Re: [PATCH] drm/amdgpu: fix OLAND card ip_init failed during kdump caputrue kernel boot
On 2024/8/22 22:05, Mario Limonciello wrote: > On 7/23/2024 04:42, Lu Yao wrote: >> [Why] >> When running kdump test on a machine with R7340 card, a hang is caused due >> to the failure of 'amdgpu_device_ip_init()', error message as follows: >> >>'[drm:amdgpu_device_ip_init [amdgpu]] *ERROR* hw_init of IP block >> failed -22' >>'[drm:uvd_v3_1_hw_init [amdgpu]] *ERROR* amdgpu: UVD Firmware validate >> fail (-22).' >>'[drm:amdgpu_device_ip_init [amdgpu]] *ERROR* hw_init of IP block >> failed -22' >>'amdgpu :01:00.0: amdgpu: amdgpu_device_ip_init failed' >>'amdgpu :01:00.0: amdgpu: Fatal error during GPU init' >> >> This is because the caputrue kernel does not power off when it starts, > > Presumably you mean: > s/caputrue/capture/ Oh, you're right. It's a mistake. > >> cause hardware status does not reset. >> >> [How] >> Add 'is_kdump_kernel()' judgment. >> For 'si_dpm' block, use disable and then enable. >> For 'uvd_v3_1' block, skip loading during the initialization phase. >> >> Signed-off-by: Lu Yao >> --- >> During test, I first modified the 'amdgpu_device_ip_hw_init_phase*', make >> it does not end directly when a block hw_init failed. >> >> After analysis, 'si_dpm' block failed at 'si_dpm_enable()-> >> amdgpu_si_is_smc_running()', calling 'si_dpm_disable()' before can resolve. >> 'uvd_v3_1' block failed at 'uvd_v3_1_hw_init()->uvd_v3_1_fw_validate()', >> read mmUVD_FW_STATUS value is 0x27220102, I didn't find out why. But for >> caputrue kernel, UVD is not required. Therefore, don't added this block. > > Hmm, a few thoughs. > > 1) Although you used this for the R7340, these concepts you're identifying > probably make sense on most AMD GPUs. SUch checks might be better to uplevel > to earlier in IP discovery code. > > 2) I'd actually argue we don't want to have the kdump capture kernel do ANY > hardware init. You're going to lose hardware state which "could" be valuable > information for debugging a problem that caused a panic. > So, maybe should skip all the ip_block hw_init functions when kdump? > That being said, I'm not really sure what framebuffer can drive the display > across a kexec if you don't load amdgpu. What actually happens if you > blacklist amdgpu in the capture kernel? > > What happens with your patch in place? > > At least for me I'd like to see a kernel log from both cases. > After add 'initcall_blacklist=amdgpu_init' in KDUMP_CMDLINE_APPEND, kernel logs are as follow: [4.085602][ 0] nvme0n1: p1 p2 p3 p4 p5 p6 [4.157927][ 0] [drm] radeon kernel modesetting enabled. [4.163383][ 0] radeon :01:00.0: SI support disabled by module param [5.387012][ 0] initcall amdgpu_init blacklisted [6.613733][ 0] initcall amdgpu_init blacklisted [7.859320][ 0] mtsnd build info: e3fc429 [8.687512][ 0] EXT4-fs (nvme0n1p3): orphan cleanup on readonly fs [8.694035][ 0] EXT4-fs (nvme0n1p3): mounted filesystem 75c1e96b-cef8-4ed3-86ea-45010c7b859c ro with ordered data mode. Quota mode: none. [9.309862][ 0] device-mapper: core: CONFIG_IMA_DISABLE_HTABLE is disabled. Duplicate IMA measurements will not be recorded in the IMA log. [9.325236][ 0] device-mapper: uevent: version 1.0.3 [9.330946][ 0] systemd[1]: Starting modprobe@fuse.service - Load Kernel Module fuse... [9.341512][ 0] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-de...@redhat.com [9.380944][ 0] fuse: init (API version 7.39) [9.390196][ 0] loop: module loaded [9.486957][ 0] lp: driver loaded but no devices found [9.494904][ 0] EXT4-fs (nvme0n1p3): re-mounted 75c1e96b-cef8-4ed3-86ea-45010c7b859c r/w. Quota mode: none. [9.505931][ 0] systemd[1]: Starting systemd-udev-trigger.service - Coldplug All udev Devices... [9.518899][ 0] ppdev: user-space parallel port driver [9.524908][ 0] systemd[1]: Started systemd-journald.service - Journal Service. [9.574209][ 0] systemd-journald[350]: Received client request to flush runtime journal. [ 10.118484][ 0] snd_hda_intel :00:1f.3: Unknown capability 0 [ 11.590124][ 0] hdaudio hdaudioC0D2: Unable to configure, disabling [ 23.892640][ 0] reboot: Restarting system After with my patch in place: [4.074629][ 0] nvme0n1: p1 p2 p3 p4 p5 p6 [4.146956][ 0] [drm] radeon kernel modesetting enabled. [4.152409][ 0] radeon :01:00.0: SI support disabled by module param [5.379207][ 0] [drm] amdgpu kernel modesetting enabled.
[PATCH] drm/amdgpu: add raven1 gfxoff quirk
From: Peng Liu Fix screen corruption with openkylin. Link: https://bbs.openkylin.top/t/topic/171497 Signed-off-by: Peng Liu --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 2929c8972ea7..0cd5fd3fa18b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1301,6 +1301,8 @@ static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 }, /* Apple MacBook Pro (15-inch, 2019) Radeon Pro Vega 20 4 GB */ { 0x1002, 0x69af, 0x106b, 0x019a, 0xc0 }, + /* https://bbs.openkylin.top/t/topic/171497 */ + { 0x1002, 0x15d8, 0x19e5, 0x3e14, 0xc2}, { 0, 0, 0, 0, 0 }, }; -- 2.25.1
[PATCH] drm/amdgpu: enable gfxoff quirk on HP 705G4
From: Peng Liu Enabling gfxoff quirk results in perfectly usable graphical user interface on HP 705G4 DM with R5 2400G. Without the quirk, X server is completely unusable as every few seconds there is gpu reset due to ring gfx timeout. Signed-off-by: Peng Liu --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 2929c8972ea7..bd17e32b432d 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1301,6 +1301,8 @@ static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 }, /* Apple MacBook Pro (15-inch, 2019) Radeon Pro Vega 20 4 GB */ { 0x1002, 0x69af, 0x106b, 0x019a, 0xc0 }, + /* HP 705G4 DM with R5 2400G */ + { 0x1002, 0x15dd, 0x103c, 0x8464, 0xd6}, { 0, 0, 0, 0, 0 }, }; -- 2.25.1
[PATCH] drm/amdgpu: add dce6 drm_panic support
Add support for the drm_panic module, which displays a pretty user friendly message on the screen when a Linux kernel panic occurs. Signed-off-by: Lu Yao --- The patch can work properly on the TTY, but after start X, drawn image is messy, it looks like the data isn't linearly arranged. However at this time 'fb->modifier' is 'DRM_FORMAT_MOD_LINEAR'. Another difference I found is: For TTY, the amdgpu_bo is created with flag 'AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED|AMDGPU_GEM_CREATE_CPU_GTT_USWC| AMDGPU_GEM_CREATE_VRAM_CLEARED|AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS'. For X, the amdgpu_bo is created with flag 'AMDGPU_GEM_CREATE_NO_CPU_ACCESS|AMDGPU_GEM_CREATE_CPU_GTT_USWC' I try to use same flag for X, it looks like no difference. Can someone provide some insight into this problem or where I am going wrong. Thanks a lot. Test environment: X86 arch + v6.6 kernel + R7340. --- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 32 +++ 1 file changed, 32 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index 05c0df97f01d..12c3801c264a 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include "../../drm_internal.h" #include "amdgpu.h" #include "amdgpu_pm.h" @@ -2600,6 +2602,35 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = { .get_scanout_position = amdgpu_crtc_get_scanout_position, }; +static int dce_v6_0_drm_primary_plane_get_scanout_buffer(struct drm_plane *plane, +struct drm_scanout_buffer *sb) +{ + struct drm_framebuffer *fb; + struct drm_gem_object *obj; + struct amdgpu_bo *abo; + int ret = 0; + + if (!plane->fb || plane->fb->modifier != DRM_FORMAT_MOD_LINEAR) + return -ENODEV; + + fb = plane->fb; + sb->width = fb->width; + sb->height = fb->height; + sb->format = fb->format; + sb->pitch[0] = fb->pitches[0]; + + obj = fb->obj[0]; + abo = gem_to_amdgpu_bo(obj); + if (!abo || abo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) + return -EINVAL; + + return drm_gem_vmap(obj, &sb->map[0]); +} + +static const struct drm_plane_helper_funcs dce_v6_0_drm_primary_plane_helper_funcs = { + .get_scanout_buffer = dce_v6_0_drm_primary_plane_get_scanout_buffer +}; + static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) { struct amdgpu_crtc *amdgpu_crtc; @@ -2627,6 +2658,7 @@ static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) amdgpu_crtc->encoder = NULL; amdgpu_crtc->connector = NULL; drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v6_0_crtc_helper_funcs); + drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v6_0_drm_primary_plane_helper_funcs); return 0; } -- 2.25.1
Re: [PATCH] drm/amdgpu: add dce6 drm_panic support
On 2024/8/5 17:25, Jocelyn Falempe wrote: > > > On 02/08/2024 11:39, Christian König wrote: >> Am 02.08.24 um 09:17 schrieb Lu Yao: >>> Add support for the drm_panic module, which displays a pretty user >>> friendly message on the screen when a Linux kernel panic occurs. >>> >>> Signed-off-by: Lu Yao >>> --- >>> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 32 >>> +++ >>> 1 file changed, 32 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> index 05c0df97f01d..12c3801c264a 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> @@ -28,6 +28,8 @@ >>> #include >>> #include >>> #include >>> +#include >> >>> +#include "../../drm_internal.h" >> >> Well that this file is named "internal" and not in a common include >> directory is a strong indicator that you should absolutely *not* >> include it in a driver. >> >>> #include "amdgpu.h" >>> #include "amdgpu_pm.h" >>> @@ -2600,6 +2602,35 @@ static const struct drm_crtc_helper_funcs >>> dce_v6_0_crtc_helper_funcs = { >>> .get_scanout_position = amdgpu_crtc_get_scanout_position, >>> }; >>> +static int dce_v6_0_drm_primary_plane_get_scanout_buffer(struct >>> drm_plane *plane, >>> + struct drm_scanout_buffer *sb) >>> +{ >>> +struct drm_framebuffer *fb; >>> +struct drm_gem_object *obj; >>> +struct amdgpu_bo *abo; >>> +int ret = 0; >>> + >>> +if (!plane->fb || plane->fb->modifier != DRM_FORMAT_MOD_LINEAR) >>> +return -ENODEV; >>> + >>> +fb = plane->fb; >>> +sb->width = fb->width; >>> +sb->height = fb->height; >>> +sb->format = fb->format; >>> +sb->pitch[0] = fb->pitches[0]; >>> + >>> +obj = fb->obj[0]; >>> +abo = gem_to_amdgpu_bo(obj); >>> +if (!abo || abo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) >>> +return -EINVAL; >>> + >>> +return drm_gem_vmap(obj, &sb->map[0]); >> >> Yeah that will almost always not work. Most display buffers are >> tilled and not CPU accessible. > > For the CPU accessible issue, Christian mentioned there was a debug > interface on AMD GPU that can be used, to work around this: > > https://lore.kernel.org/dri-devel/0baabe1f-8924-2c9a-5cd4-59084a37d...@gmail.com/ > > and > https://lore.kernel.org/dri-devel/d233c376-ed07-2127-6084-8292d313d...@amd.com/ > > And you will need to use the scanout_buffer->set_pixel() callback to > write the pixels one by one, similar to what I've tried for nouveau with > https://patchwork.freedesktop.org/series/133963/ > > For the tiling format, the problem is that it is internal to the GPU, > and currently the driver don't know which tiling format is being used. > > It might be possible to disable tiling and compression, but it > requires some internal DC knowledge: > https://lore.kernel.org/dri-devel/f76a3297-7d63-8615-45c5-47f02b64a...@amd.com/ > > > > Best regards, >From the discussion provided, it is difficult to implement this feature >without the relevant data book and knowledge.(Whether how tiled memory >storage, or how to disable tiling of DC) It looks like I'll just have to wait for AMD engineers to implement this. Thanks a lot, Lu Yao
Re: [PATCH] drm/amdgpu: add dce6 drm_panic support
On Thu, Aug 8, 2024 at 13:24 PM Alex Deucher wrote: > > On Thu, Aug 8, 2024 at 12:43 PM Alex Deucher wrote: > > > > On Thu, Aug 8, 2024 at 2:35 AM Lu Yao wrote: > > > > > > On 2024/8/5 17:25, Jocelyn Falempe wrote: > > > > > > > > > > > > On 02/08/2024 11:39, Christian König wrote: > > > >> Am 02.08.24 um 09:17 schrieb Lu Yao: > > > >>> Add support for the drm_panic module, which displays a pretty user > > > >>> friendly message on the screen when a Linux kernel panic occurs. > > > >>> > > > >>> Signed-off-by: Lu Yao > > > >>> --- > > > >>> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 32 > > > >>> +++ > > > >>> 1 file changed, 32 insertions(+) > > > >>> > > > >>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > > > >>> b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > > > >>> index 05c0df97f01d..12c3801c264a 100644 > > > >>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > > > >>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > > > >>> @@ -28,6 +28,8 @@ > > > >>> #include > > > >>> #include > > > >>> #include > > > >>> +#include > > > >> > > > >>> +#include "../../drm_internal.h" > > > >> > > > >> Well that this file is named "internal" and not in a common include > > > >> directory is a strong indicator that you should absolutely *not* > > > >> include it in a driver. > > > >> > > > >>> #include "amdgpu.h" > > > >>> #include "amdgpu_pm.h" > > > >>> @@ -2600,6 +2602,35 @@ static const struct drm_crtc_helper_funcs > > > >>> dce_v6_0_crtc_helper_funcs = { > > > >>> .get_scanout_position = amdgpu_crtc_get_scanout_position, > > > >>> }; > > > >>> +static int dce_v6_0_drm_primary_plane_get_scanout_buffer(struct > > > >>> drm_plane *plane, > > > >>> + struct drm_scanout_buffer *sb) > > > >>> +{ > > > >>> +struct drm_framebuffer *fb; > > > >>> +struct drm_gem_object *obj; > > > >>> +struct amdgpu_bo *abo; > > > >>> +int ret = 0; > > > >>> + > > > >>> +if (!plane->fb || plane->fb->modifier != DRM_FORMAT_MOD_LINEAR) > > > >>> +return -ENODEV; > > > >>> + > > > >>> +fb = plane->fb; > > > >>> +sb->width = fb->width; > > > >>> +sb->height = fb->height; > > > >>> +sb->format = fb->format; > > > >>> +sb->pitch[0] = fb->pitches[0]; > > > >>> + > > > >>> +obj = fb->obj[0]; > > > >>> +abo = gem_to_amdgpu_bo(obj); > > > >>> +if (!abo || abo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) > > > >>> +return -EINVAL; > > > >>> + > > > >>> +return drm_gem_vmap(obj, &sb->map[0]); > > > >> > > > >> Yeah that will almost always not work. Most display buffers are > > > >> tilled and not CPU accessible. > > > > > > > > For the CPU accessible issue, Christian mentioned there was a debug > > > > interface on AMD GPU that can be used, to work around this: > > > > > > > > https://lore.kernel.org/dri-devel/0baabe1f-8924-2c9a-5cd4-59084a37d...@gmail.com/ > > > > and > > > > https://lore.kernel.org/dri-devel/d233c376-ed07-2127-6084-8292d313d...@amd.com/ > > > > > > > > And you will need to use the scanout_buffer->set_pixel() callback to > > > > write the pixels one by one, similar to what I've tried for nouveau with > > > > https://patchwork.freedesktop.org/series/133963/ > > > > > > > > For the tiling format, the problem is that it is internal to the GPU, > > > > and currently the driver don't know which tiling format is being used. > > > > > > > > It might be possible to disable tiling and compression, but it > > > > requires some internal DC knowledge: > > > > https://lore.kernel.org/dri-devel/f76a3297-7d63-8615-45c5-47f02b64a...@amd.com/ > > > > > > > > > > > > Best regards, > > > > > > From the discussion provided, it is difficult to implement this feature > > > without the relevant data book and knowledge.(Whether how tiled memory > > > storage, or how to disable tiling of DC) > > > > For DCE 6, the GRPH_ARRAY_MODE field in mmGRPH_CONTROL controls the > > display tiling. Set that field to GRPH_ARRAY_LINEAR_GENERAL (0) to > > disable tiling. > > For clarity that register is instanced so use mmGRPH_CONTROL + > amdgpu_crtc->crtc_offset to get the right instance. > It works, I'll submit a new patch soon. Thanks, Lu Yao > Alex
[PATCH v2] drm/amdgpu: add dce6 drm_panic support
Add support for the drm_panic module, which displays a pretty user friendly message on the screen when a Linux kernel panic occurs. Signed-off-by: Lu Yao --- Changes in v2: 1. Drop include "drm_internal.h" 2. Add disabling DC tiling ops. Per suggestion from previous thread: https://patchwork.freedesktop.org/patch/606879/?series=136832&rev=1 --- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 48 +++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index 05c0df97f01d..ba1b7a36caa3 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "amdgpu.h" #include "amdgpu_pm.h" @@ -2600,6 +2601,52 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = { .get_scanout_position = amdgpu_crtc_get_scanout_position, }; +static int dce_v6_0_drm_primary_plane_get_scanout_buffer(struct drm_plane *plane, +struct drm_scanout_buffer *sb) +{ + struct drm_framebuffer *fb; + struct amdgpu_bo *abo; + struct amdgpu_crtc *amdgpu_crtc; + struct amdgpu_device *adev; + uint32_t fb_format; + + if (!plane->fb) + return -EINVAL; + + fb = plane->fb; + + abo = gem_to_amdgpu_bo(fb->obj[0]); + amdgpu_crtc = to_amdgpu_crtc(plane->crtc); + adev = drm_to_adev(fb->dev); + + if (!abo->kmap.virtual && + ttm_bo_kmap(&abo->tbo, 0, PFN_UP(abo->tbo.base.size), &abo->kmap)) { + DRM_WARN("amdgpu bo map failed, panic won't be displayed\n"); + return -ENOMEM; + } + + if (abo->kmap.bo_kmap_type & TTM_BO_MAP_IOMEM_MASK) + iosys_map_set_vaddr_iomem(&sb->map[0], abo->kmap.virtual); + else + iosys_map_set_vaddr(&sb->map[0], abo->kmap.virtual); + + sb->width = fb->width; + sb->height = fb->height; + sb->format = fb->format; + sb->pitch[0] = fb->pitches[0]; + + /* Disable DC tiling */ + fb_format = RREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset); + fb_format &= ~GRPH_ARRAY_MODE(0x7); + WREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset, fb_format); + + return 0; +} + +static const struct drm_plane_helper_funcs dce_v6_0_drm_primary_plane_helper_funcs = { + .get_scanout_buffer = dce_v6_0_drm_primary_plane_get_scanout_buffer +}; + static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) { struct amdgpu_crtc *amdgpu_crtc; @@ -2627,6 +2674,7 @@ static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) amdgpu_crtc->encoder = NULL; amdgpu_crtc->connector = NULL; drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v6_0_crtc_helper_funcs); + drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v6_0_drm_primary_plane_helper_funcs); return 0; } -- 2.25.1
[PATCH] drm/imagination: Kconfig: add 'PAGE_SIZE=4K' dependency
When 'PAGE_SIZE=64K',the following compilation error occurs: " ../drivers/gpu/drm/imagination/pvr_fw_mips.c: In function ‘pvr_mips_fw_process’: ../drivers/gpu/drm/imagination/pvr_fw_mips.c:140:60: error: array subscript 0 is outside the bounds of an interior zero-length array ‘dma_addr_t[0]’ {aka ‘long long unsigned int[]’} [-Werror=zero-length-bounds] 140 | boot_data->pt_phys_addr[page_nr] = mips_data->pt_dma_addr[src_page_nr] + ~~^ In file included from ../drivers/gpu/drm/imagination/pvr_fw_mips.c:6: ../drivers/gpu/drm/imagination/pvr_fw_mips.h:30:13: note: while referencing ‘pt_dma_addr’ 30 | dma_addr_t pt_dma_addr[PVR_MIPS_PT_PAGE_COUNT]; " This is because 'PVR_MIPS_PT_PAGE_COUNT' is defined as '(ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K) \ >> PAGE_SHIFT', and under the above conditions, 'PAGE_SHIFT' is '16', 'ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES' is '4','ROGUE_MIPSFW_PAGE_SIZE_4K' is '4096',so 'PVR_MIPS_PT_PAGE_COUNT' is '0' causing the member 'pt_dma_addr' to be incorrectly defined. Signed-off-by: Lu Yao --- drivers/gpu/drm/imagination/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imagination/Kconfig b/drivers/gpu/drm/imagination/Kconfig index 3bfa2ac212dc..e585922f634d 100644 --- a/drivers/gpu/drm/imagination/Kconfig +++ b/drivers/gpu/drm/imagination/Kconfig @@ -3,7 +3,7 @@ config DRM_POWERVR tristate "Imagination Technologies PowerVR (Series 6 and later) & IMG Graphics" - depends on ARM64 + depends on (ARM64 && ARM64_PAGE_SHIFT=12) depends on DRM depends on PM select DRM_EXEC -- 2.25.1
[PATCH] drm/amdgpu: Fix assignment errors in 'si_common_early_init' functions
uvd_ctx_rreg/uvd_ctx_wreg correct value requires function pointer. Signed-off-by: Lu Yao --- drivers/gpu/drm/amd/amdgpu/si.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c index a757526153e5..455d49f7bd9c 100644 --- a/drivers/gpu/drm/amd/amdgpu/si.c +++ b/drivers/gpu/drm/amd/amdgpu/si.c @@ -2032,8 +2032,8 @@ static int si_common_early_init(void *handle) adev->pcie_wreg = &si_pcie_wreg; adev->pciep_rreg = &si_pciep_rreg; adev->pciep_wreg = &si_pciep_wreg; - adev->uvd_ctx_rreg = si_uvd_ctx_rreg; - adev->uvd_ctx_wreg = si_uvd_ctx_wreg; + adev->uvd_ctx_rreg = &si_uvd_ctx_rreg; + adev->uvd_ctx_wreg = &si_uvd_ctx_wreg; adev->didt_rreg = NULL; adev->didt_wreg = NULL; -- 2.25.1
[PATCH] drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer
For 'AMDGPU_FAMILY_SI' family cards, in 'si_common_early_init' func, init 'didt_rreg' and 'didt_wreg' to 'NULL'. But in func 'amdgpu_debugfs_regs_didt_read/write', using 'RREG32_DIDT' 'WREG32_DIDT' lacks of relevant judgment. And other 'amdgpu_ip_block_version' that use these two definitions won't be added for 'AMDGPU_FAMILY_SI'. So, add null pointer judgment before calling. Signed-off-by: Lu Yao --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index a53f436fa9f1..797d7d3bfd50 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -638,6 +638,11 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf, if (size & 0x3 || *pos & 0x3) return -EINVAL; + if (adev->didt_rreg == NULL) { + dev_err(adev->dev, "%s adev->didt_rreg is null!\n", __FUNC__); + return -EPERM; + } + r = pm_runtime_get_sync(adev_to_drm(adev)->dev); if (r < 0) { pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); @@ -694,6 +699,11 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __user if (size & 0x3 || *pos & 0x3) return -EINVAL; + if (adev->didt_wreg == NULL) { + dev_err(adev->dev, "%s adev->didt_wreg is null!\n", __FUNC__); + return -EPERM; + } + r = pm_runtime_get_sync(adev_to_drm(adev)->dev); if (r < 0) { pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); -- 2.25.1
[PATCH v2] drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer
For 'AMDGPU_FAMILY_SI' family cards, in 'si_common_early_init' func, init 'didt_rreg' and 'didt_wreg' to 'NULL'. But in func 'amdgpu_debugfs_regs_didt_read/write', using 'RREG32_DIDT' 'WREG32_DIDT' lacks of relevant judgment. And other 'amdgpu_ip_block_version' that use these two definitions won't be added for 'AMDGPU_FAMILY_SI'. So, add null pointer judgment before calling. Signed-off-by: Lu Yao --- Changes in v2: 1. Drop dev_err message. 2. Change error code from 'EPERM' to 'EOPNOTSUPP' Link to v1: https://lore.kernel.org/all/20231122093509.34302-1-ya...@kylinos.cn/ Thanks Christian for his comments. --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index a53f436fa9f1..e098cd66fa2a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -638,6 +638,9 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf, if (size & 0x3 || *pos & 0x3) return -EINVAL; + if (adev->didt_rreg == NULL) + return -EOPNOTSUPP; + r = pm_runtime_get_sync(adev_to_drm(adev)->dev); if (r < 0) { pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); @@ -694,6 +697,9 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __user if (size & 0x3 || *pos & 0x3) return -EINVAL; + if (adev->didt_wreg == NULL) + return -EOPNOTSUPP; + r = pm_runtime_get_sync(adev_to_drm(adev)->dev); if (r < 0) { pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); -- 2.25.1
[PATCH] drm/xe: select X86_PLATFORM_DEVICES when ACPI_WMI is selected
ACPI_WMI is a subitem of X86_PLATFORM_DEVICES. And X86_PLATFORM_DEVICES is not selected in the current Kconfig, and may cause Kconfig warnings: WARNING: unmet direct dependencies detected for ACPI_WMI Depends on [n]: X86_PLATFORM_DEVICES [=n] && ACPI [=y] Selected by [m]: - DRM_XE [=m] && HAS_IOMEM [=y] && DRM [=m] && PCI [=y] && MMU [=y] && (m && MODULES [=y] || y && KUNIT [=y]=y) && X86 [=y] && ACPI [=y] Signed-off-by: Lu Yao --- drivers/gpu/drm/xe/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig index 1a556d087e63..f483e69a5d0f 100644 --- a/drivers/gpu/drm/xe/Kconfig +++ b/drivers/gpu/drm/xe/Kconfig @@ -26,6 +26,7 @@ config DRM_XE select INPUT if ACPI select ACPI_VIDEO if X86 && ACPI select ACPI_BUTTON if ACPI + select X86_PLATFORM_DEVICES if X86 && ACPI select ACPI_WMI if X86 && ACPI select SYNC_FILE select IOSF_MBI -- 2.25.1
[PATCH] drm/radeon/ni: Fix memory leak and missing error handling in ni_init_microcode()
'smc_fw' is not released when its size is not as expected, causing memory leak. And when other firmware sizes do not meet expectations, 'err' is assigned but does not jump to 'out'. Signed-off-by: Lu Yao --- drivers/gpu/drm/radeon/ni.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 3890911fe693..11f7a05a5261 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -765,6 +765,7 @@ int ni_init_microcode(struct radeon_device *rdev) pr_err("ni_cp: Bogus length %zu in firmware \"%s\"\n", rdev->me_fw->size, fw_name); err = -EINVAL; + goto out; } snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); @@ -775,6 +776,7 @@ int ni_init_microcode(struct radeon_device *rdev) pr_err("ni_rlc: Bogus length %zu in firmware \"%s\"\n", rdev->rlc_fw->size, fw_name); err = -EINVAL; + goto out; } /* no MC ucode on TN */ @@ -787,6 +789,7 @@ int ni_init_microcode(struct radeon_device *rdev) pr_err("ni_mc: Bogus length %zu in firmware \"%s\"\n", rdev->mc_fw->size, fw_name); err = -EINVAL; + goto out; } } @@ -795,9 +798,7 @@ int ni_init_microcode(struct radeon_device *rdev) err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); if (err) { pr_err("smc: error loading firmware \"%s\"\n", fw_name); - release_firmware(rdev->smc_fw); - rdev->smc_fw = NULL; - err = 0; + err = -EINVAL; } else if (rdev->smc_fw->size != smc_req_size) { pr_err("ni_mc: Bogus length %zu in firmware \"%s\"\n", rdev->smc_fw->size, fw_name); @@ -818,6 +819,8 @@ int ni_init_microcode(struct radeon_device *rdev) rdev->rlc_fw = NULL; release_firmware(rdev->mc_fw); rdev->mc_fw = NULL; + release_firmware(rdev->smc_fw); + rdev->smc_fw = NULL; } return err; } -- 2.25.1
Re: [PATCH v2] drm/amdgpu: add dce6 drm_panic support
On 2024/9/17 21:21, Alex Deucher wrote: On Mon, Aug 12, 2024 at 2:10 AM Lu Yao wrote: Add support for the drm_panic module, which displays a pretty user friendly message on the screen when a Linux kernel panic occurs. Signed-off-by: Lu Yao Patch looks good to me. Any chance you want to convert the other non-DC dce files (dce_v8_0.c, dce_v10_0.c, dce_v11_0.c) while you are at it? Alex I don't have any hardware with those dc ip blocks. Although the code logic looks consistent, but it still needs to be tested, right? ; ) Lu Yao --- Changes in v2: 1. Drop include "drm_internal.h" 2. Add disabling DC tiling ops. Per suggestion from previous thread: https://patchwork.freedesktop.org/patch/606879/?series=136832&rev=1 --- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 48 +++ 1 file changed, 48 insertions(+) -- 2.25.1
[PATCH] drm/amdgpu: Add null pointer check before task_info get and put
This patch add null pointer check for amdgpu_vm_put_task_info and amdgpu_vm_get_task_info_vm, because there is only a warning if create task_info failed in amdgpu_vm_init. Fixes: b8f67b9ddf4f ("drm/amdgpu: change vm->task_info handling") Signed-off-by: Lu Yao --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index c9c48b782ec1..65edd74bd944 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2336,7 +2336,8 @@ amdgpu_vm_get_vm_from_pasid(struct amdgpu_device *adev, u32 pasid) */ void amdgpu_vm_put_task_info(struct amdgpu_task_info *task_info) { - kref_put(&task_info->refcount, amdgpu_vm_destroy_task_info); + if (task_info) + kref_put(&task_info->refcount, amdgpu_vm_destroy_task_info); } /** @@ -2352,7 +2353,7 @@ amdgpu_vm_get_task_info_vm(struct amdgpu_vm *vm) { struct amdgpu_task_info *ti = NULL; - if (vm) { + if (vm && vm->task_info) { ti = vm->task_info; kref_get(&vm->task_info->refcount); } -- 2.25.1
[PATCH] drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state'
Add null pointer check before use fb. Reported by smatch. Signed-off-by: Lu Yao --- drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c index d89630b2d5c1..20bfa9589ee7 100644 --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c @@ -640,18 +640,18 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_ intel_plane_is_scaled(new_plane_state)) new_crtc_state->scaled_planes |= BIT(plane->id); - if (new_plane_state->uapi.visible && + if (fb && new_plane_state->uapi.visible && intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) new_crtc_state->nv12_planes |= BIT(plane->id); - if (new_plane_state->uapi.visible && + if (fb && new_plane_state->uapi.visible && fb->format->format == DRM_FORMAT_C8) new_crtc_state->c8_planes |= BIT(plane->id); if (new_plane_state->uapi.visible || old_plane_state->uapi.visible) new_crtc_state->update_planes |= BIT(plane->id); - if (new_plane_state->uapi.visible && + if (fb && new_plane_state->uapi.visible && intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) { new_crtc_state->data_rate_y[plane->id] = intel_plane_data_rate(new_crtc_state, new_plane_state, 0); -- 2.25.1
[PATCH] drm/i915/display: add audio dis/enable when connector hotplug
Now audio enable/disable depends on an atomic commit, it doesn't make sence. For wayland, there will trigering an atomic commit, so it works well. But for Xorg using modesetting, there won't. In this case, unplug the HDMI/DP and the audio jack event is not triggered, resulting in still having a HDMI/DP audio output choice. Signed-off-by: Lu Yao --- drivers/gpu/drm/i915/display/intel_hotplug.c | 31 1 file changed, 31 insertions(+) --- Test hardware: CPU: i5-12500 GPU: UHD Graphics 770 diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c index 3adc791d3776..332d6e1a99cd 100644 --- a/drivers/gpu/drm/i915/display/intel_hotplug.c +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c @@ -32,6 +32,7 @@ #include "intel_display_types.h" #include "intel_hotplug.h" #include "intel_hotplug_irq.h" +#include "intel_audio.h" /** * DOC: Hotplug @@ -415,6 +416,35 @@ void intel_hpd_trigger_irq(struct intel_digital_port *dig_port) queue_work(i915->display.hotplug.dp_wq, &i915->display.hotplug.dig_port_work); } +/* + * when connector hotplug state changed, audio need changed too. + */ +static void i915_audio_hotplug(struct intel_connector *connector) +{ + struct drm_crtc *crtc; + struct drm_device *dev = connector->base.dev; + + drm_for_each_crtc(crtc, dev) { + if (connector->base.state->crtc == crtc) { + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct intel_crtc_state *pipe_config = + to_intel_crtc_state(intel_crtc->base.state); + struct intel_encoder *encoder = + intel_attached_encoder(connector); + + if (pipe_config && pipe_config->has_audio) { + if (connector->base.status == connector_status_disconnected) + intel_audio_codec_disable(encoder, pipe_config, + connector->base.state); + else if (connector->base.status == connector_status_connected) + intel_audio_codec_enable(encoder, pipe_config, + connector->base.state); + } + break; + } + } +} + /* * Handle hotplug events outside the interrupt handler proper. */ @@ -487,6 +517,7 @@ static void i915_hotplug_work_func(struct work_struct *work) drm_connector_get(&connector->base); first_changed_connector = &connector->base; } + i915_audio_hotplug(connector); break; case INTEL_HOTPLUG_RETRY: retry |= hpd_bit; -- 2.25.1