gpu: nvgpu: add domain name API

Add nvgpu_nvs_domain_get_name() to minimize messing up with nvs
internals and to help code organization when nvs is not built in yet. A
stub to help compilation returns NULL because no domains can exist when
the stub is built in, and thus it won't be used.

Jira NVGPU-6788

Change-Id: If663f7c0e8434ef00dd3a3f40f6404a35b477f2b
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2673120
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Konsta Hölttä
2022-02-23 12:11:20 +02:00
committed by mobile promotions
parent 2a8914619d
commit f10ee4ab0e
3 changed files with 18 additions and 4 deletions

View File

@@ -167,23 +167,23 @@ int nvgpu_tsg_bind_channel(struct nvgpu_tsg *tsg, struct nvgpu_channel *ch)
int nvgpu_tsg_bind_domain(struct nvgpu_tsg *tsg, struct nvgpu_nvs_domain *nnvs_domain)
{
struct nvgpu_runlist_domain *rl_domain;
struct nvs_domain *nvs_domain;
struct gk20a *g = tsg->g;
const char *name;
/* Hopping channels from one domain to another is not allowed */
if (tsg->num_active_channels != 0U) {
return -EINVAL;
}
nvs_domain = nnvs_domain->parent;
name = nvgpu_nvs_domain_get_name(nnvs_domain);
/*
* The domain ptr will get updated with the right id once the runlist
* gets specified based on the first channel.
*/
rl_domain = nvgpu_rl_domain_get(g, 0, nvs_domain->name);
rl_domain = nvgpu_rl_domain_get(g, 0, name);
if (rl_domain == NULL) {
nvgpu_err(g, "rl domain not found (%s)", nvs_domain->name);
nvgpu_err(g, "rl domain not found (%s)", name);
/*
* This shouldn't happen because the nvs domain guarantees RL domains.
*

View File

@@ -490,6 +490,13 @@ u32 nvgpu_nvs_domain_count(struct gk20a *g)
return count;
}
const char *nvgpu_nvs_domain_get_name(struct nvgpu_nvs_domain *dom)
{
struct nvs_domain *nvs_dom = dom->parent;
return nvs_dom->name;
}
void nvgpu_nvs_get_log(struct gk20a *g, s64 *timestamp, const char **msg)
{
struct nvs_log_event ev;

View File

@@ -103,6 +103,7 @@ struct nvgpu_nvs_domain *
nvgpu_nvs_domain_by_name(struct gk20a *g, const char *name);
void nvgpu_nvs_domain_get(struct gk20a *g, struct nvgpu_nvs_domain *dom);
void nvgpu_nvs_domain_put(struct gk20a *g, struct nvgpu_nvs_domain *dom);
const char *nvgpu_nvs_domain_get_name(struct nvgpu_nvs_domain *dom);
/*
* Debug wrapper for NVS code.
*/
@@ -134,6 +135,12 @@ static inline void nvgpu_nvs_domain_put(struct gk20a *g, struct nvgpu_nvs_domain
(void)g;
(void)dom;
}
static inline const char *nvgpu_nvs_domain_get_name(struct nvgpu_nvs_domain *dom)
{
(void)dom;
return NULL;
}
#endif
#endif