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

remoteproc: xlnx: Avoid RPU force power down

Powering off RPU using force_pwrdwn call results in system failure
if there are multiple users of that RPU node. Better mechanism is to use
request_node and release_node EEMI calls. With use of these EEMI calls,
platform management controller will take-care of powering off RPU
when there is no user.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
Link: https://lore.kernel.org/r/20250506165944.1109534-1-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

authored by

Tanmay Shah and committed by
Mathieu Poirier
b170eb0d bcd24123

+33 -1
+33 -1
drivers/remoteproc/xlnx_r5_remoteproc.c
··· 380 380 dev_dbg(r5_core->dev, "RPU boot addr 0x%llx from %s.", rproc->bootaddr, 381 381 bootmem == PM_RPU_BOOTMEM_HIVEC ? "OCM" : "TCM"); 382 382 383 + /* Request node before starting RPU core if new version of API is supported */ 384 + if (zynqmp_pm_feature(PM_REQUEST_NODE) > 1) { 385 + ret = zynqmp_pm_request_node(r5_core->pm_domain_id, 386 + ZYNQMP_PM_CAPABILITY_ACCESS, 0, 387 + ZYNQMP_PM_REQUEST_ACK_BLOCKING); 388 + if (ret < 0) { 389 + dev_err(r5_core->dev, "failed to request 0x%x", 390 + r5_core->pm_domain_id); 391 + return ret; 392 + } 393 + } 394 + 383 395 ret = zynqmp_pm_request_wake(r5_core->pm_domain_id, 1, 384 396 bootmem, ZYNQMP_PM_REQUEST_ACK_NO); 385 397 if (ret) ··· 413 401 struct zynqmp_r5_core *r5_core = rproc->priv; 414 402 int ret; 415 403 404 + /* Use release node API to stop core if new version of API is supported */ 405 + if (zynqmp_pm_feature(PM_RELEASE_NODE) > 1) { 406 + ret = zynqmp_pm_release_node(r5_core->pm_domain_id); 407 + if (ret) 408 + dev_err(r5_core->dev, "failed to stop remoteproc RPU %d\n", ret); 409 + return ret; 410 + } 411 + 412 + /* 413 + * Check expected version of EEMI call before calling it. This avoids 414 + * any error or warning prints from firmware as it is expected that fw 415 + * doesn't support it. 416 + */ 417 + if (zynqmp_pm_feature(PM_FORCE_POWERDOWN) != 1) { 418 + dev_dbg(r5_core->dev, "EEMI interface %d ver 1 not supported\n", 419 + PM_FORCE_POWERDOWN); 420 + return -EOPNOTSUPP; 421 + } 422 + 423 + /* maintain force pwr down for backward compatibility */ 416 424 ret = zynqmp_pm_force_pwrdwn(r5_core->pm_domain_id, 417 425 ZYNQMP_PM_REQUEST_ACK_BLOCKING); 418 426 if (ret) 419 - dev_err(r5_core->dev, "failed to stop remoteproc RPU %d\n", ret); 427 + dev_err(r5_core->dev, "core force power down failed\n"); 420 428 421 429 return ret; 422 430 }