From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Nested paging in nested SVM setup Date: Thu, 21 Aug 2014 13:24:57 +0200 Message-ID: <53F5D709.3060207@redhat.com> References: <53A179C4.9060203@gmail.com> <53A18A6D.2050407@siemens.com> <53F44440.6070408@gmail.com> <53F44645.2000708@redhat.com> <53F45036.1070309@gmail.com> <53F45832.5080708@redhat.com> <53F59192.3070500@gmail.com> <53F5B250.3000206@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Valentine Sinitsyn , Jan Kiszka , kvm@vger.kernel.org Return-path: Received: from mail-we0-f177.google.com ([74.125.82.177]:42120 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753929AbaHULZC (ORCPT ); Thu, 21 Aug 2014 07:25:02 -0400 Received: by mail-we0-f177.google.com with SMTP id w62so9173741wes.22 for ; Thu, 21 Aug 2014 04:25:01 -0700 (PDT) In-Reply-To: <53F5B250.3000206@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 21/08/2014 10:48, Valentine Sinitsyn ha scritto: > > No kvm_apic: after NPTs are set up, no page faults caused by register > read (error_code: d), to trap and emulate APIC access. It seems to work for VMX (see the testcase I just sent). For SVM, can you check if this test works for you, so that we can work on a simple testcase? The patch applies to git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git and you can run the test like this (64-bit host): ./configure make ./x86-run x86/svm.flat -cpu host Paolo diff --git a/x86/svm.c b/x86/svm.c index a9b29b1..aff00da 100644 --- a/x86/svm.c +++ b/x86/svm.c @@ -797,6 +797,27 @@ static bool npt_pfwalk_check(struct test *test) && (test->vmcb->control.exit_info_2 == read_cr3()); } +static void npt_l1mmio_prepare(struct test *test) +{ + vmcb_ident(test->vmcb); +} + +u32 nested_apic_version; + +static void npt_l1mmio_test(struct test *test) +{ + u64 *data = (void*)(0xfee00030UL); + + nested_apic_version = *data; +} + +static bool npt_l1mmio_check(struct test *test) +{ + u64 *data = (void*)(0xfee00030); + + return (nested_apic_version == *data); +} + static void latency_prepare(struct test *test) { default_prepare(test); @@ -962,6 +983,8 @@ static struct test tests[] = { default_finished, npt_rw_check }, { "npt_pfwalk", npt_supported, npt_pfwalk_prepare, null_test, default_finished, npt_pfwalk_check }, + { "npt_l1mmio", npt_supported, npt_l1mmio_prepare, npt_l1mmio_test, + default_finished, npt_l1mmio_check }, { "latency_run_exit", default_supported, latency_prepare, latency_test, latency_finished, latency_check }, { "latency_svm_insn", default_supported, lat_svm_insn_prepare, null_test,