@@ -1029,26 +1029,51 @@ r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend)
1029
1029
return nvkm_gsp_rpc_wr (gsp , rpc , true);
1030
1030
}
1031
1031
1032
+ /* dword only */
1033
+ struct nv_gsp_registry_entries {
1034
+ const char * name ;
1035
+ u32 value ;
1036
+ };
1037
+
1038
+ static const struct nv_gsp_registry_entries r535_registry_entries [] = {
1039
+ { "RMSecBusResetEnable" , 1 },
1040
+ { "RMForcePcieConfigSave" , 1 },
1041
+ };
1042
+ #define NV_GSP_REG_NUM_ENTRIES ARRAY_SIZE(r535_registry_entries)
1043
+
1032
1044
static int
1033
1045
r535_gsp_rpc_set_registry (struct nvkm_gsp * gsp )
1034
1046
{
1035
1047
PACKED_REGISTRY_TABLE * rpc ;
1036
1048
char * strings ;
1049
+ int str_offset ;
1050
+ int i ;
1051
+ size_t rpc_size = sizeof (* rpc ) + sizeof (rpc -> entries [0 ]) * NV_GSP_REG_NUM_ENTRIES ;
1052
+
1053
+ /* add strings + null terminator */
1054
+ for (i = 0 ; i < NV_GSP_REG_NUM_ENTRIES ; i ++ )
1055
+ rpc_size += strlen (r535_registry_entries [i ].name ) + 1 ;
1037
1056
1038
- rpc = nvkm_gsp_rpc_get (gsp , NV_VGPU_MSG_FUNCTION_SET_REGISTRY ,
1039
- sizeof (* rpc ) + sizeof (rpc -> entries [0 ]) + 1 );
1057
+ rpc = nvkm_gsp_rpc_get (gsp , NV_VGPU_MSG_FUNCTION_SET_REGISTRY , rpc_size );
1040
1058
if (IS_ERR (rpc ))
1041
1059
return PTR_ERR (rpc );
1042
1060
1043
1061
rpc -> size = sizeof (* rpc );
1044
- rpc -> numEntries = 1 ;
1045
- rpc -> entries [0 ].nameOffset = offsetof(typeof (* rpc ), entries [1 ]);
1046
- rpc -> entries [0 ].type = 1 ;
1047
- rpc -> entries [0 ].data = 0 ;
1048
- rpc -> entries [0 ].length = 4 ;
1049
-
1050
- strings = (char * )& rpc -> entries [1 ];
1051
- strings [0 ] = '\0' ;
1062
+ rpc -> numEntries = NV_GSP_REG_NUM_ENTRIES ;
1063
+
1064
+ str_offset = offsetof(typeof (* rpc ), entries [NV_GSP_REG_NUM_ENTRIES ]);
1065
+ strings = (char * )& rpc -> entries [NV_GSP_REG_NUM_ENTRIES ];
1066
+ for (i = 0 ; i < NV_GSP_REG_NUM_ENTRIES ; i ++ ) {
1067
+ int name_len = strlen (r535_registry_entries [i ].name ) + 1 ;
1068
+
1069
+ rpc -> entries [i ].nameOffset = str_offset ;
1070
+ rpc -> entries [i ].type = 1 ;
1071
+ rpc -> entries [i ].data = r535_registry_entries [i ].value ;
1072
+ rpc -> entries [i ].length = 4 ;
1073
+ memcpy (strings , r535_registry_entries [i ].name , name_len );
1074
+ strings += name_len ;
1075
+ str_offset += name_len ;
1076
+ }
1052
1077
1053
1078
return nvkm_gsp_rpc_wr (gsp , rpc , false);
1054
1079
}
0 commit comments