mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
To: Michal Simek <michal.simek@amd.com>
Cc: Jay Buddhabhatti <jay.buddhabhatti@amd.com>,
	Ronak Jain <ronak.jain@amd.com>,
	Aravind Thokala <Aravind.Thokala@amd.com>,
	Harsh Jain <h.jain@amd.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <git@amd.com>
Subject: [PATCH 4/5] drivers: firmware: xilinx: Localize firmware version caches
Date: Fri, 27 Nov 2026 17:18:38 +0530	[thread overview]
Message-ID: <20261127114839.1428778-5-jay.buddhabhatti@amd.com> (raw)
In-Reply-To: <20261127114839.1428778-1-jay.buddhabhatti@amd.com>

Keep the PM API version cache local to its getter and populate it after
a successful query. The firmware probe now keeps the returned version in
a local variable instead of passing the address of a file-wide cache.

The firmware probe is the only caller of
zynqmp_pm_get_trustzone_version(). Remove the unnecessary trustzone
version cache and keep the returned version local to the probe.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 619ead2069c5..374d39f34480 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -488,9 +488,6 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 			  smc_arg[4], smc_arg[5], smc_arg[6], smc_arg[7]);
 }
 
-static u32 pm_api_version;
-static u32 pm_tz_version;
-
 int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset)
 {
 	int ret;
@@ -512,6 +509,7 @@ int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset)
 int zynqmp_pm_get_api_version(u32 *version)
 {
 	u32 ret_payload[PAYLOAD_ARG_CNT];
+	static u32 pm_api_version;
 	int ret;
 
 	if (!version)
@@ -524,6 +522,8 @@ int zynqmp_pm_get_api_version(u32 *version)
 	}
 	ret = zynqmp_pm_invoke_fn(PM_GET_API_VERSION, ret_payload, 0);
 	*version = ret_payload[1];
+	if (!ret)
+		pm_api_version = ret_payload[1];
 
 	return ret;
 }
@@ -616,11 +616,6 @@ static int zynqmp_pm_get_trustzone_version(u32 *version)
 	if (!version)
 		return -EINVAL;
 
-	/* Check is PM trustzone version already verified */
-	if (pm_tz_version > 0) {
-		*version = pm_tz_version;
-		return 0;
-	}
 	ret = zynqmp_pm_invoke_fn(PM_GET_TRUSTZONE_VERSION, ret_payload, 0);
 	*version = ret_payload[1];
 
@@ -2178,9 +2173,9 @@ static int zynqmp_clear_pm_state(struct device *dev)
 
 static int zynqmp_firmware_probe(struct platform_device *pdev)
 {
+	u32 pm_api_version, pm_family_code, pm_tz_version;
 	struct device *dev = &pdev->dev;
 	struct zynqmp_devinfo *devinfo;
-	u32 pm_family_code;
 	int ret;
 
 	ret = get_set_conduit_method(dev->of_node);
-- 
2.43.0


  parent reply	other threads:[~2026-11-27 11:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 11:48 [PATCH 0/5] drivers: firmware: xilinx: Split ZynqMP firmware driver into modular components Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 1/5] drivers: firmware: xilinx: Relocate PDI library APIs to new file Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 2/5] drivers: firmware: xilinx: Relocate FPGA " Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 3/5] drivers: firmware: xilinx: Relocate NVM " Jay Buddhabhatti
2026-11-27 11:48 ` Jay Buddhabhatti [this message]
2026-11-27 11:48 ` [PATCH 5/5] drivers: firmware: xilinx: Split PM EEMI and core APIs in firmware Jay Buddhabhatti

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=20261127114839.1428778-5-jay.buddhabhatti@amd.com \
    --to=jay.buddhabhatti@amd.com \
    --cc=Aravind.Thokala@amd.com \
    --cc=git@amd.com \
    --cc=h.jain@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=ronak.jain@amd.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

all inboxes | Powered by JetHome®