From: Jason Gunthorpe <jgg@nvidia.com>
To: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Gerd Bayer <gbayer@linux.ibm.com>,
Pierre Morel <pmorel@linux.ibm.com>,
linux-s390@vger.kernel.org, borntraeger@linux.ibm.com,
hca@linux.ibm.com, gor@linux.ibm.com,
gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com,
svens@linux.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 3/6] iommu/s390: Fix potential s390_domain aperture shrinking
Date: Mon, 24 Oct 2022 13:53:36 -0300 [thread overview]
Message-ID: <Y1bDEOar1GacgfkU@nvidia.com> (raw)
In-Reply-To: <20221017124558.1386337-4-schnelle@linux.ibm.com>
On Mon, Oct 17, 2022 at 02:45:55PM +0200, Niklas Schnelle wrote:
> The s390 IOMMU driver currently sets the IOMMU domain's aperture to
> match the device specific DMA address range of the device that is first
> attached. This is not ideal. For one if the domain has no device
> attached in the meantime the aperture could be shrunk allowing
> translations outside the aperture to exist in the translation tables.
> Also this is a bit of a misuse of the aperture which really should
> describe what addresses can be translated and not some device specific
> limitations.
>
> Instead of misusing the aperture like this we can instead create
> reserved ranges for the ranges inaccessible to the attached devices
> allowing devices with overlapping ranges to still share an IOMMU domain.
> This also significantly simplifies s390_iommu_attach_device() allowing
> us to move the aperture check to the beginning of the function and
> removing the need to hold the device list's lock to check the aperture.
>
> As we then use the same aperture for all domains and it only depends on
> the table properties we can already check zdev->start_dma/end_dma at
> probe time and turn the check on attach into a WARN_ON().
>
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> v5->v6:
> - Return -EINVAL after WARN_ON() in attach
> v4->v5:
> - Make aperture check in attach a WARN_ON() and fail in probe if
> zdev->start_dma/end_dma doesn't git in aperture (Jason)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
next prev parent reply other threads:[~2022-10-24 16:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 12:45 [PATCH v7 0/6] iommu/s390: Fixes related to attach and aperture handling Niklas Schnelle
2022-10-17 12:45 ` [PATCH v7 1/6] iommu/s390: Fix duplicate domain attachments Niklas Schnelle
2022-10-24 16:52 ` Jason Gunthorpe
2022-10-17 12:45 ` [PATCH v7 2/6] iommu/s390: Get rid of s390_domain_device Niklas Schnelle
2022-10-24 16:52 ` Jason Gunthorpe
2022-10-17 12:45 ` [PATCH v7 3/6] iommu/s390: Fix potential s390_domain aperture shrinking Niklas Schnelle
2022-10-24 15:02 ` Niklas Schnelle
2022-10-24 16:53 ` Jason Gunthorpe [this message]
2022-10-17 12:45 ` [PATCH v7 4/6] iommu/s390: Fix incorrect aperture check Niklas Schnelle
2022-10-24 16:54 ` Jason Gunthorpe
2022-10-17 12:45 ` [PATCH v7 5/6] iommu/s390: Fix incorrect pgsize_bitmap Niklas Schnelle
2022-10-17 12:45 ` [PATCH v7 6/6] iommu/s390: Implement map_pages()/unmap_pages() instead of map()/unmap() Niklas Schnelle
2022-10-24 16:59 ` Jason Gunthorpe
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=Y1bDEOar1GacgfkU@nvidia.com \
--to=jgg@nvidia.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gbayer@linux.ibm.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=pmorel@linux.ibm.com \
--cc=robin.murphy@arm.com \
--cc=schnelle@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.