[PATCH 2/2] nvme-pci: skip CMB blocks incompatible with PCI P2P DMA

Christoph Hellwig hch at lst.de
Wed Feb 12 21:58:25 PST 2025


On Thu, Feb 13, 2025 at 01:04:44AM +0800, Icenowy Zheng wrote:
> +	/*
> +	 * Controllers may support a CMB size larger than their BAR,
> +	 * for example, due to being behind a bridge. Reduce the CMB to
> +	 * the reported size of the BAR
> +	 */
> +	if (size > bar_size - offset)
> +		size = bar_size - offset;

Nit: use up the full 80 characters for the comment, and maybe switch
the above expression to use the min() helper.

> +	if (!IS_ALIGNED(size, memremap_compat_align()) ||
> +	    !IS_ALIGNED(pci_resource_start(pdev, bar),
> +			memremap_compat_align()))

These compat names looked odd to me, but it looks like they are indeed
the proper interface here.  So modulo the little style things above
this looks good, thanks a lot!




More information about the Linux-nvme mailing list