Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp13275lqz; Fri, 29 Mar 2024 07:10:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIJgAY3xKEA/BRM/O6gP7je5QDJA+6tIYAILTymzLkwXD7sxg2zbQ2jTyDuhlgToheDrqnSr9dcmi0KFQy7515Dlcs09ciFPk9aHwr+A== X-Google-Smtp-Source: AGHT+IFkZY+RwVZKbH0NXmgU6kUqqM/6CpigTH5PaYIHRGgXrfqlfQvrUiN7ciGZ9pmFz39l3Zqu X-Received: by 2002:a05:6e02:b2c:b0:366:b8b0:708c with SMTP id e12-20020a056e020b2c00b00366b8b0708cmr2578990ilu.16.1711721456940; Fri, 29 Mar 2024 07:10:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711721456; cv=pass; d=google.com; s=arc-20160816; b=OulkppWpbqz2jzSLVExmHoplHAlYKCSu3Wx9zqxmgeQ5wPbNpIbJYaqJXVxFt9KnIN XRoFFzCjeEz3NDJ+S3spemf+iung4g62Lp1iKTI6WJktLrRy33ARhafBuD23xRgrFlbC ML+pFhaWLWsHYXfw/sY2rKWgDExbqOAVUu8a/4rL2u/erA4lCyvA6MBpbSCFwsSqCF4P tAjSlf1HRbv8JU1DhHiWTVyPTJX61qXZFYZf+s0sj1Q0kgEv/JxrHHn7h0SpJbw2IngA ns1BO73xpa+ACI48/AzRcK/uajDPL2v6PEtEt3uUur3khUva6Zk3cSbRgQPXtxDQC5mK Bktw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=uHlkQ092XlK4FpMlmqfst46WAL+CktcVX6n6AYFB+Ro=; fh=sLfn6LBJ3Qf1y+93mkoqYQMhX/up9gAHWEp+DIw7264=; b=OXt0IiHKD7ejO9brl0Q+BLsNC66ZuCXwwLJScV9MoW/K1Z1foMf06w+rdahgF3hbTw 6VrCqsWUPXMJupgnUUfFvLeSp2wHyEKwIVtJw+3qqRrJemHi9y0D1ydV7vaL7BS9D6Ld TWas6i0OmyRSsdSK3f/Qg6cXPKTcex0lpDwOLeRkjHTZaf8Jog9vW45bNJ+9ZvQAIUet bFF82APMd+mEC1WRhMPpH4zmR8CPGtm54BRW520PMEcF2C0QU1Z6yKzS9rClloLHSoFH 4lDHvXVzPeu8ED82VJyqlW0sKS8pzy6Thku9FGCqnFXWl+BKPZlqiC+IL+Dz/MXQRtHb fs/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KlhW2zl3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124857-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z17-20020a637e11000000b005c5e2c15169si3843992pgc.737.2024.03.29.07.10.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 07:10:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124857-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KlhW2zl3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124857-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9BD0B2822F9 for ; Fri, 29 Mar 2024 14:10:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B6651C525C; Fri, 29 Mar 2024 12:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KlhW2zl3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C47714A4DF; Fri, 29 Mar 2024 12:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716301; cv=none; b=LAJr0aQpAvh1GHMVhis5ZayQ/zDERXzqX5RC/WdxMWtgz9e8OlGsR31cIEXkWE0cPsZAm0pnIaao/9MfW/CXx+2HjfyRR3mo3qjA3flsVQw5e+ERV+chwCJh9ictwC1ciuO+1fFyi1kZ3INwtl9ah3w3aE0p0j0aYM8nOdn+VJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716301; c=relaxed/simple; bh=fbR+5U4rESsw5v4xXsfCY68N3QJWqm7u3XMhqCXZziY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iB9QeyuCz1K07bvkxgzVNB26kSfPVD3cq9YAR/yggbTcZBEGK8TwIxyAoVPhvWic2luvv4pHdWbqDSPNCXUPY40Pwhp8IOhohEsAWtILNlLKnSqzKbZs22nPSi7dNW8Aj+bLoR14n5ObWjYnkgkm/3GhT7T8Q0NDE2w8o4G24v8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KlhW2zl3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5DB3C433C7; Fri, 29 Mar 2024 12:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716301; bh=fbR+5U4rESsw5v4xXsfCY68N3QJWqm7u3XMhqCXZziY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlhW2zl3LQ4G5ZVZngiWCpgnfnAW8DOaNOuqSh+3cr+Nj7SZU/dHvthk0df56SIwg ZY1klYrtbsknK4Jruy+H4ymABE2fm2WDrB022kAQjldnk8XY9b7xJkQIVAY6H5UQq5 3jaKsQ8KPnNcUHgQANxYdeiHQinKUHy3STxb/NHba9EzShmUgTLkZan+kJce5+N6bP YKu/JLb7nniV0EPX9WugJ+kQC34+Jxbg9c9ByN37IYIwS7wsWSaAcspT4VsRnC18Gn LWhGSGMOv40I5/m2m4JgiVNvPxox5zvQeZtGNRPd3a2RyAiQnWfKE2kqC1i966hjly eYq28wtsKWVvg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Drake , Bjorn Helgaas , Jian-Hong Pan , "Rafael J . Wysocki" , Sasha Levin , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 6.6 48/75] PCI: Disable D3cold on Asus B1400 PCI-NVMe bridge Date: Fri, 29 Mar 2024 08:42:29 -0400 Message-ID: <20240329124330.3089520-48-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329124330.3089520-1-sashal@kernel.org> References: <20240329124330.3089520-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.23 Content-Transfer-Encoding: 8bit From: Daniel Drake [ Upstream commit cdea98bf1faef23166262825ce44648be6ebff42 ] The Asus B1400 with original shipped firmware versions and VMD disabled cannot resume from suspend: the NVMe device becomes unresponsive and inaccessible. This appears to be an untested D3cold transition by the vendor; Intel socwatch shows that Windows leaves the NVMe device and parent bridge in D0 during suspend, even though these firmware versions have StorageD3Enable=1. The NVMe device and parent PCI bridge both share the same "PXP" ACPI power resource, which gets turned off as both devices are put into D3cold during suspend. The _OFF() method calls DL23() which sets a L23E bit at offset 0xe2 into the PCI configuration space for this root port. This is the specific write that the _ON() routine is unable to recover from. This register is not documented in the public chipset datasheet. Disallow D3cold on the PCI bridge to enable successful suspend/resume. Link: https://bugzilla.kernel.org/show_bug.cgi?id=215742 Link: https://lore.kernel.org/r/20240228075316.7404-1-drake@endlessos.org Signed-off-by: Daniel Drake Signed-off-by: Bjorn Helgaas Acked-by: Jian-Hong Pan Acked-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- arch/x86/pci/fixup.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index f347c20247d30..b33afb240601b 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c @@ -907,6 +907,54 @@ static void chromeos_fixup_apl_pci_l1ss_capability(struct pci_dev *dev) DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x5ad6, chromeos_save_apl_pci_l1ss_capability); DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x5ad6, chromeos_fixup_apl_pci_l1ss_capability); +/* + * Disable D3cold on Asus B1400 PCI-NVMe bridge + * + * On this platform with VMD off, the NVMe device cannot successfully power + * back on from D3cold. This appears to be an untested transition by the + * vendor: Windows leaves the NVMe and parent bridge in D0 during suspend. + * + * We disable D3cold on the parent bridge for simplicity, and the fact that + * both parent bridge and NVMe device share the same power resource. + * + * This is only needed on BIOS versions before 308; the newer versions flip + * StorageD3Enable from 1 to 0. + */ +static const struct dmi_system_id asus_nvme_broken_d3cold_table[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.304"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.305"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.306"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.307"), + }, + }, + {} +}; + +static void asus_disable_nvme_d3cold(struct pci_dev *pdev) +{ + if (dmi_check_system(asus_nvme_broken_d3cold_table) > 0) + pci_d3cold_disable(pdev); +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x9a09, asus_disable_nvme_d3cold); + #ifdef CONFIG_SUSPEND /* * Root Ports on some AMD SoCs advertise PME_Support for D3hot and D3cold, but -- 2.43.0