mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-25 03:55:09 +08:00
5236756d04
Linux implements SPR save/restore including storage space for registers in the task struct for process context switching. Make use of this similarly to the way we make use of the context switching fp/vec save restore. This improves code reuse, allows some stack space to be saved, and helps with avoiding VRSAVE updates if they are not required. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20211123095231.1036501-39-npiggin@gmail.com
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
|
* Privileged (non-hypervisor) host registers to save.
|
|
*/
|
|
struct p9_host_os_sprs {
|
|
unsigned long iamr;
|
|
unsigned long amr;
|
|
|
|
unsigned int pmc1;
|
|
unsigned int pmc2;
|
|
unsigned int pmc3;
|
|
unsigned int pmc4;
|
|
unsigned int pmc5;
|
|
unsigned int pmc6;
|
|
unsigned long mmcr0;
|
|
unsigned long mmcr1;
|
|
unsigned long mmcr2;
|
|
unsigned long mmcr3;
|
|
unsigned long mmcra;
|
|
unsigned long siar;
|
|
unsigned long sier1;
|
|
unsigned long sier2;
|
|
unsigned long sier3;
|
|
unsigned long sdar;
|
|
};
|
|
|
|
static inline bool nesting_enabled(struct kvm *kvm)
|
|
{
|
|
return kvm->arch.nested_enable && kvm_is_radix(kvm);
|
|
}
|
|
|
|
bool load_vcpu_state(struct kvm_vcpu *vcpu,
|
|
struct p9_host_os_sprs *host_os_sprs);
|
|
void store_vcpu_state(struct kvm_vcpu *vcpu);
|
|
void save_p9_host_os_sprs(struct p9_host_os_sprs *host_os_sprs);
|
|
void restore_p9_host_os_sprs(struct kvm_vcpu *vcpu,
|
|
struct p9_host_os_sprs *host_os_sprs);
|
|
void switch_pmu_to_guest(struct kvm_vcpu *vcpu,
|
|
struct p9_host_os_sprs *host_os_sprs);
|
|
void switch_pmu_to_host(struct kvm_vcpu *vcpu,
|
|
struct p9_host_os_sprs *host_os_sprs);
|