Message ID | 1e4f48d753871bf61de3af97a3009e069d25d01e.1702607884.git.sanastasio@raptorengineering.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Early Boot Allocation on Power | expand |
On 15.12.2023 03:43, Shawn Anastasio wrote: > Introduce setup.h to asm-generic based off of ARM's to define all > stubs necessary to compile bootfdt.c And - I'm sorry to ask - how's that "generic"? I'm also not convinced at all that a generic header can validly use BUG() in the way you propose. Some of these go far beyond what presently we have in e.g. altp2m_vcpu_idx(). Jan
On 15.12.2023 03:43, Shawn Anastasio wrote: > Introduce setup.h to asm-generic based off of ARM's to define all > stubs necessary to compile bootfdt.c > > Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> > --- > xen/arch/ppc/include/asm/Makefile | 1 + > xen/arch/ppc/include/asm/setup.h | 6 -- > xen/include/asm-generic/setup.h | 148 ++++++++++++++++++++++++++++++ > 3 files changed, 149 insertions(+), 6 deletions(-) > delete mode 100644 xen/arch/ppc/include/asm/setup.h > create mode 100644 xen/include/asm-generic/setup.h > > diff --git a/xen/arch/ppc/include/asm/Makefile b/xen/arch/ppc/include/asm/Makefile > index a711cfa856..7167661f86 100644 > --- a/xen/arch/ppc/include/asm/Makefile > +++ b/xen/arch/ppc/include/asm/Makefile > @@ -6,5 +6,6 @@ generic-y += iocap.h > generic-y += paging.h > generic-y += percpu.h > generic-y += random.h > +generic-y += setup.h > generic-y += static-shmem.h > generic-y += vm_event.h Looking at patch 5, you undo this there. Why introduce it in the first place then? And why leave a stale (unused) file around there? Jan
Hi Jan, On 12/20/23 5:09 AM, Jan Beulich wrote: > On 15.12.2023 03:43, Shawn Anastasio wrote: >> Introduce setup.h to asm-generic based off of ARM's to define all >> stubs necessary to compile bootfdt.c >> >> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> >> --- >> xen/arch/ppc/include/asm/Makefile | 1 + >> xen/arch/ppc/include/asm/setup.h | 6 -- >> xen/include/asm-generic/setup.h | 148 ++++++++++++++++++++++++++++++ >> 3 files changed, 149 insertions(+), 6 deletions(-) >> delete mode 100644 xen/arch/ppc/include/asm/setup.h >> create mode 100644 xen/include/asm-generic/setup.h >> >> diff --git a/xen/arch/ppc/include/asm/Makefile b/xen/arch/ppc/include/asm/Makefile >> index a711cfa856..7167661f86 100644 >> --- a/xen/arch/ppc/include/asm/Makefile >> +++ b/xen/arch/ppc/include/asm/Makefile >> @@ -6,5 +6,6 @@ generic-y += iocap.h >> generic-y += paging.h >> generic-y += percpu.h >> generic-y += random.h >> +generic-y += setup.h >> generic-y += static-shmem.h >> generic-y += vm_event.h > > Looking at patch 5, you undo this there. Why introduce it in the first place > then? And why leave a stale (unused) file around there? > The intent was to leave the file around for RISC-V, since now xen/common won't build when CONFIG_HAS_DEVICE tree is set unless these headers are available with sufficient definitions. Given your earlier comment about these not being exactly generic (which I agree with, they are closer to stubs if anything), I suppose I'll just drop both of these headers going forward and let RISC-V handle the new changes required to get common/ building. > Jan Thanks, Shawn
diff --git a/xen/arch/ppc/include/asm/Makefile b/xen/arch/ppc/include/asm/Makefile index a711cfa856..7167661f86 100644 --- a/xen/arch/ppc/include/asm/Makefile +++ b/xen/arch/ppc/include/asm/Makefile @@ -6,5 +6,6 @@ generic-y += iocap.h generic-y += paging.h generic-y += percpu.h generic-y += random.h +generic-y += setup.h generic-y += static-shmem.h generic-y += vm_event.h diff --git a/xen/arch/ppc/include/asm/setup.h b/xen/arch/ppc/include/asm/setup.h deleted file mode 100644 index e4f64879b6..0000000000 --- a/xen/arch/ppc/include/asm/setup.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_PPC_SETUP_H__ -#define __ASM_PPC_SETUP_H__ - -#define max_init_domid (0) - -#endif /* __ASM_PPC_SETUP_H__ */ diff --git a/xen/include/asm-generic/setup.h b/xen/include/asm-generic/setup.h new file mode 100644 index 0000000000..0262ad49f9 --- /dev/null +++ b/xen/include/asm-generic/setup.h @@ -0,0 +1,148 @@ +#ifndef __ASM_GENERIC_SETUP_H__ +#define __ASM_GENERIC_SETUP_H__ + +#define max_init_domid (0) + +#include <xen/bug.h> + +#include <public/version.h> +#include <asm/p2m.h> +#include <xen/device_tree.h> + +#define MIN_FDT_ALIGN 8 +#define MAX_FDT_SIZE SZ_2M + +#define NR_MEM_BANKS 256 + +#define MAX_MODULES 32 /* Current maximum useful modules */ + +typedef enum { + BOOTMOD_XEN, + BOOTMOD_FDT, + BOOTMOD_KERNEL, + BOOTMOD_RAMDISK, + BOOTMOD_XSM, + BOOTMOD_GUEST_DTB, + BOOTMOD_UNKNOWN +} bootmodule_kind; + +enum membank_type { + /* + * The MEMBANK_DEFAULT type refers to either reserved memory for the + * device/firmware (when the bank is in 'reserved_mem') or any RAM (when + * the bank is in 'mem'). + */ + MEMBANK_DEFAULT, + /* + * The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memory + * bank is bound to a static Xen domain. It is only valid when the bank + * is in reserved_mem. + */ + MEMBANK_STATIC_DOMAIN, + /* + * The MEMBANK_STATIC_HEAP type is used to indicate whether the memory + * bank is reserved as static heap. It is only valid when the bank is + * in reserved_mem. + */ + MEMBANK_STATIC_HEAP, +}; + +/* Indicates the maximum number of characters(\0 included) for shm_id */ +#define MAX_SHM_ID_LENGTH 16 + +struct membank { + paddr_t start; + paddr_t size; + enum membank_type type; +}; + +struct meminfo { + unsigned int nr_banks; + struct membank bank[NR_MEM_BANKS]; +}; + +/* + * The domU flag is set for kernels and ramdisks of "xen,domain" nodes. + * The purpose of the domU flag is to avoid getting confused in + * kernel_probe, where we try to guess which is the dom0 kernel and + * initrd to be compatible with all versions of the multiboot spec. + */ +#define BOOTMOD_MAX_CMDLINE 1024 +struct bootmodule { + bootmodule_kind kind; + bool domU; + paddr_t start; + paddr_t size; +}; + +/* DT_MAX_NAME is the node name max length according the DT spec */ +#define DT_MAX_NAME 41 +struct bootcmdline { + bootmodule_kind kind; + bool domU; + paddr_t start; + char dt_name[DT_MAX_NAME]; + char cmdline[BOOTMOD_MAX_CMDLINE]; +}; + +struct bootmodules { + int nr_mods; + struct bootmodule module[MAX_MODULES]; +}; + +struct bootcmdlines { + unsigned int nr_mods; + struct bootcmdline cmdline[MAX_MODULES]; +}; + +struct bootinfo { + struct meminfo mem; + struct meminfo reserved_mem; + struct bootmodules modules; + struct bootcmdlines cmdlines; + bool static_heap; +}; + +extern struct bootinfo bootinfo; + +/* + * setup.c + */ + +static inline bool check_reserved_regions_overlap(paddr_t region_start, + paddr_t region_size) +{ + /* Not implemented on GENERIC */ + BUG(); +} + +static inline struct bootmodule *add_boot_module(bootmodule_kind kind, + paddr_t start, paddr_t size, + bool domU) +{ + /* Not implemented on GENERIC */ + BUG(); +} + +static inline void add_boot_cmdline(const char *name, const char *cmdline, + bootmodule_kind kind, paddr_t start, + bool domU) +{ + /* Not implemented on GENERIC */ + BUG(); +} + +static inline const char *boot_module_kind_as_string(bootmodule_kind kind) +{ + /* Not implemented on GENERIC */ + BUG(); +} + +static inline struct bootcmdline *boot_cmdline_find_by_kind( + bootmodule_kind kind) +{ + /* Not implemented on GENERIC */ + BUG(); +} + +#endif /* __ASM_GENERIC_SETUP_H__ */
Introduce setup.h to asm-generic based off of ARM's to define all stubs necessary to compile bootfdt.c Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> --- xen/arch/ppc/include/asm/Makefile | 1 + xen/arch/ppc/include/asm/setup.h | 6 -- xen/include/asm-generic/setup.h | 148 ++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 6 deletions(-) delete mode 100644 xen/arch/ppc/include/asm/setup.h create mode 100644 xen/include/asm-generic/setup.h