Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Vivi, Rodrigo" <rodrigo.vivi@intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Konieczny, Kamil" <kamil.konieczny@intel.com>
Subject: Re: [PATCH i-g-t v4 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms
Date: Fri, 19 Jan 2024 14:47:53 +0000	[thread overview]
Message-ID: <90e04338b0bcb55504733504d5642c699086d2e6.camel@intel.com> (raw)
In-Reply-To: <CY5PR11MB621114B6F0AA5A5B872887DF95702@CY5PR11MB6211.namprd11.prod.outlook.com>

On Fri, 2024-01-19 at 14:12 +0000, Gupta, Anshuman wrote:
> 
> 
> > -----Original Message-----
> > From: Vivi, Rodrigo <rodrigo.vivi@intel.com>
> > Sent: Thursday, December 28, 2023 6:11 AM
> > To: Gupta, Anshuman <anshuman.gupta@intel.com>
> > Cc: igt-dev@lists.freedesktop.org; Tauro, Riana
> > <riana.tauro@intel.com>;
> > Nilawar, Badal <badal.nilawar@intel.com>; Konieczny, Kamil
> > <kamil.konieczny@intel.com>
> > Subject: Re: [PATCH i-g-t v4 2/4] lib/igt_pm: Add helper to get/set
> > auto_suspenddelay_ms
> > 
> > On Thu, Dec 21, 2023 at 10:03:36PM +0530, Anshuman Gupta wrote:
> > > Sometimes we want to test pm igt test with an explicit auto
> > > suspend
> > > delay, therefore adding helpers to get/set the pci_dev
> > > auto_suspenddelay_ms.
> > > 
> > > Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> > 
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > 
> > we also need to change the default value from 0 to 1 at least, and
> > then see
> > how much more time machine we use. But 0 is unrealistic.
> Thanks Rodrigo for RB.
> You mean 1ms or 1 second ?

ops, yeap, I mentioned 1second. But we might attempt some smaller
ones like 500ms?! 200ms?

> Thanks,
> Anshuman Gupta.
> > 
> > > ---
> > >  lib/igt_pm.c | 53
> > > ++++++++++++++++++++++++++++++++++++++++------------
> > >  lib/igt_pm.h |  2 ++
> > >  2 files changed, 43 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/lib/igt_pm.c b/lib/igt_pm.c index
> > > c2d98fceb..d436c2c50
> > > 100644
> > > --- a/lib/igt_pm.c
> > > +++ b/lib/igt_pm.c
> > > @@ -1068,18 +1068,6 @@ static void igt_pm_write_power_attr(int
> > > fd,
> > const char *val, int len)
> > >         igt_assert(strncmp(buf, val, len) == 0);  }
> > > 
> > > -static int igt_pm_get_autosuspend_delay(struct pci_device
> > > *pci_dev)
> > > -{
> > > -       char delay_str[64];
> > > -       int delay, delay_fd;
> > > -
> > > -       delay_fd = igt_pm_get_power_attr_fd(pci_dev,
> > "autosuspend_delay_ms");
> > > -       if (igt_pm_read_power_attr(delay_fd, delay_str, 64,
> > > true))
> > > -               igt_assert(sscanf(delay_str, "%d", &delay) > 0);
> > > -
> > > -       return delay;
> > > -}
> > > -
> > >  static void
> > >  igt_pm_setup_pci_dev_power_attrs(struct pci_device *pci_dev,
> > >                                  struct igt_pm_pci_dev_pwrattr
> > > *pwrattr, int
> > delay_ms) @@ -1165,6
> > > +1153,47 @@ igt_pm_setup_pci_card_power_attrs(struct pci_device
> > *pci_dev, bool save_attrs, i
> > >         pci_iterator_destroy(iter);
> > >  }
> > > 
> > > +/**
> > > + * igt_pm_get_autosuspend_delay:
> > > + * @pci_dev: pci_dev.
> > > + * Get pci_dev autosuspend delay value from pci sysfs
> > "autosuspend_delay_ms".
> > > + *
> > > + * Returns:
> > > + * autosuspend_delay_ms.
> > > + */
> > > +int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev) {
> > > +       char delay_str[64];
> > > +       int delay, delay_fd;
> > > +
> > > +       delay_fd = igt_pm_get_power_attr_fd(pci_dev,
> > "autosuspend_delay_ms");
> > > +       if (igt_pm_read_power_attr(delay_fd, delay_str, 64,
> > > true))
> > > +               igt_assert(sscanf(delay_str, "%d", &delay) > 0);
> > > +
> > > +       return delay;
> > > +}
> > > +
> > > +/**
> > > + * igt_pm_set_autosuspend_delay:
> > > + * @pci_dev: pci_dev.
> > > + * @delay_ms: autosuspend delay in ms.
> > > + * Set pci_dev autosuspend delay value through pci sysfs
> > "autosuspend_delay_ms".
> > > + */
> > > +void igt_pm_set_autosuspend_delay(struct pci_device *pci_dev,
> > > int
> > > +delay_ms) {
> > > +       char delay_str[64];
> > > +       int delay_fd;
> > > +
> > > +       delay_fd = igt_pm_get_power_attr_fd(pci_dev,
> > > +"autosuspend_delay_ms");
> > > +
> > > +       if (delay_ms >= 0) {
> > > +               int wc;
> > > +
> > > +               wc = snprintf(delay_str, 64, "%d\n", delay_ms);
> > > +               igt_pm_write_power_attr(delay_fd, delay_str, wc);
> > > +       }
> > > +}
> > > +
> > >  /**
> > >   * igt_pm_enable_pci_card_runtime_pm:
> > >   * @root: root port pci_dev.
> > > diff --git a/lib/igt_pm.h b/lib/igt_pm.h index
> > > 306a9eb46..8394315c6
> > > 100644
> > > --- a/lib/igt_pm.h
> > > +++ b/lib/igt_pm.h
> > > @@ -77,6 +77,8 @@ int igt_pm_get_pcie_acpihp_slot(struct
> > > pci_device
> > > *pci_dev);  bool igt_pm_acpi_d3cold_supported(struct pci_device
> > > *pci_dev);  enum igt_acpi_d_state 
> > > igt_pm_get_acpi_real_d_state(struct
> > > pci_device *pci_dev);
> > > +int igt_pm_get_autosuspend_delay(struct pci_device *pci_dev);
> > > void
> > > +igt_pm_set_autosuspend_delay(struct pci_device *pci_dev, int
> > > +delay_ms);
> > >  void igt_pm_enable_pci_card_runtime_pm(struct pci_device *root,
> > >                                        struct pci_device *i915);
> > >  void igt_pm_get_d3cold_allowed(const char *pci_slot_name,
> > > uint32_t
> > > *value);
> > > --
> > > 2.25.1
> > > 


  reply	other threads:[~2024-01-19 14:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 16:33 [PATCH i-g-t v4 0/4] Add d3 mmap test Anshuman Gupta
2023-12-21 16:33 ` [PATCH i-g-t v4 1/4] test/xe_pm: Add exit handler to close fw handle Anshuman Gupta
2023-12-21 16:33 ` [PATCH i-g-t v4 2/4] lib/igt_pm: Add helper to get/set auto_suspenddelay_ms Anshuman Gupta
2023-12-28  0:40   ` Rodrigo Vivi
2024-01-19 14:12     ` Gupta, Anshuman
2024-01-19 14:47       ` Vivi, Rodrigo [this message]
2023-12-21 16:33 ` [PATCH i-g-t v4 3/4] tests/xe_pm: Add d3-mmap IGT test Anshuman Gupta
2023-12-22  7:48   ` Nilawar, Badal
2023-12-22  7:48     ` Nilawar, Badal
2023-12-21 16:33 ` [PATCH i-g-t v4 4/4] HAX: Add d3-mmap to xe-fast-feedback Anshuman Gupta

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=90e04338b0bcb55504733504d5642c699086d2e6.camel@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@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