[DragonFlyBSD - Bug #3455] drm: pci_set_dma_mask() always fails ("Can't set DMA mask/consistent mask (-5)")

liweitianux bugtracker-admin at leaf.dragonflybsd.org
Thu Oct 22 02:53:03 PDT 2026


Issue #3455 has been updated by liweitianux.


This is at least better than the original code. However, do we need to actually implement the two compat stubs?

I just took a look at the FreeBSD source and they have:

<pre><code class="c">
// sys/compat/linuxkpi/common/include/linux/dma-mapping.h

static inline int
dma_supported(struct device *dev, u64 dma_mask)
{

	/* XXX busdma takes care of this elsewhere. */
	return (1);
}

static inline int
dma_set_mask(struct device *dev, u64 dma_mask)
{

	if (!dev->dma_priv || !dma_supported(dev, dma_mask))
		return -EIO;

	return (linux_dma_tag_init(dev, dma_mask));
}

static inline int
dma_set_coherent_mask(struct device *dev, u64 dma_mask)
{

	if (!dev->dma_priv || !dma_supported(dev, dma_mask))
		return -EIO;

	return (linux_dma_tag_init_coherent(dev, dma_mask));
}

static inline int
dma_set_mask_and_coherent(struct device *dev, u64 dma_mask)
{
	int r;

	r = dma_set_mask(dev, dma_mask);
	if (r == 0)
		dma_set_coherent_mask(dev, dma_mask);
	return (r);
}
</code></pre>


----------------------------------------
Bug #3455: drm: pci_set_dma_mask() always fails ("Can't set DMA mask/consistent mask (-5)")
http://bugs.dragonflybsd.org/issues/3455#change-14894

* Author: sigttou
* Status: New
* Priority: Normal
* Category: Driver
* Target version: 6.6
* Start date: 2026-10-22
----------------------------------------
The drm compat functions @pci_set_dma_mask()@ and @pci_set_consistent_dma_mask()@ return @-EIO@ unconditionally. Every boot with i915
on gen8+ logs @[drm:gen8_gmch_probe] ERROR Can't set DMA mask/consistent mask (-5)@.

Accept a requested mask when it covers the installed memory (@ptoa(Maxmem)@) and, for the consistent mask, when it is at least 32 bits.
Otherwise return @-EIO@ as before, so drivers still get an error on machines whose memory exceeds what the device can address.


---Files--------------------------------
0001-drm-implement-pci_set_dma_mask-and-pci_set_consisten.patch (1.8 KB)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account


More information about the Bugs mailing list