Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2096147rdb; Tue, 20 Feb 2024 17:54:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW21tX10ZqbKG/dEWO6WW+EarQXMNKHgcAN1V1kKgNtII8QvgOh6MhYrO/nSjZAHCOpbCU56SOQIU3lNSQJx/bs4aSXDnk6wyV/xLfgWQ== X-Google-Smtp-Source: AGHT+IGazq65V8sCazK83IWXddu2kbgPxdARiLvJGJdYXcFThy1mCM7H6WgHFrJFKx9ck1yKdN74 X-Received: by 2002:a05:6358:f485:b0:176:4e7d:f30e with SMTP id ku5-20020a056358f48500b001764e7df30emr13493752rwb.14.1708480499694; Tue, 20 Feb 2024 17:54:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708480499; cv=pass; d=google.com; s=arc-20160816; b=fl2IWjVXW6Rsj8SsZk6GdWgtXnI5eLscJp4Oxg6CPHwvZxvIcuHyi5Oz7QvdVQZiBp d0ePTmseprv0jmfsrF0CvkOgRxsMDl52npG3TCGDIv4guD5e+0ISUDsiIO+pEzDtI9bz GuJE+5EtjpXZJVoeCZ3aa31ME2OqAFNLSWnetJze1Rf98hj2nY95Xj81aeFaW05UFabz M03fTWIsv+i7N81LwBYdh6O+SCExRhWzUOl0QFh2wubMhZY/aCr9dp9kYNjqJ1TyDoHz Bgo6YnomIXyVoKAwBX1XArhRE18hpS0IMW8/94pBigNyRcUOg9PsFmYlE3tzb9NuJwsX P/cQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:organization:autocrypt :references:in-reply-to:date:cc:to:reply-to:from:subject:message-id :dkim-signature; bh=aZEXdgDXNpiV9ynLc8omSuxhI/t3RarAVerP6oXpfWU=; fh=UvrR2SRPGzMFAQbBwHsBDCrRh8Hu/JZs4UAtJXrTzAk=; b=Uubb24FVX6t7t2pW7+swvoTPFmf2oZfV5ellHiQMbcncpVFQzqTLMJg/aWJDJq1499 Fb5JYJEBywbGZ+imfdtvr+ak5eexbk96BQVAynhlY1uqzQF84zR1vpjcqo5ngzsm7G9S bGCRkwEQyAfWgH6N8FZimg6xhaqYEIkyZjJ4bwWaBwBzkUp1OnSmZtRaJfXAosYc+hL0 6DLlQIy7b9OPyiJNwaZuNLGVqO3vvQxsCBoDYTWhdeKUU37zoXL409SBUN7ujowIp/a9 ys7Cs0n/LIQMOwzsvWM+k4J9C9jOjOrDVA5QsETEI6VdD2AoZTV+L29Bwv0ZMwyHmwjx lfOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bk40mBms; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-73822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m6-20020a632606000000b005dc1330fadcsi7141943pgm.6.2024.02.20.17.54.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 17:54:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73822-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=@intel.com header.s=Intel header.b=bk40mBms; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-73822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 DD9F2283634 for ; Tue, 20 Feb 2024 23:25:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68669154BF8; Tue, 20 Feb 2024 23:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bk40mBms" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 7B21578688; Tue, 20 Feb 2024 23:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708471544; cv=none; b=KrZCHTP1imBp1uXw2Bxdsp65Aj1S4H1ugqD0zwBM6BX2Iq/VDW2l0P1J0ZdkII/uxhayQcsEG3THZR3ICK+NfZYdismQ9dKHpRKWQgzjDUYs90Oxbi98s0JINHtgk1mkskz21JKqUBkd1ZLObzJAaD8rTnuoyVCxGaGOWDY/uBw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708471544; c=relaxed/simple; bh=aZEXdgDXNpiV9ynLc8omSuxhI/t3RarAVerP6oXpfWU=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=Ag1MWHhgoHgjMpRzwwZWK17rdmGrpTxEdzdZaORjtKr2GH62w1zzhehz2HPO5K65ABtBO0QqdgblXNvvuc5BWAewkgO7IbT69K9xA6UwVJL8vHiP6dfYnE8ZTKFiSX94VRtXT7mMjrXFOFotdXrHqPpbM3YKKukIKkkRbD1gGYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bk40mBms; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708471542; x=1740007542; h=message-id:subject:from:reply-to:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=aZEXdgDXNpiV9ynLc8omSuxhI/t3RarAVerP6oXpfWU=; b=bk40mBmswitWUmc6gSXTsSAVAc08sl0YWIqYUP5/HXjJV4SGvXMnSHZo kKNR7Azkh1sCwVcDVjagzlENo85KkJOkTNesm1ajzL0InuD2c0bgPApW5 Dmgt0OSAf5H+RrsmnuiyMu3GQVM77+ZFGxdaIHdFnDKJH4zejkqh9KRhn nbX2uOyItbWR9kFb/NfAO57u/bue8MscwzOQbTLzG0wWeukmCEuvKFvhn i+iRAVG/v5ceK6LTzVZZ4nyf/22UScptHtdJ2CCfCf++s9nF/uF96NMeL QKrBxXFQEpuX3yhsBFI1GV3YKBCE+mIoouojE9kXbkGEabXHdChwiuMUF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10990"; a="13164219" X-IronPort-AV: E=Sophos;i="6.06,174,1705392000"; d="scan'208";a="13164219" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 15:25:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,174,1705392000"; d="scan'208";a="5287373" Received: from linux.intel.com ([10.54.29.200]) by orviesa006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 15:25:42 -0800 Received: from [10.54.75.156] (debox1-desk1.jf.intel.com [10.54.75.156]) by linux.intel.com (Postfix) with ESMTP id 92A65580DBE; Tue, 20 Feb 2024 15:25:41 -0800 (PST) Message-ID: <6d989b7da1e7493a3e2d478cec060a459f375daf.camel@linux.intel.com> Subject: Re: [PATCH v2 1/2] PCI: Disable D3cold on Asus B1400 PCI-NVMe bridge From: "David E. Box" Reply-To: david.e.box@linux.intel.com To: Daniel Drake Cc: Bjorn Helgaas , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, mario.limonciello@amd.com, rafael@kernel.org, lenb@kernel.org, linux-acpi@vger.kernel.org, linux@endlessos.org Date: Tue, 20 Feb 2024 15:25:41 -0800 In-Reply-To: References: <20240207084452.9597-1-drake@endlessos.org> <20240207200538.GA912749@bhelgaas> <9654146ac849bb00faf2fe963d3da94ad65003b8.camel@linux.intel.com> Autocrypt: addr=david.e.box@linux.intel.com; prefer-encrypt=mutual; keydata=mQENBF2w2YABCACw5TpqmFTR6SgsrNqZE8ro1q2lUgVZda26qIi8GeHmVBmu572RfPydisEpCK246rYM5YY9XAps810ZxgFlLyBqpE/rxB4Dqvh04QePD6fQNui/QCSpyZ6j9F8zl0zutOjfNTIQBkcar28hazL9I8CGnnMko21QDl4pkrq1dgLSgl2r2N1a6LJ2l8lLnQ1NJgPAev4BWo4WAwH2rZ94aukzAlkFizjZXmB/6em+lhinTR9hUeXpTwcaAvmCHmrUMxeOyhx+csO1uAPUjxL7olj2J83dv297RrpjMkDyuUOv8EJlPjvVogJF1QOd5MlkWdj+6vnVDRfO8zUwm2pqg25DABEBAAG0KkR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/3G/yig9RUO7A/1efRi0E1iJAa6qHrPqE/kJANbz/x+9wcx1VfFwraFXbdT/P2JeOcW/USW89wzMRmOo+AiBSnTI4xvb1s/TxSfoLZvtoj2MR+2PW1zBALWYUKHOzhfFKs3cMufwIIoQUPVqGVeH+u6Asun6ZpNRxdDONop+uEXHe6q6LzI/NnczqoZQLhM8d1XqokYax/IZ4= Organization: David E. Box Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.2 (3.50.2-1.fc39) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Mon, 2024-02-19 at 12:35 +0100, Daniel Drake wrote: > On Fri, Feb 9, 2024 at 9:36=E2=80=AFAM Daniel Drake = wrote: > > On Thu, Feb 8, 2024 at 5:57=E2=80=AFPM David E. Box > > wrote: > > > This does look like a firmware bug. We've had reports of D3cold suppo= rt > > > missing > > > when running in non-VMD mode on systems that were designed with VMD f= or > > > Windows. > > > These issues have been caught and addressed by OEMs during enabling o= f > > > Linux > > > systems. Does D3cold work in VMD mode? > >=20 > > On Windows for the VMD=3Don case, we only tested this on a BIOS with > > StorageD3Enable=3D0. The NVMe device and parent bridge stayed in D0 ove= r > > suspend, but that's exactly what the BIOS asked for, so it doesn't > > really answer your question. >=20 > Tested on the original BIOS version with VMD=3Don: Windows leaves the > NVMe device (and parent bridge) in D0 during suspend (i.e. same result > as VMD=3Doff). >=20 > On this setup, there are 2 devices with StorageD3Enable flags: >=20 > 1. \_SB.PC00.PEG0.PEGP._DSD has StorageD3Enable=3D1. This is set > regardless of the VMD setting at the BIOS level. This is the flag that > is causing us the headache in non-VMD mode where Linux then proceeds > to put devices into D3cold. Likely never tested. > This PEGP device in the non-VMD configuration corresponds to the NVMe > storage device. PEG0 is the PCI root port at 00:06.0 (the one in > question in this thread), and PEGP is the child with address 0. > However in VMD mode, 00:06.0 is a dummy device (not a bridge) so this > PEGP device isn't going to be used by anything. >=20 > 2. \_SB.PC00.VMD0._DSD has StorageD3Enable=3D0. This VMD0 device is only > present when VMD is enabled in the BIOS. It is the companion for > 00:0e.0 which is the device that the vmd driver binds against. This > could be influencing Windows to leave the NVMe device in D0, but I > doubt it, because it can't explain why Windows would have the D0 > behaviour when VMD=3Doff, also this is a really strange place to put the > StorageD3Enable setting because it is not a storage device. Yes, we don't look for the property here, only under the child device of th= e Root Port. >=20 > > On Linux with VMD=3Don and StorageD3Enable=3D1, the NVMe storage device > > and the VMD parent bridge are staying in D0 over suspend. I don't know > > why this is, I would have expected at least D3hot.=C2=A0 However, given > > that the NVMe device has no firmware_node under the VMD=3Don setup, I > > believe there is no way it would enter D3cold because there's no > > linkage to an ACPI device, so no available _PS3 or _PR0 or whatever is > > the precise definition of D3cold. >=20 > Checked in more detail. In Linux, the NVMe device will only go into > D3hot/D3cold if the ACPI companion device has an explicit > StorageD3Enable=3D1. However, in VMD mode the NVMe storage device has no > ACPI companion. Code flow is nvme_pci_alloc_dev() -> acpi_storage_d3() > =C2=A0-> return false because no companion. That explains it. >=20 > The VMD PCI bridge at 10000:e0:06.0 that is parent of the SATA & NVME > devices does have a companion \_SB.PC00.VMD0.PEG0 > However, the SATA and NVME child devices do not have any ACPI > companion. I examined the logic of vmd_acpi_find_companion() and > determined that it is looking for devices with _ADR 80b8ffff (SATA) > and 8100ffff (NVME) and such devices do not exist in the ACPI tables. Based on its counterpart it should be at \_SB.PC00.VMD0.PEG0.PEGP in VMD mo= de. This is where _ADR =3D 8100FFFF should be. This looks like broken ACPI code= since the property does exist in the expected location when VMD is disabled. >=20 > Speculating a little, I guess this is also why Windows leaves the > device in D0 in VMD=3Don mode: it would only put the NVMe device in > D3hot/D3cold if it had a corresponding companion with > StorageD3Enable=3D1 and there isn't one of those. What's still unknown > is why it doesn't put the device in D3 in VMD=3Doff mode because there > is a correctly placed StorageD3Enable=3D1 in that case. Given the observations (inconsistent firmware and testing showing Windows u= sing D0) I'm good with the approach. David