linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot
@ 2021-05-09  2:26 Shawn Guo
  2021-05-23  6:05 ` Shawn Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shawn Guo @ 2021-05-09  2:26 UTC (permalink / raw)
  To: Will Deacon
  Cc: Robin Murphy, Bjorn Andersson, Lorenzo Pieralisi, Hanjun Guo,
	Sudeep Holla, Mark Rutland, linux-arm-kernel, linux-arm-msm,
	Shawn Guo

The hookup with qcom_smmu_impl is required to do ACPI boot on SC8180X
based devices like Lenovo Flex 5G laptop and Microsoft Surface Pro X.
Define acpi_platform_list for these platforms and match them using
acpi_match_platform_list() call, and create qcom_smmu_impl accordingly.

(np == NULL) is used to check ACPI boot, because fwnode of SMMU device
is a static allocation and thus helpers like has_acpi_companion() don't
work here.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Changes for v3:
 - Call acpi_match_platform_list() to match platform in qcom smmu
   driver rather than IORT code.

Changes for v2:
 - Rather than using asl_compiler_id in IORT table, follow suggestion
   from Robin Murphy to use acpi_match_platform_list() to match platform.

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

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index 98b3a1c2a181..f7e187f3fa66 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2019, The Linux Foundation. All rights reserved.
  */
 
+#include <linux/acpi.h>
 #include <linux/adreno-smmu-priv.h>
 #include <linux/of_device.h>
 #include <linux/qcom_scm.h>
@@ -339,10 +340,22 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
 	{ }
 };
 
+static struct acpi_platform_list qcom_acpi_platlist[] = {
+	{ "LENOVO", "CB-01   ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
+	{ "QCOM  ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
+	{ }
+};
+
 struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
 {
 	const struct device_node *np = smmu->dev->of_node;
 
+	if (np == NULL) {
+		/* Match platform for ACPI boot */
+		if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
+			return qcom_smmu_create(smmu, &qcom_smmu_impl);
+	}
+
 	if (of_match_node(qcom_smmu_impl_of_match, np))
 		return qcom_smmu_create(smmu, &qcom_smmu_impl);
 
-- 
2.17.1


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

* Re: [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot
  2021-05-09  2:26 [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot Shawn Guo
@ 2021-05-23  6:05 ` Shawn Guo
  2021-05-24 12:09   ` Robin Murphy
  2021-05-25  3:58 ` Bjorn Andersson
  2021-06-08 11:42 ` Will Deacon
  2 siblings, 1 reply; 5+ messages in thread
From: Shawn Guo @ 2021-05-23  6:05 UTC (permalink / raw)
  To: Will Deacon, Robin Murphy
  Cc: Bjorn Andersson, Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla,
	Mark Rutland, linux-arm-kernel, linux-arm-msm

On Sun, May 09, 2021 at 10:26:07AM +0800, Shawn Guo wrote:
> The hookup with qcom_smmu_impl is required to do ACPI boot on SC8180X
> based devices like Lenovo Flex 5G laptop and Microsoft Surface Pro X.
> Define acpi_platform_list for these platforms and match them using
> acpi_match_platform_list() call, and create qcom_smmu_impl accordingly.
> 
> (np == NULL) is used to check ACPI boot, because fwnode of SMMU device
> is a static allocation and thus helpers like has_acpi_companion() don't
> work here.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> Changes for v3:
>  - Call acpi_match_platform_list() to match platform in qcom smmu
>    driver rather than IORT code.

Hi Robin,

How does this version look?

Shawn

> 
> Changes for v2:
>  - Rather than using asl_compiler_id in IORT table, follow suggestion
>    from Robin Murphy to use acpi_match_platform_list() to match platform.
> 
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index 98b3a1c2a181..f7e187f3fa66 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2019, The Linux Foundation. All rights reserved.
>   */
>  
> +#include <linux/acpi.h>
>  #include <linux/adreno-smmu-priv.h>
>  #include <linux/of_device.h>
>  #include <linux/qcom_scm.h>
> @@ -339,10 +340,22 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
>  	{ }
>  };
>  
> +static struct acpi_platform_list qcom_acpi_platlist[] = {
> +	{ "LENOVO", "CB-01   ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
> +	{ "QCOM  ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
> +	{ }
> +};
> +
>  struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
>  {
>  	const struct device_node *np = smmu->dev->of_node;
>  
> +	if (np == NULL) {
> +		/* Match platform for ACPI boot */
> +		if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
> +			return qcom_smmu_create(smmu, &qcom_smmu_impl);
> +	}
> +
>  	if (of_match_node(qcom_smmu_impl_of_match, np))
>  		return qcom_smmu_create(smmu, &qcom_smmu_impl);
>  
> -- 
> 2.17.1
> 

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

* Re: [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot
  2021-05-23  6:05 ` Shawn Guo
@ 2021-05-24 12:09   ` Robin Murphy
  0 siblings, 0 replies; 5+ messages in thread
From: Robin Murphy @ 2021-05-24 12:09 UTC (permalink / raw)
  To: Shawn Guo, Will Deacon
  Cc: Bjorn Andersson, Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla,
	Mark Rutland, linux-arm-kernel, linux-arm-msm

On 2021-05-23 07:05, Shawn Guo wrote:
> On Sun, May 09, 2021 at 10:26:07AM +0800, Shawn Guo wrote:
>> The hookup with qcom_smmu_impl is required to do ACPI boot on SC8180X
>> based devices like Lenovo Flex 5G laptop and Microsoft Surface Pro X.
>> Define acpi_platform_list for these platforms and match them using
>> acpi_match_platform_list() call, and create qcom_smmu_impl accordingly.
>>
>> (np == NULL) is used to check ACPI boot, because fwnode of SMMU device
>> is a static allocation and thus helpers like has_acpi_companion() don't
>> work here.
>>
>> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
>> ---
>> Changes for v3:
>>   - Call acpi_match_platform_list() to match platform in qcom smmu
>>     driver rather than IORT code.
> 
> Hi Robin,
> 
> How does this version look?

So good that I glanced at it, thought "nice!", then having no remaining 
concerns promptly moved on to something else forgot about it. Sorry 
about that!

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

Cheers,
Robin.

> Shawn
> 
>>
>> Changes for v2:
>>   - Rather than using asl_compiler_id in IORT table, follow suggestion
>>     from Robin Murphy to use acpi_match_platform_list() to match platform.
>>
>>   drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>> index 98b3a1c2a181..f7e187f3fa66 100644
>> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>> @@ -3,6 +3,7 @@
>>    * Copyright (c) 2019, The Linux Foundation. All rights reserved.
>>    */
>>   
>> +#include <linux/acpi.h>
>>   #include <linux/adreno-smmu-priv.h>
>>   #include <linux/of_device.h>
>>   #include <linux/qcom_scm.h>
>> @@ -339,10 +340,22 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
>>   	{ }
>>   };
>>   
>> +static struct acpi_platform_list qcom_acpi_platlist[] = {
>> +	{ "LENOVO", "CB-01   ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
>> +	{ "QCOM  ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
>> +	{ }
>> +};
>> +
>>   struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
>>   {
>>   	const struct device_node *np = smmu->dev->of_node;
>>   
>> +	if (np == NULL) {
>> +		/* Match platform for ACPI boot */
>> +		if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
>> +			return qcom_smmu_create(smmu, &qcom_smmu_impl);
>> +	}
>> +
>>   	if (of_match_node(qcom_smmu_impl_of_match, np))
>>   		return qcom_smmu_create(smmu, &qcom_smmu_impl);
>>   
>> -- 
>> 2.17.1
>>

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

* Re: [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot
  2021-05-09  2:26 [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot Shawn Guo
  2021-05-23  6:05 ` Shawn Guo
@ 2021-05-25  3:58 ` Bjorn Andersson
  2021-06-08 11:42 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2021-05-25  3:58 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Will Deacon, Robin Murphy, Lorenzo Pieralisi, Hanjun Guo,
	Sudeep Holla, Mark Rutland, linux-arm-kernel, linux-arm-msm

On Sat 08 May 21:26 CDT 2021, Shawn Guo wrote:

> The hookup with qcom_smmu_impl is required to do ACPI boot on SC8180X
> based devices like Lenovo Flex 5G laptop and Microsoft Surface Pro X.
> Define acpi_platform_list for these platforms and match them using
> acpi_match_platform_list() call, and create qcom_smmu_impl accordingly.
> 
> (np == NULL) is used to check ACPI boot, because fwnode of SMMU device
> is a static allocation and thus helpers like has_acpi_companion() don't
> work here.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> Changes for v3:
>  - Call acpi_match_platform_list() to match platform in qcom smmu
>    driver rather than IORT code.
> 
> Changes for v2:
>  - Rather than using asl_compiler_id in IORT table, follow suggestion
>    from Robin Murphy to use acpi_match_platform_list() to match platform.
> 
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index 98b3a1c2a181..f7e187f3fa66 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2019, The Linux Foundation. All rights reserved.
>   */
>  
> +#include <linux/acpi.h>
>  #include <linux/adreno-smmu-priv.h>
>  #include <linux/of_device.h>
>  #include <linux/qcom_scm.h>
> @@ -339,10 +340,22 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
>  	{ }
>  };
>  
> +static struct acpi_platform_list qcom_acpi_platlist[] = {
> +	{ "LENOVO", "CB-01   ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
> +	{ "QCOM  ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
> +	{ }
> +};
> +
>  struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
>  {
>  	const struct device_node *np = smmu->dev->of_node;
>  
> +	if (np == NULL) {
> +		/* Match platform for ACPI boot */
> +		if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
> +			return qcom_smmu_create(smmu, &qcom_smmu_impl);
> +	}
> +
>  	if (of_match_node(qcom_smmu_impl_of_match, np))
>  		return qcom_smmu_create(smmu, &qcom_smmu_impl);
>  
> -- 
> 2.17.1
> 

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

* Re: [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot
  2021-05-09  2:26 [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot Shawn Guo
  2021-05-23  6:05 ` Shawn Guo
  2021-05-25  3:58 ` Bjorn Andersson
@ 2021-06-08 11:42 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2021-06-08 11:42 UTC (permalink / raw)
  To: Shawn Guo
  Cc: catalin.marinas, kernel-team, Will Deacon, Mark Rutland,
	Sudeep Holla, Hanjun Guo, Robin Murphy, Lorenzo Pieralisi,
	Bjorn Andersson, linux-arm-msm, linux-arm-kernel

On Sun, 9 May 2021 10:26:07 +0800, Shawn Guo wrote:
> The hookup with qcom_smmu_impl is required to do ACPI boot on SC8180X
> based devices like Lenovo Flex 5G laptop and Microsoft Surface Pro X.
> Define acpi_platform_list for these platforms and match them using
> acpi_match_platform_list() call, and create qcom_smmu_impl accordingly.
> 
> (np == NULL) is used to check ACPI boot, because fwnode of SMMU device
> is a static allocation and thus helpers like has_acpi_companion() don't
> work here.

Applied to will (for-joerg/arm-smmu/updates), thanks!

[1/1] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot
      https://git.kernel.org/will/c/a51627c5df58

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

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

end of thread, other threads:[~2021-06-08 11:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-09  2:26 [PATCH v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot Shawn Guo
2021-05-23  6:05 ` Shawn Guo
2021-05-24 12:09   ` Robin Murphy
2021-05-25  3:58 ` Bjorn Andersson
2021-06-08 11:42 ` Will Deacon

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