Skip to content

Commit 213060a

Browse files
Isaku Yamahataaegl
authored andcommitted
[IA64] pvops: 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. Cc: Jes Sorensen <[email protected]> Signed-off-by: Isaku Yamahata <[email protected]> Signed-off-by: Tony Luck <[email protected]>
1 parent 4df8d22 commit 213060a

File tree

5 files changed

+99
-8
lines changed

5 files changed

+99
-8
lines changed

arch/ia64/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ define archhelp
9999
echo ' boot - Build vmlinux and bootloader for Ski simulator'
100100
echo '* unwcheck - Check vmlinux for invalid unwind info'
101101
endef
102+
103+
archprepare: make_nr_irqs_h FORCE
104+
PHONY += make_nr_irqs_h FORCE
105+
106+
make_nr_irqs_h: FORCE
107+
$(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h

arch/ia64/kernel/Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,39 @@ $(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
7373
# Note: kbuild does not track this dependency due to usage of .incbin
7474
$(obj)/gate-data.o: $(obj)/gate.so
7575

76+
# Calculate NR_IRQ = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) based on config
77+
define sed-y
78+
"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
79+
endef
80+
quiet_cmd_nr_irqs = GEN $@
81+
define cmd_nr_irqs
82+
(set -e; \
83+
echo "#ifndef __ASM_NR_IRQS_H__"; \
84+
echo "#define __ASM_NR_IRQS_H__"; \
85+
echo "/*"; \
86+
echo " * DO NOT MODIFY."; \
87+
echo " *"; \
88+
echo " * This file was generated by Kbuild"; \
89+
echo " *"; \
90+
echo " */"; \
91+
echo ""; \
92+
sed -ne $(sed-y) $<; \
93+
echo ""; \
94+
echo "#endif" ) > $@
95+
endef
96+
97+
# We use internal kbuild rules to avoid the "is up to date" message from make
98+
arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \
99+
$(wildcard $(srctree)/include/asm-ia64/*/irq.h)
100+
$(Q)mkdir -p $(dir $@)
101+
$(call if_changed_dep,cc_s_c)
102+
103+
include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
104+
$(Q)mkdir -p $(dir $@)
105+
$(call cmd,nr_irqs)
106+
107+
clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
108+
76109
#
77110
# native ivt.S and entry.S
78111
#

arch/ia64/kernel/nr-irqs.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* calculate
3+
* NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, FOO_NR_IRQS...)
4+
* depending on config.
5+
* This must be calculated before processing asm-offset.c.
6+
*/
7+
8+
#define ASM_OFFSETS_C 1
9+
10+
#include <linux/kbuild.h>
11+
#include <linux/threads.h>
12+
#include <asm-ia64/native/irq.h>
13+
14+
void foo(void)
15+
{
16+
union paravirt_nr_irqs_max {
17+
char ia64_native_nr_irqs[IA64_NATIVE_NR_IRQS];
18+
#ifdef CONFIG_XEN
19+
char xen_nr_irqs[XEN_NR_IRQS];
20+
#endif
21+
};
22+
23+
DEFINE(NR_IRQS, sizeof (union paravirt_nr_irqs_max));
24+
}

include/asm-ia64/irq.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@
1313

1414
#include <linux/types.h>
1515
#include <linux/cpumask.h>
16-
17-
#define NR_VECTORS 256
18-
19-
#if (NR_VECTORS + 32 * NR_CPUS) < 1024
20-
#define NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
21-
#else
22-
#define NR_IRQS 1024
23-
#endif
16+
#include <asm-ia64/nr-irqs.h>
2417

2518
static __inline__ int
2619
irq_canonicalize (int irq)

include/asm-ia64/native/irq.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/******************************************************************************
2+
* include/asm-ia64/native/irq.h
3+
*
4+
* Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5+
* VA Linux Systems Japan K.K.
6+
*
7+
* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
*
21+
* moved from linux/include/asm-ia64/irq.h.
22+
*/
23+
24+
#ifndef _ASM_IA64_NATIVE_IRQ_H
25+
#define _ASM_IA64_NATIVE_IRQ_H
26+
27+
#define NR_VECTORS 256
28+
29+
#if (NR_VECTORS + 32 * NR_CPUS) < 1024
30+
#define IA64_NATIVE_NR_IRQS (NR_VECTORS + 32 * NR_CPUS)
31+
#else
32+
#define IA64_NATIVE_NR_IRQS 1024
33+
#endif
34+
35+
#endif /* _ASM_IA64_NATIVE_IRQ_H */

0 commit comments

Comments
 (0)