[PATCH 14/18] drm/amdgpu: Fix amdgpu reload failure under SRIOV

Alex Deucher alexdeucher at gmail.com
Mon Sep 18 21:07:28 UTC 2017


On Mon, Sep 18, 2017 at 5:31 AM, Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
> Am 18.09.2017 um 08:11 schrieb Monk Liu:
>>
>> From: Horace Chen <horace.chen at amd.com>
>>
>> Kernel will set the PCI power state to UNKNOWN after unloading,
>> Since SRIOV has faked PCI config space so the UNKNOWN state
>> will be kept forever.
>>
>> In driver reload if the power state is UNKNOWN then enabling msi
>> will fail.
>>
>> forcely set it to D0 for SRIOV to fix this kernel flawness.
>>
>> Change-Id: I6a72d5fc9b653b21c3c98167515a511c5edeb91c
>> Signed-off-by: Horace Chen <horace.chen at amd.com>
>> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
>
>
> Acked-by: Christian König <christian.koenig at amd.com>, but better wait for
> Alex to have a look as well on this before pushing it.
>

Seems reasonable to me barring Xiangliang's comment.
Acked-by: Alex Deucher <alexander.deucher at amd.com>

> Christian.
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> index 914c5bf..345406a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> @@ -229,7 +229,15 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>         adev->irq.msi_enabled = false;
>>         if (amdgpu_msi_ok(adev)) {
>> -               int ret = pci_enable_msi(adev->pdev);
>> +               int ret;
>> +               if (amdgpu_sriov_vf(adev) &&
>> +                   adev->pdev->current_state == PCI_UNKNOWN){
>> +                       /* If pci power state is unknown on the SRIOV
>> platform,
>> +                        * it may be set in the remove device. We need to
>> forcely
>> +                        * set it to D0 to enable the msi*/
>> +                       adev->pdev->current_state = PCI_D0;
>> +               }
>> +               ret = pci_enable_msi(adev->pdev);
>>                 if (!ret) {
>>                         adev->irq.msi_enabled = true;
>>                         dev_info(adev->dev, "amdgpu: using MSI.\n");
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list