* [Qemu-devel] [PATCH] arm_gic_kvm: Tell kernel about number of IRQs
@ 2014-12-04 18:44 Peter Maydell
2014-12-08 11:29 ` Christoffer Dall
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2014-12-04 18:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Christoffer Dall, patches
Newer kernels support a device attribute on the GIC which allows us to
tell it how many IRQs this GIC instance is configured with; use it, if
it exists.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/intc/arm_gic_kvm.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
index 5038885..1ad3eb0 100644
--- a/hw/intc/arm_gic_kvm.c
+++ b/hw/intc/arm_gic_kvm.c
@@ -92,6 +92,21 @@ static bool kvm_arm_gic_can_save_restore(GICState *s)
return s->dev_fd >= 0;
}
+static bool kvm_gic_supports_attr(GICState *s, int group, int attrnum)
+{
+ struct kvm_device_attr attr = {
+ .group = group,
+ .attr = attrnum,
+ .flags = 0,
+ };
+
+ if (s->dev_fd == -1) {
+ return false;
+ }
+
+ return kvm_device_ioctl(s->dev_fd, KVM_HAS_DEVICE_ATTR, &attr) == 0;
+}
+
static void kvm_gic_access(GICState *s, int group, int offset,
int cpu, uint32_t *val, bool write)
{
@@ -553,6 +568,11 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
return;
}
+ if (kvm_gic_supports_attr(s, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, 0)) {
+ uint32_t numirqs = s->num_irq;
+ kvm_gic_access(s, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, 0, 0, &numirqs, 1);
+ }
+
/* Distributor */
memory_region_init_reservation(&s->iomem, OBJECT(s),
"kvm-gic_dist", 0x1000);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] arm_gic_kvm: Tell kernel about number of IRQs
2014-12-04 18:44 [Qemu-devel] [PATCH] arm_gic_kvm: Tell kernel about number of IRQs Peter Maydell
@ 2014-12-08 11:29 ` Christoffer Dall
0 siblings, 0 replies; 2+ messages in thread
From: Christoffer Dall @ 2014-12-08 11:29 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Thu, Dec 04, 2014 at 06:44:39PM +0000, Peter Maydell wrote:
> Newer kernels support a device attribute on the GIC which allows us to
> tell it how many IRQs this GIC instance is configured with; use it, if
> it exists.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-08 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 18:44 [Qemu-devel] [PATCH] arm_gic_kvm: Tell kernel about number of IRQs Peter Maydell
2014-12-08 11:29 ` Christoffer Dall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).