From: Michael Ellerman Date: Fri, 28 May 2021 23:36:29 +0000 Subject: Re: [PATCH v2] KVM: PPC: Book3S HV: Fix reverse map real-mode address lookup with huge vmalloc Message-Id: <87sg26h1mq.fsf@mpe.ellerman.id.au> List-Id: References: <20210526120005.3432222-1-npiggin@gmail.com> In-Reply-To: <20210526120005.3432222-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nicholas Piggin , kvm-ppc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Nicholas Piggin 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 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