From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, Sheng Yang <sheng@linux.intel.com>
Subject: [PATCH 4/7] KVM: Add kvm_get_irq_routing_entry() func
Date: Thu, 11 Nov 2010 15:46:57 +0800 [thread overview]
Message-ID: <1289461620-7055-5-git-send-email-sheng@linux.intel.com> (raw)
In-Reply-To: <1289461620-7055-1-git-send-email-sheng@linux.intel.com>
We need to query the entry later.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
include/linux/kvm_host.h | 2 ++
virt/kvm/irq_comm.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 7f9e4b7..e2ecbac 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -614,6 +614,8 @@ int kvm_set_irq_routing(struct kvm *kvm,
const struct kvm_irq_routing_entry *entries,
unsigned nr,
unsigned flags);
+int kvm_get_irq_routing_entry(struct kvm *kvm, int gsi,
+ struct kvm_kernel_irq_routing_entry *entry);
void kvm_free_irq_routing(struct kvm *kvm);
#else
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 8edca91..ae1dc7c 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -421,6 +421,26 @@ out:
return r;
}
+int kvm_get_irq_routing_entry(struct kvm *kvm, int gsi,
+ struct kvm_kernel_irq_routing_entry *entry)
+{
+ int count = 0;
+ struct kvm_kernel_irq_routing_entry *ei = NULL;
+ struct kvm_irq_routing_table *irq_rt;
+ struct hlist_node *n;
+
+ rcu_read_lock();
+ irq_rt = rcu_dereference(kvm->irq_routing);
+ if (gsi < irq_rt->nr_rt_entries)
+ hlist_for_each_entry(ei, n, &irq_rt->map[gsi], link)
+ count++;
+ if (count == 1)
+ *entry = *ei;
+ rcu_read_unlock();
+
+ return (count != 1);
+}
+
#define IOAPIC_ROUTING_ENTRY(irq) \
{ .gsi = irq, .type = KVM_IRQ_ROUTING_IRQCHIP, \
.u.irqchip.irqchip = KVM_IRQCHIP_IOAPIC, .u.irqchip.pin = (irq) }
--
1.7.0.1
next prev parent reply other threads:[~2010-11-11 7:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 7:46 [PATCH 0/7 v4] MSI-X mask support for assigned device Sheng Yang
2010-11-11 7:46 ` [PATCH 1/7] PCI: MSI: Move MSI-X entry definition to pci_regs.h Sheng Yang
2010-11-11 7:46 ` [PATCH 2/7] PCI: Add mask bit definition for MSI-X table Sheng Yang
2010-11-11 17:29 ` Jesse Barnes
2010-11-15 8:02 ` Sheng Yang
2010-11-11 7:46 ` [PATCH 3/7] KVM: Move struct kvm_io_device to kvm_host.h Sheng Yang
2010-11-11 7:46 ` Sheng Yang [this message]
2010-11-11 7:46 ` [PATCH 5/7] KVM: assigned dev: Clean up assigned_device's flag Sheng Yang
2010-11-11 7:46 ` [PATCH 6/7] KVM: assigned dev: MSI-X mask support Sheng Yang
2010-11-12 9:53 ` Michael S. Tsirkin
2010-11-12 10:13 ` Sheng Yang
2010-11-12 10:47 ` Michael S. Tsirkin
2010-11-12 10:54 ` Sheng Yang
2010-11-12 11:25 ` Michael S. Tsirkin
2010-11-15 7:37 ` Sheng Yang
2010-11-15 7:42 ` Michael S. Tsirkin
2010-11-15 7:48 ` Sheng Yang
2010-11-15 8:03 ` Michael S. Tsirkin
2010-11-15 8:22 ` Sheng Yang
2010-11-11 7:47 ` [PATCH 7/7] KVM: assigned dev: Big endian support for MSI-X MMIO Sheng Yang
2010-11-11 16:12 ` Michael S. Tsirkin
2010-11-12 2:47 ` Sheng Yang
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=1289461620-7055-5-git-send-email-sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.