Received: by 10.223.185.116 with SMTP id b49csp7397734wrg; Thu, 1 Mar 2018 05:02:40 -0800 (PST) X-Google-Smtp-Source: AG47ELtbkX6GP8lMa64yjApLC7D2pNNN1UKfKfYi1+8C2+Q7w4gkIgKFHNGynKqiFP2QUWiWMHzq X-Received: by 10.98.11.145 with SMTP id 17mr1893666pfl.150.1519909360209; Thu, 01 Mar 2018 05:02:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519909360; cv=none; d=google.com; s=arc-20160816; b=ZtINpb9Nrscn3FgirMcLFaRTNGHEyJVZBGB0wvNXv1+dHUntov2U8Xj6G0imh4qUc6 kLzBy4k+V7B24BQbVtKOBbeO7vEyF8nYDaGU12dqTpCpOIyiIvL9A7B0oM3Li2mACHQf IG523JkaWc4968sGks9pMFn9E/lGywLVn7u8ZWohnAV1qwjbLbcbh8gV6AZPMZl2XmWA KPoTbfwr/0grzFg8k2Psy8GLP79cKO70kQ2uivfusHRGj7R6Eliss25fzGhU3GJIlLyW xLxjKBPjlgGzidkHEl6fJ+RRSaGLYmWfFARG1mWG8BVWFc1Ylf+hm+WzvVmiiEfr7bL9 daQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ccWpB6B5MEm475gq8sjuImnJLMpKY94QLsRYdXyhfpw=; b=xGNCJVfC7y0l2iGx2mX+dT6QeG2673qeY24WMPI/LQ5ZTWtK9MtVTVbIHcu71rZnBf e5iO1IO4BNx4uyapjQ6TwcX9Jadt68MkOkQS723Tl43wwKw7rkXpvQvYqaamth3WDSaL IypZQshgo3CQPZ5LTQi35NJgpwC8GCB+HyzrBQ91zHe58+DZqOvDwt95XA2QFo/X2Vr0 rWRNPzeJZNfWA58K9n9EfGEPXWuNro9+xLc6gyp+rmnFZ0kvZYT0ccAjI4vrn9gCXnW5 A6k4xJhbP8JfG3lZ6wxh9wasMzEDoba2/7N/7/Zcawze4LeeQy4JoRnllMgE3bWzuJ5X hwWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eBmCz7H/; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si2437515pgn.339.2018.03.01.05.02.05; Thu, 01 Mar 2018 05:02:40 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=eBmCz7H/; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031089AbeCANAS (ORCPT + 99 others); Thu, 1 Mar 2018 08:00:18 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:44205 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030915AbeCANAO (ORCPT ); Thu, 1 Mar 2018 08:00:14 -0500 Received: by mail-pg0-f67.google.com with SMTP id l4so2267941pgp.11 for ; Thu, 01 Mar 2018 05:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ccWpB6B5MEm475gq8sjuImnJLMpKY94QLsRYdXyhfpw=; b=eBmCz7H/8d4JQQbcrfHGWDJ3JynokepH2HqubcLqlc3m1OaXtObxOsE2XLy7O+HbA0 4rYWONP5Ps/H1G5zQpnv9Hvgg/CPGjM0tU+NlAJ2zzZjixcfYPGMv36Ipzmzhkc58lp3 0HYZPoQ7dSUd7csijiGK7lVrGddwCDEGZZokI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ccWpB6B5MEm475gq8sjuImnJLMpKY94QLsRYdXyhfpw=; b=RHkIn33Zk2P8/6RnP6mtGUKudVDV67If0AEUE8lWroyTLG+/USNPn7z6IA3Oy7bVN3 xY6TPcVQVEZKAqfbd7+OkSq675lDuZ4gIKSq4cyoGSCJBaTLWEyW2riqVMMMBjnp/72f WcHCKbEz4J5QTkKfGjTz7B3d/TWAD65e9EiP2qdJiHOmRd9orwn/XXVT6+MJl5cZOyGV 9FMnmRKA6m0QvNJimIz00zImQobLyrTZmWko4gd1xWOt22gt2rHneFiwie7c/TXvFHZG y3HgJjgcWbfcKcTtJCGaBoDRKAkXt+2cg3Jx/Etb6XENLAWZWtkyDTfiernLLAym1UkW JGew== X-Gm-Message-State: APf1xPCoTEFc1EmZMfYFYX2IzFTt4kP2dSCJatf40PR4bFgErciGXkUL sIMkW6cSE6iqDP9fHSiEV0iZkw== X-Received: by 10.101.73.197 with SMTP id t5mr1513480pgs.426.1519909212255; Thu, 01 Mar 2018 05:00:12 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id x4sm2289655pfb.46.2018.03.01.05.00.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 05:00:11 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alex Shi Subject: [PATCH 36/45] arm64: KVM: Make PSCI_VERSION a fast path Date: Thu, 1 Mar 2018 20:54:13 +0800 Message-Id: <1519908862-11425-37-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> References: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Zyngier commit 90348689d500 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: Alex Shi --- arch/arm64/kvm/hyp/switch.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index cf6d962..3eab6ac 100644 --- 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 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu) 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; -- 2.7.4