[PATCH v2] KVM: PPC: Book3S HV: Fix reverse map real-mode address lookup with huge vmalloc
Michael Ellerman
mpe at ellerman.id.au
Sat May 29 09:36:29 AEST 2021
Nicholas Piggin <npiggin at gmail.com> writes:
> real_vmalloc_addr() does not currently work for huge vmalloc, which is
> what the reverse map can be allocated with for radix host, hash guest.
>
> Extract the hugepage aware equivalent from eeh code into a helper, and
> convert existing sites including this one to use it.
>
> Fixes: 8abddd968a30 ("powerpc/64s/radix: Enable huge vmalloc mappings")
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
I changed the subject to "powerpc: ..." now that it's not just a KVM patch.
...
> diff --git a/arch/powerpc/kernel/io-workarounds.c b/arch/powerpc/kernel/io-workarounds.c
> index 51bbaae94ccc..ddba8761e58c 100644
> --- a/arch/powerpc/kernel/io-workarounds.c
> +++ b/arch/powerpc/kernel/io-workarounds.c
> @@ -65,22 +65,13 @@ struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
> bus = &iowa_busses[token - 1];
> else {
> unsigned long vaddr, paddr;
> - pte_t *ptep;
>
> vaddr = (unsigned long)PCI_FIX_ADDR(addr);
> if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END)
> return NULL;
> - /*
> - * We won't find huge pages here (iomem). Also can't hit
> - * a page table free due to init_mm
> - */
> - ptep = find_init_mm_pte(vaddr, &hugepage_shift);
> - if (ptep == NULL)
> - paddr = 0;
> - else {
> - WARN_ON(hugepage_shift);
> - paddr = pte_pfn(*ptep) << PAGE_SHIFT;
> - }
> +
> + paddr = ppc_find_vmap_phys(vaddr);
> +
> bus = iowa_pci_find(vaddr, paddr);
>
> if (bus == NULL)
This needed:
diff --git a/arch/powerpc/kernel/io-workarounds.c b/arch/powerpc/kernel/io-workarounds.c
index ddba8761e58c..c877f074d174 100644
--- a/arch/powerpc/kernel/io-workarounds.c
+++ b/arch/powerpc/kernel/io-workarounds.c
@@ -55,7 +55,6 @@ static struct iowa_bus *iowa_pci_find(unsigned long vaddr, unsigned long paddr)
#ifdef CONFIG_PPC_INDIRECT_MMIO
struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
{
- unsigned hugepage_shift;
struct iowa_bus *bus;
int token;
cheers
More information about the Linuxppc-dev
mailing list