Move struct amdgpu_init_level and helpers from the monolithic amdgpu.h file 
into a new
amdgpu_init_level.h file.

This is part of the ongoing effort to reduce the size of amdgpu.h into their 
own respective
separate headers.

Signed-off-by: Shahyan Soltani <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           | 23 +--------
 .../gpu/drm/amd/amdgpu/amdgpu_init_level.h    | 51 +++++++++++++++++++
 2 files changed, 52 insertions(+), 22 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_init_level.h

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 9473626ea96f..07962b06168d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -115,6 +115,7 @@
 #include "amdgpu_wb.h"
 #include "amdgpu_ip.h"
 #include "amdgpu_mqd.h"
+#include "amdgpu_init_level.h"
 #include "amdgpu_uid.h"
 #include "amdgpu_video_codecs.h"
 #if defined(CONFIG_DRM_AMD_ISP)
@@ -621,25 +622,6 @@ struct amdgpu_pcie_reset_ctx {
        struct pci_saved_state *swds_pcistate;
 };
 
-/*
- * Custom Init levels could be defined for different situations where a full
- * initialization of all hardware blocks are not expected. Sample cases are
- * custom init sequences after resume after S0i3/S3, reset on initialization,
- * partial reset of blocks etc. Presently, this defines only two levels. Levels
- * are described in corresponding struct definitions - amdgpu_init_default,
- * amdgpu_init_minimal_xgmi.
- */
-enum amdgpu_init_lvl_id {
-       AMDGPU_INIT_LEVEL_DEFAULT,
-       AMDGPU_INIT_LEVEL_MINIMAL_XGMI,
-       AMDGPU_INIT_LEVEL_RESET_RECOVERY,
-};
-
-struct amdgpu_init_level {
-       enum amdgpu_init_lvl_id level;
-       uint32_t hwini_ip_block_mask;
-};
-
 #define AMDGPU_RESET_MAGIC_NUM 64
 #define AMDGPU_MAX_DF_PERFMONS 4
 struct amdgpu_reset_domain;
@@ -1436,9 +1418,6 @@ extern const struct attribute_group 
amdgpu_vram_mgr_attr_group;
 extern const struct attribute_group amdgpu_gtt_mgr_attr_group;
 extern const struct attribute_group amdgpu_flash_attr_group;
 
-void amdgpu_set_init_level(struct amdgpu_device *adev,
-                          enum amdgpu_init_lvl_id lvl);
-
 static inline int amdgpu_device_bus_status_check(struct amdgpu_device *adev)
 {
        u32 status;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_init_level.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_init_level.h
new file mode 100644
index 000000000000..60e75cc88bfd
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_init_level.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT
+ *
+ * Copyright 2026 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_INIT_LEVEL_H__
+#define __AMDGPU_INIT_LEVEL_H__
+
+#include <linux/types.h>
+
+struct amdgpu_device;
+
+/*
+ * Custom Init levels could be defined for different situations where a full
+ * initialization of all hardware blocks are not expected. Sample cases are
+ * custom init sequences after resume after S0i3/S3, reset on initialization,
+ * partial reset of blocks etc. Presently, this defines only two levels. Levels
+ * are described in corresponding struct definitions - amdgpu_init_default,
+ * amdgpu_init_minimal_xgmi.
+ */
+enum amdgpu_init_lvl_id {
+       AMDGPU_INIT_LEVEL_DEFAULT,
+       AMDGPU_INIT_LEVEL_MINIMAL_XGMI,
+       AMDGPU_INIT_LEVEL_RESET_RECOVERY,
+};
+
+struct amdgpu_init_level {
+       enum amdgpu_init_lvl_id level;
+       uint32_t hwini_ip_block_mask;
+};
+
+void amdgpu_set_init_level(struct amdgpu_device *adev,
+                          enum amdgpu_init_lvl_id lvl);
+#endif
-- 
2.54.0

Reply via email to