From patchwork Thu Feb 1 18:59:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 126584 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1977500ljc; Thu, 1 Feb 2018 10:59:47 -0800 (PST) X-Google-Smtp-Source: AH8x226hV15aEDAdi6kFekEbY3pRR+eDwRGTVQul4R2uQP1X6habIXSOic4u3Ue4GgWnEdlmo4LN X-Received: by 10.13.228.1 with SMTP id n1mr16364822ywe.6.1517511586918; Thu, 01 Feb 2018 10:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517511586; cv=none; d=google.com; s=arc-20160816; b=JIERT6eczcnv35CsOE/cTLgzY31dELeHWpWkF9B/8kitbXH4nAxZinhOCbabn4toxT uTmSYWJVsDK1vmpC63kilimzDjfQapZO52tVpVBLDI77EcgpCCYZuMe6ZbU41/Smz7p8 XouUt8UAbETuCZSm8qXGsGt80OgSX3SXy8CS7D/2PQPYuS636m5TBQzTjm50I/NmZRdK XX12T6lk9+yY9d89m92HjZ5iUGL4jjWUYwhr4XZNGMuvwqXhTRxaXelfvnb7CfxCzgCn Jc1ZF3nq7L0Ojs6LfnS2Sg3CiSUHgQwKmZX3rgJkUYpSe/MJCeKa9z1zaaQsaMr2HxdN t9pg== 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=HeRgkkJvlpwRnJw6m0neGXSr1i/mq3/IC4ktRq4o57I=; b=eoXcEYNrhDL4diIZ8r2LYVEL/lVINcCMMclgu8+28WZO0M+EHGDXsHUjE+lYKtGjOg I193Lp5xJhd2sFldj63wVPsm2cWgXmUJcfbDRLzAjn2Dgchy9X2267JDKyyNhpjefb+H cKZtpqBKhxEFPR1qbG/BdLomT2djJTwRK6LraZ+TlL4wKA05rO+8tiMOjvVqNUxyRpBy upxBxHx0PTsvGDicDqk8MMdZlVVzABpYSj5vNrXmENUlXsHTBiAXZ0TcOv4gEFSiRHY1 XTvznzTWSgqwJti2UV55cvghWlBDzHLJ2jFST3jEX+EO9movPfD3DbBdOfs9R+4xBaoh CPtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PsEr/hl4; 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 d76si44754ybh.425.2018.02.01.10.59.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Feb 2018 10:59:46 -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=PsEr/hl4; 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]:54896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehK5K-0000L1-6T for patch@linaro.org; Thu, 01 Feb 2018 13:59:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehK4q-0000J6-Rh for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:59:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehK4n-0001N2-0H for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:59:16 -0500 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:44325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehK4m-0001MD-Qt for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:59:12 -0500 Received: by mail-oi0-x243.google.com with SMTP id b3so11250482oib.11 for ; Thu, 01 Feb 2018 10:59:12 -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=HeRgkkJvlpwRnJw6m0neGXSr1i/mq3/IC4ktRq4o57I=; b=PsEr/hl489WGaiViMI93z1f+brm+WJkFN0DZM1lTTHqJbPi1m1dt/w8j9scX9beNQA /vNvLWcdf7gbhj70Hy9K2MORjjaOgroKU5rJekskBWTUzcg8pOuQDZ6rNkohhVEtY6lG U/lAqihh1RKxNEPciZqkjgHXVaGvLCrw2B9aJb3XJK7mf6+FnFaqZqIf9GmjJy4ASLZ6 e8ZF1k5wqx42l6aj3bmBFB+2MKdUPwLX0TNdVojyaV4sOb35kPSKNGGYJYqmZKd7L6Hw vvu+c7btJBnHN5YW4VoifEhajWEaxfEJuo33RhdihpPMvGRH3wMaC7d/9amOe3MKpz5S Lshw== 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=HeRgkkJvlpwRnJw6m0neGXSr1i/mq3/IC4ktRq4o57I=; b=F48Va4st9dziSRs91SWdASnycSO96Fc0BkxQBTDRNvOSgRmXTUQrPY/kRBxge9rBXK Wliit+eXUKah3POsIsQjEWPGiT4+/HoESSX47tqkotkUu1ANcNv/h3g37Ylp1aOco/6w BKZLYxnbLmE5TyrEVFfmu+88t6eLH5XkOpqIrOEkieNgUzfArLYulsDyPMS03i+qX6A6 6Fv0PVQQXAQ0WKGgH2Q70AiR750klgKAFY8nOE9arYM9SwppagiiCyfON2hg5l4Gqz8k MxBVdz0Iq+K3p4lwWuMhYSALGhc2A/6DustE0GmxFM8jouRnyCFqNJsXch6eXTDOON/w AHvQ== X-Gm-Message-State: AKwxytdAHAQaltRvVx53UCUBuFXIk4wJICd76J7AhTfaZN9o8C5EGjzC UzejzYyRsff7LjHu0NjA4WkVcc4= X-Received: by 10.202.226.204 with SMTP id z195mr3582074oig.141.1517511551808; Thu, 01 Feb 2018 10:59:11 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id e7sm101894oic.50.2018.02.01.10.59.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 10:59:10 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id E59A09E7; Thu, 1 Feb 2018 12:59:09 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 26AE43000A6; Thu, 1 Feb 2018 12:59:09 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 1 Feb 2018 12:59:07 -0600 Message-Id: <1517511547-10147-3-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517511547-10147-1-git-send-email-minyard@acm.org> References: <1517511547-10147-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::243 Subject: [Qemu-devel] [PATCH 2/2] ipmi: Use proper struct reference for BT vmstate 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard The vmstate for isa_ipmi_bt was referencing into the bt structure, instead create a bt structure separate and use that. The version 1 of the BT transfer was fairly broken, if a migration occured during an IPMI operation, it is likely the migration would be corrupted because I misunderstood the VMSTATE_VBUFFER_UINT32() handling, I thought it handled transferring the length field, too. So I just remove support for that. I doubt anyone is using it at this point. This also removes the transfer of use_irq, since that should come from configuration. Signed-off-by: Corey Minyard --- hw/ipmi/isa_ipmi_bt.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index e946030..a990ab7 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -450,22 +450,39 @@ static void isa_ipmi_bt_realize(DeviceState *dev, Error **errp) isa_register_ioport(isadev, &iib->bt.io, iib->bt.io_base); } -static const VMStateDescription vmstate_ISAIPMIBTDevice = { - .name = TYPE_IPMI_INTERFACE, + +const VMStateDescription vmstate_IPMIBT = { + .name = TYPE_IPMI_INTERFACE_PREFIX "bt", .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_BOOL(bt.obf_irq_set, ISAIPMIBTDevice), - VMSTATE_BOOL(bt.atn_irq_set, ISAIPMIBTDevice), - VMSTATE_BOOL(bt.use_irq, ISAIPMIBTDevice), - VMSTATE_BOOL(bt.irqs_enabled, ISAIPMIBTDevice), - VMSTATE_UINT32(bt.outpos, ISAIPMIBTDevice), - VMSTATE_VBUFFER_UINT32(bt.outmsg, ISAIPMIBTDevice, 1, NULL, bt.outlen), - VMSTATE_VBUFFER_UINT32(bt.inmsg, ISAIPMIBTDevice, 1, NULL, bt.inlen), - VMSTATE_UINT8(bt.control_reg, ISAIPMIBTDevice), - VMSTATE_UINT8(bt.mask_reg, ISAIPMIBTDevice), - VMSTATE_UINT8(bt.waiting_rsp, ISAIPMIBTDevice), - VMSTATE_UINT8(bt.waiting_seq, ISAIPMIBTDevice), + VMSTATE_BOOL(obf_irq_set, IPMIBT), + VMSTATE_BOOL(atn_irq_set, IPMIBT), + VMSTATE_BOOL(irqs_enabled, IPMIBT), + VMSTATE_UINT32(outpos, IPMIBT), + VMSTATE_UINT32(outlen, IPMIBT), + VMSTATE_UINT8_ARRAY(outmsg, IPMIBT, MAX_IPMI_MSG_SIZE), + VMSTATE_UINT32(inlen, IPMIBT), + VMSTATE_UINT8_ARRAY(inmsg, IPMIBT, MAX_IPMI_MSG_SIZE), + VMSTATE_UINT8(control_reg, IPMIBT), + VMSTATE_UINT8(mask_reg, IPMIBT), + VMSTATE_UINT8(waiting_rsp, IPMIBT), + VMSTATE_UINT8(waiting_seq, IPMIBT), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_ISAIPMIBTDevice = { + .name = TYPE_IPMI_INTERFACE_PREFIX "isa-bt", + .version_id = 2, + .minimum_version_id = 2, + /* + * Version 1 had messed up the array transfer, it's not even usable + * because it used VMSTATE_VBUFFER_UINT32, but it did not transfer + * the buffer length, so random things would happen. + */ + .fields = (VMStateField[]) { + VMSTATE_STRUCT(bt, ISAIPMIBTDevice, 1, vmstate_IPMIBT, IPMIBT), VMSTATE_END_OF_LIST() } };