From 67511676246cce57becbd2dcf5abccf08d9ef737 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Mon, 11 Jan 2016 11:53:33 +0100
Subject: Enable/disable devices for RHEL

This commit adds all changes related to changes in supported devices.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

Rebase notes (qemu 3.1.0)
- spapr_rng disabled in default_config
- new hyperv.mak in default configs
- Move changes from x86_64-softmmu.mak to i386-softmmu.mak
- Added CONFIG_VIRTIO_MMIO to aarch64-softmmu.mak
- Removed config_vga_isa.c changes as no longer needed
- Removed new devices

Rebase notes (4.0.0):
- Added CONFIG_PCI_EXPRESS_GENERIC_BRIDGE for aarch64-softmmu.mak
- Added CONFIG_ARM_VIRT for aarch64-softmmu.mak
- Switch to KConfig (upstream)
 - Using device whitelist + without-defualt-devices option

Rebase notes (4.1.0):
- Added CONFIG_USB_OHCI_PCI for ppc64
- Added CONFIG_XIVE_KVM for ppc64
- Added CONFIG_ACPI_PCI for x86_64
- Added CONFIG_SEMIHOSTING for aarch64
- Cleanup aarch64 devices
- Do not build a15mpcore.c
- Removed ide-isa.c stub file
- Use CONFIG_USB_EHCI_PCI on x86_64 (new upstream)

Rebase notes (4.2.0-rc0):
- Use conditional build for isa-superio.c (upstream change)
- Rename PCI_PIIX to PCI_I440FX (upstream change)

Rebase notes (4.2.0-rc3):
- Disabled ccid-card-emulated (patch 92566)
- Disabled vfio-pci-igd-lpc-bridge (patch 92565)

Merged patches (qemu 3.1.0):
- d51e082 Re-enable CONFIG_HYPERV_TESTDEV
- 4b889f3 Declare cirrus-vga as deprecated
- b579d32 Do not build bluetooth support
- 3eef52a Disable CONFIG_IPMI and CONFIG_I2C for ppc64
- 9caf292 Disable CONFIG_CAN_BUS and CONFIG_CAN_SJA1000

Merged patches (4.1.0):
- 20a51f6 fdc: Revert downstream disablement of device "floppy"
- f869cc0 fdc: Restrict floppy controllers to RHEL-7 machine types
- 5909721 aarch64: Compile out IOH3420
- 27b7c44 rh: set CONFIG_BOCHS_DISPLAY=y for x86 (partial)
- 495a27d x86_64-rh-devices: add missing TPM passthrough
- e1fe9fe x86_64-rh-devices: enable TPM emulation (partial)

Merged patches (4.2.0):
- f7587dd RHEL: disable hostmem-memfd

Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
 Makefile.objs                          |   4 +-
 backends/Makefile.objs                 |   3 +-
 default-configs/aarch64-rh-devices.mak |  20 +++++
 default-configs/aarch64-softmmu.mak    |  10 ++-
 default-configs/ppc64-rh-devices.mak   |  32 ++++++++
 default-configs/ppc64-softmmu.mak      |   8 +-
 default-configs/rh-virtio.mak          |  10 +++
 default-configs/s390x-rh-devices.mak   |  15 ++++
 default-configs/s390x-softmmu.mak      |   4 +-
 default-configs/x86_64-rh-devices.mak  | 100 +++++++++++++++++++++++++
 default-configs/x86_64-softmmu.mak     |   4 +-
 hw/acpi/ich9.c                         |   4 +-
 hw/arm/Makefile.objs                   |   2 +-
 hw/block/fdc.c                         |  10 +++
 hw/bt/Makefile.objs                    |   4 +-
 hw/cpu/Makefile.objs                   |   5 +-
 hw/display/Makefile.objs               |   5 +-
 hw/display/cirrus_vga.c                |   3 +
 hw/ide/piix.c                          |   5 +-
 hw/input/pckbd.c                       |   2 +
 hw/net/e1000.c                         |   2 +
 hw/pci-host/i440fx.c                   |   4 +
 hw/ppc/spapr_cpu_core.c                |   2 +
 hw/usb/Makefile.objs                   |   4 +-
 hw/vfio/pci-quirks.c                   |   9 +++
 hw/vfio/pci.c                          |   5 ++
 qemu-options.hx                        |   7 +-
 redhat/qemu-kvm.spec.template          |   5 +-
 target/arm/cpu.c                       |   4 +-
 target/i386/cpu.c                      |  35 +++++++--
 target/ppc/cpu-models.c                |  10 +++
 target/s390x/cpu_models.c              |   3 +
 target/s390x/kvm.c                     |   8 ++
 util/memfd.c                           |   2 +-
 vl.c                                   |   8 +-
 35 files changed, 317 insertions(+), 41 deletions(-)
 create mode 100644 default-configs/aarch64-rh-devices.mak
 create mode 100644 default-configs/ppc64-rh-devices.mak
 create mode 100644 default-configs/rh-virtio.mak
 create mode 100644 default-configs/s390x-rh-devices.mak
 create mode 100644 default-configs/x86_64-rh-devices.mak

diff --git a/Makefile.objs b/Makefile.objs
index 11ba1a36bd..fcf63e1096 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -65,8 +65,8 @@ common-obj-y += replay/
 
 common-obj-y += ui/
 common-obj-m += ui/
-common-obj-y += bt-host.o bt-vhci.o
-bt-host.o-cflags := $(BLUEZ_CFLAGS)
+#common-obj-y += bt-host.o bt-vhci.o
+#bt-host.o-cflags := $(BLUEZ_CFLAGS)
 
 common-obj-y += dma-helpers.o
 common-obj-y += vl.o
diff --git a/backends/Makefile.objs b/backends/Makefile.objs
index f0691116e8..f328d404bf 100644
--- a/backends/Makefile.objs
+++ b/backends/Makefile.objs
@@ -16,4 +16,5 @@ endif
 
 common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO)) += vhost-user.o
 
-common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
+# RHEL: disable memfd
+# common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
diff --git a/default-configs/aarch64-rh-devices.mak b/default-configs/aarch64-rh-devices.mak
new file mode 100644
index 0000000000..a1ed641174
--- /dev/null
+++ b/default-configs/aarch64-rh-devices.mak
@@ -0,0 +1,20 @@
+include rh-virtio.mak
+
+CONFIG_ARM_GIC_KVM=y
+CONFIG_ARM_SMMUV3=y
+CONFIG_ARM_V7M=y
+CONFIG_ARM_VIRT=y
+CONFIG_EDID=y
+CONFIG_PCIE_PORT=y
+CONFIG_PCI_DEVICES=y
+CONFIG_PCI_TESTDEV=y
+CONFIG_PFLASH_CFI01=y
+CONFIG_SCSI=y
+CONFIG_SEMIHOSTING=y
+CONFIG_USB=y
+CONFIG_USB_XHCI=y
+CONFIG_VFIO=y
+CONFIG_VFIO_PCI=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_XIO3130=y
diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak
index 958b1e08e4..8f6867d48a 100644
--- a/default-configs/aarch64-softmmu.mak
+++ b/default-configs/aarch64-softmmu.mak
@@ -1,8 +1,10 @@
 # Default configuration for aarch64-softmmu
 
 # We support all the 32 bit boards so need all their config
-include arm-softmmu.mak
+#include arm-softmmu.mak
 
-CONFIG_XLNX_ZYNQMP_ARM=y
-CONFIG_XLNX_VERSAL=y
-CONFIG_SBSA_REF=y
+#CONFIG_XLNX_ZYNQMP_ARM=y
+#CONFIG_XLNX_VERSAL=y
+#CONFIG_SBSA_REF=y
+
+include aarch64-rh-devices.mak
diff --git a/default-configs/ppc64-rh-devices.mak b/default-configs/ppc64-rh-devices.mak
new file mode 100644
index 0000000000..35f2106d06
--- /dev/null
+++ b/default-configs/ppc64-rh-devices.mak
@@ -0,0 +1,32 @@
+include rh-virtio.mak
+
+CONFIG_DIMM=y
+CONFIG_MEM_DEVICE=y
+CONFIG_PCI=y
+CONFIG_PCI_DEVICES=y
+CONFIG_PCI_TESTDEV=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_BOT=y
+CONFIG_USB_XHCI=y
+CONFIG_USB_XHCI_NEC=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_XICS_KVM=y
+CONFIG_XICS_SPAPR=y
+CONFIG_XIVE=y
+CONFIG_XIVE_SPAPR=y
+CONFIG_XIVE_KVM=y
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index cca52665d9..fec354f327 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -1,10 +1,12 @@
 # Default configuration for ppc64-softmmu
 
 # Include all 32-bit boards
-include ppc-softmmu.mak
+#include ppc-softmmu.mak
 
 # For PowerNV
-CONFIG_POWERNV=y
+#CONFIG_POWERNV=y
 
 # For pSeries
-CONFIG_PSERIES=y
+#CONFIG_PSERIES=y
+
+include ppc64-rh-devices.mak
diff --git a/default-configs/rh-virtio.mak b/default-configs/rh-virtio.mak
new file mode 100644
index 0000000000..94ede1b5f6
--- /dev/null
+++ b/default-configs/rh-virtio.mak
@@ -0,0 +1,10 @@
+CONFIG_VIRTIO=y
+CONFIG_VIRTIO_BALLOON=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_VIRTIO_GPU=y
+CONFIG_VIRTIO_INPUT=y
+CONFIG_VIRTIO_INPUT_HOST=y
+CONFIG_VIRTIO_NET=y
+CONFIG_VIRTIO_RNG=y
+CONFIG_VIRTIO_SCSI=y
+CONFIG_VIRTIO_SERIAL=y
diff --git a/default-configs/s390x-rh-devices.mak b/default-configs/s390x-rh-devices.mak
new file mode 100644
index 0000000000..c3c73fe752
--- /dev/null
+++ b/default-configs/s390x-rh-devices.mak
@@ -0,0 +1,15 @@
+include rh-virtio.mak
+
+CONFIG_PCI=y
+CONFIG_S390_CCW_VIRTIO=y
+CONFIG_S390_FLIC=y
+CONFIG_S390_FLIC_KVM=y
+CONFIG_SCLPCONSOLE=y
+CONFIG_SCSI=y
+CONFIG_TERMINAL3270=y
+CONFIG_VFIO=y
+CONFIG_VFIO_AP=y
+CONFIG_VFIO_PCI=y
+CONFIG_VHOST_USER=y
+CONFIG_VIRTIO_CCW=y
+CONFIG_WDT_DIAG288=y
diff --git a/default-configs/s390x-softmmu.mak b/default-configs/s390x-softmmu.mak
index f2287a133f..3e2e388e91 100644
--- a/default-configs/s390x-softmmu.mak
+++ b/default-configs/s390x-softmmu.mak
@@ -10,4 +10,6 @@
 
 # Boards:
 #
-CONFIG_S390_CCW_VIRTIO=y
+#CONFIG_S390_CCW_VIRTIO=y
+
+include s390x-rh-devices.mak
diff --git a/default-configs/x86_64-rh-devices.mak b/default-configs/x86_64-rh-devices.mak
new file mode 100644
index 0000000000..d59b6d9bb5
--- /dev/null
+++ b/default-configs/x86_64-rh-devices.mak
@@ -0,0 +1,100 @@
+include rh-virtio.mak
+
+CONFIG_AC97=y
+CONFIG_ACPI=y
+CONFIG_ACPI_PCI=y
+CONFIG_ACPI_CPU_HOTPLUG=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_NVDIMM=y
+CONFIG_ACPI_SMBUS=y
+CONFIG_ACPI_VMGENID=y
+CONFIG_ACPI_X86=y
+CONFIG_ACPI_X86_ICH=y
+CONFIG_AHCI=y
+CONFIG_APIC=y
+CONFIG_APM=y
+CONFIG_BOCHS_DISPLAY=y
+CONFIG_DIMM=y
+CONFIG_E1000E_PCI_EXPRESS=y
+CONFIG_E1000_PCI=y
+CONFIG_EDU=y
+CONFIG_FDC=y
+CONFIG_FW_CFG_DMA=y
+CONFIG_HDA=y
+CONFIG_HYPERV=y
+CONFIG_HYPERV_TESTDEV=y
+CONFIG_I2C=y
+CONFIG_I440FX=y
+CONFIG_I8254=y
+CONFIG_I8257=y
+CONFIG_I8259=y
+CONFIG_I82801B11=y
+CONFIG_IDE_CORE=y
+CONFIG_IDE_PCI=y
+CONFIG_IDE_PIIX=y
+CONFIG_IDE_QDEV=y
+CONFIG_IOAPIC=y
+CONFIG_IOH3420=y
+CONFIG_ISA_BUS=y
+CONFIG_ISA_DEBUG=y
+CONFIG_ISA_TESTDEV=y
+CONFIG_LPC_ICH9=y
+CONFIG_MC146818RTC=y
+CONFIG_MEM_DEVICE=y
+CONFIG_NVDIMM=y
+CONFIG_OPENGL=y
+CONFIG_PAM=y
+CONFIG_PC=y
+CONFIG_PCI=y
+CONFIG_PCIE_PORT=y
+CONFIG_PCI_DEVICES=y
+CONFIG_PCI_EXPRESS=y
+CONFIG_PCI_EXPRESS_Q35=y
+CONFIG_PCI_I440FX=y
+CONFIG_PCI_TESTDEV=y
+CONFIG_PCKBD=y
+CONFIG_PCSPK=y
+CONFIG_PC_ACPI=y
+CONFIG_PC_PCI=y
+CONFIG_PFLASH_CFI01=y
+CONFIG_PVPANIC=y
+CONFIG_PXB=y
+CONFIG_Q35=y
+CONFIG_QXL=y
+CONFIG_RTL8139_PCI=y
+CONFIG_SCSI=y
+CONFIG_SERIAL=y
+CONFIG_SERIAL_ISA=y
+CONFIG_SERIAL_PCI=y
+CONFIG_SEV=y
+CONFIG_SGA=y
+CONFIG_SMBIOS=y
+CONFIG_SMBUS_EEPROM=y
+CONFIG_SPICE=y
+CONFIG_TEST_DEVICES=y
+CONFIG_USB=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_EHCI_PCI=y
+CONFIG_USB_SMARTCARD=y
+CONFIG_USB_STORAGE_BOT=y
+CONFIG_USB_UHCI=y
+CONFIG_USB_XHCI=y
+CONFIG_USB_XHCI_NEC=y
+CONFIG_VFIO=y
+CONFIG_VFIO_PCI=y
+CONFIG_VGA=y
+CONFIG_VGA_CIRRUS=y
+CONFIG_VGA_PCI=y
+CONFIG_VHOST_USER=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_VIRTIO_VGA=y
+CONFIG_VMMOUSE=y
+CONFIG_VMPORT=y
+CONFIG_VTD=y
+CONFIG_WDT_IB6300ESB=y
+CONFIG_WDT_IB700=y
+CONFIG_XIO3130=y
+CONFIG_TPM_CRB=y
+CONFIG_TPM_TIS=y
+CONFIG_TPM_EMULATOR=y
+CONFIG_TPM_PASSTHROUGH=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 64b2ee2960..b5de7e5279 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -1,3 +1,5 @@
 # Default configuration for x86_64-softmmu
 
-include i386-softmmu.mak
+#include i386-softmmu.mak
+
+include x86_64-rh-devices.mak
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 2034dd749e..ab203ad448 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -449,8 +449,8 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
     static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
     pm->acpi_memory_hotplug.is_enabled = true;
     pm->cpu_hotplug_legacy = true;
-    pm->disable_s3 = 0;
-    pm->disable_s4 = 0;
+    pm->disable_s3 = 1;
+    pm->disable_s4 = 1;
     pm->s4_val = 2;
 
     object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
index fe749f65fd..2aa1a9efdd 100644
--- a/hw/arm/Makefile.objs
+++ b/hw/arm/Makefile.objs
@@ -27,7 +27,7 @@ obj-$(CONFIG_VEXPRESS) += vexpress.o
 obj-$(CONFIG_ZYNQ) += xilinx_zynq.o
 obj-$(CONFIG_SABRELITE) += sabrelite.o
 
-obj-$(CONFIG_ARM_V7M) += armv7m.o
+#obj-$(CONFIG_ARM_V7M) += armv7m.o
 obj-$(CONFIG_EXYNOS4) += exynos4210.o
 obj-$(CONFIG_PXA2XX) += pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
 obj-$(CONFIG_DIGIC) += digic.o
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index ac5d31e8c1..e925bac002 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -46,6 +46,8 @@
 #include "qemu/module.h"
 #include "trace.h"
 
+#include "hw/boards.h"
+
 /********************************************************/
 /* debug Floppy devices */
 
@@ -2638,6 +2640,14 @@ static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
     int i, j;
     static int command_tables_inited = 0;
 
+    /* Restricted for Red Hat Enterprise Linux: */
+    MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+    if (!strstr(mc->name, "-rhel7.")) {
+        error_setg(errp, "Device %s is not supported with machine type %s",
+                   object_get_typename(OBJECT(dev)), mc->name);
+        return;
+    }
+
     if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
         error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'");
     }
diff --git a/hw/bt/Makefile.objs b/hw/bt/Makefile.objs
index 867a7d2e8a..e678e9ee3c 100644
--- a/hw/bt/Makefile.objs
+++ b/hw/bt/Makefile.objs
@@ -1,3 +1,3 @@
-common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
-common-obj-y += hci-csr.o
+#common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
+#common-obj-y += hci-csr.o
 
diff --git a/hw/cpu/Makefile.objs b/hw/cpu/Makefile.objs
index 8db9e8a7b3..1601ea93c7 100644
--- a/hw/cpu/Makefile.objs
+++ b/hw/cpu/Makefile.objs
@@ -1,5 +1,6 @@
 obj-$(CONFIG_ARM11MPCORE) += arm11mpcore.o
 obj-$(CONFIG_REALVIEW) += realview_mpcore.o
 obj-$(CONFIG_A9MPCORE) += a9mpcore.o
-obj-$(CONFIG_A15MPCORE) += a15mpcore.o
-common-obj-y += core.o cluster.o
+#obj-$(CONFIG_A15MPCORE) += a15mpcore.o
+common-obj-y += core.o
+# cluster.o
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index f2182e3bef..3d0cda1b52 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -1,8 +1,9 @@
 common-obj-$(CONFIG_DDC) += i2c-ddc.o
 common-obj-$(CONFIG_EDID) += edid-generate.o edid-region.o
 
-common-obj-$(CONFIG_FW_CFG_DMA) += ramfb.o
-common-obj-$(CONFIG_FW_CFG_DMA) += ramfb-standalone.o
+# Disabled for Red Hat Enterprise Linux
+#common-obj-$(CONFIG_FW_CFG_DMA) += ramfb.o
+#common-obj-$(CONFIG_FW_CFG_DMA) += ramfb-standalone.o
 
 common-obj-$(CONFIG_ADS7846) += ads7846.o
 common-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index cd283e53b4..93afa26fda 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -2975,6 +2975,9 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp)
      PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
      int16_t device_id = pc->device_id;
 
+     warn_report("'cirrus-vga' is deprecated, "
+                 "please use a different VGA card instead");
+
      /* follow real hardware, cirrus card emulated has 4 MB video memory.
        Also accept 8 MB/16 MB for backward compatibility. */
      if (s->vga.vram_size_mb != 4 && s->vga.vram_size_mb != 8 &&
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index db313dd3b1..e14858ca64 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -251,7 +251,8 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
     k->class_id = PCI_CLASS_STORAGE_IDE;
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-    dc->hotpluggable = false;
+    /* Disabled for Red Hat Enterprise Linux: */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo piix3_ide_info = {
@@ -279,6 +280,8 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_STORAGE_IDE;
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
     dc->hotpluggable = false;
+    /* Disabled for Red Hat Enterprise Linux: */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo piix4_ide_info = {
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index f0acfd86f7..390eb6579c 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -571,6 +571,8 @@ static void i8042_class_initfn(ObjectClass *klass, void *data)
     dc->realize = i8042_realizefn;
     dc->vmsd = &vmstate_kbd_isa;
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+    /* Disabled for Red Hat Enterprise Linux: */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo i8042_info = {
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index a73f8d404e..fc73fdd6fa 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1795,6 +1795,7 @@ static const E1000Info e1000_devices[] = {
         .revision  = 0x03,
         .phy_id2   = E1000_PHY_ID2_8254xx_DEFAULT,
     },
+#if 0 /* Disabled for Red Hat Enterprise Linux 7 */
     {
         .name      = "e1000-82544gc",
         .device_id = E1000_DEV_ID_82544GC_COPPER,
@@ -1807,6 +1808,7 @@ static const E1000Info e1000_devices[] = {
         .revision  = 0x03,
         .phy_id2   = E1000_PHY_ID2_8254xx_DEFAULT,
     },
+#endif
 };
 
 static void e1000_register_types(void)
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index f27131102d..17f10efae2 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -386,6 +386,7 @@ static const TypeInfo i440fx_info = {
     },
 };
 
+#if 0 /*  Disabled in Red Hat Enterprise Linux */
 /* IGD Passthrough Host Bridge. */
 typedef struct {
     uint8_t offset;
@@ -469,6 +470,7 @@ static const TypeInfo igd_passthrough_i440fx_info = {
     .instance_size = sizeof(PCII440FXState),
     .class_init    = igd_passthrough_i440fx_class_init,
 };
+#endif
 
 static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
                                                 PCIBus *rootbus)
@@ -514,7 +516,9 @@ static const TypeInfo i440fx_pcihost_info = {
 static void i440fx_register_types(void)
 {
     type_register_static(&i440fx_info);
+#if 0 /*  Disabled in Red Hat Enterprise Linux */
     type_register_static(&igd_passthrough_i440fx_info);
+#endif
     type_register_static(&i440fx_pcihost_info);
 }
 
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 8339c4c0f8..301cd7b4e4 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -403,10 +403,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("power5+_v2.1"),
+#endif
     DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"),
     DEFINE_SPAPR_CPU_CORE_TYPE("power7+_v2.1"),
     DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"),
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 303ac084a0..700a91886e 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -30,7 +30,9 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
 ifeq ($(CONFIG_USB_SMARTCARD),y)
 common-obj-y                          += dev-smartcard-reader.o
 common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
-smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+# Disabled for Red Hat Enterprise Linux:
+# smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+smartcard.mo-objs := ccid-card-passthru.o
 smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
 smartcard.mo-libs := $(SMARTCARD_LIBS)
 endif
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 136f3a9ad6..4505ffe48a 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -1166,6 +1166,7 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)
     trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name);
 }
 
+#if 0 /* Disabled for Red Hat Enterprise Linux */
 /*
  * Intel IGD support
  *
@@ -1239,6 +1240,7 @@ static int igd_gen(VFIOPCIDevice *vdev)
 
     return 8; /* Assume newer is compatible */
 }
+#endif
 
 typedef struct VFIOIGDQuirk {
     struct VFIOPCIDevice *vdev;
@@ -1311,6 +1313,7 @@ typedef struct {
     uint8_t len;
 } IGDHostInfo;
 
+#if 0 /* Disabled for Red Hat Enterprise Linux */
 static const IGDHostInfo igd_host_bridge_infos[] = {
     {PCI_REVISION_ID,         2},
     {PCI_SUBSYSTEM_VENDOR_ID, 2},
@@ -1559,9 +1562,11 @@ static const MemoryRegionOps vfio_igd_index_quirk = {
     .write = vfio_igd_quirk_index_write,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
+#endif
 
 static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
 {
+#if 0 /* Disabled for Red Hat Enterprise Linux */
     struct vfio_region_info *rom = NULL, *opregion = NULL,
                             *host = NULL, *lpc = NULL;
     VFIOQuirk *quirk;
@@ -1572,6 +1577,7 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
     uint32_t gmch;
     uint16_t cmd_orig, cmd;
     Error *err = NULL;
+#endif
 
     /*
      * This must be an Intel VGA device at address 00:02.0 for us to even
@@ -1585,6 +1591,8 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
         return;
     }
 
+#if 0 /* Disabled for Red Hat Enterprise Linux */
+
     /*
      * We need to create an LPC/ISA bridge at PCI bus address 00:1f.0 that we
      * can stuff host values into, so if there's already one there and it's not
@@ -1809,6 +1817,7 @@ out:
     g_free(opregion);
     g_free(host);
     g_free(lpc);
+#endif
 }
 
 /*
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 2d40b396f2..c8534d3035 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3220,6 +3220,7 @@ static const TypeInfo vfio_pci_dev_info = {
     },
 };
 
+#if 0 /* Disabled for Red Hat Enterprise Linux */
 static Property vfio_pci_dev_nohotplug_properties[] = {
     DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
     DEFINE_PROP_END_OF_LIST(),
@@ -3239,11 +3240,15 @@ static const TypeInfo vfio_pci_nohotplug_dev_info = {
     .instance_size = sizeof(VFIOPCIDevice),
     .class_init = vfio_pci_nohotplug_dev_class_init,
 };
+#endif
 
 static void register_vfio_pci_dev_type(void)
 {
     type_register_static(&vfio_pci_dev_info);
+
+#if 0 /* Disabled for Red Hat Enterprise Linux */
     type_register_static(&vfio_pci_nohotplug_dev_info);
+#endif
 }
 
 type_init(register_vfio_pci_dev_type)
diff --git a/qemu-options.hx b/qemu-options.hx
index 65c9473b73..fc17aca631 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2111,11 +2111,6 @@ ETEXI
 
 DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
     "-no-hpet        disable HPET\n", QEMU_ARCH_I386)
-STEXI
-@item -no-hpet
-@findex -no-hpet
-Disable HPET support.
-ETEXI
 
 DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
     "-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]\n"
@@ -3125,6 +3120,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
+#if 0
 DEFHEADING(Bluetooth(R) options:)
 STEXI
 @table @option
@@ -3203,6 +3199,7 @@ STEXI
 @end table
 ETEXI
 DEFHEADING()
+#endif
 
 #ifdef CONFIG_TPM
 DEFHEADING(TPM device options:)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 7a4ac9339b..3788fc3c4a 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2744,7 +2744,9 @@ static void arm_cpu_register_types(void)
     type_register_static(&idau_interface_type_info);
 
     while (info->name) {
-        cpu_register(info);
+        /* RHEL specific: Filter out unsupported cpu models */
+        if (!strcmp(info->name, "cortex-a15"))
+            cpu_register(info);
         info++;
     }
 
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 69f518a21a..1b7880ae3a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1835,14 +1835,14 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .family = 6,
         .model = 6,
         .stepping = 3,
-        .features[FEAT_1_EDX] =
-            PPRO_FEATURES |
-            CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
-            CPUID_PSE36,
-        .features[FEAT_1_ECX] =
-            CPUID_EXT_SSE3 | CPUID_EXT_CX16,
-        .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
+        .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
+            CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
+            CPUID_MCA | CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC |
+            CPUID_CX8 | CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC |
+            CPUID_PSE | CPUID_DE | CPUID_FP87,
+        .features[FEAT_1_ECX] = CPUID_EXT_CX16 | CPUID_EXT_SSE3,
+        .features[FEAT_8000_0001_EDX] = CPUID_EXT2_LM | CPUID_EXT2_NX |
+            CPUID_EXT2_SYSCALL,
         .features[FEAT_8000_0001_ECX] =
             CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM,
         .xlevel = 0x8000000A,
@@ -2128,6 +2128,25 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .xlevel = 0x80000008,
         .model_id = "Intel(R) Atom(TM) CPU N270   @ 1.60GHz",
     },
+    {
+        .name = "cpu64-rhel6",
+        .level = 4,
+        .vendor = CPUID_VENDOR_AMD,
+        .family = 6,
+        .model = 13,
+        .stepping = 3,
+        .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
+             CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
+             CPUID_MCA | CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC |
+             CPUID_CX8 | CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC |
+             CPUID_PSE | CPUID_DE | CPUID_FP87,
+        .features[FEAT_1_ECX] = CPUID_EXT_CX16 | CPUID_EXT_SSE3,
+        .features[FEAT_8000_0001_EDX] = CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
+        .features[FEAT_8000_0001_ECX] = CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
+             CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
+        .xlevel = 0x8000000A,
+        .model_id = "QEMU Virtual CPU version (cpu64-rhel6)",
+    },
     {
         .name = "Conroe",
         .level = 10,
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
index 086548e9b9..1bbf378c18 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 401 family                                                    */
     POWERPC_DEF("401",           CPU_POWERPC_401,                    401,
@@ -740,8 +741,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,
@@ -760,6 +763,7 @@
                 "PowerPC 970MP v1.1")
     POWERPC_DEF("power5+_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("power7+_v2.1",  CPU_POWERPC_POWER7P_v21,            POWER7,
@@ -780,6 +784,7 @@
 /* PowerPC CPU aliases                                                     */
 
 PowerPCCPUAlias ppc_cpu_aliases[] = {
+#if 0  /* Embedded and 32-bit CPUs disabled for Red Hat Enterprise Linux */
     { "403", "403gc" },
     { "405", "405d4" },
     { "405cr", "405crc" },
@@ -938,12 +943,15 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
     { "7447a", "7447a_v1.2" },
     { "7457a", "7457a_v1.2" },
     { "apollo7pm", "7457a_v1.0" },
+#endif
 #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+", "power5+_v2.1" },
     { "power5gs", "power5+_v2.1" },
+#endif
     { "power7", "power7_v2.3" },
     { "power7+", "power7+_v2.1" },
     { "power8e", "power8e_v2.1" },
@@ -952,6 +960,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
     { "power9", "power9_v2.0" },
 #endif
 
+#if 0  /* Disabled for Red Hat Enterprise Linux */
     /* Generic PowerPCs */
 #if defined(TARGET_PPC64)
     { "ppc64", "970fx_v3.1" },
@@ -959,5 +968,6 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
     { "ppc32", "604" },
     { "ppc", "604" },
     { "default", "604" },
+#endif
     { NULL, NULL }
 };
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 7e92fb2e15..be718220d7 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -404,6 +404,9 @@ static void check_unavailable_features(const S390CPUModel *max_model,
         (max_model->def->gen == model->def->gen &&
          max_model->def->ec_ga < model->def->ec_ga)) {
         list_add_feat("type", unavailable);
+    } else if (model->def->gen < 11 && kvm_enabled()) {
+        /* Older CPU models are not supported on Red Hat Enterprise Linux */
+        list_add_feat("type", unavailable);
     }
 
     /* detect missing features if any to properly report them */
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 0c9d14b4b1..a02d569537 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -2387,6 +2387,14 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
         error_setg(errp, "KVM doesn't support CPU models");
         return;
     }
+
+    /* Older CPU models are not supported on Red Hat Enterprise Linux */
+    if (model->def->gen < 11) {
+        error_setg(errp, "KVM: Unsupported CPU type specified: %s",
+                   MACHINE(qdev_get_machine())->cpu_type);
+        return;
+    }
+
     prop.cpuid = s390_cpuid_from_cpu_model(model);
     prop.ibc = s390_ibc_from_cpu_model(model);
     /* configure cpu features indicated via STFL(e) */
diff --git a/util/memfd.c b/util/memfd.c
index 4a3c07e0be..3303ec9da4 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -193,7 +193,7 @@ bool qemu_memfd_alloc_check(void)
  */
 bool qemu_memfd_check(unsigned int flags)
 {
-#ifdef CONFIG_LINUX
+#if 0 /* RHEL: memfd support disabled */
     int mfd = memfd_create("test", flags | MFD_CLOEXEC);
 
     if (mfd >= 0) {
diff --git a/vl.c b/vl.c
index 6a65a64bfd..668a34577e 100644
--- a/vl.c
+++ b/vl.c
@@ -166,7 +166,7 @@ Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 int win2k_install_hack = 0;
 int singlestep = 0;
 int acpi_enabled = 1;
-int no_hpet = 0;
+int no_hpet = 1; /* Always disabled for Red Hat Enterprise Linux */
 int fd_bootchk = 1;
 static int no_reboot;
 int no_shutdown = 0;
@@ -914,6 +914,7 @@ static void configure_rtc(QemuOpts *opts)
     }
 }
 
+#if 0 // Disabled for Red Hat Enterprise Linux
 /***********************************************************/
 /* Bluetooth support */
 static int nb_hcis;
@@ -1035,6 +1036,7 @@ static int bt_parse(const char *opt)
     error_report("bad bluetooth parameter '%s'", opt);
     return 1;
 }
+#endif
 
 static int parse_name(void *opaque, QemuOpts *opts, Error **errp)
 {
@@ -3128,6 +3130,7 @@ int main(int argc, char **argv, char **envp)
                 }
                 break;
 #endif
+#if 0 /* Disabled for Red Hat Enterprise Linux */
             case QEMU_OPTION_bt:
                 warn_report("The bluetooth subsystem is deprecated and will "
                             "be removed soon. If the bluetooth subsystem is "
@@ -3135,6 +3138,7 @@ int main(int argc, char **argv, char **envp)
                             "qemu-devel@nongnu.org with your usecase.");
                 add_device_config(DEV_BT, optarg);
                 break;
+#endif
             case QEMU_OPTION_audio_help:
                 audio_legacy_help();
                 exit (0);
@@ -4282,9 +4286,11 @@ int main(int argc, char **argv, char **envp)
 
     tpm_init();
 
+#if 0 // Disabled for Red Hat Enterprise Linux
     /* init the bluetooth world */
     if (foreach_device_config(DEV_BT, bt_parse))
         exit(1);
+#endif
 
     if (!xen_enabled()) {
         /* On 32-bit hosts, QEMU is limited by virtual address space */
-- 
2.21.0

