@@ -775,6 +775,39 @@ static int optee_ffa_reclaim_protmem(struct optee *optee,
775775 * with a matching configuration.
776776 */
777777
778+ static bool optee_ffa_get_os_revision (struct ffa_device * ffa_dev ,
779+ const struct ffa_ops * ops ,
780+ struct optee_revision * revision )
781+ {
782+ const struct ffa_msg_ops * msg_ops = ops -> msg_ops ;
783+ struct ffa_send_direct_data data = {
784+ .data0 = OPTEE_FFA_GET_OS_VERSION ,
785+ };
786+ int rc ;
787+
788+ msg_ops -> mode_32bit_set (ffa_dev );
789+
790+ rc = msg_ops -> sync_send_receive (ffa_dev , & data );
791+ if (rc ) {
792+ pr_err ("Unexpected error %d\n" , rc );
793+ return false;
794+ }
795+
796+ if (revision ) {
797+ revision -> os_major = data .data0 ;
798+ revision -> os_minor = data .data1 ;
799+ revision -> os_build_id = data .data2 ;
800+ }
801+
802+ if (data .data2 )
803+ pr_info ("revision %lu.%lu (%08lx)" ,
804+ data .data0 , data .data1 , data .data2 );
805+ else
806+ pr_info ("revision %lu.%lu" , data .data0 , data .data1 );
807+
808+ return true;
809+ }
810+
778811static bool optee_ffa_api_is_compatible (struct ffa_device * ffa_dev ,
779812 const struct ffa_ops * ops )
780813{
@@ -798,20 +831,6 @@ static bool optee_ffa_api_is_compatible(struct ffa_device *ffa_dev,
798831 return false;
799832 }
800833
801- data = (struct ffa_send_direct_data ){
802- .data0 = OPTEE_FFA_GET_OS_VERSION ,
803- };
804- rc = msg_ops -> sync_send_receive (ffa_dev , & data );
805- if (rc ) {
806- pr_err ("Unexpected error %d\n" , rc );
807- return false;
808- }
809- if (data .data2 )
810- pr_info ("revision %lu.%lu (%08lx)" ,
811- data .data0 , data .data1 , data .data2 );
812- else
813- pr_info ("revision %lu.%lu" , data .data0 , data .data1 );
814-
815834 return true;
816835}
817836
@@ -900,6 +919,7 @@ static int optee_ffa_open(struct tee_context *ctx)
900919
901920static const struct tee_driver_ops optee_ffa_clnt_ops = {
902921 .get_version = optee_ffa_get_version ,
922+ .get_tee_revision = optee_get_revision ,
903923 .open = optee_ffa_open ,
904924 .release = optee_release ,
905925 .open_session = optee_open_session ,
@@ -918,6 +938,7 @@ static const struct tee_desc optee_ffa_clnt_desc = {
918938
919939static const struct tee_driver_ops optee_ffa_supp_ops = {
920940 .get_version = optee_ffa_get_version ,
941+ .get_tee_revision = optee_get_revision ,
921942 .open = optee_ffa_open ,
922943 .release = optee_release_supp ,
923944 .supp_recv = optee_supp_recv ,
@@ -1060,6 +1081,11 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
10601081 if (!optee )
10611082 return - ENOMEM ;
10621083
1084+ if (!optee_ffa_get_os_revision (ffa_dev , ffa_ops , & optee -> revision )) {
1085+ rc = - EINVAL ;
1086+ goto err_free_optee ;
1087+ }
1088+
10631089 pool = optee_ffa_shm_pool_alloc_pages ();
10641090 if (IS_ERR (pool )) {
10651091 rc = PTR_ERR (pool );
0 commit comments