From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH kvm-unit-tests] Honor cpuid.nx when enabling efer.nxe Date: Tue, 21 Dec 2010 18:40:53 +0200 Message-ID: <1292949653-21940-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52771 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936Ab0LUQlN (ORCPT ); Tue, 21 Dec 2010 11:41:13 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBLGfCuG029550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Dec 2010 11:41:12 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oBLGfBA0023863 for ; Tue, 21 Dec 2010 11:41:12 -0500 Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Avi Kivity --- x86/vmexit.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/x86/vmexit.c b/x86/vmexit.c index 551083d..67746c6 100644 --- a/x86/vmexit.c +++ b/x86/vmexit.c @@ -144,7 +144,8 @@ static void do_test(struct test *test) static void enable_nx(void *junk) { - wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_NX_MASK); + if (cpuid(0x80000001).d & (1 << 20)) + wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_NX_MASK); } int main(void) -- 1.7.1