<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt;">
The flush reg is read/write. If the reads are not working on those platforms, I think the writes may be dropped silently. </div>
<div id="ms-outlook-mobile-body-separator-line" dir="auto"><br>
</div>
<div id="ms-outlook-mobile-signature" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt;" dir="auto">
<div dir="auto">Thanks,</div>
<div dir="auto">Lijo</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Wednesday, May 7, 2025 8:43:51 PM<br>
<b>To:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Lazar, Lijo <Lijo.Lazar@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH 1/7] Revert "drm/amdgpu: Use generic hdp flush function"</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Ping again on this series?<br>
<br>
Alex<br>
<br>
On Tue, May 6, 2025 at 11:17 AM Alex Deucher <alexdeucher@gmail.com> wrote:<br>
><br>
> Ping on this series? This fixes a regression.<br>
><br>
> Alex<br>
><br>
> On Mon, May 5, 2025 at 9:05 AM Alex Deucher <alexander.deucher@amd.com> wrote:<br>
> ><br>
> > This reverts commit 18a878fd8aef0ec21648a3782f55a79790cd4073.<br>
> ><br>
> > Revert this temporarily to make it easier to fix a regression<br>
> > in the HDP handling.<br>
> ><br>
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com><br>
> > ---<br>
> > drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c | 21 ---------------------<br>
> > drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h | 2 --<br>
> > drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 13 ++++++++++++-<br>
> > drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c | 13 ++++++++++++-<br>
> > drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c | 13 ++++++++++++-<br>
> > drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c | 13 ++++++++++++-<br>
> > 6 files changed, 48 insertions(+), 27 deletions(-)<br>
> ><br>
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c<br>
> > index 7fd8f09c28e66..b6cf801939aa5 100644<br>
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c<br>
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c<br>
> > @@ -22,7 +22,6 @@<br>
> > */<br>
> > #include "amdgpu.h"<br>
> > #include "amdgpu_ras.h"<br>
> > -#include <uapi/linux/kfd_ioctl.h><br>
> ><br>
> > int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev)<br>
> > {<br>
> > @@ -47,23 +46,3 @@ int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev)<br>
> > /* hdp ras follows amdgpu_ras_block_late_init_default for late init */<br>
> > return 0;<br>
> > }<br>
> > -<br>
> > -void amdgpu_hdp_generic_flush(struct amdgpu_device *adev,<br>
> > - struct amdgpu_ring *ring)<br>
> > -{<br>
> > - if (!ring || !ring->funcs->emit_wreg) {<br>
> > - WREG32((adev->rmmio_remap.reg_offset +<br>
> > - KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >><br>
> > - 2,<br>
> > - 0);<br>
> > - RREG32((adev->rmmio_remap.reg_offset +<br>
> > - KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >><br>
> > - 2);<br>
> > - } else {<br>
> > - amdgpu_ring_emit_wreg(ring,<br>
> > - (adev->rmmio_remap.reg_offset +<br>
> > - KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >><br>
> > - 2,<br>
> > - 0);<br>
> > - }<br>
> > -}<br>
> > \ No newline at end of file<br>
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h<br>
> > index 4cfd932b7e91e..7b8a6152dc8d9 100644<br>
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h<br>
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h<br>
> > @@ -44,6 +44,4 @@ struct amdgpu_hdp {<br>
> > };<br>
> ><br>
> > int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev);<br>
> > -void amdgpu_hdp_generic_flush(struct amdgpu_device *adev,<br>
> > - struct amdgpu_ring *ring);<br>
> > #endif /* __AMDGPU_HDP_H__ */<br>
> > diff --git a/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c b/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c<br>
> > index e6c0d86d34865..f1dc13b3ab38e 100644<br>
> > --- a/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c<br>
> > +++ b/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c<br>
> > @@ -36,6 +36,17 @@<br>
> > #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L<br>
> > #define mmHDP_MEM_POWER_CTRL_BASE_IDX 0<br>
> ><br>
> > +static void hdp_v4_0_flush_hdp(struct amdgpu_device *adev,<br>
> > + struct amdgpu_ring *ring)<br>
> > +{<br>
> > + if (!ring || !ring->funcs->emit_wreg) {<br>
> > + WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);<br>
> > + } else {<br>
> > + amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + }<br>
> > +}<br>
> > +<br>
> > static void hdp_v4_0_invalidate_hdp(struct amdgpu_device *adev,<br>
> > struct amdgpu_ring *ring)<br>
> > {<br>
> > @@ -169,7 +180,7 @@ struct amdgpu_hdp_ras hdp_v4_0_ras = {<br>
> > };<br>
> ><br>
> > const struct amdgpu_hdp_funcs hdp_v4_0_funcs = {<br>
> > - .flush_hdp = amdgpu_hdp_generic_flush,<br>
> > + .flush_hdp = hdp_v4_0_flush_hdp,<br>
> > .invalidate_hdp = hdp_v4_0_invalidate_hdp,<br>
> > .update_clock_gating = hdp_v4_0_update_clock_gating,<br>
> > .get_clock_gating_state = hdp_v4_0_get_clockgating_state,<br>
> > diff --git a/drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c b/drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c<br>
> > index 8bc001dc9f631..43195c0797480 100644<br>
> > --- a/drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c<br>
> > +++ b/drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c<br>
> > @@ -27,6 +27,17 @@<br>
> > #include "hdp/hdp_5_0_0_sh_mask.h"<br>
> > #include <uapi/linux/kfd_ioctl.h><br>
> ><br>
> > +static void hdp_v5_0_flush_hdp(struct amdgpu_device *adev,<br>
> > + struct amdgpu_ring *ring)<br>
> > +{<br>
> > + if (!ring || !ring->funcs->emit_wreg) {<br>
> > + WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);<br>
> > + } else {<br>
> > + amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + }<br>
> > +}<br>
> > +<br>
> > static void hdp_v5_0_invalidate_hdp(struct amdgpu_device *adev,<br>
> > struct amdgpu_ring *ring)<br>
> > {<br>
> > @@ -206,7 +217,7 @@ static void hdp_v5_0_init_registers(struct amdgpu_device *adev)<br>
> > }<br>
> ><br>
> > const struct amdgpu_hdp_funcs hdp_v5_0_funcs = {<br>
> > - .flush_hdp = amdgpu_hdp_generic_flush,<br>
> > + .flush_hdp = hdp_v5_0_flush_hdp,<br>
> > .invalidate_hdp = hdp_v5_0_invalidate_hdp,<br>
> > .update_clock_gating = hdp_v5_0_update_clock_gating,<br>
> > .get_clock_gating_state = hdp_v5_0_get_clockgating_state,<br>
> > diff --git a/drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c b/drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c<br>
> > index ec20daf4272c5..a88d25a06c29b 100644<br>
> > --- a/drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c<br>
> > +++ b/drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c<br>
> > @@ -30,6 +30,17 @@<br>
> > #define regHDP_CLK_CNTL_V6_1 0xd5<br>
> > #define regHDP_CLK_CNTL_V6_1_BASE_IDX 0<br>
> ><br>
> > +static void hdp_v6_0_flush_hdp(struct amdgpu_device *adev,<br>
> > + struct amdgpu_ring *ring)<br>
> > +{<br>
> > + if (!ring || !ring->funcs->emit_wreg) {<br>
> > + WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);<br>
> > + } else {<br>
> > + amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + }<br>
> > +}<br>
> > +<br>
> > static void hdp_v6_0_update_clock_gating(struct amdgpu_device *adev,<br>
> > bool enable)<br>
> > {<br>
> > @@ -138,7 +149,7 @@ static void hdp_v6_0_get_clockgating_state(struct amdgpu_device *adev,<br>
> > }<br>
> ><br>
> > const struct amdgpu_hdp_funcs hdp_v6_0_funcs = {<br>
> > - .flush_hdp = amdgpu_hdp_generic_flush,<br>
> > + .flush_hdp = hdp_v6_0_flush_hdp,<br>
> > .update_clock_gating = hdp_v6_0_update_clock_gating,<br>
> > .get_clock_gating_state = hdp_v6_0_get_clockgating_state,<br>
> > };<br>
> > diff --git a/drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c b/drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c<br>
> > index ed1debc035073..49f7eb4fbd117 100644<br>
> > --- a/drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c<br>
> > +++ b/drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c<br>
> > @@ -27,6 +27,17 @@<br>
> > #include "hdp/hdp_7_0_0_sh_mask.h"<br>
> > #include <uapi/linux/kfd_ioctl.h><br>
> ><br>
> > +static void hdp_v7_0_flush_hdp(struct amdgpu_device *adev,<br>
> > + struct amdgpu_ring *ring)<br>
> > +{<br>
> > + if (!ring || !ring->funcs->emit_wreg) {<br>
> > + WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);<br>
> > + } else {<br>
> > + amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);<br>
> > + }<br>
> > +}<br>
> > +<br>
> > static void hdp_v7_0_update_clock_gating(struct amdgpu_device *adev,<br>
> > bool enable)<br>
> > {<br>
> > @@ -126,7 +137,7 @@ static void hdp_v7_0_get_clockgating_state(struct amdgpu_device *adev,<br>
> > }<br>
> ><br>
> > const struct amdgpu_hdp_funcs hdp_v7_0_funcs = {<br>
> > - .flush_hdp = amdgpu_hdp_generic_flush,<br>
> > + .flush_hdp = hdp_v7_0_flush_hdp,<br>
> > .update_clock_gating = hdp_v7_0_update_clock_gating,<br>
> > .get_clock_gating_state = hdp_v7_0_get_clockgating_state,<br>
> > };<br>
> > --<br>
> > 2.49.0<br>
> ><br>
</div>
</span></font></div>
</div>
</body>
</html>