nitro_enclaves: Merge contiguous physical memory regions
authorLongpeng <longpeng2@huawei.com>
Sun, 7 Nov 2021 14:09:14 +0000 (22:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 15:11:09 +0000 (16:11 +0100)
commitf6bdc0aafe88cf4c727e7bb00da1f480ecd80bee
tree74c4010abe5c7b84631311a34e1d0efa6cc36551
parentdc74e8cf2324ad61b050a55ec0ffa9db6f4fce33
nitro_enclaves: Merge contiguous physical memory regions

There can be cases when there are more memory regions that need to be
set for an enclave than the maximum supported number of memory regions
per enclave. One example can be when the memory regions are backed by 2
MiB hugepages (the minimum supported hugepage size).

Let's merge the adjacent regions if they are physically contiguous. This
way the final number of memory regions is less than before merging and
could potentially avoid reaching maximum.

Reviewed-by: Andra Paraschiv <andraprs@amazon.com>
Signed-off-by: Longpeng <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20211107140918.2106-2-longpeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/virt/nitro_enclaves/ne_misc_dev.c