[PATCH <i-g-t> v1 1/2] Add support for xe in runtime pm

Purkait, Soham soham.purkait at intel.com
Mon Mar 24 06:43:44 UTC 2025


Hi Kamil,

On 18-03-2025 21:16, Kamil Konieczny wrote:
> Hi Soham,
> On 2025-03-17 at 13:58:22 +0530, 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
>>
>> 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);
>> +			if (!strcmp("i915", card.driver))
>> +				__igt_debugfs_dump(data.drm_fd,
>> +						   "i915_runtime_pm_status",
>> +						   IGT_LOG_INFO);
> Dump this also fo xe driver.
What is the equivalent file name for Xe as "i915_runtime_pm_status" for 
i915 ?
Thanks,
Soham
>
> Regards,
> Kamil
>
>>   			ret = EXIT_FAILURE;
>>   			goto exit;
>>   		}
>> -- 
>> 2.34.1
>>


More information about the igt-dev mailing list