hw: Fix some incomplete memory region size
v2 cover hw: Fix some incomplete memory region size
Series fully reviewed.
Since v1:
- Add parenthesis on the Xen patch (Paul Durrant)
- Add Peter's R-b tags
memory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value.
This is not a problem for the 32-bit maximum, 4 GiB, but in some places we incorrectly use UINT32_MAX instead of 4 GiB, and end up missing 1 byte in the memory region.
This series fixes the cases I encountered.
Also included few patches while reviewing, I replaced some magic values by the IEC binary prefix equivalent.
Regards,
Phil.
Philippe Mathieu-Daudé (8):
hw/arm/aspeed: Correct DRAM container region size hw/pci-host/prep: Correct RAVEN bus bridge memory region size hw/pci/pci_bridge: Correct pci_bridge_io memory region size hw/pci/pci_bridge: Use the IEC binary prefix definitions hw/pci-host: Use the IEC binary prefix definitions hw/hppa/dino: Use the IEC binary prefix definitions hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions target/i386/cpu: Use the IEC binary prefix definitions
hw/arm/aspeed.c | 2 +- hw/hppa/dino.c | 4 ++-- hw/i386/xen/xen-hvm.c | 3 ++- hw/pci-host/i440fx.c | 3 ++- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +++-- hw/pci/pci_bridge.c | 7 ++++--- target/i386/cpu.c | 2 +- 9 files changed, 17 insertions(+), 13 deletions(-)
Signature · 1 line
2.21.3
PATCH v2 1/8 hw/arm/aspeed: Correct DRAM container region size
memory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the aspeed-ram-container MemoryRegion ends up missing 1 byte:
$ qemu-system-arm -M ast2600-evb -S -monitor stdio (qemu) info mtree
address-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017ffffffe (prio 0, i/o): aspeed-ram-container
0000000080000000-00000000bfffffff (prio 0, ram): ram
00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ramFix by using the correct value. We now have:
address-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017fffffff (prio 0, i/o): aspeed-ram-container
0000000080000000-00000000bfffffff (prio 0, ram): ram
00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ram--- hw/arm/aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/aspeed.c +1 -1
@@ -262,7 +262,7 @@ static void aspeed_machine_init(MachineState *machine) bmc =g_new0 (AspeedBoardState,1 );memory_region_init (&bmc->ram_container,NULL ,"aspeed-ram-container" , -UINT32_MAX ); +4 * GiB);memory_region_add_subregion (&bmc->ram_container,0 , machine->ram); object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
Signature · 1 line
2.21.3
Re: [PATCH v2 1/8] hw/arm/aspeed: Correct DRAM container region size
Quoted 16 lines · Philippe Mathieu-Daudé
memory_region_set_size()handle the 16 Exabytes limit by special-casing theUINT64_MAXvalue. This is not a problem for the 32-bit maximum, 4 GiB.
By using theUINT32_MAXvalue, the aspeed-ram-container MemoryRegion ends up missing 1 byte:$ qemu-system-arm -M ast2600-evb -S -monitor stdio (qemu) info mtreeaddress-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017ffffffe (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000bfffffff (prio 0, ram): ram 00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ramFix by using the correct value. We now have:
Quoted 7 lines
address-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017fffffff (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000bfffffff (prio 0, ram): ram 00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ramReviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 18 lines
--- hw/arm/aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/arm/aspeed.c +1
-1@@ -262,7 +262,7 @@ static void aspeed_machine_init(MachineState *machine) bmc =g_new0 (AspeedBoardState,1 );memory_region_init (&bmc->ram_container,NULL ,"aspeed-ram-container" , -UINT32_MAX ); +4 * GiB);memory_region_add_subregion (&bmc->ram_container,0 , machine->ram); object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
Re: [PATCH v2 1/8] hw/arm/aspeed: Correct DRAM container region size
In reply to Philippe Mathieu-DaudéQuoted 21 lines · Philippe Mathieu-Daudé
memory_region_set_size()handle the 16 Exabytes limit by special-casing theUINT64_MAXvalue. This is not a problem for the 32-bit maximum, 4 GiB.
By using theUINT32_MAXvalue, the aspeed-ram-container MemoryRegion ends up missing 1 byte:$ qemu-system-arm -M ast2600-evb -S -monitor stdio (qemu) info mtreeaddress-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017ffffffe (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000bfffffff (prio 0, ram): ram 00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ramFix by using the correct value. We now have:
address-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017fffffff (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000bfffffff (prio 0, ram): ram 00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ram
Quoted 5 lines
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Laurent Vivier
AppliedRe: [PATCH v2 1/8] hw/arm/aspeed: Correct DRAM container region size
In reply to Philippe Mathieu-DaudéLe 01/06/2020 à 16:29, Philippe Mathieu-Daudé a écrit :
Quoted 33 lines
memory_region_set_size()handle the 16 Exabytes limit by special-casing theUINT64_MAXvalue. This is not a problem for the 32-bit maximum, 4 GiB.
By using theUINT32_MAXvalue, the aspeed-ram-container MemoryRegion ends up missing 1 byte:$ qemu-system-arm -M ast2600-evb -S -monitor stdio (qemu) info mtreeaddress-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017ffffffe (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000bfffffff (prio 0, ram): ram 00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ramFix by using the correct value. We now have:
address-space: aspeed.fmc-ast2600-dma-dram
0000000080000000-000000017fffffff (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000bfffffff (prio 0, ram): ram 00000000c0000000-ffffffffffffffff (prio 0, i/o): max_ramReviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/arm/aspeed.c +0
-0
hw/arm/aspeed.c static void aspeed_machine_init(MachineState *machine) · line 268
Quoted 8 lines
hw/arm/aspeed.c +1
-1@@ -262,7 +262,7 @@ static void aspeed_machine_init(MachineState *machine) bmc =g_new0 (AspeedBoardState,1 );memory_region_init (&bmc->ram_container,NULL ,"aspeed-ram-container" , -UINT32_MAX ); +4 * GiB);memory_region_add_subregion (&bmc->ram_container,0 , machine->ram); object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
Applied to my trivial-patches branch.
Thanks,
Laurent
PATCH v2 2/8 hw/pci-host/prep: Correct RAVEN bus bridge memory region size
In reply to Philippe Mathieu-Daudémemory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the bm-raven MemoryRegion ends up missing 1 byte:
$ qemu-system-ppc -M prep -S -monitor stdio -usb
memory-region: bm-raven
0000000000000000-00000000fffffffe (prio 0, i/o): bm-raven
0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff
0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffffFix by using the correct value. We now have:
memory-region: bm-raven
0000000000000000-00000000ffffffff (prio 0, i/o): bm-raven
0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff
0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffff--- hw/pci-host/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/prep.c +1 -1
@@ -294,7 +294,7 @@ static void raven_pcihost_initfn(Object *obj) &s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS);/* Bus master address space */ -memory_region_init (&s->bm, obj,"bm-raven" ,UINT32_MAX ); +memory_region_init (&s->bm, obj,"bm-raven" ,4 * GiB);memory_region_init_alias (&s->bm_pci_memory_alias, obj,"bm-pci-memory" , &s->pci_memory,0 ,memory_region_size (&s->pci_memory));
Signature · 1 line
2.21.3
Re: [PATCH v2 2/8] hw/pci-host/prep: Correct RAVEN bus bridge memory region size
Quoted 19 lines · Philippe Mathieu-Daudé
memory_region_set_size()handle the 16 Exabytes limit by special-casing theUINT64_MAXvalue. This is not a problem for the 32-bit maximum, 4 GiB.
By using theUINT32_MAXvalue, the bm-raven MemoryRegion ends up missing 1 byte:$ qemu-system-ppc -M prep -S -monitor stdio -usb memory-region: bm-raven 0000000000000000-00000000fffffffe (prio 0, i/o): bm-raven 0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff 0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffffFix by using the correct value. We now have:
memory-region: bm-raven
0000000000000000-00000000ffffffff (prio 0, i/o): bm-raven 0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff 0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffff
Quoted 5 lines
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/pci-host/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH v2 3/8 hw/pci/pci_bridge: Correct pci_bridge_io memory region size
In reply to Philippe Mathieu-Daudémemory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the pci_bridge_io MemoryRegion ends up missing 1 byte:
(qemu) info mtree
memory-region: pci_bridge_io
0000000000000000-00000000fffffffe (prio 0, i/o): pci_bridge_io
0000000000000060-0000000000000060 (prio 0, i/o): i8042-data
0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd
00000000000001ce-00000000000001d1 (prio 0, i/o): vbe
0000000000000378-000000000000037f (prio 0, i/o): parallel
00000000000003b4-00000000000003b5 (prio 0, i/o): vga
...Fix by using the correct value. We now have:
memory-region: pci_bridge_io
0000000000000000-00000000ffffffff (prio 0, i/o): pci_bridge_io
0000000000000060-0000000000000060 (prio 0, i/o): i8042-data
0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd
...--- hw/pci/pci_bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/pci/pci_bridge.c +2 -1
@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" #include "qemu/module.h"
@@ -381,7 +382,7 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename)memory_region_init (&br->address_space_mem,OBJECT (br),"pci_bridge_pci" ,UINT64_MAX ); sec_bus->address_space_io = &br->address_space_io;memory_region_init (&br->address_space_io,OBJECT (br),"pci_bridge_io" , -UINT32_MAX ); +4 * GiB); br->windows =pci_bridge_region_init (br);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling);
Signature · 1 line
2.21.3
Re: [PATCH v2 3/8] hw/pci/pci_bridge: Correct pci_bridge_io memory region size
Quoted 24 lines · Philippe Mathieu-Daudé
memory_region_set_size()handle the 16 Exabytes limit by special-casing theUINT64_MAXvalue. This is not a problem for the 32-bit maximum, 4 GiB.
By using theUINT32_MAXvalue, thepci_bridge_ioMemoryRegion ends up missing 1 byte:(qemu) info mtree
memory-region:pci_bridge_io0000000000000000-00000000fffffffe (prio 0, i/o): pci_bridge_io 0000000000000060-0000000000000060 (prio 0, i/o): i8042-data 0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd 00000000000001ce-00000000000001d1 (prio 0, i/o): vbe 0000000000000378-000000000000037f (prio 0, i/o): parallel 00000000000003b4-00000000000003b5 (prio 0, i/o): vga ...Fix by using the correct value. We now have:
memory-region:
pci_bridge_io0000000000000000-00000000ffffffff (prio 0, i/o): pci_bridge_io 0000000000000060-0000000000000060 (prio 0, i/o): i8042-data 0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd ...
Quoted 5 lines
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/pci/pci_bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
r~
PATCH v2 4/8 hw/pci/pci_bridge: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéIEC binary prefixes ease code review: the unit is explicit.
--- hw/pci/pci_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci/pci_bridge.c +2 -2
@@ -423,14 +423,14 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset, }if (res_reserve.mem_non_pref != (uint64_t )-1 && - res_reserve.mem_non_pref >= (1ULL <<32 )) { + res_reserve.mem_non_pref >=4 * GiB) {error_setg (errp,"PCI resource reserve cap: mem-reserve must be less than 4G" );return -EINVAL ; }if (res_reserve.mem_pref_32 != (uint64_t )-1 && - res_reserve.mem_pref_32 >= (1ULL <<32 )) { + res_reserve.mem_pref_32 >=4 * GiB) {error_setg (errp,"PCI resource reserve cap: pref32-reserve must be less than 4G" );return -EINVAL ;
Signature · 1 line
2.21.3
Re: [PATCH v2 4/8] hw/pci/pci_bridge: Use the IEC binary prefix definitions
Quoted 7 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/pci/pci_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
PATCH v2 5/8 hw/pci-host: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéIEC binary prefixes ease code review: the unit is explicit.
--- hw/pci-host/i440fx.c | 3 ++- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-)
hw/pci-host/i440fx.c +2 -1
@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h"
@@ -301,7 +302,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,memory_region_set_enabled (&f->smram_region, true);/* smram, as seen by SMM CPUs */ -memory_region_init (&f->smram,OBJECT (d),"smram" ,1ull <<32 ); +memory_region_init (&f->smram,OBJECT (d),"smram" ,4 * GiB);memory_region_set_enabled (&f->smram, true);memory_region_init_alias (&f->low_smram,OBJECT (d),"smram-low" , f->ram_memory,0xa0000 ,0x20000 );
hw/pci-host/q35.c +1 -1
@@ -589,7 +589,7 @@ static void mch_realize(PCIDevice *d, Error **errp)memory_region_set_enabled (&mch->open_high_smram, false);/* smram, as seen by SMM CPUs */ -memory_region_init (&mch->smram,OBJECT (mch),"smram" ,1ull <<32 ); +memory_region_init (&mch->smram,OBJECT (mch),"smram" ,4 * GiB);memory_region_set_enabled (&mch->smram, true); memory_region_init_alias(&mch->low_smram, OBJECT(mch), "smram-low", mch->ram_memory, MCH_HOST_BRIDGE_SMRAM_C_BASE,
hw/pci-host/versatile.c +3 -2
@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/irq.h"
@@ -399,8 +400,8 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)pci_map_irq_fn mapfn;int i; -memory_region_init (&s->pci_io_space,OBJECT (s),"pci_io" ,1ULL <<32 ); -memory_region_init (&s->pci_mem_space,OBJECT (s),"pci_mem" ,1ULL <<32 ); +memory_region_init (&s->pci_io_space,OBJECT (s),"pci_io" ,4 * GiB); +memory_region_init (&s->pci_mem_space,OBJECT (s),"pci_mem" ,4 * GiB); pci_root_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), dev, "pci", &s->pci_mem_space, &s->pci_io_space,
Signature · 1 line
2.21.3
Re: [PATCH v2 5/8] hw/pci-host: Use the IEC binary prefix definitions
Quoted 9 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/pci-host/i440fx.c | 3 ++- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-)
r~
PATCH v2 6/8 hw/hppa/dino: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéIEC binary prefixes ease code review: the unit is explicit.
--- hw/hppa/dino.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/hppa/dino.c +2 -2
@@ -542,7 +542,7 @@ PCIBus *dino_init(MemoryRegion *addr_space, &s->parent_obj.data_mem);/* Dino PCI bus memory. */ -memory_region_init (&s->pci_mem,OBJECT (s),"pci-memory" ,1ull <<32 ); +memory_region_init (&s->pci_mem,OBJECT (s),"pci-memory" ,4 * GiB); b = pci_register_root_bus(dev, "pci", dino_set_irq, dino_pci_map_irq, s, &s->pci_mem, get_system_io(),
@@ -561,7 +561,7 @@ PCIBus *dino_init(MemoryRegion *addr_space, }/* Set up PCI view of memory: Bus master address space. */ -memory_region_init (&s->bm,OBJECT (s),"bm-dino" ,1ull <<32 ); +memory_region_init (&s->bm,OBJECT (s),"bm-dino" ,4 * GiB);memory_region_init_alias (&s->bm_ram_alias,OBJECT (s),"bm-system" , addr_space,0 ,0xf0000000 +DINO_MEM_CHUNK_SIZE );
Signature · 1 line
2.21.3
Re: [PATCH v2 6/8] hw/hppa/dino: Use the IEC binary prefix definitions
Quoted 7 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/hppa/dino.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
Laurent Vivier
AppliedRe: [PATCH v2 6/8] hw/hppa/dino: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéLe 01/06/2020 à 16:29, Philippe Mathieu-Daudé a écrit :
Quoted 23 lines
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/hppa/dino.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/hppa/dino.c +1
-1@@ -542,7 +542,7 @@ PCIBus *dino_init(MemoryRegion *addr_space, &s->parent_obj.data_mem);/* Dino PCI bus memory. */ -memory_region_init (&s->pci_mem,OBJECT (s),"pci-memory" ,1ull <<32 ); +memory_region_init (&s->pci_mem,OBJECT (s),"pci-memory" ,4 * GiB); b = pci_register_root_bus(dev, "pci", dino_set_irq, dino_pci_map_irq, s, &s->pci_mem, get_system_io(),
hw/hppa/dino.c PCIBus *dino_init(MemoryRegion *addr_space, · line 567
Quoted 8 lines
hw/hppa/dino.c +1
-1@@ -561,7 +561,7 @@ PCIBus *dino_init(MemoryRegion *addr_space, }/* Set up PCI view of memory: Bus master address space. */ -memory_region_init (&s->bm,OBJECT (s),"bm-dino" ,1ull <<32 ); +memory_region_init (&s->bm,OBJECT (s),"bm-dino" ,4 * GiB);memory_region_init_alias (&s->bm_ram_alias,OBJECT (s),"bm-system" , addr_space,0 ,0xf0000000 +DINO_MEM_CHUNK_SIZE );
Applied to my trivial-patches branch.
Thanks,
Laurent
PATCH v2 7/8 hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéIEC binary prefixes ease code review: the unit is explicit.
--- hw/i386/xen/xen-hvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/xen/xen-hvm.c +2 -1
@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "cpu.h" #include "hw/pci/pci.h"
@@ -230,7 +231,7 @@ static void xen_ram_init(PCMachineState *pcms,* Xen does not allocate the memory continuously, it keeps a * hole of the size computed above or passed in. */ - block_len = (1ULL <<32 ) + x86ms->above_4g_mem_size; + block_len = (4 * GiB) + x86ms->above_4g_mem_size; }memory_region_init_ram (&ram_memory,NULL ,"xen.ram" , block_len, &error_fatal);
Signature · 1 line
2.21.3
RE: [PATCH v2 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
Quoted 13 lines
-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]> On Behalf Of Philippe Mathieu-Daudé
Sent: 01 June 2020 15:29
To: [email protected]
Cc: [email protected]; Anthony Perard <[email protected]>; Paolo Bonzini <[email protected]>; Hervé Poussineau <[email protected]>; Helge Deller <[email protected]>; qemu- [email protected]; Marcel Apfelbaum <[email protected]>; Stefano Stabellini <[email protected]>; Michael S. Tsirkin <[email protected]>; Eduardo Habkost <[email protected]>; Paul Durrant <[email protected]>; Andrew Jeffery <[email protected]>; [email protected]; Peter Maydell <[email protected]>; Joel Stanley <[email protected]>; Cédric Le Goater <[email protected]>; qemu- [email protected]; Richard Henderson <[email protected]>; Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v2 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
Quoted 4 lines
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 27 lines
--- hw/i386/xen/xen-hvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/i386/xen/xen-hvm.c +2
-2@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "cpu.h" #include "hw/pci/pci.h" @@ -230,7 +231,7 @@ static void xen_ram_init(PCMachineState *pcms,* Xen does not allocate the memory continuously, it keeps a * hole of the size computed above or passed in. */ - block_len = (1ULL <<32 ) + x86ms->above_4g_mem_size; + block_len = (4 * GiB) + x86ms->above_4g_mem_size; }memory_region_init_ram (&ram_memory,NULL ,"xen.ram" , block_len, &error_fatal); --2.21.3
Re: [PATCH v2 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/xen/xen-hvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
r~
Laurent Vivier
AppliedRe: [PATCH v2 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéLe 01/06/2020 à 16:29, Philippe Mathieu-Daudé a écrit :
Quoted 22 lines
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/xen/xen-hvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/i386/xen/xen-hvm.c +1
-0@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "cpu.h" #include "hw/pci/pci.h"
hw/i386/xen/xen-hvm.c static void xen_ram_init(PCMachineState *pcms, · line 237
Quoted 8 lines
hw/i386/xen/xen-hvm.c +1
-1@@ -230,7 +231,7 @@ static void xen_ram_init(PCMachineState *pcms,* Xen does not allocate the memory continuously, it keeps a * hole of the size computed above or passed in. */ - block_len = (1ULL <<32 ) + x86ms->above_4g_mem_size; + block_len = (4 * GiB) + x86ms->above_4g_mem_size; }memory_region_init_ram (&ram_memory,NULL ,"xen.ram" , block_len, &error_fatal);
Applied to my trivial-patches branch.
Thanks,
Laurent
PATCH v2 8/8 target/i386/cpu: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéIEC binary prefixes ease code review: the unit is explicit.
--- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -6159,7 +6159,7 @@ static void x86_cpu_machine_done(Notifier *n, void *unused)if (smram) { cpu->smram =g_new (MemoryRegion,1 );memory_region_init_alias (cpu->smram,OBJECT (cpu),"smram" , - smram,0 ,1ull <<32 ); + smram,0 ,4 * GiB);memory_region_set_enabled (cpu->smram, true);memory_region_add_subregion_overlap (cpu->cpu_as_root,0 , cpu->smram,1 ); }
Signature · 1 line
2.21.3
Re: [PATCH v2 8/8] target/i386/cpu: Use the IEC binary prefix definitions
Quoted 7 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Laurent Vivier
AppliedRe: [PATCH v2 8/8] target/i386/cpu: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéLe 01/06/2020 à 16:29, Philippe Mathieu-Daudé a écrit :
Quoted 14 lines
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/cpu.c +0
-0
target/i386/cpu.c static void x86_cpu_machine_done(Notifier *n, void *unused) · line 6165
Quoted 8 lines
target/i386/cpu.c +1
-1@@ -6159,7 +6159,7 @@ static void x86_cpu_machine_done(Notifier *n, void *unused)if (smram) { cpu->smram =g_new (MemoryRegion,1 );memory_region_init_alias (cpu->smram,OBJECT (cpu),"smram" , - smram,0 ,1ull <<32 ); + smram,0 ,4 * GiB);memory_region_set_enabled (cpu->smram, true);memory_region_add_subregion_overlap (cpu->cpu_as_root,0 , cpu->smram,1 ); }
Applied to my trivial-patches branch.
Thanks,
Laurent
Quoted 5 lines · Philippe Mathieu-Daudé
Series fully reviewed.
Since v1:
- Add parenthesis on the Xen patch (Paul Durrant)
- Add Peter's R-b tags
PCI things:
I'll queue pci patches in my tree.
Quoted 37 lines
memory_region_set_size()handle the 16 Exabytes limit by special-casing theUINT64_MAXvalue.
This is not a problem for the 32-bit maximum, 4 GiB, but in some places we incorrectly useUINT32_MAXinstead of 4 GiB, and end up missing 1 byte in the memory region.This series fixes the cases I encountered.
Also included few patches while reviewing, I replaced some magic values by the IEC binary prefix equivalent.Regards,
Phil.
Philippe Mathieu-Daudé (8):
hw/arm/aspeed: Correct DRAM container region size hw/pci-host/prep: Correct RAVEN bus bridge memory region size hw/pci/pci_bridge: Correctpci_bridge_iomemory region size hw/pci/pci_bridge: Use the IEC binary prefix definitions hw/pci-host: Use the IEC binary prefix definitions hw/hppa/dino: Use the IEC binary prefix definitions hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions target/i386/cpu: Use the IEC binary prefix definitionshw/arm/aspeed.c | 2 +- hw/hppa/dino.c | 4 ++-- hw/i386/xen/xen-hvm.c | 3 ++- hw/pci-host/i440fx.c | 3 ++- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +++-- hw/pci/pci_bridge.c | 7 ++++--- target/i386/cpu.c | 2 +- 9 files changed, 17 insertions(+), 13 deletions(-)Signature · 1 line
2.21.3