[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v4 35/47] pc: add option to disable PS/2 mouse/keyboard
From: |
Michael S. Tsirkin |
Subject: |
[PULL v4 35/47] pc: add option to disable PS/2 mouse/keyboard |
Date: |
Mon, 7 Mar 2022 17:46:22 -0500 |
From: Joelle van Dyne <j@getutm.app>
On some older software like Windows 7 installer, having both a PS/2
mouse and USB mouse results in only one device working property (which
might be a different device each boot). While the workaround to not use
a USB mouse with such software is valid, it creates an inconsistent
experience if the user wishes to always use a USB mouse.
This introduces a new machine property to inhibit the creation of the
i8042 PS/2 controller.
Signed-off-by: Joelle van Dyne <j@getutm.app>
Message-Id: <20220227210655.45592-1-j@getutm.app>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/i386/pc.h | 2 ++
hw/i386/pc.c | 28 ++++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9c9f4ac748..1a27de9c8b 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -48,6 +48,7 @@ typedef struct PCMachineState {
bool sata_enabled;
bool pit_enabled;
bool hpet_enabled;
+ bool i8042_enabled;
bool default_bus_bypass_iommu;
uint64_t max_fw_size;
@@ -64,6 +65,7 @@ typedef struct PCMachineState {
#define PC_MACHINE_SMBUS "smbus"
#define PC_MACHINE_SATA "sata"
#define PC_MACHINE_PIT "pit"
+#define PC_MACHINE_I8042 "i8042"
#define PC_MACHINE_MAX_FW_SIZE "max-fw-size"
#define PC_MACHINE_SMBIOS_EP "smbios-entry-point-type"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c8696ac01e..32bf12421e 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1014,7 +1014,8 @@ static const MemoryRegionOps ioportF0_io_ops = {
},
};
-static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool
no_vmport)
+static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
+ bool create_i8042, bool no_vmport)
{
int i;
DriveInfo *fd[MAX_FD];
@@ -1036,6 +1037,10 @@ static void pc_superio_init(ISABus *isa_bus, bool
create_fdctrl, bool no_vmport)
}
}
+ if (!create_i8042) {
+ return;
+ }
+
i8042 = isa_create_simple(isa_bus, "i8042");
if (!no_vmport) {
isa_create_simple(isa_bus, TYPE_VMPORT);
@@ -1131,7 +1136,8 @@ void pc_basic_device_init(struct PCMachineState *pcms,
i8257_dma_init(isa_bus, 0);
/* Super I/O */
- pc_superio_init(isa_bus, create_fdctrl, pcms->vmport != ON_OFF_AUTO_ON);
+ pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled,
+ pcms->vmport != ON_OFF_AUTO_ON);
}
void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus)
@@ -1512,6 +1518,20 @@ static void pc_machine_set_hpet(Object *obj, bool value,
Error **errp)
pcms->hpet_enabled = value;
}
+static bool pc_machine_get_i8042(Object *obj, Error **errp)
+{
+ PCMachineState *pcms = PC_MACHINE(obj);
+
+ return pcms->i8042_enabled;
+}
+
+static void pc_machine_set_i8042(Object *obj, bool value, Error **errp)
+{
+ PCMachineState *pcms = PC_MACHINE(obj);
+
+ pcms->i8042_enabled = value;
+}
+
static bool pc_machine_get_default_bus_bypass_iommu(Object *obj, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
@@ -1641,6 +1661,7 @@ static void pc_machine_initfn(Object *obj)
pcms->smbus_enabled = true;
pcms->sata_enabled = true;
pcms->pit_enabled = true;
+ pcms->i8042_enabled = true;
pcms->max_fw_size = 8 * MiB;
#ifdef CONFIG_HPET
pcms->hpet_enabled = true;
@@ -1777,6 +1798,9 @@ static void pc_machine_class_init(ObjectClass *oc, void
*data)
object_class_property_set_description(oc, "hpet",
"Enable/disable high precision event timer emulation");
+ object_class_property_add_bool(oc, PC_MACHINE_I8042,
+ pc_machine_get_i8042, pc_machine_set_i8042);
+
object_class_property_add_bool(oc, "default-bus-bypass-iommu",
pc_machine_get_default_bus_bypass_iommu,
pc_machine_set_default_bus_bypass_iommu);
--
MST
- [PULL v4 25/47] pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt, (continued)
- [PULL v4 25/47] pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt, Michael S. Tsirkin, 2022/03/07
- [PULL v4 23/47] virtio-net: Unlimit tx queue size if peer is vdpa, Michael S. Tsirkin, 2022/03/07
- [PULL v4 24/47] pcie: Add support for Single Root I/O Virtualization (SR/IOV), Michael S. Tsirkin, 2022/03/07
- [PULL v4 26/47] pcie: Add a helper to the SR/IOV API, Michael S. Tsirkin, 2022/03/07
- [PULL v4 27/47] pcie: Add 1.2 version token for the Power Management Capability, Michael S. Tsirkin, 2022/03/07
- [PULL v4 28/47] pci-bridge/xio3130_upstream: Fix error handling, Michael S. Tsirkin, 2022/03/07
- [PULL v4 29/47] pci-bridge/xio3130_downstream: Fix error handling, Michael S. Tsirkin, 2022/03/07
- [PULL v4 30/47] headers: Add pvpanic.h, Michael S. Tsirkin, 2022/03/07
- [PULL v4 31/47] hw/misc/pvpanic: Use standard headers instead, Michael S. Tsirkin, 2022/03/07
- [PULL v4 33/47] pci: expose TYPE_XIO3130_DOWNSTREAM name, Michael S. Tsirkin, 2022/03/07
- [PULL v4 35/47] pc: add option to disable PS/2 mouse/keyboard,
Michael S. Tsirkin <=
- [PULL v4 34/47] acpi: pcihp: pcie: set power on cap on parent slot, Michael S. Tsirkin, 2022/03/07
- [PULL v4 32/47] pci: show id info when pci BDF conflict, Michael S. Tsirkin, 2022/03/07
- [PULL v4 36/47] vhost-vsock: detach the virqueue element in case of error, Michael S. Tsirkin, 2022/03/07
- [PULL v4 37/47] x86: cleanup unused compat_apic_id_mode, Michael S. Tsirkin, 2022/03/07
- [PULL v4 38/47] hw/smbios: Add table 4 parameter, "processor-id", Michael S. Tsirkin, 2022/03/07
- [PULL v4 39/47] pci: drop COMPAT_PROP_PCP for 2.0 machine types, Michael S. Tsirkin, 2022/03/07
- [PULL v4 40/47] event_notifier: add event_notifier_get_wfd(), Michael S. Tsirkin, 2022/03/07
- [PULL v4 41/47] vhost: use wfd on functions setting vring call fd, Michael S. Tsirkin, 2022/03/07
- [PULL v4 42/47] configure, meson: allow enabling vhost-user on all POSIX systems, Michael S. Tsirkin, 2022/03/07
- [PULL v4 43/47] docs: vhost-user: add subsection for non-Linux platforms, Michael S. Tsirkin, 2022/03/07