From nobody Mon Apr 29 23:29:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1599226380; cv=none; d=zohomail.com; s=zohoarc; b=CKthCIRVG7X+ZWcXIeOX/XskrDl9DQbYJ2CAGf09hSgHbQOj7SqhO2EFfhZ8rVwC8sujB/XOr0LGlILKc7bqHUs+tKzWLr7MH0F1tOSYmDjxNlksKmHhXY/g/AhdFhGDIQ9G1WIkmw64uJFpUjGyhC/OK3SSsQlCLJJX4stfias= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599226380; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=EJICNcVaN8n/5BgYLiEvYlWcKYMBBQ0Y7yIYu9xdZs8=; b=Axjn+3Cs8lZxUgv/hsDnLY6Ao5SGtOYb5+uDGx0U8+pwUNYllc3XKRfRGxAHf06pOB6vmxaOd2Y7MyGAIh7zJzpB6YZ7nNiT/Ms0fsb9qrQlBU1ewQBJtju+eBaenmtpF1iAa9dQwxhTjaLCxRBM4QLSJbFBiwfLo6CVB7J6hZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599226380706273.45533566509357; Fri, 4 Sep 2020 06:33:00 -0700 (PDT) Received: from localhost ([::1]:51440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEB6X-0003bU-Nq for importer@patchew.org; Fri, 04 Sep 2020 08:46:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEB4m-0001JW-Gr for qemu-devel@nongnu.org; Fri, 04 Sep 2020 08:44:20 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:39164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEB4k-0006ss-Ge for qemu-devel@nongnu.org; Fri, 04 Sep 2020 08:44:20 -0400 Received: by mail-pf1-x444.google.com with SMTP id u128so4542705pfb.6 for ; Fri, 04 Sep 2020 05:44:17 -0700 (PDT) Received: from localhost.localdomain ([115.96.104.172]) by smtp.googlemail.com with ESMTPSA id i20sm6063695pgk.77.2020.09.04.05.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 05:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anisinha-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=EJICNcVaN8n/5BgYLiEvYlWcKYMBBQ0Y7yIYu9xdZs8=; b=vrqNa6Ek0Vu1TW5QFfk5X6BjPFGkeGAuzWzd6MPHSBFKot0puGPLdXn02Rri9D6/Tv qf5h/FzEqCQFYZ+kj6yttFMKs8ssx9qccFcdyomV8ELCNFumE5lgfucUucRKPRvpbElW PHUBk1x8A1cAXmIgLxSc9Nkxa2npdKNEI5932yd0Amz40KixurDKVnrf6kK0Qu0ao15D sHqFqxAIZCexyJeGDzXNTMz2Ixc10e3uakXsw1bl7ziQOlqBffiQg8ggEcuA+/WW9Rk7 M3vK3uitCBfewvtug/9PrQX6Ms8EPvaog6P59Ev7eeKfEmYgTRltfjxWhxgyxb3VkAa/ pnfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EJICNcVaN8n/5BgYLiEvYlWcKYMBBQ0Y7yIYu9xdZs8=; b=BLGiIyzkNCr/w98ir5jgLiW0sECkh86wdgPvl/aMeVWFPzAI8cCiybxPI9Di8MGcns WVT0wryo2KwcCb469boODuI0WNRgRZGeS3VNicoDNsBiwU93e1J9vZPSnu6OYnZ5mjHh Ac7dv1cL/oiudQsIsYkSEHDjg/GneTR4yg7XLIuSUC0HdbXEmr8lxM2ArSx8Vr7JId7z VxbZPUF31cA7FRutb6sAuke/SmuPMb49VFQdCEOEWQZqHLN/YIE/iTfCFEvPKaJtNspX hl6Wlit2w+0n1lU90JHwjm/4SSO6QVoM3LsgSsD1tzl7qsVqyP84aLA31h7odq6/8FeF /wBQ== X-Gm-Message-State: AOAM533NmJk/zKG4j7okjvgQ71fg3tk8MK/kwS2f7qQ8F59d11bPBGJ+ 862MH2QftWzqlNRMVhjNGVpL6rSaLg5Zpw== X-Google-Smtp-Source: ABdhPJzXdjGHrvuLUWAkHhS1BrnqOlXAwBO48h6FNaIq/U3FlM37UzL+wdh1HycKNeVyOsmkbf7rqw== X-Received: by 2002:a63:4404:: with SMTP id r4mr6573679pga.29.1599223456218; Fri, 04 Sep 2020 05:44:16 -0700 (PDT) From: Ani Sinha To: qemu-devel@nongnu.org Subject: [PATCH v2] i440fx/acpi: disable hotplug of cold plugged bridges regarldless of hotplug switch Date: Fri, 4 Sep 2020 18:14:04 +0530 Message-Id: <20200904124404.9894-1-ani@anisinha.ca> X-Mailer: git-send-email 2.17.1 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: none client-ip=2607:f8b0:4864:20::444; envelope-from=ani@anisinha.ca; helo=mail-pf1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , jusual@redhat.com, Paolo Bonzini , Ani Sinha , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cold plugged bridges should not be hot unpluggable, even when their hotplug property (acpi-pci-hotplug-with-bridge-support) is turned off. However, with the current implementaton, windows would try to hot-unplug a pci bridge when it's hotplug switch is off. This is regardless of whether there are devices attached to the bridge. When devices are attached to the bridge, the bridge is ultimately not hot-unpluggable. We have a demo video here: https://youtu.be/pME2sjyQweo In this fix, we identify a cold plugged bridge and for cold plugged bridges, we do not add the appropriate amls and acpi methods that are used by the OS to identify a hot-unpluggable pci device. After this change, Windows does n= ot show an option to eject the PCI bridge. A demo video is here: https://youtu.be/kbgej5B9Hgs While at it, I have also updated a stale comment. This change is tested with a Windows 2012R2 guest image and Windows 2019 se= rver guest image running on Ubuntu 18.04 host. This change is based off of upstr= eam qemu master branch tag v5.1.0. Signed-off-by: Ani Sinha --- hw/i386/acpi-build.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Changelog: v2: cosmetic commit log update. v1: initial patch. diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b7bcbbbb2a..90b863f4ec 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -359,6 +359,7 @@ static void build_append_pci_bus_devices(Aml *parent_sc= ope, PCIBus *bus, int slot =3D PCI_SLOT(i); bool hotplug_enabled_dev; bool bridge_in_acpi; + bool cold_plugged_bridge; =20 if (!pdev) { if (bsel) { /* add hotplug slots for non present devices */ @@ -380,15 +381,14 @@ static void build_append_pci_bus_devices(Aml *parent_= scope, PCIBus *bus, pc =3D PCI_DEVICE_GET_CLASS(pdev); dc =3D DEVICE_GET_CLASS(pdev); =20 - /* When hotplug for bridges is enabled, bridges are - * described in ACPI separately (see build_pci_bus_end). - * In this case they aren't themselves hot-pluggable. + /* + * Cold plugged bridges aren't themselves hot-pluggable. * Hotplugged bridges *are* hot-pluggable. */ - bridge_in_acpi =3D pc->is_bridge && pcihp_bridge_en && - !DEVICE(pdev)->hotplugged; + cold_plugged_bridge =3D pc->is_bridge && !DEVICE(pdev)->hotplugged; + bridge_in_acpi =3D cold_plugged_bridge && pcihp_bridge_en; =20 - hotplug_enabled_dev =3D bsel && dc->hotpluggable && !bridge_in_acp= i; + hotplug_enabled_dev =3D bsel && dc->hotpluggable && !cold_plugged_= bridge; =20 if (pc->class_id =3D=3D PCI_CLASS_BRIDGE_ISA) { continue; --=20 2.17.1