All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: xgene: fix breakage from generic config usage
@ 2015-03-04 22:24 ` Mark Salter
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Salter @ 2015-03-04 22:24 UTC (permalink / raw)
  To: Tanmay Inamdar
  Cc: Bjorn Helgaas, Rob Herring, linux-kernel, linux-pci,
	linux-arm-kernel, Mark Salter

Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
accessors") breaks PCI on the X-Gene platform. It creates two
problems with the xgene_pcie_map_bus() function. First, it returns
an int but should return a void __iomem *, but that's just a
compile-time warning. The breakage is caused by the offset not
being added to the base of the config map. So all config reads
and writes operate on the first four bytes of config space. This
patch fixes both issues.

Signed-off-by: Mark Salter <msalter@redhat.com>
---
 drivers/pci/host/pci-xgene.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 52bb25c..b87f80b 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
 	return false;
 }
 
-static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
-			      int offset)
+static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
+					int offset)
 {
 	struct xgene_pcie_port *port = bus->sysdata;
+	void __iomem *base;
 
 	if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
 	    xgene_pcie_hide_rc_bars(bus, offset))
 		return NULL;
 
 	xgene_pcie_set_rtdid_reg(bus, devfn);
-	return xgene_pcie_get_cfg_base(bus);
+	base = xgene_pcie_get_cfg_base(bus);
+	if (base)
+		base += offset;
+	return base;
 }
 
 static struct pci_ops xgene_pcie_ops = {
-- 
1.8.3.1


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

* [PATCH] PCI: xgene: fix breakage from generic config usage
@ 2015-03-04 22:24 ` Mark Salter
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Salter @ 2015-03-04 22:24 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
accessors") breaks PCI on the X-Gene platform. It creates two
problems with the xgene_pcie_map_bus() function. First, it returns
an int but should return a void __iomem *, but that's just a
compile-time warning. The breakage is caused by the offset not
being added to the base of the config map. So all config reads
and writes operate on the first four bytes of config space. This
patch fixes both issues.

Signed-off-by: Mark Salter <msalter@redhat.com>
---
 drivers/pci/host/pci-xgene.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 52bb25c..b87f80b 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
 	return false;
 }
 
-static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
-			      int offset)
+static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
+					int offset)
 {
 	struct xgene_pcie_port *port = bus->sysdata;
+	void __iomem *base;
 
 	if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
 	    xgene_pcie_hide_rc_bars(bus, offset))
 		return NULL;
 
 	xgene_pcie_set_rtdid_reg(bus, devfn);
-	return xgene_pcie_get_cfg_base(bus);
+	base = xgene_pcie_get_cfg_base(bus);
+	if (base)
+		base += offset;
+	return base;
 }
 
 static struct pci_ops xgene_pcie_ops = {
-- 
1.8.3.1

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

* Re: [PATCH] PCI: xgene: fix breakage from generic config usage
  2015-03-04 22:24 ` Mark Salter
@ 2015-03-05 16:54   ` Feng Kan
  -1 siblings, 0 replies; 6+ messages in thread
From: Feng Kan @ 2015-03-05 16:54 UTC (permalink / raw)
  To: Mark Salter
  Cc: Tanmay Inamdar, Bjorn Helgaas, Rob Herring,
	linux-kernel@vger.kernel.org, linux-pci,
	linux-arm-kernel@lists.infradead.org

Acked-by: Feng Kan <fkan@apm.com>

On Wed, Mar 4, 2015 at 2:24 PM, Mark Salter <msalter@redhat.com> wrote:
> Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
> accessors") breaks PCI on the X-Gene platform. It creates two
> problems with the xgene_pcie_map_bus() function. First, it returns
> an int but should return a void __iomem *, but that's just a
> compile-time warning. The breakage is caused by the offset not
> being added to the base of the config map. So all config reads
> and writes operate on the first four bytes of config space. This
> patch fixes both issues.
>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> ---
>  drivers/pci/host/pci-xgene.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
> index 52bb25c..b87f80b 100644
> --- a/drivers/pci/host/pci-xgene.c
> +++ b/drivers/pci/host/pci-xgene.c
> @@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
>         return false;
>  }
>
> -static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> -                             int offset)
> +static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> +                                       int offset)
>  {
>         struct xgene_pcie_port *port = bus->sysdata;
> +       void __iomem *base;
>
>         if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
>             xgene_pcie_hide_rc_bars(bus, offset))
>                 return NULL;
>
>         xgene_pcie_set_rtdid_reg(bus, devfn);
> -       return xgene_pcie_get_cfg_base(bus);
> +       base = xgene_pcie_get_cfg_base(bus);
> +       if (base)
> +               base += offset;
> +       return base;
>  }
>
>  static struct pci_ops xgene_pcie_ops = {
> --
> 1.8.3.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] 6+ messages in thread

* [PATCH] PCI: xgene: fix breakage from generic config usage
@ 2015-03-05 16:54   ` Feng Kan
  0 siblings, 0 replies; 6+ messages in thread
From: Feng Kan @ 2015-03-05 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

Acked-by: Feng Kan <fkan@apm.com>

On Wed, Mar 4, 2015 at 2:24 PM, Mark Salter <msalter@redhat.com> wrote:
> Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
> accessors") breaks PCI on the X-Gene platform. It creates two
> problems with the xgene_pcie_map_bus() function. First, it returns
> an int but should return a void __iomem *, but that's just a
> compile-time warning. The breakage is caused by the offset not
> being added to the base of the config map. So all config reads
> and writes operate on the first four bytes of config space. This
> patch fixes both issues.
>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> ---
>  drivers/pci/host/pci-xgene.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
> index 52bb25c..b87f80b 100644
> --- a/drivers/pci/host/pci-xgene.c
> +++ b/drivers/pci/host/pci-xgene.c
> @@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
>         return false;
>  }
>
> -static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> -                             int offset)
> +static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> +                                       int offset)
>  {
>         struct xgene_pcie_port *port = bus->sysdata;
> +       void __iomem *base;
>
>         if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
>             xgene_pcie_hide_rc_bars(bus, offset))
>                 return NULL;
>
>         xgene_pcie_set_rtdid_reg(bus, devfn);
> -       return xgene_pcie_get_cfg_base(bus);
> +       base = xgene_pcie_get_cfg_base(bus);
> +       if (base)
> +               base += offset;
> +       return base;
>  }
>
>  static struct pci_ops xgene_pcie_ops = {
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] PCI: xgene: fix breakage from generic config usage
  2015-03-04 22:24 ` Mark Salter
@ 2015-03-06 17:04   ` Bjorn Helgaas
  -1 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2015-03-06 17:04 UTC (permalink / raw)
  To: Mark Salter
  Cc: Tanmay Inamdar, Rob Herring, linux-kernel, linux-pci,
	linux-arm-kernel

On Wed, Mar 04, 2015 at 05:24:24PM -0500, Mark Salter wrote:
> Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
> accessors") breaks PCI on the X-Gene platform. It creates two
> problems with the xgene_pcie_map_bus() function. First, it returns
> an int but should return a void __iomem *, but that's just a
> compile-time warning. The breakage is caused by the offset not
> being added to the base of the config map. So all config reads
> and writes operate on the first four bytes of config space. This
> patch fixes both issues.
> 
> Signed-off-by: Mark Salter <msalter@redhat.com>

I forgot to copy you, Mark, but I applied Feng's earlier patch [1], which I
think is equivalent to yours.

[1] https://patchwork.ozlabs.org/patch/440759/

> ---
>  drivers/pci/host/pci-xgene.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
> index 52bb25c..b87f80b 100644
> --- a/drivers/pci/host/pci-xgene.c
> +++ b/drivers/pci/host/pci-xgene.c
> @@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
>  	return false;
>  }
>  
> -static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> -			      int offset)
> +static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> +					int offset)
>  {
>  	struct xgene_pcie_port *port = bus->sysdata;
> +	void __iomem *base;
>  
>  	if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
>  	    xgene_pcie_hide_rc_bars(bus, offset))
>  		return NULL;
>  
>  	xgene_pcie_set_rtdid_reg(bus, devfn);
> -	return xgene_pcie_get_cfg_base(bus);
> +	base = xgene_pcie_get_cfg_base(bus);
> +	if (base)
> +		base += offset;
> +	return base;
>  }
>  
>  static struct pci_ops xgene_pcie_ops = {
> -- 
> 1.8.3.1
> 

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

* [PATCH] PCI: xgene: fix breakage from generic config usage
@ 2015-03-06 17:04   ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2015-03-06 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 04, 2015 at 05:24:24PM -0500, Mark Salter wrote:
> Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
> accessors") breaks PCI on the X-Gene platform. It creates two
> problems with the xgene_pcie_map_bus() function. First, it returns
> an int but should return a void __iomem *, but that's just a
> compile-time warning. The breakage is caused by the offset not
> being added to the base of the config map. So all config reads
> and writes operate on the first four bytes of config space. This
> patch fixes both issues.
> 
> Signed-off-by: Mark Salter <msalter@redhat.com>

I forgot to copy you, Mark, but I applied Feng's earlier patch [1], which I
think is equivalent to yours.

[1] https://patchwork.ozlabs.org/patch/440759/

> ---
>  drivers/pci/host/pci-xgene.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
> index 52bb25c..b87f80b 100644
> --- a/drivers/pci/host/pci-xgene.c
> +++ b/drivers/pci/host/pci-xgene.c
> @@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
>  	return false;
>  }
>  
> -static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> -			      int offset)
> +static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
> +					int offset)
>  {
>  	struct xgene_pcie_port *port = bus->sysdata;
> +	void __iomem *base;
>  
>  	if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
>  	    xgene_pcie_hide_rc_bars(bus, offset))
>  		return NULL;
>  
>  	xgene_pcie_set_rtdid_reg(bus, devfn);
> -	return xgene_pcie_get_cfg_base(bus);
> +	base = xgene_pcie_get_cfg_base(bus);
> +	if (base)
> +		base += offset;
> +	return base;
>  }
>  
>  static struct pci_ops xgene_pcie_ops = {
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2015-03-06 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04 22:24 [PATCH] PCI: xgene: fix breakage from generic config usage Mark Salter
2015-03-04 22:24 ` Mark Salter
2015-03-05 16:54 ` Feng Kan
2015-03-05 16:54   ` Feng Kan
2015-03-06 17:04 ` Bjorn Helgaas
2015-03-06 17:04   ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.