@@ -525,6 +525,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
525525 case MLX5_CMD_OP_SAVE_VHCA_STATE :
526526 case MLX5_CMD_OP_LOAD_VHCA_STATE :
527527 case MLX5_CMD_OP_SYNC_CRYPTO :
528+ case MLX5_CMD_OP_ALLOW_OTHER_VHCA_ACCESS :
528529 * status = MLX5_DRIVER_STATUS_ABORTED ;
529530 * synd = MLX5_DRIVER_SYND ;
530531 return - ENOLINK ;
@@ -728,6 +729,7 @@ const char *mlx5_command_str(int command)
728729 MLX5_COMMAND_STR_CASE (SAVE_VHCA_STATE );
729730 MLX5_COMMAND_STR_CASE (LOAD_VHCA_STATE );
730731 MLX5_COMMAND_STR_CASE (SYNC_CRYPTO );
732+ MLX5_COMMAND_STR_CASE (ALLOW_OTHER_VHCA_ACCESS );
731733 default : return "unknown command opcode" ;
732734 }
733735}
@@ -2090,6 +2092,74 @@ int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
20902092}
20912093EXPORT_SYMBOL (mlx5_cmd_exec_cb );
20922094
2095+ int mlx5_cmd_allow_other_vhca_access (struct mlx5_core_dev * dev ,
2096+ struct mlx5_cmd_allow_other_vhca_access_attr * attr )
2097+ {
2098+ u32 out [MLX5_ST_SZ_DW (allow_other_vhca_access_out )] = {};
2099+ u32 in [MLX5_ST_SZ_DW (allow_other_vhca_access_in )] = {};
2100+ void * key ;
2101+
2102+ MLX5_SET (allow_other_vhca_access_in ,
2103+ in , opcode , MLX5_CMD_OP_ALLOW_OTHER_VHCA_ACCESS );
2104+ MLX5_SET (allow_other_vhca_access_in ,
2105+ in , object_type_to_be_accessed , attr -> obj_type );
2106+ MLX5_SET (allow_other_vhca_access_in ,
2107+ in , object_id_to_be_accessed , attr -> obj_id );
2108+
2109+ key = MLX5_ADDR_OF (allow_other_vhca_access_in , in , access_key );
2110+ memcpy (key , attr -> access_key , sizeof (attr -> access_key ));
2111+
2112+ return mlx5_cmd_exec (dev , in , sizeof (in ), out , sizeof (out ));
2113+ }
2114+
2115+ int mlx5_cmd_alias_obj_create (struct mlx5_core_dev * dev ,
2116+ struct mlx5_cmd_alias_obj_create_attr * alias_attr ,
2117+ u32 * obj_id )
2118+ {
2119+ u32 out [MLX5_ST_SZ_DW (general_obj_out_cmd_hdr )] = {};
2120+ u32 in [MLX5_ST_SZ_DW (create_alias_obj_in )] = {};
2121+ void * param ;
2122+ void * attr ;
2123+ void * key ;
2124+ int ret ;
2125+
2126+ attr = MLX5_ADDR_OF (create_alias_obj_in , in , hdr );
2127+ MLX5_SET (general_obj_in_cmd_hdr ,
2128+ attr , opcode , MLX5_CMD_OP_CREATE_GENERAL_OBJECT );
2129+ MLX5_SET (general_obj_in_cmd_hdr ,
2130+ attr , obj_type , alias_attr -> obj_type );
2131+ param = MLX5_ADDR_OF (general_obj_in_cmd_hdr , in , op_param );
2132+ MLX5_SET (general_obj_create_param , param , alias_object , 1 );
2133+
2134+ attr = MLX5_ADDR_OF (create_alias_obj_in , in , alias_ctx );
2135+ MLX5_SET (alias_context , attr , vhca_id_to_be_accessed , alias_attr -> vhca_id );
2136+ MLX5_SET (alias_context , attr , object_id_to_be_accessed , alias_attr -> obj_id );
2137+
2138+ key = MLX5_ADDR_OF (alias_context , attr , access_key );
2139+ memcpy (key , alias_attr -> access_key , sizeof (alias_attr -> access_key ));
2140+
2141+ ret = mlx5_cmd_exec (dev , in , sizeof (in ), out , sizeof (out ));
2142+ if (ret )
2143+ return ret ;
2144+
2145+ * obj_id = MLX5_GET (general_obj_out_cmd_hdr , out , obj_id );
2146+
2147+ return 0 ;
2148+ }
2149+
2150+ int mlx5_cmd_alias_obj_destroy (struct mlx5_core_dev * dev , u32 obj_id ,
2151+ u16 obj_type )
2152+ {
2153+ u32 out [MLX5_ST_SZ_DW (general_obj_out_cmd_hdr )] = {};
2154+ u32 in [MLX5_ST_SZ_DW (general_obj_in_cmd_hdr )] = {};
2155+
2156+ MLX5_SET (general_obj_in_cmd_hdr , in , opcode , MLX5_CMD_OP_DESTROY_GENERAL_OBJECT );
2157+ MLX5_SET (general_obj_in_cmd_hdr , in , obj_type , obj_type );
2158+ MLX5_SET (general_obj_in_cmd_hdr , in , obj_id , obj_id );
2159+
2160+ return mlx5_cmd_exec (dev , in , sizeof (in ), out , sizeof (out ));
2161+ }
2162+
20932163static void destroy_msg_cache (struct mlx5_core_dev * dev )
20942164{
20952165 struct cmd_msg_cache * ch ;
0 commit comments