EXPORT_SYMBOL for pci_walk_bus?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I am working on the Xen PCI front in the Jeremey's git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git

and trying to make the drivers/pci/xen-pcifront.c to be modularized.
The reason for this is to slim down the kernel - there is no need
for the PV-OPS kernel to have the xen-pcifront.c compiled in since
most deployments aren't using it.

The Xen PCI-front is a driver for the PV guest domains (on machines
where you don't have VT-d) to have a channel with the privileged domain
to operate on PCI devices. Basically a shim that intercepts pci_conf_[read|write]
commands and forwards them to the control domain that can do the native
pci_conf_[read|write] commands. It also can do MSI/MSI-X.

The issue I am having is that during the driver initialization, it walks
the PCI devices it has found. Keep in mind that the normal x86 PCI code
has not found anything as the 0xcf8/0xcfc are not visible to the guest.
Here is the issue I am hitting:

 450         /* Claim resources before going "live" with our devices */
 451         pci_walk_bus(b, pcifront_claim_resource, pdev);

If the xen-pcifront is compiled as module, the pci_walk_bus is not
accessible as it does not have an EXPORT_SYMBOL.

One way to resolve this is to make pci_walk_bus exportable but I don't know
what the policy for this is? Is this the preferred method?

Or should try another method, where I seperate the driver in two pieces:
1). One that stays in the kernel and will just find the PCI BARs and register
them. 2)  The other that actually does the shimming?

But then I am back to the kernel having a compiled piece of code that is not
used in most deployments.

I would appreciate any ideas of how to do this correctly?

Attached is simple patch (inline and attached) for the EXPORT_SYMB in case
that is the right way of doing it.

[PATCH] [PCI]: Export pci_walk_bus function.

In preperation of modularizing Xen-pcifront (which is not in mainline -
hopefully soon), the pci_walk_bus needs to be exported so that the
xen-pcifront module can walk call the pci subsystem to walk the
PCI devices and claim them.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 drivers/pci/bus.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index cef28a7..1805f3d 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -253,3 +253,4 @@ EXPORT_SYMBOL(pci_bus_alloc_resource);
 EXPORT_SYMBOL_GPL(pci_bus_add_device);
 EXPORT_SYMBOL(pci_bus_add_devices);
 EXPORT_SYMBOL(pci_enable_bridges);
+EXPORT_SYMBOL(pci_walk_bus);
-- 
1.6.2.5


>From 54619378508ebb134ad3e669b485283bd9dc041b Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Mon, 21 Dec 2009 11:24:21 -0500
Subject: [PATCH] [PCI]: Export pci_walk_bus function.

In preperation of modularizing Xen-pcifront (which is not in mainline -
hopefully soon), the pci_walk_bus needs to be exported so that the
xen-pcifront module can walk call the pci subsystem to walk the
PCI devices and claim them.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 drivers/pci/bus.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index cef28a7..1805f3d 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -253,3 +253,4 @@ EXPORT_SYMBOL(pci_bus_alloc_resource);
 EXPORT_SYMBOL_GPL(pci_bus_add_device);
 EXPORT_SYMBOL(pci_bus_add_devices);
 EXPORT_SYMBOL(pci_enable_bridges);
+EXPORT_SYMBOL(pci_walk_bus);
-- 
1.6.2.5


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux