[PATCH 'i-g-t' v2 2/2] tools/intel_pm_rpm: Add support for xe in runtime pm

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Mar 27 17:06:22 UTC 2025


Hi Riana,
On 2025-03-27 at 19:37:55 +0530, Riana Tauro wrote:
> Hi Soham
> 
> Use this while generating patch for igt
> git format-patch --subject-prefix="i-g-t"
> 
> Replace  [PATCH 'i-g-t' ...]  with [PATCH i-g-t ...]

Or follow CONTRIBUTING.md and in your igt repo do:

git config format.subjectprefix "PATCH i-g-t"

Regards,
Kamil

> 
> On 3/27/2025 7:18 AM, Soham Purkait wrote:
> >    Add support for runtime power management
> > for Xe driver along with existing i915
> > support.
> > 
> > v1 :  Updated references from "i915" to
> >        "generic GPU driver" to include support
> >        for the xe driver, ensuring clarity and
> >        consistency
> > 
> > v2 : Add prefix in commit message (Kamil)
> > 
> > Signed-off-by: Soham Purkait <soham.purkait at intel.com>
> > ---
> >   tools/intel_pm_rpm.c | 28 ++++++++++++++++------------
> >   1 file changed, 16 insertions(+), 12 deletions(-)
> > 
> > diff --git a/tools/intel_pm_rpm.c b/tools/intel_pm_rpm.c
> > index 08c25ca8a..8c4778e4f 100644
> > --- a/tools/intel_pm_rpm.c
> > +++ b/tools/intel_pm_rpm.c
> > @@ -35,7 +35,7 @@
> >   #include "igt_pm.h"
> >   #define DONT_SET_AUTOSUSPEND_DELAY (1 << 0)
> > -#define SET_I915_AUTOSUSPEND_DELAY (1 << 1)
> > +#define SET_AUTOSUSPEND_DELAY (1 << 1)
> >   typedef struct {
> >   	int drm_fd;
> > @@ -47,8 +47,8 @@ typedef struct {
> >   const char *help_str =
> >   	"  --disable-display-wait\t\tDisable all screens and try to go into runtime pm.\n"
> >   	"  --force-d3cold-wait\t\tForce dgfx gfx card to enter runtime D3Cold.\n"
> > -	"  --setup-d3cold\t\tEnable gfx card runtime pm and optionally set autosupend delay to"
> > -	"  i915 autosuspend delay. Use --setup-d3cold=i915-auto-delay as optional argument.\n"
> > +	"  --setup-d3cold\t\tEnable gfx card runtime pm and optionally set GPU driver's"
> > +	"  autosuspend delay. Use --setup-d3cold=auto-delay as optional argument.\n"
> >   	"  --help\t\tProvide help. Provide card name with IGT_DEVICE=drm:/dev/dri/card*.";
> >   static struct option long_options[] = {
> >   	{"disable-display-wait", 0, 0, 'd'},
> > @@ -80,14 +80,14 @@ static void disable_all_displays(data_t *data)
> >   static void
> >   setup_gfx_card_d3cold(data_t *data, unsigned char setup_d3cold)
> >   {
> > -	struct pci_device *root, *i915;
> > +	struct pci_device *root, *gpu_device;
> >   	root = igt_device_get_pci_root_port(data->drm_fd);
> >   	if (setup_d3cold == DONT_SET_AUTOSUSPEND_DELAY) {
> >   		igt_pm_enable_pci_card_runtime_pm(root, NULL);
> > -	} else if (setup_d3cold == SET_I915_AUTOSUSPEND_DELAY) {
> > -		i915 = igt_device_get_pci_device(data->drm_fd);
> > -		igt_pm_enable_pci_card_runtime_pm(root, i915);
> > +	} else if (setup_d3cold == SET_AUTOSUSPEND_DELAY) {
> > +		gpu_device = igt_device_get_pci_device(data->drm_fd);
> > +		igt_pm_enable_pci_card_runtime_pm(root, gpu_device);
> >   	}
> >   	igt_info("Enabled pci devs runtime pm under Root port %04x:%02x:%02x.%01x\n",
> > @@ -151,7 +151,8 @@ int main(int argc, char *argv[])
> >   			goto exit;
> >   		}
> >   	} else {
> > -		if (!igt_device_find_first_i915_discrete_card(&card)) {
> > +		if (!igt_device_find_first_i915_discrete_card(&card) &&
> > +		    !igt_device_find_first_xe_discrete_card(&card)) {
> >   			igt_warn("No discrete gpu found\n");
> >   			ret = EXIT_FAILURE;
> >   			goto exit;
> > @@ -169,8 +170,8 @@ int main(int argc, char *argv[])
> >   			break;
> >   		case 's':
> >   			if (optarg) {
> > -				if (!strcmp(optarg, "i915-auto-delay")) {
> > -					setup_d3cold = SET_I915_AUTOSUSPEND_DELAY;
> > +				if (!strcmp(optarg, "auto-delay")) {
> > +					setup_d3cold = SET_AUTOSUSPEND_DELAY;
> >   				} else	{
> >   					usage(argv[0]);
> >   					ret = EXIT_SUCCESS;
> > @@ -203,7 +204,7 @@ int main(int argc, char *argv[])
> >   		kmstest_set_vt_graphics_mode();
> >   		igt_display_require(&data.display, data.drm_fd);
> > -		/* i915 disables RPM in case DMC is not loaded on kms supported cards */
> > +		/* GPU driver disables RPM in case DMC is not loaded on kms supported cards */
> >   		if (!igt_pm_dmc_loaded(data.debugfs_fd)) {
> >   			igt_warn("dmc fw is not loaded, no runtime pm\n");
> >   			ret = EXIT_FAILURE;
> > @@ -215,7 +216,10 @@ int main(int argc, char *argv[])
> >   		igt_setup_runtime_pm(data.drm_fd);
> >   		disable_all_displays(&data);
> >   		if (!igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)) {
> > -			__igt_debugfs_dump(data.drm_fd, "i915_runtime_pm_status", IGT_LOG_INFO);
> Add a error or warn statement for xe or else it'll just quit
> 
> Is this tested for xe since CI doesn't run tools?
> 
> Thanks
> Riana> +			if (!strcmp("i915", card.driver))
> > +				__igt_debugfs_dump(data.drm_fd,
> > +						   "i915_runtime_pm_status",
> > +						   IGT_LOG_INFO);
> >   			ret = EXIT_FAILURE;
> >   			goto exit;
> >   		}
> 


More information about the igt-dev mailing list