From nobody Sun Nov 24 10:43:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=szczek.dev ARC-Seal: i=1; a=rsa-sha256; t=1723908358; cv=none; d=zohomail.com; s=zohoarc; b=OY15pgDL0NXcvgyq7Za57AcuQemz456wAwJgUmT3sMorzUjamOKBFm/Y8Gt5BPwziAGtUsbzEanQigihhmjvp30JrLQEpGLjV6rMjzmy+NwQUi8FFwUIQApkiuGxP4f4kAWcGmT4sp0Rx8QqGmryu68BWnZC5H07PJbgyrT0/v0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723908358; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pjjQ6/SzofMzx51HfeLaFW2R17BybGcImSMEFiILnx4=; b=eTF6Jd+5CCXylR9bJTvVpesGxckNI93Q78pBJRa77havlwAFpNioR8/J5Jce7n3TEuJpVmUK5IurT8xXBt6xaWLCE408oYfG+Y69rkdbaOFVKYDTvG+iIVhgz2DgjhaQ7maj9OeiCoP7g8hVFj/e2VtjK7Q1J3/efHUJPFWw47k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1723908357604284.697891601078; Sat, 17 Aug 2024 08:25:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfLJF-00027w-M8; Sat, 17 Aug 2024 11:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfLJC-00020c-Mn for qemu-devel@nongnu.org; Sat, 17 Aug 2024 11:25:38 -0400 Received: from mail-4022.proton.ch ([185.70.40.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfLJB-0002tz-0o for qemu-devel@nongnu.org; Sat, 17 Aug 2024 11:25:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szczek.dev; s=protonmail3; t=1723908334; x=1724167534; bh=pjjQ6/SzofMzx51HfeLaFW2R17BybGcImSMEFiILnx4=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=O4/bk5mJLEUFGYRLgAY4ASL+fPD/CYGxahy7XfwQ0sQsX8Y+hNmVvXMcunVU24CsS dOrft7WlipAJWN0mdVVGEYiJS2nYEIbj3Qh9ooWBl/S4aMUdMgmCBes2LOwpkZBT3D 2SQfbjDN9VogfRfon5qQkU2eF5P4PIXjhA2XHANFKmNWnI9aZ0lTNPT1+4E25rJEio HQ+ziIO3rl+kmo/Qo07vYbKllVZfKJk9DsoavHH/D7C2vMlSwMLsjmW8pjIxusqcEo kYDNkBhd/bwJP6IhkhJhAPKRZud9k6lenxUEBWTXCmp5k23L2LqJmQSImhVmOquKRz 0n7iL9SL8gpVg== Date: Sat, 17 Aug 2024 15:25:31 +0000 To: "qemu-devel@nongnu.org" From: =?utf-8?Q?Kamil_Szcz=C4=99k?= Cc: "qemu-trivial@nongnu.org" , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow , Joelle van Dyne Subject: [PATCH-for-9.1 v3 1/2] hw/i386/pc: Unify vmport=auto handling Message-ID: In-Reply-To: References: Feedback-ID: 37679334:user:proton X-Pm-Message-ID: ccb779ee013ecd9b32c017226fc10513d5934360 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.70.40.22; envelope-from=kamil@szczek.dev; helo=mail-4022.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @szczek.dev) X-ZM-MESSAGEID: 1723908360096116600 Content-Type: text/plain; charset="utf-8" The code which translates vmport=3Dauto to on/off is currently separate for each PC machine variant, while being functionally equivalent. This moves the translation into a shared initialization function, while also tightening the enum assertion. Signed-off-by: Kamil Szcz=C4=99k Reviewed-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 5 +++++ hw/i386/pc_piix.c | 5 ----- hw/i386/pc_q35.c | 5 ----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c74931d577..72229a24ff 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1217,6 +1217,11 @@ void pc_basic_device_init(struct PCMachineState *pcm= s, isa_realize_and_unref(pcms->pcspk, isa_bus, &error_fatal); } =20 + assert(pcms->vmport >=3D 0 && pcms->vmport < ON_OFF_AUTO__MAX); + if (pcms->vmport =3D=3D ON_OFF_AUTO_AUTO) { + pcms->vmport =3D xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; + } + /* Super I/O */ pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled, pcms->vmport !=3D ON_OFF_AUTO_ON); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index d9e69243b4..347afa4c37 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -310,11 +310,6 @@ static void pc_init1(MachineState *machine, const char= *pci_type) =20 pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL); =20 - assert(pcms->vmport !=3D ON_OFF_AUTO__MAX); - if (pcms->vmport =3D=3D ON_OFF_AUTO_AUTO) { - pcms->vmport =3D xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; - } - /* init basic PC hardware */ pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc, !MACHINE_CLASS(pcmc)->no_floppy, 0x4); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 9d108b194e..f2d8edfa84 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -276,11 +276,6 @@ static void pc_q35_init(MachineState *machine) x86_register_ferr_irq(x86ms->gsi[13]); } =20 - assert(pcms->vmport !=3D ON_OFF_AUTO__MAX); - if (pcms->vmport =3D=3D ON_OFF_AUTO_AUTO) { - pcms->vmport =3D ON_OFF_AUTO_ON; - } - /* init basic PC hardware */ pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc, !mc->no_fl= oppy, 0xff0104); --=20 2.45.0 From nobody Sun Nov 24 10:43:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=szczek.dev ARC-Seal: i=1; a=rsa-sha256; t=1723908411; cv=none; d=zohomail.com; s=zohoarc; b=l2bGdBsI50iQozwmW/fCXdGNL1wvkoAxyGrB4d1mU8SgacdTE9vTfR7i2Vtil5SFkg3ZlVdP5vI5953I2z9Pmyf/1tm6sqM5tin8y2jh7ZooQlLrMj6GysiVVX8dnwz5xE7tisV+IOdYEs1lNGCMe4awUzfjcLqN7nxQg8cgZ8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723908411; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=s1J+/joXcnmcBoU8KLpZcBTE95mzfsErY/FNZ190l+o=; b=GVYepbAgqEFv8W6udyiZs15GUya02zrhICg8qhOuZkLcV7/uRwXu9IRegIC4CmyCp4rV4q21x5O2MwEtVKXkQuxGX/aHxv3Et8YPjjnUtWxZeiLCKS2ayS0QdMDtwI3+qtCpAENPPLnr8YWjh18AUgTyvaLP8b96dfnOINGKtRM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1723908411442469.7736946143092; Sat, 17 Aug 2024 08:26:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfLJy-0005Ze-43; Sat, 17 Aug 2024 11:26:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfLJu-0005SI-IT; Sat, 17 Aug 2024 11:26:22 -0400 Received: from mail-4018.proton.ch ([185.70.40.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfLJs-0002ww-T7; Sat, 17 Aug 2024 11:26:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szczek.dev; s=protonmail3; t=1723908378; x=1724167578; bh=s1J+/joXcnmcBoU8KLpZcBTE95mzfsErY/FNZ190l+o=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=rlW8z0XeQaNzMWc/WBcrDRx7BKdI3vFDWcIopNL3luqmJy7d/URc9c19bkMvL0ZnY BGZTdablPRmaBF3uaOC3gP0TifAjwbf+md4PP33RjUC9fbFa1y0jF2h2WSaVe03e52 5Fr/Gjp5VG7U98XVx+h2CNJW+xzZKwHOa5J7Q2rgKWGhNx1EKijVPKAw+C1ODneioy R9GmpmFo0qw5AutlSjeLVi/9Caog8sWxVFcXHLZ13tCfiuGTs5QEPNxMDw7542QR7e YXuj0xEuRlQeNXLj9bJm0Mxt8LEgjkSUypvkSFqnErOS51R7DEF8/K6GVS3xxXrRca 4iXFu3Hvg2U7Q== Date: Sat, 17 Aug 2024 15:26:15 +0000 To: "qemu-devel@nongnu.org" From: =?utf-8?Q?Kamil_Szcz=C4=99k?= Cc: "qemu-trivial@nongnu.org" , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow , Joelle van Dyne Subject: [PATCH-for-9.1 v3 2/2] hw/i386/pc: Ensure vmport prerequisites are fulfilled Message-ID: <0MS3y5E-hHqODIhiuFxmCnIrXd612JIGq31UuMsz4KGCKZ_wWuF-PHGKTRSGS0nWaPEddOdF4YOczHdgorulECPo792OhWov7O9BBF6UMX4=@szczek.dev> In-Reply-To: References: Feedback-ID: 37679334:user:proton X-Pm-Message-ID: 224da595a205981604b56b7ecd1509ad48547c22 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.70.40.18; envelope-from=kamil@szczek.dev; helo=mail-4018.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @szczek.dev) X-ZM-MESSAGEID: 1723908412514116600 Content-Type: text/plain; charset="utf-8" Since commit 4ccd5fe22feb95137d325f422016a6473541fe9f ('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=3Dauto to take i8042 controller availability into account. Signed-off-by: Kamil Szcz=C4=99k Reviewed-by: Bernhard Beschow --- hw/i386/pc.c | 11 ++++++++--- qemu-options.hx | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 72229a24ff..7779c88a91 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1075,7 +1075,7 @@ static const MemoryRegionOps ioportF0_io_ops =3D { }; =20 static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, - bool create_i8042, bool no_vmport) + bool create_i8042, bool no_vmport, Error **err= p) { int i; DriveInfo *fd[MAX_FD]; @@ -1100,6 +1100,10 @@ static void pc_superio_init(ISABus *isa_bus, bool cr= eate_fdctrl, } =20 if (!create_i8042) { + if (!no_vmport) { + error_setg(errp, + "vmport requires the i8042 controller to be enabled= "); + } return; } =20 @@ -1219,12 +1223,13 @@ void pc_basic_device_init(struct PCMachineState *pc= ms, =20 assert(pcms->vmport >=3D 0 && pcms->vmport < ON_OFF_AUTO__MAX); if (pcms->vmport =3D=3D ON_OFF_AUTO_AUTO) { - pcms->vmport =3D xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; + pcms->vmport =3D (xen_enabled() || !pcms->i8042_enabled) + ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } =20 /* Super I/O */ pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled, - pcms->vmport !=3D ON_OFF_AUTO_ON); + pcms->vmport !=3D ON_OFF_AUTO_ON, &error_fatal); } =20 void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) diff --git a/qemu-options.hx b/qemu-options.hx index cee0da2014..9197bb25d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -68,8 +68,8 @@ SRST =20 ``vmport=3Don|off|auto`` Enables emulation of VMWare IO port, for vmmouse etc. auto says - to select the value based on accel. For accel=3Dxen the default is - off otherwise the default is on. + to select the value based on accel and i8042. For accel=3Dxen or + i8042=3Doff the default is off otherwise the default is on. =20 ``dump-guest-core=3Don|off`` Include guest memory in a core dump. The default is on. --=20 2.45.0