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

[xen master] xen/arm: Conditional compilation of kernel_info.shm_mem member



commit e13499b3c479f217f9d1fe9a1afac78e16dba116
Author:     Luca Fancellu <luca.fancellu@xxxxxxx>
AuthorDate: Thu Apr 18 08:36:45 2024 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Wed Apr 24 19:13:35 2024 +0100

    xen/arm: Conditional compilation of kernel_info.shm_mem member
    
    The user of shm_mem member of the 'struct kernel_info' is only
    the code managing the static shared memory feature, which can be
    compiled out using CONFIG_STATIC_SHM, so in case the feature is
    not requested, that member won't be used and will waste memory
    space.
    
    To address this issue, protect the member with the Kconfig parameter
    and modify the signature of the only function using it to remove
    any reference to the member from outside the static-shmem module.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/include/asm/kernel.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/kernel.h 
b/xen/arch/arm/include/asm/kernel.h
index d46f29ee6c..eb3cb7809c 100644
--- a/xen/arch/arm/include/asm/kernel.h
+++ b/xen/arch/arm/include/asm/kernel.h
@@ -39,7 +39,9 @@ struct kernel_info {
     void *fdt; /* flat device tree */
     paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
     struct meminfo mem;
+#ifdef CONFIG_STATIC_SHM
     struct meminfo shm_mem;
+#endif
 
     /* kernel entry point */
     paddr_t entry;
@@ -80,10 +82,16 @@ struct kernel_info {
 
 #define kernel_info_get_mem(kinfo) (&(kinfo)->mem.common)
 
+#ifdef CONFIG_STATIC_SHM
+#define KERNEL_INFO_SHM_MEM_INIT .shm_mem.common.max_banks = NR_MEM_BANKS,
+#else
+#define KERNEL_INFO_SHM_MEM_INIT
+#endif
+
 #define KERNEL_INFO_INIT                        \
 {                                               \
     .mem.common.max_banks = NR_MEM_BANKS,       \
-    .shm_mem.common.max_banks = NR_MEM_BANKS,   \
+    KERNEL_INFO_SHM_MEM_INIT                    \
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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