linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: Ryan Roberts <ryan.roberts@arm.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Cc: "joro@8bytes.org" <joro@8bytes.org>,
	"jgg@nvidia.com" <jgg@nvidia.com>,
	"kevin.tian@intel.com" <kevin.tian@intel.com>,
	"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
	"mshavit@google.com" <mshavit@google.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"will@kernel.org" <will@kernel.org>,
	"joao.m.martins@oracle.com" <joao.m.martins@oracle.com>,
	jiangkunkun <jiangkunkun@huawei.com>,
	zhukeqian <zhukeqian1@huawei.com>, Linuxarm <linuxarm@huawei.com>
Subject: RE: [PATCH v2 1/4] iommu/arm-smmu-v3: Add feature detection for HTTU
Date: Wed, 24 Apr 2024 08:01:02 +0000	[thread overview]
Message-ID: <fa8707bed7ed45a2b3fdc831b356909c@huawei.com> (raw)
In-Reply-To: <3733929c-657e-4d24-b5e9-a5d946645abe@arm.com>

Hi,

> -----Original Message-----
> From: Ryan Roberts <ryan.roberts@arm.com>
> Sent: Tuesday, April 23, 2024 3:42 PM
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;
> iommu@lists.linux.dev; linux-arm-kernel@lists.infradead.org
> Cc: joro@8bytes.org; jgg@nvidia.com; kevin.tian@intel.com;
> nicolinc@nvidia.com; mshavit@google.com; robin.murphy@arm.com;
> will@kernel.org; joao.m.martins@oracle.com; jiangkunkun
> <jiangkunkun@huawei.com>; zhukeqian <zhukeqian1@huawei.com>;
> Linuxarm <linuxarm@huawei.com>
> Subject: Re: [PATCH v2 1/4] iommu/arm-smmu-v3: Add feature detection for
> HTTU
> 
> Hi,
> 
> I'm aiming to (slowly) get more involved with SMMU activities, although I'm
> sure
> it will take a while to get up to speed and provide useful input. It was
> suggested that this series would be a useful starting point to dip my toe in.
> Please bear with me while I ask stupid questions...

Thanks for going through the series. I am planning to respin this one soon, once
Jason's SMMUv3 refactor series in some good form.

> 
> 
> On 22/02/2024 09:49, Shameer Kolothum wrote:
> > From: Jean-Philippe Brucker <jean-philippe@linaro.org>
> >
> > If the SMMU supports it and the kernel was built with HTTU support,
> > Probe support for Hardware Translation Table Update (HTTU) which is
> > essentially to enable hardware update of access and dirty flags.
> >
> > Probe and set the smmu::features for Hardware Dirty and Hardware Access
> > bits. This is in preparation, to enable it on the context descriptors of
> > stage 1 format.
> >
> > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> > Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> > Signed-off-by: Shameer Kolothum
> <shameerali.kolothum.thodi@huawei.com>
> 
> Except for the nit (feel free to ignore it), LGTM!
> 
> Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
> 
> 
> > ---
> >  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32
> +++++++++++++++++++++
> >  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h |  5 ++++
> >  2 files changed, 37 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 0606166a8781..bd30739e3588 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > @@ -4196,6 +4196,28 @@ static void arm_smmu_device_iidr_probe(struct
> arm_smmu_device *smmu)
> >  	}
> >  }
> >
> > +static void arm_smmu_get_httu(struct arm_smmu_device *smmu, u32
> reg)
> > +{
> > +	u32 fw_features = smmu->features & (ARM_SMMU_FEAT_HA |
> ARM_SMMU_FEAT_HD);
> > +	u32 features = 0;
> > +
> > +	switch (FIELD_GET(IDR0_HTTU, reg)) {
> > +	case IDR0_HTTU_ACCESS_DIRTY:
> > +		features |= ARM_SMMU_FEAT_HD;
> > +		fallthrough;
> > +	case IDR0_HTTU_ACCESS:
> > +		features |= ARM_SMMU_FEAT_HA;
> > +	}
> > +
> > +	if (smmu->dev->of_node)
> > +		smmu->features |= features;
> > +	else if (features != fw_features)
> > +		/* ACPI IORT sets the HTTU bits */
> > +		dev_warn(smmu->dev,
> > +			 "IDR0.HTTU overridden by FW configuration
> (0x%x)\n",
> > +			 fw_features);
> > +}
> > +
> >  static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> >  {
> >  	u32 reg;
> > @@ -4256,6 +4278,8 @@ static int arm_smmu_device_hw_probe(struct
> arm_smmu_device *smmu)
> >  			smmu->features |= ARM_SMMU_FEAT_E2H;
> >  	}
> >
> > +	arm_smmu_get_httu(smmu, reg);
> > +
> >  	/*
> >  	 * The coherency feature as set by FW is used in preference to the ID
> >  	 * register, but warn on mismatch.
> > @@ -4448,6 +4472,14 @@ static int arm_smmu_device_acpi_probe(struct
> platform_device *pdev,
> >  	if (iort_smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE)
> >  		smmu->features |= ARM_SMMU_FEAT_COHERENCY;
> >
> > +	switch (FIELD_GET(ACPI_IORT_SMMU_V3_HTTU_OVERRIDE,
> iort_smmu->flags)) {
> > +	case IDR0_HTTU_ACCESS_DIRTY:
> > +		smmu->features |= ARM_SMMU_FEAT_HD;
> > +		fallthrough;
> > +	case IDR0_HTTU_ACCESS:
> > +		smmu->features |= ARM_SMMU_FEAT_HA;
> > +	}
> > +
> >  	return 0;
> >  }
> >  #else
> > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> > index 45bcd72fcda4..5e51a6c1d55f 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> > @@ -33,6 +33,9 @@
> >  #define IDR0_ASID16			(1 << 12)
> >  #define IDR0_ATS			(1 << 10)
> >  #define IDR0_HYP			(1 << 9)
> > +#define IDR0_HTTU			GENMASK(7, 6)
> > +#define IDR0_HTTU_ACCESS		1
> > +#define IDR0_HTTU_ACCESS_DIRTY		2
> >  #define IDR0_COHACC			(1 << 4)
> >  #define IDR0_TTF			GENMASK(3, 2)
> >  #define IDR0_TTF_AARCH64		2
> > @@ -668,6 +671,8 @@ struct arm_smmu_device {
> >  #define ARM_SMMU_FEAT_SVA		(1 << 17)
> >  #define ARM_SMMU_FEAT_E2H		(1 << 18)
> >  #define ARM_SMMU_FEAT_NESTING		(1 << 19)
> > +#define ARM_SMMU_FEAT_HA		(1 << 20)
> > +#define ARM_SMMU_FEAT_HD		(1 << 21)
> 
> nit: HA and HD are a bit opaque, at least to me. I guess they are HW Access
> and
> HW Dirty? Perhaps ARM_SMMU_FEAT_HW_ACCESS and
> ARM_SMMU_FEAT_HW_DIRTY are more
> expressive?

Nothing against it. Just that _HW_ is not used in driver anywhere(AFAICS)
and HA/HD are used in the specification. How about we rename to 
ARM_SMMU_FEAT_HTTU_HA and ARM_SMMU_FEAT_HTTU_HA?

Thanks,
Shameer

> 
> >  	u32				features;
> >
> >  #define ARM_SMMU_OPT_SKIP_PREFETCH	(1 << 0)
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-04-24  9:16 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  9:49 [PATCH v2 0/4] iommu/smmuv3: Add IOMMUFD dirty tracking support for SMMUv3 Shameer Kolothum
2024-02-22  9:49 ` [PATCH v2 1/4] iommu/arm-smmu-v3: Add feature detection for HTTU Shameer Kolothum
2024-04-23 14:41   ` Ryan Roberts
2024-04-23 14:52     ` Jason Gunthorpe
2024-04-24 10:04       ` Ryan Roberts
2024-04-24 12:23         ` Jason Gunthorpe
2024-04-24 12:59           ` Ryan Roberts
2024-04-24 13:20           ` Shameerali Kolothum Thodi
2024-04-24 13:32             ` Jason Gunthorpe
2024-04-24 13:43               ` Shameerali Kolothum Thodi
2024-04-24 14:21                 ` Jason Gunthorpe
2024-04-24  8:01     ` Shameerali Kolothum Thodi [this message]
2024-04-24  8:28       ` Ryan Roberts
2024-02-22  9:49 ` [PATCH v2 2/4] iommu/io-pgtable-arm: Add read_and_clear_dirty() support Shameer Kolothum
2024-04-23 15:56   ` Ryan Roberts
2024-04-24  8:01     ` Shameerali Kolothum Thodi
2024-04-24  8:36       ` Ryan Roberts
2024-02-22  9:49 ` [PATCH v2 3/4] iommu/arm-smmu-v3: Add support for dirty tracking in domain alloc Shameer Kolothum
2024-02-22 11:04   ` Joao Martins
2024-02-22 11:31     ` Shameerali Kolothum Thodi
2024-02-22 11:37       ` Joao Martins
2024-02-22 12:24         ` Shameerali Kolothum Thodi
2024-02-22 13:11           ` Jason Gunthorpe
2024-02-22 13:23           ` Joao Martins
2024-03-08 14:31   ` Jason Gunthorpe
2024-04-23 16:27   ` Ryan Roberts
2024-04-23 16:39     ` Jason Gunthorpe
2024-04-23 16:50       ` Ryan Roberts
2024-04-24  8:27     ` Shameerali Kolothum Thodi
2024-02-22  9:49 ` [PATCH v2 4/4] iommu/arm-smmu-v3: Enable HTTU for stage1 with io-pgtable mapping Shameer Kolothum
2024-03-08 14:32   ` Jason Gunthorpe
2024-04-23 16:45   ` Ryan Roberts
2024-04-23 17:32     ` Jason Gunthorpe
2024-04-24  7:58       ` Ryan Roberts
2024-04-24 12:15         ` Jason Gunthorpe
2024-04-24 12:45           ` Ryan Roberts

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=fa8707bed7ed45a2b3fdc831b356909c@huawei.com \
    --to=shameerali.kolothum.thodi@huawei.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=jiangkunkun@huawei.com \
    --cc=joao.m.martins@oracle.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=mshavit@google.com \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=will@kernel.org \
    --cc=zhukeqian1@huawei.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).