From patchwork Thu Dec 7 21:46:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 121095 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8903382qgn; Thu, 7 Dec 2017 13:52:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ5eeNxG2ZjgokIfTTjgqNg7vW5i1UZrCXZOLGkiO3xJN3rNx8+INry5xRF1PHTAZvKGeWG X-Received: by 10.129.175.10 with SMTP id n10mr18988575ywh.263.1512683527709; Thu, 07 Dec 2017 13:52:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512683527; cv=none; d=google.com; s=arc-20160816; b=xSCxPJzjchilrJXaaRdECflzMDzUebj+9/bFbqNeYsOaf8Roc9XuK3AM/APcT16JC1 3u1BNoyqZMqtDff61N01Ok1eqRKgzV+puU1t0tvK0yFLx9pCUaKcpPtHQY7fKXEDstJq Sooy4Ch/Osn6e3rXD0mmADZl3B3nh/h84URMySW31QPujk5AWt1HEwRk5HR9dOxFtV3z 67G75U0nJ8C0wgi0noGQIeWgMgDkSg+/pdLALw0nUbTaRVDXLX2z6lDgp9uCoaQQ38C5 ZG/TEMr+iRbsa1WG0UvVj1gEb6cjdkxr22qsDiie1UpOWV7SsG43X3q9wPupvSdvLXfx aTGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=jpmK1Igkm3NFGVKTiC4/qQJV3D4/E8c+EEW3KID+uZQ=; b=gjiRUWjCG6jOFL+WKXQ4uLWjltaQZvZi0mR4SQCUNxR/4rjBA682IWI/+K5g3cN4uf 0DRUUo/fEC9etTKs/Epi5NWcbpcjpfYd8iQYajS3ZJ4jQyChZiZF4exb2sl3lQiH7bnM hYw/Bwp8ATtN3aPqJHjP03cbIwHEZz+ZoEzMdPAyJX6H+tWnFe7mC/2dxVpI/1ep4vgy n3UP5Pcz+qcqgJgT/ImNL9HFShbVM+U3cZfTPO67eIRurJ+PYYnCQaXdYLVb67V7XJYZ 8/4Qsv/2pelA2jFW4a7m0Dyb34EVhjQPEF9ytvS7gJOcy3qOZkH2wYtue7ZfaDVwCrVv zGcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HcPhFbPU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r4si1345838ywd.139.2017.12.07.13.52.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Dec 2017 13:52:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HcPhFbPU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:34524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN45P-00008G-6p for patch@linaro.org; Thu, 07 Dec 2017 16:52:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN401-00041G-Cv for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eN400-0006OP-8L for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:33 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:42451) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eN400-0006Mp-1i for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:32 -0500 Received: by mail-pg0-x244.google.com with SMTP id e14so5385658pgr.9 for ; Thu, 07 Dec 2017 13:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jpmK1Igkm3NFGVKTiC4/qQJV3D4/E8c+EEW3KID+uZQ=; b=HcPhFbPUXF5lC1Covv19MvacrUpvuywwDs04akFru/rwMBHpHKpHMCjVIIA44rOFV1 s6b9HDwYAgGClQLRB2k/4M/KcVxTMQ35Q3XAKnC/9r+qajWHMar8nTnJMdaPU94uhsFF RLfFsBISK1Oajl2Cickly0GflUyz7yAxNzHoOj337FdJl4RbFjr9F+NieTRTRLdK3i8e hH/8523nvciyX2ALAThWZkURByhHpAqhWZtBmPtCH7Xq3tG9mUSeqUaCFooSciuuCytH KeE4yfBEVh9X2jaBQFn2EUjUy8EWzJkIaT5G+0m6HSqh1zbO/tT8pGh5s1d0jQdYWZvi fKNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=jpmK1Igkm3NFGVKTiC4/qQJV3D4/E8c+EEW3KID+uZQ=; b=RU7bBe39uwT74RXkHfezX93JOK60nrMy3EOXI+Qn0EeM4nUgTECoXGOSlYB2Qt61gM 0jb3JnqDjiIB8oQhZNyADMg37Tzy/TYGQ5CkGAKa9yhZPiUcrrpScBa3/oFY1vK0MqKK gD7iSvn8UQn5dTCC1wY7CGwdrQKNzg+Nze8h7ozSOabXRz6xFWTxl3hdsrgTTGQVKCJD rXI/NpGAlt+TyUEW248GMXyeJFtEEmwj0oGeBohuX3qEPLMbe75VK/U0MdRc7cM5bcw+ p1Up9oVeK0QnC90/6OZAEEe9b6dhVnC0s4RZqoyw8r31qQSOeYGXBXADbSpr3+z8npwZ xijA== X-Gm-Message-State: AJaThX5YT7KRFTJEZI+6ibOi32y7dOU+VMu0F6kO/AUOT0oXoZaOfYRY UBTZXF8i6tElPXhkZIztRw== X-Received: by 10.99.120.131 with SMTP id t125mr26147999pgc.83.1512683190991; Thu, 07 Dec 2017 13:46:30 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id u19sm10223959pfh.89.2017.12.07.13.46.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 13:46:29 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 3195FCF0; Thu, 7 Dec 2017 15:46:25 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 2A2EB302366; Thu, 7 Dec 2017 15:46:23 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 7 Dec 2017 15:46:12 -0600 Message-Id: <1512683181-8420-6-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512683181-8420-1-git-send-email-minyard@acm.org> References: <1512683181-8420-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH 05/14] i2c:pm_smbus: Fix state transfer 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: Corey Minyard , Paolo Bonzini , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Transfer the state information for the SMBus registers and internal data so it will work on a VM transfer. Signed-off-by: Corey Minyard Cc: Michael S. Tsirkin Cc: Paolo Bonzini --- hw/acpi/piix4.c | 1 + hw/i2c/pm_smbus.c | 19 +++++++++++++++++++ hw/i2c/smbus_ich9.c | 3 ++- include/hw/i2c/pm_smbus.h | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index a0fb1ce..18c1ffa 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -321,6 +321,7 @@ static const VMStateDescription vmstate_acpi = { VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState), VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState), VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_apm, APMState), + VMSTATE_STRUCT(smb, PIIX4PMState, 1, pmsmb_vmstate, PMSMBus), VMSTATE_TIMER_PTR(ar.tmr.timer, PIIX4PMState), VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState), VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE), diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c index 686d411..eb2df4d 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -370,6 +370,25 @@ static const MemoryRegionOps pm_smbus_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +const VMStateDescription pmsmb_vmstate = { + .name = "pmsmb", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT8(smb_stat, PMSMBus), + VMSTATE_UINT8(smb_ctl, PMSMBus), + VMSTATE_UINT8(smb_cmd, PMSMBus), + VMSTATE_UINT8(smb_addr, PMSMBus), + VMSTATE_UINT8(smb_data0, PMSMBus), + VMSTATE_UINT8(smb_data1, PMSMBus), + VMSTATE_VBUFFER_UINT32(smb_data, PMSMBus, 1, NULL, smb_index), + VMSTATE_UINT8(smb_auxctl, PMSMBus), + VMSTATE_BOOL(i2c_enable, PMSMBus), + VMSTATE_BOOL(op_done, PMSMBus), + VMSTATE_END_OF_LIST() + } +}; + void pm_smbus_init(DeviceState *parent, PMSMBus *smb) { smb->op_done = true; diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c index 59e165a..706b9ec 100644 --- a/hw/i2c/smbus_ich9.c +++ b/hw/i2c/smbus_ich9.c @@ -49,7 +49,8 @@ static const VMStateDescription vmstate_ich9_smbus = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, struct ICH9SMBState), + VMSTATE_PCI_DEVICE(dev, ICH9SMBState), + VMSTATE_STRUCT(smb, ICH9SMBState, 1, pmsmb_vmstate, PMSMBus), VMSTATE_END_OF_LIST() } }; diff --git a/include/hw/i2c/pm_smbus.h b/include/hw/i2c/pm_smbus.h index 99d5489..b1e1970 100644 --- a/include/hw/i2c/pm_smbus.h +++ b/include/hw/i2c/pm_smbus.h @@ -33,4 +33,6 @@ typedef struct PMSMBus { void pm_smbus_init(DeviceState *parent, PMSMBus *smb); +extern const VMStateDescription pmsmb_vmstate; + #endif /* PM_SMBUS_H */