PCI Hotplug fixes for 2.6.4-rc1
PATCH 1/1 PCI Hotplug fixes for 2.6.4-rc1
Hi,
Here are some minor PCI hotplug fixes for 2.6.4-rc1. They fix some oopses, and make the build options a lot saner and allow the distros to pick the proper options easier.
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/pci-2.6
thanks,
greg k-h
p.s. I'll send these as patches in response to this email to lkml for those who want to see them.
drivers/pci/hotplug/Kconfig | 32 ++++--------------- drivers/pci/hotplug/Makefile | 54 +++++++++++++++------------------ drivers/pci/hotplug/cpqphp.h | 1 drivers/pci/hotplug/cpqphp_core.c | 5 +++ drivers/pci/hotplug/cpqphp_ctrl.c | 47 ++++++++++++++-------------- drivers/pci/hotplug/cpqphp_pci.c | 36 +++++++++++----------- drivers/pci/hotplug/pci_hotplug_core.c | 23 ++++++++++---- drivers/pci/hotplug/pciehprm_acpi.c | 3 + drivers/pci/hotplug/shpchp.h | 3 - drivers/pci/hotplug/shpchprm_acpi.c | 3 + include/linux/pci.h | 1 11 files changed, 105 insertions(+), 103 deletions(-)
-----
Dely Sy:
o PCI Hotplug: fixes for shpc and pcie hot-plug drivers
Greg Kroah-Hartman:
o PCI Hotplug: clean up the Makefile a bit more
o PCI Hotplug: fix up the permission settings on a few of the sysfs files
o PCI Hotplug: fix stupid directory name of "pci_hotplug_slots" to be just "slots"
Torben Mathiasen:
o PCI Hotplug: Patch to get cpqphp working with IOAPIC
PATCH 1/1 PCI Hotplug fixes for 2.6.4-rc1
ChangeSet 1.1621, 2004/03/01 09:48:14-08:00, [email protected]
[PATCH] PCI Hotplug: Patch to get cpqphp working with IOAPIC
Quoted 8 lines · Dely L
Since filling out the
INTERRUPT_LINEis needed for systems running with legacy irqs and not needed for systems running with IO-APIC. Thepossible
solutions:
1) Best is there is a run-time check (a flag or an API call) that tells whether the system is running on legacy mode or IO-APIC mode. Is there such check that you know of?
Dan suggested that we look at what IRQ the hotplug controller has been assigned in the MPS table. If its < 0x10 we're in legacy/mapped mode. That would probaly work
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Do those servers work on 2.6.2 without my patch?
Yes
They work but they get
dev->irq= 9 or 11 in the APIC enabled mode. Correct?
Yes. All hot-added adapters get legacy IRQs like IRQ5 in the example below where eth2 was added after bootup:
linux:~ # cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
0: 831113 0 0 0 IO-APIC-edge timer 1: 255 0 0 0 IO-APIC-edge i8042 2: 0 0 0 0 XT-PIC cascade 5: 0 0 0 0 XT-PIC eth2 8: 2 0 0 0 IO-APIC-edge rtc 12: 92 0 0 0 IO-APIC-edge i8042 14: 29 0 0 0 IO-APIC-edge ide0 20: 0 0 0 0 IO-APIC-level cciss0 21: 0 0 0 0 IO-APIC-level cciss1 29: 107 0 0 0 IO-APIC-level eth0 30: 7702 0 0 0 IO-APIC-level aic7xxx 31: 30 0 0 0 IO-APIC-level aic7xxx 34: 336 0 0 0 IO-APIC-level cpqphp.o, cpqphp.o NMI: 0 0 0 0 LOC: 830760 830893 830892 830891 ERR: 0 MIS: 0
I attached a patch that does the legacy mode check that Dan suggested and IRQs for hot-added adapters seems to be given out in the APIC range.
drivers/pci/hotplug/cpqphp.h | 1 drivers/pci/hotplug/cpqphp_core.c | 5 ++++ drivers/pci/hotplug/cpqphp_ctrl.c | 47 +++++++++++++++++++------------------- drivers/pci/hotplug/cpqphp_pci.c | 36 ++++++++++++++--------------- 4 files changed, 48 insertions(+), 41 deletions(-)
drivers/pci/hotplug/cpqphp.h +1 -0
@@ -444,6 +444,7 @@/* Global variables */ extern int cpqhp_debug; +extern int cpqhp_legacy_mode;extern struct controller *cpqhp_ctrl_list;extern struct pci_func *cpqhp_slot_list[256 ];
drivers/pci/hotplug/cpqphp_core.c +5 -0
@@ -49,6 +49,7 @@/* Global variables */ int cpqhp_debug; +int cpqhp_legacy_mode;struct controller *cpqhp_ctrl_list;/* = NULL */ struct pci_func *cpqhp_slot_list[256 ];
@@ -1169,6 +1170,10 @@*/ // The next line is required for cpqhp_find_available_resources ctrl->interrupt = pdev->irq; +if (ctrl->interrupt <0x10 ) { + cpqhp_legacy_mode =1 ; +dbg ("System seems to be configured for Full Table Mapped MPS mode\n" ); + } ctrl->cfgspc_irq =0 ;pci_read_config_byte (pdev,PCI_INTERRUPT_LINE , &ctrl->cfgspc_irq);
drivers/pci/hotplug/cpqphp_ctrl.c +24 -23
57 lines not on this page · raw message
drivers/pci/hotplug/cpqphp_pci.c +18 -18
@@ -151,32 +151,32 @@*/ int cpqhp_set_irq (u8 bus_num,u8 dev_num,u8 int_pin,u8 irq_num) { -#if !defined(CONFIG_X86_IO_APIC )int rc;u16 temp_word;struct pci_dev fakedev;struct pci_bus fakebus; - fakedev.devfn = dev_num <<3 ; - fakedev.bus = &fakebus; - fakebus.number = bus_num; -dbg ("%s: dev %d, bus %d, pin %d, num %d\n" , - __FUNCTION__, dev_num, bus_num, int_pin, irq_num); - rc =pcibios_set_irq_routing (&fakedev, int_pin -0x0a , irq_num); -dbg ("%s: rc %d\n" , __FUNCTION__, rc); -if (!rc) -return !rc; +if (cpqhp_legacy_mode) { + fakedev.devfn = dev_num <<3 ; + fakedev.bus = &fakebus; + fakebus.number = bus_num; +dbg ("%s: dev %d, bus %d, pin %d, num %d\n" , + __FUNCTION__, dev_num, bus_num, int_pin, irq_num); + rc =pcibios_set_irq_routing (&fakedev, int_pin -0x0a , irq_num); +dbg ("%s: rc %d\n" , __FUNCTION__, rc); +if (!rc) +return !rc; -// set the Edge Level Control Register (ELCR) - temp_word =inb (0x4d0 ); - temp_word |=inb (0x4d1 ) <<8 ; +// set the Edge Level Control Register (ELCR) + temp_word =inb (0x4d0 ); + temp_word |=inb (0x4d1 ) <<8 ; - temp_word |=0x01 << irq_num; + temp_word |=0x01 << irq_num; -// This should only be for x86 as it sets the Edge Level Control Register -outb ((u8) (temp_word &0xFF ),0x4d0 ); -outb ((u8) ((temp_word &0xFF00 ) >>8 ),0x4d1 ); -#endif +// This should only be for x86 as it sets the Edge Level Control Register +outb ((u8) (temp_word &0xFF ),0x4d0 ); +outb ((u8) ((temp_word &0xFF00 ) >>8 ),0x4d1 ); + }return 0 ; }
ChangeSet 1.1622, 2004/03/01 16:18:12-08:00, [email protected]
PCI Hotplug: fix stupid directory name of "pci_hotplug_slots" to be just "slots"
drivers/pci/hotplug/pci_hotplug_core.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
drivers/pci/hotplug/pci_hotplug_core.c +13 -2
@@ -104,8 +104,19 @@ .release = &hotplug_slot_release, }; -decl_subsys (pci_hotplug_slots, &hotplug_slot_ktype,NULL ); - +/* +* We create a struct subsystem on our own and not use decl_subsys so +* we can have a sane name "slots" in sysfs, yet still keep a good +* global variable name "pci_hotplug_slots_subsys. +* If the decl_subsys() #define ever changes, this declaration will +* need to be update to make sure everything is initialized properly. +*/ +struct subsystem pci_hotplug_slots_subsys = { + .kset = { + .kobj = { .name ="slots" }, + .ktype = &hotplug_slot_ktype, + } +};/* these strings match up with the values in pci_bus_speed */ static char *pci_bus_speed_strings[] = {
ChangeSet 1.1623, 2004/03/02 13:11:26-08:00, [email protected]
PCI Hotplug: fix up the permission settings on a few of the sysfs files.
Thanks to Linda Xie for pointing this out.
drivers/pci/hotplug/pci_hotplug_core.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/pci/hotplug/pci_hotplug_core.c +4 -4
@@ -292,7 +292,7 @@ }static struct hotplug_slot_attribute hotplug_slot_attr_latch = { - .attr = {.name ="latch" , .mode =S_IFREG |S_IRUGO |S_IWUSR }, + .attr = {.name ="latch" , .mode =S_IFREG |S_IRUGO }, .show = latch_read_file, };
@@ -311,7 +311,7 @@ }static struct hotplug_slot_attribute hotplug_slot_attr_presence = { - .attr = {.name ="adapter" , .mode =S_IFREG |S_IRUGO |S_IWUSR }, + .attr = {.name ="adapter" , .mode =S_IFREG |S_IRUGO }, .show = presence_read_file, };
@@ -361,7 +361,7 @@ }static struct hotplug_slot_attribute hotplug_slot_attr_max_bus_speed = { - .attr = {.name ="max_bus_speed" , .mode =S_IFREG |S_IRUGO |S_IWUSR }, + .attr = {.name ="max_bus_speed" , .mode =S_IFREG |S_IRUGO }, .show = max_bus_speed_read_file, };
@@ -387,7 +387,7 @@ }static struct hotplug_slot_attribute hotplug_slot_attr_cur_bus_speed = { - .attr = {.name ="cur_bus_speed" , .mode =S_IFREG |S_IRUGO |S_IWUSR }, + .attr = {.name ="cur_bus_speed" , .mode =S_IFREG |S_IRUGO }, .show = cur_bus_speed_read_file, };
ChangeSet 1.1624, 2004/03/02 19:10:44-08:00, [email protected]
[PATCH] PCI Hotplug: fixes for shpc and pcie hot-plug drivers
This patch contains the following:
1. Fix up the pcie and shpc options to make it easier for distros
to use as what we have discussed;
2. Fix bug encountered when installing the drivers on non-hotplug
systems;3. Put PCI_CAP_ID_SHPC in include/linux/pci.h
drivers/pci/hotplug/Kconfig | 30 ++++++------------------------ drivers/pci/hotplug/Makefile | 24 ++++++++++++++---------- drivers/pci/hotplug/pciehprm_acpi.c | 3 +++ drivers/pci/hotplug/shpchp.h | 3 --- drivers/pci/hotplug/shpchprm_acpi.c | 3 +++ include/linux/pci.h | 1 + 6 files changed, 27 insertions(+), 37 deletions(-)
drivers/pci/hotplug/Kconfig +6 -24
@@ -135,23 +135,14 @@ When in doubt, say N. config HOTPLUG_PCI_PCIE_POLL_EVENT_MODE - bool "Use polling mechanism for hot-plug events." + bool "Use polling mechanism for hot-plug events (for testing purpose)" depends on HOTPLUG_PCI_PCIE help Say Y here if you want to use the polling mechanism for hot-plug - events. + events for early platform testing. When in doubt, say N. -config HOTPLUG_PCI_PCIE_PHPRM_NONACPI - bool "Non-ACPI: Use $HPRT for resource/configuration" - depends on HOTPLUG_PCI_PCIE - help - Say Y here if Hotplug resource/configuration information is provided - by platform BIOS $HPRT or bridge resource information, not by ACPI. - - When in doubt, say N. - config HOTPLUG_PCI_SHPC tristate "SHPC PCI Hotplug driver" depends on HOTPLUG_PCI
@@ -165,29 +156,20 @@ When in doubt, say N. config HOTPLUG_PCI_SHPC_POLL_EVENT_MODE - bool "Use polling mechanism for hot-plug events" + bool "Use polling mechanism for hot-plug events (for testing purpose)" depends on HOTPLUG_PCI_SHPC help Say Y here if you want to use the polling mechanism for hot-plug - events. - - When in doubt, say N. - -config HOTPLUG_PCI_SHPC_PHPRM_NONACPI - bool "Non-ACPI: Use $HPRT for resource/configuration" - depends on HOTPLUG_PCI_SHPC - help - Say Y here if Hotplug resource/configuration information is provided - by platform BIOS $HPRT or bridge resource information, not by ACPI. + events for early platform testing. When in doubt, say N. config HOTPLUG_PCI_SHPC_PHPRM_LEGACY bool "For AMD SHPC only: Use $HRT for resource/configuration" - depends on HOTPLUG_PCI_SHPC && HOTPLUG_PCI_SHPC_PHPRM_NONACPI + depends on HOTPLUG_PCI_SHPC && !ACPI_BUS help Say Y here for AMD SHPC. You have to select this option if you are - using this driver on AMD platform with SHPC. + using this driver on platform with AMD SHPC. config HOTPLUG_PCI_RPA tristate "RPA PCI Hotplug driver"
drivers/pci/hotplug/Makefile +14 -10
@@ -51,10 +51,12 @@ pciehp_sysfs.o \ pciehp_hpc.o -ifeq ($(CONFIG_HOTPLUG_PCI_PCIE_PHPRM_NONACPI),y) - pciehp-objs += pciehprm_nonacpi.o -else - pciehp-objs += pciehprm_acpi.o +ifdef CONFIG_HOTPLUG_PCI_PCIE + ifdef CONFIG_ACPI_BUS + pciehp-objs += pciehprm_acpi.o + else + pciehp-objs += pciehprm_nonacpi.o + endif endif shpchp-objs := shpchp_core.o \
@@ -63,12 +65,14 @@ shpchp_sysfs.o \ shpchp_hpc.o -ifeq ($(CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY),y) - shpchp-objs += shpchprm_legacy.o -else - ifeq ($(CONFIG_HOTPLUG_PCI_SHPC_PHPRM_NONACPI),y) - shpchp-objs += shpchprm_nonacpi.o - else +ifdef CONFIG_HOTPLUG_PCI_SHPC + ifdef CONFIG_ACPI_BUS shpchp-objs += shpchprm_acpi.o + else + ifdef CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY + shpchp-objs += shpchprm_legacy.o + else + shpchp-objs += shpchprm_nonacpi.o + endif endif endif
drivers/pci/hotplug/pciehprm_acpi.c +3 -0
@@ -1188,6 +1188,9 @@static void pciehprm_free_bridges (struct acpi_bridge *ab) { +if (!ab) +return ; +if (ab->child)pciehprm_free_bridges (ab->child);
drivers/pci/hotplug/shpchp.h +0 -3
@@ -154,9 +154,6 @@/* Define AMD SHPC ID */ #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 -/* Define SHPC CAP ID - not defined in kernel yet */ -#define PCI_CAP_ID_SHPC 0x0C -#define INT_BUTTON_IGNORE 0#define INT_PRESENCE_ON 1#define INT_PRESENCE_OFF 2
drivers/pci/hotplug/shpchprm_acpi.c +3 -0
@@ -1187,6 +1187,9 @@static void shpchprm_free_bridges (struct acpi_bridge *ab) { +if (!ab) +return ; +if (ab->child)shpchprm_free_bridges (ab->child);
include/linux/pci.h +1 -0
@@ -199,6 +199,7 @@#define PCI_CAP_ID_MSI 0x05/* Message Signalled Interrupts */ #define PCI_CAP_ID_CHSWP 0x06/* CompactPCI HotSwap */ #define PCI_CAP_ID_PCIX 0x07/* PCI-X */ +#define PCI_CAP_ID_SHPC 0x0C/* PCI Standard Hot-Plug Controller */ #define PCI_CAP_ID_EXP 0x10/* PCI Express */ #define PCI_CAP_ID_MSIX 0x11/* MSI-X */ #define PCI_CAP_LIST_NEXT 1/* Next capability in the list */
ChangeSet 1.1625, 2004/03/02 19:25:34-08:00, [email protected]
PCI Hotplug: clean up the Makefile a bit more.
drivers/pci/hotplug/Makefile | 30 ++++++++++++------------------ 1 files changed, 12 insertions(+), 18 deletions(-)
drivers/pci/hotplug/Makefile +12 -18
@@ -50,13 +50,10 @@ pciehp_pci.o \ pciehp_sysfs.o \ pciehp_hpc.o - -ifdef CONFIG_HOTPLUG_PCI_PCIE - ifdef CONFIG_ACPI_BUS - pciehp-objs += pciehprm_acpi.o - else - pciehp-objs += pciehprm_nonacpi.o - endif +ifdef CONFIG_ACPI_BUS + pciehp-objs += pciehprm_acpi.o +else + pciehp-objs += pciehprm_nonacpi.o endif shpchp-objs := shpchp_core.o \
@@ -64,15 +61,12 @@ shpchp_pci.o \ shpchp_sysfs.o \ shpchp_hpc.o - -ifdef CONFIG_HOTPLUG_PCI_SHPC - ifdef CONFIG_ACPI_BUS - shpchp-objs += shpchprm_acpi.o - else - ifdef CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY - shpchp-objs += shpchprm_legacy.o - else - shpchp-objs += shpchprm_nonacpi.o - endif - endif +ifdef CONFIG_ACPI_BUS + shpchp-objs += shpchprm_acpi.o +else + ifdef CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY + shpchp-objs += shpchprm_legacy.o + else + shpchp-objs += shpchprm_nonacpi.o + endif endif
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Greg,
Quoted 5 lines · Greg KH
drivers/pci/hotplug/pci_hotplug_core.c +3
-2-decl_subsys (pci_hotplug_slots, &hotplug_slot_ktype,NULL ); - +/* +* We create a struct subsystem on our own and not use decl_subsys so +* we can have a sane name "slots" in sysfs, yet still keep a good
drivers/pci/hotplug/pci_hotplug_core.c line 119
Quoted 10 lines
drivers/pci/hotplug/pci_hotplug_core.c +10
-0+* global variable name "pci_hotplug_slots_subsys. +* If the decl_subsys() #define ever changes, this declaration will +* need to be update to make sure everything is initialized properly. +*/ +struct subsystem pci_hotplug_slots_subsys = { + .kset = { + .kobj = { .name ="slots" }, + .ktype = &hotplug_slot_ktype, + } +};
How about creating a decl_subsys_name() for creating sane names, like we have for the module parameters?
That whould solve all those problems, since this is used not only once.
Regards
Ingo Oeser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFARsoBU56oYWuOrkARAk0NAKDWSddUZQSD25ywMKs5zrpcrAJefACgjdV8 1d6axZhMy8k5qCozsrExrBc=
=sQZY
-----END PGP SIGNATURE-----
Quoted 22 lines · Ingo Oeser
Hi Greg,
Quoted 5 lines · Greg KH
drivers/pci/hotplug/pci_hotplug_core.c +3
-2-decl_subsys (pci_hotplug_slots, &hotplug_slot_ktype,NULL ); - +/* +* We create a struct subsystem on our own and not use decl_subsys so +* we can have a sane name "slots" in sysfs, yet still keep a good drivers/pci/hotplug/pci_hotplug_core.c line 119
Quoted 10 lines
drivers/pci/hotplug/pci_hotplug_core.c +10
-0+* global variable name "pci_hotplug_slots_subsys. +* If the decl_subsys() #define ever changes, this declaration will +* need to be update to make sure everything is initialized properly. +*/ +struct subsystem pci_hotplug_slots_subsys = { + .kset = { + .kobj = { .name ="slots" }, + .ktype = &hotplug_slot_ktype, + } +};How about creating a
decl_subsys_name()for creating sane names, like we have for the module parameters?
Quoted 1 line
That whould solve all those problems, since this is used not only once.
Good idea. Care to make up such a patch?
thanks,
greg k-h