From patchwork Mon Aug 20 20:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 144667 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4421075ljj; Mon, 20 Aug 2018 13:44:11 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyKPG4oq83ue28OhbVs8eMdgSQ3JAlpfau0rdYjvBeZ9CXvuOXXgmBGkFoZWN4zHz+6FCXt X-Received: by 2002:ac8:4789:: with SMTP id k9-v6mr12396271qtq.253.1534797851044; Mon, 20 Aug 2018 13:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534797851; cv=none; d=google.com; s=arc-20160816; b=dAloWm35YsGG+k6PSvNA4ubu679TBT0GQmDw71UxtSJRpl8qhmkDElUUosiA6YjpB1 k1Wy6u1+aNCJ+Xjrij3aQ19eDLIGrs/APP+jyS+Swwnxhksin5CGghO98hDvO9dp6DIl tzEQjfxVhK8yJ+V7QcxiJy+/gzjGDgutLJ498E2RMWJoMGzQJ/IWZuaWdnxe+h9FItA2 EQv34Ux8c0x+IUcqKdCPryJV6h3IbEeSkNMLJpVdmi2UbLYPND2U4nuqs+5TIQjYfPzR 5OxZS5ijS2/lc8D2zSJomYuKrMx+COSJfZqv9/+H1RJs96a8I1/GjTAw2ePRFaXnSoeE QmuQ== 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=6um9LCgQm8RB2FF4sWnJ/rKBGigVWim2d8i4e7toEqQ=; b=aF7UpI45SqCBknh0bhXKt54M0Mtl9W+UI2CV5f8KmwH9mlRzZMAmPwrKg6gR6jlL2b vdqTgiiBTZUR/V6hx4PLxPFXFJdiWcE9dzQIJDDWTwJj0utf5D3LJJUhwDU0crR5i9tc k+E2nNwS2Y9AiwvWMuzkscZd+w6TqZG46iCdZBExByIW8j8PmVQCPivOm9kktZREptNv qgbDnNw4X4d7RXqnn5ImNt4+/RCbb40ntrvbvVr/5+xjevVvRw7D8ivBOtVWmFZ/2izj CvF4c8Y7r5N6AmEmDiPt+GB198dNvoKoanfLKnFfThx3hMYpgyQ6PoPwV5LV4ZYvTEMT /Dhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="PaI8k4/Z"; 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 k8-v6si1087751qtg.106.2018.08.20.13.44.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Aug 2018 13:44:11 -0700 (PDT) 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="PaI8k4/Z"; 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]:49228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frr22-0001Vu-HL for patch@linaro.org; Mon, 20 Aug 2018 16:44:10 -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) 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-Received: by 2002:aca:a56:: with SMTP id 83-v6mr14539080oik.57.1534796789172; 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) 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+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 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(-) -- 2.7.4 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 = { */ static const VMStateDescription vmstate_acpi = { .name = "piix4_pm", - .version_id = 3, + .version_id = 4, .minimum_version_id = 3, .minimum_version_id_old = 1, .load_state_old = acpi_load_old, @@ -320,6 +320,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, 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 = { .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_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 = 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 { static const VMStateDescription vmstate_ich9_smbus = { .name = "ich9_smb", - .version_id = 1, + .version_id = 2, .minimum_version_id = 1, .fields = (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 { void pm_smbus_init(DeviceState *parent, PMSMBus *smb); +extern const VMStateDescription pmsmb_vmstate; + #endif /* PM_SMBUS_H */