From: Alex Williamson <alex.williamson@redhat.com>
To: kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org, mst@redhat.com,
alex.williamson@redhat.com, chrisw@redhat.com
Subject: [PATCH 5/8] pci: Remove cap.length, cap.start, cap.supported
Date: Thu, 11 Nov 2010 19:55:55 -0700 [thread overview]
Message-ID: <20101112025549.31423.97635.stgit@s20.home> (raw)
In-Reply-To: <20101112024710.31423.99667.stgit@s20.home>
Capabilities aren't required to be contiguous, so cap.length never
really made much sense. Likewise, cap.start is mostly meaningless
too. Both of these are better served by the capability map. We
can also get rid of cap.supported, since it's really now unused
and redundant with flag in the status word anyway.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/device-assignment.c | 4 ----
hw/pci.c | 8 +-------
hw/pci.h | 2 --
3 files changed, 1 insertions(+), 13 deletions(-)
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;
next prev parent reply other threads:[~2010-11-12 2:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 2:54 [PATCH 0/8] PCI capability and device assignment improvements Alex Williamson
2010-11-12 2:55 ` [PATCH 1/8] pci: pci_default_cap_write_config ignores wmask Alex Williamson
2010-11-12 5:22 ` Michael S. Tsirkin
2010-11-12 6:03 ` Alex Williamson
2010-11-12 8:48 ` Michael S. Tsirkin
2010-11-12 15:49 ` Alex Williamson
2010-11-16 16:12 ` Michael S. Tsirkin
2010-11-12 2:55 ` [PATCH 2/8] pci: Remove pci_enable_capability_support() Alex Williamson
2010-11-12 2:55 ` [PATCH 3/8] device-assignment: Use PCI capabilities support Alex Williamson
2010-11-12 2:55 ` [PATCH 4/8] pci: Replace used bitmap with capability byte map Alex Williamson
2010-11-12 5:40 ` Michael S. Tsirkin
2010-11-12 6:07 ` Alex Williamson
2010-11-12 9:02 ` Michael S. Tsirkin
2010-11-12 15:32 ` Alex Williamson
2010-11-12 2:55 ` Alex Williamson [this message]
2010-11-12 2:56 ` [PATCH 6/8] device-assignment: Move PCI capabilities to match physical hardware Alex Williamson
2010-11-12 9:20 ` Michael S. Tsirkin
2010-11-12 13:53 ` Alex Williamson
2010-11-12 2:56 ` [PATCH 7/8] pci: Pass ID for capability read/write handlers Alex Williamson
2010-11-12 2:56 ` [RFC PATCH 8/8] device-assignment: pass through and stub more PCI caps Alex Williamson
2010-11-12 5:36 ` Michael S. Tsirkin
2010-11-12 6:30 ` Alex Williamson
2010-11-12 9:11 ` Michael S. Tsirkin
2010-11-12 15:42 ` Alex Williamson
2010-11-16 16:08 ` Michael S. Tsirkin
2010-11-12 5:39 ` [PATCH 0/8] PCI capability and device assignment improvements Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101112025549.31423.97635.stgit@s20.home \
--to=alex.williamson@redhat.com \
--cc=chrisw@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox