diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-10-18 10:41:08 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-10-18 10:41:08 -0400 |
commit | 0794bfc74365d0de4b1d4920cb71031850551cbd (patch) | |
tree | e8c48f4a0b36e89a9d2d9c0a2fc9e58dd6103335 /drivers/xen/events.c | |
parent | 7b586d71858091f0958e5808b7e3d5390c2ae47d (diff) |
xen: identity map gsi->irqs
Impact: preserve compat with native
Reserve the lower irq range for use for hardware interrupts so we
can identity-map them.
[v2: Rebased on top tip/irq/core]
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/events.c')
-rw-r--r-- | drivers/xen/events.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index bc69a9d92abc..1bb51e459ab2 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/ptrace.h> | 33 | #include <asm/ptrace.h> |
34 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
35 | #include <asm/idle.h> | 35 | #include <asm/idle.h> |
36 | #include <asm/io_apic.h> | ||
36 | #include <asm/sync_bitops.h> | 37 | #include <asm/sync_bitops.h> |
37 | #include <asm/xen/hypercall.h> | 38 | #include <asm/xen/hypercall.h> |
38 | #include <asm/xen/hypervisor.h> | 39 | #include <asm/xen/hypervisor.h> |
@@ -46,9 +47,6 @@ | |||
46 | #include <xen/interface/hvm/hvm_op.h> | 47 | #include <xen/interface/hvm/hvm_op.h> |
47 | #include <xen/interface/hvm/params.h> | 48 | #include <xen/interface/hvm/params.h> |
48 | 49 | ||
49 | /* Leave low irqs free for identity mapping */ | ||
50 | #define LEGACY_IRQS 16 | ||
51 | |||
52 | /* | 50 | /* |
53 | * This lock protects updates to the following mapping and reference-count | 51 | * This lock protects updates to the following mapping and reference-count |
54 | * arrays. The lock does not need to be acquired to read the mapping tables. | 52 | * arrays. The lock does not need to be acquired to read the mapping tables. |
@@ -351,6 +349,17 @@ static void unmask_evtchn(int port) | |||
351 | put_cpu(); | 349 | put_cpu(); |
352 | } | 350 | } |
353 | 351 | ||
352 | static int get_nr_hw_irqs(void) | ||
353 | { | ||
354 | int ret = 1; | ||
355 | |||
356 | #ifdef CONFIG_X86_IO_APIC | ||
357 | ret = get_nr_irqs_gsi(); | ||
358 | #endif | ||
359 | |||
360 | return ret; | ||
361 | } | ||
362 | |||
354 | static int find_unbound_irq(void) | 363 | static int find_unbound_irq(void) |
355 | { | 364 | { |
356 | struct irq_data *data; | 365 | struct irq_data *data; |
@@ -382,8 +391,8 @@ static int find_unbound_irq(void) | |||
382 | 391 | ||
383 | static bool identity_mapped_irq(unsigned irq) | 392 | static bool identity_mapped_irq(unsigned irq) |
384 | { | 393 | { |
385 | /* only identity map legacy irqs */ | 394 | /* identity map all the hardware irqs */ |
386 | return irq < LEGACY_IRQS; | 395 | return irq < get_nr_hw_irqs(); |
387 | } | 396 | } |
388 | 397 | ||
389 | static void pirq_unmask_notify(int irq) | 398 | static void pirq_unmask_notify(int irq) |
@@ -552,6 +561,7 @@ int xen_allocate_pirq(unsigned gsi) | |||
552 | 561 | ||
553 | if (identity_mapped_irq(gsi)) { | 562 | if (identity_mapped_irq(gsi)) { |
554 | irq = gsi; | 563 | irq = gsi; |
564 | irq_to_desc_alloc_node(irq, 0); | ||
555 | dynamic_irq_init(irq); | 565 | dynamic_irq_init(irq); |
556 | } else | 566 | } else |
557 | irq = find_unbound_irq(); | 567 | irq = find_unbound_irq(); |