From: Bjorn Helgaas <helgaas@kernel.org>
To: "Nilawar, Badal" <badal.nilawar@intel.com>
Cc: intel-xe@lists.freedesktop.org, linux-acpi@vger.kernel.org,
linux-pci@vger.kernel.org, anshuman.gupta@intel.com,
rafael@kernel.org, lenb@kernel.org, bhelgaas@google.com,
ilpo.jarvinen@linux.intel.com, rodrigo.vivi@intel.com,
varun.gupta@intel.com, ville.syrjala@linux.intel.com,
uma.shankar@intel.com, karthik.poosa@intel.com,
matthew.auld@intel.com, sk.anirban@intel.com,
raag.jadav@intel.com
Subject: Re: [PATCH v6 01/12] PCI/ACPI: Add D3cold Aux Power Limit_DSM method
Date: Thu, 22 Jan 2026 14:53:48 -0600 [thread overview]
Message-ID: <20260122205348.GA41683@bhelgaas> (raw)
In-Reply-To: <f391a681-3153-4296-851b-a4db3cbc8de1@intel.com>
On Tue, Jan 20, 2026 at 07:33:17PM +0530, Nilawar, Badal wrote:
> On 15-01-2026 01:54, Bjorn Helgaas wrote:
> > On Tue, Jan 13, 2026 at 10:12:02PM +0530, Badal Nilawar wrote:
> > > From: Anshuman Gupta <anshuman.gupta@intel.com>
> > >
> > > Implement _DSM method 0Ah, as per PCI Firmware r3.3, sec 4.6.10,
> > > to request auxiliary power required by the device when in D3cold state.
> ...
> > > +int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_mw,
> > > + u32 *retry_interval)
> > > +{
> > > + union acpi_object in_obj = {
> > > + .integer.type = ACPI_TYPE_INTEGER,
> > > + .integer.value = requested_mw,
> > > + };
> > > +
> > > + union acpi_object *out_obj;
> > > + int result;
> > > + struct pci_dev *bdev;
> > > + struct acpi_device *adev;
> > > + acpi_handle handle;
> > > + struct aux_pwr *apwr, *next;
> > > +
> > > + if (!dev)
> > > + return -EINVAL;
> >
> > We talked about only allowing this for function 0:
> > https://lore.kernel.org/all/20250904183046.GA1267851@bhelgaas/
>
> In rev5 there was suggestion from Rafael to remove function 0 check as
> synchronization among drivers will be
> tricky. https://patchwork.freedesktop.org/patch/681119/?series=145342&rev=5#comment_1255325
> > > + case AUX_PWR_REQ_GRANTED:
> > > + pci_info(bdev, "D3cold Aux Power request granted: %u mW\n",
> > > + requested_mw);
> > > + apwr = kzalloc(sizeof(*apwr), GFP_KERNEL);
> > > + if (apwr) {
> > > + apwr->aux_pwr_limit = requested_mw;
> > > + apwr->dev = &dev->dev;
> > > + apwr->adev = adev;
> > > + INIT_LIST_HEAD(&apwr->list);
> > > + list_add(&acpi_aux_pwr_list,
> > > + &apwr->list);
> > > + }
> >
> > I think we leak this allocation if the device is removed. I think the
> > list idea is more complicated than aggregating would be.
> >
> > I think we could:
> >
> > - add "aux_power_mw" in struct pci_dev
> >
> > - walk the tree below bdev, accumulating aux_power_mw
> > (total_aux_power_mw += dev->aux_power_mw)
> >
> > - pass "total_aux_power_mw + requested_mw" to the _DSM
> >
> > - if successful, set dev->aux_power_mw = requested_mw
>
> Introduced list based handling as in rev5 there was suggestion to avoid
> adding variables in acpi/acpi_power structures.
> To handle allocation leak in function acpi_device_release() I will add code
> to scan list and delete the entry.
I think it's a mistake to add list handling for this sort of
non-dynamic situation because it adds complexity and lifetime issues.
I'm OK with adding this data to struct pci_dev. That means we don't
have to deal with any extra list management or lifetime issues, and
it's also a way to handle the aggregation and avoid the problem of
synchronizing between drivers.
My proposal is to aggregate the power requirements of all the devices
below the bridge that implements this _DSM (bdev), and store the total
requirement in bdev->aux_power_mw.
We can do the aggregation piecemeal. As each downstream driver calls
this function, its requirement can be added to aux_power_mw.
> > > + if (retry_interval) {
> > > + *retry_interval = result & 0xF;
> > > + return -EAGAIN;
> > > + }
> > > + return -EINVAL;
> >
> > I think we should do:
> >
> > case AUX_PWR_REQ_RETRY_INTERVAL_MIN ... AUX_PWR_REQ_RETRY_INTERVAL_MAX:
> > result &= 0xf;
> > pci_info(bdev, "... needs retry", result);
> > if (retry_interval)
> > *retry_interval = result;
> > return -EAGAIN;
> >
> > I don't think it's useful to return different errors based on whether
> > the caller supplied a "retry_interval" pointer.
>
> This is to indicate caller to retry after retry_interval returned by ACPI
> method.
>
> It's up to caller whether to retry or just proceed.
I understand what the retry_interval is for. Obviously the caller can
always decide whether to retry.
How does it help the caller if we return -EAGAIN if it supplied a
retry_interval pointer, but -EINVAL if it didn't?
When the _DSM returns an AUX_PWR_REQ_RETRY_INTERVAL status, I think we
should always return -EAGAIN.
Bjorn
next prev parent reply other threads:[~2026-01-22 20:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 16:42 [PATCH v6 00/12] VRAM Self Refresh Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 01/12] PCI/ACPI: Add D3cold Aux Power Limit_DSM method Badal Nilawar
2026-01-14 20:24 ` Bjorn Helgaas
2026-01-20 14:03 ` Nilawar, Badal
2026-01-22 20:53 ` Bjorn Helgaas [this message]
2026-01-13 16:42 ` [PATCH v6 02/12] PCI/ACPI: Add PERST# Assertion Delay _DSM method Badal Nilawar
2026-01-13 17:04 ` Manivannan Sadhasivam
2026-01-14 13:47 ` Nilawar, Badal
2026-01-14 19:55 ` Bjorn Helgaas
2026-01-14 20:19 ` Bjorn Helgaas
2026-01-20 15:59 ` Nilawar, Badal
2026-01-22 23:27 ` Bjorn Helgaas
2026-01-13 16:42 ` [PATCH v6 03/12] drm/xe/vrsr: Introduce flag has_vrsr Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 04/12] drm/xe/vrsr: Detect VRSR Capability Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 05/12] drm/xe/vrsr: Initialize VRSR feature Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 06/12] drm/xe/vrsr: Enable VRSR on default VGA boot device Badal Nilawar
2026-01-15 14:25 ` Jani Nikula
2026-01-15 15:25 ` Rodrigo Vivi
2026-01-20 13:28 ` Nilawar, Badal
2026-01-20 13:43 ` Jani Nikula
2026-01-20 14:42 ` Shankar, Uma
2026-01-20 15:37 ` Nilawar, Badal
2026-01-20 15:07 ` Vivi, Rodrigo
2026-01-13 16:42 ` [PATCH v6 07/12] drm/xe/vrsr: Refactor d3cold.allowed to a enum Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 08/12] drm/xe/pm: D3cold target state Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 09/12] drm/xe/pm: Refactor PM Sleep Ops Badal Nilawar
2026-01-14 18:00 ` Bjorn Helgaas
2026-01-20 14:05 ` Nilawar, Badal
2026-01-13 16:42 ` [PATCH v6 10/12] drm/xe/vrsr: Enable VRSR Badal Nilawar
2026-01-14 18:02 ` Bjorn Helgaas
2026-01-13 16:42 ` [PATCH v6 11/12] drm/xe/pm/s2idle: Don't evict user BOs D3cold-VRSR state Badal Nilawar
2026-01-13 16:42 ` [PATCH v6 12/12] drm/xe/vrsr: Introduce a debugfs node named vrsr_capable Badal Nilawar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122205348.GA41683@bhelgaas \
--to=helgaas@kernel.org \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=karthik.poosa@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=matthew.auld@intel.com \
--cc=raag.jadav@intel.com \
--cc=rafael@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=sk.anirban@intel.com \
--cc=uma.shankar@intel.com \
--cc=varun.gupta@intel.com \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox