From patchwork Mon Jan 9 06:24:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9503943 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 8C15660757 for ; Mon, 9 Jan 2017 06:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C8F52808F for ; Mon, 9 Jan 2017 06:33:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70F242811C; Mon, 9 Jan 2017 06:33:02 +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 03A582808F for ; Mon, 9 Jan 2017 06:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162769AbdAIGau (ORCPT ); Mon, 9 Jan 2017 01:30:50 -0500 Received: from outprodmail02.cc.columbia.edu ([128.59.72.51]:52415 "EHLO outprodmail02.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939817AbdAIG0l (ORCPT ); Mon, 9 Jan 2017 01:26:41 -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 v096PWuh005289 for ; Mon, 9 Jan 2017 01:26:30 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id 4577382 for ; Mon, 9 Jan 2017 01:26:30 -0500 (EST) Received: from sendprodmail02.cc.columbia.edu (sendprodmail02.cc.columbia.edu [128.59.72.14]) by hazelnut (Postfix) with ESMTP id 125A78B for ; Mon, 9 Jan 2017 01:26:30 -0500 (EST) Received: from mail-qk0-f197.google.com (mail-qk0-f197.google.com [209.85.220.197]) by sendprodmail02.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096QTg3042973 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:26:29 -0500 Received: by mail-qk0-f197.google.com with SMTP id d75so52982815qkc.0 for ; Sun, 08 Jan 2017 22:26:29 -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=XrZgA5YNjrZY/U+EwT0x3BeblMmujqqQLgkqCTYsuYM=; b=c3YMtVMp86PWnMP60/2QYK0AJaUubMSSWnkpMH2xrKNiV2YfueUB/5OtgwuJQ/eQ+W Sin30wj0Tg6iTvOl1cU5UYrg3iQtKSMCXPsjVJ7dxDC49R/bMub0J+XzMg1ENpJZsoAy ikoTeOy+iLSmFwPE0plLkShZMJgrQRNDAlFOpCXf6XwwRf7y8pUEagO90F1BrCibFjJE dfu5SNOdNTghHOZwU1U6TGt9zoCJ+mVuNxKhhnhqIBlU/kJBURsTeKvTotXrl4LTUAnb MowxF0bZkgI3i7JgbjURrXqedidq/11Vbyfv6b/NVqbwjUgK7bcmeDmXlNmk91fUusm+ ws3w== X-Gm-Message-State: AIkVDXLIgYbHeZdHo3snyfPatSrUJ+FXvD3G87Z7dfkXxItpBFBD+RN2EpFtegvtQxHbF/NFMDj703Fd9KdQTTDE30yUwTDSPNxaLwrylM+dGzMKfkwFfBhCIgQB3tkgc+GRHj24Mw2fXVw= X-Received: by 10.55.26.159 with SMTP id l31mr86414459qkh.164.1483943189641; Sun, 08 Jan 2017 22:26:29 -0800 (PST) X-Received: by 10.55.26.159 with SMTP id l31mr86414441qkh.164.1483943189499; Sun, 08 Jan 2017 22:26:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 22:26:28 -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 46/55] KVM: arm64: Add more info to the S2 translation result Date: Mon, 9 Jan 2017 01:24:42 -0500 Message-Id: <1483943091-1364-47-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 From: Christoffer Dall When translating an L2 IPA to an L1 IPA, we some times need to know at which level this translation occurred and what the resulting permissions was, so populate the translation result structure with these additional fields. Signed-off-by: Christoffer Dall Signed-off-by: Jintack Lim --- arch/arm64/include/asm/kvm_mmu.h | 3 +++ arch/arm64/kvm/mmu-nested.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index bf94f0c..2ac603d 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -327,6 +327,9 @@ static inline unsigned int kvm_get_vmid_bits(void) struct kvm_s2_trans { phys_addr_t output; phys_addr_t block_size; + bool writable; + bool readable; + int level; }; #ifdef CONFIG_KVM_ARM_NESTED_HYP diff --git a/arch/arm64/kvm/mmu-nested.c b/arch/arm64/kvm/mmu-nested.c index b161b55..b579d23 100644 --- a/arch/arm64/kvm/mmu-nested.c +++ b/arch/arm64/kvm/mmu-nested.c @@ -236,6 +236,9 @@ static int walk_nested_s2_pgd(struct kvm_vcpu *vcpu, phys_addr_t ipa, (ipa & GENMASK_ULL(addr_bottom - 1, 0)); out->output = paddr; out->block_size = 1UL << ((3 - level) * stride + wi->pgshift); + out->readable = desc & (0b01 << 6); + out->writable = desc & (0b10 << 6); + out->level = level; return 0; }