Re: [PATCH v1] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option
> +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c > @@ -45,9 +45,11 @@ static void virtio_gpu_config_changed_work_func(struct > work_struct *work) > if (events_read & VIRTIO_GPU_EVENT_DISPLAY) { > if (vgdev->has_edid) > virtio_gpu_cmd_get_edids(vgdev); > - virtio_gpu_cmd_get_display_info(vgdev); > - virtio_gpu_notify(vgdev); > - drm_helper_hpd_irq_event(vgdev->ddev); > + if (vgdev->num_scanouts) { > + virtio_gpu_cmd_get_display_info(vgdev); > + virtio_gpu_notify(vgdev); > + drm_helper_hpd_irq_event(vgdev->ddev); > + } I'd suggest to make the edid lines conditional too. > - if (IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS) || !vgdev->num_scanouts) { > + if (!IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS) || !vgdev->num_scanouts) { > DRM_INFO("KMS disabled\n"); > vgdev->num_scanouts = 0; > vgdev->has_edid = false; Doesn't make a difference because has_edid gets set to false here, but IMHO it is less confusing that way. take care, Gerd
Re: [PATCH] drm/amdgpu: Use uncached ioremap() for LoongArch
Am 06.03.23 um 04:01 schrieb WANG Xuerui: On 2023/3/6 10:49, Huacai Chen wrote: Hi, Christian, On Mon, Mar 6, 2023 at 12:40 AM Christian König wrote: Am 05.03.23 um 06:21 schrieb Huacai Chen: LoongArch maintains cache coherency in hardware, but its WUC attribute (Weak-ordered UnCached, which is similar to WC) is out of the scope of cache coherency machanism. This means WUC can only used for write-only memory regions. So use uncached ioremap() for LoongArch in the amdgpu driver. Well NAK. This is leaking platform dependencies into the driver code. Then is it acceptable to let ioremap() depend on drm_arch_can_wc_memory()? Note: he's likely meaning "is it acceptable to use drm_arch_can_wc_memory() to decide between ioremap() and ioremap_wc()". Although I doubt it's acceptable to you (driver) folks either, because while drm_arch_can_wc_memory() does isolate platform details from driver proper, it's still papering over platform PCIe violation in VRAM domain. Still better than having platform defines though. Well agree on the PCIe violations, but drm_arch_can_wc_memory() is just for a completely different use case. drm_arch_can_wc_memory() checks if system memory can be accessed write combined as well (which is a PCIe extension) or needs to be accessed with caching enabled (which is a core PCIe requirement). So completely different topic and no using this here is not acceptable either. The key point is that when WUC only works with write only mappings you *can't* use that to implement ioremap_wc(). Also making use of drm_arch_can_wc_memory might fix this fdo issue [1] on aarch64 too (where I replied earlier). It seems people simply can't stop inventing such micro-architectures sadly... I don't think that will help for this bug. WC on iomem is known to work correctly on aarch64 and well tested. What doesn't work is using WC on system memory. And in the case of aarch64 it's not a core issue with the platform, but rather that some hw implements get it right and some get it wrong. I already had an in deep discussion with ARM folks about that and it seems that some hw implementations think they can combine the core IP with some cheap PCIe root complex and it just magically works. Regards, Christian. [1]: https://gitlab.freedesktop.org/drm/amd/-/issues/2313 When you have a limitation that ioremap_wc() can't guarantee read/write ordering then that's pretty clearly a platform bug and you would need to apply this workaround to all drivers using ioremap_wc() which isn't really feasible. I agree in this case perhaps all of ioremap_wc() usages would have to degrade into ioremap() for correctness on such platforms. In which case amdgpu wouldn't have to be individually called out / touched anyway. Whether this is easily doable/upstreamable is another question though...
[Bug 216625] [regression] GPU lockup on Radeon R7 Kaveri
https://bugzilla.kernel.org/show_bug.cgi?id=216625 --- Comment #9 from Pierre Ossman (pierre-bugzi...@ossman.eu) --- FYI, it seems to have gotten worse since upgrading from kernel-6.1.8-100.fc36.x86_64 to kernel-6.1.13-100.fc36.x86_64. It now hangs more arbitrarily, not just when trying to play a video. Having done a suspend/resume cycle is still a requirement though. I'm struggling building the old version of mesa that still worked. It isn't very compatible with newer LLVM, and there is something wrong with Fedora's packaging of LLVM 12 (that seems to be the matching LLVM version for that old mesa). I'll need some more effort to get that test up and running. -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
RE: [PATCH v15 00/16] drm: Add Samsung MIPI DSIM bridge
Hi Jagan, > -Original Message- > From: Jagan Teki > Sent: Friday, March 3, 2023 11:51 PM > To: Andrzej Hajda ; Inki Dae ; > Marek Szyprowski ; Neil Armstrong > ; Marek Vasut ; Maxime Ripard > > Cc: Seung-Woo Kim ; Kyungmin Park > ; Frieder Schrempf ; > Tim Harvey ; Adam Ford ; Matteo > Lisi ; dri-devel@lists.freedesktop.org; linux- > samsung-...@vger.kernel.org; linux-amarula amar...@amarulasolutions.com>; Jagan Teki > Subject: [PATCH v15 00/16] drm: Add Samsung MIPI DSIM bridge > > This series supports common bridge support for Samsung MIPI DSIM > which is used in Exynos and i.MX8MM SoC's. > > The final bridge supports both the Exynos and i.MX8M Mini/Nano/Plus. > > Inki Dae: please note that this series added on top of exynos-drm-next > since few exynos dsi changes are not been part of drm-misc-next. > Request you to pick these via exynos-drm-next, or let me know if you > have any comments? Seems some issue Marek found on testing. If fixed then I will try to pick this patch series up. To Andrzej, Neil, Robert and Laurent. Could you give me any comment to below patch, [drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge] : https://www.spinics.net/lists/dri-devel/msg385731.html If you could kindly provide me with an Acked-by or Signed-off-by after review, it would greatly assist me in picking up this patch series for upstream. Thanks, Inki Dae > > Patch 0001 - 0002: find child DSI bridge and panel > > Patch 0003 - 0004: optional PHY, PMS_P offset > > Patch 0005 : introduce hw_type > > Patch 0006 : fixing host init > > Patch 0007 : atomic_check > > Patch 0008 : input_bus_flags > > Patch 0009 : atomic_get_input_bus_fmts > > Patch 0010 - 0011: component vs bridge > > Patch 0012 : DSIM bridge > > Patch 0013 - 0014: i.MX8M Mini/Nano > > Patch 0015 - 0016: i.MX8M Plus > > Changes for v15: > - drop drm_of helpers > - re-added find DSI bridge/Panel helper in dsim > - collect RB from Marek V > - fixed leading underscore in function names > - commit messages updated > - rebased on exynos-drm-next > > Changes for v13: > - remove devm call for DSI panel or bridge finding > - rebased on drm-misc-next > > Changes for v12: > - collect RB from Marek V > - add te_irq_handler hook > - fix comments from Marek V > - update atomic_get_input_bus_fmts logic > > Changes for v11: > - collect RB from Frieder Schrempf > - collect ACK from Rob > - collect ACK from Robert > - fix BIT macro replacements > - fix checkpatch --strict warnings > - fix unneeded commit text > - drop extra lines > > Changes for v10: > - rebase on drm-misc-next > - add drm_of_dsi_find_panel_or_bridge > - add devm_drm_of_dsi_get_bridge > - fix host initialization (Thanks to Marek Szyprowski) > - rearrange the tiny patches for easy to review > - update simple names for enum hw_type > - add is_hw_exynos macro > - rework on commit messages > > Changes for v9: > - rebase on drm-misc-next > - drop drm bridge attach fix for Exynos > - added prepare_prev_first flag > - added pre_enable_prev_first flag > - fix bridge chain order for exynos > - added fix for Exynos host init for first DSI transfer > - added MEDIA_BUS_FMT_FIXED > - return MEDIA_BUS_FMT_RGB888_1X24 output_fmt if supported output_fmt > list is unsupported. > - added MEDIA_BUS_FMT_YUYV10_1X20 > - added MEDIA_BUS_FMT_YUYV12_1X24 > > Changes for v8: > * fixed comment lines > * fixed commit messages > * fixed video mode bits > * collect Marek Ack > * fixed video mode bit names > * update input formats logic > * added imx8mplus support > > Changes for v7: > * fix the drm bridge attach chain for exynos drm dsi driver > * fix the hw_type checking logic > > Changes for v6: > * handle previous bridge for exynos dsi while attaching bridge > > Changes for v5: > * bridge changes to support multi-arch > * updated and clear commit messages > * add hw_type via plat data > * removed unneeded quirk > * rebased on linux-next > > Changes for v4: > * include Inki Dae in MAINTAINERS > * remove dsi_driver probe in exynos_drm_drv to support multi-arch build > * update init handling to ensure host init done on first cmd transfer > > Changes for v3: > * fix the mult-arch build > * fix dsi host init > * updated commit messages > > Changes for v2: > * fix bridge handling > * fix dsi host init > * correct the commit messages > > Tested in Engicam i.Core MX8M Mini SoM. > > Repo: > https://protect2.fireeye.com/v1/url?k=ba7a5cbf-dbf1498c-ba7bd7f0-000babff9bb7- > 64eb01b9825d1cad&q=1&e=55e2423e-1b57-4c22-a4a8- > 3dfcebdd3d9d&u=https%3A%2F%2Fgithub.com%2Fopenedev%2Fkernel%2Ftree%2Fimx8mm- > dsi-v15 > > v13: > https://lore.kernel.org/all/20230227113925.875425-1- > ja...@amarulasolutions.com/ > > Any inputs? > Jagan. > > Jagan Teki (14): > drm: exynos: dsi: Drop explicit call to bridge detach > drm: exynos: dsi: Lookup OF-graph or Child node devices > drm: exynos: dsi: Mark PHY as optional > drm: exynos: dsi: Add platform PLL_P (PMS_P) off
Re: [PATCH] drm/amdgpu: Use uncached ioremap() for LoongArch
Hi, Christian, On Mon, Mar 6, 2023 at 12:40 AM Christian König wrote: > > Am 05.03.23 um 06:21 schrieb Huacai Chen: > > LoongArch maintains cache coherency in hardware, but its WUC attribute > > (Weak-ordered UnCached, which is similar to WC) is out of the scope of > > cache coherency machanism. This means WUC can only used for write-only > > memory regions. So use uncached ioremap() for LoongArch in the amdgpu > > driver. > > Well NAK. This is leaking platform dependencies into the driver code. Then is it acceptable to let ioremap() depend on drm_arch_can_wc_memory()? Huacai > > When you have a limitation that ioremap_wc() can't guarantee read/write > ordering then that's pretty clearly a platform bug and you would need to > apply this workaround to all drivers using ioremap_wc() which isn't > really feasible. > > The x86 cache dependencies is because the GPU can also be part of the > CPU in which case PCIe is not used to access the aperture base. > > Regards, > Christian. > > > > > Signed-off-by: Huacai Chen > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > > index c5ef7f7bdc15..c6888a58819a 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > > @@ -1750,8 +1750,13 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) > > > > else > > #endif > > +#ifdef CONFIG_LOONGARCH > > + adev->mman.aper_base_kaddr = ioremap(adev->gmc.aper_base, > > + adev->gmc.visible_vram_size); > > +#else > > adev->mman.aper_base_kaddr = ioremap_wc(adev->gmc.aper_base, > > adev->gmc.visible_vram_size); > > +#endif > > #endif > > > > /* >
[PATCH] drivers/gpu: fix typo in comment
Replace "isntance" with "instance". Signed-off-by: Husain Alshehhi --- .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h| 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h index 007d6bdc3e39..734b34902fa7 100644 --- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h @@ -1971,7 +1971,7 @@ struct dmub_cmd_psr_copy_settings_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2029,7 +2029,7 @@ struct dmub_cmd_psr_set_level_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2056,7 +2056,7 @@ struct dmub_rb_cmd_psr_enable_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2100,7 +2100,7 @@ struct dmub_cmd_psr_set_version_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2131,7 +2131,7 @@ struct dmub_cmd_psr_force_static_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2206,7 +2206,7 @@ struct dmub_cmd_update_dirty_rect_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2344,7 +2344,7 @@ struct dmub_cmd_update_cursor_payload0 { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2391,7 +2391,7 @@ struct dmub_cmd_psr_set_vtotal_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; @@ -2429,7 +2429,7 @@ struct dmub_cmd_psr_set_power_opt_data { uint8_t cmd_version; /** * Panel Instance. -* Panel isntance to identify which psr_state to use +* Panel instance to identify which psr_state to use * Currently the support is only for 0 or 1 */ uint8_t panel_inst; -- 2.39.2
Re: IMX8MM: assign panel to mipi_dsi in a device tree
On Mon, 6 Mar 2023 00:05:03 +0530 Jagan Teki wrote: >On Sun, Mar 5, 2023 at 11:39 PM Patrick Boettcher > wrote: >> >> Hi list, >> >> After several days of trying I realize my too small/old brain is >> unable to map around how to assign/connect a panel to the >> mipi_dsi-node in a device. >> >> We are using a 'tdo,tl070wsh30' panel connected to the >> mipi-dsi-interface of a imx8mm. >> >> Of all the references I found on the in public repositories none of >> them is using this exact panel. Well. >> >> Looking at other device trees I came up with the following dts-node >> add to the mipi_dsi-node: >> >> &mipi_dsi { >> #address-cells = <1>; >> #size-cells = <0>; >> status = "okay"; >> >> port@0 { >> reg = <0>; >> mipi_dsi_panel0_out: endpoint { >> remote-endpoint = <&panel0_in>; >> attach-bridge; >> }; >> }; >> >> panel@0 { >> compatible = "tdo,tl070wsh30"; >> reg = <0>; >> >> pinctrl-0 = <&pinctrl_mipi_dsi>; >> pinctrl-names = "default"; >> reset-gpios = <&gpio4 4 GPIO_ACTIVE_LOW>; >> enable-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; >> >> backlight = <&panel_gpio_backlight>; >> power-supply = <&panel_gpio_regulator>; >> >> dsi-lanes = <4>; >> >> video-mode = <0>; >> >> panel-width-mm = <157>; >> panel-height-mm = <86>; >> >> status = "okay"; >> >> port { >> panel0_in: endpoint { >> remote-endpoint >> =<&mipi_dsi_panel0_out>; }; >> }; >> }; >> }; >> >> >> You'll see that I used the attach-bridge-option, which is maybe not >> necessary. I found this during a debug-print-session in the >> drm-bridge-driver, it wasn't attaching a bridge. But maybe I don't >> need a bridge as the panel-driver contains everything to control the >> controllers of the panel. I don't really know. >> >> However, with this I have the following messages: >> >> [0.393985] [drm:drm_bridge_attach] *ERROR* failed to attach >> bridge /soc@0/bus@32c0/mipi_dsi@32e1 to encoder DSI-34: -19 >> [0.405626] imx_sec_dsim_drv 32e1.mipi_dsi: Failed to attach >> bridge: 32e1.mipi_dsi [0.413974] imx_sec_dsim_drv >> 32e1.mipi_dsi: failed to bind sec dsim bridge: -517 >> >> The panel driver is never instantiated. >> >> I'm using 5.15.51 (-imx). mipi_dsi and the panel-driver are built >> into the kernel. > >Please share the source repo link? I'm using this one (via yocto's recipe): github.com/nxp-imx/linux-imx.git, branch lf-5.15.y > B/W if you may try the mainline >code base of imx8mm dsi please check here. >https://github.com/openedev/kernel/commits/imx8mm-dsi-v16 Do you really think this is a kernel version problem not only an integration issue? I mean NXP's version is coming with device-tree's using panels, and, although I can't test, I believe they are working, aren't they? -- Patrick.
[PATCH v12 11/11] drm/panfrost: Switch to generic memory shrinker
Replace Panfrost's custom memory shrinker with a common drm-shmem memory shrinker. Tested-by: Steven Price # Firefly-RK3288 Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h| 4 - drivers/gpu/drm/panfrost/panfrost_drv.c | 27 ++-- drivers/gpu/drm/panfrost/panfrost_gem.c | 30 ++-- drivers/gpu/drm/panfrost/panfrost_gem.h | 9 -- .../gpu/drm/panfrost/panfrost_gem_shrinker.c | 129 -- drivers/gpu/drm/panfrost/panfrost_job.c | 18 ++- include/drm/drm_gem_shmem_helper.h| 7 - 8 files changed, 47 insertions(+), 178 deletions(-) delete mode 100644 drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c diff --git a/drivers/gpu/drm/panfrost/Makefile b/drivers/gpu/drm/panfrost/Makefile index 7da2b3f02ed9..11622e22cf15 100644 --- a/drivers/gpu/drm/panfrost/Makefile +++ b/drivers/gpu/drm/panfrost/Makefile @@ -5,7 +5,6 @@ panfrost-y := \ panfrost_device.o \ panfrost_devfreq.o \ panfrost_gem.o \ - panfrost_gem_shrinker.o \ panfrost_gpu.o \ panfrost_job.o \ panfrost_mmu.o \ diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index d9ba68cffb77..28f28bbdbda9 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -116,10 +116,6 @@ struct panfrost_device { atomic_t pending; } reset; - struct mutex shrinker_lock; - struct list_head shrinker_list; - struct shrinker shrinker; - struct panfrost_devfreq pfdevfreq; }; diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index aa292e4a86eb..e29a2e604257 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -169,7 +169,6 @@ panfrost_lookup_bos(struct drm_device *dev, break; } - atomic_inc(&bo->gpu_usecount); job->mappings[i] = mapping; } @@ -394,7 +393,6 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, { struct panfrost_file_priv *priv = file_priv->driver_priv; struct drm_panfrost_madvise *args = data; - struct panfrost_device *pfdev = dev->dev_private; struct drm_gem_object *gem_obj; struct panfrost_gem_object *bo; int ret = 0; @@ -407,11 +405,15 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, bo = to_panfrost_bo(gem_obj); + if (bo->is_heap) { + args->retained = 1; + goto out_put_object; + } + ret = dma_resv_lock_interruptible(bo->base.base.resv, NULL); if (ret) goto out_put_object; - mutex_lock(&pfdev->shrinker_lock); mutex_lock(&bo->mappings.lock); if (args->madv == PANFROST_MADV_DONTNEED) { struct panfrost_gem_mapping *first; @@ -437,17 +439,8 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, args->retained = drm_gem_shmem_madvise(&bo->base, args->madv); - if (args->retained) { - if (args->madv == PANFROST_MADV_DONTNEED) - list_move_tail(&bo->base.madv_list, - &pfdev->shrinker_list); - else if (args->madv == PANFROST_MADV_WILLNEED) - list_del_init(&bo->base.madv_list); - } - out_unlock_mappings: mutex_unlock(&bo->mappings.lock); - mutex_unlock(&pfdev->shrinker_lock); dma_resv_unlock(bo->base.base.resv); out_put_object: drm_gem_object_put(gem_obj); @@ -579,9 +572,6 @@ static int panfrost_probe(struct platform_device *pdev) ddev->dev_private = pfdev; pfdev->ddev = ddev; - mutex_init(&pfdev->shrinker_lock); - INIT_LIST_HEAD(&pfdev->shrinker_list); - err = panfrost_device_init(pfdev); if (err) { if (err != -EPROBE_DEFER) @@ -603,10 +593,14 @@ static int panfrost_probe(struct platform_device *pdev) if (err < 0) goto err_out1; - panfrost_gem_shrinker_init(ddev); + err = drmm_gem_shmem_init(ddev); + if (err < 0) + goto err_out2; return 0; +err_out2: + drm_dev_unregister(ddev); err_out1: pm_runtime_disable(pfdev->dev); panfrost_device_fini(pfdev); @@ -622,7 +616,6 @@ static int panfrost_remove(struct platform_device *pdev) struct drm_device *ddev = pfdev->ddev; drm_dev_unregister(ddev); - panfrost_gem_shrinker_cleanup(ddev); pm_runtime_get_sync(pfdev->dev); pm_runtime_disable(pfdev->dev); diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c index 3c812fbd126f..08d795c28b4e 100644 --- a/drivers/gp
[PATCH v12 10/11] drm/virtio: Support memory shrinking
Support generic drm-shmem memory shrinker and add new madvise IOCTL to the VirtIO-GPU driver. BO cache manager of Mesa driver will mark BOs as "don't need" using the new IOCTL to let shrinker purge the marked BOs on OOM, the shrinker will also evict unpurgeable shmem BOs from memory if guest supports SWAP file or partition. Acked-by: Gerd Hoffmann Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.h| 18 +++- drivers/gpu/drm/virtio/virtgpu_gem.c| 52 + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 37 +++ drivers/gpu/drm/virtio/virtgpu_kms.c| 8 ++ drivers/gpu/drm/virtio/virtgpu_object.c | 137 +++- drivers/gpu/drm/virtio/virtgpu_plane.c | 22 +++- drivers/gpu/drm/virtio/virtgpu_vq.c | 40 +++ include/uapi/drm/virtgpu_drm.h | 14 +++ 8 files changed, 297 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index af6ffb696086..07eb8d3e5cfd 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -89,6 +89,7 @@ struct virtio_gpu_object { uint32_t hw_res_handle; bool dumb; bool created; + bool detached; bool host3d_blob, guest_blob; uint32_t blob_mem, blob_flags; @@ -277,7 +278,7 @@ struct virtio_gpu_fpriv { }; /* virtgpu_ioctl.c */ -#define DRM_VIRTIO_NUM_IOCTLS 12 +#define DRM_VIRTIO_NUM_IOCTLS 13 extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS]; void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file); @@ -313,6 +314,10 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs); void virtio_gpu_array_put_free_delayed(struct virtio_gpu_device *vgdev, struct virtio_gpu_object_array *objs); void virtio_gpu_array_put_free_work(struct work_struct *work); +int virtio_gpu_array_prepare(struct virtio_gpu_device *vgdev, +struct virtio_gpu_object_array *objs); +int virtio_gpu_gem_host_mem_release(struct virtio_gpu_object *bo); +int virtio_gpu_gem_madvise(struct virtio_gpu_object *obj, int madv); /* virtgpu_vq.c */ int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev); @@ -324,6 +329,8 @@ void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev, struct virtio_gpu_fence *fence); void virtio_gpu_cmd_unref_resource(struct virtio_gpu_device *vgdev, struct virtio_gpu_object *bo); +int virtio_gpu_cmd_release_resource(struct virtio_gpu_device *vgdev, + struct virtio_gpu_object *bo); void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev, uint64_t offset, uint32_t width, uint32_t height, @@ -344,6 +351,9 @@ void virtio_gpu_object_attach(struct virtio_gpu_device *vgdev, struct virtio_gpu_object *obj, struct virtio_gpu_mem_entry *ents, unsigned int nents); +void virtio_gpu_object_detach(struct virtio_gpu_device *vgdev, + struct virtio_gpu_object *obj, + struct virtio_gpu_fence *fence); int virtio_gpu_attach_status_page(struct virtio_gpu_device *vgdev); int virtio_gpu_detach_status_page(struct virtio_gpu_device *vgdev); void virtio_gpu_cursor_ping(struct virtio_gpu_device *vgdev, @@ -456,6 +466,8 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, bool virtio_gpu_is_shmem(struct virtio_gpu_object *bo); +int virtio_gpu_reattach_shmem_object(struct virtio_gpu_object *bo); + int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev, uint32_t *resid); /* virtgpu_prime.c */ @@ -486,4 +498,8 @@ void virtio_gpu_vram_unmap_dma_buf(struct device *dev, struct sg_table *sgt, enum dma_data_direction dir); +/* virtgpu_gem_shrinker.c */ +int virtio_gpu_gem_shrinker_init(struct virtio_gpu_device *vgdev); +void virtio_gpu_gem_shrinker_fini(struct virtio_gpu_device *vgdev); + #endif diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c index 7db48d17ee3a..8f65911b1e99 100644 --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c @@ -294,3 +294,55 @@ void virtio_gpu_array_put_free_work(struct work_struct *work) } spin_unlock(&vgdev->obj_free_lock); } + +int virtio_gpu_array_prepare(struct virtio_gpu_device *vgdev, +struct virtio_gpu_object_array *objs) +{ + struct virtio_gpu_object *bo; + int ret = 0; + u32 i; + + for (i = 0; i < objs->nents; i++) { + bo = gem_to_virtio_gpu_obj(objs->objs[i]); + +
[PATCH v12 09/11] drm/gem: Export drm_gem_pin/unpin()
Export drm_gem_un/pin() functions. They will be used by VirtIO-GPU driver for pinning of an active framebuffer, preventing it from swapping out by memory shrinker. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 2 ++ drivers/gpu/drm/drm_internal.h | 2 -- include/drm/drm_gem.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 3da34b121c93..6492c47b7142 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1153,12 +1153,14 @@ int drm_gem_pin(struct drm_gem_object *obj) else return 0; } +EXPORT_SYMBOL(drm_gem_pin); void drm_gem_unpin(struct drm_gem_object *obj) { if (obj->funcs->unpin) obj->funcs->unpin(obj); } +EXPORT_SYMBOL(drm_gem_unpin); int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map) { diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index d7e023bbb0d5..55d0ee7475f7 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -173,8 +173,6 @@ void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); void drm_gem_print_info(struct drm_printer *p, unsigned int indent, const struct drm_gem_object *obj); -int drm_gem_pin(struct drm_gem_object *obj); -void drm_gem_unpin(struct drm_gem_object *obj); int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map); void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map); diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 7bd8e236..f7703cb66569 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -493,4 +493,7 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru, int drm_gem_evict(struct drm_gem_object *obj); +int drm_gem_pin(struct drm_gem_object *obj); +void drm_gem_unpin(struct drm_gem_object *obj); + #endif /* __DRM_GEM_H__ */ -- 2.39.2
[PATCH v12 08/11] drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked()
Export drm_gem_shmem_get_pages_sgt_locked() that will be used by virtio-gpu shrinker during GEM swap-in operation done under the held reservation lock. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++- include/drm/drm_gem_shmem_helper.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index b814352aae33..b79e74c72b65 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -849,7 +849,7 @@ struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *shmem) } EXPORT_SYMBOL_GPL(drm_gem_shmem_get_sg_table); -static struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_object *shmem) +struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_object *shmem) { struct drm_gem_object *obj = &shmem->base; int ret; @@ -887,6 +887,7 @@ static struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_ drm_gem_shmem_put_pages(shmem); return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(drm_gem_shmem_get_pages_sgt_locked); /** * drm_gem_shmem_get_pages_sgt - Pin pages, dma map them, and return a diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h index e99f1715514b..61aaacc6cb99 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -144,6 +144,7 @@ void drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem); struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *shmem); struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *shmem); +struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_object *shmem); void drm_gem_shmem_print_info(const struct drm_gem_shmem_object *shmem, struct drm_printer *p, unsigned int indent); -- 2.39.2
[PATCH v12 07/11] drm/shmem-helper: Remove obsoleted is_iomem test
Everything that uses the mapped buffer should by agnostic to is_iomem. The only reason for the is_iomem test is is that we're setting shmem->vaddr to the returned map->vaddr. Now that the shmem->vaddr code is gone, remove the obsoleted is_iomem test to clean up the code. Suggested-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index e47cc45f39a1..b814352aae33 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -432,12 +432,6 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, if (obj->import_attach) { ret = dma_buf_vmap(obj->import_attach->dmabuf, map); - if (!ret) { - if (drm_WARN_ON(obj->dev, map->is_iomem)) { - dma_buf_vunmap(obj->import_attach->dmabuf, map); - return -EIO; - } - } } else { pgprot_t prot = PAGE_KERNEL; -- 2.39.2
[PATCH v12 06/11] drm/shmem-helper: Add memory shrinker
Introduce common drm-shmem shrinker for DRM drivers. To start using drm-shmem shrinker drivers should do the following: 1. Implement evict() callback of GEM object where driver should check whether object is purgeable or evictable using drm-shmem helpers and perform the shrinking action 2. Initialize drm-shmem internals using drmm_gem_shmem_init(drm_device), which will register drm-shmem shrinker 3. Implement madvise IOCTL that will use drm_gem_shmem_madvise() Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 351 +- .../gpu/drm/panfrost/panfrost_gem_shrinker.c | 9 +- include/drm/drm_device.h | 10 +- include/drm/drm_gem_shmem_helper.h| 52 ++- 4 files changed, 402 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 474918383b3e..e47cc45f39a1 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -88,8 +89,6 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private) if (ret) goto err_release; - INIT_LIST_HEAD(&shmem->madv_list); - if (!private) { /* * Our buffers are kept pinned, so allocating them @@ -128,6 +127,57 @@ struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, size_t } EXPORT_SYMBOL_GPL(drm_gem_shmem_create); +static void drm_gem_shmem_resv_assert_held(struct drm_gem_shmem_object *shmem) +{ + /* +* Destroying the object is a special case.. drm_gem_shmem_free() +* calls many things that WARN_ON if the obj lock is not held. But +* acquiring the obj lock in drm_gem_shmem_free() can cause a locking +* order inversion between reservation_ww_class_mutex and fs_reclaim. +* +* This deadlock is not actually possible, because no one should +* be already holding the lock when drm_gem_shmem_free() is called. +* Unfortunately lockdep is not aware of this detail. So when the +* refcount drops to zero, we pretend it is already locked. +*/ + if (kref_read(&shmem->base.refcount)) + dma_resv_assert_held(shmem->base.resv); +} + +static bool drm_gem_shmem_is_evictable(struct drm_gem_shmem_object *shmem) +{ + dma_resv_assert_held(shmem->base.resv); + + return (shmem->madv >= 0) && shmem->base.funcs->evict && + shmem->pages_use_count && !shmem->pages_pin_count && + !shmem->base.dma_buf && !shmem->base.import_attach && + shmem->sgt && !shmem->evicted; +} + +static void +drm_gem_shmem_update_pages_state(struct drm_gem_shmem_object *shmem) +{ + struct drm_gem_object *obj = &shmem->base; + struct drm_gem_shmem *shmem_mm = obj->dev->shmem_mm; + struct drm_gem_shmem_shrinker *shmem_shrinker = &shmem_mm->shrinker; + + drm_gem_shmem_resv_assert_held(shmem); + + if (!shmem_shrinker || obj->import_attach) + return; + + if (shmem->madv < 0) + drm_gem_lru_remove(&shmem->base); + else if (drm_gem_shmem_is_evictable(shmem) || drm_gem_shmem_is_purgeable(shmem)) + drm_gem_lru_move_tail(&shmem_shrinker->lru_evictable, &shmem->base); + else if (shmem->evicted) + drm_gem_lru_move_tail(&shmem_shrinker->lru_evicted, &shmem->base); + else if (!shmem->pages) + drm_gem_lru_remove(&shmem->base); + else + drm_gem_lru_move_tail(&shmem_shrinker->lru_pinned, &shmem->base); +} + /** * drm_gem_shmem_free - Free resources associated with a shmem GEM object * @shmem: shmem GEM object to free @@ -142,7 +192,8 @@ void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem) if (obj->import_attach) { drm_prime_gem_destroy(obj, shmem->sgt); } else { - dma_resv_lock(shmem->base.resv, NULL); + /* take out shmem GEM object from the memory shrinker */ + drm_gem_shmem_madvise(shmem, -1); drm_WARN_ON(obj->dev, shmem->vmap_use_count); @@ -152,12 +203,10 @@ void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem) sg_free_table(shmem->sgt); kfree(shmem->sgt); } - if (shmem->pages) + if (shmem->pages_use_count) drm_gem_shmem_put_pages(shmem); drm_WARN_ON(obj->dev, shmem->pages_use_count); - - dma_resv_unlock(shmem->base.resv); } drm_gem_object_release(obj); @@ -178,6 +227,11 @@ drm_gem_shmem_acquire_pages(struct drm_gem_shmem_object *shmem) return -ENOMEM; } + if (shmem->pages) { + drm_WARN_ON(ob
[PATCH v12 03/11] drm/shmem-helper: Add pages_pin_count field
And new pages_pin_count field to struct drm_gem_shmem_object that will determine whether pages are evictable by memory shrinker. The pages will be evictable only when pages_pin_count=0. This patch prepares code for addition of the memory shrinker that will utilize the new field. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 +++ include/drm/drm_gem_shmem_helper.h | 9 + 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index a62c41336a7f..0c3abb0c2ea2 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -277,6 +277,8 @@ static int drm_gem_shmem_pin_locked(struct drm_gem_shmem_object *shmem) drm_WARN_ON(obj->dev, obj->import_attach); ret = drm_gem_shmem_get_pages(shmem); + if (!ret) + shmem->pages_pin_count++; return ret; } @@ -289,7 +291,12 @@ static void drm_gem_shmem_unpin_locked(struct drm_gem_shmem_object *shmem) drm_WARN_ON(obj->dev, obj->import_attach); + if (drm_WARN_ON_ONCE(obj->dev, !shmem->pages_pin_count)) + return; + drm_gem_shmem_put_pages(shmem); + + shmem->pages_pin_count--; } /** diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h index 20ddcd799df9..7d823c9fc480 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -39,6 +39,15 @@ struct drm_gem_shmem_object { */ unsigned int pages_use_count; + /** +* @pages_pin_count: +* +* Reference count on the pinned pages table. +* The pages allowed to be evicted by memory shrinker +* only when the count is zero. +*/ + unsigned int pages_pin_count; + /** * @madv: State for madvise * -- 2.39.2
[PATCH v12 02/11] drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages()
Factor out pages allocation from drm_gem_shmem_get_pages() into drm_gem_shmem_acquire_pages() function and similar for the put_pages() in a preparation for addition of shrinker support to drm-shmem. Once shrinker will be added, the pages_use_count>0 will no longer determine whether pages are pinned because pages could be swapped out by the shrinker and then pages_use_count will be greater than 0 in this case. We will add new pages_pin_count in a later patch. The new common drm_gem_shmem_acquire/release_pages() will be used by shrinker code for performing the page swapping. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 67 +- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 651ca7f380a2..a62c41336a7f 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -165,19 +165,26 @@ void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem) } EXPORT_SYMBOL_GPL(drm_gem_shmem_free); -static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) +static int +drm_gem_shmem_acquire_pages(struct drm_gem_shmem_object *shmem) { struct drm_gem_object *obj = &shmem->base; struct page **pages; - if (shmem->pages_use_count++ > 0) - return 0; + dma_resv_assert_held(shmem->base.resv); + + if (shmem->madv < 0) { + drm_WARN_ON(obj->dev, shmem->pages); + return -ENOMEM; + } + + if (drm_WARN_ON(obj->dev, !shmem->pages_use_count)) + return -EINVAL; pages = drm_gem_get_pages(obj); if (IS_ERR(pages)) { drm_dbg_kms(obj->dev, "Failed to get pages (%ld)\n", PTR_ERR(pages)); - shmem->pages_use_count = 0; return PTR_ERR(pages); } @@ -196,6 +203,48 @@ static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) return 0; } +static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) +{ + int err; + + dma_resv_assert_held(shmem->base.resv); + + if (shmem->madv < 0) + return -ENOMEM; + + if (shmem->pages_use_count++ > 0) + return 0; + + err = drm_gem_shmem_acquire_pages(shmem); + if (err) + goto err_zero_use; + + return 0; + +err_zero_use: + shmem->pages_use_count = 0; + + return err; +} + +static void +drm_gem_shmem_release_pages(struct drm_gem_shmem_object *shmem) +{ + struct drm_gem_object *obj = &shmem->base; + + dma_resv_assert_held(shmem->base.resv); + +#ifdef CONFIG_X86 + if (shmem->map_wc) + set_pages_array_wb(shmem->pages, obj->size >> PAGE_SHIFT); +#endif + + drm_gem_put_pages(obj, shmem->pages, + shmem->pages_mark_dirty_on_put, + shmem->pages_mark_accessed_on_put); + shmem->pages = NULL; +} + /* * drm_gem_shmem_put_pages - Decrease use count on the backing pages for a shmem GEM object * @shmem: shmem GEM object @@ -214,15 +263,7 @@ void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem) if (--shmem->pages_use_count > 0) return; -#ifdef CONFIG_X86 - if (shmem->map_wc) - set_pages_array_wb(shmem->pages, obj->size >> PAGE_SHIFT); -#endif - - drm_gem_put_pages(obj, shmem->pages, - shmem->pages_mark_dirty_on_put, - shmem->pages_mark_accessed_on_put); - shmem->pages = NULL; + drm_gem_shmem_release_pages(shmem); } EXPORT_SYMBOL(drm_gem_shmem_put_pages); -- 2.39.2
[PATCH v12 05/11] drm/shmem-helper: Factor out unpinning part from drm_gem_shmem_purge()
Factor out pages unpinning code from drm_gem_shmem_purge() into new drm_gem_shmem_unpin_pages(). This prepares code for addition of memory shrinker support. The new common function will be used by shrinker for eviction of shmem pages. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index e2324e857847..474918383b3e 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -486,25 +486,29 @@ int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv) } EXPORT_SYMBOL(drm_gem_shmem_madvise); -void drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem) +static void drm_gem_shmem_unpin_pages(struct drm_gem_shmem_object *shmem) { struct drm_gem_object *obj = &shmem->base; struct drm_device *dev = obj->dev; dma_resv_assert_held(shmem->base.resv); - drm_WARN_ON(obj->dev, !drm_gem_shmem_is_purgeable(shmem)); - dma_unmap_sgtable(dev->dev, shmem->sgt, DMA_BIDIRECTIONAL, 0); + drm_gem_shmem_release_pages(shmem); + drm_vma_node_unmap(&obj->vma_node, dev->anon_inode->i_mapping); + sg_free_table(shmem->sgt); kfree(shmem->sgt); shmem->sgt = NULL; +} - drm_gem_shmem_put_pages(shmem); +void drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem) +{ + struct drm_gem_object *obj = &shmem->base; - shmem->madv = -1; + drm_WARN_ON(obj->dev, !drm_gem_shmem_is_purgeable(shmem)); - drm_vma_node_unmap(&obj->vma_node, dev->anon_inode->i_mapping); + drm_gem_shmem_unpin_pages(shmem); drm_gem_free_mmap_offset(obj); /* Our goal here is to return as much of the memory as @@ -515,6 +519,8 @@ void drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem) shmem_truncate_range(file_inode(obj->filp), 0, (loff_t)-1); invalidate_mapping_pages(file_inode(obj->filp)->i_mapping, 0, (loff_t)-1); + + shmem->madv = -1; } EXPORT_SYMBOL(drm_gem_shmem_purge); -- 2.39.2
[PATCH v12 04/11] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin
The vmapped pages shall be pinned in memory. Previously get/put pages were implicitly pinning/unpinning the pages. This will no longer be the case with addition of memory shrinker because pages_use_count>0 won't determine whether pages are pinned anymore, while the new pages_pin_count will do that. Switch the vmap/vunmap to use pin/unpin functions in a preparation of addition of the memory shrinker support. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 0c3abb0c2ea2..e2324e857847 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -380,7 +380,7 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, return 0; } - ret = drm_gem_shmem_get_pages(shmem); + ret = drm_gem_shmem_pin_locked(shmem); if (ret) goto err_zero_use; @@ -403,7 +403,7 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, err_put_pages: if (!obj->import_attach) - drm_gem_shmem_put_pages(shmem); + drm_gem_shmem_unpin_locked(shmem); err_zero_use: shmem->vmap_use_count = 0; @@ -440,7 +440,7 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, return; vunmap(shmem->vaddr); - drm_gem_shmem_put_pages(shmem); + drm_gem_shmem_unpin_locked(shmem); } shmem->vaddr = NULL; -- 2.39.2
[PATCH v12 01/11] drm/shmem-helper: Switch to reservation lock
Replace all drm-shmem locks with a GEM reservation lock. This makes locks consistent with dma-buf locking convention where importers are responsible for holding reservation lock for all operations performed over dma-bufs, preventing deadlock between dma-buf importers and exporters. Suggested-by: Daniel Vetter Acked-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 217 -- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +- .../gpu/drm/panfrost/panfrost_gem_shrinker.c | 6 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 19 +- include/drm/drm_gem_shmem_helper.h| 14 +- 6 files changed, 120 insertions(+), 151 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 5762806e4689..651ca7f380a2 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -88,8 +88,6 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private) if (ret) goto err_release; - mutex_init(&shmem->pages_lock); - mutex_init(&shmem->vmap_lock); INIT_LIST_HEAD(&shmem->madv_list); if (!private) { @@ -141,11 +139,13 @@ void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem) { struct drm_gem_object *obj = &shmem->base; - drm_WARN_ON(obj->dev, shmem->vmap_use_count); - if (obj->import_attach) { drm_prime_gem_destroy(obj, shmem->sgt); } else { + dma_resv_lock(shmem->base.resv, NULL); + + drm_WARN_ON(obj->dev, shmem->vmap_use_count); + if (shmem->sgt) { dma_unmap_sgtable(obj->dev->dev, shmem->sgt, DMA_BIDIRECTIONAL, 0); @@ -154,18 +154,18 @@ void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem) } if (shmem->pages) drm_gem_shmem_put_pages(shmem); - } - drm_WARN_ON(obj->dev, shmem->pages_use_count); + drm_WARN_ON(obj->dev, shmem->pages_use_count); + + dma_resv_unlock(shmem->base.resv); + } drm_gem_object_release(obj); - mutex_destroy(&shmem->pages_lock); - mutex_destroy(&shmem->vmap_lock); kfree(shmem); } EXPORT_SYMBOL_GPL(drm_gem_shmem_free); -static int drm_gem_shmem_get_pages_locked(struct drm_gem_shmem_object *shmem) +static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) { struct drm_gem_object *obj = &shmem->base; struct page **pages; @@ -197,35 +197,16 @@ static int drm_gem_shmem_get_pages_locked(struct drm_gem_shmem_object *shmem) } /* - * drm_gem_shmem_get_pages - Allocate backing pages for a shmem GEM object + * drm_gem_shmem_put_pages - Decrease use count on the backing pages for a shmem GEM object * @shmem: shmem GEM object * - * This function makes sure that backing pages exists for the shmem GEM object - * and increases the use count. - * - * Returns: - * 0 on success or a negative error code on failure. + * This function decreases the use count and puts the backing pages when use drops to zero. */ -int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) +void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem) { struct drm_gem_object *obj = &shmem->base; - int ret; - drm_WARN_ON(obj->dev, obj->import_attach); - - ret = mutex_lock_interruptible(&shmem->pages_lock); - if (ret) - return ret; - ret = drm_gem_shmem_get_pages_locked(shmem); - mutex_unlock(&shmem->pages_lock); - - return ret; -} -EXPORT_SYMBOL(drm_gem_shmem_get_pages); - -static void drm_gem_shmem_put_pages_locked(struct drm_gem_shmem_object *shmem) -{ - struct drm_gem_object *obj = &shmem->base; + dma_resv_assert_held(shmem->base.resv); if (drm_WARN_ON_ONCE(obj->dev, !shmem->pages_use_count)) return; @@ -243,20 +224,32 @@ static void drm_gem_shmem_put_pages_locked(struct drm_gem_shmem_object *shmem) shmem->pages_mark_accessed_on_put); shmem->pages = NULL; } +EXPORT_SYMBOL(drm_gem_shmem_put_pages); -/* - * drm_gem_shmem_put_pages - Decrease use count on the backing pages for a shmem GEM object - * @shmem: shmem GEM object - * - * This function decreases the use count and puts the backing pages when use drops to zero. - */ -void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem) +static int drm_gem_shmem_pin_locked(struct drm_gem_shmem_object *shmem) { - mutex_lock(&shmem->pages_lock); - drm_gem_shmem_put_pages_locked(shmem); - mutex_unlock(&shmem->pages_lock); + struct drm_gem_object *obj = &shmem->base; + int ret; + + dma_resv_assert_held(shmem->base.resv); + + drm_WARN_ON(obj->dev, obj->import_
[PATCH v12 00/11] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers
This series: 1. Adds common drm-shmem memory shrinker 2. Enables shrinker for VirtIO-GPU driver 3. Switches Panfrost driver to the common shrinker Changelog: v12:- Fixed the "no previous prototype for function" warning reported by kernel build bot for v11. - Fixed the missing reservation lock reported by Intel CI for VGEM driver. Other drivers using drm-shmem were affected similarly to VGEM. The problem was in the dma-buf attachment code path that led to drm-shmem pinning function which assumed the held reservation lock by drm_gem_pin(). In the past that code path was causing trouble for i915 driver and we've changed the locking scheme for the attachment code path in the dma-buf core to let exporters to handle the locking themselves. After a closer investigation, I realized that my assumption about testing of dma-buf export code path using Panfrost driver was incorrect. Now I created additional local test to exrecise the Panfrost export path. I also reproduced the issue reported by the Intel CI for v10. It's all fixed now by making the drm_gem_shmem_pin() to take the resv lock by itself. - Patches are based on top of drm-tip, CC'd intel-gfx CI for testing. v11:- Rebased on a recent linux-next. Added new patch as a result: drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked() It's needed by the virtio-gpu driver to swap-in/unevict shmem object, previously get_pages_sgt() didn't use locking. - Separated the "Add memory shrinker" patch into smaller parts to ease the reviewing, as was requested by Thomas Zimmermann: drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages() drm/shmem-helper: Add pages_pin_count field drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin drm/shmem-helper: Factor out unpinning part from drm_gem_shmem_purge() - Addessed the v10 review comments from Thomas Zimmermann: return errno instead of bool, sort code alphabetically, rename function and etc minor changes. - Added new patch to remove the "map->is_iomem" from drm-shmem, as was suggested by Thomas Zimmermann. - Added acks and r-b's that were given to v10. v10:- Was partially applied to misc-fixes/next. https://lore.kernel.org/dri-devel/6c16f303-81df-7ebe-85e9-51bb40a8b...@collabora.com/T/ Dmitry Osipenko (11): drm/shmem-helper: Switch to reservation lock drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages() drm/shmem-helper: Add pages_pin_count field drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin drm/shmem-helper: Factor out unpinning part from drm_gem_shmem_purge() drm/shmem-helper: Add memory shrinker drm/shmem-helper: Remove obsoleted is_iomem test drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked() drm/gem: Export drm_gem_pin/unpin() drm/virtio: Support memory shrinking drm/panfrost: Switch to generic memory shrinker drivers/gpu/drm/drm_gem.c | 2 + drivers/gpu/drm/drm_gem_shmem_helper.c| 613 ++ drivers/gpu/drm/drm_internal.h| 2 - drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h| 4 - drivers/gpu/drm/panfrost/panfrost_drv.c | 34 +- drivers/gpu/drm/panfrost/panfrost_gem.c | 30 +- drivers/gpu/drm/panfrost/panfrost_gem.h | 9 - .../gpu/drm/panfrost/panfrost_gem_shrinker.c | 122 drivers/gpu/drm/panfrost/panfrost_job.c | 18 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 19 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 18 +- drivers/gpu/drm/virtio/virtgpu_gem.c | 52 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c| 37 ++ drivers/gpu/drm/virtio/virtgpu_kms.c | 8 + drivers/gpu/drm/virtio/virtgpu_object.c | 137 +++- drivers/gpu/drm/virtio/virtgpu_plane.c| 22 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 40 ++ include/drm/drm_device.h | 10 +- include/drm/drm_gem.h | 3 + include/drm/drm_gem_shmem_helper.h| 83 ++- include/uapi/drm/virtgpu_drm.h| 14 + 23 files changed, 917 insertions(+), 369 deletions(-) delete mode 100644 drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c -- 2.39.2
[PATCH] media: stm32-dcmi: Enable incoherent buffer allocation
Set allow_cache_hints to 1 for the vb2_queue capture queue in the STM32MP15xx DCMI V4L2 driver. This allows us to allocate buffers with the V4L2_MEMORY_FLAG_NON_COHERENT set. On STM32MP15xx SoCs, this enables caching for this memory, which improves performance when being read from CPU. This change should be safe from race conditions since videobuf2 already invalidates or flushes the appropriate cache lines in its prepare() and finish() methods. Tested on a STM32MP157F SoC. Resulted in 4x buffer access speedup. Signed-off-by: Marek Vasut --- Cc: "Christian König" Cc: Alexandre Torgue Cc: Hugues Fruchet Cc: Mauro Carvalho Chehab Cc: Maxime Coquelin Cc: Philipp Zabel Cc: Sumit Semwal Cc: dri-devel@lists.freedesktop.org Cc: linaro-mm-...@lists.linaro.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-me...@vger.kernel.org Cc: linux-st...@st-md-mailman.stormreply.com --- drivers/media/platform/st/stm32/stm32-dcmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c b/drivers/media/platform/st/stm32/stm32-dcmi.c index ad8e9742e1ae7..2ac508da5ba36 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmi.c +++ b/drivers/media/platform/st/stm32/stm32-dcmi.c @@ -2084,6 +2084,7 @@ static int dcmi_probe(struct platform_device *pdev) q->mem_ops = &vb2_dma_contig_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->min_buffers_needed = 2; + q->allow_cache_hints = 1; q->dev = &pdev->dev; ret = vb2_queue_init(q); -- 2.39.2
Re: IMX8MM: assign panel to mipi_dsi in a device tree
On Sun, Mar 5, 2023 at 11:39 PM Patrick Boettcher wrote: > > Hi list, > > After several days of trying I realize my too small/old brain is unable > to map around how to assign/connect a panel to the mipi_dsi-node in a > device. > > We are using a 'tdo,tl070wsh30' panel connected to the > mipi-dsi-interface of a imx8mm. > > Of all the references I found on the in public repositories none of > them is using this exact panel. Well. > > Looking at other device trees I came up with the following dts-node add > to the mipi_dsi-node: > > &mipi_dsi { > #address-cells = <1>; > #size-cells = <0>; > status = "okay"; > > port@0 { > reg = <0>; > mipi_dsi_panel0_out: endpoint { > remote-endpoint = <&panel0_in>; > attach-bridge; > }; > }; > > panel@0 { > compatible = "tdo,tl070wsh30"; > reg = <0>; > > pinctrl-0 = <&pinctrl_mipi_dsi>; > pinctrl-names = "default"; > reset-gpios = <&gpio4 4 GPIO_ACTIVE_LOW>; > enable-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; > > backlight = <&panel_gpio_backlight>; > power-supply = <&panel_gpio_regulator>; > > dsi-lanes = <4>; > > video-mode = <0>; > > panel-width-mm = <157>; > panel-height-mm = <86>; > > status = "okay"; > > port { > panel0_in: endpoint { > remote-endpoint =<&mipi_dsi_panel0_out>; > }; > }; > }; > }; > > > You'll see that I used the attach-bridge-option, which is maybe not > necessary. I found this during a debug-print-session in the > drm-bridge-driver, it wasn't attaching a bridge. But maybe I don't need > a bridge as the panel-driver contains everything to control the > controllers of the panel. I don't really know. > > However, with this I have the following messages: > > [0.393985] [drm:drm_bridge_attach] *ERROR* failed to attach bridge > /soc@0/bus@32c0/mipi_dsi@32e1 to encoder DSI-34: -19 > [0.405626] imx_sec_dsim_drv 32e1.mipi_dsi: Failed to attach bridge: > 32e1.mipi_dsi > [0.413974] imx_sec_dsim_drv 32e1.mipi_dsi: failed to bind sec dsim > bridge: -517 > > The panel driver is never instantiated. > > I'm using 5.15.51 (-imx). mipi_dsi and the panel-driver are built into > the kernel. Please share the source repo link? B/W if you may try the mainline code base of imx8mm dsi please check here. https://github.com/openedev/kernel/commits/imx8mm-dsi-v16 Jagan.
IMX8MM: assign panel to mipi_dsi in a device tree
Hi list, After several days of trying I realize my too small/old brain is unable to map around how to assign/connect a panel to the mipi_dsi-node in a device. We are using a 'tdo,tl070wsh30' panel connected to the mipi-dsi-interface of a imx8mm. Of all the references I found on the in public repositories none of them is using this exact panel. Well. Looking at other device trees I came up with the following dts-node add to the mipi_dsi-node: &mipi_dsi { #address-cells = <1>; #size-cells = <0>; status = "okay"; port@0 { reg = <0>; mipi_dsi_panel0_out: endpoint { remote-endpoint = <&panel0_in>; attach-bridge; }; }; panel@0 { compatible = "tdo,tl070wsh30"; reg = <0>; pinctrl-0 = <&pinctrl_mipi_dsi>; pinctrl-names = "default"; reset-gpios = <&gpio4 4 GPIO_ACTIVE_LOW>; enable-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; backlight = <&panel_gpio_backlight>; power-supply = <&panel_gpio_regulator>; dsi-lanes = <4>; video-mode = <0>; panel-width-mm = <157>; panel-height-mm = <86>; status = "okay"; port { panel0_in: endpoint { remote-endpoint =<&mipi_dsi_panel0_out>; }; }; }; }; You'll see that I used the attach-bridge-option, which is maybe not necessary. I found this during a debug-print-session in the drm-bridge-driver, it wasn't attaching a bridge. But maybe I don't need a bridge as the panel-driver contains everything to control the controllers of the panel. I don't really know. However, with this I have the following messages: [0.393985] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c0/mipi_dsi@32e1 to encoder DSI-34: -19 [0.405626] imx_sec_dsim_drv 32e1.mipi_dsi: Failed to attach bridge: 32e1.mipi_dsi [0.413974] imx_sec_dsim_drv 32e1.mipi_dsi: failed to bind sec dsim bridge: -517 The panel driver is never instantiated. I'm using 5.15.51 (-imx). mipi_dsi and the panel-driver are built into the kernel. I have to say that I'm basically trying to imitate the device-tree-implementation based on example rather than understanding the exact details of how to correctly work with mipi_dsi and the panel. I'd appreciate any help and pointers which lead me into the right direction. Thanks in advance. -- Patrick.
Re: gud: set PATH connector property
On 3/2/23 13:01, Simon Ser wrote: > On Tuesday, February 28th, 2023 at 16:16, Peter Stuge wrote: > >> Simon Ser wrote: >> > Would it be possible to set the PATH connector property based on the > USB port used by gud? Sadly not really easily. The physical topology underneath each host controller is stable but bus numbers (usb1, usb2 etc.) are not. >>> >>> Oh, that's news to me. So if I unplug and replug a USB device, the bus >>> number and bus device number might change? >> >> The bus number is stable as long as the bus (host controller) exists. >> >>> Or does this happen after a power-cycle? Or is this hardware-specific? >> >> Consider a host controller on a plug-in card, like ExpressCard (usb1) >> and perhaps Thunderbolt (usb2) for a more modern example. >> >> The bus on each new host controller gets the next available bus number. >> >> Plug ExpressCard before Thunderbolt to get the order above. Unplug >> both (usb1+usb2 disappear) then plug Thunderbolt back in before >> ExpressCard; now Thunderbolt is usb1 and ExpressCard usb2. > > Hm, right. With a first-come-first-served scheme, there is no way to > have stable identifiers. > > I'm having a look at prior art: udev has similar needs for network > interface names. For USB they use [2] a scheme with > port/config/interface. I have no idea what meaning these have, but > would they be useful for building a PATH KMS property? > > [1]: > https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html > [2]: > https://github.com/systemd/systemd/blob/7a67afe33192ce4a55e6825b80554fb4ebbb4b03/src/udev/udev-builtin-net_id.c#L758 > I'm no expert but that looks like a good idea, it has probably been well scrutinized. Maybe we can do something like this, not tested: /* PATH=usb:[[P]s[f]]uo */ int drm_connector_set_path_property_usb(struct drm_connector *connector, struct usb_interface *intf) { u8 config = intf->cur_altsetting->desc.bAlternateSetting; u8 ifnum = intf->cur_altsetting->desc.bInterfaceNumber; struct usb_device *usb = interface_to_usbdev(intf); struct device *dev = &intf->dev; char path[255], temp[64]; strlcpy(path, "usb:", sizeof(path)); while (dev = dev->parent) { struct pci_dev *pci; if (dev->bus != &pci_bus_type) continue; pci = to_pci_dev(dev); if (pci_domain_nr(pci->bus)) { snprintf(temp, sizeof(temp), "P%u", pci_domain_nr(pci->bus)); strlcat(path, temp, sizeof(path)); } snprintf(temp, sizeof(temp), "s%u", PCI_SLOT(pci->devfn)); strlcat(path, temp, sizeof(path)); if (pci->multifunction) { snprintf(temp, sizeof(temp), "f%u", PCI_FUNC(pci->devfn)); strlcat(path, temp, sizeof(path)); } break; } snprintf(temp, sizeof(temp), "u%s", usb->devpath); strlcat(path, temp, sizeof(path)); if (config) { snprintf(temp, sizeof(temp), "c%u", config); strlcat(path, temp, sizeof(path)); } if (ifnum) { snprintf(temp, sizeof(temp), "i%u", ifnum); strlcat(path, temp, sizeof(path)); } snprintf(temp, sizeof(temp), "o%s", connector->index); strlcat(path, temp, sizeof(path)); return drm_connector_set_path_property(connector, path); } Noralf.
Re: [PATCH] drm/amdgpu: Use uncached ioremap() for LoongArch
Am 05.03.23 um 06:21 schrieb Huacai Chen: LoongArch maintains cache coherency in hardware, but its WUC attribute (Weak-ordered UnCached, which is similar to WC) is out of the scope of cache coherency machanism. This means WUC can only used for write-only memory regions. So use uncached ioremap() for LoongArch in the amdgpu driver. Well NAK. This is leaking platform dependencies into the driver code. When you have a limitation that ioremap_wc() can't guarantee read/write ordering then that's pretty clearly a platform bug and you would need to apply this workaround to all drivers using ioremap_wc() which isn't really feasible. The x86 cache dependencies is because the GPU can also be part of the CPU in which case PCIe is not used to access the aperture base. Regards, Christian. Signed-off-by: Huacai Chen --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index c5ef7f7bdc15..c6888a58819a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1750,8 +1750,13 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) else #endif +#ifdef CONFIG_LOONGARCH + adev->mman.aper_base_kaddr = ioremap(adev->gmc.aper_base, + adev->gmc.visible_vram_size); +#else adev->mman.aper_base_kaddr = ioremap_wc(adev->gmc.aper_base, adev->gmc.visible_vram_size); +#endif #endif /*
[Bug 217141] New: [amdgpu] ring gfx_0.0.0 timeout steam deck AMD APU
https://bugzilla.kernel.org/show_bug.cgi?id=217141 Bug ID: 217141 Summary: [amdgpu] ring gfx_0.0.0 timeout steam deck AMD APU Product: Drivers Version: 2.5 Kernel Version: 6.1.12 Hardware: AMD OS: Linux Tree: Mainline Status: NEW Severity: high Priority: P1 Component: Video(DRI - non Intel) Assignee: drivers_video-...@kernel-bugs.osdl.org Reporter: s...@podtynnyi.com Regression: No [ 257.182206] [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx_0.0.0 timeout, signaled seq=26043, emitted[64/36172] [ 257.182668] [drm:amdgpu_job_timedout [amdgpu]] *ERROR* Process information: process NMS.exe pid 2571 thread NMS.exe pid 2571 [ 257.183084] amdgpu :04:00.0: amdgpu: GPU reset begin! [ 257.183094] [ cut here ] [ 257.183095] Evicting all processes [ 257.183151] WARNING: CPU: 6 PID: 745 at drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c:1935 kfd_suspend_all_proc esses+0x100/0x110 [amdgpu] [ 257.183562] Modules linked in: uinput snd_seq_dummy snd_hrtimer snd_seq snd_seq_device ccm algif_aead cbc des_generi c libdes ecb md4 cmac algif_hash algif_skcipher af_alg bnep ramoops reed_solomon snd_acp5x_pcm_dma snd_soc_acp5x_mach s nd_acp5x_i2s snd_sof_amd_rembrandt rtw88_8822ce snd_sof_amd_renoir rtw88_8822c snd_sof_amd_acp rtw88_pci intel_rapl_msr snd_sof_pci intel_rapl_common rtw88_core snd_sof edac_mce_amd snd_sof_utils btusb kvm_amd btrtl snd_pci_ps mac80211 sn d_hda_codec_hdmi btbcm snd_soc_cs35l41_spi btintel kvm snd_soc_cs35l41 snd_rpl_pci_acp6x snd_hda_intel btmtk snd_soc_wm _adsp snd_intel_dspcfg cs_dsp snd_acp_pci libarc4 leds_steamdeck extcon_steamdeck snd_pci_acp6x snd_intel_sdw_acpi snd_ soc_nau8821 snd_soc_cs35l41_lib steamdeck_hwmon irqbypass bluetooth snd_hda_codec snd_pci_acp5x snd_soc_core rapl snd_r n_pci_acp3x cfg80211 pcspkr snd_hda_core snd_compress i2c_piix4 mousedev cdc_acm ac97_bus snd_acp_config joydev ecdh_ge neric snd_pcm_dmaengine snd_hwdep snd_soc_acpi [ 257.183627] snd_pci_acp3x snd_pcm dwc3_pci rfkill ina2xx_adc kfifo_buf snd_timer opt3001 ltrf216a steamdeck spi_amd ina2xx industrialio snd acpi_cpufreq mac_hid soundcore fuse ip_tables x_tables overlay ext4 crc16 mbcache jbd2 hid_ste am usbhid amdgpu vfat fat gpu_sched drm_buddy serio_raw sdhci_pci nvme_tcp drm_display_helper atkbd cqhci libps2 nvme_f abrics crct10dif_pclmul vivaldi_fmap crc32_pclmul polyval_clmulni sdhci polyval_generic cec i8042 gf128mul nvme hid_mul titouch drm_ttm_helper ghash_clmulni_intel xhci_pci sha512_ssse3 nvme_core aesni_intel crypto_simd sp5100_tco cryptd wd at_wdt ttm xhci_pci_renesas ccp mmc_core nvme_common serio video i2c_hid_acpi wmi 8250_dw i2c_hid btrfs blake2b_generic xor raid6_pq libcrc32c crc32c_generic crc32c_intel dm_mirror dm_region_hash dm_log dm_mod pkcs8_key_parser crypto_user [ 257.183700] CPU: 6 PID: 745 Comm: kworker/u32:7 Not tainted 6.1.12-valve2-1-neptune-61 #1 4091faa51bd1be3bbac5fd4c3c e3432202f24d92 [ 257.183704] Hardware name: Valve Jupiter/Jupiter, BIOS F7A0113 11/04/2022 [ 257.183708] Workqueue: amdgpu-reset-dev drm_sched_job_timedout [gpu_sched] [ 257.183718] RIP: 0010:kfd_suspend_all_processes+0x100/0x110 [amdgpu] [ 257.184119] Code: c7 c7 00 b3 3f c1 41 5c 41 5d e9 cb 4f 5f f1 be 03 00 00 00 e8 d1 89 a3 f1 e9 59 ff ff ff 48 c7 c7 14 a2 24 c1 e8 12 d6 06 f2 <0f> 0b e9 24 ff ff ff 0f 0b eb c5 0f 1f 44 00 00 66 0f 1f 00 0f 1f [ 257.184122] RSP: 0018:ad1140f67cf8 EFLAGS: 00010286 [ 257.184125] RAX: RBX: 993b46b68400 RCX: 0027 [ 257.184127] RDX: 993e6eda0728 RSI: 0001 RDI: 993e6eda0720 [ 257.184128] RBP: 993b4462 R08: R09: ad1140f67b78 [ 257.184130] R10: 0003 R11: 993e7ef7ffe8 R12: ad1140f67dd0 [ 257.184131] R13: R14: 993b89dbe400 R15: [ 257.184133] FS: () GS:993e6ed8() knlGS: [ 257.184135] CS: 0010 DS: ES: CR0: 80050033 [ 257.184137] CR2: 55d62521f000 CR3: 000108b04000 CR4: 00350ee0 [ 257.184139] Call Trace: [ 257.184143] [ 257.184147] kgd2kfd_suspend.part.0+0x3d/0x40 [amdgpu ad613437896db6c29581f2be9152cc5a6dd35ad7] [ 257.184571] kgd2kfd_pre_reset+0x47/0x60 [amdgpu ad613437896db6c29581f2be9152cc5a6dd35ad7] [ 257.184965] amdgpu_device_gpu_recover.cold+0x119/0xb40 [amdgpu ad613437896db6c29581f2be9152cc5a6dd35ad7] [ 257.185430] amdgpu_job_timedout+0x1dc/0x220 [amdgpu ad613437896db6c29581f2be9152cc5a6dd35ad7] [ 257.185866] ? try_to_wake_up+0xd9/0x560 [ 257.185874] drm_sched_job_timedout+0x7a/0x110 [gpu_sched 32db77b2b4e1fdeaf45e32d64ce206e5c0ca90ae] [ 257.185885] process_one_work+0x1c7/0x380 [ 257.185892] worker_thread+0x51/0x390 [ 257.185897] ? rescuer_thread+0x3b0/0x3b0 [ 257.185901] kthread+0xde/0x110 [ 257.185905] ? kthrea
[PATCH] drm/amd/display: change several dcn30 variables storage-class-specifier to static
smatch reports these similar problems in dcn30 drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_dwb.c:223:25: warning: symbol 'dcn30_dwbc_funcs' was not declared. Should it be static? drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_mmhubbub.c:214:28: warning: symbol 'dcn30_mmhubbub_funcs' was not declared. Should it be static? drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_mpc.c:1402:24: warning: symbol 'dcn30_mpc_funcs' was not declared. Should it be static? All of these are only used in their definition file, so they should be static Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c index f14f69616692..0d98918bf0fc 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c @@ -220,7 +220,7 @@ void dwb3_set_denorm(struct dwbc *dwbc, struct dc_dwb_params *params) } -const struct dwbc_funcs dcn30_dwbc_funcs = { +static const struct dwbc_funcs dcn30_dwbc_funcs = { .get_caps = dwb3_get_caps, .enable = dwb3_enable, .disable= dwb3_disable, diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c index 7a93eff183d9..6f2a0d5d963b 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c @@ -211,7 +211,7 @@ static void mmhubbub3_config_mcif_arb(struct mcif_wb *mcif_wb, REG_UPDATE(MCIF_WB_ARBITRATION_CONTROL, MCIF_WB_CLIENT_ARBITRATION_SLICE, params->arbitration_slice); } -const struct mcif_wb_funcs dcn30_mmhubbub_funcs = { +static const struct mcif_wb_funcs dcn30_mmhubbub_funcs = { .warmup_mcif= mmhubbub3_warmup_mcif, .enable_mcif= mmhubbub2_enable_mcif, .disable_mcif = mmhubbub2_disable_mcif, diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c index ad1c1b703874..6cf40c1332bc 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c @@ -1399,7 +1399,7 @@ static void mpc3_set_mpc_mem_lp_mode(struct mpc *mpc) } } -const struct mpc_funcs dcn30_mpc_funcs = { +static const struct mpc_funcs dcn30_mpc_funcs = { .read_mpcc_state = mpc1_read_mpcc_state, .insert_plane = mpc1_insert_plane, .remove_mpcc = mpc1_remove_mpcc, -- 2.27.0
[PATCH] drm: fix typo in margin connector properties docs
This was pointed out by Ville and Pekka in their replies, but forgot to apply the change properly before pushing. Sorry for the noise! Signed-off-by: Simon Ser Fixes: 409f07d353b3 ("drm: document connector margin properties") Cc: Ville Syrjälä Cc: Pekka Paalanen Cc: Maxime Ripard Cc: Dave Stevenson --- drivers/gpu/drm/drm_connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 4b12c7a39ee3..48df7a5ea503 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1452,7 +1452,7 @@ static const struct drm_prop_enum_list dp_colorspaces[] = { * * left margin, right margin, top margin, bottom margin: * Add margins to the connector's viewport. This is typically used to - * mitigate underscan on TVs. + * mitigate overscan on TVs. * * The value is the size in pixels of the black border which will be * added. The attached CRTC's content will be scaled to fill the whole -- 2.39.2
Re: [PATCH] dt-bindings: yamllint: Require a space after a comment '#'
On Fri, Mar 03, 2023 at 03:42:23PM -0600, Rob Herring wrote: > Enable yamllint to check the prefered commenting style of requiring a fwiiw: prefered -> preferred > space after a comment character '#'. Fix the cases in the tree which > have a warning with this enabled. Most cases just need a space after the > '#'. A couple of cases with comments which were not intended to be > comments are revealed. Those were in ti,sa2ul.yaml, ti,cal.yaml, and > brcm,bcmgenet.yaml. > > Signed-off-by: Rob Herring ...