From patchwork Tue Mar 1 19:30:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Feiner X-Patchwork-Id: 8469671 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 61121C0553 for ; Tue, 1 Mar 2016 19:31:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C4BB2034E for ; Tue, 1 Mar 2016 19:31:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2B4B20304 for ; Tue, 1 Mar 2016 19:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752083AbcCATbK (ORCPT ); Tue, 1 Mar 2016 14:31:10 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33646 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665AbcCATbI (ORCPT ); Tue, 1 Mar 2016 14:31:08 -0500 Received: by mail-pa0-f43.google.com with SMTP id fl4so117466994pad.0 for ; Tue, 01 Mar 2016 11:31:07 -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:in-reply-to:references; bh=58UgCOSQFp+HPsDQEBVvMIbG+2Xyyzn8X6+VER3ucPE=; b=gX8YhRnMKStrFPKj7f1K2rO3qYypPTEmQ7meZzNED5xkUm7Hs44rFQope8OpT+xA9B PcPpFqj1vItcgWm+vl2ZUQOb8uztR3EUZoqrKqdVIcpYJxbnSKrslRz7V1auAn4/GM9l rWA48dRr95kGzRQfMwcncZXVQhbOvx+SrPF9GrTlEqmZ3pOvKOt2iOCVSgkmTrrlNEBq sZQsrjIR1Raimx9ZaiJwciv+MGD+3iaQmcC1qLGOQQcsl0oGniFPqzSmmyIsVyRp82rs z+FnvqUQcfU+7TRBGC03NXln7+uZh86OS6pHVLcQN0PiUbFbwFVXuDEyvDyLIW93Qquq DjqQ== 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:in-reply-to :references; bh=58UgCOSQFp+HPsDQEBVvMIbG+2Xyyzn8X6+VER3ucPE=; b=KpEKi+QCnDpkMK7hkyr6K9G7M1ljeHHEabdQrMcOWVRv9ZoL6dTXefk3tsSBgxkKIb cIcg7yTxYZqzPAfrXZkuEf1vJ6mk0HYjlNpL+luwoyAz+LnV18N8vO0+wOdgex3OLZkk 0gOIfOi02x0qOp0Kg/G9qPgkKXsPyMXa7e9p/kuKpDyLSWCbRiV3JTpFYLc1TxNwcdgT sFEGAJhxyKwhYMXVU4KCbaJZy9F++tmxwfwrBon48fgo593v5L+Fs4yIODqGpkDzRD7a ijj6n3R/RCgMSp75d4NXZ/UCH/RFmQmp9v7hgWlyv0SoJSKfzQZMPblxS6QslJLKR+q2 3cqg== X-Gm-Message-State: AD7BkJKd+dln7MatK34V4Gmuk98VLXispnLjEtUBxCfRuFyq2X0mqyT+F/I4uv1PZUme2N5L X-Received: by 10.66.132.73 with SMTP id os9mr32511477pab.27.1456860667440; Tue, 01 Mar 2016 11:31:07 -0800 (PST) Received: from localhost ([2620:0:1009:3:b1e9:1d95:1ce5:e70c]) by smtp.gmail.com with ESMTPSA id ss5sm47470387pab.15.2016.03.01.11.31.06 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 01 Mar 2016 11:31:06 -0800 (PST) From: Peter Feiner To: kvm@vger.kernel.org, jan.kiszka@siemens.com, pbonzini@redhat.com Cc: pfeiner@google.com Subject: [kvm-unit-tests 5/5] x86: vmx: don't explicitly split identity EPT map Date: Tue, 1 Mar 2016 11:30:22 -0800 Message-Id: <1456860622-31251-6-git-send-email-pfeiner@google.com> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456860622-31251-1-git-send-email-pfeiner@google.com> References: <1456860622-31251-1-git-send-email-pfeiner@google.com> 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=unavailable 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 Since install_ept_entry automatically splits large EPTEs, it's no longer necessary to explicitly pave the EPT identity map with 4K entries mapping [base_addr1, base_addr1 + PAGE_SIZE_2M). I.e., install_ept(data_page1, data_page2) does the paving before installing the 4k data_page1 -> data_page2 mapping. The other setup_ept_range call was unnecessary. Note that there was benign bug in the deleted code. The third argument of setup_ept_range is length not end! Thus the range of GPA mappings being split was [base_addr1, base_addr1 * 2 + PAGE_SIZE_2M). Signed-off-by: Peter Feiner --- x86/vmx_tests.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index bb65c06..4ef2247 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -954,7 +954,6 @@ static int apic_version; static int ept_init() { - unsigned long base_addr1, base_addr2; u32 ctrl_cpu[2]; if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) || @@ -979,12 +978,6 @@ static int ept_init() memset(data_page2, 0x0, PAGE_SIZE); *((u32 *)data_page1) = MAGIC_VAL_1; *((u32 *)data_page2) = MAGIC_VAL_2; - base_addr1 = (unsigned long)data_page1 & PAGE_MASK_2M; - base_addr2 = (unsigned long)data_page2 & PAGE_MASK_2M; - setup_ept_range(pml4, base_addr1, base_addr1 + PAGE_SIZE_2M, 0, 0, - EPT_WA | EPT_RA | EPT_EA); - setup_ept_range(pml4, base_addr2, base_addr2 + PAGE_SIZE_2M, 0, 0, - EPT_WA | EPT_RA | EPT_EA); install_ept(pml4, (unsigned long)data_page1, (unsigned long)data_page2, EPT_RA | EPT_WA | EPT_EA);