mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: add nvgpu_get_v2_user_class()
Add a function to find the nvgpu_class of the v2 user device nodes. This is the last entry in the class list, as the devices are created in that order. The v2 user class is not defined when MIG is enabled because there are multiple logical devices; bigger changes would be needed for this. Jira NVGPU-6788 Change-Id: I2177c1e5b4d0bbec77a4e258391859242b4f20d6 Signed-off-by: Konsta Hölttä <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2674427 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
f11ca4c300
commit
beed6d3c2b
@@ -511,6 +511,8 @@ static int nvgpu_prepare_default_dev_node_class_list(struct gk20a *g,
|
|||||||
* V2 device node names hierarchy.
|
* V2 device node names hierarchy.
|
||||||
* This hierarchy will replace above hierarchy in second phase.
|
* This hierarchy will replace above hierarchy in second phase.
|
||||||
* Both legacy and V2 device node hierarchies will co-exist until then.
|
* Both legacy and V2 device node hierarchies will co-exist until then.
|
||||||
|
*
|
||||||
|
* Note: nvgpu_get_v2_user_class() assumes this order in the class list.
|
||||||
*/
|
*/
|
||||||
if (g->pci_class != 0U) {
|
if (g->pci_class != 0U) {
|
||||||
if (power_node) {
|
if (power_node) {
|
||||||
@@ -546,6 +548,23 @@ static int nvgpu_prepare_default_dev_node_class_list(struct gk20a *g,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct nvgpu_class *nvgpu_get_v2_user_class(struct gk20a *g)
|
||||||
|
{
|
||||||
|
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||||
|
struct nvgpu_class *class;
|
||||||
|
|
||||||
|
if (nvgpu_grmgr_is_multi_gr_enabled(g)) {
|
||||||
|
/* Ambiguous with multiple fractional GPUs */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvgpu_assert(!nvgpu_list_empty(&l->class_list_head));
|
||||||
|
/* this must match nvgpu_prepare_default_dev_node_class_list() */
|
||||||
|
class = nvgpu_list_last_entry(&l->class_list_head, nvgpu_class, list_entry);
|
||||||
|
nvgpu_assert(!class->power_node);
|
||||||
|
return class;
|
||||||
|
}
|
||||||
|
|
||||||
static int nvgpu_prepare_dev_node_class_list(struct gk20a *g, u32 *num_classes,
|
static int nvgpu_prepare_dev_node_class_list(struct gk20a *g, u32 *num_classes,
|
||||||
bool power_node)
|
bool power_node)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,5 +80,6 @@ int nvgpu_create_device(
|
|||||||
const char *cdev_name,
|
const char *cdev_name,
|
||||||
struct cdev *cdev, struct device **out,
|
struct cdev *cdev, struct device **out,
|
||||||
struct nvgpu_class *class);
|
struct nvgpu_class *class);
|
||||||
|
struct nvgpu_class *nvgpu_get_v2_user_class(struct gk20a *g);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user