Skip to contentSkip to conversation

lib: utils/mailbox: Allow service group version lower than RPMI spec version

PATCH New Rahul Pathak 1 participant 1 message Oct 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: utils/mailbox: Allow service group version lower than RPMI spec version

RPMI specfication defines the version of the service group as the specification version that service group complies with.

Its possible that group version may not changed but spec version has due to other changes.

Allow RPMI mailbox driver to check for every service group version including base to not be greater than the reported RPMI spec version.

---
 lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c +14 -2
index 21330c4b..7eded2fd 100644
@@ -562,8 +562,14 @@ static struct mbox_chan *rpmi_shmem_mbox_request_chan(
 		ret = smq_base_get_two_u32(mctl,
 					   RPMI_BASE_SRV_PROBE_SERVICE_GROUP,
 					   chan_args, tval);
-		if (ret || !tval[1])
+		/*
+		 * The service group version must not be greater than the
+		 * RPMI specification version implemented by the platform
+		 * microcontroller.
+		 */
+		if (ret || !tval[1] || tval[1] > mctl->spec_version)
 			return NULL;
+
 	}
 
 	srvgrp_chan = sbi_zalloc(sizeof(*srvgrp_chan));
@@ -773,8 +779,14 @@ static int rpmi_shmem_mbox_init(const void *fdt, int nodeoff,
 	if (ret)
 		goto fail_free_chan;
 	mctl->spec_version = tval[1];
+
+	/*
+	 * Spec version must not be lower than the Base service group
+	 * version. Spec allows the group version lower then the spec
+	 * version which is implemented by the platform microcontroller.
+	 */
 	if (mctl->spec_version < RPMI_BASE_VERSION_MIN ||
-	    mctl->spec_version != base_srvgrp->servicegroup_version) {
+	    base_srvgrp->servicegroup_version > mctl->spec_version) {
 		ret = SBI_EINVAL;
 		goto fail_free_chan;
 	}
Signature · 7 lines
2.43.0


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi