[PATCH] drm/amdgpu: Add lock around VF RLCG interface

2024-05-27 Thread Victor Skvortsov
flush_gpu_tlb may be called from another thread while device_gpu_recover is running. Both of these threads access registers through the VF RLCG interface during VF Full Access. Add a lock around this interface to prevent race conditions between these threads. Signed-off-by: Victor Skvortsov

[PATCH 2/2] drm/amdgpu: Queue KFD reset workitem in VF FED

2024-05-19 Thread Victor Skvortsov
iate reset request from the guest) inside the pf2vf thread on FED. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c i

[PATCH 1/2] drm/amdgpu: Extend KIQ reg polling wait for VF

2024-05-19 Thread Victor Skvortsov
Runtime KIQ interface to read/write registers in VF may take longer than expected for BM environment. Extend the timeout. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amdgpu: Remove wrong fini_data_exchange call

2024-05-17 Thread Victor Skvortsov
This call is already done inside amdgpu_device_pre_asic_reset. If should_recover_gpu is false, then vf2pf worker thread is permanently killed. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 -- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 2 -- 2 files changed, 4

[PATCH] drm/amdgpu: Skip virt_exchange_init on SDMA poison consumption

2024-03-12 Thread Victor Skvortsov
From: Victor Skvortsov Host will initiate an FLR in SDMA poison consumption scenario. Guest should wait for FLR message to re-init data exchange. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH] drm/amdgpu/: Remove bo_create_kernel_at path from virt page

2024-03-12 Thread Victor Skvortsov
Use amdgpu_vram_mgr to reserve bad page ranges. Reserved ranges will be freed by amdgpu_vram_mgr_fini() Delete bo_create path as it is redundant. Suggested-by: Christian König Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 55 ++-- drivers

[PATCH] drm/amdgpu: Fix wait for RLCG command completion

2022-02-03 Thread Victor Skvortsov
if (!(tmp & flag)) condition will always evaluate to true when the flag is 0x0 (AMDGPU_RLCG_GC_WRITE). Instead check that address bits are cleared to determine whether the command is complete. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +- drivers/gpu

[PATCH v3 5/5] drm/amdgpu: Modify indirect register access for gfx9 sriov

2021-12-16 Thread Victor Skvortsov
Expand RLCG interface for new GC read & write commands. New interface will only be used if the PF enables the flag in pf2vf msg. v2: Added a description for the scratch registers Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 117 -- 1

[PATCH v3 4/5] drm/amdgpu: get xgmi info before ip_init

2021-12-16 Thread Victor Skvortsov
Driver needs to call get_xgmi_info() before ip_init to determine whether it needs to handle a pending hive reset. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 6 -- drivers/gpu/drm/amd/amdgpu

[PATCH v3 3/5] drm/amdgpu: Modify indirect register access for amdkfd_gfx_v9 sriov

2021-12-16 Thread Victor Skvortsov
Modify GC register access from MMIO to RLCG if the indirect flag is set Signed-off-by: Victor Skvortsov --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

[PATCH v3 2/5] drm/amdgpu: Modify indirect register access for gmc_v9_0 sriov

2021-12-16 Thread Victor Skvortsov
Modify GC register access from MMIO to RLCG if the indirect flag is set v2: Replaced ternary operator with if-else for better readability Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 57 --- 1 file changed, 43 insertions(+), 14 deletions

[PATCH v3 1/5] drm/amdgpu: Add *_SOC15_IP_NO_KIQ() macro definitions

2021-12-16 Thread Victor Skvortsov
Add helper macros to change register access from direct to indirect. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/soc15_common.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15_common.h b/drivers/gpu/drm/amd/amdgpu/soc15_common.h

[PATCH v3 0/5] *** GFX9 RLCG Interface modifications ***

2021-12-16 Thread Victor Skvortsov
xgmi_info call to earlier in init. Victor Skvortsov (5): drm/amdgpu: Add *_SOC15_IP_NO_KIQ() macro definitions drm/amdgpu: Modify indirect register access for gmc_v9_0 sriov drm/amdgpu: Modify indirect register access for amdkfd_gfx_v9 sriov drm/amdgpu: get xgmi info before ip_init drm

[PATCH v2] drm/amdgpu: Separate vf2pf work item init from virt data exchange

2021-12-16 Thread Victor Skvortsov
times without re-initializing the work item. v2: Cleaned up the code. Kept the original call to init_exchange_data() inside early init to initialize the work item, afterwards call exchange_data() when needed. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6

[PATCH v2 5/5] drm/amdgpu: Modify indirect register access for gfx9 sriov

2021-12-15 Thread Victor Skvortsov
Expand RLCG interface for new GC read & write commands. New interface will only be used if the PF enables the flag in pf2vf msg. v2: Added a description for the scratch registers Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 117 -- 1

[PATCH v2 4/5] drm/amdgpu: Initialize Aldebaran RLC function pointers

2021-12-15 Thread Victor Skvortsov
In SRIOV, RLC function pointers must be initialized early as we rely on the RLCG interface for all GC register access. v2: Make aldebaran a seperate case Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

[PATCH v2 1/5] drm/amdgpu: Add *_SOC15_IP_NO_KIQ() macro definitions

2021-12-15 Thread Victor Skvortsov
Add helper macros to change register access from direct to indirect. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/soc15_common.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15_common.h b/drivers/gpu/drm/amd/amdgpu/soc15_common.h

[PATCH v2 2/5] drm/amdgpu: Modify indirect register access for gmc_v9_0 sriov

2021-12-15 Thread Victor Skvortsov
Modify GC register access from MMIO to RLCG if the indirect flag is set v2: Replaced ternary operator with if-else for better readability Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 57 --- 1 file changed, 43 insertions(+), 14 deletions

[PATCH v2 3/5] drm/amdgpu: Modify indirect register access for amdkfd_gfx_v9 sriov

2021-12-15 Thread Victor Skvortsov
Modify GC register access from MMIO to RLCG if the indirect flag is set Signed-off-by: Victor Skvortsov --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

[PATCH v2 0/5] *** GFX9 RLCG Interface modifications ***

2021-12-15 Thread Victor Skvortsov
This patchset introduces an expanded sriov RLCG interface. This interface will be used by Aldebaran in sriov mode for indirect GC register access during full access. v2: Added descriptions to scratch registers, and improved code readability. Victor Skvortsov (5): drm/amdgpu: Add

[PATCH 4/5] drm/amdgpu: Initialize Aldebaran RLC function pointers

2021-12-15 Thread Victor Skvortsov
In SRIOV, RLC function pointers must be initialized early as we rely on the RLCG interface for all GC register access. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu

[PATCH 2/5] drm/amdgpu: Modify indirect register access for gmc_v9_0 sriov

2021-12-15 Thread Victor Skvortsov
Modify GC register access from MMIO to RLCG if the indirect flag is set Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 45 +++ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers

[PATCH 5/5] drm/amdgpu: Modify indirect register access for gfx9 sriov

2021-12-15 Thread Victor Skvortsov
Expand RLCG interface for new GC read & write commands. New interface will only be used if the PF enables the flag in pf2vf msg. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 111 +++--- 1 file changed, 83 insertions(+), 28 deletions(-)

[PATCH 1/5] drm/amdgpu: Add *_SOC15_IP_NO_KIQ() macro definitions

2021-12-15 Thread Victor Skvortsov
Add helper macros to change register access from direct to indirect. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/soc15_common.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15_common.h b/drivers/gpu/drm/amd/amdgpu/soc15_common.h

[PATCH 3/5] drm/amdgpu: Modify indirect register access for amdkfd_gfx_v9 sriov

2021-12-15 Thread Victor Skvortsov
Modify GC register access from MMIO to RLCG if the indirect flag is set Signed-off-by: Victor Skvortsov --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

[PATCH 0/5] *** GFX9 RLCG Interface modifications ***

2021-12-15 Thread Victor Skvortsov
This patchset introduces an expanded sriov RLCG interface. This interface will be used by Aldebaran in sriov mode for indirect GC register access during full access. Victor Skvortsov (5): drm/amdgpu: Add *_SOC15_IP_NO_KIQ() macro definitions drm/amdgpu: Modify indirect register access

[PATCH] drm/amdgpu: SRIOV flr_work should use down_write

2021-12-09 Thread Victor Skvortsov
Host initiated VF FLR may fail if someone else is already holding a read_lock. Change from down_write_trylock to down_write to guarantee the reset goes through. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 5 +++-- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 5

[PATCH 1/2] drm/amdgpu: Separate vf2pf work item init from virt data exchange

2021-12-09 Thread Victor Skvortsov
times without re-initializing the work item. Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 42 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 5 +-- drivers/gpu/drm/amd/amdgpu

[PATCH 2/2] drm/amdgpu: Reserve Bad pages early for SRIOV VF

2021-12-09 Thread Victor Skvortsov
Add a pf-vf exchange right after GMC sw init in order to reserve bad pages as early as possible Signed-off-by: Victor Skvortsov --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd