[PATCH 1/2] xen: Add dependency on armv8

Xen core calls HYPERVISOR_memory_op() in map_shared_info() which is just in xen_init() called from init_sequence_r[].
Xen can run only on armv8 where HVC calls are implemented that's why enable it only for arm64.
Signed-off-by: Michal Simek michal.simek@amd.com ---
Depends on https://lore.kernel.org/r/1bc97e93ae35da1dba0643845e09b03c1e666cf5.168076824... --- Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/Kconfig b/Kconfig index d18a13c923f4..27cdf57527f1 100644 --- a/Kconfig +++ b/Kconfig @@ -175,6 +175,7 @@ config CC_HAS_ASM_INLINE
config XEN bool "Select U-Boot be run as a bootloader for XEN Virtual Machine" + depends on ARM64 select SSCANF help Enabling this option will make U-Boot be run as a bootloader

Xen core_init() is calling HVC which should be called from EL1 level that's why do Xen initialization only when U-Boot runs in EL1.
Signed-off-by: Michal Simek michal.simek@amd.com ---
drivers/xen/hypervisor.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/drivers/xen/hypervisor.c b/drivers/xen/hypervisor.c index 16c7c96c94e0..0b2311ba2675 100644 --- a/drivers/xen/hypervisor.c +++ b/drivers/xen/hypervisor.c @@ -264,8 +264,15 @@ void clear_evtchn(uint32_t port)
int xen_init(void) { + int el = current_el(); + debug("%s\n", __func__);
+ if (el != 1) { + puts("XEN:\tnot running from EL1\n"); + return 0; + } + map_shared_info(NULL); init_events(); init_xenbus();

On 4/11/23 13:23, Michal Simek wrote:
Xen core calls HYPERVISOR_memory_op() in map_shared_info() which is just in xen_init() called from init_sequence_r[].
Xen can run only on armv8 where HVC calls are implemented that's why enable it only for arm64.
Doesn't ARMv7a also support HYP mode ?

On 4/12/23 06:57, Marek Vasut wrote:
On 4/11/23 13:23, Michal Simek wrote:
Xen core calls HYPERVISOR_memory_op() in map_shared_info() which is just in xen_init() called from init_sequence_r[].
Xen can run only on armv8 where HVC calls are implemented that's why enable it only for arm64.
Doesn't ARMv7a also support HYP mode ?
Xen code in U-Boot is wired via HYPERVISOR_* functions which are wired only for armv8.
arch/arm/cpu/armv8/xen/hypercall.S:56:.globl HYPERVISOR_##hypercall; \ arch/arm/cpu/armv8/xen/hypercall.S:58:HYPERVISOR_##hypercall: \ arch/arm/cpu/armv8/xen/hypercall.S:59: mov x16, #__HYPERVISOR_##hypercall; \
M

On 4/12/23 09:10, Michal Simek wrote:
On 4/12/23 06:57, Marek Vasut wrote:
On 4/11/23 13:23, Michal Simek wrote:
Xen core calls HYPERVISOR_memory_op() in map_shared_info() which is just in xen_init() called from init_sequence_r[].
Xen can run only on armv8 where HVC calls are implemented that's why enable it only for arm64.
Doesn't ARMv7a also support HYP mode ?
Xen code in U-Boot is wired via HYPERVISOR_* functions which are wired only for armv8.
This should go into the commit message ^ as this is useful information.
arch/arm/cpu/armv8/xen/hypercall.S:56:.globl HYPERVISOR_##hypercall; \ arch/arm/cpu/armv8/xen/hypercall.S:58:HYPERVISOR_##hypercall: \ arch/arm/cpu/armv8/xen/hypercall.S:59: mov x16, #__HYPERVISOR_##hypercall; \
The commit message should be updated to something like 'U-Boot currently implements ... <functionality> ... only for ARM64, add dependency on ARM64. The hardware functionality is also available on ARMv7a, but currently not supported by U-Boot, hence it is not added to the list of dependencies here.'
Basically don't say "armv8 where HVC calls are implemented" , because that can be misinterpreted as "only on armv8 hardware which implements the HVC extensions".
Or something like that, adjust as you see fit.
participants (2)
-
Marek Vasut
-
Michal Simek