Hypervisor may choose not to enable Guest Translation Shootdown Enable (GTSE) option for the guest. When GTSE isn't ON, the guest OS isn't permitted to use instructions like tblie and tlbsync directly, but is expected to make hypervisor calls to get the TLB flushed.
This series enables the TLB flush routines in the radix code to off-load TLB flushing to hypervisor via the newly proposed hcall H_RPT_INVALIDATE. The specification of this hcall is still evolving while the patchset is posted here for any early comments. To easily check the availability of GTSE, it is made an MMU feature. The OV5 handling and H_REGISTER_PROC_TBL hcall are changed to handle GTSE as an optionally available feature and to not assume GTSE when radix support is available. The actual hcall implementation for KVM isn't included in this patchset. H_RPT_INVALIDATE ================ Syntax: int64 /* H_Success: Return code on successful completion */ /* H_Busy - repeat the call with the same */ /* H_Parameter, H_P2, H_P3, H_P4, H_P5 : Invalid parameters */ hcall(const uint64 H_RPT_INVALIDATE, /* Invalidate RPT translation lookaside information */ uint64 pid, /* PID/LPID to invalidate */ uint64 target, /* Invalidation target */ uint64 type, /* Type of lookaside information */ uint64 pageSizes, /* Page sizes */ uint64 start, /* Start of Effective Address (EA) range (inclusive) */ uint64 end) /* End of EA range (exclusive) */ Invalidation targets (target) ----------------------------- Core MMU 0x01 /* All virtual processors in the partition */ Core local MMU 0x02 /* Current virtual processor */ Nest MMU 0x04 /* All nest/accelerator agents in use by the partition */ A combination of the above can be specified, except core and core local. Type of translation to invalidate (type) --------------------------------------- NESTED 0x0001 /* invalidate nested guest partition-scope */ TLB 0x0002 /* Invalidate TLB */ PWC 0x0004 /* Invalidate Page Walk Cache */ PRT 0x0008 /* Invalidate Process Table Entries if NESTED is clear*/ PAT 0x0008 /* Invalidate Partition Table Entries if NESTED is set*/ A combination of the above can be specified. Page size mask (pages) ---------------------- 4K 0x01 64K 0x02 2M 0x04 1G 0x08 All sizes (-1UL) A combination of the above can be specified. All page sizes can be selected with -1. Semantics: Invalidate radix tree lookaside information matching the parameters given. * Return H_P2, H_P3 or H_P4 if target, type, or pageSizes parameters are different from the defined values. * Return H_PARAMETER if NESTED is set and pid is not a valid nested LPID allocated to this partition * Return H_P5 if (start, end) doesn't form a valid range. Start and end should be a valid Quadrant address and end > start. * Return H_NotSupported if the partition is not in running in radix translation mode. * May invalidate more translation information than requested. * If start = 0 and end = -1, set the range to cover all valid addresses. Else start and end should be aligned to 4kB (lower 11 bits clear). * If NESTED is clear, then invalidate process scoped lookaside information. Else pid specifies a nested LPID, and the invalidation is performed on nested guest partition table and nested guest partition scope real addresses. * If pid = 0 and NESTED is clear, then valid addresses are quadrant 3 and quadrant 0 spaces, Else valid addresses are quadrant 0. * Pages which are fully covered by the range are to be invalidated. Those which are partially covered are considered outside invalidation range, which allows a caller to optimally invalidate ranges that may contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (4): powerpc/mm: Make GTSE an MMU FTR powerpc/prom_init: Ask for Radix GTSE only if supported. powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM Nicholas Piggin (1): powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE arch/powerpc/include/asm/firmware.h | 4 +- arch/powerpc/include/asm/hvcall.h | 27 ++++++- arch/powerpc/include/asm/mmu.h | 4 + arch/powerpc/include/asm/plpar_wrappers.h | 52 +++++++++++++ arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/kernel/prom_init.c | 13 ++-- arch/powerpc/kvm/book3s_64_mmu_radix.c | 27 +++++-- arch/powerpc/kvm/book3s_hv_nested.c | 13 +++- arch/powerpc/mm/book3s64/radix_tlb.c | 95 +++++++++++++++++++++-- arch/powerpc/mm/init_64.c | 5 +- arch/powerpc/platforms/pseries/firmware.c | 1 + arch/powerpc/platforms/pseries/lpar.c | 8 +- 12 files changed, 224 insertions(+), 26 deletions(-) -- 2.21.3