OSDN Git Service

tomoyo/tomoyo-test1.git
13 months agodrm/amdgpu: Add memory partition mem_id to amdgpu_bo
Philip Yang [Thu, 26 Jan 2023 23:25:28 +0000 (18:25 -0500)]
drm/amdgpu: Add memory partition mem_id to amdgpu_bo

Add mem_id_plus1 parameter to amdgpu_gem_object_create and pass it to
amdgpu_bo_create. For dGPU mode allocation, mem_id is used by VRAM
manager to get the memory partition fpfn, lpfn from xcp manager. For APU
native mode allocation, mem_id is used to get NUMA node id from xcp
manager, then pass to TTM as numa pool id to alloc memory from the
specific NUMA node. mem_id -1 means for entire VRAM or any NUMA nodes.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Show KFD node memory partition info
Philip Yang [Thu, 26 Jan 2023 23:11:29 +0000 (18:11 -0500)]
drm/amdkfd: Show KFD node memory partition info

Show KFD node memory partition id and size, add helper function
KFD_XCP_MEMORY_SIZE to get kfd node memory size, will be used
later to support memory accounting per partition.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add memory partition id to amdgpu_vm
Philip Yang [Fri, 24 Feb 2023 00:58:22 +0000 (19:58 -0500)]
drm/amdgpu: Add memory partition id to amdgpu_vm

If xcp_mgr is initialized, add mem_id to amdgpu_vm structure to store
memory partition number when creating amdgpu_vm for the xcp. The xcp
number is decided when opening the render device, for example
/dev/dri/renderD129 is xcp_id 0, /dev/dri/renderD130 is xcp_id 1.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Store drm node minor number for kfd nodes
Philip Yang [Thu, 23 Feb 2023 16:03:37 +0000 (11:03 -0500)]
drm/amdkfd: Store drm node minor number for kfd nodes

From KFD topology, application will find kfd node with the corresponding
drm device node minor number, for example if partition drm node starts
from /dev/dri/renderD129, then KFD node 0 with store drm node minor
number 129. Application will open drm node /dev/dri/renderD129 to create
amdgpu vm for kfd node 0 with the correct vm->mem_id to indicate the
memory partition.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add xcp manager num_xcp_per_mem_partition
Philip Yang [Sat, 4 Mar 2023 00:45:45 +0000 (19:45 -0500)]
drm/amdgpu: Add xcp manager num_xcp_per_mem_partition

Used by KFD to check memory limit accounting.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: update ref_cnt before ctx free
James Zhu [Mon, 15 Aug 2022 21:21:44 +0000 (17:21 -0400)]
drm/amdgpu: update ref_cnt before ctx free

Update ref_cnt before ctx free.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: run partition schedule if it is supported
James Zhu [Mon, 15 Aug 2022 21:15:02 +0000 (17:15 -0400)]
drm/amdgpu: run partition schedule if it is supported

Run partition schedule if it is supported during ctx init entity.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add partition schedule for GC(9, 4, 3)
James Zhu [Mon, 15 Aug 2022 21:00:54 +0000 (17:00 -0400)]
drm/amdgpu: add partition schedule for GC(9, 4, 3)

Implement partition schedule for GC(9, 4, 3).

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: keep amdgpu_ctx_mgr in ctx structure
James Zhu [Mon, 15 Aug 2022 21:12:01 +0000 (17:12 -0400)]
drm/amdgpu: keep amdgpu_ctx_mgr in ctx structure

Keep amdgpu_ctx_mgr in ctx structure to track fpriv.

v2: add missing fpriv declaration lost in rebase

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add partition scheduler list update
James Zhu [Mon, 15 Aug 2022 21:19:11 +0000 (17:19 -0400)]
drm/amdgpu: add partition scheduler list update

Add partition scheduler list update in late init
and xcp partition mode switch.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: update header to support partition scheduling
James Zhu [Mon, 15 Aug 2022 20:55:02 +0000 (16:55 -0400)]
drm/amdgpu: update header to support partition scheduling

Update header to support partition scheduling.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add partition ID track in ring
James Zhu [Mon, 15 Aug 2022 20:45:12 +0000 (16:45 -0400)]
drm/amdgpu: add partition ID track in ring

Keep track partition ID in ring.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: find partition ID when open device
James Zhu [Tue, 28 Feb 2023 19:16:38 +0000 (14:16 -0500)]
drm/amdgpu: find partition ID when open device

Find partition ID when open device from render device minor.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-and-tested-by: Philip Yang<Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: support partition drm devices
James Zhu [Mon, 15 Aug 2022 20:55:02 +0000 (16:55 -0400)]
drm/amdgpu: support partition drm devices

Support partition drm devices on GC_HWIP IP_VERSION(9, 4, 3).

This is a temporary solution and will be superceded.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-and-tested-by: Philip Yang<Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/bu: update mtype_local parameter settings
Graham Sider [Mon, 6 Mar 2023 22:56:44 +0000 (17:56 -0500)]
drm/amdgpu/bu: update mtype_local parameter settings

Update mtype_local module parameter to use MTYPE_RW by default.

0: MTYPE_RW (default)
1: MTYPE_NC
2: MTYPE_CC

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/bu: add mtype_local as a module parameter
David Francis [Mon, 27 Feb 2023 15:33:11 +0000 (10:33 -0500)]
drm/amdgpu/bu: add mtype_local as a module parameter

Selects the MTYPE to be used for local memory,
(0 = MTYPE_CC (default), 1 = MTYPE_NC, 2 = MTYPE_RW)

v2: squash in build fix (Alex)

Reviewed-by: Graham Sider <Graham.Sider@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Override MTYPE per page on GFXv9.4.3 APUs
Felix Kuehling [Tue, 21 Feb 2023 22:44:18 +0000 (17:44 -0500)]
drm/amdgpu: Override MTYPE per page on GFXv9.4.3 APUs

On GFXv9.4.3 NUMA APUs, system memory locality must be determined per
page to choose the correct MTYPE. This patch adds a GMC callback that
can provide this per-page override and implements it for native mode.

Carve-out mode is not yet supported and will use the safe default
(remote) MTYPE for system memory.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-and-tested-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix per-BO MTYPE selection for GFXv9.4.3
Felix Kuehling [Tue, 21 Feb 2023 22:31:32 +0000 (17:31 -0500)]
drm/amdgpu: Fix per-BO MTYPE selection for GFXv9.4.3

Treat system memory on NUMA systems as remote by default. Overriding with
a more efficient MTYPE per page will be implemented in the next patch.

No need for a special case for APP APUs. System memory is handled the same
for carve-out and native mode. And VRAM doesn't exist in native mode.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-and-tested-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/bu: Add use_mtype_cc_wa module param
Graham Sider [Mon, 6 Feb 2023 19:04:42 +0000 (14:04 -0500)]
drm/amdgpu/bu: Add use_mtype_cc_wa module param

By default, set use_mtype_cc_wa to 1 to set PTE coherence flag MTYPE_CC
instead of MTYPE_RW by default. This is required for the time being to
mitigate a bug causing XCCs to hit stale data due to TCC marking fully
dirty lines as exclusive.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Joseph Greathouse <Joseph.Greathouse@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Use legacy TLB flush for gfx943
Graham Sider [Wed, 8 Feb 2023 16:10:57 +0000 (11:10 -0500)]
drm/amdgpu: Use legacy TLB flush for gfx943

Invalidate TLBs via a legacy flush request (flush_type=0) prior to the
heavyweight flush requests (flush_type=2) in gmc_v9_0.c. This is
temporarily required to mitigate a bug causing CPC UTCL1 to return stale
translations after invalidation requests in address range mode.

v2: squash in long term fix "drm/amdgpu: disable extra gfx943 legacy flush on rev1+"

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: For GFX 9.4.3 APU fix vram_usage value
Harish Kasiviswanathan [Fri, 28 Apr 2023 18:20:00 +0000 (14:20 -0400)]
drm/amdgpu: For GFX 9.4.3 APU fix vram_usage value

For GFX 9.4.3 APP APU VRAM is allocated in GTT domain. While freeing
memory check for GTT domain instead of VRAM if it is APP APU

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Enable NPS4 CPX mode
Philip Yang [Wed, 19 Apr 2023 21:43:26 +0000 (17:43 -0400)]
drm/amdgpu: Enable NPS4 CPX mode

CPX compute mode is valid mode for NPS4 memory partition mode.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Move pgmap to amdgpu_kfd_dev structure
Philip Yang [Fri, 31 Mar 2023 15:13:40 +0000 (11:13 -0400)]
drm/amdkfd: Move pgmap to amdgpu_kfd_dev structure

VRAM pgmap resource is allocated every time when switching compute
partitions because kfd_dev is re-initialized by post_partition_switch,
As a result, it causes memory region resource leaking and system
memory usage accounting unbalanced.

pgmap resource should be allocated and registered only once when loading
driver and freed when unloading driver, move it from kfd_dev to
amdgpu_kfd_dev.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Skip halting RLC on GFX v9.4.3
Lijo Lazar [Fri, 24 Mar 2023 09:51:30 +0000 (15:21 +0530)]
drm/amdgpu: Skip halting RLC on GFX v9.4.3

RLC-PMFW handshake happens periodically when GFXCLK DPM is enabled and
halting RLC may cause unexpected results. Avoid halting RLC from driver
side.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix register accesses in GFX v9.4.3
Lijo Lazar [Thu, 16 Mar 2023 09:29:27 +0000 (14:59 +0530)]
drm/amdgpu: Fix register accesses in GFX v9.4.3

Access registers with the right xcc id. Also, remove the unused logic as
PG is not used in GFX v9.4.3

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Increase queue number per process to 255 on GFX9.4.3
Mukul Joshi [Wed, 15 Mar 2023 18:04:33 +0000 (14:04 -0400)]
drm/amdkfd: Increase queue number per process to 255 on GFX9.4.3

Increase the maximum number of queues that can be created per process
to 255 on GFX 9.4.3. There is no HWS limitation restricting the number
queues that can be created.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Adjust the sequence to query ras error info
Hawking Zhang [Mon, 20 Mar 2023 09:51:30 +0000 (17:51 +0800)]
drm/amdgpu: Adjust the sequence to query ras error info

It turns out STATUS_VALID_FLAG needs to be checked
ahead of any other fields. ADDRESS_VALID_FLAG and
ERR_INFO_VALID_FLAG only manages ADDRESS and ERR_INFO
field respectively. driver should continue poll
ERR CNT field even ERR_INFO_VALD_FLAG is not set.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Initialize jpeg v4_0_3 ras function
Hawking Zhang [Mon, 6 Mar 2023 03:03:27 +0000 (11:03 +0800)]
drm/amdgpu: Initialize jpeg v4_0_3 ras function

Initialize jpeg v4_0_3 ras function.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add reset_ras_error_count for jpeg v4_0_3
Hawking Zhang [Thu, 2 Mar 2023 10:04:24 +0000 (18:04 +0800)]
drm/amdgpu: Add reset_ras_error_count for jpeg v4_0_3

Add reset_ras_error_count callback for jpeg v4_0_3.
It will be used to reset jpeg ras error count.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add query_ras_error_count for jpeg v4_0_3
Hawking Zhang [Thu, 2 Mar 2023 09:56:59 +0000 (17:56 +0800)]
drm/amdgpu: Add query_ras_error_count for jpeg v4_0_3

Add query_ras_error_count callback for jpeg v4_0_3.
It will be used to query and log jpeg error count.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Re-enable VCN RAS if DPG is enabled
Hawking Zhang [Thu, 2 Mar 2023 08:38:38 +0000 (16:38 +0800)]
drm/amdgpu: Re-enable VCN RAS if DPG is enabled

VCN RAS enablement sequence needs to be added in
DPG HW init sequence.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Initialize vcn v4_0_3 ras function
Hawking Zhang [Mon, 6 Mar 2023 03:00:11 +0000 (11:00 +0800)]
drm/amdgpu: Initialize vcn v4_0_3 ras function

Initialize vcn v4_0_3 ras function

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add reset_ras_error_count for vcn v4_0_3
Hawking Zhang [Thu, 2 Mar 2023 06:23:47 +0000 (14:23 +0800)]
drm/amdgpu: Add reset_ras_error_count for vcn v4_0_3

Add reset_ras_error_count callback for vcn v4_0_3.
It will be used to reset vcn ras error count.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add query_ras_error_count for vcn v4_0_3
Hawking Zhang [Wed, 1 Mar 2023 12:37:56 +0000 (20:37 +0800)]
drm/amdgpu: Add query_ras_error_count for vcn v4_0_3

Add query_ras_error_count callback for vcn v4_0_3.
It will be used to query and log vcn error count.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add vcn/jpeg ras err status registers
Hawking Zhang [Wed, 1 Mar 2023 02:05:17 +0000 (10:05 +0800)]
drm/amdgpu: Add vcn/jpeg ras err status registers

Add new ras error status registers introduced in
vcn v4_0_3 to log vcn and jpeg ras error.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Checked if the pointer NULL before use it.
Gavin Wan [Fri, 17 Mar 2023 22:42:30 +0000 (18:42 -0400)]
drm/amdgpu: Checked if the pointer NULL before use it.

For SRIOV on some parts, the host driver does not post VBIOS. So the guest
cannot get bios information. Therefore, adev->virt.fw_reserve.p_pf2vf
and adev->mode_info.atom_context are NULL.

Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
Reviewed-by: Zhigang Luo <Zhigang.Luo@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Set memory partitions to 1 for SRIOV.
Gavin Wan [Mon, 10 Apr 2023 19:04:26 +0000 (15:04 -0400)]
drm/amdgpu: Set memory partitions to 1 for SRIOV.

For SRIOV, the memory partitions are set on host drover. Each VF only
has one memory partition. We need set the memory partitions to 1 on
guest driver for SRIOV.

V2: sqaush in fix ("drm/amdgpu: Fix memory range info of GC 9.4.3 VFs")

Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
Acked-by: Zhigang Luo <zhigang.luo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Skip using MC FB Offset when APU flag is set for SRIOV.
Gavin Wan [Mon, 3 Apr 2023 21:49:41 +0000 (17:49 -0400)]
drm/amdgpu: Skip using MC FB Offset when APU flag is set for SRIOV.

The MC_VM_FB_OFFSET is PF only register. It cannot be read on VF.
So, the driver should not use MC_VM_FB_OFFSET address to set the
address of dev->gmc.aper_base.

Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
Reviewed-by: Zhigang Luo <zhigang.luo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add PSP supporting PSP 13.0.6 SRIOV ucode init.
Gavin Wan [Thu, 16 Mar 2023 17:44:41 +0000 (13:44 -0400)]
drm/amdgpu: Add PSP supporting PSP 13.0.6 SRIOV ucode init.

Add PSP supporting PSP 13.0.6 SRIOV ucode init.

Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add PSP spatial parition interface
Lijo Lazar [Fri, 10 Mar 2023 10:08:19 +0000 (15:38 +0530)]
drm/amdgpu: Add PSP spatial parition interface

Add PSP ring command interface for spatial partitioning.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Return error on invalid compute mode
Lijo Lazar [Tue, 7 Mar 2023 05:06:08 +0000 (10:36 +0530)]
drm/amdgpu: Return error on invalid compute mode

Return error if an invalid compute partition mode is requested.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add compute mode descriptor function
Lijo Lazar [Tue, 7 Mar 2023 05:03:05 +0000 (10:33 +0530)]
drm/amdgpu: Add compute mode descriptor function

Keep a helper function to get description of compute partition mode.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix unmapping of aperture
Lijo Lazar [Fri, 3 Mar 2023 12:33:00 +0000 (18:03 +0530)]
drm/amdgpu: Fix unmapping of aperture

When aperture size is zero, there is no mapping done.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix xGMI access P2P mapping failure on GFXIP 9.4.3
Rajneesh Bhardwaj [Mon, 27 Feb 2023 18:17:14 +0000 (13:17 -0500)]
drm/amdgpu: Fix xGMI access P2P mapping failure on GFXIP 9.4.3

On GFXIP 9.4.3, we dont need to rely on xGMI hive info to determine P2P
access.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-and-tested-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Native mode memory partition support
Rajneesh Bhardwaj [Tue, 28 Feb 2023 01:08:29 +0000 (20:08 -0500)]
drm/amdkfd: Native mode memory partition support

For native mode, after amdgpu_bo is created on CPU domain, then call
amdgpu_ttm_tt_set_mem_pool to select the TTM pool using bo->mem_id.
ttm_bo_validate will allocate the memory to the correct memory partition
before mapping to GPUs.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-and-tested-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Set TTM pools for memory partitions
Philip Yang [Mon, 27 Feb 2023 16:16:09 +0000 (11:16 -0500)]
drm/amdgpu: Set TTM pools for memory partitions

For native mode only, create TTM pool for each memory partition to store
the NUMA node id, then the TTM pool will be selected using memory
partition id to allocate memory from the correct partition.

Acked-by: Christian König <christian.koenig@amd.com>
(rajneesh: changed need_swiotlb and need_dma32 to false for pool init)
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-and-tested-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/ttm: export ttm_pool_fini for cleanup
Rajneesh Bhardwaj [Tue, 14 Feb 2023 04:51:07 +0000 (23:51 -0500)]
drm/ttm: export ttm_pool_fini for cleanup

ttm_pool_init is exported and used outside of ttm subsystem with
amdgpu_ttm interface, similarly export ttm_pool_fini for proper cleanup.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add auto mode for compute partition
Lijo Lazar [Mon, 13 Feb 2023 13:56:18 +0000 (19:26 +0530)]
drm/amdgpu: Add auto mode for compute partition

When auto mode is specified, driver will choose the right compute
partition mode.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Reviewed-by: Philip Yang <philip.yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Check memory ranges for valid xcp mode
Lijo Lazar [Mon, 13 Feb 2023 13:20:07 +0000 (18:50 +0530)]
drm/amdgpu: Check memory ranges for valid xcp mode

Check the memory ranges available to the device also for deciding a
valid partition mode. Only select combinations are valid for a
particular mode.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Reviewed-by: Philip Yang <philip.yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Use xcc mask for identifying xcc
Lijo Lazar [Thu, 9 Feb 2023 11:00:53 +0000 (16:30 +0530)]
drm/amdkfd: Use xcc mask for identifying xcc

Instead of start xcc id and number of xcc per node, use the xcc mask
which is the mask of logical ids of xccs belonging to a parition.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Add xcp reference to kfd node
Lijo Lazar [Thu, 9 Feb 2023 09:14:13 +0000 (14:44 +0530)]
drm/amdkfd: Add xcp reference to kfd node

Fetch xcp information from xcp_mgr and also add xcc_mask to kfd node.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Move initialization of xcp before kfd
Lijo Lazar [Fri, 3 Feb 2023 13:16:40 +0000 (18:46 +0530)]
drm/amdgpu: Move initialization of xcp before kfd

After partition switch, fill all relevant xcp information before kfd
starts initialization.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fill xcp mem node in aquavanjaram
Lijo Lazar [Fri, 3 Feb 2023 11:44:12 +0000 (17:14 +0530)]
drm/amdgpu: Fill xcp mem node in aquavanjaram

Implement callbacks to fill memory node information in aquavanjaram.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add callback to fill xcp memory id
Lijo Lazar [Fri, 3 Feb 2023 11:42:10 +0000 (17:12 +0530)]
drm/amdgpu: Add callback to fill xcp memory id

Add callback in xcp interface to fill xcp memory id information. Memory
id is used to identify the range/partition of an XCP from the available
memory partitions in device. Also, fill the id information.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Initialize memory ranges for GC 9.4.3
Lijo Lazar [Tue, 14 Feb 2023 09:15:45 +0000 (14:45 +0530)]
drm/amdgpu: Initialize memory ranges for GC 9.4.3

GC 9.4.3 ASICS may have memory split into multiple partitions.Initialize
the memory partition information for each range. The information may be
in the form of a numa node id or a range of pages.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add memory partitions to gmc
Lijo Lazar [Tue, 14 Feb 2023 09:07:53 +0000 (14:37 +0530)]
drm/amdgpu: Add memory partitions to gmc

Some ASICs have the device memory divided into multiple partitions. The
parititions could be denoted by a numa node or by a range of pages.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add API to get numa information of XCC
Lijo Lazar [Tue, 14 Feb 2023 13:29:40 +0000 (18:59 +0530)]
drm/amdgpu: Add API to get numa information of XCC

Add interface to get numa information of ACPI XCC object. The interface
uses logical id to identify an XCC.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Store additional numa node information
Lijo Lazar [Tue, 14 Feb 2023 13:03:51 +0000 (18:33 +0530)]
drm/amdgpu: Store additional numa node information

Use a struct to store additional numa node information including size
and base address. Add numa_info pointer to xcc object to point to the
relevant structure based on its proximity domain.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Get supported memory partition modes
Lijo Lazar [Fri, 17 Feb 2023 04:02:44 +0000 (09:32 +0530)]
drm/amdgpu: Get supported memory partition modes

Expand the interface to get supported memory partition modes also along
with the current memory partition mode.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Move memory partition query to gmc
Lijo Lazar [Tue, 31 Jan 2023 07:09:49 +0000 (12:39 +0530)]
drm/amdgpu: Move memory partition query to gmc

GMC block handles memory related information, it makes more sense to
keep memory partition functions in gmc block.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add utility functions for xcp
Lijo Lazar [Wed, 25 Jan 2023 14:34:52 +0000 (20:04 +0530)]
drm/amdgpu: Add utility functions for xcp

Add utility functions to get details of xcp and iterate through
available xcps.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Use apt name for FW reserved region
Lijo Lazar [Fri, 24 Feb 2023 12:31:38 +0000 (18:01 +0530)]
drm/amdgpu: Use apt name for FW reserved region

Use the generic term fw_reserved_memory for FW reserve region. This
region may also hold discovery TMR in addition to other reserve
regions. This region size could be larger than discovery tmr size, hence
don't change the discovery tmr size based on this.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Use GPU VA space for IH v4.4.2 in APU
Lijo Lazar [Thu, 23 Feb 2023 14:43:56 +0000 (20:13 +0530)]
drm/amdgpu: Use GPU VA space for IH v4.4.2 in APU

For IH ring buffer and read/write pointers, use GPU VA space rather than
Guest PA on APU configs. Access through Guest PA doesn't work when IOMMU
is enabled. It is also beneficial in NUMA configs as it allocates from
the closest numa pool in a numa enabled system.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Simplify aquavanjram instance mapping
Lijo Lazar [Mon, 20 Feb 2023 06:34:30 +0000 (12:04 +0530)]
drm/amdgpu: Simplify aquavanjram instance mapping

Simplify so as to use the same sequence to assign logical to physical
ids for all IPs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/vcn: Use buffer object's deletion logic
Lijo Lazar [Wed, 8 Mar 2023 07:11:22 +0000 (12:41 +0530)]
drm/amdgpu/vcn: Use buffer object's deletion logic

VCN DPG buffer object is intialized to NULL. If allotted, buffer object
deletion logic will take care of NULL check and delete accordingly. This
is useful for cases where indirect sram flag could be manipulated later
after buffer allocation.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Use a different value than 0xDEADBEEF for jpeg ring test
Sonny Jiang [Fri, 24 Mar 2023 21:44:59 +0000 (17:44 -0400)]
drm/amdgpu: Use a different value than 0xDEADBEEF for jpeg ring test

The 0xDEADBEEF standard anti-hang value. Use it may cause
fake pass.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add a read after write DB_CTRL for vcn_v4_0_3
Sonny Jiang [Tue, 28 Mar 2023 17:19:11 +0000 (13:19 -0400)]
drm/amdgpu: Add a read after write DB_CTRL for vcn_v4_0_3

To make sure VCN DB_CTRL is delivered before doorbell write.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: fixes a JPEG get write/read pointer bug
Sonny Jiang [Wed, 22 Mar 2023 19:49:29 +0000 (15:49 -0400)]
drm/amdgpu: fixes a JPEG get write/read pointer bug

Need parentheses for the micro parameters.

Signed-off-by: Sonny Jiang <sonjiang@amd.com>
Reviewed-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: A workaround for JPEG_v4_0_3 ring test fail
Sonny Jiang [Mon, 20 Mar 2023 20:17:21 +0000 (16:17 -0400)]
drm/amdgpu: A workaround for JPEG_v4_0_3 ring test fail

The jpeg_v4_0_3 jpeg_pitch register uses UVD_JRBC_SCRATCH0. It needs to
move WREG() to after jpeg_start.
Switch to a posted register write when doing the ring test to make sure
the register write lands before we test the result.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: use physical AID index for ring name
James Zhu [Wed, 15 Mar 2023 08:09:25 +0000 (04:09 -0400)]
drm/amdgpu: use physical AID index for ring name

Use physical AID index for VCN/JPEG ring name instead of
logical AID index.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Sonny Jiang <sonny.jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/vcn: use dummy register selects AID for VCN_RAM ucode
James Zhu [Wed, 15 Mar 2023 07:54:55 +0000 (03:54 -0400)]
drm/amdgpu/vcn: use dummy register selects AID for VCN_RAM ucode

Use dummy register 0xDEADBEEF selects AID for PSP VCN_RAM ucode.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Sonny Jiang <sonny.jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix harvest reporting of VCN
Lijo Lazar [Mon, 27 Feb 2023 10:37:39 +0000 (16:07 +0530)]
drm/amdgpu: Fix harvest reporting of VCN

Use VCN instance mask to check if an instance is harvested or not.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Use logical ids for VCN/JPEG v4.0.3
Lijo Lazar [Fri, 17 Feb 2023 14:11:06 +0000 (19:41 +0530)]
drm/amdgpu: Use logical ids for VCN/JPEG v4.0.3

Address VCN/JPEG instances using logical ids. Whenever register access is
required, get the physical instance using GET_INST.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add VCN logical to physical id mapping
Lijo Lazar [Fri, 17 Feb 2023 13:14:20 +0000 (18:44 +0530)]
drm/amdgpu: Add VCN logical to physical id mapping

Add mappings for logical to physical id for VCN/JPEG 4.0.3

v2: make local function static (Alex)

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add instance mask for VCN and JPEG
Lijo Lazar [Fri, 17 Feb 2023 12:57:51 +0000 (18:27 +0530)]
drm/amdgpu: Add instance mask for VCN and JPEG

Keep an instance mask formed by physical instance numbers for VCN and JPEG
IPs. Populate the mask from discovery table information.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Load vcn_v4_0_3 ucode during early_init
Sonny Jiang [Wed, 15 Feb 2023 18:56:57 +0000 (13:56 -0500)]
drm/amdgpu: Load vcn_v4_0_3 ucode during early_init

VCN loading ucode is moved to early_init with using 'amdgpu_ucode_*'
helpers.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Sonny Jiang <sonjiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: preserve the num_links in case of reflection
Shiwu Zhang [Mon, 13 Feb 2023 07:45:42 +0000 (15:45 +0800)]
drm/amdgpu: preserve the num_links in case of reflection

For topology reflection, each socket to every other socket has the
exactly same topology info as the other way around. So it is safe
to keep the reflected num_links value otherwise it will be overriden
by the link info output of GET_PEER_LINKS command.

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix discovery sys node harvest info
Lijo Lazar [Fri, 10 Feb 2023 06:35:59 +0000 (12:05 +0530)]
drm/amdgpu: Fix discovery sys node harvest info

Initalize syfs nodes after harvest information is fetched and fetch the
correct harvest info based on each IP instance.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Flush TLB after unmapping for GFX v9.4.3
Philip Yang [Thu, 9 Feb 2023 23:23:16 +0000 (18:23 -0500)]
drm/amdkfd: Flush TLB after unmapping for GFX v9.4.3

kfd_flush_tlb_after_unmap should return true for GFX v9.4.3, to do TLB
heavyweight flush after unmapping from GPU to guarantee that the GPU
will not access pages after they have been unmapped. This also helps
improve the mapping to GPU performance.

Without this, KFD accidently flush TLB after mapping to GPU because the
vm update sequence number is increased by previous unmapping.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add fallback path for discovery info
Lijo Lazar [Mon, 30 Jan 2023 04:18:39 +0000 (09:48 +0530)]
drm/amdgpu: Add fallback path for discovery info

If SOC doesn't expose dedicated vram, discovery region may be
available through system memory. Rename the existing interface to
generic read_binary_from_mem and add a fallback path to read from system
memory.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Read discovery info from system memory
Lijo Lazar [Mon, 30 Jan 2023 04:08:09 +0000 (09:38 +0530)]
drm/amdgpu: Read discovery info from system memory

On certain ASICs, discovery info is available at reserved region in system
memory. The location is available through ACPI interface. Add API to read
discovery info from there.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add API to get tmr info from acpi
Lijo Lazar [Fri, 27 Jan 2023 13:10:14 +0000 (18:40 +0530)]
drm/amdgpu: Add API to get tmr info from acpi

In certain configs, TMR information is available from ACPI. Add API to
fetch the information.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add parsing of acpi xcc objects
Lijo Lazar [Fri, 27 Jan 2023 12:48:17 +0000 (18:18 +0530)]
drm/amdgpu: Add parsing of acpi xcc objects

Add parsing of ACPI xcc objects and fill in relevant info from them by
invoking the DSM methods.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-and-tested-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: Enable SVM on Native mode
Mukul Joshi [Tue, 31 Jan 2023 16:23:50 +0000 (11:23 -0500)]
drm/amdkfd: Enable SVM on Native mode

This patch enables SVM capability on GFX9.4.3 when
run in Native mode. It also sets best_prefetch and
best_restore locations to CPU as there is no VRAM.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add FGCG for GFX v9.4.3
Lijo Lazar [Thu, 2 Feb 2023 09:43:12 +0000 (15:13 +0530)]
drm/amdgpu: Add FGCG for GFX v9.4.3

It's not fine grain, behaves similar to MGCG.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Use transient mode during xcp switch
Lijo Lazar [Fri, 20 Jan 2023 10:23:47 +0000 (15:53 +0530)]
drm/amdgpu: Use transient mode during xcp switch

During partition switch, keep the state as transient mode. Fetch the
latest state if switch fails.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add flags for partition mode query
Lijo Lazar [Mon, 16 Jan 2023 05:25:38 +0000 (10:55 +0530)]
drm/amdgpu: Add flags for partition mode query

It's not required to take lock on all cases while querying partition
mode. Querying partition mode during KFD init process doesn't need to
take a lock. Init process after a switch will already be happening under
lock. Control the behaviour by adding flags to xcp_query_partition_mode.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: fix wrong smu socclk value
Yang Wang [Thu, 27 Apr 2023 02:36:51 +0000 (10:36 +0800)]
drm/amd/pm: fix wrong smu socclk value

fix typo about smu socclk value.

Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add mode-2 reset in SMU v13.0.6
Lijo Lazar [Thu, 9 Mar 2023 07:34:56 +0000 (13:04 +0530)]
drm/amdgpu: Add mode-2 reset in SMU v13.0.6

Modifications to mode-2 reset flow for SMU v13.0.6 ASICs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Notify PMFW about driver unload cases
Lijo Lazar [Fri, 10 Mar 2023 06:03:37 +0000 (11:33 +0530)]
drm/amd/pm: Notify PMFW about driver unload cases

On SMU v13.0.6 APUs, FW will need to take some actions if driver is going
to halt RLC. Notify PMFW that driver is not going to manage device so
that FW takes care of the required actions.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Update PMFW headers for version 85.54
Lijo Lazar [Fri, 10 Mar 2023 12:41:25 +0000 (18:11 +0530)]
drm/amd/pm: Update PMFW headers for version 85.54

It adds message support for FW notification on driver unload.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Expose mem temperature for GC version 9.4.3
Asad Kamal [Wed, 8 Mar 2023 14:30:58 +0000 (22:30 +0800)]
drm/amd/pm: Expose mem temperature for GC version 9.4.3

Add mem temperature as part of hw mon attributes for GC version 9.4.3

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Update hw mon attributes for GC version 9.4.3
Asad Kamal [Fri, 3 Mar 2023 04:20:21 +0000 (12:20 +0800)]
drm/amd/pm: Update hw mon attributes for GC version 9.4.3

Update hw mon attributes for GC Version 9.4.3 to valid ones
on APU and Non APU systems

v2: Group checks along existing one
Added power limit & mclock for gc version 9.4.3

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Initialize power limit for SMU v13.0.6
Lijo Lazar [Mon, 27 Feb 2023 11:21:16 +0000 (16:51 +0530)]
drm/amd/pm: Initialize power limit for SMU v13.0.6

PMFW will initialize the power limit values even if PPT throttler
feature is disabled. Fetch the limit value from FW.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Keep interface version in PMFW header
Lijo Lazar [Tue, 21 Feb 2023 09:17:51 +0000 (14:47 +0530)]
drm/amd/pm: Keep interface version in PMFW header

Use the interface version directly from PMFW interface header file rather
than keeping another definition in common smu13 file.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Add ih for SMU v13.0.6 thermal throttling
Asad kamal [Wed, 15 Feb 2023 07:53:15 +0000 (15:53 +0800)]
drm/amd/pm: Add ih for SMU v13.0.6 thermal throttling

Add interrupt handler for thermal throttler events from
PMFW on SMUv13.0.6

Signed-off-by: Asad kamal <asad.kamal@amd.com>
Acked-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Update pmfw header files for SMU v13.0.6
Asad kamal [Mon, 13 Feb 2023 11:52:56 +0000 (19:52 +0800)]
drm/amd/pm: Update pmfw header files for SMU v13.0.6

Update driver interface for SMU v13.0.6 to be
compatible with PMFW v85.48 version

Signed-off-by: Asad kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Update gfx clock frequency for SMU v13.0.6
Asad kamal [Wed, 8 Feb 2023 15:04:25 +0000 (23:04 +0800)]
drm/amd/pm: Update gfx clock frequency for SMU v13.0.6

Update gfx clock frequency from metric table for SMU v13.0.6

Signed-off-by: Asad kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Update pmfw header files for SMU v13.0.6
Asad kamal [Wed, 8 Feb 2023 12:19:13 +0000 (20:19 +0800)]
drm/amd/pm: Update pmfw header files for SMU v13.0.6

Update driver metrics table for SMU v13.0.6 to be
compatible with PMFW v85.47 version

Signed-off-by: Asad kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: fix sdma instance
Stanley.Yang [Wed, 22 Mar 2023 03:16:53 +0000 (11:16 +0800)]
drm/amdgpu: fix sdma instance

It should change logical instance to device instance
to query ras info

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>