drm: Add DRM driver for GlandaGPU (VHDL soft-IP GPU)
Subsystems (3)
v6 cover drm: Add DRM driver for GlandaGPU (VHDL soft-IP GPU)
This is v6 of the GlandaGPU DRM driver series [1][2][3][4][5]. It addresses review feedback from Thomas Zimmermann on v5.
GlandaGPU is a small VHDL soft-IP 2D display controller, currently targeting a Terasic DE10-Standard (Cyclone V SoC). This series has been tested against a QEMU digital twin and on real hardware.
Hardware/VHDL: https://github.com/stiangglanda/GlandaGPU QEMU fork: https://github.com/stiangglanda/qemu-glandagpu Userspace tests: https://github.com/stiangglanda/GlandaGPU-userspace-tests
Changes since v5:
driver core:
- Replace the custom glanda_crtc_atomic_flush() with drm_crtc_vblank_atomic_flush() (Thomas Zimmermann).
On the QEMU device ID: it's currently a placeholder from the experimental range, since I haven't submitted the QEMU patch to get an official one yet. Is that fine to merge as is, with a follow-up kernel patch once the official ID is assigned?
[1] v1: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[2] v2: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[3] v3: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[4] v4: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[5] v5: https://lore.kernel.org/dri-devel/[email protected]/T/#t
Leander Kieweg (2):
dt-bindings: display: Add GlandaGPU binding drm/glanda: Add initial DRM driver for GlandaGPU
.../bindings/display/kieweg,gpu.yaml | 56 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 11 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/glandagpu.c | 634 ++++++++++++++++++ 6 files changed, 710 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/kieweg,gpu.yaml create mode 100644 drivers/gpu/drm/tiny/glandagpu.c
Signature · 1 line
2.43.0
PATCH v6 1/2 dt-bindings: display: Add GlandaGPU binding
Add Device Tree binding documentation for GlandaGPU, a custom FPGA-based 2D display controller.
For hardware designs and RTL sources, see:
https://github.com/stiangglanda/GlandaGPU
--- .../bindings/display/kieweg,gpu.yaml | 56 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/kieweg,gpu.yaml
Documentation/devicetree/bindings/display/kieweg,gpu.yaml new file +56 -0
@@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/kieweg,gpu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GlandaGPU 2D Hardware Accelerated Display Controller + +maintainers: + - Leander Kieweg <[email protected]> + +description: | + GlandaGPU is a custom FPGA soft-IP core providing a simple + 2D hardware-accelerated drawing engine with a VGA-compatible + display output. The register window covers a combined VRAM + MMIO + region, with MMIO registers at a fixed offset within it. + + For hardware designs and RTL sources, see: + https://github.com/stiangglanda/GlandaGPU + +properties: + compatible: + const: kieweg,gpu-1.0 + + reg: + maxItems: 1 + description: + Combined VRAM + MMIO register window (VRAM at offset 0, + MMIO registers at offset 0x00200000 within this range). + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + description: Bus and pixel clock provided to the FPGA IP. + +required: + - compatible + - reg + - interrupts + - clocks + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + gpu@c0000000 { + compatible = "kieweg,gpu-1.0"; + reg = <0xc0000000 0x1000000>; + interrupt-parent = <&intc>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc1>; + };
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -893,6 +893,8 @@ patternProperties: description: Khadas "^kiebackpeter,.*": description: Kieback & Peter GmbH + "^kieweg,.*": + description: Leander Kieweg "^kinetic,.*": description: Kinetic Technologies "^kingdisplay,.*":
Signature · 1 line
2.43.0
PATCH v6 2/2 drm/glanda: Add initial DRM driver for GlandaGPU
In reply to Leander KiewegIntroduce the core DRM/KMS driver for GlandaGPU. This driver supports basic modesetting, atomic updates via shadow plane helpers, and optional QEMU PCI probing alongside the platform driver.
--- MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 11 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/glandagpu.c | 634 +++++++++++++++++++++++++++++++ 4 files changed, 652 insertions(+) create mode 100644 drivers/gpu/drm/tiny/glandagpu.c
MAINTAINERS +6 -0
@@ -8076,6 +8076,12 @@ T: git https://gitlab.freedesktop.org/drm/misc/kernel.git F: drivers/gpu/drm/gud/ F: include/drm/gud.h +DRM DRIVER FOR GLANDAGPU +M: Leander Kieweg <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/display/kieweg,gpu.yaml +F: drivers/gpu/drm/tiny/glandagpu.c + DRM DRIVER FOR GRAIN MEDIA GM12U320 PROJECTORS M: Hans de Goede <[email protected]> S: Maintained
drivers/gpu/drm/tiny/Kconfig +11 -0
@@ -56,6 +56,17 @@ config DRM_CIRRUS_QEMU - qxl (DRM_QXL, qemu -vga qxl, works best with spice) - virtio (DRM_VIRTIO_GPU), qemu -vga virtio) +config DRM_GLANDA + tristate "GlandaGPU DRM driver" + depends on DRM && MMU && (PCI || COMPILE_TEST) + select DRM_KMS_HELPER + select DRM_GEM_SHMEM_HELPER + help + DRM/KMS driver for the GlandaGPU display controller + (FPGA soft IP). This driver supports basic modesetting, + dumb buffers, and atomic updates via shadow planes. + It also provides PCI probing for QEMU testing. + config DRM_GM12U320 tristate "GM12U320 driver for USB projectors" depends on DRM && USB && MMU
drivers/gpu/drm/tiny/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_APPLETBDRM) += appletbdrm.o obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o obj-$(CONFIG_DRM_BOCHS) += bochs.o obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus-qemu.o +obj-$(CONFIG_DRM_GLANDA) += glandagpu.o obj-$(CONFIG_DRM_GM12U320) += gm12u320.o obj-$(CONFIG_DRM_PANEL_MIPI_DBI) += panel-mipi-dbi.o obj-$(CONFIG_DRM_PIXPAPER) += pixpaper.o
drivers/gpu/drm/tiny/glandagpu.c new file +634 -0
634 lines not on this page · raw message
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v6 2/2] drm/glanda: Add initial DRM driver for GlandaGPU
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] drm: sleeping in atomic context during plane atomic_update - [High] drm/glanda: incorrect teardown…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm: sleeping in atomic context during plane atomic_update
- [High] drm/glanda: incorrect teardown order in glanda_drm_fini causes IRQ storm --
commit 282719415a14034814111dcb1dd6288f05170cc2
Author: Leander Kieweg <[email protected]>
drm/glanda: Add initial DRM driver for GlandaGPU
Introduce the core DRM/KMS driver for GlandaGPU. This driver supports basic modesetting, atomic updates via shadow plane helpers, and optional QEMU PCI probing alongside the platform driver.
Quoted 5 lines
drivers/gpu/drm/tiny/glandagpu.c new file +0
-0
[ ... ]
Quoted 5 lines
drivers/gpu/drm/tiny/glandagpu.c new file +5
-0+static void glanda_blit_rect(struct glanda_device *gdev, + const struct drm_rect *dst_clip, + const struct iosys_map *src, + struct drm_framebuffer *fb, + int dst_off_x, int dst_off_y,
drivers/gpu/drm/tiny/glandagpu.c line 109
Quoted 10 lines
drivers/gpu/drm/tiny/glandagpu.c new file +10
-0+ struct drm_format_conv_state *fmtcnv_state) +{ +unsigned int src_pitch = fb->pitches[0 ]; +unsigned int width =drm_rect_width (dst_clip); +unsigned int height =drm_rect_height (dst_clip); +unsigned int x, y; +size_t len = width *sizeof (u32); +u32 *sbuf; + + sbuf =drm_format_conv_state_reserve (fmtcnv_state, len,GFP_KERNEL );
[Severity: High]
Is it safe to use GFP_KERNEL in this context?
glanda_blit_rect() is called from glanda_plane_atomic_update(), which is registered as the atomic_update callback for the primary plane.
As per DRM subsystem rules, plane atomic update callbacks execute in atomic context (e.g., inside drm_atomic_helper_commit_tail with locks held/preemption disabled) where sleeping is strictly forbidden.
GFP_KERNEL allows the memory allocator to block and reclaim memory.
Could this allocation be deferred to a sleepable hook like atomic_check?
Quoted 2 lines
drivers/gpu/drm/tiny/glandagpu.c new file +2
-0+if (!sbuf) +return ;
[ ... ]
Quoted 5 lines
drivers/gpu/drm/tiny/glandagpu.c new file +5
-0+static void glanda_plane_atomic_update (struct drm_plane *plane, +struct drm_atomic_commit *state) +{ +struct drm_plane_state *old_state =drm_atomic_get_old_plane_state (state, plane); +struct drm_plane_state *new_state =drm_atomic_get_new_plane_state (state, plane);
drivers/gpu/drm/tiny/glandagpu.c line 148
Quoted 10 lines
drivers/gpu/drm/tiny/glandagpu.c new file +10
-0+struct drm_shadow_plane_state *shadow_state =to_drm_shadow_plane_state (new_state); +struct drm_rect vram_clip =DRM_RECT_INIT (0 ,0 ,GLANDA_WIDTH ,GLANDA_HEIGHT ); +struct glanda_device *gdev =to_glanda (plane->dev); +struct drm_framebuffer *fb = new_state->fb; +struct drm_atomic_helper_damage_iter iter; +struct drm_rect damage; +int dst_off_x, dst_off_y; +int ret, idx; + + ret =drm_gem_fb_begin_cpu_access (fb,DMA_FROM_DEVICE );
[Severity: High]
Can this call sleep while executing in an atomic context?
As noted above, glanda_plane_atomic_update() runs in an atomic context where sleeping is forbidden.
drm_gem_fb_begin_cpu_access() can sleep while acquiring DMA reservation locks and waiting on fences. Calling sleepable functions in the atomic display commit path will cause kernel warnings (scheduling while atomic BUGs), deadlocks, and system instability.
Should CPU access preparation be deferred to the sleepable prepare_fb hook?
Quoted 2 lines
drivers/gpu/drm/tiny/glandagpu.c new file +2
-0+if (ret) +return ;
[ ... ]
drivers/gpu/drm/tiny/glandagpu.c line 281
Quoted 8 lines
drivers/gpu/drm/tiny/glandagpu.c new file +8
-0+static void glanda_crtc_disable_vblank (struct drm_crtc *crtc) +{ +struct glanda_device *gdev =to_glanda (crtc->dev); +u32 ier; +int idx; + +if (!drm_dev_enter (crtc->dev, &idx)) +return ;
[Severity: High]
Will this early return prevent the hardware VSYNC interrupt from being disabled when the module unloads?
If drm_dev_unplug() is called before drm_atomic_helper_shutdown(), drm_dev_enter() will return false because the device is already marked as unplugged.
The early return here would then cause the hardware interrupt disable logic (clearing INT_VSYNC in REG_IER) to be skipped.
If the driver finishes removal, devres frees the IRQ handler while the hardware continues to fire interrupts. Because the IRQ is requested with IRQF_SHARED, an unhandled hardware interrupt causes an IRQ storm that will force the kernel to permanently disable the shared interrupt line, potentially causing a denial of service for other devices sharing the line.
Quoted 6 lines
drivers/gpu/drm/tiny/glandagpu.c new file +6
-0+ + ier =readl (gdev->mmio_base +REG_IER ); +writel (ier & ~INT_VSYNC , gdev->mmio_base +REG_IER ); + +drm_dev_exit (idx); +}
[ ... ]
drivers/gpu/drm/tiny/glandagpu.c line 455
Quoted 5 lines
drivers/gpu/drm/tiny/glandagpu.c new file +5
-0+/* Shared teardown, mirrors glanda_drm_init() */ +static void glanda_drm_fini (struct glanda_device *gdev) +{ +drm_dev_unplug (&gdev->drm); +drm_atomic_helper_shutdown (&gdev->drm);
[Severity: High]
Are these teardown operations ordered correctly to prevent an IRQ storm on module unload?
Because drm_dev_unplug() marks the device as unplugged (dev->unplugged = true) before drm_atomic_helper_shutdown() is called, any drm_dev_enter() calls in the shutdown path (like in glanda_crtc_disable_vblank() and glanda_plane_atomic_disable()) will immediately return false.
This short-circuits the hardware disable logic, leaving the VSYNC interrupt enabled when the module unloads.
Should drm_atomic_helper_shutdown() be called before drm_dev_unplug() to ensure hardware teardown logic executes properly?
Quoted 1 line
+}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Hi Thomas,
a gentle ping on v6 of the GlandaGPU series. Is there anything else I should change before it can be merged?
Best regards,
Leander
Am So., 11. Okt. 2026 um 17:46 Uhr schrieb Leander Kieweg <[email protected]>:
Quoted 46 lines
This is v6 of the GlandaGPU DRM driver series [1][2][3][4][5]. It addresses review feedback from Thomas Zimmermann on v5.
GlandaGPU is a small VHDL soft-IP 2D display controller, currently targeting a Terasic DE10-Standard (Cyclone V SoC). This series has been tested against a QEMU digital twin and on real hardware.
Hardware/VHDL: https://github.com/stiangglanda/GlandaGPU QEMU fork: https://github.com/stiangglanda/qemu-glandagpu Userspace tests: https://github.com/stiangglanda/GlandaGPU-userspace-testsChanges since v5:
driver core:
- Replace the customglanda_crtc_atomic_flush()withdrm_crtc_vblank_atomic_flush()(Thomas Zimmermann).On the QEMU device ID: it's currently a placeholder from the experimental range, since I haven't submitted the QEMU patch to get an official one yet. Is that fine to merge as is, with a follow-up kernel patch once the official ID is assigned?
[1] v1: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[2] v2: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[3] v3: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[4] v4: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[5] v5: https://lore.kernel.org/dri-devel/[email protected]/T/#tLeander Kieweg (2):
dt-bindings: display: Add GlandaGPU binding drm/glanda: Add initial DRM driver for GlandaGPU.../bindings/display/kieweg,gpu.yaml | 56 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 11 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/glandagpu.c | 634 ++++++++++++++++++ 6 files changed, 710 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/kieweg,gpu.yaml create mode 100644 drivers/gpu/drm/tiny/glandagpu.c--
2.43.0
Thomas Zimmermann
maintainerHi
Am 10.11.26 um 11:36 schrieb Leander Kieweg:
Quoted 4 lines
Hi Thomas,
a gentle ping on v6 of the GlandaGPU series. Is there anything else I should change before it can be merged?
Oh, I thought you wanted to send a v7. :)
There's nothing blocking it, I think. I'll merged the driver in soon.
Best regards
Thomas
Quoted 51 lines
Best regards,
LeanderAm So., 11. Okt. 2026 um 17:46 Uhr schrieb Leander Kieweg <[email protected]>:
Quoted 45 lines
This is v6 of the GlandaGPU DRM driver series [1][2][3][4][5]. It addresses review feedback from Thomas Zimmermann on v5.
GlandaGPU is a small VHDL soft-IP 2D display controller, currently targeting a Terasic DE10-Standard (Cyclone V SoC). This series has been tested against a QEMU digital twin and on real hardware.
Hardware/VHDL: https://github.com/stiangglanda/GlandaGPU QEMU fork: https://github.com/stiangglanda/qemu-glandagpu Userspace tests: https://github.com/stiangglanda/GlandaGPU-userspace-testsChanges since v5:
driver core:
- Replace the customglanda_crtc_atomic_flush()withdrm_crtc_vblank_atomic_flush()(Thomas Zimmermann).On the QEMU device ID: it's currently a placeholder from the experimental range, since I haven't submitted the QEMU patch to get an official one yet. Is that fine to merge as is, with a follow-up kernel patch once the official ID is assigned?
[1] v1: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[2] v2: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[3] v3: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[4] v4: https://lore.kernel.org/dri-devel/[email protected]/T/#t
[5] v5: https://lore.kernel.org/dri-devel/[email protected]/T/#tLeander Kieweg (2):
dt-bindings: display: Add GlandaGPU binding drm/glanda: Add initial DRM driver for GlandaGPU.../bindings/display/kieweg,gpu.yaml | 56 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 11 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/glandagpu.c | 634 ++++++++++++++++++ 6 files changed, 710 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/kieweg,gpu.yamlcreate mode 100644drivers/gpu/drm/tiny/glandagpu.c--
2.43.0
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
Quoted 3 lines
Oh, I thought you wanted to send a v7. :)
There's nothing blocking it, I think. I'll merged the driver in soon.
Hi Thomas,
thank you for the review and for merging it!
After Christmas I will submit the QEMU patch to get the official device ID. Then I will send a follow-up kernel patch to replace the placeholder.
Best regards,
Leander
Thomas Zimmermann
maintainerHi
Am 10.11.26 um 18:28 schrieb Leander Kieweg:
Quoted 6 lines
Quoted 3 lines
Oh, I thought you wanted to send a v7. :)
There's nothing blocking it, I think. I'll merged the driver in soon.
Hi Thomas,
thank you for the review and for merging it!
There's was bitrot in there.
CC [M] drivers/gpu/drm/tiny/glandagpu.o/home/tzimmermann/Projekte/drm-upstream/src/drivers/gpu/drm/tiny/glandagpu.c:293:10: error: »const struct drm_crtc_funcs« hat kein Element namens »reset«
293 | .reset = drm_atomic_helper_crtc_reset,
| ^~~~~/home/tzimmermann/Projekte/drm-upstream/src/drivers/gpu/drm/tiny/glandagpu.c:293:18: error: »drm_atomic_helper_crtc_reset« ist hier (außerhalb einer Funktion) nicht deklariert; meinten Sie »drm_atomic_helper_check_modeset«? 293 | .reset = drm_atomic_helper_crtc_reset,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| drm_atomic_helper_check_modeset/home/tzimmermann/Projekte/drm-upstream/src/drivers/gpu/drm/tiny/glandagpu.c:317:10: error: »const struct drm_connector_funcs« hat kein Element namens »reset«
317 | .reset = drm_atomic_helper_connector_reset,
| ^~~~~/home/tzimmermann/Projekte/drm-upstream/src/drivers/gpu/drm/tiny/glandagpu.c:317:18: error: »drm_atomic_helper_connector_reset« ist hier (außerhalb einer Funktion) nicht deklariert; meinten Sie »drm_atomic_helper_connector_tv_check«? 317 | .reset = drm_atomic_helper_connector_reset,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| drm_atomic_helper_connector_tv_check
The reset callbacks got replaced by atomic_create_state plus default implementation. I've fixed the patch before merging it.
Quoted 4 lines
After Christmas I will submit the QEMU patch to get the official device ID. Then I will send a follow-up kernel patch to replace the placeholder.
Sure.
Best regards
Thomas
Quoted 3 lines
Best regards,
Leander
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)