From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: Chris Wright <chrisw@sous-sol.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
Ohad Ben-Cohen <ohad@wizery.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>, Avi Kivity <avi@redhat.com>,
David Brown <davidb@codeaurora.org>
Subject: Re: [PATCH 0/2] Introduce iommu_commit() function
Date: Fri, 24 Jun 2011 10:08:05 +0200 [thread overview]
Message-ID: <20110624080805.GG13255@amd.com> (raw)
In-Reply-To: <20110623172053.GV25383@sequoia.sous-sol.org>
On Thu, Jun 23, 2011 at 01:20:53PM -0400, Chris Wright wrote:
> * David Woodhouse (dwmw2@infradead.org) wrote:
> > I'd much rather KVM just gave us a list of the pages to map, in a single
> > call.
>
> This makes most sense to me.
But how is this supposed to work with arbitrary page-sizes? When we
define the interface as
int iommu_map(struct iommu_domain *domain,
unsigned long iova,
struct page **pages,
int num_pages);
how does the IOMMU driver know which page-sizes are the best to use?
Sure, it can check if the pages in the list are physically contiguous,
but that is really bad design.
The information about the right page-sizes is already available in the
caller and the best is to pass this information down to the iommu
driver (which then maps the region with the best-fitting page-sizes it
supports). I would rather change the interface to something like
int iommu_map(struct iommu_domain *domain,
unsigned long iova,
phys_addr_t phys_addr,
size_t len);
In this interface the caller specifies that the system physical region
starting at phys_addr, ending at phys_addr+len-1 should be mapped at
iova. The IOMMU driver already knows that this region is physically
contiguous and can apply the right page-sizes itself.
This interface is also much friendlier to the caller because there is no
need to build a list of pages. And yes, there will be more users of the
iommu-api than KVM in the future.
The page-table page cache-flushing problem on VT-d can be solved with
the iommu_commit() function like I described in an previous email. This
one can be used for a number of things necessary on other iommus too
(like flushing io/tlbs) so that this interface makes sense for all iommu
hardware supported by the iommu-api.
Regards,
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
next prev parent reply other threads:[~2011-06-24 8:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-23 15:31 [PATCH 0/2] Introduce iommu_commit() function Joerg Roedel
2011-06-23 15:31 ` [PATCH 1/2] iommu-api: Introduce iommu_comit function Joerg Roedel
2011-06-23 15:31 ` [PATCH 2/2] KVM: IOMMU: Use iommu_commit() in device-passthrough code Joerg Roedel
2011-06-23 15:38 ` [PATCH 0/2] Introduce iommu_commit() function David Woodhouse
2011-06-23 16:21 ` Roedel, Joerg
2011-06-23 17:20 ` Chris Wright
2011-06-24 8:08 ` Roedel, Joerg [this message]
2011-11-16 9:40 ` Avi Kivity
2011-06-29 5:02 ` KyongHo Cho
2011-06-29 5:51 ` Joerg Roedel
2011-11-16 2:00 ` KyongHo Cho
2011-11-16 12:58 ` 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=20110624080805.GG13255@amd.com \
--to=joerg.roedel@amd.com \
--cc=avi@redhat.com \
--cc=chrisw@sous-sol.org \
--cc=davidb@codeaurora.org \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ohad@wizery.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