linux/arch/powerpc/kvm
Greg Kurz 5706d14d2a KVM: PPC: Book3S HV: XICS: Replace the 'destroy' method by a 'release' method
Similarly to what was done with XICS-on-XIVE and XIVE native KVM devices
with commit 5422e95103 ("KVM: PPC: Book3S HV: XIVE: Replace the 'destroy'
method by a 'release' method"), convert the historical XICS KVM device to
implement the 'release' method. This is needed to run nested guests with
an in-kernel IRQ chip. A typical POWER9 guest can select XICS or XIVE
during boot, which requires to be able to destroy and to re-create the
KVM device. Only the historical XICS KVM device is available under pseries
at the current time and it still uses the legacy 'destroy' method.

Switching to 'release' means that vCPUs might still be running when the
device is destroyed. In order to avoid potential use-after-free, the
kvmppc_xics structure is allocated on first usage and kept around until
the VM exits. The same pointer is used each time a KVM XICS device is
being created, but this is okay since we only have one per VM.

Clear the ICP of each vCPU with vcpu->mutex held. This ensures that the
next time the vCPU resumes execution, it won't be going into the XICS
code anymore.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2020-09-03 14:12:48 +10:00
..
book3s.c KVM: PPC: Book3S HV: XICS: Replace the 'destroy' method by a 'release' method 2020-09-03 14:12:48 +10:00
book3s.h KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
book3s_32_mmu.c KVM: PPC: Use fallthrough; 2020-03-19 16:39:52 +11:00
book3s_32_mmu_host.c KVM: PPC: Book3S PR: Move kvmppc_mmu_init() into PR KVM 2020-03-19 16:39:52 +11:00
book3s_32_sr.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_mmu.c KVM: PPC: Use fallthrough; 2020-03-19 16:39:52 +11:00
book3s_64_mmu_host.c KVM: PPC: Book3S PR: Move kvmppc_mmu_init() into PR KVM 2020-03-19 16:39:52 +11:00
book3s_64_mmu_hv.c KVM: PPC: Book3S HV: Increase KVMPPC_NR_LPIDS on POWER8 and POWER9 2020-07-21 15:38:03 +10:00
book3s_64_mmu_radix.c PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
book3s_64_slb.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_vio.c KVM: PPC: Book3S: Fix some RCU-list locks 2020-05-27 11:39:31 +10:00
book3s_64_vio_hv.c powerpc: Replace _ALIGN_UP() by ALIGN() 2020-05-11 23:15:15 +10:00
book3s_emulate.c KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
book3s_exports.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_hv.c PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
book3s_hv_builtin.c powerpc/kvm/cma: Improve kernel log during boot 2020-07-29 21:09:37 +10:00
book3s_hv_hmi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 114 2019-05-24 17:39:01 +02:00
book3s_hv_interrupts.S KVM: PPC: Book3S HV: Save/restore new PMU registers 2020-07-22 21:56:41 +10:00
book3s_hv_nested.c KVM: PPC: Protect kvm_vcpu_read_guest with srcu locks 2020-07-21 15:38:03 +10:00
book3s_hv_ras.c powerpc/64s: Move HMI IRQ stat from percpu variable to paca. 2020-07-29 23:47:53 +10:00
book3s_hv_rm_mmu.c powerpc: Define new SRR1 bits for a ISA v3.1 2020-05-19 00:10:38 +10:00
book3s_hv_rm_xics.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
book3s_hv_rm_xive.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
book3s_hv_rmhandlers.S KVM: PPC: Book3S HV: Save/restore new PMU registers 2020-07-22 21:56:41 +10:00
book3s_hv_tm.c KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones 2020-03-19 16:39:52 +11:00
book3s_hv_tm_builtin.c KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones 2020-03-19 16:39:52 +11:00
book3s_hv_uvmem.c PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
book3s_interrupts.S PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
book3s_mmu_hpte.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_paired_singles.c KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
book3s_pr.c PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
book3s_pr_papr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
book3s_rmhandlers.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_rtas.c KVM: PPC: Protect kvm_vcpu_read_guest with srcu locks 2020-07-21 15:38:03 +10:00
book3s_segment.S powerpc/64s/exception: Move KVM test to common code 2020-04-01 13:42:11 +11:00
book3s_xics.c KVM: PPC: Book3S HV: XICS: Replace the 'destroy' method by a 'release' method 2020-09-03 14:12:48 +10:00
book3s_xics.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
book3s_xive.c KVM: PPC: Book3S HV: XIVE: Fix typo in comment 2020-01-23 21:31:23 +11:00
book3s_xive.h KVM: PPC: Book3S HV: XIVE: Make VP block size configurable 2019-10-22 16:29:02 +11:00
book3s_xive_native.c powerpc/xive: Enforce load-after-store ordering when StoreEOI is active 2020-05-07 22:58:31 +10:00
book3s_xive_template.c powerpc/xive: Enforce load-after-store ordering when StoreEOI is active 2020-05-07 22:58:31 +10:00
booke.c KVM: PPC: Clean up redundant kvm_run parameters in assembly 2020-07-23 15:50:01 +10:00
booke.h KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
booke_emulate.c KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
booke_interrupts.S KVM: PPC: Clean up redundant kvm_run parameters in assembly 2020-07-23 15:50:01 +10:00
bookehv_interrupts.S KVM: PPC: Clean up redundant kvm_run parameters in assembly 2020-07-23 15:50:01 +10:00
e500.c KVM: PPC: Kill kvmppc_ops::mmu_destroy() and kvmppc_mmu_destroy() 2020-03-19 16:43:07 +11:00
e500.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500_emulate.c KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
e500_mmu.c KVM: PPC: Kill kvmppc_ops::mmu_destroy() and kvmppc_mmu_destroy() 2020-03-19 16:43:07 +11:00
e500_mmu_host.c KVM: Pass MMU notifier range flags to kvm_unmap_hva_range() 2020-08-21 18:03:47 -04:00
e500_mmu_host.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500mc.c KVM: PPC: Kill kvmppc_ops::mmu_destroy() and kvmppc_mmu_destroy() 2020-03-19 16:43:07 +11:00
emulate.c KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
emulate_loadstore.c MIPS: 2020-06-12 11:05:52 -07:00
fpu.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
irq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile KVM: PPC: Book3S HV: Support for running secure guests 2019-11-28 16:30:02 +11:00
mpic.c KVM: Remove unnecessary asm/kvm_host.h includes 2020-03-16 17:57:34 +01:00
powerpc.c PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
timing.c powerpc/kvm: no need to check return value of debugfs_create functions 2020-03-04 22:44:25 +11:00
timing.h KVM: Remove unnecessary asm/kvm_host.h includes 2020-03-16 17:57:34 +01:00
tm.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
trace.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00
trace_book3s.h KVM: PPC: Book3S: Simplify external interrupt handling 2018-10-09 16:04:27 +11:00
trace_booke.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00
trace_hv.h KVM: PPC: Fix typo on H_DISABLE_AND_GET hcall 2020-07-23 17:43:35 +10:00
trace_pr.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00