Skip to contentSkip to conversation

libs/guest: don't use unsigned long as type for PFNs

PATCH Superseded Juergen Gross 3 participants 3 messages Oct 5, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libs/guest: don't use unsigned long as type for PFNs

Declarations of xc_dom_console_init() and xc_dom_console_set_disconnected() in libxenguest.h don't match their implementation in the library.

Use xen_pfn_t for PFNs in the library to fix that.

Fixes b6fc307b0b00 ("libs/guest: Set console as disconnected on resume")
Fixes 971b7d5ecbcd ("libs/guest: Set console page to disconnected")
---
 tools/libs/guest/xg_dom_boot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/libs/guest/xg_dom_boot.c +3 -3
index f51b6a78c8..beeb4a7255 100644
@@ -430,7 +430,7 @@ int xc_dom_gnttab_init(struct xc_dom_image *dom)
 
 static int dom_console_init(xc_interface *xch,
                             uint32_t domid,
-                            unsigned long dst_pfn,
+                            xen_pfn_t dst_pfn,
                             bool clear)
 {
     const size_t size = PAGE_SIZE;
@@ -451,14 +451,14 @@ static int dom_console_init(xc_interface *xch,
 
 int xc_dom_console_init(xc_interface *xch,
                         uint32_t domid,
-                        unsigned long dst_pfn)
+                        xen_pfn_t dst_pfn)
 {
     return dom_console_init(xch, domid, dst_pfn, true);
 }
 
 int xc_dom_console_set_disconnected(xc_interface *xch,
                                     uint32_t domid,
-                                    unsigned long dst_pfn)
+                                    xen_pfn_t dst_pfn)
 {
     return dom_console_init(xch, domid, dst_pfn, false);
 }
Signature · 1 line
2.51.0
#1 lore raw
Quoted 3 lines · Juergen Gross

Declarations of xc_dom_console_init() and xc_dom_console_set_disconnected() in libxenguest.h don't match their implementation in the library.

"Under arm32, xen_pfn_t is a uint64_t and wider than unsigned long."

Quoted 7 lines

Use xen_pfn_t for PFNs in the library to fix that.

Fixes b6fc307b0b00 ("libs/guest: Set console as disconnected on resume")
Fixes 971b7d5ecbcd ("libs/guest: Set console page to disconnected")

For this patch, Reveiwed-by: Andrew Cooper <[email protected]>

However, another bug in these patches is the use of pfn.  gfn is the correct term to be using.

~Andrew

Tested-by on v1 1/1
#2 lore raw
In reply to Juergen Gross

Hi Jurgen,

Quoted 6 lines · Juergen Gross

Declarations of xc_dom_console_init() and xc_dom_console_set_disconnected() in libxenguest.h don't match their implementation in the library.

Quoted 6 lines

Use xen_pfn_t for PFNs in the library to fix that.

Fixes b6fc307b0b00 ("libs/guest: Set console as disconnected on resume")
Fixes 971b7d5ecbcd ("libs/guest: Set console page to disconnected")

Thanks for the quick patch, I’ve built the arm32 configuration and this solves the compilation issue.

Tested-by Luca Fancellu <[email protected] <mailto:[email protected]>>

Cheers,
Luca