xen/arm: allow translated iommu mappings

In preparation of exposing vITS to domUs, generalize arm_iommu_map_page
and arm_iommu_unmap_page to allow ITS doorbell mappings with dfn != mfn.

The mfn does not need to be passed to guest_physmap_remove_page since
there is no mfn checking on the p2m_iommu_map_{rw,ro} p2m types during
unmap. Pass INVALID_MFN to guest_physmap_remove_page.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
Tested-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
Stefano Stabellini authored and Julien Grall committed 2025-08-12 12:04:41 +01:00
1 parent 53d60d759d
commit 4cde4a552e
1 file changed
+2 -9
+2 -9
View File
@@ -36,9 +36,6 @@ int __must_check arm_iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn,
{
p2m_type_t t;
BUG_ON(!domain_use_host_layout(d));
BUG_ON(mfn_x(mfn) != dfn_x(dfn));
/* We only support readable and writable flags */
if ( !(flags & (IOMMUF_readable | IOMMUF_writable)) )
return -EINVAL;
@@ -49,7 +46,7 @@ int __must_check arm_iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn,
* The function guest_physmap_add_entry replaces the current mapping
* if there is already one...
*/
return guest_physmap_add_entry(d, _gfn(dfn_x(dfn)), _mfn(dfn_x(dfn)),
return guest_physmap_add_entry(d, _gfn(dfn_x(dfn)), mfn,
IOMMUF_order(flags), t);
}
@@ -58,11 +55,7 @@ int __must_check arm_iommu_unmap_page(struct domain *d, dfn_t dfn,
unsigned int order,
unsigned int *flush_flags)
{
if ( !domain_use_host_layout(d) )
return -EINVAL;
return guest_physmap_remove_page(d, _gfn(dfn_x(dfn)), _mfn(dfn_x(dfn)),
order);
return guest_physmap_remove_page(d, _gfn(dfn_x(dfn)), INVALID_MFN, order);
}
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.