Received: by 10.223.185.116 with SMTP id b49csp2237421wrg; Thu, 15 Feb 2018 08:33:13 -0800 (PST) X-Google-Smtp-Source: AH8x224aCRtSOHGNdYOZn8IDqDtqn9wjM1vuJmc4mN6uYJSKhEK87GQrALQLyKb3h2jHYG58Yq0z X-Received: by 10.101.72.4 with SMTP id h4mr2657778pgs.386.1518712393659; Thu, 15 Feb 2018 08:33:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518712393; cv=none; d=google.com; s=arc-20160816; b=gonjBRIpWr1DGgbEu9Ph1p8hGOOWjIo5wLjdOOlTH8OoXeLVBtgFkzbDZZuE04MYHr PeTLxSoflVAufZDms+9AzQvnZka8LmW3iJCvyeIhVRJHfjYkpql1sfPOo+q1h6QTyVsE 06aXHyGToK9CFk5plfVZirL97TEBNYXZYlnEWqKKT2M0NP0Vzxen6pPV/zRHBn/RdWPO 1WpC8UWULOnvtV9IGqNOxSK4JcjTdhOBbMIqlMBaSV+T3gm0HTlG6jjMbAC6bJ6P0G6m hdIDPEmk6rfi2NT3Zhfc6dZpDNhI9qtm6gmZOxOdwY99JieJLST1FiwOGe7j+vtgLqTr xp9g== 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=mQN6V+A4XXYNjJZvWL8RSablvP8hYvIZS+YiHhXGzl4=; b=V63e70ElxWKZy9MsfXLTrP9mq16WozDfHH3hw3oGL7kGPANTLe8MyjxoIxUMJOthCw qsxFloPFrlCHR0uLUsirA1Nu9GfcHwAjQVBAcN/q7ZeRQSszlEDT65U2HSf79NrmxPi3 TOlJn/fO66iMfaxrpHwNqWzso2Qbko1man57kUDrfu81ujh4tHGx7cY1gZsDWa74HE6r DPa5C7sKxlkvBBfYpq/f+XBdgsQX0NuFtfTSKhjNYhUC0JZyWVNlYunqqPcuE3hFwrKg chentKRArSj71MmmyXvYbE6eGdnYA9MsbJOgHsF9nUiXS2PHqoF/X8cFG+nKEIfd5gLt JM7Q== 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 z188si1453715pfz.46.2018.02.15.08.32.59; Thu, 15 Feb 2018 08:33:13 -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; 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 S1425992AbeBOQbx (ORCPT + 99 others); Thu, 15 Feb 2018 11:31:53 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33200 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424092AbeBOPmJ (ORCPT ); Thu, 15 Feb 2018 10:42:09 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A90DB102A; Thu, 15 Feb 2018 15:42:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Will Deacon , Catalin Marinas Subject: [PATCH 4.15 078/202] [Variant 2/Spectre-v2] arm64: KVM: Make PSCI_VERSION a fast path Date: Thu, 15 Feb 2018 16:16:18 +0100 Message-Id: <20180215151717.559429005@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 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.15-stable review patch. If anyone has any objections, please let me know. ------------------ 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: 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 @@ -341,6 +342,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;