gpu: nvgpu: Add mock support for all ga10b registers

- Add support for unit tests to run on orin platform.

JIRA NVGPU-9909

Change-Id: I532e667c4b30c36ca19776cd4ac8ef8fb1147d03
Signed-off-by: srajum <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2886066
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
srajum
2023-04-11 11:34:46 +05:30
committed by mobile promotions
parent 4ee71f9852
commit 63057907ee
3 changed files with 142020 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -46,12 +46,16 @@ struct nvgpu_mock_iospace {
#define MOCK_REGS_PBUS 10U
#define MOCK_REGS_HSHUB 11U
#define MOCK_REGS_FB 12U
#define MOCK_REGS_LAST 13U
#define MOCK_REGS_RUNLIST 13U
#define MOCK_REGS_CHRAM 14U
#define MOCK_REGS_LAST 15U
/**
* Load a mocked register list into the passed IO space description.
*/
int nvgpu_get_mock_reglist(struct gk20a *g, u32 reg_space,
int nvgpu_get_mock_reglist_gv11b(struct gk20a *g, u32 reg_space,
struct nvgpu_mock_iospace *iospace);
int nvgpu_get_mock_reglist_ga10b(struct gk20a *g, u32 reg_space,
struct nvgpu_mock_iospace *iospace);
#endif

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -159,8 +159,22 @@ static void nvgpu_posix_load_regs(struct gk20a *g)
struct nvgpu_mock_iospace space;
struct nvgpu_posix_io_reg_space *regs;
char chip[24];
memset(chip, 0, sizeof(chip));
FILE *tegra_name = popen("uname -m", "r");
while (fgets(chip, sizeof(chip), tegra_name) != NULL) {
chip[strcspn(chip, "\n")] = '\0';
}
pclose(tegra_name);
for (i = 0; i < MOCK_REGS_LAST; i++) {
err = nvgpu_get_mock_reglist(g, i, &space);
if (strcmp(chip, "ARMv8_nVidia-Orin") == 0) {
err = nvgpu_get_mock_reglist_ga10b(g, i, &space);
} else {
err = nvgpu_get_mock_reglist_gv11b(g, i, &space);
}
if (err) {
nvgpu_err(g, "Unknown IO regspace: %d; ignoring.", i);
continue;