On Mon, Nov 4, 2024 at 4:05 AM Lu Yao <yaolu@xxxxxxxxxx> wrote: > > on 2024/11/1 02:04, Alex Deucher wrote: > > Add support for the drm_panic module, which displays a pretty user > > friendly message on the screen when a Linux kernel panic occurs. > > > > Adapt Lu Yao's code to use common helpers derived from > > Jocelyn's patch. This extends the non-DC code to enable > > access to non-CPU accessible VRAM and adds support for > > other DCE versions. > > > > Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> > > Cc: Lu Yao <yaolu@xxxxxxxxxx> > > Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx> > > --- > > drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 27 ++++++++++++++++++++++++++ > > drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 27 ++++++++++++++++++++++++++ > > drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 27 ++++++++++++++++++++++++++ > > drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 26 +++++++++++++++++++++++++ > > 4 files changed, 107 insertions(+) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c > > index 5098c50d54c8..a26f2381504b 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c > > +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c > > @@ -2687,6 +2687,32 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = { > > .get_scanout_position = amdgpu_crtc_get_scanout_position, > > }; > > > > +static void dce_v10_0_panic_flush(struct drm_plane *plane) > > +{ > > + struct drm_framebuffer *fb; > > + struct amdgpu_crtc *amdgpu_crtc; > > + struct amdgpu_device *adev; > > + uint32_t fb_format; > > + > > + if (!plane->fb) > > + return; > > + > > + fb = plane->fb; > > + amdgpu_crtc = to_amdgpu_crtc(plane->crtc); > > + adev = drm_to_adev(fb->dev); > > + > > + /* Disable DC tiling */ > > + fb_format = RREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset); > > + fb_format &= ~GRPH_CONTROL__GRPH_ARRAY_MODE_MASK; > > + WREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset, fb_format); > > + > > +} > > + > For non-DC ip, 'mmGRPH_CONTROL' and 'GRPH_CONTROL__GRPH_ARRAY_MODE_MASK' val are same, so whether the panic_flush function can also be made same? It could, but I didn't want to imply that this should be used for all IPs because the tiling controls are different on newer GPUs. > > > > +static const struct drm_plane_helper_funcs dce_v10_0_drm_primary_plane_helper_funcs = { > > + .get_scanout_buffer = amdgpu_display_get_scanout_buffer, > The definition of 'amdgpu_display_get_scanout_buffer' seems to be missing. It was added in patch 1. Alex