From nobody Tue Apr 30 13:37:50 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=1599235999; cv=none; d=zohomail.com; s=zohoarc; b=ks3CjL2SFA1YTBMRwkiS8XwdfXElyGg33HoQTOB+OBSc+qDnPpUOEp2xZni1uVn99fpSaZg6MARdooX++SvfOLEQr8CkJfXXLHwioSoQrSkBDC7tQZQJX+hPyt0GVCuTjeX89GTWbL4NyxUlE01+k00rjlXUWbQK17zLIGYz8aM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599235999; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=ghFMA8BY0AfUwWC47JwaY8XB5Sm1/ORo3UrAREV6/J8=; b=FRr1qqBGkzHKIljCZ3QAFCPH3I7TMh0RaUjbglSo5ZE49S6jvdUh7uVkOCGloiXRR1BBvVHzsCdQ4gRtRT17dCPhb/TjtaQCPtNhx5ZTAX9vZBp/PmQmmo6n09BsncQZzPA4Wm9NpnCAYO4S4qMwM7DCoMPw+ajJWPB2b59rAgQ= 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 1599235999189479.6147250001644; Fri, 4 Sep 2020 09:13:19 -0700 (PDT) Received: from localhost ([::1]:58320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEEKy-0003tx-Qr for importer@patchew.org; Fri, 04 Sep 2020 12:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEEI3-0000M2-1T for qemu-devel@nongnu.org; Fri, 04 Sep 2020 12:10:15 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:35821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEEI0-0003ZF-U9 for qemu-devel@nongnu.org; Fri, 04 Sep 2020 12:10:14 -0400 Received: by mail-pf1-x443.google.com with SMTP id o68so4868275pfg.2 for ; Fri, 04 Sep 2020 09:10:12 -0700 (PDT) Received: from localhost.localdomain ([115.96.104.177]) by smtp.googlemail.com with ESMTPSA id u62sm7252607pfb.4.2020.09.04.09.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 09:10:09 -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=ghFMA8BY0AfUwWC47JwaY8XB5Sm1/ORo3UrAREV6/J8=; b=JgsH3HL8Uawy0K6KjuaRIYj9Qb0IQOY+dlceVOHSgboBHa1FlnrRL21uSCN3lgTlsr o0afQmyKVcR9w+DE3u00yhkgS17gwB8VFFuSyRqtuyq3I4920gghcROWsRee0BfkrpQ3 v9sYP+ZwZBaJ2OouYYckD0epGbf0wSz8lCrd9HqYZd8Medg353714gUzfH2Oydu9GWuO O8mJ120TT9AdgVK/uTxagC3OGSsvouWQEd/+QWBgVBE/E9+EMsC8dJK/aFolW9xlttO/ UEhWxuD3GAdNAqCMb3KCOiJyuoWoDeaXZ8fPE5jte21ZDleU2470d4t16Z82CRGHf/i+ eB9A== 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=ghFMA8BY0AfUwWC47JwaY8XB5Sm1/ORo3UrAREV6/J8=; b=rPi6lNI+lYPWsz8xUp7lNp27bTNr709wKjDR2ohLneyXS+hC23erywkGHThdY5U2jm 7vd/R5RslagSuVsEVOf22wvHGfSsWrKlzB1Zsq4cs1RG4kpAcJa6oGqVJ1iLGQlLoZWD 1GEiU70zd3n4MX2lbfTqFoqUDxMIbX9c94iBe/5PuPKZGyahZHx/8v/vDNUlfHFo1arL 41rYu+EZ2xGBdunC9RjqYrNMbLeLuH6GMBhywiZuPWAWbazwDKNjp+WACpr6dojr2QRd Wgt/k02r8+WkQaWTZ/U+mr7PfGch+ZwlbWSvFIX7FMlHcfZaCqrcOnOQmUTNICXIb0Te bcCA== X-Gm-Message-State: AOAM530ztwivYmGUurxnyeSuJEU/2PHtXQfOtkM+hMp27LL8j6Okl1+s cJZbIF0tnv86+/d/Hs5ZjkPmbLiLe1GbBA== X-Google-Smtp-Source: ABdhPJxkNCGYiyg/4aUWYJPOKZmu+Kbe/kZ0kpam84R+oPmk0V5j7QgYtxvkGsNH/41BKxviprcazg== X-Received: by 2002:a63:a54a:: with SMTP id r10mr7884807pgu.5.1599235810854; Fri, 04 Sep 2020 09:10:10 -0700 (PDT) From: Ani Sinha To: qemu-devel@nongnu.org Subject: [PATCH v3] i440fx/acpi: do not add hotplug related amls for cold plugged bridges Date: Fri, 4 Sep 2020 21:40:00 +0530 Message-Id: <20200904161000.12115-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::443; envelope-from=ani@anisinha.ca; helo=mail-pf1-x443.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 are not hot unpluggable, even when their hotplug property (acpi-pci-hotplug-with-bridge-support) is turned off. Please see the function acpi_pcihp_pc_no_hotplug() (thanks Julia). 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. This is because we add amls like _EJ0 etc for the pci slot where the bridge is cold plugged. 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-pluggable/unpluggable pci device. After this change, Wind= ows does not 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 Reviewed-by: Julia Suvorova --- hw/i386/acpi-build.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) changelog: v3: commit log updates providing more accurate information as received from= Julia. v2: cosmetic commit log updates with patch testing information. 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