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@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Oleksii Kurochko authored and Jan Beulich committed 2026-09-30 15:00:25 +02:00
1 parent f9194b586b
commit 1043866f84
4 files changed
+49

No files matched your search

+2
View File
@@ -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
+7
View File
@@ -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;
}
+28
View File
@@ -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;
}
+12
View File
@@ -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 */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.