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: 9504087 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 695D060710 for ; Mon, 9 Jan 2017 06:44:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57BD3280DE for ; Mon, 9 Jan 2017 06:44:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A6B82811E; Mon, 9 Jan 2017 06:44:13 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB189280DE for ; Mon, 9 Jan 2017 06:44:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cQTgg-0007KS-Bl; Mon, 09 Jan 2017 06:44:10 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQTgG-0006KB-24 for linux-arm-kernel@bombadil.infradead.org; Mon, 09 Jan 2017 06:43:44 +0000 Received: from outprodmail01.cc.columbia.edu ([128.59.72.39]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQTQ6-00034k-R9 for linux-arm-kernel@lists.infradead.org; Mon, 09 Jan 2017 06:27:04 +0000 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail01.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096PXwU017320 for ; Mon, 9 Jan 2017 01:26:42 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id B638C6D for ; Mon, 9 Jan 2017 01:26:42 -0500 (EST) Received: from sendprodmail04.cc.columbia.edu (sendprodmail04.cc.columbia.edu [128.59.72.16]) by hazelnut (Postfix) with ESMTP id 94A7A6D for ; Mon, 9 Jan 2017 01:26:42 -0500 (EST) Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by sendprodmail04.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096QgON006038 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:26:42 -0500 Received: by mail-qk0-f198.google.com with SMTP id d75so52985259qkc.0 for ; Sun, 08 Jan 2017 22:26:42 -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=JjDRqhStjU1IiclDVhyIF0EJOcMo67V819D7+dxO4BQUafjgxwKpGIqZqmAVaHfcho cApx0w8MLHFQ1nGD1h0CPsBrmKZfoCVxU0Rbg83iheAkCFabpMwVLViFiIernxvvrBYC qC1/ILw0ntdB+SkwBWjEsEJVAGj4+ghldob0rYSBAyO5g9Y3xGIytsw7hFY4ldQnmTMu i50WVsSS7DxBLAovXVeaGAVlK9Wntt2Us7a/MKiV6vydU7PYDxunx6s1qS0v8PuNgVIl kdrqx+QSBOsXXdZkxCSnwpSZkri/GsjLYikOBHKxKNxZTs5LnvIT/dkcih64pRW8NiwO yoXQ== X-Gm-Message-State: AIkVDXJkcbyhKlaxGjDK7PgCNRPOsHAhOOlVdaQFWystLAfpXNMWn9QlIXhaCon+ypXDxrGPKGVQcdi9TeZI6+9lOuh3vaJYh2Kdjg+oomEiW2lvMbZAoIdPSLIi2Uv4Xar7I7mt3qs7K4DzgPVpkB8uPBWSOep/Tj/rcg== X-Received: by 10.55.26.159 with SMTP id l31mr86414981qkh.164.1483943202182; Sun, 08 Jan 2017 22:26:42 -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 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.16 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170109_062703_079025_0748D8C2 X-CRM114-Status: GOOD ( 13.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jintack@cs.columbia.edu MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }