From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	"Keir (Xen.org)" <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH] xen: remove nr_irqs_gsi from generic code
Date: Wed, 19 Dec 2012 14:43:53 +0000	[thread overview]
Message-ID: <1355928233-15885-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1354628943.2693.80.camel@zakaz.uk.xensource.com>
The concept is X86 specific.
AFAICT the generic concept here is the number of physical IRQs which
the current hardware has, so call this nr_hw_irqs.
Also using "defined NR_IRQS" as a standin for x86 might have made
sense at one point but its just cleaner to push the necessary
definitions into asm/irq.h.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Keir (Xen.org) <keir@xen.org>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
--
v2: s/nr_hw_irqs/nr_static_irqs/g
---
 xen/arch/arm/dummy.S      |    2 --
 xen/common/domain.c       |    4 ++--
 xen/include/asm-arm/irq.h |    3 +++
 xen/include/asm-x86/irq.h |    4 ++++
 xen/include/xen/irq.h     |    8 --------
 xen/xsm/flask/hooks.c     |    4 ++--
 6 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/xen/arch/arm/dummy.S b/xen/arch/arm/dummy.S
index 6416f94..a214fbf 100644
--- a/xen/arch/arm/dummy.S
+++ b/xen/arch/arm/dummy.S
@@ -6,5 +6,3 @@ x:	.word 0xe7f000f0 /* Undefined instruction */
 	.globl x; \
 x:	mov pc, lr
 	
-/* PIRQ support */
-DUMMY(nr_irqs_gsi);
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 12c8e24..2f8ef00 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -259,9 +259,9 @@ struct domain *domain_create(
         atomic_inc(&d->pause_count);
 
         if ( domid )
-            d->nr_pirqs = nr_irqs_gsi + extra_domU_irqs;
+            d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
         else
-            d->nr_pirqs = nr_irqs_gsi + extra_dom0_irqs;
+            d->nr_pirqs = nr_static_irqs + extra_dom0_irqs;
         if ( d->nr_pirqs > nr_irqs )
             d->nr_pirqs = nr_irqs;
 
diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index abde839..bd6b54a 100644
--- a/xen/include/asm-arm/irq.h
+++ b/xen/include/asm-arm/irq.h
@@ -21,6 +21,9 @@ struct irq_cfg {
 #define NR_IRQS		1024
 #define nr_irqs NR_IRQS
 
+#define nr_irqs NR_IRQS
+#define nr_static_irqs NR_IRQS
+
 struct irq_desc;
 
 struct irq_desc *__irq_to_desc(int irq);
diff --git a/xen/include/asm-x86/irq.h b/xen/include/asm-x86/irq.h
index 5eefb94..7f5da06 100644
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
@@ -11,6 +11,10 @@
 #include <irq_vectors.h>
 #include <asm/percpu.h>
 
+extern unsigned int nr_irqs_gsi;
+extern unsigned int nr_irqs;
+#define nr_static_irqs nr_irqs_gsi
+
 #define IO_APIC_IRQ(irq)    (platform_legacy_irq(irq) ?    \
 			     (1 << (irq)) & io_apic_irqs : \
 			     (irq) < nr_irqs_gsi)
diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h
index 5973cce..7386358 100644
--- a/xen/include/xen/irq.h
+++ b/xen/include/xen/irq.h
@@ -58,14 +58,6 @@ typedef const struct hw_interrupt_type hw_irq_controller;
 
 #include <asm/irq.h>
 
-#ifdef NR_IRQS
-# define nr_irqs NR_IRQS
-# define nr_irqs_gsi NR_IRQS
-#else
-extern unsigned int nr_irqs_gsi;
-extern unsigned int nr_irqs;
-#endif
-
 struct msi_desc;
 /*
  * This is the "IRQ descriptor", which contains various information
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 0ca10d0..782e28c 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -72,7 +72,7 @@ static int get_irq_sid(int irq, u32 *sid, struct avc_audit_data *ad)
     struct irq_desc *desc = irq_to_desc(irq);
     if ( irq >= nr_irqs || irq < 0 )
         return -EINVAL;
-    if ( irq < nr_irqs_gsi ) {
+    if ( irq < nr_static_irqs ) {
         if (ad) {
             AVC_AUDIT_DATA_INIT(ad, IRQ);
             ad->irq = irq;
@@ -699,7 +699,7 @@ static int flask_map_domain_pirq (struct domain *d, int irq, void *data)
     if ( rc )
         return rc;
 
-    if ( irq >= nr_irqs_gsi && msi ) {
+    if ( irq >= nr_static_irqs && msi ) {
         u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
         AVC_AUDIT_DATA_INIT(&ad, DEV);
         ad.device = machine_bdf;
-- 
1.7.9.1
next prev parent reply	other threads:[~2012-12-19 14:43 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04 11:56 [PATCH 00/15] xen: arm: remove dummy.S Ian Campbell
2012-12-04 11:56 ` [PATCH 01/15] xen: arm: define node_online_map Ian Campbell
2012-12-04 11:56 ` [PATCH 02/15] xen: arm: make smp_send_state_dump a real function Ian Campbell
2012-12-04 11:56 ` [PATCH 03/15] xen: arm: implement arch_get_info_guest Ian Campbell
2012-12-04 11:56 ` [PATCH 04/15] xen: arm: implement arch_vcpu_reset Ian Campbell
2012-12-04 11:56 ` [PATCH 05/15] xen: remove nr_irqs_gsi from generic code Ian Campbell
2012-12-04 13:43   ` Jan Beulich
2012-12-04 13:49     ` Ian Campbell
2012-12-19 14:43       ` Ian Campbell [this message]
2012-12-19 15:18         ` [PATCH] " Keir Fraser
2012-12-19 15:31         ` Jan Beulich
2012-12-19 16:05         ` Ian Campbell
2012-12-04 11:56 ` [PATCH 06/15] xen: arm: stub out pirq related functions Ian Campbell
2012-12-04 11:56 ` [PATCH 07/15] xen: arm: stub out wallclock time Ian Campbell
2012-12-04 11:56 ` [PATCH 08/15] xen: arm: stub out steal_page Ian Campbell
2012-12-04 11:56 ` [PATCH 09/15] xen: arm: stub page_is_ram_type Ian Campbell
2012-12-04 11:56 ` [PATCH 10/15] xen: arm: stub out domain_get_maximum_gpfn Ian Campbell
2012-12-04 11:56 ` [PATCH 11/15] xen: arm: stub domain_relinquish_resources Ian Campbell
2012-12-04 11:56 ` [PATCH 12/15] xen: arm: initialise dom_{xen,io,cow} Ian Campbell
2012-12-04 14:17   ` [PATCH 12/15] xen: arm: initialise dom_{xen, io, cow} David Vrabel
2012-12-04 14:21     ` Ian Campbell
2012-12-04 11:56 ` [PATCH 13/15] xen: arm: implement send_timer_event Ian Campbell
2012-12-04 11:56 ` [PATCH 14/15] xen: arm: implement share_xen_page_with_privileged_guests Ian Campbell
2012-12-04 11:56 ` [PATCH 15/15] xen: arm: remove now empty dummy.S Ian Campbell
2012-12-19 16:05   ` Ian Campbell
2012-12-06 12:09 ` [PATCH 00/15] xen: arm: remove dummy.S Tim Deegan
2012-12-19 13:27   ` Ian Campbell
2012-12-18 17:14 ` Ian Campbell
2012-12-18 18:31   ` Stefano Stabellini
2012-12-18 20:54     ` Ian Campbell
2012-12-19 11:21       ` Stefano Stabellini
2012-12-19 14:03 ` Ian Campbell
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=1355928233-15885-1-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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 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).