Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: "Marek Behún" <kabel@kernel.org>, "Bjorn Helgaas" <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, pali@kernel.org
Subject: Re: [PATCH 12/14] PCI: aardvark: Set PCI Bridge Class Code to PCI Bridge
Date: Thu, 28 Oct 2021 19:30:54 +0100	[thread overview]
Message-ID: <20211028183054.GA4746@lpieralisi> (raw)
In-Reply-To: <20211012164145.14126-13-kabel@kernel.org>

On Tue, Oct 12, 2021 at 06:41:43PM +0200, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> Aardvark controller has something like config space of a Root Port
> available at offset 0x0 of internal registers - these registers are used
> for implementation of the emulated bridge.
> 
> The default value of Class Code of this bridge corresponds to a RAID Mass
> storage controller, though. (This is probably intended for when the
> controller is used as Endpoint.)
> 
> Change the Class Code to correspond to a PCI Bridge.
> 
> Add comment explaining this change.
> 
> Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Marek Behún <kabel@kernel.org>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Cc: stable@vger.kernel.org
> ---
>  drivers/pci/controller/pci-aardvark.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> index 289cd45ed1ec..801657e7da93 100644
> --- a/drivers/pci/controller/pci-aardvark.c
> +++ b/drivers/pci/controller/pci-aardvark.c
> @@ -513,6 +513,26 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)
>  	reg = (PCI_VENDOR_ID_MARVELL << 16) | PCI_VENDOR_ID_MARVELL;
>  	advk_writel(pcie, reg, VENDOR_ID_REG);
>  
> +	/*
> +	 * Change Class Code of PCI Bridge device to PCI Bridge (0x600400),
> +	 * because the default value is Mass storage controller (0x010400).
> +	 *
> +	 * Note that this Aardvark PCI Bridge does not have compliant Type 1
> +	 * Configuration Space and it even cannot be accessed via Aardvark's
> +	 * PCI config space access method. Something like config space is
> +	 * available in internal Aardvark registers starting at offset 0x0
> +	 * and is reported as Type 0. In range 0x10 - 0x34 it has totally
> +	 * different registers.

Is the RP enumerated as a PCI device with type 0 header ?

> +	 *
> +	 * Therefore driver uses emulation of PCI Bridge which emulates
> +	 * access to configuration space via internal Aardvark registers or
> +	 * emulated configuration buffer.
> +	 */
> +	reg = advk_readl(pcie, PCIE_CORE_DEV_REV_REG);
> +	reg &= ~0xffffff00;
> +	reg |= (PCI_CLASS_BRIDGE_PCI << 8) << 8;
> +	advk_writel(pcie, reg, PCIE_CORE_DEV_REV_REG);

I remember Bjorn commenting on something similar in the past - he may
have some comments on whether this change is the right thing to do.

Lorenzo

>  	/* Disable Root Bridge I/O space, memory space and bus mastering */
>  	reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG);
>  	reg &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
> -- 
> 2.32.0
> 

  reply	other threads:[~2021-10-28 18:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 16:41 [PATCH 00/14] PCI: aardvark controller fixes BATCH 2 Marek Behún
2021-10-12 16:41 ` [PATCH 01/14] PCI: pci-bridge-emul: Fix emulation of W1C bits Marek Behún
2021-10-12 16:41 ` [PATCH 02/14] PCI: aardvark: Fix return value of MSI domain .alloc() method Marek Behún
2021-10-27 11:26   ` Lorenzo Pieralisi
2021-10-27 11:31     ` Pali Rohár
2021-10-12 16:41 ` [PATCH 03/14] PCI: aardvark: Read all 16-bits from PCIE_MSI_PAYLOAD_REG Marek Behún
2021-10-12 16:41 ` [PATCH 04/14] PCI: aardvark: Fix support for MSI interrupts Marek Behún
2021-10-12 16:41 ` [PATCH 05/14] PCI: aardvark: Fix reading MSI interrupt number Marek Behún
2021-10-12 16:41 ` [PATCH 06/14] PCI: aardvark: Clear all MSIs at setup Marek Behún
2021-10-12 16:41 ` [PATCH 07/14] PCI: aardvark: Refactor unmasking summary MSI interrupt Marek Behún
2021-10-12 16:41 ` [PATCH 08/14] PCI: aardvark: Fix masking MSI interrupts Marek Behún
2021-10-12 16:41 ` [PATCH 09/14] PCI: aardvark: Fix setting MSI address Marek Behún
2021-10-12 16:41 ` [PATCH 10/14] PCI: aardvark: Enable MSI-X support Marek Behún
2021-10-27 14:12   ` Lorenzo Pieralisi
2021-10-27 14:23     ` Pali Rohár
2021-10-28 11:08       ` Lorenzo Pieralisi
2021-10-28 11:13         ` Pali Rohár
2021-10-28 11:30           ` Lorenzo Pieralisi
2021-10-28 11:37             ` Pali Rohár
2021-10-28 15:24               ` Marc Zyngier
2021-10-28 15:29                 ` Pali Rohár
2021-10-28 15:51                 ` Marek Behún
2021-10-28 16:22                   ` Marc Zyngier
2021-10-28 16:25                   ` Marek Behún
2021-10-28 17:00                     ` Marc Zyngier
2021-10-28 17:47                       ` Lorenzo Pieralisi
2021-10-28 18:24                         ` Marek Behún
2021-10-12 16:41 ` [PATCH 11/14] PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on emulated bridge Marek Behún
2021-10-12 16:41 ` [PATCH 12/14] PCI: aardvark: Set PCI Bridge Class Code to PCI Bridge Marek Behún
2021-10-28 18:30   ` Lorenzo Pieralisi [this message]
2021-10-28 18:45     ` Pali Rohár
2021-10-28 20:43       ` Bjorn Helgaas
2021-10-12 16:41 ` [PATCH 13/14] PCI: aardvark: Fix support for PCI_BRIDGE_CTL_BUS_RESET on emulated bridge Marek Behún
2021-10-12 16:41 ` [PATCH 14/14] PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 " Marek Behún
2021-10-19 18:36 ` [PATCH 00/14] PCI: aardvark controller fixes BATCH 2 Pali Rohár
2021-10-28 18:33 ` Lorenzo Pieralisi

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=20211028183054.GA4746@lpieralisi \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=kabel@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pali@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