From: Baolu Lu <baolu.lu@linux.intel.com>
To: Robin Murphy <robin.murphy@arm.com>, joro@8bytes.org, will@kernel.org
Cc: baolu.lu@linux.intel.com, iommu@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] iommu: Retire iommu_capable()
Date: Wed, 17 Aug 2022 16:41:23 +0800 [thread overview]
Message-ID: <0030c6c6-7c35-916a-9663-8b71b4378ee7@linux.intel.com> (raw)
In-Reply-To: <d8bd8777d06929ad8f49df7fc80e1b9af32a41b5.1660574547.git.robin.murphy@arm.com>
On 2022/8/15 23:26, Robin Murphy wrote:
> With all callers now converted to the device-specific version, retire
> the old bus-based interface, and give drivers the chance to indicate
> accurate per-instance capabilities.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
> ---
> drivers/iommu/amd/iommu.c | 2 +-
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
> drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +-
> drivers/iommu/arm/arm-smmu/qcom_iommu.c | 2 +-
> drivers/iommu/fsl_pamu_domain.c | 2 +-
> drivers/iommu/intel/iommu.c | 2 +-
> drivers/iommu/iommu.c | 11 +----------
> drivers/iommu/s390-iommu.c | 2 +-
> include/linux/iommu.h | 8 +-------
> 9 files changed, 9 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index 65b8e4fd8217..94220eb5bff3 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2251,7 +2251,7 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
> return ops->iova_to_phys(ops, iova);
> }
>
> -static bool amd_iommu_capable(enum iommu_cap cap)
> +static bool amd_iommu_capable(struct device *dev, enum iommu_cap cap)
> {
> switch (cap) {
> case IOMMU_CAP_CACHE_COHERENCY:
> 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 d32b02336411..ab919ec43c4d 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -1992,7 +1992,7 @@ static const struct iommu_flush_ops arm_smmu_flush_ops = {
> };
>
> /* IOMMU API */
> -static bool arm_smmu_capable(enum iommu_cap cap)
> +static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
> {
> switch (cap) {
> case IOMMU_CAP_CACHE_COHERENCY:
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> index dfa82df00342..ce036a053fb8 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> @@ -1330,7 +1330,7 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
> return ops->iova_to_phys(ops, iova);
> }
>
> -static bool arm_smmu_capable(enum iommu_cap cap)
> +static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
> {
> switch (cap) {
> case IOMMU_CAP_CACHE_COHERENCY:
> diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> index 17235116d3bb..66ca47f2e57f 100644
> --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> @@ -493,7 +493,7 @@ static phys_addr_t qcom_iommu_iova_to_phys(struct iommu_domain *domain,
> return ret;
> }
>
> -static bool qcom_iommu_capable(enum iommu_cap cap)
> +static bool qcom_iommu_capable(struct device *dev, enum iommu_cap cap)
> {
> switch (cap) {
> case IOMMU_CAP_CACHE_COHERENCY:
> diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
> index 011f9ab7f743..08fd9089e3ba 100644
> --- a/drivers/iommu/fsl_pamu_domain.c
> +++ b/drivers/iommu/fsl_pamu_domain.c
> @@ -178,7 +178,7 @@ static phys_addr_t fsl_pamu_iova_to_phys(struct iommu_domain *domain,
> return iova;
> }
>
> -static bool fsl_pamu_capable(enum iommu_cap cap)
> +static bool fsl_pamu_capable(struct device *dev, enum iommu_cap cap)
> {
> return cap == IOMMU_CAP_CACHE_COHERENCY;
> }
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 7cca030a508e..da63b358ef4a 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -4429,7 +4429,7 @@ static bool intel_iommu_enforce_cache_coherency(struct iommu_domain *domain)
> return true;
> }
>
> -static bool intel_iommu_capable(enum iommu_cap cap)
> +static bool intel_iommu_capable(struct device *dev, enum iommu_cap cap)
> {
> if (cap == IOMMU_CAP_CACHE_COHERENCY)
> return true;
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 780fb7071577..6283a8b4def4 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -1869,19 +1869,10 @@ bool device_iommu_capable(struct device *dev, enum iommu_cap cap)
> if (!ops->capable)
> return false;
>
> - return ops->capable(cap);
> + return ops->capable(dev, cap);
> }
> EXPORT_SYMBOL_GPL(device_iommu_capable);
>
> -bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
> -{
> - if (!bus->iommu_ops || !bus->iommu_ops->capable)
> - return false;
> -
> - return bus->iommu_ops->capable(cap);
> -}
> -EXPORT_SYMBOL_GPL(iommu_capable);
> -
> /**
> * iommu_set_fault_handler() - set a fault handler for an iommu domain
> * @domain: iommu domain
> diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
> index c898bcbbce11..cd0ee89d63e0 100644
> --- a/drivers/iommu/s390-iommu.c
> +++ b/drivers/iommu/s390-iommu.c
> @@ -39,7 +39,7 @@ static struct s390_domain *to_s390_domain(struct iommu_domain *dom)
> return container_of(dom, struct s390_domain, domain);
> }
>
> -static bool s390_iommu_capable(enum iommu_cap cap)
> +static bool s390_iommu_capable(struct device *dev, enum iommu_cap cap)
> {
> switch (cap) {
> case IOMMU_CAP_CACHE_COHERENCY:
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index ea30f00dc145..e39372dfe8c4 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -227,7 +227,7 @@ struct iommu_iotlb_gather {
> * @owner: Driver module providing these ops
> */
> struct iommu_ops {
> - bool (*capable)(enum iommu_cap);
> + bool (*capable)(struct device *dev, enum iommu_cap);
>
> /* Domain allocation and freeing by the iommu driver */
> struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type);
> @@ -420,7 +420,6 @@ extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
> extern int bus_iommu_probe(struct bus_type *bus);
> extern bool iommu_present(struct bus_type *bus);
> extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap);
> -extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
> extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
> extern struct iommu_group *iommu_group_get_by_id(int id);
> extern void iommu_domain_free(struct iommu_domain *domain);
> @@ -697,11 +696,6 @@ static inline bool device_iommu_capable(struct device *dev, enum iommu_cap cap)
> return false;
> }
>
> -static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
> -{
> - return false;
> -}
> -
> static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
> {
> return NULL;
next prev parent reply other threads:[~2022-08-17 8:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 15:26 [PATCH 1/2] iommu: Retire iommu_capable() Robin Murphy
2022-08-15 15:26 ` [PATCH 2/2] iommu/arm-smmu: Report IOMMU_CAP_CACHE_COHERENCY better Robin Murphy
2022-08-17 8:41 ` Baolu Lu [this message]
2022-09-07 12:17 ` [PATCH 1/2] iommu: Retire iommu_capable() Joerg Roedel
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=0030c6c6-7c35-916a-9663-8b71b4378ee7@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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