From nobody Tue Feb 10 10:20:08 2026 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=1600337532; cv=none; d=zohomail.com; s=zohoarc; b=Ebh0SmMZBd44KjEl7HY8xNvTeBL5IihW8q25GIqOaCkpVwVkQk7h0pfmtjKCE+LzARyggnTKVhKoWKZzXQ2S3MmZGCLevilhLZNoGNVQzVVoQOLEeB4fMumUgRTsmfp7l5v6YtZJzUeoS9uueQmN6Np5wsEfViBNawqz2mAQx8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600337532; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ughGQhnpv0vI//S8mrXDQnorJKmr6CWqkbIT0eqOuAw=; b=Qc6OAfEOzKhRqlaIL2DfOaMeN1F/CIE2bkclqzuBID4FxISc+JrQoWNU2GWMjoi3tVLV42+q1CtoKQVl73XsC5J6Db7IkOGSVIbCDTpr2w1MLCoLXlFWRiWaxDgF5JWbzvWw+Wh5gy8mwZmUKRD12/gJIw3JT27ZYy8ONJy5sjk= 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 1600337532459519.926794747478; Thu, 17 Sep 2020 03:12:12 -0700 (PDT) Received: from localhost ([::1]:54656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIqtf-0002EF-C9 for importer@patchew.org; Thu, 17 Sep 2020 06:12:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIqs8-0000XV-DO for qemu-devel@nongnu.org; Thu, 17 Sep 2020 06:10:37 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:50245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIqrs-0003SM-3J for qemu-devel@nongnu.org; Thu, 17 Sep 2020 06:10:36 -0400 Received: by mail-pj1-x1044.google.com with SMTP id fa1so1031895pjb.0 for ; Thu, 17 Sep 2020 03:10:19 -0700 (PDT) Received: from localhost.localdomain ([115.96.122.113]) by smtp.googlemail.com with ESMTPSA id d20sm5241559pjv.39.2020.09.17.03.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 03:10:17 -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:in-reply-to:references; bh=ughGQhnpv0vI//S8mrXDQnorJKmr6CWqkbIT0eqOuAw=; b=oHRy+U40gY7WXpeiPdpLewoi1bxzHQURaFqm0qVchkCkLQStqgbbFDT3tBhaNF+JGc aE/lvNRBIZsNs8kJ2POASt3/xjRKlHRY4/+J9aIZrWZ5FpqjGw1dkwhCMygGiRzsuIsQ GIDjcXcIyq575q46w86gGhAKEnE8CR8L2EXHjwWXasBr5JNQgvDFptlBvD6fcYQGlxsi r1WQGXgMbyQNHIUbkeh00pWC6KSyz+UNyGX6NxQq6Jy5oz7tHr7kH+HZaL0Acx5hm9LB dxB0NLlE5v/BSNjGGyD0AA6WK1Z7DD50g35fC9ZrhfSj2mtszLLcut7n911HDvtUqw6U MrCQ== 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:in-reply-to :references; bh=ughGQhnpv0vI//S8mrXDQnorJKmr6CWqkbIT0eqOuAw=; b=c861biIORGDrxm2k6T1Rfub69Bwsn3dn/IYa2WluOenKv/WnVtRWa8FATATMFkYfts 9qjelW2aoVtGjvx8UMYeBqhDttaL0kTiZtGUtgjy1z7fyK9fn4a3d1ROKbUnm/saKrRr m/pevhKn/HOsBJtLxgcCKWHcGTLJCSv5z12FQZf+bihw7pIUdxwzFlTCcPTO80zj+6Q9 VKAiWoWYLPz9hVosKcLLP1oYGDkTDSe7buO4Rq58W4CjwTm+VHHcjOtpM1O9mKxtU2pe 6a4thBOq567QUAAlGC3WVZgn1vRoSsc3z3WWAjKwmYp2uHiHgGwnqpZCp4gY3l+llz2O M0pg== X-Gm-Message-State: AOAM5331TOQouH0AH0Q77IQbNDNvXqDM0vMw+lllwwxdDxvtVJPi+Hwx jLPZxc/+FbWHdzIp3K/olhmQLDPzIdy5X/mL X-Google-Smtp-Source: ABdhPJzfFvhXFfyqGWZp2LkCT8QCHCevyBJWAQBs0a71k7Z0QqxYqCGc5wCbsuHtOIyEBjxDJ3Xr8A== X-Received: by 2002:a17:902:b413:b029:d1:f3d7:2674 with SMTP id x19-20020a170902b413b02900d1f3d72674mr5001587plr.53.1600337418314; Thu, 17 Sep 2020 03:10:18 -0700 (PDT) From: Ani Sinha To: qemu-devel@nongnu.org Subject: [PATCH v7 05/12] i440fx/acpi: do not add hotplug related amls for cold plugged bridges Date: Thu, 17 Sep 2020 15:39:40 +0530 Message-Id: <20200917100947.21106-6-ani@anisinha.ca> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200917100947.21106-1-ani@anisinha.ca> References: <20200917100947.21106-1-ani@anisinha.ca> 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::1044; envelope-from=ani@anisinha.ca; helo=mail-pj1-x1044.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: Laurent Vivier , Thomas Huth , 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(). 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 ACPI code like _EJ0 etc for = the pci slot where the bridge is cold plugged. In this fix, we identify a cold plugged bridge and for cold plugged bridges, we do not add the appropriate ACPI methods that are used by the OS to identify a hot-pluggable/unpluggable pci device. After this change, Wind= ows does not detect the cold plugged pci bridge as ejectable. As a result of the patch, the following are the changes to the DSDT ACPI table: @@ -858,38 +858,33 @@ Return (Zero) } Method (_S2D, 0, NotSerialized) // _S2D: S2 Device State { Return (Zero) } Method (_S3D, 0, NotSerialized) // _S3D: S3 Device State { Return (Zero) } } Device (S18) { - Name (_SUN, 0x03) // _SUN: Slot User Number Name (_ADR, 0x00030000) // _ADR: Address - Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device - { - PCEJ (BSEL, _SUN) - } } Device (S20) { Name (_SUN, 0x04) // _SUN: Slot User Number Name (_ADR, 0x00040000) // _ADR: Address Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device { PCEJ (BSEL, _SUN) } } Device (S28) { Name (_SUN, 0x05) // _SUN: Slot User Number Name (_ADR, 0x00050000) // _ADR: Address @@ -1148,37 +1143,32 @@ PCEJ (BSEL, _SUN) } } Device (SF8) { Name (_SUN, 0x1F) // _SUN: Slot User Number Name (_ADR, 0x001F0000) // _ADR: Address Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device { PCEJ (BSEL, _SUN) } } Method (DVNT, 2, NotSerialized) { - If ((Arg0 & 0x08)) - { - Notify (S18, Arg1) - } - If ((Arg0 & 0x10)) { Notify (S20, Arg1) } If ((Arg0 & 0x20)) { Notify (S28, Arg1) } If ((Arg0 & 0x40)) { Notify (S30, Arg1) } If ((Arg0 & 0x80)) While at it, I have also updated a stale comment. Signed-off-by: Ani Sinha Suggested-by: Julia Suvorova Reviewed-by: Julia Suvorova Reviewed-by: Igor Mammedov --- hw/i386/acpi-build.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 7a5a8b3521..e079b686f5 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