From patchwork Mon Jan 9 06:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9503891 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 07BD660757 for ; Mon, 9 Jan 2017 06:30:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAB04280D0 for ; Mon, 9 Jan 2017 06:30:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC58A2815E; Mon, 9 Jan 2017 06:30:34 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham 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 641F1280D0 for ; Mon, 9 Jan 2017 06:30:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941973AbdAIG2Q (ORCPT ); Mon, 9 Jan 2017 01:28:16 -0500 Received: from outprodmail02.cc.columbia.edu ([128.59.72.51]:52540 "EHLO outprodmail02.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939959AbdAIG0n (ORCPT ); Mon, 9 Jan 2017 01:26:43 -0500 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail02.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Q5ha006221 for ; Mon, 9 Jan 2017 01:26:40 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id A9F1281 for ; Mon, 9 Jan 2017 01:26:40 -0500 (EST) Received: from sendprodmail02.cc.columbia.edu (sendprodmail02.cc.columbia.edu [128.59.72.14]) by hazelnut (Postfix) with ESMTP id 870CB81 for ; Mon, 9 Jan 2017 01:26:40 -0500 (EST) Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by sendprodmail02.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096QePx043243 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:26:40 -0500 Received: by mail-qt0-f197.google.com with SMTP id k15so94312539qtg.5 for ; Sun, 08 Jan 2017 22:26:40 -0800 (PST) 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=eTARu1rS7ZChLCKhtzcCO2+hcKm9AnS3YPvqq1ojwK4=; b=rStpr6/MtEr60rPdS3ivrAcuaKaN8WxRkJ4mRdolDYpzBf3SJ3PLnWeOjHPhB/FNbK bjO4pileZojuYyGo0npfEFhk5TxuyZEXboI09Lw1yFB8Yza64mv9H+x3YQUZxqmA4Iyb Eu7nhpiozbRTig5JaiTvES6+rc/DmNKmwTBtlRArPuooFFC4cumCayJ20uGDZFFLcPWU C3la64TgpYS1MLeTQvPL5UTOpZ5UnQq4vi9M54rQzdy+jiqtpXl4xhsFzc0u9gC3Gawm rXZN8QDlltvB+rK6VpecXmeAXGhSmmsp93JdvOFBs6tSf+9akurI1YYRBeyrIjhjgcG+ 4QxA== X-Gm-Message-State: AIkVDXLDO6YZKmaeDak8STt16wCRxP1blh6boMVSZlb8jQM+HVStCBOeEOEvIZTdSlwDRoUNmoPmx9Pb8SBpiJn0Mkw2NUHmCFAhxcm+nfKw0yDyZ+fNSpQDJrsBOudWI74O2UsuklG9dHw= X-Received: by 10.200.38.177 with SMTP id 46mr79745298qto.107.1483943200199; Sun, 08 Jan 2017 22:26:40 -0800 (PST) X-Received: by 10.200.38.177 with SMTP id 46mr79745280qto.107.1483943200075; Sun, 08 Jan 2017 22:26:40 -0800 (PST) Received: from jintack.cs.columbia.edu ([2001:18d8:ffff:16:21a:4aff:feaa:f900]) by smtp.gmail.com with ESMTPSA id h3sm8623257qtc.6.2017.01.08.22.26.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 22:26:39 -0800 (PST) From: Jintack Lim To: christoffer.dall@linaro.org, marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, vladimir.murzin@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, james.morse@arm.com, lorenzo.pieralisi@arm.com, kevin.brodsky@arm.com, wcohen@redhat.com, shankerd@codeaurora.org, geoff@infradead.org, andre.przywara@arm.com, eric.auger@redhat.com, anna-maria@linutronix.de, shihwei@cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jintack@cs.columbia.edu Subject: [RFC 55/55] KVM: arm64: Enable nested virtualization Date: Mon, 9 Jan 2017 01:24:51 -0500 Message-Id: <1483943091-1364-56-git-send-email-jintack@cs.columbia.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu> References: <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu> X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.78 on 128.59.72.14 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that everything is ready, we enable nested virtualization by setting the HCR NV and NV1 bit. Signed-off-by: Jintack Lim --- arch/arm64/include/asm/kvm_arm.h | 1 + arch/arm64/kvm/hyp/switch.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index f9addf3..ab8b93b 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h @@ -24,6 +24,7 @@ /* Hyp Configuration Register (HCR) bits */ #define HCR_NV1 (UL(1) << 43) +#define HCR_NV (UL(1) << 42) #define HCR_E2H (UL(1) << 34) #define HCR_ID (UL(1) << 33) #define HCR_CD (UL(1) << 32) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index c80b2ae..df7b88d 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -87,7 +87,7 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) isb(); } if (vcpu_mode_el2(vcpu)) - val |= HCR_TVM | HCR_TRVM; + val |= HCR_TVM | HCR_TRVM | HCR_NV | HCR_NV1; write_sysreg(val, hcr_el2); /* Trap on AArch32 cp15 c15 accesses (EL1 or EL0) */ write_sysreg(1 << 15, hstr_el2);