Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: <vitaly.prosyak@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Christian Koenig <christian.koenig@amd.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH 1/2] lib/amdgpu: allow usage convenient chip info
Date: Sat, 22 Jun 2024 18:52:15 -0400	[thread overview]
Message-ID: <20240622225216.108985-1-vitaly.prosyak@amd.com> (raw)

From: Vitaly Prosyak <vitaly.prosyak@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@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@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


             reply	other threads:[~2024-06-22 22:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-22 22:52 vitaly.prosyak [this message]
2024-06-22 22:52 ` [PATCH 2/2] tests/amdgpu/gang_cs: skip test for some chips vitaly.prosyak
2024-06-24  1:57   ` Zhang, Jesse(Jie)
2024-06-24  9:44   ` Christian König
2024-06-23  0:00 ` ✓ CI.xeBAT: success for series starting with [1/2] lib/amdgpu: allow usage convenient chip info Patchwork
2024-06-23  0:09 ` ✓ Fi.CI.BAT: " Patchwork
2024-06-23  0:53 ` ✗ CI.xeFULL: failure " Patchwork
2024-06-23  1:38 ` ✗ Fi.CI.IGT: " Patchwork
2024-06-24  1:57 ` [PATCH 1/2] " Zhang, Jesse(Jie)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240622225216.108985-1-vitaly.prosyak@amd.com \
    --to=vitaly.prosyak@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox