From patchwork Mon Sep 11 11:16:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 9947083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 55442602C9 for ; Mon, 11 Sep 2017 10:54:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24D9328B79 for ; Mon, 11 Sep 2017 10:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19B6F28B98; Mon, 11 Sep 2017 10:54:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 290C528B79 for ; Mon, 11 Sep 2017 10:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751384AbdIKKyW (ORCPT ); Mon, 11 Sep 2017 06:54:22 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6022 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036AbdIKKyV (ORCPT ); Mon, 11 Sep 2017 06:54:21 -0400 Received: from 172.30.72.60 (EHLO DGGEMS407-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHB90008; Mon, 11 Sep 2017 18:53:57 +0800 (CST) Received: from linux.huawei.com (10.67.187.203) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.301.0; Mon, 11 Sep 2017 18:53:47 +0800 From: Dongjiu Geng To: , , , CC: , , Subject: [PATCH] arm64: KVM: Skip PSTATE.PAN reest at EL2 in non-VHE Date: Mon, 11 Sep 2017 19:16:52 +0800 Message-ID: <1505128612-13819-1-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.7.7 MIME-Version: 1.0 X-Originating-IP: [10.67.187.203] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0205.59B66B45.006B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8ad280bc8523f6cd2dc01798fb7b8dc3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PSTATE.PAN disables reading and/or writing to a userspace virtual address from EL1 in non-VHE or from EL2 in VHE. In non-VHE, there is no any userspace mapping at EL2, so no need to reest the PSTATE.PAN. Signed-off-by: Dongjiu Geng Signed-off-by: Haibin Zhang --- arch/arm64/kvm/hyp/entry.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S index 12ee62d6d410..86a7549b1b4c 100644 --- a/arch/arm64/kvm/hyp/entry.S +++ b/arch/arm64/kvm/hyp/entry.S @@ -96,8 +96,12 @@ ENTRY(__guest_exit) add x1, x1, #VCPU_CONTEXT - ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN + b 2f // skip PAN at EL2 in non-VHE +alternative_else_nop_endif + ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) +2: // Store the guest regs x2 and x3 stp x2, x3, [x1, #CPU_XREG_OFFSET(2)]