Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78809a68 authored by Radim Krčmář's avatar Radim Krčmář
Browse files
KVM/PPC update for 4.14

There are various minor fixes and cleanups.  The only new feature is
that we now export information about storage key support to userspace,
so it can advertise it to the guest.

I have pulled in Michael Ellerman's topic/ppc-kvm branch from the
powerpc tree to get a couple of fixes that touch both KVM PPC code and
other PPC code.  That's why there is some arch/powerpc stuff in the
diffstat that isn't arch/powerpc/kvm.
parents 082d3900 43f6b0cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -104,6 +104,7 @@
#define HPTE_R_C		ASM_CONST(0x0000000000000080)
#define HPTE_R_C		ASM_CONST(0x0000000000000080)
#define HPTE_R_R		ASM_CONST(0x0000000000000100)
#define HPTE_R_R		ASM_CONST(0x0000000000000100)
#define HPTE_R_KEY_LO		ASM_CONST(0x0000000000000e00)
#define HPTE_R_KEY_LO		ASM_CONST(0x0000000000000e00)
#define HPTE_R_KEY		(HPTE_R_KEY_LO | HPTE_R_KEY_HI)


#define HPTE_V_1TB_SEG		ASM_CONST(0x4000000000000000)
#define HPTE_V_1TB_SEG		ASM_CONST(0x4000000000000000)
#define HPTE_V_VRMA_MASK	ASM_CONST(0x4001ffffff000000)
#define HPTE_V_VRMA_MASK	ASM_CONST(0x4001ffffff000000)
+4 −0
Original line number Original line Diff line number Diff line
@@ -104,6 +104,10 @@ struct kvmppc_host_state {
	u8 napping;
	u8 napping;


#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
	/*
	 * hwthread_req/hwthread_state pair is used to pull sibling threads
	 * out of guest on pre-ISAv3.0B CPUs where threads share MMU.
	 */
	u8 hwthread_req;
	u8 hwthread_req;
	u8 hwthread_state;
	u8 hwthread_state;
	u8 host_ipi;
	u8 host_ipi;
+1 −9
Original line number Original line Diff line number Diff line
@@ -66,16 +66,8 @@ extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
#define pmd_large(pmd)		0
#define pmd_large(pmd)		0
#endif
#endif
pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
				   bool *is_thp, unsigned *shift);
static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
					       bool *is_thp, unsigned *shift)
{
	VM_WARN(!arch_irqs_disabled(),
		"%s called with irq enabled\n", __func__);
	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
}


/* can we use this in kvm */
unsigned long vmalloc_to_phys(void *vmalloc_addr);
unsigned long vmalloc_to_phys(void *vmalloc_addr);


void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
+35 −0
Original line number Original line Diff line number Diff line
#ifndef _ASM_POWERPC_PTE_WALK_H
#define _ASM_POWERPC_PTE_WALK_H

#include <linux/sched.h>

/* Don't use this directly */
extern pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
			       bool *is_thp, unsigned *hshift);

static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea,
				    bool *is_thp, unsigned *hshift)
{
	VM_WARN(!arch_irqs_disabled(), "%s called with irq enabled\n", __func__);
	return __find_linux_pte(pgdir, ea, is_thp, hshift);
}

static inline pte_t *find_init_mm_pte(unsigned long ea, unsigned *hshift)
{
	pgd_t *pgdir = init_mm.pgd;
	return __find_linux_pte(pgdir, ea, NULL, hshift);
}
/*
 * This is what we should always use. Any other lockless page table lookup needs
 * careful audit against THP split.
 */
static inline pte_t *find_current_mm_pte(pgd_t *pgdir, unsigned long ea,
					 bool *is_thp, unsigned *hshift)
{
	VM_WARN(!arch_irqs_disabled(), "%s called with irq enabled\n", __func__);
	VM_WARN(pgdir != current->mm->pgd,
		"%s lock less page table lookup called on wrong mm\n", __func__);
	return __find_linux_pte(pgdir, ea, is_thp, hshift);
}

#endif /* _ASM_POWERPC_PTE_WALK_H */
+2 −2
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@
#include <asm/machdep.h>
#include <asm/machdep.h>
#include <asm/ppc-pci.h>
#include <asm/ppc-pci.h>
#include <asm/rtas.h>
#include <asm/rtas.h>
#include <asm/pte-walk.h>




/** Overview:
/** Overview:
@@ -352,8 +353,7 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
	 * worried about _PAGE_SPLITTING/collapse. Also we will not hit
	 * worried about _PAGE_SPLITTING/collapse. Also we will not hit
	 * page table free, because of init_mm.
	 * page table free, because of init_mm.
	 */
	 */
	ptep = __find_linux_pte_or_hugepte(init_mm.pgd, token,
	ptep = find_init_mm_pte(token, &hugepage_shift);
					   NULL, &hugepage_shift);
	if (!ptep)
	if (!ptep)
		return token;
		return token;
	WARN_ON(hugepage_shift);
	WARN_ON(hugepage_shift);
Loading