Skip to contentSkip to conversation

apb: Fix compiler warnings (large constants)

PATCH Applied Stefan Weil 3 participants 4 messages Jun 7, 2014 – Jun 8, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apb: Fix compiler warnings (large constants)

Both constants need more than 32 bit.

---
 hw/pci-host/apb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/apb.c +2 -2
index 1497008..6fa2723 100644
@@ -99,8 +99,8 @@ do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while (0)
 #define IOMMU_TTE_DATA_SIZE     (1ULL << 61)
 #define IOMMU_TTE_DATA_W        (1ULL << 1)
 
-#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000
-#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000
+#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000ULL
+#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000ULL
 
 #define IOMMU_TSB_8K_OFFSET_MASK_8M    0x00000000007fe000ULL
 #define IOMMU_TSB_8K_OFFSET_MASK_16M   0x0000000000ffe000ULL
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 12 lines · Stefan Weil

Both constants need more than 32 bit.

---
  hw/pci-host/apb.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/apb.c +0 -0
index 1497008..6fa2723 100644

hw/pci-host/apb.c do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while (0) · line 106

Quoted 10 lines
hw/pci-host/apb.c +2 -2
@@ -99,8 +99,8 @@ do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while (0)
  #define IOMMU_TTE_DATA_SIZE     (1ULL << 61)
  #define IOMMU_TTE_DATA_W        (1ULL << 1)
 
-#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000
-#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000
+#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000ULL
+#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000ULL
 
  #define IOMMU_TSB_8K_OFFSET_MASK_8M    0x00000000007fe000ULL
  #define IOMMU_TSB_8K_OFFSET_MASK_16M   0x0000000000ffe000ULL

Gah yes, physical addresses in SPARC do lie outside the 32-bit range (I guess this showed up building with a 32-bit compiler?). Is it urgent enough to warrant me sending this as a separate pull request, or can it simply be queued via trivial?

ATB,

Mark.

#2 lore raw
In reply to Mark Cave-Ayland

Am 08.06.2014 14:48, schrieb Mark Cave-Ayland:

Quoted 23 lines · Stefan Weil
Quoted 22 lines

Both constants need more than 32 bit.

---
  hw/pci-host/apb.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/apb.c +2 -2
index 1497008..6fa2723 100644
@@ -99,8 +99,8 @@ do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while
 (0)
  #define IOMMU_TTE_DATA_SIZE     (1ULL << 61)
  #define IOMMU_TTE_DATA_W        (1ULL << 1)
 
-#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000
-#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000
+#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000ULL
+#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000ULL
 
Quoted 7 lines
Quoted 2 lines
hw/pci-host/apb.c +0 -0
  #define IOMMU_TSB_8K_OFFSET_MASK_8M    0x00000000007fe000ULL
  #define IOMMU_TSB_8K_OFFSET_MASK_16M   0x0000000000ffe000ULL

Gah yes, physical addresses in SPARC do lie outside the 32-bit range (I guess this showed up building with a 32-bit compiler?). Is it urgent enough to warrant me sending this as a separate pull request, or can it simply be queued via trivial?

It's not urgent, was detected by smatch (static code analyser), and is already queued via trivial (thanks, Michael).

Cheers
Stefan