* [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
@ 2008-04-09 4:49 Isaku Yamahata
2008-04-22 9:08 ` Jes Sorensen
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Isaku Yamahata @ 2008-04-09 4:49 UTC (permalink / raw)
To: linux-ia64
Make NR_IRQ overridable by each pv instances.
Pv instance may need each own number of irqs so that
NR_IRQS should be the maximum number of nr_irqs each
pv instances need.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
include/asm-ia64/irq.h | 10 ++++++-
include/asm-ia64/paravirt_irq.h | 49 +++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 2 deletions(-)
create mode 100644 include/asm-ia64/paravirt_irq.h
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index a66d268..0463427 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -17,9 +17,15 @@
#define NR_VECTORS 256
#if (NR_VECTORS + 32 * NR_CPUS) < 1024
-#define NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
+#define IA64_NATIVE_NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
#else
-#define NR_IRQS 1024
+#define IA64_NATIVE_NR_IRQS 1024
+#endif
+
+#ifdef CONFIG_PARAVIRT
+#include <asm/paravirt_irq.h>
+#else
+#define NR_IRQS IA64_NATIVE_NR_IRQS
#endif
static __inline__ int
diff --git a/include/asm-ia64/paravirt_irq.h b/include/asm-ia64/paravirt_irq.h
new file mode 100644
index 0000000..7dedf2a
--- /dev/null
+++ b/include/asm-ia64/paravirt_irq.h
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * include/asm-ia64/paravirt_irq.h
+ *
+ * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
+ * VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASM_PARAVIRT_IRQ_H
+#define __ASM_PARAVIRT_IRQ_H
+
+#ifdef CONFIG_PARAVIRT
+
+/* Determine the maximal NR_IRQ which each pv instances require.
+ * i.e. NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...)
+ */
+
+#define NR_IRQS 1
+
+#if IA64_NATIVE_NR_IRQS > NR_IRQS
+#undef NR_IRQS
+#define NR_IRQS IA64_NATIVE_NR_IRQS
+#endif
+
+#ifdef CONFIG_XEN
+#include <asm/xen/irq.h>
+#if XEN_NR_IRQS > NR_IRQS
+#undef NR_IRQS
+#define NR_IRQS XEN_NR_IRQS
+#endif
+#endif /* CONFIG_XEN */
+
+#endif /* CONFIG_PARAVIRT */
+
+#endif /* __ASM_PARAVIRT_IRQ_H */
--
1.5.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
@ 2008-04-22 9:08 ` Jes Sorensen
2008-04-22 10:11 ` Isaku Yamahata
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2008-04-22 9:08 UTC (permalink / raw)
To: linux-ia64
> Make NR_IRQ overridable by each pv instances.
> Pv instance may need each own number of irqs so that
> NR_IRQS should be the maximum number of nr_irqs each
> pv instances need.
This really looks dodgy.
+#ifdef CONFIG_PARAVIRT
+
+/* Determine the maximal NR_IRQ which each pv instances require.
+ * i.e. NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...)
+ */
+
+#define NR_IRQS 1
+
+#if IA64_NATIVE_NR_IRQS > NR_IRQS
+#undef NR_IRQS
+#define NR_IRQS IA64_NATIVE_NR_IRQS
+#endif
+
+#ifdef CONFIG_XEN
+#include <asm/xen/irq.h>
+#if XEN_NR_IRQS > NR_IRQS
+#undef NR_IRQS
+#define NR_IRQS XEN_NR_IRQS
+#endif
+#endif /* CONFIG_XEN */
I don't see why Xen needs special casing here, it really makes the
code gross. Please use one typedef for this, like PARAVIRT_NR_IRQS or
something like that, so we don't end up with a KVM special case, an
LGUEST special case and a Xen special case.
Cheers,
Jes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
2008-04-22 9:08 ` Jes Sorensen
@ 2008-04-22 10:11 ` Isaku Yamahata
2008-04-22 12:05 ` Jes Sorensen
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Isaku Yamahata @ 2008-04-22 10:11 UTC (permalink / raw)
To: linux-ia64
On Tue, Apr 22, 2008 at 05:08:22AM -0400, Jes Sorensen wrote:
>
> > Make NR_IRQ overridable by each pv instances.
> > Pv instance may need each own number of irqs so that
> > NR_IRQS should be the maximum number of nr_irqs each
> > pv instances need.
>
> This really looks dodgy.
>
> +#ifdef CONFIG_PARAVIRT
> +
> +/* Determine the maximal NR_IRQ which each pv instances require.
> + * i.e. NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...)
> + */
> +
> +#define NR_IRQS 1
> +
> +#if IA64_NATIVE_NR_IRQS > NR_IRQS
> +#undef NR_IRQS
> +#define NR_IRQS IA64_NATIVE_NR_IRQS
> +#endif
> +
> +#ifdef CONFIG_XEN
> +#include <asm/xen/irq.h>
> +#if XEN_NR_IRQS > NR_IRQS
> +#undef NR_IRQS
> +#define NR_IRQS XEN_NR_IRQS
> +#endif
> +#endif /* CONFIG_XEN */
>
> I don't see why Xen needs special casing here, it really makes the
> code gross. Please use one typedef for this, like PARAVIRT_NR_IRQS or
> something like that, so we don't end up with a KVM special case, an
> LGUEST special case and a Xen special case.
I'm willing to introduce something like PARAVIRT_NR_IRQS,
but I don't see how PARAVIRT_NR_IRQS solves the issues.
What I want here is to define by cpp
#define PARAVIRT_NR_IRQS \
max( \
IA64_NATIVE_NR_IRQS, \
XEN_NR_IRQS, /* only if CONFIG_XEN */ \
LGUSET_NR_IRQS, /* only if CONFIG_LGUSET */ \
KVM_GUEST_NR_IRQS, /* only if CONFIG_KVM_GUEST */ \
MORE_FUTURE_VM_NR_IRQS, /* only if ...*/ \
.... \
)
Probably I'm missing something.
Could you suggest more concretly? Hopefully (pseudo) code snippet.
--
yamahata
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
2008-04-22 9:08 ` Jes Sorensen
2008-04-22 10:11 ` Isaku Yamahata
@ 2008-04-22 12:05 ` Jes Sorensen
2008-04-23 2:54 ` Isaku Yamahata
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2008-04-22 12:05 UTC (permalink / raw)
To: linux-ia64
Isaku Yamahata wrote:
> I'm willing to introduce something like PARAVIRT_NR_IRQS,
> but I don't see how PARAVIRT_NR_IRQS solves the issues.
> What I want here is to define by cpp
> #define PARAVIRT_NR_IRQS \
> max( \
> IA64_NATIVE_NR_IRQS, \
> XEN_NR_IRQS, /* only if CONFIG_XEN */ \
> LGUSET_NR_IRQS, /* only if CONFIG_LGUSET */ \
> KVM_GUEST_NR_IRQS, /* only if CONFIG_KVM_GUEST */ \
> MORE_FUTURE_VM_NR_IRQS, /* only if ...*/ \
> .... \
> )
>
> Probably I'm missing something.
> Could you suggest more concretly? Hopefully (pseudo) code snippet.
I'd rather have PARAVIRT_NR_IRQ set from Kconfig if possible given that
all of these are constants anyway. If we cannot do that, then it would
be better to do the #if FOO_NR_IRQ > PARAVIRT_NR_IRQ in the various
header files for Xen/KVM/lguest so we don't get the clutter in the main
makefile.
Cheers,
Jes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
` (2 preceding siblings ...)
2008-04-22 12:05 ` Jes Sorensen
@ 2008-04-23 2:54 ` Isaku Yamahata
2008-04-23 14:03 ` Jes Sorensen
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Isaku Yamahata @ 2008-04-23 2:54 UTC (permalink / raw)
To: linux-ia64
On Tue, Apr 22, 2008 at 02:05:59PM +0200, Jes Sorensen wrote:
> Isaku Yamahata wrote:
> >I'm willing to introduce something like PARAVIRT_NR_IRQS,
> >but I don't see how PARAVIRT_NR_IRQS solves the issues.
> >What I want here is to define by cpp
> >#define PARAVIRT_NR_IRQS \
> > max( \
> > IA64_NATIVE_NR_IRQS, \
> > XEN_NR_IRQS, /* only if CONFIG_XEN */ \
> > LGUSET_NR_IRQS, /* only if CONFIG_LGUSET */ \
> > KVM_GUEST_NR_IRQS, /* only if CONFIG_KVM_GUEST */ \
> > MORE_FUTURE_VM_NR_IRQS, /* only if ...*/ \
> > .... \
> > )
> >
> >Probably I'm missing something.
> >Could you suggest more concretly? Hopefully (pseudo) code snippet.
>
> I'd rather have PARAVIRT_NR_IRQ set from Kconfig if possible given that
> all of these are constants anyway. If we cannot do that, then it would
> be better to do the #if FOO_NR_IRQ > PARAVIRT_NR_IRQ in the various
> header files for Xen/KVM/lguest so we don't get the clutter in the main
> makefile.
Unfotunately Kconfig doesn't support arithmetic comparison.
So do you want something like the followings?
irq.h:
#if (NR_VECTORS + 32 * NR_CPUS) < 1024
#define IA64_NATIVE_NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
#else
#define IA64_NATIVE_NR_IRQS 1024
#endif
#define PARAVIRT_NR_IRQS IA64_NATIVE_NR_IRQS
/* CAUTION:each asm/xxx/irq.h may redefine PARAVIRT_NR_IRQS */
#include <asm/xen/irq.h>
#include <asm/kvm/irq.h>
#include <asm/foo/irq.h>
...
#define NR_IRQS PARAVIRT_NR_IRQS
asm/foo/irq.h:
#define FOO_NR_IRQ ...
#ifdef CONFIG_FOO
#if FOO_NR_IRQS > PARAVIRT_NR_IRQS
#undef PARAVIRT_NR_IRQS
#define PARAVIRT_NR_IRQS FOO_NR_IRQS
#endif
#endif
--
yamahata
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
` (3 preceding siblings ...)
2008-04-23 2:54 ` Isaku Yamahata
@ 2008-04-23 14:03 ` Jes Sorensen
2008-04-24 11:19 ` Isaku Yamahata
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2008-04-23 14:03 UTC (permalink / raw)
To: linux-ia64
Isaku Yamahata wrote:
>> I'd rather have PARAVIRT_NR_IRQ set from Kconfig if possible given that
>> all of these are constants anyway. If we cannot do that, then it would
>> be better to do the #if FOO_NR_IRQ > PARAVIRT_NR_IRQ in the various
>> header files for Xen/KVM/lguest so we don't get the clutter in the main
>> makefile.
>
> Unfotunately Kconfig doesn't support arithmetic comparison.
> So do you want something like the followings?
IMHO, that would be better.
Cheers,
Jes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
` (4 preceding siblings ...)
2008-04-23 14:03 ` Jes Sorensen
@ 2008-04-24 11:19 ` Isaku Yamahata
2008-04-24 11:52 ` Jes Sorensen
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Isaku Yamahata @ 2008-04-24 11:19 UTC (permalink / raw)
To: linux-ia64
On Wed, Apr 23, 2008 at 04:03:58PM +0200, Jes Sorensen wrote:
> Isaku Yamahata wrote:
> >>I'd rather have PARAVIRT_NR_IRQ set from Kconfig if possible given that
> >>all of these are constants anyway. If we cannot do that, then it would
> >>be better to do the #if FOO_NR_IRQ > PARAVIRT_NR_IRQ in the various
> >>header files for Xen/KVM/lguest so we don't get the clutter in the main
> >>makefile.
> >
> >Unfotunately Kconfig doesn't support arithmetic comparison.
> >So do you want something like the followings?
>
> IMHO, that would be better.
How about this?
Eventually I found another way which doesn't use #undef trick.
ASM_OFFSET_C is somewhat tricky, but much better, I suppose.
From 8b13a7498112d2f3f1d8eb58543209956ffc5417 Mon Sep 17 00:00:00 2001
From: Isaku Yamahata <yamahata@valinux.co.jp>
Date: Thu, 24 Apr 2008 19:53:50 +0900
Subject: ia64/pv_ops: paravirtualize NR_IRQS
Make NR_IRQ overridable by each pv instances.
Pv instance may need each own number of irqs so that
NR_IRQS should be the maximum number of nr_irqs each
pv instances need.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
arch/ia64/kernel/asm-offsets.c | 18 ++++++++++++++++++
include/asm-ia64/hardirq.h | 4 +++-
include/asm-ia64/irq.h | 13 +++++++++++--
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 230a6f9..dff6403 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -10,6 +10,7 @@
#include <linux/pid.h>
#include <linux/clocksource.h>
+#include <asm-ia64/irq.h>
#include <asm-ia64/processor.h>
#include <asm-ia64/ptrace.h>
#include <asm-ia64/siginfo.h>
@@ -291,4 +292,21 @@ void foo(void)
offsetof (struct itc_jitter_data_t, itc_jitter));
DEFINE(IA64_ITC_LASTCYCLE_OFFSET,
offsetof (struct itc_jitter_data_t, itc_lastcycle));
+ BLANK();
+
+ {
+ /*
+ * calculate
+ * max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, FOO_NR_IRQS...)
+ * depending on config.
+ */
+ union paravirt_nr_irqs_max {
+ char ia64_native_nr_irqs[IA64_NATIVE_NR_IRQS];
+#ifdef CONFIG_XEN
+ char xen_nr_irqs[XEN_NR_IRQS];
+#endif
+ };
+
+ DEFINE(PARAVIRT_NR_IRQS, sizeof (union paravirt_nr_irqs_max));
+ }
}
diff --git a/include/asm-ia64/hardirq.h b/include/asm-ia64/hardirq.h
index 140e495..7ee7626 100644
--- a/include/asm-ia64/hardirq.h
+++ b/include/asm-ia64/hardirq.h
@@ -8,7 +8,9 @@
#include <linux/threads.h>
+#ifndef ASM_OFFSETS_C
#include <linux/irq.h>
+#endif
#include <asm/processor.h>
@@ -26,7 +28,7 @@
* The hardirq mask has to be large enough to have space for potentially all IRQ sources
* in the system nesting on a single CPU:
*/
-#if (1 << HARDIRQ_BITS) < NR_IRQS
+#if !defined (ASM_OFFSETS_C) && ((1 << HARDIRQ_BITS) < NR_IRQS)
# error HARDIRQ_BITS is too low!
#endif
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index a66d268..5208318 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -17,9 +17,18 @@
#define NR_VECTORS 256
#if (NR_VECTORS + 32 * NR_CPUS) < 1024
-#define NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
+#define IA64_NATIVE_NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
#else
-#define NR_IRQS 1024
+#define IA64_NATIVE_NR_IRQS 1024
+#endif
+
+/*
+ * PARAVIRT_NR_IRQS is defined by asm-offsets.c as
+ * max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) depending on config.
+ */
+#ifndef ASM_OFFSETS_C
+#include <asm/asm-offsets.h>
+#define NR_IRQS PARAVIRT_NR_IRQS
#endif
static __inline__ int
--
1.5.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
` (5 preceding siblings ...)
2008-04-24 11:19 ` Isaku Yamahata
@ 2008-04-24 11:52 ` Jes Sorensen
2008-04-24 12:21 ` Isaku Yamahata
2008-04-30 12:29 ` Isaku Yamahata
8 siblings, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2008-04-24 11:52 UTC (permalink / raw)
To: linux-ia64
Isaku Yamahata wrote:
> On Wed, Apr 23, 2008 at 04:03:58PM +0200, Jes Sorensen wrote:
>> Isaku Yamahata wrote:
>>>> I'd rather have PARAVIRT_NR_IRQ set from Kconfig if possible given that
>>>> all of these are constants anyway. If we cannot do that, then it would
>>>> be better to do the #if FOO_NR_IRQ > PARAVIRT_NR_IRQ in the various
>>>> header files for Xen/KVM/lguest so we don't get the clutter in the main
>>>> makefile.
>>> Unfotunately Kconfig doesn't support arithmetic comparison.
>>> So do you want something like the followings?
>> IMHO, that would be better.
>
> How about this?
> Eventually I found another way which doesn't use #undef trick.
> ASM_OFFSET_C is somewhat tricky, but much better, I suppose.
Hi Isaku,
Yes, this looks like a much nicer way to solve the problem IMHO.
> +/*
> + * PARAVIRT_NR_IRQS is defined by asm-offsets.c as
> + * max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) depending on config.
> + */
> +#ifndef ASM_OFFSETS_C
> +#include <asm/asm-offsets.h>
> +#define NR_IRQS PARAVIRT_NR_IRQS
> #endif
>
> static __inline__ int
Shouldn't this be defined as IA64_NATIVE_NR_IRQS? I wouldn't do the
#ifndef ASM_OFFSETS_C part, you should be able to just include it
unconditionally.
Cheers,
Jes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
` (6 preceding siblings ...)
2008-04-24 11:52 ` Jes Sorensen
@ 2008-04-24 12:21 ` Isaku Yamahata
2008-04-30 12:29 ` Isaku Yamahata
8 siblings, 0 replies; 10+ messages in thread
From: Isaku Yamahata @ 2008-04-24 12:21 UTC (permalink / raw)
To: linux-ia64
On Thu, Apr 24, 2008 at 01:52:20PM +0200, Jes Sorensen wrote:
> >+/*
> >+ * PARAVIRT_NR_IRQS is defined by asm-offsets.c as
> >+ * max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) depending on config.
> >+ */
> >+#ifndef ASM_OFFSETS_C
> >+#include <asm/asm-offsets.h>
> >+#define NR_IRQS PARAVIRT_NR_IRQS
> > #endif
> >
> > static __inline__ int
>
> Shouldn't this be defined as IA64_NATIVE_NR_IRQS?
I eliminated this hunk completly.
> I wouldn't do the
> #ifndef ASM_OFFSETS_C part, you should be able to just include it
> unconditionally.
Still two ASM_OFFSET_C remain, but I couldn't find
a way to sort out deep header inclusion dependency.
Without them, asm-offset.c doesn't compile.
From c101e113912a4bbc117b4d93e215169a55581602 Mon Sep 17 00:00:00 2001
From: Isaku Yamahata <yamahata@valinux.co.jp>
Date: Thu, 24 Apr 2008 21:02:26 +0900
Subject: ia64/pv_ops: paravirtualize NR_IRQS
Make NR_IRQ overridable by each pv instances.
Pv instance may need each own number of irqs so that
NR_IRQS should be the maximum number of nr_irqs each
pv instances need.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
arch/ia64/kernel/asm-offsets.c | 18 ++++++++++++++++++
include/asm-ia64/hardirq.h | 4 +++-
include/asm-ia64/irq.h | 4 ++--
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 230a6f9..08a09e3 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -10,6 +10,7 @@
#include <linux/pid.h>
#include <linux/clocksource.h>
+#include <asm-ia64/irq.h>
#include <asm-ia64/processor.h>
#include <asm-ia64/ptrace.h>
#include <asm-ia64/siginfo.h>
@@ -291,4 +292,21 @@ void foo(void)
offsetof (struct itc_jitter_data_t, itc_jitter));
DEFINE(IA64_ITC_LASTCYCLE_OFFSET,
offsetof (struct itc_jitter_data_t, itc_lastcycle));
+ BLANK();
+
+ {
+ /*
+ * calculate
+ * max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, FOO_NR_IRQS...)
+ * depending on config.
+ */
+ union paravirt_nr_irqs_max {
+ char ia64_native_nr_irqs[IA64_NATIVE_NR_IRQS];
+#ifdef CONFIG_XEN
+ char xen_nr_irqs[XEN_NR_IRQS];
+#endif
+ };
+
+ DEFINE(NR_IRQS, sizeof (union paravirt_nr_irqs_max));
+ }
}
diff --git a/include/asm-ia64/hardirq.h b/include/asm-ia64/hardirq.h
index 140e495..7ee7626 100644
--- a/include/asm-ia64/hardirq.h
+++ b/include/asm-ia64/hardirq.h
@@ -8,7 +8,9 @@
#include <linux/threads.h>
+#ifndef ASM_OFFSETS_C
#include <linux/irq.h>
+#endif
#include <asm/processor.h>
@@ -26,7 +28,7 @@
* The hardirq mask has to be large enough to have space for potentially all IRQ sources
* in the system nesting on a single CPU:
*/
-#if (1 << HARDIRQ_BITS) < NR_IRQS
+#if !defined (ASM_OFFSETS_C) && ((1 << HARDIRQ_BITS) < NR_IRQS)
# error HARDIRQ_BITS is too low!
#endif
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index a66d268..60e4c1d 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -17,9 +17,9 @@
#define NR_VECTORS 256
#if (NR_VECTORS + 32 * NR_CPUS) < 1024
-#define NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
+#define IA64_NATIVE_NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
#else
-#define NR_IRQS 1024
+#define IA64_NATIVE_NR_IRQS 1024
#endif
static __inline__ int
--
1.5.3
--
yamahata
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
` (7 preceding siblings ...)
2008-04-24 12:21 ` Isaku Yamahata
@ 2008-04-30 12:29 ` Isaku Yamahata
8 siblings, 0 replies; 10+ messages in thread
From: Isaku Yamahata @ 2008-04-30 12:29 UTC (permalink / raw)
To: linux-ia64
Make NR_IRQ overridable by each pv instances.
Pv instance may need each own number of irqs so that
NR_IRQS should be the maximum number of nr_irqs each
pv instances need.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
arch/ia64/Makefile | 6 ++++++
arch/ia64/kernel/Makefile | 33 +++++++++++++++++++++++++++++++++
arch/ia64/kernel/nr-irqs.c | 24 ++++++++++++++++++++++++
include/asm-ia64/irq.h | 9 +--------
include/asm-ia64/native/irq.h | 35 +++++++++++++++++++++++++++++++++++
5 files changed, 99 insertions(+), 8 deletions(-)
create mode 100644 arch/ia64/kernel/nr-irqs.c
create mode 100644 include/asm-ia64/native/irq.h
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index ec4cca4..4721a12 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -99,3 +99,9 @@ define archhelp
echo ' boot - Build vmlinux and bootloader for Ski simulator'
echo '* unwcheck - Check vmlinux for invalid unwind info'
endef
+
+archprepare: make_nr_irqs_h FORCE
+PHONY += make_nr_irqs_h FORCE
+
+make_nr_irqs_h: FORCE
+ $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index cea91f1..87fea11 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -73,6 +73,39 @@ $(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
# Note: kbuild does not track this dependency due to usage of .incbin
$(obj)/gate-data.o: $(obj)/gate.so
+# Calculate NR_IRQ = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) based on config
+define sed-y
+ "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
+endef
+quiet_cmd_nr_irqs = GEN $@
+define cmd_nr_irqs
+ (set -e; \
+ echo "#ifndef __ASM_NR_IRQS_H__"; \
+ echo "#define __ASM_NR_IRQS_H__"; \
+ echo "/*"; \
+ echo " * DO NOT MODIFY."; \
+ echo " *"; \
+ echo " * This file was generated by Kbuild"; \
+ echo " *"; \
+ echo " */"; \
+ echo ""; \
+ sed -ne $(sed-y) $<; \
+ echo ""; \
+ echo "#endif" ) > $@
+endef
+
+# We use internal kbuild rules to avoid the "is up to date" message from make
+arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \
+ $(wildcard $(srctree)/include/asm-ia64/*/irq.h)
+ $(Q)mkdir -p $(dir $@)
+ $(call if_changed_dep,cc_s_c)
+
+include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
+ $(Q)mkdir -p $(dir $@)
+ $(call cmd,nr_irqs)
+
+clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
+
#
# native ivt.S and entry.S
#
diff --git a/arch/ia64/kernel/nr-irqs.c b/arch/ia64/kernel/nr-irqs.c
new file mode 100644
index 0000000..1ae0491
--- /dev/null
+++ b/arch/ia64/kernel/nr-irqs.c
@@ -0,0 +1,24 @@
+/*
+ * calculate
+ * NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, FOO_NR_IRQS...)
+ * depending on config.
+ * This must be calculated before processing asm-offset.c.
+ */
+
+#define ASM_OFFSETS_C 1
+
+#include <linux/kbuild.h>
+#include <linux/threads.h>
+#include <asm-ia64/native/irq.h>
+
+void foo(void)
+{
+ union paravirt_nr_irqs_max {
+ char ia64_native_nr_irqs[IA64_NATIVE_NR_IRQS];
+#ifdef CONFIG_XEN
+ char xen_nr_irqs[XEN_NR_IRQS];
+#endif
+ };
+
+ DEFINE(NR_IRQS, sizeof (union paravirt_nr_irqs_max));
+}
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index a66d268..3627116 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -13,14 +13,7 @@
#include <linux/types.h>
#include <linux/cpumask.h>
-
-#define NR_VECTORS 256
-
-#if (NR_VECTORS + 32 * NR_CPUS) < 1024
-#define NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
-#else
-#define NR_IRQS 1024
-#endif
+#include <asm-ia64/nr-irqs.h>
static __inline__ int
irq_canonicalize (int irq)
diff --git a/include/asm-ia64/native/irq.h b/include/asm-ia64/native/irq.h
new file mode 100644
index 0000000..efe9ff7
--- /dev/null
+++ b/include/asm-ia64/native/irq.h
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * include/asm-ia64/native/irq.h
+ *
+ * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
+ * VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * moved from linux/include/asm-ia64/irq.h.
+ */
+
+#ifndef _ASM_IA64_NATIVE_IRQ_H
+#define _ASM_IA64_NATIVE_IRQ_H
+
+#define NR_VECTORS 256
+
+#if (NR_VECTORS + 32 * NR_CPUS) < 1024
+#define IA64_NATIVE_NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
+#else
+#define IA64_NATIVE_NR_IRQS 1024
+#endif
+
+#endif /* _ASM_IA64_NATIVE_IRQ_H */
--
1.5.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-04-30 12:29 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-09 4:49 [PATCH 11/15] ia64/pv_ops: paravirtualize NR_IRQS Isaku Yamahata
2008-04-22 9:08 ` Jes Sorensen
2008-04-22 10:11 ` Isaku Yamahata
2008-04-22 12:05 ` Jes Sorensen
2008-04-23 2:54 ` Isaku Yamahata
2008-04-23 14:03 ` Jes Sorensen
2008-04-24 11:19 ` Isaku Yamahata
2008-04-24 11:52 ` Jes Sorensen
2008-04-24 12:21 ` Isaku Yamahata
2008-04-30 12:29 ` Isaku Yamahata
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox