linux/arch/powerpc/include/asm
Bharata B Rao f0c6fbbb90 KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE
H_RPT_INVALIDATE does two types of TLB invalidations:

1. Process-scoped invalidations for guests when LPCR[GTSE]=0.
   This is currently not used in KVM as GTSE is not usually
   disabled in KVM.
2. Partition-scoped invalidations that an L1 hypervisor does on
   behalf of an L2 guest. This is currently handled
   by H_TLB_INVALIDATE hcall and this new replaces the old that.

This commit enables process-scoped invalidations for L1 guests.
Support for process-scoped and partition-scoped invalidations
from/for nested guests will be added separately.

Process scoped tlbie invalidations from L1 and nested guests
need RS register for TLBIE instruction to contain both PID and
LPID.  This patch introduces primitives that execute tlbie
instruction with both PID and LPID set in prepartion for
H_RPT_INVALIDATE hcall.

A description of H_RPT_INVALIDATE follows:

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 id,        /* PID/LPID to invalidate */
      uint64 target,    /* Invalidation target */
      uint64 type,      /* Type of lookaside information */
      uint64 pg_sizes,  /* 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 caching of Process Table
			Entries if NESTED is clear */
PAT          0x0008  /* Invalidate caching of 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.

Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210621085003.904767-4-bharata@linux.ibm.com
2021-06-21 22:54:27 +10:00
..
book3s powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def 2021-06-21 22:48:18 +10:00
nohash powerpc/64: Fix the definition of the fixmap area 2021-04-22 20:59:15 +10:00
vdso powerpc/vdso: Add support for time namespaces 2021-04-14 23:04:44 +10:00
8xx_immap.h
accounting.h
agp.h
archrandom.h
asm-compat.h
asm-const.h powerpc/uaccess: Don't use "m<>" constraint with GCC 4.9 2020-10-22 14:26:09 +11:00
asm-offsets.h
asm-prototypes.h KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C 2021-06-10 22:12:13 +10:00
async_tx.h
atomic.h powerpc: Fix update form addressing in inline assembly 2020-12-04 22:13:19 +11:00
backlight.h
barrier.h powerpc/qspinlock: Use generic smp_cond_load_relaxed 2021-03-29 12:48:46 +11:00
bitops.h powerpc/bitops: Fix possible undefined behaviour with fls() and fls64() 2020-11-19 14:50:13 +11:00
bootx.h
btext.h
bug.h powerpc: clean up do_page_fault 2021-04-14 23:04:44 +10:00
bugs.h
cache.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
cacheflush.h powerpc/mem: Inline flush_dcache_page() 2021-04-14 23:04:19 +10:00
cell-pmu.h
cell-regs.h
checksum.h powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10 2020-12-15 22:50:11 +11:00
clocksource.h powerpc/vdso: Prepare for switching VDSO to generic C implementation. 2020-12-04 01:01:10 +11:00
cmpxchg.h powerpc: Remove IBM405 Erratum #77 2020-05-28 23:24:36 +10:00
code-patching-asm.h
code-patching.h powerpc/64s: Use symbolic macros for function entry encoding 2021-03-10 07:58:04 +11:00
compat.h compat: lift compat_s64 and compat_u64 to <asm-generic/compat.h> 2020-09-17 13:00:46 -04:00
context_tracking.h
copro.h
cpm.h
cpm1.h powerpc/8xx: Fix early debug when SMC1 is relocated 2020-12-09 17:00:54 +11:00
cpm2.h powerpc: Spelling/typo fixes 2021-04-08 21:17:42 +10:00
cpu_has_feature.h powerpc: Force inlining of cpu_has_feature() to avoid build failure 2021-03-14 20:32:24 +11:00
cpu_setup_power.h powerpc/64s: Convert some cpu_setup() and cpu_restore() functions to C 2020-11-19 14:49:56 +11:00
cpufeature.h
cpuidle.h
cputable.h arch: powerpc: Stop building and using oprofile 2021-01-29 10:05:51 +05:30
cputhreads.h KVM: PPC: Book3S HV: Fix TLB management on SMT8 POWER9 and POWER10 processors 2021-06-21 09:22:34 +10:00
cputime.h powerpc/64: move account_stolen_time into its own function 2021-02-09 00:10:49 +11:00
crashdump-ppc64.h powerpc/kexec_file: Setup backup region for kdump kernel 2020-07-29 23:47:54 +10:00
current.h
dbdma.h
dbell.h powerpc: Inline doorbell sending functions 2020-07-29 21:02:09 +10:00
dcr-generic.h
dcr-mmio.h
dcr-native.h powerpc/4xx: Fix build errors from mfdcr() 2021-03-01 12:33:31 +11:00
dcr-regs.h
dcr.h
debug.h powerpc: convert interrupt handlers to use wrappers 2021-02-09 00:02:12 +11:00
debugfs.h
delay.h powerpc/time: Avoid using get_tbl() and get_tbu() internally 2020-10-08 21:17:15 +11:00
device.h IOMMU Updates for Linux v5.9 2020-08-11 14:13:24 -07:00
disassemble.h
dma-direct.h dma-direct: rename and cleanup __phys_to_dma 2020-09-11 09:14:43 +02:00
dma.h
drmem.h powerpc/drmem: Make lmb_size 64 bit 2020-10-08 12:50:52 +11:00
dt_cpu_ftrs.h
dtl.h powerpc64: Break asm/percpu.h vs spinlock_types.h dependency 2020-07-10 12:00:01 +02:00
edac.h
eeh_event.h
eeh.h powerpc/eeh: Delete eeh_pe->config_addr 2020-10-07 22:34:47 +11:00
ehv_pic.h
elf.h powerpc: Remove ucache_bsize 2020-12-05 21:49:52 +11:00
elfnote.h
emergency-restart.h
emulated_ops.h
epapr_hcalls.h powerpc/epapr_hcalls.h: delete duplicated words 2020-07-27 00:01:31 +10:00
exception-64e.h powerpc/64e: Drop dead BOOK3E_MMU_TLB_STATS code 2020-07-29 21:08:12 +10:00
exception-64s.h KVM: PPC: Book3S 64: Move hcall early register setup to KVM 2021-06-10 22:12:12 +10:00
exec.h
extable.h
fadump-internal.h
fadump.h
fb.h
feature-fixups.h powerpc/64s: fix scv entry fallback flush vs interrupt 2021-01-20 15:58:19 +11:00
firmware.h powerpc: remove unneeded semicolons 2021-02-09 00:10:50 +11:00
fixmap.h powerpc/64: Fix the definition of the fixmap area 2021-04-22 20:59:15 +10:00
floppy.h
fs_pd.h
fsl_85xx_cache_sram.h
fsl_gtm.h
fsl_hcalls.h
fsl_lbc.h
fsl_pamu_stash.h iommu/fsl_pamu: replace DOMAIN_ATTR_FSL_PAMU_STASH with a direct call 2021-04-07 10:56:52 +02:00
fsl_pm.h
ftrace.h tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
futex.h powerpc/futex: Switch to user_access block 2021-03-26 23:19:43 +11:00
grackle.h
hardirq.h powerpc/64s: Move HMI IRQ stat from percpu variable to paca. 2020-07-29 23:47:53 +10:00
head-64.h powerpc/64s: system call support for scv/rfscv instructions 2020-07-22 23:00:27 +10:00
heathrow.h
highmem.h powerpc/mm/highmem: use __set_pte_at() for kmap_local() 2021-01-24 10:34:53 -08:00
hmi.h
hugetlb.h powerpc/mm: Enable compound page check for both THP and HugeTLB 2021-02-11 23:35:06 +11:00
hvcall.h KVM: PPC: Book3S HV: Fix comments of H_RPT_INVALIDATE arguments 2021-06-21 22:48:18 +10:00
hvconsole.h powerpc/pseries: Move hvc_vio_init_early() prototype to shared location 2021-03-24 14:09:30 +11:00
hvcserver.h
hvsi.h
hw_breakpoint.h powerpc/watchpoint: Fix exception handling for CONFIG_HAVE_HW_BREAKPOINT=N 2020-09-15 22:13:20 +10:00
hw_irq.h powerpc/irq: Add stub irq_soft_mask_return() for PPC32 2021-02-11 23:35:09 +11:00
hydra.h powerpc/chrp: Make hydra_init() static 2021-03-24 14:09:29 +11:00
i8259.h
ibmebus.h
icswx.h powerpc/nx: Don't pack struct coprocessor_request_block 2020-08-25 01:31:33 +10:00
ide.h
idle.h
imc-pmu.h powerpc/perf: Add kernel support for new MSR[HV PR] bits in trace-imc 2020-07-16 13:12:46 +10:00
immap_cpm2.h
inst.h powerpc: Rename probe_kernel_read_inst() 2021-04-21 22:52:33 +10:00
interrupt.h powerpc/64s: Make NMI record implicitly soft-masked code as irqs disabled 2021-05-14 17:28:52 +10:00
io_event_irq.h
io-defs.h
io-workarounds.h
io.h mm: remove xlate_dev_kmem_ptr() 2021-05-07 00:26:34 -07:00
iommu.h dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
ipic.h
irq_work.h
irq.h powerpc/irq: Inline call_do_irq() and call_do_softirq() 2021-03-29 13:22:17 +11:00
irqflags.h
isa-bridge.h
jump_label.h powerpc: Switch to relative jump labels 2021-04-03 21:22:21 +11:00
kasan.h powerpc/kasan: Fix shadow start address with modules 2021-04-25 21:29:04 +10:00
Kbuild powerpc/syscalls: switch to generic syscalltbl.sh 2021-04-14 23:04:16 +10:00
kdebug.h
kdump.h
kexec_ranges.h powerpc/kexec_file: Avoid stomping memory used by special regions 2020-07-29 23:47:53 +10:00
kexec.h powerpc/kexec_file: Restore FDT size estimation for kdump kernel 2021-03-11 09:53:38 -07:00
keylargo.h
kfence.h powerpc: Enable KFENCE for PPC32 2021-03-24 14:09:30 +11:00
kgdb.h
kprobes.h
kup.h powerpc/32: Manage KUAP in C 2021-03-29 13:22:11 +11:00
kvm_asm.h KVM: PPC: Book3S HV P9: implement hash host / hash guest support 2021-06-10 22:12:15 +10:00
kvm_book3s_32.h
kvm_book3s_64.h KVM: PPC: Book3S HV P9: inline kvmhv_load_hv_regs_and_go into __kvmhv_vcpu_entry_p9 2021-06-10 22:12:13 +10:00
kvm_book3s_asm.h KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support 2021-02-10 14:31:08 +11:00
kvm_book3s_uvmem.h KVM: PPC: Book3S HV: Migrate hot plugged memory 2020-07-28 12:34:52 +10:00
kvm_book3s.h KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks 2021-05-06 00:25:42 +10:00
kvm_booke_hv_asm.h
kvm_booke.h powerpc: Inline doorbell sending functions 2020-07-29 21:02:09 +10:00
kvm_fpu.h
kvm_guest.h powerpc: Reintroduce is_kvm_guest() as a fast-path check 2020-12-04 01:01:22 +11:00
kvm_host.h KVM: PPC: Book3S HV: Remove support for dependent threads mode on P9 2021-06-10 22:12:14 +10:00
kvm_para.h powerpc: Reintroduce is_kvm_guest() as a fast-path check 2020-12-04 01:01:22 +11:00
kvm_ppc.h KVM: PPC: Book3S HV: Remove virt mode checks from real mode handlers 2021-06-10 22:12:14 +10:00
libata-portmap.h
linkage.h
livepatch.h livepatch: Use the default ftrace_ops instead of REGS when ARGS is available 2020-11-13 12:15:28 -05:00
local.h
lppaca.h powerpc64: Break asm/percpu.h vs spinlock_types.h dependency 2020-07-10 12:00:01 +02:00
lv1call.h
machdep.h powerpc/pci: Add ppc_md.discover_phbs() 2021-02-03 09:46:36 +11:00
macio.h
mc146818rtc.h
mce.h powerpc/mce: Remove per cpu variables from MCE handlers 2021-01-31 22:35:49 +11:00
mediabay.h
mem_encrypt.h
membarrier.h
mman.h powerpc/64s: Disallow PROT_SAO in LPARs by default 2020-08-24 14:12:54 +10:00
mmiowb.h
mmu_context.h KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE 2021-06-21 22:54:27 +10:00
mmu.h powerpc: Force inlining of mmu_has_feature to fix build failure 2021-03-02 22:41:50 +11:00
mmzone.h mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports 2020-11-22 10:48:22 -08:00
module.h powerpc updates for 5.8 2020-06-05 12:39:30 -07:00
module.lds.h kbuild: preprocess module linker script 2020-09-25 00:36:41 +09:00
mpc5xxx.h
mpc6xx.h
mpc52xx_psc.h
mpc52xx.h
mpc85xx.h
mpc5121.h
mpc8260.h
mpic_msgr.h
mpic_timer.h
mpic.h
msi_bitmap.h
nmi.h powerpc: convert interrupt handlers to use wrappers 2021-02-09 00:02:12 +11:00
nvram.h
ohare.h
opal-api.h powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_EOI_FW 2020-12-11 09:53:10 +11:00
opal.h powerpc/powernv: remove the nvlink support 2021-05-02 23:35:32 +10:00
paca.h powerpc/64s: Remove EXSLB interrupt save area 2021-02-11 23:35:05 +11:00
page_32.h powerpc/32s: Cleanup around PTE_FLAGS_OFFSET in hash_low.S 2020-12-09 23:48:14 +11:00
page_64.h
page.h powerpc/32: Set user/kernel boundary at TASK_SIZE instead of PAGE_OFFSET 2020-07-27 00:01:30 +10:00
paravirt.h powerpc/pseries: Fix hcall tracing recursion in pv queued spinlocks 2021-05-12 11:07:38 +10:00
parport.h
pasemi_dma.h
pci-bridge.h powerpc/powernv: remove the nvlink support 2021-05-02 23:35:32 +10:00
pci.h powerpc/powernv: remove the nvlink support 2021-05-02 23:35:32 +10:00
percpu.h powerpc: Fix circular dependency between percpu.h and mmu.h 2020-08-04 23:15:59 +10:00
perf_event_fsl_emb.h
perf_event_server.h powerpc/perf: Expose processor pipeline stage cycles using PERF_SAMPLE_WEIGHT_STRUCT 2021-04-20 14:22:23 +10:00
perf_event.h powerpc/perf: Expose Performance Monitor Counter SPR's as part of extended regs 2021-02-09 01:09:44 +11:00
pgalloc.h
pgtable-be-types.h
pgtable-types.h
pgtable.h powerpc: Remove duplicate includes 2021-03-24 14:09:30 +11:00
pkeys.h powerpc/pkeys: Remove unused code 2021-02-09 01:09:44 +11:00
plpar_wrappers.h powerpc/pseries: use notrace hcall variant for H_CEDE idle 2021-05-12 11:07:38 +10:00
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h
pnv-ocxl.h ocxl: Initiate a TLB invalidate command 2020-12-04 01:01:30 +11:00
pnv-pci.h
powernv.h
ppc_asm.h powerpc/64e/interrupt: use new interrupt return 2021-04-14 23:04:20 +10:00
ppc-opcode.h powerpc/ebpf32: Use standard function call for functions within 32M distance 2021-04-21 22:52:33 +10:00
ppc-pci.h powerpc/pci: Remove unimplemented prototypes 2021-02-11 23:35:36 +11:00
ppc4xx.h
probes.h
processor.h powerpc/64s: power4 nap fixup in C 2021-04-08 21:17:45 +10:00
prom.h powerpc: Add POWER10 architected mode 2020-06-02 20:59:20 +10:00
ps3.h powerpc/ps3: make system bus's remove and shutdown callbacks return void 2020-12-04 01:01:22 +11:00
ps3av.h
ps3gpu.h
ps3stor.h
pte-walk.h
ptrace.h powerpc: move norestart trap flag to bit 0 2021-04-14 23:04:44 +10:00
qspinlock_paravirt.h powerpc/pseries: Implement paravirt qspinlocks for SPLPAR 2020-07-27 00:01:29 +10:00
qspinlock.h powerpc/qspinlock: Use generic smp_cond_load_relaxed 2021-03-29 12:48:46 +11:00
reg_8xx.h
reg_a2.h
reg_booke.h powerpc/32: Handle bookE debugging in C in syscall entry/exit 2021-02-11 23:35:12 +11:00
reg_fsl_emb.h
reg.h powerpc/32: Use r2 in wrtspr() instead of r0 2021-04-21 22:52:32 +10:00
rheap.h
rio.h
rtas-types.h powerpc/rtas: remove unused rtas_suspend_me_data 2020-12-08 21:41:02 +11:00
rtas.h powerpc/rtas: rename RTAS_RMOBUF_MAX to RTAS_USER_REGION_SIZE 2021-04-14 23:04:16 +10:00
runlatch.h
seccomp.h powerpc: Enable seccomp architecture tracking 2020-11-20 11:16:35 -08:00
sections.h maccess: make get_kernel_nofault() check for minimal type compatibility 2020-06-18 12:10:37 -07:00
secure_boot.h
security_features.h powerpc/64s: flush L1D after user accesses 2020-11-19 23:47:18 +11:00
secvar.h
serial.h
setjmp.h
setup.h powerpc: remove unneeded semicolons 2021-02-09 00:10:50 +11:00
sfp-machine.h
shmparam.h
signal.h
simple_spinlock_types.h powerpc: Move spinlock implementation to simple_spinlock 2020-07-26 23:34:26 +10:00
simple_spinlock.h powerpc/spinlock: Unserialize spin_is_locked 2021-03-26 23:19:43 +11:00
slice.h
smp.h powerpc/smp: Cache CPU to chip lookup 2021-04-17 10:40:51 +10:00
smu.h powerpc/smu.h: delete duplicated word 2020-07-27 00:01:32 +10:00
sparsemem.h mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports 2020-11-22 10:48:22 -08:00
spinlock_types.h powerpc/64s: Implement queued spinlocks and rwlocks 2020-07-27 00:01:23 +10:00
spinlock.h powerpc/spinlock: Define smp_mb__after_spinlock only once 2021-03-26 23:19:43 +11:00
spu_csa.h
spu_info.h
spu_priv1.h
spu.h arch: powerpc: Stop building and using oprofile 2021-01-29 10:05:51 +05:30
sstep.h Merge branch 'scv' support into next 2020-07-23 17:43:44 +10:00
stackprotector.h
stacktrace.h
string.h x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
svm.h powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory 2020-09-14 23:07:14 +10:00
swab.h
swiotlb.h
switch_to.h powerpc: Fix missing declaration of [en/dis]able_kernel_vsx() 2021-03-10 11:15:00 +11:00
synch.h powerpc/64s: Add cp_abort after tlbiel to invalidate copy-buffer address 2020-10-06 23:22:23 +11:00
syscall.h
syscalls.h
task_size_32.h
task_size_64.h
tce.h
termios.h
thread_info.h powerpc/64s: power4 nap fixup in C 2021-04-08 21:17:45 +10:00
time.h KVM: PPC: Book3S HV P9: Reduce irq_work vs guest decrementer races 2021-06-10 22:12:13 +10:00
timex.h powerpc/time: Move timebase functions into new asm/vdso/timebase.h 2020-12-04 01:01:10 +11:00
tlb.h powerpc/32s: Inline flush_hash_entry() 2020-12-09 16:46:56 +11:00
tlbflush.h
tm.h
topology.h Revert "powerpc/topology: Update topology_core_cpumask" 2021-04-17 10:40:51 +10:00
trace_clock.h
trace.h
tsi108_irq.h
tsi108_pci.h
tsi108.h
types.h
uaccess.h powerpc/uaccess: Fix __get_user() with CONFIG_CC_HAS_ASM_GOTO_OUTPUT 2021-05-12 11:07:39 +10:00
udbg.h
uic.h
ultravisor-api.h
ultravisor.h
unaligned.h
uninorth.h
unistd.h powerpc/syscalls: Use sys_old_select() in ppc_select() 2021-03-26 23:19:42 +11:00
uprobes.h
user.h
vas.h
vdso_datapage.h powerpc/vdso: Add support for time namespaces 2021-04-14 23:04:44 +10:00
vdso.h powerpc/vdso: Cleanup vdso.h 2020-12-04 01:01:19 +11:00
vermagic.h
vga.h
vio.h powerpc/pseries: Add shutdown() to vio_driver and vio_bus 2021-04-20 14:22:24 +10:00
vmalloc.h mm/vmalloc: provide fallback arch huge vmap support functions 2021-04-30 11:20:40 -07:00
word-at-a-time.h
xics.h
xive-regs.h
xive.h powerpc/xive: Simplify the dump of XIVE interrupts under xmon 2021-04-14 23:04:14 +10:00
xmon.h powerpc: remove unneeded semicolons 2021-02-09 00:10:50 +11:00
xor_altivec.h
xor.h