[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/x86: move domain_clamp_alloc_bitsize() into pv32 code



commit c37bcb35f928c81cbeea7c05f86b6779f8a2b8c4
Author:     Grygorii Strashko <grygorii_strashko@xxxxxxxx>
AuthorDate: Thu Dec 18 10:00:34 2025 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Dec 18 10:04:55 2025 +0100

    xen/x86: move domain_clamp_alloc_bitsize() into pv32 code
    
    The d->arch.physaddr_bitsize field is used only by PV32 code so as the
    domain_clamp_alloc_bitsize() function.
    
    Hence move domain_clamp_alloc_bitsize() function into PV32 code and convert
    it to macro.
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/include/asm/mm.h | 11 +++++++++--
 xen/arch/x86/x86_64/mm.c      |  7 -------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 9438f5ea01..3fc678d32f 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -619,8 +619,15 @@ void __iomem *ioremap_wc(paddr_t pa, size_t len);
 
 extern int memory_add(unsigned long spfn, unsigned long epfn, unsigned int 
pxm);
 
-unsigned int domain_clamp_alloc_bitsize(struct domain *d, unsigned int bits);
-#define domain_clamp_alloc_bitsize(d, bits) domain_clamp_alloc_bitsize(d, bits)
+#ifdef CONFIG_PV32
+#define domain_clamp_alloc_bitsize(d, bits) ({                 \
+    const struct domain *_d = (d);                             \
+                                                               \
+    ((_d && _d->arch.physaddr_bitsize)                         \
+     ? min_t(unsigned int, _d->arch.physaddr_bitsize, bits)    \
+     : (bits));                                                \
+})
+#endif
 
 unsigned long domain_get_maximum_gpfn(struct domain *d);
 
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 42fd4fe4e9..8eadab7933 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -1119,13 +1119,6 @@ unmap:
     return ret;
 }
 
-unsigned int domain_clamp_alloc_bitsize(struct domain *d, unsigned int bits)
-{
-    if ( (d == NULL) || (d->arch.physaddr_bitsize == 0) )
-        return bits;
-    return min(d->arch.physaddr_bitsize, bits);
-}
-
 static int transfer_pages_to_heap(struct mem_hotadd_info *info)
 {
     unsigned long i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.