Xen-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found] <1425868467-9667-1-git-send-email-wangyijing@huawei.com>
@ 2015-03-09  2:34 ` Yijing Wang
  2015-03-09  2:34 ` [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number Yijing Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-09  2:34 UTC (permalink / raw)
  Cc: linux-ia64, linux-pci, Yijing Wang, Guan Xuetao, Russell King,
	x86, Geert Uytterhoeven, Benjamin Herrenschmidt, xen-devel,
	Arnd Bergmann, Marc Zyngier, Rusty Russell, linux-m68k,
	Bjorn Helgaas, Thomas Gleixner, Yinghai Lu, linux-arm-kernel,
	Liviu Dudau, Tony Luck, linux-kernel, Jiang Liu, linux-alpha,
	David S. Miller

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel@lists.xenproject.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/xen-pcifront.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..9e7c28b 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -21,6 +21,7 @@
 #include <linux/bitops.h>
 #include <linux/time.h>
 #include <xen/platform_pci.h>
+#include "pci.h"
 
 #include <asm/xen/swiotlb-xen.h>
 #define INVALID_GRANT_REF (0)
@@ -446,6 +447,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +472,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
+	pci_add_resource(&resources, &busn_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a
 	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
       [not found] <1425868467-9667-1-git-send-email-wangyijing@huawei.com>
  2015-03-09  2:34 ` [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented() Yijing Wang
@ 2015-03-09  2:34 ` Yijing Wang
       [not found] ` <1425868467-9667-5-git-send-email-wangyijing@huawei.com>
       [not found] ` <1425868467-9667-8-git-send-email-wangyijing@huawei.com>
  3 siblings, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-09  2:34 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-sh, linux-pci, sparclinux,
	Chris Metcalf, Paul Mackerras, Yijing Wang, Guan Xuetao,
	linux-s390, Russell King, Michael Ellerman, x86, Sebastian Ott,
	Geert Uytterhoeven, Gerald Schaefer, Benjamin Herrenschmidt,
	xen-devel, Matt Turner, Fenghua Yu, Arnd Bergmann, Marc Zyngier,
	Rusty Russell, linux-m68k, Ivan Kokshaysky, Bjorn

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Richard Henderson <rth@twiddle.net>
CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
CC: Matt Turner <mattst88@gmail.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Fenghua Yu <fenghua.yu@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Gerald Schaefer <gerald.schaefer@de.ibm.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-ia64@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linuxppc-dev@lists.ozlabs.org
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: xen-devel@lists.xenproject.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    4 ++--
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    5 +++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    7 ++++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 42 insertions(+), 30 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 5c845ad..deb0a36 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -336,8 +336,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno),
+				alpha_mv.pci_ops, hose, &resources);
 		if (!bus)
 			continue;
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 700686d..be0bbeb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,10 +206,10 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	if (!bus)
 		return;
-
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 48cc657..675749f 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 1be65eb..7e0b7f9 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus == NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 6d8d173..34a32ec 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1350,8 +1350,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..86f8d2b 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2a525c9..a467aca 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1612,8 +1612,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index a2a7391..20e662f 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -770,8 +770,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..116f80f 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 9ce5afe..838fe1e 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -667,8 +667,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 9475a74..25b0d9b 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,9 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, 0),
+				controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index b1df847..f6f41f3 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 6ac2738..ad0e926 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -424,9 +424,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+				(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL,
+				PCI_DOMBUS(domain, busnum), &pci_root_ops,
+				sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 0cbc723..0160280 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -486,7 +486,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 9e7c28b..af6144a 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -479,8 +479,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found] ` <1425868467-9667-5-git-send-email-wangyijing@huawei.com>
@ 2015-03-11 22:32   ` Bjorn Helgaas
       [not found]   ` <20150311223211.GB1082@google.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Bjorn Helgaas @ 2015-03-11 22:32 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-ia64, linux-pci, Guan Xuetao, Russell King, x86,
	Geert Uytterhoeven, Benjamin Herrenschmidt, xen-devel,
	Arnd Bergmann, Marc Zyngier, Rusty Russell, linux-m68k,
	Thomas Gleixner, Yinghai Lu, linux-arm-kernel, Liviu Dudau,
	Tony Luck, linux-kernel, Jiang Liu, linux-alpha, David S. Miller

On Mon, Mar 09, 2015 at 10:34:01AM +0800, Yijing Wang wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Use pci_scan_root_bus() instead of deprecated function
> pci_scan_bus_parented().
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: xen-devel@lists.xenproject.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/xen-pcifront.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index b1ffebe..9e7c28b 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -21,6 +21,7 @@
>  #include <linux/bitops.h>
>  #include <linux/time.h>
>  #include <xen/platform_pci.h>
> +#include "pci.h"
>  
>  #include <asm/xen/swiotlb-xen.h>
>  #define INVALID_GRANT_REF (0)
> @@ -446,6 +447,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>  				 unsigned int domain, unsigned int bus)
>  {
>  	struct pci_bus *b;
> +	LIST_HEAD(resources);
>  	struct pcifront_sd *sd = NULL;
>  	struct pci_bus_entry *bus_entry = NULL;
>  	int err = 0;
> @@ -470,17 +472,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>  		err = -ENOMEM;
>  		goto err_out;
>  	}
> +	pci_add_resource(&resources, &ioport_resource);
> +	pci_add_resource(&resources, &iomem_resource);
> +	pci_add_resource(&resources, &busn_resource);

Since I don't want to export busn_resource, you might have to allocate your
own struct resource for it here.  And, of course, figure out the details of
which PCI domain you're in and whether you need to share one struct
resource across several host bridges in the same domain.

>  	pcifront_init_sd(sd, domain, bus, pdev);
>  
>  	pci_lock_rescan_remove();
>  
> -	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
> -				  &pcifront_bus_ops, sd);
> +	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> +				  &pcifront_bus_ops, sd, &resources);
>  	if (!b) {
>  		dev_err(&pdev->xdev->dev,
>  			"Error creating PCI Frontend Bus!\n");
>  		err = -ENOMEM;
>  		pci_unlock_rescan_remove();
> +		pci_free_resource_list(&resources);
>  		goto err_out;
>  	}
>  
> @@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>  
>  	list_add(&bus_entry->list, &pdev->root_buses);
>  
> -	/* pci_scan_bus_parented skips devices which do not have a have
> +	/* pci_scan_root_bus skips devices which do not have a
>  	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
>  	err = pcifront_scan_bus(pdev, domain, bus, b);
>  
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
       [not found] ` <1425868467-9667-8-git-send-email-wangyijing@huawei.com>
@ 2015-03-12  1:34   ` Bjorn Helgaas
       [not found]   ` <20150312013408.GB10949@google.com>
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Bjorn Helgaas @ 2015-03-12  1:34 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-mips, linux-ia64, linux-sh, linux-pci, Chris Metcalf,
	Paul Mackerras, sparclinux, Guan Xuetao, linux-s390, Russell King,
	Michael Ellerman, x86, Sebastian Ott, Geert Uytterhoeven,
	Gerald Schaefer, Benjamin Herrenschmidt, xen-devel, Matt Turner,
	Fenghua Yu, Arnd Bergmann, Marc Zyngier, Rusty Russell,
	linux-m68k, Ivan Kokshaysky, Thomas Gleixner, Yinghai

On Mon, Mar 09, 2015 at 10:34:04AM +0800, Yijing Wang wrote:
> Now we could pass PCI domain combined with bus number
> in u32 argu. Because in arm/arm64, PCI domain number
> is assigned by pci_bus_assign_domain_nr(). So we leave
> pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
> unchanged.

I'm not buying this.  If you're using this PCI_DOMBUS() thing (and I'm not
convinced that's a good idea yet), I'm not happy with most code being

  pci_scan_root_bus(..., PCI_DOMBUS(hose->index, next_busno), ...)

but ARM being

  pci_scan_root_bus(..., sys->busnr, ...)

That just looks like a mistake.  Make ARM use PCI_DOMBUS(0, sys->busnr) if
you want, but at least make it look like you did a thorough job.

> A new function pci_host_assign_domain_nr()
> will be introduced for arm/arm64 to assign domain number
> in later patch.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Richard Henderson <rth@twiddle.net>
> CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> CC: Matt Turner <mattst88@gmail.com>
> CC: Tony Luck <tony.luck@intel.com>
> CC: Fenghua Yu <fenghua.yu@intel.com>
> CC: Michal Simek <monstr@monstr.eu>
> CC: Ralf Baechle <ralf@linux-mips.org>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Paul Mackerras <paulus@samba.org>
> CC: Michael Ellerman <mpe@ellerman.id.au>
> CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
> CC: Gerald Schaefer <gerald.schaefer@de.ibm.com>
> CC: "David S. Miller" <davem@davemloft.net>
> CC: Chris Metcalf <cmetcalf@ezchip.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: linux-alpha@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> CC: linux-ia64@vger.kernel.org
> CC: linux-mips@linux-mips.org
> CC: linuxppc-dev@lists.ozlabs.org
> CC: linux-s390@vger.kernel.org
> CC: linux-sh@vger.kernel.org
> CC: sparclinux@vger.kernel.org
> CC: xen-devel@lists.xenproject.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  arch/alpha/kernel/pci.c          |    5 +++--
>  arch/alpha/kernel/sys_nautilus.c |    4 ++--
>  arch/ia64/pci/pci.c              |    4 ++--
>  arch/ia64/sn/kernel/io_init.c    |    5 +++--
>  arch/microblaze/pci/pci-common.c |    5 +++--
>  arch/mips/pci/pci.c              |    4 ++--
>  arch/powerpc/kernel/pci-common.c |    5 +++--
>  arch/s390/pci/pci.c              |    5 +++--
>  arch/sh/drivers/pci/pci.c        |    5 +++--
>  arch/sparc/kernel/pci.c          |    5 +++--
>  arch/tile/kernel/pci.c           |    5 +++--
>  arch/tile/kernel/pci_gx.c        |    5 +++--
>  arch/x86/pci/acpi.c              |    7 ++++---
>  arch/x86/pci/common.c            |    3 ++-
>  drivers/pci/xen-pcifront.c       |    5 +++--
>  15 files changed, 42 insertions(+), 30 deletions(-)
> 
> diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
> index 5c845ad..deb0a36 100644
> --- a/arch/alpha/kernel/pci.c
> +++ b/arch/alpha/kernel/pci.c
> @@ -336,8 +336,9 @@ common_init_pci(void)
>  		pci_add_resource_offset(&resources, hose->mem_space,
>  					hose->mem_space->start);
>  
> -		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
> -					hose, &resources);
> +		bus = pci_scan_root_bus(NULL,
> +				PCI_DOMBUS(hose->index, next_busno),
> +				alpha_mv.pci_ops, hose, &resources);
>  		if (!bus)
>  			continue;
>  		hose->bus = bus;
> diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
> index 700686d..be0bbeb 100644
> --- a/arch/alpha/kernel/sys_nautilus.c
> +++ b/arch/alpha/kernel/sys_nautilus.c
> @@ -206,10 +206,10 @@ nautilus_init_pci(void)
>  	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
>  
>  	/* Scan our single hose.  */
> -	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
> +	bus = pci_scan_bus(PCI_DOMBUS(hose->index, 0),
> +			alpha_mv.pci_ops, hose);
>  	if (!bus)
>  		return;
> -
>  	hose->bus = bus;
>  	pcibios_claim_one_bus(bus);
>  
> diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
> index 48cc657..675749f 100644
> --- a/arch/ia64/pci/pci.c
> +++ b/arch/ia64/pci/pci.c
> @@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  	 * should handle the case here, but it appears that IA64 hasn't
>  	 * such quirk. So we just ignore the case now.
>  	 */
> -	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
> -				   &info->resources);
> +	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
> +			&pci_root_ops, controller, &info->resources);
>  	if (!pbus) {
>  		pci_free_resource_list(&info->resources);
>  		__release_pci_root_info(info);
> diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
> index 1be65eb..7e0b7f9 100644
> --- a/arch/ia64/sn/kernel/io_init.c
> +++ b/arch/ia64/sn/kernel/io_init.c
> @@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
>  	pci_add_resource_offset(&resources,	&res[1],
>  			prom_bussoft_ptr->bs_legacy_mem);
>  
> -	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
> -				&resources);
> +	bus = pci_scan_root_bus(NULL,
> +			PCI_DOMBUS(controller->segment, busnum),
> +			&pci_root_ops, controller, &resources);
>   	if (bus == NULL) {
>  		kfree(res);
>  		kfree(controller);
> diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
> index 6d8d173..34a32ec 100644
> --- a/arch/microblaze/pci/pci-common.c
> +++ b/arch/microblaze/pci/pci-common.c
> @@ -1350,8 +1350,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
>  
>  	pcibios_setup_phb_resources(hose, &resources);
>  
> -	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
> -				hose->ops, hose, &resources);
> +	bus = pci_scan_root_bus(hose->parent,
> +			PCI_DOMBUS(hose->global_number, hose->first_busno),
> +			hose->ops, hose, &resources);
>  	if (bus == NULL) {
>  		pr_err("Failed to create bus for PCI domain %04x\n",
>  		       hose->global_number);
> diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
> index 9eb54b5..86f8d2b 100644
> --- a/arch/mips/pci/pci.c
> +++ b/arch/mips/pci/pci.c
> @@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
>  	pci_add_resource_offset(&resources,
>  				hose->mem_resource, hose->mem_offset);
>  	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
> -	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
> -				&resources);
> +	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
> +			hose->pci_ops, hose, &resources);
>  	if (!bus)
>  		pci_free_resource_list(&resources);
>  
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 2a525c9..a467aca 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1612,8 +1612,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
>  	pci_add_resource(&resources, &hose->busn);
>  
>  	/* Create an empty bus for the toplevel */
> -	bus = pci_create_root_bus(hose->parent, hose->first_busno,
> -				  hose->ops, hose, &resources);
> +	bus = pci_create_root_bus(hose->parent,
> +			PCI_DOMBUS(hose->global_number, hose->first_busno),
> +			hose->ops, hose, &resources);
>  	if (bus == NULL) {
>  		pr_err("Failed to create bus for PCI domain %04x\n",
>  			hose->global_number);
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index a2a7391..20e662f 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -770,8 +770,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
>  	if (ret)
>  		return ret;
>  
> -	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
> -				      zdev, &resources);
> +	zdev->bus = pci_scan_root_bus(NULL,
> +			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
> +			zdev, &resources);
>  	if (!zdev->bus) {
>  		zpci_cleanup_bus_resources(zdev);
>  		return -EIO;
> diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
> index efc1051..116f80f 100644
> --- a/arch/sh/drivers/pci/pci.c
> +++ b/arch/sh/drivers/pci/pci.c
> @@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
>  		pci_add_resource_offset(&resources, res, offset);
>  	}
>  
> -	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
> -				&resources);
> +	bus = pci_scan_root_bus(NULL,
> +			PCI_DOMBUS(hose->index, next_busno),
> +			hose->pci_ops, hose, &resources);
>  	hose->bus = bus;
>  
>  	need_domain_info = need_domain_info || hose->index;
> diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
> index 9ce5afe..838fe1e 100644
> --- a/arch/sparc/kernel/pci.c
> +++ b/arch/sparc/kernel/pci.c
> @@ -667,8 +667,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
>  	pbm->busn.end	= pbm->pci_last_busno;
>  	pbm->busn.flags	= IORESOURCE_BUS;
>  	pci_add_resource(&resources, &pbm->busn);
> -	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
> -				  pbm, &resources);
> +	bus = pci_create_root_bus(parent,
> +			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
> +			pbm->pci_ops, pbm, &resources);
>  	if (!bus) {
>  		printk(KERN_ERR "Failed to create bus for %s\n",
>  		       node->full_name);
> diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
> index 9475a74..25b0d9b 100644
> --- a/arch/tile/kernel/pci.c
> +++ b/arch/tile/kernel/pci.c
> @@ -306,8 +306,9 @@ int __init pcibios_init(void)
>  
>  			pci_add_resource(&resources, &ioport_resource);
>  			pci_add_resource(&resources, &iomem_resource);
> -			bus = pci_scan_root_bus(NULL, 0, controller->ops,
> -						controller, &resources);
> +			bus = pci_scan_root_bus(NULL,
> +				PCI_DOMBUS(controller->index, 0),
> +				controller->ops, controller, &resources);
>  			controller->root_bus = bus;
>  			controller->last_busno = bus->busn_res.end;
>  		}
> diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
> index b1df847..f6f41f3 100644
> --- a/arch/tile/kernel/pci_gx.c
> +++ b/arch/tile/kernel/pci_gx.c
> @@ -881,8 +881,9 @@ int __init pcibios_init(void)
>  					controller->mem_offset);
>  		pci_add_resource(&resources, &controller->io_space);
>  		controller->first_busno = next_busno;
> -		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
> -					controller, &resources);
> +		bus = pci_scan_root_bus(NULL,
> +				PCI_DOMBUS(controller->index, next_busno),
> +				controller->ops, controller, &resources);
>  		controller->root_bus = bus;
>  		next_busno = bus->busn_res.end + 1;
>  	}
> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> index 6ac2738..ad0e926 100644
> --- a/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -424,9 +424,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  		}
>  
>  		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
> -				    (u8)root->secondary.end, root->mcfg_addr))
> -			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
> -						  sd, &resources);
> +				(u8)root->secondary.end, root->mcfg_addr))
> +			bus = pci_create_root_bus(NULL,
> +				PCI_DOMBUS(domain, busnum), &pci_root_ops,
> +				sd, &resources);
>  
>  		if (bus) {
>  			pci_scan_child_bus(bus);
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 0cbc723..0160280 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -486,7 +486,8 @@ void pcibios_scan_root(int busnum)
>  	sd->node = x86_pci_root_bus_node(busnum);
>  	x86_pci_root_bus_resources(busnum, &resources);
>  	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
> -	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
> +	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
> +			&pci_root_ops, sd, &resources);
>  	if (!bus) {
>  		pci_free_resource_list(&resources);
>  		kfree(sd);
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 9e7c28b..af6144a 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -479,8 +479,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>  
>  	pci_lock_rescan_remove();
>  
> -	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> -				  &pcifront_bus_ops, sd, &resources);
> +	b = pci_scan_root_bus(&pdev->xdev->dev,
> +			PCI_DOMBUS(sd->domain, bus),
> +			&pcifront_bus_ops, sd, &resources);
>  	if (!b) {
>  		dev_err(&pdev->xdev->dev,
>  			"Error creating PCI Frontend Bus!\n");
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]   ` <20150311223211.GB1082@google.com>
@ 2015-03-12 11:46     ` Yijing Wang
       [not found]     ` <55017CA5.2010502@huawei.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-12 11:46 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-ia64, linux-pci, Guan Xuetao, Russell King, x86,
	Geert Uytterhoeven, Benjamin Herrenschmidt, xen-devel,
	Arnd Bergmann, Marc Zyngier, Rusty Russell, linux-m68k,
	Thomas Gleixner, Yinghai Lu, linux-arm-kernel, Liviu Dudau,
	Tony Luck, linux-kernel, Jiang Liu, linux-alpha, David S. Miller

>>  	struct pci_bus *b;
>> +	LIST_HEAD(resources);
>>  	struct pcifront_sd *sd = NULL;
>>  	struct pci_bus_entry *bus_entry = NULL;
>>  	int err = 0;
>> @@ -470,17 +472,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>>  		err = -ENOMEM;
>>  		goto err_out;
>>  	}
>> +	pci_add_resource(&resources, &ioport_resource);
>> +	pci_add_resource(&resources, &iomem_resource);
>> +	pci_add_resource(&resources, &busn_resource);
> 
> Since I don't want to export busn_resource, you might have to allocate your
> own struct resource for it here.  And, of course, figure out the details of
> which PCI domain you're in and whether you need to share one struct
> resource across several host bridges in the same domain.

Allocate its own resource here is ok for me, as I mentioned in previous reply,
so do we still need to add additional info to figure out which domain own the bus resource ?


> 
>>  	pcifront_init_sd(sd, domain, bus, pdev);
>>  
>>  	pci_lock_rescan_remove();
>>  
>> -	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
>> -				  &pcifront_bus_ops, sd);
>> +	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
>> +				  &pcifront_bus_ops, sd, &resources);
>>  	if (!b) {
>>  		dev_err(&pdev->xdev->dev,
>>  			"Error creating PCI Frontend Bus!\n");
>>  		err = -ENOMEM;
>>  		pci_unlock_rescan_remove();
>> +		pci_free_resource_list(&resources);
>>  		goto err_out;
>>  	}
>>  
>> @@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>>  
>>  	list_add(&bus_entry->list, &pdev->root_buses);
>>  
>> -	/* pci_scan_bus_parented skips devices which do not have a have
>> +	/* pci_scan_root_bus skips devices which do not have a
>>  	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
>>  	err = pcifront_scan_bus(pdev, domain, bus, b);
>>  
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
       [not found]   ` <20150312013408.GB10949@google.com>
@ 2015-03-12 12:20     ` Yijing Wang
  0 siblings, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-12 12:20 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-sh, linux-pci, Chris Metcalf,
	Paul Mackerras, sparclinux, Guan Xuetao, linux-s390, Russell King,
	Michael Ellerman, x86, Sebastian Ott, Geert Uytterhoeven,
	Gerald Schaefer, Benjamin Herrenschmidt, xen-devel, Matt Turner,
	Fenghua Yu, Arnd Bergmann, Marc Zyngier, Rusty Russell,
	linux-m68k, Ivan Kokshaysky, Thomas Gleixner, Yinghai

On 2015/3/12 9:34, Bjorn Helgaas wrote:
> On Mon, Mar 09, 2015 at 10:34:04AM +0800, Yijing Wang wrote:
>> Now we could pass PCI domain combined with bus number
>> in u32 argu. Because in arm/arm64, PCI domain number
>> is assigned by pci_bus_assign_domain_nr(). So we leave
>> pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
>> unchanged.
> 
> I'm not buying this.  If you're using this PCI_DOMBUS() thing (and I'm not
> convinced that's a good idea yet), I'm not happy with most code being
> 
>   pci_scan_root_bus(..., PCI_DOMBUS(hose->index, next_busno), ...)

Yes, it looks a little ugly. Which do you prefer, use a container structure or
put all args into function directly ?


> 
> but ARM being
> 
>   pci_scan_root_bus(..., sys->busnr, ...)
> 
> That just looks like a mistake.  Make ARM use PCI_DOMBUS(0, sys->busnr) if
> you want, but at least make it look like you did a thorough job.

For arm, I assumed the pci_host_assign_domain_nr() would update its domain,
but it may made the code obscure.

> 
>> A new function pci_host_assign_domain_nr()
>> will be introduced for arm/arm64 to assign domain number
>> in later patch.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> CC: Richard Henderson <rth@twiddle.net>
>> CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>> CC: Matt Turner <mattst88@gmail.com>
>> CC: Tony Luck <tony.luck@intel.com>
>> CC: Fenghua Yu <fenghua.yu@intel.com>
>> CC: Michal Simek <monstr@monstr.eu>
>> CC: Ralf Baechle <ralf@linux-mips.org>
>> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> CC: Paul Mackerras <paulus@samba.org>
>> CC: Michael Ellerman <mpe@ellerman.id.au>
>> CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
>> CC: Gerald Schaefer <gerald.schaefer@de.ibm.com>
>> CC: "David S. Miller" <davem@davemloft.net>
>> CC: Chris Metcalf <cmetcalf@ezchip.com>
>> CC: Thomas Gleixner <tglx@linutronix.de>
>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> CC: linux-alpha@vger.kernel.org
>> CC: linux-kernel@vger.kernel.org
>> CC: linux-ia64@vger.kernel.org
>> CC: linux-mips@linux-mips.org
>> CC: linuxppc-dev@lists.ozlabs.org
>> CC: linux-s390@vger.kernel.org
>> CC: linux-sh@vger.kernel.org
>> CC: sparclinux@vger.kernel.org
>> CC: xen-devel@lists.xenproject.org
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>>  arch/alpha/kernel/pci.c          |    5 +++--
>>  arch/alpha/kernel/sys_nautilus.c |    4 ++--
>>  arch/ia64/pci/pci.c              |    4 ++--
>>  arch/ia64/sn/kernel/io_init.c    |    5 +++--
>>  arch/microblaze/pci/pci-common.c |    5 +++--
>>  arch/mips/pci/pci.c              |    4 ++--
>>  arch/powerpc/kernel/pci-common.c |    5 +++--
>>  arch/s390/pci/pci.c              |    5 +++--
>>  arch/sh/drivers/pci/pci.c        |    5 +++--
>>  arch/sparc/kernel/pci.c          |    5 +++--
>>  arch/tile/kernel/pci.c           |    5 +++--
>>  arch/tile/kernel/pci_gx.c        |    5 +++--
>>  arch/x86/pci/acpi.c              |    7 ++++---
>>  arch/x86/pci/common.c            |    3 ++-
>>  drivers/pci/xen-pcifront.c       |    5 +++--
>>  15 files changed, 42 insertions(+), 30 deletions(-)
>>
>> diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
>> index 5c845ad..deb0a36 100644
>> --- a/arch/alpha/kernel/pci.c
>> +++ b/arch/alpha/kernel/pci.c
>> @@ -336,8 +336,9 @@ common_init_pci(void)
>>  		pci_add_resource_offset(&resources, hose->mem_space,
>>  					hose->mem_space->start);
>>  
>> -		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
>> -					hose, &resources);
>> +		bus = pci_scan_root_bus(NULL,
>> +				PCI_DOMBUS(hose->index, next_busno),
>> +				alpha_mv.pci_ops, hose, &resources);
>>  		if (!bus)
>>  			continue;
>>  		hose->bus = bus;
>> diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
>> index 700686d..be0bbeb 100644
>> --- a/arch/alpha/kernel/sys_nautilus.c
>> +++ b/arch/alpha/kernel/sys_nautilus.c
>> @@ -206,10 +206,10 @@ nautilus_init_pci(void)
>>  	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
>>  
>>  	/* Scan our single hose.  */
>> -	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
>> +	bus = pci_scan_bus(PCI_DOMBUS(hose->index, 0),
>> +			alpha_mv.pci_ops, hose);
>>  	if (!bus)
>>  		return;
>> -
>>  	hose->bus = bus;
>>  	pcibios_claim_one_bus(bus);
>>  
>> diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
>> index 48cc657..675749f 100644
>> --- a/arch/ia64/pci/pci.c
>> +++ b/arch/ia64/pci/pci.c
>> @@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>>  	 * should handle the case here, but it appears that IA64 hasn't
>>  	 * such quirk. So we just ignore the case now.
>>  	 */
>> -	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
>> -				   &info->resources);
>> +	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
>> +			&pci_root_ops, controller, &info->resources);
>>  	if (!pbus) {
>>  		pci_free_resource_list(&info->resources);
>>  		__release_pci_root_info(info);
>> diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
>> index 1be65eb..7e0b7f9 100644
>> --- a/arch/ia64/sn/kernel/io_init.c
>> +++ b/arch/ia64/sn/kernel/io_init.c
>> @@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
>>  	pci_add_resource_offset(&resources,	&res[1],
>>  			prom_bussoft_ptr->bs_legacy_mem);
>>  
>> -	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
>> -				&resources);
>> +	bus = pci_scan_root_bus(NULL,
>> +			PCI_DOMBUS(controller->segment, busnum),
>> +			&pci_root_ops, controller, &resources);
>>   	if (bus == NULL) {
>>  		kfree(res);
>>  		kfree(controller);
>> diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
>> index 6d8d173..34a32ec 100644
>> --- a/arch/microblaze/pci/pci-common.c
>> +++ b/arch/microblaze/pci/pci-common.c
>> @@ -1350,8 +1350,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
>>  
>>  	pcibios_setup_phb_resources(hose, &resources);
>>  
>> -	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
>> -				hose->ops, hose, &resources);
>> +	bus = pci_scan_root_bus(hose->parent,
>> +			PCI_DOMBUS(hose->global_number, hose->first_busno),
>> +			hose->ops, hose, &resources);
>>  	if (bus == NULL) {
>>  		pr_err("Failed to create bus for PCI domain %04x\n",
>>  		       hose->global_number);
>> diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
>> index 9eb54b5..86f8d2b 100644
>> --- a/arch/mips/pci/pci.c
>> +++ b/arch/mips/pci/pci.c
>> @@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
>>  	pci_add_resource_offset(&resources,
>>  				hose->mem_resource, hose->mem_offset);
>>  	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
>> -	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
>> -				&resources);
>> +	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
>> +			hose->pci_ops, hose, &resources);
>>  	if (!bus)
>>  		pci_free_resource_list(&resources);
>>  
>> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
>> index 2a525c9..a467aca 100644
>> --- a/arch/powerpc/kernel/pci-common.c
>> +++ b/arch/powerpc/kernel/pci-common.c
>> @@ -1612,8 +1612,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
>>  	pci_add_resource(&resources, &hose->busn);
>>  
>>  	/* Create an empty bus for the toplevel */
>> -	bus = pci_create_root_bus(hose->parent, hose->first_busno,
>> -				  hose->ops, hose, &resources);
>> +	bus = pci_create_root_bus(hose->parent,
>> +			PCI_DOMBUS(hose->global_number, hose->first_busno),
>> +			hose->ops, hose, &resources);
>>  	if (bus == NULL) {
>>  		pr_err("Failed to create bus for PCI domain %04x\n",
>>  			hose->global_number);
>> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
>> index a2a7391..20e662f 100644
>> --- a/arch/s390/pci/pci.c
>> +++ b/arch/s390/pci/pci.c
>> @@ -770,8 +770,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
>>  	if (ret)
>>  		return ret;
>>  
>> -	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
>> -				      zdev, &resources);
>> +	zdev->bus = pci_scan_root_bus(NULL,
>> +			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
>> +			zdev, &resources);
>>  	if (!zdev->bus) {
>>  		zpci_cleanup_bus_resources(zdev);
>>  		return -EIO;
>> diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
>> index efc1051..116f80f 100644
>> --- a/arch/sh/drivers/pci/pci.c
>> +++ b/arch/sh/drivers/pci/pci.c
>> @@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
>>  		pci_add_resource_offset(&resources, res, offset);
>>  	}
>>  
>> -	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
>> -				&resources);
>> +	bus = pci_scan_root_bus(NULL,
>> +			PCI_DOMBUS(hose->index, next_busno),
>> +			hose->pci_ops, hose, &resources);
>>  	hose->bus = bus;
>>  
>>  	need_domain_info = need_domain_info || hose->index;
>> diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
>> index 9ce5afe..838fe1e 100644
>> --- a/arch/sparc/kernel/pci.c
>> +++ b/arch/sparc/kernel/pci.c
>> @@ -667,8 +667,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
>>  	pbm->busn.end	= pbm->pci_last_busno;
>>  	pbm->busn.flags	= IORESOURCE_BUS;
>>  	pci_add_resource(&resources, &pbm->busn);
>> -	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
>> -				  pbm, &resources);
>> +	bus = pci_create_root_bus(parent,
>> +			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
>> +			pbm->pci_ops, pbm, &resources);
>>  	if (!bus) {
>>  		printk(KERN_ERR "Failed to create bus for %s\n",
>>  		       node->full_name);
>> diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
>> index 9475a74..25b0d9b 100644
>> --- a/arch/tile/kernel/pci.c
>> +++ b/arch/tile/kernel/pci.c
>> @@ -306,8 +306,9 @@ int __init pcibios_init(void)
>>  
>>  			pci_add_resource(&resources, &ioport_resource);
>>  			pci_add_resource(&resources, &iomem_resource);
>> -			bus = pci_scan_root_bus(NULL, 0, controller->ops,
>> -						controller, &resources);
>> +			bus = pci_scan_root_bus(NULL,
>> +				PCI_DOMBUS(controller->index, 0),
>> +				controller->ops, controller, &resources);
>>  			controller->root_bus = bus;
>>  			controller->last_busno = bus->busn_res.end;
>>  		}
>> diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
>> index b1df847..f6f41f3 100644
>> --- a/arch/tile/kernel/pci_gx.c
>> +++ b/arch/tile/kernel/pci_gx.c
>> @@ -881,8 +881,9 @@ int __init pcibios_init(void)
>>  					controller->mem_offset);
>>  		pci_add_resource(&resources, &controller->io_space);
>>  		controller->first_busno = next_busno;
>> -		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
>> -					controller, &resources);
>> +		bus = pci_scan_root_bus(NULL,
>> +				PCI_DOMBUS(controller->index, next_busno),
>> +				controller->ops, controller, &resources);
>>  		controller->root_bus = bus;
>>  		next_busno = bus->busn_res.end + 1;
>>  	}
>> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
>> index 6ac2738..ad0e926 100644
>> --- a/arch/x86/pci/acpi.c
>> +++ b/arch/x86/pci/acpi.c
>> @@ -424,9 +424,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>>  		}
>>  
>>  		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
>> -				    (u8)root->secondary.end, root->mcfg_addr))
>> -			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
>> -						  sd, &resources);
>> +				(u8)root->secondary.end, root->mcfg_addr))
>> +			bus = pci_create_root_bus(NULL,
>> +				PCI_DOMBUS(domain, busnum), &pci_root_ops,
>> +				sd, &resources);
>>  
>>  		if (bus) {
>>  			pci_scan_child_bus(bus);
>> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
>> index 0cbc723..0160280 100644
>> --- a/arch/x86/pci/common.c
>> +++ b/arch/x86/pci/common.c
>> @@ -486,7 +486,8 @@ void pcibios_scan_root(int busnum)
>>  	sd->node = x86_pci_root_bus_node(busnum);
>>  	x86_pci_root_bus_resources(busnum, &resources);
>>  	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
>> -	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
>> +	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
>> +			&pci_root_ops, sd, &resources);
>>  	if (!bus) {
>>  		pci_free_resource_list(&resources);
>>  		kfree(sd);
>> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
>> index 9e7c28b..af6144a 100644
>> --- a/drivers/pci/xen-pcifront.c
>> +++ b/drivers/pci/xen-pcifront.c
>> @@ -479,8 +479,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>>  
>>  	pci_lock_rescan_remove();
>>  
>> -	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
>> -				  &pcifront_bus_ops, sd, &resources);
>> +	b = pci_scan_root_bus(&pdev->xdev->dev,
>> +			PCI_DOMBUS(sd->domain, bus),
>> +			&pcifront_bus_ops, sd, &resources);
>>  	if (!b) {
>>  		dev_err(&pdev->xdev->dev,
>>  			"Error creating PCI Frontend Bus!\n");
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]     ` <55017CA5.2010502@huawei.com>
@ 2015-03-12 19:35       ` Bjorn Helgaas
       [not found]       ` <20150312193505.GB7346@google.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Bjorn Helgaas @ 2015-03-12 19:35 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-ia64, linux-pci, Guan Xuetao, Russell King, x86,
	Geert Uytterhoeven, Benjamin Herrenschmidt, xen-devel,
	Arnd Bergmann, Marc Zyngier, Rusty Russell, linux-m68k,
	Thomas Gleixner, Yinghai Lu, linux-arm-kernel, Liviu Dudau,
	Tony Luck, linux-kernel, Jiang Liu, linux-alpha, David S. Miller

On Thu, Mar 12, 2015 at 07:46:45PM +0800, Yijing Wang wrote:
> >>  	struct pci_bus *b;
> >> +	LIST_HEAD(resources);
> >>  	struct pcifront_sd *sd = NULL;
> >>  	struct pci_bus_entry *bus_entry = NULL;
> >>  	int err = 0;
> >> @@ -470,17 +472,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >>  		err = -ENOMEM;
> >>  		goto err_out;
> >>  	}
> >> +	pci_add_resource(&resources, &ioport_resource);
> >> +	pci_add_resource(&resources, &iomem_resource);
> >> +	pci_add_resource(&resources, &busn_resource);
> > 
> > Since I don't want to export busn_resource, you might have to allocate your
> > own struct resource for it here.  And, of course, figure out the details of
> > which PCI domain you're in and whether you need to share one struct
> > resource across several host bridges in the same domain.
> 
> Allocate its own resource here is ok for me, as I mentioned in previous reply,
> so do we still need to add additional info to figure out which domain own the bus resource ?

That's up to the caller.  Only the platform knows which bridges it wants to
have in the same domain.  In principle, every host bridge could be in its
own domain, since each bridge is the root of a unique PCI hierarchy.  But
some platforms have firmware that assumes otherwise.  I have no idea what
xen assumes.

> >>  	pcifront_init_sd(sd, domain, bus, pdev);
> >>  
> >>  	pci_lock_rescan_remove();
> >>  
> >> -	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
> >> -				  &pcifront_bus_ops, sd);
> >> +	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> >> +				  &pcifront_bus_ops, sd, &resources);
> >>  	if (!b) {
> >>  		dev_err(&pdev->xdev->dev,
> >>  			"Error creating PCI Frontend Bus!\n");
> >>  		err = -ENOMEM;
> >>  		pci_unlock_rescan_remove();
> >> +		pci_free_resource_list(&resources);
> >>  		goto err_out;
> >>  	}
> >>  
> >> @@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >>  
> >>  	list_add(&bus_entry->list, &pdev->root_buses);
> >>  
> >> -	/* pci_scan_bus_parented skips devices which do not have a have
> >> +	/* pci_scan_root_bus skips devices which do not have a
> >>  	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
> >>  	err = pcifront_scan_bus(pdev, domain, bus, b);
> >>  
> >> -- 
> >> 1.7.1
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> > .
> > 
> 
> 
> -- 
> Thanks!
> Yijing
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]       ` <20150312193505.GB7346@google.com>
@ 2015-03-13  2:36         ` Yijing Wang
       [not found]         ` <55024D35.6050509@huawei.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-13  2:36 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-ia64, linux-pci, Guan Xuetao, Russell King, x86,
	Geert Uytterhoeven, Benjamin Herrenschmidt, xen-devel,
	Arnd Bergmann, Marc Zyngier, Rusty Russell, linux-m68k,
	Thomas Gleixner, Yinghai Lu, linux-arm-kernel, Liviu Dudau,
	Tony Luck, linux-kernel, Jiang Liu, linux-alpha, David S. Miller

>>>> +	pci_add_resource(&resources, &ioport_resource);
>>>> +	pci_add_resource(&resources, &iomem_resource);
>>>> +	pci_add_resource(&resources, &busn_resource);
>>>
>>> Since I don't want to export busn_resource, you might have to allocate your
>>> own struct resource for it here.  And, of course, figure out the details of
>>> which PCI domain you're in and whether you need to share one struct
>>> resource across several host bridges in the same domain.
>>
>> Allocate its own resource here is ok for me, as I mentioned in previous reply,
>> so do we still need to add additional info to figure out which domain own the bus resource ?
> 
> That's up to the caller.  Only the platform knows which bridges it wants to
> have in the same domain.  In principle, every host bridge could be in its
> own domain, since each bridge is the root of a unique PCI hierarchy.  But
> some platforms have firmware that assumes otherwise.  I have no idea what
> xen assumes.

I'm not xen guy, so I don't know much about it, but because it call pci_scan_bus_parented()
before, and in which busn_resource is always shared for different host bridges(same domain or not),
I think add a static bus resource(0,255) should be safe, at least, it would not introduce new risk.

Something like:

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..a69e529 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,9 +446,15 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
                                 unsigned int domain, unsigned int bus)
 {
        struct pci_bus *b;
+       LIST_HEAD(resources);
        struct pcifront_sd *sd = NULL;
        struct pci_bus_entry *bus_entry = NULL;
        int err = 0;
+       static struct resource busn_res = {
+               .start = 0,
+               .end = 255,
+               .flags = IORESOURCE_BUS,
+       };

 #ifndef CONFIG_PCI_DOMAINS
        if (domain != 0) {
@@ -470,17 +476,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
                err = -ENOMEM;
                goto err_out;
        }
+       pci_add_resource(&resources, &ioport_resource);
+       pci_add_resource(&resources, &iomem_resource);
+       pci_add_resource(&resources, &busn_res);
        pcifront_init_sd(sd, domain, bus, pdev);

        pci_lock_rescan_remove();

-       b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-                                 &pcifront_bus_ops, sd);
+       b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+                                 &pcifront_bus_ops, sd, &resources);
        if (!b) {

Bjorn, what do you think about ?

Thanks!
Yijing.


> 
>>>>  	pcifront_init_sd(sd, domain, bus, pdev);
>>>>  
>>>>  	pci_lock_rescan_remove();
>>>>  
>>>> -	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
>>>> -				  &pcifront_bus_ops, sd);
>>>> +	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
>>>> +				  &pcifront_bus_ops, sd, &resources);
>>>>  	if (!b) {
>>>>  		dev_err(&pdev->xdev->dev,
>>>>  			"Error creating PCI Frontend Bus!\n");
>>>>  		err = -ENOMEM;
>>>>  		pci_unlock_rescan_remove();
>>>> +		pci_free_resource_list(&resources);
>>>>  		goto err_out;
>>>>  	}
>>>>  
>>>> @@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>>>>  
>>>>  	list_add(&bus_entry->list, &pdev->root_buses);
>>>>  
>>>> -	/* pci_scan_bus_parented skips devices which do not have a have
>>>> +	/* pci_scan_root_bus skips devices which do not have a
>>>>  	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
>>>>  	err = pcifront_scan_bus(pdev, domain, bus, b);
>>>>  
>>>> -- 
>>>> 1.7.1
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>> .
>>>
>>
>>
>> -- 
>> Thanks!
>> Yijing
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]         ` <55024D35.6050509@huawei.com>
@ 2015-03-13 13:24           ` Bjorn Helgaas
       [not found]           ` <CAErSpo4T7f9PNVMLrQbCvW2a=HnRauQR2eBz6H69B7Q2=ELNWw@mail.gmail.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Bjorn Helgaas @ 2015-03-13 13:24 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org,
	Guan Xuetao, Russell King, x86@kernel.org, Geert Uytterhoeven,
	Benjamin Herrenschmidt, xen-devel@lists.xenproject.org,
	Arnd Bergmann, Marc Zyngier, Rusty Russell, linux-m68k,
	Thomas Gleixner, Yinghai Lu, linux-arm, Liviu Dudau, Tony Luck,
	linux-kernel@vger.kernel.org, Jiang Liu, linux-alpha,
	David S. Miller

On Thu, Mar 12, 2015 at 9:36 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>>> +  pci_add_resource(&resources, &ioport_resource);
>>>>> +  pci_add_resource(&resources, &iomem_resource);
>>>>> +  pci_add_resource(&resources, &busn_resource);
>>>>
>>>> Since I don't want to export busn_resource, you might have to allocate your
>>>> own struct resource for it here.  And, of course, figure out the details of
>>>> which PCI domain you're in and whether you need to share one struct
>>>> resource across several host bridges in the same domain.
>>>
>>> Allocate its own resource here is ok for me, as I mentioned in previous reply,
>>> so do we still need to add additional info to figure out which domain own the bus resource ?
>>
>> That's up to the caller.  Only the platform knows which bridges it wants to
>> have in the same domain.  In principle, every host bridge could be in its
>> own domain, since each bridge is the root of a unique PCI hierarchy.  But
>> some platforms have firmware that assumes otherwise.  I have no idea what
>> xen assumes.
>
> I'm not xen guy, so I don't know much about it, but because it call pci_scan_bus_parented()
> before, and in which busn_resource is always shared for different host bridges(same domain or not),
> I think add a static bus resource(0,255) should be safe, at least, it would not introduce new risk.
>
> Something like:
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index b1ffebe..a69e529 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -446,9 +446,15 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>                                  unsigned int domain, unsigned int bus)
>  {
>         struct pci_bus *b;
> +       LIST_HEAD(resources);
>         struct pcifront_sd *sd = NULL;
>         struct pci_bus_entry *bus_entry = NULL;
>         int err = 0;
> +       static struct resource busn_res = {
> +               .start = 0,
> +               .end = 255,
> +               .flags = IORESOURCE_BUS,
> +       };
>
>  #ifndef CONFIG_PCI_DOMAINS
>         if (domain != 0) {
> @@ -470,17 +476,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>                 err = -ENOMEM;
>                 goto err_out;
>         }
> +       pci_add_resource(&resources, &ioport_resource);
> +       pci_add_resource(&resources, &iomem_resource);
> +       pci_add_resource(&resources, &busn_res);
>         pcifront_init_sd(sd, domain, bus, pdev);
>
>         pci_lock_rescan_remove();
>
> -       b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
> -                                 &pcifront_bus_ops, sd);
> +       b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> +                                 &pcifront_bus_ops, sd, &resources);
>         if (!b) {
>
> Bjorn, what do you think about ?

That seems OK to me.  Probably still wrong, but no worse than it was before.

>>>>>    pcifront_init_sd(sd, domain, bus, pdev);
>>>>>
>>>>>    pci_lock_rescan_remove();
>>>>>
>>>>> -  b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
>>>>> -                            &pcifront_bus_ops, sd);
>>>>> +  b = pci_scan_root_bus(&pdev->xdev->dev, bus,
>>>>> +                            &pcifront_bus_ops, sd, &resources);
>>>>>    if (!b) {
>>>>>            dev_err(&pdev->xdev->dev,
>>>>>                    "Error creating PCI Frontend Bus!\n");
>>>>>            err = -ENOMEM;
>>>>>            pci_unlock_rescan_remove();
>>>>> +          pci_free_resource_list(&resources);
>>>>>            goto err_out;
>>>>>    }
>>>>>
>>>>> @@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>>>>>
>>>>>    list_add(&bus_entry->list, &pdev->root_buses);
>>>>>
>>>>> -  /* pci_scan_bus_parented skips devices which do not have a have
>>>>> +  /* pci_scan_root_bus skips devices which do not have a
>>>>>    * devfn==0. The pcifront_scan_bus enumerates all devfn. */
>>>>>    err = pcifront_scan_bus(pdev, domain, bus, b);
>>>>>
>>>>> --
>>>>> 1.7.1
>>>>>
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>>>>> the body of a message to majordomo@vger.kernel.org
>>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Thanks!
>>> Yijing
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>> .
>>
>
>
> --
> Thanks!
> Yijing
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]           ` <CAErSpo4T7f9PNVMLrQbCvW2a=HnRauQR2eBz6H69B7Q2=ELNWw@mail.gmail.com>
@ 2015-03-13 14:01             ` Konrad Rzeszutek Wilk
       [not found]             ` <20150313140132.GH5378@l.oracle.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-03-13 14:01 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-m68k, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org,
	Yijing Wang, Guan Xuetao, Russell King, x86@kernel.org,
	Geert Uytterhoeven, Benjamin Herrenschmidt,
	xen-devel@lists.xenproject.org, Arnd Bergmann, Marc Zyngier,
	Rusty Russell, Thomas Gleixner, Yinghai Lu, linux-arm,
	Liviu Dudau, Tony Luck, linux-kernel@vger.kernel.org, Jiang Liu,
	linux-alpha, Davi

On Fri, Mar 13, 2015 at 08:24:58AM -0500, Bjorn Helgaas wrote:
> On Thu, Mar 12, 2015 at 9:36 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >>>>> +  pci_add_resource(&resources, &ioport_resource);
> >>>>> +  pci_add_resource(&resources, &iomem_resource);
> >>>>> +  pci_add_resource(&resources, &busn_resource);
> >>>>
> >>>> Since I don't want to export busn_resource, you might have to allocate your
> >>>> own struct resource for it here.  And, of course, figure out the details of
> >>>> which PCI domain you're in and whether you need to share one struct
> >>>> resource across several host bridges in the same domain.
> >>>
> >>> Allocate its own resource here is ok for me, as I mentioned in previous reply,
> >>> so do we still need to add additional info to figure out which domain own the bus resource ?
> >>
> >> That's up to the caller.  Only the platform knows which bridges it wants to
> >> have in the same domain.  In principle, every host bridge could be in its
> >> own domain, since each bridge is the root of a unique PCI hierarchy.  But
> >> some platforms have firmware that assumes otherwise.  I have no idea what
> >> xen assumes.
> >
> > I'm not xen guy, so I don't know much about it, but because it call pci_scan_bus_parented()
> > before, and in which busn_resource is always shared for different host bridges(same domain or not),
> > I think add a static bus resource(0,255) should be safe, at least, it would not introduce new risk.
> >
> > Something like:
> >
> > diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> > index b1ffebe..a69e529 100644
> > --- a/drivers/pci/xen-pcifront.c
> > +++ b/drivers/pci/xen-pcifront.c
> > @@ -446,9 +446,15 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >                                  unsigned int domain, unsigned int bus)
> >  {
> >         struct pci_bus *b;
> > +       LIST_HEAD(resources);
> >         struct pcifront_sd *sd = NULL;
> >         struct pci_bus_entry *bus_entry = NULL;
> >         int err = 0;
> > +       static struct resource busn_res = {
> > +               .start = 0,
> > +               .end = 255,
> > +               .flags = IORESOURCE_BUS,
> > +       };
> >
> >  #ifndef CONFIG_PCI_DOMAINS
> >         if (domain != 0) {
> > @@ -470,17 +476,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >                 err = -ENOMEM;
> >                 goto err_out;
> >         }
> > +       pci_add_resource(&resources, &ioport_resource);
> > +       pci_add_resource(&resources, &iomem_resource);
> > +       pci_add_resource(&resources, &busn_res);
> >         pcifront_init_sd(sd, domain, bus, pdev);
> >
> >         pci_lock_rescan_remove();
> >
> > -       b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
> > -                                 &pcifront_bus_ops, sd);
> > +       b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> > +                                 &pcifront_bus_ops, sd, &resources);
> >         if (!b) {
> >
> > Bjorn, what do you think about ?
> 
> That seems OK to me.  Probably still wrong, but no worse than it was before.

Interesting. The mechanism for PCI passthrough can either synthesize
and PCI bus number starting at zero (so first device is always 0:0:0.0)
or it can replicate the backend PCI topology. That means you
could have segment values passed in, so: ab:ff:00.1). I've to admin
I hadn't tried the 'physical' replication on an machine with
domains (err, segments).

Is there an git tree with this so I can just try it out?

Thanks.
> 
> >>>>>    pcifront_init_sd(sd, domain, bus, pdev);
> >>>>>
> >>>>>    pci_lock_rescan_remove();
> >>>>>
> >>>>> -  b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
> >>>>> -                            &pcifront_bus_ops, sd);
> >>>>> +  b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> >>>>> +                            &pcifront_bus_ops, sd, &resources);
> >>>>>    if (!b) {
> >>>>>            dev_err(&pdev->xdev->dev,
> >>>>>                    "Error creating PCI Frontend Bus!\n");
> >>>>>            err = -ENOMEM;
> >>>>>            pci_unlock_rescan_remove();
> >>>>> +          pci_free_resource_list(&resources);
> >>>>>            goto err_out;
> >>>>>    }
> >>>>>
> >>>>> @@ -488,7 +494,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >>>>>
> >>>>>    list_add(&bus_entry->list, &pdev->root_buses);
> >>>>>
> >>>>> -  /* pci_scan_bus_parented skips devices which do not have a have
> >>>>> +  /* pci_scan_root_bus skips devices which do not have a
> >>>>>    * devfn==0. The pcifront_scan_bus enumerates all devfn. */
> >>>>>    err = pcifront_scan_bus(pdev, domain, bus, b);
> >>>>>
> >>>>> --
> >>>>> 1.7.1
> >>>>>
> >>>>> --
> >>>>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> >>>>> the body of a message to majordomo@vger.kernel.org
> >>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>>>
> >>>> .
> >>>>
> >>>
> >>>
> >>> --
> >>> Thanks!
> >>> Yijing
> >>>
> >>> --
> >>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> >>> the body of a message to majordomo@vger.kernel.org
> >>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>
> >> .
> >>
> >
> >
> > --
> > Thanks!
> > Yijing
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]             ` <20150313140132.GH5378@l.oracle.com>
@ 2015-03-13 14:26               ` Bjorn Helgaas
       [not found]               ` <CAErSpo69ytCxBK5AD79Nz05wy=GwzcOGV7WkiKFxpLDH4wtJXw@mail.gmail.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Bjorn Helgaas @ 2015-03-13 14:26 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: linux-m68k, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org,
	Yijing Wang, Guan Xuetao, Russell King, x86@kernel.org,
	Geert Uytterhoeven, Benjamin Herrenschmidt,
	xen-devel@lists.xenproject.org, Arnd Bergmann, Marc Zyngier,
	Rusty Russell, Thomas Gleixner, Yinghai Lu, linux-arm,
	Liviu Dudau, Tony Luck, linux-kernel@vger.kernel.org, Jiang Liu,
	linux-alpha, Davi

On Fri, Mar 13, 2015 at 9:01 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Fri, Mar 13, 2015 at 08:24:58AM -0500, Bjorn Helgaas wrote:
>> On Thu, Mar 12, 2015 at 9:36 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> >>>>> +  pci_add_resource(&resources, &ioport_resource);
>> >>>>> +  pci_add_resource(&resources, &iomem_resource);
>> >>>>> +  pci_add_resource(&resources, &busn_resource);
>> >>>>
>> >>>> Since I don't want to export busn_resource, you might have to allocate your
>> >>>> own struct resource for it here.  And, of course, figure out the details of
>> >>>> which PCI domain you're in and whether you need to share one struct
>> >>>> resource across several host bridges in the same domain.
>> >>>
>> >>> Allocate its own resource here is ok for me, as I mentioned in previous reply,
>> >>> so do we still need to add additional info to figure out which domain own the bus resource ?
>> >>
>> >> That's up to the caller.  Only the platform knows which bridges it wants to
>> >> have in the same domain.  In principle, every host bridge could be in its
>> >> own domain, since each bridge is the root of a unique PCI hierarchy.  But
>> >> some platforms have firmware that assumes otherwise.  I have no idea what
>> >> xen assumes.
>> >
>> > I'm not xen guy, so I don't know much about it, but because it call pci_scan_bus_parented()
>> > before, and in which busn_resource is always shared for different host bridges(same domain or not),
>> > I think add a static bus resource(0,255) should be safe, at least, it would not introduce new risk.
>> >
>> > Something like:
>> >
>> > diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
>> > index b1ffebe..a69e529 100644
>> > --- a/drivers/pci/xen-pcifront.c
>> > +++ b/drivers/pci/xen-pcifront.c
>> > @@ -446,9 +446,15 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>> >                                  unsigned int domain, unsigned int bus)
>> >  {
>> >         struct pci_bus *b;
>> > +       LIST_HEAD(resources);
>> >         struct pcifront_sd *sd = NULL;
>> >         struct pci_bus_entry *bus_entry = NULL;
>> >         int err = 0;
>> > +       static struct resource busn_res = {
>> > +               .start = 0,
>> > +               .end = 255,
>> > +               .flags = IORESOURCE_BUS,
>> > +       };
>> >
>> >  #ifndef CONFIG_PCI_DOMAINS
>> >         if (domain != 0) {
>> > @@ -470,17 +476,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>> >                 err = -ENOMEM;
>> >                 goto err_out;
>> >         }
>> > +       pci_add_resource(&resources, &ioport_resource);
>> > +       pci_add_resource(&resources, &iomem_resource);
>> > +       pci_add_resource(&resources, &busn_res);
>> >         pcifront_init_sd(sd, domain, bus, pdev);
>> >
>> >         pci_lock_rescan_remove();
>> >
>> > -       b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
>> > -                                 &pcifront_bus_ops, sd);
>> > +       b = pci_scan_root_bus(&pdev->xdev->dev, bus,
>> > +                                 &pcifront_bus_ops, sd, &resources);
>> >         if (!b) {
>> >
>> > Bjorn, what do you think about ?
>>
>> That seems OK to me.  Probably still wrong, but no worse than it was before.
>
> Interesting. The mechanism for PCI passthrough can either synthesize
> and PCI bus number starting at zero (so first device is always 0:0:0.0)
> or it can replicate the backend PCI topology. That means you
> could have segment values passed in, so: ab:ff:00.1). I've to admin
> I hadn't tried the 'physical' replication on an machine with
> domains (err, segments).
>
> Is there an git tree with this so I can just try it out?

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
pci/enumeration-yw6 has similar code (it exports the single
busn_resource and makes xen use it).  That should be functionally
identical to what v4.0-rc1 does.

Yijing hasn't posted the static busn_res proposal above yet, so I
don't have a branch with that in it.

Bjorn

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
       [not found] ` <1425868467-9667-8-git-send-email-wangyijing@huawei.com>
  2015-03-12  1:34   ` [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number Bjorn Helgaas
       [not found]   ` <20150312013408.GB10949@google.com>
@ 2015-03-17  5:15   ` Manish Jaggi
       [not found]   ` <5507B88D.1020300@caviumnetworks.com>
  3 siblings, 0 replies; 18+ messages in thread
From: Manish Jaggi @ 2015-03-17  5:15 UTC (permalink / raw)
  To: Yijing Wang, Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-sh, linux-pci, Chris Metcalf,
	Paul Mackerras, sparclinux, Guan Xuetao, linux-s390, Russell King,
	Michael Ellerman, x86, Sebastian Ott, Geert Uytterhoeven,
	linux-arm-kernel, Benjamin Herrenschmidt, xen-devel, Matt Turner,
	Fenghua Yu, Arnd Bergmann, Marc Zyngier, Rusty Russell,
	linux-m68k, Ivan Kokshaysky, Thomas Gleixner,
	Yinghai Lu <yingh>


On Monday 09 March 2015 08:04 AM, Yijing Wang wrote:
> Now we could pass PCI domain combined with bus number
> in u32 argu. Because in arm/arm64, PCI domain number
> is assigned by pci_bus_assign_domain_nr(). So we leave
> pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
> unchanged. A new function pci_host_assign_domain_nr()
> will be introduced for arm/arm64 to assign domain number
> in later patch.
Hi,
I think these changes might not be required. We have made very few 
changes in the xen-pcifront to support PCI passthrough in arm64.
As per xen architecture for a domU only a single pci virtual bus is 
created and all passthrough devices are attached to it.


-manish
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Richard Henderson <rth@twiddle.net>
> CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> CC: Matt Turner <mattst88@gmail.com>
> CC: Tony Luck <tony.luck@intel.com>
> CC: Fenghua Yu <fenghua.yu@intel.com>
> CC: Michal Simek <monstr@monstr.eu>
> CC: Ralf Baechle <ralf@linux-mips.org>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Paul Mackerras <paulus@samba.org>
> CC: Michael Ellerman <mpe@ellerman.id.au>
> CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
> CC: Gerald Schaefer <gerald.schaefer@de.ibm.com>
> CC: "David S. Miller" <davem@davemloft.net>
> CC: Chris Metcalf <cmetcalf@ezchip.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: linux-alpha@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> CC: linux-ia64@vger.kernel.org
> CC: linux-mips@linux-mips.org
> CC: linuxppc-dev@lists.ozlabs.org
> CC: linux-s390@vger.kernel.org
> CC: linux-sh@vger.kernel.org
> CC: sparclinux@vger.kernel.org
> CC: xen-devel@lists.xenproject.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>   arch/alpha/kernel/pci.c          |    5 +++--
>   arch/alpha/kernel/sys_nautilus.c |    4 ++--
>   arch/ia64/pci/pci.c              |    4 ++--
>   arch/ia64/sn/kernel/io_init.c    |    5 +++--
>   arch/microblaze/pci/pci-common.c |    5 +++--
>   arch/mips/pci/pci.c              |    4 ++--
>   arch/powerpc/kernel/pci-common.c |    5 +++--
>   arch/s390/pci/pci.c              |    5 +++--
>   arch/sh/drivers/pci/pci.c        |    5 +++--
>   arch/sparc/kernel/pci.c          |    5 +++--
>   arch/tile/kernel/pci.c           |    5 +++--
>   arch/tile/kernel/pci_gx.c        |    5 +++--
>   arch/x86/pci/acpi.c              |    7 ++++---
>   arch/x86/pci/common.c            |    3 ++-
>   drivers/pci/xen-pcifront.c       |    5 +++--
>   15 files changed, 42 insertions(+), 30 deletions(-)
>
> diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
> index 5c845ad..deb0a36 100644
> --- a/arch/alpha/kernel/pci.c
> +++ b/arch/alpha/kernel/pci.c
> @@ -336,8 +336,9 @@ common_init_pci(void)
>   		pci_add_resource_offset(&resources, hose->mem_space,
>   					hose->mem_space->start);
>   
> -		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
> -					hose, &resources);
> +		bus = pci_scan_root_bus(NULL,
> +				PCI_DOMBUS(hose->index, next_busno),
> +				alpha_mv.pci_ops, hose, &resources);
>   		if (!bus)
>   			continue;
>   		hose->bus = bus;
> diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
> index 700686d..be0bbeb 100644
> --- a/arch/alpha/kernel/sys_nautilus.c
> +++ b/arch/alpha/kernel/sys_nautilus.c
> @@ -206,10 +206,10 @@ nautilus_init_pci(void)
>   	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
>   
>   	/* Scan our single hose.  */
> -	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
> +	bus = pci_scan_bus(PCI_DOMBUS(hose->index, 0),
> +			alpha_mv.pci_ops, hose);
>   	if (!bus)
>   		return;
> -
>   	hose->bus = bus;
>   	pcibios_claim_one_bus(bus);
>   
> diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
> index 48cc657..675749f 100644
> --- a/arch/ia64/pci/pci.c
> +++ b/arch/ia64/pci/pci.c
> @@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>   	 * should handle the case here, but it appears that IA64 hasn't
>   	 * such quirk. So we just ignore the case now.
>   	 */
> -	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
> -				   &info->resources);
> +	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
> +			&pci_root_ops, controller, &info->resources);
>   	if (!pbus) {
>   		pci_free_resource_list(&info->resources);
>   		__release_pci_root_info(info);
> diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
> index 1be65eb..7e0b7f9 100644
> --- a/arch/ia64/sn/kernel/io_init.c
> +++ b/arch/ia64/sn/kernel/io_init.c
> @@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
>   	pci_add_resource_offset(&resources,	&res[1],
>   			prom_bussoft_ptr->bs_legacy_mem);
>   
> -	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
> -				&resources);
> +	bus = pci_scan_root_bus(NULL,
> +			PCI_DOMBUS(controller->segment, busnum),
> +			&pci_root_ops, controller, &resources);
>    	if (bus == NULL) {
>   		kfree(res);
>   		kfree(controller);
> diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
> index 6d8d173..34a32ec 100644
> --- a/arch/microblaze/pci/pci-common.c
> +++ b/arch/microblaze/pci/pci-common.c
> @@ -1350,8 +1350,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
>   
>   	pcibios_setup_phb_resources(hose, &resources);
>   
> -	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
> -				hose->ops, hose, &resources);
> +	bus = pci_scan_root_bus(hose->parent,
> +			PCI_DOMBUS(hose->global_number, hose->first_busno),
> +			hose->ops, hose, &resources);
>   	if (bus == NULL) {
>   		pr_err("Failed to create bus for PCI domain %04x\n",
>   		       hose->global_number);
> diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
> index 9eb54b5..86f8d2b 100644
> --- a/arch/mips/pci/pci.c
> +++ b/arch/mips/pci/pci.c
> @@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
>   	pci_add_resource_offset(&resources,
>   				hose->mem_resource, hose->mem_offset);
>   	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
> -	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
> -				&resources);
> +	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
> +			hose->pci_ops, hose, &resources);
>   	if (!bus)
>   		pci_free_resource_list(&resources);
>   
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 2a525c9..a467aca 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1612,8 +1612,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
>   	pci_add_resource(&resources, &hose->busn);
>   
>   	/* Create an empty bus for the toplevel */
> -	bus = pci_create_root_bus(hose->parent, hose->first_busno,
> -				  hose->ops, hose, &resources);
> +	bus = pci_create_root_bus(hose->parent,
> +			PCI_DOMBUS(hose->global_number, hose->first_busno),
> +			hose->ops, hose, &resources);
>   	if (bus == NULL) {
>   		pr_err("Failed to create bus for PCI domain %04x\n",
>   			hose->global_number);
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index a2a7391..20e662f 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -770,8 +770,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
>   	if (ret)
>   		return ret;
>   
> -	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
> -				      zdev, &resources);
> +	zdev->bus = pci_scan_root_bus(NULL,
> +			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
> +			zdev, &resources);
>   	if (!zdev->bus) {
>   		zpci_cleanup_bus_resources(zdev);
>   		return -EIO;
> diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
> index efc1051..116f80f 100644
> --- a/arch/sh/drivers/pci/pci.c
> +++ b/arch/sh/drivers/pci/pci.c
> @@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
>   		pci_add_resource_offset(&resources, res, offset);
>   	}
>   
> -	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
> -				&resources);
> +	bus = pci_scan_root_bus(NULL,
> +			PCI_DOMBUS(hose->index, next_busno),
> +			hose->pci_ops, hose, &resources);
>   	hose->bus = bus;
>   
>   	need_domain_info = need_domain_info || hose->index;
> diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
> index 9ce5afe..838fe1e 100644
> --- a/arch/sparc/kernel/pci.c
> +++ b/arch/sparc/kernel/pci.c
> @@ -667,8 +667,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
>   	pbm->busn.end	= pbm->pci_last_busno;
>   	pbm->busn.flags	= IORESOURCE_BUS;
>   	pci_add_resource(&resources, &pbm->busn);
> -	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
> -				  pbm, &resources);
> +	bus = pci_create_root_bus(parent,
> +			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
> +			pbm->pci_ops, pbm, &resources);
>   	if (!bus) {
>   		printk(KERN_ERR "Failed to create bus for %s\n",
>   		       node->full_name);
> diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
> index 9475a74..25b0d9b 100644
> --- a/arch/tile/kernel/pci.c
> +++ b/arch/tile/kernel/pci.c
> @@ -306,8 +306,9 @@ int __init pcibios_init(void)
>   
>   			pci_add_resource(&resources, &ioport_resource);
>   			pci_add_resource(&resources, &iomem_resource);
> -			bus = pci_scan_root_bus(NULL, 0, controller->ops,
> -						controller, &resources);
> +			bus = pci_scan_root_bus(NULL,
> +				PCI_DOMBUS(controller->index, 0),
> +				controller->ops, controller, &resources);
>   			controller->root_bus = bus;
>   			controller->last_busno = bus->busn_res.end;
>   		}
> diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
> index b1df847..f6f41f3 100644
> --- a/arch/tile/kernel/pci_gx.c
> +++ b/arch/tile/kernel/pci_gx.c
> @@ -881,8 +881,9 @@ int __init pcibios_init(void)
>   					controller->mem_offset);
>   		pci_add_resource(&resources, &controller->io_space);
>   		controller->first_busno = next_busno;
> -		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
> -					controller, &resources);
> +		bus = pci_scan_root_bus(NULL,
> +				PCI_DOMBUS(controller->index, next_busno),
> +				controller->ops, controller, &resources);
>   		controller->root_bus = bus;
>   		next_busno = bus->busn_res.end + 1;
>   	}
> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> index 6ac2738..ad0e926 100644
> --- a/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -424,9 +424,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>   		}
>   
>   		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
> -				    (u8)root->secondary.end, root->mcfg_addr))
> -			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
> -						  sd, &resources);
> +				(u8)root->secondary.end, root->mcfg_addr))
> +			bus = pci_create_root_bus(NULL,
> +				PCI_DOMBUS(domain, busnum), &pci_root_ops,
> +				sd, &resources);
>   
>   		if (bus) {
>   			pci_scan_child_bus(bus);
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 0cbc723..0160280 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -486,7 +486,8 @@ void pcibios_scan_root(int busnum)
>   	sd->node = x86_pci_root_bus_node(busnum);
>   	x86_pci_root_bus_resources(busnum, &resources);
>   	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
> -	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
> +	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
> +			&pci_root_ops, sd, &resources);
>   	if (!bus) {
>   		pci_free_resource_list(&resources);
>   		kfree(sd);
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 9e7c28b..af6144a 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -479,8 +479,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
>   
>   	pci_lock_rescan_remove();
>   
> -	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> -				  &pcifront_bus_ops, sd, &resources);
> +	b = pci_scan_root_bus(&pdev->xdev->dev,
> +			PCI_DOMBUS(sd->domain, bus),
> +			&pcifront_bus_ops, sd, &resources);
>   	if (!b) {
>   		dev_err(&pdev->xdev->dev,
>   			"Error creating PCI Frontend Bus!\n");

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
       [not found]   ` <5507B88D.1020300@caviumnetworks.com>
@ 2015-03-17 14:05     ` Ian Campbell
       [not found]     ` <1426601130.18247.238.camel@citrix.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Ian Campbell @ 2015-03-17 14:05 UTC (permalink / raw)
  To: Manish Jaggi
  Cc: linux-mips, linux-ia64, linux-sh, linux-pci, Yijing Wang,
	Chris Metcalf, Paul Mackerras, sparclinux, Guan Xuetao,
	linux-s390, Russell King, Michael Ellerman, x86, Sebastian Ott,
	Geert Uytterhoeven, Gerald Schaefer, Benjamin Herrenschmidt,
	xen-devel, Matt Turner, Fenghua Yu, Arnd Bergmann, Marc Zyngier,
	Rusty Russell, linux-m68k, Ivan Kokshaysky, Bjorn

On Tue, 2015-03-17 at 10:45 +0530, Manish Jaggi wrote:
> On Monday 09 March 2015 08:04 AM, Yijing Wang wrote:
> > Now we could pass PCI domain combined with bus number
> > in u32 argu. Because in arm/arm64, PCI domain number
> > is assigned by pci_bus_assign_domain_nr(). So we leave
> > pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
> > unchanged. A new function pci_host_assign_domain_nr()
> > will be introduced for arm/arm64 to assign domain number
> > in later patch.
> Hi,
> I think these changes might not be required. We have made very few 
> changes in the xen-pcifront to support PCI passthrough in arm64.
> As per xen architecture for a domU only a single pci virtual bus is 
> created and all passthrough devices are attached to it.

I guess you are only talking about the changes to xen-pcifront.c?
Otherwise you are ignoring the dom0 case which is exposed to the real
set of PCI root complexes and anyway I'm not sure how "not needed for
Xen domU" translates into not required, since it is clearly required for
other systems.

Strictly speaking the Xen pciif protocol does support multiple buses,
it's just that the tools, and perhaps kernels, have not yet felt any
need to actually make use of that.

There doesn't seem to be any harm in updating pcifront to follow this
generic API change.

Ian.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
       [not found]     ` <1426601130.18247.238.camel@citrix.com>
@ 2015-03-18  4:26       ` Manish Jaggi
  2015-03-18  5:56         ` Yijing Wang
  0 siblings, 1 reply; 18+ messages in thread
From: Manish Jaggi @ 2015-03-18  4:26 UTC (permalink / raw)
  To: Ian Campbell, xen-devel, Yijing Wang


On Tuesday 17 March 2015 07:35 PM, Ian Campbell wrote:
> On Tue, 2015-03-17 at 10:45 +0530, Manish Jaggi wrote:
>> On Monday 09 March 2015 08:04 AM, Yijing Wang wrote:
>>> Now we could pass PCI domain combined with bus number
>>> in u32 argu. Because in arm/arm64, PCI domain number
>>> is assigned by pci_bus_assign_domain_nr(). So we leave
>>> pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
>>> unchanged. A new function pci_host_assign_domain_nr()
>>> will be introduced for arm/arm64 to assign domain number
>>> in later patch.
>> Hi,
>> I think these changes might not be required. We have made very few
>> changes in the xen-pcifront to support PCI passthrough in arm64.
>> As per xen architecture for a domU only a single pci virtual bus is
>> created and all passthrough devices are attached to it.
> I guess you are only talking about the changes to xen-pcifront.c?
> Otherwise you are ignoring the dom0 case which is exposed to the real
> set of PCI root complexes and anyway I'm not sure how "not needed for
> Xen domU" translates into not required, since it is clearly required for
> other systems.
>
> Strictly speaking the Xen pciif protocol does support multiple buses,
> it's just that the tools, and perhaps kernels, have not yet felt any
> need to actually make use of that.
>
> There doesn't seem to be any harm in updating pcifront to follow this
> generic API change.
ok.

One side question, the function

  pci_host_assign_domain_nr()

which would be introduced in later patch, does it appear to be doing the 
same binding which we are trying to implement via a pci_host_bridge add 
hypercall.

>
> Ian.
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number
  2015-03-18  4:26       ` Manish Jaggi
@ 2015-03-18  5:56         ` Yijing Wang
  0 siblings, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-18  5:56 UTC (permalink / raw)
  To: Manish Jaggi, Ian Campbell, xen-devel

On 2015/3/18 12:26, Manish Jaggi wrote:
> 
> On Tuesday 17 March 2015 07:35 PM, Ian Campbell wrote:
>> On Tue, 2015-03-17 at 10:45 +0530, Manish Jaggi wrote:
>>> On Monday 09 March 2015 08:04 AM, Yijing Wang wrote:
>>>> Now we could pass PCI domain combined with bus number
>>>> in u32 argu. Because in arm/arm64, PCI domain number
>>>> is assigned by pci_bus_assign_domain_nr(). So we leave
>>>> pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
>>>> unchanged. A new function pci_host_assign_domain_nr()
>>>> will be introduced for arm/arm64 to assign domain number
>>>> in later patch.
>>> Hi,
>>> I think these changes might not be required. We have made very few
>>> changes in the xen-pcifront to support PCI passthrough in arm64.
>>> As per xen architecture for a domU only a single pci virtual bus is
>>> created and all passthrough devices are attached to it.
>> I guess you are only talking about the changes to xen-pcifront.c?
>> Otherwise you are ignoring the dom0 case which is exposed to the real
>> set of PCI root complexes and anyway I'm not sure how "not needed for
>> Xen domU" translates into not required, since it is clearly required for
>> other systems.
>>
>> Strictly speaking the Xen pciif protocol does support multiple buses,
>> it's just that the tools, and perhaps kernels, have not yet felt any
>> need to actually make use of that.
>>
>> There doesn't seem to be any harm in updating pcifront to follow this
>> generic API change.
> ok.
> 
> One side question, the function
> 
>  pci_host_assign_domain_nr()
> 
> which would be introduced in later patch, does it appear to be doing the same binding which we are trying to implement via a pci_host_bridge add hypercall.

pci_host_assign_domain_nr() will be called only when CONFIG_PCI_DOMAINS_GENERIC enabled, now mostly be used in arm/arm64.

Thanks!
Yijing.

> 
>>
>> Ian.
>>
> 
> 
> 


-- 
Thanks!
Yijing

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]               ` <CAErSpo69ytCxBK5AD79Nz05wy=GwzcOGV7WkiKFxpLDH4wtJXw@mail.gmail.com>
@ 2015-03-25 19:23                 ` Konrad Rzeszutek Wilk
       [not found]                 ` <20150325192331.GG25884@l.oracle.com>
  1 sibling, 0 replies; 18+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-03-25 19:23 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-m68k, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org,
	Yijing Wang, Guan Xuetao, Russell King, x86@kernel.org,
	Geert Uytterhoeven, Benjamin Herrenschmidt,
	xen-devel@lists.xenproject.org, Arnd Bergmann, Marc Zyngier,
	Rusty Russell, Thomas Gleixner, Yinghai Lu, linux-arm,
	Liviu Dudau, Tony Luck, linux-kernel@vger.kernel.org, Jiang Liu,
	linux-alpha, Davi

On Fri, Mar 13, 2015 at 09:26:08AM -0500, Bjorn Helgaas wrote:
> On Fri, Mar 13, 2015 at 9:01 AM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> > On Fri, Mar 13, 2015 at 08:24:58AM -0500, Bjorn Helgaas wrote:
> >> On Thu, Mar 12, 2015 at 9:36 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> >>>>> +  pci_add_resource(&resources, &ioport_resource);
> >> >>>>> +  pci_add_resource(&resources, &iomem_resource);
> >> >>>>> +  pci_add_resource(&resources, &busn_resource);
> >> >>>>
> >> >>>> Since I don't want to export busn_resource, you might have to allocate your
> >> >>>> own struct resource for it here.  And, of course, figure out the details of
> >> >>>> which PCI domain you're in and whether you need to share one struct
> >> >>>> resource across several host bridges in the same domain.
> >> >>>
> >> >>> Allocate its own resource here is ok for me, as I mentioned in previous reply,
> >> >>> so do we still need to add additional info to figure out which domain own the bus resource ?
> >> >>
> >> >> That's up to the caller.  Only the platform knows which bridges it wants to
> >> >> have in the same domain.  In principle, every host bridge could be in its
> >> >> own domain, since each bridge is the root of a unique PCI hierarchy.  But
> >> >> some platforms have firmware that assumes otherwise.  I have no idea what
> >> >> xen assumes.
> >> >
> >> > I'm not xen guy, so I don't know much about it, but because it call pci_scan_bus_parented()
> >> > before, and in which busn_resource is always shared for different host bridges(same domain or not),
> >> > I think add a static bus resource(0,255) should be safe, at least, it would not introduce new risk.
> >> >
> >> > Something like:
> >> >
> >> > diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> >> > index b1ffebe..a69e529 100644
> >> > --- a/drivers/pci/xen-pcifront.c
> >> > +++ b/drivers/pci/xen-pcifront.c
> >> > @@ -446,9 +446,15 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >> >                                  unsigned int domain, unsigned int bus)
> >> >  {
> >> >         struct pci_bus *b;
> >> > +       LIST_HEAD(resources);
> >> >         struct pcifront_sd *sd = NULL;
> >> >         struct pci_bus_entry *bus_entry = NULL;
> >> >         int err = 0;
> >> > +       static struct resource busn_res = {
> >> > +               .start = 0,
> >> > +               .end = 255,
> >> > +               .flags = IORESOURCE_BUS,
> >> > +       };
> >> >
> >> >  #ifndef CONFIG_PCI_DOMAINS
> >> >         if (domain != 0) {
> >> > @@ -470,17 +476,21 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
> >> >                 err = -ENOMEM;
> >> >                 goto err_out;
> >> >         }
> >> > +       pci_add_resource(&resources, &ioport_resource);
> >> > +       pci_add_resource(&resources, &iomem_resource);
> >> > +       pci_add_resource(&resources, &busn_res);
> >> >         pcifront_init_sd(sd, domain, bus, pdev);
> >> >
> >> >         pci_lock_rescan_remove();
> >> >
> >> > -       b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
> >> > -                                 &pcifront_bus_ops, sd);
> >> > +       b = pci_scan_root_bus(&pdev->xdev->dev, bus,
> >> > +                                 &pcifront_bus_ops, sd, &resources);
> >> >         if (!b) {
> >> >
> >> > Bjorn, what do you think about ?
> >>
> >> That seems OK to me.  Probably still wrong, but no worse than it was before.
> >
> > Interesting. The mechanism for PCI passthrough can either synthesize
> > and PCI bus number starting at zero (so first device is always 0:0:0.0)
> > or it can replicate the backend PCI topology. That means you
> > could have segment values passed in, so: ab:ff:00.1). I've to admin
> > I hadn't tried the 'physical' replication on an machine with
> > domains (err, segments).
> >
> > Is there an git tree with this so I can just try it out?
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
> pci/enumeration-yw6 has similar code (it exports the single

I presume now it is bjorn/pci/enumeration-yw8 ? Going to test this out
this week.
> busn_resource and makes xen use it).  That should be functionally
> identical to what v4.0-rc1 does.
> 
> Yijing hasn't posted the static busn_res proposal above yet, so I
> don't have a branch with that in it.
> 
> Bjorn

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]                 ` <20150325192331.GG25884@l.oracle.com>
@ 2015-03-26  1:18                   ` Yijing Wang
  2015-03-26  7:30                   ` Yijing Wang
  1 sibling, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-26  1:18 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Bjorn Helgaas
  Cc: Liviu Dudau, linux-m68k, Rusty Russell, Russell King,
	xen-devel@lists.xenproject.org, Arnd Bergmann, Marc Zyngier,
	linux-pci@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, David S. Miller, linux-alpha,
	Tony Luck, Geert Uytterhoeven, Benjamin Herrenschmidt,
	linux-ia64@vger.kernel.org, Thomas Gleixner, Guan Xuetao,
	Yinghai Lu, Jiang Liu, linux-arm

>>>> That seems OK to me.  Probably still wrong, but no worse than it was before.
>>>
>>> Interesting. The mechanism for PCI passthrough can either synthesize
>>> and PCI bus number starting at zero (so first device is always 0:0:0.0)
>>> or it can replicate the backend PCI topology. That means you
>>> could have segment values passed in, so: ab:ff:00.1). I've to admin
>>> I hadn't tried the 'physical' replication on an machine with
>>> domains (err, segments).
>>>
>>> Is there an git tree with this so I can just try it out?
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
>> pci/enumeration-yw6 has similar code (it exports the single
> 
> I presume now it is bjorn/pci/enumeration-yw8 ? Going to test this out
> this week.

Yes, it's the latest version. thanks!

>> busn_resource and makes xen use it).  That should be functionally
>> identical to what v4.0-rc1 does.
>>
>> Yijing hasn't posted the static busn_res proposal above yet, so I
>> don't have a branch with that in it.
>>
>> Bjorn
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
       [not found]                 ` <20150325192331.GG25884@l.oracle.com>
  2015-03-26  1:18                   ` Yijing Wang
@ 2015-03-26  7:30                   ` Yijing Wang
  1 sibling, 0 replies; 18+ messages in thread
From: Yijing Wang @ 2015-03-26  7:30 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Bjorn Helgaas
  Cc: Liviu Dudau, linux-m68k, Rusty Russell, Russell King,
	xen-devel@lists.xenproject.org, Arnd Bergmann, Marc Zyngier,
	linux-pci@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, David S. Miller, linux-alpha,
	Tony Luck, Geert Uytterhoeven, Benjamin Herrenschmidt,
	linux-ia64@vger.kernel.org, Thomas Gleixner, Guan Xuetao,
	Yinghai Lu, Jiang Liu, linux-arm

>>> Is there an git tree with this so I can just try it out?
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
>> pci/enumeration-yw6 has similar code (it exports the single
> 
> I presume now it is bjorn/pci/enumeration-yw8 ? Going to test this out
> this week.

Hi Konrad, I fixed two issues found by Tomasz and Daniel for the current v8 version.
I posted out the latest v9 in my github tree. Could you pull this series from my
github tree ?
The URL is: https://github.com/YijingWang/linux-pci.git enumer9

Thanks!
Yijing.

>> busn_resource and makes xen use it).  That should be functionally
>> identical to what v4.0-rc1 does.
>>
>> Yijing hasn't posted the static busn_res proposal above yet, so I
>> don't have a branch with that in it.
>>
>> Bjorn
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-03-26  7:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1425868467-9667-1-git-send-email-wangyijing@huawei.com>
2015-03-09  2:34 ` [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented() Yijing Wang
2015-03-09  2:34 ` [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number Yijing Wang
     [not found] ` <1425868467-9667-5-git-send-email-wangyijing@huawei.com>
2015-03-11 22:32   ` [PATCH v6 04/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented() Bjorn Helgaas
     [not found]   ` <20150311223211.GB1082@google.com>
2015-03-12 11:46     ` Yijing Wang
     [not found]     ` <55017CA5.2010502@huawei.com>
2015-03-12 19:35       ` Bjorn Helgaas
     [not found]       ` <20150312193505.GB7346@google.com>
2015-03-13  2:36         ` Yijing Wang
     [not found]         ` <55024D35.6050509@huawei.com>
2015-03-13 13:24           ` Bjorn Helgaas
     [not found]           ` <CAErSpo4T7f9PNVMLrQbCvW2a=HnRauQR2eBz6H69B7Q2=ELNWw@mail.gmail.com>
2015-03-13 14:01             ` Konrad Rzeszutek Wilk
     [not found]             ` <20150313140132.GH5378@l.oracle.com>
2015-03-13 14:26               ` Bjorn Helgaas
     [not found]               ` <CAErSpo69ytCxBK5AD79Nz05wy=GwzcOGV7WkiKFxpLDH4wtJXw@mail.gmail.com>
2015-03-25 19:23                 ` Konrad Rzeszutek Wilk
     [not found]                 ` <20150325192331.GG25884@l.oracle.com>
2015-03-26  1:18                   ` Yijing Wang
2015-03-26  7:30                   ` Yijing Wang
     [not found] ` <1425868467-9667-8-git-send-email-wangyijing@huawei.com>
2015-03-12  1:34   ` [PATCH v6 07/30] PCI: Pass PCI domain number combined with root bus number Bjorn Helgaas
     [not found]   ` <20150312013408.GB10949@google.com>
2015-03-12 12:20     ` Yijing Wang
2015-03-17  5:15   ` Manish Jaggi
     [not found]   ` <5507B88D.1020300@caviumnetworks.com>
2015-03-17 14:05     ` Ian Campbell
     [not found]     ` <1426601130.18247.238.camel@citrix.com>
2015-03-18  4:26       ` Manish Jaggi
2015-03-18  5:56         ` Yijing Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox