From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>,
joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
gerald.schaefer@linux.ibm.com
Cc: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
svens@linux.ibm.com, borntraeger@linux.ibm.com, clg@redhat.com,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org
Subject: Re: [PATCH v3 2/5] iommu/s390: support cleanup of additional table regions
Date: Tue, 11 Mar 2025 13:01:07 +0100 [thread overview]
Message-ID: <7cec7c48246559e5193837c58a962c76e6d38651.camel@linux.ibm.com> (raw)
In-Reply-To: <20250228214456.440641-3-mjrosato@linux.ibm.com>
On Fri, 2025-02-28 at 16:44 -0500, Matthew Rosato wrote:
> Extend the existing dma_cleanup_tables to also handle region second and
> region first tables.
>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
> drivers/iommu/s390-iommu.c | 71 ++++++++++++++++++++++++++++++++++----
> 1 file changed, 64 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
> index cad032d4c9a6..f2cda0ce0fe9 100644
> --- a/drivers/iommu/s390-iommu.c
> +++ b/drivers/iommu/s390-iommu.c
> @@ -121,6 +121,22 @@ static inline int pt_entry_isvalid(unsigned long entry)
> return (entry & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID;
> }
>
>
--- snip ---
> +
> +static void dma_cleanup_tables(struct s390_domain *domain)
> +{
> + int rtx, rsx, rfx;
> +
> + if (!domain->dma_table)
> return;
>
> - for (rtx = 0; rtx < ZPCI_TABLE_ENTRIES; rtx++)
> - if (reg_entry_isvalid(table[rtx]))
> - dma_free_seg_table(table[rtx]);
> + switch (domain->origin_type) {
> + case ZPCI_TABLE_TYPE_RFX:
> + for (rfx = 0; rfx < ZPCI_TABLE_ENTRIES; rfx++)
> + if (reg_entry_isvalid(domain->dma_table[rfx]))
> + dma_free_rs_table(domain->dma_table[rfx]);
> + break;
> + case ZPCI_TABLE_TYPE_RSX:
> + for (rsx = 0; rsx < ZPCI_TABLE_ENTRIES; rsx++)
> + if (reg_entry_isvalid(domain->dma_table[rsx]))
> + dma_free_rt_table(domain->dma_table[rsx]);
> + break;
> + case ZPCI_TABLE_TYPE_RTX:
> + for (rtx = 0; rtx < ZPCI_TABLE_ENTRIES; rtx++)
> + if (reg_entry_isvalid(domain->dma_table[rtx]))
> + dma_free_seg_table(domain->dma_table[rtx]);
> + break;
> + default:
> + WARN_ONCE(1, "Invalid IOMMU table (%x)\n", domain->origin_type);
> + return;
> + }
>
> - dma_free_cpu_table(table);
> + dma_free_cpu_table(domain->dma_table);
> }
>
> static unsigned long *dma_alloc_page_table(gfp_t gfp)
> @@ -358,7 +415,7 @@ static void s390_iommu_rcu_free_domain(struct rcu_head *head)
> {
> struct s390_domain *s390_domain = container_of(head, struct s390_domain, rcu);
>
> - dma_cleanup_tables(s390_domain->dma_table);
> + dma_cleanup_tables(s390_domain);
> kfree(s390_domain);
> }
>
Looks good to me.
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
next prev parent reply other threads:[~2025-03-11 12:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 21:44 [PATCH v3 0/5] iommu/s390: support additional table regions Matthew Rosato
2025-02-28 21:44 ` [PATCH v3 1/5] iommu/s390: set appropriate IOTA region type Matthew Rosato
2025-03-11 11:49 ` Niklas Schnelle
2025-02-28 21:44 ` [PATCH v3 2/5] iommu/s390: support cleanup of additional table regions Matthew Rosato
2025-03-11 12:01 ` Niklas Schnelle [this message]
2025-02-28 21:44 ` [PATCH v3 3/5] iommu/s390: support iova_to_phys for " Matthew Rosato
2025-03-11 14:19 ` Niklas Schnelle
2025-02-28 21:44 ` [PATCH v3 4/5] iommu/s390: support map/unmap " Matthew Rosato
2025-02-28 21:44 ` [PATCH v3 5/5] iommu/s390: allow larger region tables Matthew Rosato
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=7cec7c48246559e5193837c58a962c76e6d38651.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=clg@redhat.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=robin.murphy@arm.com \
--cc=svens@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).