Actually I have more patches for gpu_reset feature for SRIOV case, but I didn't send out them, so this patch can be skipped. I'll cleanup all those patches more and send out for review later BR Monk -----Original Message----- From: Christian König [mailto:deathsimple@xxxxxxxxxxx] Sent: Monday, February 06, 2017 4:24 PM To: Liu, Monk <Monk.Liu at amd.com>; amd-gfx at lists.freedesktop.org Subject: Re: [PATCH 05/21] drm/amdgpu:BUG if gpu_reste and asic_reset from VF Am 04.02.2017 um 11:34 schrieb Monk Liu: > for SRIOV vf, Guest couldn't really access PCI registers so > gpu_reset() and asic_reset should be avoided. > > for suspend it could run for SRIOV because cg/pg routine already > modified for SRIOV vf case, besides we should remove the req/rel gpu > access around it because the req/rel should be used by invoker. > > Change-Id: I678d3f2ce202458c1d1d404970fa47421766b666 > Signed-off-by: Monk Liu <Monk.Liu at amd.com> Mhm, isn't a BUG_ON() a bit hard here? I mean that usually terminates the current process if not the brings down the whole system. Maybe just adding a WARN() to the "if (amdgpu_sriov_vf(adev)) return 0;" is more appropriate. Regards, Christian. > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +-------- > drivers/gpu/drm/amd/amdgpu/vi.c | 2 ++ > 2 files changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 6106cd6..173df73 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -1566,9 +1566,6 @@ int amdgpu_suspend(struct amdgpu_device *adev) > { > int i, r; > > - if (amdgpu_sriov_vf(adev)) > - amdgpu_virt_request_full_gpu(adev, false); > - > /* ungate SMC block first */ > r = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_SMC, > AMD_CG_STATE_UNGATE); > @@ -1597,9 +1594,6 @@ int amdgpu_suspend(struct amdgpu_device *adev) > } > } > > - if (amdgpu_sriov_vf(adev)) > - amdgpu_virt_release_full_gpu(adev, false); > - > return 0; > } > > @@ -2356,8 +2350,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) > int resched; > bool need_full_reset; > > - if (amdgpu_sriov_vf(adev)) > - return 0; > + BUG_ON(amdgpu_sriov_vf(adev)); > > if (!amdgpu_check_soft_reset(adev)) { > DRM_INFO("No hardware hang detected. Did some blocks stall?\n"); > diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c > b/drivers/gpu/drm/amd/amdgpu/vi.c index 7810030..557994c 100644 > --- a/drivers/gpu/drm/amd/amdgpu/vi.c > +++ b/drivers/gpu/drm/amd/amdgpu/vi.c > @@ -739,6 +739,8 @@ static int vi_asic_reset(struct amdgpu_device *adev) > { > int r; > > + BUG_ON(amdgpu_sriov_vf(adev)); > + > amdgpu_atombios_scratch_regs_engine_hung(adev, true); > > r = vi_gpu_pci_config_reset(adev);