mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
ARM/sysctl: Expose the supported guest GIC modes in physinfo
In preparation to simplify the domain creation logic surrounding GIC version. On a GICv3 host, also report support for GICv2-compatible guests when the hardware's vGICv2 compatibility mode is enabled, rather than just the native GIC version. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Julian Vetter <julian.vetter@vates.tech> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
7168cc02f8
commit
8673bedd76
5 files changed
+47
No files matched your search
@@ -433,6 +433,12 @@ unsigned int vgic_max_vcpus(unsigned int domctl_vgic_version);
|
||||
void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t csize,
|
||||
paddr_t vbase, uint32_t aliased_offset);
|
||||
|
||||
#ifdef CONFIG_VGICV2
|
||||
bool vgic_v2_hw_enabled(void);
|
||||
#else
|
||||
static inline bool vgic_v2_hw_enabled(void) { return false; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GICV3
|
||||
struct rdist_region;
|
||||
void vgic_v3_setup_hw(paddr_t dbase,
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
#include <xen/dt-overlay.h>
|
||||
#include <xen/errno.h>
|
||||
#include <xen/hypercall.h>
|
||||
|
||||
#include <asm/arm64/sve.h>
|
||||
#include <asm/gic.h>
|
||||
#include <asm/vgic.h>
|
||||
|
||||
#include <public/sysctl.h>
|
||||
|
||||
void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
|
||||
@@ -21,6 +25,31 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
|
||||
|
||||
pi->arch_capabilities |= MASK_INSR(sve_encode_vl(get_sys_vl_len()),
|
||||
XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK);
|
||||
|
||||
switch ( gic_hw_version() )
|
||||
{
|
||||
case GIC_V2:
|
||||
pi->arch_capabilities |= XEN_SYSCTL_PHYSCAP_ARM_GIC_V2;
|
||||
break;
|
||||
|
||||
case GIC_V3:
|
||||
pi->arch_capabilities |= XEN_SYSCTL_PHYSCAP_ARM_GIC_V3;
|
||||
|
||||
/* GICv3 may additionally support GICv2-compatible guests. */
|
||||
if ( vgic_v2_hw_enabled() )
|
||||
pi->arch_capabilities |= XEN_SYSCTL_PHYSCAP_ARM_GIC_V2;
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* Running a control domain without having the GIC sorted yet?
|
||||
* Something's broken, but there's nothing we can do about it here.
|
||||
*/
|
||||
printk_once(XENLOG_ERR "Unrecognised GIC version %d\n",
|
||||
gic_hw_version());
|
||||
ASSERT_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
long arch_do_sysctl(struct xen_sysctl *sysctl,
|
||||
|
||||
@@ -49,6 +49,11 @@ void __init vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t csize,
|
||||
vgic_v2_hw.aliased_offset = aliased_offset;
|
||||
}
|
||||
|
||||
bool vgic_v2_hw_enabled(void)
|
||||
{
|
||||
return vgic_v2_hw.enabled;
|
||||
}
|
||||
|
||||
#define NR_TARGETS_PER_ITARGETSR 4U
|
||||
#define NR_BITS_PER_TARGET (32U / NR_TARGETS_PER_ITARGETSR)
|
||||
|
||||
|
||||
@@ -47,6 +47,11 @@ void __init vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t csize,
|
||||
printk("Using the new VGIC implementation.\n");
|
||||
}
|
||||
|
||||
bool vgic_v2_hw_enabled(void)
|
||||
{
|
||||
return gic_v2_hw_data.enabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* transfer the content of the LRs back into the corresponding ap_list:
|
||||
* - active bit is transferred as is
|
||||
|
||||
@@ -106,6 +106,8 @@ struct xen_sysctl_tbuf_op {
|
||||
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#define XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK (0x1FU)
|
||||
#define XEN_SYSCTL_PHYSCAP_ARM_GIC_V2 (1U << 5)
|
||||
#define XEN_SYSCTL_PHYSCAP_ARM_GIC_V3 (1U << 6)
|
||||
#endif
|
||||
|
||||
struct xen_sysctl_physinfo {
|
||||
|
||||