hw/i386/pc: Ensure vmport prerequisites are fulfilled

Since commit 4ccd5fe22f ('pc: add option
to disable PS/2 mouse/keyboard'), the vmport will not be created unless
the i8042 PS/2 controller is enabled. To avoid confusion, let's fail if
vmport was explicitly requested, but the i8042 controller is disabled.
This also changes the behavior of vmport=auto to take i8042 controller
availability into account.

Signed-off-by: Kamil Szczęk <kamil@szczek.dev>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <0MS3y5E-hHqODIhiuFxmCnIrXd612JIGq31UuMsz4KGCKZ_wWuF-PHGKTRSGS0nWaPEddOdF4YOczHdgorulECPo792OhWov7O9BBF6UMX4=@szczek.dev>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Kamil Szczęk 2024-08-17 15:26:15 +00:00 committed by Philippe Mathieu-Daudé
parent c911f875f8
commit 702cbdc46b
2 changed files with 10 additions and 5 deletions

View File

@ -1075,7 +1075,7 @@ static const MemoryRegionOps ioportF0_io_ops = {
}; };
static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
bool create_i8042, bool no_vmport) bool create_i8042, bool no_vmport, Error **errp)
{ {
int i; int i;
DriveInfo *fd[MAX_FD]; DriveInfo *fd[MAX_FD];
@ -1100,6 +1100,10 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
} }
if (!create_i8042) { if (!create_i8042) {
if (!no_vmport) {
error_setg(errp,
"vmport requires the i8042 controller to be enabled");
}
return; return;
} }
@ -1219,12 +1223,13 @@ void pc_basic_device_init(struct PCMachineState *pcms,
assert(pcms->vmport >= 0 && pcms->vmport < ON_OFF_AUTO__MAX); assert(pcms->vmport >= 0 && pcms->vmport < ON_OFF_AUTO__MAX);
if (pcms->vmport == ON_OFF_AUTO_AUTO) { if (pcms->vmport == ON_OFF_AUTO_AUTO) {
pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; pcms->vmport = (xen_enabled() || !pcms->i8042_enabled)
? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
} }
/* Super I/O */ /* Super I/O */
pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled, pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled,
pcms->vmport != ON_OFF_AUTO_ON); pcms->vmport != ON_OFF_AUTO_ON, &error_fatal);
} }
void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus)

View File

@ -68,8 +68,8 @@ SRST
``vmport=on|off|auto`` ``vmport=on|off|auto``
Enables emulation of VMWare IO port, for vmmouse etc. auto says Enables emulation of VMWare IO port, for vmmouse etc. auto says
to select the value based on accel. For accel=xen the default is to select the value based on accel and i8042. For accel=xen or
off otherwise the default is on. i8042=off the default is off otherwise the default is on.
``dump-guest-core=on|off`` ``dump-guest-core=on|off``
Include guest memory in a core dump. The default is on. Include guest memory in a core dump. The default is on.