linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C
@ 2017-05-22 15:06 Robin Murphy
  2017-05-22 15:06 ` [PATCH v2 2/2] iommu/arm-smmu: Plumb in new ACPI identifiers Robin Murphy
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Robin Murphy @ 2017-05-22 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

IORT revision C has been published with a number of new SMMU
implementation identifiers. Since IORT doesn't have any way of falling
back to a more generic model code, we really need Linux to know about
these before vendors start updating their firmware tables to use them.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
CC: Robert Moore <robert.moore@intel.com>
CC: Lv Zheng <lv.zheng@intel.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---

v2: Update more comments, add Robert's tags.

I'm including this here as a kernel patch just for context - once I've
figured out how we actually submit patches to ACPICA directly, I'll do
that per the preferred process.

Robin.

 include/acpi/actbl2.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index faa9f2c0d5de..f469ea41f2fd 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -663,7 +663,7 @@ struct acpi_ibft_target {
  * IORT - IO Remapping Table
  *
  * Conforms to "IO Remapping Table System Software on ARM Platforms",
- * Document number: ARM DEN 0049B, October 2015
+ * Document number: ARM DEN 0049C, May 2017
  *
  ******************************************************************************/
 
@@ -778,6 +778,8 @@ struct acpi_iort_smmu {
 #define ACPI_IORT_SMMU_V2               0x00000001	/* Generic SMMUv2 */
 #define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002	/* ARM Corelink MMU-400 */
 #define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003	/* ARM Corelink MMU-500 */
+#define ACPI_IORT_SMMU_CORELINK_MMU401  0x00000004	/* ARM Corelink MMU-401 */
+#define ACPI_IORT_SMMU_CAVIUM_SMMUV2    0x00000005	/* Cavium ThunderX SMMUv2 */
 
 /* Masks for Flags field above */
 
@@ -798,13 +800,19 @@ struct acpi_iort_smmu_v3 {
 	u32 flags;
 	u32 reserved;
 	u64 vatos_address;
-	u32 model;		/* O: generic SMMUv3 */
+	u32 model;
 	u32 event_gsiv;
 	u32 pri_gsiv;
 	u32 gerr_gsiv;
 	u32 sync_gsiv;
 };
 
+/* Values for Model field above */
+
+#define ACPI_IORT_SMMU_V3               0x00000000	/* Generic SMMUv3 */
+#define ACPI_IORT_SMMU_HISILICON_HI161X 0x00000001	/* HiSilicon Hi161x SMMUv3 */
+#define ACPI_IORT_SMMU_CAVIUM_CN99XX    0x00000002	/* Cavium CN99xx SMMUv3 */
+
 /* Masks for Flags field above */
 
 #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
-- 
2.12.2.dirty

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

* [PATCH v2 2/2] iommu/arm-smmu: Plumb in new ACPI identifiers
  2017-05-22 15:06 [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robin Murphy
@ 2017-05-22 15:06 ` Robin Murphy
  2017-05-22 15:49 ` [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robert Richter
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Robin Murphy @ 2017-05-22 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

Revision C of IORT now allows us to identify ARM MMU-401 and the Cavium
ThunderX implementation. Wire them up so that we can probe these models
once firmware starts using the new codes, and so that the appropriate
features and quirks get enabled when we do.

For the sake of backports and mitigating sychronisation problems with
the ACPICA headers, we'll carry a backup copy of the new definitions
locally for the short term to make life simpler.

CC: stable at vger.kernel.org # 4.10
Acked-by: Robert Richter <rrichter@cavium.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---

v2: Add local backup definitions

This is ready to go regardless of patch 1. The stable backport is in likely
anticipation of machines with updated firmware paired with stable distro
kernels, which would be unable to recognise and probe the SMMU otherwise.

Robin.

 drivers/iommu/arm-smmu.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 7ec30b08b3bd..79b9bb7d4783 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -312,6 +312,14 @@ enum arm_smmu_implementation {
 	CAVIUM_SMMUV2,
 };
 
+/* Until ACPICA headers cover IORT rev. C */
+#ifndef ACPI_IORT_SMMU_CORELINK_MMU401
+#define ACPI_IORT_SMMU_CORELINK_MMU401	0x4
+#endif
+#ifndef ACPI_IORT_SMMU_CAVIUM_SMMUV2
+#define ACPI_IORT_SMMU_CAVIUM_SMMUV2	0x5
+#endif
+
 struct arm_smmu_s2cr {
 	struct iommu_group		*group;
 	int				count;
@@ -2073,6 +2081,10 @@ static int acpi_smmu_get_data(u32 model, struct arm_smmu_device *smmu)
 		smmu->version = ARM_SMMU_V1;
 		smmu->model = GENERIC_SMMU;
 		break;
+	case ACPI_IORT_SMMU_CORELINK_MMU401:
+		smmu->version = ARM_SMMU_V1_64K;
+		smmu->model = GENERIC_SMMU;
+		break;
 	case ACPI_IORT_SMMU_V2:
 		smmu->version = ARM_SMMU_V2;
 		smmu->model = GENERIC_SMMU;
@@ -2081,6 +2093,10 @@ static int acpi_smmu_get_data(u32 model, struct arm_smmu_device *smmu)
 		smmu->version = ARM_SMMU_V2;
 		smmu->model = ARM_MMU500;
 		break;
+	case ACPI_IORT_SMMU_CAVIUM_SMMUV2:
+		smmu->version = ARM_SMMU_V2;
+		smmu->model = CAVIUM_SMMUV2;
+		break;
 	default:
 		ret = -ENODEV;
 	}
-- 
2.12.2.dirty

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

* [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C
  2017-05-22 15:06 [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robin Murphy
  2017-05-22 15:06 ` [PATCH v2 2/2] iommu/arm-smmu: Plumb in new ACPI identifiers Robin Murphy
@ 2017-05-22 15:49 ` Robert Richter
  2017-05-22 15:53   ` Robert Richter
  2017-05-30  9:12 ` Joerg Roedel
  2017-06-06  8:43 ` Hanjun Guo
  3 siblings, 1 reply; 7+ messages in thread
From: Robert Richter @ 2017-05-22 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 22.05.17 16:06:37, Robin Murphy wrote:
> IORT revision C has been published with a number of new SMMU
> implementation identifiers. Since IORT doesn't have any way of falling
> back to a more generic model code, we really need Linux to know about
> these before vendors start updating their firmware tables to use them.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Robert Moore <robert.moore@intel.com>
> CC: Lv Zheng <lv.zheng@intel.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Robin, the stable tag is missing here, but we will need it for #2.

Thanks,

-Robert

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

* [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C
  2017-05-22 15:49 ` [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robert Richter
@ 2017-05-22 15:53   ` Robert Richter
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Richter @ 2017-05-22 15:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 22.05.17 17:49:17, Robert Richter wrote:
> On 22.05.17 16:06:37, Robin Murphy wrote:
> > IORT revision C has been published with a number of new SMMU
> > implementation identifiers. Since IORT doesn't have any way of falling
> > back to a more generic model code, we really need Linux to know about
> > these before vendors start updating their firmware tables to use them.
> > 
> > CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> > CC: Robert Moore <robert.moore@intel.com>
> > CC: Lv Zheng <lv.zheng@intel.com>
> > Acked-by: Robert Richter <rrichter@cavium.com>
> > Tested-by: Robert Richter <rrichter@cavium.com>
> > Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> 
> Robin, the stable tag is missing here, but we will need it for #2.

I just noticed the additional #defines in #2. So no need to mark this
one stable too.

-Robert

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

* [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C
  2017-05-22 15:06 [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robin Murphy
  2017-05-22 15:06 ` [PATCH v2 2/2] iommu/arm-smmu: Plumb in new ACPI identifiers Robin Murphy
  2017-05-22 15:49 ` [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robert Richter
@ 2017-05-30  9:12 ` Joerg Roedel
  2017-05-31 12:21   ` Robin Murphy
  2017-06-06  8:43 ` Hanjun Guo
  3 siblings, 1 reply; 7+ messages in thread
From: Joerg Roedel @ 2017-05-30  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 22, 2017 at 04:06:37PM +0100, Robin Murphy wrote:
> IORT revision C has been published with a number of new SMMU
> implementation identifiers. Since IORT doesn't have any way of falling
> back to a more generic model code, we really need Linux to know about
> these before vendors start updating their firmware tables to use them.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Robert Moore <robert.moore@intel.com>
> CC: Lv Zheng <lv.zheng@intel.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> 
> v2: Update more comments, add Robert's tags.

I generally prefer 'Fixes'-tags, can you please add them too?

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

* [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C
  2017-05-30  9:12 ` Joerg Roedel
@ 2017-05-31 12:21   ` Robin Murphy
  0 siblings, 0 replies; 7+ messages in thread
From: Robin Murphy @ 2017-05-31 12:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 30/05/17 10:12, Joerg Roedel wrote:
> On Mon, May 22, 2017 at 04:06:37PM +0100, Robin Murphy wrote:
>> IORT revision C has been published with a number of new SMMU
>> implementation identifiers. Since IORT doesn't have any way of falling
>> back to a more generic model code, we really need Linux to know about
>> these before vendors start updating their firmware tables to use them.
>>
>> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
>> CC: Robert Moore <robert.moore@intel.com>
>> CC: Lv Zheng <lv.zheng@intel.com>
>> Acked-by: Robert Richter <rrichter@cavium.com>
>> Tested-by: Robert Richter <rrichter@cavium.com>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>
>> v2: Update more comments, add Robert's tags.
> 
> I generally prefer 'Fixes'-tags, can you please add them too?

This patch isn't a fix, though, it's merely adding some new stuff from a
new release of the IORT spec.

Either way, since I discovered we do actually have approval to
contribute to ACPICA directly, I now intend to route the header change
that way per Rafaels' preference[1] - patch 2/2 will take care of itself
in the meantime.

Thanks,
Robin.

[1]:https://www.mail-archive.com/iommu at lists.linux-foundation.org/msg17602.html

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

* [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C
  2017-05-22 15:06 [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robin Murphy
                   ` (2 preceding siblings ...)
  2017-05-30  9:12 ` Joerg Roedel
@ 2017-06-06  8:43 ` Hanjun Guo
  3 siblings, 0 replies; 7+ messages in thread
From: Hanjun Guo @ 2017-06-06  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 2017/5/22 23:06, Robin Murphy wrote:
> IORT revision C has been published with a number of new SMMU
> implementation identifiers. Since IORT doesn't have any way of falling
> back to a more generic model code, we really need Linux to know about
> these before vendors start updating their firmware tables to use them.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Robert Moore <robert.moore@intel.com>
> CC: Lv Zheng <lv.zheng@intel.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> 
> v2: Update more comments, add Robert's tags.
> 
> I'm including this here as a kernel patch just for context - once I've
> figured out how we actually submit patches to ACPICA directly, I'll do
> that per the preferred process.
> 
> Robin.
> 
>   include/acpi/actbl2.h | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> index faa9f2c0d5de..f469ea41f2fd 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -663,7 +663,7 @@ struct acpi_ibft_target {
>    * IORT - IO Remapping Table
>    *
>    * Conforms to "IO Remapping Table System Software on ARM Platforms",
> - * Document number: ARM DEN 0049B, October 2015
> + * Document number: ARM DEN 0049C, May 2017
>    *
>    ******************************************************************************/
>   
> @@ -778,6 +778,8 @@ struct acpi_iort_smmu {
>   #define ACPI_IORT_SMMU_V2               0x00000001	/* Generic SMMUv2 */
>   #define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002	/* ARM Corelink MMU-400 */
>   #define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003	/* ARM Corelink MMU-500 */
> +#define ACPI_IORT_SMMU_CORELINK_MMU401  0x00000004	/* ARM Corelink MMU-401 */
> +#define ACPI_IORT_SMMU_CAVIUM_SMMUV2    0x00000005	/* Cavium ThunderX SMMUv2 */
>   
>   /* Masks for Flags field above */
>   
> @@ -798,13 +800,19 @@ struct acpi_iort_smmu_v3 {
>   	u32 flags;
>   	u32 reserved;
>   	u64 vatos_address;
> -	u32 model;		/* O: generic SMMUv3 */
> +	u32 model;
>   	u32 event_gsiv;
>   	u32 pri_gsiv;
>   	u32 gerr_gsiv;
>   	u32 sync_gsiv;
>   };
>   
> +/* Values for Model field above */
> +
> +#define ACPI_IORT_SMMU_V3               0x00000000	/* Generic SMMUv3 */
> +#define ACPI_IORT_SMMU_HISILICON_HI161X 0x00000001	/* HiSilicon Hi161x SMMUv3 */
> +#define ACPI_IORT_SMMU_CAVIUM_CN99XX    0x00000002	/* Cavium CN99xx SMMUv3 */
> +
>   /* Masks for Flags field above */
>   
>   #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
> 

Looks good to me,

Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>

By the way, how will this patch be merged? There are pending patches
on top of it, Rafael suggested to work with ACPICA upstream first [1],
Robin, will work on that?

[1]: 
https://www.mail-archive.com/linux-kernel at vger.kernel.org/msg1394295.html

Thanks
Hanjun

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

end of thread, other threads:[~2017-06-06  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 15:06 [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robin Murphy
2017-05-22 15:06 ` [PATCH v2 2/2] iommu/arm-smmu: Plumb in new ACPI identifiers Robin Murphy
2017-05-22 15:49 ` [PATCH v2 1/2] ACPICA: IORT: Update SMMU models for IORT rev. C Robert Richter
2017-05-22 15:53   ` Robert Richter
2017-05-30  9:12 ` Joerg Roedel
2017-05-31 12:21   ` Robin Murphy
2017-06-06  8:43 ` Hanjun Guo

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).