qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/riscv: fix build error with clang


From: Daniel Henrique Barboza
Subject: Re: [PATCH] hw/riscv: fix build error with clang
Date: Fri, 1 Nov 2024 14:38:33 -0300
User-agent: Mozilla Thunderbird



On 11/1/24 2:35 PM, Daniel Henrique Barboza wrote:


On 11/1/24 2:08 PM, Pierrick Bouvier wrote:
Introduced in 0c54ac, "hw/riscv: add RISC-V IOMMU base emulation"

../hw/riscv/riscv-iommu.c:187:17: error: redefinition of '_pext_u64'

   187 | static uint64_t _pext_u64(uint64_t val, uint64_t ext)

       |                 ^

D:/a/_temp/msys64/clang64/lib/clang/18/include/bmi2intrin.h:217:1: note: 
previous definition is here

   217 | _pext_u64(unsigned long long __X, unsigned long long __Y)

       | ^

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>


I think you can also add a

Fixes: 0c54acb824 ("hw/riscv: add RISC-V IOMMU base emulation")

---
  hw/riscv/riscv-iommu.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
index feb650549ac..f738570bac2 100644
--- a/hw/riscv/riscv-iommu.c
+++ b/hw/riscv/riscv-iommu.c
@@ -184,7 +184,7 @@ static void riscv_iommu_pri(RISCVIOMMUState *s,
  }
  /* Portable implementation of pext_u64, bit-mask extraction. */
-static uint64_t _pext_u64(uint64_t val, uint64_t ext)
+static uint64_t pext_u64(uint64_t val, uint64_t ext)

I suggest name it 'riscv_iommu_pext_u64' to be clear that this is a local scope 
function,
not to be mistaken with anything available in clang or any other compiler.


Thanks,

Daniel

  {
      uint64_t ret = 0;
      uint64_t rot = 1;
@@ -528,7 +528,7 @@ static MemTxResult riscv_iommu_msi_write(RISCVIOMMUState *s,
      int cause;
      /* Interrupt File Number */
-    intn = _pext_u64(PPN_DOWN(gpa), ctx->msi_addr_mask);
+    intn = pext_u64(PPN_DOWN(gpa), ctx->msi_addr_mask);
      if (intn >= 256) {
          /* Interrupt file number out of range */
          res = MEMTX_ACCESS_ERROR;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]