All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Mark Salter <msalter@redhat.com>
Cc: Tanmay Inamdar <tinamdar@apm.com>, Rob Herring <robh@kernel.org>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: xgene: fix breakage from generic config usage
Date: Fri, 6 Mar 2015 11:04:08 -0600	[thread overview]
Message-ID: <20150306170408.GD20077@google.com> (raw)
In-Reply-To: <1425507864-22055-1-git-send-email-msalter@redhat.com>

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
> 

WARNING: multiple messages have this Message-ID (diff)
From: bhelgaas@google.com (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI: xgene: fix breakage from generic config usage
Date: Fri, 6 Mar 2015 11:04:08 -0600	[thread overview]
Message-ID: <20150306170408.GD20077@google.com> (raw)
In-Reply-To: <1425507864-22055-1-git-send-email-msalter@redhat.com>

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
> 

  parent reply	other threads:[~2015-03-06 17:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-03-06 17:04   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150306170408.GD20077@google.com \
    --to=bhelgaas@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=msalter@redhat.com \
    --cc=robh@kernel.org \
    --cc=tinamdar@apm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.