Update patch for 9.0.0 qemu

This commit is contained in:
eabdullin 2024-11-25 14:28:58 +03:00
parent 8e3d73f9dd
commit d48864abfd
3 changed files with 67 additions and 131 deletions

View File

@ -1,72 +1,25 @@
From eb742e8a7c75e3be5c158cb19185d9cf6ae4862c Mon Sep 17 00:00:00 2001
From 078107cb85368f95afc5f48ec7712a3c9213b157 Mon Sep 17 00:00:00 2001
From: eabdullin <ed.abdullin.1@gmail.com>
Date: Tue, 15 Oct 2024 10:48:05 +0300
Date: Tue, 26 Nov 2024 13:11:35 +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 +-
hw/ppc/spapr.c | 101 ++++++++++++++++++++++++++++++++++++++++
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
target/ppc/kvm.c | 27 +++++++++++
target/ppc/kvm_ppc.h | 13 ++++++
8 files changed, 180 insertions(+), 1 deletion(-)
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
index e9bc97fee..3e1713838 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1746,6 +1746,13 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason)
}
@@ -1718,6 +1718,13 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason)
pef_kvm_reset(machine->cgs, &error_fatal);
spapr_caps_apply(spapr);
spapr_nested_reset(spapr);
+ if (spapr->svm_allowed) {
@ -79,7 +32,7 @@ index 370d7c35d..aed36a4de 100644
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)
@@ -3421,6 +3428,20 @@ static void spapr_set_host_serial(Object *obj, const char *value, Error **errp)
spapr->host_serial = g_strdup(value);
}
@ -100,7 +53,7 @@ index 370d7c35d..aed36a4de 100644
static void spapr_instance_init(Object *obj)
{
SpaprMachineState *spapr = SPAPR_MACHINE(obj);
@@ -3530,6 +3551,12 @@ static void spapr_instance_init(Object *obj)
@@ -3499,6 +3520,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");
@ -113,7 +66,7 @@ index 370d7c35d..aed36a4de 100644
}
static void spapr_machine_finalizefn(Object *obj)
@@ -4775,6 +4802,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
@@ -4754,6 +4781,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;
@ -121,28 +74,15 @@ index 370d7c35d..aed36a4de 100644
}
static const TypeInfo spapr_machine_info = {
@@ -4830,13 +4858,14 @@ static void spapr_machine_latest_class_options(MachineClass *mc)
@@ -4805,6 +4833,7 @@ 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)
type_init(spapr_machine_register_##suffix)
+#if 0 /* Disabled for Red Hat Enterprise Linux */
/*
* pseries-9.1
* pseries-9.0
*/
@@ -5056,6 +5085,9 @@ static bool phb_placement_4_0(SpaprMachineState *spapr, uint32_t index,
@@ -5013,6 +5042,9 @@ static bool phb_placement_4_0(SpaprMachineState *spapr, uint32_t index,
}
return true;
}
@ -152,10 +92,10 @@ index 370d7c35d..aed36a4de 100644
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)
@@ -5338,6 +5370,75 @@ 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);
DEFINE_SPAPR_MACHINE(2_1, "2.1", false);
+#endif /* disabled for RHEL */
+
+static void spapr_rhel_machine_default_class_options(MachineClass *mc)
@ -169,79 +109,67 @@ index 370d7c35d..aed36a4de 100644
+ mc->max_cpus = 384;
+}
+
+static void spapr_rhel_machine_10_0_0_class_options(MachineClass *mc)
+static void spapr_machine_rhel950_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);
+ compat_props_add(mc->compat_props, hw_compat_rhel_9_5,
+ hw_compat_rhel_9_5_len);
+ smc->pre_6_2_numa_affinity = true;
+ mc->smp_props.prefer_sockets = true;
+}
+
+DEFINE_SPAPR_MACHINE_AS_LATEST(10, 0, 0);
+DEFINE_SPAPR_MACHINE(rhel950, "rhel9.5.0", true);
+
+static void spapr_rhel_machine_9_5_0_class_options(MachineClass *mc)
+static void spapr_machine_rhel940_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);
+ spapr_machine_rhel950_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);
+DEFINE_SPAPR_MACHINE(rhel940, "rhel9.4.0", false);
+
+static void spapr_rhel_machine_9_3_0_class_options(MachineClass *mc)
+static void spapr_machine_rhel930_class_options(MachineClass *mc)
+{
+ spapr_rhel_machine_9_4_0_class_options(mc);
+ spapr_machine_rhel940_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);
+DEFINE_SPAPR_MACHINE(rhel930, "rhel9.3.0", false);
+
+static void spapr_rhel_machine_9_2_0_class_options(MachineClass *mc)
+static void spapr_machine_rhel920_class_options(MachineClass *mc)
+{
+ spapr_rhel_machine_9_3_0_class_options(mc);
+ spapr_machine_rhel930_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);
+DEFINE_SPAPR_MACHINE(rhel920, "rhel9.2.0", false);
+
+static void spapr_rhel_machine_9_1_0_class_options(MachineClass *mc)
+static void spapr_machine_rhel910_class_options(MachineClass *mc)
+{
+ spapr_rhel_machine_9_2_0_class_options(mc);
+ spapr_machine_rhel920_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);
+DEFINE_SPAPR_MACHINE(rhel910, "rhel9.1.0", false);
+
+static void spapr_rhel_machine_9_0_0_class_options(MachineClass *mc)
+static void spapr_machine_rhel900_class_options(MachineClass *mc)
+{
+ spapr_rhel_machine_9_1_0_class_options(mc);
+ spapr_machine_rhel910_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);
+
+DEFINE_SPAPR_MACHINE(rhel900, "rhel9.0.0", false);
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
index e7c9edd03..c33c321d1 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -25,6 +25,7 @@
@ -279,7 +207,7 @@ index 56090abcd..e3371b24f 100644
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[] = {
@@ -389,10 +403,12 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {
.instance_size = sizeof(SpaprCpuCore),
.class_size = sizeof(SpaprCpuCoreClass),
},
@ -293,7 +221,7 @@ index 56090abcd..e3371b24f 100644
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
index 4aaf23d28..183a13702 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -157,6 +157,7 @@ struct SpaprMachineClass {
@ -398,10 +326,10 @@ index f2301b43f..4c38fa517 100644
{ NULL, NULL }
};
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 321ed2da7..e35a99762 100644
index 67e6b2eff..11187aeb9 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)
@@ -1655,6 +1655,7 @@ static inline int ppc_env_mmu_index(CPUPPCState *env, bool ifetch)
/* Compatibility modes */
#if defined(TARGET_PPC64)
@ -410,18 +338,18 @@ index 321ed2da7..e35a99762 100644
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
index 8231feb2d..59f640cf7 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -92,6 +92,7 @@ static int cap_large_decr;
@@ -89,6 +89,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)
static uint32_t debug_inst_opcode;
@@ -141,6 +142,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);
@ -429,7 +357,7 @@ index 907dba60d..c942ff55b 100644
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)
@@ -2564,6 +2566,16 @@ bool kvmppc_supports_ail_3(void)
return cap_ail_mode_3;
}
@ -446,10 +374,10 @@ index 907dba60d..c942ff55b 100644
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);
@@ -2964,3 +2976,18 @@ bool kvm_arch_cpu_check_are_resettable(void)
void kvm_arch_accel_class_init(ObjectClass *oc)
{
}
type_init(kvm_cpu_accel_register_types);
+
+void kvmppc_svm_allow(Error **errp)
+{
@ -505,3 +433,4 @@ index 1975fb5ee..d1017f98b 100644
return -1;
--
2.39.5 (Apple Git-154)

View File

@ -8,13 +8,13 @@ Subject: [PATCH] Enable QXL device build
1 file changed, 1 insertion(+)
diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
index 45a8a1529..2769c1eb4 100644
index 276397f3b..cc1e5bd41 100644
--- a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
+++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
@@ -112,3 +112,4 @@ CONFIG_VHOST_USER_VSOCK=y
CONFIG_VHOST_USER_FS=y
@@ -111,3 +111,4 @@ CONFIG_VHOST_USER_FS=y
CONFIG_IOMMUFD=y
CONFIG_VHOST_USER_SND=y
CONFIG_VHOST_USER_SCMI=y
+CONFIG_QXL=y
--
2.43.5

View File

@ -1039,7 +1039,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/openbios-ppc
rm -rf %{buildroot}%{_datadir}/%{name}/openbios-sparc32
rm -rf %{buildroot}%{_datadir}/%{name}/openbios-sparc64
# Provided by package SLOF
%ifnarch ppc64le
rm -rf %{buildroot}%{_datadir}/%{name}/slof.bin
%endif
# Remove unpackaged files.
rm -rf %{buildroot}%{_datadir}/%{name}/palcode-clipper
@ -1296,6 +1298,10 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%{_libdir}/%{name}/accel-tcg-%{kvm_target}.so
%endif
%ifarch ppc64le
%{_datadir}/%{name}/slof.bin
%endif
%files device-display-virtio-gpu
%{_libdir}/%{name}/hw-display-virtio-gpu.so
@ -1368,6 +1374,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
- Enable QXL device build
- Enable building for ppc64le
- Re-added Spice support
- Don't remove slof.bin for ppc64le
* Wed Sep 18 2024 Miroslav Rezanina <mrezanin@redhat.com> - 9.0.0-9
- kvm-nbd-server-CVE-2024-7409-Avoid-use-after-free-when-c.patch [RHEL-52599]