[PATCH 1/2] lib/amdgpu: allow usage convenient chip info

Zhang, Jesse(Jie) Jesse.Zhang at amd.com
Mon Jun 24 01:57:20 UTC 2024


[AMD Official Use Only - AMD Internal Distribution Only]

This patch looks good to me.

Reviewed-by: Jesse Zhang <Jesse.Zhang at amd.com>

-----Original Message-----
From: vitaly.prosyak at amd.com <vitaly.prosyak at amd.com>
Sent: Sunday, June 23, 2024 6:52 AM
To: igt-dev at lists.freedesktop.org
Cc: Prosyak, Vitaly <Vitaly.Prosyak at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; Kamil Konieczny <kamil.konieczny at linux.intel.com>; Zhang, Jesse(Jie) <Jesse.Zhang at amd.com>
Subject: [PATCH 1/2] lib/amdgpu: allow usage convenient chip info

From: Vitaly Prosyak <vitaly.prosyak at amd.com>

Make the struct chip_info accessible for use within the test.
The structure will be accessed through a constant pointer, ensuring that no modifications to its fields are allowed.

Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian Koenig <christian.koenig at amd.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Cc: Jesse Zhang <Jesse.Zhang at amd.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak at amd.com>
---
 lib/amdgpu/amd_ip_blocks.c | 10 ++--------  lib/amdgpu/amd_ip_blocks.h | 10 +++++++++-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/amdgpu/amd_ip_blocks.c b/lib/amdgpu/amd_ip_blocks.c index 2ee94105c..19e2838f5 100644
--- a/lib/amdgpu/amd_ip_blocks.c
+++ b/lib/amdgpu/amd_ip_blocks.c
@@ -16,7 +16,6 @@

 #include <amdgpu_drm.h>
 #include "amdgpu_asic_addr.h"
-#include "amd_family.h"
 #include "amd_gfx_v8_0.h"
 #include "ioctl_wrappers.h"

@@ -412,15 +411,9 @@ struct amdgpu_ip_block_version sdma_v3_x_ip_block = {
        .funcs = &sdma_v3_x_ip_funcs
 };

-struct chip_info {
-       const char *name;
-       enum radeon_family family;
-       enum chip_class chip_class;
-         amdgpu_device_handle dev;
-};
-
 /* we may improve later */
 struct amdgpu_ip_blocks_device amdgpu_ips;
+const struct chip_info  *g_pChip = NULL;
 struct chip_info g_chip;

 static int
@@ -617,6 +610,7 @@ int setup_amdgpu_ip_blocks(uint32_t major, uint32_t minor, struct amdgpu_gpu_inf
                {},
        };
        struct chip_info *info = &g_chip;
+       g_pChip = &g_chip;

        switch (amdinfo->family_id) {
        case AMDGPU_FAMILY_SI:
diff --git a/lib/amdgpu/amd_ip_blocks.h b/lib/amdgpu/amd_ip_blocks.h index 97a9ad489..d4364d604 100644
--- a/lib/amdgpu/amd_ip_blocks.h
+++ b/lib/amdgpu/amd_ip_blocks.h
@@ -8,6 +8,7 @@
 #define AMD_IP_BLOCKS_H

 #include "amd_registers.h"
+#include "amd_family.h"

 #define MAX_CARDS_SUPPORTED 4

@@ -110,8 +111,15 @@ struct amdgpu_ip_blocks_device {
        int                     num_ip_blocks;
 };

-extern  struct amdgpu_ip_blocks_device amdgpu_ips;
+struct chip_info {
+       const char *name;
+       enum radeon_family family;
+       enum chip_class chip_class;
+       amdgpu_device_handle dev;
+};

+extern  struct amdgpu_ip_blocks_device amdgpu_ips; extern const struct
+chip_info  *g_pChip;
 int
 setup_amdgpu_ip_blocks(uint32_t major, uint32_t minor, struct amdgpu_gpu_info *amdinfo,
                       amdgpu_device_handle device);
--
2.25.1



More information about the igt-dev mailing list