linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Nowicki <tn@semihalf.com>
To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com,
	catalin.marinas@arm.com, rafael@kernel.org
Cc: hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com,
	okaya@codeaurora.org, jiang.liu@linux.intel.com,
	jchandra@broadcom.com, robert.richter@caviumnetworks.com,
	mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com,
	wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com,
	msalter@redhat.com, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org,
	jcm@redhat.com
Subject: Re: [PATCH V6 12/13] pci, pci-thunder-ecam: Add ACPI support for ThunderX ECAM.
Date: Tue, 19 Apr 2016 12:26:08 +0200	[thread overview]
Message-ID: <571607C0.10909@semihalf.com> (raw)
In-Reply-To: <1460740008-19489-13-git-send-email-tn@semihalf.com>

On 15.04.2016 19:06, Tomasz Nowicki wrote:
> Passes 1.x miss PCI enhanced allocation (EA) header for fixed-BARs,
> thus these passes should use Cavium-specific config access functions
> that synthesize the missing EA capabilities.
>
> We already have DT driver which addresses errata requirements and
> allows to use special PCI config accessors. Currently this driver uses
> compatible = "cavium,pci-host-thunder-ecam" to mach against the errata.
> For ACPI case we need explicit errata number and corresponding
> DECLARE_ACPI_MCFG_FIXUP fixup code.
>
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> ---
>   arch/arm64/Kconfig                  | 14 ++++++++++++++
>   arch/arm64/include/asm/cpufeature.h |  3 ++-
>   arch/arm64/kernel/cpu_errata.c      |  8 ++++++++
>   drivers/pci/host/pci-thunder-ecam.c | 35 +++++++++++++++++++++++++++++++++++
>   4 files changed, 59 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 1bded87..b7614b8 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -445,6 +445,20 @@ config CAVIUM_ERRATUM_27456
>
>   	  If unsure, say Y.
>
> +config CAVIUM_ERRATUM_24575
> +	bool "Cavium erratum 24575: Enhanced Allocation (EA) emualaion"
> +	default y
> +	help
> +	  Enable workaround for erratum 24575.
> +
> +	  Early versions of the Cavium Thunder CN88XX processor are missing
> +	  Enhanced Allocation (EA) capabilities for the fixed BAR addresses used
> +	  by the on-SoC hardware blocks. The erratum adds config access
> +	  functions that synthesize the missing EA capabilities for versions
> +	  that are missing that information.
> +
> +	  If unsure, say Y.
> +
>   endmenu
>
>
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index b9b6494..a78364e 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -35,8 +35,9 @@
>   #define ARM64_ALT_PAN_NOT_UAO			10
>   #define ARM64_HAS_VIRT_HOST_EXTN		11
>   #define ARM64_WORKAROUND_CAVIUM_27456		12
> +#define ARM64_WORKAROUND_CAVIUM_24575		13
>
> -#define ARM64_NCAPS				13
> +#define ARM64_NCAPS				14
>
>   #ifndef __ASSEMBLY__
>
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 06afd04..89c13d7 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
> @@ -97,6 +97,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
>   			   (1 << MIDR_VARIANT_SHIFT) | 1),
>   	},
>   #endif
> +#ifdef CONFIG_CAVIUM_ERRATUM_24575
> +	{
> +	/* Cavium ThunderX, pass 1.x */
> +		.desc = "Cavium erratum 24575",
> +		.capability = ARM64_WORKAROUND_CAVIUM_24575,
> +		MIDR_RANGE(MIDR_THUNDERX, 0x00, 0x01),
> +	},
> +#endif
>   	{
>   	}
>   };
> diff --git a/drivers/pci/host/pci-thunder-ecam.c b/drivers/pci/host/pci-thunder-ecam.c
> index f67c6d7..01de697 100644
> --- a/drivers/pci/host/pci-thunder-ecam.c
> +++ b/drivers/pci/host/pci-thunder-ecam.c
> @@ -11,10 +11,14 @@
>   #include <linux/ioport.h>
>   #include <linux/of_pci.h>
>   #include <linux/of.h>
> +#include <linux/pci-acpi.h>
>   #include <linux/platform_device.h>
>
> +#include <asm/virt.h>
> +
>   #include "../ecam.h"
>
> +
>   static void set_val(u32 v, int where, int size, u32 *val)
>   {
>   	int shift = (where & 3) * 8;
> @@ -376,5 +380,36 @@ static struct platform_driver thunder_ecam_driver = {
>   };
>   module_platform_driver(thunder_ecam_driver);
>
> +#ifdef CONFIG_ACPI
> +
> +static bool needs_cavium_erratum_24575(struct pci_cfg_fixup *fixup,
> +				      struct acpi_pci_root *root)
> +{
> +	/*
> +	 * We must match errata code and be hypervisor, quirk does not apply
> +	 * for virtual machines.
> +	 */
> +	return cpus_have_cap(ARM64_WORKAROUND_CAVIUM_24575) &&
> +	       is_hyp_mode_available();
> +}
> +
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			0, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			1, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			2, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			3, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			10, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			11, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			12, PCI_MCFG_BUS_ANY);
> +DECLARE_ACPI_MCFG_FIXUP(NULL, needs_cavium_erratum_24575, &pci_thunder_ecam_ops,
> +			13, PCI_MCFG_BUS_ANY);
> +#endif
> +

I wonder if we can identify quirk based on _DSD properties, like that:

Name (_DSD, Package () {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package () {
		Package (2) {"cavium,pci-host-thunder-ecam", 1},
	}
})

similar for PEM driver:

Name (_DSD, Package () {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package () {
		Package (2) {"cavium,pci-host-thunder-pem", 1},
	}
})

Do you think it is right thing to do?

Tomasz

  reply	other threads:[~2016-04-19 10:26 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 17:06 [PATCH V6 00/13] Support for generic ACPI based PCI host controller Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 01/13] pci, acpi, x86, ia64: Move ACPI host bridge device companion assignment to core code Tomasz Nowicki
2016-04-15 20:41   ` kbuild test robot
2016-04-26 22:36     ` Bjorn Helgaas
2016-04-27 10:12       ` Tomasz Nowicki
2016-04-27  2:45   ` Bjorn Helgaas
2016-05-04  8:10     ` Tomasz Nowicki
2016-05-09 22:18       ` Rafael J. Wysocki
2016-05-10 10:27         ` Lorenzo Pieralisi
2016-05-09 22:56   ` Rafael J. Wysocki
2016-05-10  1:53     ` Bjorn Helgaas
2016-05-10 10:07       ` Lorenzo Pieralisi
2016-04-15 17:06 ` [PATCH V6 02/13] pci, acpi: Provide generic way to assign bus domain number Tomasz Nowicki
2016-04-27  2:26   ` Bjorn Helgaas
2016-04-27 11:17     ` Lorenzo Pieralisi
2016-04-27 16:44       ` Bjorn Helgaas
2016-04-27 17:31         ` Lorenzo Pieralisi
2016-04-28  8:13           ` Liviu.Dudau
2016-04-28 15:12           ` Bjorn Helgaas
2016-04-28 15:34             ` Arnd Bergmann
2016-04-29 22:50               ` Arnd Bergmann
2016-05-02 12:43       ` Tomasz Nowicki
2016-05-02 13:26         ` Jayachandran C
2016-05-03 11:02           ` Lorenzo Pieralisi
2016-05-03 14:22             ` Jayachandran C
2016-05-03 14:55               ` Lorenzo Pieralisi
2016-04-27 11:59     ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 03/13] x86, ia64: Include acpi_pci_{add|remove}_bus to the default pcibios_{add|remove}_bus implementation Tomasz Nowicki
2016-04-27  2:34   ` Bjorn Helgaas
2016-04-27 13:19     ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 04/13] pci, of: Move the PCI I/O space management to PCI core code Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 05/13] acpi, pci: Support IO resources when parsing PCI host bridge resources Tomasz Nowicki
2016-04-27  2:39   ` Bjorn Helgaas
2016-04-27  5:36     ` Jon Masters
2016-04-28 21:53       ` Jon Masters
2016-04-27 14:26     ` Lorenzo Pieralisi
2016-04-27 15:10       ` Liviu.Dudau
2016-04-27 16:09         ` Lorenzo Pieralisi
2016-04-28 15:45       ` Bjorn Helgaas
2016-04-15 17:06 ` [PATCH V6 06/13] arm64, pci, acpi: ACPI support for legacy IRQs parsing and consolidation with DT code Tomasz Nowicki
2016-04-27  2:44   ` Bjorn Helgaas
2016-04-27 11:46     ` Lorenzo Pieralisi
2016-04-15 17:06 ` [PATCH V6 07/13] PCI: Provide common functions for ECAM mapping Tomasz Nowicki
2016-04-15 18:41   ` Arnd Bergmann
2016-04-28 21:47   ` Bjorn Helgaas
2016-04-29  8:01     ` Jayachandran C
2016-05-05  9:24       ` Jayachandran C
2016-05-05 10:38         ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 08/13] PCI: generic, thunder: update to use generic ECAM API Tomasz Nowicki
2016-04-15 18:39   ` Arnd Bergmann
2016-04-16  7:20     ` Jayachandran C
2016-04-16  7:31       ` Arnd Bergmann
2016-04-16 14:36         ` Jayachandran C
2016-04-18 13:03           ` Tomasz Nowicki
2016-04-18 14:44             ` Arnd Bergmann
2016-04-18 19:31               ` Tomasz Nowicki
2016-04-19 13:06                 ` Arnd Bergmann
2016-04-21  9:28                   ` Tomasz Nowicki
2016-04-21  9:36                     ` Arnd Bergmann
2016-04-21 10:08                       ` Tomasz Nowicki
2016-04-22 14:30                         ` Jon Masters
2016-04-22 16:00                           ` David Daney
2016-04-28 20:14                       ` Bjorn Helgaas
2016-04-28 20:40                         ` Arnd Bergmann
2016-04-28 21:18                           ` Bjorn Helgaas
2016-04-28 21:47                             ` Jon Masters
2016-04-29  9:41                               ` Lorenzo Pieralisi
2016-04-19 21:40   ` Arnd Bergmann
2016-04-20  0:22     ` Jayachandran C
2016-04-15 17:06 ` [PATCH V6 09/13] pci, acpi: Support for ACPI based generic PCI host controller Tomasz Nowicki
2016-04-20 19:12   ` Jayachandran C
2016-04-21  9:06     ` Tomasz Nowicki
2016-04-22 12:49       ` Jayachandran C
2016-04-22 14:40       ` Jon Masters
2016-04-23 15:23         ` Jon Masters
2016-04-28 21:48   ` Bjorn Helgaas
2016-04-29  8:37     ` Lorenzo Pieralisi
2016-04-29 17:35       ` Jayachandran C
2016-05-02 11:31         ` Tomasz Nowicki
2016-05-03  8:46         ` Lorenzo Pieralisi
2016-05-02 11:03     ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 10/13] arm64, pci, acpi: Start using ACPI based PCI host controller driver for ARM64 Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 11/13] pci, acpi: Match PCI config space accessors against platfrom specific quirks Tomasz Nowicki
2016-04-18 11:37   ` liudongdong (C)
2016-04-18 12:21     ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 12/13] pci, pci-thunder-ecam: Add ACPI support for ThunderX ECAM Tomasz Nowicki
2016-04-19 10:26   ` Tomasz Nowicki [this message]
2016-04-19 10:41     ` [Linaro-acpi] " G Gregory
2016-04-19 11:12       ` Graeme Gregory
2016-04-19 11:22         ` Tomasz Nowicki
2016-04-19 12:29           ` G Gregory
2016-04-15 17:06 ` [PATCH V6 13/13] pci, pci-thunder-pem: Add ACPI support for ThunderX PEM Tomasz Nowicki
2016-04-15 18:19 ` [PATCH V6 00/13] Support for generic ACPI based PCI host controller Jon Masters
2016-04-16 15:31   ` Jayachandran C
2016-04-18 13:33     ` Tomasz Nowicki
2016-04-18 14:38       ` Arnd Bergmann
2016-04-18 15:26         ` Tomasz Nowicki
2016-04-17  9:23   ` Martinez Kristofer
2016-04-16 18:30 ` Duc Dang
2016-04-17  4:18 ` Sinan Kaya
2016-04-22 16:08 ` Robert Richter
2016-04-22 20:46 ` Suravee Suthikulpanit
2016-04-25 17:23 ` Jeremy Linton
2016-04-26  9:07 ` liudongdong (C)
2016-04-28 21:27 ` [PATCH] acpi: pci: QDF2432 32 bit config space accessors Christopher Covington
2016-04-28 21:35   ` Rafael J. Wysocki

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=571607C0.10909@semihalf.com \
    --to=tn@semihalf.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=hanjun.guo@linaro.org \
    --cc=helgaas@kernel.org \
    --cc=jchandra@broadcom.com \
    --cc=jcm@redhat.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=msalter@redhat.com \
    --cc=mw@semihalf.com \
    --cc=okaya@codeaurora.org \
    --cc=rafael@kernel.org \
    --cc=robert.richter@caviumnetworks.com \
    --cc=wangyijing@huawei.com \
    --cc=will.deacon@arm.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 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).