qemu-kvm/kvm-redhat-Add-some-devices...

136 lines
5.0 KiB
Diff

From 1b6e1cc1f3d8033620bc0c04670d252180bd2c36 Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Wed, 10 Feb 2021 17:10:34 -0300
Subject: [PATCH 11/54] redhat: Add some devices for exporting upstream machine
types
RH-Author: Peter Xu <peterx@redhat.com>
Message-id: <20210210171034.129116-2-peterx@redhat.com>
Patchwork-id: 101043
O-Subject: [RHEL-AV-8.4.0 qemu-kvm PATCH 1/1] redhat: Add some devices for exporting upstream machine types
Bugzilla: 1917826
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Both "isa-parallel" and "hpet" will be required for the to-be-exported upstream
x86 machine types, so add them back into config.
Since HPET was disabled for rhel machine types previously, we need to
explicitly do that for RHEL now after we add HPET back.
Meanwhile, add blockers for the two devices so that they can never be created
on RHEL machine types. That should keep the old behavior for RHEL-AV.
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
default-configs/devices/x86_64-softmmu.mak | 6 ++++++
default-configs/devices/x86_64-upstream-devices.mak | 4 ++++
hw/char/parallel.c | 9 +++++++++
hw/i386/pc_piix.c | 2 +-
hw/i386/pc_q35.c | 2 +-
hw/timer/hpet.c | 8 ++++++++
6 files changed, 29 insertions(+), 2 deletions(-)
create mode 100644 default-configs/devices/x86_64-upstream-devices.mak
diff --git a/default-configs/devices/x86_64-softmmu.mak b/default-configs/devices/x86_64-softmmu.mak
index b5de7e5279..e57bcff7d9 100644
--- a/default-configs/devices/x86_64-softmmu.mak
+++ b/default-configs/devices/x86_64-softmmu.mak
@@ -3,3 +3,9 @@
#include i386-softmmu.mak
include x86_64-rh-devices.mak
+
+#
+# RHEL: this is for the limited upstream machine type support, so to export
+# some more devices than what RHEL machines have.
+#
+include x86_64-upstream-devices.mak
diff --git a/default-configs/devices/x86_64-upstream-devices.mak b/default-configs/devices/x86_64-upstream-devices.mak
new file mode 100644
index 0000000000..2cd20f54d2
--- /dev/null
+++ b/default-configs/devices/x86_64-upstream-devices.mak
@@ -0,0 +1,4 @@
+# We need "isa-parallel"
+CONFIG_PARALLEL=y
+# We need "hpet"
+CONFIG_HPET=y
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index 8b418abf71..6b3696a237 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -29,6 +29,7 @@
#include "chardev/char-parallel.h"
#include "chardev/char-fe.h"
#include "hw/acpi/aml-build.h"
+#include "hw/boards.h"
#include "hw/irq.h"
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
@@ -533,6 +534,14 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp)
int base;
uint8_t dummy;
+ /* Restricted for Red Hat Enterprise Linux */
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+ if (strstr(mc->name, "rhel")) {
+ error_setg(errp, "Device %s is not supported with machine type %s",
+ object_get_typename(OBJECT(dev)), mc->name);
+ return;
+ }
+
if (!qemu_chr_fe_backend_connected(&s->chr)) {
error_setg(errp, "Can't create parallel device, empty char device");
return;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 1b1cc18ae0..6e1f1ba082 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1018,7 +1018,7 @@ static void pc_machine_rhel7_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
m->family = "pc_piix_Y";
- m->default_machine_opts = "firmware=bios-256k.bin";
+ m->default_machine_opts = "firmware=bios-256k.bin,hpet=off";
pcmc->default_nic_model = "e1000";
m->default_display = "std";
m->no_parallel = 1;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 72854192a9..a8c0496c9f 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -580,7 +580,7 @@ static void pc_q35_machine_rhel_options(MachineClass *m)
pcmc->default_nic_model = "e1000e";
m->family = "pc_q35_Z";
m->units_per_default_bus = 1;
- m->default_machine_opts = "firmware=bios-256k.bin";
+ m->default_machine_opts = "firmware=bios-256k.bin,hpet=off";
m->default_display = "std";
m->no_floppy = 1;
m->no_parallel = 1;
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index 9520471be2..202e032524 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -733,6 +733,14 @@ static void hpet_realize(DeviceState *dev, Error **errp)
int i;
HPETTimer *timer;
+ /* Restricted for Red Hat Enterprise Linux */
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+ if (strstr(mc->name, "rhel")) {
+ error_setg(errp, "Device %s is not supported with machine type %s",
+ object_get_typename(OBJECT(dev)), mc->name);
+ return;
+ }
+
if (!s->intcap) {
warn_report("Hpet's intcap not initialized");
}
--
2.27.0