diff mbox series

drm/amdgpu: fix SI failure due to doorbells allocation

Message ID 20231008064649.3184677-1-uwu@icenowy.me (mailing list archive)
State New, archived
Headers show
Series drm/amdgpu: fix SI failure due to doorbells allocation | expand

Commit Message

Icenowy Zheng Oct. 8, 2023, 6:46 a.m. UTC
SI hardware does not have doorbells at all, however currently the code
will try to do the allocation and thus fail, makes SI AMDGPU not usable.

Fix this failure by skipping doorbells allocation when doorbells count
is zero.

Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Sharma, Shashank Oct. 9, 2023, 9:01 a.m. UTC | #1
[AMD Official Use Only - General]

Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>

Regards
Shashank
-----Original Message-----
From: Icenowy Zheng <uwu@icenowy.me>
Sent: Sunday, October 8, 2023 8:47 AM
To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@gmail.com>; Daniel Vetter <daniel@ffwll.ch>; Sharma, Shashank <Shashank.Sharma@amd.com>; Yadav, Arvind <Arvind.Yadav@amd.com>
Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Icenowy Zheng <uwu@icenowy.me>
Subject: [PATCH] drm/amdgpu: fix SI failure due to doorbells allocation

SI hardware does not have doorbells at all, however currently the code will try to do the allocation and thus fail, makes SI AMDGPU not usable.

Fix this failure by skipping doorbells allocation when doorbells count is zero.

Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
index d0249ada91d30..599aece42017a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
@@ -142,6 +142,10 @@ int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev)
        int r;
        int size;

+       /* SI HW does not have doorbells, skip allocation */
+       if (adev->doorbell.num_kernel_doorbells == 0)
+               return 0;
+
        /* Reserve first num_kernel_doorbells (page-aligned) for kernel ops */
        size = ALIGN(adev->doorbell.num_kernel_doorbells * sizeof(u32), PAGE_SIZE);

--
2.39.1
Alex Deucher Oct. 9, 2023, 6:45 p.m. UTC | #2
Applied.  Thanks!

On Mon, Oct 9, 2023 at 5:27 AM Sharma, Shashank <Shashank.Sharma@amd.com> wrote:
>
> [AMD Official Use Only - General]
>
> Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
>
> Regards
> Shashank
> -----Original Message-----
> From: Icenowy Zheng <uwu@icenowy.me>
> Sent: Sunday, October 8, 2023 8:47 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@gmail.com>; Daniel Vetter <daniel@ffwll.ch>; Sharma, Shashank <Shashank.Sharma@amd.com>; Yadav, Arvind <Arvind.Yadav@amd.com>
> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Icenowy Zheng <uwu@icenowy.me>
> Subject: [PATCH] drm/amdgpu: fix SI failure due to doorbells allocation
>
> SI hardware does not have doorbells at all, however currently the code will try to do the allocation and thus fail, makes SI AMDGPU not usable.
>
> Fix this failure by skipping doorbells allocation when doorbells count is zero.
>
> Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages")
> Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> index d0249ada91d30..599aece42017a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> @@ -142,6 +142,10 @@ int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev)
>         int r;
>         int size;
>
> +       /* SI HW does not have doorbells, skip allocation */
> +       if (adev->doorbell.num_kernel_doorbells == 0)
> +               return 0;
> +
>         /* Reserve first num_kernel_doorbells (page-aligned) for kernel ops */
>         size = ALIGN(adev->doorbell.num_kernel_doorbells * sizeof(u32), PAGE_SIZE);
>
> --
> 2.39.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
index d0249ada91d30..599aece42017a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
@@ -142,6 +142,10 @@  int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev)
 	int r;
 	int size;
 
+	/* SI HW does not have doorbells, skip allocation */
+	if (adev->doorbell.num_kernel_doorbells == 0)
+		return 0;
+
 	/* Reserve first num_kernel_doorbells (page-aligned) for kernel ops */
 	size = ALIGN(adev->doorbell.num_kernel_doorbells * sizeof(u32), PAGE_SIZE);