Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1427970 > unrolled thread

[PATCH 0/2] ARM/PCI: Make I/O port space optional

Started byBjorn Helgaas <bhelgaas@google.com>
First post2016-06-21 19:10 +0200
Last post2016-06-21 19:20 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] ARM/PCI: Make I/O port space optional Bjorn Helgaas <bhelgaas@google.com> - 2016-06-21 19:10 +0200
    [PATCH 2/2] PCI: rcar: Drop gen2 dummy I/O port region Bjorn Helgaas <bhelgaas@google.com> - 2016-06-21 19:20 +0200
    [PATCH 1/2] ARM: Make PCI I/O space optional Bjorn Helgaas <bhelgaas@google.com> - 2016-06-21 19:20 +0200

#1427970 — [PATCH 0/2] ARM/PCI: Make I/O port space optional

FromBjorn Helgaas <bhelgaas@google.com>
Date2016-06-21 19:10 +0200
Subject[PATCH 0/2] ARM/PCI: Make I/O port space optional
Message-ID<rMxlv-eK-27@gated-at.bofh.it>
Currently we always require an I/O port resource for PCI host bridges.  Even
if the bridge doesn't actually support I/O port space, we add a default I/O
resource for it.

These patches make I/O port space optional on ARM.  Comments welcome.

If these look OK, I'll fold them into the series at [1], where they should
fix a resource conflict [2] in the R-Car driver.

[1] http://lkml.kernel.org/r/20160606225630.20936.77349.stgit@bhelgaas-glaptop2.roam.corp.google.com
[2] http://lkml.kernel.org/r/CAMuHMdVgLfTD-BjRZ+gVKgYE8dkDZzQ6DnYtkUs+jVPthJsEdQ@mail.gmail.com

---

Bjorn Helgaas (2):
      ARM: Make PCI I/O space optional
      PCI: rcar: Drop gen2 dummy I/O port region


 arch/arm/include/asm/mach/pci.h  |    1 +
 arch/arm/kernel/bios32.c         |   13 +++++++++++--
 drivers/pci/host/pci-rcar-gen2.c |   11 +----------
 3 files changed, 13 insertions(+), 12 deletions(-)

[toc] | [next] | [standalone]


#1427984 — [PATCH 2/2] PCI: rcar: Drop gen2 dummy I/O port region

FromBjorn Helgaas <bhelgaas@google.com>
Date2016-06-21 19:20 +0200
Subject[PATCH 2/2] PCI: rcar: Drop gen2 dummy I/O port region
Message-ID<rMxvb-ii-31@gated-at.bofh.it>
In reply to#1427970
Previously we added a dummy I/O port region even though the R-Car
controller doesn't support PCI port I/O.  This resulted in bogus root bus
resources like this:

  pci_bus 0000:00: root bus resource [io  0xee080000-0xee0810ff]
  pci_bus 0000:00: root bus resource [mem 0xee080000-0xee0810ff]

Drop the unused dummy I/O port region and set struct hw_pci.io_optional so
the ARM PCI code doesn't add a default one for us.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pci-rcar-gen2.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
index 9980a4b..ddf7765 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -97,7 +97,6 @@
 struct rcar_pci_priv {
 	struct device *dev;
 	void __iomem *reg;
-	struct resource io_res;
 	struct resource mem_res;
 	struct resource *cfg_res;
 	unsigned busnr;
@@ -273,7 +272,6 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys)
 		rcar_pci_setup_errirq(priv);
 
 	/* Add PCI resources */
-	pci_add_resource(&sys->resources, &priv->io_res);
 	pci_add_resource(&sys->resources, &priv->mem_res);
 
 	/* Setup bus number based on platform device id / of bus-range */
@@ -371,14 +369,6 @@ static int rcar_pci_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	priv->mem_res = *mem_res;
-	/*
-	 * The controller does not support/use port I/O,
-	 * so setup a dummy port I/O region here.
-	 */
-	priv->io_res.start = priv->mem_res.start;
-	priv->io_res.end = priv->mem_res.end;
-	priv->io_res.flags = IORESOURCE_IO;
-
 	priv->cfg_res = cfg_res;
 
 	priv->irq = platform_get_irq(pdev, 0);
@@ -421,6 +411,7 @@ static int rcar_pci_probe(struct platform_device *pdev)
 	hw_private[0] = priv;
 	memset(&hw, 0, sizeof(hw));
 	hw.nr_controllers = ARRAY_SIZE(hw_private);
+	hw.io_optional = 1;
 	hw.private_data = hw_private;
 	hw.map_irq = rcar_pci_map_irq;
 	hw.ops = &rcar_pci_ops;

[toc] | [prev] | [next] | [standalone]


#1427986 — [PATCH 1/2] ARM: Make PCI I/O space optional

FromBjorn Helgaas <bhelgaas@google.com>
Date2016-06-21 19:20 +0200
Subject[PATCH 1/2] ARM: Make PCI I/O space optional
Message-ID<rMxvb-ii-33@gated-at.bofh.it>
In reply to#1427970
For callers of pci_common_init_dev(), we previously always required a PCI
I/O port resource.  If the caller's ->setup() function had added an I/O
resource, we used that; otherwise, we added a default 64K I/O port space
for it.

There are PCI host bridges that do not support I/O port space, and we
should not add fictitious spaces for them.

If a caller sets struct hw_pci.io_optional, assume it is responsible for
adding any I/O port resource it desires, and do not add any default I/O
port space.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/arm/include/asm/mach/pci.h |    1 +
 arch/arm/kernel/bios32.c        |   13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 0070e85..2d88af5 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -22,6 +22,7 @@ struct hw_pci {
 	struct msi_controller *msi_ctrl;
 	struct pci_ops	*ops;
 	int		nr_controllers;
+	unsigned int	io_optional:1;
 	void		**private_data;
 	int		(*setup)(int nr, struct pci_sys_data *);
 	struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 05e61a2..65f12ef 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -410,7 +410,8 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 	return irq;
 }
 
-static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
+static int pcibios_init_resource(int busnr, struct pci_sys_data *sys,
+				 int io_optional)
 {
 	int ret;
 	struct resource_entry *window;
@@ -420,6 +421,14 @@ static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
 			 &iomem_resource, sys->mem_offset);
 	}
 
+	/*
+	 * If a platform says I/O port support is optional, we don't add
+	 * the default I/O space.  The platform is responsible for adding
+	 * any I/O space it needs.
+	 */
+	if (io_optional)
+		return 0;
+
 	resource_list_for_each_entry(window, &sys->resources)
 		if (resource_type(window->res) == IORESOURCE_IO)
 			return 0;
@@ -466,7 +475,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
 		if (ret > 0) {
 			struct pci_host_bridge *host_bridge;
 
-			ret = pcibios_init_resources(nr, sys);
+			ret = pcibios_init_resource(nr, sys, hw->io_optional);
 			if (ret)  {
 				kfree(sys);
 				break;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web