These functions are basically wrappers of map_domain_page; move
them to the shared extern.h and make them inline to help with code
generation.
Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
xen/drivers/passthrough/vtd/extern.h | 13 +++++++++++--
xen/drivers/passthrough/vtd/x86/vtd.c | 10 ----------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index c16583c951..a62310b3e7 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -21,6 +21,7 @@
#define DRIVERS__PASSTHROUGH__VTD__EXTERN_H
#include "dmar.h"
+#include <xen/domain_page.h>
#include <xen/keyhandler.h>
#define VTDPREFIX "[VT-D]"
@@ -78,8 +79,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu,
uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
void free_pgtable_maddr(u64 maddr);
-void *map_vtd_domain_page(u64 maddr);
-void unmap_vtd_domain_page(const void *va);
int domain_context_mapping_one(struct domain *domain, struct vtd_iommu *iommu,
uint8_t bus, uint8_t devfn,
const struct pci_dev *pdev, domid_t domid,
@@ -114,4 +113,14 @@ void quirk_iommu_caps(struct vtd_iommu *iommu);
bool platform_supports_intremap(void);
bool platform_supports_x2apic(void);
+static inline void *map_vtd_domain_page(u64 maddr)
+{
+ return map_domain_page(_mfn(paddr_to_pfn(maddr)));
+}
+
+static inline void unmap_vtd_domain_page(const void *va)
+{
+ unmap_domain_page(va);
+}
+
#endif // DRIVERS__PASSTHROUGH__VTD__EXTERN_H
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 76f12adc23..b0798dc6a1 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -36,13 +36,3 @@
* 1:1 iommu mappings except xen and unusable regions.
*/
boolean_param("iommu_inclusive_mapping", iommu_hwdom_inclusive);
-
-void *map_vtd_domain_page(u64 maddr)
-{
- return map_domain_page(_mfn(paddr_to_pfn(maddr)));
-}
-
-void unmap_vtd_domain_page(const void *va)
-{
- unmap_domain_page(va);
-}
--
2.51.1
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
On 22/10/2025 10:51 am, Teddy Astie wrote:
> These functions are basically wrappers of map_domain_page; move
We tend to write map_domain_page() with brackets, to make it clearer
that we're talking about a function.
> diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
> index c16583c951..a62310b3e7 100644
> --- a/xen/drivers/passthrough/vtd/extern.h
> +++ b/xen/drivers/passthrough/vtd/extern.h
> @@ -114,4 +113,14 @@ void quirk_iommu_caps(struct vtd_iommu *iommu);
> bool platform_supports_intremap(void);
> bool platform_supports_x2apic(void);
>
> +static inline void *map_vtd_domain_page(u64 maddr)
> +{
> + return map_domain_page(_mfn(paddr_to_pfn(maddr)));
maddr_to_mfn() drops the _mfn() wrapper. u64 wants to become paddr_t.
Otherwise, Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>. I can
fix up when queueing.
~Andrew
On 22.10.2025 11:51, Teddy Astie wrote: > These functions are basically wrappers of map_domain_page; Given this, ... > move > them to the shared extern.h and make them inline to help with code > generation. ... rather than moving can't we just drop them? Jan
Le 22/10/2025 à 12:28, Jan Beulich a écrit : > On 22.10.2025 11:51, Teddy Astie wrote: >> These functions are basically wrappers of map_domain_page; > > Given this, ... > >> move >> them to the shared extern.h and make them inline to help with code >> generation. > > ... rather than moving can't we just drop them? > That would be better, but that's a larger set of changes (map_vtd_domain_page uses maddr instead of mfn). Ideally, we would want to change the code to use mfn directly and avoid converting all around between mfn and maddr when refering to pages. > Jan -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
© 2016 - 2025 Red Hat, Inc.