Hi Greg, Kenji-san,
First, many thanks to Kenji-san for his code review and
subsequent patches. They really improved the code a lot!I've merged all his changes into my series, with the thought that
it will be better to contain all the fixes in one spot for future
bisectability purposes.I gave Kenji-san credit in the changelog, as well at the top of
drivers/acpi/pci_slot.c, but if that's not sufficient, we can
certainly add more attributions where it's appropriate. Please
let me know.This is v11 of the physical pci_slot series. It should be *very*
close to what I'd like to see in linux-next for further testing.
I would appreciate any final code review and if it looks ok,
maybe finally get it merged upstream. ;)Thanks to all testers, reviewers, and commenters.
/ac
--
Detect all physical PCI slots as described by ACPI, and create
entries in /sys/bus/pci/slots/.Not all physical slots are hotpluggable, and the acpiphp module
does not detect them. Now we know the physical PCI geography of
our system, without caring about hotplug.v10 -> v11:
Thanks to Kenji Kanishige for the following updates:
- Fix dmi table for Fujitsu PRIMEQUEST
- Fix _STA evaluation
- Use list_head for pci slot list
- Fix slot removal pathv9 -> v10:
Allow an hp driver to override the pci_slot kobject name.v8 -> v9:
Add DMI quirk for Fujitsu machines; eval _STA before _SUNv6 -> v8:
No changev5 -> v6:
Add debugging information.v4 -> v5:
Convert to a tristate module.Remove #ifdef CONFIG_ACPI_PCI_SLOT, as struct pci_slot
objects are properly refcounted, and multiple calls to
pci_create/destroy_slot work just fine.Remove prior -EBUSY changes, as they have been folded
into the Introduce pci_slot patch.v3 -> v4:
Always attempt to call pci_create_slot from pcihp_core to
cover cases of
a) user did not say Y to Kconfig option ACPI_PCI_SLOT
b) native PCIe hotplug driver registering on a
non-ACPI system.Return -EBUSY if an hp driver attempts to register a slot
that is already registered to another driver. Do not
consider that to be an error condition in acpiphp and pciehp.v2 -> v3:
Add Kconfig option to driver, allowing users to [de]config
this driver. If configured, take slightly different code
paths in pci_hp_register and pci_hp_deregister.v1 -> v2:
Now recursively discovering p2p bridges and slots
underneath them. Hopefully, this will prevent us
from trying to register the same slot multiple times.Signed-off-by: Alex Chiang <achiang@hp.com>
---
drivers/acpi/Kconfig | 9 +
drivers/acpi/Makefile | 1 +
drivers/acpi/pci_slot.c | 370 ++++++++++++++++++++++++++++++++
drivers/pci/hotplug/pci_hotplug_core.c | 16 +...
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Thanks,
Kenji Kaneshige--
Currently, /sys/bus/pci/slots/ only exposes hotplug attributes
when a hotplug driver is loaded, but PCI slots have attributes
such as address, speed, width, etc. that are not related to
hotplug at all.Introduce pci_slot as the primary data structure and kobject
model. Hotplug attributes described in hotplug_slot become a
secondary structure associated with the pci_slot.This patch only creates the infrastructure that allows the
separation of PCI slot attributes and hotplug attributes.
In this patch, the PCI hotplug core remains the only user of this
infrastructure, and thus, /sys/bus/pci/slots/ will still only
become populated when a hotplug driver is loaded.A later patch in this series will add a second user of this new
infrastructure and demonstrate splitting the task of exposing
pci_slot attributes from hotplug_slot attributes.- Make pci_slot the primary sysfs entity. hotplug_slot becomes a
subsidiary structure.
o pci_create_slot() creates and registers a slot with the PCI core
o pci_slot_add_hotplug() gives it hotplug capability- Change the prototype of pci_hp_register() to take the bus and
slot number (on parent bus) as parameters.- Remove all the ->get_address methods since this functionality is
now handled by pci_slot directly.v10 -> v11:
Thanks to Kenji Kanishige for the following updates
- Add missing semaphore for slot release
- Use list_head for pci slot list
- Replace dbg with pr_debug
- Remove useless release handler
- Use .default_attrs for address file
- Fix return value of pci_create_slot()
- Change return value of pci_destroy_slot()
- Trivial cleanups for slot.c
- add missing lock for hotplug slot listv9 -> v10:
No changev8 -> v9:
Fixed printk output, changed to American spelling of
"initialization"v7 -> v8:
Removed externs from C files.Taught sn_hp_destroy and sn_hotplug_slot_register about
struct pci_slot.v6 -> v7:
Refresh to new kobject model.v5 -> ...
I've so far fixed four compile errors in this patch. It's your turn:
drivers/pci/hotplug/rpaphp_slot.c: In function 'rpaphp_deregister_slot':
drivers/pci/hotplug/rpaphp_slot.c:139: error: 'struct hotplug_slot' has no member named 'kobj'
drivers/pci/hotplug/rpaphp_slot.c: In function 'rpaphp_register_slot':
drivers/pci/hotplug/rpaphp_slot.c:173: error: 'struct hotplug_slot' has no member named 'kobj'
--
Hi Andrew,
Sorry for the sloppiness. :(
In the future, do you have a better suggestion on how to do large
sweeps on code for hardware that one might not own? Is there an
easier way other than setting up a cross-compiler environment?Thanks.
/ac
Subject: [PATCH] remove rpaphp 'address_read_file'
From: Alex Chiang <achiang@hp.com>Physical pci_slot removed ->get_address methods from individual
PCI hotplug drivers, but overlooked rpaphp, causing build errors.Remove rpaphp's 'address_read_file' as well.
Signed-off-by: Alex Chiang <achiang@hp.com>
---
drivers/pci/hotplug/rpaphp_slot.c | 37 -------------------------------------
1 files changed, 0 insertions(+), 37 deletions(-)diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 8e5fff0..0d4cfc7 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -33,33 +33,6 @@
#include <asm/rtas.h>
#include "rpaphp.h"-static ssize_t address_read_file (struct hotplug_slot *php_slot, char *buf)
-{
- int retval;
- struct slot *slot = (struct slot *)php_slot->private;
- struct pci_bus *bus;
-
- if (!slot)
- return -ENOENT;
-
- bus = slot->bus;
- if (!bus)
- return -ENOENT;
-
- if (bus->self)
- retval = sprintf(buf, pci_name(bus->self));
- else
- retval = sprintf(buf, "%04x:%02x:00.0",
- pci_domain_nr(bus), bus->number);
-
- return retval;
-}
-
-static struct hotplug_slot_attribute php_attr_address = {
- .attr = {.name = "address", .mode = S_IFREG | S_IRUGO},
- .show = address_read_file,
-};
-
/* free up the memory used by a slot */
static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot)
{
@@ -135,9 +108,6 @@ int rpaphp_deregister_slot(struct slot *slot)list_del(&slot->rpaphp_slot_list);
- /* remove "address" file */
- sysfs_remove_file(&php_slot->kobj, &php_attr_address.attr);
-
retval = pci_hp_deregister(php_slot);
if (retval)
e...
Setting up a cross-compile environment is easy -
http://userweb.kernel.org/~akpm/cross-compilers/ has several.
--
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Thanks,
Kenji Kaneshige--
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Export kobject_rename() to fix the following link error. This happens
when pci_hotplug_core driver is compiled as a kernel module.ERROR: "kobject_rename" [drivers/pci/hotplug/pci_hotplug.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Alex Chiang <achiang@hp.com>
---
lib/kobject.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)diff --git a/lib/kobject.c b/lib/kobject.c
index 0d03252..e2a9f65 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -456,6 +456,7 @@ out:return error;
}
+EXPORT_SYMBOL_GPL(kobject_rename);/**
* kobject_move - move object to another parent
--
1.5.3.1.g1e61--
Register one slot per slot, rather than one slot per function.
Change the name of the slot to fake%d instead of the pci address.Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
drivers/pci/hotplug/fakephp.c | 85 ++++++++++++++--------------------------
1 files changed, 30 insertions(+), 55 deletions(-)diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 94b6401..6c14b4d 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -66,6 +66,7 @@ struct dummy_slot {
struct pci_dev *dev;
struct work_struct remove_work;
unsigned long removed;
+ char name[8];
};static int debug;
@@ -100,6 +101,7 @@ static int add_slot(struct pci_dev *dev)
struct dummy_slot *dslot;
struct hotplug_slot *slot;
int retval = -ENOMEM;
+ static int count = 1;slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
if (!slot)
@@ -113,13 +115,14 @@ static int add_slot(struct pci_dev *dev)
slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;- slot->name = &dev->dev.bus_id[0];
- dbg("slot->name = %s\n", slot->name);
-
dslot = kzalloc(sizeof(struct dummy_slot), GFP_KERNEL);
if (!dslot)
goto error_info;+ slot->name = dslot->name;
+ snprintf(slot->name, sizeof(dslot->name), "fake%d", count++);
+ dbg("slot->name = %s\n", slot->name);
+
slot->ops = &dummy_hotplug_slot_ops;
slot->release = &dummy_release;
slot->private = dslot;
@@ -148,17 +151,17 @@ error:
static int __init pci_scan_buses(void)
{
struct pci_dev *dev = NULL;
- int retval = 0;
+ int lastslot = 0;while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
- retval = add_slot(dev);
- if (retval) {
- pci_dev_put(dev);
- break;
- }
+ if (PCI_FUNC(dev->devfn) > 0 &&
+ lastslot == PCI_SLOT(dev->devfn))
+ continue;
+ la...
| Amit K. Arora | [RFC] Heads up on sys_fallocate() |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Linus Torvalds | Linux 2.6.25-rc4 |
| Greg KH | Linux 2.6.25.10 |
git: | |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Ilpo Järvinen | Re: Strange Application bug, race in MSG_PEEK complaints (was: Bug#513695: fetchma... |
