|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: [PATCH v4 07/14] iommu: make map, unmap and flush all take both an order and a count
> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 06 August 2020 10:57
> To: Paul Durrant <paul@xxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; Durrant, Paul <pdurrant@xxxxxxxxxxxx>;
> Jun Nakajima
> <jun.nakajima@xxxxxxxxx>; Kevin Tian <kevin.tian@xxxxxxxxx>; Andrew Cooper
> <andrew.cooper3@xxxxxxxxxx>; George Dunlap <george.dunlap@xxxxxxxxxx>; Wei
> Liu <wl@xxxxxxx>; Roger Pau
> Monné <roger.pau@xxxxxxxxxx>; Ian Jackson <ian.jackson@xxxxxxxxxxxxx>; Julien
> Grall <julien@xxxxxxx>;
> Stefano Stabellini <sstabellini@xxxxxxxxxx>; Volodymyr Babchuk
> <Volodymyr_Babchuk@xxxxxxxx>
> Subject: RE: [EXTERNAL] [PATCH v4 07/14] iommu: make map, unmap and flush all
> take both an order and a
> count
>
> CAUTION: This email originated from outside of the organization. Do not click
> links or open
> attachments unless you can confirm the sender and know the content is safe.
>
>
>
> On 04.08.2020 15:42, Paul Durrant wrote:
> > From: Paul Durrant <pdurrant@xxxxxxxxxx>
> >
> > At the moment iommu_map() and iommu_unmap() take a page order but not a
> > count, whereas iommu_iotlb_flush() takes a count but not a page order.
> > This patch simply makes them consistent with each other.
>
> Why can't we do with just a count, where order gets worked out by
> functions knowing how to / wanting to deal with higher order pages?
>
Yes, that may well be better. The order of the CPU mappings isn't really
relevant cases where the IOMMU uses different page orders. I'll just move
everything over to a page count.
Paul
> > --- a/xen/arch/x86/mm/p2m-ept.c
> > +++ b/xen/arch/x86/mm/p2m-ept.c
> > @@ -843,7 +843,7 @@ out:
> > need_modify_vtd_table )
> > {
> > if ( iommu_use_hap_pt(d) )
> > - rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
> > + rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order), 1,
>
> Forgot to drop the "1 << "? (There are then I think two more instances
> further down.)
>
> > --- a/xen/common/memory.c
> > +++ b/xen/common/memory.c
> > @@ -851,12 +851,12 @@ int xenmem_add_to_physmap(struct domain *d, struct
> > xen_add_to_physmap *xatp,
> >
> > this_cpu(iommu_dont_flush_iotlb) = 0;
> >
> > - ret = iommu_iotlb_flush(d, _dfn(xatp->idx - done), done,
> > + ret = iommu_iotlb_flush(d, _dfn(xatp->idx - done), 0, done,
>
> Arguments wrong way round? (This risk of inverting their order is
> one of the primary reasons why I think we want just a count.) I'm
> also uncertain about the use of 0 vs PAGE_ORDER_4K here.
>
> > IOMMU_FLUSHF_added |
> > IOMMU_FLUSHF_modified);
> > if ( unlikely(ret) && rc >= 0 )
> > rc = ret;
> >
> > - ret = iommu_iotlb_flush(d, _dfn(xatp->gpfn - done), done,
> > + ret = iommu_iotlb_flush(d, _dfn(xatp->gpfn - done), 0, done,
>
> Same here then.
>
> Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |