Commit b4787311 authored by Zengruan Ye's avatar Zengruan Ye Committed by lishusen
Browse files

KVM: arm64: Implement PV_SCHED_FEATURES call

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8WMFU


CVE: NA

--------------------------------

This provides a mechanism for querying which paravirtualized sched
features are available in this hypervisor.

Add some SMCCC compatible hypercalls for PV sched features:
  PV_SCHED_FEATURES:       0xC5000090
  PV_SCHED_IPA_INIT:       0xC5000091
  PV_SCHED_IPA_RELEASE:    0xC5000092

Also add the header file which defines the ABI for the paravirtualized
sched features we're about to add.

Signed-off-by: default avatarZengruan Ye <yezengruan@huawei.com>
Signed-off-by: default avatarlishusen <lishusen2@huawei.com>
parent 3566c5bf
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1549,6 +1549,17 @@ config PARAVIRT
	  under a hypervisor, potentially improving performance significantly
	  over full virtualization.

config PARAVIRT_SCHED
	bool "Paravirtualization layer for sched"
	depends on PARAVIRT
	help
	  This supports the vCPU preemption check to enhance lock performance on
	  overcommitted hosts (more runnable vCPUs than physical CPUs in the
	  system) as doing busy waits for preempted vCPUs will hurt system
	  performance far worse than early yielding.

	  If you are unsure how to answer this question, answer Y.

config PARAVIRT_TIME_ACCOUNTING
	bool "Paravirtual steal time accounting"
	select PARAVIRT
+1 −0
Original line number Diff line number Diff line
@@ -469,6 +469,7 @@ CONFIG_SCHED_HRTICK=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_HW_PERF_EVENTS=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_SCHED=y
CONFIG_PARAVIRT_TIME_ACCOUNTING=y
CONFIG_ARCH_SUPPORTS_KEXEC=y
CONFIG_ARCH_SUPPORTS_KEXEC_FILE=y
+9 −0
Original line number Diff line number Diff line
@@ -1051,6 +1051,15 @@ static inline bool kvm_arm_is_pvtime_enabled(struct kvm_vcpu_arch *vcpu_arch)
	return (vcpu_arch->steal.base != INVALID_GPA);
}

#ifdef CONFIG_PARAVIRT_SCHED
long kvm_hypercall_pvsched_features(struct kvm_vcpu *vcpu);
#else
static inline long kvm_hypercall_pvsched_features(struct kvm_vcpu *vcpu)
{
	return 0;
}
#endif

void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome);

struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr);
+16 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright(c) 2019 Huawei Technologies Co., Ltd
 * Author: Zengruan Ye <yezengruan@huawei.com>
 */

#ifndef __ASM_PVSCHED_ABI_H
#define __ASM_PVSCHED_ABI_H

struct pvsched_vcpu_state {
	__le32 preempted;
	/* Structure must be 64 byte aligned, pad to that size */
	u8 padding[60];
} __packed;

#endif
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ include $(srctree)/virt/kvm/Makefile.kvm
obj-$(CONFIG_KVM) += kvm.o
obj-$(CONFIG_KVM) += hyp/

kvm-y += arm.o mmu.o mmio.o psci.o hypercalls.o pvtime.o \
kvm-y += arm.o mmu.o mmio.o psci.o hypercalls.o pvtime.o pvsched.o \
	 inject_fault.o va_layout.o handle_exit.o \
	 guest.o debug.o reset.o sys_regs.o stacktrace.o \
	 vgic-sys-reg-v3.o fpsimd.o pkvm.o \
Loading