bus/pci: align next mapping address on page boundary
authorWangyu (Eric) <seven.wangyu@huawei.com>
Wed, 13 Nov 2019 07:17:30 +0000 (07:17 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 14 Nov 2019 13:17:48 +0000 (14:17 +0100)
commitd25ab4b7f128610cb5310b424c1f608686173f13
tree1f32db1049928d6800aba86653163d67ce65b3db
parent08a234788ee548796fd6b394c7e897a2bf1df1b3
bus/pci: align next mapping address on page boundary

Currently, the next address picked by PCI mapping infrastructure
may be page-unaligned due to BAR length being smaller than page size.
This leads to a situation where the requested map address is invalid,
resulting in mmap() call returning an arbitrary address,
which will later interfere with device BAR mapping in secondary processes.

Fix it by always aligning the next requested address on page boundary.

Fixes: c752998b5e2e ("pci: introduce library and driver")
Cc: stable@dpdk.org
Signed-off-by: Xiaofeng Deng <dengxiaofeng@huawei.com>
Signed-off-by: Wangyu (Eric) <seven.wangyu@huawei.com>
Acked-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Gavin Hu <gavin.hu@arm.com>
drivers/bus/pci/linux/pci_uio.c
drivers/bus/pci/linux/pci_vfio.c