From patchwork Sat Sep 25 00:55:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 1532604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=LH0fEQWi; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4HGVp65TVGz9tT8 for ; Sat, 25 Sep 2021 10:56:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347572AbhIYA5k (ORCPT ); Fri, 24 Sep 2021 20:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346950AbhIYA52 (ORCPT ); Fri, 24 Sep 2021 20:57:28 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A682C0613E5 for ; Fri, 24 Sep 2021 17:55:49 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id i77-20020a25d150000000b005b1d20152b0so5821713ybg.14 for ; Fri, 24 Sep 2021 17:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=ah8BjXPWllLk7CuVOQDBnnkjluI1bAcWQEy7hqnXFdI=; b=LH0fEQWiB4eDpGtf5hQ32ngY9GD9n7/7byCfmfVAytc4CKzgNHw+3wzIXFXa/o5bjL 2I8Eux8FnK1n3Iopqot3X1OQnjmh9TXn5kbxaAIGqSl+9CT/5AZsgzAsrWdmxrS6mlrW dx+aaDSPBdScsR191c0lwGAUmjnCNBA+1XrB67IkhS4U9E2OhMxPrheuqrJo04xzwB0N XAS0I23+EYToVad3pLc9+Altu8hz2KVdmKC0N6gwn8kCYuyHcyl1sb/GxSbWhO/S13/S czeNRHxyY1pa57ENB4tByagarGXZrQ657lOxch4brq39vjJlp224VHM9XKZnUh7GAMXk zEKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=ah8BjXPWllLk7CuVOQDBnnkjluI1bAcWQEy7hqnXFdI=; b=jPegYIKded4SpTC4Q0QkdDro0xpNccLVMIVQn+3nHt5/obztLm9Ksj+7SLl62+S+Lm ZuJCdqXhEcw8m+Zb1462l5UxkiHVLqiFOZOJMs0p0bxzn1WyaB+njKZmBBcJapEE0QXy XxztIwpyH2Hc0fnJn2gaBUVdRw8UFxvl2pco6uBCjxHQL2lXljHJw/ieTpT78n4tZZqE WDNB0niN5agAoV9DtEbNQ4pAxE5Ts9xzN42JjFcRe7bBqcP1XjLNuZqWJSS2sDOzPfdw ZZ76UQpnES4IWXTzSxxb3VJxygr8pfm2jfAaYRa6f65cDUwFHxEg3R+IlAftV59MP33x S2uw== X-Gm-Message-State: AOAM532gLjhjR/jO978wyvLpX+bCVEbyJaCHooW0hJtq7m3S/EHSeInL xtgiJqup0a1vjZae1IFq+SBoPf0jcxI= X-Google-Smtp-Source: ABdhPJxp5JGS1M0N56DHKiumu5prHduzDpf9Ztz1q5ePOF80kOqklxBqHGGBpfEM+YrqrhVUO4t7wkRniPM= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:4c72:89be:dba3:2bcb]) (user=seanjc job=sendgmr) by 2002:a25:1d09:: with SMTP id d9mr16059645ybd.140.1632531348364; Fri, 24 Sep 2021 17:55:48 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 24 Sep 2021 17:55:22 -0700 In-Reply-To: <20210925005528.1145584-1-seanjc@google.com> Message-Id: <20210925005528.1145584-9-seanjc@google.com> Mime-Version: 1.0 References: <20210925005528.1145584-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog Subject: [PATCH 08/14] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt() From: Sean Christopherson To: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , Jing Zhang Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Rename a variety of HLT-related helpers to free up the function name "kvm_vcpu_halt" for future use in generic KVM code, e.g. to differentiate between "block" and "halt". No functional change intended. Signed-off-by: Sean Christopherson Reviewed-by: David Matlack --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/vmx/vmx.c | 4 ++-- arch/x86/kvm/x86.c | 13 +++++++------ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4e8c21083bdb..cfebef10b89c 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1679,7 +1679,7 @@ int kvm_emulate_monitor(struct kvm_vcpu *vcpu); int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in); int kvm_emulate_cpuid(struct kvm_vcpu *vcpu); int kvm_emulate_halt(struct kvm_vcpu *vcpu); -int kvm_vcpu_halt(struct kvm_vcpu *vcpu); +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu); int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu); int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index eedcebf58004..f689e463b678 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3618,7 +3618,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) !(nested_cpu_has(vmcs12, CPU_BASED_INTR_WINDOW_EXITING) && (vmcs12->guest_rflags & X86_EFLAGS_IF))) { vmx->nested.nested_run_pending = 0; - return kvm_vcpu_halt(vcpu); + return kvm_emulate_halt_noskip(vcpu); } break; case GUEST_ACTIVITY_WAIT_SIPI: diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d118daed0530..858f5f1f1273 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4740,7 +4740,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, if (kvm_emulate_instruction(vcpu, 0)) { if (vcpu->arch.halt_request) { vcpu->arch.halt_request = 0; - return kvm_vcpu_halt(vcpu); + return kvm_emulate_halt_noskip(vcpu); } return 1; } @@ -5414,7 +5414,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) if (vcpu->arch.halt_request) { vcpu->arch.halt_request = 0; - return kvm_vcpu_halt(vcpu); + return kvm_emulate_halt_noskip(vcpu); } /* diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b0c21d42f453..eade8a2bdccf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8643,7 +8643,7 @@ void kvm_arch_exit(void) #endif } -static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) +static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason) { ++vcpu->stat.halt_exits; if (lapic_in_kernel(vcpu)) { @@ -8655,11 +8655,11 @@ static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) } } -int kvm_vcpu_halt(struct kvm_vcpu *vcpu) +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) { - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); } -EXPORT_SYMBOL_GPL(kvm_vcpu_halt); +EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip); int kvm_emulate_halt(struct kvm_vcpu *vcpu) { @@ -8668,7 +8668,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered * KVM_EXIT_DEBUG here. */ - return kvm_vcpu_halt(vcpu) && ret; + return kvm_emulate_halt_noskip(vcpu) && ret; } EXPORT_SYMBOL_GPL(kvm_emulate_halt); @@ -8676,7 +8676,8 @@ int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu) { int ret = kvm_skip_emulated_instruction(vcpu); - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, KVM_EXIT_AP_RESET_HOLD) && ret; + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, + KVM_EXIT_AP_RESET_HOLD) && ret; } EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold);