From patchwork Tue Jul 18 16:58:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9849119 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 A9826600CC for ; Tue, 18 Jul 2017 17:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D75D285C9 for ; Tue, 18 Jul 2017 17:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8199B285D3; Tue, 18 Jul 2017 17:10: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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM 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 252AF285C9 for ; Tue, 18 Jul 2017 17:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752093AbdGRQ74 (ORCPT ); Tue, 18 Jul 2017 12:59:56 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:34432 "EHLO mail-io0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbdGRQ7u (ORCPT ); Tue, 18 Jul 2017 12:59:50 -0400 Received: by mail-io0-f174.google.com with SMTP id l7so10048872iof.1 for ; Tue, 18 Jul 2017 09:59:50 -0700 (PDT) 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=mHWQkEU3PYjg8LR9+vULRp6NTl/3XN9AtXKMlcly4IQ=; b=NFkG7lmLWwAUmE2PzhvTE6CJ5McM+Z5OnBtVqnnW8R6U6m7oE5HNrwG5vlI3jJpH+1 3oOl/UviiBqPgFvuQz2gVSjNmmv1of0RXWcRkDKwLWmaccwNVjOBgeFDOiyW4KxpNn9T oGZS/NJ+fLPdwTC6COkfKZt2bdAYpKpv0X2fg= 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=mHWQkEU3PYjg8LR9+vULRp6NTl/3XN9AtXKMlcly4IQ=; b=C8M3QuH5IWMdXBH7sxSN43eoCjbUIqnTBCFuwMJTfLU232NGXKSPXvgOqcn/5H8jsY jBV2h2SvwB+/AHXoxt26iYKVd/yZvvGVjn2ynJ6w8f62WpdvvFm0Z8COSCXM0XNHV2mr gD9lBfCRNL5RiRKWgWTA0RvJ7qL9F8oetNGaTfe8P9Hd3GE5MumZsCoUWp2k86j/iMCt 7dvUZrMJQcitG3FAy2+CQULRRarR5pJVFDYXkn0XbNQfm5/1EbFtAEl59fGvDWh/I2nL euNcMQvGUDIa0pAVstXWn4aYBdkaTb1oIZplDWf4xz05BUYreacxYKAB7I3kbf5jqfM7 ddHA== X-Gm-Message-State: AIVw111GmQCWvtHhw/elhhb1ltx4RmOC433jAGRuK4sHC9XR5wjji6z3 cmj3EHb6dunnN8et X-Received: by 10.107.173.220 with SMTP id m89mr2480426ioo.152.1500397189611; Tue, 18 Jul 2017 09:59:49 -0700 (PDT) Received: from node.jintackl-qv26972.kvmarm-pg0.wisc.cloudlab.us (c220g1-030822.wisc.cloudlab.us. [128.104.222.82]) by smtp.gmail.com with ESMTPSA id j96sm1413075ioo.49.2017.07.18.09.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 09:59:48 -0700 (PDT) From: Jintack Lim To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Cc: corbet@lwn.net, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, mchehab@kernel.org, cov@codeaurora.org, daniel.lezcano@linaro.org, david.daney@cavium.com, mark.rutland@arm.com, suzuki.poulose@arm.com, stefan@hello-penguin.com, andy.gross@linaro.org, wcohen@redhat.com, ard.biesheuvel@linaro.org, shankerd@codeaurora.org, vladimir.murzin@arm.com, james.morse@arm.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jintack Lim Subject: [RFC PATCH v2 09/38] KVM: arm64: Add the shadow context for virtual EL2 execution Date: Tue, 18 Jul 2017 11:58:35 -0500 Message-Id: <1500397144-16232-10-git-send-email-jintack.lim@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500397144-16232-1-git-send-email-jintack.lim@linaro.org> References: <1500397144-16232-1-git-send-email-jintack.lim@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With the nested virtualization support, a hypervisor running inside a VM (i.e. a guest hypervisor) is now deprivilaged and runs in EL1 instead of EL2. So, the host hypervisor manages the shadow context for the virtual EL2 execution. Signed-off-by: Jintack Lim --- arch/arm64/include/asm/kvm_host.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 57dccde..46880c3 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -229,6 +229,19 @@ struct kvm_cpu_context { }; u64 el2_special_regs[NR_EL2_SPECIAL_REGS]; + + u64 shadow_sys_regs[NR_SYS_REGS]; /* only used for virtual EL2 */ + + /* + * hw_* will be written to the hardware when entering to a VM. + * They have either the virtual EL2 or EL1/EL0 context depending + * on the vcpu mode. + */ + u64 *hw_sys_regs; + u64 hw_sp_el1; + u64 hw_pstate; + u64 hw_elr_el1; + u64 hw_spsr_el1; }; typedef struct kvm_cpu_context kvm_cpu_context_t;