From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: Robin Murphy <robin.murphy@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>
Cc: "jon@solid-run.com" <jon@solid-run.com>,
Linuxarm <linuxarm@huawei.com>,
"steven.price@arm.com" <steven.price@arm.com>,
"Guohanjun \(Hanjun Guo\)" <guohanjun@huawei.com>,
yangyicong <yangyicong@huawei.com>,
"Sami.Mujawar@arm.com" <Sami.Mujawar@arm.com>,
"will@kernel.org" <will@kernel.org>,
wanghuiqiang <wanghuiqiang@huawei.com>
Subject: RE: [PATCH v7 3/9] iommu/dma: Introduce generic helper to retrieve RMR info
Date: Mon, 11 Oct 2021 05:51:11 +0000 [thread overview]
Message-ID: <183c95d412df42c9b9a1ef6123832916@huawei.com> (raw)
In-Reply-To: <53208fa4-576c-f590-334a-6d1ce8170031@arm.com>
> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: 08 October 2021 14:04
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;
> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;
> iommu@lists.linux-foundation.org
> Cc: Linuxarm <linuxarm@huawei.com>; lorenzo.pieralisi@arm.com;
> joro@8bytes.org; will@kernel.org; wanghuiqiang
> <wanghuiqiang@huawei.com>; Guohanjun (Hanjun Guo)
> <guohanjun@huawei.com>; steven.price@arm.com; Sami.Mujawar@arm.com;
> jon@solid-run.com; eric.auger@redhat.com; yangyicong
> <yangyicong@huawei.com>
> Subject: Re: [PATCH v7 3/9] iommu/dma: Introduce generic helper to retrieve
> RMR info
>
> On 2021-08-05 09:07, Shameer Kolothum wrote:
> > Reserved Memory Regions(RMR) associated with an IOMMU can be
> > described through ACPI IORT tables in systems with devices
> > that require a unity mapping or bypass for those
> > regions.
> >
> > Introduce a generic interface so that IOMMU drivers can retrieve
> > and set up necessary mappings.
> >
> > Signed-off-by: Shameer Kolothum
> <shameerali.kolothum.thodi@huawei.com>
> > ---
> > drivers/iommu/dma-iommu.c | 29 +++++++++++++++++++++++++++++
> > include/linux/dma-iommu.h | 13 +++++++++++++
> > 2 files changed, 42 insertions(+)
> >
> > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> > index 98ba927aee1a..2fa2445e9070 100644
> > --- a/drivers/iommu/dma-iommu.c
> > +++ b/drivers/iommu/dma-iommu.c
> > @@ -174,6 +174,35 @@ void iommu_put_dma_cookie(struct
> iommu_domain *domain)
> > }
> > EXPORT_SYMBOL(iommu_put_dma_cookie);
> >
> > +/**
> > + *
> > + * iommu_dma_get_rmrs - Retrieve Reserved Memory Regions(RMRs)
> associated
> > + * with a given IOMMU
> > + * @iommu_fwnode: fwnode associated with IOMMU
> > + * @list: RMR list to be populated
> > + *
> > + */
> > +int iommu_dma_get_rmrs(struct fwnode_handle *iommu_fwnode,
> > + struct list_head *list)
> > +{
> > + return -EINVAL;
> > +}
> > +EXPORT_SYMBOL(iommu_dma_get_rmrs);
> > +
> > +/**
> > + *
> > + * iommu_dma_put_rmrs - Release Reserved Memory Regions(RMRs)
> associated
> > + * with a given IOMMU
> > + * @iommu_fwnode: fwnode associated with IOMMU
> > + * @list: RMR list
> > + *
> > + */
> > +void iommu_dma_put_rmrs(struct fwnode_handle *iommu_fwnode,
> > + struct list_head *list)
> > +{
> > +}
> > +EXPORT_SYMBOL(iommu_dma_put_rmrs);
>
> Unless there's something special you expect to need to do here, can we
> just uphold the prevailing expectation that resv_regions are kmalloc()ed
> and can be freed directly by the generic function?
Right. I think we can do that.
>
> > +
> > /**
> > * iommu_dma_get_resv_regions - Reserved region driver helper
> > * @dev: Device from iommu_get_resv_regions()
> > diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
> > index 758ca4694257..3b7b2d096c6e 100644
> > --- a/include/linux/dma-iommu.h
> > +++ b/include/linux/dma-iommu.h
> > @@ -42,12 +42,16 @@ void iommu_dma_free_cpu_cached_iovas(unsigned
> int cpu,
> >
> > extern bool iommu_dma_forcedac;
> >
> > +int iommu_dma_get_rmrs(struct fwnode_handle *iommu, struct list_head
> *list);
> > +void iommu_dma_put_rmrs(struct fwnode_handle *iommu, struct list_head
> *list);
> > +
> > #else /* CONFIG_IOMMU_DMA */
> >
> > struct iommu_domain;
> > struct msi_desc;
> > struct msi_msg;
> > struct device;
> > +struct fwnode_handle;
> >
> > static inline void iommu_setup_dma_ops(struct device *dev, u64
> dma_base,
> > u64 dma_limit)
> > @@ -83,5 +87,14 @@ static inline void
> iommu_dma_get_resv_regions(struct device *dev, struct list_he
> > {
> > }
> >
> > +static int iommu_dma_get_rmrs(struct fwnode_handle *iommu, struct
> list_head *list)
> > +{
> > + return -ENODEV;
>
> Hmm, if this needs to be stubbed at all then returning an error seems
> like probably the wrong thing to do. I guess it's for 32-bit builds of
> arm-smmu? It is not an error if the firmware describes no RMRs because
> there are no RMRs, so it hardly deserves to be an error if there are no
> RMRs simply because the firmware isn't ACPI.
Yes, definitely not an error return. I will change that.
Thanks,
Shameer
>
> Robin.
>
> > +}
> > +
> > +static void iommu_dma_put_rmrs(struct fwnode_handle *iommu, struct
> list_head *list)
> > +{
> > +}
> > +
> > #endif /* CONFIG_IOMMU_DMA */
> > #endif /* __DMA_IOMMU_H */
> >
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2021-10-11 5:51 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-05 8:07 [PATCH v7 0/9] ACPI/IORT: Support for IORT RMR node Shameer Kolothum
2021-08-05 8:07 ` [PATCH v7 1/9] iommu: Introduce a union to struct iommu_resv_region Shameer Kolothum
2021-08-20 10:22 ` Steven Price
2021-10-08 12:14 ` Robin Murphy
2021-10-09 6:57 ` Jon Nettleton
2021-10-11 5:47 ` Shameerali Kolothum Thodi
2021-10-11 13:47 ` Robin Murphy
2021-08-05 8:07 ` [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Shameer Kolothum
2021-08-05 16:03 ` Lorenzo Pieralisi
2021-08-05 16:31 ` Jon Nettleton
2021-08-05 18:37 ` Laurentiu Tudor
2021-09-06 17:44 ` Robin Murphy
2021-09-06 19:51 ` Jon Nettleton
2021-09-16 7:26 ` Shameerali Kolothum Thodi
2021-09-16 7:52 ` Jon Nettleton
2021-09-16 8:26 ` Shameerali Kolothum Thodi
2021-09-16 11:16 ` Jon Nettleton
2021-09-17 11:26 ` Shameerali Kolothum Thodi
2021-10-05 10:53 ` Laurentiu Tudor
2021-10-08 12:48 ` Robin Murphy
2021-10-09 7:06 ` Jon Nettleton
2021-10-11 14:04 ` Robin Murphy
2021-10-12 8:00 ` Jon Nettleton
2021-12-08 12:18 ` Lorenzo Pieralisi
2021-12-08 13:26 ` Jon Nettleton
2021-12-08 14:37 ` Robin Murphy
2021-12-08 15:11 ` Jon Nettleton
2021-10-11 5:59 ` Shameerali Kolothum Thodi
2021-08-05 8:07 ` [PATCH v7 3/9] iommu/dma: Introduce generic helper to retrieve RMR info Shameer Kolothum
2021-10-08 13:03 ` Robin Murphy
2021-10-11 5:51 ` Shameerali Kolothum Thodi [this message]
2021-08-05 8:07 ` [PATCH v7 4/9] ACPI/IORT: Add a helper to retrieve RMR memory regions Shameer Kolothum
2021-08-05 15:43 ` Lorenzo Pieralisi
2021-08-05 8:07 ` [PATCH v7 5/9] iommu/arm-smmu-v3: Introduce strtab init helper Shameer Kolothum
2021-08-05 8:07 ` [PATCH v7 6/9] iommu/arm-smmu-v3: Refactor arm_smmu_init_bypass_stes() to force bypass Shameer Kolothum
2021-08-05 8:07 ` [PATCH v7 7/9] iommu/arm-smmu-v3: Get associated RMR info and install bypass STE Shameer Kolothum
2021-08-05 8:07 ` [PATCH v7 8/9] iommu/arm-smmu: Get associated RMR info and install bypass SMR Shameer Kolothum
2021-08-05 8:07 ` [PATCH v7 9/9] iommu/dma: Reserve any RMR regions associated with a dev Shameer Kolothum
2021-10-08 13:09 ` Robin Murphy
2021-10-09 7:07 ` Jon Nettleton
2021-10-11 15:00 ` Robin Murphy
2021-10-11 15:42 ` Shameerali Kolothum Thodi
2021-08-05 13:22 ` [PATCH v7 0/9] ACPI/IORT: Support for IORT RMR node Ard Biesheuvel
2021-08-05 13:35 ` Shameerali Kolothum Thodi
2021-08-05 14:09 ` Ard Biesheuvel
2021-08-31 5:06 ` Jon Nettleton
2021-09-30 9:47 ` Eric Auger
2021-09-30 10:50 ` Shameerali Kolothum Thodi
2022-01-25 13:00 ` Shameerali Kolothum Thodi via iommu
2022-01-25 19:30 ` Robin Murphy
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=183c95d412df42c9b9a1ef6123832916@huawei.com \
--to=shameerali.kolothum.thodi@huawei.com \
--cc=Sami.Mujawar@arm.com \
--cc=guohanjun@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jon@solid-run.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linuxarm@huawei.com \
--cc=robin.murphy@arm.com \
--cc=steven.price@arm.com \
--cc=wanghuiqiang@huawei.com \
--cc=will@kernel.org \
--cc=yangyicong@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).