From: Alex Williamson <alex.williamson@redhat.com>
To: kvm@vger.kernel.org
Cc: alex.williamson@redhat.com, ddutile@redhat.com, mst@redhat.com,
chrisw@redhat.com
Subject: [PATCH v2 2/5] pci: Remove PCI_CAPABILITY_CONFIG_*
Date: Mon, 06 Dec 2010 09:22:38 -0700 [thread overview]
Message-ID: <20101206162216.4648.80711.stgit@s20.home> (raw)
In-Reply-To: <20101206161810.4648.45658.stgit@s20.home>
Half of these aren't used anywhere, the other half are wrong. Now that
device assignment is trying to match physical hardware offsets for PCI
capabilities, we can't round up the MSI and MSI-X length. MSI-X is
always 12 bytes. MSI is variable length depending on features, but for
the current device assignment implementation, it's always the minimum
length of 10 bytes.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/device-assignment.c | 8 +++-----
hw/pci.h | 5 -----
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 6d6e657..1a90a89 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1302,10 +1302,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
* MSI capability is the 1st capability in capability config */
if ((pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSI))) {
dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI;
- pci_add_capability(pci_dev, PCI_CAP_ID_MSI, pos,
- PCI_CAPABILITY_CONFIG_MSI_LENGTH);
-
/* Only 32-bit/no-mask currently supported */
+ pci_add_capability(pci_dev, PCI_CAP_ID_MSI, pos, 10);
+
pci_set_word(pci_dev->config + pos + PCI_MSI_FLAGS,
pci_get_word(pci_dev->config + pos + PCI_MSI_FLAGS) &
PCI_MSI_FLAGS_QMASK);
@@ -1326,8 +1325,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
uint32_t msix_table_entry;
dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX;
- pci_add_capability(pci_dev, PCI_CAP_ID_MSIX, pos,
- PCI_CAPABILITY_CONFIG_MSIX_LENGTH);
+ pci_add_capability(pci_dev, PCI_CAP_ID_MSIX, pos, 12);
pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS,
pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) &
diff --git a/hw/pci.h b/hw/pci.h
index 34955d8..d579738 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -122,11 +122,6 @@ enum {
QEMU_PCI_CAP_MULTIFUNCTION = (1 << QEMU_PCI_CAP_MULTIFUNCTION_BITNR),
};
-#define PCI_CAPABILITY_CONFIG_MAX_LENGTH 0x60
-#define PCI_CAPABILITY_CONFIG_DEFAULT_START_ADDR 0x40
-#define PCI_CAPABILITY_CONFIG_MSI_LENGTH 0x10
-#define PCI_CAPABILITY_CONFIG_MSIX_LENGTH 0x10
-
typedef int (*msix_mask_notifier_func)(PCIDevice *, unsigned vector,
int masked);
next prev parent reply other threads:[~2010-12-06 16:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-03 19:33 [PATCH 0/5] Extra capabilities for device assignment Alex Williamson
2010-12-03 19:33 ` [PATCH 1/5] device-assignment: Fix off-by-one in header check Alex Williamson
2010-12-03 19:33 ` [PATCH 2/5] pci: MSI-X capability is 12 bytes, not 16, MSI is 10 bytes Alex Williamson
2010-12-03 19:37 ` Chris Wright
2010-12-03 19:48 ` Alex Williamson
2010-12-03 19:54 ` Chris Wright
2010-12-03 19:33 ` [PATCH 3/5] pci: Error on PCI capability collisions Alex Williamson
2010-12-03 19:34 ` [PATCH 4/5] device-assignment: Error checking when adding capabilities Alex Williamson
2010-12-03 19:34 ` [PATCH 5/5] device-assignment: pass through and stub more PCI caps Alex Williamson
2010-12-06 16:21 ` [PATCH v2 0/5] Extra capabilities for device assignment Alex Williamson
2010-12-06 16:22 ` [PATCH v2 1/5] device-assignment: Fix off-by-one in header check Alex Williamson
2010-12-06 16:22 ` Alex Williamson [this message]
2010-12-06 16:22 ` [PATCH v2 3/5] pci: Error on PCI capability collisions Alex Williamson
2010-12-06 16:22 ` [PATCH v2 4/5] device-assignment: Error checking when adding capabilities Alex Williamson
2010-12-06 16:23 ` [PATCH v2 5/5] device-assignment: pass through and stub more PCI caps Alex Williamson
2010-12-06 16:34 ` [PATCH v2 0/5] Extra capabilities for device assignment Avi Kivity
2010-12-06 16:43 ` Alex Williamson
2010-12-06 17:03 ` Avi Kivity
2010-12-09 15:13 ` Markus Armbruster
2010-12-09 15:32 ` Avi Kivity
2010-12-09 16:17 ` Alex Williamson
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=20101206162216.4648.80711.stgit@s20.home \
--to=alex.williamson@redhat.com \
--cc=chrisw@redhat.com \
--cc=ddutile@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
/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