Re: [PATCH 14/15] mailbox: mediatek: Add mt8195 support for CMDQ secure driver
Re: [RFT PATCH v2 01/12] drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time
Hi Doug, On Fri, Sep 22, 2023 at 08:44:16AM -0700, Doug Anderson wrote: > Hi, > > On Fri, Sep 22, 2023 at 12:56 AM Laurentiu Palcu > wrote: > > > > Hi, > > > > On Thu, Sep 21, 2023 at 12:26:44PM -0700, Douglas Anderson wrote: > > > Based on grepping through the source code this driver appears to be > > > missing a call to drm_atomic_helper_shutdown() at system shutdown > > > time. Among other things, this means that if a panel is in use that it > > > won't be cleanly powered off at system shutdown time. > > > > > > The fact that we should call drm_atomic_helper_shutdown() in the case > > > of OS shutdown/restart comes straight out of the kernel doc "driver > > > instance overview" in drm_drv.c. > > > > > > Suggested-by: Maxime Ripard > > > Reviewed-by: Maxime Ripard > > > Signed-off-by: Douglas Anderson > > > > No issues found on i.MX8MQ. > > > > Tested-by: Laurentiu Palcu > > Reviewed-by: Laurentiu Palcu > > Thanks! Would you expect this patch to land through drm-misc? If so, > I'm happy to commit it there with your tags. Yes, please do. The i.MX8MQ DCSS patches go through drm-misc. > If patches to this driver normally flow through drm-misc, I'm also > happy to post a patch to MAINTAINERS (or review a patch you post) > adding this to the entry for "NXP i.MX 8MQ DCSS DRIVER": > > T: git git://anongit.freedesktop.org/drm/drm-misc > > ...which would make it obvious in the future that things should land > through drm-misc. Thanks, that sounds good. Laurentiu
Re: [PATCH] accel/ivpu: Add Arrow Lake pci id
On Fri, Sep 22, 2023 at 09:24:08AM -0600, Jeffrey Hugo wrote: > On 9/22/2023 7:22 AM, Stanislaw Gruszka wrote: > > Enable VPU on Arrow Lake CPUs. > > > > Reviewed-by: Krystian Pradzynski > > Reviewed-by: Karol Wachowski > > Signed-off-by: Stanislaw Gruszka > > --- > > drivers/accel/ivpu/ivpu_drv.c | 1 + > > drivers/accel/ivpu/ivpu_drv.h | 2 ++ > > 2 files changed, 3 insertions(+) > > > > diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c > > index ba79f397c9e8..aa7314fdbc0f 100644 > > --- a/drivers/accel/ivpu/ivpu_drv.c > > +++ b/drivers/accel/ivpu/ivpu_drv.c > > @@ -634,6 +634,7 @@ static void ivpu_dev_fini(struct ivpu_device *vdev) > > static struct pci_device_id ivpu_pci_ids[] = { > > { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) }, > > + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) }, > > { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) }, > > { } > > }; > > diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h > > index 9e8c075fe9ef..03b3d6532fb6 100644 > > --- a/drivers/accel/ivpu/ivpu_drv.h > > +++ b/drivers/accel/ivpu/ivpu_drv.h > > @@ -23,6 +23,7 @@ > > #define DRIVER_DATE "20230117" > > #define PCI_DEVICE_ID_MTL 0x7d1d > > +#define PCI_DEVICE_ID_ARL 0xad1d > > #define PCI_DEVICE_ID_LNL 0x643e > > I'm curious, how are these ordered? Release date? Doesn't seem like it is > alphabetical nor numerical by DID. Yes, it's release date based. > Not a problem, just something I'd like to know. > > Reviewed-by: Jeffrey Hugo Thanks Stanislaw
Re: [PATCH 06/15] mailbox: mediatek: Add cmdq_mbox_stop to disable GCE thread
Re: [PATCH 07/15] mailbox: mediatek: Add loop pkt flag and irq handling for loop command
Re: [PATCH 06/15] mailbox: mediatek: Add cmdq_mbox_stop to disable GCE thread
Re: [PATCH 03/15] soc: mailbox: Add SPR definition for GCE
Re: [PATCH 02/15] dt-bindings: gce: mt8195: Add CMDQ_SYNC_TOKEN_SECURE_THR_EOF event id
Re: [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration
Hi Jernej, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.6-rc3 next-20230921] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jernej-Skrabec/drm-sun4i-dw-hdmi-Deinit-PHY-in-fail-path/20230925-032818 base: linus/master patch link: https://lore.kernel.org/r/20230924192604.3262187-6-jernej.skrabec%40gmail.com patch subject: [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration config: parisc-randconfig-002-20230925 (https://download.01.org/0day-ci/archive/20230925/202309251030.rztxxyfe-...@intel.com/config) compiler: hppa-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230925/202309251030.rztxxyfe-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202309251030.rztxxyfe-...@intel.com/ All errors (new ones prefixed by >>): hppa-linux-ld: drivers/gpu/drm/sun4i/sun8i_hdmi_phy.o: in function `sun8i_hdmi_phy_driver_init': >> (.init.text+0x0): multiple definition of `init_module'; >> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o:(.init.text+0x0): first defined here hppa-linux-ld: drivers/gpu/drm/sun4i/sun8i_hdmi_phy.o: in function `sun8i_hdmi_phy_driver_exit': >> (.exit.text+0x0): multiple definition of `cleanup_module'; >> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o:(.exit.text+0x0): first defined here -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 10/15] platform/x86/amd/pmf: Add capability to sideload of policy binary
Hi Shyam, kernel test robot noticed the following build warnings: [auto build test WARNING on hid/for-next] [also build test WARNING on linus/master v6.6-rc3 next-20230921] [cannot apply to drm-misc/drm-misc-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Shyam-Sundar-S-K/platform-x86-amd-pmf-Add-PMF-TEE-interface/20230923-015418 base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next patch link: https://lore.kernel.org/r/20230922175056.244940-11-Shyam-sundar.S-k%40amd.com patch subject: [PATCH 10/15] platform/x86/amd/pmf: Add capability to sideload of policy binary config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230925/202309251031.awddkrgs-...@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230925/202309251031.awddkrgs-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202309251031.awddkrgs-...@intel.com/ All warnings (new ones prefixed by >>): >> drivers/platform/x86/amd/pmf/tee-if.c:305:5: warning: no previous prototype >> for 'amd_pmf_open_pb' [-Wmissing-prototypes] 305 | int amd_pmf_open_pb(struct amd_pmf_dev *dev, struct dentry *debugfs_root) | ^~~ vim +/amd_pmf_open_pb +305 drivers/platform/x86/amd/pmf/tee-if.c 304 > 305 int amd_pmf_open_pb(struct amd_pmf_dev *dev, struct dentry > *debugfs_root) 306 { 307 struct dentry *file = NULL; 308 309 dev->esbin = debugfs_create_dir("pb", debugfs_root); 310 if (IS_ERR(dev->esbin)) 311 return -EINVAL; 312 313 file = debugfs_create_file("update_policy", 0644, dev->esbin, dev, _fops); 314 if (!file) 315 return -EINVAL; 316 317 return 0; 318 } 319 #endif 320 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
linux-next: manual merge of the drm-misc tree with Linus' tree
Hi all, Today's linux-next merge of the drm-misc tree got a conflict in: drivers/accel/qaic/qaic_data.c between commit: 2d956177b7c9 ("accel/qaic: Fix slicing memory leak") from Linus' tree and commit: 217b812364d3 ("accel/qaic: Add QAIC_DETACH_SLICE_BO IOCTL") from the drm-misc tree. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc drivers/accel/qaic/qaic_data.c index f4b06792c6f1,c90fa6a430f6.. --- a/drivers/accel/qaic/qaic_data.c +++ b/drivers/accel/qaic/qaic_data.c @@@ -1018,10 -1031,10 +1031,11 @@@ int qaic_attach_slice_bo_ioctl(struct d if (args->hdr.dir == DMA_TO_DEVICE) dma_sync_sgtable_for_cpu(>pdev->dev, bo->sgt, args->hdr.dir); - bo->dbc = dbc; + bo->sliced = true; + list_add_tail(>bo_list, >dbc->bo_lists); srcu_read_unlock(>ch_lock, rcu_id); - drm_gem_object_put(obj); + mutex_unlock(>lock); + kfree(slice_ent); srcu_read_unlock(>dev_lock, qdev_rcu_id); srcu_read_unlock(>qddev_lock, usr_rcu_id); pgpJn88TTti1n.pgp Description: OpenPGP digital signature
Re: [PATCH 2/2] ARM: dts: imx: add support for the ATM0700D4 panel attached to sk-imx53
On Tue, Aug 29, 2023 at 12:19:23PM +0300, Dmitry Baryshkov wrote: > On Mon, 28 Aug 2023 at 19:02, Laurent Pinchart wrote: > > On Sun, Aug 27, 2023 at 12:54:29AM +0300, Dmitry Baryshkov wrote: > > > The SK-ATM0700D4-Plug is an extension board (provided by the same > > > manufacturer, [1]) which can be connected to the SK-IMX53 panel kit. The > > > panel can be connected either using the RGB parallel bus or using the > > > LVDS connector (recommended). Add DT files describing this "shield", > > > both RGB and LVDS connections. > > > > Shouldn't these be implemented as overlays ? > > Indeed, I see that imx8mm opted to use overlays. However frankly > speaking I don't see a benefit in using DT overlays, if in the end we > are building a single dtb file. Quite contrary, splitting this to > separate dtso/dtbo files would disable DT schema validation. It is > possible to validate DT with multiple nested inclusions, but it is not > possible to validate overlays. Overlays make it possible to mix and match multiple peripherals attached to a board. This is especially useful for development boards where you can have panels, camera modules and other add-ons attached. You would otherwise need lots of .dts to express all possible combinations. There are still some validation issues with overlays, but as far as I can tell the kernel now supports validating overlays applied to a base board. See how arch/arm64/boot/dts/freescale/Makefile defines, for instance, imx8mp-tqma8mpql-mba8mpxl-lvds-dtbs += imx8mp-tqma8mpql-mba8mpxl.dtb imx8mp-tqma8mpql-mba8mpxl-lvds.dtbo dtb-$(CONFIG_ARCH_MXC) += imx8mp-tqma8mpql-mba8mpxl-lvds.dtb I've just seen that Shawn has applied this patch. Could you convert it to overlays with additional patches ? > > > [1] http://starterkit.ru/html/index.php?name=shop=view=64 > > > > > > Signed-off-by: Dmitry Baryshkov > > > --- > > > arch/arm/boot/dts/nxp/imx/Makefile| 2 + > > > .../nxp/imx/imx53-sk-imx53-atm0700d4-lvds.dts | 97 +++ > > > .../nxp/imx/imx53-sk-imx53-atm0700d4-rgb.dts | 112 ++ > > > .../dts/nxp/imx/imx53-sk-imx53-atm0700d4.dtsi | 45 +++ > > > 4 files changed, 256 insertions(+) > > > create mode 100644 > > > arch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4-lvds.dts > > > create mode 100644 > > > arch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4-rgb.dts > > > create mode 100644 > > > arch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4.dtsi > > > > > > diff --git a/arch/arm/boot/dts/nxp/imx/Makefile > > > b/arch/arm/boot/dts/nxp/imx/Makefile > > > index 3629e343d322..7532ed6468a0 100644 > > > --- a/arch/arm/boot/dts/nxp/imx/Makefile > > > +++ b/arch/arm/boot/dts/nxp/imx/Makefile > > > @@ -47,6 +47,8 @@ dtb-$(CONFIG_SOC_IMX53) += \ > > > imx53-qsb.dtb \ > > > imx53-qsrb.dtb \ > > > imx53-sk-imx53.dtb \ > > > + imx53-sk-imx53-atm0700d4-lvds.dtb \ > > > + imx53-sk-imx53-atm0700d4-rgb.dtb \ > > > imx53-smd.dtb \ > > > imx53-tx53-x03x.dtb \ > > > imx53-tx53-x13x.dtb \ > > > diff --git a/arch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4-lvds.dts > > > b/arch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4-lvds.dts > > > new file mode 100644 > > > index ..b1c1e7c759b3 > > > --- /dev/null > > > +++ b/arch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4-lvds.dts > > > @@ -0,0 +1,97 @@ > > > +// SPDX-License-Identifier: GPL-2.0+ > > > +// > > > +// Copyright 2023 Linaro Ltd. > > > + > > > +/dts-v1/; > > > + > > > +#include > > > +#include "imx53-sk-imx53-atm0700d4.dtsi" > > > + > > > +/ { > > > + lvds-decoder { > > > + compatible = "ti,sn65lvds94", "lvds-decoder"; > > > + > > > + ports { > > > + #address-cells = <1>; > > > + #size-cells = <0>; > > > + > > > + port@0 { > > > + reg = <0>; > > > + > > > + lvds_decoder_in: endpoint { > > > + remote-endpoint = <_out>; > > > + }; > > > + }; > > > + > > > + port@1 { > > > + reg = <1>; > > > + > > > + lvds_decoder_out: endpoint { > > > + remote-endpoint = <_rgb_in>; > > > + }; > > > + }; > > > + }; > > > + }; > > > +}; > > > + > > > + { > > > + pinctrl_lvds0: lvds0grp { > > > + /* LVDS pins only have pin mux configuration */ > > > + fsl,pins = < > > > + MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK 0x8000 > > > + MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0 0x8000 > > > + MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1 0x8000 > > > + MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2 0x8000 > > > +
Re: [PATCH 2/2] ARM: dts: imx: add support for the ATM0700D4 panel attached to sk-imx53
On Sun, Aug 27, 2023 at 12:54:29AM +0300, Dmitry Baryshkov wrote: > The SK-ATM0700D4-Plug is an extension board (provided by the same > manufacturer, [1]) which can be connected to the SK-IMX53 panel kit. The > panel can be connected either using the RGB parallel bus or using the > LVDS connector (recommended). Add DT files describing this "shield", > both RGB and LVDS connections. > > [1] http://starterkit.ru/html/index.php?name=shop=view=64 > > Signed-off-by: Dmitry Baryshkov Applied, thanks!
Re: [PATCH drm-misc-next v4 3/8] drm/nouveau: uvmm: rename 'umgr' to 'base'
On Thu, 21 Sept 2023 at 00:44, Danilo Krummrich wrote: > > Rename struct drm_gpuvm within struct nouveau_uvmm from 'umgr' to base. > > Signed-off-by: Danilo Krummrich Reviewed-by: Dave Airlie > --- > drivers/gpu/drm/nouveau/nouveau_debugfs.c | 2 +- > drivers/gpu/drm/nouveau/nouveau_exec.c| 4 +-- > drivers/gpu/drm/nouveau/nouveau_uvmm.c| 32 +++ > drivers/gpu/drm/nouveau/nouveau_uvmm.h| 6 ++--- > 4 files changed, 22 insertions(+), 22 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c > b/drivers/gpu/drm/nouveau/nouveau_debugfs.c > index 053f703f2f68..e83db051e851 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c > +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c > @@ -231,7 +231,7 @@ nouveau_debugfs_gpuva(struct seq_file *m, void *data) > continue; > > nouveau_uvmm_lock(uvmm); > - drm_debugfs_gpuva_info(m, >umgr); > + drm_debugfs_gpuva_info(m, >base); > seq_puts(m, "\n"); > nouveau_debugfs_gpuva_regions(m, uvmm); > nouveau_uvmm_unlock(uvmm); > diff --git a/drivers/gpu/drm/nouveau/nouveau_exec.c > b/drivers/gpu/drm/nouveau/nouveau_exec.c > index c001952cd678..b4239af29e5a 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_exec.c > +++ b/drivers/gpu/drm/nouveau/nouveau_exec.c > @@ -106,8 +106,8 @@ nouveau_exec_job_submit(struct nouveau_job *job) > drm_exec_until_all_locked(exec) { > struct drm_gpuva *va; > > - drm_gpuvm_for_each_va(va, >umgr) { > - if (unlikely(va == >umgr.kernel_alloc_node)) > + drm_gpuvm_for_each_va(va, >base) { > + if (unlikely(va == >base.kernel_alloc_node)) > continue; > > ret = drm_exec_prepare_obj(exec, va->gem.obj, 1); > diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c > b/drivers/gpu/drm/nouveau/nouveau_uvmm.c > index c750072cb268..6c86b64273c3 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c > @@ -329,7 +329,7 @@ nouveau_uvma_region_create(struct nouveau_uvmm *uvmm, > struct nouveau_uvma_region *reg; > int ret; > > - if (!drm_gpuva_interval_empty(>umgr, addr, range)) > + if (!drm_gpuva_interval_empty(>base, addr, range)) > return -ENOSPC; > > ret = nouveau_uvma_region_alloc(); > @@ -384,7 +384,7 @@ nouveau_uvma_region_empty(struct nouveau_uvma_region *reg) > { > struct nouveau_uvmm *uvmm = reg->uvmm; > > - return drm_gpuva_interval_empty(>umgr, > + return drm_gpuva_interval_empty(>base, > reg->va.addr, > reg->va.range); > } > @@ -589,7 +589,7 @@ op_map_prepare(struct nouveau_uvmm *uvmm, > uvma->region = args->region; > uvma->kind = args->kind; > > - drm_gpuva_map(>umgr, >va, op); > + drm_gpuva_map(>base, >va, op); > > /* Keep a reference until this uvma is destroyed. */ > nouveau_uvma_gem_get(uvma); > @@ -1194,7 +1194,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job) > goto unwind_continue; > } > > - op->ops = drm_gpuvm_sm_unmap_ops_create(>umgr, > + op->ops = drm_gpuvm_sm_unmap_ops_create(>base, > op->va.addr, > op->va.range); > if (IS_ERR(op->ops)) { > @@ -1205,7 +1205,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job) > ret = nouveau_uvmm_sm_unmap_prepare(uvmm, >new, > op->ops); > if (ret) { > - drm_gpuva_ops_free(>umgr, op->ops); > + drm_gpuva_ops_free(>base, op->ops); > op->ops = NULL; > op->reg = NULL; > goto unwind_continue; > @@ -1240,7 +1240,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job) > } > } > > - op->ops = drm_gpuvm_sm_map_ops_create(>umgr, > + op->ops = drm_gpuvm_sm_map_ops_create(>base, > op->va.addr, > op->va.range, > op->gem.obj, > @@ -1256,7 +1256,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job) > op->va.range, > op->flags & 0xff); >
Re: [PATCH drm-misc-next v4 2/8] drm/gpuvm: allow building as module
On Thu, 21 Sept 2023 at 00:43, Danilo Krummrich wrote: > > Currently, the DRM GPUVM does not have any core dependencies preventing > a module build. > > Also, new features from subsequent patches require helpers (namely > drm_exec) which can be built as module. > > Reviewed-by: Christian König > Signed-off-by: Danilo Krummrich Reviewed-by: Dave Airlie > --- > drivers/gpu/drm/Kconfig | 7 +++ > drivers/gpu/drm/Makefile| 2 +- > drivers/gpu/drm/drm_gpuvm.c | 3 +++ > drivers/gpu/drm/nouveau/Kconfig | 1 + > 4 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > index ab9ef1c20349..0f78a03e4e84 100644 > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -216,6 +216,13 @@ config DRM_EXEC > help > Execution context for command submissions > > +config DRM_GPUVM > + tristate > + depends on DRM && DRM_EXEC > + help > + GPU-VM representation providing helpers to manage a GPUs virtual > + address space > + > config DRM_BUDDY > tristate > depends on DRM > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index 7a84b3cddeab..8e1bde059170 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -45,7 +45,6 @@ drm-y := \ > drm_vblank.o \ > drm_vblank_work.o \ > drm_vma_manager.o \ > - drm_gpuvm.o \ > drm_writeback.o > drm-$(CONFIG_DRM_LEGACY) += \ > drm_agpsupport.o \ > @@ -81,6 +80,7 @@ obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += > drm_panel_orientation_quirks.o > # > # > obj-$(CONFIG_DRM_EXEC) += drm_exec.o > +obj-$(CONFIG_DRM_GPUVM) += drm_gpuvm.o > > obj-$(CONFIG_DRM_BUDDY) += drm_buddy.o > > diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c > index 7074bcad5b28..bfea4a8a19ec 100644 > --- a/drivers/gpu/drm/drm_gpuvm.c > +++ b/drivers/gpu/drm/drm_gpuvm.c > @@ -1723,3 +1723,6 @@ drm_gpuva_ops_free(struct drm_gpuvm *gpuvm, > kfree(ops); > } > EXPORT_SYMBOL_GPL(drm_gpuva_ops_free); > + > +MODULE_DESCRIPTION("DRM GPUVM"); > +MODULE_LICENSE("GPL"); > diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig > index c52e8096cca4..1e6aaf95ff7c 100644 > --- a/drivers/gpu/drm/nouveau/Kconfig > +++ b/drivers/gpu/drm/nouveau/Kconfig > @@ -11,6 +11,7 @@ config DRM_NOUVEAU > select DRM_TTM > select DRM_TTM_HELPER > select DRM_EXEC > + select DRM_GPUVM > select DRM_SCHED > select I2C > select I2C_ALGOBIT > -- > 2.41.0 >
Re: [PATCH drm-misc-next v4 1/8] drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm
On Thu, 21 Sept 2023 at 16:49, Christian König wrote: > > Am 20.09.23 um 16:42 schrieb Danilo Krummrich: > > Rename struct drm_gpuva_manager to struct drm_gpuvm including > > corresponding functions. This way the GPUVA manager's structures align > > very well with the documentation of VM_BIND [1] and VM_BIND locking [2]. > > > > It also provides a better foundation for the naming of data structures > > and functions introduced for implementing a common dma-resv per GPU-VM > > including tracking of external and evicted objects in subsequent > > patches. > > > > [1] Documentation/gpu/drm-vm-bind-async.rst > > [2] Documentation/gpu/drm-vm-bind-locking.rst > > > > Cc: Thomas Hellström > > Cc: Matthew Brost > > Signed-off-by: Danilo Krummrich > > Not sure if that name is better or worse, but from the handling I > suggest to have this patch separately pushed to drm-misc-next. > > Feel free to add my Acked-by for pushing this. > Acked-by: Dave Airlie > Regards, > Christian. > > > --- > > drivers/gpu/drm/Makefile | 2 +- > > drivers/gpu/drm/drm_debugfs.c | 16 +- > > .../gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} | 400 +- > > drivers/gpu/drm/nouveau/nouveau_exec.c| 2 +- > > drivers/gpu/drm/nouveau/nouveau_uvmm.c| 24 +- > > drivers/gpu/drm/nouveau/nouveau_uvmm.h| 6 +- > > include/drm/drm_debugfs.h | 6 +- > > include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} | 153 --- > > 8 files changed, 304 insertions(+), 305 deletions(-) > > rename drivers/gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} (78%) > > rename include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} (78%) > > > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > > index 215e78e79125..7a84b3cddeab 100644 > > --- a/drivers/gpu/drm/Makefile > > +++ b/drivers/gpu/drm/Makefile > > @@ -45,7 +45,7 @@ drm-y := \ > > drm_vblank.o \ > > drm_vblank_work.o \ > > drm_vma_manager.o \ > > - drm_gpuva_mgr.o \ > > + drm_gpuvm.o \ > > drm_writeback.o > > drm-$(CONFIG_DRM_LEGACY) += \ > > drm_agpsupport.o \ > > diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c > > index 44ecd7d0daac..f291fb4b359f 100644 > > --- a/drivers/gpu/drm/drm_debugfs.c > > +++ b/drivers/gpu/drm/drm_debugfs.c > > @@ -40,7 +40,7 @@ > > #include > > #include > > #include > > -#include > > +#include > > > > #include "drm_crtc_internal.h" > > #include "drm_internal.h" > > @@ -189,31 +189,31 @@ static const struct file_operations drm_debugfs_fops > > = { > > /** > >* drm_debugfs_gpuva_info - dump the given DRM GPU VA space > >* @m: pointer to the _file to write > > - * @mgr: the _gpuva_manager representing the GPU VA space > > + * @gpuvm: the _gpuvm representing the GPU VA space > >* > >* Dumps the GPU VA mappings of a given DRM GPU VA manager. > >* > >* For each DRM GPU VA space drivers should call this function from their > >* _info_list's show callback. > >* > > - * Returns: 0 on success, -ENODEV if the is not initialized > > + * Returns: 0 on success, -ENODEV if the is not initialized > >*/ > > int drm_debugfs_gpuva_info(struct seq_file *m, > > -struct drm_gpuva_manager *mgr) > > +struct drm_gpuvm *gpuvm) > > { > > - struct drm_gpuva *va, *kva = >kernel_alloc_node; > > + struct drm_gpuva *va, *kva = >kernel_alloc_node; > > > > - if (!mgr->name) > > + if (!gpuvm->name) > > return -ENODEV; > > > > seq_printf(m, "DRM GPU VA space (%s) [0x%016llx;0x%016llx]\n", > > -mgr->name, mgr->mm_start, mgr->mm_start + mgr->mm_range); > > +gpuvm->name, gpuvm->mm_start, gpuvm->mm_start + > > gpuvm->mm_range); > > seq_printf(m, "Kernel reserved node [0x%016llx;0x%016llx]\n", > > kva->va.addr, kva->va.addr + kva->va.range); > > seq_puts(m, "\n"); > > seq_puts(m, " VAs | start | range | end > >| object | object offset\n"); > > seq_puts(m, > > "-\n"); > > - drm_gpuva_for_each_va(va, mgr) { > > + drm_gpuvm_for_each_va(va, gpuvm) { > > if (unlikely(va == kva)) > > continue; > > > > diff --git a/drivers/gpu/drm/drm_gpuva_mgr.c b/drivers/gpu/drm/drm_gpuvm.c > > similarity index 78% > > rename from drivers/gpu/drm/drm_gpuva_mgr.c > > rename to drivers/gpu/drm/drm_gpuvm.c > > index f86bfad74ff8..7074bcad5b28 100644 > > --- a/drivers/gpu/drm/drm_gpuva_mgr.c > > +++ b/drivers/gpu/drm/drm_gpuvm.c > > @@ -25,7 +25,7 @@ > >* > >*/ > > > > -#include > > +#include > > > > #include > > #include > > @@ -33,8 +33,8 @@ > > /** > >* DOC: Overview > >* > > - * The DRM GPU VA Manager, represented by
Re: [PATCH v6 04/20] drm/imagination/uapi: Add PowerVR driver UAPI
> +struct drm_pvr_dev_query_gpu_info { > + /** > +* @gpu_id: GPU identifier. > +* > +* For all currently supported GPUs this is the BVNC encoded as a > 64-bit > +* value as follows: > +* > +*++++---+ > +*| 63..48 | 47..32 | 31..16 | 15..0 | > +*++++===+ > +*| B | V | N | C | > +*++++---+ > +*/ > + __u64 gpu_id; > + > + /** > +* @num_phantoms: Number of Phantoms present. > +*/ > + __u32 num_phantoms; > +}; I think this one needs __u32 padding; of some sort. Dave.
[PATCH drm-misc-next 1/2] drm/nouveau: make use of DRM_SCHED_POLICY_SINGLE_ENTITY
DRM_SCHED_POLICY_SINGLE_ENTITY was implemented in order to properly support firmware schedulers being able to handle an arbitrary amount of dynamically allocated command ring buffers. This perfectly matches Nouveau's needs, hence make use of it. Topology wise we create one scheduler instance per client (handling VM_BIND jobs) and one scheduler instance per channel (handling EXEC jobs). All channel scheduler instances share a workqueue, but every client scheduler instance has a dedicated workqueue. The latter is required to ensure that for VM_BIND jobs free_job() work and run_job() work can always run concurrently and hence, free_job() work can never stall run_job() work. For EXEC jobs we don't have this requirement, since EXEC job's free_job() does not require to take any locks which indirectly or directly are held for allocations elsewhere. Signed-off-by: Danilo Krummrich --- This patch is based on Matt's scheduler work [1]. [1] https://lore.kernel.org/dri-devel/20230919050155.2647172-1-matthew.br...@intel.com/ --- drivers/gpu/drm/nouveau/nouveau_abi16.c | 18 +-- drivers/gpu/drm/nouveau/nouveau_abi16.h | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 31 ++-- drivers/gpu/drm/nouveau/nouveau_drv.h | 9 +- drivers/gpu/drm/nouveau/nouveau_exec.c | 7 +- drivers/gpu/drm/nouveau/nouveau_exec.h | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 189 drivers/gpu/drm/nouveau/nouveau_sched.h | 35 ++--- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 69 +++-- drivers/gpu/drm/nouveau/nouveau_uvmm.h | 4 +- 10 files changed, 168 insertions(+), 198 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 30afbec9e3b1..f8e59cfb1d34 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -126,21 +126,14 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, { struct nouveau_abi16_ntfy *ntfy, *temp; - /* When a client exits without waiting for it's queued up jobs to -* finish it might happen that we fault the channel. This is due to -* drm_file_free() calling drm_gem_release() before the postclose() -* callback. Hence, we can't tear down this scheduler entity before -* uvmm mappings are unmapped. Currently, we can't detect this case. -* -* However, this should be rare and harmless, since the channel isn't -* needed anymore. -*/ - nouveau_sched_entity_fini(>sched_entity); + /* Cancel all jobs from the entity's queue. */ + drm_sched_entity_fini(>sched.entity); - /* wait for all activity to stop before cleaning up */ if (chan->chan) nouveau_channel_idle(chan->chan); + nouveau_sched_fini(>sched); + /* cleanup notifier state */ list_for_each_entry_safe(ntfy, temp, >notifiers, head) { nouveau_abi16_ntfy_fini(chan, ntfy); @@ -323,8 +316,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) if (ret) goto done; - ret = nouveau_sched_entity_init(>sched_entity, >sched, - drm->sched_wq); + ret = nouveau_sched_init(>sched, drm, drm->sched_wq); if (ret) goto done; diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.h b/drivers/gpu/drm/nouveau/nouveau_abi16.h index 9f538486c10e..1f5e243c0c75 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.h +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.h @@ -26,7 +26,7 @@ struct nouveau_abi16_chan { struct nouveau_bo *ntfy; struct nouveau_vma *ntfy_vma; struct nvkm_mm heap; - struct nouveau_sched_entity sched_entity; + struct nouveau_sched sched; }; struct nouveau_abi16 { diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 50589f982d1a..dbe1f08ac540 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -199,8 +199,8 @@ nouveau_cli_fini(struct nouveau_cli *cli) WARN_ON(!list_empty(>worker)); usif_client_fini(cli); + nouveau_sched_fini(>sched); nouveau_uvmm_fini(>uvmm); - nouveau_sched_entity_fini(>sched_entity); nouveau_vmm_fini(>svm); nouveau_vmm_fini(>vmm); nvif_mmu_dtor(>mmu); @@ -307,8 +307,17 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname, cli->mem = [ret]; - ret = nouveau_sched_entity_init(>sched_entity, >sched, - drm->sched_wq); + /* Don't pass in the (shared) sched_wq in order to let +* nouveau_sched_init() create a dedicated one for VM_BIND jobs. +* +* This is required to ensure that for VM_BIND jobs free_job() work and +* run_job() work can always run concurrently and hence, free_job() work +* can never stall run_job() work. For EXEC jobs we don't have this +
[PATCH drm-misc-next 2/2] drm/nouveau: enable dynamic job flow control
Make use of the scheduler's submission limit and scheduler job's submission unit count to account for the actual size of a job, such that we fill up the ring efficiently. Signed-off-by: Danilo Krummrich --- This patch is based on Matt's scheduler work [1] and [2]. [1] https://lore.kernel.org/dri-devel/20230919050155.2647172-1-matthew.br...@intel.com/ [2] https://lore.kernel.org/nouveau/20230924224555.15595-1-d...@redhat.com/T/#u --- drivers/gpu/drm/nouveau/nouveau_abi16.c | 3 ++- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_exec.c | 3 ++- drivers/gpu/drm/nouveau/nouveau_sched.c | 9 - drivers/gpu/drm/nouveau/nouveau_sched.h | 3 ++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index f8e59cfb1d34..207945700c94 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -316,7 +316,8 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) if (ret) goto done; - ret = nouveau_sched_init(>sched, drm, drm->sched_wq); + ret = nouveau_sched_init(>sched, drm, drm->sched_wq, +chan->chan->dma.ib_max); if (ret) goto done; diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index dbe1f08ac540..2b695c521821 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -317,7 +317,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname, * locks which indirectly or directly are held for allocations * elsewhere. */ - ret = nouveau_sched_init(>sched, drm, NULL); + ret = nouveau_sched_init(>sched, drm, NULL, 1); if (ret) goto done; diff --git a/drivers/gpu/drm/nouveau/nouveau_exec.c b/drivers/gpu/drm/nouveau/nouveau_exec.c index 5a70fcf571f7..5d1533b413d3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_exec.c +++ b/drivers/gpu/drm/nouveau/nouveau_exec.c @@ -253,10 +253,11 @@ nouveau_exec_job_init(struct nouveau_exec_job **pjob, } } + args.file_priv = __args->file_priv; job->chan = __args->chan; args.sched = __args->sched; - args.file_priv = __args->file_priv; + args.submission_units = job->push.count; args.in_sync.count = __args->in_sync.count; args.in_sync.s = __args->in_sync.s; diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.c b/drivers/gpu/drm/nouveau/nouveau_sched.c index 0dbd0ea6d02e..6b32fd4eefb0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sched.c +++ b/drivers/gpu/drm/nouveau/nouveau_sched.c @@ -12,7 +12,6 @@ #include "nouveau_abi16.h" #include "nouveau_sched.h" -#define NOUVEAU_SCHED_HW_SUBMISSIONS 1 #define NOUVEAU_SCHED_JOB_TIMEOUT_MS 1 int @@ -77,10 +76,10 @@ nouveau_job_init(struct nouveau_job *job, ret = -ENOMEM; goto err_free_objs; } - } - ret = drm_sched_job_init(>base, >entity, 1, NULL); + ret = drm_sched_job_init(>base, >entity, +args->submission_units, NULL); if (ret) goto err_free_chains; @@ -387,7 +386,7 @@ static const struct drm_sched_backend_ops nouveau_sched_ops = { }; int nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm, - struct workqueue_struct *wq) + struct workqueue_struct *wq, u32 submission_limit) { struct drm_gpu_scheduler *drm_sched = >base; struct drm_sched_entity *entity = >entity; @@ -404,7 +403,7 @@ int nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm, } ret = drm_sched_init(drm_sched, _sched_ops, wq, -NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit, +submission_limit, 0, job_hang_limit, NULL, NULL, "nouveau_sched", DRM_SCHED_POLICY_SINGLE_ENTITY, drm->dev->dev); if (ret) diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.h b/drivers/gpu/drm/nouveau/nouveau_sched.h index 026f33d9b70c..c1d603759914 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sched.h +++ b/drivers/gpu/drm/nouveau/nouveau_sched.h @@ -27,6 +27,7 @@ enum nouveau_job_state { struct nouveau_job_args { struct drm_file *file_priv; struct nouveau_sched *sched; + u32 submission_units; enum dma_resv_usage resv_usage; bool sync; @@ -112,7 +113,7 @@ struct nouveau_sched { }; int nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm, - struct workqueue_struct *wq); + struct workqueue_struct *wq, u32 submission_limit); void nouveau_sched_fini(struct nouveau_sched *sched); #endif -- 2.41.0
[PATCH drm-misc-next 1/3] drm/sched: implement dynamic job flow control
Currently, job flow control is implemented simply by limiting the amount of jobs in flight. Therefore, a scheduler is initialized with a submission limit that corresponds to a certain amount of jobs. This implies that for each job drivers need to account for the maximum job size possible in order to not overflow the ring buffer. However, there are drivers, such as Nouveau, where the job size has a rather large range. For such drivers it can easily happen that job submissions not even filling the ring by 1% can block subsequent submissions, which, in the worst case, can lead to the ring run dry. In order to overcome this issue, allow for tracking the actual job size instead of the amount job jobs. Therefore, add a field to track a job's submission units, which represents the amount of units a job contributes to the scheduler's submission limit. Signed-off-by: Danilo Krummrich --- This patch is based on Matt's scheduler work [1]. [1] https://lore.kernel.org/dri-devel/20230919050155.2647172-1-matthew.br...@intel.com/ --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +- .../gpu/drm/scheduler/gpu_scheduler_trace.h | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 5 +- drivers/gpu/drm/scheduler/sched_main.c| 81 +-- drivers/gpu/drm/v3d/v3d_gem.c | 2 +- include/drm/gpu_scheduler.h | 18 +++-- 11 files changed, 78 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 78476bc75b4e..d54daaf64bf1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -115,7 +115,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm, if (!entity) return 0; - return drm_sched_job_init(&(*job)->base, entity, owner); + return drm_sched_job_init(&(*job)->base, entity, 1, owner); } int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 45403ea38906..74a446711207 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -538,7 +538,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, ret = drm_sched_job_init(>sched_job, >sched_entity[args->pipe], -submit->ctx); +1, submit->ctx); if (ret) goto err_submit_put; diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c index 50c2075228aa..5dc6678e1eb9 100644 --- a/drivers/gpu/drm/lima/lima_sched.c +++ b/drivers/gpu/drm/lima/lima_sched.c @@ -123,7 +123,7 @@ int lima_sched_task_init(struct lima_sched_task *task, for (i = 0; i < num_bos; i++) drm_gem_object_get([i]->base.base); - err = drm_sched_job_init(>base, >base, vm); + err = drm_sched_job_init(>base, >base, 1, vm); if (err) { kfree(task->bos); return err; diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 3f1aa4de3b87..6d230c38e4f5 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -48,7 +48,7 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev, return ERR_PTR(ret); } - ret = drm_sched_job_init(>base, queue->entity, queue); + ret = drm_sched_job_init(>base, queue->entity, 1, queue); if (ret) { kfree(submit->hw_fence); kfree(submit); diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.c b/drivers/gpu/drm/nouveau/nouveau_sched.c index f26a814a9920..e991426d86e4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sched.c +++ b/drivers/gpu/drm/nouveau/nouveau_sched.c @@ -89,7 +89,7 @@ nouveau_job_init(struct nouveau_job *job, } - ret = drm_sched_job_init(>base, >base, NULL); + ret = drm_sched_job_init(>base, >base, 1, NULL); if (ret) goto err_free_chains; diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index a2ab99698ca8..d5e777deee5c 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -272,7 +272,7 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data, ret = drm_sched_job_init(>base, _priv->sched_entity[slot], -NULL); +1, NULL); if
Re: [PATCH] drm/sun4i: Add error handling in sun4i_layer_init_one()
Hi! Dne nedelja, 24. september 2023 ob 09:42:16 CEST je liuhaoran napisal(a): > This patch adds error-handling for the drm_plane_create_alpha_property() > and drm_plane_create_zpos_property() inside the dw_hdmi_imx_probe(). dw_hdmi_imx_probe() is not from this driver. Best regards, Jernej > > Signed-off-by: liuhaoran > --- > drivers/gpu/drm/sun4i/sun4i_layer.c | 19 --- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c > b/drivers/gpu/drm/sun4i/sun4i_layer.c > index 98f3176366c0..a3343afb7935 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_layer.c > +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c > @@ -224,9 +224,22 @@ static struct sun4i_layer *sun4i_layer_init_one(struct > drm_device *drm, > drm_plane_helper_add(>plane, >_backend_layer_helper_funcs); > > - drm_plane_create_alpha_property(>plane); > - drm_plane_create_zpos_property(>plane, layer->id, > -0, SUN4I_BACKEND_NUM_LAYERS - 1); > + ret = drm_plane_create_alpha_property(>plane); > + > + if (ret) { > + dev_err(drm->dev, "Failed to install alpha property, > + rc = %d\n", ret); > + return ERR_PTR(ret); > + } > + > + ret = drm_plane_create_zpos_property(>plane, layer->id, 0, > + SUN4I_BACKEND_NUM_LAYERS - 1); > + > + if (ret) { > + dev_err(drm->dev, "Failed to install zpos property, > + rc = %d\n", ret); > + return ERR_PTR(ret); > + } > > return layer; > } >
[PATCH 1/7] drm/sun4i: dw-hdmi: Deinit PHY in fail path
Commit 9bf3797796f5 ("drm/sun4i: dw-hdmi: Make HDMI PHY into a platform device") removed code for PHY deinitialization in fail path. Add it back. Fixes: 9bf3797796f5 ("drm/sun4i: dw-hdmi: Make HDMI PHY into a platform device") Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 4727dfaa8fb9..0b647b030b15 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -203,6 +203,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, cleanup_encoder: drm_encoder_cleanup(encoder); + sun8i_hdmi_phy_deinit(hdmi->phy); err_disable_clk_tmds: clk_disable_unprepare(hdmi->clk_tmds); err_assert_ctrl_reset: -- 2.42.0
[PATCH 4/7] drm/sun4i: Don't show error for deferred probes.
Drivers probing in display pipeline can be deferred for many reasons. Don't print error for such cases. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun4i_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 6a8dfc022d3c..b4816a1b0be3 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -88,7 +88,8 @@ static int sun4i_drv_bind(struct device *dev) ret = component_bind_all(drm->dev, drm); if (ret) { - dev_err(drm->dev, "Couldn't bind all pipelines components\n"); + dev_err_probe(drm->dev, ret, + "Couldn't bind all pipelines components\n"); goto cleanup_mode_config; } -- 2.42.0
[PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration
There is no reason to register two drivers in same place. Using macro lowers amount of boilerplate code. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 27 +- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 -- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 3 ++- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 93831cdf1917..d93e8ff71aae 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -378,32 +378,7 @@ static struct platform_driver sun8i_dw_hdmi_pltfm_driver = { .of_match_table = sun8i_dw_hdmi_dt_ids, }, }; - -static int __init sun8i_dw_hdmi_init(void) -{ - int ret; - - ret = platform_driver_register(_dw_hdmi_pltfm_driver); - if (ret) - return ret; - - ret = platform_driver_register(_hdmi_phy_driver); - if (ret) { - platform_driver_unregister(_dw_hdmi_pltfm_driver); - return ret; - } - - return ret; -} - -static void __exit sun8i_dw_hdmi_exit(void) -{ - platform_driver_unregister(_dw_hdmi_pltfm_driver); - platform_driver_unregister(_hdmi_phy_driver); -} - -module_init(sun8i_dw_hdmi_init); -module_exit(sun8i_dw_hdmi_exit); +module_platform_driver(sun8i_dw_hdmi_pltfm_driver); MODULE_AUTHOR("Jernej Skrabec "); MODULE_DESCRIPTION("Allwinner DW HDMI bridge"); diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 18ffc1b4841f..21e010deeb48 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -194,8 +194,6 @@ struct sun8i_dw_hdmi { struct reset_control*rst_ctrl; }; -extern struct platform_driver sun8i_hdmi_phy_driver; - static inline struct sun8i_dw_hdmi * encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) { diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 489ea94693ff..f917a979e4a4 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -729,10 +729,11 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) return 0; } -struct platform_driver sun8i_hdmi_phy_driver = { +static struct platform_driver sun8i_hdmi_phy_driver = { .probe = sun8i_hdmi_phy_probe, .driver = { .name = "sun8i-hdmi-phy", .of_match_table = sun8i_hdmi_phy_of_table, }, }; +module_platform_driver(sun8i_hdmi_phy_driver); -- 2.42.0
[PATCH 6/7] drm/sun4i: dw-hdmi: Make sun8i_hdmi_phy_get() more intuitive
Let's make sun8i_hdmi_phy_get() to behave more like other kernel functions and return phy pointer instead of setting field in struct. This also makes function more universal. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 5 +++-- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 10 -- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index d93e8ff71aae..41f815a1faec 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -239,10 +239,11 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, goto err_disable_clk_tmds; } - ret = sun8i_hdmi_phy_get(hdmi, phy_node); + hdmi->phy = sun8i_hdmi_phy_get(phy_node); of_node_put(phy_node); - if (ret) { + if (IS_ERR(hdmi->phy)) { dev_err(dev, "Couldn't get the HDMI PHY\n"); + ret = PTR_ERR(hdmi->phy); goto err_disable_clk_tmds; } diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 21e010deeb48..748b6a4d9cdd 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -200,7 +200,7 @@ encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) return container_of(encoder, struct sun8i_dw_hdmi, encoder); } -int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node); +struct sun8i_hdmi_phy *sun8i_hdmi_phy_get(struct device_node *node); int sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy); void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy); diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index f917a979e4a4..1c9bdefed35e 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -650,25 +650,23 @@ static const struct of_device_id sun8i_hdmi_phy_of_table[] = { { /* sentinel */ } }; -int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node) +struct sun8i_hdmi_phy *sun8i_hdmi_phy_get(struct device_node *node) { struct platform_device *pdev = of_find_device_by_node(node); struct sun8i_hdmi_phy *phy; if (!pdev) - return -EPROBE_DEFER; + return ERR_PTR(-EPROBE_DEFER); phy = platform_get_drvdata(pdev); if (!phy) { put_device(>dev); - return -EPROBE_DEFER; + return ERR_PTR(-EPROBE_DEFER); } - hdmi->phy = phy; - put_device(>dev); - return 0; + return phy; } static int sun8i_hdmi_phy_probe(struct platform_device *pdev) -- 2.42.0
[PATCH 7/7] drm/sun4i: dw-hdmi: check for phy device first
Let's check for phy device first. Since it uses much of the same clocks and resets it also lowers amount of possible deferred probes. While at it, don't report error for deferred phy probe. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 35 +-- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 41f815a1faec..c1becd964326 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -173,11 +173,24 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, struct device_node *phy_node; struct drm_encoder *encoder; struct sun8i_dw_hdmi *hdmi; + struct sun8i_hdmi_phy *phy; int ret; if (!pdev->dev.of_node) return -ENODEV; + phy_node = of_parse_phandle(dev->of_node, "phys", 0); + if (!phy_node) { + dev_err(dev, "Can't find PHY phandle\n"); + return -EINVAL; + } + + phy = sun8i_hdmi_phy_get(phy_node); + of_node_put(phy_node); + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), +"Couldn't get the HDMI PHY\n"); + hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) return -ENOMEM; @@ -185,6 +198,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, plat_data = >plat_data; hdmi->dev = >dev; encoder = >encoder; + hdmi->phy = phy; hdmi->quirks = of_device_get_match_data(dev); @@ -232,22 +246,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, goto err_assert_ctrl_reset; } - phy_node = of_parse_phandle(dev->of_node, "phys", 0); - if (!phy_node) { - dev_err(dev, "Can't found PHY phandle\n"); - ret = -EINVAL; - goto err_disable_clk_tmds; - } - - hdmi->phy = sun8i_hdmi_phy_get(phy_node); - of_node_put(phy_node); - if (IS_ERR(hdmi->phy)) { - dev_err(dev, "Couldn't get the HDMI PHY\n"); - ret = PTR_ERR(hdmi->phy); - goto err_disable_clk_tmds; - } - - ret = sun8i_hdmi_phy_init(hdmi->phy); + ret = sun8i_hdmi_phy_init(phy); if (ret) goto err_disable_clk_tmds; @@ -259,7 +258,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, plat_data->mode_valid = hdmi->quirks->mode_valid; plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe; plat_data->output_port = 1; - sun8i_hdmi_phy_set_ops(hdmi->phy, plat_data); + sun8i_hdmi_phy_set_ops(phy, plat_data); platform_set_drvdata(pdev, hdmi); @@ -310,7 +309,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, drm_bridge_remove(>enc_bridge); dw_hdmi_remove(hdmi->hdmi); err_deinit_phy: - sun8i_hdmi_phy_deinit(hdmi->phy); + sun8i_hdmi_phy_deinit(phy); err_disable_clk_tmds: clk_disable_unprepare(hdmi->clk_tmds); err_assert_ctrl_reset: -- 2.42.0
[PATCH 3/7] drm/sun4i: dw-hdmi: Switch to bridge functions
Since ddc-en property handling was moved from sun8i dw-hdmi driver to display connector driver, probe order of drivers determines if EDID is properly read at boot time or not. In order to fix this, let's switch to bridge functions which allows us to build proper chain and defer execution until all drivers are probed. Fixes: 920169041baa ("drm/sun4i: dw-hdmi: Fix ddc-en GPIO consumer conflict") Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 114 +- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 5 ++ 2 files changed, 117 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 8f8d3bdba5ce..93831cdf1917 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -8,14 +8,82 @@ #include #include +#include +#include #include #include #include #include +#include + #include "sun8i_dw_hdmi.h" #include "sun8i_tcon_top.h" +#define bridge_to_sun8i_dw_hdmi(x) \ + container_of(x, struct sun8i_dw_hdmi, enc_bridge) + +static int sun8i_hdmi_enc_attach(struct drm_bridge *bridge, +enum drm_bridge_attach_flags flags) +{ + struct sun8i_dw_hdmi *hdmi = bridge_to_sun8i_dw_hdmi(bridge); + + return drm_bridge_attach(>encoder, hdmi->hdmi_bridge, +>enc_bridge, flags); +} + +static void sun8i_hdmi_enc_detach(struct drm_bridge *bridge) +{ + struct sun8i_dw_hdmi *hdmi = bridge_to_sun8i_dw_hdmi(bridge); + + cec_notifier_conn_unregister(hdmi->cec_notifier); + hdmi->cec_notifier = NULL; +} + +static void sun8i_hdmi_enc_hpd_notify(struct drm_bridge *bridge, + enum drm_connector_status status) +{ + struct sun8i_dw_hdmi *hdmi = bridge_to_sun8i_dw_hdmi(bridge); + struct edid *edid; + + if (!hdmi->cec_notifier) + return; + + if (status == connector_status_connected) { + edid = drm_bridge_get_edid(hdmi->hdmi_bridge, hdmi->connector); + if (edid) + cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, +edid); + } else { + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + } +} + +static int sun8i_hdmi_enc_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct drm_connector_state *old_conn_state = + drm_atomic_get_old_connector_state(conn_state->state, + conn_state->connector); + + if (!drm_connector_atomic_hdr_metadata_equal(old_conn_state, conn_state)) + crtc_state->mode_changed = true; + + return 0; +} + +static const struct drm_bridge_funcs sun8i_hdmi_enc_bridge_funcs = { + .attach = sun8i_hdmi_enc_attach, + .detach = sun8i_hdmi_enc_detach, + .hpd_notify = sun8i_hdmi_enc_hpd_notify, + .atomic_check = sun8i_hdmi_enc_atomic_check, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, +}; + static void sun8i_dw_hdmi_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) @@ -99,6 +167,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, { struct platform_device *pdev = to_platform_device(dev); struct dw_hdmi_plat_data *plat_data; + struct cec_connector_info conn_info; + struct drm_connector *connector; struct drm_device *drm = data; struct device_node *phy_node; struct drm_encoder *encoder; @@ -187,18 +257,57 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, plat_data->mode_valid = hdmi->quirks->mode_valid; plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe; + plat_data->output_port = 1; sun8i_hdmi_phy_set_ops(hdmi->phy, plat_data); platform_set_drvdata(pdev, hdmi); - hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); + hdmi->hdmi = dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi->hdmi)) { ret = PTR_ERR(hdmi->hdmi); goto err_deinit_phy; } + hdmi->hdmi_bridge = of_drm_find_bridge(dev->of_node); + + hdmi->enc_bridge.funcs = _hdmi_enc_bridge_funcs; + hdmi->enc_bridge.type = DRM_MODE_CONNECTOR_HDMIA; + hdmi->enc_bridge.interlace_allowed = true; + +
[PATCH 2/7] drm/sun4i: dw-hdmi: Remove double encoder cleanup
It turns out that comment is wrong - dw hdmi driver never does any encoder cleanup. In fact, cleanup is done automatically, in destroy callback of encoder. Even more, encoder memory will be freed when hdmi device is destroyed. However, encoder will be cleaned up after that, in drm_mode_config_cleanup(), which is called later. This will cause use after free bug. Remove redundant encoder cleanup, switch memory allocation to live as long as drm object and while at it, check return code of encoder initialization. Fixes: b7c7436a5ff0 ("drm/sun4i: Implement A83T HDMI driver") Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 0b647b030b15..8f8d3bdba5ce 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -107,7 +108,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, if (!pdev->dev.of_node) return -ENODEV; - hdmi = devm_kzalloc(>dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) return -ENOMEM; @@ -180,7 +181,9 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, goto err_disable_clk_tmds; drm_encoder_helper_add(encoder, _dw_hdmi_encoder_helper_funcs); - drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); + if (ret) + goto err_deinit_phy; plat_data->mode_valid = hdmi->quirks->mode_valid; plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe; @@ -189,20 +192,14 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, platform_set_drvdata(pdev, hdmi); hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); - - /* -* If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(), -* which would have called the encoder cleanup. Do it manually. -*/ if (IS_ERR(hdmi->hdmi)) { ret = PTR_ERR(hdmi->hdmi); - goto cleanup_encoder; + goto err_deinit_phy; } return 0; -cleanup_encoder: - drm_encoder_cleanup(encoder); +err_deinit_phy: sun8i_hdmi_phy_deinit(hdmi->phy); err_disable_clk_tmds: clk_disable_unprepare(hdmi->clk_tmds); -- 2.42.0
[PATCH 0/7] drm/sun4i: dw-hdmi: Fix initialization & refactor
Main goal of this series is to fix race condition between probing display connector driver and sun8i dw-hdmi platform driver. Sometimes, boards have ddc-en gpio specified in DT file. This is handled by display connector driver since commit 920169041baa ("drm/sun4i: dw-hdmi: Fix ddc-en GPIO consumer conflict"). However, because there is no link between it and sun8i dw-hdmi driver, probe order isn't determined. If display connector driver if probed afterwards, then sun8i dw-hdmi driver won't be able to read EDID and thus fall back to 1024x768. This can be easily solved by using bridges and linking them together. Coincidentally, switching to bridge model is also long term goal. I found out some other issues when working on them (missing phy deinit and memory corruption during executing fail path). Since there is now a bigger chance of deferring probe, it's also good to skip reporting deferred probe as error. This often confuses users when examining dmesg output, especially if there is no error code reported. I also throw 2 refactoring patches for a good measure. Please take a look. Best regards, Jernej Jernej Skrabec (7): drm/sun4i: dw-hdmi: Deinit PHY in fail path drm/sun4i: dw-hdmi: Remove double encoder cleanup drm/sun4i: dw-hdmi: Switch to bridge functions drm/sun4i: Don't show error for deferred probes. drm/sun4i: dw-hdmi: Split driver registration drm/sun4i: dw-hdmi: Make sun8i_hdmi_phy_get() more intuitive drm/sun4i: dw-hdmi: check for phy device first drivers/gpu/drm/sun4i/sun4i_drv.c | 3 +- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 191 ++--- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 9 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 13 +- 4 files changed, 151 insertions(+), 65 deletions(-) -- 2.42.0
Re: [PATCH] drm/imx: Add error handling in dw_hdmi_imx_probe()
On Sun, Sep 24, 2023 at 11:36 AM liuhaoran wrote: > > This patch adds error-handling for the of_match_node() > inside the dw_hdmi_imx_probe(). > > Signed-off-by: liuhaoran > --- > drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c > b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c > index a2277a0d6d06..3b25f018b2a6 100644 > --- a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c > +++ b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c > @@ -224,6 +224,9 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev) > struct imx_hdmi *hdmi; > int ret; > > + if (!match) > + return -ENODEV; > + This check is not needed. The only way this driver can probe is via devicetree and this can only happen when match is non-NULL.
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback error path
Hi, Jani: Jani Nikula 於 2023年9月14日 週四 下午9:13寫道: > > Setting new_edid to NULL leaks the buffer. Applied to mediatek-drm-next [1], thanks. [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next Regards, Chun-Kuang. > > Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") > Cc: Markus Schneider-Pargmann > Cc: Guillaume Ranquet > Cc: Bo-Chen Chen > Cc: CK Hu > Cc: AngeloGioacchino Del Regno > Cc: Dmitry Osipenko > Cc: Chun-Kuang Hu > Cc: Philipp Zabel > Cc: Matthias Brugger > Cc: dri-devel@lists.freedesktop.org > Cc: linux-media...@lists.infradead.org > Cc: linux-ker...@vger.kernel.org > Cc: linux-arm-ker...@lists.infradead.org > Cc: # v6.1+ > Signed-off-by: Jani Nikula > > --- > > UNTESTED > --- > drivers/gpu/drm/mediatek/mtk_dp.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c > b/drivers/gpu/drm/mediatek/mtk_dp.c > index 2cb47f663756..8fc6eff68e30 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dp.c > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c > @@ -2049,6 +2049,7 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge > *bridge, > */ > if (mtk_dp_parse_capabilities(mtk_dp)) { > drm_err(mtk_dp->drm_dev, "Can't parse capabilities\n"); > + kfree(new_edid); > new_edid = NULL; > } > > -- > 2.39.2 >
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
Hi, Jani: Jani Nikula 於 2023年9月22日 週五 下午5:44寫道: > > On Tue, 19 Sep 2023, Chen-Yu Tsai wrote: > > On Tue, Sep 19, 2023 at 7:02 PM Jani Nikula wrote: > >> > >> On Fri, 15 Sep 2023, Chen-Yu Tsai wrote: > >> > On Thu, Sep 14, 2023 at 11:53 PM Jani Nikula > >> > wrote: > >> >> > >> >> The sads returned by drm_edid_to_sad() needs to be freed. > >> >> > >> >> Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195") > >> >> Cc: Guillaume Ranquet > >> >> Cc: Bo-Chen Chen > >> >> Cc: AngeloGioacchino Del Regno > >> >> Cc: Dmitry Osipenko > >> >> Cc: Chun-Kuang Hu > >> >> Cc: Philipp Zabel > >> >> Cc: Matthias Brugger > >> >> Cc: dri-devel@lists.freedesktop.org > >> >> Cc: linux-media...@lists.infradead.org > >> >> Cc: linux-ker...@vger.kernel.org > >> >> Cc: linux-arm-ker...@lists.infradead.org > >> >> Cc: # v6.1+ > >> >> Signed-off-by: Jani Nikula > >> > > >> > Looks correct to me. > >> > > >> > Reviewed-by: Chen-Yu Tsai > >> > >> Thanks for the reviews Chen-Yu and Guillaume. Will you push this to > >> drm-misc-next or shall I? > > > > Patches for the MediaTek drm driver go through their own separate tree, > > maintained by CK (Chun-Kuang). > > Chun-Kuang, can you confirm picking up these two patches, please? > > MAINTAINERS does not list a separate git repository for MediaTek drm > drivers, so I don't know where that would be. It should probably be > added to MAINTAINERS. Applied to mediatek-drm-next [1], thanks. [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next Regards, Chun-Kuang. > > Thanks, > Jani. > > > > > ChenYu > > -- > Jani Nikula, Intel
Re: [PATCH v6,0/4] Add compatible to increase MT8188 audio control
Hi, Shuijing: Shuijing Li 於 2023年8月22日 週二 上午10:41寫道: > > Add dt-binding documentation of dp-tx for MediaTek MT8188 SoC. > Mainly add the following two flag: > > 1.The audio packet arrangement function is to only arrange audio > packets into the Hblanking area. In order to align with the HW > default setting of g1200, this function needs to be turned off. > > 2.Due to the difference of HW, different dividers need to be set. > > Base on the branch of linus/master v6.4. For this series, applied to mediatek-drm-next [1], thanks. [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next Regards, Chun-Kuang. > > Shuijing Li (4): > dt-bindings: display: mediatek: dp: Add compatible for MediaTek MT8188 > drm/mediatek: dp: Add the audio packet flag to mtk_dp_data struct > drm/mediatek: dp: Add the audio divider to mtk_dp_data struct > drm/mediatek: dp: Add support MT8188 dp/edp function > > .../display/mediatek/mediatek,dp.yaml | 2 ++ > drivers/gpu/drm/mediatek/mtk_dp.c | 36 ++- > drivers/gpu/drm/mediatek/mtk_dp_reg.h | 23 > 3 files changed, 54 insertions(+), 7 deletions(-) > > -- > 2.40.1 >
[PATCH AUTOSEL 4.14 1/6] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 1d5510cb6db4e..1962ff624b7c5 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -385,8 +385,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
[PATCH AUTOSEL 4.19 1/7] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 1d5510cb6db4e..1962ff624b7c5 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -385,8 +385,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
[PATCH AUTOSEL 5.4 1/7] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 514f9f287a781..c6f181702b9a7 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
[PATCH AUTOSEL 5.10 01/13] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 514f9f287a781..c6f181702b9a7 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
[PATCH AUTOSEL 5.15 14/18] drm/amdgpu: Handle null atom context in VBIOS info ioctl
From: David Francis [ Upstream commit 5e7e82254270c8cf8b107451c5de01cee2f135ae ] On some APU systems, there is no atom context and so the atom_context struct is null. Add a check to the VBIOS_INFO branch of amdgpu_info_ioctl to handle this case, returning all zeroes. Reviewed-by: Alex Deucher Signed-off-by: David Francis Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index e8485b1f02ed6..70d49b998ee9e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -926,12 +926,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) struct atom_context *atom_context; atom_context = adev->mode_info.atom_context; - memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name)); - memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn)); - vbios_info.version = atom_context->version; - memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, - sizeof(atom_context->vbios_ver_str)); - memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date)); + if (atom_context) { + memcpy(vbios_info.name, atom_context->name, + sizeof(atom_context->name)); + memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, + sizeof(atom_context->vbios_pn)); + vbios_info.version = atom_context->version; + memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, + sizeof(atom_context->vbios_ver_str)); + memcpy(vbios_info.date, atom_context->date, + sizeof(atom_context->date)); + } return copy_to_user(out, _info, min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0; -- 2.40.1
[PATCH AUTOSEL 5.15 13/18] drm/amd/display: Don't check registers, if using AUX BL control
From: Swapnil Patel [ Upstream commit f5b2c10b57615828b531bb0ae56bd6325a41167e ] [Why] Currently the driver looks DCN registers to access if BL is on or not. This check is not valid if we are using AUX based brightness control. This causes driver to not send out "backlight off" command during power off sequence as it already thinks it is off. [How] Only check DCN registers if we aren't using AUX based brightness control. Reviewed-by: Wenjing Liu Acked-by: Stylon Wang Signed-off-by: Swapnil Patel Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index 52142d272c868..87825818d43ec 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -980,7 +980,9 @@ void dce110_edp_backlight_control( return; } - if (link->panel_cntl) { + if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled || + link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 || + link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)) { bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl); if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) { -- 2.40.1
[PATCH AUTOSEL 6.1 22/28] drm/amdgpu/nbio4.3: set proper rmmio_remap.reg_offset for SR-IOV
From: Alex Deucher [ Upstream commit ab43213e7afd08ac68d4282060bacf309e70fd14 ] Needed for HDP flush to work correctly. Reviewed-by: Timmy Tsai Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c index 09fdcd20cb919..c52a378396af1 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c @@ -344,6 +344,9 @@ static void nbio_v4_3_init_registers(struct amdgpu_device *adev) data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK; WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data); } + if (amdgpu_sriov_vf(adev)) + adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0, + regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; } static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev) -- 2.40.1
[PATCH AUTOSEL 6.1 21/28] drm/amdgpu/soc21: don't remap HDP registers for SR-IOV
From: Alex Deucher [ Upstream commit 1832403cd41ca6b19b24e9d64f79cb08d920ca44 ] This matches the behavior for soc15 and nv. Acked-by: Christian König Reviewed-by: Timmy Tsai Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c index d150a90daa403..56af7b5abac14 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -755,7 +755,7 @@ static int soc21_common_hw_init(void *handle) * for the purpose of expose those registers * to process space */ - if (adev->nbio.funcs->remap_hdp_registers) + if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf(adev)) adev->nbio.funcs->remap_hdp_registers(adev); /* enable the doorbell aperture */ soc21_enable_doorbell_aperture(adev, true); -- 2.40.1
[PATCH AUTOSEL 5.15 01/18] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 514f9f287a781..c6f181702b9a7 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
[PATCH AUTOSEL 6.1 23/28] drm/amdgpu: Handle null atom context in VBIOS info ioctl
From: David Francis [ Upstream commit 5e7e82254270c8cf8b107451c5de01cee2f135ae ] On some APU systems, there is no atom context and so the atom_context struct is null. Add a check to the VBIOS_INFO branch of amdgpu_info_ioctl to handle this case, returning all zeroes. Reviewed-by: Alex Deucher Signed-off-by: David Francis Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 9e3313dd956ae..24b4bd6bb2771 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -896,12 +896,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) struct atom_context *atom_context; atom_context = adev->mode_info.atom_context; - memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name)); - memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn)); - vbios_info.version = atom_context->version; - memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, - sizeof(atom_context->vbios_ver_str)); - memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date)); + if (atom_context) { + memcpy(vbios_info.name, atom_context->name, + sizeof(atom_context->name)); + memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, + sizeof(atom_context->vbios_pn)); + vbios_info.version = atom_context->version; + memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, + sizeof(atom_context->vbios_ver_str)); + memcpy(vbios_info.date, atom_context->date, + sizeof(atom_context->date)); + } return copy_to_user(out, _info, min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0; -- 2.40.1
[PATCH AUTOSEL 6.1 20/28] drm/amd/display: Don't check registers, if using AUX BL control
From: Swapnil Patel [ Upstream commit f5b2c10b57615828b531bb0ae56bd6325a41167e ] [Why] Currently the driver looks DCN registers to access if BL is on or not. This check is not valid if we are using AUX based brightness control. This causes driver to not send out "backlight off" command during power off sequence as it already thinks it is off. [How] Only check DCN registers if we aren't using AUX based brightness control. Reviewed-by: Wenjing Liu Acked-by: Stylon Wang Signed-off-by: Swapnil Patel Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index 9378c98d02cfe..508f5fe268484 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -973,7 +973,9 @@ void dce110_edp_backlight_control( return; } - if (link->panel_cntl) { + if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled || + link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 || + link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)) { bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl); if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) { -- 2.40.1
[PATCH AUTOSEL 6.1 02/28] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 514f9f287a781..c6f181702b9a7 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
[PATCH AUTOSEL 6.5 32/41] drm/amdkfd: Checkpoint and restore queues on GFX11
From: David Francis [ Upstream commit 9296da8c40900b4dae3d973aa22be306e2a77671 ] The code in kfd_mqd_manager_v11.c to support criu dump and restore of queue state was missing. Added it; should be equivalent to kfd_mqd_manager_v10.c. CC: Felix Kuehling Reviewed-by: Harish Kasiviswanathan Acked-by: Alex Deucher Signed-off-by: David Francis Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c | 41 +++ 1 file changed, 41 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c index 97f754949ca92..352757f2d3202 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c @@ -321,6 +321,43 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, return 0; } +static void checkpoint_mqd(struct mqd_manager *mm, void *mqd, void *mqd_dst, void *ctl_stack_dst) +{ + struct v11_compute_mqd *m; + + m = get_mqd(mqd); + + memcpy(mqd_dst, m, sizeof(struct v11_compute_mqd)); +} + +static void restore_mqd(struct mqd_manager *mm, void **mqd, + struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, + struct queue_properties *qp, + const void *mqd_src, + const void *ctl_stack_src, const u32 ctl_stack_size) +{ + uint64_t addr; + struct v11_compute_mqd *m; + + m = (struct v11_compute_mqd *) mqd_mem_obj->cpu_ptr; + addr = mqd_mem_obj->gpu_addr; + + memcpy(m, mqd_src, sizeof(*m)); + + *mqd = m; + if (gart_addr) + *gart_addr = addr; + + m->cp_hqd_pq_doorbell_control = + qp->doorbell_off << + CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT; + pr_debug("cp_hqd_pq_doorbell_control 0x%x\n", + m->cp_hqd_pq_doorbell_control); + + qp->is_active = 0; +} + + static void init_mqd_hiq(struct mqd_manager *mm, void **mqd, struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, struct queue_properties *q) @@ -438,6 +475,8 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type, mqd->mqd_size = sizeof(struct v11_compute_mqd); mqd->get_wave_state = get_wave_state; mqd->mqd_stride = kfd_mqd_stride; + mqd->checkpoint_mqd = checkpoint_mqd; + mqd->restore_mqd = restore_mqd; #if defined(CONFIG_DEBUG_FS) mqd->debugfs_show_mqd = debugfs_show_mqd; #endif @@ -482,6 +521,8 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type, mqd->update_mqd = update_mqd_sdma; mqd->destroy_mqd = kfd_destroy_mqd_sdma; mqd->is_occupied = kfd_is_occupied_sdma; + mqd->checkpoint_mqd = checkpoint_mqd; + mqd->restore_mqd = restore_mqd; mqd->mqd_size = sizeof(struct v11_sdma_mqd); mqd->mqd_stride = kfd_mqd_stride; #if defined(CONFIG_DEBUG_FS) -- 2.40.1
[PATCH AUTOSEL 6.5 31/41] drm/amdgpu: fallback to old RAS error message for aqua_vanjaram
From: Hawking Zhang [ Upstream commit ffd6bde302061aeee405ab364403af30210f0b99 ] So driver doesn't generate incorrect message until the new format is settled down for aqua_vanjaram Signed-off-by: Hawking Zhang Reviewed-by: Yang Wang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 8aaa427f8c0f6..7d5019a884024 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1061,7 +1061,8 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev, info->ce_count = obj->err_data.ce_count; if (err_data.ce_count) { - if (adev->smuio.funcs && + if (!adev->aid_mask && + adev->smuio.funcs && adev->smuio.funcs->get_socket_id && adev->smuio.funcs->get_die_id) { dev_info(adev->dev, "socket: %d, die: %d " @@ -1081,7 +1082,8 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev, } } if (err_data.ue_count) { - if (adev->smuio.funcs && + if (!adev->aid_mask && + adev->smuio.funcs && adev->smuio.funcs->get_socket_id && adev->smuio.funcs->get_die_id) { dev_info(adev->dev, "socket: %d, die: %d " -- 2.40.1
[PATCH AUTOSEL 6.5 33/41] drm/amdgpu: Handle null atom context in VBIOS info ioctl
From: David Francis [ Upstream commit 5e7e82254270c8cf8b107451c5de01cee2f135ae ] On some APU systems, there is no atom context and so the atom_context struct is null. Add a check to the VBIOS_INFO branch of amdgpu_info_ioctl to handle this case, returning all zeroes. Reviewed-by: Alex Deucher Signed-off-by: David Francis Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index f678bdd5f353d..b9fc7e2db5e59 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -940,12 +940,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) struct atom_context *atom_context; atom_context = adev->mode_info.atom_context; - memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name)); - memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn)); - vbios_info.version = atom_context->version; - memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, - sizeof(atom_context->vbios_ver_str)); - memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date)); + if (atom_context) { + memcpy(vbios_info.name, atom_context->name, + sizeof(atom_context->name)); + memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, + sizeof(atom_context->vbios_pn)); + vbios_info.version = atom_context->version; + memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, + sizeof(atom_context->vbios_ver_str)); + memcpy(vbios_info.date, atom_context->date, + sizeof(atom_context->date)); + } return copy_to_user(out, _info, min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0; -- 2.40.1
[PATCH AUTOSEL 6.5 27/41] drm/amd/display: Add dirty rect support for Replay
From: Bhawanpreet Lakha [ Upstream commit 679fc891bf11845730b572fc44f8a0eb846aba29 ] Dirty rect can be used with replay, so enable them to allow for more powersaving. Reviewed-by: Sun peng Li Acked-by: Stylon Wang Signed-off-by: Bhawanpreet Lakha Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 3123ea2f4f30a..5c63a13f25193 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8038,7 +8038,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, bundle->surface_updates[planes_count].plane_info = >plane_infos[planes_count]; - if (acrtc_state->stream->link->psr_settings.psr_feature_enabled) { + if (acrtc_state->stream->link->psr_settings.psr_feature_enabled || + acrtc_state->stream->link->replay_settings.replay_feature_enabled) { fill_dc_dirty_rects(plane, old_plane_state, new_plane_state, new_crtc_state, >flip_addrs[planes_count], -- 2.40.1
[PATCH AUTOSEL 6.5 30/41] drm/amdgpu/nbio4.3: set proper rmmio_remap.reg_offset for SR-IOV
From: Alex Deucher [ Upstream commit ab43213e7afd08ac68d4282060bacf309e70fd14 ] Needed for HDP flush to work correctly. Reviewed-by: Timmy Tsai Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c index d5ed9e0e1a5f1..e5b5b0f4940f4 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c @@ -345,6 +345,9 @@ static void nbio_v4_3_init_registers(struct amdgpu_device *adev) data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK; WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data); } + if (amdgpu_sriov_vf(adev)) + adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0, + regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; } static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev) -- 2.40.1
[PATCH AUTOSEL 6.5 29/41] drm/amdgpu/soc21: don't remap HDP registers for SR-IOV
From: Alex Deucher [ Upstream commit 1832403cd41ca6b19b24e9d64f79cb08d920ca44 ] This matches the behavior for soc15 and nv. Acked-by: Christian König Reviewed-by: Timmy Tsai Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c index e5e5d68a4d702..1a5ffbf884891 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -786,7 +786,7 @@ static int soc21_common_hw_init(void *handle) * for the purpose of expose those registers * to process space */ - if (adev->nbio.funcs->remap_hdp_registers) + if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf(adev)) adev->nbio.funcs->remap_hdp_registers(adev); /* enable the doorbell aperture */ adev->nbio.funcs->enable_doorbell_aperture(adev, true); -- 2.40.1
[PATCH AUTOSEL 6.5 26/41] drm/amdkfd: Update CU masking for GFX 9.4.3
From: Mukul Joshi [ Upstream commit fc6efed2c728c9c10b058512fc9c1613f870a8e8 ] The CU mask passed from user-space will change based on different spatial partitioning mode. As a result, update CU masking code for GFX9.4.3 to work for all partitioning modes. Signed-off-by: Mukul Joshi Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 28 --- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h | 2 +- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c | 2 +- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 2 +- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c | 2 +- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 46 --- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c | 2 +- 7 files changed, 56 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c index 35e05ee89eac5..254f343f967a3 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c @@ -97,14 +97,16 @@ void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd, void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, const uint32_t *cu_mask, uint32_t cu_mask_count, - uint32_t *se_mask) + uint32_t *se_mask, uint32_t inst) { struct kfd_cu_info cu_info; uint32_t cu_per_sh[KFD_MAX_NUM_SE][KFD_MAX_NUM_SH_PER_SE] = {0}; bool wgp_mode_req = KFD_GC_VERSION(mm->dev) >= IP_VERSION(10, 0, 0); uint32_t en_mask = wgp_mode_req ? 0x3 : 0x1; - int i, se, sh, cu, cu_bitmap_sh_mul, inc = wgp_mode_req ? 2 : 1; + int i, se, sh, cu, cu_bitmap_sh_mul, cu_inc = wgp_mode_req ? 2 : 1; uint32_t cu_active_per_node; + int inc = cu_inc * NUM_XCC(mm->dev->xcc_mask); + int xcc_inst = inst + ffs(mm->dev->xcc_mask) - 1; amdgpu_amdkfd_get_cu_info(mm->dev->adev, _info); @@ -143,7 +145,8 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, for (se = 0; se < cu_info.num_shader_engines; se++) for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) cu_per_sh[se][sh] = hweight32( - cu_info.cu_bitmap[0][se % 4][sh + (se / 4) * cu_bitmap_sh_mul]); + cu_info.cu_bitmap[xcc_inst][se % 4][sh + (se / 4) * + cu_bitmap_sh_mul]); /* Symmetrically map cu_mask to all SEs & SHs: * se_mask programs up to 2 SH in the upper and lower 16 bits. @@ -166,20 +169,33 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, * cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1) * ... * +* For GFX 9.4.3, the following code only looks at a +* subset of the cu_mask corresponding to the inst parameter. +* If we have n XCCs under one GPU node +* cu_mask[0] bit0 -> XCC0 se_mask[0] bit0 (XCC0,SE0,SH0,CU0) +* cu_mask[0] bit1 -> XCC1 se_mask[0] bit0 (XCC1,SE0,SH0,CU0) +* .. +* cu_mask[0] bitn -> XCCn se_mask[0] bit0 (XCCn,SE0,SH0,CU0) +* cu_mask[0] bit n+1 -> XCC0 se_mask[1] bit0 (XCC0,SE1,SH0,CU0) +* +* For example, if there are 6 XCCs under 1 KFD node, this code +* running for each inst, will look at the bits as: +* inst, inst + 6, inst + 12... +* * First ensure all CUs are disabled, then enable user specified CUs. */ for (i = 0; i < cu_info.num_shader_engines; i++) se_mask[i] = 0; - i = 0; - for (cu = 0; cu < 16; cu += inc) { + i = inst; + for (cu = 0; cu < 16; cu += cu_inc) { for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) { for (se = 0; se < cu_info.num_shader_engines; se++) { if (cu_per_sh[se][sh] > cu) { if (cu_mask[i / 32] & (en_mask << (i % 32))) se_mask[se] |= en_mask << (cu + sh * 16); i += inc; - if (i == cu_mask_count) + if (i >= cu_mask_count) return; } } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h index 23158db7da035..57bf5e513f4d1 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h @@ -138,7 +138,7 @@ void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd, void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, const uint32_t *cu_mask, uint32_t cu_mask_count, - uint32_t *se_mask); + uint32_t *se_mask, uint32_t inst);
[PATCH AUTOSEL 6.5 25/41] drm/amdkfd: Update cache info reporting for GFX v9.4.3
From: Mukul Joshi [ Upstream commit 0752e66e91fa86fa5481b04b22053363833ffb85 ] Update cache info reporting in sysfs to report the correct number of CUs and associated cache information based on different spatial partitioning modes. Signed-off-by: Mukul Joshi Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_crat.h | 4 ++ drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 82 +-- drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 2 +- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h index fc719389b5d65..4684711aa695a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h @@ -79,6 +79,10 @@ struct crat_header { #define CRAT_SUBTYPE_IOLINK_AFFINITY 5 #define CRAT_SUBTYPE_MAX 6 +/* + * Do not change the value of CRAT_SIBLINGMAP_SIZE from 32 + * as it breaks the ABI. + */ #define CRAT_SIBLINGMAP_SIZE 32 /* diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index ea67a353beb00..5582191022106 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c @@ -1650,14 +1650,17 @@ static int fill_in_l1_pcache(struct kfd_cache_properties **props_ext, static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext, struct kfd_gpu_cache_info *pcache_info, struct kfd_cu_info *cu_info, - int cache_type, unsigned int cu_processor_id) + int cache_type, unsigned int cu_processor_id, + struct kfd_node *knode) { unsigned int cu_sibling_map_mask; int first_active_cu; - int i, j, k; + int i, j, k, xcc, start, end; struct kfd_cache_properties *pcache = NULL; - cu_sibling_map_mask = cu_info->cu_bitmap[0][0][0]; + start = ffs(knode->xcc_mask) - 1; + end = start + NUM_XCC(knode->xcc_mask); + cu_sibling_map_mask = cu_info->cu_bitmap[start][0][0]; cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1); first_active_cu = ffs(cu_sibling_map_mask); @@ -1692,16 +1695,18 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext, cu_sibling_map_mask = cu_sibling_map_mask >> (first_active_cu - 1); k = 0; - for (i = 0; i < cu_info->num_shader_engines; i++) { - for (j = 0; j < cu_info->num_shader_arrays_per_engine; j++) { - pcache->sibling_map[k] = (uint8_t)(cu_sibling_map_mask & 0xFF); - pcache->sibling_map[k+1] = (uint8_t)((cu_sibling_map_mask >> 8) & 0xFF); - pcache->sibling_map[k+2] = (uint8_t)((cu_sibling_map_mask >> 16) & 0xFF); - pcache->sibling_map[k+3] = (uint8_t)((cu_sibling_map_mask >> 24) & 0xFF); - k += 4; - - cu_sibling_map_mask = cu_info->cu_bitmap[0][i % 4][j + i / 4]; - cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1); + for (xcc = start; xcc < end; xcc++) { + for (i = 0; i < cu_info->num_shader_engines; i++) { + for (j = 0; j < cu_info->num_shader_arrays_per_engine; j++) { + pcache->sibling_map[k] = (uint8_t)(cu_sibling_map_mask & 0xFF); + pcache->sibling_map[k+1] = (uint8_t)((cu_sibling_map_mask >> 8) & 0xFF); + pcache->sibling_map[k+2] = (uint8_t)((cu_sibling_map_mask >> 16) & 0xFF); + pcache->sibling_map[k+3] = (uint8_t)((cu_sibling_map_mask >> 24) & 0xFF); + k += 4; + + cu_sibling_map_mask = cu_info->cu_bitmap[xcc][i % 4][j + i / 4]; + cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1); + } } } pcache->sibling_map_size = k; @@ -1719,7 +1724,7 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext, static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct kfd_node *kdev) { struct kfd_gpu_cache_info *pcache_info = NULL; - int i, j, k; + int i, j, k, xcc, start, end; int ct = 0; unsigned int cu_processor_id; int ret; @@ -1753,37 +1758,42 @@ static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct *
[PATCH AUTOSEL 6.5 28/41] drm/amd/display: Don't check registers, if using AUX BL control
From: Swapnil Patel [ Upstream commit f5b2c10b57615828b531bb0ae56bd6325a41167e ] [Why] Currently the driver looks DCN registers to access if BL is on or not. This check is not valid if we are using AUX based brightness control. This causes driver to not send out "backlight off" command during power off sequence as it already thinks it is off. [How] Only check DCN registers if we aren't using AUX based brightness control. Reviewed-by: Wenjing Liu Acked-by: Stylon Wang Signed-off-by: Swapnil Patel Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index 6966420dfbac3..15fa19ee748cf 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -964,7 +964,9 @@ void dce110_edp_backlight_control( return; } - if (link->panel_cntl) { + if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled || + link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 || + link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)) { bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl); if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) { -- 2.40.1
[PATCH AUTOSEL 6.5 24/41] drm/amdgpu: Store CU info from all XCCs for GFX v9.4.3
From: Mukul Joshi [ Upstream commit 97e3c6a853f2af9145daf0c6ca25bcdf55c759d4 ] Currently, we store CU info only for a single XCC assuming that it is the same for all XCCs. However, that may not be true. As a result, store CU info for all XCCs. This info is later used for CU masking. Signed-off-by: Mukul Joshi Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c| 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c| 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c| 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 76 +-- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 8 +- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 11 ++- .../gpu/drm/amd/include/kgd_kfd_interface.h | 6 +- 14 files changed, 60 insertions(+), 65 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index b4fcad0e62f7e..a7c8beff1647c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -492,7 +492,7 @@ void amdgpu_amdkfd_get_cu_info(struct amdgpu_device *adev, struct kfd_cu_info *c cu_info->cu_active_number = acu_info.number; cu_info->cu_ao_mask = acu_info.ao_cu_mask; memcpy(_info->cu_bitmap[0], _info.bitmap[0], - sizeof(acu_info.bitmap)); + sizeof(cu_info->cu_bitmap)); cu_info->num_shader_engines = adev->gfx.config.max_shader_engines; cu_info->num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se; cu_info->num_cu_per_sh = adev->gfx.config.max_cu_per_sh; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h index a4ff515ce8966..59ba03d387fcc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h @@ -43,6 +43,7 @@ #define AMDGPU_GFX_LBPW_DISABLED_MODE 0x0008L #define AMDGPU_MAX_GC_INSTANCES8 +#define KGD_MAX_QUEUES 128 #define AMDGPU_MAX_GFX_QUEUES KGD_MAX_QUEUES #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES @@ -254,7 +255,7 @@ struct amdgpu_cu_info { uint32_t number; uint32_t ao_cu_mask; uint32_t ao_cu_bitmap[4][4]; - uint32_t bitmap[4][4]; + uint32_t bitmap[AMDGPU_MAX_GC_INSTANCES][4][4]; }; struct amdgpu_gfx_ras { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index d4ca19ba5a289..f678bdd5f353d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -839,7 +839,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) memcpy(_info->cu_ao_bitmap[0], >gfx.cu_info.ao_cu_bitmap[0], sizeof(adev->gfx.cu_info.ao_cu_bitmap)); memcpy(_info->cu_bitmap[0], >gfx.cu_info.bitmap[0], - sizeof(adev->gfx.cu_info.bitmap)); + sizeof(dev_info->cu_bitmap)); dev_info->vram_type = adev->gmc.vram_type; dev_info->vram_bit_width = adev->gmc.vram_width; dev_info->vce_harvest_config = adev->vce.harvest_config; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 44af8022b89fa..f743bf2c92877 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -9448,7 +9448,7 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev, gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh( adev, disable_masks[i * 2 + j]); bitmap = gfx_v10_0_get_cu_active_bitmap_per_sh(adev); - cu_info->bitmap[i][j] = bitmap; + cu_info->bitmap[0][i][j] = bitmap; for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) { if (bitmap & mask) { diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 0451533ddde41..a82cba884c48f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -6394,7 +6394,7 @@ static int gfx_v11_0_get_cu_info(struct amdgpu_device *adev, *SE6: {SH0,SH1} --> {bitmap[2][2], bitmap[2][3]} *SE7: {SH0,SH1} --> {bitmap[3][2], bitmap[3][3]} */ - cu_info->bitmap[i % 4][j + (i /
[PATCH AUTOSEL 6.5 02/41] parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller [ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ] Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index 8e51c775c80a6..62399c7ea94a1 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; + #define ASTRO_RUNWAY_PORT 0x582 #define IKE_MERCED_PORT0x803 #define REO_MERCED_PORT0x804 diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 514f9f287a781..c6f181702b9a7 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) static int __init parisc_agp_init(void) { - extern struct sba_device *sba_list; - int err = -1; struct parisc_device *sba = NULL, *lba = NULL; struct lba_device *lbadev = NULL; -- 2.40.1
Re: [PATCH RFC v6 08/10] drm/msm/dpu: Allow NULL FBs in atomic commit
On 29/08/2023 03:05, Jessica Zhang wrote: Since solid fill planes allow for a NULL framebuffer in a valid commit, add NULL framebuffer checks to atomic commit calls within DPU. Reviewed-by: Dmitry Baryshkov Signed-off-by: Jessica Zhang --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 9 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 41 --- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 8ce7586e2ddf..5e845510e8c1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -451,6 +451,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, struct drm_plane_state *state; struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state); struct dpu_plane_state *pstate = NULL; + const struct msm_format *fmt; struct dpu_format *format; struct dpu_hw_ctl *ctl = mixer->lm_ctl; @@ -470,7 +471,13 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, pstate = to_dpu_plane_state(state); fb = state->fb; - format = to_dpu_format(msm_framebuffer_format(pstate->base.fb)); + if (drm_plane_solid_fill_enabled(state)) + fmt = dpu_get_msm_format(&_dpu_crtc_get_kms(crtc)->base, + DRM_FORMAT_ABGR, 0); + else + fmt = msm_framebuffer_format(pstate->base.fb); + + format = to_dpu_format(fmt); if (pstate->stage == DPU_STAGE_BASE && format->alpha_enable) bg_alpha_enable = true; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index c2aaaded07ed..114c803ff99b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -837,8 +837,13 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, pipe_cfg->dst_rect = new_plane_state->dst; - fb_rect.x2 = new_plane_state->fb->width; - fb_rect.y2 = new_plane_state->fb->height; + if (drm_plane_solid_fill_enabled(new_plane_state)) + return 0; This would skip all the width checks, dpu_plane_atomic_check_pipe(), etc. Could you please confirm that all of those checks are irrelevant for solid fill? + + if (new_plane_state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && new_plane_state->fb) { + fb_rect.x2 = new_plane_state->fb->width; + fb_rect.y2 = new_plane_state->fb->height; + } /* Ensure fb size is supported */ if (drm_rect_width(_rect) > MAX_IMG_WIDTH || @@ -1082,21 +1087,32 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) struct drm_crtc *crtc = state->crtc; struct drm_framebuffer *fb = state->fb; bool is_rt_pipe; - const struct dpu_format *fmt = - to_dpu_format(msm_framebuffer_format(fb)); + const struct dpu_format *fmt; struct dpu_sw_pipe_cfg *pipe_cfg = >pipe_cfg; struct dpu_sw_pipe_cfg *r_pipe_cfg = >r_pipe_cfg; struct dpu_kms *kms = _dpu_plane_get_kms(>base); struct msm_gem_address_space *aspace = kms->base.aspace; struct dpu_hw_fmt_layout layout; bool layout_valid = false; - int ret; - ret = dpu_format_populate_layout(aspace, fb, ); - if (ret) - DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); - else - layout_valid = true; + if (state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && fb) { + int ret; + + fmt = to_dpu_format(msm_framebuffer_format(fb)); + + ret = dpu_format_populate_layout(aspace, fb, ); + if (ret) + DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); + else + layout_valid = true; + + DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u " DRM_RECT_FMT + ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_FP_ARG(>src), + crtc->base.id, DRM_RECT_ARG(>dst), + (char *)>base.pixel_format, DPU_FORMAT_IS_UBWC(fmt)); + } else { + fmt = dpu_get_dpu_format(DRM_FORMAT_ABGR); #define DPU_SOLID_FILL_FORMAT ? Also, I don't think that solid_fill planes consume bandwidth, so this likely needs to be fixed too. + } pstate->pending = true; @@ -1104,11 +1120,6 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) pstate->needs_qos_remap |= (is_rt_pipe != pdpu->is_rt_pipe); pdpu->is_rt_pipe = is_rt_pipe; - DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u " DRM_RECT_FMT - ", %4.4s ubwc %d\n", fb->base.id,
Re: [Freedreno] [PATCH RFC v6 07/10] drm/atomic: Loosen FB atomic checks
On 22/09/2023 20:49, Jessica Zhang wrote: On 8/29/2023 1:22 AM, Pekka Paalanen wrote: On Mon, 28 Aug 2023 17:05:13 -0700 Jessica Zhang wrote: Loosen the requirements for atomic and legacy commit so that, in cases where pixel_source != FB, the commit can still go through. This includes adding framebuffer NULL checks in other areas to account for FB being NULL when non-FB pixel sources are enabled. To disable a plane, the pixel_source must be NONE or the FB must be NULL if pixel_source == FB. Signed-off-by: Jessica Zhang --- drivers/gpu/drm/drm_atomic.c | 20 +++- drivers/gpu/drm/drm_atomic_helper.c | 36 include/drm/drm_atomic_helper.h | 4 ++-- include/drm/drm_plane.h | 29 + 4 files changed, 62 insertions(+), 27 deletions(-) ... diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index a58f84b6bd5e..4c5b7bcdb25c 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -992,6 +992,35 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev, #define drm_for_each_plane(plane, dev) \ list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) +/** + * drm_plane_solid_fill_enabled - Check if solid fill is enabled on plane + * @state: plane state + * + * Returns: + * Whether the plane has been assigned a solid_fill_blob + */ +static inline bool drm_plane_solid_fill_enabled(struct drm_plane_state *state) +{ + if (!state) + return false; + return state->pixel_source == DRM_PLANE_PIXEL_SOURCE_SOLID_FILL && state->solid_fill_blob; +} + +static inline bool drm_plane_has_visible_data(const struct drm_plane_state *state) +{ + switch (state->pixel_source) { + case DRM_PLANE_PIXEL_SOURCE_NONE: + return false; + case DRM_PLANE_PIXEL_SOURCE_SOLID_FILL: + return state->solid_fill_blob != NULL; This reminds me, new UAPI docs did not say what the requirements are for choosing solid fill pixel source. Is the atomic commit rejected if pixel source is solid fill, but solid_fill property has no blob? Hi Pekka, Yes, if pixel_source is solid_fill and the solid_fill property blob isn't set, the atomic commit should throw an error. Will document this in the UAPI. I don't see a corresponding error check in atomic_check() functions. Could you please check that there is one, as you are updating the uAPI. Thanks, Jessica Zhang This should be doc'd. Thanks, pq + case DRM_PLANE_PIXEL_SOURCE_FB: + default: + WARN_ON(state->pixel_source != DRM_PLANE_PIXEL_SOURCE_FB); + } + + return state->fb != NULL; +} + bool drm_any_plane_has_format(struct drm_device *dev, u32 format, u64 modifier); -- With best wishes Dmitry
Re: [PATCH RFC v6 07/10] drm/atomic: Loosen FB atomic checks
On 29/08/2023 03:05, Jessica Zhang wrote: Loosen the requirements for atomic and legacy commit so that, in cases where pixel_source != FB, the commit can still go through. This includes adding framebuffer NULL checks in other areas to account for FB being NULL when non-FB pixel sources are enabled. To disable a plane, the pixel_source must be NONE or the FB must be NULL if pixel_source == FB. Signed-off-by: Jessica Zhang --- drivers/gpu/drm/drm_atomic.c| 20 +++- drivers/gpu/drm/drm_atomic_helper.c | 36 include/drm/drm_atomic_helper.h | 4 ++-- include/drm/drm_plane.h | 29 + 4 files changed, 62 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index cc0e93d19e15..cdc6cfedd433 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -668,14 +668,14 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, const struct drm_framebuffer *fb = new_plane_state->fb; int ret; - /* either *both* CRTC and FB must be set, or neither */ - if (crtc && !fb) { - drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no FB\n", + /* either *both* CRTC and pixel source must be set, or neither */ + if (crtc && !drm_plane_has_visible_data(new_plane_state)) { + drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no visible data\n", plane->base.id, plane->name); return -EINVAL; - } else if (fb && !crtc) { - drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] FB set but no CRTC\n", - plane->base.id, plane->name); + } else if (drm_plane_has_visible_data(new_plane_state) && !crtc) { + drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] Source %d has visible data but no CRTC\n", + plane->base.id, plane->name, new_plane_state->pixel_source); return -EINVAL; } @@ -706,9 +706,11 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, } - ret = drm_atomic_plane_check_fb(new_plane_state); - if (ret) - return ret; + if (new_plane_state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && fb) { Nit: could you please be more specific here? Drop the fb variable and use new_plane_state->fb directly. + ret = drm_atomic_plane_check_fb(new_plane_state); + if (ret) + return ret; + } if (plane_switching_crtc(old_plane_state, new_plane_state)) { drm_dbg_atomic(plane->dev, diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 41b8066f61ff..a176064ee27e 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -864,7 +864,7 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, *src = drm_plane_state_src(plane_state); *dst = drm_plane_state_dest(plane_state); - if (!fb) { + if (!drm_plane_has_visible_data(plane_state)) { plane_state->visible = false; return 0; } @@ -881,25 +881,29 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, return -EINVAL; } - drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation); + if (plane_state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && fb) { And here too. Could you please move fb var into the condition? Other than that LGTM + drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation); - /* Check scaling */ - hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); - vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); - if (hscale < 0 || vscale < 0) { - drm_dbg_kms(plane_state->plane->dev, - "Invalid scaling of plane\n"); - drm_rect_debug_print("src: ", _state->src, true); - drm_rect_debug_print("dst: ", _state->dst, false); - return -ERANGE; - } + /* Check scaling */ + hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); + vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); - if (crtc_state->enable) - drm_mode_get_hv_timing(_state->mode, , ); + if (hscale < 0 || vscale < 0) { + drm_dbg_kms(plane_state->plane->dev, + "Invalid scaling of plane\n"); + drm_rect_debug_print("src: ", _state->src, true); + drm_rect_debug_print("dst: ", _state->dst, false); + return -ERANGE; + } - plane_state->visible =
Re: [PATCH RFC v6 05/10] drm/atomic: Add solid fill data to plane state dump
On 29/08/2023 03:05, Jessica Zhang wrote: Add solid_fill property data to the atomic plane state dump. Signed-off-by: Jessica Zhang --- drivers/gpu/drm/drm_atomic.c | 4 drivers/gpu/drm/drm_plane.c | 8 include/drm/drm_plane.h | 3 +++ 3 files changed, 15 insertions(+) Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry
Re: [PATCH RFC v6 04/10] drm/atomic: Add pixel source to plane state dump
On 29/08/2023 03:05, Jessica Zhang wrote: Add pixel source to the atomic plane state dump Signed-off-by: Jessica Zhang --- drivers/gpu/drm/drm_atomic.c| 1 + drivers/gpu/drm/drm_blend.c | 1 + drivers/gpu/drm/drm_crtc_internal.h | 1 + 3 files changed, 3 insertions(+) Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry
Re: [PATCH RFC v6 01/10] drm: Introduce pixel_source DRM plane property
On 29/08/2023 03:05, Jessica Zhang wrote: Add support for pixel_source property to drm_plane and related documentation. In addition, force pixel_source to DRM_PLANE_PIXEL_SOURCE_FB in DRM_IOCTL_MODE_SETPLANE as to not break legacy userspace. This enum property will allow user to specify a pixel source for the plane. Possible pixel sources will be defined in the drm_plane_pixel_source enum. Currently, the only pixel sources are DRM_PLANE_PIXEL_SOURCE_FB (the default value) and DRM_PLANE_PIXEL_SOURCE_NONE. Signed-off-by: Jessica Zhang Acked-by: Dmitry Baryshkov Minor question below --- drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 4 ++ drivers/gpu/drm/drm_blend.c | 90 +++ drivers/gpu/drm/drm_plane.c | 19 +-- include/drm/drm_blend.h | 2 + include/drm/drm_plane.h | 21 6 files changed, 133 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 784e63d70a42..01638c51ce0a 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -252,6 +252,7 @@ void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *plane_state, plane_state->alpha = DRM_BLEND_ALPHA_OPAQUE; plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI; + plane_state->pixel_source = DRM_PLANE_PIXEL_SOURCE_FB; if (plane->color_encoding_property) { if (!drm_object_property_get_default_value(>base, diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index d867e7f9f2cd..454f980e16c9 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -544,6 +544,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->src_w = val; } else if (property == config->prop_src_h) { state->src_h = val; + } else if (property == plane->pixel_source_property) { + state->pixel_source = val; } else if (property == plane->alpha_property) { state->alpha = val; } else if (property == plane->blend_mode_property) { @@ -616,6 +618,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->src_w; } else if (property == config->prop_src_h) { *val = state->src_h; + } else if (property == plane->pixel_source_property) { + *val = state->pixel_source; } else if (property == plane->alpha_property) { *val = state->alpha; } else if (property == plane->blend_mode_property) { diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 6e74de833466..c3c57bae06b7 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -185,6 +185,21 @@ * plane does not expose the "alpha" property, then this is * assumed to be 1.0 * + * pixel_source: + * pixel_source is set up with drm_plane_create_pixel_source_property(). + * It is used to toggle the active source of pixel data for the plane. + * The plane will only display data from the set pixel_source -- any + * data from other sources will be ignored. + * + * Possible values: + * + * "NONE": + * No active pixel source. + * Committing with a NONE pixel source will disable the plane. + * + * "FB": + * Framebuffer source set by the "FB_ID" property. + * * Note that all the property extensions described here apply either to the * plane or the CRTC (e.g. for the background color, which currently is not * exposed and assumed to be black). @@ -615,3 +630,78 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane, return 0; } EXPORT_SYMBOL(drm_plane_create_blend_mode_property); + +static const struct drm_prop_enum_list drm_pixel_source_enum_list[] = { + { DRM_PLANE_PIXEL_SOURCE_NONE, "NONE" }, + { DRM_PLANE_PIXEL_SOURCE_FB, "FB" }, +}; + +/** + * drm_plane_create_pixel_source_property - create a new pixel source property + * @plane: DRM plane + * @extra_sources: Bitmask of additional supported pixel_sources for the driver. + *DRM_PLANE_PIXEL_SOURCE_FB and DRM_PLANE_PIXEL_SOURCE_NONE will + *always be enabled as supported sources. + * + * This creates a new property describing the current source of pixel data for the + * plane. The pixel_source will be initialized as DRM_PLANE_PIXEL_SOURCE_FB by default. + * + * Drivers can set a custom default source by overriding the pixel_source value in + * drm_plane_funcs.reset() + * + * The property is exposed to userspace as an enumeration property called + * "pixel_source" and has the following enumeration values: + * + * "NONE": + * No active pixel source + * + * "FB":
Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
On 9/22/23 11:32, Kees Cook wrote: Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct nvkm_perfdom. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Ben Skeggs Cc: Karol Herbst Cc: Lyude Paul Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: nouv...@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h index 6ae25d3e7f45..c011227f7052 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h @@ -82,7 +82,7 @@ struct nvkm_perfdom { u8 mode; u32 clk; u16 signal_nr; - struct nvkm_perfsig signal[]; + struct nvkm_perfsig signal[] __counted_by(signal_nr); }; struct nvkm_funcdom {
Re: [PATCH] drm/msm/mdp4: Add error handling in mdp4_lvds_connector_init()
On Sun, 24 Sept 2023 at 09:42, liuhaoran wrote: > > This patch adds error-handling for the drm_connector_init() and > drm_connector_attach_encoder inside the mdp4_lvds_connector_init(). > > Signed-off-by: liuhaoran As pointed out by the kernel robot, this was not even compile tested. So NAK. Please use proper casts for error returns. > --- > .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c| 14 +++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c > b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c > index 7444b75c4215..62eb363ba90f 100644 > --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c > +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c > @@ -96,6 +96,7 @@ struct drm_connector *mdp4_lvds_connector_init(struct > drm_device *dev, > { > struct drm_connector *connector = NULL; > struct mdp4_lvds_connector *mdp4_lvds_connector; > + int ret; > > mdp4_lvds_connector = kzalloc(sizeof(*mdp4_lvds_connector), > GFP_KERNEL); > if (!mdp4_lvds_connector) > @@ -106,8 +107,12 @@ struct drm_connector *mdp4_lvds_connector_init(struct > drm_device *dev, > > connector = _lvds_connector->base; > > - drm_connector_init(dev, connector, _lvds_connector_funcs, > - DRM_MODE_CONNECTOR_LVDS); > + ret = drm_connector_init(dev, connector, _lvds_connector_funcs, > +DRM_MODE_CONNECTOR_LVDS); > + > + if (ret) > + return ret; > + > drm_connector_helper_add(connector, > _lvds_connector_helper_funcs); > > connector->polled = 0; > @@ -115,7 +120,10 @@ struct drm_connector *mdp4_lvds_connector_init(struct > drm_device *dev, > connector->interlace_allowed = 0; > connector->doublescan_allowed = 0; > > - drm_connector_attach_encoder(connector, encoder); > + ret = drm_connector_attach_encoder(connector, encoder); > + > + if (ret) > + return ret; > > return connector; > } > -- > 2.17.1 > -- With best wishes Dmitry
Re: [PATCH] drm/sun4i: Add error handling in sun4i_layer_init_one()
Hi liuhaoran, kernel test robot noticed the following build warnings: [auto build test WARNING on sunxi/sunxi/for-next] [also build test WARNING on linus/master v6.6-rc2 next-20230921] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/liuhaoran/drm-sun4i-Add-error-handling-in-sun4i_layer_init_one/20230924-154504 base: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git sunxi/for-next patch link: https://lore.kernel.org/r/20230924074216.17390-1-liuhaoran14%40163.com patch subject: [PATCH] drm/sun4i: Add error handling in sun4i_layer_init_one() config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230924/202309241647.qegach1e-...@intel.com/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230924/202309241647.qegach1e-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202309241647.qegach1e-...@intel.com/ All warnings (new ones prefixed by >>): drivers/gpu/drm/sun4i/sun4i_layer.c: In function 'sun4i_layer_init_one': >> drivers/gpu/drm/sun4i/sun4i_layer.c:230:35: warning: missing terminating " >> character 230 | dev_err(drm->dev, "Failed to install alpha property, | ^ drivers/gpu/drm/sun4i/sun4i_layer.c:231:34: warning: missing terminating " character 231 | rc = %d\n", ret); | ^ drivers/gpu/drm/sun4i/sun4i_layer.c:239:35: warning: missing terminating " character 239 | dev_err(drm->dev, "Failed to install zpos property, | ^ drivers/gpu/drm/sun4i/sun4i_layer.c:240:34: warning: missing terminating " character 240 | rc = %d\n", ret); | ^ drivers/gpu/drm/sun4i/sun4i_layer.c:275:2: error: unterminated argument list invoking macro "dev_err" 275 | } | ^ drivers/gpu/drm/sun4i/sun4i_layer.c:230:17: error: 'dev_err' undeclared (first use in this function); did you mean '_dev_err'? 230 | dev_err(drm->dev, "Failed to install alpha property, | ^~~ | _dev_err drivers/gpu/drm/sun4i/sun4i_layer.c:230:17: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/sun4i/sun4i_layer.c:230:24: error: expected ';' at end of input 230 | dev_err(drm->dev, "Failed to install alpha property, |^ |; .. drivers/gpu/drm/sun4i/sun4i_layer.c:230:17: error: expected declaration or statement at end of input 230 | dev_err(drm->dev, "Failed to install alpha property, | ^~~ drivers/gpu/drm/sun4i/sun4i_layer.c:230:17: error: expected declaration or statement at end of input drivers/gpu/drm/sun4i/sun4i_layer.c: At top level: >> drivers/gpu/drm/sun4i/sun4i_layer.c:190:28: warning: 'sun4i_layer_init_one' >> defined but not used [-Wunused-function] 190 | static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, |^~~~ vim +230 drivers/gpu/drm/sun4i/sun4i_layer.c 189 > 190 static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, 191 struct sun4i_backend *backend, 192 enum drm_plane_type type, 193 unsigned int id) 194 { 195 const uint64_t *modifiers = sun4i_layer_modifiers; 196 const uint32_t *formats = sun4i_layer_formats; 197 unsigned int formats_len = ARRAY_SIZE(sun4i_layer_formats); 198 struct sun4i_layer *layer; 199 int ret; 200 201 layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL); 202 if (!layer) 203 return ERR_PTR(-ENOMEM); 204 205 layer->id = id; 206 layer->backend = backend; 207 208 if (IS_ERR_OR_NULL(backend->frontend)) { 209 formats = sun4i_backend_layer_formats; 210 formats_len = ARRAY_SIZE(sun4i_backend_layer_formats); 211 modifiers = NULL; 212
Re: [PATCH] drm/msm/mdp4: Add error handling in mdp4_lvds_connector_init()
Hi liuhaoran, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on linus/master v6.6-rc2 next-20230921] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/liuhaoran/drm-msm-mdp4-Add-error-handling-in-mdp4_lvds_connector_init/20230924-144326 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230924064159.14739-1-liuhaoran14%40163.com patch subject: [PATCH] drm/msm/mdp4: Add error handling in mdp4_lvds_connector_init() config: arm-defconfig (https://download.01.org/0day-ci/archive/20230924/202309241619.rhcrkwza-...@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230924/202309241619.rhcrkwza-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202309241619.rhcrkwza-...@intel.com/ All warnings (new ones prefixed by >>): drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c: In function 'mdp4_lvds_connector_init': >> drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c:114:24: warning: >> returning 'int' from a function with return type 'struct drm_connector *' >> makes pointer from integer without a cast [-Wint-conversion] 114 | return ret; |^~~ drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c:126:24: warning: returning 'int' from a function with return type 'struct drm_connector *' makes pointer from integer without a cast [-Wint-conversion] 126 | return ret; |^~~ vim +114 drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c 92 93 /* initialize connector */ 94 struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev, 95 struct device_node *panel_node, struct drm_encoder *encoder) 96 { 97 struct drm_connector *connector = NULL; 98 struct mdp4_lvds_connector *mdp4_lvds_connector; 99 int ret; 100 101 mdp4_lvds_connector = kzalloc(sizeof(*mdp4_lvds_connector), GFP_KERNEL); 102 if (!mdp4_lvds_connector) 103 return ERR_PTR(-ENOMEM); 104 105 mdp4_lvds_connector->encoder = encoder; 106 mdp4_lvds_connector->panel_node = panel_node; 107 108 connector = _lvds_connector->base; 109 110 ret = drm_connector_init(dev, connector, _lvds_connector_funcs, 111 DRM_MODE_CONNECTOR_LVDS); 112 113 if (ret) > 114 return ret; -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
[PATCH] drm/sun4i: Add error handling in sun4i_layer_init_one()
This patch adds error-handling for the drm_plane_create_alpha_property() and drm_plane_create_zpos_property() inside the dw_hdmi_imx_probe(). Signed-off-by: liuhaoran --- drivers/gpu/drm/sun4i/sun4i_layer.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 98f3176366c0..a3343afb7935 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -224,9 +224,22 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, drm_plane_helper_add(>plane, _backend_layer_helper_funcs); - drm_plane_create_alpha_property(>plane); - drm_plane_create_zpos_property(>plane, layer->id, - 0, SUN4I_BACKEND_NUM_LAYERS - 1); + ret = drm_plane_create_alpha_property(>plane); + + if (ret) { + dev_err(drm->dev, "Failed to install alpha property, + rc = %d\n", ret); + return ERR_PTR(ret); + } + + ret = drm_plane_create_zpos_property(>plane, layer->id, 0, +SUN4I_BACKEND_NUM_LAYERS - 1); + + if (ret) { + dev_err(drm->dev, "Failed to install zpos property, + rc = %d\n", ret); + return ERR_PTR(ret); + } return layer; } -- 2.17.1
[PATCH] drm/imx: Add error handling in dw_hdmi_imx_probe()
This patch adds error-handling for the of_match_node() inside the dw_hdmi_imx_probe(). Signed-off-by: liuhaoran --- drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c index a2277a0d6d06..3b25f018b2a6 100644 --- a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c +++ b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c @@ -224,6 +224,9 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev) struct imx_hdmi *hdmi; int ret; + if (!match) + return -ENODEV; + hdmi = devm_kzalloc(>dev, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) return -ENOMEM; -- 2.17.1
[PATCH] drm/msm/mdp4: Add error handling in mdp4_lvds_connector_init()
This patch adds error-handling for the drm_connector_init() and drm_connector_attach_encoder inside the mdp4_lvds_connector_init(). Signed-off-by: liuhaoran --- .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c| 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c index 7444b75c4215..62eb363ba90f 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c @@ -96,6 +96,7 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev, { struct drm_connector *connector = NULL; struct mdp4_lvds_connector *mdp4_lvds_connector; + int ret; mdp4_lvds_connector = kzalloc(sizeof(*mdp4_lvds_connector), GFP_KERNEL); if (!mdp4_lvds_connector) @@ -106,8 +107,12 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev, connector = _lvds_connector->base; - drm_connector_init(dev, connector, _lvds_connector_funcs, - DRM_MODE_CONNECTOR_LVDS); + ret = drm_connector_init(dev, connector, _lvds_connector_funcs, +DRM_MODE_CONNECTOR_LVDS); + + if (ret) + return ret; + drm_connector_helper_add(connector, _lvds_connector_helper_funcs); connector->polled = 0; @@ -115,7 +120,10 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev, connector->interlace_allowed = 0; connector->doublescan_allowed = 0; - drm_connector_attach_encoder(connector, encoder); + ret = drm_connector_attach_encoder(connector, encoder); + + if (ret) + return ret; return connector; } -- 2.17.1
[PATCH] drm/i915/gt: Add error handling in intel_timeline_pin()
This patch adds error-handling for the i915_active_acquire() inside the intel_timeline_pin(). Signed-off-by: liuhaoran --- drivers/gpu/drm/i915/gt/intel_timeline.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c b/drivers/gpu/drm/i915/gt/intel_timeline.c index b9640212d659..a2edf9233500 100644 --- a/drivers/gpu/drm/i915/gt/intel_timeline.c +++ b/drivers/gpu/drm/i915/gt/intel_timeline.c @@ -211,7 +211,11 @@ int intel_timeline_pin(struct intel_timeline *tl, struct i915_gem_ww_ctx *ww) GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n", tl->fence_context, tl->hwsp_offset); - i915_active_acquire(>active); + err = i915_active_acquire(>active); + + if (err) + return err; + if (atomic_fetch_inc(>pin_count)) { i915_active_release(>active); __i915_vma_unpin(tl->hwsp_ggtt); -- 2.17.1