linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection
@ 2025-04-08  3:33 Aneesh Kumar K.V (Arm)
  2025-04-08  5:30 ` Pranjal Shrivastava
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Aneesh Kumar K.V (Arm) @ 2025-04-08  3:33 UTC (permalink / raw)
  To: iommu, linux-kernel, linux-arm-kernel
  Cc: will, robin.murphy, jgg, nicolinc, jsnitsel, praan, kevin.tian,
	ddutile, Aneesh Kumar K.V (Arm)

Commit 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
introduced S2FWB usage but omitted the corresponding feature detection.
As a result, vIOMMU allocation fails on FVP in arm_vsmmu_alloc(), due to
the following check:

	if (!arm_smmu_master_canwbs(master) &&
	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
		return ERR_PTR(-EOPNOTSUPP);

This patch adds the missing detection logic to prevent allocation
failure when S2FWB is supported.

Fixes: 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 358072b4e293..c7d297ceabdb 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -4405,6 +4405,8 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR3);
 	if (FIELD_GET(IDR3_RIL, reg))
 		smmu->features |= ARM_SMMU_FEAT_RANGE_INV;
+	if (FIELD_GET(IDR3_FWB, reg))
+		smmu->features |= ARM_SMMU_FEAT_S2FWB;
 
 	/* IDR5 */
 	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR5);
-- 
2.43.0



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

* Re: [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection
  2025-04-08  3:33 [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection Aneesh Kumar K.V (Arm)
@ 2025-04-08  5:30 ` Pranjal Shrivastava
  2025-04-08  7:31 ` Nicolin Chen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Pranjal Shrivastava @ 2025-04-08  5:30 UTC (permalink / raw)
  To: Aneesh Kumar K.V (Arm)
  Cc: iommu, linux-kernel, linux-arm-kernel, will, robin.murphy, jgg,
	nicolinc, jsnitsel, kevin.tian, ddutile

On Tue, Apr 08, 2025 at 09:03:51AM +0530, Aneesh Kumar K.V (Arm) wrote:
> Commit 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> introduced S2FWB usage but omitted the corresponding feature detection.
> As a result, vIOMMU allocation fails on FVP in arm_vsmmu_alloc(), due to
> the following check:
> 
> 	if (!arm_smmu_master_canwbs(master) &&
> 	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> 		return ERR_PTR(-EOPNOTSUPP);
> 
> This patch adds the missing detection logic to prevent allocation
> failure when S2FWB is supported.
> 
> Fixes: 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 358072b4e293..c7d297ceabdb 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -4405,6 +4405,8 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>  	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR3);
>  	if (FIELD_GET(IDR3_RIL, reg))
>  		smmu->features |= ARM_SMMU_FEAT_RANGE_INV;
> +	if (FIELD_GET(IDR3_FWB, reg))
> +		smmu->features |= ARM_SMMU_FEAT_S2FWB;
>  
>  	/* IDR5 */
>  	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR5);

Indeed. Looks like setting the feature flag was missed previously.

Reviewed-by: Pranjal Shrivastava <praan@google.com>

Thanks,
Praan


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

* Re: [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection
  2025-04-08  3:33 [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection Aneesh Kumar K.V (Arm)
  2025-04-08  5:30 ` Pranjal Shrivastava
@ 2025-04-08  7:31 ` Nicolin Chen
  2025-04-08 12:09 ` Jason Gunthorpe
  2025-04-17 14:27 ` Will Deacon
  3 siblings, 0 replies; 6+ messages in thread
From: Nicolin Chen @ 2025-04-08  7:31 UTC (permalink / raw)
  To: Aneesh Kumar K.V (Arm)
  Cc: iommu, linux-kernel, linux-arm-kernel, will, robin.murphy, jgg,
	jsnitsel, praan, kevin.tian, ddutile

On Tue, Apr 08, 2025 at 09:03:51AM +0530, Aneesh Kumar K.V (Arm) wrote:
> Commit 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> introduced S2FWB usage but omitted the corresponding feature detection.
> As a result, vIOMMU allocation fails on FVP in arm_vsmmu_alloc(), due to
> the following check:
> 
> 	if (!arm_smmu_master_canwbs(master) &&
> 	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> 		return ERR_PTR(-EOPNOTSUPP);
> 
> This patch adds the missing detection logic to prevent allocation
> failure when S2FWB is supported.
> 
> Fixes: 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>

Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>


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

* Re: [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection
  2025-04-08  3:33 [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection Aneesh Kumar K.V (Arm)
  2025-04-08  5:30 ` Pranjal Shrivastava
  2025-04-08  7:31 ` Nicolin Chen
@ 2025-04-08 12:09 ` Jason Gunthorpe
  2025-04-11 16:03   ` Will Deacon
  2025-04-17 14:27 ` Will Deacon
  3 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2025-04-08 12:09 UTC (permalink / raw)
  To: Aneesh Kumar K.V (Arm)
  Cc: iommu, linux-kernel, linux-arm-kernel, will, robin.murphy,
	nicolinc, jsnitsel, praan, kevin.tian, ddutile

On Tue, Apr 08, 2025 at 09:03:51AM +0530, Aneesh Kumar K.V (Arm) wrote:
> Commit 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> introduced S2FWB usage but omitted the corresponding feature detection.
> As a result, vIOMMU allocation fails on FVP in arm_vsmmu_alloc(), due to
> the following check:
> 
> 	if (!arm_smmu_master_canwbs(master) &&
> 	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> 		return ERR_PTR(-EOPNOTSUPP);
> 
> This patch adds the missing detection logic to prevent allocation
> failure when S2FWB is supported.
> 
> Fixes: 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

This should go to rc

Jason


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

* Re: [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection
  2025-04-08 12:09 ` Jason Gunthorpe
@ 2025-04-11 16:03   ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2025-04-11 16:03 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Aneesh Kumar K.V (Arm), iommu, linux-kernel, linux-arm-kernel,
	robin.murphy, nicolinc, jsnitsel, praan, kevin.tian, ddutile

On Tue, Apr 08, 2025 at 09:09:19AM -0300, Jason Gunthorpe wrote:
> On Tue, Apr 08, 2025 at 09:03:51AM +0530, Aneesh Kumar K.V (Arm) wrote:
> > Commit 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> > introduced S2FWB usage but omitted the corresponding feature detection.
> > As a result, vIOMMU allocation fails on FVP in arm_vsmmu_alloc(), due to
> > the following check:
> > 
> > 	if (!arm_smmu_master_canwbs(master) &&
> > 	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> > 		return ERR_PTR(-EOPNOTSUPP);
> > 
> > This patch adds the missing detection logic to prevent allocation
> > failure when S2FWB is supported.
> > 
> > Fixes: 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> > Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
> > ---
> >  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> 
> This should go to rc

Yup. I'll pick this up next week along with any other SMMU fixes kicking
around.

Cheers,

Will


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

* Re: [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection
  2025-04-08  3:33 [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection Aneesh Kumar K.V (Arm)
                   ` (2 preceding siblings ...)
  2025-04-08 12:09 ` Jason Gunthorpe
@ 2025-04-17 14:27 ` Will Deacon
  3 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2025-04-17 14:27 UTC (permalink / raw)
  To: iommu, linux-kernel, linux-arm-kernel, Aneesh Kumar K.V (Arm)
  Cc: catalin.marinas, kernel-team, Will Deacon, robin.murphy, jgg,
	nicolinc, jsnitsel, praan, kevin.tian, ddutile

On Tue, 08 Apr 2025 09:03:51 +0530, Aneesh Kumar K.V (Arm) wrote:
> Commit 67e4fe398513 ("iommu/arm-smmu-v3: Use S2FWB for NESTED domains")
> introduced S2FWB usage but omitted the corresponding feature detection.
> As a result, vIOMMU allocation fails on FVP in arm_vsmmu_alloc(), due to
> the following check:
> 
> 	if (!arm_smmu_master_canwbs(master) &&
> 	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> 		return ERR_PTR(-EOPNOTSUPP);
> 
> [...]

Applied to iommu (arm/smmu/fixes), thanks!

[1/1] iommu/arm-smmu-v3: Add missing S2FWB feature detection
      https://git.kernel.org/iommu/c/45e00e367189

Cheers,
-- 
Will

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


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

end of thread, other threads:[~2025-04-17 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08  3:33 [PATCH] iommu/arm-smmu-v3: Add missing S2FWB feature detection Aneesh Kumar K.V (Arm)
2025-04-08  5:30 ` Pranjal Shrivastava
2025-04-08  7:31 ` Nicolin Chen
2025-04-08 12:09 ` Jason Gunthorpe
2025-04-11 16:03   ` Will Deacon
2025-04-17 14:27 ` 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).