drm/amdgpu: Enable doorbell selfring if resize BAR successfully
Subsystems (2)
PATCH 1/1 drm/amdgpu: Enable doorbell selfring if resize BAR successfully
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.
[How]
Move enable_doorbell_selfring_aperture from *_common_hw_init to *_common_late_init.
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +3 -1
@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); } const struct amdgpu_ip_block_version nv_common_ip_block =
@@ -999,6 +1000,7 @@ static int nv_common_late_init(void *handle) } } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -1
@@ -623,7 +623,8 @@ static void soc15_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); } const struct amdgpu_ip_block_version vega10_common_ip_block =
@@ -1125,6 +1126,7 @@ static int soc15_common_late_init(void *handle)if (amdgpu_sriov_vf (adev))xgpu_ai_mailbox_get_irq (adev); + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
drivers/gpu/drm/amd/amdgpu/soc21.c +3 -1
@@ -454,7 +454,8 @@ static void soc21_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); } const struct amdgpu_ip_block_version soc21_common_ip_block =
@@ -764,6 +765,7 @@ static int soc21_common_late_init(void *handle)amdgpu_irq_get (adev, &adev->nbio.ras_err_event_athub_irq,0 ); } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
Signature · 1 line
2.25.1
[AMD Official Use Only - General]
Ping.
Quoted 110 lines
-----Original Message-----
From: Xiao, Shane <[email protected]>
Sent: Tuesday, April 18, 2023 2:55 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Xiao, Shane <[email protected]>; Liu, Aaron <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>
Subject: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8100644drivers/gpu/drm/amd/amdgpu/nv.c +2
-1@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); }const struct
amdgpu_ip_block_versionnv_common_ip_block= @@ -999,6
+1000,7 @@ static intnv_common_late_init(void *handle)drivers/gpu/drm/amd/amdgpu/nv.c +1
-0} } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1@@ -623,7 +623,8 @@ static void soc15_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); }const struct
amdgpu_ip_block_versionvega10_common_ip_block= @@ -
1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0if (amdgpu_sriov_vf (adev))xgpu_ai_mailbox_get_irq (adev); + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +2
-1@@ -454,7 +454,8 @@ static void soc21_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); }const struct
amdgpu_ip_block_versionsoc21_common_ip_block= @@ -764,6
+765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-Quoted 1 line
nbio.ras_err_event_athub_irq, 0);
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1} + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; } --2.25.1
Am 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.
That's a good catch.
Quoted 4 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.
But that sounds like a bad idea. Instead the full call to nv_enable_doorbell_aperture() should be moved around.
Regards,
Christian.
Quoted 80 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/nv.c +3
-1@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); } const struct amdgpu_ip_block_version nv_common_ip_block =@@ -999,6 +1000,7 @@ static int nv_common_late_init(void *handle) } } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +3
-1@@ -623,7 +623,8 @@ static void soc15_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); } const struct amdgpu_ip_block_version vega10_common_ip_block =@@ -1125,6 +1126,7 @@ static int soc15_common_late_init(void *handle)if (amdgpu_sriov_vf (adev))xgpu_ai_mailbox_get_irq (adev); + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +3
-1@@ -454,7 +454,8 @@ static void soc21_enable_doorbell_aperture(struct amdgpu_device *adev, bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); } const struct amdgpu_ip_block_version soc21_common_ip_block =@@ -764,6 +765,7 @@ static int soc21_common_late_init(void *handle)amdgpu_irq_get (adev, &adev->nbio.ras_err_event_athub_irq,0 ); } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
[AMD Official Use Only - General]
Quoted 20 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.
Hi Christian,
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell. If so, we cannot enable doorbell after gfx hw init.
Best Regards,
Shane
Quoted 93 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct
Quoted 19 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
drivers/gpu/drm/amd/amdgpu/soc15.c static void soc15_enable_doorbell_aperture(struct
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-0} const struct amdgpu_ip_block_version nv_common_ip_block = @@ -999,6 +1000,7 @@ static int nv_common_late_init(void *handle) } } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static void soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c static void soc15_enable_doorbell_aperture(struct · line 627
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
drivers/gpu/drm/amd/amdgpu/soc21.c static void soc21_enable_doorbell_aperture(struct
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +1
-1} const struct amdgpu_ip_block_version vega10_common_ip_block = @@ -1125,6 +1126,7 @@ static int soc15_common_late_init(void *handle) if (amdgpu_sriov_vf(adev))xgpu_ai_mailbox_get_irq (adev); + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static void soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c static void soc21_enable_doorbell_aperture(struct · line 458
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +2
-1bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-1} const struct amdgpu_ip_block_version soc21_common_ip_block = @@ -764,6 +765,7 @@ static int soc21_common_late_init(void *handle) amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0);
}drivers/gpu/drm/amd/amdgpu/soc21.c +1
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
[AMD Official Use Only - General]
Quoted 40 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 24 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 4 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.
Quoted 8 lines
Quoted 2 lines
But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.
We have come up with two ways to resolve the issue.
1) Separate enable_doorbell_aperture and enable_doorbell_selfring_aperture. However, the enable_doorbell_selfring_aperture should be moved in *_common_ip_funcs->late_init.
2) The full call can be moved to gmc hw init. But it seems strange to move nbio configuration into gmc hw init.
If neither of the above methods is suitable, could you please give us some advice on this issue?
Best Regards,
Shane
Quoted 100 lines
Best Regards,
ShaneQuoted 96 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct
Quoted 19 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1} const struct amdgpu_ip_block_version nv_common_ip_block = @@ -999,6 +1000,7 @@ static int nv_common_late_init(void *handle) } } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 6 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1- adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 17 lines
}const struct
amdgpu_ip_block_versionvega10_common_ip_block= @@
-1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)
if (amdgpu_sriov_vf(adev))
xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 6 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +2
-1- adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 12 lines
}const struct
amdgpu_ip_block_versionsoc21_common_ip_block= @@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-
nbio.ras_err_event_athub_irq, 0);
}drivers/gpu/drm/amd/amdgpu/soc21.c +1
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
Christian König
maintainerAm 24.04.23 um 16:06 schrieb Xiao, Shane:
Quoted 39 lines
[AMD Official Use Only - General]
Quoted 38 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 16 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.Quoted 7 lines
That's a good catch.
Quoted 3 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Quoted 7 lines
Quoted 3 lines
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.We have come up with two ways to resolve the issue.
1) Separate
enable_doorbell_apertureandenable_doorbell_selfring_aperture. However, theenable_doorbell_selfring_apertureshould be moved in*_common_ip_funcs->late_init.
I'm not an expert for this part of the driver, but of hand that sounds like the right way of doing it.
Alex any objections?
Regards,
Christian.
Quoted 104 lines
2) The full call can be moved to gmc hw init. But it seems strange to move nbio configuration into gmc hw init.
If neither of the above methods is suitable, could you please give us some advice on this issue?
Best Regards,
ShaneQuoted 97 lines
Best Regards,
ShaneQuoted 94 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct
Quoted 18 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1} const struct amdgpu_ip_block_version nv_common_ip_block = @@ -999,6 +1000,7 @@ static int nv_common_late_init(void *handle) } } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 6 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1- adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 17 lines
}const struct
amdgpu_ip_block_versionvega10_common_ip_block= @@
-1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)
if (amdgpu_sriov_vf(adev))
xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 6 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +2
-1- adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 12 lines
}const struct
amdgpu_ip_block_versionsoc21_common_ip_block= @@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0); }drivers/gpu/drm/amd/amdgpu/soc21.c +1
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }
Quoted 46 lines · Christian König
Am 24.04.23 um 16:06 schrieb Xiao, Shane:
Quoted 44 lines
[AMD Official Use Only - General]
Quoted 34 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 21 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 3 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.Quoted 7 lines
Quoted 2 lines
But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.We have come up with two ways to resolve the issue.
Quoted 7 lines
Quoted 2 lines
1) Separate
enable_doorbell_apertureandenable_doorbell_selfring_aperture. However, theenable_doorbell_selfring_apertureshould be moved in*_common_ip_funcs->late_init.I'm not an expert for this part of the driver, but of hand that sounds like the right way of doing it.
Alex any objections?
Yeah, seems reasonable.
Alex
Quoted 109 lines
Regards,
Christian.Quoted 104 lines
2) The full call can be moved to gmc hw init. But it seems strange to move nbio configuration into gmc hw init.
If neither of the above methods is suitable, could you please give us some advice on this issue?
Best Regards,
ShaneQuoted 97 lines
Best Regards,
ShaneQuoted 94 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct
Quoted 18 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static void nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c static void nv_enable_doorbell_aperture(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1bool enable) { adev->nbio.funcs->enable_doorbell_aperture (adev, enable); - adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/nv.c +2
-1} const struct amdgpu_ip_block_version nv_common_ip_block = @@ -999,6 +1000,7 @@ static int nv_common_late_init(void *handle) } } + adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 6 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1- adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 17 lines
}const struct
amdgpu_ip_block_versionvega10_common_ip_block= @@
-1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)if (amdgpu_sriov_vf(adev)) xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 6 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +2
-1- adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, enable); +if (!enable) + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 12 lines
}const struct
amdgpu_ip_block_versionsoc21_common_ip_block= @@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0); }+ adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, true); return 0;}
[AMD Official Use Only - General]
Quoted 67 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, April 25, 2023 4:20 AM
To: Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyQuoted 49 lines · Christian König
Am 24.04.23 um 16:06 schrieb Xiao, Shane:
Quoted 47 lines
[AMD Official Use Only - General]
Quoted 35 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 22 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 3 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.Quoted 7 lines
Quoted 2 lines
But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.We have come up with two ways to resolve the issue.
1) Separate
enable_doorbell_apertureandenable_doorbell_selfring_aperture. However, the
enable_doorbell_selfring_apertureshould be moved in *_common_ip_funcs-Quoted 2 lines
late_init.
Quoted 9 lines
Quoted 4 lines
I'm not an expert for this part of the driver, but of hand that sounds like the right way of doing it.
Alex any objections?
Yeah, seems reasonable.
Alex
enable_doorbell_aperture and enable_doorbell_selfring_aperture should be in common_*_init instead of gmc_hw_init. The order of execution of Shane's 1st way is :
1) common_sw_init
2) common_hw_init -> enable_doorbell_aperture
3) gmc_sw_init -> amdgpu_device_resize_fb_bar ///This relies gmc.real_vram_size to determine resize_fb_bar, so moving amdgpu_device_resize_fb_bar to common_sw_init is not a good idea.
4) gmc_hw_init
5) common_late_init -> enable_doorbell_selfring_aperture
The 1st way looks good to me and reviewed-by me.
Quoted 127 lines
Quoted 5 lines
Regards,
Christian.Quoted 1 line
2) The full call can be moved to gmc hw init. But it seems strange to move
nbio configuration into gmc hw init.
Quoted 2 lines
Quoted 2 lines
If neither of the above methods is suitable, could you please give us some
advice on this issue?
Quoted 118 lines
Quoted 117 lines
Best Regards,
ShaneQuoted 113 lines
Best Regards,
ShaneQuoted 110 lines
Regards,
Christian.Quoted 19 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8
100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static voidQuoted 1 line
nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c
Quoted 9 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/nv.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 19 lines
}const struct
amdgpu_ip_block_versionnv_common_ip_block= @@
-999,6
+1000,7 @@ static intnv_common_late_init(void *handle)} }drivers/gpu/drm/amd/amdgpu/nv.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 9 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 19 lines
}const struct
amdgpu_ip_block_versionvega10_common_ip_block=
@@
-1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)if (amdgpu_sriov_vf(adev)) xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 9 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 14 lines
}const struct
amdgpu_ip_block_versionsoc21_common_ip_block=
@@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0); }+ adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,
+ true); return 0;}
[AMD Official Use Only - General]
Quoted 105 lines
-----Original Message-----
From: Liu, Aaron <[email protected]>
Sent: Tuesday, April 25, 2023 9:14 AM
To: Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 70 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, April 25, 2023 4:20 AM
To: Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyQuoted 50 lines · Christian König
Am 24.04.23 um 16:06 schrieb Xiao, Shane:
Quoted 48 lines
[AMD Official Use Only - General]
Quoted 36 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 23 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 3 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.Quoted 7 lines
Quoted 2 lines
But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.We have come up with two ways to resolve the issue.
1) Separate
enable_doorbell_apertureandenable_doorbell_selfring_aperture. However, the
enable_doorbell_selfring_apertureshould be moved in *_common_ip_funcs-Quoted 2 lines
late_init.Quoted 9 lines
Quoted 4 lines
I'm not an expert for this part of the driver, but of hand that sounds like the right way of doing it.
Alex any objections?
Yeah, seems reasonable.
Alex
enable_doorbell_apertureandenable_doorbell_selfring_apertureshould be in common_*_init instead ofgmc_hw_init.
The order of execution of Shane's 1st way is :
1)common_sw_init
2)common_hw_init->enable_doorbell_aperture
3)gmc_sw_init->amdgpu_device_resize_fb_bar///This relies
gmc.real_vram_size to determineresize_fb_bar, so movingamdgpu_device_resize_fb_bartocommon_sw_initis not a good idea.
4)gmc_hw_init
5)common_late_init->enable_doorbell_selfring_aperture
Quoted 1 line
The 1st way looks good to me and reviewed-by me.
Hi Alex & Christian,
Since this patch has already implemented it in this way, is there any other comments on this patch body? Or can I add you R-B or Acked-by on this patch?
Best Regards,
Shane
Quoted 130 lines
Quoted 130 lines
Quoted 7 lines
Regards,
Christian.Quoted 2 lines
2) The full call can be moved to gmc hw init. But it seems strange to move
nbio configuration into gmc hw init.
Quoted 3 lines
Quoted 3 lines
If neither of the above methods is suitable, could you please give us some
advice on this issue?
Quoted 118 lines
Quoted 117 lines
Best Regards,
ShaneQuoted 113 lines
Best Regards,
ShaneQuoted 110 lines
Regards,
Christian.Quoted 19 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8
100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static voidQuoted 1 line
nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c
Quoted 9 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/nv.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 19 lines
}const struct
amdgpu_ip_block_versionnv_common_ip_block= @@
-999,6
+1000,7 @@ static intnv_common_late_init(void *handle)} }drivers/gpu/drm/amd/amdgpu/nv.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 9 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 19 lines
}const struct
amdgpu_ip_block_versionvega10_common_ip_block
= @@
-1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)if (amdgpu_sriov_vf(adev)) xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 9 lines
bool enable)
{ adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 14 lines
}const struct
amdgpu_ip_block_versionsoc21_common_ip_block=
@@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0); }+ adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,
+ true); return 0;}
Am 25.04.23 um 05:29 schrieb Xiao, Shane:
Quoted 107 lines
[AMD Official Use Only - General]
Quoted 103 lines
-----Original Message-----
From: Liu, Aaron <[email protected]>
Sent: Tuesday, April 25, 2023 9:14 AM
To: Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 69 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, April 25, 2023 4:20 AM
To: Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyQuoted 49 lines · Christian König
Am 24.04.23 um 16:06 schrieb Xiao, Shane:
Quoted 48 lines
[AMD Official Use Only - General]
Quoted 36 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 23 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 3 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto*_common_late_init.Quoted 7 lines
Quoted 2 lines
But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.We have come up with two ways to resolve the issue.
1) Separate
enable_doorbell_apertureandenable_doorbell_selfring_aperture. However, the
enable_doorbell_selfring_apertureshould be moved in *_common_ip_funcs-Quoted 2 lines
late_init.Quoted 8 lines
Quoted 4 lines
I'm not an expert for this part of the driver, but of hand that sounds like the right way of doing it.
Alex any objections?
Yeah, seems reasonable.
Alex
enable_doorbell_apertureandenable_doorbell_selfring_apertureshould be in common_*_init instead ofgmc_hw_init.
The order of execution of Shane's 1st way is :
1)common_sw_init
2)common_hw_init->enable_doorbell_aperture
3)gmc_sw_init->amdgpu_device_resize_fb_bar///This relies
gmc.real_vram_size to determineresize_fb_bar, so movingamdgpu_device_resize_fb_bartocommon_sw_initis not a good idea.
4)gmc_hw_init
5)common_late_init->enable_doorbell_selfring_aperture
Quoted 5 lines
Quoted 1 line
The 1st way looks good to me and reviewed-by me.
Hi Alex & Christian,
Since this patch has already implemented it in this way, is there any other comments on this patch body? Or can I add you R-B or Acked-by on this patch?
At least remove the functions soc15_enable_doorbell_aperture()/nv_enable_doorbell_aperture()/soc21_enable_doorbell_aperture() and open code the respective calls.
Those don't make sense any more since we don't have a central point when the apertures are enabled/disabled.
Regards,
Christian.
Quoted 129 lines
Best Regards,
ShaneQuoted 125 lines
Quoted 125 lines
Quoted 5 lines
Regards,
Christian.Quoted 2 lines
2) The full call can be moved to gmc hw init. But it seems strange to move
nbio configuration into gmc hw init.
Quoted 2 lines
Quoted 2 lines
If neither of the above methods is suitable, could you please give us some
advice on this issue?
Quoted 116 lines
Quoted 116 lines
Best Regards,
ShaneQuoted 113 lines
Best Regards,
ShaneQuoted 110 lines
Regards,
Christian.Quoted 19 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8
100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static voidQuoted 1 line
nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c
Quoted 9 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/nv.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 19 lines
}
const struct
amdgpu_ip_block_versionnv_common_ip_block= @@
-999,6
+1000,7 @@ static intnv_common_late_init(void *handle)} }drivers/gpu/drm/amd/amdgpu/nv.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 9 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 19 lines
}
const struct
amdgpu_ip_block_versionvega10_common_ip_block
= @@
-1125,6 +1126,7 @@ static intsoc15_common_late_init(void *handle)if (amdgpu_sriov_vf(adev)) xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 9 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 14 lines
}
const struct
amdgpu_ip_block_versionsoc21_common_ip_block=
@@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0); }+ adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,
+ true); return 0; }
[AMD Official Use Only - General]
Quoted 133 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 25, 2023 4:54 PM
To: Xiao, Shane <[email protected]>; Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 25.04.23 um 05:29 schrieb Xiao, Shane:
Quoted 44 lines
[AMD Official Use Only - General]
Quoted 40 lines
-----Original Message-----
From: Liu, Aaron <[email protected]>
Sent: Tuesday, April 25, 2023 9:14 AM
To: Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 25 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, April 25, 2023 4:20 AM
To: Koenig, Christian <[email protected]>
Cc: Xiao, Shane <[email protected]>; Christian König <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>; Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyQuoted 9 lines · Christian König
Am 24.04.23 um 16:06 schrieb Xiao, Shane:
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 7 lines
-----Original Message-----
From: Xiao, Shane
Sent: Monday, April 24, 2023 6:31 PM
To: Christian König <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, FelixQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu, Aaron <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfully[AMD Official Use Only - General]
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, April 24, 2023 5:07 PM
To: Xiao, Shane <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Liu,Aaron
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
<[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Enable doorbell selfring if resize BAR successfullyAm 18.04.23 um 08:54 schrieb Shane Xiao:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
[Why]
The selfring doorbell aperture will change when we resize FB BAR successfully during gmc sw init, we should reorder the sequence of enabling doorbell selfring aperture.That's a good catch.
Quoted 2 lines
[How]
Moveenable_doorbell_selfring_aperturefrom*_common_hw_initto
Quoted 35 lines
Quoted 35 lines
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
*_common_late_init.But that sounds like a bad idea. Instead the full call to
nv_enable_doorbell_aperture()should be moved around.Hi Christian,
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Yes, I get your idea. But as far as I can understand that, the gfx hw init will use doorbell.
If so, we cannot enable doorbell after gfx hw init.We have come up with two ways to resolve the issue.
1) Separate
enable_doorbell_apertureandenable_doorbell_selfring_aperture. However, the
enable_doorbell_selfring_apertureshould be moved in *_common_ip_funcs-Quoted 2 lines
late_init.Quoted 8 lines
Quoted 4 lines
I'm not an expert for this part of the driver, but of hand that sounds like the right way of doing it.
Alex any objections?
Yeah, seems reasonable.
Alex
enable_doorbell_apertureandenable_doorbell_selfring_apertureshould be in common_*_init instead ofgmc_hw_init.
The order of execution of Shane's 1st way is :
1)common_sw_init
2)common_hw_init->enable_doorbell_aperture
3)gmc_sw_init->amdgpu_device_resize_fb_bar///This relies
gmc.real_vram_size to determineresize_fb_bar, so movingamdgpu_device_resize_fb_bartocommon_sw_initis not a good idea.
4)gmc_hw_init
5)common_late_init->enable_doorbell_selfring_apertureQuoted 4 lines
Quoted 1 line
The 1st way looks good to me and reviewed-by me.
Hi Alex & Christian,
Since this patch has already implemented it in this way, is there any other
comments on this patch body?
Quoted 1 line
Or can I add you R-B or Acked-by on this patch?
Quoted 7 lines
At least remove the functions soc15_enable_doorbell_aperture()/nv_enable_doorbell_aperture()/soc21_enab
le_doorbell_aperture()
and open code the respective calls.Those don't make sense any more since we don't have a central point when the apertures are enabled/disabled.
Sure, I will update this in v2.
Best Regards,
Shane
Quoted 135 lines
Regards,
Christian.Quoted 90 lines
Best Regards,
ShaneQuoted 86 lines
Quoted 86 lines
Quoted 5 lines
Regards,
Christian.Quoted 2 lines
2) The full call can be moved to gmc hw init. But it seems strange to move
nbio configuration into gmc hw init.
Quoted 2 lines
Quoted 2 lines
If neither of the above methods is suitable, could you please give us some
advice on this issue?
Quoted 77 lines
Quoted 77 lines
Best Regards,
ShaneQuoted 74 lines
Best Regards,
ShaneQuoted 71 lines
Regards,
Christian.Quoted 19 lines
This fixes the potential issue that GPU ring its own doorbell when this device is in translated mode with iommu is on.
Signed-off-by Shane Xiao <[email protected]>Signed-off-by Aaron Liu <[email protected]>Tested-by Xiaomeng Hou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 +++- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex47420b403871..f4c85634a4c8
100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -535,7 +535,8 @@ static voidQuoted 1 line
nv_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/nv.c
Quoted 9 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/nv.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 20 lines
}
const struct
amdgpu_ip_block_versionnv_common_ip_block=
@@
-999,6
+1000,7 @@ static intnv_common_late_init(void *handle)} }drivers/gpu/drm/amd/amdgpu/nv.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -623,7 +623,8 @@ static voidQuoted 1 line
soc15_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc15.c
Quoted 9 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc15.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 5 lines
}
const struct
amdgpu_ip_block_versionvega10_common_ip_block
= @@
-1125,6 +1126,7 @@ static int soc15_common_late_init(void*handle)
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 14 lines
if (amdgpu_sriov_vf(adev)) xgpu_ai_mailbox_get_irq(adev);drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0+ adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, + true);return 0 ; }drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -454,7 +454,8 @@ static voidQuoted 1 line
soc21_enable_doorbell_aperture(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/soc21.c
Quoted 9 lines
bool enable) { adev->nbio.funcs->enable_doorbell_aperture(adev,enable);
-adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);drivers/gpu/drm/amd/amdgpu/soc21.c +3
-0+if (!enable) + + adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,false);
Quoted 14 lines
}
const struct
amdgpu_ip_block_versionsoc21_common_ip_block
= @@
-764,6 +765,7 @@ static intsoc21_common_late_init(void *handle)
amdgpu_irq_get(adev, &adev-nbio.ras_err_event_athub_irq, 0); }+ adev->nbio.funcs->enable_doorbell_selfring_aperture(adev,
+ true); return 0; }