From: Ryan Roberts <ryan.roberts@arm.com>
To: "Mikołaj Lenczewski" <miko.lenczewski@arm.com>,
suzuki.poulose@arm.com, yang@os.amperecomputing.com,
corbet@lwn.net, catalin.marinas@arm.com, will@kernel.org,
jean-philippe@linaro.org, robin.murphy@arm.com, joro@8bytes.org,
akpm@linux-foundation.org, mark.rutland@arm.com,
joey.gouly@arm.com, maz@kernel.org, james.morse@arm.com,
broonie@kernel.org, anshuman.khandual@arm.com,
oliver.upton@linux.dev, ioworker0@gmail.com, baohua@kernel.org,
david@redhat.com, jgg@ziepe.ca,
shameerali.kolothum.thodi@huawei.com, nicolinc@nvidia.com,
mshavit@google.com, jsnitsel@redhat.com, smostafa@google.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev
Subject: Re: [PATCH v3 2/3] iommu/arm: Add BBM Level 2 smmu feature
Date: Thu, 13 Mar 2025 16:18:12 +0000 [thread overview]
Message-ID: <07c36889-10d3-4944-a039-3a30fbdca883@arm.com> (raw)
In-Reply-To: <20250313104111.24196-4-miko.lenczewski@arm.com>
On 13/03/2025 10:41, Mikołaj Lenczewski wrote:
> For supporting BBM Level 2 for userspace mappings, we want to ensure
> that the smmu also supports its own version of BBM Level 2. Luckily, the
> smmu spec (IHI 0070G 3.21.1.3) is stricter than the aarch64 spec (DDI
> 0487K.a D8.16.2), so already guarantees that no aborts are raised when
> BBM level 2 is claimed.
>
> Add the feature and testing for it under arm_smmu_sva_supported().
>
> Signed-off-by: Mikołaj Lenczewski <miko.lenczewski@arm.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 3 +++
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 +++
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 4 ++++
> 3 files changed, 10 insertions(+)
>
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> index 9ba596430e7c..6ba182572788 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> @@ -222,6 +222,9 @@ bool arm_smmu_sva_supported(struct arm_smmu_device *smmu)
> feat_mask |= ARM_SMMU_FEAT_VAX;
> }
>
> + if (system_supports_bbml2_noabort())
> + feat_mask |= ARM_SMMU_FEAT_BBML2;
> +
> if ((smmu->features & feat_mask) != feat_mask)
> return false;
>
> 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..dcee0bdec924 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -4406,6 +4406,9 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> if (FIELD_GET(IDR3_RIL, reg))
> smmu->features |= ARM_SMMU_FEAT_RANGE_INV;
>
> + if (FIELD_GET(IDR3_BBML, reg) == IDR3_BBML2)
> + smmu->features |= ARM_SMMU_FEAT_BBML2;
> +
> /* IDR5 */
> reg = readl_relaxed(smmu->base + ARM_SMMU_IDR5);
>
> 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 bd9d7c85576a..85eaf3ab88c2 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> @@ -60,6 +60,9 @@ struct arm_smmu_device;
> #define ARM_SMMU_IDR3 0xc
> #define IDR3_FWB (1 << 8)
> #define IDR3_RIL (1 << 10)
> +#define IDR3_BBML GENMASK(12, 11)
> +#define IDR3_BBML1 (1 << 11)
> +#define IDR3_BBML2 (2 << 11)
>
> #define ARM_SMMU_IDR5 0x14
> #define IDR5_STALL_MAX GENMASK(31, 16)
> @@ -754,6 +757,7 @@ struct arm_smmu_device {
> #define ARM_SMMU_FEAT_HA (1 << 21)
> #define ARM_SMMU_FEAT_HD (1 << 22)
> #define ARM_SMMU_FEAT_S2FWB (1 << 23)
> +#define ARM_SMMU_FEAT_BBML2 (1 << 24)
> u32 features;
>
> #define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0)
next prev parent reply other threads:[~2025-03-13 17:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 10:41 [PATCH v3 0/3] Initial BBML2 support for contpte_convert() Mikołaj Lenczewski
2025-03-13 10:41 ` [PATCH v3 1/3] arm64: Add BBM Level 2 cpu feature Mikołaj Lenczewski
2025-03-13 16:13 ` Ryan Roberts
2025-03-13 18:08 ` Mikołaj Lenczewski
2025-03-14 9:26 ` Ryan Roberts
2025-03-13 17:21 ` Yang Shi
2025-03-13 18:13 ` Mikołaj Lenczewski
2025-03-13 18:17 ` Ryan Roberts
2025-03-13 17:34 ` Marc Zyngier
2025-03-13 18:20 ` Mikołaj Lenczewski
2025-03-13 18:39 ` Marc Zyngier
2025-03-13 18:22 ` Ryan Roberts
2025-03-13 18:36 ` Marc Zyngier
2025-03-14 9:18 ` Ryan Roberts
2025-03-14 10:11 ` Marc Zyngier
2025-03-14 12:33 ` Suzuki K Poulose
2025-03-14 13:12 ` Ryan Roberts
2025-03-13 10:41 ` [PATCH v3 2/3] iommu/arm: Add BBM Level 2 smmu feature Mikołaj Lenczewski
2025-03-13 11:39 ` Robin Murphy
2025-03-13 16:18 ` Ryan Roberts [this message]
2025-03-13 10:41 ` [PATCH v3 3/3] arm64/mm: Elide tlbi in contpte_convert() under BBML2 Mikołaj Lenczewski
2025-03-13 16:28 ` Ryan Roberts
2025-03-13 11:22 ` [PATCH v3 0/3] Initial BBML2 support for contpte_convert() Suzuki K Poulose
2025-03-13 11:30 ` Mikołaj Lenczewski
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=07c36889-10d3-4944-a039-3a30fbdca883@arm.com \
--to=ryan.roberts@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=baohua@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=ioworker0@gmail.com \
--cc=james.morse@arm.com \
--cc=jean-philippe@linaro.org \
--cc=jgg@ziepe.ca \
--cc=joey.gouly@arm.com \
--cc=joro@8bytes.org \
--cc=jsnitsel@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=miko.lenczewski@arm.com \
--cc=mshavit@google.com \
--cc=nicolinc@nvidia.com \
--cc=oliver.upton@linux.dev \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=smostafa@google.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.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).