Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP1
xen.30827
602e5abb-gnttab-bypass-IOMMU-when-mapping-own-g...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 602e5abb-gnttab-bypass-IOMMU-when-mapping-own-grant.patch of Package xen.30827
# Commit e8185c5f01c68f7d29d23a4a91bc1be1ff2cc1ca # Date 2021-02-18 13:16:59 +0100 # Author Jan Beulich <jbeulich@suse.com> # Committer Jan Beulich <jbeulich@suse.com> gnttab: bypass IOMMU (un)mapping when a domain is (un)mapping its own grant Mappings for a domain's own pages should already be present in the IOMMU. While installing the same mapping again is merely redundant (and inefficient), removing the mapping when the grant mapping gets removed is outright wrong in this case: The mapping was there before the map, so should remain in place after unmapping. This affects - Arm Dom0 in the direct mapped case, - x86 PV Dom0 in the "iommu=dom0-strict" / "dom0-iommu=strict" case, - all x86 PV DomU-s, including driver domains. See the code comment for why it's the original domain and not the page owner that gets compared against. Reported-by: Rahul Singh <Rahul.Singh@arm.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Julien Grall <jgrall@amazon.com> --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1150,7 +1150,14 @@ map_grant_ref( goto undo_out; } - need_iommu = gnttab_need_iommu_mapping(ld); + /* + * This is deliberately not checking the page's owner: get_paged_frame() + * explicitly rejects foreign pages, and all success paths above yield + * either owner == rd or owner == dom_io (the dom_cow case is irrelevant + * as mem-sharing and IOMMU use are incompatible). The dom_io case would + * need checking separately if we compared against owner here. + */ + need_iommu = ld != rd && gnttab_need_iommu_mapping(ld); if ( need_iommu ) { unsigned int kind; @@ -1406,7 +1413,8 @@ unmap_common( if ( put_handle ) put_maptrack_handle(lgt, op->handle); - if ( rc == GNTST_okay && gnttab_need_iommu_mapping(ld) ) + /* See the respective comment in map_grant_ref(). */ + if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) ) { unsigned int kind; int err = 0;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor