From patchwork Wed Oct 27 14:05:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 69346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CEAD4B6EDF for ; Wed, 27 Oct 2010 23:09:43 +1100 (EST) Received: from localhost ([127.0.0.1]:54195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB4oP-0006GY-3P for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2010 08:09:01 -0400 Received: from [140.186.70.92] (port=52034 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB4mu-0005yj-Lw for qemu-devel@nongnu.org; Wed, 27 Oct 2010 08:08:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PB4lw-0007c2-0m for qemu-devel@nongnu.org; Wed, 27 Oct 2010 08:07:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PB4lv-0007bO-Q8 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 08:06:27 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9RC6Qgm026338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Oct 2010 08:06:27 -0400 Received: from redhat.com (vpn-6-133.tlv.redhat.com [10.35.6.133]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o9RC6O6N008499; Wed, 27 Oct 2010 08:06:25 -0400 Date: Wed, 27 Oct 2010 16:05:58 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org, yamahata@valinux.co.jp Message-ID: <20101027140558.GA3380@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] pci: improve w1c mask handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org - save/restore must not check w1c bits since they are in fact guest controlled - clear w1c bits on reset Note: for express there are different kinds of reset, some leave part of config space alone. We will likely need a sticky bit mask to implement this. Signed-off-by: Michael S. Tsirkin --- Isaku, does the below make sense? hw/pci.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index e50de14..1a14a0e 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -141,7 +141,8 @@ static void pci_device_reset(PCIDevice *dev) pci_update_irq_status(dev); /* Clear all writeable bits */ pci_word_test_and_clear_mask(dev->config + PCI_COMMAND, - pci_get_word(dev->wmask + PCI_COMMAND)); + pci_get_word(dev->wmask + PCI_COMMAND) | + pci_get_word(dev->w1cmask + PCI_COMMAND)); dev->config[PCI_CACHE_LINE_SIZE] = 0x0; dev->config[PCI_INTERRUPT_LINE] = 0x0; for (r = 0; r < PCI_NUM_REGIONS; ++r) { @@ -293,7 +294,8 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t 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]) { + if ((config[i] ^ s->config[i]) & + s->cmask[i] & ~s->wmask[i] & ~s->w1cmask) { qemu_free(config); return -EINVAL; }