From patchwork Wed May 29 12:41:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 1107135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45DVjp6rH5z9sB8 for ; Wed, 29 May 2019 22:42:54 +1000 (AEST) Received: from localhost ([127.0.0.1]:53649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVxuu-0001GY-Ts for incoming@patchwork.ozlabs.org; Wed, 29 May 2019 08:42:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVxu4-0001EC-4Q for qemu-devel@nongnu.org; Wed, 29 May 2019 08:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVxu3-0004ba-8a for qemu-devel@nongnu.org; Wed, 29 May 2019 08:42:00 -0400 Received: from mail.ispras.ru ([83.149.199.45]:56908) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVxu3-0004aN-2R for qemu-devel@nongnu.org; Wed, 29 May 2019 08:41:59 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id C71DF540081; Wed, 29 May 2019 15:41:56 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 29 May 2019 15:41:56 +0300 Message-ID: <155913371654.8429.1659082639780315242.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH] target/i386: save EFER for 32-bit targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, dovgaluk@ispras.ru, ehabkost@redhat.com, pavel.dovgaluk@ispras.ru, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" i386 (32 bit) emulation uses EFER in wrmsr and in MMU fault processing. But it does not included in VMState, because "efer" field is disabled with #ifdef TARGET_X86_64 This patch adds a section for 32-bit targets which saves EFER when it's value is non-zero. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Peter Xu --- target/i386/machine.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/i386/machine.c b/target/i386/machine.c index 225b5d433b..b5bfc5803e 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -964,6 +964,27 @@ static const VMStateDescription vmstate_svm_npt = { } }; +#ifndef TARGET_X86_64 +static bool intel_efer32_needed(void *opaque) +{ + X86CPU *cpu = opaque; + CPUX86State *env = &cpu->env; + + return env->efer != 0; +} + +static const VMStateDescription vmstate_efer32 = { + .name = "cpu/efer32", + .version_id = 1, + .minimum_version_id = 1, + .needed = intel_efer32_needed, + .fields = (VMStateField[]) { + VMSTATE_UINT64(env.efer, X86CPU), + VMSTATE_END_OF_LIST() + } +}; +#endif + VMStateDescription vmstate_x86_cpu = { .name = "cpu", .version_id = 12, @@ -1089,6 +1110,9 @@ VMStateDescription vmstate_x86_cpu = { &vmstate_msr_intel_pt, &vmstate_msr_virt_ssbd, &vmstate_svm_npt, +#ifndef TARGET_X86_64 + &vmstate_efer32, +#endif NULL } };