From nobody Wed Nov 5 14:23:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534797815613166.1528681335716; Mon, 20 Aug 2018 13:43:35 -0700 (PDT) Received: from localhost ([::1]:49228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frr1S-0001Vu-FY for importer@patchew.org; Mon, 20 Aug 2018 16:43:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frqlF-0002rN-2p for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frql2-0002WH-Bi for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:46 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:45091) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frqkw-0002Jh-Lv for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:32 -0400 Received: by mail-oi0-x244.google.com with SMTP id q11-v6so28133482oic.12 for ; Mon, 20 Aug 2018 13:26:29 -0700 (PDT) Received: from serve.minyard.net ([47.184.170.128]) by smtp.gmail.com with ESMTPSA id p7-v6sm9339221oif.35.2018.08.20.13.26.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 13:26:28 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:7d98:76b7:e7fd:495f]) by serve.minyard.net (Postfix) with ESMTPA id 76919127C; Mon, 20 Aug 2018 15:26:24 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 8B5A9300108; Mon, 20 Aug 2018 15:26:21 -0500 (CDT) 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=6um9LCgQm8RB2FF4sWnJ/rKBGigVWim2d8i4e7toEqQ=; b=PaI8k4/ZanzyPw1jVc5PETFIAAHP0rypRI5xM35m69CzoV9CRVx+lZg+wG+FbNlYo2 g8MPxoD26jRFRHjlyXsF1KYuDR+QYmDK97LjGgUz49zMCXABfxeyD2I5bOyrt0wfQvft 3jdvlonPdEXw/rK0HSun/Izd431QI00oc4JFEJ6jKeFpCUO+4PfsWy/V37CCtN/SRQ80 ILkggWkeEC/1+YzrJikzVn140IB2402xNfWBJ8VSFh0VRpdJz0wCoVQbHk5o1Z1A3TZb 44/QZATaGuB8f1jAcJoT9eM3/jDCoB2X6SXuQ8g634ZDuMICSUxEv/lJXBTlPB8Ldgok omng== 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=6um9LCgQm8RB2FF4sWnJ/rKBGigVWim2d8i4e7toEqQ=; b=nwsKd4oq1b8klu/xdyekGCLYhu7InbhkuINOxHV+LGOW01P9DuI3gaZTrvQ+cqkxml /VxO11lbb5cKH9p0YMbQA3ubavDNN+mHJl3l8Q2jQZdlCDXPjkTQeHkA8ySfxRhpxJOm wB0ZqbDwZKvKr5xXV8uReTUI806zZSP+AH6zM0qy1NTtJbMh9C5W872FTeN4T2h/vCi/ gClK+Rt8AiAjxJYePWRsqe1/3fbp750DlpYhqOlKSKq7EYNDkUKadcHp+uOYOmT2iEDX MXRBLgH+pn4sA9XwH5xcqf/uR1BpPTfZ+IPvLFPZsTIaKirtd/2tDU92KoqzojBq8++T DyzQ== X-Gm-Message-State: AOUpUlE6fuksQhbAgFqvWqRpRG5E/pLEAc2e8bgds5JkTQcmUEZhBYuk b6RGz2kYayFXGdRzq4o7QTgsQz0= X-Google-Smtp-Source: AA+uWPwqnaXbEnO/KqAvlzdtqcE0ZEPssGZugvit9WrUp90aMisiHjhdOXxvJA4ybYT4d55AOrC9kQ== X-Received: by 2002:aca:a56:: with SMTP id 83-v6mr14539080oik.57.1534796789172; Mon, 20 Aug 2018 13:26:29 -0700 (PDT) From: minyard@acm.org To: Paolo Bonzini , qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 15:26:05 -0500 Message-Id: <1534796770-10295-6-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534796770-10295-1-git-send-email-minyard@acm.org> References: <1534796770-10295-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:4003:c06::244 Subject: [Qemu-devel] [PATCH v2 05/10] 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 , "Dr . David Alan Gilbert" , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Cc: Dr. David Alan Gilbert --- hw/acpi/piix4.c | 3 ++- hw/i2c/pm_smbus.c | 20 ++++++++++++++++++++ hw/i2c/smbus_ich9.c | 5 +++-- include/hw/i2c/pm_smbus.h | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 6404af5..f8d8d2e 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -309,7 +309,7 @@ static const VMStateDescription vmstate_cpuhp_state =3D= { */ static const VMStateDescription vmstate_acpi =3D { .name =3D "piix4_pm", - .version_id =3D 3, + .version_id =3D 4, .minimum_version_id =3D 3, .minimum_version_id_old =3D 1, .load_state_old =3D acpi_load_old, @@ -320,6 +320,7 @@ static const VMStateDescription vmstate_acpi =3D { 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, 4, 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 32132be..9e11d47 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -383,6 +383,26 @@ static const MemoryRegionOps pm_smbus_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 +const VMStateDescription pmsmb_vmstate =3D { + .name =3D "pmsmb", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (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_UINT32(smb_index, PMSMBus), + VMSTATE_UINT8_ARRAY(smb_data, PMSMBus, PM_SMBUS_MAX_MSG_SIZE), + 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 =3D true; diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c index a66a114..c8b8413 100644 --- a/hw/i2c/smbus_ich9.c +++ b/hw/i2c/smbus_ich9.c @@ -45,10 +45,11 @@ typedef struct ICH9SMBState { =20 static const VMStateDescription vmstate_ich9_smbus =3D { .name =3D "ich9_smb", - .version_id =3D 1, + .version_id =3D 2, .minimum_version_id =3D 1, .fields =3D (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, struct ICH9SMBState), + VMSTATE_PCI_DEVICE(dev, ICH9SMBState), + VMSTATE_STRUCT(smb, ICH9SMBState, 2, 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 { =20 void pm_smbus_init(DeviceState *parent, PMSMBus *smb); =20 +extern const VMStateDescription pmsmb_vmstate; + #endif /* PM_SMBUS_H */ --=20 2.7.4