18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
38c2ecf20Sopenharmony_ci * All Rights Reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
68c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
78c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
88c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
98c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
108c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
138c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
148c2ecf20Sopenharmony_ci * Software.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
188c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
198c2ecf20Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
208c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
218c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
228c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#include <drm/amdgpu_drm.h>
268c2ecf20Sopenharmony_ci#include <drm/drm_drv.h>
278c2ecf20Sopenharmony_ci#include <drm/drm_gem.h>
288c2ecf20Sopenharmony_ci#include <drm/drm_vblank.h>
298c2ecf20Sopenharmony_ci#include <drm/drm_managed.h>
308c2ecf20Sopenharmony_ci#include "amdgpu_drv.h"
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#include <drm/drm_pciids.h>
338c2ecf20Sopenharmony_ci#include <linux/console.h>
348c2ecf20Sopenharmony_ci#include <linux/module.h>
358c2ecf20Sopenharmony_ci#include <linux/pm_runtime.h>
368c2ecf20Sopenharmony_ci#include <linux/vga_switcheroo.h>
378c2ecf20Sopenharmony_ci#include <drm/drm_probe_helper.h>
388c2ecf20Sopenharmony_ci#include <linux/mmu_notifier.h>
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#include "amdgpu.h"
418c2ecf20Sopenharmony_ci#include "amdgpu_irq.h"
428c2ecf20Sopenharmony_ci#include "amdgpu_dma_buf.h"
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#include "amdgpu_amdkfd.h"
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#include "amdgpu_ras.h"
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * KMS wrapper.
508c2ecf20Sopenharmony_ci * - 3.0.0 - initial driver
518c2ecf20Sopenharmony_ci * - 3.1.0 - allow reading more status registers (GRBM, SRBM, SDMA, CP)
528c2ecf20Sopenharmony_ci * - 3.2.0 - GFX8: Uses EOP_TC_WB_ACTION_EN, so UMDs don't have to do the same
538c2ecf20Sopenharmony_ci *           at the end of IBs.
548c2ecf20Sopenharmony_ci * - 3.3.0 - Add VM support for UVD on supported hardware.
558c2ecf20Sopenharmony_ci * - 3.4.0 - Add AMDGPU_INFO_NUM_EVICTIONS.
568c2ecf20Sopenharmony_ci * - 3.5.0 - Add support for new UVD_NO_OP register.
578c2ecf20Sopenharmony_ci * - 3.6.0 - kmd involves use CONTEXT_CONTROL in ring buffer.
588c2ecf20Sopenharmony_ci * - 3.7.0 - Add support for VCE clock list packet
598c2ecf20Sopenharmony_ci * - 3.8.0 - Add support raster config init in the kernel
608c2ecf20Sopenharmony_ci * - 3.9.0 - Add support for memory query info about VRAM and GTT.
618c2ecf20Sopenharmony_ci * - 3.10.0 - Add support for new fences ioctl, new gem ioctl flags
628c2ecf20Sopenharmony_ci * - 3.11.0 - Add support for sensor query info (clocks, temp, etc).
638c2ecf20Sopenharmony_ci * - 3.12.0 - Add query for double offchip LDS buffers
648c2ecf20Sopenharmony_ci * - 3.13.0 - Add PRT support
658c2ecf20Sopenharmony_ci * - 3.14.0 - Fix race in amdgpu_ctx_get_fence() and note new functionality
668c2ecf20Sopenharmony_ci * - 3.15.0 - Export more gpu info for gfx9
678c2ecf20Sopenharmony_ci * - 3.16.0 - Add reserved vmid support
688c2ecf20Sopenharmony_ci * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
698c2ecf20Sopenharmony_ci * - 3.18.0 - Export gpu always on cu bitmap
708c2ecf20Sopenharmony_ci * - 3.19.0 - Add support for UVD MJPEG decode
718c2ecf20Sopenharmony_ci * - 3.20.0 - Add support for local BOs
728c2ecf20Sopenharmony_ci * - 3.21.0 - Add DRM_AMDGPU_FENCE_TO_HANDLE ioctl
738c2ecf20Sopenharmony_ci * - 3.22.0 - Add DRM_AMDGPU_SCHED ioctl
748c2ecf20Sopenharmony_ci * - 3.23.0 - Add query for VRAM lost counter
758c2ecf20Sopenharmony_ci * - 3.24.0 - Add high priority compute support for gfx9
768c2ecf20Sopenharmony_ci * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
778c2ecf20Sopenharmony_ci * - 3.26.0 - GFX9: Process AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE.
788c2ecf20Sopenharmony_ci * - 3.27.0 - Add new chunk to to AMDGPU_CS to enable BO_LIST creation.
798c2ecf20Sopenharmony_ci * - 3.28.0 - Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
808c2ecf20Sopenharmony_ci * - 3.29.0 - Add AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID
818c2ecf20Sopenharmony_ci * - 3.30.0 - Add AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE.
828c2ecf20Sopenharmony_ci * - 3.31.0 - Add support for per-flip tiling attribute changes with DC
838c2ecf20Sopenharmony_ci * - 3.32.0 - Add syncobj timeline support to AMDGPU_CS.
848c2ecf20Sopenharmony_ci * - 3.33.0 - Fixes for GDS ENOMEM failures in AMDGPU_CS.
858c2ecf20Sopenharmony_ci * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches
868c2ecf20Sopenharmony_ci * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
878c2ecf20Sopenharmony_ci * - 3.36.0 - Allow reading more status registers on si/cik
888c2ecf20Sopenharmony_ci * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
898c2ecf20Sopenharmony_ci * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
908c2ecf20Sopenharmony_ci * - 3.39.0 - DMABUF implicit sync does a full pipeline sync
918c2ecf20Sopenharmony_ci * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
928c2ecf20Sopenharmony_ci */
938c2ecf20Sopenharmony_ci#define KMS_DRIVER_MAJOR	3
948c2ecf20Sopenharmony_ci#define KMS_DRIVER_MINOR	40
958c2ecf20Sopenharmony_ci#define KMS_DRIVER_PATCHLEVEL	0
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciint amdgpu_vram_limit = 0;
988c2ecf20Sopenharmony_ciint amdgpu_vis_vram_limit = 0;
998c2ecf20Sopenharmony_ciint amdgpu_gart_size = -1; /* auto */
1008c2ecf20Sopenharmony_ciint amdgpu_gtt_size = -1; /* auto */
1018c2ecf20Sopenharmony_ciint amdgpu_moverate = -1; /* auto */
1028c2ecf20Sopenharmony_ciint amdgpu_benchmarking = 0;
1038c2ecf20Sopenharmony_ciint amdgpu_testing = 0;
1048c2ecf20Sopenharmony_ciint amdgpu_audio = -1;
1058c2ecf20Sopenharmony_ciint amdgpu_disp_priority = 0;
1068c2ecf20Sopenharmony_ciint amdgpu_hw_i2c = 0;
1078c2ecf20Sopenharmony_ciint amdgpu_pcie_gen2 = -1;
1088c2ecf20Sopenharmony_ciint amdgpu_msi = -1;
1098c2ecf20Sopenharmony_cichar amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENGTH];
1108c2ecf20Sopenharmony_ciint amdgpu_dpm = -1;
1118c2ecf20Sopenharmony_ciint amdgpu_fw_load_type = -1;
1128c2ecf20Sopenharmony_ciint amdgpu_aspm = -1;
1138c2ecf20Sopenharmony_ciint amdgpu_runtime_pm = -1;
1148c2ecf20Sopenharmony_ciuint amdgpu_ip_block_mask = 0xffffffff;
1158c2ecf20Sopenharmony_ciint amdgpu_bapm = -1;
1168c2ecf20Sopenharmony_ciint amdgpu_deep_color = 0;
1178c2ecf20Sopenharmony_ciint amdgpu_vm_size = -1;
1188c2ecf20Sopenharmony_ciint amdgpu_vm_fragment_size = -1;
1198c2ecf20Sopenharmony_ciint amdgpu_vm_block_size = -1;
1208c2ecf20Sopenharmony_ciint amdgpu_vm_fault_stop = 0;
1218c2ecf20Sopenharmony_ciint amdgpu_vm_debug = 0;
1228c2ecf20Sopenharmony_ciint amdgpu_vm_update_mode = -1;
1238c2ecf20Sopenharmony_ciint amdgpu_exp_hw_support = 0;
1248c2ecf20Sopenharmony_ciint amdgpu_dc = -1;
1258c2ecf20Sopenharmony_ciint amdgpu_sched_jobs = 32;
1268c2ecf20Sopenharmony_ciint amdgpu_sched_hw_submission = 2;
1278c2ecf20Sopenharmony_ciuint amdgpu_pcie_gen_cap = 0;
1288c2ecf20Sopenharmony_ciuint amdgpu_pcie_lane_cap = 0;
1298c2ecf20Sopenharmony_ciuint amdgpu_cg_mask = 0xffffffff;
1308c2ecf20Sopenharmony_ciuint amdgpu_pg_mask = 0xffffffff;
1318c2ecf20Sopenharmony_ciuint amdgpu_sdma_phase_quantum = 32;
1328c2ecf20Sopenharmony_cichar *amdgpu_disable_cu = NULL;
1338c2ecf20Sopenharmony_cichar *amdgpu_virtual_display = NULL;
1348c2ecf20Sopenharmony_ci/* OverDrive(bit 14) disabled by default*/
1358c2ecf20Sopenharmony_ciuint amdgpu_pp_feature_mask = 0xffffbfff;
1368c2ecf20Sopenharmony_ciuint amdgpu_force_long_training = 0;
1378c2ecf20Sopenharmony_ciint amdgpu_job_hang_limit = 0;
1388c2ecf20Sopenharmony_ciint amdgpu_lbpw = -1;
1398c2ecf20Sopenharmony_ciint amdgpu_compute_multipipe = -1;
1408c2ecf20Sopenharmony_ciint amdgpu_gpu_recovery = -1; /* auto */
1418c2ecf20Sopenharmony_ciint amdgpu_emu_mode = 0;
1428c2ecf20Sopenharmony_ciuint amdgpu_smu_memory_pool_size = 0;
1438c2ecf20Sopenharmony_ci/* FBC (bit 0) disabled by default*/
1448c2ecf20Sopenharmony_ciuint amdgpu_dc_feature_mask = 0;
1458c2ecf20Sopenharmony_ciuint amdgpu_dc_debug_mask = 0;
1468c2ecf20Sopenharmony_ciint amdgpu_async_gfx_ring = 1;
1478c2ecf20Sopenharmony_ciint amdgpu_mcbp = 0;
1488c2ecf20Sopenharmony_ciint amdgpu_discovery = -1;
1498c2ecf20Sopenharmony_ciint amdgpu_mes = 0;
1508c2ecf20Sopenharmony_ciint amdgpu_noretry = -1;
1518c2ecf20Sopenharmony_ciint amdgpu_force_asic_type = -1;
1528c2ecf20Sopenharmony_ciint amdgpu_tmz = 0;
1538c2ecf20Sopenharmony_ciint amdgpu_reset_method = -1; /* auto */
1548c2ecf20Sopenharmony_ciint amdgpu_num_kcq = -1;
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_cistruct amdgpu_mgpu_info mgpu_info = {
1578c2ecf20Sopenharmony_ci	.mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),
1588c2ecf20Sopenharmony_ci};
1598c2ecf20Sopenharmony_ciint amdgpu_ras_enable = -1;
1608c2ecf20Sopenharmony_ciuint amdgpu_ras_mask = 0xffffffff;
1618c2ecf20Sopenharmony_ciint amdgpu_bad_page_threshold = -1;
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/**
1648c2ecf20Sopenharmony_ci * DOC: vramlimit (int)
1658c2ecf20Sopenharmony_ci * Restrict the total amount of VRAM in MiB for testing.  The default is 0 (Use full VRAM).
1668c2ecf20Sopenharmony_ci */
1678c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
1688c2ecf20Sopenharmony_cimodule_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci/**
1718c2ecf20Sopenharmony_ci * DOC: vis_vramlimit (int)
1728c2ecf20Sopenharmony_ci * Restrict the amount of CPU visible VRAM in MiB for testing.  The default is 0 (Use full CPU visible VRAM).
1738c2ecf20Sopenharmony_ci */
1748c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vis_vramlimit, "Restrict visible VRAM for testing, in megabytes");
1758c2ecf20Sopenharmony_cimodule_param_named(vis_vramlimit, amdgpu_vis_vram_limit, int, 0444);
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/**
1788c2ecf20Sopenharmony_ci * DOC: gartsize (uint)
1798c2ecf20Sopenharmony_ci * Restrict the size of GART in Mib (32, 64, etc.) for testing. The default is -1 (The size depends on asic).
1808c2ecf20Sopenharmony_ci */
1818c2ecf20Sopenharmony_ciMODULE_PARM_DESC(gartsize, "Size of GART to setup in megabytes (32, 64, etc., -1=auto)");
1828c2ecf20Sopenharmony_cimodule_param_named(gartsize, amdgpu_gart_size, uint, 0600);
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci/**
1858c2ecf20Sopenharmony_ci * DOC: gttsize (int)
1868c2ecf20Sopenharmony_ci * Restrict the size of GTT domain in MiB for testing. The default is -1 (It's VRAM size if 3GB < VRAM < 3/4 RAM,
1878c2ecf20Sopenharmony_ci * otherwise 3/4 RAM size).
1888c2ecf20Sopenharmony_ci */
1898c2ecf20Sopenharmony_ciMODULE_PARM_DESC(gttsize, "Size of the GTT domain in megabytes (-1 = auto)");
1908c2ecf20Sopenharmony_cimodule_param_named(gttsize, amdgpu_gtt_size, int, 0600);
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/**
1938c2ecf20Sopenharmony_ci * DOC: moverate (int)
1948c2ecf20Sopenharmony_ci * Set maximum buffer migration rate in MB/s. The default is -1 (8 MB/s).
1958c2ecf20Sopenharmony_ci */
1968c2ecf20Sopenharmony_ciMODULE_PARM_DESC(moverate, "Maximum buffer migration rate in MB/s. (32, 64, etc., -1=auto, 0=1=disabled)");
1978c2ecf20Sopenharmony_cimodule_param_named(moverate, amdgpu_moverate, int, 0600);
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/**
2008c2ecf20Sopenharmony_ci * DOC: benchmark (int)
2018c2ecf20Sopenharmony_ci * Run benchmarks. The default is 0 (Skip benchmarks).
2028c2ecf20Sopenharmony_ci */
2038c2ecf20Sopenharmony_ciMODULE_PARM_DESC(benchmark, "Run benchmark");
2048c2ecf20Sopenharmony_cimodule_param_named(benchmark, amdgpu_benchmarking, int, 0444);
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci/**
2078c2ecf20Sopenharmony_ci * DOC: test (int)
2088c2ecf20Sopenharmony_ci * Test BO GTT->VRAM and VRAM->GTT GPU copies. The default is 0 (Skip test, only set 1 to run test).
2098c2ecf20Sopenharmony_ci */
2108c2ecf20Sopenharmony_ciMODULE_PARM_DESC(test, "Run tests");
2118c2ecf20Sopenharmony_cimodule_param_named(test, amdgpu_testing, int, 0444);
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci/**
2148c2ecf20Sopenharmony_ci * DOC: audio (int)
2158c2ecf20Sopenharmony_ci * Set HDMI/DPAudio. Only affects non-DC display handling. The default is -1 (Enabled), set 0 to disabled it.
2168c2ecf20Sopenharmony_ci */
2178c2ecf20Sopenharmony_ciMODULE_PARM_DESC(audio, "Audio enable (-1 = auto, 0 = disable, 1 = enable)");
2188c2ecf20Sopenharmony_cimodule_param_named(audio, amdgpu_audio, int, 0444);
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/**
2218c2ecf20Sopenharmony_ci * DOC: disp_priority (int)
2228c2ecf20Sopenharmony_ci * Set display Priority (1 = normal, 2 = high). Only affects non-DC display handling. The default is 0 (auto).
2238c2ecf20Sopenharmony_ci */
2248c2ecf20Sopenharmony_ciMODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)");
2258c2ecf20Sopenharmony_cimodule_param_named(disp_priority, amdgpu_disp_priority, int, 0444);
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/**
2288c2ecf20Sopenharmony_ci * DOC: hw_i2c (int)
2298c2ecf20Sopenharmony_ci * To enable hw i2c engine. Only affects non-DC display handling. The default is 0 (Disabled).
2308c2ecf20Sopenharmony_ci */
2318c2ecf20Sopenharmony_ciMODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
2328c2ecf20Sopenharmony_cimodule_param_named(hw_i2c, amdgpu_hw_i2c, int, 0444);
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/**
2358c2ecf20Sopenharmony_ci * DOC: pcie_gen2 (int)
2368c2ecf20Sopenharmony_ci * To disable PCIE Gen2/3 mode (0 = disable, 1 = enable). The default is -1 (auto, enabled).
2378c2ecf20Sopenharmony_ci */
2388c2ecf20Sopenharmony_ciMODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable)");
2398c2ecf20Sopenharmony_cimodule_param_named(pcie_gen2, amdgpu_pcie_gen2, int, 0444);
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci/**
2428c2ecf20Sopenharmony_ci * DOC: msi (int)
2438c2ecf20Sopenharmony_ci * To disable Message Signaled Interrupts (MSI) functionality (1 = enable, 0 = disable). The default is -1 (auto, enabled).
2448c2ecf20Sopenharmony_ci */
2458c2ecf20Sopenharmony_ciMODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
2468c2ecf20Sopenharmony_cimodule_param_named(msi, amdgpu_msi, int, 0444);
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/**
2498c2ecf20Sopenharmony_ci * DOC: lockup_timeout (string)
2508c2ecf20Sopenharmony_ci * Set GPU scheduler timeout value in ms.
2518c2ecf20Sopenharmony_ci *
2528c2ecf20Sopenharmony_ci * The format can be [Non-Compute] or [GFX,Compute,SDMA,Video]. That is there can be one or
2538c2ecf20Sopenharmony_ci * multiple values specified. 0 and negative values are invalidated. They will be adjusted
2548c2ecf20Sopenharmony_ci * to the default timeout.
2558c2ecf20Sopenharmony_ci *
2568c2ecf20Sopenharmony_ci * - With one value specified, the setting will apply to all non-compute jobs.
2578c2ecf20Sopenharmony_ci * - With multiple values specified, the first one will be for GFX.
2588c2ecf20Sopenharmony_ci *   The second one is for Compute. The third and fourth ones are
2598c2ecf20Sopenharmony_ci *   for SDMA and Video.
2608c2ecf20Sopenharmony_ci *
2618c2ecf20Sopenharmony_ci * By default(with no lockup_timeout settings), the timeout for all non-compute(GFX, SDMA and Video)
2628c2ecf20Sopenharmony_ci * jobs is 10000. And there is no timeout enforced on compute jobs.
2638c2ecf20Sopenharmony_ci */
2648c2ecf20Sopenharmony_ciMODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and infinity timeout for compute jobs; "
2658c2ecf20Sopenharmony_ci		"for passthrough or sriov, 10000 for all jobs."
2668c2ecf20Sopenharmony_ci		" 0: keep default value. negative: infinity timeout), "
2678c2ecf20Sopenharmony_ci		"format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
2688c2ecf20Sopenharmony_ci		"for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
2698c2ecf20Sopenharmony_cimodule_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci/**
2728c2ecf20Sopenharmony_ci * DOC: dpm (int)
2738c2ecf20Sopenharmony_ci * Override for dynamic power management setting
2748c2ecf20Sopenharmony_ci * (0 = disable, 1 = enable, 2 = enable sw smu driver for vega20)
2758c2ecf20Sopenharmony_ci * The default is -1 (auto).
2768c2ecf20Sopenharmony_ci */
2778c2ecf20Sopenharmony_ciMODULE_PARM_DESC(dpm, "DPM support (1 = enable, 0 = disable, -1 = auto)");
2788c2ecf20Sopenharmony_cimodule_param_named(dpm, amdgpu_dpm, int, 0444);
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/**
2818c2ecf20Sopenharmony_ci * DOC: fw_load_type (int)
2828c2ecf20Sopenharmony_ci * Set different firmware loading type for debugging (0 = direct, 1 = SMU, 2 = PSP). The default is -1 (auto).
2838c2ecf20Sopenharmony_ci */
2848c2ecf20Sopenharmony_ciMODULE_PARM_DESC(fw_load_type, "firmware loading type (0 = direct, 1 = SMU, 2 = PSP, -1 = auto)");
2858c2ecf20Sopenharmony_cimodule_param_named(fw_load_type, amdgpu_fw_load_type, int, 0444);
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/**
2888c2ecf20Sopenharmony_ci * DOC: aspm (int)
2898c2ecf20Sopenharmony_ci * To disable ASPM (1 = enable, 0 = disable). The default is -1 (auto, enabled).
2908c2ecf20Sopenharmony_ci */
2918c2ecf20Sopenharmony_ciMODULE_PARM_DESC(aspm, "ASPM support (1 = enable, 0 = disable, -1 = auto)");
2928c2ecf20Sopenharmony_cimodule_param_named(aspm, amdgpu_aspm, int, 0444);
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/**
2958c2ecf20Sopenharmony_ci * DOC: runpm (int)
2968c2ecf20Sopenharmony_ci * Override for runtime power management control for dGPUs in PX/HG laptops. The amdgpu driver can dynamically power down
2978c2ecf20Sopenharmony_ci * the dGPU on PX/HG laptops when it is idle. The default is -1 (auto enable). Setting the value to 0 disables this functionality.
2988c2ecf20Sopenharmony_ci */
2998c2ecf20Sopenharmony_ciMODULE_PARM_DESC(runpm, "PX runtime pm (1 = force enable, 0 = disable, -1 = PX only default)");
3008c2ecf20Sopenharmony_cimodule_param_named(runpm, amdgpu_runtime_pm, int, 0444);
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/**
3038c2ecf20Sopenharmony_ci * DOC: ip_block_mask (uint)
3048c2ecf20Sopenharmony_ci * Override what IP blocks are enabled on the GPU. Each GPU is a collection of IP blocks (gfx, display, video, etc.).
3058c2ecf20Sopenharmony_ci * Use this parameter to disable specific blocks. Note that the IP blocks do not have a fixed index. Some asics may not have
3068c2ecf20Sopenharmony_ci * some IPs or may include multiple instances of an IP so the ordering various from asic to asic. See the driver output in
3078c2ecf20Sopenharmony_ci * the kernel log for the list of IPs on the asic. The default is 0xffffffff (enable all blocks on a device).
3088c2ecf20Sopenharmony_ci */
3098c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ip_block_mask, "IP Block Mask (all blocks enabled (default))");
3108c2ecf20Sopenharmony_cimodule_param_named(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/**
3138c2ecf20Sopenharmony_ci * DOC: bapm (int)
3148c2ecf20Sopenharmony_ci * Bidirectional Application Power Management (BAPM) used to dynamically share TDP between CPU and GPU. Set value 0 to disable it.
3158c2ecf20Sopenharmony_ci * The default -1 (auto, enabled)
3168c2ecf20Sopenharmony_ci */
3178c2ecf20Sopenharmony_ciMODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)");
3188c2ecf20Sopenharmony_cimodule_param_named(bapm, amdgpu_bapm, int, 0444);
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci/**
3218c2ecf20Sopenharmony_ci * DOC: deep_color (int)
3228c2ecf20Sopenharmony_ci * Set 1 to enable Deep Color support. Only affects non-DC display handling. The default is 0 (disabled).
3238c2ecf20Sopenharmony_ci */
3248c2ecf20Sopenharmony_ciMODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))");
3258c2ecf20Sopenharmony_cimodule_param_named(deep_color, amdgpu_deep_color, int, 0444);
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci/**
3288c2ecf20Sopenharmony_ci * DOC: vm_size (int)
3298c2ecf20Sopenharmony_ci * Override the size of the GPU's per client virtual address space in GiB.  The default is -1 (automatic for each asic).
3308c2ecf20Sopenharmony_ci */
3318c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vm_size, "VM address space size in gigabytes (default 64GB)");
3328c2ecf20Sopenharmony_cimodule_param_named(vm_size, amdgpu_vm_size, int, 0444);
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/**
3358c2ecf20Sopenharmony_ci * DOC: vm_fragment_size (int)
3368c2ecf20Sopenharmony_ci * Override VM fragment size in bits (4, 5, etc. 4 = 64K, 9 = 2M). The default is -1 (automatic for each asic).
3378c2ecf20Sopenharmony_ci */
3388c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vm_fragment_size, "VM fragment size in bits (4, 5, etc. 4 = 64K (default), Max 9 = 2M)");
3398c2ecf20Sopenharmony_cimodule_param_named(vm_fragment_size, amdgpu_vm_fragment_size, int, 0444);
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci/**
3428c2ecf20Sopenharmony_ci * DOC: vm_block_size (int)
3438c2ecf20Sopenharmony_ci * Override VM page table size in bits (default depending on vm_size and hw setup). The default is -1 (automatic for each asic).
3448c2ecf20Sopenharmony_ci */
3458c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default depending on vm_size)");
3468c2ecf20Sopenharmony_cimodule_param_named(vm_block_size, amdgpu_vm_block_size, int, 0444);
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/**
3498c2ecf20Sopenharmony_ci * DOC: vm_fault_stop (int)
3508c2ecf20Sopenharmony_ci * Stop on VM fault for debugging (0 = never, 1 = print first, 2 = always). The default is 0 (No stop).
3518c2ecf20Sopenharmony_ci */
3528c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vm_fault_stop, "Stop on VM fault (0 = never (default), 1 = print first, 2 = always)");
3538c2ecf20Sopenharmony_cimodule_param_named(vm_fault_stop, amdgpu_vm_fault_stop, int, 0444);
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci/**
3568c2ecf20Sopenharmony_ci * DOC: vm_debug (int)
3578c2ecf20Sopenharmony_ci * Debug VM handling (0 = disabled, 1 = enabled). The default is 0 (Disabled).
3588c2ecf20Sopenharmony_ci */
3598c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vm_debug, "Debug VM handling (0 = disabled (default), 1 = enabled)");
3608c2ecf20Sopenharmony_cimodule_param_named(vm_debug, amdgpu_vm_debug, int, 0644);
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci/**
3638c2ecf20Sopenharmony_ci * DOC: vm_update_mode (int)
3648c2ecf20Sopenharmony_ci * Override VM update mode. VM updated by using CPU (0 = never, 1 = Graphics only, 2 = Compute only, 3 = Both). The default
3658c2ecf20Sopenharmony_ci * is -1 (Only in large BAR(LB) systems Compute VM tables will be updated by CPU, otherwise 0, never).
3668c2ecf20Sopenharmony_ci */
3678c2ecf20Sopenharmony_ciMODULE_PARM_DESC(vm_update_mode, "VM update using CPU (0 = never (default except for large BAR(LB)), 1 = Graphics only, 2 = Compute only (default for LB), 3 = Both");
3688c2ecf20Sopenharmony_cimodule_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444);
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci/**
3718c2ecf20Sopenharmony_ci * DOC: exp_hw_support (int)
3728c2ecf20Sopenharmony_ci * Enable experimental hw support (1 = enable). The default is 0 (disabled).
3738c2ecf20Sopenharmony_ci */
3748c2ecf20Sopenharmony_ciMODULE_PARM_DESC(exp_hw_support, "experimental hw support (1 = enable, 0 = disable (default))");
3758c2ecf20Sopenharmony_cimodule_param_named(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci/**
3788c2ecf20Sopenharmony_ci * DOC: dc (int)
3798c2ecf20Sopenharmony_ci * Disable/Enable Display Core driver for debugging (1 = enable, 0 = disable). The default is -1 (automatic for each asic).
3808c2ecf20Sopenharmony_ci */
3818c2ecf20Sopenharmony_ciMODULE_PARM_DESC(dc, "Display Core driver (1 = enable, 0 = disable, -1 = auto (default))");
3828c2ecf20Sopenharmony_cimodule_param_named(dc, amdgpu_dc, int, 0444);
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci/**
3858c2ecf20Sopenharmony_ci * DOC: sched_jobs (int)
3868c2ecf20Sopenharmony_ci * Override the max number of jobs supported in the sw queue. The default is 32.
3878c2ecf20Sopenharmony_ci */
3888c2ecf20Sopenharmony_ciMODULE_PARM_DESC(sched_jobs, "the max number of jobs supported in the sw queue (default 32)");
3898c2ecf20Sopenharmony_cimodule_param_named(sched_jobs, amdgpu_sched_jobs, int, 0444);
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci/**
3928c2ecf20Sopenharmony_ci * DOC: sched_hw_submission (int)
3938c2ecf20Sopenharmony_ci * Override the max number of HW submissions. The default is 2.
3948c2ecf20Sopenharmony_ci */
3958c2ecf20Sopenharmony_ciMODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default 2)");
3968c2ecf20Sopenharmony_cimodule_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444);
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/**
3998c2ecf20Sopenharmony_ci * DOC: ppfeaturemask (hexint)
4008c2ecf20Sopenharmony_ci * Override power features enabled. See enum PP_FEATURE_MASK in drivers/gpu/drm/amd/include/amd_shared.h.
4018c2ecf20Sopenharmony_ci * The default is the current set of stable power features.
4028c2ecf20Sopenharmony_ci */
4038c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ppfeaturemask, "all power features enabled (default))");
4048c2ecf20Sopenharmony_cimodule_param_named(ppfeaturemask, amdgpu_pp_feature_mask, hexint, 0444);
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/**
4078c2ecf20Sopenharmony_ci * DOC: forcelongtraining (uint)
4088c2ecf20Sopenharmony_ci * Force long memory training in resume.
4098c2ecf20Sopenharmony_ci * The default is zero, indicates short training in resume.
4108c2ecf20Sopenharmony_ci */
4118c2ecf20Sopenharmony_ciMODULE_PARM_DESC(forcelongtraining, "force memory long training");
4128c2ecf20Sopenharmony_cimodule_param_named(forcelongtraining, amdgpu_force_long_training, uint, 0444);
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci/**
4158c2ecf20Sopenharmony_ci * DOC: pcie_gen_cap (uint)
4168c2ecf20Sopenharmony_ci * Override PCIE gen speed capabilities. See the CAIL flags in drivers/gpu/drm/amd/include/amd_pcie.h.
4178c2ecf20Sopenharmony_ci * The default is 0 (automatic for each asic).
4188c2ecf20Sopenharmony_ci */
4198c2ecf20Sopenharmony_ciMODULE_PARM_DESC(pcie_gen_cap, "PCIE Gen Caps (0: autodetect (default))");
4208c2ecf20Sopenharmony_cimodule_param_named(pcie_gen_cap, amdgpu_pcie_gen_cap, uint, 0444);
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci/**
4238c2ecf20Sopenharmony_ci * DOC: pcie_lane_cap (uint)
4248c2ecf20Sopenharmony_ci * Override PCIE lanes capabilities. See the CAIL flags in drivers/gpu/drm/amd/include/amd_pcie.h.
4258c2ecf20Sopenharmony_ci * The default is 0 (automatic for each asic).
4268c2ecf20Sopenharmony_ci */
4278c2ecf20Sopenharmony_ciMODULE_PARM_DESC(pcie_lane_cap, "PCIE Lane Caps (0: autodetect (default))");
4288c2ecf20Sopenharmony_cimodule_param_named(pcie_lane_cap, amdgpu_pcie_lane_cap, uint, 0444);
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/**
4318c2ecf20Sopenharmony_ci * DOC: cg_mask (uint)
4328c2ecf20Sopenharmony_ci * Override Clockgating features enabled on GPU (0 = disable clock gating). See the AMD_CG_SUPPORT flags in
4338c2ecf20Sopenharmony_ci * drivers/gpu/drm/amd/include/amd_shared.h. The default is 0xffffffff (all enabled).
4348c2ecf20Sopenharmony_ci */
4358c2ecf20Sopenharmony_ciMODULE_PARM_DESC(cg_mask, "Clockgating flags mask (0 = disable clock gating)");
4368c2ecf20Sopenharmony_cimodule_param_named(cg_mask, amdgpu_cg_mask, uint, 0444);
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci/**
4398c2ecf20Sopenharmony_ci * DOC: pg_mask (uint)
4408c2ecf20Sopenharmony_ci * Override Powergating features enabled on GPU (0 = disable power gating). See the AMD_PG_SUPPORT flags in
4418c2ecf20Sopenharmony_ci * drivers/gpu/drm/amd/include/amd_shared.h. The default is 0xffffffff (all enabled).
4428c2ecf20Sopenharmony_ci */
4438c2ecf20Sopenharmony_ciMODULE_PARM_DESC(pg_mask, "Powergating flags mask (0 = disable power gating)");
4448c2ecf20Sopenharmony_cimodule_param_named(pg_mask, amdgpu_pg_mask, uint, 0444);
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci/**
4478c2ecf20Sopenharmony_ci * DOC: sdma_phase_quantum (uint)
4488c2ecf20Sopenharmony_ci * Override SDMA context switch phase quantum (x 1K GPU clock cycles, 0 = no change). The default is 32.
4498c2ecf20Sopenharmony_ci */
4508c2ecf20Sopenharmony_ciMODULE_PARM_DESC(sdma_phase_quantum, "SDMA context switch phase quantum (x 1K GPU clock cycles, 0 = no change (default 32))");
4518c2ecf20Sopenharmony_cimodule_param_named(sdma_phase_quantum, amdgpu_sdma_phase_quantum, uint, 0444);
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci/**
4548c2ecf20Sopenharmony_ci * DOC: disable_cu (charp)
4558c2ecf20Sopenharmony_ci * Set to disable CUs (It's set like se.sh.cu,...). The default is NULL.
4568c2ecf20Sopenharmony_ci */
4578c2ecf20Sopenharmony_ciMODULE_PARM_DESC(disable_cu, "Disable CUs (se.sh.cu,...)");
4588c2ecf20Sopenharmony_cimodule_param_named(disable_cu, amdgpu_disable_cu, charp, 0444);
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/**
4618c2ecf20Sopenharmony_ci * DOC: virtual_display (charp)
4628c2ecf20Sopenharmony_ci * Set to enable virtual display feature. This feature provides a virtual display hardware on headless boards
4638c2ecf20Sopenharmony_ci * or in virtualized environments. It will be set like xxxx:xx:xx.x,x;xxxx:xx:xx.x,x. It's the pci address of
4648c2ecf20Sopenharmony_ci * the device, plus the number of crtcs to expose. E.g., 0000:26:00.0,4 would enable 4 virtual crtcs on the pci
4658c2ecf20Sopenharmony_ci * device at 26:00.0. The default is NULL.
4668c2ecf20Sopenharmony_ci */
4678c2ecf20Sopenharmony_ciMODULE_PARM_DESC(virtual_display,
4688c2ecf20Sopenharmony_ci		 "Enable virtual display feature (the virtual_display will be set like xxxx:xx:xx.x,x;xxxx:xx:xx.x,x)");
4698c2ecf20Sopenharmony_cimodule_param_named(virtual_display, amdgpu_virtual_display, charp, 0444);
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci/**
4728c2ecf20Sopenharmony_ci * DOC: job_hang_limit (int)
4738c2ecf20Sopenharmony_ci * Set how much time allow a job hang and not drop it. The default is 0.
4748c2ecf20Sopenharmony_ci */
4758c2ecf20Sopenharmony_ciMODULE_PARM_DESC(job_hang_limit, "how much time allow a job hang and not drop it (default 0)");
4768c2ecf20Sopenharmony_cimodule_param_named(job_hang_limit, amdgpu_job_hang_limit, int ,0444);
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci/**
4798c2ecf20Sopenharmony_ci * DOC: lbpw (int)
4808c2ecf20Sopenharmony_ci * Override Load Balancing Per Watt (LBPW) support (1 = enable, 0 = disable). The default is -1 (auto, enabled).
4818c2ecf20Sopenharmony_ci */
4828c2ecf20Sopenharmony_ciMODULE_PARM_DESC(lbpw, "Load Balancing Per Watt (LBPW) support (1 = enable, 0 = disable, -1 = auto)");
4838c2ecf20Sopenharmony_cimodule_param_named(lbpw, amdgpu_lbpw, int, 0444);
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ciMODULE_PARM_DESC(compute_multipipe, "Force compute queues to be spread across pipes (1 = enable, 0 = disable, -1 = auto)");
4868c2ecf20Sopenharmony_cimodule_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ci/**
4898c2ecf20Sopenharmony_ci * DOC: gpu_recovery (int)
4908c2ecf20Sopenharmony_ci * Set to enable GPU recovery mechanism (1 = enable, 0 = disable). The default is -1 (auto, disabled except SRIOV).
4918c2ecf20Sopenharmony_ci */
4928c2ecf20Sopenharmony_ciMODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto)");
4938c2ecf20Sopenharmony_cimodule_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci/**
4968c2ecf20Sopenharmony_ci * DOC: emu_mode (int)
4978c2ecf20Sopenharmony_ci * Set value 1 to enable emulation mode. This is only needed when running on an emulator. The default is 0 (disabled).
4988c2ecf20Sopenharmony_ci */
4998c2ecf20Sopenharmony_ciMODULE_PARM_DESC(emu_mode, "Emulation mode, (1 = enable, 0 = disable)");
5008c2ecf20Sopenharmony_cimodule_param_named(emu_mode, amdgpu_emu_mode, int, 0444);
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci/**
5038c2ecf20Sopenharmony_ci * DOC: ras_enable (int)
5048c2ecf20Sopenharmony_ci * Enable RAS features on the GPU (0 = disable, 1 = enable, -1 = auto (default))
5058c2ecf20Sopenharmony_ci */
5068c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ras_enable, "Enable RAS features on the GPU (0 = disable, 1 = enable, -1 = auto (default))");
5078c2ecf20Sopenharmony_cimodule_param_named(ras_enable, amdgpu_ras_enable, int, 0444);
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci/**
5108c2ecf20Sopenharmony_ci * DOC: ras_mask (uint)
5118c2ecf20Sopenharmony_ci * Mask of RAS features to enable (default 0xffffffff), only valid when ras_enable == 1
5128c2ecf20Sopenharmony_ci * See the flags in drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
5138c2ecf20Sopenharmony_ci */
5148c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ras_mask, "Mask of RAS features to enable (default 0xffffffff), only valid when ras_enable == 1");
5158c2ecf20Sopenharmony_cimodule_param_named(ras_mask, amdgpu_ras_mask, uint, 0444);
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/**
5188c2ecf20Sopenharmony_ci * DOC: si_support (int)
5198c2ecf20Sopenharmony_ci * Set SI support driver. This parameter works after set config CONFIG_DRM_AMDGPU_SI. For SI asic, when radeon driver is enabled,
5208c2ecf20Sopenharmony_ci * set value 0 to use radeon driver, while set value 1 to use amdgpu driver. The default is using radeon driver when it available,
5218c2ecf20Sopenharmony_ci * otherwise using amdgpu driver.
5228c2ecf20Sopenharmony_ci */
5238c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMDGPU_SI
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
5268c2ecf20Sopenharmony_ciint amdgpu_si_support = 0;
5278c2ecf20Sopenharmony_ciMODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
5288c2ecf20Sopenharmony_ci#else
5298c2ecf20Sopenharmony_ciint amdgpu_si_support = 1;
5308c2ecf20Sopenharmony_ciMODULE_PARM_DESC(si_support, "SI support (1 = enabled (default), 0 = disabled)");
5318c2ecf20Sopenharmony_ci#endif
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_cimodule_param_named(si_support, amdgpu_si_support, int, 0444);
5348c2ecf20Sopenharmony_ci#endif
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci/**
5378c2ecf20Sopenharmony_ci * DOC: cik_support (int)
5388c2ecf20Sopenharmony_ci * Set CIK support driver. This parameter works after set config CONFIG_DRM_AMDGPU_CIK. For CIK asic, when radeon driver is enabled,
5398c2ecf20Sopenharmony_ci * set value 0 to use radeon driver, while set value 1 to use amdgpu driver. The default is using radeon driver when it available,
5408c2ecf20Sopenharmony_ci * otherwise using amdgpu driver.
5418c2ecf20Sopenharmony_ci */
5428c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMDGPU_CIK
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
5458c2ecf20Sopenharmony_ciint amdgpu_cik_support = 0;
5468c2ecf20Sopenharmony_ciMODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
5478c2ecf20Sopenharmony_ci#else
5488c2ecf20Sopenharmony_ciint amdgpu_cik_support = 1;
5498c2ecf20Sopenharmony_ciMODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
5508c2ecf20Sopenharmony_ci#endif
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_cimodule_param_named(cik_support, amdgpu_cik_support, int, 0444);
5538c2ecf20Sopenharmony_ci#endif
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci/**
5568c2ecf20Sopenharmony_ci * DOC: smu_memory_pool_size (uint)
5578c2ecf20Sopenharmony_ci * It is used to reserve gtt for smu debug usage, setting value 0 to disable it. The actual size is value * 256MiB.
5588c2ecf20Sopenharmony_ci * E.g. 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte. The default is 0 (disabled).
5598c2ecf20Sopenharmony_ci */
5608c2ecf20Sopenharmony_ciMODULE_PARM_DESC(smu_memory_pool_size,
5618c2ecf20Sopenharmony_ci	"reserve gtt for smu debug usage, 0 = disable,"
5628c2ecf20Sopenharmony_ci		"0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
5638c2ecf20Sopenharmony_cimodule_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci/**
5668c2ecf20Sopenharmony_ci * DOC: async_gfx_ring (int)
5678c2ecf20Sopenharmony_ci * It is used to enable gfx rings that could be configured with different prioritites or equal priorities
5688c2ecf20Sopenharmony_ci */
5698c2ecf20Sopenharmony_ciMODULE_PARM_DESC(async_gfx_ring,
5708c2ecf20Sopenharmony_ci	"Asynchronous GFX rings that could be configured with either different priorities (HP3D ring and LP3D ring), or equal priorities (0 = disabled, 1 = enabled (default))");
5718c2ecf20Sopenharmony_cimodule_param_named(async_gfx_ring, amdgpu_async_gfx_ring, int, 0444);
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci/**
5748c2ecf20Sopenharmony_ci * DOC: mcbp (int)
5758c2ecf20Sopenharmony_ci * It is used to enable mid command buffer preemption. (0 = disabled (default), 1 = enabled)
5768c2ecf20Sopenharmony_ci */
5778c2ecf20Sopenharmony_ciMODULE_PARM_DESC(mcbp,
5788c2ecf20Sopenharmony_ci	"Enable Mid-command buffer preemption (0 = disabled (default), 1 = enabled)");
5798c2ecf20Sopenharmony_cimodule_param_named(mcbp, amdgpu_mcbp, int, 0444);
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci/**
5828c2ecf20Sopenharmony_ci * DOC: discovery (int)
5838c2ecf20Sopenharmony_ci * Allow driver to discover hardware IP information from IP Discovery table at the top of VRAM.
5848c2ecf20Sopenharmony_ci * (-1 = auto (default), 0 = disabled, 1 = enabled)
5858c2ecf20Sopenharmony_ci */
5868c2ecf20Sopenharmony_ciMODULE_PARM_DESC(discovery,
5878c2ecf20Sopenharmony_ci	"Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM");
5888c2ecf20Sopenharmony_cimodule_param_named(discovery, amdgpu_discovery, int, 0444);
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci/**
5918c2ecf20Sopenharmony_ci * DOC: mes (int)
5928c2ecf20Sopenharmony_ci * Enable Micro Engine Scheduler. This is a new hw scheduling engine for gfx, sdma, and compute.
5938c2ecf20Sopenharmony_ci * (0 = disabled (default), 1 = enabled)
5948c2ecf20Sopenharmony_ci */
5958c2ecf20Sopenharmony_ciMODULE_PARM_DESC(mes,
5968c2ecf20Sopenharmony_ci	"Enable Micro Engine Scheduler (0 = disabled (default), 1 = enabled)");
5978c2ecf20Sopenharmony_cimodule_param_named(mes, amdgpu_mes, int, 0444);
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci/**
6008c2ecf20Sopenharmony_ci * DOC: noretry (int)
6018c2ecf20Sopenharmony_ci * Disable retry faults in the GPU memory controller.
6028c2ecf20Sopenharmony_ci * (0 = retry enabled, 1 = retry disabled, -1 auto (default))
6038c2ecf20Sopenharmony_ci */
6048c2ecf20Sopenharmony_ciMODULE_PARM_DESC(noretry,
6058c2ecf20Sopenharmony_ci	"Disable retry faults (0 = retry enabled, 1 = retry disabled, -1 auto (default))");
6068c2ecf20Sopenharmony_cimodule_param_named(noretry, amdgpu_noretry, int, 0644);
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci/**
6098c2ecf20Sopenharmony_ci * DOC: force_asic_type (int)
6108c2ecf20Sopenharmony_ci * A non negative value used to specify the asic type for all supported GPUs.
6118c2ecf20Sopenharmony_ci */
6128c2ecf20Sopenharmony_ciMODULE_PARM_DESC(force_asic_type,
6138c2ecf20Sopenharmony_ci	"A non negative value used to specify the asic type for all supported GPUs");
6148c2ecf20Sopenharmony_cimodule_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci
6188c2ecf20Sopenharmony_ci#ifdef CONFIG_HSA_AMD
6198c2ecf20Sopenharmony_ci/**
6208c2ecf20Sopenharmony_ci * DOC: sched_policy (int)
6218c2ecf20Sopenharmony_ci * Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription.
6228c2ecf20Sopenharmony_ci * Setting 1 disables over-subscription. Setting 2 disables HWS and statically
6238c2ecf20Sopenharmony_ci * assigns queues to HQDs.
6248c2ecf20Sopenharmony_ci */
6258c2ecf20Sopenharmony_ciint sched_policy = KFD_SCHED_POLICY_HWS;
6268c2ecf20Sopenharmony_cimodule_param(sched_policy, int, 0444);
6278c2ecf20Sopenharmony_ciMODULE_PARM_DESC(sched_policy,
6288c2ecf20Sopenharmony_ci	"Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)");
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci/**
6318c2ecf20Sopenharmony_ci * DOC: hws_max_conc_proc (int)
6328c2ecf20Sopenharmony_ci * Maximum number of processes that HWS can schedule concurrently. The maximum is the
6338c2ecf20Sopenharmony_ci * number of VMIDs assigned to the HWS, which is also the default.
6348c2ecf20Sopenharmony_ci */
6358c2ecf20Sopenharmony_ciint hws_max_conc_proc = -1;
6368c2ecf20Sopenharmony_cimodule_param(hws_max_conc_proc, int, 0444);
6378c2ecf20Sopenharmony_ciMODULE_PARM_DESC(hws_max_conc_proc,
6388c2ecf20Sopenharmony_ci	"Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))");
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci/**
6418c2ecf20Sopenharmony_ci * DOC: cwsr_enable (int)
6428c2ecf20Sopenharmony_ci * CWSR(compute wave store and resume) allows the GPU to preempt shader execution in
6438c2ecf20Sopenharmony_ci * the middle of a compute wave. Default is 1 to enable this feature. Setting 0
6448c2ecf20Sopenharmony_ci * disables it.
6458c2ecf20Sopenharmony_ci */
6468c2ecf20Sopenharmony_ciint cwsr_enable = 1;
6478c2ecf20Sopenharmony_cimodule_param(cwsr_enable, int, 0444);
6488c2ecf20Sopenharmony_ciMODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))");
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci/**
6518c2ecf20Sopenharmony_ci * DOC: max_num_of_queues_per_device (int)
6528c2ecf20Sopenharmony_ci * Maximum number of queues per device. Valid setting is between 1 and 4096. Default
6538c2ecf20Sopenharmony_ci * is 4096.
6548c2ecf20Sopenharmony_ci */
6558c2ecf20Sopenharmony_ciint max_num_of_queues_per_device = KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT;
6568c2ecf20Sopenharmony_cimodule_param(max_num_of_queues_per_device, int, 0444);
6578c2ecf20Sopenharmony_ciMODULE_PARM_DESC(max_num_of_queues_per_device,
6588c2ecf20Sopenharmony_ci	"Maximum number of supported queues per device (1 = Minimum, 4096 = default)");
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci/**
6618c2ecf20Sopenharmony_ci * DOC: send_sigterm (int)
6628c2ecf20Sopenharmony_ci * Send sigterm to HSA process on unhandled exceptions. Default is not to send sigterm
6638c2ecf20Sopenharmony_ci * but just print errors on dmesg. Setting 1 enables sending sigterm.
6648c2ecf20Sopenharmony_ci */
6658c2ecf20Sopenharmony_ciint send_sigterm;
6668c2ecf20Sopenharmony_cimodule_param(send_sigterm, int, 0444);
6678c2ecf20Sopenharmony_ciMODULE_PARM_DESC(send_sigterm,
6688c2ecf20Sopenharmony_ci	"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)");
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci/**
6718c2ecf20Sopenharmony_ci * DOC: debug_largebar (int)
6728c2ecf20Sopenharmony_ci * Set debug_largebar as 1 to enable simulating large-bar capability on non-large bar
6738c2ecf20Sopenharmony_ci * system. This limits the VRAM size reported to ROCm applications to the visible
6748c2ecf20Sopenharmony_ci * size, usually 256MB.
6758c2ecf20Sopenharmony_ci * Default value is 0, diabled.
6768c2ecf20Sopenharmony_ci */
6778c2ecf20Sopenharmony_ciint debug_largebar;
6788c2ecf20Sopenharmony_cimodule_param(debug_largebar, int, 0444);
6798c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug_largebar,
6808c2ecf20Sopenharmony_ci	"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)");
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_ci/**
6838c2ecf20Sopenharmony_ci * DOC: ignore_crat (int)
6848c2ecf20Sopenharmony_ci * Ignore CRAT table during KFD initialization. By default, KFD uses the ACPI CRAT
6858c2ecf20Sopenharmony_ci * table to get information about AMD APUs. This option can serve as a workaround on
6868c2ecf20Sopenharmony_ci * systems with a broken CRAT table.
6878c2ecf20Sopenharmony_ci *
6888c2ecf20Sopenharmony_ci * Default is auto (according to asic type, iommu_v2, and crat table, to decide
6898c2ecf20Sopenharmony_ci * whehter use CRAT)
6908c2ecf20Sopenharmony_ci */
6918c2ecf20Sopenharmony_ciint ignore_crat;
6928c2ecf20Sopenharmony_cimodule_param(ignore_crat, int, 0444);
6938c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ignore_crat,
6948c2ecf20Sopenharmony_ci	"Ignore CRAT table during KFD initialization (0 = auto (default), 1 = ignore CRAT)");
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci/**
6978c2ecf20Sopenharmony_ci * DOC: halt_if_hws_hang (int)
6988c2ecf20Sopenharmony_ci * Halt if HWS hang is detected. Default value, 0, disables the halt on hang.
6998c2ecf20Sopenharmony_ci * Setting 1 enables halt on hang.
7008c2ecf20Sopenharmony_ci */
7018c2ecf20Sopenharmony_ciint halt_if_hws_hang;
7028c2ecf20Sopenharmony_cimodule_param(halt_if_hws_hang, int, 0644);
7038c2ecf20Sopenharmony_ciMODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)");
7048c2ecf20Sopenharmony_ci
7058c2ecf20Sopenharmony_ci/**
7068c2ecf20Sopenharmony_ci * DOC: hws_gws_support(bool)
7078c2ecf20Sopenharmony_ci * Assume that HWS supports GWS barriers regardless of what firmware version
7088c2ecf20Sopenharmony_ci * check says. Default value: false (rely on MEC2 firmware version check).
7098c2ecf20Sopenharmony_ci */
7108c2ecf20Sopenharmony_cibool hws_gws_support;
7118c2ecf20Sopenharmony_cimodule_param(hws_gws_support, bool, 0444);
7128c2ecf20Sopenharmony_ciMODULE_PARM_DESC(hws_gws_support, "Assume MEC2 FW supports GWS barriers (false = rely on FW version check (Default), true = force supported)");
7138c2ecf20Sopenharmony_ci
7148c2ecf20Sopenharmony_ci/**
7158c2ecf20Sopenharmony_ci  * DOC: queue_preemption_timeout_ms (int)
7168c2ecf20Sopenharmony_ci  * queue preemption timeout in ms (1 = Minimum, 9000 = default)
7178c2ecf20Sopenharmony_ci  */
7188c2ecf20Sopenharmony_ciint queue_preemption_timeout_ms = 9000;
7198c2ecf20Sopenharmony_cimodule_param(queue_preemption_timeout_ms, int, 0644);
7208c2ecf20Sopenharmony_ciMODULE_PARM_DESC(queue_preemption_timeout_ms, "queue preemption timeout in ms (1 = Minimum, 9000 = default)");
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci/**
7238c2ecf20Sopenharmony_ci * DOC: debug_evictions(bool)
7248c2ecf20Sopenharmony_ci * Enable extra debug messages to help determine the cause of evictions
7258c2ecf20Sopenharmony_ci */
7268c2ecf20Sopenharmony_cibool debug_evictions;
7278c2ecf20Sopenharmony_cimodule_param(debug_evictions, bool, 0644);
7288c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug_evictions, "enable eviction debug messages (false = default)");
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci/**
7318c2ecf20Sopenharmony_ci * DOC: no_system_mem_limit(bool)
7328c2ecf20Sopenharmony_ci * Disable system memory limit, to support multiple process shared memory
7338c2ecf20Sopenharmony_ci */
7348c2ecf20Sopenharmony_cibool no_system_mem_limit;
7358c2ecf20Sopenharmony_cimodule_param(no_system_mem_limit, bool, 0644);
7368c2ecf20Sopenharmony_ciMODULE_PARM_DESC(no_system_mem_limit, "disable system memory limit (false = default)");
7378c2ecf20Sopenharmony_ci
7388c2ecf20Sopenharmony_ci#endif
7398c2ecf20Sopenharmony_ci
7408c2ecf20Sopenharmony_ci/**
7418c2ecf20Sopenharmony_ci * DOC: dcfeaturemask (uint)
7428c2ecf20Sopenharmony_ci * Override display features enabled. See enum DC_FEATURE_MASK in drivers/gpu/drm/amd/include/amd_shared.h.
7438c2ecf20Sopenharmony_ci * The default is the current set of stable display features.
7448c2ecf20Sopenharmony_ci */
7458c2ecf20Sopenharmony_ciMODULE_PARM_DESC(dcfeaturemask, "all stable DC features enabled (default))");
7468c2ecf20Sopenharmony_cimodule_param_named(dcfeaturemask, amdgpu_dc_feature_mask, uint, 0444);
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci/**
7498c2ecf20Sopenharmony_ci * DOC: dcdebugmask (uint)
7508c2ecf20Sopenharmony_ci * Override display features enabled. See enum DC_DEBUG_MASK in drivers/gpu/drm/amd/include/amd_shared.h.
7518c2ecf20Sopenharmony_ci */
7528c2ecf20Sopenharmony_ciMODULE_PARM_DESC(dcdebugmask, "all debug options disabled (default))");
7538c2ecf20Sopenharmony_cimodule_param_named(dcdebugmask, amdgpu_dc_debug_mask, uint, 0444);
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci/**
7568c2ecf20Sopenharmony_ci * DOC: abmlevel (uint)
7578c2ecf20Sopenharmony_ci * Override the default ABM (Adaptive Backlight Management) level used for DC
7588c2ecf20Sopenharmony_ci * enabled hardware. Requires DMCU to be supported and loaded.
7598c2ecf20Sopenharmony_ci * Valid levels are 0-4. A value of 0 indicates that ABM should be disabled by
7608c2ecf20Sopenharmony_ci * default. Values 1-4 control the maximum allowable brightness reduction via
7618c2ecf20Sopenharmony_ci * the ABM algorithm, with 1 being the least reduction and 4 being the most
7628c2ecf20Sopenharmony_ci * reduction.
7638c2ecf20Sopenharmony_ci *
7648c2ecf20Sopenharmony_ci * Defaults to 0, or disabled. Userspace can still override this level later
7658c2ecf20Sopenharmony_ci * after boot.
7668c2ecf20Sopenharmony_ci */
7678c2ecf20Sopenharmony_ciuint amdgpu_dm_abm_level = 0;
7688c2ecf20Sopenharmony_ciMODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) ");
7698c2ecf20Sopenharmony_cimodule_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444);
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ciint amdgpu_backlight = -1;
7728c2ecf20Sopenharmony_ciMODULE_PARM_DESC(backlight, "Backlight control (0 = pwm, 1 = aux, -1 auto (default))");
7738c2ecf20Sopenharmony_cimodule_param_named(backlight, amdgpu_backlight, bint, 0444);
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ci/**
7768c2ecf20Sopenharmony_ci * DOC: tmz (int)
7778c2ecf20Sopenharmony_ci * Trusted Memory Zone (TMZ) is a method to protect data being written
7788c2ecf20Sopenharmony_ci * to or read from memory.
7798c2ecf20Sopenharmony_ci *
7808c2ecf20Sopenharmony_ci * The default value: 0 (off).  TODO: change to auto till it is completed.
7818c2ecf20Sopenharmony_ci */
7828c2ecf20Sopenharmony_ciMODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto, 0 = off (default), 1 = on)");
7838c2ecf20Sopenharmony_cimodule_param_named(tmz, amdgpu_tmz, int, 0444);
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci/**
7868c2ecf20Sopenharmony_ci * DOC: reset_method (int)
7878c2ecf20Sopenharmony_ci * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)
7888c2ecf20Sopenharmony_ci */
7898c2ecf20Sopenharmony_ciMODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)");
7908c2ecf20Sopenharmony_cimodule_param_named(reset_method, amdgpu_reset_method, int, 0444);
7918c2ecf20Sopenharmony_ci
7928c2ecf20Sopenharmony_ci/**
7938c2ecf20Sopenharmony_ci * DOC: bad_page_threshold (int)
7948c2ecf20Sopenharmony_ci * Bad page threshold is to specify the threshold value of faulty pages
7958c2ecf20Sopenharmony_ci * detected by RAS ECC, that may result in GPU entering bad status if total
7968c2ecf20Sopenharmony_ci * faulty pages by ECC exceed threshold value and leave it for user's further
7978c2ecf20Sopenharmony_ci * check.
7988c2ecf20Sopenharmony_ci */
7998c2ecf20Sopenharmony_ciMODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement)");
8008c2ecf20Sopenharmony_cimodule_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444);
8018c2ecf20Sopenharmony_ci
8028c2ecf20Sopenharmony_ciMODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup (8 if set to greater than 8 or less than 0, only affect gfx 8+)");
8038c2ecf20Sopenharmony_cimodule_param_named(num_kcq, amdgpu_num_kcq, int, 0444);
8048c2ecf20Sopenharmony_ci
8058c2ecf20Sopenharmony_cistatic const struct pci_device_id pciidlist[] = {
8068c2ecf20Sopenharmony_ci#ifdef  CONFIG_DRM_AMDGPU_SI
8078c2ecf20Sopenharmony_ci	{0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8088c2ecf20Sopenharmony_ci	{0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8098c2ecf20Sopenharmony_ci	{0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8108c2ecf20Sopenharmony_ci	{0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8118c2ecf20Sopenharmony_ci	{0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8128c2ecf20Sopenharmony_ci	{0x1002, 0x6791, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8138c2ecf20Sopenharmony_ci	{0x1002, 0x6792, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8148c2ecf20Sopenharmony_ci	{0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8158c2ecf20Sopenharmony_ci	{0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8168c2ecf20Sopenharmony_ci	{0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8178c2ecf20Sopenharmony_ci	{0x1002, 0x679B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8188c2ecf20Sopenharmony_ci	{0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8198c2ecf20Sopenharmony_ci	{0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
8208c2ecf20Sopenharmony_ci	{0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|AMD_IS_MOBILITY},
8218c2ecf20Sopenharmony_ci	{0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|AMD_IS_MOBILITY},
8228c2ecf20Sopenharmony_ci	{0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|AMD_IS_MOBILITY},
8238c2ecf20Sopenharmony_ci	{0x1002, 0x6806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8248c2ecf20Sopenharmony_ci	{0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8258c2ecf20Sopenharmony_ci	{0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8268c2ecf20Sopenharmony_ci	{0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8278c2ecf20Sopenharmony_ci	{0x1002, 0x6811, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8288c2ecf20Sopenharmony_ci	{0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8298c2ecf20Sopenharmony_ci	{0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8308c2ecf20Sopenharmony_ci	{0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8318c2ecf20Sopenharmony_ci	{0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN},
8328c2ecf20Sopenharmony_ci	{0x1002, 0x6600, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8338c2ecf20Sopenharmony_ci	{0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8348c2ecf20Sopenharmony_ci	{0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8358c2ecf20Sopenharmony_ci	{0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8368c2ecf20Sopenharmony_ci	{0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8378c2ecf20Sopenharmony_ci	{0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8388c2ecf20Sopenharmony_ci	{0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8398c2ecf20Sopenharmony_ci	{0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8408c2ecf20Sopenharmony_ci	{0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND},
8418c2ecf20Sopenharmony_ci	{0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND},
8428c2ecf20Sopenharmony_ci	{0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND},
8438c2ecf20Sopenharmony_ci	{0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND},
8448c2ecf20Sopenharmony_ci	{0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8458c2ecf20Sopenharmony_ci	{0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8468c2ecf20Sopenharmony_ci	{0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8478c2ecf20Sopenharmony_ci	{0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|AMD_IS_MOBILITY},
8488c2ecf20Sopenharmony_ci	{0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND},
8498c2ecf20Sopenharmony_ci	{0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8508c2ecf20Sopenharmony_ci	{0x1002, 0x6821, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8518c2ecf20Sopenharmony_ci	{0x1002, 0x6822, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8528c2ecf20Sopenharmony_ci	{0x1002, 0x6823, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8538c2ecf20Sopenharmony_ci	{0x1002, 0x6824, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8548c2ecf20Sopenharmony_ci	{0x1002, 0x6825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8558c2ecf20Sopenharmony_ci	{0x1002, 0x6826, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8568c2ecf20Sopenharmony_ci	{0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8578c2ecf20Sopenharmony_ci	{0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8588c2ecf20Sopenharmony_ci	{0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8598c2ecf20Sopenharmony_ci	{0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8608c2ecf20Sopenharmony_ci	{0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8618c2ecf20Sopenharmony_ci	{0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8628c2ecf20Sopenharmony_ci	{0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8638c2ecf20Sopenharmony_ci	{0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8648c2ecf20Sopenharmony_ci	{0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8658c2ecf20Sopenharmony_ci	{0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|AMD_IS_MOBILITY},
8668c2ecf20Sopenharmony_ci	{0x1002, 0x6835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8678c2ecf20Sopenharmony_ci	{0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8688c2ecf20Sopenharmony_ci	{0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8698c2ecf20Sopenharmony_ci	{0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8708c2ecf20Sopenharmony_ci	{0x1002, 0x683B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8718c2ecf20Sopenharmony_ci	{0x1002, 0x683D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8728c2ecf20Sopenharmony_ci	{0x1002, 0x683F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE},
8738c2ecf20Sopenharmony_ci	{0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
8748c2ecf20Sopenharmony_ci	{0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
8758c2ecf20Sopenharmony_ci	{0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
8768c2ecf20Sopenharmony_ci	{0x1002, 0x6665, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
8778c2ecf20Sopenharmony_ci	{0x1002, 0x6667, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
8788c2ecf20Sopenharmony_ci	{0x1002, 0x666F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
8798c2ecf20Sopenharmony_ci#endif
8808c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMDGPU_CIK
8818c2ecf20Sopenharmony_ci	/* Kaveri */
8828c2ecf20Sopenharmony_ci	{0x1002, 0x1304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8838c2ecf20Sopenharmony_ci	{0x1002, 0x1305, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8848c2ecf20Sopenharmony_ci	{0x1002, 0x1306, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8858c2ecf20Sopenharmony_ci	{0x1002, 0x1307, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8868c2ecf20Sopenharmony_ci	{0x1002, 0x1309, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8878c2ecf20Sopenharmony_ci	{0x1002, 0x130A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8888c2ecf20Sopenharmony_ci	{0x1002, 0x130B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8898c2ecf20Sopenharmony_ci	{0x1002, 0x130C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8908c2ecf20Sopenharmony_ci	{0x1002, 0x130D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8918c2ecf20Sopenharmony_ci	{0x1002, 0x130E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
8928c2ecf20Sopenharmony_ci	{0x1002, 0x130F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8938c2ecf20Sopenharmony_ci	{0x1002, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8948c2ecf20Sopenharmony_ci	{0x1002, 0x1311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8958c2ecf20Sopenharmony_ci	{0x1002, 0x1312, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8968c2ecf20Sopenharmony_ci	{0x1002, 0x1313, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8978c2ecf20Sopenharmony_ci	{0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8988c2ecf20Sopenharmony_ci	{0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
8998c2ecf20Sopenharmony_ci	{0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
9008c2ecf20Sopenharmony_ci	{0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
9018c2ecf20Sopenharmony_ci	{0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
9028c2ecf20Sopenharmony_ci	{0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
9038c2ecf20Sopenharmony_ci	{0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
9048c2ecf20Sopenharmony_ci	/* Bonaire */
9058c2ecf20Sopenharmony_ci	{0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|AMD_IS_MOBILITY},
9068c2ecf20Sopenharmony_ci	{0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|AMD_IS_MOBILITY},
9078c2ecf20Sopenharmony_ci	{0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|AMD_IS_MOBILITY},
9088c2ecf20Sopenharmony_ci	{0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|AMD_IS_MOBILITY},
9098c2ecf20Sopenharmony_ci	{0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9108c2ecf20Sopenharmony_ci	{0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9118c2ecf20Sopenharmony_ci	{0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9128c2ecf20Sopenharmony_ci	{0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9138c2ecf20Sopenharmony_ci	{0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9148c2ecf20Sopenharmony_ci	{0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9158c2ecf20Sopenharmony_ci	{0x1002, 0x665f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE},
9168c2ecf20Sopenharmony_ci	/* Hawaii */
9178c2ecf20Sopenharmony_ci	{0x1002, 0x67A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9188c2ecf20Sopenharmony_ci	{0x1002, 0x67A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9198c2ecf20Sopenharmony_ci	{0x1002, 0x67A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9208c2ecf20Sopenharmony_ci	{0x1002, 0x67A8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9218c2ecf20Sopenharmony_ci	{0x1002, 0x67A9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9228c2ecf20Sopenharmony_ci	{0x1002, 0x67AA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9238c2ecf20Sopenharmony_ci	{0x1002, 0x67B0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9248c2ecf20Sopenharmony_ci	{0x1002, 0x67B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9258c2ecf20Sopenharmony_ci	{0x1002, 0x67B8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9268c2ecf20Sopenharmony_ci	{0x1002, 0x67B9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9278c2ecf20Sopenharmony_ci	{0x1002, 0x67BA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9288c2ecf20Sopenharmony_ci	{0x1002, 0x67BE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII},
9298c2ecf20Sopenharmony_ci	/* Kabini */
9308c2ecf20Sopenharmony_ci	{0x1002, 0x9830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9318c2ecf20Sopenharmony_ci	{0x1002, 0x9831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9328c2ecf20Sopenharmony_ci	{0x1002, 0x9832, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9338c2ecf20Sopenharmony_ci	{0x1002, 0x9833, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9348c2ecf20Sopenharmony_ci	{0x1002, 0x9834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9358c2ecf20Sopenharmony_ci	{0x1002, 0x9835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9368c2ecf20Sopenharmony_ci	{0x1002, 0x9836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9378c2ecf20Sopenharmony_ci	{0x1002, 0x9837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9388c2ecf20Sopenharmony_ci	{0x1002, 0x9838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9398c2ecf20Sopenharmony_ci	{0x1002, 0x9839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9408c2ecf20Sopenharmony_ci	{0x1002, 0x983a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9418c2ecf20Sopenharmony_ci	{0x1002, 0x983b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_MOBILITY|AMD_IS_APU},
9428c2ecf20Sopenharmony_ci	{0x1002, 0x983c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9438c2ecf20Sopenharmony_ci	{0x1002, 0x983d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9448c2ecf20Sopenharmony_ci	{0x1002, 0x983e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9458c2ecf20Sopenharmony_ci	{0x1002, 0x983f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|AMD_IS_APU},
9468c2ecf20Sopenharmony_ci	/* mullins */
9478c2ecf20Sopenharmony_ci	{0x1002, 0x9850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9488c2ecf20Sopenharmony_ci	{0x1002, 0x9851, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9498c2ecf20Sopenharmony_ci	{0x1002, 0x9852, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9508c2ecf20Sopenharmony_ci	{0x1002, 0x9853, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9518c2ecf20Sopenharmony_ci	{0x1002, 0x9854, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9528c2ecf20Sopenharmony_ci	{0x1002, 0x9855, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9538c2ecf20Sopenharmony_ci	{0x1002, 0x9856, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9548c2ecf20Sopenharmony_ci	{0x1002, 0x9857, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9558c2ecf20Sopenharmony_ci	{0x1002, 0x9858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9568c2ecf20Sopenharmony_ci	{0x1002, 0x9859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9578c2ecf20Sopenharmony_ci	{0x1002, 0x985A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9588c2ecf20Sopenharmony_ci	{0x1002, 0x985B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9598c2ecf20Sopenharmony_ci	{0x1002, 0x985C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9608c2ecf20Sopenharmony_ci	{0x1002, 0x985D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9618c2ecf20Sopenharmony_ci	{0x1002, 0x985E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9628c2ecf20Sopenharmony_ci	{0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
9638c2ecf20Sopenharmony_ci#endif
9648c2ecf20Sopenharmony_ci	/* topaz */
9658c2ecf20Sopenharmony_ci	{0x1002, 0x6900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
9668c2ecf20Sopenharmony_ci	{0x1002, 0x6901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
9678c2ecf20Sopenharmony_ci	{0x1002, 0x6902, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
9688c2ecf20Sopenharmony_ci	{0x1002, 0x6903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
9698c2ecf20Sopenharmony_ci	{0x1002, 0x6907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
9708c2ecf20Sopenharmony_ci	/* tonga */
9718c2ecf20Sopenharmony_ci	{0x1002, 0x6920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9728c2ecf20Sopenharmony_ci	{0x1002, 0x6921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9738c2ecf20Sopenharmony_ci	{0x1002, 0x6928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9748c2ecf20Sopenharmony_ci	{0x1002, 0x6929, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9758c2ecf20Sopenharmony_ci	{0x1002, 0x692B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9768c2ecf20Sopenharmony_ci	{0x1002, 0x692F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9778c2ecf20Sopenharmony_ci	{0x1002, 0x6930, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9788c2ecf20Sopenharmony_ci	{0x1002, 0x6938, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9798c2ecf20Sopenharmony_ci	{0x1002, 0x6939, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
9808c2ecf20Sopenharmony_ci	/* fiji */
9818c2ecf20Sopenharmony_ci	{0x1002, 0x7300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_FIJI},
9828c2ecf20Sopenharmony_ci	{0x1002, 0x730F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_FIJI},
9838c2ecf20Sopenharmony_ci	/* carrizo */
9848c2ecf20Sopenharmony_ci	{0x1002, 0x9870, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CARRIZO|AMD_IS_APU},
9858c2ecf20Sopenharmony_ci	{0x1002, 0x9874, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CARRIZO|AMD_IS_APU},
9868c2ecf20Sopenharmony_ci	{0x1002, 0x9875, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CARRIZO|AMD_IS_APU},
9878c2ecf20Sopenharmony_ci	{0x1002, 0x9876, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CARRIZO|AMD_IS_APU},
9888c2ecf20Sopenharmony_ci	{0x1002, 0x9877, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CARRIZO|AMD_IS_APU},
9898c2ecf20Sopenharmony_ci	/* stoney */
9908c2ecf20Sopenharmony_ci	{0x1002, 0x98E4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_STONEY|AMD_IS_APU},
9918c2ecf20Sopenharmony_ci	/* Polaris11 */
9928c2ecf20Sopenharmony_ci	{0x1002, 0x67E0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9938c2ecf20Sopenharmony_ci	{0x1002, 0x67E3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9948c2ecf20Sopenharmony_ci	{0x1002, 0x67E8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9958c2ecf20Sopenharmony_ci	{0x1002, 0x67EB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9968c2ecf20Sopenharmony_ci	{0x1002, 0x67EF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9978c2ecf20Sopenharmony_ci	{0x1002, 0x67FF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9988c2ecf20Sopenharmony_ci	{0x1002, 0x67E1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
9998c2ecf20Sopenharmony_ci	{0x1002, 0x67E7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
10008c2ecf20Sopenharmony_ci	{0x1002, 0x67E9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
10018c2ecf20Sopenharmony_ci	/* Polaris10 */
10028c2ecf20Sopenharmony_ci	{0x1002, 0x67C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10038c2ecf20Sopenharmony_ci	{0x1002, 0x67C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10048c2ecf20Sopenharmony_ci	{0x1002, 0x67C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10058c2ecf20Sopenharmony_ci	{0x1002, 0x67C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10068c2ecf20Sopenharmony_ci	{0x1002, 0x67C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10078c2ecf20Sopenharmony_ci	{0x1002, 0x67D0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10088c2ecf20Sopenharmony_ci	{0x1002, 0x67DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10098c2ecf20Sopenharmony_ci	{0x1002, 0x67C8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10108c2ecf20Sopenharmony_ci	{0x1002, 0x67C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10118c2ecf20Sopenharmony_ci	{0x1002, 0x67CA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10128c2ecf20Sopenharmony_ci	{0x1002, 0x67CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10138c2ecf20Sopenharmony_ci	{0x1002, 0x67CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10148c2ecf20Sopenharmony_ci	{0x1002, 0x6FDF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
10158c2ecf20Sopenharmony_ci	/* Polaris12 */
10168c2ecf20Sopenharmony_ci	{0x1002, 0x6980, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10178c2ecf20Sopenharmony_ci	{0x1002, 0x6981, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10188c2ecf20Sopenharmony_ci	{0x1002, 0x6985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10198c2ecf20Sopenharmony_ci	{0x1002, 0x6986, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10208c2ecf20Sopenharmony_ci	{0x1002, 0x6987, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10218c2ecf20Sopenharmony_ci	{0x1002, 0x6995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10228c2ecf20Sopenharmony_ci	{0x1002, 0x6997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10238c2ecf20Sopenharmony_ci	{0x1002, 0x699F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
10248c2ecf20Sopenharmony_ci	/* VEGAM */
10258c2ecf20Sopenharmony_ci	{0x1002, 0x694C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM},
10268c2ecf20Sopenharmony_ci	{0x1002, 0x694E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM},
10278c2ecf20Sopenharmony_ci	{0x1002, 0x694F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM},
10288c2ecf20Sopenharmony_ci	/* Vega 10 */
10298c2ecf20Sopenharmony_ci	{0x1002, 0x6860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10308c2ecf20Sopenharmony_ci	{0x1002, 0x6861, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10318c2ecf20Sopenharmony_ci	{0x1002, 0x6862, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10328c2ecf20Sopenharmony_ci	{0x1002, 0x6863, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10338c2ecf20Sopenharmony_ci	{0x1002, 0x6864, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10348c2ecf20Sopenharmony_ci	{0x1002, 0x6867, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10358c2ecf20Sopenharmony_ci	{0x1002, 0x6868, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10368c2ecf20Sopenharmony_ci	{0x1002, 0x6869, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10378c2ecf20Sopenharmony_ci	{0x1002, 0x686a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10388c2ecf20Sopenharmony_ci	{0x1002, 0x686b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10398c2ecf20Sopenharmony_ci	{0x1002, 0x686c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10408c2ecf20Sopenharmony_ci	{0x1002, 0x686d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10418c2ecf20Sopenharmony_ci	{0x1002, 0x686e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10428c2ecf20Sopenharmony_ci	{0x1002, 0x686f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10438c2ecf20Sopenharmony_ci	{0x1002, 0x687f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
10448c2ecf20Sopenharmony_ci	/* Vega 12 */
10458c2ecf20Sopenharmony_ci	{0x1002, 0x69A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
10468c2ecf20Sopenharmony_ci	{0x1002, 0x69A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
10478c2ecf20Sopenharmony_ci	{0x1002, 0x69A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
10488c2ecf20Sopenharmony_ci	{0x1002, 0x69A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
10498c2ecf20Sopenharmony_ci	{0x1002, 0x69AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
10508c2ecf20Sopenharmony_ci	/* Vega 20 */
10518c2ecf20Sopenharmony_ci	{0x1002, 0x66A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10528c2ecf20Sopenharmony_ci	{0x1002, 0x66A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10538c2ecf20Sopenharmony_ci	{0x1002, 0x66A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10548c2ecf20Sopenharmony_ci	{0x1002, 0x66A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10558c2ecf20Sopenharmony_ci	{0x1002, 0x66A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10568c2ecf20Sopenharmony_ci	{0x1002, 0x66A7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10578c2ecf20Sopenharmony_ci	{0x1002, 0x66AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
10588c2ecf20Sopenharmony_ci	/* Raven */
10598c2ecf20Sopenharmony_ci	{0x1002, 0x15dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU},
10608c2ecf20Sopenharmony_ci	{0x1002, 0x15d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU},
10618c2ecf20Sopenharmony_ci	/* Arcturus */
10628c2ecf20Sopenharmony_ci	{0x1002, 0x738C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARCTURUS},
10638c2ecf20Sopenharmony_ci	{0x1002, 0x7388, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARCTURUS},
10648c2ecf20Sopenharmony_ci	{0x1002, 0x738E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARCTURUS},
10658c2ecf20Sopenharmony_ci	{0x1002, 0x7390, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARCTURUS},
10668c2ecf20Sopenharmony_ci	/* Navi10 */
10678c2ecf20Sopenharmony_ci	{0x1002, 0x7310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10688c2ecf20Sopenharmony_ci	{0x1002, 0x7312, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10698c2ecf20Sopenharmony_ci	{0x1002, 0x7318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10708c2ecf20Sopenharmony_ci	{0x1002, 0x7319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10718c2ecf20Sopenharmony_ci	{0x1002, 0x731A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10728c2ecf20Sopenharmony_ci	{0x1002, 0x731B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10738c2ecf20Sopenharmony_ci	{0x1002, 0x731E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10748c2ecf20Sopenharmony_ci	{0x1002, 0x731F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
10758c2ecf20Sopenharmony_ci	/* Navi14 */
10768c2ecf20Sopenharmony_ci	{0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
10778c2ecf20Sopenharmony_ci	{0x1002, 0x7341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
10788c2ecf20Sopenharmony_ci	{0x1002, 0x7347, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
10798c2ecf20Sopenharmony_ci	{0x1002, 0x734F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
10808c2ecf20Sopenharmony_ci
10818c2ecf20Sopenharmony_ci	/* Renoir */
10828c2ecf20Sopenharmony_ci	{0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
10838c2ecf20Sopenharmony_ci	{0x1002, 0x1638, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
10848c2ecf20Sopenharmony_ci	{0x1002, 0x164C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
10858c2ecf20Sopenharmony_ci
10868c2ecf20Sopenharmony_ci	/* Navi12 */
10878c2ecf20Sopenharmony_ci	{0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
10888c2ecf20Sopenharmony_ci	{0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
10898c2ecf20Sopenharmony_ci
10908c2ecf20Sopenharmony_ci	/* Sienna_Cichlid */
10918c2ecf20Sopenharmony_ci	{0x1002, 0x73A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10928c2ecf20Sopenharmony_ci	{0x1002, 0x73A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10938c2ecf20Sopenharmony_ci	{0x1002, 0x73A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10948c2ecf20Sopenharmony_ci	{0x1002, 0x73AB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10958c2ecf20Sopenharmony_ci	{0x1002, 0x73AE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10968c2ecf20Sopenharmony_ci	{0x1002, 0x73AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10978c2ecf20Sopenharmony_ci	{0x1002, 0x73BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci	{0, 0, 0}
11008c2ecf20Sopenharmony_ci};
11018c2ecf20Sopenharmony_ci
11028c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pci, pciidlist);
11038c2ecf20Sopenharmony_ci
11048c2ecf20Sopenharmony_cistatic struct drm_driver kms_driver;
11058c2ecf20Sopenharmony_ci
11068c2ecf20Sopenharmony_cistatic int amdgpu_pci_probe(struct pci_dev *pdev,
11078c2ecf20Sopenharmony_ci			    const struct pci_device_id *ent)
11088c2ecf20Sopenharmony_ci{
11098c2ecf20Sopenharmony_ci	struct drm_device *ddev;
11108c2ecf20Sopenharmony_ci	struct amdgpu_device *adev;
11118c2ecf20Sopenharmony_ci	unsigned long flags = ent->driver_data;
11128c2ecf20Sopenharmony_ci	int ret, retry = 0;
11138c2ecf20Sopenharmony_ci	bool supports_atomic = false;
11148c2ecf20Sopenharmony_ci
11158c2ecf20Sopenharmony_ci	if (!amdgpu_virtual_display &&
11168c2ecf20Sopenharmony_ci	    amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
11178c2ecf20Sopenharmony_ci		supports_atomic = true;
11188c2ecf20Sopenharmony_ci
11198c2ecf20Sopenharmony_ci	if ((flags & AMD_EXP_HW_SUPPORT) && !amdgpu_exp_hw_support) {
11208c2ecf20Sopenharmony_ci		DRM_INFO("This hardware requires experimental hardware support.\n"
11218c2ecf20Sopenharmony_ci			 "See modparam exp_hw_support\n");
11228c2ecf20Sopenharmony_ci		return -ENODEV;
11238c2ecf20Sopenharmony_ci	}
11248c2ecf20Sopenharmony_ci	/* differentiate between P10 and P11 asics with the same DID */
11258c2ecf20Sopenharmony_ci	if (pdev->device == 0x67FF &&
11268c2ecf20Sopenharmony_ci	    (pdev->revision == 0xE3 ||
11278c2ecf20Sopenharmony_ci	     pdev->revision == 0xE7 ||
11288c2ecf20Sopenharmony_ci	     pdev->revision == 0xF3 ||
11298c2ecf20Sopenharmony_ci	     pdev->revision == 0xF7)) {
11308c2ecf20Sopenharmony_ci		flags &= ~AMD_ASIC_MASK;
11318c2ecf20Sopenharmony_ci		flags |= CHIP_POLARIS10;
11328c2ecf20Sopenharmony_ci	}
11338c2ecf20Sopenharmony_ci
11348c2ecf20Sopenharmony_ci	/* Due to hardware bugs, S/G Display on raven requires a 1:1 IOMMU mapping,
11358c2ecf20Sopenharmony_ci	 * however, SME requires an indirect IOMMU mapping because the encryption
11368c2ecf20Sopenharmony_ci	 * bit is beyond the DMA mask of the chip.
11378c2ecf20Sopenharmony_ci	 */
11388c2ecf20Sopenharmony_ci	if (mem_encrypt_active() && ((flags & AMD_ASIC_MASK) == CHIP_RAVEN)) {
11398c2ecf20Sopenharmony_ci		dev_info(&pdev->dev,
11408c2ecf20Sopenharmony_ci			 "SME is not compatible with RAVEN\n");
11418c2ecf20Sopenharmony_ci		return -ENOTSUPP;
11428c2ecf20Sopenharmony_ci	}
11438c2ecf20Sopenharmony_ci
11448c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMDGPU_SI
11458c2ecf20Sopenharmony_ci	if (!amdgpu_si_support) {
11468c2ecf20Sopenharmony_ci		switch (flags & AMD_ASIC_MASK) {
11478c2ecf20Sopenharmony_ci		case CHIP_TAHITI:
11488c2ecf20Sopenharmony_ci		case CHIP_PITCAIRN:
11498c2ecf20Sopenharmony_ci		case CHIP_VERDE:
11508c2ecf20Sopenharmony_ci		case CHIP_OLAND:
11518c2ecf20Sopenharmony_ci		case CHIP_HAINAN:
11528c2ecf20Sopenharmony_ci			dev_info(&pdev->dev,
11538c2ecf20Sopenharmony_ci				 "SI support provided by radeon.\n");
11548c2ecf20Sopenharmony_ci			dev_info(&pdev->dev,
11558c2ecf20Sopenharmony_ci				 "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
11568c2ecf20Sopenharmony_ci				);
11578c2ecf20Sopenharmony_ci			return -ENODEV;
11588c2ecf20Sopenharmony_ci		}
11598c2ecf20Sopenharmony_ci	}
11608c2ecf20Sopenharmony_ci#endif
11618c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMDGPU_CIK
11628c2ecf20Sopenharmony_ci	if (!amdgpu_cik_support) {
11638c2ecf20Sopenharmony_ci		switch (flags & AMD_ASIC_MASK) {
11648c2ecf20Sopenharmony_ci		case CHIP_KAVERI:
11658c2ecf20Sopenharmony_ci		case CHIP_BONAIRE:
11668c2ecf20Sopenharmony_ci		case CHIP_HAWAII:
11678c2ecf20Sopenharmony_ci		case CHIP_KABINI:
11688c2ecf20Sopenharmony_ci		case CHIP_MULLINS:
11698c2ecf20Sopenharmony_ci			dev_info(&pdev->dev,
11708c2ecf20Sopenharmony_ci				 "CIK support provided by radeon.\n");
11718c2ecf20Sopenharmony_ci			dev_info(&pdev->dev,
11728c2ecf20Sopenharmony_ci				 "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
11738c2ecf20Sopenharmony_ci				);
11748c2ecf20Sopenharmony_ci			return -ENODEV;
11758c2ecf20Sopenharmony_ci		}
11768c2ecf20Sopenharmony_ci	}
11778c2ecf20Sopenharmony_ci#endif
11788c2ecf20Sopenharmony_ci
11798c2ecf20Sopenharmony_ci	/* Get rid of things like offb */
11808c2ecf20Sopenharmony_ci	ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "amdgpudrmfb");
11818c2ecf20Sopenharmony_ci	if (ret)
11828c2ecf20Sopenharmony_ci		return ret;
11838c2ecf20Sopenharmony_ci
11848c2ecf20Sopenharmony_ci	adev = devm_drm_dev_alloc(&pdev->dev, &kms_driver, typeof(*adev), ddev);
11858c2ecf20Sopenharmony_ci	if (IS_ERR(adev))
11868c2ecf20Sopenharmony_ci		return PTR_ERR(adev);
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_ci	adev->dev  = &pdev->dev;
11898c2ecf20Sopenharmony_ci	adev->pdev = pdev;
11908c2ecf20Sopenharmony_ci	ddev = adev_to_drm(adev);
11918c2ecf20Sopenharmony_ci
11928c2ecf20Sopenharmony_ci	if (!supports_atomic)
11938c2ecf20Sopenharmony_ci		ddev->driver_features &= ~DRIVER_ATOMIC;
11948c2ecf20Sopenharmony_ci
11958c2ecf20Sopenharmony_ci	ret = pci_enable_device(pdev);
11968c2ecf20Sopenharmony_ci	if (ret)
11978c2ecf20Sopenharmony_ci		return ret;
11988c2ecf20Sopenharmony_ci
11998c2ecf20Sopenharmony_ci	ddev->pdev = pdev;
12008c2ecf20Sopenharmony_ci	pci_set_drvdata(pdev, ddev);
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci	ret = amdgpu_driver_load_kms(adev, flags);
12038c2ecf20Sopenharmony_ci	if (ret)
12048c2ecf20Sopenharmony_ci		goto err_pci;
12058c2ecf20Sopenharmony_ci
12068c2ecf20Sopenharmony_ciretry_init:
12078c2ecf20Sopenharmony_ci	ret = drm_dev_register(ddev, flags);
12088c2ecf20Sopenharmony_ci	if (ret == -EAGAIN && ++retry <= 3) {
12098c2ecf20Sopenharmony_ci		DRM_INFO("retry init %d\n", retry);
12108c2ecf20Sopenharmony_ci		/* Don't request EX mode too frequently which is attacking */
12118c2ecf20Sopenharmony_ci		msleep(5000);
12128c2ecf20Sopenharmony_ci		goto retry_init;
12138c2ecf20Sopenharmony_ci	} else if (ret) {
12148c2ecf20Sopenharmony_ci		goto err_pci;
12158c2ecf20Sopenharmony_ci	}
12168c2ecf20Sopenharmony_ci
12178c2ecf20Sopenharmony_ci	ret = amdgpu_debugfs_init(adev);
12188c2ecf20Sopenharmony_ci	if (ret)
12198c2ecf20Sopenharmony_ci		DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
12208c2ecf20Sopenharmony_ci
12218c2ecf20Sopenharmony_ci	return 0;
12228c2ecf20Sopenharmony_ci
12238c2ecf20Sopenharmony_cierr_pci:
12248c2ecf20Sopenharmony_ci	pci_disable_device(pdev);
12258c2ecf20Sopenharmony_ci	return ret;
12268c2ecf20Sopenharmony_ci}
12278c2ecf20Sopenharmony_ci
12288c2ecf20Sopenharmony_cistatic void
12298c2ecf20Sopenharmony_ciamdgpu_pci_remove(struct pci_dev *pdev)
12308c2ecf20Sopenharmony_ci{
12318c2ecf20Sopenharmony_ci	struct drm_device *dev = pci_get_drvdata(pdev);
12328c2ecf20Sopenharmony_ci
12338c2ecf20Sopenharmony_ci#ifdef MODULE
12348c2ecf20Sopenharmony_ci	if (THIS_MODULE->state != MODULE_STATE_GOING)
12358c2ecf20Sopenharmony_ci#endif
12368c2ecf20Sopenharmony_ci		DRM_ERROR("Hotplug removal is not supported\n");
12378c2ecf20Sopenharmony_ci	drm_dev_unplug(dev);
12388c2ecf20Sopenharmony_ci	amdgpu_driver_unload_kms(dev);
12398c2ecf20Sopenharmony_ci	pci_disable_device(pdev);
12408c2ecf20Sopenharmony_ci	pci_set_drvdata(pdev, NULL);
12418c2ecf20Sopenharmony_ci}
12428c2ecf20Sopenharmony_ci
12438c2ecf20Sopenharmony_cistatic void
12448c2ecf20Sopenharmony_ciamdgpu_pci_shutdown(struct pci_dev *pdev)
12458c2ecf20Sopenharmony_ci{
12468c2ecf20Sopenharmony_ci	struct drm_device *dev = pci_get_drvdata(pdev);
12478c2ecf20Sopenharmony_ci	struct amdgpu_device *adev = drm_to_adev(dev);
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_ci	if (amdgpu_ras_intr_triggered())
12508c2ecf20Sopenharmony_ci		return;
12518c2ecf20Sopenharmony_ci
12528c2ecf20Sopenharmony_ci	/* if we are running in a VM, make sure the device
12538c2ecf20Sopenharmony_ci	 * torn down properly on reboot/shutdown.
12548c2ecf20Sopenharmony_ci	 * unfortunately we can't detect certain
12558c2ecf20Sopenharmony_ci	 * hypervisors so just do this all the time.
12568c2ecf20Sopenharmony_ci	 */
12578c2ecf20Sopenharmony_ci	if (!amdgpu_passthrough(adev))
12588c2ecf20Sopenharmony_ci		adev->mp1_state = PP_MP1_STATE_UNLOAD;
12598c2ecf20Sopenharmony_ci	amdgpu_device_ip_suspend(adev);
12608c2ecf20Sopenharmony_ci	adev->mp1_state = PP_MP1_STATE_NONE;
12618c2ecf20Sopenharmony_ci}
12628c2ecf20Sopenharmony_ci
12638c2ecf20Sopenharmony_cistatic int amdgpu_pmops_suspend(struct device *dev)
12648c2ecf20Sopenharmony_ci{
12658c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
12668c2ecf20Sopenharmony_ci
12678c2ecf20Sopenharmony_ci	return amdgpu_device_suspend(drm_dev, true);
12688c2ecf20Sopenharmony_ci}
12698c2ecf20Sopenharmony_ci
12708c2ecf20Sopenharmony_cistatic int amdgpu_pmops_resume(struct device *dev)
12718c2ecf20Sopenharmony_ci{
12728c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
12738c2ecf20Sopenharmony_ci
12748c2ecf20Sopenharmony_ci	return amdgpu_device_resume(drm_dev, true);
12758c2ecf20Sopenharmony_ci}
12768c2ecf20Sopenharmony_ci
12778c2ecf20Sopenharmony_cistatic int amdgpu_pmops_freeze(struct device *dev)
12788c2ecf20Sopenharmony_ci{
12798c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
12808c2ecf20Sopenharmony_ci	struct amdgpu_device *adev = drm_to_adev(drm_dev);
12818c2ecf20Sopenharmony_ci	int r;
12828c2ecf20Sopenharmony_ci
12838c2ecf20Sopenharmony_ci	adev->in_hibernate = true;
12848c2ecf20Sopenharmony_ci	r = amdgpu_device_suspend(drm_dev, true);
12858c2ecf20Sopenharmony_ci	adev->in_hibernate = false;
12868c2ecf20Sopenharmony_ci	if (r)
12878c2ecf20Sopenharmony_ci		return r;
12888c2ecf20Sopenharmony_ci	return amdgpu_asic_reset(adev);
12898c2ecf20Sopenharmony_ci}
12908c2ecf20Sopenharmony_ci
12918c2ecf20Sopenharmony_cistatic int amdgpu_pmops_thaw(struct device *dev)
12928c2ecf20Sopenharmony_ci{
12938c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
12948c2ecf20Sopenharmony_ci
12958c2ecf20Sopenharmony_ci	return amdgpu_device_resume(drm_dev, true);
12968c2ecf20Sopenharmony_ci}
12978c2ecf20Sopenharmony_ci
12988c2ecf20Sopenharmony_cistatic int amdgpu_pmops_poweroff(struct device *dev)
12998c2ecf20Sopenharmony_ci{
13008c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
13018c2ecf20Sopenharmony_ci
13028c2ecf20Sopenharmony_ci	return amdgpu_device_suspend(drm_dev, true);
13038c2ecf20Sopenharmony_ci}
13048c2ecf20Sopenharmony_ci
13058c2ecf20Sopenharmony_cistatic int amdgpu_pmops_restore(struct device *dev)
13068c2ecf20Sopenharmony_ci{
13078c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
13088c2ecf20Sopenharmony_ci
13098c2ecf20Sopenharmony_ci	return amdgpu_device_resume(drm_dev, true);
13108c2ecf20Sopenharmony_ci}
13118c2ecf20Sopenharmony_ci
13128c2ecf20Sopenharmony_cistatic int amdgpu_pmops_runtime_suspend(struct device *dev)
13138c2ecf20Sopenharmony_ci{
13148c2ecf20Sopenharmony_ci	struct pci_dev *pdev = to_pci_dev(dev);
13158c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = pci_get_drvdata(pdev);
13168c2ecf20Sopenharmony_ci	struct amdgpu_device *adev = drm_to_adev(drm_dev);
13178c2ecf20Sopenharmony_ci	int ret, i;
13188c2ecf20Sopenharmony_ci
13198c2ecf20Sopenharmony_ci	if (!adev->runpm) {
13208c2ecf20Sopenharmony_ci		pm_runtime_forbid(dev);
13218c2ecf20Sopenharmony_ci		return -EBUSY;
13228c2ecf20Sopenharmony_ci	}
13238c2ecf20Sopenharmony_ci
13248c2ecf20Sopenharmony_ci	/* wait for all rings to drain before suspending */
13258c2ecf20Sopenharmony_ci	for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
13268c2ecf20Sopenharmony_ci		struct amdgpu_ring *ring = adev->rings[i];
13278c2ecf20Sopenharmony_ci		if (ring && ring->sched.ready) {
13288c2ecf20Sopenharmony_ci			ret = amdgpu_fence_wait_empty(ring);
13298c2ecf20Sopenharmony_ci			if (ret)
13308c2ecf20Sopenharmony_ci				return -EBUSY;
13318c2ecf20Sopenharmony_ci		}
13328c2ecf20Sopenharmony_ci	}
13338c2ecf20Sopenharmony_ci
13348c2ecf20Sopenharmony_ci	adev->in_runpm = true;
13358c2ecf20Sopenharmony_ci	if (amdgpu_device_supports_boco(drm_dev))
13368c2ecf20Sopenharmony_ci		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
13378c2ecf20Sopenharmony_ci	drm_kms_helper_poll_disable(drm_dev);
13388c2ecf20Sopenharmony_ci
13398c2ecf20Sopenharmony_ci	ret = amdgpu_device_suspend(drm_dev, false);
13408c2ecf20Sopenharmony_ci	if (ret)
13418c2ecf20Sopenharmony_ci		return ret;
13428c2ecf20Sopenharmony_ci
13438c2ecf20Sopenharmony_ci	if (amdgpu_device_supports_boco(drm_dev)) {
13448c2ecf20Sopenharmony_ci		/* Only need to handle PCI state in the driver for ATPX
13458c2ecf20Sopenharmony_ci		 * PCI core handles it for _PR3.
13468c2ecf20Sopenharmony_ci		 */
13478c2ecf20Sopenharmony_ci		if (amdgpu_is_atpx_hybrid()) {
13488c2ecf20Sopenharmony_ci			pci_ignore_hotplug(pdev);
13498c2ecf20Sopenharmony_ci		} else {
13508c2ecf20Sopenharmony_ci			amdgpu_device_cache_pci_state(pdev);
13518c2ecf20Sopenharmony_ci			pci_disable_device(pdev);
13528c2ecf20Sopenharmony_ci			pci_ignore_hotplug(pdev);
13538c2ecf20Sopenharmony_ci			pci_set_power_state(pdev, PCI_D3cold);
13548c2ecf20Sopenharmony_ci		}
13558c2ecf20Sopenharmony_ci		drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
13568c2ecf20Sopenharmony_ci	} else if (amdgpu_device_supports_boco(drm_dev)) {
13578c2ecf20Sopenharmony_ci		/* nothing to do */
13588c2ecf20Sopenharmony_ci	} else if (amdgpu_device_supports_baco(drm_dev)) {
13598c2ecf20Sopenharmony_ci		amdgpu_device_baco_enter(drm_dev);
13608c2ecf20Sopenharmony_ci	}
13618c2ecf20Sopenharmony_ci
13628c2ecf20Sopenharmony_ci	return 0;
13638c2ecf20Sopenharmony_ci}
13648c2ecf20Sopenharmony_ci
13658c2ecf20Sopenharmony_cistatic int amdgpu_pmops_runtime_resume(struct device *dev)
13668c2ecf20Sopenharmony_ci{
13678c2ecf20Sopenharmony_ci	struct pci_dev *pdev = to_pci_dev(dev);
13688c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = pci_get_drvdata(pdev);
13698c2ecf20Sopenharmony_ci	struct amdgpu_device *adev = drm_to_adev(drm_dev);
13708c2ecf20Sopenharmony_ci	int ret;
13718c2ecf20Sopenharmony_ci
13728c2ecf20Sopenharmony_ci	if (!adev->runpm)
13738c2ecf20Sopenharmony_ci		return -EINVAL;
13748c2ecf20Sopenharmony_ci
13758c2ecf20Sopenharmony_ci	if (amdgpu_device_supports_boco(drm_dev)) {
13768c2ecf20Sopenharmony_ci		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
13778c2ecf20Sopenharmony_ci
13788c2ecf20Sopenharmony_ci		/* Only need to handle PCI state in the driver for ATPX
13798c2ecf20Sopenharmony_ci		 * PCI core handles it for _PR3.
13808c2ecf20Sopenharmony_ci		 */
13818c2ecf20Sopenharmony_ci		if (amdgpu_is_atpx_hybrid()) {
13828c2ecf20Sopenharmony_ci			pci_set_master(pdev);
13838c2ecf20Sopenharmony_ci		} else {
13848c2ecf20Sopenharmony_ci			pci_set_power_state(pdev, PCI_D0);
13858c2ecf20Sopenharmony_ci			amdgpu_device_load_pci_state(pdev);
13868c2ecf20Sopenharmony_ci			ret = pci_enable_device(pdev);
13878c2ecf20Sopenharmony_ci			if (ret)
13888c2ecf20Sopenharmony_ci				return ret;
13898c2ecf20Sopenharmony_ci			pci_set_master(pdev);
13908c2ecf20Sopenharmony_ci		}
13918c2ecf20Sopenharmony_ci	} else if (amdgpu_device_supports_baco(drm_dev)) {
13928c2ecf20Sopenharmony_ci		amdgpu_device_baco_exit(drm_dev);
13938c2ecf20Sopenharmony_ci	}
13948c2ecf20Sopenharmony_ci	ret = amdgpu_device_resume(drm_dev, false);
13958c2ecf20Sopenharmony_ci	drm_kms_helper_poll_enable(drm_dev);
13968c2ecf20Sopenharmony_ci	if (amdgpu_device_supports_boco(drm_dev))
13978c2ecf20Sopenharmony_ci		drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
13988c2ecf20Sopenharmony_ci	adev->in_runpm = false;
13998c2ecf20Sopenharmony_ci	return 0;
14008c2ecf20Sopenharmony_ci}
14018c2ecf20Sopenharmony_ci
14028c2ecf20Sopenharmony_cistatic int amdgpu_pmops_runtime_idle(struct device *dev)
14038c2ecf20Sopenharmony_ci{
14048c2ecf20Sopenharmony_ci	struct drm_device *drm_dev = dev_get_drvdata(dev);
14058c2ecf20Sopenharmony_ci	struct amdgpu_device *adev = drm_to_adev(drm_dev);
14068c2ecf20Sopenharmony_ci	/* we don't want the main rpm_idle to call suspend - we want to autosuspend */
14078c2ecf20Sopenharmony_ci	int ret = 1;
14088c2ecf20Sopenharmony_ci
14098c2ecf20Sopenharmony_ci	if (!adev->runpm) {
14108c2ecf20Sopenharmony_ci		pm_runtime_forbid(dev);
14118c2ecf20Sopenharmony_ci		return -EBUSY;
14128c2ecf20Sopenharmony_ci	}
14138c2ecf20Sopenharmony_ci
14148c2ecf20Sopenharmony_ci	if (amdgpu_device_has_dc_support(adev)) {
14158c2ecf20Sopenharmony_ci		struct drm_crtc *crtc;
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_ci		drm_modeset_lock_all(drm_dev);
14188c2ecf20Sopenharmony_ci
14198c2ecf20Sopenharmony_ci		drm_for_each_crtc(crtc, drm_dev) {
14208c2ecf20Sopenharmony_ci			if (crtc->state->active) {
14218c2ecf20Sopenharmony_ci				ret = -EBUSY;
14228c2ecf20Sopenharmony_ci				break;
14238c2ecf20Sopenharmony_ci			}
14248c2ecf20Sopenharmony_ci		}
14258c2ecf20Sopenharmony_ci
14268c2ecf20Sopenharmony_ci		drm_modeset_unlock_all(drm_dev);
14278c2ecf20Sopenharmony_ci
14288c2ecf20Sopenharmony_ci	} else {
14298c2ecf20Sopenharmony_ci		struct drm_connector *list_connector;
14308c2ecf20Sopenharmony_ci		struct drm_connector_list_iter iter;
14318c2ecf20Sopenharmony_ci
14328c2ecf20Sopenharmony_ci		mutex_lock(&drm_dev->mode_config.mutex);
14338c2ecf20Sopenharmony_ci		drm_modeset_lock(&drm_dev->mode_config.connection_mutex, NULL);
14348c2ecf20Sopenharmony_ci
14358c2ecf20Sopenharmony_ci		drm_connector_list_iter_begin(drm_dev, &iter);
14368c2ecf20Sopenharmony_ci		drm_for_each_connector_iter(list_connector, &iter) {
14378c2ecf20Sopenharmony_ci			if (list_connector->dpms ==  DRM_MODE_DPMS_ON) {
14388c2ecf20Sopenharmony_ci				ret = -EBUSY;
14398c2ecf20Sopenharmony_ci				break;
14408c2ecf20Sopenharmony_ci			}
14418c2ecf20Sopenharmony_ci		}
14428c2ecf20Sopenharmony_ci
14438c2ecf20Sopenharmony_ci		drm_connector_list_iter_end(&iter);
14448c2ecf20Sopenharmony_ci
14458c2ecf20Sopenharmony_ci		drm_modeset_unlock(&drm_dev->mode_config.connection_mutex);
14468c2ecf20Sopenharmony_ci		mutex_unlock(&drm_dev->mode_config.mutex);
14478c2ecf20Sopenharmony_ci	}
14488c2ecf20Sopenharmony_ci
14498c2ecf20Sopenharmony_ci	if (ret == -EBUSY)
14508c2ecf20Sopenharmony_ci		DRM_DEBUG_DRIVER("failing to power off - crtc active\n");
14518c2ecf20Sopenharmony_ci
14528c2ecf20Sopenharmony_ci	pm_runtime_mark_last_busy(dev);
14538c2ecf20Sopenharmony_ci	pm_runtime_autosuspend(dev);
14548c2ecf20Sopenharmony_ci	return ret;
14558c2ecf20Sopenharmony_ci}
14568c2ecf20Sopenharmony_ci
14578c2ecf20Sopenharmony_cilong amdgpu_drm_ioctl(struct file *filp,
14588c2ecf20Sopenharmony_ci		      unsigned int cmd, unsigned long arg)
14598c2ecf20Sopenharmony_ci{
14608c2ecf20Sopenharmony_ci	struct drm_file *file_priv = filp->private_data;
14618c2ecf20Sopenharmony_ci	struct drm_device *dev;
14628c2ecf20Sopenharmony_ci	long ret;
14638c2ecf20Sopenharmony_ci	dev = file_priv->minor->dev;
14648c2ecf20Sopenharmony_ci	ret = pm_runtime_get_sync(dev->dev);
14658c2ecf20Sopenharmony_ci	if (ret < 0)
14668c2ecf20Sopenharmony_ci		goto out;
14678c2ecf20Sopenharmony_ci
14688c2ecf20Sopenharmony_ci	ret = drm_ioctl(filp, cmd, arg);
14698c2ecf20Sopenharmony_ci
14708c2ecf20Sopenharmony_ci	pm_runtime_mark_last_busy(dev->dev);
14718c2ecf20Sopenharmony_ciout:
14728c2ecf20Sopenharmony_ci	pm_runtime_put_autosuspend(dev->dev);
14738c2ecf20Sopenharmony_ci	return ret;
14748c2ecf20Sopenharmony_ci}
14758c2ecf20Sopenharmony_ci
14768c2ecf20Sopenharmony_cistatic const struct dev_pm_ops amdgpu_pm_ops = {
14778c2ecf20Sopenharmony_ci	.suspend = amdgpu_pmops_suspend,
14788c2ecf20Sopenharmony_ci	.resume = amdgpu_pmops_resume,
14798c2ecf20Sopenharmony_ci	.freeze = amdgpu_pmops_freeze,
14808c2ecf20Sopenharmony_ci	.thaw = amdgpu_pmops_thaw,
14818c2ecf20Sopenharmony_ci	.poweroff = amdgpu_pmops_poweroff,
14828c2ecf20Sopenharmony_ci	.restore = amdgpu_pmops_restore,
14838c2ecf20Sopenharmony_ci	.runtime_suspend = amdgpu_pmops_runtime_suspend,
14848c2ecf20Sopenharmony_ci	.runtime_resume = amdgpu_pmops_runtime_resume,
14858c2ecf20Sopenharmony_ci	.runtime_idle = amdgpu_pmops_runtime_idle,
14868c2ecf20Sopenharmony_ci};
14878c2ecf20Sopenharmony_ci
14888c2ecf20Sopenharmony_cistatic int amdgpu_flush(struct file *f, fl_owner_t id)
14898c2ecf20Sopenharmony_ci{
14908c2ecf20Sopenharmony_ci	struct drm_file *file_priv = f->private_data;
14918c2ecf20Sopenharmony_ci	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
14928c2ecf20Sopenharmony_ci	long timeout = MAX_WAIT_SCHED_ENTITY_Q_EMPTY;
14938c2ecf20Sopenharmony_ci
14948c2ecf20Sopenharmony_ci	timeout = amdgpu_ctx_mgr_entity_flush(&fpriv->ctx_mgr, timeout);
14958c2ecf20Sopenharmony_ci	timeout = amdgpu_vm_wait_idle(&fpriv->vm, timeout);
14968c2ecf20Sopenharmony_ci
14978c2ecf20Sopenharmony_ci	return timeout >= 0 ? 0 : timeout;
14988c2ecf20Sopenharmony_ci}
14998c2ecf20Sopenharmony_ci
15008c2ecf20Sopenharmony_cistatic const struct file_operations amdgpu_driver_kms_fops = {
15018c2ecf20Sopenharmony_ci	.owner = THIS_MODULE,
15028c2ecf20Sopenharmony_ci	.open = drm_open,
15038c2ecf20Sopenharmony_ci	.flush = amdgpu_flush,
15048c2ecf20Sopenharmony_ci	.release = drm_release,
15058c2ecf20Sopenharmony_ci	.unlocked_ioctl = amdgpu_drm_ioctl,
15068c2ecf20Sopenharmony_ci	.mmap = amdgpu_mmap,
15078c2ecf20Sopenharmony_ci	.poll = drm_poll,
15088c2ecf20Sopenharmony_ci	.read = drm_read,
15098c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
15108c2ecf20Sopenharmony_ci	.compat_ioctl = amdgpu_kms_compat_ioctl,
15118c2ecf20Sopenharmony_ci#endif
15128c2ecf20Sopenharmony_ci};
15138c2ecf20Sopenharmony_ci
15148c2ecf20Sopenharmony_ciint amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
15158c2ecf20Sopenharmony_ci{
15168c2ecf20Sopenharmony_ci        struct drm_file *file;
15178c2ecf20Sopenharmony_ci
15188c2ecf20Sopenharmony_ci	if (!filp)
15198c2ecf20Sopenharmony_ci		return -EINVAL;
15208c2ecf20Sopenharmony_ci
15218c2ecf20Sopenharmony_ci	if (filp->f_op != &amdgpu_driver_kms_fops) {
15228c2ecf20Sopenharmony_ci		return -EINVAL;
15238c2ecf20Sopenharmony_ci	}
15248c2ecf20Sopenharmony_ci
15258c2ecf20Sopenharmony_ci	file = filp->private_data;
15268c2ecf20Sopenharmony_ci	*fpriv = file->driver_priv;
15278c2ecf20Sopenharmony_ci	return 0;
15288c2ecf20Sopenharmony_ci}
15298c2ecf20Sopenharmony_ci
15308c2ecf20Sopenharmony_cistatic struct drm_driver kms_driver = {
15318c2ecf20Sopenharmony_ci	.driver_features =
15328c2ecf20Sopenharmony_ci	    DRIVER_ATOMIC |
15338c2ecf20Sopenharmony_ci	    DRIVER_GEM |
15348c2ecf20Sopenharmony_ci	    DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ |
15358c2ecf20Sopenharmony_ci	    DRIVER_SYNCOBJ_TIMELINE,
15368c2ecf20Sopenharmony_ci	.open = amdgpu_driver_open_kms,
15378c2ecf20Sopenharmony_ci	.postclose = amdgpu_driver_postclose_kms,
15388c2ecf20Sopenharmony_ci	.lastclose = amdgpu_driver_lastclose_kms,
15398c2ecf20Sopenharmony_ci	.irq_handler = amdgpu_irq_handler,
15408c2ecf20Sopenharmony_ci	.ioctls = amdgpu_ioctls_kms,
15418c2ecf20Sopenharmony_ci	.gem_free_object_unlocked = amdgpu_gem_object_free,
15428c2ecf20Sopenharmony_ci	.gem_open_object = amdgpu_gem_object_open,
15438c2ecf20Sopenharmony_ci	.gem_close_object = amdgpu_gem_object_close,
15448c2ecf20Sopenharmony_ci	.dumb_create = amdgpu_mode_dumb_create,
15458c2ecf20Sopenharmony_ci	.dumb_map_offset = amdgpu_mode_dumb_mmap,
15468c2ecf20Sopenharmony_ci	.fops = &amdgpu_driver_kms_fops,
15478c2ecf20Sopenharmony_ci
15488c2ecf20Sopenharmony_ci	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
15498c2ecf20Sopenharmony_ci	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
15508c2ecf20Sopenharmony_ci	.gem_prime_export = amdgpu_gem_prime_export,
15518c2ecf20Sopenharmony_ci	.gem_prime_import = amdgpu_gem_prime_import,
15528c2ecf20Sopenharmony_ci	.gem_prime_vmap = amdgpu_gem_prime_vmap,
15538c2ecf20Sopenharmony_ci	.gem_prime_vunmap = amdgpu_gem_prime_vunmap,
15548c2ecf20Sopenharmony_ci	.gem_prime_mmap = amdgpu_gem_prime_mmap,
15558c2ecf20Sopenharmony_ci
15568c2ecf20Sopenharmony_ci	.name = DRIVER_NAME,
15578c2ecf20Sopenharmony_ci	.desc = DRIVER_DESC,
15588c2ecf20Sopenharmony_ci	.date = DRIVER_DATE,
15598c2ecf20Sopenharmony_ci	.major = KMS_DRIVER_MAJOR,
15608c2ecf20Sopenharmony_ci	.minor = KMS_DRIVER_MINOR,
15618c2ecf20Sopenharmony_ci	.patchlevel = KMS_DRIVER_PATCHLEVEL,
15628c2ecf20Sopenharmony_ci};
15638c2ecf20Sopenharmony_ci
15648c2ecf20Sopenharmony_cistatic struct pci_error_handlers amdgpu_pci_err_handler = {
15658c2ecf20Sopenharmony_ci	.error_detected	= amdgpu_pci_error_detected,
15668c2ecf20Sopenharmony_ci	.mmio_enabled	= amdgpu_pci_mmio_enabled,
15678c2ecf20Sopenharmony_ci	.slot_reset	= amdgpu_pci_slot_reset,
15688c2ecf20Sopenharmony_ci	.resume		= amdgpu_pci_resume,
15698c2ecf20Sopenharmony_ci};
15708c2ecf20Sopenharmony_ci
15718c2ecf20Sopenharmony_cistatic struct pci_driver amdgpu_kms_pci_driver = {
15728c2ecf20Sopenharmony_ci	.name = DRIVER_NAME,
15738c2ecf20Sopenharmony_ci	.id_table = pciidlist,
15748c2ecf20Sopenharmony_ci	.probe = amdgpu_pci_probe,
15758c2ecf20Sopenharmony_ci	.remove = amdgpu_pci_remove,
15768c2ecf20Sopenharmony_ci	.shutdown = amdgpu_pci_shutdown,
15778c2ecf20Sopenharmony_ci	.driver.pm = &amdgpu_pm_ops,
15788c2ecf20Sopenharmony_ci	.err_handler = &amdgpu_pci_err_handler,
15798c2ecf20Sopenharmony_ci};
15808c2ecf20Sopenharmony_ci
15818c2ecf20Sopenharmony_cistatic int __init amdgpu_init(void)
15828c2ecf20Sopenharmony_ci{
15838c2ecf20Sopenharmony_ci	int r;
15848c2ecf20Sopenharmony_ci
15858c2ecf20Sopenharmony_ci	if (vgacon_text_force()) {
15868c2ecf20Sopenharmony_ci		DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
15878c2ecf20Sopenharmony_ci		return -EINVAL;
15888c2ecf20Sopenharmony_ci	}
15898c2ecf20Sopenharmony_ci
15908c2ecf20Sopenharmony_ci	r = amdgpu_sync_init();
15918c2ecf20Sopenharmony_ci	if (r)
15928c2ecf20Sopenharmony_ci		goto error_sync;
15938c2ecf20Sopenharmony_ci
15948c2ecf20Sopenharmony_ci	r = amdgpu_fence_slab_init();
15958c2ecf20Sopenharmony_ci	if (r)
15968c2ecf20Sopenharmony_ci		goto error_fence;
15978c2ecf20Sopenharmony_ci
15988c2ecf20Sopenharmony_ci	DRM_INFO("amdgpu kernel modesetting enabled.\n");
15998c2ecf20Sopenharmony_ci	kms_driver.num_ioctls = amdgpu_max_kms_ioctl;
16008c2ecf20Sopenharmony_ci	amdgpu_register_atpx_handler();
16018c2ecf20Sopenharmony_ci
16028c2ecf20Sopenharmony_ci	/* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
16038c2ecf20Sopenharmony_ci	amdgpu_amdkfd_init();
16048c2ecf20Sopenharmony_ci
16058c2ecf20Sopenharmony_ci	/* let modprobe override vga console setting */
16068c2ecf20Sopenharmony_ci	return pci_register_driver(&amdgpu_kms_pci_driver);
16078c2ecf20Sopenharmony_ci
16088c2ecf20Sopenharmony_cierror_fence:
16098c2ecf20Sopenharmony_ci	amdgpu_sync_fini();
16108c2ecf20Sopenharmony_ci
16118c2ecf20Sopenharmony_cierror_sync:
16128c2ecf20Sopenharmony_ci	return r;
16138c2ecf20Sopenharmony_ci}
16148c2ecf20Sopenharmony_ci
16158c2ecf20Sopenharmony_cistatic void __exit amdgpu_exit(void)
16168c2ecf20Sopenharmony_ci{
16178c2ecf20Sopenharmony_ci	amdgpu_amdkfd_fini();
16188c2ecf20Sopenharmony_ci	pci_unregister_driver(&amdgpu_kms_pci_driver);
16198c2ecf20Sopenharmony_ci	amdgpu_unregister_atpx_handler();
16208c2ecf20Sopenharmony_ci	amdgpu_sync_fini();
16218c2ecf20Sopenharmony_ci	amdgpu_fence_slab_fini();
16228c2ecf20Sopenharmony_ci	mmu_notifier_synchronize();
16238c2ecf20Sopenharmony_ci}
16248c2ecf20Sopenharmony_ci
16258c2ecf20Sopenharmony_cimodule_init(amdgpu_init);
16268c2ecf20Sopenharmony_cimodule_exit(amdgpu_exit);
16278c2ecf20Sopenharmony_ci
16288c2ecf20Sopenharmony_ciMODULE_AUTHOR(DRIVER_AUTHOR);
16298c2ecf20Sopenharmony_ciMODULE_DESCRIPTION(DRIVER_DESC);
16308c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL and additional rights");
1631