[PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
There are drivers that register framebuffer devices very early in the boot process and make use of the existing framebuffer as setup by the firmware. If one of those drivers has registered a fbdev, then the fallback fbdev of the DRM driver won't be bound to the framebuffer console. To avoid that, remove any existing generic driver and take over the graphics device. By doing that, the fb mapped to the console is switched correctly from the early fbdev to the one registered by the rockchip DRM driver: [ 40.752420] fb0: switching to rockchip-drm-fb from EFI VGA Signed-off-by: Javier Martinez Canillas --- Changes in v2: - Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann). - Adapt subject line, commit message, etc accordingly. drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 212bd87c0c4..b730b8d5d94 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev) struct rockchip_drm_private *private; int ret; + /* Remove existing drivers that may own the framebuffer memory. */ + ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb"); + if (ret) { + DRM_DEV_ERROR(dev, + "Failed to remove existing framebuffers - %d.\n", + ret); + return ret; + } + drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); -- 2.31.1
[PATCH] drm/virtgpu: Fix a resource leak in an error handling path
If an error occurs after calling 'virtio_gpu_init()', 'virtio_gpu_deinit()' must be called as already done in the remove function. Fixes: d516e75c71c9 ("drm/virtio: Drop deprecated load/unload initialization") Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/virtio/virtgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index 33bf5f53ae31..ca77edbc5ea0 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -125,11 +125,13 @@ static int virtio_gpu_probe(struct virtio_device *vdev) ret = drm_dev_register(dev, 0); if (ret) - goto err_free; + goto err_deinit; drm_fbdev_generic_setup(vdev->priv, 32); return 0; +err_deinit: + virtio_gpu_deinit(dev); err_free: drm_dev_put(dev); return ret; -- 2.30.2
Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas: There are drivers that register framebuffer devices very early in the boot process and make use of the existing framebuffer as setup by the firmware. If one of those drivers has registered a fbdev, then the fallback fbdev of the DRM driver won't be bound to the framebuffer console. To avoid that, remove any existing generic driver and take over the graphics device. By doing that, the fb mapped to the console is switched correctly from the early fbdev to the one registered by the rockchip DRM driver: [ 40.752420] fb0: switching to rockchip-drm-fb from EFI VGA Signed-off-by: Javier Martinez Canillas Acked-by: Thomas Zimmermann Ping me if no one else merges the patch. Best regards Thomas --- Changes in v2: - Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann). - Adapt subject line, commit message, etc accordingly. drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 212bd87c0c4..b730b8d5d94 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev) struct rockchip_drm_private *private; int ret; + /* Remove existing drivers that may own the framebuffer memory. */ + ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb"); + if (ret) { + DRM_DEV_ERROR(dev, + "Failed to remove existing framebuffers - %d.\n", + ret); + return ret; + } + drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer OpenPGP_signature Description: OpenPGP digital signature
[PATCH 0/4] drm: Finally retire struct drm_format_name_buf
This is a cleanup patchset to remove drm_format_name_buf et al. There are two instances in drivers that need to be replaced with the %4cc printk format modifier. Patch 3 was left over back from an earlier patchset. [1] Patch 4 removes struct drm_format_name_buf. I built-tested with drm-tip. The patchsetcan be mered through drm-misc. [1] https://lore.kernel.org/dri-devel/20210216155723.17109-1-sakari.ai...@linux.intel.com/ Sakari Ailus (1): drm: Remove drm_get_format_name() Thomas Zimmermann (3): drm/amdgpu: Use %p4cc to print 4CC format drm/simpledrm: Use %p4cc to print 4CC format drm/fourcc: Remove struct drm_format_buf_name drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++ drivers/gpu/drm/drm_fourcc.c| 25 - drivers/gpu/drm/tiny/simpledrm.c| 6 ++--- include/drm/drm_fourcc.h| 9 4 files changed, 4 insertions(+), 43 deletions(-) -- 2.31.1
[PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format
Replace use of struct drm_format_name_buf with %p4cc for printing 4CC formats. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 8a1fb8b6606e..49f73b5b89b0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -1077,12 +1077,9 @@ int amdgpu_display_gem_fb_verify_and_init( /* Verify that the modifier is supported. */ if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format, mode_cmd->modifier[0])) { - struct drm_format_name_buf format_name; drm_dbg_kms(dev, - "unsupported pixel format %s / modifier 0x%llx\n", - drm_get_format_name(mode_cmd->pixel_format, - &format_name), - mode_cmd->modifier[0]); + "unsupported pixel format %p4cc / modifier 0x%llx\n", + &mode_cmd->pixel_format, mode_cmd->modifier[0]); ret = -EINVAL; goto err; -- 2.31.1
[PATCH 2/4] drm/simpledrm: Use %p4cc to print 4CC format
Replace use of struct drm_format_name_buf with %p4cc for printing 4CC formats. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/tiny/simpledrm.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index ed40dde4d218..2defd5cc6c99 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -466,7 +466,6 @@ static int simpledrm_device_init_fb(struct simpledrm_device *sdev) { int width, height, stride; const struct drm_format_info *format; - struct drm_format_name_buf buf; struct drm_device *dev = &sdev->dev; struct platform_device *pdev = sdev->pdev; const struct simplefb_platform_data *pd = dev_get_platdata(&pdev->dev); @@ -510,9 +509,8 @@ static int simpledrm_device_init_fb(struct simpledrm_device *sdev) drm_dbg_kms(dev, "display mode={" DRM_MODE_FMT "}\n", DRM_MODE_ARG(&sdev->mode)); drm_dbg_kms(dev, - "framebuffer format=\"%s\", size=%dx%d, stride=%d byte\n", - drm_get_format_name(format->format, &buf), width, - height, stride); + "framebuffer format=%p4cc, size=%dx%d, stride=%d byte\n", + &format->format, width, height, stride); return 0; } -- 2.31.1
[PATCH 4/4] drm/fourcc: Remove struct drm_format_buf_name
The structure is unused. Remove it. Signed-off-by: Thomas Zimmermann --- include/drm/drm_fourcc.h | 8 1 file changed, 8 deletions(-) diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 3ea17b8a79d3..3b138d4ae67e 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -135,14 +135,6 @@ struct drm_format_info { bool is_yuv; }; -/** - * struct drm_format_name_buf - name of a DRM format - * @str: string buffer containing the format name - */ -struct drm_format_name_buf { - char str[32]; -}; - /** * drm_format_info_is_yuv_packed - check that the format info matches a YUV * format with data laid in a single plane -- 2.31.1
[PATCH 3/4] drm: Remove drm_get_format_name()
From: Sakari Ailus The %p4cc printk format modifier was recently added to print fourcc codes, replacing drm_get_format_name(). The function is no longer needed, so remove it. Signed-off-by: Sakari Ailus Reviewed-by: Petr Mladek Reviewed-by: Andy Shevchenko --- drivers/gpu/drm/drm_fourcc.c | 25 - include/drm/drm_fourcc.h | 1 - 2 files changed, 26 deletions(-) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 03262472059c..5cf45aa6eedc 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -30,11 +30,6 @@ #include #include -static char printable_char(int c) -{ - return isascii(c) && isprint(c) ? c : '?'; -} - /** * drm_mode_legacy_fb_format - compute drm fourcc code from legacy description * @bpp: bits per pixels @@ -130,26 +125,6 @@ uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, } EXPORT_SYMBOL(drm_driver_legacy_fb_format); -/** - * drm_get_format_name - fill a string with a drm fourcc format's name - * @format: format to compute name of - * @buf: caller-supplied buffer - */ -const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf) -{ - snprintf(buf->str, sizeof(buf->str), -"%c%c%c%c %s-endian (0x%08x)", -printable_char(format & 0xff), -printable_char((format >> 8) & 0xff), -printable_char((format >> 16) & 0xff), -printable_char((format >> 24) & 0x7f), -format & DRM_FORMAT_BIG_ENDIAN ? "big" : "little", -format); - - return buf->str; -} -EXPORT_SYMBOL(drm_get_format_name); - /* * Internal function to query information for a given format. See * drm_format_info() for the public API. diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 156b122c0ad5..3ea17b8a79d3 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -318,6 +318,5 @@ unsigned int drm_format_info_block_height(const struct drm_format_info *info, int plane); uint64_t drm_format_info_min_pitch(const struct drm_format_info *info, int plane, unsigned int buffer_width); -const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf); #endif /* __DRM_FOURCC_H__ */ -- 2.31.1
Re: [PATCH] drm/msm/dp: remove most of usbpd-related remains
On Sun, 16 May 2021 at 08:41, Bjorn Andersson wrote: > > On Sat 15 May 14:56 CDT 2021, Dmitry Baryshkov wrote: > > > Remove most of remains of downstream usbpd code. Mainline kernel uses > > different approach for managing Type-C / USB-PD, so this remains unused. > > Do not touch usbpd callbacks for now, since they look usefull enough as > > an example of how to handle connect/disconnect (to be rewritten into . > > > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/gpu/drm/msm/Makefile| 1 - > > drivers/gpu/drm/msm/dp/dp_ctrl.c| 4 +- > > drivers/gpu/drm/msm/dp/dp_ctrl.h| 3 +- > > drivers/gpu/drm/msm/dp/dp_debug.c | 6 +-- > > drivers/gpu/drm/msm/dp/dp_debug.h | 4 +- > > drivers/gpu/drm/msm/dp/dp_display.c | 36 ++- > > drivers/gpu/drm/msm/dp/dp_hpd.c | 69 - > > drivers/gpu/drm/msm/dp/dp_hpd.h | 51 - > > drivers/gpu/drm/msm/dp/dp_power.c | 2 +- > > drivers/gpu/drm/msm/dp/dp_power.h | 3 +- > > 10 files changed, 11 insertions(+), 168 deletions(-) > > delete mode 100644 drivers/gpu/drm/msm/dp/dp_hpd.c > > > [..] > > diff --git a/drivers/gpu/drm/msm/dp/dp_hpd.c > > b/drivers/gpu/drm/msm/dp/dp_hpd.c > > It seems to me that this would be a reasonable place to plug in the > typec_mux stuff. And as we're starting that exercise we should perhaps > hold off on applying until we've figured out how that would look? I'm fine with holding this for a while. Note, that actual code handling the connection/disconnection is left in place. I've just dropped unused data structures and related code. In fact this started as I started looking for the place to put typec-mux code and whether fields from dp_usbpd struct are used or not (they are not). -- With best wishes Dmitry
Re: [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format
Am 16.05.21 um 14:13 schrieb Thomas Zimmermann: Replace use of struct drm_format_name_buf with %p4cc for printing 4CC formats. Signed-off-by: Thomas Zimmermann Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 8a1fb8b6606e..49f73b5b89b0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -1077,12 +1077,9 @@ int amdgpu_display_gem_fb_verify_and_init( /* Verify that the modifier is supported. */ if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format, mode_cmd->modifier[0])) { - struct drm_format_name_buf format_name; drm_dbg_kms(dev, - "unsupported pixel format %s / modifier 0x%llx\n", - drm_get_format_name(mode_cmd->pixel_format, - &format_name), - mode_cmd->modifier[0]); + "unsupported pixel format %p4cc / modifier 0x%llx\n", + &mode_cmd->pixel_format, mode_cmd->modifier[0]); ret = -EINVAL; goto err;
Re: [PATCH v1 3/3] drm/msm/dpu: simplify interrupt managing
On Sun, 16 May 2021 at 08:24, Bjorn Andersson wrote: > > On Sun 11 Apr 19:09 CDT 2021, Dmitry Baryshkov wrote: > > > Change huge lookup table to contain just sensible entries. IRQ index is > > now not an index in the table, but just register id (multiplied by 32, > > the amount of IRQs in the register) plus offset in the register. This > > allows us to remove all the "reserved" entries from dpu_irq_map. The > > table is now only used for lookups, individual functions calculate > > register and mask using the irq_idx. > > > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 10 +- > > .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 1151 +++-- > > .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h |4 +- > > 3 files changed, 196 insertions(+), 969 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c > > b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c > > index fd11a2aeab6c..4e2ad03df903 100644 > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c > > @@ -70,7 +70,7 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, > > int irq_idx) > > return -EINVAL; > > } > > > > - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { > > + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { > > DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); > > return -EINVAL; > > } > > @@ -133,7 +133,7 @@ static int _dpu_core_irq_disable(struct dpu_kms > > *dpu_kms, int irq_idx) > > return -EINVAL; > > } > > > > - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { > > + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { > > DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); > > return -EINVAL; > > } > > @@ -208,7 +208,7 @@ int dpu_core_irq_register_callback(struct dpu_kms > > *dpu_kms, int irq_idx, > > return -EINVAL; > > } > > > > - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { > > + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { > > DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); > > return -EINVAL; > > } > > @@ -243,7 +243,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms > > *dpu_kms, int irq_idx, > > return -EINVAL; > > } > > > > - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { > > + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { > > DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); > > return -EINVAL; > > } > > @@ -328,7 +328,7 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms) > > spin_lock_init(&dpu_kms->irq_obj.cb_lock); > > > > /* Create irq callbacks for all possible irq_idx */ > > - dpu_kms->irq_obj.total_irqs = dpu_kms->hw_intr->irq_idx_tbl_size; > > + dpu_kms->irq_obj.total_irqs = dpu_kms->hw_intr->total_irqs; > > dpu_kms->irq_obj.irq_cb_tbl = kcalloc(dpu_kms->irq_obj.total_irqs, > > sizeof(struct list_head), GFP_KERNEL); > > dpu_kms->irq_obj.enable_counts = kcalloc(dpu_kms->irq_obj.total_irqs, > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c > > b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c > > index 8bd22e060437..2cb6800047c3 100644 > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c > > @@ -32,142 +32,142 @@ > > /** > > * WB interrupt status bit definitions > > */ > > -#define DPU_INTR_WB_0_DONE BIT(0) > > -#define DPU_INTR_WB_1_DONE BIT(1) > > -#define DPU_INTR_WB_2_DONE BIT(4) > > +#define DPU_INTR_WB_0_DONE 0 > > +#define DPU_INTR_WB_1_DONE 1 > > +#define DPU_INTR_WB_2_DONE 4 > > > > /** > > * WDOG timer interrupt status bit definitions > > */ > > -#define DPU_INTR_WD_TIMER_0_DONE BIT(2) > > -#define DPU_INTR_WD_TIMER_1_DONE BIT(3) > > -#define DPU_INTR_WD_TIMER_2_DONE BIT(5) > > -#define DPU_INTR_WD_TIMER_3_DONE BIT(6) > > -#define DPU_INTR_WD_TIMER_4_DONE BIT(7) > > +#define DPU_INTR_WD_TIMER_0_DONE 2 > > +#define DPU_INTR_WD_TIMER_1_DONE 3 > > +#define DPU_INTR_WD_TIMER_2_DONE 5 > > +#define DPU_INTR_WD_TIMER_3_DONE 6 > > +#define DPU_INTR_WD_TIMER_4_DONE 7 > > > > /** > > * Pingpong interrupt status bit definitions > > */ > > -#define DPU_INTR_PING_PONG_0_DONE BIT(8) > > -#define DPU_INTR_PING_PONG_1_DONE BIT(9) > > -#define DPU_INTR_PING_PONG_2_DONE BIT(10) > > -#define DPU_INTR_PING_PONG_3_DONE BIT(11) > > -#define DPU_INTR_PING_PONG_0_RD_PTR BIT(12) > > -#define DPU_INTR_PING_PONG_1_RD_PTR BIT(13) > > -#define DPU_INTR_PING_PONG_2_RD_PTR BIT(14) > > -#define DPU_INTR_PING_PONG_3_RD_PTR BIT(15) > > -#define DPU_INTR_PING_PONG_0_WR_PTR BIT(16) > > -#define DPU_INTR_PING_PONG_1_WR_PTR BIT(17) > > -#
Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
Hello Thomas, On 5/16/21 12:30 PM, Thomas Zimmermann wrote: > > > Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas: >> There are drivers that register framebuffer devices very early in the boot >> process and make use of the existing framebuffer as setup by the firmware. >> >> If one of those drivers has registered a fbdev, then the fallback fbdev > of >> the DRM driver won't be bound to the framebuffer console. To avoid that, >> remove any existing generic driver and take over the graphics device. >> >> By doing that, the fb mapped to the console is switched correctly from the >> early fbdev to the one registered by the rockchip DRM driver: >> >> [ 40.752420] fb0: switching to rockchip-drm-fb from EFI VGA >> >> Signed-off-by: Javier Martinez Canillas > > Acked-by: Thomas Zimmermann > > Ping me if no one else merges the patch. > Sure, I will. And thanks a lot for your review! > Best regards > Thomas > Best regards, -- Javier Martinez Canillas Software Engineer New Platform Technologies Enablement team RHEL Engineering
[PATCH] drm/i915: only disable default vga device
From: Vivek Das Mohapatra This patch is to do with seamless handover, eg when the sequence is bootloader → plymouth → desktop. It switches the vga arbiter from the "other" GPU to the default one (intel in this case), so the driver can issue some io(). Signed-off-by: Vivek Das Mohapatra Signed-off-by: Emil Velikov --- Greetings all, This patch has been downstream for a while now yet it seems perfectly reasonable thing to have in the Linux kernel. https://github.com/ValveSoftware/steamos_kernel/commit/5431b5b1999c3d3b5efee817fb3373fbbd473063 drivers/gpu/drm/i915/display/intel_vga.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c index be333699c515..4f07b5ad5fa0 100644 --- a/drivers/gpu/drm/i915/display/intel_vga.c +++ b/drivers/gpu/drm/i915/display/intel_vga.c @@ -30,12 +30,14 @@ void intel_vga_disable(struct drm_i915_private *dev_priv) u8 sr1; /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */ - vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO); - outb(SR01, VGA_SR_INDEX); - sr1 = inb(VGA_SR_DATA); - outb(sr1 | 1 << 5, VGA_SR_DATA); - vga_put(pdev, VGA_RSRC_LEGACY_IO); - udelay(300); + if (pdev == vga_default_device()) { + vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO); + outb(SR01, VGA_SR_INDEX); + sr1 = inb(VGA_SR_DATA); + outb(sr1 | 1 << 5, VGA_SR_DATA); + vga_put(pdev, VGA_RSRC_LEGACY_IO); + udelay(300); + } intel_de_write(dev_priv, vga_reg, VGA_DISP_DISABLE); intel_de_posting_read(dev_priv, vga_reg); -- 2.27.0
[PATCH 1/3] drm/i915: Don't include drm_legacy.h
i915 does not use DRM legacy code. Remove the rsp include statements. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 1 - drivers/gpu/drm/i915/i915_drv.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_phys.c b/drivers/gpu/drm/i915/gem/i915_gem_phys.c index 81dc2bf59bc3..51a05e62875d 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_phys.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_phys.c @@ -8,7 +8,6 @@ #include #include -#include /* for drm_legacy.h! */ #include #include "gt/intel_gt.h" diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 61308ce19059..bcc6f0133150 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -51,7 +51,6 @@ #include #include -#include /* for struct drm_dma_handle */ #include #include #include -- 2.31.1
[PATCH 0/3] drm: Remove some includes of drm_legacy.h
Remove include statements for DRM legacy headers. None of these dependencies is required. Built-tested w/o CONFIG_DRM_LEGACY set. These patches should probably go through drm-misc, like the rest of the legacy cleanups. Thomas Zimmermann (3): drm/i915: Don't include drm_legacy.h drm/nouveau: Don't include drm_legacy.h drm: Don't include drm_legacy.h in drm_lease.c drivers/gpu/drm/drm_lease.c | 1 - drivers/gpu/drm/i915/gem/i915_gem_phys.c | 1 - drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/nouveau/nouveau_ttm.c| 2 -- 4 files changed, 5 deletions(-) base-commit: 77fc6f68ed347b0a4c6969f6adac70026d5b1449 prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24 prerequisite-patch-id: c59ca2ddb182af06006fa360ad3e90fe16b93d3a prerequisite-patch-id: 8c45deec68d6ab65d66f551b51b12acf2e9ae0b4 prerequisite-patch-id: 742f08083f0d5776068a761b1e2432e8edc2bdf8 prerequisite-patch-id: 39cfaf5f337ec53d3237bf2a700e77c84f789039 -- 2.31.1
[PATCH 3/3] drm: Don't include drm_legacy.h in drm_lease.c
DRM leases do not use DRM legacy code. Remove the rsp include statement. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_lease.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c index da4f085fc09e..00fb433bcef1 100644 --- a/drivers/gpu/drm/drm_lease.c +++ b/drivers/gpu/drm/drm_lease.c @@ -14,7 +14,6 @@ #include "drm_crtc_internal.h" #include "drm_internal.h" -#include "drm_legacy.h" #define drm_for_each_lessee(lessee, lessor) \ list_for_each_entry((lessee), &(lessor)->lessees, lessee_list) -- 2.31.1
[PATCH 2/3] drm/nouveau: Don't include drm_legacy.h
Nouveau does not use DRM legacy code. Remove the rsp. include statement. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index e8b506a6685b..468eacb41f05 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c @@ -31,8 +31,6 @@ #include "nouveau_mem.h" #include "nouveau_ttm.h" -#include - #include static void -- 2.31.1
[PATCH] drm: Remove unused branch in legacy PCI initialization
The legacy PCI init code sets the drvdata for drivers with MODESET flag, but none of the old UMS drivers sets the flag. Remove the branch. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_pci.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 38c3cb72e7e6..f508f70e7a3f 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -165,9 +165,6 @@ static int drm_legacy_get_pci_dev(struct pci_dev *pdev, dev->hose = pdev->sysdata; #endif - if (drm_core_check_feature(dev, DRIVER_MODESET)) - pci_set_drvdata(pdev, dev); - drm_legacy_pci_agp_init(dev); ret = drm_dev_register(dev, ent->driver_data); -- 2.31.1
[PATCH] drm: Mark IRQ_BUSID ioctl as legacy
The functionality is only implemented for legacy drivers. Mark the ioctl as legacy and move the code behind CONFIG_DRM_LEGACY. If legacy drivers are disabled, the ioctl call now returns -EINVAL instead of -EOPNOTSUPP. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_internal.h | 8 drivers/gpu/drm/drm_ioctl.c| 3 ++- drivers/gpu/drm/drm_legacy.h | 8 drivers/gpu/drm/drm_pci.c | 8 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 1dcb5797a3bb..17f3548c8ed2 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -54,18 +54,10 @@ void drm_lastclose(struct drm_device *dev); #ifdef CONFIG_PCI /* drm_pci.c */ -int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, - struct drm_file *file_priv); int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master); #else -static inline int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - return -EINVAL; -} - static inline int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) { diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index b0856c139693..53d314103a37 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -577,7 +577,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0), - DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_legacy_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY), + DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_legacy_irq_by_busid, +DRM_MASTER|DRM_ROOT_ONLY), DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_legacy_getmap_ioctl, 0), diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h index 7080d2538421..c9206840c87f 100644 --- a/drivers/gpu/drm/drm_legacy.h +++ b/drivers/gpu/drm/drm_legacy.h @@ -235,9 +235,17 @@ void drm_master_legacy_init(struct drm_master *master); static inline void drm_master_legacy_init(struct drm_master *master) {} #endif +/* drm_pci.c */ #if IS_ENABLED(CONFIG_DRM_LEGACY) && IS_ENABLED(CONFIG_PCI) +int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, struct drm_file *file_priv); void drm_legacy_pci_agp_destroy(struct drm_device *dev); #else +static inline int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -EINVAL; +} + static inline void drm_legacy_pci_agp_destroy(struct drm_device *dev) {} #endif diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index f508f70e7a3f..39d35fc3a43b 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -72,7 +72,9 @@ int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) return 0; } -static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) +#ifdef CONFIG_DRM_LEGACY + +static int drm_legacy_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) { struct pci_dev *pdev = to_pci_dev(dev->dev); @@ -115,11 +117,9 @@ int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return -EOPNOTSUPP; - return drm_pci_irq_by_busid(dev, p); + return drm_legacy_pci_irq_by_busid(dev, p); } -#ifdef CONFIG_DRM_LEGACY - void drm_legacy_pci_agp_destroy(struct drm_device *dev) { if (dev->agp) { -- 2.31.1
Re: [PATCH -next] drm: correct function name drm_legacy_ctxbitmap_flush()
Hi Am 13.05.21 um 09:19 schrieb Yang Yingliang: Fix the following make W=1 kernel build warning: drivers/gpu/drm/drm_context.c:136: warning: expecting prototype for drm_ctxbitmap_flush(). Prototype was for drm_legacy_ctxbitmap_flush() instead Signed-off-by: Yang Yingliang Added to drm-misc-next. Thanks! Best regards Thomas --- drivers/gpu/drm/drm_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index c99be950bf17..acbec1ddd583 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -124,7 +124,7 @@ void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev) } /** - * drm_ctxbitmap_flush() - Flush all contexts owned by a file + * drm_legacy_ctxbitmap_flush() - Flush all contexts owned by a file * @dev: DRM device to operate on * @file: Open file to flush contexts for * -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer OpenPGP_signature Description: OpenPGP digital signature
Re: [PATCH] drm/msm/dpu: simplify dpu_core_irq_en/disable helpers
On 11/05/2021 17:15, Dmitry Baryshkov wrote: dpu_core_irq_en/disable helpers are always called with the irq_count equal to 1. Merge them with _dpu_core_en/disable functions and make them handle just one interrupt index at a time. Replacing this patch with the squashing enable/disable into register/unregister (part of DPU IRQ rework patchset v2). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 50 drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h | 20 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +- 3 files changed, 18 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index c10761ea191c..0ee9ac21e24a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -63,11 +63,11 @@ int dpu_core_irq_idx_lookup(struct dpu_kms *dpu_kms, } /** - * _dpu_core_irq_enable - enable core interrupt given by the index + * dpu_core_irq_enable - enable core interrupt given by the index * @dpu_kms: Pointer to dpu kms context * @irq_idx: interrupt index */ -static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) +int dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) { unsigned long irq_flags; int ret = 0, enable_count; @@ -85,6 +85,8 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) } enable_count = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idx]); + if (enable_count) + DRM_ERROR("irq_idx=%d enable_count=%d\n", irq_idx, enable_count); DRM_DEBUG_KMS("irq_idx=%d enable_count=%d\n", irq_idx, enable_count); trace_dpu_core_irq_enable_idx(irq_idx, enable_count); @@ -109,31 +111,12 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) return ret; } -int dpu_core_irq_enable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) -{ - int i, ret = 0, counts; - - if (!irq_idxs || !irq_count) { - DPU_ERROR("invalid params\n"); - return -EINVAL; - } - - counts = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idxs[0]]); - if (counts) - DRM_ERROR("irq_idx=%d enable_count=%d\n", irq_idxs[0], counts); - - for (i = 0; (i < irq_count) && !ret; i++) - ret = _dpu_core_irq_enable(dpu_kms, irq_idxs[i]); - - return ret; -} - /** - * _dpu_core_irq_disable - disable core interrupt given by the index + * dpu_core_irq_disable - disable core interrupt given by the index * @dpu_kms: Pointer to dpu kms context * @irq_idx: interrupt index */ -static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) +int dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) { int ret = 0, enable_count; @@ -148,6 +131,8 @@ static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) } enable_count = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idx]); + if (enable_count > 1) + DRM_ERROR("irq_idx=%d enable_count=%d\n", irq_idx, enable_count); DRM_DEBUG_KMS("irq_idx=%d enable_count=%d\n", irq_idx, enable_count); trace_dpu_core_irq_disable_idx(irq_idx, enable_count); @@ -164,25 +149,6 @@ static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) return ret; } -int dpu_core_irq_disable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) -{ - int i, ret = 0, counts; - - if (!irq_idxs || !irq_count) { - DPU_ERROR("invalid params\n"); - return -EINVAL; - } - - counts = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idxs[0]]); - if (counts == 2) - DRM_ERROR("irq_idx=%d enable_count=%d\n", irq_idxs[0], counts); - - for (i = 0; (i < irq_count) && !ret; i++) - ret = _dpu_core_irq_disable(dpu_kms, irq_idxs[i]); - - return ret; -} - u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx, bool clear) { if (!dpu_kms->hw_intr) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h index e30775e6585b..2ac781738e83 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h @@ -43,34 +43,30 @@ int dpu_core_irq_idx_lookup( uint32_t instance_idx); /** - * dpu_core_irq_enable - IRQ helper function for enabling one or more IRQs + * dpu_core_irq_enable - IRQ helper function for enabling IRQ * @dpu_kms: DPU handle - * @irq_idxs: Array of irq index - * @irq_count: Number of irq_idx provided in the array + * @irq_idx: irq index * @return: 0 for success enabling IRQ, otherwise failure * * This function increments count on each enable and decrements on each -
[PATCH v2 0/6] drm/msm/dpu: rework irq handling
Simplify IRQ handling. dpu_irq_map is a huge table consisting of all possible IRQ entries (including a plenty of 'reserved' = not existing IRQs). It is always used to lookup the interrupt index (in the table) and then to use this index to lookup related interrupt register and mask. For the long period of time these indices had 1:1 correspondence to register/mask pairs. SC7280 introduced 'additional' IRQs removing this correpondence. Replace all IRQ lookup with stable irq indices, which correponds directly to the register/bit pair. The irq indices are now fetched from the hw catalog rather than being looked up using the hw block id and irq type. Changes since v1: - move IRQ indices to hw catalog rather than looking them up from the big dpu_irq_map table (as suggested by Bjorn). - add patch to squash irq enable/disable into dpu_core_irq_register_callback()/dpu_core_irq_unregister_callback() Changes since RFC: - rebase on top of msm/msm-next to include SC7280 changes. The following changes since commit f2f46b878777e0d3f885c7ddad48f477b4dea247: drm/msm/dp: initialize audio_comp when audio starts (2021-05-06 16:26:57 -0700) are available in the Git repository at: https://git.linaro.org/people/dmitry.baryshkov/kernel.git dpu-irq-simplify-2 for you to fetch changes up to ec3d935f9a18aeb3ebf5482eba7133cec020e047: drm/msm/dpu: simplify IRQ enabling/disabling (2021-05-16 23:19:56 +0300) Dmitry Baryshkov (6): drm/msm/dpu: merge dpu_hw_intr_get_interrupt_statuses into dpu_hw_intr_dispatch_irqs drm/msm/dpu: hw_intr: always call dpu_hw_intr_clear_intr_status_nolock drm/msm/dpu: define interrupt register names drm/msm/dpu: replace IRQ lookup with the data in hw catalog drm/msm/dpu: drop remains of old irq lookup subsystem drm/msm/dpu: simplify IRQ enabling/disabling drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 203 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h | 43 - drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 74 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |4 - .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 40 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 33 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 202 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 14 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 1450 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 112 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h|2 - drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 36 +- 12 files changed, 330 insertions(+), 1883 deletions(-)
[PATCH v2 3/6] drm/msm/dpu: define interrupt register names
In order to make mdss_irqs readable (and error-prone) define names for interrupt register indices. Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c| 45 --- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 18 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index b569030a0847..9a77d64d3fd4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -7,6 +7,7 @@ #include #include #include "dpu_hw_mdss.h" +#include "dpu_hw_interrupts.h" #include "dpu_hw_catalog.h" #include "dpu_kms.h" @@ -56,6 +57,23 @@ #define INTF_SC7280_MASK INTF_SC7180_MASK | BIT(DPU_DATA_HCTL_EN) +#define IRQ_SDM845_MASK (BIT(MDP_SSPP_TOP0_INTR) | \ +BIT(MDP_SSPP_TOP0_INTR2) | \ +BIT(MDP_SSPP_TOP0_HIST_INTR) | \ +BIT(MDP_INTF0_INTR) | \ +BIT(MDP_INTF1_INTR) | \ +BIT(MDP_INTF2_INTR) | \ +BIT(MDP_INTF3_INTR) | \ +BIT(MDP_INTF4_INTR) | \ +BIT(MDP_AD4_0_INTR) | \ +BIT(MDP_AD4_1_INTR)) + +#define IRQ_SC7180_MASK (BIT(MDP_SSPP_TOP0_INTR) | \ +BIT(MDP_SSPP_TOP0_INTR2) | \ +BIT(MDP_SSPP_TOP0_HIST_INTR) | \ +BIT(MDP_INTF0_INTR) | \ +BIT(MDP_INTF1_INTR)) + #define INTR_SC7180_MASK \ (BIT(DPU_IRQ_TYPE_PING_PONG_RD_PTR) |\ BIT(DPU_IRQ_TYPE_PING_PONG_WR_PTR) |\ @@ -63,6 +81,23 @@ BIT(DPU_IRQ_TYPE_PING_PONG_TEAR_CHECK) |\ BIT(DPU_IRQ_TYPE_PING_PONG_TE_CHECK)) +#define IRQ_SC7280_MASK (BIT(MDP_SSPP_TOP0_INTR) | \ +BIT(MDP_SSPP_TOP0_INTR2) | \ +BIT(MDP_SSPP_TOP0_HIST_INTR) | \ +BIT(MDP_INTF0_7xxx_INTR) | \ +BIT(MDP_INTF1_7xxx_INTR) | \ +BIT(MDP_INTF5_7xxx_INTR)) + +#define IRQ_SM8250_MASK (BIT(MDP_SSPP_TOP0_INTR) | \ +BIT(MDP_SSPP_TOP0_INTR2) | \ +BIT(MDP_SSPP_TOP0_HIST_INTR) | \ +BIT(MDP_INTF0_INTR) | \ +BIT(MDP_INTF1_INTR) | \ +BIT(MDP_INTF2_INTR) | \ +BIT(MDP_INTF3_INTR) | \ +BIT(MDP_INTF4_INTR)) + + #define DEFAULT_PIXEL_RAM_SIZE (50 * 1024) #define DEFAULT_DPU_LINE_WIDTH 2048 #define DEFAULT_DPU_OUTPUT_LINE_WIDTH 2560 @@ -1060,7 +1095,7 @@ static void sdm845_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .reg_dma_count = 1, .dma_cfg = sdm845_regdma, .perf = sdm845_perf_data, - .mdss_irqs = 0x3ff, + .mdss_irqs = IRQ_SDM845_MASK, }; } @@ -1091,7 +1126,7 @@ static void sc7180_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .reg_dma_count = 1, .dma_cfg = sdm845_regdma, .perf = sc7180_perf_data, - .mdss_irqs = 0x3f, + .mdss_irqs = IRQ_SC7180_MASK, .obsolete_irq = INTR_SC7180_MASK, }; } @@ -1125,7 +1160,7 @@ static void sm8150_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .reg_dma_count = 1, .dma_cfg = sm8150_regdma, .perf = sm8150_perf_data, - .mdss_irqs = 0x3ff, + .mdss_irqs = IRQ_SDM845_MASK, }; } @@ -1158,7 +1193,7 @@ static void sm8250_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .reg_dma_count = 1, .dma_cfg = sm8250_regdma, .perf = sm8250_perf_data, - .mdss_irqs = 0xff, + .mdss_irqs = IRQ_SM8250_MASK, }; } @@ -1181,7 +1216,7 @@ static void sc7280_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .vbif_count = ARRAY_SIZE(sdm845_vbif), .vbif = sdm845_vbif, .perf = sc7280_perf_data, - .mdss_irqs = 0x1c07, + .mdss_irqs = IRQ_SC7280_MASK, .obsolete_irq = INTR_SC7180_MASK, }; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h index 5bade5637ecc..b26a3445a8eb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h @@ -74,6 +74,24 @@ enum dpu_intr_type { DPU_IRQ_TYPE_RESERVED, }; +/* When making changes be sure to sync with dpu_intr_set */ +enum dpu_hw_intr_reg { + MDP_SSPP_TOP0_INTR, + MDP_SSPP_TOP0_INTR2, + MDP_SSPP_TOP0_HIST_INTR, + MDP_INTF0_INTR, + MDP_INTF1_INTR, + MDP_INTF2_INTR, + MDP_INTF3_INTR, + MDP_INTF4_INTR, + MDP_AD4_0_INTR, + MDP_AD4_1_INTR, +
[PATCH v2 1/6] drm/msm/dpu: merge dpu_hw_intr_get_interrupt_statuses into dpu_hw_intr_dispatch_irqs
There is little sense in reading interrupt statuses and right after that going after the array of statuses to dispatch them. Merge both loops into single function doing read and dispatch. Signed-off-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 10 +-- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 66 ++- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 8 --- 3 files changed, 20 insertions(+), 64 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index cdec3fbe6ff4..54b34746a587 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -376,15 +376,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms) irqreturn_t dpu_core_irq(struct dpu_kms *dpu_kms) { - /* -* Read interrupt status from all sources. Interrupt status are -* stored within hw_intr. -* Function will also clear the interrupt status after reading. -* Individual interrupt status bit will only get stored if it -* is enabled. -*/ - dpu_kms->hw_intr->ops.get_interrupt_statuses(dpu_kms->hw_intr); - /* * Dispatch to HW driver to handle interrupt lookup that is being * fired. When matching interrupt is located, HW driver will call to @@ -392,6 +383,7 @@ irqreturn_t dpu_core_irq(struct dpu_kms *dpu_kms) * dpu_core_irq_callback_handler will perform the registered function * callback, and do the interrupt status clearing once the registered * callback is finished. +* Function will also clear the interrupt status after reading. */ dpu_kms->hw_intr->ops.dispatch_irqs( dpu_kms->hw_intr, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c index 48c96b812126..cf9bfd45aa59 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c @@ -1371,6 +1371,7 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, int start_idx; int end_idx; u32 irq_status; + u32 enable_mask; unsigned long irq_flags; if (!intr) @@ -1383,8 +1384,6 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, */ spin_lock_irqsave(&intr->irq_lock, irq_flags); for (reg_idx = 0; reg_idx < ARRAY_SIZE(dpu_intr_set); reg_idx++) { - irq_status = intr->save_irq_status[reg_idx]; - /* * Each Interrupt register has a range of 64 indexes, and * that is static for dpu_irq_map. @@ -1396,6 +1395,20 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, start_idx >= ARRAY_SIZE(dpu_irq_map)) continue; + /* Read interrupt status */ + irq_status = DPU_REG_READ(&intr->hw, dpu_intr_set[reg_idx].status_off); + + /* Read enable mask */ + enable_mask = DPU_REG_READ(&intr->hw, dpu_intr_set[reg_idx].en_off); + + /* and clear the interrupt */ + if (irq_status) + DPU_REG_WRITE(&intr->hw, dpu_intr_set[reg_idx].clr_off, +irq_status); + + /* Finally update IRQ status based on enable mask */ + irq_status &= enable_mask; + /* * Search through matching intr status from irq map. * start_idx and end_idx defined the search range in @@ -1429,6 +1442,10 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, irq_status &= ~dpu_irq_map[irq_idx].irq_mask; } } + + /* ensure register writes go through */ + wmb(); + spin_unlock_irqrestore(&intr->irq_lock, irq_flags); } @@ -1580,41 +1597,6 @@ static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr) return 0; } -static void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr) -{ - int i; - u32 enable_mask; - unsigned long irq_flags; - - if (!intr) - return; - - spin_lock_irqsave(&intr->irq_lock, irq_flags); - for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) { - if (!test_bit(i, &intr->irq_mask)) - continue; - - /* Read interrupt status */ - intr->save_irq_status[i] = DPU_REG_READ(&intr->hw, - dpu_intr_set[i].status_off); - - /* Read enable mask */ - enable_mask = DPU_REG_READ(&intr->hw, dpu_intr_set[i].en_off); - - /* and clear the interrupt */ - if (intr->save_irq_status[i]) - DPU_REG_WRITE(&intr->hw, dpu_intr_set[i].clr_off, -
[PATCH v2 2/6] drm/msm/dpu: hw_intr: always call dpu_hw_intr_clear_intr_status_nolock
Always call dpu_hw_intr_clear_intr_status_nolock() from the dpu_hw_intr_dispatch_irqs(). This simplifies the callback function (which call clears the interrupts anyway) and enforces clearing the hw interrupt status. Signed-off-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 9 - .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 39 +-- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 9 - 3 files changed, 18 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index 54b34746a587..fd11a2aeab6c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -41,15 +41,6 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) if (cb->func) cb->func(cb->arg, irq_idx); spin_unlock_irqrestore(&dpu_kms->irq_obj.cb_lock, irq_flags); - - /* -* Clear pending interrupt status in HW. -* NOTE: dpu_core_irq_callback_handler is protected by top-level -* spinlock, so it is safe to clear any interrupt status here. -*/ - dpu_kms->hw_intr->ops.clear_intr_status_nolock( - dpu_kms->hw_intr, - irq_idx); } int dpu_core_irq_idx_lookup(struct dpu_kms *dpu_kms, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c index cf9bfd45aa59..8bd22e060437 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c @@ -1362,6 +1362,22 @@ static int dpu_hw_intr_irqidx_lookup(struct dpu_hw_intr *intr, return -EINVAL; } +static void dpu_hw_intr_clear_intr_status_nolock(struct dpu_hw_intr *intr, + int irq_idx) +{ + int reg_idx; + + if (!intr) + return; + + reg_idx = dpu_irq_map[irq_idx].reg_idx; + DPU_REG_WRITE(&intr->hw, dpu_intr_set[reg_idx].clr_off, + dpu_irq_map[irq_idx].irq_mask); + + /* ensure register writes go through */ + wmb(); +} + static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, void (*cbfunc)(void *, int), void *arg) @@ -1430,9 +1446,8 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, */ if (cbfunc) cbfunc(arg, irq_idx); - else - intr->ops.clear_intr_status_nolock( - intr, irq_idx); + + dpu_hw_intr_clear_intr_status_nolock(intr, irq_idx); /* * When callback finish, clear the irq_status @@ -1597,23 +1612,6 @@ static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr) return 0; } - -static void dpu_hw_intr_clear_intr_status_nolock(struct dpu_hw_intr *intr, - int irq_idx) -{ - int reg_idx; - - if (!intr) - return; - - reg_idx = dpu_irq_map[irq_idx].reg_idx; - DPU_REG_WRITE(&intr->hw, dpu_intr_set[reg_idx].clr_off, - dpu_irq_map[irq_idx].irq_mask); - - /* ensure register writes go through */ - wmb(); -} - static u32 dpu_hw_intr_get_interrupt_status(struct dpu_hw_intr *intr, int irq_idx, bool clear) { @@ -1655,7 +1653,6 @@ static void __setup_intr_ops(struct dpu_hw_intr_ops *ops) ops->dispatch_irqs = dpu_hw_intr_dispatch_irq; ops->clear_all_irqs = dpu_hw_intr_clear_irqs; ops->disable_all_irqs = dpu_hw_intr_disable_irqs; - ops->clear_intr_status_nolock = dpu_hw_intr_clear_intr_status_nolock; ops->get_interrupt_status = dpu_hw_intr_get_interrupt_status; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h index 5a1c304ba93f..5bade5637ecc 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h @@ -142,15 +142,6 @@ struct dpu_hw_intr_ops { void (*cbfunc)(void *arg, int irq_idx), void *arg); - /** -* clear_intr_status_nolock() - clears the HW interrupts without lock -* @intr: HW interrupt handle -* @irq_idx:Lookup irq index return from irq_idx_lookup -*/ - void (*clear_intr_status_nolock)( - struct dpu_hw_intr *intr, - int irq_idx); - /** * get_interrupt_status - Gets HW interrupt status, and clear if set, *based on given lookup IRQ index. -- 2.30.2
[PATCH v2 5/6] drm/msm/dpu: drop remains of old irq lookup subsystem
There is no more need for the dpu_intr_type types, dpu_irq_map table, individual intr defines and obsolete_irq field. Drop all of them now. Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |2 - .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c |4 - .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |2 - .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|9 - .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|2 - .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 1234 - .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 64 - 7 files changed, 1317 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h index 3bd12ce45a80..e7270eb6b84b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h @@ -165,7 +165,6 @@ enum dpu_intr_idx { /** * dpu_encoder_irq - tracking structure for interrupts * @name: string name of interrupt - * @intr_type: Encoder interrupt type * @intr_idx: Encoder interrupt enumeration * @irq_idx: IRQ interface lookup index from DPU IRQ framework * will be -EINVAL if IRQ is not registered @@ -173,7 +172,6 @@ enum dpu_intr_idx { */ struct dpu_encoder_irq { const char *name; - enum dpu_intr_type intr_type; enum dpu_intr_idx intr_idx; int irq_idx; struct dpu_irq_callback cb; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index 6f06e379b97f..36064004d6ff 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -789,25 +789,21 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( irq = &phys_enc->irq[INTR_IDX_CTL_START]; irq->name = "ctl_start"; - irq->intr_type = DPU_IRQ_TYPE_CTL_START; irq->intr_idx = INTR_IDX_CTL_START; irq->cb.func = dpu_encoder_phys_cmd_ctl_start_irq; irq = &phys_enc->irq[INTR_IDX_PINGPONG]; irq->name = "pp_done"; - irq->intr_type = DPU_IRQ_TYPE_PING_PONG_COMP; irq->intr_idx = INTR_IDX_PINGPONG; irq->cb.func = dpu_encoder_phys_cmd_pp_tx_done_irq; irq = &phys_enc->irq[INTR_IDX_RDPTR]; irq->name = "pp_rd_ptr"; - irq->intr_type = DPU_IRQ_TYPE_PING_PONG_RD_PTR; irq->intr_idx = INTR_IDX_RDPTR; irq->cb.func = dpu_encoder_phys_cmd_pp_rd_ptr_irq; irq = &phys_enc->irq[INTR_IDX_UNDERRUN]; irq->name = "underrun"; - irq->intr_type = DPU_IRQ_TYPE_INTF_UNDER_RUN; irq->intr_idx = INTR_IDX_UNDERRUN; irq->cb.func = dpu_encoder_phys_cmd_underrun_irq; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index 6cdb4ecbc173..4ef3d7357c2d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -729,13 +729,11 @@ struct dpu_encoder_phys *dpu_encoder_phys_vid_init( irq = &phys_enc->irq[INTR_IDX_VSYNC]; irq->name = "vsync_irq"; - irq->intr_type = DPU_IRQ_TYPE_INTF_VSYNC; irq->intr_idx = INTR_IDX_VSYNC; irq->cb.func = dpu_encoder_phys_vid_vblank_irq; irq = &phys_enc->irq[INTR_IDX_UNDERRUN]; irq->name = "underrun"; - irq->intr_type = DPU_IRQ_TYPE_INTF_UNDER_RUN; irq->intr_idx = INTR_IDX_UNDERRUN; irq->cb.func = dpu_encoder_phys_vid_underrun_irq; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index f929131ed260..d01c4c919504 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -74,13 +74,6 @@ BIT(MDP_INTF0_INTR) | \ BIT(MDP_INTF1_INTR)) -#define INTR_SC7180_MASK \ - (BIT(DPU_IRQ_TYPE_PING_PONG_RD_PTR) |\ - BIT(DPU_IRQ_TYPE_PING_PONG_WR_PTR) |\ - BIT(DPU_IRQ_TYPE_PING_PONG_AUTO_REF) |\ - BIT(DPU_IRQ_TYPE_PING_PONG_TEAR_CHECK) |\ - BIT(DPU_IRQ_TYPE_PING_PONG_TE_CHECK)) - #define IRQ_SC7280_MASK (BIT(MDP_SSPP_TOP0_INTR) | \ BIT(MDP_SSPP_TOP0_INTR2) | \ BIT(MDP_SSPP_TOP0_HIST_INTR) | \ @@ -1171,7 +1164,6 @@ static void sc7180_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .dma_cfg = sdm845_regdma, .perf = sc7180_perf_data, .mdss_irqs = IRQ_SC7180_MASK, - .obsolete_irq = INTR_SC7180_MASK, }; } @@ -1261,7 +1253,6 @@ static void sc7280_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .vbif = sdm845_vbif, .perf = sc7280_perf_data, .mdss_irqs = IRQ_SC7280_MASK, - .obsolete_irq = INTR_SC7180_MASK, }; } diff --git a/dr
[PATCH v2 4/6] drm/msm/dpu: replace IRQ lookup with the data in hw catalog
The IRQ table in the dpu_hw_interrupts.h is big, ugly, and hard to maintain. There are only few interrupts used from that table. Newer generations use different IRQ locations. Move this data to hw catalog. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 20 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h | 13 -- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 64 +++- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 2 - .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 36 ++--- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 31 +--- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c| 150 +++--- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h| 12 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 137 +++- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 17 +- drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 28 ++-- 11 files changed, 229 insertions(+), 281 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index fd11a2aeab6c..11c0abed21ee 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -43,16 +43,6 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) spin_unlock_irqrestore(&dpu_kms->irq_obj.cb_lock, irq_flags); } -int dpu_core_irq_idx_lookup(struct dpu_kms *dpu_kms, - enum dpu_intr_type intr_type, u32 instance_idx) -{ - if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.irq_idx_lookup) - return -EINVAL; - - return dpu_kms->hw_intr->ops.irq_idx_lookup(dpu_kms->hw_intr, - intr_type, instance_idx); -} - /** * _dpu_core_irq_enable - enable core interrupt given by the index * @dpu_kms: Pointer to dpu kms context @@ -70,7 +60,7 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -133,7 +123,7 @@ static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -208,7 +198,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx, return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -243,7 +233,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx, return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -328,7 +318,7 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms) spin_lock_init(&dpu_kms->irq_obj.cb_lock); /* Create irq callbacks for all possible irq_idx */ - dpu_kms->irq_obj.total_irqs = dpu_kms->hw_intr->irq_idx_tbl_size; + dpu_kms->irq_obj.total_irqs = dpu_kms->hw_intr->total_irqs; dpu_kms->irq_obj.irq_cb_tbl = kcalloc(dpu_kms->irq_obj.total_irqs, sizeof(struct list_head), GFP_KERNEL); dpu_kms->irq_obj.enable_counts = kcalloc(dpu_kms->irq_obj.total_irqs, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h index e30775e6585b..d147784d5531 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h @@ -29,19 +29,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms); */ irqreturn_t dpu_core_irq(struct dpu_kms *dpu_kms); -/** - * dpu_core_irq_idx_lookup - IRQ helper function for lookup irq_idx from HW - * interrupt mapping table. - * @dpu_kms: DPU handle - * @intr_type: DPU HW interrupt type for lookup - * @instance_idx: DPU HW block instance defined in dpu_hw_mdss.h - * @return:irq_idx or -EINVAL when fail to lookup - */ -int dpu_core_irq_idx_lookup( - struct dpu_kms *dpu_kms, - enum dpu_intr_type intr_type, - uint32_t instance_idx); - /** * dpu_core_irq_enable - IRQ helper function for enabling one or more IRQs * @dpu_kms: DPU handle diff --git a/drivers/gpu/drm/msm/
[PATCH v2 6/6] drm/msm/dpu: simplify IRQ enabling/disabling
Merge dpu_core_irq_enable() into dpu_core_irq_register_callback() and dpu_core_irq_disable() into dpu_core_irq_unregister_callback(), because they are called in pairs. There is no need to have separate enable/disable pair, we can enable hardware IRQ when first callback is registered and when the last callback is unregistered. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 168 +++ drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h | 30 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 18 -- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 - drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h| 8 - 5 files changed, 27 insertions(+), 199 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index 11c0abed21ee..4f110c428b60 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -26,10 +26,8 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) pr_debug("irq_idx=%d\n", irq_idx); - if (list_empty(&irq_obj->irq_cb_tbl[irq_idx])) { - DRM_ERROR("no registered cb, idx:%d enable_count:%d\n", irq_idx, - atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idx])); - } + if (list_empty(&irq_obj->irq_cb_tbl[irq_idx])) + DRM_ERROR("no registered cb, idx:%d\n", irq_idx); atomic_inc(&irq_obj->irq_counts[irq_idx]); @@ -43,127 +41,6 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) spin_unlock_irqrestore(&dpu_kms->irq_obj.cb_lock, irq_flags); } -/** - * _dpu_core_irq_enable - enable core interrupt given by the index - * @dpu_kms: Pointer to dpu kms context - * @irq_idx: interrupt index - */ -static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) -{ - unsigned long irq_flags; - int ret = 0, enable_count; - - if (!dpu_kms->hw_intr || - !dpu_kms->irq_obj.enable_counts || - !dpu_kms->irq_obj.irq_counts) { - DPU_ERROR("invalid params\n"); - return -EINVAL; - } - - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { - DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); - return -EINVAL; - } - - enable_count = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idx]); - DRM_DEBUG_KMS("irq_idx=%d enable_count=%d\n", irq_idx, enable_count); - trace_dpu_core_irq_enable_idx(irq_idx, enable_count); - - if (atomic_inc_return(&dpu_kms->irq_obj.enable_counts[irq_idx]) == 1) { - ret = dpu_kms->hw_intr->ops.enable_irq( - dpu_kms->hw_intr, - irq_idx); - if (ret) - DPU_ERROR("Fail to enable IRQ for irq_idx:%d\n", - irq_idx); - - DPU_DEBUG("irq_idx=%d ret=%d\n", irq_idx, ret); - - spin_lock_irqsave(&dpu_kms->irq_obj.cb_lock, irq_flags); - /* empty callback list but interrupt is enabled */ - if (list_empty(&dpu_kms->irq_obj.irq_cb_tbl[irq_idx])) - DPU_ERROR("irq_idx=%d enabled with no callback\n", - irq_idx); - spin_unlock_irqrestore(&dpu_kms->irq_obj.cb_lock, irq_flags); - } - - return ret; -} - -int dpu_core_irq_enable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) -{ - int i, ret = 0, counts; - - if (!irq_idxs || !irq_count) { - DPU_ERROR("invalid params\n"); - return -EINVAL; - } - - counts = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idxs[0]]); - if (counts) - DRM_ERROR("irq_idx=%d enable_count=%d\n", irq_idxs[0], counts); - - for (i = 0; (i < irq_count) && !ret; i++) - ret = _dpu_core_irq_enable(dpu_kms, irq_idxs[i]); - - return ret; -} - -/** - * _dpu_core_irq_disable - disable core interrupt given by the index - * @dpu_kms: Pointer to dpu kms context - * @irq_idx: interrupt index - */ -static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) -{ - int ret = 0, enable_count; - - if (!dpu_kms->hw_intr || !dpu_kms->irq_obj.enable_counts) { - DPU_ERROR("invalid params\n"); - return -EINVAL; - } - - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { - DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); - return -EINVAL; - } - - enable_count = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idx]); - DRM_DEBUG_KMS("irq_idx=%d enable_count=%d\n", irq_idx, enable_count); - trace_dpu_core_irq_disable_idx(irq_idx, enable_count); - - if (atomic_dec_return(&dpu_kms->irq_obj.enable_counts[irq_idx]) == 0) { -
Re: [PATCH v1 3/3] drm/msm/dpu: simplify interrupt managing
On 16/05/2021 08:24, Bjorn Andersson wrote: On Sun 11 Apr 19:09 CDT 2021, Dmitry Baryshkov wrote: Change huge lookup table to contain just sensible entries. IRQ index is now not an index in the table, but just register id (multiplied by 32, the amount of IRQs in the register) plus offset in the register. This allows us to remove all the "reserved" entries from dpu_irq_map. The table is now only used for lookups, individual functions calculate register and mask using the irq_idx. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 10 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 1151 +++-- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h |4 +- 3 files changed, 196 insertions(+), 969 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index fd11a2aeab6c..4e2ad03df903 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -70,7 +70,7 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -133,7 +133,7 @@ static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -208,7 +208,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx, return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -243,7 +243,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx, return -EINVAL; } - if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) { + if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) { DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx); return -EINVAL; } @@ -328,7 +328,7 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms) spin_lock_init(&dpu_kms->irq_obj.cb_lock); /* Create irq callbacks for all possible irq_idx */ - dpu_kms->irq_obj.total_irqs = dpu_kms->hw_intr->irq_idx_tbl_size; + dpu_kms->irq_obj.total_irqs = dpu_kms->hw_intr->total_irqs; dpu_kms->irq_obj.irq_cb_tbl = kcalloc(dpu_kms->irq_obj.total_irqs, sizeof(struct list_head), GFP_KERNEL); dpu_kms->irq_obj.enable_counts = kcalloc(dpu_kms->irq_obj.total_irqs, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c index 8bd22e060437..2cb6800047c3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c @@ -32,142 +32,142 @@ /** * WB interrupt status bit definitions */ -#define DPU_INTR_WB_0_DONE BIT(0) -#define DPU_INTR_WB_1_DONE BIT(1) -#define DPU_INTR_WB_2_DONE BIT(4) +#define DPU_INTR_WB_0_DONE 0 +#define DPU_INTR_WB_1_DONE 1 +#define DPU_INTR_WB_2_DONE 4 /** * WDOG timer interrupt status bit definitions */ -#define DPU_INTR_WD_TIMER_0_DONE BIT(2) -#define DPU_INTR_WD_TIMER_1_DONE BIT(3) -#define DPU_INTR_WD_TIMER_2_DONE BIT(5) -#define DPU_INTR_WD_TIMER_3_DONE BIT(6) -#define DPU_INTR_WD_TIMER_4_DONE BIT(7) +#define DPU_INTR_WD_TIMER_0_DONE 2 +#define DPU_INTR_WD_TIMER_1_DONE 3 +#define DPU_INTR_WD_TIMER_2_DONE 5 +#define DPU_INTR_WD_TIMER_3_DONE 6 +#define DPU_INTR_WD_TIMER_4_DONE 7 /** * Pingpong interrupt status bit definitions */ -#define DPU_INTR_PING_PONG_0_DONE BIT(8) -#define DPU_INTR_PING_PONG_1_DONE BIT(9) -#define DPU_INTR_PING_PONG_2_DONE BIT(10) -#define DPU_INTR_PING_PONG_3_DONE BIT(11) -#define DPU_INTR_PING_PONG_0_RD_PTR BIT(12) -#define DPU_INTR_PING_PONG_1_RD_PTR BIT(13) -#define DPU_INTR_PING_PONG_2_RD_PTR BIT(14) -#define DPU_INTR_PING_PONG_3_RD_PTR BIT(15) -#define DPU_INTR_PING_PONG_0_WR_PTR BIT(16) -#define DPU_INTR_PING_PONG_1_WR_PTR BIT(17) -#define DPU_INTR_PING_PONG_2_WR_PTR BIT(18) -#define DPU_INTR_PING_PONG_3_WR_PTR BIT(19) -#define DPU_INTR_PING_PONG_0_AUTOREFRESH_DONE BIT(20) -#define DPU_INTR_PING_PONG_1_AUTOREFRESH_DONE BIT(21) -#define DPU_INTR_PING_PONG_2_AUTOREFRESH_DONE BIT(22) -#define DPU_INTR_PING_PONG_3_AUTOREFRESH_DONE BIT(23) +#define DPU_INTR_PING_PONG_0_DONE 8 +#define D
Re: [PATCH] treewide: Remove leading spaces in Kconfig files
On Sun, May 16, 2021 at 03:22:09PM +0200, Juerg Haefliger wrote: > There are a few occurences of leading spaces before tabs in a couple of > Kconfig files. Remove them by running the following command: > > $ find . -name 'Kconfig*' | xargs sed -r -i 's/^[ ]+\t/\t/' > > Signed-off-by: Juerg Haefliger > --- > arch/arm/mach-omap1/Kconfig | 12 ++-- > arch/arm/mach-vt8500/Kconfig| 6 +++--- > arch/arm/mm/Kconfig | 10 +- > drivers/char/hw_random/Kconfig | 8 > drivers/net/usb/Kconfig | 10 +- > drivers/net/wan/Kconfig | 4 ++-- > drivers/scsi/Kconfig| 2 +- > drivers/uio/Kconfig | 2 +- > drivers/video/backlight/Kconfig | 10 +- > drivers/virtio/Kconfig | 2 +- > drivers/w1/masters/Kconfig | 6 +++--- > fs/proc/Kconfig | 4 ++-- > init/Kconfig| 2 +- > net/netfilter/Kconfig | 2 +- > net/netfilter/ipvs/Kconfig | 2 +- > 15 files changed, 41 insertions(+), 41 deletions(-) Please break this up into one patch per subsystem and resend to the proper maintainers that way. thanks, greg k-h