From patchwork Wed Dec 30 16:26:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 7934171 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EC5B9BEEE5 for ; Wed, 30 Dec 2015 16:26:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 19D26202E6 for ; Wed, 30 Dec 2015 16:26:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C0F3202C8 for ; Wed, 30 Dec 2015 16:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222AbbL3Q0W (ORCPT ); Wed, 30 Dec 2015 11:26:22 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34114 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752046AbbL3Q0V (ORCPT ); Wed, 30 Dec 2015 11:26:21 -0500 Received: by mail-pa0-f46.google.com with SMTP id uo6so118715273pac.1 for ; Wed, 30 Dec 2015 08:26:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FFEd56cKb/Jq99GmkDoaud2hx75wUs4ARxr/9nRwYK0=; b=dQQoGZHXkITrFRQ/KTyfJVqHhpbAoWd1wSbbfX9kw5i6CSKTlGMq4axattfjnXcD/K dceLiGtOHtM7SiHa7cQbilYCCe02RKjOlPVWGLdDfsOb8vdLkDbAkclJ0ysyaQTAVKr/ xWkYAZuhm3k0sKyDVPZXyuXGVaaC66DbX4Bk+XZZuvcJHzF/7Q2pmdJGB9+4cq5R0kh5 wMUPk13D+twN/yYXcs7rMynwnLpkPoUBwFZ5p8znImbZyAHmYHM59fsoEl85NneAxDB+ 8TiUSRE3Rqcum3SyWsBxWxsgtdVJzVD9XA45Ca5e3DZetM8yttzSoksSWuhNGKx9Albd IdCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FFEd56cKb/Jq99GmkDoaud2hx75wUs4ARxr/9nRwYK0=; b=XToppPTnLs1b5Qy+H0KS6NiyuMI+v63jyzvE5Wy3u5E2yVSL6VBsZpdld9+Whcg/Yd +kOZNYdJ5LiJQVKH0kor0fGUuNvp5x4YArpUFKY458s8z71nXqYRLDmtg2+V2AGvemje mzvrgtF400hhhIbWdfkPbaoMqXvpZOWfb16wFA2hFCkMPULAig7UK08ERCyHHwAQ45nP 8YRR3G5Jh/JqJvHVD/1qYPFtsfNGBFK8WTLtV07MvP46wVh+mIE8uzxdxLoS8yOsmu4I lGtmgdgXRezmHNU5RgeziXZ02iXJj2g6xmifIpdHy/i57psPwK0Y9wum4d0pS9a8aEmh 2fxA== X-Gm-Message-State: ALoCoQmWJZNoeOUekF9CiKiCcugjLKgYtdvwYG+R4/+hIGA1i+F0yJWKO1VQHTmXxpcH3i5S1BEPMHXNBBy2ShHBRR9pErJ8YA== X-Received: by 10.66.232.170 with SMTP id tp10mr95045475pac.38.1451492780675; Wed, 30 Dec 2015 08:26:20 -0800 (PST) Received: from dmatlack-linux.kir.corp.google.com ([172.31.88.63]) by smtp.gmail.com with ESMTPSA id s2sm31261810pfs.60.2015.12.30.08.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Dec 2015 08:26:20 -0800 (PST) From: David Matlack To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, David Matlack Subject: [PATCH] kvm: x86: fix comment about {mmu,nested_mmu}.gva_to_gpa Date: Wed, 30 Dec 2015 08:26:17 -0800 Message-Id: <1451492777-7454-1-git-send-email-dmatlack@google.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The comment had the meaning of mmu.gva_to_gpa and nested_mmu.gva_to_gpa swapped. Fix that, and also add some details describing how each translation works. Signed-off-by: David Matlack --- arch/x86/kvm/mmu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index e7c2c14..098a9c2 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4058,10 +4058,12 @@ static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu) g_context->inject_page_fault = kvm_inject_page_fault; /* - * Note that arch.mmu.gva_to_gpa translates l2_gva to l1_gpa. The - * translation of l2_gpa to l1_gpa addresses is done using the - * arch.nested_mmu.gva_to_gpa function. Basically the gva_to_gpa - * functions between mmu and nested_mmu are swapped. + * Note that arch.mmu.gva_to_gpa translates l2_gpa to l1_gpa using + * L1's nested page tables (e.g. EPT12). The nested translation + * of l2_gva to l1_gpa is done by arch.nested_mmu.gva_to_gpa using + * L2's page tables as the first level of translation and L1's + * nested page tables as the second level of translation. Basically + * the gva_to_gpa functions between mmu and nested_mmu are swapped. */ if (!is_paging(vcpu)) { g_context->nx = false;