Skip to content

Commit 00b0300

Browse files
Gavin ShanMarc Zyngier
authored andcommitted
KVM: arm64: Drop sort_memblock_regions()
Drop sort_memblock_regions() and avoid sorting the copied memory regions to be ascending order on their base addresses, because the source memory regions should have been sorted correctly when they are added by memblock_add() or its variants. This is generally reverting commit a14307f ("KVM: arm64: Sort the hypervisor memblocks"). No functional changes intended. Signed-off-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Quentin Perret <qperret@google.com> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20250311043718.91004-1-gshan@redhat.com Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent e0ccc45 commit 00b0300

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

arch/arm64/kvm/pkvm.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <asm/kvm_mmu.h>
1111
#include <linux/memblock.h>
1212
#include <linux/mutex.h>
13-
#include <linux/sort.h>
1413

1514
#include <asm/kvm_pkvm.h>
1615

@@ -24,23 +23,6 @@ static unsigned int *hyp_memblock_nr_ptr = &kvm_nvhe_sym(hyp_memblock_nr);
2423
phys_addr_t hyp_mem_base;
2524
phys_addr_t hyp_mem_size;
2625

27-
static int cmp_hyp_memblock(const void *p1, const void *p2)
28-
{
29-
const struct memblock_region *r1 = p1;
30-
const struct memblock_region *r2 = p2;
31-
32-
return r1->base < r2->base ? -1 : (r1->base > r2->base);
33-
}
34-
35-
static void __init sort_memblock_regions(void)
36-
{
37-
sort(hyp_memory,
38-
*hyp_memblock_nr_ptr,
39-
sizeof(struct memblock_region),
40-
cmp_hyp_memblock,
41-
NULL);
42-
}
43-
4426
static int __init register_memblock_regions(void)
4527
{
4628
struct memblock_region *reg;
@@ -52,7 +34,6 @@ static int __init register_memblock_regions(void)
5234
hyp_memory[*hyp_memblock_nr_ptr] = *reg;
5335
(*hyp_memblock_nr_ptr)++;
5436
}
55-
sort_memblock_regions();
5637

5738
return 0;
5839
}

0 commit comments

Comments
 (0)