From patchwork Fri Nov 12 02:55:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 318692 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAC2uivW000980 for ; Fri, 12 Nov 2010 02:56:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755182Ab0KLCz7 (ORCPT ); Thu, 11 Nov 2010 21:55:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18382 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755150Ab0KLCz6 (ORCPT ); Thu, 11 Nov 2010 21:55:58 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAC2tvIN014657 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Nov 2010 21:55:57 -0500 Received: from s20.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAC2ttg5011518; Thu, 11 Nov 2010 21:55:56 -0500 From: Alex Williamson Subject: [PATCH 5/8] pci: Remove cap.length, cap.start, cap.supported To: kvm@vger.kernel.org Cc: qemu-devel@nongnu.org, mst@redhat.com, alex.williamson@redhat.com, chrisw@redhat.com Date: Thu, 11 Nov 2010 19:55:55 -0700 Message-ID: <20101112025549.31423.97635.stgit@s20.home> In-Reply-To: <20101112024710.31423.99667.stgit@s20.home> References: <20101112024710.31423.99667.stgit@s20.home> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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.3 (demeter1.kernel.org [140.211.167.41]); Fri, 12 Nov 2010 02:56:44 +0000 (UTC) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 74cdd26..322fa9f 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1292,8 +1292,6 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) pci_get_word(pci_dev->config + PCI_STATUS) & ~PCI_STATUS_CAP_LIST); - pci_dev->cap.length = 0; - #ifdef KVM_CAP_IRQ_ROUTING #ifdef KVM_CAP_DEVICE_MSI /* Expose MSI capability @@ -1320,7 +1318,6 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); pci_set_long(pci_dev->wmask + vpos + PCI_MSI_ADDRESS_LO, 0xfffffffc); pci_set_long(pci_dev->wmask + vpos + PCI_MSI_DATA_32, 0xffff); - pci_dev->cap.length += PCI_CAPABILITY_CONFIG_MSI_LENGTH; } #endif #ifdef KVM_CAP_DEVICE_MSIX @@ -1356,7 +1353,6 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) bar_nr = msix_table_entry & PCI_MSIX_BIR; msix_table_entry &= ~PCI_MSIX_BIR; dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry; - pci_dev->cap.length += PCI_CAPABILITY_CONFIG_MSIX_LENGTH; } #endif #endif diff --git a/hw/pci.c b/hw/pci.c index e1e8a77..d566e33 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1190,10 +1190,7 @@ static void pci_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) int pci_access_cap_config(PCIDevice *pci_dev, uint32_t address, int len) { - if (pci_dev->cap.supported && address >= pci_dev->cap.start && - (address + len) < pci_dev->cap.start + pci_dev->cap.length) - return 1; - return 0; + return pci_dev->cap_map[address]; } uint32_t pci_default_cap_read_config(PCIDevice *pci_dev, @@ -2040,8 +2037,6 @@ int pci_add_capability_at_offset(PCIDevice *pdev, uint8_t cap_id, memset(pdev->cmask + offset, 0xFF, size); pdev->config[PCI_STATUS] |= PCI_STATUS_CAP_LIST; - pdev->cap.supported = 1; - pdev->cap.start = pdev->cap.start ? MIN(pdev->cap.start, offset) : offset; return offset; } @@ -2072,7 +2067,6 @@ void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size) if (!pdev->config[PCI_CAPABILITY_LIST]) { pdev->config[PCI_STATUS] &= ~PCI_STATUS_CAP_LIST; - pdev->cap.start = pdev->cap.length = 0; } } diff --git a/hw/pci.h b/hw/pci.h index 2265c70..177008a 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -208,8 +208,6 @@ struct PCIDevice { /* Device capability configuration space */ struct { - int supported; - unsigned int start, length; PCICapConfigReadFunc *config_read; PCICapConfigWriteFunc *config_write; } cap;