From patchwork Tue Sep 4 20:22:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 181670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 277732C00B2 for ; Wed, 5 Sep 2012 06:22:59 +1000 (EST) Received: from localhost ([::1]:51777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8zeD-00061A-7Y for incoming@patchwork.ozlabs.org; Tue, 04 Sep 2012 16:22:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8ze6-00060V-Da for qemu-devel@nongnu.org; Tue, 04 Sep 2012 16:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8ze5-0001Zc-Cr for qemu-devel@nongnu.org; Tue, 04 Sep 2012 16:22:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8ze5-0001ZU-4L for qemu-devel@nongnu.org; Tue, 04 Sep 2012 16:22:49 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q84KMl5V013913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Sep 2012 16:22:47 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q84KMkW1031156; Tue, 4 Sep 2012 16:22:47 -0400 Date: Tue, 4 Sep 2012 16:22:46 -0400 From: Jason Baron To: "Michael S. Tsirkin" Message-ID: <20120904202246.GC22890@redhat.com> References: <20120831084227.GA24072@redhat.com> <20120831144551.GB12212@redhat.com> <20120831153513.GB24891@redhat.com> <20120831154331.GE12212@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120831154331.GE12212@redhat.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: yamahata@valinux.co.jp, alex.williamson@redhat.com, jan.kiszka@siemens.com, qemu-devel@nongnu.org, quintela@redhat.com Subject: Re: [Qemu-devel] [PATCH 2/2 v2] pcie_aer: clear cmask for Advanced Error Interrupt Message Number X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Fri, Aug 31, 2012 at 11:43:31AM -0400, Jason Baron wrote: > On Fri, Aug 31, 2012 at 06:35:13PM +0300, Michael S. Tsirkin wrote: > > On Fri, Aug 31, 2012 at 10:45:52AM -0400, Jason Baron wrote: > > > On Fri, Aug 31, 2012 at 11:42:27AM +0300, Michael S. Tsirkin wrote: > > > > Some minor nits below. If you dont get to it I will tweak this patch > > > > when I apply it early next week. > > > > > > > > On Thu, Aug 30, 2012 at 01:51:15PM -0400, Jason Baron wrote: > > > > > The Advanced Error Interrupt Message Number (bits 31:27 of the Root > > > > > Error Status Register) is updated when the number of msi messages assigned to a > > > > > device changes. Migration of windows 7 on q35 chipset failed because the check > > > > > in get_pci_config_device() fails due to wmask being set on these bits. > > > > > > > > I think you actually mean 'not being set on these bits'? > > > > > > > > > > No, the check is: > > > > > > static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) > > > { > > > PCIDevice *s = container_of(pv, PCIDevice, config); > > > uint8_t *config; > > > int i; > > > > > > assert(size == pci_config_size(s)); > > > config = g_malloc(size); > > > > > > qemu_get_buffer(f, config, size); > > > for (i = 0; i < size; ++i) { > > > if ((config[i] ^ s->config[i]) & > > > s->cmask[i] & ~s->wmask[i] & ~s->w1cmask[i]) { > > > g_free(config); > > > return -EINVAL; > > > } > > > } > > > ..... > > > > > > So because cmask is set and these bits differ in config space (due to > > > them being updated before migration), the migration aborts. > > > > Ah so you mean 'cmask being set' - not wmask as you wrote. > > > > Sorry - my mistake, yes I meant 'cmask'. I will fix the changelog in the > re-post. > Ok, here's a v2: --- pcie_aer: clear cmask for Advanced Error Interrupt Message Number The Advanced Error Interrupt Message Number (bits 31:27 of the Root Error Status Register) is updated when the number of msi messages assigned to a device changes. Migration of windows 7 on q35 chipset failed because the check in get_pci_config_device() fails due to cmask being set on these bits. Its valid to update these bits and we must restore this state across migration. Signed-off-by: Jason Baron --- v2: - Based on Michael Tsirkin's feedback: -updated changelog 'wmask' -> 'cmask' -Cleaned up comments -Make cmask set more readable hw/pcie_aer.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c index 3b6981c..b04c164 100644 --- a/hw/pcie_aer.c +++ b/hw/pcie_aer.c @@ -738,6 +738,11 @@ void pcie_aer_root_init(PCIDevice *dev) PCI_ERR_ROOT_CMD_EN_MASK); pci_set_long(dev->w1cmask + pos + PCI_ERR_ROOT_STATUS, PCI_ERR_ROOT_STATUS_REPORT_MASK); + /* PCI_ERR_ROOT_IRQ is RO but devices change it using a + * device-specific method. + */ + pci_set_long(dev->cmask + pos + PCI_ERR_ROOT_STATUS, + ~PCI_ERR_ROOT_IRQ); } void pcie_aer_root_reset(PCIDevice *dev)