From patchwork Thu Sep 8 10:48:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 1129382 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p88AmLr0017382 for ; Thu, 8 Sep 2011 10:48:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758238Ab1IHKsL (ORCPT ); Thu, 8 Sep 2011 06:48:11 -0400 Received: from david.siemens.de ([192.35.17.14]:20667 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758223Ab1IHKsK (ORCPT ); Thu, 8 Sep 2011 06:48:10 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id p88Am29h020609; Thu, 8 Sep 2011 12:48:03 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p88Am2B6028794; Thu, 8 Sep 2011 12:48:02 +0200 Message-ID: <4E689D62.40006@siemens.com> Date: Thu, 08 Sep 2011 12:48:02 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti CC: kvm , "Michael S. Tsirkin" Subject: [PATCH] qemu-kvm: Resolve PCI upstream diffs Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 08 Sep 2011 10:48:22 +0000 (UTC) Resolve all unneeded deviations from upstream code. No functional changes. Signed-off-by: Jan Kiszka --- hw/pci.c | 11 +++++++---- hw/pci.h | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index e4c166a..4d8845c 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -2106,8 +2106,6 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, memset(pdev->wmask + offset, 0, size); /* Check capability by default */ memset(pdev->cmask + offset, 0xFF, size); - - return offset; } @@ -2125,9 +2123,14 @@ void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size) memset(pdev->cmask + offset, 0, size); memset(pdev->used + offset, 0, size); - if (!pdev->config[PCI_CAPABILITY_LIST]) { + if (!pdev->config[PCI_CAPABILITY_LIST]) pdev->config[PCI_STATUS] &= ~PCI_STATUS_CAP_LIST; - } +} + +/* Reserve space for capability at a known offset (to call after load). */ +void pci_reserve_capability(PCIDevice *pdev, uint8_t offset, uint8_t size) +{ + memset(pdev->used + offset, 0xff, size); } uint8_t pci_find_capability(PCIDevice *pdev, uint8_t cap_id) diff --git a/hw/pci.h b/hw/pci.h index da0c2d2..70fcd9c 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -147,7 +147,7 @@ struct PCIDevice { /* Used to implement RW1C(Write 1 to Clear) bytes */ uint8_t *w1cmask; - /* Used to allocate config space and track capabilities. */ + /* Used to allocate config space for capabilities. */ uint8_t *used; /* the following fields are read only */ @@ -230,8 +230,11 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size); +void pci_reserve_capability(PCIDevice *pci_dev, uint8_t offset, uint8_t size); + uint8_t pci_find_capability(PCIDevice *pci_dev, uint8_t cap_id); + uint32_t pci_default_read_config(PCIDevice *d, uint32_t address, int len); void pci_default_write_config(PCIDevice *d,