Re: [PATCH 2/2] nvme-pci: skip CMB blocks incompatible with PCI P2P DMA
From: Icenowy Zheng
Date: Thu Feb 13 2025 - 09:19:31 EST
在 2025-02-13星期四的 06:58 +0100,Christoph Hellwig写道:
> 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.
I am only moving around existing code here.
Maybe I should refactor the code here and then move it?
>
> > + 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!
>