Skip to contentSkip to conversation

drm/amdgpu: refactor code to reuse system information

PATCH New Sunil Khatri 1 participant 1 message Mar 19, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/amdgpu: refactor code to reuse system information

Refactor the code so debugfs and devcoredump can reuse the common information and avoid unnecessary copy of it.

created a new file which would be the right place to hold functions which will be used between ioctl, debugfs and devcoredump.

Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/Makefile          |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_coreinfo.c | 146 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_coreinfo.h |  33 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c      | 117 +--------------
 4 files changed, 182 insertions(+), 116 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_coreinfo.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_coreinfo.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index 4536c8ad0e11..2c5c800c1ed6 100644
@@ -80,7 +80,7 @@ amdgpu-y += amdgpu_device.o amdgpu_doorbell_mgr.o amdgpu_kms.o \
 	amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \
 	amdgpu_fw_attestation.o amdgpu_securedisplay.o \
 	amdgpu_eeprom.o amdgpu_mca.o amdgpu_psp_ta.o amdgpu_lsdma.o \
-	amdgpu_ring_mux.o amdgpu_xcp.o amdgpu_seq64.o amdgpu_aca.o
+	amdgpu_ring_mux.o amdgpu_xcp.o amdgpu_seq64.o amdgpu_aca.o amdgpu_coreinfo.o
 
 amdgpu-$(CONFIG_PROC_FS) += amdgpu_fdinfo.o
 
drivers/gpu/drm/amd/amdgpu/amdgpu_coreinfo.c new file +146 -0

146 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_coreinfo.h new file +33 -0
new file mode 100644
index 000000000000..52d0e86eabbb
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2024 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __AMDGPU_COREINFO_H__
+#define __AMDGPU_COREINFO_H__
+
+#include "amdgpu.h"
+#include <drm/amdgpu_drm.h>
+
+void amdgpu_coreinfo_devinfo(struct amdgpu_device *adev, struct drm_amdgpu_info_device *dev_info);
+
+#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -115

134 lines not on this page · raw message

Signature · 1 line
2.34.1