Received: by 10.192.165.156 with SMTP id m28csp244862imm; Tue, 17 Apr 2018 09:25:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/kt72ymnBvWuy/L6mcbSYrR3fkNG3hBGGiwR8DJbnRoT4g37tc9/zM1BuirgF2scehK+7a X-Received: by 10.99.183.15 with SMTP id t15mr2334265pgf.416.1523982324452; Tue, 17 Apr 2018 09:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982324; cv=none; d=google.com; s=arc-20160816; b=j+cADs4Xw0BnX0o/jhSLAS5FphqAs1FooIeqjGtX613clTk6jBkARn8v0ygnreCD6a j5Wk3zhFC670D29vh4mdIwDuMP8xmI+MZgaGP8X8F2gHN9JdnzAchxS3vnAS2aDSDEL8 kU9UKimUodUlz4wA5dRItSBB9MXe3crCYEz2d01zpxNNfSUHAU51FuUQLy+3HUeSWVt1 /sHyO5r2Jew6+EDeI6BWenu6cW1f8YTPVtSCZ5hJj2k4XnI6+BvsSca3xNjRsJ/9YFzR ifpucLP7x/DyN/lqKsrYoO6G+EXwEN+PFjl5TSOxUtKtBiLlmgUuAaL+P9Z/Cau2vEA3 F5Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TNyMyYp34HLCRyPrz433DnT/l6IcHqSy79usn6YXCM8=; b=V94RRGVB6FtCH7v50aelxeX7VpFw9kpq+hn9CcR7lNFMVQO5spYzXDxxQkbpvnLleq nBn/GN1H3P3HIeY/23R+IGv3FFyUB7F/OdM+JW8Z4HHoDPOSa3XGGW75/yXrBzdOuQTt VJMQxclOOG/4h8pjkDnhPj27pl3TCJ0HsGZNWVANil+cynb3/UPDHxoSs+py++6U02MO kR/fC5ihl7PaynsIfmtfVoqsANt/xwFkdRTC4gbaKCLWnXHgmZuBscAOSwgKV7kVA6IM 3mmxTYXO6vr96+SS2R8cWDxQ4/7J2ikZWCvdLpab+gweBcLQD4uyfTOLYSkT0Dj9WcdD eDQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si7686094pgu.535.2018.04.17.09.25.09; Tue, 17 Apr 2018 09:25:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755636AbeDQQJg (ORCPT + 99 others); Tue, 17 Apr 2018 12:09:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36134 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932107AbeDQQJb (ORCPT ); Tue, 17 Apr 2018 12:09:31 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7190CD1A; Tue, 17 Apr 2018 16:09:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Marc Zyngier , Will Deacon , Catalin Marinas , Greg Hackmann , Mark Rutland Subject: [PATCH 4.9 41/66] arm64: KVM: Make PSCI_VERSION a fast path Date: Tue, 17 Apr 2018 17:59:14 +0200 Message-Id: <20180417155647.652315522@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155645.868055442@linuxfoundation.org> References: <20180417155645.868055442@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Rutland From: Marc Zyngier commit 90348689d500410ca7a55624c667f956771dce7f upstream. For those CPUs that require PSCI to perform a BP invalidation, going all the way to the PSCI code for not much is a waste of precious cycles. Let's terminate that call as early as possible. Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Mark Rutland [v4.9 backport] Tested-by: Greg Hackmann Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kvm/hyp/switch.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -308,6 +309,18 @@ again: if (exit_code == ARM_EXCEPTION_TRAP && !__populate_fault_info(vcpu)) goto again; + if (exit_code == ARM_EXCEPTION_TRAP && + (kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_HVC64 || + kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_HVC32) && + vcpu_get_reg(vcpu, 0) == PSCI_0_2_FN_PSCI_VERSION) { + u64 val = PSCI_RET_NOT_SUPPORTED; + if (test_bit(KVM_ARM_VCPU_PSCI_0_2, vcpu->arch.features)) + val = 2; + + vcpu_set_reg(vcpu, 0, val); + goto again; + } + if (static_branch_unlikely(&vgic_v2_cpuif_trap) && exit_code == ARM_EXCEPTION_TRAP) { bool valid;