|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/riscv: add initial dom0less infrastructure support
commit 1043866f84f36fa0016d8c0dff20d8daa478bb75
Author: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
AuthorDate: Wed Sep 23 12:26:49 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Sep 30 15:00:25 2026 +0200
xen/riscv: add initial dom0less infrastructure support
Enable dom0less support for RISC-V by selecting HAS_DOM0LESS and
providing the minimal architecture hooks required by the common
dom0less infrastructure.
Add stub implementations for architecture-specific helpers used when
building domains from the device tree. These allow the generic
dom0less code to build and let a basic DomU be constructed on RISC-V.
construct_hwdom() and make_hypervisor_node() are still stubs returning
an error: Dom0/hwdom construction isn't supported yet, and the
hypervisor node generation (needed by domains with
DOM0LESS_ENHANCED_NO_XS set) is not implemented. Both are marked with
a TODO and are not reached by the currently supported configurations.
Provide missing helpers and definitions required by the domain
construction code, including domain bitness helpers and the
p2m_set_allocation() prototype.
Additionally define the guest magic memory region (GUEST_MAGIC_BASE /
GUEST_MAGIC_SIZE) in asm/guest-layout.h. The base is arbitrary; the
only constraint is that the region must not overlap guest RAM or the
emulated device regions. It is placed in the unused gap below
GUEST_RAM0_BASE (0x80000000); the constraints are documented next to
the #define-s.
A separate region for grant tables will be introduced at the same time as
the introduction of the grant table for RISC-V.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/riscv/Kconfig | 2 ++
xen/arch/riscv/dom0less-build.c | 7 +++++++
xen/arch/riscv/domain-build.c | 28 ++++++++++++++++++++++++++++
xen/arch/riscv/include/asm/guest-layout.h | 12 ++++++++++++
4 files changed, 49 insertions(+)
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 48520588fe..d8a348c0cf 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -6,6 +6,8 @@ config RISCV
select GENERIC_BUG_FRAME
select GENERIC_UART_INIT
select HAS_DEVICE_TREE_DISCOVERY
+ select HAS_DOM0LESS
+ select HAS_DOMAIN_TYPE
select HAS_EX_TABLE
select HAS_PMAP
select HAS_UBSAN
diff --git a/xen/arch/riscv/dom0less-build.c b/xen/arch/riscv/dom0less-build.c
index d1a51b9293..0801d7e250 100644
--- a/xen/arch/riscv/dom0less-build.c
+++ b/xen/arch/riscv/dom0less-build.c
@@ -102,3 +102,10 @@ int __init arch_parse_dom0less_node(struct dt_device_node
*node,
return 0;
}
+
+int __init arch_handle_passthrough_prop(struct kernel_info *kinfo,
+ struct dt_device_node *node)
+{
+ /* Nothing specific to do for now */
+ return 0;
+}
diff --git a/xen/arch/riscv/domain-build.c b/xen/arch/riscv/domain-build.c
index d7613721db..1e3abe259c 100644
--- a/xen/arch/riscv/domain-build.c
+++ b/xen/arch/riscv/domain-build.c
@@ -156,9 +156,37 @@ int __init make_cpus_node(const struct domain *d, struct
kernel_info *kinfo)
return fdt_end_node(fdt);
}
+int __init construct_hwdom(struct kernel_info *kinfo,
+ const struct dt_device_node *node)
+{
+ /*
+ * TODO: Dom0/hwdom construction isn't supported on RISC-V yet, so this
+ * is a stub returning an error. It must be implemented before a hardware
+ * domain can be built from the device tree.
+ */
+
+ return -EOPNOTSUPP;
+}
+
int __init make_timer_node(const struct kernel_info *kinfo)
{
/* There is no need for timer node for RISC-V. */
return 0;
}
+
+int __init make_hypervisor_node(struct domain *d,
+ const struct kernel_info *kinfo,
+ int addrcells, int sizecells)
+{
+ /*
+ * TODO: Generating the hypervisor node isn't implemented yet. Returning
+ * an error here breaks building of any domain (DomU included) whose
+ * dom0less_feature has DOM0LESS_ENHANCED_NO_XS set. This is harmless for
+ * now because Dom0/hwdom construction isn't supported on RISC-V yet
+ * either, and no RISC-V DomU sets that flag, so this path is never taken.
+ * It must be implemented before DOM0LESS_ENHANCED_NO_XS is used.
+ */
+
+ return -EOPNOTSUPP;
+}
diff --git a/xen/arch/riscv/include/asm/guest-layout.h
b/xen/arch/riscv/include/asm/guest-layout.h
index 90603f06bb..ceed9125e7 100644
--- a/xen/arch/riscv/include/asm/guest-layout.h
+++ b/xen/arch/riscv/include/asm/guest-layout.h
@@ -32,4 +32,16 @@
#define GUEST_RAM_BANK_BASES { GUEST_RAM0_BASE, GUEST_RAM1_BASE }
#define GUEST_RAM_BANK_SIZES { GUEST_RAM0_SIZE, GUEST_RAM1_SIZE }
+/*
+ * The guest magic region holds the Xen-reserved pages mapped into the
+ * guest's physical address space. The only real constraint on
+ * GUEST_MAGIC_BASE/SIZE is that the region must not overlap guest RAM
+ * (the GUEST_RAMx banks) or the emulated device regions defined above;
+ * the exact base is otherwise arbitrary. Here it is placed in the unused gap
+ * below GUEST_RAM0_BASE (0x80000000), but a hole after a RAM bank would work
+ * equally well.
+ */
+#define GUEST_MAGIC_BASE _UL(0x79000000)
+#define GUEST_MAGIC_SIZE _UL(0x00200000)
+
#endif /* ASM_RISCV_GUEST_LAYOUT_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |