508 lines
17 KiB
Diff
508 lines
17 KiB
Diff
From eb742e8a7c75e3be5c158cb19185d9cf6ae4862c Mon Sep 17 00:00:00 2001
|
|
From: eabdullin <ed.abdullin.1@gmail.com>
|
|
Date: Tue, 15 Oct 2024 10:48:05 +0300
|
|
Subject: [PATCH] Add ppc64 support
|
|
|
|
---
|
|
.../ppc64-softmmu/ppc64-rh-devices.mak | 39 ++++++
|
|
hw/ppc/spapr.c | 125 +++++++++++++++++-
|
|
hw/ppc/spapr_cpu_core.c | 16 +++
|
|
include/hw/ppc/spapr.h | 3 +
|
|
target/ppc/compat.c | 11 ++
|
|
target/ppc/cpu-models.c | 9 +-
|
|
target/ppc/cpu.h | 1 +
|
|
target/ppc/kvm.c | 27 ++++
|
|
target/ppc/kvm_ppc.h | 13 ++
|
|
9 files changed, 237 insertions(+), 7 deletions(-)
|
|
create mode 100644 configs/devices/ppc64-softmmu/ppc64-rh-devices.mak
|
|
|
|
diff --git a/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak b/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak
|
|
new file mode 100644
|
|
index 000000000..4b801b126
|
|
--- /dev/null
|
|
+++ b/configs/devices/ppc64-softmmu/ppc64-rh-devices.mak
|
|
@@ -0,0 +1,39 @@
|
|
+include ../rh-virtio.mak
|
|
+
|
|
+CONFIG_DIMM=y
|
|
+CONFIG_MEM_DEVICE=y
|
|
+CONFIG_NVDIMM=y
|
|
+CONFIG_PCI=y
|
|
+CONFIG_PCI_DEVICES=y
|
|
+CONFIG_PCI_TESTDEV=y
|
|
+CONFIG_PCI_EXPRESS=y
|
|
+CONFIG_PSERIES=y
|
|
+CONFIG_SCSI=y
|
|
+CONFIG_SPAPR_VSCSI=y
|
|
+CONFIG_TEST_DEVICES=y
|
|
+CONFIG_USB=y
|
|
+CONFIG_USB_OHCI=y
|
|
+CONFIG_USB_OHCI_PCI=y
|
|
+CONFIG_USB_SMARTCARD=y
|
|
+CONFIG_USB_STORAGE_CORE=y
|
|
+CONFIG_USB_STORAGE_CLASSIC=y
|
|
+CONFIG_USB_XHCI=y
|
|
+CONFIG_USB_XHCI_NEC=y
|
|
+CONFIG_USB_XHCI_PCI=y
|
|
+CONFIG_USB_HUB=y
|
|
+CONFIG_USB_HID=y
|
|
+CONFIG_VFIO=y
|
|
+CONFIG_VFIO_PCI=y
|
|
+CONFIG_VGA=y
|
|
+CONFIG_VGA_PCI=y
|
|
+CONFIG_VHOST_USER=y
|
|
+CONFIG_VIRTIO_PCI=y
|
|
+CONFIG_VIRTIO_VGA=y
|
|
+CONFIG_WDT_IB6300ESB=y
|
|
+CONFIG_XICS=y
|
|
+CONFIG_XIVE=y
|
|
+CONFIG_TPM=y
|
|
+CONFIG_TPM_SPAPR=y
|
|
+CONFIG_TPM_EMULATOR=y
|
|
+CONFIG_VHOST_VSOCK=y
|
|
+CONFIG_VHOST_USER_VSOCK=y
|
|
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
|
index 370d7c35d..aed36a4de 100644
|
|
--- a/hw/ppc/spapr.c
|
|
+++ b/hw/ppc/spapr.c
|
|
@@ -1746,6 +1746,13 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason)
|
|
}
|
|
spapr_caps_apply(spapr);
|
|
spapr_nested_reset(spapr);
|
|
+ if (spapr->svm_allowed) {
|
|
+#ifdef CONFIG_KVM
|
|
+ kvmppc_svm_allow(&error_fatal);
|
|
+#else
|
|
+ error_setg(&error_fatal, "No PEF support in tcg, try x-svm-allowed=off");
|
|
+#endif
|
|
+ }
|
|
|
|
first_ppc_cpu = POWERPC_CPU(first_cpu);
|
|
if (kvm_enabled() && kvmppc_has_cap_mmu_radix() &&
|
|
@@ -3452,6 +3459,20 @@ static void spapr_set_host_serial(Object *obj, const char *value, Error **errp)
|
|
spapr->host_serial = g_strdup(value);
|
|
}
|
|
|
|
+static bool spapr_get_svm_allowed(Object *obj, Error **errp)
|
|
+{
|
|
+ SpaprMachineState *spapr = SPAPR_MACHINE(obj);
|
|
+
|
|
+ return spapr->svm_allowed;
|
|
+}
|
|
+
|
|
+static void spapr_set_svm_allowed(Object *obj, bool value, Error **errp)
|
|
+{
|
|
+ SpaprMachineState *spapr = SPAPR_MACHINE(obj);
|
|
+
|
|
+ spapr->svm_allowed = value;
|
|
+}
|
|
+
|
|
static void spapr_instance_init(Object *obj)
|
|
{
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(obj);
|
|
@@ -3530,6 +3551,12 @@ static void spapr_instance_init(Object *obj)
|
|
spapr_get_host_serial, spapr_set_host_serial);
|
|
object_property_set_description(obj, "host-serial",
|
|
"Host serial number to advertise in guest device tree");
|
|
+ object_property_add_bool(obj, "x-svm-allowed",
|
|
+ spapr_get_svm_allowed,
|
|
+ spapr_set_svm_allowed);
|
|
+ object_property_set_description(obj, "x-svm-allowed",
|
|
+ "Allow the guest to become a Secure Guest"
|
|
+ " (experimental only)");
|
|
}
|
|
|
|
static void spapr_machine_finalizefn(Object *obj)
|
|
@@ -4775,6 +4802,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
|
|
vmc->client_architecture_support = spapr_vof_client_architecture_support;
|
|
vmc->quiesce = spapr_vof_quiesce;
|
|
vmc->setprop = spapr_vof_setprop;
|
|
+ smc->has_power9_support = true;
|
|
}
|
|
|
|
static const TypeInfo spapr_machine_info = {
|
|
@@ -4830,13 +4858,14 @@ static void spapr_machine_latest_class_options(MachineClass *mc)
|
|
} \
|
|
type_init(MACHINE_VER_SYM(register, spapr, __VA_ARGS__))
|
|
|
|
-#define DEFINE_SPAPR_MACHINE_AS_LATEST(major, minor) \
|
|
- DEFINE_SPAPR_MACHINE_IMPL(true, major, minor)
|
|
-#define DEFINE_SPAPR_MACHINE(major, minor) \
|
|
- DEFINE_SPAPR_MACHINE_IMPL(false, major, minor)
|
|
-#define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, tag) \
|
|
- DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag)
|
|
+#define DEFINE_SPAPR_MACHINE_AS_LATEST(major, minor, micro) \
|
|
+ DEFINE_SPAPR_MACHINE_IMPL(true, major, minor, micro)
|
|
+#define DEFINE_SPAPR_MACHINE(major, minor, micro) \
|
|
+ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, micro)
|
|
+#define DEFINE_SPAPR_MACHINE_TAGGED(major, minor, micro, tag) \
|
|
+ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, micro, _, tag)
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
/*
|
|
* pseries-9.1
|
|
*/
|
|
@@ -5056,6 +5085,9 @@ static bool phb_placement_4_0(SpaprMachineState *spapr, uint32_t index,
|
|
}
|
|
return true;
|
|
}
|
|
+#endif
|
|
+
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
static void spapr_machine_4_0_class_options(MachineClass *mc)
|
|
{
|
|
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
|
@@ -5380,6 +5412,87 @@ static void spapr_machine_2_1_class_options(MachineClass *mc)
|
|
compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len);
|
|
}
|
|
DEFINE_SPAPR_MACHINE(2, 1);
|
|
+#endif /* disabled for RHEL */
|
|
+
|
|
+static void spapr_rhel_machine_default_class_options(MachineClass *mc)
|
|
+{
|
|
+ /*
|
|
+ * Defaults for the latest behaviour inherited from the base class
|
|
+ * can be overriden here for all pseries-rhel* machines.
|
|
+ */
|
|
+
|
|
+ /* Maximum supported VCPU count */
|
|
+ mc->max_cpus = 384;
|
|
+}
|
|
+
|
|
+static void spapr_rhel_machine_10_0_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
|
+
|
|
+ /* The default machine type must apply the RHEL specific defaults */
|
|
+ spapr_rhel_machine_default_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_0,
|
|
+ hw_compat_rhel_10_0_len);
|
|
+ smc->pre_6_2_numa_affinity = true;
|
|
+ mc->smp_props.prefer_sockets = true;
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE_AS_LATEST(10, 0, 0);
|
|
+
|
|
+static void spapr_rhel_machine_9_5_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ spapr_rhel_machine_10_0_0_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_5,
|
|
+ hw_compat_rhel_9_5_len);
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE(9, 5, 0);
|
|
+
|
|
+static void spapr_rhel_machine_9_4_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ spapr_rhel_machine_9_5_0_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_4,
|
|
+ hw_compat_rhel_9_4_len);
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE(9, 4, 0);
|
|
+
|
|
+static void spapr_rhel_machine_9_3_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ spapr_rhel_machine_9_4_0_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_3,
|
|
+ hw_compat_rhel_9_3_len);
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE(9, 3, 0);
|
|
+
|
|
+static void spapr_rhel_machine_9_2_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ spapr_rhel_machine_9_3_0_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_2,
|
|
+ hw_compat_rhel_9_2_len);
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE(9, 2, 0);
|
|
+
|
|
+static void spapr_rhel_machine_9_1_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ spapr_rhel_machine_9_2_0_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_1,
|
|
+ hw_compat_rhel_9_1_len);
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE(9, 1, 0);
|
|
+
|
|
+static void spapr_rhel_machine_9_0_0_class_options(MachineClass *mc)
|
|
+{
|
|
+ spapr_rhel_machine_9_1_0_class_options(mc);
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_0,
|
|
+ hw_compat_rhel_9_0_len);
|
|
+}
|
|
+
|
|
+DEFINE_SPAPR_MACHINE(9, 0, 0);
|
|
+
|
|
|
|
static void spapr_machine_register_types(void)
|
|
{
|
|
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
|
|
index 56090abcd..e3371b24f 100644
|
|
--- a/hw/ppc/spapr_cpu_core.c
|
|
+++ b/hw/ppc/spapr_cpu_core.c
|
|
@@ -25,6 +25,7 @@
|
|
#include "sysemu/reset.h"
|
|
#include "sysemu/hw_accel.h"
|
|
#include "qemu/error-report.h"
|
|
+#include "cpu-models.h"
|
|
|
|
static void spapr_reset_vcpu(PowerPCCPU *cpu)
|
|
{
|
|
@@ -264,6 +265,7 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
|
{
|
|
CPUPPCState *env = &cpu->env;
|
|
CPUState *cs = CPU(cpu);
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
|
|
|
|
if (!qdev_realize(DEVICE(cpu), NULL, errp)) {
|
|
return false;
|
|
@@ -280,6 +282,18 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
|
/* Set time-base frequency to 512 MHz. vhyp must be set first. */
|
|
cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ);
|
|
|
|
+ if (!smc->has_power9_support &&
|
|
+ (((spapr->max_compat_pvr &&
|
|
+ ppc_compat_cmp(spapr->max_compat_pvr,
|
|
+ CPU_POWERPC_LOGICAL_3_00) >= 0)) ||
|
|
+ (!spapr->max_compat_pvr &&
|
|
+ ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) {
|
|
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
|
+ "POWER9 CPU is not supported by this machine class");
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+
|
|
if (spapr_irq_cpu_intc_create(spapr, cpu, errp) < 0) {
|
|
qdev_unrealize(DEVICE(cpu));
|
|
return false;
|
|
@@ -399,10 +413,12 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {
|
|
.instance_size = sizeof(SpaprCpuCore),
|
|
.class_size = sizeof(SpaprCpuCoreClass),
|
|
},
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("970_v2.2"),
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.0"),
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.1"),
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("power5p_v2.1"),
|
|
+#endif
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"),
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("power7p_v2.1"),
|
|
DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"),
|
|
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
|
|
index f6de3e997..3cc7ef0c0 100644
|
|
--- a/include/hw/ppc/spapr.h
|
|
+++ b/include/hw/ppc/spapr.h
|
|
@@ -157,6 +157,7 @@ struct SpaprMachineClass {
|
|
bool pre_5_2_numa_associativity;
|
|
bool pre_6_2_numa_affinity;
|
|
|
|
+ bool has_power9_support;
|
|
bool (*phb_placement)(SpaprMachineState *spapr, uint32_t index,
|
|
uint64_t *buid, hwaddr *pio,
|
|
hwaddr *mmio32, hwaddr *mmio64,
|
|
@@ -258,6 +259,8 @@ struct SpaprMachineState {
|
|
|
|
/* Set by -boot */
|
|
char *boot_device;
|
|
+ /* Secure Guest support via x-svm-allowed */
|
|
+ bool svm_allowed;
|
|
|
|
/*< public >*/
|
|
char *kvm_type;
|
|
diff --git a/target/ppc/compat.c b/target/ppc/compat.c
|
|
index ebef2ccce..ab7ed7680 100644
|
|
--- a/target/ppc/compat.c
|
|
+++ b/target/ppc/compat.c
|
|
@@ -114,6 +114,17 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr)
|
|
return NULL;
|
|
}
|
|
|
|
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2)
|
|
+{
|
|
+ const CompatInfo *compat1 = compat_by_pvr(pvr1);
|
|
+ const CompatInfo *compat2 = compat_by_pvr(pvr2);
|
|
+
|
|
+ g_assert(compat1);
|
|
+ g_assert(compat2);
|
|
+
|
|
+ return compat1 - compat2;
|
|
+}
|
|
+
|
|
static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr,
|
|
uint32_t min_compat_pvr, uint32_t max_compat_pvr)
|
|
{
|
|
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
|
|
index f2301b43f..4c38fa517 100644
|
|
--- a/target/ppc/cpu-models.c
|
|
+++ b/target/ppc/cpu-models.c
|
|
@@ -66,6 +66,7 @@
|
|
#define POWERPC_DEF(_name, _pvr, _type, _desc) \
|
|
POWERPC_DEF_SVR(_name, _desc, _pvr, POWERPC_SVR_NONE, _type)
|
|
|
|
+#if 0 /* Embedded and 32-bit CPUs disabled for Red Hat Enterprise Linux */
|
|
/* Embedded PowerPC */
|
|
/* PowerPC 405 family */
|
|
/* PowerPC 405 cores */
|
|
@@ -698,8 +699,10 @@
|
|
"PowerPC 7447A v1.2 (G4)")
|
|
POWERPC_DEF("7457a_v1.2", CPU_POWERPC_74x7A_v12, 7455,
|
|
"PowerPC 7457A v1.2 (G4)")
|
|
+#endif
|
|
/* 64 bits PowerPC */
|
|
#if defined(TARGET_PPC64)
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
POWERPC_DEF("970_v2.2", CPU_POWERPC_970_v22, 970,
|
|
"PowerPC 970 v2.2")
|
|
POWERPC_DEF("970fx_v1.0", CPU_POWERPC_970FX_v10, 970,
|
|
@@ -718,6 +721,7 @@
|
|
"PowerPC 970MP v1.1")
|
|
POWERPC_DEF("power5p_v2.1", CPU_POWERPC_POWER5P_v21, POWER5P,
|
|
"POWER5+ v2.1")
|
|
+#endif
|
|
POWERPC_DEF("power7_v2.3", CPU_POWERPC_POWER7_v23, POWER7,
|
|
"POWER7 v2.3")
|
|
POWERPC_DEF("power7p_v2.1", CPU_POWERPC_POWER7P_v21, POWER7,
|
|
@@ -895,12 +899,14 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
|
|
{ "7457a", "7457a_v1.2" },
|
|
{ "apollo7pm", "7457a_v1.0" },
|
|
#if defined(TARGET_PPC64)
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
{ "970", "970_v2.2" },
|
|
{ "970fx", "970fx_v3.1" },
|
|
{ "970mp", "970mp_v1.1" },
|
|
{ "power5+", "power5p_v2.1" },
|
|
{ "power5+_v2.1", "power5p_v2.1" },
|
|
{ "power5gs", "power5+_v2.1" },
|
|
+#endif
|
|
{ "power7", "power7_v2.3" },
|
|
{ "power7+", "power7p_v2.1" },
|
|
{ "power7+_v2.1", "power7p_v2.1" },
|
|
@@ -910,13 +916,14 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
|
|
{ "power9", "power9_v2.2" },
|
|
{ "power10", "power10_v2.0" },
|
|
#endif
|
|
-
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
/* Generic PowerPCs */
|
|
#if defined(TARGET_PPC64)
|
|
{ "ppc64", "970fx_v3.1" },
|
|
#endif
|
|
{ "ppc32", "604" },
|
|
{ "ppc", "604" },
|
|
+#endif
|
|
|
|
{ NULL, NULL }
|
|
};
|
|
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
|
|
index 321ed2da7..e35a99762 100644
|
|
--- a/target/ppc/cpu.h
|
|
+++ b/target/ppc/cpu.h
|
|
@@ -1673,6 +1673,7 @@ static inline int ppc_env_mmu_index(CPUPPCState *env, bool ifetch)
|
|
|
|
/* Compatibility modes */
|
|
#if defined(TARGET_PPC64)
|
|
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2);
|
|
bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
|
|
uint32_t min_compat_pvr, uint32_t max_compat_pvr);
|
|
bool ppc_type_check_compat(const char *cputype, uint32_t compat_pvr,
|
|
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
|
|
index 907dba60d..c942ff55b 100644
|
|
--- a/target/ppc/kvm.c
|
|
+++ b/target/ppc/kvm.c
|
|
@@ -92,6 +92,7 @@ static int cap_large_decr;
|
|
static int cap_fwnmi;
|
|
static int cap_rpt_invalidate;
|
|
static int cap_ail_mode_3;
|
|
+static int cap_ppc_secure_guest;
|
|
|
|
#ifdef CONFIG_PSERIES
|
|
static int cap_papr;
|
|
@@ -150,6 +151,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
|
|
cap_resize_hpt = kvm_vm_check_extension(s, KVM_CAP_SPAPR_RESIZE_HPT);
|
|
kvmppc_get_cpu_characteristics(s);
|
|
cap_ppc_nested_kvm_hv = kvm_vm_check_extension(s, KVM_CAP_PPC_NESTED_HV);
|
|
+ cap_ppc_secure_guest = kvm_vm_check_extension(s, KVM_CAP_PPC_SECURE_GUEST);
|
|
cap_large_decr = kvmppc_get_dec_bits();
|
|
cap_fwnmi = kvm_vm_check_extension(s, KVM_CAP_PPC_FWNMI);
|
|
/*
|
|
@@ -2597,6 +2599,16 @@ bool kvmppc_supports_ail_3(void)
|
|
return cap_ail_mode_3;
|
|
}
|
|
|
|
+bool kvmppc_has_cap_secure_guest(void)
|
|
+{
|
|
+ return !!cap_ppc_secure_guest;
|
|
+}
|
|
+
|
|
+int kvmppc_enable_cap_secure_guest(void)
|
|
+{
|
|
+ return kvm_vm_enable_cap(kvm_state, KVM_CAP_PPC_SECURE_GUEST, 0, 1);
|
|
+}
|
|
+
|
|
PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
|
|
{
|
|
uint32_t host_pvr = mfpvr();
|
|
@@ -3012,3 +3024,18 @@ static void kvm_cpu_accel_register_types(void)
|
|
type_register_static(&kvm_cpu_accel_type_info);
|
|
}
|
|
type_init(kvm_cpu_accel_register_types);
|
|
+
|
|
+void kvmppc_svm_allow(Error **errp)
|
|
+{
|
|
+ if (!kvm_enabled()) {
|
|
+ error_setg(errp, "No PEF support in tcg, try x-svm-allowed=off");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (!kvmppc_has_cap_secure_guest()) {
|
|
+ error_setg(errp, "KVM implementation does not support secure guests, "
|
|
+ "try x-svm-allowed=off");
|
|
+ } else if (kvmppc_enable_cap_secure_guest() < 0) {
|
|
+ error_setg(errp, "Error enabling x-svm-allowed, try x-svm-allowed=off");
|
|
+ }
|
|
+}
|
|
diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
|
|
index 1975fb5ee..d1017f98b 100644
|
|
--- a/target/ppc/kvm_ppc.h
|
|
+++ b/target/ppc/kvm_ppc.h
|
|
@@ -46,6 +46,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
|
|
target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
|
|
bool radix, bool gtse,
|
|
uint64_t proc_tbl);
|
|
+void kvmppc_svm_allow(Error **errp);
|
|
bool kvmppc_spapr_use_multitce(void);
|
|
int kvmppc_spapr_enable_inkernel_multitce(void);
|
|
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
|
|
@@ -79,6 +80,8 @@ int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable);
|
|
int kvmppc_has_cap_rpt_invalidate(void);
|
|
bool kvmppc_supports_ail_3(void);
|
|
int kvmppc_enable_hwrng(void);
|
|
+bool kvmppc_has_cap_secure_guest(void);
|
|
+int kvmppc_enable_cap_secure_guest(void);
|
|
int kvmppc_put_books_sregs(PowerPCCPU *cpu);
|
|
PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void);
|
|
void kvmppc_check_papr_resize_hpt(Error **errp);
|
|
@@ -427,6 +430,16 @@ static inline bool kvmppc_supports_ail_3(void)
|
|
return false;
|
|
}
|
|
|
|
+static inline bool kvmppc_has_cap_secure_guest(void)
|
|
+{
|
|
+ return false;
|
|
+}
|
|
+
|
|
+static inline int kvmppc_enable_cap_secure_guest(void)
|
|
+{
|
|
+ return -1;
|
|
+}
|
|
+
|
|
static inline int kvmppc_enable_hwrng(void)
|
|
{
|
|
return -1;
|
|
--
|
|
2.39.5 (Apple Git-154)
|