Re: [PATCH 1/6 v3] PCI: export some functions and macros

Previous thread: [PATCH 0/6 v3] PCI: Linux kernel SR-IOV support by Zhao, Yu on Saturday, September 27, 2008 - 1:27 am. (3 messages)

Next thread: [PATCH 2/6 v3] PCI: add new general functions by Zhao, Yu on Saturday, September 27, 2008 - 1:27 am. (3 messages)
From: Zhao, Yu
Date: Saturday, September 27, 2008 - 1:27 am

Export some functions and move some macros from c file to header file.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Alex Chiang <achiang@hp.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>

---
 drivers/pci/pci-sysfs.c |   10 ++++----
 drivers/pci/pci.c       |    2 +-
 drivers/pci/pci.h       |   20 ++++++++++++++++++
 drivers/pci/probe.c     |   50 +++++++++++++++++++++-------------------------
 drivers/pci/setup-bus.c |    4 +-
 drivers/pci/setup-res.c |    2 +-
 include/linux/pci.h     |    4 +-
 7 files changed, 54 insertions(+), 38 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 9c71858..f99160d 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -696,7 +696,7 @@ static struct bin_attribute pci_config_attr = {
                .name = "config",
                .mode = S_IRUGO | S_IWUSR,
        },
-       .size = 256,
+       .size = PCI_CFG_SPACE_SIZE,
        .read = pci_read_config,
        .write = pci_write_config,
 };
@@ -706,7 +706,7 @@ static struct bin_attribute pcie_config_attr = {
                .name = "config",
                .mode = S_IRUGO | S_IWUSR,
        },
-       .size = 4096,
+       .size = PCI_CFG_SPACE_EXP_SIZE,
        .read = pci_read_config,
        .write = pci_write_config,
 };
@@ -724,7 +724,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
        if (!sysfs_initialized)
                return -EACCES;

-       if (pdev->cfg_size < 4096)
+       if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
                retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr);
        else
                retval = sysfs_create_bin_file(&pdev->dev.kobj, &pcie_config_attr);
@@ -795,7 +795,7 @@ err_vpd:
                kfree(pdev->vpd->attr);
        }
 ...
From: Matthew Wilcox
Date: Saturday, September 27, 2008 - 5:59 am

That's absolutely not everything this patch does.  You need to split
this into smaller pieces and explain what you're doing and why for each


The original intent here was to have a pci_read_base() that called
__pci_read_base() and then did things like translate physical BAR
addresses to virtual ones.  That patch is in the archives somewhere.
We ended up not including that patch because my user found out he could
get the address he wanted from elsewhere.  I'm not sure we want to
remove the __ at this point.

The eventual goal is to fix up the BARs at this point, but there's
several architectures that will break if we do this now.  It's on my

What's going on here?  Why are you adding pci_bar_rom?  For the rom we
use pci_bar_mem32.  Take a look at, for example, the MCHBAR in the 965
spec (313053.pdf).  That's something that uses the pci_bar_mem64 type


And you don't even change the type here ... have you tested this code on

Er, this is rather important.  Why can you just delete it?

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--

From: Zhao, Yu
Date: Tuesday, October 7, 2008 - 7:23 pm

From: Jesse Barnes
Date: Wednesday, October 1, 2008 - 9:52 am

I just pushed Yanmin's cleanups here, can you separate out the rest of your 

See Matthew's comments here; the pci_read_base changes should be part of a 


These resource_size changes seem like good cleanups by themselves, can you 

Another good standalone cleanup, please submit separately.

Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
--

Previous thread: [PATCH 0/6 v3] PCI: Linux kernel SR-IOV support by Zhao, Yu on Saturday, September 27, 2008 - 1:27 am. (3 messages)

Next thread: [PATCH 2/6 v3] PCI: add new general functions by Zhao, Yu on Saturday, September 27, 2008 - 1:27 am. (3 messages)