mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/arm: remove XEN_DOMCTL_CONFIG_GIC_NATIVE from the ABI
Now that the toolstack always resolves a concrete GIC_V2 or GIC_V3 before calling createdomain, nothing on the Xen side needs to resolve GIC_NATIVE either: * A new gic_domctl_hw_version() helper returns the XEN_DOMCTL_CONFIG_GIC_* value matching the host's gic_hw_version(). * arch_sanitise_domain_config() uses it to validate the requested version against the hardware, rather than resolving GIC_NATIVE and writing the result back into config->arch.gic_version. A guest must use the host's GIC version, except that a GICv3 host with the GICv2 compatibility mode enabled may also run GICv2 guests. This is the same information that XEN_SYSCTL_physinfo reports to the toolstack. * create_dom0() and arch_parse_dom0less_node(), which both always want a vGIC that exactly matches the hardware, use the same helper instead of GIC_NATIVE. With nothing left resolving or relying on it, drop XEN_DOMCTL_CONFIG_GIC_NATIVE from the public ABI. Every caller must now request a concrete GIC_V2 or GIC_V3. This is an incompatible change for any toolstack still passing 0 (formerly GIC_NATIVE) expecting Xen to auto-select a version. Add a CHANGELOG.md entry, noting that available GIC versions can be queried via XEN_SYSCTL_physinfo. Signed-off-by: Julian Vetter <julian.vetter@vates.tech> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
93e976a1d1
commit
6c6bec2c80
7 files changed
+43
-20
No files matched your search
@@ -18,6 +18,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
- On Arm:
|
||||||
|
- XEN_DOMCTL_CONFIG_GIC_NATIVE has been removed. Toolstacks must now
|
||||||
|
explicitly request GIC_V2 or GIC_V3 when creating a domain.
|
||||||
|
Available GIC versions can be queried via XEN_SYSCTL_physinfo.
|
||||||
- On x86:
|
- On x86:
|
||||||
- The kexec "v1" interface, which was declared obsolete in Xen 4.4 (2013).
|
- The kexec "v1" interface, which was declared obsolete in Xen 4.4 (2013).
|
||||||
The only known user was the classic-xen fork of Linux. This does not
|
The only known user was the classic-xen fork of Linux. This does not
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <asm/arm64/sve.h>
|
#include <asm/arm64/sve.h>
|
||||||
#include <asm/domain_build.h>
|
#include <asm/domain_build.h>
|
||||||
#include <asm/firmware/sci.h>
|
#include <asm/firmware/sci.h>
|
||||||
|
#include <asm/gic.h>
|
||||||
#include <asm/grant_table.h>
|
#include <asm/grant_table.h>
|
||||||
#include <asm/setup.h>
|
#include <asm/setup.h>
|
||||||
|
|
||||||
@@ -368,7 +369,7 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
|
|||||||
unsigned int flags = bd->create_flags;
|
unsigned int flags = bd->create_flags;
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
|
|
||||||
d_cfg->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
|
d_cfg->arch.gic_version = gic_domctl_hw_version();
|
||||||
d_cfg->flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
|
d_cfg->flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
|
||||||
|
|
||||||
if ( domu_dt_sci_parse(node, d_cfg) )
|
if ( domu_dt_sci_parse(node, d_cfg) )
|
||||||
|
|||||||
+12
-16
@@ -609,23 +609,18 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the native GIC version, passed back to the toolstack. */
|
/*
|
||||||
if ( config->arch.gic_version == XEN_DOMCTL_CONFIG_GIC_NATIVE )
|
* A guest can only use the host's GIC version, except that a GICv3 host
|
||||||
|
* with the GICv2 compatibility mode enabled can also run GICv2 guests.
|
||||||
|
* This mirrors what XEN_SYSCTL_physinfo reports to the toolstack.
|
||||||
|
*/
|
||||||
|
if ( config->arch.gic_version != gic_domctl_hw_version() &&
|
||||||
|
!(config->arch.gic_version == XEN_DOMCTL_CONFIG_GIC_V2 &&
|
||||||
|
vgic_v2_hw_enabled()) )
|
||||||
{
|
{
|
||||||
switch ( gic_hw_version() )
|
dprintk(XENLOG_INFO, "Unsupported GIC version %u\n",
|
||||||
{
|
config->arch.gic_version);
|
||||||
case GIC_V2:
|
return -EINVAL;
|
||||||
config->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_V2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GIC_V3:
|
|
||||||
config->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_V3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ASSERT_UNREACHABLE();
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* max_vcpus depends on the GIC version, and Xen's compiled limit. */
|
/* max_vcpus depends on the GIC version, and Xen's compiled limit. */
|
||||||
@@ -634,6 +629,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
|
|||||||
if ( max_vcpus == 0 )
|
if ( max_vcpus == 0 )
|
||||||
{
|
{
|
||||||
dprintk(XENLOG_INFO, "Unsupported GIC version\n");
|
dprintk(XENLOG_INFO, "Unsupported GIC version\n");
|
||||||
|
ASSERT_UNREACHABLE();
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <xen/warning.h>
|
#include <xen/warning.h>
|
||||||
#include <xen/static-shmem.h>
|
#include <xen/static-shmem.h>
|
||||||
#include <asm/device.h>
|
#include <asm/device.h>
|
||||||
|
#include <asm/gic.h>
|
||||||
#include <asm/setup.h>
|
#include <asm/setup.h>
|
||||||
#include <asm/tee/tee.h>
|
#include <asm/tee/tee.h>
|
||||||
#include <asm/pci.h>
|
#include <asm/pci.h>
|
||||||
@@ -1967,7 +1968,7 @@ void __init create_dom0(void)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* The vGIC for DOM0 is exactly emulating the hardware GIC */
|
/* The vGIC for DOM0 is exactly emulating the hardware GIC */
|
||||||
dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
|
dom0_cfg.arch.gic_version = gic_domctl_hw_version();
|
||||||
dom0_cfg.arch.nr_spis = vgic_def_nr_spis();
|
dom0_cfg.arch.nr_spis = vgic_def_nr_spis();
|
||||||
dom0_cfg.arch.tee_type = tee_get_type();
|
dom0_cfg.arch.tee_type = tee_get_type();
|
||||||
dom0_cfg.max_vcpus = dom0_max_vcpus();
|
dom0_cfg.max_vcpus = dom0_max_vcpus();
|
||||||
|
|||||||
@@ -56,6 +56,21 @@ enum gic_version gic_hw_version(void)
|
|||||||
return gic_hw_ops->info->hw_version;
|
return gic_hw_ops->info->hw_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t gic_domctl_hw_version(void)
|
||||||
|
{
|
||||||
|
switch ( gic_hw_version() )
|
||||||
|
{
|
||||||
|
case GIC_V2:
|
||||||
|
return XEN_DOMCTL_CONFIG_GIC_V2;
|
||||||
|
|
||||||
|
case GIC_V3:
|
||||||
|
return XEN_DOMCTL_CONFIG_GIC_V3;
|
||||||
|
|
||||||
|
default:
|
||||||
|
BUG();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int gic_number_lines(void)
|
unsigned int gic_number_lines(void)
|
||||||
{
|
{
|
||||||
return gic_hw_ops->info->nr_lines;
|
return gic_hw_ops->info->nr_lines;
|
||||||
|
|||||||
@@ -262,6 +262,12 @@ DECLARE_PER_CPU(uint64_t, lr_mask);
|
|||||||
|
|
||||||
extern enum gic_version gic_hw_version(void);
|
extern enum gic_version gic_hw_version(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The XEN_DOMCTL_CONFIG_GIC_* value matching the GIC version actually
|
||||||
|
* present on this host.
|
||||||
|
*/
|
||||||
|
uint8_t gic_domctl_hw_version(void);
|
||||||
|
|
||||||
/* Program the IRQ type into the GIC */
|
/* Program the IRQ type into the GIC */
|
||||||
void gic_set_irq_type(struct irq_desc *desc, unsigned int type);
|
void gic_set_irq_type(struct irq_desc *desc, unsigned int type);
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
|
|||||||
* struct xen_arch_domainconfig's ABI is covered by
|
* struct xen_arch_domainconfig's ABI is covered by
|
||||||
* XEN_DOMCTL_INTERFACE_VERSION.
|
* XEN_DOMCTL_INTERFACE_VERSION.
|
||||||
*/
|
*/
|
||||||
#define XEN_DOMCTL_CONFIG_GIC_NATIVE 0
|
/* XEN_DOMCTL_CONFIG_GIC_NATIVE 0 - removed in Xen 4.23 */
|
||||||
#define XEN_DOMCTL_CONFIG_GIC_V2 1
|
#define XEN_DOMCTL_CONFIG_GIC_V2 1
|
||||||
#define XEN_DOMCTL_CONFIG_GIC_V3 2
|
#define XEN_DOMCTL_CONFIG_GIC_V3 2
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
|
|||||||
#define XEN_DOMCTL_CONFIG_ARM_V8R_EL1_MSA_VMSA 2
|
#define XEN_DOMCTL_CONFIG_ARM_V8R_EL1_MSA_VMSA 2
|
||||||
|
|
||||||
struct xen_arch_domainconfig {
|
struct xen_arch_domainconfig {
|
||||||
/* IN/OUT */
|
/* IN */
|
||||||
uint8_t gic_version;
|
uint8_t gic_version;
|
||||||
/* IN - Contains SVE vector length divided by 128 */
|
/* IN - Contains SVE vector length divided by 128 */
|
||||||
uint8_t sve_vl;
|
uint8_t sve_vl;
|
||||||
|
|||||||