Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2398941rbb; Tue, 27 Feb 2024 23:53:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUtIs4y6oyJbYU7DopaQzWrrunBsNHFT1sh4abA3Hm7R6hvRy2gLYcYhiv4+ABLKGQCyNaeWwEjeQyT3wgJ2m6CEjQc5EA8KD+NPTwFjQ== X-Google-Smtp-Source: AGHT+IE4KZMpc9CZR92GX17ElUlXijXjw7qL/EhCyxuadSiW3Zm6NKuIK+bYDtVrpPa0v6GXa9HX X-Received: by 2002:a05:620a:4406:b0:787:edf6:25fc with SMTP id v6-20020a05620a440600b00787edf625fcmr3023440qkp.48.1709106819239; Tue, 27 Feb 2024 23:53:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709106819; cv=pass; d=google.com; s=arc-20160816; b=j/ypTb8AWb7OPFjWsE2AdeWAWv3mpaFQFurHKGdR69NQh3eRkR/9WUeCPYybBzkyab WakR6GbBzMjjXThV3GYCzeJOKPYNlaJ+d3HT8YmSAIqZ/dzSrlr8h6h61aQlrR9xr3Yu dZWB++GN3rHN87KzfmngGIFUIzc/bDG4SE9eFFPc9h3krDqXeVlOSVrNjiQ/0HgrhNga FeDf5vJHHH9bzZ4t653NhLcOdzomDRnrLWcLklVdEUgCtAGNCiucyw8MEvhgPzwaZAe5 WV7hSbJL92eaEYqIKlCka6mLTjaFr7985ThROprzkE9Nw75bv856hX9gc7WIqKoMdAA5 hoUw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=BwZREp7Ok6on7duMSE+fGHGMVh8R/XQyRm504JpLDwM=; fh=HRWE/ZmJ4Vxi6v/vGzEJuSq3bRe9k5FI529NlJ8yUqM=; b=mknIre2tzoblCbicSVjLFZ4HqDwoEdPkFAgsrSEB7M78lXf9fYsJbjh7uMCOrpUa8q psFZYskAXohlOoaPtIbJCNlJz0PwViCCdsv6ntd/9xt4YYLmhI+7olpAGlNmd2W8dlIX Q75wzo7sUoSFBn96mBK9wl7eRqs0J/4LKXwgR5zeiF1f5I9XDAYkREZysUmbgjtM8i/N pmjOuPFnjmrAezwCAtngoE4kDLz1shtq4BZbWcJtRx88SUI+qMpTKkxTDWT10p+1wiP5 oNuc+jCm2DkGcE4H4w0moAg+ZptM6Des2GljjtPwO7l5RcXvUQPlt2tv4TFddQSpsTCS PX4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=tM4WWze4; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-84634-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84634-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bp6-20020a05620a458600b00787167c97cfsi9954992qkb.324.2024.02.27.23.53.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 23:53:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84634-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=tM4WWze4; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-84634-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84634-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D182D1C25ACC for ; Wed, 28 Feb 2024 07:53:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CFC52563F; Wed, 28 Feb 2024 07:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="tM4WWze4" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D75425601 for ; Wed, 28 Feb 2024 07:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709106804; cv=none; b=F4iVPpb12p/wXPKF5pLh9q3umsS5UywQESWHiUH8GgDDW5q9dajX/eYr7sAoJLRZtp6kKVIgUzmaRDaB943DBoP2v+WUEDOD93sFJjKmrNkXpwqgTNf/fFXQnWN5bxhcYMPbc4C+1BtJwvlkX02iOvkGSqiiWFedwNXBfwx1s38= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709106804; c=relaxed/simple; bh=A4ahDC3K/7VxYDp1KcCi8IyKxrIOOQY26srrHVeCdhk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YteRUfy0//bGVtj3SHQrSqorGNiIzzAIURcWBTYaiv5IDM/EICYDmz5LLMHTdxyCJ94G9M3Gkz2Gc1WO0XoUWjso09eOWe7G6e3jMBLUXltqQWMqIMcWOz9PhoEiQF2ncMfRd5b4quVfS91LADYvJ/h7PZEshfCJyiv6C68UAQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org; spf=pass smtp.mailfrom=endlessos.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b=tM4WWze4; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=endlessos.org Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a27e7b70152so227291966b.0 for ; Tue, 27 Feb 2024 23:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1709106799; x=1709711599; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BwZREp7Ok6on7duMSE+fGHGMVh8R/XQyRm504JpLDwM=; b=tM4WWze44F4UnC7DuIHIGPdg4aXWZvQD21aS8FZ5CMspMiB/nxJrJv5NaxXnrs3lgi OriQerQ7ECHtCq+gRAD2DYv+br28UiXM/7MeCcnnp8fJNEspHzmlYf3LpOL/BciHbGfH Boe91TLkE7F1QbiUtGdMGi7hkvxYwLL9YscMZqsNgQ/I7+NQR9FIaMvpPjaVxHHx1eQ6 DSPJ+rQnLUtSG94UbVsHqtKyy/lbfzCzGcxtZHfGp+u0yAsE7IRdbbKjIPb2P1XI001f ytaIlK/z+l0MCy0fzyk41TTs29EEj2sgzppbxMBEMDIACK/vEVCjuBJhlFHekcRtnueY XIZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709106799; x=1709711599; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BwZREp7Ok6on7duMSE+fGHGMVh8R/XQyRm504JpLDwM=; b=tIPYNhULTasBijctS7VVCWlcRWzU4rFDhKdGU8vtSU8Qig0kGnCb9k6077ghuhk+1t iEDMH5PwNYg3+IB+N/6TafZipxyowZ/adAmvgq8Sx/pKg8ktWm5hefxfsL5rd+hQXiG4 OkZJm5t+NCIi14hgE+3NrxmB9NJ5wMMCHrzqj3pVvfziFEs+ZwZKkBqhGqaUKUW4R8j3 HJsNdXJhaYbUNCsO1Iab/6RGhk7SOEHyae0SDjOnlJdqAA4eU7yurpKUnYTcCGNlQSaW WkZrC1OHrMMa2ne7pFcS+WjpmZHJepGRIo7aeock7x2+tu9jUNTcHfOPdoAlRb+MOwZB z3jA== X-Forwarded-Encrypted: i=1; AJvYcCXldk8OU20/7XJWZX0oOGoQNq4xEpz6rn3hO7LUSNlAwl67u9I9TWAt9yIQLGDvvgeaPLdDhutZaAcjVWN5avdhVv3Jll/p0VNz714a X-Gm-Message-State: AOJu0YzXGfQevhLDANVcmKBAwFTFzds6yqRdVS/mMJSnPEFV4H4Mt/Lt Z6Izf016a+urkdrKRkAlKrOwjTwcnv9laRQwWXwJLGOWWaEOvThbFZuDFppWRxM= X-Received: by 2002:a17:906:3caa:b0:a3f:161b:cc13 with SMTP id b10-20020a1709063caa00b00a3f161bcc13mr6082057ejh.7.1709106799382; Tue, 27 Feb 2024 23:53:19 -0800 (PST) Received: from limbo.local ([2a00:1bb8:11f:a33a:d002:9fcd:70bf:4f2a]) by smtp.gmail.com with ESMTPSA id o14-20020a17090608ce00b00a4396e930bdsm1561581eje.79.2024.02.27.23.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 23:53:18 -0800 (PST) From: Daniel Drake To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: hpa@zytor.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, david.e.box@linux.intel.com, mario.limonciello@amd.com, rafael@kernel.org, lenb@kernel.org, linux-acpi@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan Subject: [PATCH v3 1/2] PCI: Disable D3cold on Asus B1400 PCI-NVMe bridge Date: Wed, 28 Feb 2024 08:53:15 +0100 Message-ID: <20240228075316.7404-1-drake@endlessos.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Acked-by: Jian-Hong Pan Signed-off-by: Daniel Drake --- arch/x86/pci/fixup.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) v3: Adjust comment and commit message based on feedback, and more detailed investigation (on bugzilla) which indicates the problem may be more attributable to the (lack of?) power management on the NVMe device port rather than the parent bridge. There's no difference practically though - both ACPI devices share the same power resource which is the one powered down in D3cold... v2: Match only specific BIOS versions where this quirk is required. Add subsequent patch to this series to revert the original S3 workaround now that s2idle is usable again. diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index f347c20247d30..859a32fba8a96 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 NVMe-NCIe 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.39.2