diff mbox

apb: Fix compiler warnings (large constants)

Message ID 1402167282-9264-1-git-send-email-sw@weilnetz.de
State Accepted
Headers show

Commit Message

Stefan Weil June 7, 2014, 6:54 p.m. UTC
Both constants need more than 32 bit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/pci-host/apb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Cave-Ayland June 8, 2014, 12:48 p.m. UTC | #1
On 07/06/14 19:54, Stefan Weil wrote:

> Both constants need more than 32 bit.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>   hw/pci-host/apb.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
> index 1497008..6fa2723 100644
> --- a/hw/pci-host/apb.c
> +++ b/hw/pci-host/apb.c
> @@ -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.
Michael Tokarev June 8, 2014, 1:13 p.m. UTC | #2
Applied to -trivial, thank you!

/mjt
Stefan Weil June 8, 2014, 2:37 p.m. UTC | #3
Am 08.06.2014 14:48, schrieb Mark Cave-Ayland:
> On 07/06/14 19:54, Stefan Weil wrote:
> 
>> Both constants need more than 32 bit.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>   hw/pci-host/apb.c |    4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
>> index 1497008..6fa2723 100644
>> --- a/hw/pci-host/apb.c
>> +++ b/hw/pci-host/apb.c
>> @@ -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?

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

Cheers
Stefan
diff mbox

Patch

diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 1497008..6fa2723 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -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