[PATCH 3/3] drm/amdgpu: use pci_dev_is_disconnected

vitaly prosyak vprosyak at amd.com
Thu Jan 26 14:28:08 UTC 2023


On 2023-01-26 04:20, Christian König wrote:
> Am 25.01.23 um 18:16 schrieb vitaly.prosyak at amd.com:
>> From: Vitaly Prosyak <vitaly.prosyak at amd.com>
>>
>> Added condition for pci_dev_is_disconnected and keeps
>> drm_dev_is_unplugged to check whether we should unmap MMIO.
>> Suggested by Alex regarding pci_dev_is_disconnected.
>> Suggested by Christian keeping drm_dev_is_unplugged.
>>
>> Signed-off-by: Vitaly Prosyak <vitaly.prosyak at amd.com>
>> Reviewed-by Alex Deucher <alexander.deucher at amd.com>
>> Reviewed-by Christian Koenig <christian.coenig at amd.com>
>
> Did I gave my rb with this include path below???
Explicitly there was no RB, but there was a private thread which does 
not include this include.
>
>> Change-Id: I618c471cd398437d4ed6dec6d22be78e12683ae6
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index a10b627c8357..d3568e1ded23 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -78,6 +78,8 @@
>>     #include <drm/drm_drv.h>
>>   +#include "../../../../pci/pci.h"
>
> That include path looks more than suspicious.
>
> If we want to use pci_dev_is_disconnected() outside of the pci 
> subsystem we should probably move it to include/linux/pci.h

Alright, I would drop this patch until the  It would be a separate patch 
to create a new:

include/linux/pci.h  with the following content:
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI)
bool pci_dev_is_disconnected(const struct pci_dev *dev)
{
     return dev->error_state == pci_channel_io_perm_failure;
}
#else
bool pci_dev_is_disconnected(const struct pci_dev *dev)
{
     return true;
}

#endif

I am not sure about enablement  of amdgpu when PCI is off in the config, 
but this is related to move pci_dev_is_disconnected into separate file 
and receive review from PCI system/.

>
> Regards,
> Christian.
>
>> +
>>   MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
>>   MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");
>>   MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");
>> @@ -4031,7 +4033,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device 
>> *adev)
>>         amdgpu_gart_dummy_page_fini(adev);
>>   -    if (drm_dev_is_unplugged(adev_to_drm(adev)))
>> +    if (pci_dev_is_disconnected(adev->pdev) &&
>> +        drm_dev_is_unplugged(adev_to_drm(adev)))
>>           amdgpu_device_unmap_mmio(adev);
>>     }
>


More information about the amd-gfx mailing list