From patchwork Thu Nov 15 19:24:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10684915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49AE414D6 for ; Thu, 15 Nov 2018 19:26:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C042CF97 for ; Thu, 15 Nov 2018 19:26:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 294CA2D001; Thu, 15 Nov 2018 19:26:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD71E2CFDF for ; Thu, 15 Nov 2018 19:26:19 +0000 (UTC) Received: from localhost ([::1]:40439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNNHO-0004Kl-8l for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Nov 2018 14:26:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNNG7-0003OK-Oz for qemu-devel@nongnu.org; Thu, 15 Nov 2018 14:25:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNNG2-0007yU-7f for qemu-devel@nongnu.org; Thu, 15 Nov 2018 14:24:59 -0500 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]:36162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNNG1-0007yC-Qz for qemu-devel@nongnu.org; Thu, 15 Nov 2018 14:24:54 -0500 Received: by mail-ot1-x332.google.com with SMTP id k98so19090206otk.3 for ; Thu, 15 Nov 2018 11:24:53 -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; bh=jHOJfWsIesqZkzLAgZBYA0/x9LureQvfbcDvyeioEJE=; b=c9KvgsDxmk9IM+Pg9rr5eMVNPBCpXPOt3+Ehkc3q0XfZDyNltGhzT/Br9Zd17tsTZb 8y6prMkfQ4Wl20EydJM0SmQhdrQnpXqsAAh3YkcXQZgRXZkz0nDvrsk3FLa3xGnbwyGX yIIKjGE3k5i2J4T23qZZdLxgg3zd6wlVm1cdqXxK4lxmNuiBf1ofDtWWrFaNAn7ctCSW HQvblDfcbndCDP7arjuDAZj6iSJ+9OlipoA9nA/WBobxTJGoSCD+Hc2rpAEaoW17SQJL jstlOFgmOvxKSqjwG7AwK/84soiEU6TuqDCGnSz/ofzKA3BprwZsgGPWB5n6wBViznxs Umtw== 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; bh=jHOJfWsIesqZkzLAgZBYA0/x9LureQvfbcDvyeioEJE=; b=JV2VPMmxCI9h/xKq9zIKRdxaXLpOVov3ccRMs838O73bV9xXoW2gBWuyCi7si/4BiZ KJ6wZEyjn0UarRYHQwjMJhE3C9EZHqKx6bf5UlEaxjqlQI1KncYbotf20bQFHXK4Ww6t KXPtzuPig/H8Obb2BBhD+Q1u1oUNFrHrW5aLk2c3IJEIcinzFrOG44cBjTg3MNEtB+Ln q8ruRrO7iIAsX+OAzgEoISOqwApGvcXlffhV0dRI1uu35My45Jge6Z0FOg8+1mXdt1Cb PWdnURX0r2QjhSXh3RpMN1wz23/mciE4yW879WdlUnxKARh7KRMtcSUGqAz3MXZsBwz1 HbSQ== X-Gm-Message-State: AGRZ1gISBjf9FHyGdZW/C8t4KGRTP2M75K/ilaC3WTboKETV41C3JsBZ ludNh19CVNJgL1+MLnlViw== X-Google-Smtp-Source: AJdET5ewLllul2IPeuA7hZrmGuqW9o6CqyCh7IAcq80vspejtfqnIXWOI5A9RPoh8BV1xWMIu4C72A== X-Received: by 2002:a9d:1c97:: with SMTP id l23mr4691277ota.276.1542309892515; Thu, 15 Nov 2018 11:24:52 -0800 (PST) Received: from serve.minyard.net ([47.184.128.64]) by smtp.gmail.com with ESMTPSA id k132-v6sm9597357oia.46.2018.11.15.11.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 11:24:51 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 679028FB; Thu, 15 Nov 2018 13:24:49 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id A1DF1301462; Thu, 15 Nov 2018 13:24:47 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 13:24:34 -0600 Message-Id: <20181115192446.17187-1-minyard@acm.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::332 Subject: [Qemu-devel] [PATCH v2 00/12] RFC: Fix/add vmstate handling in some I2C code 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: Paolo Bonzini , "Dr . David Alan Gilbert" , minyard@acm.org, "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These changes allow SMBus access while doing a state transfer. Seems like a good idea to me in general. I have these queued for the SMBus IPMI driver work, of course. I had submitted this before and then lost track of the work since I started finding all kinds of broken things in the I2C code. I have fixed the broken things I found first, and then added the previous patches. I have tested this in q35 and it works without issue. On piix4 the pm_smbus code is broken on a migration, however. The device disappears from the PCI bus on a migration, from what I can tell. It's not the fault of this code, something more fundamental is going on. The following comment in piix4.c may have something to do with it: /* qemu-kvm 1.2 uses version 3 but advertised as 2 * To support incoming qemu-kvm 1.2 migration, change version_id * and minimum_version_id to 2 below (which breaks migration from * qemu 1.2). Anyway, I need to chase that down. I'm primarily submitting this to make sure I'm doing the backwards compatability with .needed correctly. I'm adding a new field in the machine class and setting it in the initialization code for older versions. David, is this what you wanted? It will have to be adjusted for the proper version if/when it really goes in, of course. You can see those in the following commits: boards.h: Ignore migration for SMBus devices on i2c:pm_smbus: Fix state transfer i2c: Add vmstate handling to the smbus eeprom I thought about adding a field to the pm_smbus code to only transfer if it was accessed, but I'm assuming that most modern OSes will at least initialized the device based on its presence on the PCI bus. So that didn't seem like it would add any value. I'm also submitting to see if all the fixes and cleanups look ok. That's the first 5 commits. Thanks, -corey