*/
#include <xen/compile.h>
+#include <xen/fdt-kernel.h>
#include <xen/mm.h>
#include <xen/sched.h>
#include <xen/acpi.h>
#include <xen/device_tree.h>
#include <xen/libfdt/libfdt.h>
#include <acpi/actables.h>
-#include <asm/kernel.h>
#include <asm/domain_build.h>
/* Override macros from asm/page.h to make them work with mfn_t */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <xen/device_tree.h>
#include <xen/domain_page.h>
+#include <xen/fdt-kernel.h>
#include <xen/err.h>
#include <xen/event.h>
#include <xen/grant_table.h>
if (res)
return res;
- res = fdt_property_cell(fdt, "linux,phandle", kinfo->phandle_gic);
+ res = fdt_property_cell(fdt, "linux,phandle", kinfo->phandle_intc);
if (res)
return res;
- res = fdt_property_cell(fdt, "phandle", kinfo->phandle_gic);
+ res = fdt_property_cell(fdt, "phandle", kinfo->phandle_intc);
if (res)
return res;
if (res)
return res;
- res = fdt_property_cell(fdt, "linux,phandle", kinfo->phandle_gic);
+ res = fdt_property_cell(fdt, "linux,phandle", kinfo->phandle_intc);
if (res)
return res;
- res = fdt_property_cell(fdt, "phandle", kinfo->phandle_gic);
+ res = fdt_property_cell(fdt, "phandle", kinfo->phandle_intc);
if (res)
return res;
return res;
res = fdt_property_cell(fdt, "interrupt-parent",
- kinfo->phandle_gic);
+ kinfo->phandle_intc);
if ( res )
return res;
*/
if ( dt_node_cmp(name, "gic") == 0 )
{
- uint32_t phandle_gic = fdt_get_phandle(pfdt, node_next);
+ uint32_t phandle_intc = fdt_get_phandle(pfdt, node_next);
- if ( phandle_gic != 0 )
- kinfo->phandle_gic = phandle_gic;
+ if ( phandle_intc != 0 )
+ kinfo->phandle_intc = phandle_intc;
continue;
}
int addrcells, sizecells;
int ret, fdt_size = DOMU_DTB_SIZE;
- kinfo->phandle_gic = GUEST_PHANDLE_GIC;
+ kinfo->phandle_intc = GUEST_PHANDLE_GIC;
kinfo->gnttab_start = GUEST_GNTTAB_BASE;
kinfo->gnttab_size = GUEST_GNTTAB_SIZE;
/*
* domain_handle_dtb_bootmodule has to be called before the rest of
* the device tree is generated because it depends on the value of
- * the field phandle_gic.
+ * the field phandle_intc.
*/
if ( kinfo->dtb_bootmodule )
{
if ( ret )
goto err;
- if ( kinfo->vpl011 )
+ if ( kinfo->arch.vpl011 )
{
ret = -EINVAL;
#ifdef CONFIG_SBSA_VUART_CONSOLE
printk("*** LOADING DOMU cpus=%u memory=%#"PRIx64"KB ***\n",
d->max_vcpus, mem);
- kinfo.vpl011 = dt_property_read_bool(node, "vpl011");
- if ( kinfo.vpl011 && is_hardware_domain(d) )
+ kinfo.arch.vpl011 = dt_property_read_bool(node, "vpl011");
+ if ( kinfo.arch.vpl011 && is_hardware_domain(d) )
panic("hardware domain cannot specify vpl011\n");
rc = dt_property_read_string(node, "xen,enhanced", &dom0less_enhanced);
#ifdef CONFIG_ARM_64
/* type must be set before allocate memory */
- d->arch.type = kinfo.type;
+ d->arch.type = kinfo.arch.type;
#endif
if ( is_hardware_domain(d) )
{
* tree node in prepare_dtb_domU, so initialization on related variables
* shall be done first.
*/
- if ( kinfo.vpl011 )
+ if ( kinfo.arch.vpl011 )
{
rc = domain_vpl011_init(d, NULL);
if ( rc < 0 )
/* SPDX-License-Identifier: GPL-2.0-only */
#include <xen/init.h>
#include <xen/compile.h>
+#include <xen/fdt-kernel.h>
#include <xen/lib.h>
#include <xen/llc-coloring.h>
#include <xen/mm.h>
#include <xen/vmap.h>
#include <xen/warning.h>
#include <asm/device.h>
-#include <asm/kernel.h>
#include <asm/setup.h>
#include <asm/tee/tee.h>
#include <asm/pci.h>
return res;
res = fdt_property_cell(kinfo->fdt, "interrupt-parent",
- kinfo->phandle_gic);
+ kinfo->phandle_intc);
return res;
}
ASSERT(dt_host && (dt_host->sibling == NULL));
- kinfo->phandle_gic = dt_interrupt_controller->phandle;
+ kinfo->phandle_intc = dt_interrupt_controller->phandle;
fdt = device_tree_flattened;
new_size = fdt_totalsize(fdt) + DOM0_FDT_EXTRA_SIZE;
#ifdef CONFIG_ARM_64
/* if aarch32 mode is not supported at EL1 do not allow 32-bit domain */
- if ( !(cpu_has_el1_32) && kinfo->type == DOMAIN_32BIT )
+ if ( !(cpu_has_el1_32) && kinfo->arch.type == DOMAIN_32BIT )
{
printk("Platform does not support 32-bit domain\n");
return -EINVAL;
}
- if ( is_sve_domain(d) && (kinfo->type == DOMAIN_32BIT) )
+ if ( is_sve_domain(d) && (kinfo->arch.type == DOMAIN_32BIT) )
{
printk("SVE is not available for 32-bit domain\n");
return -EINVAL;
#ifdef CONFIG_ARM_64
/* type must be set before allocate_memory */
- d->arch.type = kinfo->type;
+ d->arch.type = kinfo->arch.type;
#endif
find_gnttab_region(d, kinfo);
if ( is_domain_direct_mapped(d) )
#ifndef __ASM_DOMAIN_BUILD_H__
#define __ASM_DOMAIN_BUILD_H__
+#include <xen/fdt-kernel.h>
#include <xen/sched.h>
-#include <asm/kernel.h>
typedef __be32 gic_interrupt_t[3];
typedef bool (*alloc_domheap_mem_cb)(struct domain *d, struct page_info *pg,
#ifndef __ARCH_ARM_KERNEL_H__
#define __ARCH_ARM_KERNEL_H__
-#include <xen/device_tree.h>
#include <asm/domain.h>
-#include <asm/setup.h>
-/*
- * List of possible features for dom0less domUs
- *
- * DOM0LESS_ENHANCED_NO_XS: Notify the OS it is running on top of Xen. All the
- * default features (excluding Xenstore) will be
- * available. Note that an OS *must* not rely on the
- * availability of Xen features if this is not set.
- * DOM0LESS_XENSTORE: Xenstore will be enabled for the VM. The
- * xenstore page allocation is done by Xen at
- * domain creation. This feature can't be
- * enabled without the DOM0LESS_ENHANCED_NO_XS.
- * DOM0LESS_XS_LEGACY Xenstore will be enabled for the VM, the
- * xenstore page allocation will happen in
- * init-dom0less. This feature can't be enabled
- * without the DOM0LESS_ENHANCED_NO_XS.
- * DOM0LESS_ENHANCED: Notify the OS it is running on top of Xen. All the
- * default features (including Xenstore) will be
- * available. Note that an OS *must* not rely on the
- * availability of Xen features if this is not set.
- * DOM0LESS_ENHANCED_LEGACY: Same as before, but using DOM0LESS_XS_LEGACY.
- */
-#define DOM0LESS_ENHANCED_NO_XS BIT(0, U)
-#define DOM0LESS_XENSTORE BIT(1, U)
-#define DOM0LESS_XS_LEGACY BIT(2, U)
-#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XS_LEGACY)
-#define DOM0LESS_ENHANCED (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENSTORE)
-
-struct kernel_info {
+struct arch_kernel_info
+{
#ifdef CONFIG_ARM_64
enum domain_type type;
#endif
- struct domain *d;
-
- void *fdt; /* flat device tree */
- paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
- struct meminfo mem;
-#ifdef CONFIG_STATIC_SHM
- struct shared_meminfo shm_mem;
-#endif
-
- /* kernel entry point */
- paddr_t entry;
-
- /* grant table region */
- paddr_t gnttab_start;
- paddr_t gnttab_size;
-
- /* boot blob load addresses */
- const struct bootmodule *kernel_bootmodule, *initrd_bootmodule, *dtb_bootmodule;
- const char* cmdline;
- paddr_t dtb_paddr;
- paddr_t initrd_paddr;
-
/* Enable pl011 emulation */
bool vpl011;
-
- /* Enable/Disable PV drivers interfaces */
- uint16_t dom0less_feature;
-
- /* GIC phandle */
- uint32_t phandle_gic;
-
- /* loader to use for this kernel */
- void (*load)(struct kernel_info *info);
- /* loader specific state */
- union {
- struct {
- paddr_t kernel_addr;
- paddr_t len;
-#ifdef CONFIG_ARM_64
- paddr_t text_offset; /* 64-bit Image only */
-#endif
- paddr_t start; /* Must be 0 for 64-bit Image */
- } zimage;
- };
};
-static inline struct membanks *kernel_info_get_mem(struct kernel_info *kinfo)
-{
- return container_of(&kinfo->mem.common, struct membanks, common);
-}
-
-static inline const struct membanks *
-kernel_info_get_mem_const(const struct kernel_info *kinfo)
-{
- return container_of(&kinfo->mem.common, const struct membanks, common);
-}
-
-#ifdef CONFIG_STATIC_SHM
-#define KERNEL_INFO_SHM_MEM_INIT \
- .shm_mem.common.max_banks = NR_SHMEM_BANKS, \
- .shm_mem.common.type = STATIC_SHARED_MEMORY,
-#else
-#define KERNEL_INFO_SHM_MEM_INIT
-#endif
-
-#define KERNEL_INFO_INIT \
-{ \
- .mem.common.max_banks = NR_MEM_BANKS, \
- .mem.common.type = MEMORY, \
- KERNEL_INFO_SHM_MEM_INIT \
-}
-
-/*
- * Probe the kernel to detemine its type and select a loader.
- *
- * Sets in info:
- * ->type
- * ->load hook, and sets loader specific variables ->zimage
- */
-int kernel_probe(struct kernel_info *info, const struct dt_device_node *domain);
-
-/*
- * Loads the kernel into guest RAM.
- *
- * Expects to be set in info when called:
- * ->mem
- * ->fdt
- *
- * Sets in info:
- * ->entry
- * ->dtb_paddr
- * ->initrd_paddr
- */
-void kernel_load(struct kernel_info *info);
-
#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */
/*
#ifndef __ASM_STATIC_MEMORY_H_
#define __ASM_STATIC_MEMORY_H_
+#include <xen/fdt-kernel.h>
#include <xen/pfn.h>
-#include <asm/kernel.h>
#ifdef CONFIG_STATIC_MEMORY
#ifndef __ASM_STATIC_SHMEM_H_
#define __ASM_STATIC_SHMEM_H_
+#include <xen/fdt-kernel.h>
#include <xen/types.h>
-#include <asm/kernel.h>
#include <asm/setup.h>
#ifdef CONFIG_STATIC_SHM
#include <xen/byteorder.h>
#include <xen/domain_page.h>
#include <xen/errno.h>
+#include <xen/fdt-kernel.h>
#include <xen/guest_access.h>
#include <xen/gunzip.h>
#include <xen/init.h>
#include <xen/sched.h>
#include <xen/vmap.h>
-#include <asm/kernel.h>
+#include <asm/domain_build.h>
#include <asm/setup.h>
#define UIMAGE_MAGIC 0x27051956
paddr_t load_addr;
#ifdef CONFIG_ARM_64
- if ( (info->type == DOMAIN_64BIT) && (info->zimage.start == 0) )
+ if ( (info->arch.type == DOMAIN_64BIT) && (info->zimage.start == 0) )
return mem->bank[0].start + info->zimage.text_offset;
#endif
switch ( uimage.arch )
{
case IH_ARCH_ARM:
- info->type = DOMAIN_32BIT;
+ info->arch.type = DOMAIN_32BIT;
break;
case IH_ARCH_ARM64:
- info->type = DOMAIN_64BIT;
+ info->arch.type = DOMAIN_64BIT;
break;
default:
printk(XENLOG_ERR "Unsupported uImage arch type %d\n", uimage.arch);
info->load = kernel_zimage_load;
- info->type = DOMAIN_64BIT;
+ info->arch.type = DOMAIN_64BIT;
return 0;
}
info->load = kernel_zimage_load;
#ifdef CONFIG_ARM_64
- info->type = DOMAIN_32BIT;
+ info->arch.type = DOMAIN_32BIT;
#endif
return 0;
#include <xen/sched.h>
+#include <asm/setup.h>
#include <asm/static-memory.h>
static bool __init append_static_memory_to_bank(struct domain *d,
#include <xen/sched.h>
#include <asm/domain_build.h>
+#include <asm/setup.h>
#include <asm/static-memory.h>
#include <asm/static-shmem.h>
* Written by Vikram Garhwal <vikram.garhwal@amd.com>
*
*/
-#include <asm/domain_build.h>
#include <xen/dt-overlay.h>
+#include <xen/fdt-kernel.h>
#include <xen/guest_access.h>
#include <xen/iocap.h>
#include <xen/libfdt/libfdt.h>
#define XENSTORE_PFN_LATE_ALLOC UINT64_MAX
extern bool need_xenstore;
+/*
+ * List of possible features for dom0less domUs
+ *
+ * DOM0LESS_ENHANCED_NO_XS: Notify the OS it is running on top of Xen. All the
+ * default features (excluding Xenstore) will be
+ * available. Note that an OS *must* not rely on the
+ * availability of Xen features if this is not set.
+ * DOM0LESS_XENSTORE: Xenstore will be enabled for the VM. The
+ * xenstore page allocation is done by Xen at
+ * domain creation. This feature can't be
+ * enabled without the DOM0LESS_ENHANCED_NO_XS.
+ * DOM0LESS_XS_LEGACY Xenstore will be enabled for the VM, the
+ * xenstore page allocation will happen in
+ * init-dom0less. This feature can't be enabled
+ * without the DOM0LESS_ENHANCED_NO_XS.
+ * DOM0LESS_ENHANCED: Notify the OS it is running on top of Xen. All the
+ * default features (including Xenstore) will be
+ * available. Note that an OS *must* not rely on the
+ * availability of Xen features if this is not set.
+ * DOM0LESS_ENHANCED_LEGACY: Same as before, but using DOM0LESS_XS_LEGACY.
+
+ */
+#define DOM0LESS_ENHANCED_NO_XS BIT(0, U)
+#define DOM0LESS_XENSTORE BIT(1, U)
+#define DOM0LESS_XS_LEGACY BIT(2, U)
+#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XS_LEGACY)
+#define DOM0LESS_ENHANCED (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENSTORE)
+
void create_domUs(void);
bool is_dom0less_mode(void);
void set_xs_domain(struct domain *d);
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * For Kernel image loading.
+ *
+ * Copyright (C) 2011 Citrix Systems, Inc.
+ */
+#ifndef __XEN_FDT_KERNEL_H__
+#define __XEN_FDT_KERNEL_H__
+
+#include <xen/bootfdt.h>
+#include <xen/device_tree.h>
+#include <xen/types.h>
+
+#if __has_include(<asm/kernel.h>)
+# include <asm/kernel.h>
+#endif
+
+struct kernel_info {
+ struct domain *d;
+
+ void *fdt; /* flat device tree */
+ paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
+ struct meminfo mem;
+#ifdef CONFIG_STATIC_SHM
+ struct shared_meminfo shm_mem;
+#endif
+
+ /* kernel entry point */
+ paddr_t entry;
+
+ /* grant table region */
+ paddr_t gnttab_start;
+ paddr_t gnttab_size;
+
+ /* boot blob load addresses */
+ const struct bootmodule *kernel_bootmodule, *initrd_bootmodule, *dtb_bootmodule;
+ const char* cmdline;
+ paddr_t dtb_paddr;
+ paddr_t initrd_paddr;
+
+ /* Enable/Disable PV drivers interfaces */
+ uint16_t dom0less_feature;
+
+ /* Interrupt controller phandle */
+ uint32_t phandle_intc;
+
+ /* loader to use for this kernel */
+ void (*load)(struct kernel_info *info);
+
+ /* loader specific state */
+ union {
+ struct {
+ paddr_t kernel_addr;
+ paddr_t len;
+#if defined(CONFIG_ARM_64) || defined(CONFIG_RISCV_64)
+ paddr_t text_offset; /* 64-bit Image only */
+#endif
+ paddr_t start; /* Must be 0 for 64-bit Image */
+ } zimage;
+ };
+
+#if __has_include(<asm/kernel.h>)
+ struct arch_kernel_info arch;
+#endif
+};
+
+static inline struct membanks *kernel_info_get_mem(struct kernel_info *kinfo)
+{
+ return container_of(&kinfo->mem.common, struct membanks, common);
+}
+
+static inline const struct membanks *
+kernel_info_get_mem_const(const struct kernel_info *kinfo)
+{
+ return container_of(&kinfo->mem.common, const struct membanks, common);
+}
+
+#ifndef KERNEL_INFO_SHM_MEM_INIT
+
+#ifdef CONFIG_STATIC_SHM
+#define KERNEL_INFO_SHM_MEM_INIT \
+ .shm_mem.common.max_banks = NR_SHMEM_BANKS, \
+ .shm_mem.common.type = STATIC_SHARED_MEMORY,
+#else
+#define KERNEL_INFO_SHM_MEM_INIT
+#endif
+
+#endif /* KERNEL_INFO_SHM_MEM_INIT */
+
+#ifndef KERNEL_INFO_INIT
+
+#define KERNEL_INFO_INIT \
+{ \
+ .mem.common.max_banks = NR_MEM_BANKS, \
+ .mem.common.type = MEMORY, \
+ KERNEL_INFO_SHM_MEM_INIT \
+}
+
+#endif /* KERNEL_INFO_INIT */
+
+/*
+ * Probe the kernel to detemine its type and select a loader.
+ *
+ * Sets in info:
+ * ->load hook, and sets loader specific variables ->zimage
+ */
+int kernel_probe(struct kernel_info *info, const struct dt_device_node *domain);
+
+/*
+ * Loads the kernel into guest RAM.
+ *
+ * Expects to be set in info when called:
+ * ->mem
+ * ->fdt
+ *
+ * Sets in info:
+ * ->entry
+ * ->dtb_paddr
+ * ->initrd_paddr
+ */
+void kernel_load(struct kernel_info *info);
+
+#endif /* __XEN_FDT_KERNEL_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */