Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/sriov: Use scope-based runtime PM

Use scope-based runtime power management in the SRIOV code for
consistency with other parts of the driver.

v2:
- Drop unnecessary 'ret' variables. (Gustavo)

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20251118164338.3572146-53-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

+11 -29
+3 -7
drivers/gpu/drm/xe/xe_pci_sriov.c
··· 219 219 int xe_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) 220 220 { 221 221 struct xe_device *xe = pdev_to_xe_device(pdev); 222 - int ret; 223 222 224 223 if (!IS_SRIOV_PF(xe)) 225 224 return -ENODEV; ··· 232 233 if (num_vfs && pci_num_vf(pdev)) 233 234 return -EBUSY; 234 235 235 - xe_pm_runtime_get(xe); 236 + guard(xe_pm_runtime)(xe); 236 237 if (num_vfs > 0) 237 - ret = pf_enable_vfs(xe, num_vfs); 238 + return pf_enable_vfs(xe, num_vfs); 238 239 else 239 - ret = pf_disable_vfs(xe); 240 - xe_pm_runtime_put(xe); 241 - 242 - return ret; 240 + return pf_disable_vfs(xe); 243 241 } 244 242 245 243 /**
+2 -4
drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c
··· 70 70 if (ret < 0) 71 71 return ret; 72 72 if (yes) { 73 - xe_pm_runtime_get(xe); 73 + guard(xe_pm_runtime)(xe); 74 74 ret = call(xe); 75 - xe_pm_runtime_put(xe); 76 75 } 77 76 if (ret < 0) 78 77 return ret; ··· 208 209 if (ret < 0) 209 210 return ret; 210 211 if (yes) { 211 - xe_pm_runtime_get(xe); 212 + guard(xe_pm_runtime)(xe); 212 213 ret = call(xe, vfid); 213 - xe_pm_runtime_put(xe); 214 214 } 215 215 if (ret < 0) 216 216 return ret;
+4 -12
drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
··· 389 389 struct xe_sriov_dev_attr *vattr = to_xe_sriov_dev_attr(attr); 390 390 struct xe_sriov_kobj *vkobj = to_xe_sriov_kobj(kobj); 391 391 struct xe_device *xe = vkobj->xe; 392 - ssize_t ret; 393 392 394 393 if (!vattr->store) 395 394 return -EPERM; 396 395 397 - xe_pm_runtime_get(xe); 398 - ret = xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, buf, count); 399 - xe_pm_runtime_put(xe); 400 - 401 - return ret; 396 + guard(xe_pm_runtime)(xe); 397 + return xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, buf, count); 402 398 } 403 399 404 400 static ssize_t xe_sriov_vf_attr_show(struct kobject *kobj, struct attribute *attr, char *buf) ··· 419 423 struct xe_sriov_kobj *vkobj = to_xe_sriov_kobj(kobj); 420 424 struct xe_device *xe = vkobj->xe; 421 425 unsigned int vfid = vkobj->vfid; 422 - ssize_t ret; 423 426 424 427 xe_sriov_pf_assert_vfid(xe, vfid); 425 428 426 429 if (!vattr->store) 427 430 return -EPERM; 428 431 429 - xe_pm_runtime_get(xe); 430 - ret = xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, vfid, buf, count); 431 - xe_pm_runtime_get(xe); 432 - 433 - return ret; 432 + guard(xe_pm_runtime)(xe); 433 + return xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, vfid, buf, count); 434 434 } 435 435 436 436 static const struct sysfs_ops xe_sriov_dev_sysfs_ops = {
+1 -4
drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
··· 477 477 if (!IS_VF_CCS_READY(xe)) 478 478 return; 479 479 480 - xe_pm_runtime_get(xe); 481 - 480 + guard(xe_pm_runtime)(xe); 482 481 for_each_ccs_rw_ctx(ctx_id) { 483 482 bb_pool = xe->sriov.vf.ccs.contexts[ctx_id].mem.ccs_bb_pool; 484 483 if (!bb_pool) ··· 488 489 drm_suballoc_dump_debug_info(&bb_pool->base, p, xe_sa_manager_gpu_addr(bb_pool)); 489 490 drm_puts(p, "\n"); 490 491 } 491 - 492 - xe_pm_runtime_put(xe); 493 492 }
+1 -2
drivers/gpu/drm/xe/xe_tile_sriov_pf_debugfs.c
··· 141 141 if (val > (TYPE)~0ull) \ 142 142 return -EOVERFLOW; \ 143 143 \ 144 - xe_pm_runtime_get(xe); \ 144 + guard(xe_pm_runtime)(xe); \ 145 145 err = xe_sriov_pf_wait_ready(xe) ?: \ 146 146 xe_gt_sriov_pf_config_set_##CONFIG(gt, vfid, val); \ 147 147 if (!err) \ 148 148 xe_sriov_pf_provision_set_custom_mode(xe); \ 149 - xe_pm_runtime_put(xe); \ 150 149 \ 151 150 return err; \ 152 151 } \