Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp104403pxj; Wed, 26 May 2021 17:32:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwT2AGSYAR/NtajuHkXiMO8kyePJWHXBr1ufYNGG+2pKm74jofmLsnvmuDevSe2NHJHdIm X-Received: by 2002:a05:6402:14c2:: with SMTP id f2mr1012908edx.69.1622075554779; Wed, 26 May 2021 17:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622075554; cv=none; d=google.com; s=arc-20160816; b=blTOG5I0UfV/wLFQLdq4L1iRhWBtIorqcfSYzTTcBo1ty82H3e/mzTtMd+PHUdHagC JexOIetWpIvZ7t0nDv7ugVsMeFAJiVUbjUKgCIUrjrydR3jVvQmDCumh3+QBMu0HQmOW aETc5maKqdWivhr+Ykob5zPyO5qW/QJRUsVpCAbgOT1sj6N4aUqnvhqHVZg5Bxu60sr8 xGNpbO3oSb6KWm/dz3s5GXfX27+gvvYgwjoUCVnQPmkXnhKSDo6O3YL03W9DXBNq13jw zDrXpEyeWdGVV45fJW78G7Aha9mnVOsjBBJ60vJaWiHJIaQg2/5FWlNw/QOjscUZA2dP hp3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=izmyF5lXZ6T+Ih81ROoFBWGYSX359TfngCEeuMk/7tw=; b=f0nAJZUAzjcQVBSJSxZs1ehULQQz1jcXuiK8yTaECbaMwCIY9ZY36k3wRmXLg6x/ty QGJF6qSTVttbRKK9GLpwqGK8IiKOyTZj+B1IbhzTY+7FxL2t0LR4WRjpBbErjBOMn2iM 09Vzs39M+WfEqSEYkWdTscJOWvk1FdjgRq0lAdQEDrNLjt4chgaFknKcZ7G4CvRmtdV/ SwQEylBHU49YqWwHLbF9BtvkrJ/9xRvsNfhcWz2NrX3Rwn1WlGCd44+dF56477oQOk+o wqu+snEZ+Dnf+CYKNMdW3jsVXVz/LwcoMbG4lnDBwfcgx7THT7Q2lou5ViE5W7sGwcCz yd1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kMT8SVDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si423270edr.570.2021.05.26.17.32.11; Wed, 26 May 2021 17:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kMT8SVDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233395AbhEZT0s (ORCPT + 99 others); Wed, 26 May 2021 15:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbhEZT0r (ORCPT ); Wed, 26 May 2021 15:26:47 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F77FC061574 for ; Wed, 26 May 2021 12:25:15 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id v9so2212524ion.11 for ; Wed, 26 May 2021 12:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=izmyF5lXZ6T+Ih81ROoFBWGYSX359TfngCEeuMk/7tw=; b=kMT8SVDJjaBto+io7zebuCCqledUf8nh4myBvhiKUjQphfgDe7/5JIOaMq3TeL2vli lGZSIEPGc5X7c2WAvwLO0tfc2FNWGgydkFVNt02Ogh4fov63BJn270+3sWaPdKFGgM0Z TeSGT3og1EXgFByRnd3ZSqx1UxiS33o0w7vjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=izmyF5lXZ6T+Ih81ROoFBWGYSX359TfngCEeuMk/7tw=; b=Tbi0iPKigSULmT5EYBT3ix5g5U+cdYT5dqgWsmKGlLgF3w5v07wC8EIInS4T2d+Y/N GDuHbz9Us9bqUccCiB3HlQfsIcbkN5j6UQJOdK6atcdeanvX/yEqJJ7SU2EkSubo3bCY Bqe82ouAgZosvBwEkuGYhC4mLwJ8Mz2KLxovJESaOYM7ZFFfitIoZQZGtqCQUXOp5Unu QO4kGJCMP7ejsLq8y5t9VhSB6EfFmhyWSOtXzR6kmsyKvw+CjIRD7QCZWkVGeiN74gIV evjK4wFAZ3B3txDCoQtUuS5Qf+X3+6Eyp/DVLW3duK3UYBpmwUJxkJh5R700fKnfYLDg 0/Og== X-Gm-Message-State: AOAM531E3wlsyPwPr46KilNj3TrbvluBacZ0/8Dfzvz8MhcBcp/3zaL5 bW57dQj8CfsDk2m2EeBezJukCw== X-Received: by 2002:a02:b78c:: with SMTP id f12mr4804493jam.7.1622057114750; Wed, 26 May 2021 12:25:14 -0700 (PDT) Received: from google.com (h184-60-195-141.arvdco.broadband.dynamic.tds.net. [184.60.195.141]) by smtp.gmail.com with ESMTPSA id b189sm113428iof.48.2021.05.26.12.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 12:25:14 -0700 (PDT) Date: Wed, 26 May 2021 13:25:12 -0600 From: Raul E Rangel To: "David E. Box" Cc: rjw@rjwysocki.net, lenb@kernel.org, kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me, dan.j.williams@intel.com, shyjumon.n@intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH V5] drivers/nvme: Add support for ACPI StorageD3Enable property Message-ID: References: <20200702225011.10932-1-david.e.box@linux.intel.com> <20200709184333.6241-1-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200709184333.6241-1-david.e.box@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 09, 2020 at 11:43:33AM -0700, David E. Box wrote: > +#ifdef CONFIG_ACPI > +static bool nvme_acpi_storage_d3(struct pci_dev *dev) > +{ > + const struct fwnode_handle *fwnode; > + struct acpi_device *adev; > + struct pci_dev *root; > + acpi_handle handle; > + acpi_status status; > + u8 val; > + > + /* > + * Look for _DSD property specifying that the storage device on > + * the port must use D3 to support deep platform power savings during > + * suspend-to-idle > + */ > + root = pcie_find_root_port(dev); > + if (!root) > + return false; > + > + adev = ACPI_COMPANION(&root->dev); > + if (!adev) > + return false; > + > + /* > + * The property is defined in the PXSX device for South complex ports > + * and in the PEGP device for North complex ports. > + */ > + status = acpi_get_handle(adev->handle, "PXSX", &handle); So I'm curious why we need to directly look at the PXSX and PEGP devices instead of the ACPI_COMPANION node attached to the pci device? I've looked around and I can't find any documentation that defines the the PXSX and PEGP device names. I've dumped some ACPI from a system that uses the PXSX name and StorageD3Cold attribute: Scope (\_SB.PCI0.GP14) { Device (PXSX) { Name (_ADR, 0x0000000000000000) // _ADR: Address Method (_STA, 0, NotSerialized) // _STA: Status { Return (0x0F) } Name (_DSD, Package (0x02) // _DSD: Device-Specific Data { ToUUID ("5025030f-842f-4ab4-a561-99a5189762d0"), Package (0x01) { Package (0x02) { "StorageD3Enable", One } } }) } } It looks to me like it's just the firmware node for the NVMe device attached to the root port. Is that the correct assumption? I'm wondering if we can simplify the look up logic to look at the ACPI_COMPANION of the pci device? The reason I ask is that I'm working on enabling S0i3 on an AMD device. This device also defines the StorageD3Enable property, but it don't use the PXSX name: Scope (GPP6) { Device (NVME) { Name (_ADR, Zero) // _ADR: Address Name (_DSD, Package (0x02) // _DSD: Device-Specific Data { ToUUID ("5025030f-842f-4ab4-a561-99a5189762d0"), Package (0x01) { Package (0x02) { "StorageD3Enable", One } } }) } } The Windows [documentation](https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/power-management-for-storage-hardware-devices-intro#d3-support) makes it sound like the _DSD should be defined on the PCI device. I can send one of the following patches depending on the feedback: 1) Additionally check the pci device's ACPI_COMPANION for the _DSD. 2) Delete the PXSX and PEGP lookups and only look at the pci device's ACPI_COMPANION. > + if (ACPI_FAILURE(status)) { > + status = acpi_get_handle(adev->handle, "PEGP", &handle); > + if (ACPI_FAILURE(status)) > + return false; > + } > + > + if (acpi_bus_get_device(handle, &adev)) > + return false; > + > + fwnode = acpi_fwnode_handle(adev); > + > + return fwnode_property_read_u8(fwnode, "StorageD3Enable", &val) ? > + false : val == 1; > +} Thanks, Raul p.s., Sorry for the second message, I somehow mangled the headers in the first message and dropped the Message-Id.