From: Paul Durrant <xadimgnik@gmail.com>
To: "'Jan Beulich'" <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
"'Paul Durrant'" <pdurrant@amazon.com>,
"'Andrew Cooper'" <andrew.cooper3@citrix.com>,
"'Wei Liu'" <wl@xen.org>,
"'Roger Pau Monné'" <roger.pau@citrix.com>,
"'George Dunlap'" <george.dunlap@citrix.com>,
"'Ian Jackson'" <ian.jackson@eu.citrix.com>,
"'Julien Grall'" <julien@xen.org>,
"'Stefano Stabellini'" <sstabellini@kernel.org>,
"'Jun Nakajima'" <jun.nakajima@intel.com>,
"'Kevin Tian'" <kevin.tian@intel.com>
Subject: RE: [PATCH v5 4/8] iommu: make map and unmap take a page count, similar to flush
Date: Thu, 10 Sep 2020 14:51:36 +0100 [thread overview]
Message-ID: <002e01d68779$80bef880$823ce980$@xen.org> (raw)
In-Reply-To: <369c4c5d-b8e4-77b6-45aa-572d531d1699@suse.com>
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 10 September 2020 13:48
> To: Paul Durrant <paul@xen.org>
> Cc: xen-devel@lists.xenproject.org; Paul Durrant <pdurrant@amazon.com>; Andrew Cooper
> <andrew.cooper3@citrix.com>; Wei Liu <wl@xen.org>; Roger Pau Monné <roger.pau@citrix.com>; George
> Dunlap <george.dunlap@citrix.com>; Ian Jackson <ian.jackson@eu.citrix.com>; Julien Grall
> <julien@xen.org>; Stefano Stabellini <sstabellini@kernel.org>; Jun Nakajima <jun.nakajima@intel.com>;
> Kevin Tian <kevin.tian@intel.com>
> Subject: Re: [PATCH v5 4/8] iommu: make map and unmap take a page count, similar to flush
>
> On 07.09.2020 09:40, Paul Durrant wrote:
> > --- a/xen/arch/x86/mm.c
> > +++ b/xen/arch/x86/mm.c
> > @@ -2966,9 +2966,11 @@ static int _get_page_type(struct page_info *page, unsigned long type,
> > mfn_t mfn = page_to_mfn(page);
> >
> > if ( (x & PGT_type_mask) == PGT_writable_page )
> > - rc = iommu_legacy_unmap(d, _dfn(mfn_x(mfn)), PAGE_ORDER_4K);
> > + rc = iommu_legacy_unmap(d, _dfn(mfn_x(mfn)),
> > + 1ul << PAGE_ORDER_4K);
> > else
> > - rc = iommu_legacy_map(d, _dfn(mfn_x(mfn)), mfn, PAGE_ORDER_4K,
> > + rc = iommu_legacy_map(d, _dfn(mfn_x(mfn)), mfn,
> > + 1ul << PAGE_ORDER_4K,
> > IOMMUF_readable | IOMMUF_writable);
> >
> > if ( unlikely(rc) )
>
> A few hundred lines up from here there is
>
> int rc2 = iommu_legacy_unmap(d, _dfn(mfn), PAGE_ORDER_4K);
>
> in cleanup_page_mappings().
Oh yes. Fixed.
>
> > --- a/xen/common/grant_table.c
> > +++ b/xen/common/grant_table.c
> > @@ -1225,7 +1225,7 @@ map_grant_ref(
> > kind = IOMMUF_readable;
> > else
> > kind = 0;
> > - if ( kind && iommu_legacy_map(ld, _dfn(mfn_x(mfn)), mfn, 0, kind) )
> > + if ( kind && iommu_legacy_map(ld, _dfn(mfn_x(mfn)), mfn, 1ul, kind) )
> > {
> > double_gt_unlock(lgt, rgt);
> > rc = GNTST_general_error;
> > @@ -1479,9 +1479,9 @@ unmap_common(
> >
> > kind = mapkind(lgt, rd, op->mfn);
> > if ( !kind )
> > - err = iommu_legacy_unmap(ld, _dfn(mfn_x(op->mfn)), 0);
> > + err = iommu_legacy_unmap(ld, _dfn(mfn_x(op->mfn)), 1ul);
> > else if ( !(kind & MAPKIND_WRITE) )
> > - err = iommu_legacy_map(ld, _dfn(mfn_x(op->mfn)), op->mfn, 0,
> > + err = iommu_legacy_map(ld, _dfn(mfn_x(op->mfn)), op->mfn, 1ul,
>
> For all three of these, I guess either 1ul << PAGE_ORDER_4K or simply 1?
> (Given that the code didn't use PAGE_ORDER_4K so far, I'd slightly
> prefer the latter. I'd be fine making the change while committing, but
> it looks like v6 is going to be needed anyway.)
Ok. Changed.
>
> > --- a/xen/drivers/passthrough/amd/iommu_map.c
> > +++ b/xen/drivers/passthrough/amd/iommu_map.c
> > @@ -362,7 +362,7 @@ static unsigned long flush_count(unsigned long dfn, unsigned int page_count,
> > }
> >
> > int amd_iommu_flush_iotlb_pages(struct domain *d, dfn_t dfn,
> > - unsigned int page_count,
> > + unsigned long page_count,
>
> This ought to be accompanied by a similar change to its flush_count()
> helper.
>
> > @@ -632,7 +632,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
>
> > static int __must_check iommu_flush_iotlb_pages(struct domain *d,
> > dfn_t dfn,
> > - unsigned int page_count,
> > + unsigned long page_count,
> > unsigned int flush_flags)
> > {
> > ASSERT(page_count && !dfn_eq(dfn, INVALID_DFN));
>
> This similarly ought to be accompanied by a change to its
> iommu_flush_iotlb() helper.
>
It is... in the previous hunk.
Paul
> Jan
next prev parent reply other threads:[~2020-09-10 13:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 7:40 [PATCH v5 0/8] IOMMU cleanup Paul Durrant
2020-09-07 7:40 ` [PATCH v5 1/8] x86/iommu: convert VT-d code to use new page table allocator Paul Durrant
2020-09-07 7:40 ` [PATCH v5 2/8] iommu: remove unused iommu_ops method and tasklet Paul Durrant
2020-09-07 7:40 ` [PATCH v5 3/8] iommu: flush I/O TLB if iommu_map() or iommu_unmap() fail Paul Durrant
2020-09-09 13:16 ` Jan Beulich
2020-09-07 7:40 ` [PATCH v5 4/8] iommu: make map and unmap take a page count, similar to flush Paul Durrant
2020-09-10 12:47 ` Jan Beulich
2020-09-10 13:51 ` Paul Durrant [this message]
2020-09-07 7:40 ` [PATCH v5 5/8] remove remaining uses of iommu_legacy_map/unmap Paul Durrant
2020-09-10 13:18 ` Jan Beulich
2020-09-07 7:40 ` [PATCH v5 6/8] common/grant_table: batch flush I/O TLB Paul Durrant
2020-09-10 13:48 ` Jan Beulich
2020-09-10 14:17 ` Paul Durrant
2020-09-10 14:39 ` Jan Beulich
2020-09-10 14:41 ` Paul Durrant
2020-09-07 7:40 ` [PATCH v5 7/8] iommu: remove the share_p2m operation Paul Durrant
2020-09-10 14:20 ` Jan Beulich
2020-09-10 14:25 ` Paul Durrant
2020-09-07 7:40 ` [PATCH v5 8/8] iommu: stop calling IOMMU page tables 'p2m tables' Paul Durrant
2020-09-10 14:27 ` Jan Beulich
2020-09-10 14:40 ` Paul Durrant
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='002e01d68779$80bef880$823ce980$@xen.org' \
--to=xadimgnik@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=paul@xen.org \
--cc=pdurrant@amazon.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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.