Hotplug multi-func device doesn't work, only func 0 are regiestered to guest pci driver, this patchset just add device entry in ACPI DSDT tables for all functions in the slot.
---
Amos Kong (2): Fix regression of commit 87b533bf hotplug: Add device per func in ACPI DSDT tables
0 files changed, 0 insertions(+), 0 deletions(-)
-- Amos
After adding more device entries in ACPI DSDT tables, the filesize of bios.bin changed from 128K to 256K. But bios could not initialize successfully.
This is a regression since seabios commit 87b533bf. Prior to that commit, seabios did not mark the early 32bit initialization code as init code. However, a side effect of marking that code (handle_post) as init code is that it is more likely the linker could place the code at an address less than 0xe0000. The patch (just a hack) would cover up the issue.
Signed-off-by: Amos Kong akong@redhat.com --- 0 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/src/post.c b/src/post.c index e195e89..bc2e548 100644 --- a/src/post.c +++ b/src/post.c @@ -336,7 +336,7 @@ reloc_init(void) // Start of Power On Self Test (POST) - the BIOS initilization phase. // This function does the setup needed for code relocation, and then // invokes the relocation and main setup code. -void VISIBLE32INIT +void VISIBLE32FLAT handle_post(void) { debug_serial_setup(); @@ -356,6 +356,14 @@ handle_post(void)
// Allow writes to modify bios area (0xf0000) make_bios_writable(); + + void handle_post2(void); + handle_post2(); +} + +void VISIBLE32INIT +handle_post2(void) +{ HaveRunPost = 1;
// Detect ram and setup internal malloc.
Only func 0 is registered to guest driver (we can only found func 0 in slot->funcs list of driver), the other functions could not be cleaned when hot-removing the whole slot. This patch adds device per function in ACPI DSDT tables.
Have tested with linux/winxp/win7, hot-adding/hot-remving, single/multiple function device, they are all fine.
new acpi-dst.hex(332K): http://amos-kong.rhcloud.com/pub/acpi-dsdt.hex
Signed-off-by: Amos Kong akong@redhat.com --- src/acpi-dsdt.dsl | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl index 08412e2..d1426ec 100644 --- a/src/acpi-dsdt.dsl +++ b/src/acpi-dsdt.dsl @@ -128,9 +128,9 @@ DefinitionBlock ( PCRM, 32, }
-#define hotplug_slot(name, nr) \ - Device (S##name) { \ - Name (_ADR, nr##0000) \ +#define hotplug_func(name, nr, adr, fn) \ + Device (S##name##fn) { \ + Name (_ADR, adr) \ Method (_EJ0,1) { \ Store(ShiftLeft(1, nr), B0EJ) \ Return (0x0) \ @@ -138,6 +138,16 @@ DefinitionBlock ( Name (_SUN, name) \ }
+#define hotplug_slot(name, nr) \ + hotplug_func(name, nr, nr##0000, 0) \ + hotplug_func(name, nr, nr##0001, 1) \ + hotplug_func(name, nr, nr##0002, 2) \ + hotplug_func(name, nr, nr##0003, 3) \ + hotplug_func(name, nr, nr##0004, 4) \ + hotplug_func(name, nr, nr##0005, 5) \ + hotplug_func(name, nr, nr##0006, 6) \ + hotplug_func(name, nr, nr##0007, 7) + hotplug_slot(1, 0x0001) hotplug_slot(2, 0x0002) hotplug_slot(3, 0x0003) @@ -842,13 +852,22 @@ DefinitionBlock ( Return(0x01) }
-#define gen_pci_hotplug(nr) \ +#define gen_pci_hotplug_func(nr, fn) \ If (And(_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \ - Notify(_SB.PCI0.S##nr, 1) \ + Notify(_SB.PCI0.S##nr##fn, 1) \ } \ If (And(_SB.PCI0.PCID, ShiftLeft(1, nr))) { \ - Notify(_SB.PCI0.S##nr, 3) \ + Notify(_SB.PCI0.S##nr##fn, 3) \ } +#define gen_pci_hotplug(nr) \ + gen_pci_hotplug_func(nr, 0) \ + gen_pci_hotplug_func(nr, 1) \ + gen_pci_hotplug_func(nr, 2) \ + gen_pci_hotplug_func(nr, 3) \ + gen_pci_hotplug_func(nr, 4) \ + gen_pci_hotplug_func(nr, 5) \ + gen_pci_hotplug_func(nr, 6) \ + gen_pci_hotplug_func(nr, 7)
Method(_L01) { gen_pci_hotplug(1)
From 4678a3cb0e0a3cd7a4bc3d284c5719fdba90bc61 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor kevin@koconnor.net Date: Tue, 20 Sep 2011 15:43:55 +0800 Subject: [PATCH V2] Fix regression of commit 87b533bf
From: Kevin O'Connor kevin@koconnor.net
After adding more device entries in ACPI DSDT tables, the filesize of bios.bin changed from 128K to 256K. But bios could not initialize successfully.
This is a regression since seabios commit 87b533bf. Prior to that commit, seabios did not mark the early 32bit initialization code as init code. However, a side effect of marking that code (handle_post) as init code is that it is more likely the linker could place the code at an address less than 0xe0000. The patch (just a hack) would cover up the issue.
--- Changes from v1: - correct the attribution
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/post.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/post.c b/src/post.c index e195e89..bc2e548 100644 --- a/src/post.c +++ b/src/post.c @@ -336,7 +336,7 @@ reloc_init(void) // Start of Power On Self Test (POST) - the BIOS initilization phase. // This function does the setup needed for code relocation, and then // invokes the relocation and main setup code. -void VISIBLE32INIT +void VISIBLE32FLAT handle_post(void) { debug_serial_setup(); @@ -356,6 +356,14 @@ handle_post(void)
// Allow writes to modify bios area (0xf0000) make_bios_writable(); + + void handle_post2(void); + handle_post2(); +} + +void VISIBLE32INIT +handle_post2(void) +{ HaveRunPost = 1;
// Detect ram and setup internal malloc.