]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-pci: skip CMB blocks incompatible with PCI P2P DMA
authorIcenowy Zheng <uwu@icenowy.me>
Wed, 12 Feb 2025 17:04:44 +0000 (01:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:32:03 +0000 (14:32 +0200)
commit35d7887ab2d19fa2f3ffd609631be950e91275a2
tree21b303dcc61971209fd4b7417115b2b29cb887a2
parent7b860d9a4d561fc2a1d6678964690cba33aae74c
nvme-pci: skip CMB blocks incompatible with PCI P2P DMA

[ Upstream commit 56cf7ef0d490b28fad8f8629fc135c5ab7c9f54e ]

The PCI P2PDMA code will register the CMB block to the memory
hot-plugging subsystem, which have an alignment requirement. Memory
blocks that do not satisfy this alignment requirement (usually 2MB) will
lead to a WARNING from memory hotplugging.

Verify the CMB block's address and size against the alignment and only
try to send CMB blocks compatible with it to prevent this warning.

Tested on Intel DC D4502 SSD, which has a 512K CMB block that is too
small for memory hotplugging (thus PCI P2PDMA).

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/pci.c