From patchwork Wed Mar 2 17:10:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Feiner X-Patchwork-Id: 8483921 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 DA447C0553 for ; Wed, 2 Mar 2016 17:11:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1101C2022A for ; Wed, 2 Mar 2016 17:11:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 192C62038A for ; Wed, 2 Mar 2016 17:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754360AbcCBRLO (ORCPT ); Wed, 2 Mar 2016 12:11:14 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:34222 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754515AbcCBRLM (ORCPT ); Wed, 2 Mar 2016 12:11:12 -0500 Received: by mail-pf0-f175.google.com with SMTP id 4so58737262pfd.1 for ; Wed, 02 Mar 2016 09:11:11 -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=dQ6Mgcg12MM5pT+l8xRUdyl/GDUohPQhoyq2GSzFHS5SHtqXDV/4xCTVBpWyEks5yx E/B5Y54naNmufeDnUdkdMuxSTHYONCMwKmxbnkRBdNfSacyPecdXDApsfRHow8ORpWRq XYzyKss9hDESV9322OA1IdHaSRiQP9EOpQHNRObIkFExRoEUvGlBVIBxoJ1Q84uh+Ayq LU/MXgWTklUFr3fxGRvE7n33NAvmlS902+StgEfBze/JHPxzu0zFkkc5/ZywjfTikXI7 IRXddriMaYwnMxBe9llC1K+1h5rPsn09RhNxMGipthcBMq/7JrEOrudk8/PAxXMk8U4q DYWg== 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=d2w8NhL2S/POIpN21uoHzJG6cQiwCR7NQN+M2FJcKdXNhdR8t6OL1vXe9vgFJCAHfX nY1opdfrWKOHNIa5NJNjbyMsZOSM0WPk8wDJhimnuXYJbrbhfqgGluCJKBIaHaUOJxKT 5L2V//BjFCxJAIPfTWZruHrTC39Ie9MEiJhdXx+xpd5fwovQ3cbQoXlTIe8AEs/36tQy b0skmlKaZNLC2/2/in8b40AL0z/MbaWSnxiKVqK58V2l9NbCCn02WqJZFTIFXm789ACN so1Yf7+Cs0ht3uMzzrTFjMnYby1SoV97idOXy6guYN3AATzHZJu8UPWN/Xf1/np9MajX PEQQ== X-Gm-Message-State: AD7BkJIBdRoLVnTqm3KVLNOII8mvdgwjOf5JsV6KKf6dZutWLbjhjzCRDdayzvWvInN4gVdP X-Received: by 10.98.72.193 with SMTP id q62mr40315947pfi.117.1456938671422; Wed, 02 Mar 2016 09:11:11 -0800 (PST) Received: from localhost ([2620:0:1009:3:10b2:1b3a:febc:1b15]) by smtp.gmail.com with ESMTPSA id r5sm54397237pap.7.2016.03.02.09.11.10 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 02 Mar 2016 09:11:10 -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 v3 6/6] x86: vmx: don't explicitly split identity EPT map Date: Wed, 2 Mar 2016 09:10:57 -0800 Message-Id: <1456938657-20850-7-git-send-email-pfeiner@google.com> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456938657-20850-1-git-send-email-pfeiner@google.com> References: <1456860622-31251-1-git-send-email-pfeiner@google.com> <1456938657-20850-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);