From patchwork Tue Mar 1 22:34:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Feiner X-Patchwork-Id: 8471131 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9A7609F2F0 for ; Tue, 1 Mar 2016 22:35:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAF9520304 for ; Tue, 1 Mar 2016 22:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC2682034A for ; Tue, 1 Mar 2016 22:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbcCAWfb (ORCPT ); Tue, 1 Mar 2016 17:35:31 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:33137 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752083AbcCAWf3 (ORCPT ); Tue, 1 Mar 2016 17:35:29 -0500 Received: by mail-pf0-f179.google.com with SMTP id 124so59087487pfg.0 for ; Tue, 01 Mar 2016 14:35:29 -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=E/Ag4TC3Zjwztyih8W0IK4KmtIJDbPF/9Gk++u6gBEnJX7oT2Jnwypv4dfVN1da0sD yv6YCP7Psg0bSUsPnFmmzs7xiFg2liI4Q2BgyZ42PkDkiq/dQoTXZ+W84DrECQZl9ANe iSkLqNsvabOiy8g8hOioxtYf8or6X6NEOvKXUdy/f/Yhl5oZplJtf04OqyxuMqTYxNWr HKrpJdkCGIWb9/I7S4mNE+OZfeKHnJ5140czL4QOKZbxoM1mfiixPoY3ga3Wp8+oLR4h 8h6KGNWsHtS6FkLhZRlezooxn4qNmOgD8nWfWNsKd3kCH2qkWSMtzcVxWjjEreEhx9WF rRiA== 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=DzYWLFewphcwluLRZBflUEwrwx8fquDgJkjIZdezG5RoN9S3VLnxDXCs6vUrF5n5dX SP8esXrfk2yV21+mvqY7Njut65JSvowUiMve1UtPrz7Px4AA/SPtTkzfCyeySBpUbsWU wtyc0muGhmcen+kZPF2FTCDafejewqc5ey3yMIb2i5FRKy+rKzBl12pIbBYB0d6Helhm 8QA/6EIvPBlJZLpxVi1d8AS4qtteuH3oy/wFeXL3DAi6cafg31zSxfJCAXynU5eNv4Pw 2oEBQfIyi/LKt80nbGNYDjp9vy0R8ASm4wV24PgUk+CxTbgcF3Xpfhcw1aBUSyUTk8tG mGTg== X-Gm-Message-State: AD7BkJL7Ya39tbzJyqXgYb1miKZ+zZZs4M/lvdNK8AhpE/zn/txs54lOuVLOrHRSl4zAx0PP X-Received: by 10.98.14.2 with SMTP id w2mr15508124pfi.35.1456871728839; Tue, 01 Mar 2016 14:35:28 -0800 (PST) Received: from localhost ([2620:0:1009:3:b1e9:1d95:1ce5:e70c]) by smtp.gmail.com with ESMTPSA id u5sm47845187pfi.15.2016.03.01.14.35.27 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 01 Mar 2016 14:35:27 -0800 (PST) From: Peter Feiner To: kvm@vger.kernel.org, jan.kiszka@siemens.com, drjones@redhat.com, pbonzini@redhat.com Cc: pfeiner@google.com Subject: [kvm-unit-tests v2 6/6] x86: vmx: don't explicitly split identity EPT map Date: Tue, 1 Mar 2016 14:34:54 -0800 Message-Id: <1456871694-23042-7-git-send-email-pfeiner@google.com> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456871694-23042-1-git-send-email-pfeiner@google.com> References: <1456860622-31251-1-git-send-email-pfeiner@google.com> <1456871694-23042-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);