Skip to contentSkip to conversation

piix: fix 32bit pci hole

PATCH In review Gerd Hoffmann 4 participants 7 messages Nov 27, 2013 – Jan 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 piix: fix 32bit pci hole

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +1 -9
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 22 lines · Gerd Hoffmann

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +0 -3
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {

hw/pci-host/piix.c PCIBus *i440fx_init(PCII440FXState **pi440fx_state, · line 351

Quoted 10 lines
hw/pci-host/piix.c +1 -6
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);

Thanks!
Laszlo

#2 lore raw
Quoted 30 lines · Laszlo Ersek
Quoted 29 lines · Gerd Hoffmann

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +1 -9
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
Quoted 5 lines

hw/pci-host/piix.c PCIBus *i440fx_init(PCII440FXState **pi440fx_state, · line 351

Quoted 3 lines
hw/pci-host/piix.c +0 -0
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);

Can someone please pick this up? (I've also nominated it for 1.7.1.)

Thanks,
Laszlo

#3 lore raw
In reply to Gerd Hoffmann

Mike,

Quoted 22 lines · Gerd Hoffmann

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +0 -3
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {

hw/pci-host/piix.c PCIBus *i440fx_init(PCII440FXState **pi440fx_state, · line 351

Quoted 10 lines
hw/pci-host/piix.c +1 -6
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);

please pick this up for 1.7.1.

1.7.0 has been released without this patch, also without etc/pci-info, but with etc/acpi/tables.

For OVMF to work with "etc/acpi/tables" correctly, with eg. a guest RAM size of 2560MB, OVMF needs:
- either this patch in qemu, or
- etc/pci-info (which won't come back), or
- a hack in OVMF that mimicks the same 0x80000000/0xc0000000/0xe0000000 logic (which I won't add).

Thanks
Laszlo

#4 lore raw
Quoted 41 lines · Laszlo Ersek

Mike,

Quoted 22 lines · Gerd Hoffmann

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +0 -3
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {

hw/pci-host/piix.c PCIBus *i440fx_init(PCII440FXState **pi440fx_state, · line 351

Quoted 10 lines
hw/pci-host/piix.c +1 -6
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);

please pick this up for 1.7.1.

1.7.0 has been released without this patch, also without etc/pci-info, but with etc/acpi/tables.

Quoted 6 lines

For OVMF to work with "etc/acpi/tables" correctly, with eg. a guest RAM size of 2560MB, OVMF needs:
- either this patch in qemu, or
- etc/pci-info (which won't come back), or
- a hack in OVMF that mimicks the same 0x80000000/0xc0000000/0xe0000000 logic (which I won't add).

Nominating this for v1.7.1 again.

The qemu-2.0 version (ie. a forward-port) of this patch has been merged as

ddaaefb piix: fix 32bit pci hole

If necessary I can resubmit the v1.7.1 patch.

Thanks,
Laszlo

#5 lore raw
Quoted 51 lines · Laszlo Ersek
Quoted 41 lines · Laszlo Ersek

Mike,

Quoted 22 lines · Gerd Hoffmann

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +0 -3
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {

hw/pci-host/piix.c PCIBus *i440fx_init(PCII440FXState **pi440fx_state, · line 351

Quoted 10 lines
hw/pci-host/piix.c +1 -6
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);

please pick this up for 1.7.1.

1.7.0 has been released without this patch, also without etc/pci-info, but with etc/acpi/tables.

Quoted 6 lines

For OVMF to work with "etc/acpi/tables" correctly, with eg. a guest RAM size of 2560MB, OVMF needs:
- either this patch in qemu, or
- etc/pci-info (which won't come back), or
- a hack in OVMF that mimicks the same 0x80000000/0xc0000000/0xe0000000 logic (which I won't add).

Nominating this for v1.7.1 again.

Quoted 8 lines

The qemu-2.0 version (ie. a forward-port) of this patch has been merged as

ddaaefb piix: fix 32bit pci hole

If necessary I can resubmit the v1.7.1 patch.

Thanks,
Laszlo

It seems cleaner to backport this into stable.
Mike, can you pick this up please?

Signature · 1 line
MST
#6 lore raw

Quoting Michael S. Tsirkin (2014-01-12 00:50:13)

Quoted 56 lines · Laszlo Ersek
Quoted 55 lines · Laszlo Ersek
Quoted 41 lines

Mike,

Quoted 22 lines · Gerd Hoffmann

Make the 32bit pci hole start at end of ram, so all possible address space is covered. Of course the firmware can use less than that. Leaving space unused is no problem, mapping pci bars outside the hole causes problems though.

---
 hw/pci-host/piix.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/pci-host/piix.c +0 -3
index edc974e..8e41ac1 100644
@@ -345,15 +345,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     f->ram_memory = ram_memory;
 
     i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    /* Set PCI window size the way seabios has always done it. */
-    /* Power of 2 so bios can cover it with a single MTRR */
-    if (ram_size <= 0x80000000) {

hw/pci-host/piix.c PCIBus *i440fx_init(PCII440FXState **pi440fx_state, · line 351

Quoted 10 lines
hw/pci-host/piix.c +1 -6
-        i440fx->pci_info.w32.begin = 0x80000000;
-    } else if (ram_size <= 0xc0000000) {
-        i440fx->pci_info.w32.begin = 0xc0000000;
-    } else {
-        i440fx->pci_info.w32.begin = 0xe0000000;
-    }
+    i440fx->pci_info.w32.begin = pci_hole_start;
 
     memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space,
                              pci_hole_start, pci_hole_size);

please pick this up for 1.7.1.

1.7.0 has been released without this patch, also without etc/pci-info, but with etc/acpi/tables.

Quoted 6 lines

For OVMF to work with "etc/acpi/tables" correctly, with eg. a guest RAM size of 2560MB, OVMF needs:
- either this patch in qemu, or
- etc/pci-info (which won't come back), or
- a hack in OVMF that mimicks the same 0x80000000/0xc0000000/0xe0000000 logic (which I won't add).

Nominating this for v1.7.1 again.

The qemu-2.0 version (ie. a forward-port) of this patch has been merged as

ddaaefb piix: fix 32bit pci hole

Quoted 8 lines
Quoted 4 lines

If necessary I can resubmit the v1.7.1 patch.

Thanks,
Laszlo

It seems cleaner to backport this into stable.
Mike, can you pick this up please?

Sure, will queue this up for 1.7.1 and backport from upstream

Quoted 3 lines
Signature · 2 lines
-- 
MST