Skip to contentSkip to conversation

xen: Use ULL for GB macro

PATCH In review Julien Grall 2 participants 3 messages May 21, 2015 – May 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Use ULL for GB macro

On 32bit, GB(4) doesn't fit on an unsigned long.

Alos, fix a couple of printf format in x86 which breaks after using unsigned long long.

---
 xen/arch/x86/apic.c      | 2 +-
 xen/arch/x86/io_apic.c   | 2 +-
 xen/include/xen/config.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/apic.c +1 -1
index 499e70f..bf0b2fe 100644
@@ -992,7 +992,7 @@ void __init init_apic_mappings(void)
         apic_phys = mp_lapic_addr;
 
     set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
-    apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", APIC_BASE,
+    apic_printk(APIC_VERBOSE, "mapped APIC to %08llx (%08lx)\n", APIC_BASE,
                 apic_phys);
 
 __next:
xen/arch/x86/io_apic.c +1 -1
index 976c0c5..1b2300a 100644
@@ -2546,7 +2546,7 @@ void __init init_ioapic_mappings(void)
             clear_page(__va(ioapic_phys));
         }
         set_fixmap_nocache(idx, ioapic_phys);
-        apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08lx)\n",
+        apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08llx (%08lx)\n",
                     __fix_to_virt(idx), ioapic_phys);
         idx++;
 
xen/include/xen/config.h +1 -1
index 6478a0a..f0746c2 100644
@@ -70,7 +70,7 @@
 #define __bitwise
 
 #define MB(_mb)     (_AC(_mb, UL) << 20)
-#define GB(_gb)     (_AC(_gb, UL) << 30)
+#define GB(_gb)     (_AC(_gb, ULL) << 30)
 
 #define __STR(...) #__VA_ARGS__
 #define STR(...) __STR(__VA_ARGS__)
Signature · 1 line
2.1.4
#1 lore raw

xen/arch/x86/apic.c void __init init_apic_mappings(void) · line 995

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 22.05.15 at 01:16, <[email protected]> wrote:
xen/arch/x86/apic.c +1 -1
@@ -992,7 +992,7 @@ void __init init_apic_mappings(void)
         apic_phys = mp_lapic_addr;
 
     set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
-    apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", APIC_BASE,
+    apic_printk(APIC_VERBOSE, "mapped APIC to %08llx (%08lx)\n", APIC_BASE,

Please use 'L' as the shorter equivalent.

xen/include/xen/config.h line 73

Quoted 8 lines
xen/include/xen/config.h +1 -1
@@ -70,7 +70,7 @@
 #define __bitwise
 
 #define MB(_mb)     (_AC(_mb, UL) << 20)
-#define GB(_gb)     (_AC(_gb, UL) << 30)
+#define GB(_gb)     (_AC(_gb, ULL) << 30)

So why do you leave MB() alone? It obviously suffers from the same problem (perhaps only latent at this point, but anyway).

Jan

#2 lore raw

Hi Jan,

Quoted 11 lines · Jan Beulich

xen/arch/x86/apic.c void __init init_apic_mappings(void) · line 995

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 22.05.15 at 01:16, <[email protected]> wrote:
xen/arch/x86/apic.c +1 -1
@@ -992,7 +992,7 @@ void __init init_apic_mappings(void)
          apic_phys = mp_lapic_addr;
 
      set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
-    apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", APIC_BASE,
+    apic_printk(APIC_VERBOSE, "mapped APIC to %08llx (%08lx)\n", APIC_BASE,

Please use 'L' as the shorter equivalent.

I didn't know this shorthand. I will use %Lx

Quoted 6 lines
Quoted 6 lines
xen/include/xen/config.h +0 -0
@@ -70,7 +70,7 @@
  #define __bitwise
 
Quoted 6 lines

xen/include/xen/config.h line 73

Quoted 3 lines
xen/include/xen/config.h +1 -1
  #define MB(_mb)     (_AC(_mb, UL) << 20)
-#define GB(_gb)     (_AC(_gb, UL) << 30)
+#define GB(_gb)     (_AC(_gb, ULL) << 30)

So why do you leave MB() alone? It obviously suffers from the same problem (perhaps only latent at this point, but anyway).

Because I haven't had any problem with MB. I will resend a new version with the 2 fixes.

Regards,

Signature · 1 line
Julien Grall