Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leander Kieweg" <kieweg.leander@gmail.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org,
	dri-devel@lists.freedesktop.org, robh@kernel.org
Subject: Re: [PATCH v3 2/2] drm/glanda: Add initial DRM driver for GlandaGPU
Date: Mon, 24 Aug 2026 20:07:32 +0000	[thread overview]
Message-ID: <20260824200733.17EC71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824195418.17707-3-kieweg.leander@gmail.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] `glanda_crtc_enable_vblank()` enables the hardware VSYNC interrupt without checking if an IRQ handler is registered, leading to an interrupt storm in polling mode.
- [High] VRAM is mapped using standard I/O instead of Write-Combining, causing a severe performance regression.
- [Medium] Unconditionally enabling the VSYNC interrupt during initialization bypasses DRM core's state management, causing unnecessary CPU wakes.
- [Low] Unconditional usage of PCI APIs breaks the build when `CONFIG_PCI` is disabled under `COMPILE_TEST`.
--

--- Patch [2]: [PATCH v3 2/2] drm/glanda: Add initial DRM driver for GlandaGPU ---
commit a32b58ce69a1f7f207f85c416ed56ab0c146bd56
Author: Leander Kieweg <kieweg.leander@gmail.com>

drm/glanda: Add initial DRM driver for GlandaGPU

This commit introduces a new DRM/KMS driver for the GlandaGPU display
controller. It supports basic modesetting and atomic updates via shadow
planes, and allows for both platform and PCI probing.

> diff --git a/drivers/gpu/drm/tiny/glandagpu.c b/drivers/gpu/drm/tiny/glandagpu.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/gpu/drm/tiny/glandagpu.c

[ ... ]

> +static int glanda_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct glanda_device *gdev = to_glanda(crtc->dev);
> +	u32 ier;
> +
> +	ier = readl(gdev->mmio_base + REG_IER);
> +	writel(ier | INT_VSYNC, gdev->mmio_base + REG_IER);

[Severity: High]
Could this cause an unhandled interrupt storm in polling mode?

If the driver falls back to polling mode, such as when
platform_get_irq_optional() returns -ENXIO, gdev->irq is set to -1
and no handler is registered. If a userspace application calls
DRM_IOCTL_WAIT_VBLANK, the DRM core will invoke this callback and enable
the hardware vsync interrupt.

Since there is no IRQ handler to clear the REG_ISR register, the hardware
will keep the interrupt line asserted, which might disable a shared
interrupt line and affect other devices.

> +
> +	return 0;
> +}

[ ... ]

> +static int glanda_drm_init(struct glanda_device *gdev, int irq)
> +{

[ ... ]

> +	if (irq > 0) {
> +		gdev->irq = irq;
> +		ret = devm_request_irq(gdev->drm.dev, gdev->irq, glanda_irq_handler,
> +				       IRQF_SHARED, "glandagpu", gdev);
> +		if (ret) {
> +			drm_err(&gdev->drm, "Failed to request IRQ %d\n",
> +				gdev->irq);
> +			return ret;
> +		}
> +
> +		writel(INT_VSYNC, gdev->mmio_base + REG_IER);

[Severity: Medium]
Is it necessary to unconditionally enable the hardware vsync interrupt here?

The DRM core initializes software vblank state as disabled. Because it is
already considered disabled, the core won't call the disable_vblank()
callback. This means the hardware will fire vsync interrupts continuously
from the moment the driver loads, even when the display is idle.

> +	} else {
> +		drm_warn(&gdev->drm, "No IRQ found, falling back to polling\n");
> +	}

[ ... ]

> +static int glandagpu_probe(struct platform_device *pdev)
> +{

[ ... ]

> +	if (resource_size(res) < GLANDA_MMIO_OFFSET + GLANDA_MMIO_SIZE) {
> +		dev_err(&pdev->dev, "MMIO region too small: %llu bytes, need at least %u\n",
> +			(unsigned long long)resource_size(res),
> +			GLANDA_MMIO_OFFSET + GLANDA_MMIO_SIZE);
> +		return -EINVAL;
> +	}
> +
> +	gdev->vram_phys = res->start;
> +	gdev->vram_base = devm_ioremap(&pdev->dev, res->start, GLANDA_VRAM_SIZE);

[Severity: High]
Will this cause severe CPU stalling during atomic frame updates?

The devm_ioremap() function creates a strongly uncacheable memory mapping.
Since glanda_plane_atomic_update() writes hundreds of thousands of pixels
individually using writel_relaxed(), each write will traverse the bus
separately.

Should this memory be mapped using write-combining (e.g., devm_ioremap_wc())
so the CPU can burst writes efficiently?

> +	gdev->mmio_base = devm_ioremap(&pdev->dev, res->start + GLANDA_MMIO_OFFSET,
> +								   GLANDA_MMIO_SIZE);

[ ... ]

> +static struct platform_driver glandagpu_driver = {
> +	.driver = {
> +		.name = "glandagpu",
> +		.of_match_table = glanda_of_match,
> +	},
> +	.probe = glandagpu_probe,
> +	.remove = glandagpu_remove,
> +};
> +
> +/* PCI probe path for the QEMU test device, real hardware uses platform_driver */
> +static int glandagpu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{

[Severity: Low]
Does this code break the build when the kernel is configured with
CONFIG_DRM_GLANDA=y, CONFIG_COMPILE_TEST=y, and CONFIG_PCI=n?

The Kconfig explicitly allows building without PCI for test coverage, but
functions like pcim_iomap_regions() and pcim_iomap_table() do not have
fallback stubs in the headers when PCI is disabled.

Should the PCI-specific driver code be guarded by #ifdef CONFIG_PCI?

> +	struct glanda_device *gdev;
> +	int ret;
> +
> +	ret = pcim_enable_device(pdev);
> +	if (ret)
> +		return ret;
> +	pci_set_master(pdev);
> +
> +	if (pci_resource_len(pdev, 0) < GLANDA_MMIO_SIZE ||
> +		pci_resource_len(pdev, 1) < GLANDA_VRAM_SIZE) {
> +		dev_err(&pdev->dev, "BAR too small: BAR0=%llu (need %u), BAR1=%llu (need %u)\n",
> +			(unsigned long long)pci_resource_len(pdev, 0), GLANDA_MMIO_SIZE,
> +			(unsigned long long)pci_resource_len(pdev, 1), GLANDA_VRAM_SIZE);
> +		return -EINVAL;
> +	}
> +
> +	ret = pcim_iomap_regions(pdev, BIT(0) | BIT(1), "glandagpu");

[Severity: High]
Similar to the platform probe, does this create a strongly uncacheable
mapping for VRAM?

pcim_iomap_regions() defaults to standard I/O mappings. This will likely
cause the same performance degradation during frame updates.

> +	if (ret)
> +		return ret;

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824195418.17707-1-kieweg.leander@gmail.com?part=2

      reply	other threads:[~2026-08-24 20:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 19:54 [PATCH v3 0/2] drm: Add DRM driver for GlandaGPU (VHDL soft-IP GPU) Leander Kieweg
2026-08-24 19:54 ` [PATCH v3 1/2] dt-bindings: display: Add GlandaGPU binding Leander Kieweg
2026-08-24 19:57   ` sashiko-bot
2026-08-24 19:54 ` [PATCH v3 2/2] drm/glanda: Add initial DRM driver for GlandaGPU Leander Kieweg
2026-08-24 20:07   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260824200733.17EC71F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kieweg.leander@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox