* [PATCH 0/8] hw: Fix some incomplete memory region size
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
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(-)
--
2.21.3
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 0/8] hw: Fix some incomplete memory region size
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
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(-)
--
2.21.3
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/8] hw/arm/aspeed: Correct DRAM container region size
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
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_ram
Fix 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
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/arm/aspeed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 2c23297edf..62344ac6a3 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -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,
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 1/8] hw/arm/aspeed: Correct DRAM container region size
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
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_ram
Fix 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
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/arm/aspeed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 2c23297edf..62344ac6a3 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -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,
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/8] hw/pci-host/prep: Correct RAVEN bus bridge memory region size
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
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-000000007fffffff
Fix 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
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci-host/prep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 1a02e9a670..88e2fc66a9 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -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));
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/8] hw/pci-host/prep: Correct RAVEN bus bridge memory region size
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
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-000000007fffffff
Fix 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
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci-host/prep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 1a02e9a670..88e2fc66a9 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -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));
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 3/8] hw/pci/pci_bridge: Correct pci_bridge_io memory region size
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
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
...
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci/pci_bridge.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 97967d12eb..3ba3203f72 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -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);
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 3/8] hw/pci/pci_bridge: Correct pci_bridge_io memory region size
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
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
...
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci/pci_bridge.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 97967d12eb..3ba3203f72 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -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);
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 4/8] hw/pci/pci_bridge: Use the IEC binary prefix definitions
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci/pci_bridge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 3ba3203f72..3789c17edc 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -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;
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 4/8] hw/pci/pci_bridge: Use the IEC binary prefix definitions
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci/pci_bridge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 3ba3203f72..3789c17edc 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -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;
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 5/8] hw/pci-host: Use the IEC binary prefix definitions
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
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(-)
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 0adbd77553..aefb416c8f 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -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);
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 352aeecfa7..b788f17b2c 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -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,
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index cfb9a78ea6..8ddfb8772a 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -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,
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 5/8] hw/pci-host: Use the IEC binary prefix definitions
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
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(-)
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 0adbd77553..aefb416c8f 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -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);
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 352aeecfa7..b788f17b2c 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -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,
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index cfb9a78ea6..8ddfb8772a 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -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,
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 6/8] hw/hppa/dino: Use the IEC binary prefix definitions
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/hppa/dino.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
index 2b1b38c58a..7290f23962 100644
--- a/hw/hppa/dino.c
+++ b/hw/hppa/dino.c
@@ -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);
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 6/8] hw/hppa/dino: Use the IEC binary prefix definitions
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/hppa/dino.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
index 2b1b38c58a..7290f23962 100644
--- a/hw/hppa/dino.c
+++ b/hw/hppa/dino.c
@@ -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);
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/i386/xen/xen-hvm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 82ece6b9e7..679d74e6a3 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -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
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/i386/xen/xen-hvm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 82ece6b9e7..679d74e6a3 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -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
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 8/8] target/i386/cpu: Use the IEC binary prefix definitions
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Paolo Bonzini, Anthony Perard, xen-devel,
qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/i386/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3733d9a279..33ce4861fb 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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);
}
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 8/8] target/i386/cpu: Use the IEC binary prefix definitions
@ 2020-05-31 17:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-31 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin, Joel Stanley,
Philippe Mathieu-Daudé,
qemu-trivial, qemu-arm, Hervé Poussineau,
Cédric Le Goater, Marcel Apfelbaum, Paolo Bonzini,
Anthony Perard, xen-devel, qemu-ppc, Richard Henderson
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/i386/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3733d9a279..33ce4861fb 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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);
}
--
2.21.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 0/8] hw: Fix some incomplete memory region size
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-05-31 19:48 ` Peter Maydell
-1 siblings, 0 replies; 25+ messages in thread
From: Peter Maydell @ 2020-05-31 19:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-ppc, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin,
QEMU Developers, Joel Stanley, QEMU Trivial, qemu-arm,
Hervé Poussineau, Cédric Le Goater, Paolo Bonzini,
Anthony Perard, open list:X86, Richard Henderson
On Sun, 31 May 2020 at 18:38, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> 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
whole series:
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/8] hw: Fix some incomplete memory region size
@ 2020-05-31 19:48 ` Peter Maydell
0 siblings, 0 replies; 25+ messages in thread
From: Peter Maydell @ 2020-05-31 19:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-ppc, Stefano Stabellini, Eduardo Habkost, Paul Durrant,
Andrew Jeffery, Helge Deller, Michael S. Tsirkin,
QEMU Developers, Joel Stanley, QEMU Trivial, qemu-arm,
Hervé Poussineau, Cédric Le Goater, Marcel Apfelbaum,
Paolo Bonzini, Anthony Perard, open list:X86, Richard Henderson
On Sun, 31 May 2020 at 18:38, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> 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
whole series:
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
2020-05-31 17:38 ` Philippe Mathieu-Daudé
@ 2020-06-01 7:26 ` Paul Durrant
-1 siblings, 0 replies; 25+ messages in thread
From: Paul Durrant @ 2020-06-01 7:26 UTC (permalink / raw)
To: 'Philippe Mathieu-Daudé', qemu-devel
Cc: 'Peter Maydell', 'Stefano Stabellini',
'Eduardo Habkost', 'Michael S. Tsirkin',
'Andrew Jeffery', 'Helge Deller',
'Joel Stanley',
qemu-trivial, qemu-arm, 'Hervé Poussineau',
'Cédric Le Goater', 'Paolo Bonzini',
'Anthony Perard',
xen-devel, qemu-ppc, 'Richard Henderson'
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On Behalf Of Philippe Mathieu-Daudé
> Sent: 31 May 2020 18:38
> To: qemu-devel@nongnu.org
> Cc: Andrew Jeffery <andrew@aj.id.au>; Helge Deller <deller@gmx.de>; Peter Maydell
> <peter.maydell@linaro.org>; Richard Henderson <rth@twiddle.net>; Eduardo Habkost
> <ehabkost@redhat.com>; Paul Durrant <paul@xen.org>; Hervé Poussineau <hpoussin@reactos.org>; Marcel
> Apfelbaum <marcel.apfelbaum@gmail.com>; xen-devel@lists.xenproject.org; Paolo Bonzini
> <pbonzini@redhat.com>; Stefano Stabellini <sstabellini@kernel.org>; Cédric Le Goater <clg@kaod.org>;
> qemu-trivial@nongnu.org; Joel Stanley <joel@jms.id.au>; qemu-arm@nongnu.org; Michael S. Tsirkin
> <mst@redhat.com>; Anthony Perard <anthony.perard@citrix.com>; qemu-ppc@nongnu.org; Philippe Mathieu-
> Daudé <f4bug@amsat.org>
> Subject: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
>
> IEC binary prefixes ease code review: the unit is explicit.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/i386/xen/xen-hvm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index 82ece6b9e7..679d74e6a3 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -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;
Not strictly necessary but could we retain the brackets please?
Paul
> }
> memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
> &error_fatal);
> --
> 2.21.3
^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
@ 2020-06-01 7:26 ` Paul Durrant
0 siblings, 0 replies; 25+ messages in thread
From: Paul Durrant @ 2020-06-01 7:26 UTC (permalink / raw)
To: 'Philippe Mathieu-Daudé', qemu-devel
Cc: 'Peter Maydell', 'Stefano Stabellini',
'Eduardo Habkost', 'Michael S. Tsirkin',
'Andrew Jeffery', 'Helge Deller',
'Joel Stanley',
qemu-trivial, qemu-arm, 'Hervé Poussineau',
'Cédric Le Goater', 'Marcel Apfelbaum',
'Paolo Bonzini', 'Anthony Perard',
xen-devel, qemu-ppc, 'Richard Henderson'
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On Behalf Of Philippe Mathieu-Daudé
> Sent: 31 May 2020 18:38
> To: qemu-devel@nongnu.org
> Cc: Andrew Jeffery <andrew@aj.id.au>; Helge Deller <deller@gmx.de>; Peter Maydell
> <peter.maydell@linaro.org>; Richard Henderson <rth@twiddle.net>; Eduardo Habkost
> <ehabkost@redhat.com>; Paul Durrant <paul@xen.org>; Hervé Poussineau <hpoussin@reactos.org>; Marcel
> Apfelbaum <marcel.apfelbaum@gmail.com>; xen-devel@lists.xenproject.org; Paolo Bonzini
> <pbonzini@redhat.com>; Stefano Stabellini <sstabellini@kernel.org>; Cédric Le Goater <clg@kaod.org>;
> qemu-trivial@nongnu.org; Joel Stanley <joel@jms.id.au>; qemu-arm@nongnu.org; Michael S. Tsirkin
> <mst@redhat.com>; Anthony Perard <anthony.perard@citrix.com>; qemu-ppc@nongnu.org; Philippe Mathieu-
> Daudé <f4bug@amsat.org>
> Subject: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
>
> IEC binary prefixes ease code review: the unit is explicit.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/i386/xen/xen-hvm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index 82ece6b9e7..679d74e6a3 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -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;
Not strictly necessary but could we retain the brackets please?
Paul
> }
> memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
> &error_fatal);
> --
> 2.21.3
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
2020-06-01 7:26 ` Paul Durrant
@ 2020-06-01 8:33 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 8:33 UTC (permalink / raw)
To: paul, qemu-devel
Cc: 'Peter Maydell', 'Stefano Stabellini',
'Eduardo Habkost', 'Michael S. Tsirkin',
'Andrew Jeffery', 'Helge Deller',
qemu-trivial, qemu-arm, 'Hervé Poussineau',
'Joel Stanley', xen-devel, 'Anthony Perard',
'Paolo Bonzini', 'Richard Henderson',
qemu-ppc, 'Cédric Le Goater'
On 6/1/20 9:26 AM, Paul Durrant wrote:
>> -----Original Message-----
>> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On Behalf Of Philippe Mathieu-Daudé
>> Sent: 31 May 2020 18:38
>> To: qemu-devel@nongnu.org
>> Cc: Andrew Jeffery <andrew@aj.id.au>; Helge Deller <deller@gmx.de>; Peter Maydell
>> <peter.maydell@linaro.org>; Richard Henderson <rth@twiddle.net>; Eduardo Habkost
>> <ehabkost@redhat.com>; Paul Durrant <paul@xen.org>; Hervé Poussineau <hpoussin@reactos.org>; Marcel
>> Apfelbaum <marcel.apfelbaum@gmail.com>; xen-devel@lists.xenproject.org; Paolo Bonzini
>> <pbonzini@redhat.com>; Stefano Stabellini <sstabellini@kernel.org>; Cédric Le Goater <clg@kaod.org>;
>> qemu-trivial@nongnu.org; Joel Stanley <joel@jms.id.au>; qemu-arm@nongnu.org; Michael S. Tsirkin
>> <mst@redhat.com>; Anthony Perard <anthony.perard@citrix.com>; qemu-ppc@nongnu.org; Philippe Mathieu-
>> Daudé <f4bug@amsat.org>
>> Subject: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
>>
>> IEC binary prefixes ease code review: the unit is explicit.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> hw/i386/xen/xen-hvm.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
>> index 82ece6b9e7..679d74e6a3 100644
>> --- a/hw/i386/xen/xen-hvm.c
>> +++ b/hw/i386/xen/xen-hvm.c
>> @@ -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;
>
> Not strictly necessary but could we retain the brackets please?
Sure.
Laurent, if this can go via your trivial@ tree, can you do the change or
you rather I resend the whole series?
>
> Paul
>
>> }
>> memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
>> &error_fatal);
>> --
>> 2.21.3
>
>
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
@ 2020-06-01 8:33 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 8:33 UTC (permalink / raw)
To: paul, qemu-devel
Cc: 'Peter Maydell', 'Stefano Stabellini',
'Eduardo Habkost', 'Michael S. Tsirkin',
'Andrew Jeffery', 'Helge Deller',
qemu-trivial, qemu-arm, 'Hervé Poussineau',
'Joel Stanley', 'Marcel Apfelbaum',
xen-devel, 'Anthony Perard', 'Paolo Bonzini',
'Richard Henderson',
qemu-ppc, 'Cédric Le Goater'
On 6/1/20 9:26 AM, Paul Durrant wrote:
>> -----Original Message-----
>> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On Behalf Of Philippe Mathieu-Daudé
>> Sent: 31 May 2020 18:38
>> To: qemu-devel@nongnu.org
>> Cc: Andrew Jeffery <andrew@aj.id.au>; Helge Deller <deller@gmx.de>; Peter Maydell
>> <peter.maydell@linaro.org>; Richard Henderson <rth@twiddle.net>; Eduardo Habkost
>> <ehabkost@redhat.com>; Paul Durrant <paul@xen.org>; Hervé Poussineau <hpoussin@reactos.org>; Marcel
>> Apfelbaum <marcel.apfelbaum@gmail.com>; xen-devel@lists.xenproject.org; Paolo Bonzini
>> <pbonzini@redhat.com>; Stefano Stabellini <sstabellini@kernel.org>; Cédric Le Goater <clg@kaod.org>;
>> qemu-trivial@nongnu.org; Joel Stanley <joel@jms.id.au>; qemu-arm@nongnu.org; Michael S. Tsirkin
>> <mst@redhat.com>; Anthony Perard <anthony.perard@citrix.com>; qemu-ppc@nongnu.org; Philippe Mathieu-
>> Daudé <f4bug@amsat.org>
>> Subject: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
>>
>> IEC binary prefixes ease code review: the unit is explicit.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> hw/i386/xen/xen-hvm.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
>> index 82ece6b9e7..679d74e6a3 100644
>> --- a/hw/i386/xen/xen-hvm.c
>> +++ b/hw/i386/xen/xen-hvm.c
>> @@ -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;
>
> Not strictly necessary but could we retain the brackets please?
Sure.
Laurent, if this can go via your trivial@ tree, can you do the change or
you rather I resend the whole series?
>
> Paul
>
>> }
>> memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
>> &error_fatal);
>> --
>> 2.21.3
>
>
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
2020-06-01 8:33 ` Philippe Mathieu-Daudé
(?)
@ 2020-06-01 11:15 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 11:15 UTC (permalink / raw)
To: paul, qemu-devel
Cc: 'Peter Maydell', 'Stefano Stabellini',
'Eduardo Habkost', 'Michael S. Tsirkin',
'Andrew Jeffery', 'Helge Deller',
qemu-trivial, 'Cédric Le Goater',
qemu-arm, 'Hervé Poussineau', 'Joel Stanley',
'Paolo Bonzini', 'Anthony Perard',
xen-devel, qemu-ppc, 'Richard Henderson'
On 6/1/20 10:33 AM, Philippe Mathieu-Daudé wrote:
> On 6/1/20 9:26 AM, Paul Durrant wrote:
>>> -----Original Message-----
>>> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On Behalf Of Philippe Mathieu-Daudé
>>> Sent: 31 May 2020 18:38
>>> To: qemu-devel@nongnu.org
>>> Cc: Andrew Jeffery <andrew@aj.id.au>; Helge Deller <deller@gmx.de>; Peter Maydell
>>> <peter.maydell@linaro.org>; Richard Henderson <rth@twiddle.net>; Eduardo Habkost
>>> <ehabkost@redhat.com>; Paul Durrant <paul@xen.org>; Hervé Poussineau <hpoussin@reactos.org>; Marcel
>>> Apfelbaum <marcel.apfelbaum@gmail.com>; xen-devel@lists.xenproject.org; Paolo Bonzini
>>> <pbonzini@redhat.com>; Stefano Stabellini <sstabellini@kernel.org>; Cédric Le Goater <clg@kaod.org>;
>>> qemu-trivial@nongnu.org; Joel Stanley <joel@jms.id.au>; qemu-arm@nongnu.org; Michael S. Tsirkin
>>> <mst@redhat.com>; Anthony Perard <anthony.perard@citrix.com>; qemu-ppc@nongnu.org; Philippe Mathieu-
>>> Daudé <f4bug@amsat.org>
>>> Subject: [PATCH 7/8] hw/i386/xen/xen-hvm: Use the IEC binary prefix definitions
>>>
>>> IEC binary prefixes ease code review: the unit is explicit.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>> hw/i386/xen/xen-hvm.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
>>> index 82ece6b9e7..679d74e6a3 100644
>>> --- a/hw/i386/xen/xen-hvm.c
>>> +++ b/hw/i386/xen/xen-hvm.c
>>> @@ -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;
>>
>> Not strictly necessary but could we retain the brackets please?
>
> Sure.
>
> Laurent, if this can go via your trivial@ tree, can you do the change or
> you rather I resend the whole series?
I understood reading another thread that contributor should not overload
maintainer, so I'll simply repost this as v2.
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00066.html
>
>>
>> Paul
>>
>>> }
>>> memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
>>> &error_fatal);
>>> --
>>> 2.21.3
>>
>>
>>
>
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2020-06-01 11:17 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-31 17:38 [PATCH 0/8] hw: Fix some incomplete memory region size Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 1/8] hw/arm/aspeed: Correct DRAM container " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 2/8] hw/pci-host/prep: Correct RAVEN bus bridge memory " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 3/8] hw/pci/pci_bridge: Correct pci_bridge_io " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 4/8] hw/pci/pci_bridge: Use the IEC binary prefix definitions Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 5/8] hw/pci-host: " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 6/8] hw/hppa/dino: " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 7/8] hw/i386/xen/xen-hvm: " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-06-01 7:26 ` Paul Durrant
2020-06-01 7:26 ` Paul Durrant
2020-06-01 8:33 ` Philippe Mathieu-Daudé
2020-06-01 8:33 ` Philippe Mathieu-Daudé
2020-06-01 11:15 ` Philippe Mathieu-Daudé
2020-05-31 17:38 ` [PATCH 8/8] target/i386/cpu: " Philippe Mathieu-Daudé
2020-05-31 17:38 ` Philippe Mathieu-Daudé
2020-05-31 19:48 ` [PATCH 0/8] hw: Fix some incomplete memory region size Peter Maydell
2020-05-31 19:48 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.