xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/ofa.c (revision ab93e0dd72c37d378dd936f031ffb83ff2bd87ce)
1 /* SPDX-License-Identifier: MIT
2  *
3  * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
4  */
5 #include <rm/engine.h>
6 
7 #include "nvrm/ofa.h"
8 
9 static int
r570_ofa_alloc(struct nvkm_gsp_object * parent,u32 handle,u32 oclass,int inst,struct nvkm_gsp_object * ofa)10 r570_ofa_alloc(struct nvkm_gsp_object *parent, u32 handle, u32 oclass, int inst,
11 	       struct nvkm_gsp_object *ofa)
12 {
13 	NV_OFA_ALLOCATION_PARAMETERS *args;
14 
15 	args = nvkm_gsp_rm_alloc_get(parent, handle, oclass, sizeof(*args), ofa);
16 	if (WARN_ON(IS_ERR(args)))
17 		return PTR_ERR(args);
18 
19 	args->size = sizeof(*args);
20 	args->engineInstance = inst;
21 
22 	return nvkm_gsp_rm_alloc_wr(ofa, args);
23 }
24 
25 const struct nvkm_rm_api_engine
26 r570_ofa = {
27 	.alloc = r570_ofa_alloc,
28 };
29