linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ray Jui <ray.jui@broadcom.com>
To: Bjorn Helgaas <helgaas@kernel.org>, Wei Liu <wei.liu@kernel.org>
Cc: linux-pci@vger.kernel.org, rjui@broadcom.com,
	Andrew Murray <andrew.murray@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: Re: [PATCH] PCI: iproc: move quirks to driver
Date: Thu, 12 Dec 2019 16:08:57 -0800	[thread overview]
Message-ID: <67db99be-5552-a0c7-bf67-a32d3156bb11@broadcom.com> (raw)
In-Reply-To: <20191212232344.GA36928@google.com>



On 2019-12-12 3:23 p.m., Bjorn Helgaas wrote:
> On Wed, Dec 11, 2019 at 04:34:38PM -0600, Bjorn Helgaas wrote:
>> On Wed, Dec 11, 2019 at 05:45:11PM +0000, Wei Liu wrote:
>>> The quirks were originally enclosed by ifdef. That made the quirks not
>>> to be applied when respective drivers were compiled as modules.
>>>
>>> Move the quirks to driver code to fix the issue.
>>>
>>> Signed-off-by: Wei Liu <wei.liu@kernel.org>
>>
>> This straddles the core and native driver boundary, so I applied it to
>> pci/misc for v5.6.  Thanks, I think this is a great solution!  It's
>> always nice when we can encapsulate device-specific things in a
>> driver.
> 
> OK, I moved this to pcie-iproc.c:
> 

Thanks a lot, Bjorn!

> commit 574f29036fce ("PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in")
> Author: Wei Liu <wei.liu@kernel.org>
> Date:   Wed Dec 11 17:45:11 2019 +0000
> 
>      PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in
>      
>      Previously quirk_paxc_bridge() was applied when the iproc driver was
>      built-in, but not when it was compiled as a module.
>      
>      This happened because it was under #ifdef CONFIG_PCIE_IPROC_PLATFORM:
>      PCIE_IPROC_PLATFORM=y causes CONFIG_PCIE_IPROC_PLATFORM to be defined, but
>      PCIE_IPROC_PLATFORM=m causes CONFIG_PCIE_IPROC_PLATFORM_MODULE to be
>      defined.
>      
>      Move quirk_paxc_bridge() to pcie-iproc.c and drop the #ifdef so the quirk
>      is always applied, whether iproc is built-in or a module.
>      
>      [bhelgaas: commit log, move to pcie-iproc.c, not pcie-iproc-platform.c]
>      Link: https://lore.kernel.org/r/20191211174511.89713-1-wei.liu@kernel.org
>      Signed-off-by: Wei Liu <wei.liu@kernel.org>
>      Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index 0a468c73bae3..8c7f875acf7f 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1588,6 +1588,30 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd802,
>   DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd804,
>   			quirk_paxc_disable_msi_parsing);
>   
> +static void quirk_paxc_bridge(struct pci_dev *pdev)
> +{
> +	/*
> +	 * The PCI config space is shared with the PAXC root port and the first
> +	 * Ethernet device.  So, we need to workaround this by telling the PCI
> +	 * code that the bridge is not an Ethernet device.
> +	 */
> +	if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
> +		pdev->class = PCI_CLASS_BRIDGE_PCI << 8;
> +
> +	/*
> +	 * MPSS is not being set properly (as it is currently 0).  This is
> +	 * because that area of the PCI config space is hard coded to zero, and
> +	 * is not modifiable by firmware.  Set this to 2 (e.g., 512 byte MPS)
> +	 * so that the MPS can be set to the real max value.
> +	 */
> +	pdev->pcie_mpss = 2;
> +}
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x16cd, quirk_paxc_bridge);
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x16f0, quirk_paxc_bridge);
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd750, quirk_paxc_bridge);
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd802, quirk_paxc_bridge);
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd804, quirk_paxc_bridge);
> +
>   MODULE_AUTHOR("Ray Jui <rjui@broadcom.com>");
>   MODULE_DESCRIPTION("Broadcom iPROC PCIe common driver");
>   MODULE_LICENSE("GPL v2");
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 4937a088d7d8..202837ed68c9 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -2381,32 +2381,6 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_BROADCOM,
>   			 PCI_DEVICE_ID_TIGON3_5719,
>   			 quirk_brcm_5719_limit_mrrs);
>   
> -#ifdef CONFIG_PCIE_IPROC_PLATFORM
> -static void quirk_paxc_bridge(struct pci_dev *pdev)
> -{
> -	/*
> -	 * The PCI config space is shared with the PAXC root port and the first
> -	 * Ethernet device.  So, we need to workaround this by telling the PCI
> -	 * code that the bridge is not an Ethernet device.
> -	 */
> -	if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
> -		pdev->class = PCI_CLASS_BRIDGE_PCI << 8;
> -
> -	/*
> -	 * MPSS is not being set properly (as it is currently 0).  This is
> -	 * because that area of the PCI config space is hard coded to zero, and
> -	 * is not modifiable by firmware.  Set this to 2 (e.g., 512 byte MPS)
> -	 * so that the MPS can be set to the real max value.
> -	 */
> -	pdev->pcie_mpss = 2;
> -}
> -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x16cd, quirk_paxc_bridge);
> -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x16f0, quirk_paxc_bridge);
> -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd750, quirk_paxc_bridge);
> -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd802, quirk_paxc_bridge);
> -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd804, quirk_paxc_bridge);
> -#endif
> -
>   /*
>    * Originally in EDAC sources for i82875P: Intel tells BIOS developers to
>    * hide device 6 which configures the overflow device access containing the
> 

      reply	other threads:[~2019-12-13  0:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 17:45 [PATCH] PCI: iproc: move quirks to driver Wei Liu
2019-12-11 22:34 ` Bjorn Helgaas
2019-12-11 23:40   ` Ray Jui
2019-12-12  0:02     ` Bjorn Helgaas
2019-12-12  0:05       ` Ray Jui
2019-12-12 10:33         ` Wei Liu
2019-12-12 23:23   ` Bjorn Helgaas
2019-12-13  0:08     ` Ray Jui [this message]

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=67db99be-5552-a0c7-bf67-a32d3156bb11@broadcom.com \
    --to=ray.jui@broadcom.com \
    --cc=andrew.murray@arm.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rjui@broadcom.com \
    --cc=wei.liu@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).