[bug report] drm/amd/display: Update MALL SS NumWays calculation
Hello Alvin Lee, The patch 525a65c77db5: "drm/amd/display: Update MALL SS NumWays calculation" from Sep 14, 2022, leads to the following Smatch static checker warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_hwseq.c:282 dcn32_calculate_cab_allocation() warn: if statement not indented drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_hwseq.c 276 277 // Include cursor size for CAB allocation 278 for (j = 0; j < dc->res_pool->pipe_count; j++) { 279 struct pipe_ctx *pipe = >res_ctx.pipe_ctx[j]; 280 struct hubp *hubp = pipe->plane_res.hubp; 281 --> 282 if (pipe->stream && pipe->plane_state && hubp) 283 /* Find the cursor plane and use the exact size instead of 284 using the max for calculation */ The code for this if statement is missing so it runs into the next if statement. 285 286 if (hubp->curs_attr.width > 0) { 287 // Round cursor width to next multiple of 64 288 cursor_size = (((hubp->curs_attr.width + 63) / 64) * 64) * hubp->curs_attr.height; 289 290 switch (pipe->stream->cursor_attributes.color_format) { 291 case CURSOR_MODE_MONO: 292 cursor_size /= 2; 293 cursor_bpp = 4; 294 break; 295 case CURSOR_MODE_COLOR_1BIT_AND: 296 case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA: 297 case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA: 298 cursor_size *= 4; 299 cursor_bpp = 4; 300 break; 301 regards, dan carpenter
Re: [PATCH] drm/amd/display: disable psr whenever applicable
On 2022-10-03 11:26, S, Shirish wrote: Ping! Regards, Shirish S On 9/30/2022 7:17 PM, S, Shirish wrote: On 9/30/2022 6:59 PM, Harry Wentland wrote: +Leo On 9/30/22 06:27, Shirish S wrote: [Why] psr feature continues to be enabled for non capable links. Do you have more info on what issues you're seeing with this? Code wise without this change we end up setting "vblank_disable_immediate" parameter to false for the failing links also. Issue wise there is a remote chance of this leading to eDP/connected monitor not lighting up. I'm surprised psr_settings.psr_feature_enabled can be 'true' before amdgpu_dm_set_psr_caps() runs. it should default to 'false', and it's set early on during amdgpu_dm_initialize_drm_device() before any other psr-related code runs. In other words, I don't expect psr_settings.psr_feature_enabled to be 'true' on early return of dm_set_psr_caps(). What are the sequence of events that causes an issue for you? [How] disable the feature on links that are not capable of the same. Signed-off-by: Shirish S --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c index 8ca10ab3dfc1..f73af028f312 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c @@ -60,11 +60,17 @@ static bool link_supports_psrsu(struct dc_link *link) */ void amdgpu_dm_set_psr_caps(struct dc_link *link) { - if (!(link->connector_signal & SIGNAL_TYPE_EDP)) + if (!(link->connector_signal & SIGNAL_TYPE_EDP)) { + DRM_ERROR("Disabling PSR as connector is not eDP\n") I don't think we should log an error here. My objective of logging an error was to inform user/developer that this boot PSR enablement had issues. It's not really an issue, PSR simply cannot be enabled on non-eDP or disconnected links. However, it is concerning if we enter this function with psr_feature_enabled == true. Thanks, Leo Am fine with moving it to INFO or remove it, if you insist. Thanks for your comments. Regards, Shirish S + link->psr_settings.psr_feature_enabled = false; return; + } - if (link->type == dc_connection_none) + if (link->type == dc_connection_none) { + DRM_ERROR("Disabling PSR as eDP connection type is invalid\n") Same here, this doesn't warrant an error log. Harry + link->psr_settings.psr_feature_enabled = false; return; + } if (link->dpcd_caps.psr_info.psr_version == 0) { link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
Re: [PATCH] Revert "drm/amdgpu: use dirty framebuffer helper"
Acked-by: Alex Deucher On Wed, Oct 5, 2022 at 11:47 AM Hamza Mahfooz wrote: > > This reverts commit 10b6e91bd1ee9cd237ffbc244ad9c25b5fd3e167. > > Unfortunately, this commit causes performance regressions on non-PSR > setups. So, just revert it until FB_DAMAGE_CLIPS support can be added. > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2189 > Signed-off-by: Hamza Mahfooz > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 14 ++ > 1 file changed, 2 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > index 23998f727c7f..1a06b8d724f3 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > @@ -38,8 +38,6 @@ > #include > #include > #include > -#include > -#include > #include > #include > #include > @@ -500,12 +498,6 @@ static const struct drm_framebuffer_funcs > amdgpu_fb_funcs = { > .create_handle = drm_gem_fb_create_handle, > }; > > -static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { > - .destroy = drm_gem_fb_destroy, > - .create_handle = drm_gem_fb_create_handle, > - .dirty = drm_atomic_helper_dirtyfb, > -}; > - > uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, > uint64_t bo_flags) > { > @@ -1108,10 +1100,8 @@ static int > amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev, > if (ret) > goto err; > > - if (drm_drv_uses_atomic_modeset(dev)) > - ret = drm_framebuffer_init(dev, >base, > _fb_funcs_atomic); > - else > - ret = drm_framebuffer_init(dev, >base, _fb_funcs); > + ret = drm_framebuffer_init(dev, >base, _fb_funcs); > + > if (ret) > goto err; > > -- > 2.37.3 >
[linux-next:master] BUILD REGRESSION 67ae4f7434cee86ee318d46fb10b8a9840ad2e81
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: 67ae4f7434cee86ee318d46fb10b8a9840ad2e81 Add linux-next specific files for 20221005 Error/Warning reports: https://lore.kernel.org/linux-mm/202209060229.dvuyxjbv-...@intel.com https://lore.kernel.org/llvm/202209220019.yr2vuxhg-...@intel.com https://lore.kernel.org/llvm/202210041553.k9dc1joc-...@intel.com https://lore.kernel.org/llvm/202210060148.uxbijocs-...@intel.com Error/Warning: (recently discovered and may have been fixed) ERROR: modpost: "devm_ioremap_resource" [drivers/dma/fsl-edma.ko] undefined! ERROR: modpost: "devm_ioremap_resource" [drivers/dma/idma64.ko] undefined! ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma.ko] undefined! ERROR: modpost: "devm_memremap" [drivers/misc/open-dice.ko] undefined! ERROR: modpost: "devm_memunmap" [drivers/misc/open-dice.ko] undefined! ERROR: modpost: "devm_platform_ioremap_resource" [drivers/char/xillybus/xillybus_of.ko] undefined! ERROR: modpost: "ioremap" [drivers/net/ethernet/8390/pcnet_cs.ko] undefined! ERROR: modpost: "ioremap" [drivers/tty/ipwireless/ipwireless.ko] undefined! ERROR: modpost: "iounmap" [drivers/net/ethernet/8390/pcnet_cs.ko] undefined! ERROR: modpost: "iounmap" [drivers/tty/ipwireless/ipwireless.ko] undefined! arch/arm64/kernel/alternative.c:199:6: warning: no previous prototype for 'apply_alternatives_vdso' [-Wmissing-prototypes] arch/arm64/kernel/alternative.c:295:14: warning: no previous prototype for 'alt_cb_patch_nops' [-Wmissing-prototypes] arch/loongarch/kernel/traps.c:250 die() warn: variable dereferenced before check 'regs' (see line 244) arch/loongarch/mm/init.c:166:24: warning: variable 'new' set but not used [-Wunused-but-set-variable] drivers/gpu/drm/amd/amdgpu/../display/dc/virtual/virtual_link_hwss.c:40:6: warning: no previous prototype for 'virtual_disable_link_output' [-Wmissing-prototypes] drivers/gpu/drm/bridge/ite-it6505.c:2712 it6505_extcon_work() warn: pm_runtime_get_sync() also returns 1 on success drivers/platform/loongarch/loongson-laptop.c:377 loongson_laptop_get_brightness() warn: impossible condition '(level < 0) => (0-255 < 0)' drivers/vfio/pci/vfio_pci_core.c:775 vfio_pci_ioctl_get_region_info() warn: potential spectre issue 'pdev->resource' [w] drivers/vfio/pci/vfio_pci_core.c:855 vfio_pci_ioctl_get_region_info() warn: potential spectre issue 'vdev->region' [r] fs/ext4/super.c:1744:19: warning: 'deprecated_msg' defined but not used [-Wunused-const-variable=] include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_417' declared with attribute error: FIELD_GET: mask is not constant kernel/bpf/memalloc.c:500 bpf_mem_alloc_destroy() error: potentially dereferencing uninitialized 'c'. net/mac80211/iface.c:251 ieee80211_can_powered_addr_change() warn: inconsistent returns '>mtx'. Unverified Error/Warning (likely false positive, please contact us if interested): ERROR: modpost: "__tsan_memcpy" [arch/s390/crypto/ghash_s390.ko] undefined! ERROR: modpost: "__tsan_memcpy" [arch/s390/crypto/sha512_s390.ko] undefined! ERROR: modpost: "__tsan_memcpy" [fs/binfmt_misc.ko] undefined! ERROR: modpost: "__tsan_memcpy" [fs/pstore/ramoops.ko] undefined! ERROR: modpost: "__tsan_memset" [arch/s390/crypto/ghash_s390.ko] undefined! ERROR: modpost: "__tsan_memset" [arch/s390/crypto/sha512_s390.ko] undefined! ERROR: modpost: "__tsan_memset" [fs/autofs/autofs4.ko] undefined! ERROR: modpost: "__tsan_memset" [fs/binfmt_misc.ko] undefined! ERROR: modpost: "__tsan_memset" [fs/cramfs/cramfs.ko] undefined! ERROR: modpost: "__tsan_memset" [fs/pstore/ramoops.ko] undefined! s390x-linux-ld: self.c:(.text+0xf6): undefined reference to `__tsan_memcpy' thread_self.c:(.text+0xe4): undefined reference to `__tsan_memcpy' Error/Warning ids grouped by kconfigs: gcc_recent_errors |-- alpha-allyesconfig | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-virtual-virtual_link_hwss.c:warning:no-previous-prototype-for-virtual_disable_link_output |-- alpha-randconfig-s042-20221002 | |-- drivers-thermal-broadcom-ns-thermal.c:sparse:sparse:incorrect-type-in-argument-(different-address-spaces)-expected-void-data-got-void-noderef-__iomem-assigned-pvtmon | |-- drivers-thermal-broadcom-ns-thermal.c:sparse:sparse:incorrect-type-in-initializer-(different-address-spaces)-expected-void-noderef-__iomem-pvtmon-got-void | |-- drivers-thermal-broadcom-ns-thermal.c:sparse:sparse:incorrect-type-in-initializer-(different-address-spaces)-expected-void-noderef-__iomem-pvtmon-got-void-devdata | |-- fs-ext4-fast_commit.c:sparse:sparse:incorrect-type-in-argument-(different-base-types)-expected-int-priv1-got-restricted-__le16-addressable-usertype-fc_len | |-- fs-ext4-fast_commit.c:sparse
Re: [PATCH] drm/amdgpu/dm/mst: Fix incorrect usage of drm_dp_add_payload_part2()
On Tue, 2022-10-04 at 16:46 -0400, Rodrigo Siqueira Jordao wrote: > > On 2022-10-04 16:24, Lyude Paul wrote: > > Yikes, it appears somehow I totally made a mistake here. We're currently > > checking to see if drm_dp_add_payload_part2() returns a non-zero value to > > indicate success. That's totally wrong though, as this function only > > returns a zero value on success - not the other way around. > > > > So, fix that. > > > > Signed-off-by: Lyude Paul > > Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/2171 > > Fixes: 4d07b0bc4034 ("drm/display/dp_mst: Move all payload info into the > > atomic state") > > --- > > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > > index b8077fcd4651..00598def5b39 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > > @@ -297,7 +297,7 @@ bool dm_helpers_dp_mst_send_payload_allocation( > > clr_flag = MST_ALLOCATE_NEW_PAYLOAD; > > } > > > > - if (enable && drm_dp_add_payload_part2(mst_mgr, mst_state->base.state, > > payload)) { > > + if (enable && drm_dp_add_payload_part2(mst_mgr, mst_state->base.state, > > payload) == 0) { > > amdgpu_dm_set_mst_status(>mst_status, > > set_flag, false); > > } else { > > Hi Lyude, > > Maybe I'm missing something, but I can't find the > drm_dp_add_payload_part2() function on amd-staging-drm-next. Which repo > are you using? If it's not on amd-staging-drm-next then it likely hasn't gotten backported to amd's branch yet and is in drm-misc-next > > Thanks > Siqueira > -- Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
Re: [PATCH v2] drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case
Am 2022-10-05 um 07:03 schrieb Danijel Slivka: CPU pagetable updates have issues with HDP flush as VF MMIO access protection is not allowing write during sriov runtime to mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL Signed-off-by: Danijel Slivka --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 83b0c5d86e48..32088ac0666c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2338,7 +2338,9 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) */ #ifdef CONFIG_X86_64 if (amdgpu_vm_update_mode == -1) { - if (amdgpu_gmc_vram_full_visible(>gmc)) + if (amdgpu_gmc_vram_full_visible(>gmc) && + !(adev->asic_type == CHIP_SIENNA_CICHLID && + amdgpu_sriov_vf(adev))) This would need at least a code comment. But I'd prefer a more general solution that expresses that some ASICs don't allow any MMIO access under SRIOV. I found that there is this function defined in amdgpu_virt.c/h: bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev). Would this return the correct result and could you use it here instead of a hard-coded asic_type? Or maybe this could be added as a flag in (adev)->virt.caps and get initialized in some ASIC-specific code path. Regards, Felix adev->vm_manager.vm_update_mode = AMDGPU_VM_USE_CPU_FOR_COMPUTE; else
[PATCH] Revert "drm/amdgpu: use dirty framebuffer helper"
This reverts commit 10b6e91bd1ee9cd237ffbc244ad9c25b5fd3e167. Unfortunately, this commit causes performance regressions on non-PSR setups. So, just revert it until FB_DAMAGE_CLIPS support can be added. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2189 Signed-off-by: Hamza Mahfooz --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 23998f727c7f..1a06b8d724f3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -38,8 +38,6 @@ #include #include #include -#include -#include #include #include #include @@ -500,12 +498,6 @@ static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .create_handle = drm_gem_fb_create_handle, }; -static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { - .destroy = drm_gem_fb_destroy, - .create_handle = drm_gem_fb_create_handle, - .dirty = drm_atomic_helper_dirtyfb, -}; - uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, uint64_t bo_flags) { @@ -1108,10 +1100,8 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev, if (ret) goto err; - if (drm_drv_uses_atomic_modeset(dev)) - ret = drm_framebuffer_init(dev, >base, _fb_funcs_atomic); - else - ret = drm_framebuffer_init(dev, >base, _fb_funcs); + ret = drm_framebuffer_init(dev, >base, _fb_funcs); + if (ret) goto err; -- 2.37.3
[PATCH v2] drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case
CPU pagetable updates have issues with HDP flush as VF MMIO access protection is not allowing write during sriov runtime to mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL Signed-off-by: Danijel Slivka --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 83b0c5d86e48..32088ac0666c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2338,7 +2338,9 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) */ #ifdef CONFIG_X86_64 if (amdgpu_vm_update_mode == -1) { - if (amdgpu_gmc_vram_full_visible(>gmc)) + if (amdgpu_gmc_vram_full_visible(>gmc) && + !(adev->asic_type == CHIP_SIENNA_CICHLID && + amdgpu_sriov_vf(adev))) adev->vm_manager.vm_update_mode = AMDGPU_VM_USE_CPU_FOR_COMPUTE; else -- 2.25.1