Skip to contentSkip to conversation

Remove 32bit support on system/user emulations

PATCH In review Peter Xu 5 participants 26 messages Aug 18 – Aug 24

Subsystems (2)
lore
Share & tools
lore

Peter Xu

author
#0 lore raw

v2 cover Remove 32bit support on system/user emulations

v1: https://lore.kernel.org/r/[email protected]

In v2, I touched up the original patch per suggested. Then I added some more patches, almost quickly looking at references of HOST_LONG_BITS and clean up those I feel confident about over 32bits. I still left some there (dev-properties, qht, etc.) which smells like tools may still use them.

Please have a look, thanks.

Peter Xu (9):
system: Define ram_addr_t to be always uint64_t hw/vexpress.c: Remove forced cast to u64
arm/mps: Remove 32bit define for MPS3_DDR_SIZE
xen-mapcache: Remove 32bit support
bsd-user: Remove 32bit host support in thunk_convert|print()
linux-user: Remove 32bit host support in thunk_convert|print() arm/aspeed: Drop ASPEED_RAM_SIZE
hw/arm/raspi4b: Drop board_rev for 32bit hosts
machine: Remove 32bit limitation on ram size

 include/hw/arm/aspeed.h           |  7 -----
 include/system/ram_addr.h         | 16 +++++------
 bsd-user/thunk.c                  | 47 ++-----------------------------
 hw/arm/aspeed_ast2600_anacapa.c   |  2 +-
 hw/arm/aspeed_ast2600_bletchley.c |  2 +-
 hw/arm/aspeed_ast2600_catalina.c  |  2 +-
 hw/arm/aspeed_ast2600_fby35.c     |  2 +-
 hw/arm/aspeed_ast2600_fuji.c      |  2 +-
 hw/arm/aspeed_ast2600_gb200nvl.c  |  2 +-
 hw/arm/mps2-tz.c                  |  9 ------
 hw/arm/mps3r.c                    |  8 ------
 hw/arm/raspi4b.c                  |  4 ---
 hw/arm/vexpress.c                 | 13 ++-------
 hw/core/machine.c                 |  8 ------
 hw/xen/xen-mapcache.c             | 12 ++------
 linux-user/thunk.c                | 47 ++-----------------------------
 16 files changed, 24 insertions(+), 159 deletions(-)
Signature · 1 line
2.54.0
author
#1 lore raw

PATCH v2 1/9 system: Define ram_addr_t to be always uint64_t

QEMU's 32bit host support was deprecated since 10.0 and removed in 11.0 (commit 372ec46b9f), at least system emulation part (cf634dfcd8fc revived tools). Now it's safe to move ram_addr_t completely over to uint64_t.

It should be almost the same as uintptr_t as before for !Xen, except that on some systems (like MacOS) uintptr_t and uint64_t can be typed slightly differently, causing unnecessary compiler warnings when use them in a mixture way.

Hopefully, this change also makes it clear that ram_addr_t is never used as a host pointer in any form, but only an internal QEMU integer based address space for allocating ramblocks.

[1] https://lore.kernel.org/r/[email protected]

---
 include/system/ram_addr.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
include/system/ram_addr.h +7 -9
index 129f6b8757..044c0b52cc 100644
@@ -14,16 +14,14 @@
 #ifndef RAM_ADDR_H
 #define RAM_ADDR_H
 
-/* address in the RAM (different from a physical address) */
-#if defined(CONFIG_XEN_BACKEND)
+/*
+ * QEMU's internal RAM address space for ramblock allocations (different
+ * from guest physical address).
+ */
 typedef uint64_t ram_addr_t;
-#  define RAM_ADDR_MAX UINT64_MAX
-#  define RAM_ADDR_FMT "%" PRIx64
-#else
-typedef uintptr_t ram_addr_t;
-#  define RAM_ADDR_MAX UINTPTR_MAX
-#  define RAM_ADDR_FMT "%" PRIxPTR
-#endif
+
+#define RAM_ADDR_MAX UINT64_MAX
+#define RAM_ADDR_FMT "%" PRIx64
 
 #define DIRTY_MEMORY_VGA       0
 #define DIRTY_MEMORY_CODE      1
Signature · 1 line
2.54.0
author
#2 lore raw

PATCH v2 2/9 hw/vexpress.c: Remove forced cast to u64

In reply to Peter Xu

Now since ram_addr_t has switched to u64, remove the forced cast as not needed.

---
 hw/arm/vexpress.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
hw/arm/vexpress.c +3 -10
index f26d8c6f8d..a6ce426356 100644
@@ -363,16 +363,9 @@ static void a15_daughterboard_init(VexpressMachineState *vms,
     MachineState *machine = MACHINE(vms);
     MemoryRegion *sysmem = get_system_memory();
 
-    {
-        /* We have to use a separate 64 bit variable here to avoid the gcc
-         * "comparison is always false due to limited range of data type"
-         * warning if we are on a host where ram_addr_t is 32 bits.
-         */
-        uint64_t rsz = ram_size;
-        if (rsz > (30ULL * 1024 * 1024 * 1024)) {
-            error_report("vexpress-a15: cannot model more than 30GB RAM");
-            exit(1);
-        }
+    if (ram_size > (30ULL * 1024 * 1024 * 1024)) {
+        error_report("vexpress-a15: cannot model more than 30GB RAM");
+        exit(1);
     }
 
     /* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */
Signature · 1 line
2.54.0
Reviewed-by on v2 2/9
#3 lore raw

Re: [PATCH v2 2/9] hw/vexpress.c: Remove forced cast to u64

Quoted 18 lines · Peter Xu

Now since ram_addr_t has switched to u64, remove the forced cast as not needed.

---
  hw/arm/vexpress.c | 13 +++----------
  1 file changed, 3 insertions(+), 10 deletions(-)
hw/arm/vexpress.c +0 -1
index f26d8c6f8d..a6ce426356 100644
@@ -363,16 +363,9 @@ static void a15_daughterboard_init(VexpressMachineState *vms,
      MachineState *machine = MACHINE(vms);
      MemoryRegion *sysmem = get_system_memory();
 
-    {

hw/arm/vexpress.c static void a15_daughterboard_init(VexpressMachineState *vms, · line 366

Quoted 10 lines
hw/arm/vexpress.c +1 -9
-        /* We have to use a separate 64 bit variable here to avoid the gcc
-         * "comparison is always false due to limited range of data type"
-         * warning if we are on a host where ram_addr_t is 32 bits.
-         */
-        uint64_t rsz = ram_size;
-        if (rsz > (30ULL * 1024 * 1024 * 1024)) {
-            error_report("vexpress-a15: cannot model more than 30GB RAM");
-            exit(1);
-        }
+    if (ram_size > (30ULL * 1024 * 1024 * 1024)) {

Note we have a more readable GiB definition in "qemu/units.h":

  #define GiB     (INT64_C(1) << 30)

Regardless:

Quoted 3 lines
hw/arm/vexpress.c +2 -0
+        error_report("vexpress-a15: cannot model more than 30GB RAM");
+        exit(1);
      }
Reviewed-by on v2 2/9
#4 lore raw

Re: [PATCH v2 2/9] hw/vexpress.c: Remove forced cast to u64

In reply to Peter Xu
Quoted 8 lines · Peter Xu

Now since ram_addr_t has switched to u64, remove the forced cast as not needed.

---
  hw/arm/vexpress.c | 13 +++----------
  1 file changed, 3 insertions(+), 10 deletions(-)

r~

Quoted 25 lines
hw/arm/vexpress.c +3 -10
index f26d8c6f8d..a6ce426356 100644
@@ -363,16 +363,9 @@ static void a15_daughterboard_init(VexpressMachineState *vms,
      MachineState *machine = MACHINE(vms);
      MemoryRegion *sysmem = get_system_memory();
 
-    {
-        /* We have to use a separate 64 bit variable here to avoid the gcc
-         * "comparison is always false due to limited range of data type"
-         * warning if we are on a host where ram_addr_t is 32 bits.
-         */
-        uint64_t rsz = ram_size;
-        if (rsz > (30ULL * 1024 * 1024 * 1024)) {
-            error_report("vexpress-a15: cannot model more than 30GB RAM");
-            exit(1);
-        }
+    if (ram_size > (30ULL * 1024 * 1024 * 1024)) {
+        error_report("vexpress-a15: cannot model more than 30GB RAM");
+        exit(1);
      }
 
      /* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */
author
#5 lore raw

PATCH v2 3/9 arm/mps: Remove 32bit define for MPS3_DDR_SIZE

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system emulations.

---
 hw/arm/mps2-tz.c | 9 ---------
 hw/arm/mps3r.c   | 8 --------
 2 files changed, 17 deletions(-)
hw/arm/mps2-tz.c +0 -9
index d6d178642b..f47b0cacb8 100644
@@ -178,16 +178,7 @@ OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineClass, MPS2TZ_MACHINE)
 
 /* Slow 32Khz S32KCLK frequency in Hz */
 #define S32KCLK_FRQ (32 * 1000)
-
-/*
- * The MPS3 DDR is 2GiB, but on a 32-bit host QEMU doesn't permit
- * emulation of that much guest RAM, so artificially make it smaller.
- */
-#if HOST_LONG_BITS == 32
-#define MPS3_DDR_SIZE (1 * GiB)
-#else
 #define MPS3_DDR_SIZE (2 * GiB)
-#endif
 
 /* For cpu{0,1}_mpu_{ns,s}, means "leave at SSE's default value" */
 #define MPU_REGION_DEFAULT UINT32_MAX
hw/arm/mps3r.c +0 -8
index caad820d3b..82a354e958 100644
@@ -59,15 +59,7 @@ typedef struct RAMInfo {
     int flags;
 } RAMInfo;
 
-/*
- * The MPS3 DDR is 3GiB, but on a 32-bit host QEMU doesn't permit
- * emulation of that much guest RAM, so artificially make it smaller.
- */
-#if HOST_LONG_BITS == 32
-#define MPS3_DDR_SIZE (1 * GiB)
-#else
 #define MPS3_DDR_SIZE (3 * GiB)
-#endif
 
 /*
  * Flag values:
Signature · 1 line
2.54.0
Reviewed-by on v2 3/9
#7 lore raw

Re: [PATCH v2 3/9] arm/mps: Remove 32bit define for MPS3_DDR_SIZE

In reply to Peter Xu
Quoted 7 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system emulations.

---
  hw/arm/mps2-tz.c | 9 ---------
  hw/arm/mps3r.c   | 8 --------
  2 files changed, 17 deletions(-)

r~

Quoted 42 lines
hw/arm/mps2-tz.c +0 -9
index d6d178642b..f47b0cacb8 100644
@@ -178,16 +178,7 @@ OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineClass, MPS2TZ_MACHINE)
 
  /* Slow 32Khz S32KCLK frequency in Hz */
  #define S32KCLK_FRQ (32 * 1000)
-
-/*
- * The MPS3 DDR is 2GiB, but on a 32-bit host QEMU doesn't permit
- * emulation of that much guest RAM, so artificially make it smaller.
- */
-#if HOST_LONG_BITS == 32
-#define MPS3_DDR_SIZE (1 * GiB)
-#else
  #define MPS3_DDR_SIZE (2 * GiB)
-#endif
 
  /* For cpu{0,1}_mpu_{ns,s}, means "leave at SSE's default value" */
  #define MPU_REGION_DEFAULT UINT32_MAX
hw/arm/mps3r.c +0 -8
index caad820d3b..82a354e958 100644
@@ -59,15 +59,7 @@ typedef struct RAMInfo {
      int flags;
  } RAMInfo;
 
-/*
- * The MPS3 DDR is 3GiB, but on a 32-bit host QEMU doesn't permit
- * emulation of that much guest RAM, so artificially make it smaller.
- */
-#if HOST_LONG_BITS == 32
-#define MPS3_DDR_SIZE (1 * GiB)
-#else
  #define MPS3_DDR_SIZE (3 * GiB)
-#endif
 
  /*
   * Flag values:
author
#8 lore raw

PATCH v2 4/9 xen-mapcache: Remove 32bit support

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system emulations.

---
 hw/xen/xen-mapcache.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
hw/xen/xen-mapcache.c +2 -10
index 85cf0cf359..e30c07c2ee 100644
@@ -26,11 +26,7 @@
 #include <xenevtchn.h>
 #include <xengnttab.h>
 
-#if HOST_LONG_BITS == 32
-#  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
-#else
-#  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
-#endif
+#define MCACHE_MAX_SIZE     (1UL << 35) /* 32GB Cap */
 
 /* This is the size of the virtual address space reserve to QEMU that will not
  * be use by MapCache.
@@ -151,11 +147,7 @@ void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque)
         exit(EXIT_FAILURE);
     }
 
-    if (HOST_LONG_BITS == 32) {
-        bucket_shift = 16;
-    } else {
-        bucket_shift = 20;
-    }
+    bucket_shift = 20;
 
     if (geteuid() == 0) {
         rlimit_as.rlim_cur = RLIM_INFINITY;
Signature · 1 line
2.54.0
Reviewed-by on v2 4/9
#9 lore raw

Re: [PATCH v2 4/9] xen-mapcache: Remove 32bit support

Quoted 6 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system emulations.

---
  hw/xen/xen-mapcache.c | 12 ++----------
  1 file changed, 2 insertions(+), 10 deletions(-)

r~

Quoted 31 lines
hw/xen/xen-mapcache.c +2 -10
index 85cf0cf359..e30c07c2ee 100644
@@ -26,11 +26,7 @@
  #include <xenevtchn.h>
  #include <xengnttab.h>
 
-#if HOST_LONG_BITS == 32
-#  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
-#else
-#  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
-#endif
+#define MCACHE_MAX_SIZE     (1UL << 35) /* 32GB Cap */
 
  /* This is the size of the virtual address space reserve to QEMU that will not
   * be use by MapCache.
@@ -151,11 +147,7 @@ void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque)
          exit(EXIT_FAILURE);
      }
 
-    if (HOST_LONG_BITS == 32) {
-        bucket_shift = 16;
-    } else {
-        bucket_shift = 20;
-    }
+    bucket_shift = 20;
 
      if (geteuid() == 0) {
          rlimit_as.rlim_cur = RLIM_INFINITY;
author
#10 lore raw

PATCH v2 5/9 bsd-user: Remove 32bit host support in thunk_convert|print()

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
 bsd-user/thunk.c | 47 +++--------------------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)
bsd-user/thunk.c +3 -44
index 3c89ae3ab8..6703286609 100644
@@ -134,13 +134,7 @@ const argtype *thunk_convert(void *dst, const void *src,
     case TYPE_ULONGLONG:
         *(uint64_t *)dst = tswap64(*(uint64_t *)src);
         break;
-#if HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 32
-    case TYPE_LONG:
-    case TYPE_ULONG:
-    case TYPE_PTRVOID:
-        *(uint32_t *)dst = tswap32(*(uint32_t *)src);
-        break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
+#if TARGET_ABI_BITS == 32
     case TYPE_LONG:
     case TYPE_ULONG:
     case TYPE_PTRVOID:
@@ -155,27 +149,12 @@ const argtype *thunk_convert(void *dst, const void *src,
             *(uint32_t *)dst = tswap32(*(uint64_t *)src & 0xffffffff);
         }
         break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#elif TARGET_ABI_BITS == 64
     case TYPE_LONG:
     case TYPE_ULONG:
     case TYPE_PTRVOID:
         *(uint64_t *)dst = tswap64(*(uint64_t *)src);
         break;
-#elif HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 64
-    case TYPE_LONG:
-    case TYPE_ULONG:
-    case TYPE_PTRVOID:
-        if (to_host) {
-            *(uint32_t *)dst = tswap64(*(uint64_t *)src);
-        } else {
-            if (type == TYPE_LONG) {
-                /* sign extension */
-                *(uint64_t *)dst = tswap64(*(int32_t *)src);
-            } else {
-                *(uint64_t *)dst = tswap64(*(uint32_t *)src);
-            }
-        }
-        break;
 #else
 #warning unsupported conversion
 #endif
@@ -283,17 +262,7 @@ const argtype *thunk_print(void *arg, const argtype *type_ptr)
     case TYPE_ULONGLONG:
         qemu_log("%" PRIu64, tswap64(*(uint64_t *)arg));
         break;
-#if HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 32
-    case TYPE_PTRVOID:
-        qemu_log("0x%" PRIx32, tswap32(*(uint32_t *)arg));
-        break;
-    case TYPE_LONG:
-        qemu_log("%" PRId32, tswap32(*(uint32_t *)arg));
-        break;
-    case TYPE_ULONG:
-        qemu_log("%" PRIu32, tswap32(*(uint32_t *)arg));
-        break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
+#if TARGET_ABI_BITS == 32
     case TYPE_PTRVOID:
         qemu_log("0x%" PRIx32, tswap32(*(uint64_t *)arg & 0xffffffff));
         break;
@@ -303,16 +272,6 @@ const argtype *thunk_print(void *arg, const argtype *type_ptr)
     case TYPE_ULONG:
         qemu_log("%" PRIu32, tswap32(*(uint64_t *)arg & 0xffffffff));
         break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
-    case TYPE_PTRVOID:
-        qemu_log("0x%" PRIx64, tswap64(*(uint64_t *)arg));
-        break;
-    case TYPE_LONG:
-        qemu_log("%" PRId64, tswap64(*(uint64_t *)arg));
-        break;
-    case TYPE_ULONG:
-        qemu_log("%" PRIu64, tswap64(*(uint64_t *)arg));
-        break;
 #else
     case TYPE_PTRVOID:
         qemu_log("0x%" PRIx64, tswap64(*(uint64_t *)arg));
Signature · 1 line
2.54.0
Reviewed-by on v2 5/9
#11 lore raw

Re: [PATCH v2 5/9] bsd-user: Remove 32bit host support in thunk_convert|print()

Quoted 6 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
  bsd-user/thunk.c | 47 +++--------------------------------------------
  1 file changed, 3 insertions(+), 44 deletions(-)

r~

Reviewed-by
#12 lore raw

Re: [PATCH v2 5/9] bsd-user: Remove 32bit host support in thunk_convert|print()

Quoted 10 lines · Richard Henderson
Quoted 6 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
  bsd-user/thunk.c | 47 +++--------------------------------------------
  1 file changed, 3 insertions(+), 44 deletions(-)

r~

Quoted 2 lines
author
#13 lore raw

PATCH v2 6/9 linux-user: Remove 32bit host support in thunk_convert|print()

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
 linux-user/thunk.c | 47 +++-------------------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)
linux-user/thunk.c +3 -44
index 3cd19e79c6..892ff3d154 100644
@@ -145,13 +145,7 @@ const argtype *thunk_convert(void *dst, const void *src,
     case TYPE_ULONGLONG:
         *(uint64_t *)dst = tswap64(*(uint64_t *)src);
         break;
-#if HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 32
-    case TYPE_LONG:
-    case TYPE_ULONG:
-    case TYPE_PTRVOID:
-        *(uint32_t *)dst = tswap32(*(uint32_t *)src);
-        break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
+#if TARGET_ABI_BITS == 32
     case TYPE_LONG:
     case TYPE_ULONG:
     case TYPE_PTRVOID:
@@ -166,27 +160,12 @@ const argtype *thunk_convert(void *dst, const void *src,
             *(uint32_t *)dst = tswap32(*(uint64_t *)src & 0xffffffff);
         }
         break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#elif TARGET_ABI_BITS == 64
     case TYPE_LONG:
     case TYPE_ULONG:
     case TYPE_PTRVOID:
         *(uint64_t *)dst = tswap64(*(uint64_t *)src);
         break;
-#elif HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 64
-    case TYPE_LONG:
-    case TYPE_ULONG:
-    case TYPE_PTRVOID:
-        if (to_host) {
-            *(uint32_t *)dst = tswap64(*(uint64_t *)src);
-        } else {
-            if (type == TYPE_LONG) {
-                /* sign extension */
-                *(uint64_t *)dst = tswap64(*(int32_t *)src);
-            } else {
-                *(uint64_t *)dst = tswap64(*(uint32_t *)src);
-            }
-        }
-        break;
 #else
 #warning unsupported conversion
 #endif
@@ -294,17 +273,7 @@ const argtype *thunk_print(void *arg, const argtype *type_ptr)
     case TYPE_ULONGLONG:
         qemu_log("%" PRIu64, tswap64(*(uint64_t *)arg));
         break;
-#if HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 32
-    case TYPE_PTRVOID:
-        qemu_log("0x%" PRIx32, tswap32(*(uint32_t *)arg));
-        break;
-    case TYPE_LONG:
-        qemu_log("%" PRId32, tswap32(*(uint32_t *)arg));
-        break;
-    case TYPE_ULONG:
-        qemu_log("%" PRIu32, tswap32(*(uint32_t *)arg));
-        break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
+#if TARGET_ABI_BITS == 32
     case TYPE_PTRVOID:
         qemu_log("0x%" PRIx32, tswap32(*(uint64_t *)arg & 0xffffffff));
         break;
@@ -314,16 +283,6 @@ const argtype *thunk_print(void *arg, const argtype *type_ptr)
     case TYPE_ULONG:
         qemu_log("%" PRIu32, tswap32(*(uint64_t *)arg & 0xffffffff));
         break;
-#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
-    case TYPE_PTRVOID:
-        qemu_log("0x%" PRIx64, tswap64(*(uint64_t *)arg));
-        break;
-    case TYPE_LONG:
-        qemu_log("%" PRId64, tswap64(*(uint64_t *)arg));
-        break;
-    case TYPE_ULONG:
-        qemu_log("%" PRIu64, tswap64(*(uint64_t *)arg));
-        break;
 #else
     case TYPE_PTRVOID:
         qemu_log("0x%" PRIx64, tswap64(*(uint64_t *)arg));
Signature · 1 line
2.54.0
Reviewed-by on v2 6/9
#14 lore raw

Re: [PATCH v2 6/9] linux-user: Remove 32bit host support in thunk_convert|print()

Quoted 6 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
  linux-user/thunk.c | 47 +++-------------------------------------------
  1 file changed, 3 insertions(+), 44 deletions(-)

r~

author
#15 lore raw

PATCH v2 7/9 arm/aspeed: Drop ASPEED_RAM_SIZE

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations. It's not needed anymore.

---
 include/hw/arm/aspeed.h           | 7 -------
 hw/arm/aspeed_ast2600_anacapa.c   | 2 +-
 hw/arm/aspeed_ast2600_bletchley.c | 2 +-
 hw/arm/aspeed_ast2600_catalina.c  | 2 +-
 hw/arm/aspeed_ast2600_fby35.c     | 2 +-
 hw/arm/aspeed_ast2600_fuji.c      | 2 +-
 hw/arm/aspeed_ast2600_gb200nvl.c  | 2 +-
 7 files changed, 6 insertions(+), 13 deletions(-)
include/hw/arm/aspeed.h +0 -7
index a00238ed74..7a012d87de 100644
@@ -25,13 +25,6 @@ DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
 #define ASPEED_MAC2_ON   (1 << 2)
 #define ASPEED_MAC3_ON   (1 << 3)
 
-/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */
-#if HOST_LONG_BITS == 32
-#define ASPEED_RAM_SIZE(sz) MIN((sz), 1 * GiB)
-#else
-#define ASPEED_RAM_SIZE(sz) (sz)
-#endif
-
 struct AspeedMachineState {
     MachineState parent_obj;
 
hw/arm/aspeed_ast2600_anacapa.c +1 -1
index 65d6b0faa2..45f7a25efd 100644
@@ -18,7 +18,7 @@
 
 #define ANACAPA_BMC_HW_STRAP1 0x00002002
 #define ANACAPA_BMC_HW_STRAP2 0x00000000
-#define ANACAPA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define ANACAPA_BMC_RAM_SIZE (2 * GiB)
 
 /*
  * "Anacapa HPM (MB)" FRU data. Generated with frugen.
hw/arm/aspeed_ast2600_bletchley.c +1 -1
index b7e84db143..8f9061c472 100644
@@ -18,7 +18,7 @@
 /* Bletchley hardware value */
 #define BLETCHLEY_BMC_HW_STRAP1 0x00002000
 #define BLETCHLEY_BMC_HW_STRAP2 0x00000801
-#define BLETCHLEY_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define BLETCHLEY_BMC_RAM_SIZE (2 * GiB)
 
 static void bletchley_bmc_i2c_init(AspeedMachineState *bmc)
 {
hw/arm/aspeed_ast2600_catalina.c +1 -1
index f714c9d1b3..c328997668 100644
@@ -20,7 +20,7 @@
 /* Catalina hardware value */
 #define CATALINA_BMC_HW_STRAP1 0x00002002
 #define CATALINA_BMC_HW_STRAP2 0x00000800
-#define CATALINA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define CATALINA_BMC_RAM_SIZE (2 * GiB)
 
 #define TYPE_TMP75 TYPE_TMP105
 #define TYPE_TMP421 "tmp421"
hw/arm/aspeed_ast2600_fby35.c +1 -1
index f624427070..1d546b1f0a 100644
@@ -17,7 +17,7 @@
 
 #define TYPE_LM75 TYPE_TMP105
 #define TYPE_TMP421 "tmp421"
-#define FBY35_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define FBY35_BMC_RAM_SIZE (2 * GiB)
 
 static const uint8_t fby35_nic_fruid[] = {
     0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
hw/arm/aspeed_ast2600_fuji.c +1 -1
index 37db252e27..cb987e2eff 100644
@@ -22,7 +22,7 @@
 /* Fuji hardware value */
 #define FUJI_BMC_HW_STRAP1    0x00000000
 #define FUJI_BMC_HW_STRAP2    0x00000000
-#define FUJI_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define FUJI_BMC_RAM_SIZE (2 * GiB)
 
 static void get_pca9548_channels(I2CBus *bus, uint8_t mux_addr,
                                  I2CBus **channels)
hw/arm/aspeed_ast2600_gb200nvl.c +1 -1
index ad9a10110b..7abd934624 100644
@@ -16,7 +16,7 @@
 /* GB200NVL hardware value */
 #define GB200NVL_BMC_HW_STRAP1 0x000000C0
 #define GB200NVL_BMC_HW_STRAP2 0x00000003
-#define GB200NVL_BMC_RAM_SIZE ASPEED_RAM_SIZE(1 * GiB)
+#define GB200NVL_BMC_RAM_SIZE (1 * GiB)
 
 static const uint8_t gb200nvl_bmc_fruid[] = {
     0x01, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0xf3, 0x01, 0x0a, 0x19, 0x1f,
Signature · 1 line
2.54.0
Reviewed-by on v2 7/9
#16 lore raw

Re: [PATCH v2 7/9] arm/aspeed: Drop ASPEED_RAM_SIZE

Quoted 19 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations. It's not needed anymore.

---
  include/hw/arm/aspeed.h           | 7 -------
  hw/arm/aspeed_ast2600_anacapa.c   | 2 +-
  hw/arm/aspeed_ast2600_bletchley.c | 2 +-
  hw/arm/aspeed_ast2600_catalina.c  | 2 +-
  hw/arm/aspeed_ast2600_fby35.c     | 2 +-
  hw/arm/aspeed_ast2600_fuji.c      | 2 +-
  hw/arm/aspeed_ast2600_gb200nvl.c  | 2 +-
  7 files changed, 6 insertions(+), 13 deletions(-)
include/hw/arm/aspeed.h +0 -0
index a00238ed74..7a012d87de 100644

include/hw/arm/aspeed.h DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass, · line 30

Quoted 6 lines
include/hw/arm/aspeed.h +0 -3
@@ -25,13 +25,6 @@ DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
  #define ASPEED_MAC2_ON   (1 << 2)
  #define ASPEED_MAC3_ON   (1 << 3)
 
-/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */
-#if HOST_LONG_BITS == 32
-#define ASPEED_RAM_SIZE(sz) MIN((sz), 1 * GiB)

Indeed now dead code.

Quoted 3 lines
include/hw/arm/aspeed.h +0 -3
-#else
-#define ASPEED_RAM_SIZE(sz) (sz)
-#endif
Reviewed-by on v2 7/9
#17 lore raw

Re: [PATCH v2 7/9] arm/aspeed: Drop ASPEED_RAM_SIZE

In reply to Peter Xu
Quoted 102 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations. It's not needed anymore.

---
  include/hw/arm/aspeed.h           | 7 -------
  hw/arm/aspeed_ast2600_anacapa.c   | 2 +-
  hw/arm/aspeed_ast2600_bletchley.c | 2 +-
  hw/arm/aspeed_ast2600_catalina.c  | 2 +-
  hw/arm/aspeed_ast2600_fby35.c     | 2 +-
  hw/arm/aspeed_ast2600_fuji.c      | 2 +-
  hw/arm/aspeed_ast2600_gb200nvl.c  | 2 +-
  7 files changed, 6 insertions(+), 13 deletions(-)
include/hw/arm/aspeed.h +0 -7
index a00238ed74..7a012d87de 100644
@@ -25,13 +25,6 @@ DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
  #define ASPEED_MAC2_ON   (1 << 2)
  #define ASPEED_MAC3_ON   (1 << 3)
 
-/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */
-#if HOST_LONG_BITS == 32
-#define ASPEED_RAM_SIZE(sz) MIN((sz), 1 * GiB)
-#else
-#define ASPEED_RAM_SIZE(sz) (sz)
-#endif
-
  struct AspeedMachineState {
      MachineState parent_obj;
 
hw/arm/aspeed_ast2600_anacapa.c +1 -1
index 65d6b0faa2..45f7a25efd 100644
@@ -18,7 +18,7 @@
 
  #define ANACAPA_BMC_HW_STRAP1 0x00002002
  #define ANACAPA_BMC_HW_STRAP2 0x00000000
-#define ANACAPA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define ANACAPA_BMC_RAM_SIZE (2 * GiB)
 
  /*
   * "Anacapa HPM (MB)" FRU data. Generated with frugen.
hw/arm/aspeed_ast2600_bletchley.c +1 -1
index b7e84db143..8f9061c472 100644
@@ -18,7 +18,7 @@
  /* Bletchley hardware value */
  #define BLETCHLEY_BMC_HW_STRAP1 0x00002000
  #define BLETCHLEY_BMC_HW_STRAP2 0x00000801
-#define BLETCHLEY_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define BLETCHLEY_BMC_RAM_SIZE (2 * GiB)
 
  static void bletchley_bmc_i2c_init(AspeedMachineState *bmc)
  {
hw/arm/aspeed_ast2600_catalina.c +1 -1
index f714c9d1b3..c328997668 100644
@@ -20,7 +20,7 @@
  /* Catalina hardware value */
  #define CATALINA_BMC_HW_STRAP1 0x00002002
  #define CATALINA_BMC_HW_STRAP2 0x00000800
-#define CATALINA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define CATALINA_BMC_RAM_SIZE (2 * GiB)
 
  #define TYPE_TMP75 TYPE_TMP105
  #define TYPE_TMP421 "tmp421"
hw/arm/aspeed_ast2600_fby35.c +1 -1
index f624427070..1d546b1f0a 100644
@@ -17,7 +17,7 @@
 
  #define TYPE_LM75 TYPE_TMP105
  #define TYPE_TMP421 "tmp421"
-#define FBY35_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define FBY35_BMC_RAM_SIZE (2 * GiB)
 
  static const uint8_t fby35_nic_fruid[] = {
      0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
hw/arm/aspeed_ast2600_fuji.c +1 -1
index 37db252e27..cb987e2eff 100644
@@ -22,7 +22,7 @@
  /* Fuji hardware value */
  #define FUJI_BMC_HW_STRAP1    0x00000000
  #define FUJI_BMC_HW_STRAP2    0x00000000
-#define FUJI_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
+#define FUJI_BMC_RAM_SIZE (2 * GiB)
 
  static void get_pca9548_channels(I2CBus *bus, uint8_t mux_addr,
                                   I2CBus **channels)
hw/arm/aspeed_ast2600_gb200nvl.c +0 -0
index ad9a10110b..7abd934624 100644

hw/arm/aspeed_ast2600_gb200nvl.c line 22

Quoted 8 lines
hw/arm/aspeed_ast2600_gb200nvl.c +1 -1
@@ -16,7 +16,7 @@
  /* GB200NVL hardware value */
  #define GB200NVL_BMC_HW_STRAP1 0x000000C0
  #define GB200NVL_BMC_HW_STRAP2 0x00000003
-#define GB200NVL_BMC_RAM_SIZE ASPEED_RAM_SIZE(1 * GiB)
+#define GB200NVL_BMC_RAM_SIZE (1 * GiB)
 
  static const uint8_t gb200nvl_bmc_fruid[] = {
      0x01, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0xf3, 0x01, 0x0a, 0x19, 0x1f,

Thanks,

C.

author
#18 lore raw

PATCH v2 8/9 hw/arm/raspi4b: Drop board_rev for 32bit hosts

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
 hw/arm/raspi4b.c | 4 ----
 1 file changed, 4 deletions(-)
hw/arm/raspi4b.c +0 -4
index e1595a875f..5f7abbb4c4 100644
@@ -111,11 +111,7 @@ static void raspi4b_machine_class_init(ObjectClass *oc, const void *data)
     MachineClass *mc = MACHINE_CLASS(oc);
     RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
 
-#if HOST_LONG_BITS == 32
-    rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */
-#else
     rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */
-#endif
     raspi_machine_class_common_init(mc, rmc->board_rev);
     mc->auto_create_sdcard = true;
     mc->init = raspi4b_machine_init;
Signature · 1 line
2.54.0
Reviewed-by on v2 8/9
#19 lore raw

Re: [PATCH v2 8/9] hw/arm/raspi4b: Drop board_rev for 32bit hosts

Quoted 12 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
  hw/arm/raspi4b.c | 4 ----
  1 file changed, 4 deletions(-)
hw/arm/raspi4b.c +0 -0
index e1595a875f..5f7abbb4c4 100644

hw/arm/raspi4b.c static void raspi4b_machine_class_init(ObjectClass *oc, const void *data) · line 115

Quoted 9 lines
hw/arm/raspi4b.c +0 -4
@@ -111,11 +111,7 @@ static void raspi4b_machine_class_init(ObjectClass *oc, const void *data)
      MachineClass *mc = MACHINE_CLASS(oc);
      RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
 
-#if HOST_LONG_BITS == 32
-    rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */
-#else
      rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */
-#endif
      raspi_machine_class_common_init(mc, rmc->board_rev);

Here I'd rather keep the machine. IIRC someone already suggested to adapt the board_rev with the CLI provided memory size. An improvement for tomorrow, meanwhile:

author
#20 lore raw

Re: [PATCH v2 8/9] hw/arm/raspi4b: Drop board_rev for 32bit hosts

Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
  hw/arm/raspi4b.c | 4 ----
  1 file changed, 4 deletions(-)
hw/arm/raspi4b.c +0 -0
index e1595a875f..5f7abbb4c4 100644

hw/arm/raspi4b.c static void raspi4b_machine_class_init(ObjectClass *oc, const void *data) · line 114

Quoted 8 lines
hw/arm/raspi4b.c +0 -4
@@ -111,11 +111,7 @@ static void raspi4b_machine_class_init(ObjectClass *oc, const void *data)
      MachineClass *mc = MACHINE_CLASS(oc);
      RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
-#if HOST_LONG_BITS == 32
-    rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */
-#else
      rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */
-#endif
      raspi_machine_class_common_init(mc, rmc->board_rev);

Here I'd rather keep the machine. IIRC someone already suggested to adapt the board_rev with the CLI provided memory size. An improvement for tomorrow, meanwhile:

Quoted 1 line

Sure, I can also drop this one for now. Thanks,

Signature · 1 line
Peter Xu
#21 lore raw

Re: [PATCH v2 8/9] hw/arm/raspi4b: Drop board_rev for 32bit hosts

Quoted 27 lines · Peter Xu
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
   hw/arm/raspi4b.c | 4 ----
   1 file changed, 4 deletions(-)
hw/arm/raspi4b.c +0 -0
index e1595a875f..5f7abbb4c4 100644

hw/arm/raspi4b.c static void raspi4b_machine_class_init(ObjectClass *oc, const void *data) · line 114

Quoted 8 lines
hw/arm/raspi4b.c +0 -4
@@ -111,11 +111,7 @@ static void raspi4b_machine_class_init(ObjectClass *oc, const void *data)
       MachineClass *mc = MACHINE_CLASS(oc);
       RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
-#if HOST_LONG_BITS == 32
-    rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */
-#else
       rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */
-#endif
       raspi_machine_class_common_init(mc, rmc->board_rev);

Here I'd rather keep the machine. IIRC someone already suggested to adapt the board_rev with the CLI provided memory size. An improvement for tomorrow, meanwhile:

Quoted 1 line
Quoted 1 line

Sure, I can also drop this one for now. Thanks,

No, keep it, this is dead code :)

What I meant is I'd like to get the Raspi 4B with 1GB (rev1.1) re-introduced, but I'm not asking you to do it (and I'm adding a note on my infinite QEMU TODO list).

author
#22 lore raw

PATCH v2 9/9 machine: Remove 32bit limitation on ram size

In reply to Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
 hw/core/machine.c | 8 --------
 1 file changed, 8 deletions(-)
hw/core/machine.c +0 -8
index e617f7804d..776df84191 100644
@@ -1625,14 +1625,6 @@ void machine_run_board_init(MachineState *machine, const char *mem_path, Error *
        clock values from the log. */
     replay_checkpoint(CHECKPOINT_INIT);
 
-    if (!xen_enabled()) {
-        /* On 32-bit hosts, QEMU is limited by virtual address space */
-        if (machine->ram_size > (2047 << 20) && HOST_LONG_BITS == 32) {
-            error_setg(errp, "at most 2047 MB RAM can be simulated");
-            return;
-        }
-    }
-
     if (machine->memdev) {
         ram_addr_t backend_size = object_property_get_uint(OBJECT(machine->memdev),
                                                            "size",  &error_abort);
Signature · 1 line
2.54.0
Reviewed-by on v2 9/9
#23 lore raw

Re: [PATCH v2 9/9] machine: Remove 32bit limitation on ram size

Quoted 16 lines · Peter Xu

QEMU has switched to 64bit-only hosts for all system/user emulations.

---
  hw/core/machine.c | 8 --------
  1 file changed, 8 deletions(-)
hw/core/machine.c +0 -1
index e617f7804d..776df84191 100644
@@ -1625,14 +1625,6 @@ void machine_run_board_init(MachineState *machine, const char *mem_path, Error *
         clock values from the log. */
      replay_checkpoint(CHECKPOINT_INIT);
 
-    if (!xen_enabled()) {

hw/core/machine.c void machine_run_board_init(MachineState *machine, const char *mem_path, Error * · line 1630

Quoted 10 lines
hw/core/machine.c +0 -7
-        /* On 32-bit hosts, QEMU is limited by virtual address space */
-        if (machine->ram_size > (2047 << 20) && HOST_LONG_BITS == 32) {
-            error_setg(errp, "at most 2047 MB RAM can be simulated");
-            return;
-        }
-    }
-
      if (machine->memdev) {
          ram_addr_t backend_size = object_property_get_uint(OBJECT(machine->memdev),
                                                             "size",  &error_abort);

r~

author
#25 lore raw
In reply to Peter Xu
Quoted 9 lines · Peter Xu

v1: https://lore.kernel.org/r/[email protected]

In v2, I touched up the original patch per suggested. Then I added some more patches, almost quickly looking at references of HOST_LONG_BITS and clean up those I feel confident about over 32bits. I still left some there (dev-properties, qht, etc.) which smells like tools may still use them.

Please have a look, thanks.

Quoted 10 lines

Peter Xu (9):
system: Define ram_addr_t to be always uint64_t hw/vexpress.c: Remove forced cast to u64
arm/mps: Remove 32bit define for MPS3_DDR_SIZE
xen-mapcache: Remove 32bit support
bsd-user: Remove 32bit host support in thunk_convert|print()
linux-user: Remove 32bit host support in thunk_convert|print() arm/aspeed: Drop ASPEED_RAM_SIZE
hw/arm/raspi4b: Drop board_rev for 32bit hosts
machine: Remove 32bit limitation on ram size

queued.

Signature · 1 line
Peter Xu