* [PATCH v2 1/8] msix: avoid leaking kvm data on init failure
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 2/8] kvm: drop kvm_context parameter from msix-related kvm functions Avi Kivity
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
Move initialization after we're certain to succeed, so we don't leak
memory on failure.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/msix.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 9663b17..162faa7 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -374,12 +374,6 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
if (nentries > MSIX_MAX_ENTRIES)
return -EINVAL;
-#ifdef KVM_CAP_IRQCHIP
- if (kvm_enabled() && kvm_irqchip_in_kernel()) {
- dev->msix_irq_entries = qemu_malloc(nentries *
- sizeof *dev->msix_irq_entries);
- }
-#endif
dev->msix_mask_notifier_opaque =
qemu_mallocz(nentries * sizeof *dev->msix_mask_notifier_opaque);
dev->msix_mask_notifier = NULL;
@@ -401,6 +395,13 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
if (ret)
goto err_config;
+#ifdef KVM_CAP_IRQCHIP
+ if (kvm_enabled() && kvm_irqchip_in_kernel()) {
+ dev->msix_irq_entries = qemu_malloc(nentries *
+ sizeof *dev->msix_irq_entries);
+ }
+#endif
+
dev->cap_present |= QEMU_PCI_CAP_MSIX;
return 0;
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 2/8] kvm: drop kvm_context parameter from msix-related kvm functions
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
2010-10-10 14:42 ` [PATCH v2 1/8] msix: avoid leaking kvm data on init failure Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 3/8] Avoid using kvm_irq_routing_entry in PCIDevice Avi Kivity
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
The kvm_context parameter serves no useful purpose since it's a global (and
all callers reference that global); on the other hand it prevents the build
when kvm is not configured in since the kvm_context symbol is not defined.
Remove the parameter and replace it by the global kvm_context in callees.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/device-assignment.c | 14 +++++++-------
hw/msix.c | 20 ++++++++++----------
qemu-kvm-x86.c | 14 +++++++-------
qemu-kvm.c | 33 +++++++++++++++++++--------------
qemu-kvm.h | 36 ++++++++++--------------------------
5 files changed, 53 insertions(+), 64 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 26cb797..2605bd1 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -767,7 +767,7 @@ static void free_dev_irq_entries(AssignedDevice *dev)
int i;
for (i = 0; i < dev->irq_entries_nr; i++)
- kvm_del_routing_entry(kvm_context, &dev->entry[i]);
+ kvm_del_routing_entry(&dev->entry[i]);
free(dev->entry);
dev->entry = NULL;
dev->irq_entries_nr = 0;
@@ -1080,15 +1080,15 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev, unsigned int ctrl_pos)
assigned_dev->entry->u.msi.data = *(uint16_t *)(pci_dev->config +
pci_dev->cap.start + PCI_MSI_DATA_32);
assigned_dev->entry->type = KVM_IRQ_ROUTING_MSI;
- r = kvm_get_irq_route_gsi(kvm_context);
+ r = kvm_get_irq_route_gsi();
if (r < 0) {
perror("assigned_dev_update_msi: kvm_get_irq_route_gsi");
return;
}
assigned_dev->entry->gsi = r;
- kvm_add_routing_entry(kvm_context, assigned_dev->entry);
- if (kvm_commit_irq_routes(kvm_context) < 0) {
+ kvm_add_routing_entry(assigned_dev->entry);
+ if (kvm_commit_irq_routes() < 0) {
perror("assigned_dev_update_msi: kvm_commit_irq_routes");
assigned_dev->cap.state &= ~ASSIGNED_DEVICE_MSI_ENABLED;
return;
@@ -1170,7 +1170,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
memcpy(&msg_addr, va + i * 16, 4);
memcpy(&msg_upper_addr, va + i * 16 + 4, 4);
- r = kvm_get_irq_route_gsi(kvm_context);
+ r = kvm_get_irq_route_gsi();
if (r < 0)
return r;
@@ -1181,7 +1181,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
adev->entry[entries_nr].u.msi.address_hi = msg_upper_addr;
adev->entry[entries_nr].u.msi.data = msg_data;
DEBUG("MSI-X data 0x%x, MSI-X addr_lo 0x%x\n!", msg_data, msg_addr);
- kvm_add_routing_entry(kvm_context, &adev->entry[entries_nr]);
+ kvm_add_routing_entry(&adev->entry[entries_nr]);
msix_entry.gsi = adev->entry[entries_nr].gsi;
msix_entry.entry = i;
@@ -1195,7 +1195,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
entries_nr ++;
}
- if (r == 0 && kvm_commit_irq_routes(kvm_context) < 0) {
+ if (r == 0 && kvm_commit_irq_routes() < 0) {
perror("assigned_dev_update_msix_mmio: kvm_commit_irq_routes");
return -EINVAL;
}
diff --git a/hw/msix.c b/hw/msix.c
index 162faa7..6abf059 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -54,12 +54,12 @@ static void kvm_msix_free(PCIDevice *dev)
int vector, changed = 0;
for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
if (dev->msix_entry_used[vector]) {
- kvm_del_routing_entry(kvm_context, &dev->msix_irq_entries[vector]);
+ kvm_del_routing_entry(&dev->msix_irq_entries[vector]);
changed = 1;
}
}
if (changed) {
- kvm_commit_irq_routes(kvm_context);
+ kvm_commit_irq_routes();
}
}
@@ -92,14 +92,14 @@ static void kvm_msix_update(PCIDevice *dev, int vector,
kvm_msix_routing_entry(dev, vector, &e);
if (memcmp(&entry->u.msi, &e.u.msi, sizeof entry->u.msi)) {
int r;
- r = kvm_update_routing_entry(kvm_context, entry, &e);
+ r = kvm_update_routing_entry(entry, &e);
if (r) {
fprintf(stderr, "%s: kvm_update_routing_entry failed: %s\n", __func__,
strerror(-r));
exit(1);
}
memcpy(&entry->u.msi, &e.u.msi, sizeof entry->u.msi);
- r = kvm_commit_irq_routes(kvm_context);
+ r = kvm_commit_irq_routes();
if (r) {
fprintf(stderr, "%s: kvm_commit_irq_routes failed: %s\n", __func__,
strerror(-r));
@@ -113,27 +113,27 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
struct kvm_irq_routing_entry *entry = dev->msix_irq_entries + vector;
int r;
- if (!kvm_has_gsi_routing(kvm_context)) {
+ if (!kvm_has_gsi_routing()) {
fprintf(stderr, "Warning: no MSI-X support found. "
"At least kernel 2.6.30 is required for MSI-X support.\n"
);
return -EOPNOTSUPP;
}
- r = kvm_get_irq_route_gsi(kvm_context);
+ r = kvm_get_irq_route_gsi();
if (r < 0) {
fprintf(stderr, "%s: kvm_get_irq_route_gsi failed: %s\n", __func__, strerror(-r));
return r;
}
entry->gsi = r;
kvm_msix_routing_entry(dev, vector, entry);
- r = kvm_add_routing_entry(kvm_context, entry);
+ r = kvm_add_routing_entry(entry);
if (r < 0) {
fprintf(stderr, "%s: kvm_add_routing_entry failed: %s\n", __func__, strerror(-r));
return r;
}
- r = kvm_commit_irq_routes(kvm_context);
+ r = kvm_commit_irq_routes();
if (r < 0) {
fprintf(stderr, "%s: kvm_commit_irq_routes failed: %s\n", __func__, strerror(-r));
return r;
@@ -146,8 +146,8 @@ static void kvm_msix_del(PCIDevice *dev, unsigned vector)
if (dev->msix_entry_used[vector]) {
return;
}
- kvm_del_routing_entry(kvm_context, &dev->msix_irq_entries[vector]);
- kvm_commit_irq_routes(kvm_context);
+ kvm_del_routing_entry(&dev->msix_irq_entries[vector]);
+ kvm_commit_irq_routes();
}
#else
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index bb09fd8..59aacd0 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1370,34 +1370,34 @@ int kvm_arch_init_irq_routing(void)
{
int i, r;
- if (kvm_irqchip && kvm_has_gsi_routing(kvm_context)) {
- kvm_clear_gsi_routes(kvm_context);
+ if (kvm_irqchip && kvm_has_gsi_routing()) {
+ kvm_clear_gsi_routes();
for (i = 0; i < 8; ++i) {
if (i == 2) {
continue;
}
- r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_MASTER, i);
+ r = kvm_add_irq_route(i, KVM_IRQCHIP_PIC_MASTER, i);
if (r < 0) {
return r;
}
}
for (i = 8; i < 16; ++i) {
- r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
+ r = kvm_add_irq_route(i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
if (r < 0) {
return r;
}
}
for (i = 0; i < 24; ++i) {
if (i == 0 && irq0override) {
- r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2);
+ r = kvm_add_irq_route(i, KVM_IRQCHIP_IOAPIC, 2);
} else if (i != 2 || !irq0override) {
- r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
+ r = kvm_add_irq_route(i, KVM_IRQCHIP_IOAPIC, i);
}
if (r < 0) {
return r;
}
}
- kvm_commit_irq_routes(kvm_context);
+ kvm_commit_irq_routes();
}
return 0;
}
diff --git a/qemu-kvm.c b/qemu-kvm.c
index e78d850..3966523 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -800,7 +800,7 @@ int kvm_reinject_control(kvm_context_t kvm, int pit_reinject)
return -ENOSYS;
}
-int kvm_has_gsi_routing(kvm_context_t kvm)
+int kvm_has_gsi_routing(void)
{
int r = 0;
@@ -819,9 +819,11 @@ int kvm_get_gsi_count(kvm_context_t kvm)
#endif
}
-int kvm_clear_gsi_routes(kvm_context_t kvm)
+int kvm_clear_gsi_routes(void)
{
#ifdef KVM_CAP_IRQ_ROUTING
+ kvm_context_t kvm = kvm_context;
+
kvm->irq_routes->nr = 0;
return 0;
#else
@@ -829,10 +831,10 @@ int kvm_clear_gsi_routes(kvm_context_t kvm)
#endif
}
-int kvm_add_routing_entry(kvm_context_t kvm,
- struct kvm_irq_routing_entry *entry)
+int kvm_add_routing_entry(struct kvm_irq_routing_entry *entry)
{
#ifdef KVM_CAP_IRQ_ROUTING
+ kvm_context_t kvm = kvm_context;
struct kvm_irq_routing *z;
struct kvm_irq_routing_entry *new;
int n, size;
@@ -867,7 +869,7 @@ int kvm_add_routing_entry(kvm_context_t kvm,
#endif
}
-int kvm_add_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin)
+int kvm_add_irq_route(int gsi, int irqchip, int pin)
{
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_entry e;
@@ -877,16 +879,16 @@ int kvm_add_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin)
e.flags = 0;
e.u.irqchip.irqchip = irqchip;
e.u.irqchip.pin = pin;
- return kvm_add_routing_entry(kvm, &e);
+ return kvm_add_routing_entry(&e);
#else
return -ENOSYS;
#endif
}
-int kvm_del_routing_entry(kvm_context_t kvm,
- struct kvm_irq_routing_entry *entry)
+int kvm_del_routing_entry(struct kvm_irq_routing_entry *entry)
{
#ifdef KVM_CAP_IRQ_ROUTING
+ kvm_context_t kvm = kvm_context;
struct kvm_irq_routing_entry *e, *p;
int i, gsi, found = 0;
@@ -943,11 +945,11 @@ int kvm_del_routing_entry(kvm_context_t kvm,
#endif
}
-int kvm_update_routing_entry(kvm_context_t kvm,
- struct kvm_irq_routing_entry *entry,
+int kvm_update_routing_entry(struct kvm_irq_routing_entry *entry,
struct kvm_irq_routing_entry *newentry)
{
#ifdef KVM_CAP_IRQ_ROUTING
+ kvm_context_t kvm = kvm_context;
struct kvm_irq_routing_entry *e;
int i;
@@ -987,7 +989,7 @@ int kvm_update_routing_entry(kvm_context_t kvm,
#endif
}
-int kvm_del_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin)
+int kvm_del_irq_route(int gsi, int irqchip, int pin)
{
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_entry e;
@@ -997,15 +999,17 @@ int kvm_del_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin)
e.flags = 0;
e.u.irqchip.irqchip = irqchip;
e.u.irqchip.pin = pin;
- return kvm_del_routing_entry(kvm, &e);
+ return kvm_del_routing_entry(&e);
#else
return -ENOSYS;
#endif
}
-int kvm_commit_irq_routes(kvm_context_t kvm)
+int kvm_commit_irq_routes(void)
{
#ifdef KVM_CAP_IRQ_ROUTING
+ kvm_context_t kvm = kvm_context;
+
kvm->irq_routes->flags = 0;
return kvm_vm_ioctl(kvm_state, KVM_SET_GSI_ROUTING, kvm->irq_routes);
#else
@@ -1013,8 +1017,9 @@ int kvm_commit_irq_routes(kvm_context_t kvm)
#endif
}
-int kvm_get_irq_route_gsi(kvm_context_t kvm)
+int kvm_get_irq_route_gsi(void)
{
+ kvm_context_t kvm = kvm_context;
int i, bit;
uint32_t *buf = kvm->used_gsi_bitmap;
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 9809574..1030a02 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -665,10 +665,8 @@ int kvm_deassign_pci_device(kvm_context_t kvm,
*
* Checks whether kvm can reroute interrupts among the various interrupt
* controllers.
- *
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_has_gsi_routing(kvm_context_t kvm);
+int kvm_has_gsi_routing(void);
/*!
* \brief Determines the number of gsis that can be routed
@@ -687,29 +685,24 @@ int kvm_get_gsi_count(kvm_context_t kvm);
* Clears the temporary irq routing table. Nothing is committed to the
* running VM.
*
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_clear_gsi_routes(kvm_context_t kvm);
+int kvm_clear_gsi_routes(void);
/*!
* \brief Adds an irq route to the temporary irq routing table
*
* Adds an irq route to the temporary irq routing table. Nothing is
* committed to the running VM.
- *
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_add_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin);
+int kvm_add_irq_route(int gsi, int irqchip, int pin);
/*!
* \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.
- *
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_del_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin);
+int kvm_del_irq_route(int gsi, int irqchip, int pin);
struct kvm_irq_routing_entry;
/*!
@@ -717,22 +710,16 @@ struct kvm_irq_routing_entry;
*
* Adds a filled routing entry to the temporary irq routing table. Nothing is
* committed to the running VM.
- *
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_add_routing_entry(kvm_context_t kvm,
- struct kvm_irq_routing_entry *entry);
+int kvm_add_routing_entry(struct kvm_irq_routing_entry *entry);
/*!
* \brief Removes a routing from the temporary irq routing table
*
* Remove a routing to the temporary irq routing table. Nothing is
* committed to the running VM.
- *
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_del_routing_entry(kvm_context_t kvm,
- struct kvm_irq_routing_entry *entry);
+int kvm_del_routing_entry(struct kvm_irq_routing_entry *entry);
/*!
* \brief Updates a routing in the temporary irq routing table
@@ -740,11 +727,8 @@ int kvm_del_routing_entry(kvm_context_t kvm,
* Update a routing in the temporary irq routing table
* with a new value. entry type and GSI can not be changed.
* Nothing is committed to the running VM.
- *
- * \param kvm Pointer to the current kvm_context
*/
-int kvm_update_routing_entry(kvm_context_t kvm,
- struct kvm_irq_routing_entry *entry,
+int kvm_update_routing_entry(struct kvm_irq_routing_entry *entry,
struct kvm_irq_routing_entry *newentry);
/*!
@@ -754,7 +738,7 @@ int kvm_update_routing_entry(kvm_context_t kvm,
*
* \param kvm Pointer to the current kvm_context
*/
-int kvm_commit_irq_routes(kvm_context_t kvm);
+int kvm_commit_irq_routes(void);
/*!
* \brief Get unused GSI number for irq routing table
@@ -763,7 +747,7 @@ int kvm_commit_irq_routes(kvm_context_t kvm);
*
* \param kvm Pointer to the current kvm_context
*/
-int kvm_get_irq_route_gsi(kvm_context_t kvm);
+int kvm_get_irq_route_gsi(void);
/*!
* \brief Create a file descriptor for injecting interrupts
@@ -903,7 +887,7 @@ int kvm_arch_halt(CPUState *env);
int handle_tpr_access(void *opaque, CPUState *env, uint64_t rip,
int is_write);
-#define qemu_kvm_has_gsi_routing() kvm_has_gsi_routing(kvm_context)
+#define qemu_kvm_has_gsi_routing() kvm_has_gsi_routing()
#ifdef TARGET_I386
#define qemu_kvm_has_pit_state2() kvm_has_pit_state2(kvm_context)
#endif
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 3/8] Avoid using kvm_irq_routing_entry in PCIDevice
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
2010-10-10 14:42 ` [PATCH v2 1/8] msix: avoid leaking kvm data on init failure Avi Kivity
2010-10-10 14:42 ` [PATCH v2 2/8] kvm: drop kvm_context parameter from msix-related kvm functions Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 4/8] Avoid use of kvm_irq_routing_entry in hw/msix.c Avi Kivity
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
This structure is not available when !CONFIG_KVM. While an incomplete type
works if it's not used, you can't do address arithmetic on it.
Use a new type kvm_msix_message instead.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/msix.c | 60 ++++++++++++++++++++++++++++++++++++++++++------------------
hw/pci.h | 9 ++++++++-
2 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 6abf059..e00fc6c 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -48,13 +48,29 @@
int msix_supported;
#ifdef CONFIG_KVM
+
+static void kvm_msix_message_to_routing_entry(struct kvm_msix_message *kmm,
+ struct kvm_irq_routing_entry *e)
+{
+ e->type = KVM_IRQ_ROUTING_MSI;
+ e->flags = 0;
+ e->u.msi.address_lo = kmm->addr_lo;
+ e->u.msi.address_hi = kmm->addr_hi;
+ e->u.msi.data = kmm->data;
+}
+
/* KVM specific MSIX helpers */
static void kvm_msix_free(PCIDevice *dev)
{
int vector, changed = 0;
+ struct kvm_msix_message *kmm;
+ struct kvm_irq_routing_entry entry;
+
for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
if (dev->msix_entry_used[vector]) {
- kvm_del_routing_entry(&dev->msix_irq_entries[vector]);
+ kmm = &dev->msix_irq_entries[vector];
+ kvm_msix_message_to_routing_entry(kmm, &entry);
+ kvm_del_routing_entry(&entry);
changed = 1;
}
}
@@ -63,21 +79,20 @@ static void kvm_msix_free(PCIDevice *dev)
}
}
-static void kvm_msix_routing_entry(PCIDevice *dev, unsigned vector,
- struct kvm_irq_routing_entry *entry)
+static void kvm_msix_message_from_vector(PCIDevice *dev, unsigned vector,
+ struct kvm_msix_message *kmm)
{
uint8_t *table_entry = dev->msix_table_page + vector * MSIX_ENTRY_SIZE;
- entry->type = KVM_IRQ_ROUTING_MSI;
- entry->flags = 0;
- entry->u.msi.address_lo = pci_get_long(table_entry + MSIX_MSG_ADDR);
- entry->u.msi.address_hi = pci_get_long(table_entry + MSIX_MSG_UPPER_ADDR);
- entry->u.msi.data = pci_get_long(table_entry + MSIX_MSG_DATA);
+
+ kmm->addr_lo = pci_get_long(table_entry + MSIX_MSG_ADDR);
+ kmm->addr_hi = pci_get_long(table_entry + MSIX_MSG_UPPER_ADDR);
+ kmm->data = pci_get_long(table_entry + MSIX_MSG_DATA);
}
static void kvm_msix_update(PCIDevice *dev, int vector,
int was_masked, int is_masked)
{
- struct kvm_irq_routing_entry e = {}, *entry;
+ struct kvm_msix_message e = {}, *entry;
int mask_cleared = was_masked && !is_masked;
/* It is only legal to change an entry when it is masked. Therefore, it is
* enough to update the routing in kernel when mask is being cleared. */
@@ -89,16 +104,20 @@ static void kvm_msix_update(PCIDevice *dev, int vector,
}
entry = dev->msix_irq_entries + vector;
e.gsi = entry->gsi;
- kvm_msix_routing_entry(dev, vector, &e);
- if (memcmp(&entry->u.msi, &e.u.msi, sizeof entry->u.msi)) {
+ kvm_msix_message_from_vector(dev, vector, &e);
+ if (memcmp(entry, &e, sizeof e) != 0) {
+ struct kvm_irq_routing_entry old, new;
int r;
- r = kvm_update_routing_entry(entry, &e);
+
+ kvm_msix_message_to_routing_entry(entry, &old);
+ kvm_msix_message_to_routing_entry(&e, &new);
+ r = kvm_update_routing_entry(&old, &new);
if (r) {
fprintf(stderr, "%s: kvm_update_routing_entry failed: %s\n", __func__,
strerror(-r));
exit(1);
}
- memcpy(&entry->u.msi, &e.u.msi, sizeof entry->u.msi);
+ *entry = e;
r = kvm_commit_irq_routes();
if (r) {
fprintf(stderr, "%s: kvm_commit_irq_routes failed: %s\n", __func__,
@@ -110,7 +129,8 @@ static void kvm_msix_update(PCIDevice *dev, int vector,
static int kvm_msix_add(PCIDevice *dev, unsigned vector)
{
- struct kvm_irq_routing_entry *entry = dev->msix_irq_entries + vector;
+ struct kvm_msix_message *kmm = dev->msix_irq_entries + vector;
+ struct kvm_irq_routing_entry entry;
int r;
if (!kvm_has_gsi_routing()) {
@@ -125,9 +145,10 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
fprintf(stderr, "%s: kvm_get_irq_route_gsi failed: %s\n", __func__, strerror(-r));
return r;
}
- entry->gsi = r;
- kvm_msix_routing_entry(dev, vector, entry);
- r = kvm_add_routing_entry(entry);
+ kmm->gsi = r;
+ kvm_msix_message_from_vector(dev, vector, kmm);
+ kvm_msix_message_to_routing_entry(kmm, &entry);
+ r = kvm_add_routing_entry(&entry);
if (r < 0) {
fprintf(stderr, "%s: kvm_add_routing_entry failed: %s\n", __func__, strerror(-r));
return r;
@@ -143,10 +164,13 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
static void kvm_msix_del(PCIDevice *dev, unsigned vector)
{
+ struct kvm_irq_routing_entry entry;
+
if (dev->msix_entry_used[vector]) {
return;
}
- kvm_del_routing_entry(&dev->msix_irq_entries[vector]);
+ kvm_msix_message_to_routing_entry(&dev->msix_irq_entries[vector], &entry);
+ kvm_del_routing_entry(&entry);
kvm_commit_irq_routes();
}
#else
diff --git a/hw/pci.h b/hw/pci.h
index 825ccbe..0370e89 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -133,6 +133,13 @@ enum {
typedef int (*msix_mask_notifier_func)(PCIDevice *, unsigned vector,
void *opaque, int masked);
+struct kvm_msix_message {
+ uint32_t gsi;
+ uint32_t addr_lo;
+ uint32_t addr_hi;
+ uint32_t data;
+};
+
struct PCIDevice {
DeviceState qdev;
/* PCI config space */
@@ -196,7 +203,7 @@ struct PCIDevice {
* on the rest of the region. */
target_phys_addr_t msix_page_size;
- struct kvm_irq_routing_entry *msix_irq_entries;
+ struct kvm_msix_message *msix_irq_entries;
void **msix_mask_notifier_opaque;
msix_mask_notifier_func msix_mask_notifier;
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 4/8] Avoid use of kvm_irq_routing_entry in hw/msix.c
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (2 preceding siblings ...)
2010-10-10 14:42 ` [PATCH v2 3/8] Avoid using kvm_irq_routing_entry in PCIDevice Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 5/8] kvm: Add stubs for msix support code Avi Kivity
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
kvm_irq_routing_entry cannot be used when CONFIG_KVM is disabled; add a new
interface to the kvm support code that uses scalars instead.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/msix.c | 35 ++++++++++-------------------------
qemu-kvm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
qemu-kvm.h | 9 +++++++++
roms/seabios | 2 +-
4 files changed, 64 insertions(+), 26 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index e00fc6c..c752e90 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -49,28 +49,16 @@ int msix_supported;
#ifdef CONFIG_KVM
-static void kvm_msix_message_to_routing_entry(struct kvm_msix_message *kmm,
- struct kvm_irq_routing_entry *e)
-{
- e->type = KVM_IRQ_ROUTING_MSI;
- e->flags = 0;
- e->u.msi.address_lo = kmm->addr_lo;
- e->u.msi.address_hi = kmm->addr_hi;
- e->u.msi.data = kmm->data;
-}
-
/* KVM specific MSIX helpers */
static void kvm_msix_free(PCIDevice *dev)
{
int vector, changed = 0;
struct kvm_msix_message *kmm;
- struct kvm_irq_routing_entry entry;
for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
if (dev->msix_entry_used[vector]) {
kmm = &dev->msix_irq_entries[vector];
- kvm_msix_message_to_routing_entry(kmm, &entry);
- kvm_del_routing_entry(&entry);
+ kvm_del_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data);
changed = 1;
}
}
@@ -106,14 +94,13 @@ static void kvm_msix_update(PCIDevice *dev, int vector,
e.gsi = entry->gsi;
kvm_msix_message_from_vector(dev, vector, &e);
if (memcmp(entry, &e, sizeof e) != 0) {
- struct kvm_irq_routing_entry old, new;
int r;
- kvm_msix_message_to_routing_entry(entry, &old);
- kvm_msix_message_to_routing_entry(&e, &new);
- r = kvm_update_routing_entry(&old, &new);
+ r = kvm_update_msix(entry->gsi, entry->addr_lo,
+ entry->addr_hi, entry->data,
+ e.gsi, e.addr_lo, e.addr_hi, e.data);
if (r) {
- fprintf(stderr, "%s: kvm_update_routing_entry failed: %s\n", __func__,
+ fprintf(stderr, "%s: kvm_update_msix failed: %s\n", __func__,
strerror(-r));
exit(1);
}
@@ -130,7 +117,6 @@ static void kvm_msix_update(PCIDevice *dev, int vector,
static int kvm_msix_add(PCIDevice *dev, unsigned vector)
{
struct kvm_msix_message *kmm = dev->msix_irq_entries + vector;
- struct kvm_irq_routing_entry entry;
int r;
if (!kvm_has_gsi_routing()) {
@@ -147,10 +133,9 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
}
kmm->gsi = r;
kvm_msix_message_from_vector(dev, vector, kmm);
- kvm_msix_message_to_routing_entry(kmm, &entry);
- r = kvm_add_routing_entry(&entry);
+ r = kvm_add_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data);
if (r < 0) {
- fprintf(stderr, "%s: kvm_add_routing_entry failed: %s\n", __func__, strerror(-r));
+ fprintf(stderr, "%s: kvm_add_msix failed: %s\n", __func__, strerror(-r));
return r;
}
@@ -164,13 +149,13 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
static void kvm_msix_del(PCIDevice *dev, unsigned vector)
{
- struct kvm_irq_routing_entry entry;
+ struct kvm_msix_message *kmm;
if (dev->msix_entry_used[vector]) {
return;
}
- kvm_msix_message_to_routing_entry(&dev->msix_irq_entries[vector], &entry);
- kvm_del_routing_entry(&entry);
+ kmm = &dev->msix_irq_entries[vector];
+ kvm_del_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data);
kvm_commit_irq_routes();
}
#else
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 3966523..733d0a9 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1036,6 +1036,50 @@ int kvm_get_irq_route_gsi(void)
return -ENOSPC;
}
+static void kvm_msix_routing_entry(struct kvm_irq_routing_entry *e,
+ uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data)
+
+{
+ e->gsi = gsi;
+ e->type = KVM_IRQ_ROUTING_MSI;
+ e->flags = 0;
+ e->u.msi.address_lo = addr_lo;
+ e->u.msi.address_hi = addr_hi;
+ e->u.msi.data = data;
+}
+
+int kvm_add_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data)
+{
+ struct kvm_irq_routing_entry e;
+
+ kvm_msix_routing_entry(&e, gsi, addr_lo, addr_hi, data);
+ return kvm_add_routing_entry(&e);
+}
+
+int kvm_del_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data)
+{
+ struct kvm_irq_routing_entry e;
+
+ kvm_msix_routing_entry(&e, gsi, addr_lo, addr_hi, data);
+ return kvm_del_routing_entry(&e);
+}
+
+int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo,
+ uint32_t old_addr_hi, uint32_t old_data,
+ uint32_t new_gsi, uint32_t new_addr_lo,
+ uint32_t new_addr_hi, uint32_t new_data)
+{
+ struct kvm_irq_routing_entry e1, e2;
+
+ kvm_msix_routing_entry(&e1, old_gsi, old_addr_lo, old_addr_hi, old_data);
+ kvm_msix_routing_entry(&e2, new_gsi, new_addr_lo, new_addr_hi, new_data);
+ return kvm_update_routing_entry(&e1, &e2);
+}
+
+
#ifdef KVM_CAP_DEVICE_MSIX
int kvm_assign_set_msix_nr(kvm_context_t kvm,
struct kvm_assigned_msix_nr *msix_nr)
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 1030a02..25f71db 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -704,6 +704,15 @@ int kvm_add_irq_route(int gsi, int irqchip, int pin);
*/
int kvm_del_irq_route(int gsi, int irqchip, int pin);
+int kvm_add_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data);
+int kvm_del_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data);
+int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo,
+ uint32_t old_addr_hi, uint32_t old_data,
+ uint32_t new_gsi, uint32_t new_addr_lo,
+ uint32_t new_addr_hi, uint32_t new_data);
+
struct kvm_irq_routing_entry;
/*!
* \brief Adds a routing entry to the temporary irq routing table
diff --git a/roms/seabios b/roms/seabios
index 17d3e46..94dc9c4 160000
--- a/roms/seabios
+++ b/roms/seabios
@@ -1 +1 @@
-Subproject commit 17d3e46511aeedc9f09a8216d194d749187b80aa
+Subproject commit 94dc9c49c283cd576c25692d17567035557a2505
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 5/8] kvm: Add stubs for msix support code
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (3 preceding siblings ...)
2010-10-10 14:42 ` [PATCH v2 4/8] Avoid use of kvm_irq_routing_entry in hw/msix.c Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 6/8] kvm: allow kvm.h to be included from target independent files Avi Kivity
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
To allow msix to build without kvm support, add stubs for these functions.
Move the declarations to kvm.h so they are accessible when kvm support is not
built.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
kvm-stub.c | 35 +++++++++++++++++++++++++++++++++++
kvm.h | 13 +++++++++++++
qemu-kvm.h | 34 ----------------------------------
3 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/kvm-stub.c b/kvm-stub.c
index d45f9fa..3c2deec 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -141,3 +141,38 @@ int kvm_set_ioeventfd_mmio_long(int fd, uint32_t adr, uint32_t val, bool assign)
{
return -ENOSYS;
}
+
+int kvm_has_gsi_routing(void)
+{
+ return 0;
+}
+
+int kvm_get_irq_route_gsi(void)
+{
+ return -ENOSYS;
+}
+
+int kvm_add_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data)
+{
+ return -ENOSYS;
+}
+
+int kvm_del_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data)
+{
+ return -ENOSYS;
+}
+
+int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo,
+ uint32_t old_addr_hi, uint32_t old_data,
+ uint32_t new_gsi, uint32_t new_addr_lo,
+ uint32_t new_addr_hi, uint32_t new_data)
+{
+ return -ENOSYS;
+}
+
+int kvm_commit_irq_routes(void)
+{
+ return -ENOSYS;
+}
diff --git a/kvm.h b/kvm.h
index d728836..2f12851 100644
--- a/kvm.h
+++ b/kvm.h
@@ -198,4 +198,17 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
int kvm_physical_memory_addr_from_ram(KVMState *s, ram_addr_t ram_addr,
target_phys_addr_t *phys_addr);
+
+int kvm_has_gsi_routing(void);
+int kvm_get_irq_route_gsi(void);
+int kvm_add_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data);
+int kvm_del_msix(uint32_t gsi, uint32_t addr_lo,
+ uint32_t addr_hi, uint32_t data);
+int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo,
+ uint32_t old_addr_hi, uint32_t old_data,
+ uint32_t new_gsi, uint32_t new_addr_lo,
+ uint32_t new_addr_hi, uint32_t new_data);
+int kvm_commit_irq_routes(void);
+
#endif
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 25f71db..9c08ab4 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -661,14 +661,6 @@ int kvm_deassign_pci_device(kvm_context_t kvm,
#endif
/*!
- * \brief Checks whether the generic irq routing capability is present
- *
- * Checks whether kvm can reroute interrupts among the various interrupt
- * controllers.
- */
-int kvm_has_gsi_routing(void);
-
-/*!
* \brief Determines the number of gsis that can be routed
*
* Returns the number of distinct gsis that can be routed by kvm. This is
@@ -704,15 +696,6 @@ int kvm_add_irq_route(int gsi, int irqchip, int pin);
*/
int kvm_del_irq_route(int gsi, int irqchip, int pin);
-int kvm_add_msix(uint32_t gsi, uint32_t addr_lo,
- uint32_t addr_hi, uint32_t data);
-int kvm_del_msix(uint32_t gsi, uint32_t addr_lo,
- uint32_t addr_hi, uint32_t data);
-int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo,
- uint32_t old_addr_hi, uint32_t old_data,
- uint32_t new_gsi, uint32_t new_addr_lo,
- uint32_t new_addr_hi, uint32_t new_data);
-
struct kvm_irq_routing_entry;
/*!
* \brief Adds a routing entry to the temporary irq routing table
@@ -740,23 +723,6 @@ int kvm_del_routing_entry(struct kvm_irq_routing_entry *entry);
int kvm_update_routing_entry(struct kvm_irq_routing_entry *entry,
struct kvm_irq_routing_entry *newentry);
-/*!
- * \brief Commit the temporary irq routing table
- *
- * Commit the temporary irq routing table to the running VM.
- *
- * \param kvm Pointer to the current kvm_context
- */
-int kvm_commit_irq_routes(void);
-
-/*!
- * \brief Get unused GSI number for irq routing table
- *
- * Get unused GSI number for irq routing table
- *
- * \param kvm Pointer to the current kvm_context
- */
-int kvm_get_irq_route_gsi(void);
/*!
* \brief Create a file descriptor for injecting interrupts
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 6/8] kvm: allow kvm.h to be included from target independent files
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (4 preceding siblings ...)
2010-10-10 14:42 ` [PATCH v2 5/8] kvm: Add stubs for msix support code Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 7/8] msix: remove CONFIG_KVM depedency Avi Kivity
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
- don't include qemu-kvm.h when NEED_CPU_H not defined
- move a couple of declarations around
Signed-off-by: Avi Kivity <avi@redhat.com>
---
kvm.h | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/kvm.h b/kvm.h
index 2f12851..d484a3f 100644
--- a/kvm.h
+++ b/kvm.h
@@ -17,7 +17,9 @@
#include <errno.h>
#include "config-host.h"
#include "qemu-queue.h"
+#ifdef NEED_CPU_H
#include "qemu-kvm.h"
+#endif
#ifdef CONFIG_KVM
#include <linux/kvm.h>
@@ -75,7 +77,6 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset);
#endif
int kvm_pit_in_kernel(void);
-int kvm_irqchip_in_kernel(void);
/* internal API */
@@ -181,6 +182,9 @@ static inline void cpu_synchronize_post_init(CPUState *env)
}
}
+int kvm_physical_memory_addr_from_ram(KVMState *s, ram_addr_t ram_addr,
+ target_phys_addr_t *phys_addr);
+
#endif
int kvm_set_ioeventfd_mmio_long(int fd, uint32_t adr, uint32_t val, bool assign);
@@ -196,9 +200,6 @@ int kvm_set_irqfd(int gsi, int fd, bool assigned)
int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
-int kvm_physical_memory_addr_from_ram(KVMState *s, ram_addr_t ram_addr,
- target_phys_addr_t *phys_addr);
-
int kvm_has_gsi_routing(void);
int kvm_get_irq_route_gsi(void);
int kvm_add_msix(uint32_t gsi, uint32_t addr_lo,
@@ -211,4 +212,6 @@ int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo,
uint32_t new_addr_hi, uint32_t new_data);
int kvm_commit_irq_routes(void);
+int kvm_irqchip_in_kernel(void);
+
#endif
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 7/8] msix: remove CONFIG_KVM depedency
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (5 preceding siblings ...)
2010-10-10 14:42 ` [PATCH v2 6/8] kvm: allow kvm.h to be included from target independent files Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 14:42 ` [PATCH v2 8/8] Move msix.o build back to Makefile.objs Avi Kivity
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
Now that the kvm support is properly stubbed, we can build the msix/kvm glue
unconditionally.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/msix.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index c752e90..f6ab686 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -47,8 +47,6 @@
/* Flag for interrupt controller to declare MSI-X support */
int msix_supported;
-#ifdef CONFIG_KVM
-
/* KVM specific MSIX helpers */
static void kvm_msix_free(PCIDevice *dev)
{
@@ -158,14 +156,6 @@ static void kvm_msix_del(PCIDevice *dev, unsigned vector)
kvm_del_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data);
kvm_commit_irq_routes();
}
-#else
-
-static void kvm_msix_free(PCIDevice *dev) {}
-static void kvm_msix_update(PCIDevice *dev, int vector,
- int was_masked, int is_masked) {}
-static int kvm_msix_add(PCIDevice *dev, unsigned vector) { return -1; }
-static void kvm_msix_del(PCIDevice *dev, unsigned vector) {}
-#endif
/* Add MSI-X capability to the config space for the device. */
/* Given a bar and its size, add MSI-X table on top of it
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v2 8/8] Move msix.o build back to Makefile.objs
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (6 preceding siblings ...)
2010-10-10 14:42 ` [PATCH v2 7/8] msix: remove CONFIG_KVM depedency Avi Kivity
@ 2010-10-10 14:42 ` Avi Kivity
2010-10-10 15:02 ` [PATCH v2 0/8] Move msix.o back to target independent files list Michael S. Tsirkin
2010-10-20 10:18 ` Michael S. Tsirkin
9 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-10 14:42 UTC (permalink / raw)
To: Michael S. Tsirkin, Marcelo Tosatti, kvm
Now that hw/msix.c does not depend on CONFIG_KVM, remove it from
Makefile.target and put it back in Makefile.objs.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
Makefile.objs | 4 +---
Makefile.target | 4 ----
2 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index a814dfe..ca5aebc 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -196,9 +196,7 @@ hw-obj-$(CONFIG_PIIX4) += piix4.o
# PCI watchdog devices
hw-obj-y += wdt_i6300esb.o
-# MSI-X depends on kvm for interrupt injection,
-# so moved it from Makefile.objs to Makefile.target for now
-# hw-obj-y += msix.o
+hw-obj-y += msix.o
# PCI network cards
hw-obj-y += ne2000.o
diff --git a/Makefile.target b/Makefile.target
index 2a1349a..d8a619d 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -183,10 +183,6 @@ obj-y += rwhandler.o
obj-$(CONFIG_KVM) += kvm.o kvm-all.o
obj-$(CONFIG_NO_KVM) += kvm-stub.o
-# MSI-X depends on kvm for interrupt injection,
-# so moved it from Makefile.objs to Makefile.target for now
-obj-y += msix.o
-
LIBS+=-lz
QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
--
1.7.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v2 0/8] Move msix.o back to target independent files list
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (7 preceding siblings ...)
2010-10-10 14:42 ` [PATCH v2 8/8] Move msix.o build back to Makefile.objs Avi Kivity
@ 2010-10-10 15:02 ` Michael S. Tsirkin
2010-10-20 10:18 ` Michael S. Tsirkin
9 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2010-10-10 15:02 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, kvm
On Sun, Oct 10, 2010 at 04:41:59PM +0200, Avi Kivity wrote:
> Due to a depedency on kvm's msix support, msix.c was changed to be a target
> dependent file. This patch set changes it back.
Nothing to object to here :). FWIW
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> v2: make the msix.c->kvm.c interface at a finer granularity, removing the need
> for kvm code to know about PCIDevice.
>
> Avi Kivity (8):
> msix: avoid leaking kvm data on init failure
> kvm: drop kvm_context parameter from msix-related kvm functions
> Avoid using kvm_irq_routing_entry in PCIDevice
> Avoid use of kvm_irq_routing_entry in hw/msix.c
> kvm: Add stubs for msix support code
> kvm: allow kvm.h to be included from target independent files
> msix: remove CONFIG_KVM depedency
> Move msix.o build back to Makefile.objs
>
> Makefile.objs | 4 +--
> Makefile.target | 4 --
> hw/device-assignment.c | 14 ++++----
> hw/msix.c | 82 ++++++++++++++++++++++++------------------------
> hw/pci.h | 9 +++++-
> kvm-stub.c | 35 ++++++++++++++++++++
> kvm.h | 22 +++++++++++--
> qemu-kvm-x86.c | 14 ++++----
> qemu-kvm.c | 77 ++++++++++++++++++++++++++++++++++++--------
> qemu-kvm.h | 55 ++++----------------------------
> roms/seabios | 2 +-
> 11 files changed, 189 insertions(+), 129 deletions(-)
>
> --
> 1.7.3.1
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2 0/8] Move msix.o back to target independent files list
2010-10-10 14:41 [PATCH v2 0/8] Move msix.o back to target independent files list Avi Kivity
` (8 preceding siblings ...)
2010-10-10 15:02 ` [PATCH v2 0/8] Move msix.o back to target independent files list Michael S. Tsirkin
@ 2010-10-20 10:18 ` Michael S. Tsirkin
2010-10-20 10:38 ` Avi Kivity
9 siblings, 1 reply; 12+ messages in thread
From: Michael S. Tsirkin @ 2010-10-20 10:18 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, kvm
On Sun, Oct 10, 2010 at 04:41:59PM +0200, Avi Kivity wrote:
> Due to a depedency on kvm's msix support, msix.c was changed to be a target
> dependent file. This patch set changes it back.
>
> v2: make the msix.c->kvm.c interface at a finer granularity, removing the need
> for kvm code to know about PCIDevice.
>
> Avi Kivity (8):
> msix: avoid leaking kvm data on init failure
> kvm: drop kvm_context parameter from msix-related kvm functions
> Avoid using kvm_irq_routing_entry in PCIDevice
> Avoid use of kvm_irq_routing_entry in hw/msix.c
> kvm: Add stubs for msix support code
> kvm: allow kvm.h to be included from target independent files
> msix: remove CONFIG_KVM depedency
> Move msix.o build back to Makefile.objs
Something strange happened: recent qemu-kvm seems much slower to me.
Any chance kernel irqchip is now disabled?
--
MST
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2 0/8] Move msix.o back to target independent files list
2010-10-20 10:18 ` Michael S. Tsirkin
@ 2010-10-20 10:38 ` Avi Kivity
0 siblings, 0 replies; 12+ messages in thread
From: Avi Kivity @ 2010-10-20 10:38 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Marcelo Tosatti, kvm
On 10/20/2010 12:18 PM, Michael S. Tsirkin wrote:
> On Sun, Oct 10, 2010 at 04:41:59PM +0200, Avi Kivity wrote:
> > Due to a depedency on kvm's msix support, msix.c was changed to be a target
> > dependent file. This patch set changes it back.
> >
> > v2: make the msix.c->kvm.c interface at a finer granularity, removing the need
> > for kvm code to know about PCIDevice.
> >
> > Avi Kivity (8):
> > msix: avoid leaking kvm data on init failure
> > kvm: drop kvm_context parameter from msix-related kvm functions
> > Avoid using kvm_irq_routing_entry in PCIDevice
> > Avoid use of kvm_irq_routing_entry in hw/msix.c
> > kvm: Add stubs for msix support code
> > kvm: allow kvm.h to be included from target independent files
> > msix: remove CONFIG_KVM depedency
> > Move msix.o build back to Makefile.objs
>
> Something strange happened: recent qemu-kvm seems much slower to me.
> Any chance kernel irqchip is now disabled?
>
You can use strace of ftrace to find out if the right ioctls or traces
are called.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 12+ messages in thread