* [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream
@ 2012-05-15 12:57 Jan Kiszka
2012-05-15 12:57 ` [PATCH 1/4] qemu-kvm: Drop unused kvm_clear_gsi_routes Jan Kiszka
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-05-15 12:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Michael S. Tsirkin
Removes two unused KVM core functions and some unneeded diffs in
msi/msix.c.
Jan Kiszka (4):
qemu-kvm: Drop unused kvm_clear_gsi_routes
qemu-kvm: Drop unused kvm_del_irq_route
qemu-kvm: msi: Drop redundant support tests
qemu-kvm: msix: Drop check for preexisting cap from msix_add_config
hw/msi.c | 4 ---
hw/msix.c | 73 +++++++++++++++++++++++------------------------------------
qemu-kvm.c | 26 ---------------------
qemu-kvm.h | 17 --------------
4 files changed, 29 insertions(+), 91 deletions(-)
--
1.7.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] qemu-kvm: Drop unused kvm_clear_gsi_routes
2012-05-15 12:57 [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Jan Kiszka
@ 2012-05-15 12:57 ` Jan Kiszka
2012-05-15 12:57 ` [PATCH 2/4] qemu-kvm: Drop unused kvm_del_irq_route Jan Kiszka
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-05-15 12:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Michael S. Tsirkin
No users remaining.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
qemu-kvm.c | 10 ----------
qemu-kvm.h | 9 ---------
2 files changed, 0 insertions(+), 19 deletions(-)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index a55a577..3d2734c 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -98,16 +98,6 @@ int kvm_deassign_pci_device(KVMState *s,
}
#endif
-int kvm_clear_gsi_routes(void)
-{
-#ifdef KVM_CAP_IRQ_ROUTING
- kvm_state->irq_routes->nr = 0;
- return 0;
-#else
- return -EINVAL;
-#endif
-}
-
int kvm_del_routing_entry(struct kvm_irq_routing_entry *entry)
{
#ifdef KVM_CAP_IRQ_ROUTING
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 3084158..1f2380b 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -81,15 +81,6 @@ int kvm_deassign_pci_device(KVMState *s,
struct kvm_assigned_pci_dev *assigned_dev);
/*!
- * \brief Clears the temporary irq routing table
- *
- * Clears the temporary irq routing table. Nothing is committed to the
- * running VM.
- *
- */
-int kvm_clear_gsi_routes(void);
-
-/*!
* \brief Removes an irq route from the temporary irq routing table
*
* Adds an irq route to the temporary irq routing table. Nothing is
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] qemu-kvm: Drop unused kvm_del_irq_route
2012-05-15 12:57 [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Jan Kiszka
2012-05-15 12:57 ` [PATCH 1/4] qemu-kvm: Drop unused kvm_clear_gsi_routes Jan Kiszka
@ 2012-05-15 12:57 ` Jan Kiszka
2012-05-15 12:57 ` [PATCH 3/4] qemu-kvm: msi: Drop redundant support tests Jan Kiszka
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-05-15 12:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Michael S. Tsirkin
No users remaining.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
qemu-kvm.c | 16 ----------------
qemu-kvm.h | 8 --------
2 files changed, 0 insertions(+), 24 deletions(-)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 3d2734c..733cd04 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -202,22 +202,6 @@ int kvm_update_routing_entry(struct kvm_irq_routing_entry *entry,
#endif
}
-int kvm_del_irq_route(int gsi, int irqchip, int pin)
-{
-#ifdef KVM_CAP_IRQ_ROUTING
- struct kvm_irq_routing_entry e;
-
- e.gsi = gsi;
- e.type = KVM_IRQ_ROUTING_IRQCHIP;
- e.flags = 0;
- e.u.irqchip.irqchip = irqchip;
- e.u.irqchip.pin = pin;
- return kvm_del_routing_entry(&e);
-#else
- return -ENOSYS;
-#endif
-}
-
int kvm_get_irq_route_gsi(void)
{
#ifdef KVM_CAP_IRQ_ROUTING
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 1f2380b..ddf87a0 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -80,14 +80,6 @@ int kvm_device_intx_set_mask(KVMState *s, uint32_t dev_id, bool masked);
int kvm_deassign_pci_device(KVMState *s,
struct kvm_assigned_pci_dev *assigned_dev);
-/*!
- * \brief Removes an irq route from the temporary irq routing table
- *
- * Adds an irq route to the temporary irq routing table. Nothing is
- * committed to the running VM.
- */
-int kvm_del_irq_route(int gsi, int irqchip, int pin);
-
struct kvm_irq_routing_entry;
void kvm_add_routing_entry(KVMState *s, struct kvm_irq_routing_entry *entry);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] qemu-kvm: msi: Drop redundant support tests
2012-05-15 12:57 [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Jan Kiszka
2012-05-15 12:57 ` [PATCH 1/4] qemu-kvm: Drop unused kvm_clear_gsi_routes Jan Kiszka
2012-05-15 12:57 ` [PATCH 2/4] qemu-kvm: Drop unused kvm_del_irq_route Jan Kiszka
@ 2012-05-15 12:57 ` Jan Kiszka
2012-05-15 12:57 ` [PATCH 4/4] qemu-kvm: msix: Drop check for preexisting cap from msix_add_config Jan Kiszka
2012-05-18 0:37 ` [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Marcelo Tosatti
4 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-05-15 12:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Michael S. Tsirkin
The presence of QEMU_PCI_CAP_MSIX implies msi_supported. And
msi_supported is not set if KVM cannot handle it properly. So drop all
redundant tests.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/msi.c | 4 ----
hw/msix.c | 10 +---------
2 files changed, 1 insertions(+), 13 deletions(-)
diff --git a/hw/msi.c b/hw/msi.c
index 7bb3e2f..4fcf769 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -218,10 +218,6 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
" 64bit %d mask %d\n",
offset, nr_vectors, msi64bit, msi_per_vector_mask);
- if (kvm_enabled() && kvm_irqchip_in_kernel() && !kvm_has_gsi_routing()) {
- return -ENOTSUP;
- }
-
assert(!(nr_vectors & (nr_vectors - 1))); /* power of 2 */
assert(nr_vectors > 0);
assert(nr_vectors <= PCI_MSI_VECTORS_MAX);
diff --git a/hw/msix.c b/hw/msix.c
index 7955221..60a6d86 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -349,8 +349,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
int ret;
/* Nothing to do if MSI is not supported by interrupt controller */
- if (!msi_supported ||
- (kvm_enabled() && kvm_irqchip_in_kernel() && !kvm_has_gsi_routing())) {
+ if (!msi_supported) {
return -ENOTSUP;
}
if (nentries > MSIX_MAX_ENTRIES)
@@ -429,10 +428,6 @@ void msix_save(PCIDevice *dev, QEMUFile *f)
{
unsigned n = dev->msix_entries_nr;
- if (!msi_supported) {
- return;
- }
-
if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) {
return;
}
@@ -445,9 +440,6 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
{
unsigned n = dev->msix_entries_nr;
- if (!msi_supported)
- return;
-
if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) {
return;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] qemu-kvm: msix: Drop check for preexisting cap from msix_add_config
2012-05-15 12:57 [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Jan Kiszka
` (2 preceding siblings ...)
2012-05-15 12:57 ` [PATCH 3/4] qemu-kvm: msi: Drop redundant support tests Jan Kiszka
@ 2012-05-15 12:57 ` Jan Kiszka
2012-05-18 0:37 ` [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Marcelo Tosatti
4 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-05-15 12:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Michael S. Tsirkin
msix_add_config is called from msix_init which only supports init-once.
Moreover, msix_add_config performed no check if the provided parameters
were compatible with the existing capability entry, so was inconsistent
anyway.
This intentionally violates our coding style in order to remove any
difference of msix_add_config to the upstream version.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/msix.c | 65 +++++++++++++++++++++++++++---------------------------------
1 files changed, 29 insertions(+), 36 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 60a6d86..5515a32 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -134,43 +134,36 @@ static int msix_add_config(struct PCIDevice *pdev, unsigned short nentries,
{
int config_offset;
uint8_t *config;
+ uint32_t new_size;
- pdev->msix_bar_size = bar_size;
-
- config_offset = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
-
- if (!config_offset) {
- uint32_t new_size;
-
- if (nentries < 1 || nentries > PCI_MSIX_FLAGS_QSIZE + 1)
- return -EINVAL;
- if (bar_size > 0x80000000)
- return -ENOSPC;
-
- /* Add space for MSI-X structures */
- if (!bar_size) {
- new_size = MSIX_PAGE_SIZE;
- } else if (bar_size < MSIX_PAGE_SIZE) {
- bar_size = MSIX_PAGE_SIZE;
- new_size = MSIX_PAGE_SIZE * 2;
- } else {
- new_size = bar_size * 2;
- }
-
- pdev->msix_bar_size = new_size;
- config_offset = pci_add_capability(pdev, PCI_CAP_ID_MSIX,
- 0, MSIX_CAP_LENGTH);
- if (config_offset < 0)
- return config_offset;
- config = pdev->config + config_offset;
-
- pci_set_word(config + PCI_MSIX_FLAGS, nentries - 1);
- /* Table on top of BAR */
- pci_set_long(config + PCI_MSIX_TABLE, bar_size | bar_nr);
- /* Pending bits on top of that */
- pci_set_long(config + PCI_MSIX_PBA, (bar_size + MSIX_PAGE_PENDING) |
- bar_nr);
- }
+ if (nentries < 1 || nentries > PCI_MSIX_FLAGS_QSIZE + 1)
+ return -EINVAL;
+ if (bar_size > 0x80000000)
+ return -ENOSPC;
+
+ /* Add space for MSI-X structures */
+ if (!bar_size) {
+ new_size = MSIX_PAGE_SIZE;
+ } else if (bar_size < MSIX_PAGE_SIZE) {
+ bar_size = MSIX_PAGE_SIZE;
+ new_size = MSIX_PAGE_SIZE * 2;
+ } else {
+ new_size = bar_size * 2;
+ }
+
+ pdev->msix_bar_size = new_size;
+ config_offset = pci_add_capability(pdev, PCI_CAP_ID_MSIX,
+ 0, MSIX_CAP_LENGTH);
+ if (config_offset < 0)
+ return config_offset;
+ config = pdev->config + config_offset;
+
+ pci_set_word(config + PCI_MSIX_FLAGS, nentries - 1);
+ /* Table on top of BAR */
+ pci_set_long(config + PCI_MSIX_TABLE, bar_size | bar_nr);
+ /* Pending bits on top of that */
+ pci_set_long(config + PCI_MSIX_PBA, (bar_size + MSIX_PAGE_PENDING) |
+ bar_nr);
pdev->msix_cap = config_offset;
/* Make flags bit writable. */
pdev->wmask[config_offset + MSIX_CONTROL_OFFSET] |= MSIX_ENABLE_MASK |
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream
2012-05-15 12:57 [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Jan Kiszka
` (3 preceding siblings ...)
2012-05-15 12:57 ` [PATCH 4/4] qemu-kvm: msix: Drop check for preexisting cap from msix_add_config Jan Kiszka
@ 2012-05-18 0:37 ` Marcelo Tosatti
4 siblings, 0 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 0:37 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm, Michael S. Tsirkin
On Tue, May 15, 2012 at 09:57:20AM -0300, Jan Kiszka wrote:
> Removes two unused KVM core functions and some unneeded diffs in
> msi/msix.c.
>
> Jan Kiszka (4):
> qemu-kvm: Drop unused kvm_clear_gsi_routes
> qemu-kvm: Drop unused kvm_del_irq_route
> qemu-kvm: msi: Drop redundant support tests
> qemu-kvm: msix: Drop check for preexisting cap from msix_add_config
>
> hw/msi.c | 4 ---
> hw/msix.c | 73 +++++++++++++++++++++++------------------------------------
> qemu-kvm.c | 26 ---------------------
> qemu-kvm.h | 17 --------------
> 4 files changed, 29 insertions(+), 91 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-18 0:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 12:57 [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Jan Kiszka
2012-05-15 12:57 ` [PATCH 1/4] qemu-kvm: Drop unused kvm_clear_gsi_routes Jan Kiszka
2012-05-15 12:57 ` [PATCH 2/4] qemu-kvm: Drop unused kvm_del_irq_route Jan Kiszka
2012-05-15 12:57 ` [PATCH 3/4] qemu-kvm: msi: Drop redundant support tests Jan Kiszka
2012-05-15 12:57 ` [PATCH 4/4] qemu-kvm: msix: Drop check for preexisting cap from msix_add_config Jan Kiszka
2012-05-18 0:37 ` [PATCH 0/4] qemu-kvm: Removal of unneeded deviations from upstream Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox