mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Dhaval Giani" <dhaval@linux.vnet.ibm.com>,
	"Mike Travis" <travis@sgi.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, "Yinghai Lu" <yhlu.kernel@gmail.com>
Subject: Re: [PATCH 00/43] dyn_array/nr_irqs/sparse_irq support v7
Date: Sun, 10 Aug 2008 02:21:57 -0700	[thread overview]
Message-ID: <86802c440808100221i64b580d7k8b3d6fb2b0f82049@mail.gmail.com> (raw)
In-Reply-To: <1218353792-3355-1-git-send-email-yhlu.kernel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 21306 bytes --]

On Sun, Aug 10, 2008 at 12:35 AM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> Please check dyn_array support for x86
> v3: split changing to nr_irqs to small patches
>   fix checkpatch error
>   reorder the patch sequence to make dyn_array support go at first
>       so could use that with arrays other than NR_IRQS
>
> v4: add CONFIG_HAVE_SPARSE_IRQ with list to use condensed irq_desc array
>   so could use 32 init, and init more if needed.
>   x86 32bit: have CONFIG_HAVE_DYN_ARRAY
>   x86 64bit: have CONFIG_HAVE_DYN_ARRAY and CONFIG_HAVE_SPARSE_IRQ
>
> v5: apply alan cox patch with NR_IRQS for serial at first
>   seperate irq_descX with irq_descX_free, so could use -1U as valid irq
>   expand /proc/interrupts to process > nr_irqs
>   hook irq_2_iommu to irq_desc
>   more other arch irq_desc[] to irq_desc(), and kstat_cpu().irqs[] to kstat_irqs_cpu..
>
> v6: fixed checkpatch errors.., only left warning about lines > 80 chars.
>   put Eric's patch about NR_IRQS at first
>
> v7: according to Eric, need to take care of that some arch doesn't use generic_hardirqs
>   reorder some sequence, squash some patches into previous to make patchset bisectable.
>
> based on tip/master
>
> to do:
>   so dyn irq_desc is done, and ready to:
>   make create_irq to get irq according to bus/dev/func/vector

together with attached patch

LBSuse:~ # cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5
      CPU6       CPU7       CPU8       CPU9       CPU10      CPU11
 CPU12      CPU13      CPU14      CPU15      CPU16      CPU17
CPU18      CPU19      CPU20      CPU21      CPU22      CPU23
CPU24      CPU25      CPU26      CPU27      CPU28      CPU29
CPU30      CPU31
  0:        255          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      timer
  1:          2          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      i8042
  4:        631          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      serial
  7:         64          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge
  8:          1          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      rtc0
  9:          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   acpi
 12:          4          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      i8042
 14:        346          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      pata_amd
 15:          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-edge      pata_amd
 21:        142          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   ohci_hcd:usb2
 20:         25          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   ehci_hcd:usb1
 48:         45          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   eth0
 49:         14          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi
 50:         15          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi
 51:         16          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi
 57:         36          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   qla2xxx
 58:         35          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   qla2xxx
 42:        848          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   IO-APIC-fasteoi   aacraid
393472:          0          0          0          0          0
 0          0          0          0          0          0          0
       0          0          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0   PCI-MSI-edge      aerdrv
426240:          0          0          0          0          0
 0          0          0          0          0          0          0
       0          0          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0   PCI-MSI-edge      aerdrv
459008:          0          0          0          0          0
 0          0          0          0          0          0          0
       0          0          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0   PCI-MSI-edge      aerdrv
134611200:          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0   PCI-MSI-edge      aerdrv
134643968:          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0   PCI-MSI-edge      aerdrv
134676736:          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0   PCI-MSI-edge      aerdrv
6291712:          8          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0   PCI-MSI-edge      lpfc
6295808:          8          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0   PCI-MSI-edge      lpfc
12714240:        292          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0   PCI-MSI-edge      ioc0
4194560:          8          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0      none-edge
4198656:          8          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0      none-edge
5243136:          8          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0      none-edge
5247232:          9          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0      none-edge
9437440:          9          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0      none-edge
9441536:          7          0          0          0          0
  0          0          0          0          0          0          0
        0          0          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0      none-edge
10486016:          7          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0      none-edge
10490112:          7          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0      none-edge
137363712:          7          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0      none-edge
137367808:          8          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0      none-edge
138412288:          6          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0      none-edge
138416384:          6          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0      none-edge
139460864:          7          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0      none-edge
139464960:          7          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0          0          0          0          0          0          0
       0      none-edge
12615936:          5          0          0          0          0
   0          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0      none-edge
NMI:          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   Non-maskable interrupts
LOC:      18545      10702       8821       7691       7521       8903
      7618       7497       7091      11846       7026       6973
 6957       7865       6862       6825       6900       7674
6716       6807       6832       7456       6795       6987       6500
      7421       6440       6363       7780       7456       6273
 7591   Local timer interrupts
RES:       3131       2258       1735        361        550       4774
       135       1125        100       2434         96         92
  105        905         96         95        101        962
104         92         99       1839         93         94        103
     2696         98         94       1002       1551        101
 144   Rescheduling interrupts
CAL:         49        166        132        129        129        184
       129        128        129        171        129        129
  129        181        129        129        129        163
129        129        128        146        129        129        129
      197        129        129         92        167        129
 128   function call interrupts
TLB:          1        231          1          0          1        159
         4          0          0         98          1          0
    0         90          1          0          0         71
1          0          0         84          0          0          0
     35          1          0          1        506          7
 0   TLB shootdowns
TRM:          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   Thermal event interrupts
THR:          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   Threshold APIC interrupts
SPU:          0          0          0          0          0          0
         0          0          0          0          0          0
    0          0          0          0          0          0
0          0          0          0          0          0          0
      0          0          0          0          0          0
 0   Spurious interrupts
ERR:         64


LBSuse:~ # cat /proc/stat
cpu  259 0 49333 1534809 10 1 15 0 0
cpu0 0 0 3990 46163 8 1 6 0 0
cpu1 30 0 1556 47896 0 0 0 0 0
cpu2 0 0 1412 48509 0 0 0 0 0
cpu3 0 0 1403 48972 0 0 0 0 0
cpu4 0 0 1407 48565 0 0 0 0 0
cpu5 62 0 1488 48980 0 0 0 0 0
cpu6 0 0 1404 48629 0 0 0 0 0
cpu7 0 0 1450 48803 0 0 0 0 0
cpu8 0 0 1404 48691 0 0 0 0 0
cpu9 45 0 1452 48925 0 0 0 0 0
cpu10 0 0 1402 48762 0 0 0 0 0
cpu11 0 0 1403 48794 0 0 0 0 0
cpu12 0 0 1404 48827 0 0 0 0 0
cpu13 19 0 1437 48870 0 0 0 0 0
cpu14 0 0 1402 47298 0 0 0 0 0
cpu15 0 0 1402 47332 0 0 0 0 0
cpu16 0 0 1403 47366 0 0 0 0 0
cpu17 18 0 1428 47360 1 0 0 0 0
cpu18 0 0 1404 47434 0 0 0 0 0
cpu19 0 0 1408 47469 0 0 0 0 0
cpu20 0 0 1510 47404 0 0 0 0 0
cpu21 12 0 1525 47422 0 0 0 0 0
cpu22 0 0 1414 47572 0 0 0 0 0
cpu23 0 0 1415 47606 0 0 0 0 0
cpu24 0 0 1420 47639 0 0 0 0 0
cpu25 51 0 1545 47501 0 0 0 0 0
cpu26 0 0 1424 47710 0 0 0 0 0
cpu27 0 0 1425 47744 0 0 0 0 0
cpu28 0 0 1804 47334 0 0 4 0 0
cpu29 18 0 1456 47778 0 0 0 0 0
cpu30 0 0 1423 47852 0 0 0 0 0
cpu31 0 0 1897 47586 0 0 4 0 0
intr 307885 0:255 1:2 2:0 3:0 4:1918 5:0 6:0 7:64 8:1 9:0 10:0 11:0
12:4 13:0 14:3853 15:0 22:0 21:142 20:25 19:0 18:0 17:0 16:0 48:303
49:14 50:15 51:16 56:0 57:36 58:35 43:0 42:848 41:0 40:0 393472:0
426240:0 459008:0 3211520:0 3277056:0 8454400:0 8519936:0 134611200:0
134643968:0 134676736:0 136380672:0 136446208:0 6291712:8 6295808:8
12714240:292 4194560:8 4198656:8 5243136:8 5247232:9 9437440:9
9441536:7 10486016:7 10490112:7 137363712:7 137367808:8 138412288:6
138416384:6 139460864:7 139464960:7 12615936:5
ctxt 90665
btime 1218359101
processes 8457
procs_running 1
procs_blocked 0


need to change irq no to hex?

YH

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pci_28bit_irq_x.patch --]
[-- Type: text/x-patch; name=pci_28bit_irq_x.patch, Size: 7844 bytes --]

diff --git a/arch/arm/mach-iop13xx/msi.c b/arch/arm/mach-iop13xx/msi.c
index 63ef112..ace5bad 100644
--- a/arch/arm/mach-iop13xx/msi.c
+++ b/arch/arm/mach-iop13xx/msi.c
@@ -125,7 +125,7 @@ void __init iop13xx_msi_init(void)
 /*
  * Dynamic irq allocate and deallocation
  */
-int create_irq(void)
+unsigned int create_irq(unsigned not_used)
 {
 	int irq, pos;
 
@@ -173,7 +173,7 @@ static struct irq_chip iop13xx_msi_chip = {
 
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
-	int id, irq = create_irq();
+	int id, irq = create_irq(0);
 	struct msi_msg msg;
 
 	if (irq < 0)
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index d373290..9554513 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -532,7 +532,7 @@ iosapic_reassign_vector (int irq)
 	int new_irq;
 
 	if (iosapic_intr_info[irq].count) {
-		new_irq = create_irq();
+		new_irq = create_irq(0);
 		if (new_irq < 0)
 			panic("%s: out of interrupt vectors!\n", __func__);
 		printk(KERN_INFO "Reassigning vector %d to %d\n",
@@ -784,7 +784,7 @@ iosapic_register_intr (unsigned int gsi,
 			goto unlock_iosapic_lock;
 		}
 	} else
-		irq = create_irq();
+		irq = create_irq(0);
 
 	/* If vector is running out, we try to find a sharable vector */
 	if (irq < 0) {
@@ -925,7 +925,7 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
 		delivery = IOSAPIC_PMI;
 		break;
 	      case ACPI_INTERRUPT_INIT:
-		irq = create_irq();
+		irq = create_irq(0);
 		if (irq < 0)
 			panic("%s: out of interrupt vectors!\n", __func__);
 		vector = irq_to_vector(irq);
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index fa28483..123f8c1 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -403,7 +403,7 @@ void destroy_and_reserve_irq(unsigned int irq)
 /*
  * Dynamic irq allocate and deallocation for MSI
  */
-int create_irq(void)
+unsigned int create_irq(unsigned int not_used)
 {
 	unsigned long flags;
 	int irq, vector, cpu;
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 8199eb2..2774792 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -84,7 +84,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 	int	irq, vector;
 	cpumask_t mask;
 
-	irq = create_irq();
+	irq = create_irq(0);
 	if (irq < 0)
 		return irq;
 
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 51f66d8..004e0bb 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -83,7 +83,7 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
 	if (provider == NULL || provider->dma_map_consistent == NULL)
 		return -EINVAL;
 
-	irq = create_irq();
+	irq = create_irq(0);
 	if (irq < 0)
 		return irq;
 
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 238e2dc..bcc1dd7 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -2499,15 +2499,15 @@ device_initcall(ioapic_init_sysfs);
 /*
  * Dynamic irq allocate and deallocation
  */
-int create_irq(void)
+unsigned int create_irq(unsigned int not_used)
 {
 	/* Allocate an unused irq */
-	int irq, new, vector = 0;
+	unsigned int irq, new, vector = 0;
 	unsigned long flags;
 
-	irq = -ENOSPC;
+	irq = 0;
 	spin_lock_irqsave(&vector_lock, flags);
-	for (new = (nr_irqs - 1); new >= 0; new--) {
+	for (new = (nr_irqs - 1); new > 0; new--) {
 		if (platform_legacy_irq(new))
 			continue;
 		if (irq_vector[new] != 0)
@@ -2519,7 +2519,7 @@ int create_irq(void)
 	}
 	spin_unlock_irqrestore(&vector_lock, flags);
 
-	if (irq >= 0) {
+	if (irq > 0) {
 		set_intr_gate(vector, interrupt[irq]);
 		dynamic_irq_init(irq);
 	}
@@ -2624,7 +2624,7 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
 {
 	struct msi_msg msg;
 	int irq, ret;
-	irq = create_irq();
+	irq = create_irq(0);
 	if (irq < 0)
 		return irq;
 
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 17a6914..2276be7 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -2508,17 +2508,21 @@ device_initcall(ioapic_init_sysfs);
 /*
  * Dynamic irq allocate and deallocation
  */
-int create_irq(void)
+unsigned int create_irq(unsigned int irq_want)
 {
 	/* Allocate an unused irq */
-	int irq;
-	int new;
+	unsigned int irq;
+	unsigned int new;
 	unsigned long flags;
 	struct irq_cfg *cfg_new;
 
-	irq = -ENOSPC;
+#ifndef CONFIG_HAVE_SPARSE_IRQ
+	irq_want = nr_irqs - 1;
+#endif
+
+	irq = 0;
 	spin_lock_irqsave(&vector_lock, flags);
-	for (new = (nr_irqs - 1); new >= 0; new--) {
+	for (new = irq_want; new > 0; new--) {
 		if (platform_legacy_irq(new))
 			continue;
 		cfg_new = irq_cfg(new);
@@ -2533,7 +2537,7 @@ int create_irq(void)
 	}
 	spin_unlock_irqrestore(&vector_lock, flags);
 
-	if (irq >= 0) {
+	if (irq > 0) {
 		dynamic_irq_init(irq);
 	}
 	return irq;
@@ -2787,13 +2791,29 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq)
 	return 0;
 }
 
+static unsigned int build_irq_for_pci_dev(struct pci_dev *dev)
+{
+	unsigned int irq;
+
+	irq = dev->bus->number;
+	irq <<= 8;
+	irq |= dev->devfn;
+	irq <<= 12;
+
+	return irq;
+}
+
 int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
 {
-	int irq, ret;
+	unsigned int irq;
+	int ret;
+	unsigned irq_want;
 
-	irq = create_irq();
-	if (irq < 0)
-		return irq;
+	irq_want = build_irq_for_pci_dev(dev) + 0x100;
+
+	irq = create_irq(irq_want);
+	if (irq == 0)
+		return -1;
 
 #ifdef CONFIG_INTR_REMAP
 	if (!intr_remapping_enabled)
@@ -2820,18 +2840,22 @@ error:
 
 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
-	int irq, ret, sub_handle;
+	unsigned int irq;
+	int ret, sub_handle;
 	struct msi_desc *desc;
+	unsigned int irq_want;
+
 #ifdef CONFIG_INTR_REMAP
 	struct intel_iommu *iommu = 0;
 	int index = 0;
 #endif
 
+	irq_want = build_irq_for_pci_dev(dev) + 0x100;
 	sub_handle = 0;
 	list_for_each_entry(desc, &dev->msi_list, list) {
-		irq = create_irq();
-		if (irq < 0)
-			return irq;
+		irq = create_irq(irq_want--);
+		if (irq == 0)
+			return -1;
 #ifdef CONFIG_INTR_REMAP
 		if (!intr_remapping_enabled)
 			goto no_ir;
diff --git a/drivers/pci/htirq.c b/drivers/pci/htirq.c
index 279c940..6c82eab 100644
--- a/drivers/pci/htirq.c
+++ b/drivers/pci/htirq.c
@@ -82,6 +82,18 @@ void unmask_ht_irq(unsigned int irq)
 	write_ht_irq_msg(irq, &msg);
 }
 
+static unsigned int build_irq_for_pci_dev(struct pci_dev *dev)
+{
+	unsigned int irq;
+
+	irq = dev->bus->number;
+	irq <<= 8;
+	irq |= dev->devfn;
+	irq <<= 12;
+
+	return irq;
+}
+
 /**
  * __ht_create_irq - create an irq and attach it to a device.
  * @dev: The hypertransport device to find the irq capability on.
@@ -97,7 +109,8 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
 	u32 data;
 	int max_irq;
 	int pos;
-	int irq;
+	unsigned int irq;
+	unsigned int irq_want;
 
 	pos = pci_find_ht_capability(dev, HT_CAPTYPE_IRQ);
 	if (!pos)
@@ -125,8 +138,9 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
 	cfg->msg.address_lo = 0xffffffff;
 	cfg->msg.address_hi = 0xffffffff;
 
-	irq = create_irq();
-	if (irq < 0) {
+	irq_want= build_irq_for_pci_dev(dev);
+	irq = create_irq(irq_want + idx);
+	if (irq == 0) {
 		kfree(cfg);
 		return -EBUSY;
 	}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 0fb3ae0..b179ccd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -404,7 +404,7 @@ extern void set_irq_noprobe(unsigned int irq);
 extern void set_irq_probe(unsigned int irq);
 
 /* Handle dynamic irq creation and destruction */
-extern int create_irq(void);
+extern unsigned int create_irq(unsigned int irq_want);
 extern void destroy_irq(unsigned int irq);
 
 /* Test to see if a driver has successfully requested an irq */

      parent reply	other threads:[~2008-08-10  9:22 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-10  7:35 Yinghai Lu
2008-08-10  7:35 ` [PATCH 01/43] x86_64: Restore the proper NR_IRQS define so larger systems work Yinghai Lu
2008-08-10  7:35   ` [PATCH 02/43] 8250: Remove NR_IRQ usage Yinghai Lu
2008-08-10  7:35     ` [PATCH 03/43] x86: add after_bootmem for 32bit Yinghai Lu
2008-08-10  7:35       ` [PATCH 04/43] x86: remove irq_vectors_limits Yinghai Lu
2008-08-10  7:35         ` [PATCH 05/43] add dyn_array support Yinghai Lu
2008-08-10  7:35           ` [PATCH 06/43] add per_cpu_dyn_array support Yinghai Lu
2008-08-10  7:35             ` [PATCH 07/43] x86: alloc dyn_array all alltogether Yinghai Lu
2008-08-10  7:35               ` [PATCH 08/43] x86: enable dyn_array support Yinghai Lu
2008-08-10  7:35                 ` [PATCH 09/43] introduce nr_irqs Yinghai Lu
2008-08-10  7:35                   ` [PATCH 10/43] x86: using nr_irqs Yinghai Lu
2008-08-10  7:36                     ` [PATCH 11/43] drivers/char to use nr_irqs Yinghai Lu
2008-08-10  7:36                       ` [PATCH 12/43] drivers/net " Yinghai Lu
2008-08-10  7:36                         ` [PATCH 13/43] drivers intr remapping " Yinghai Lu
2008-08-10  7:36                           ` [PATCH 14/43] drivers/pcmcia " Yinghai Lu
2008-08-10  7:36                             ` [PATCH 15/43] drivers/rtc " Yinghai Lu
2008-08-10  7:36                               ` [PATCH 16/43] drivers/scsi " Yinghai Lu
2008-08-10  7:36                                 ` [PATCH 17/43] drivers/serial " Yinghai Lu
2008-08-10  7:36                                   ` [PATCH 18/43] drivers proc " Yinghai Lu
2008-08-10  7:36                                     ` [PATCH 19/43] drivers xen events " Yinghai Lu
2008-08-10  7:36                                       ` [PATCH 20/43] make irq_timer_state to use dyn_array Yinghai Lu
2008-08-10  7:36                                         ` [PATCH 21/43] make irq2_iommu " Yinghai Lu
2008-08-10  7:36                                           ` [PATCH 22/43] make irq_desc " Yinghai Lu
2008-08-10  7:36                                             ` [PATCH 23/43] irq: make irqs in kernel stat use per_cpu_dyn_array Yinghai Lu
2008-08-10  7:36                                               ` [PATCH 24/43] x86: use dyn_array in io_apic_xx.c Yinghai Lu
2008-08-10  7:36                                                 ` [PATCH 25/43] x86: get mp_irqs from madt Yinghai Lu
2008-08-10  7:36                                                   ` [PATCH 26/43] x86: remove nr_irq_vectors Yinghai Lu
2008-08-10  7:36                                                     ` [PATCH 27/43] x86_64: use irq_desc() together with dyn_array Yinghai Lu
2008-08-10  7:36                                                       ` [PATCH 28/43] x86: add irq_cfg in io_apic_64.c Yinghai Lu
2008-08-10  7:36                                                         ` [PATCH 29/43] x86: put irq_2_pin pointer into irq_cfg Yinghai Lu
2008-08-10  7:36                                                           ` [PATCH 30/43] x86: put timer_rand_state pointer into irq_desc Yinghai Lu
2008-08-10  7:36                                                             ` [PATCH 31/43] x86: move kstat_irqs from kstat to irq_desc Yinghai Lu
2008-08-10  7:36                                                               ` [PATCH 32/43] add irq_desc_without_new Yinghai Lu
2008-08-10  7:36                                                                 ` [PATCH 33/43] replace loop with nr_irqs with for_each_irq_desc Yinghai Lu
2008-08-10  7:36                                                                   ` [PATCH 34/43] replace loop with nr_irqs for proc/stat Yinghai Lu
2008-08-10  7:36                                                                     ` [PATCH 35/43] replace loop with nr_irqs with for_each_irq_icfg Yinghai Lu
2008-08-10  7:36                                                                       ` [PATCH 36/43] remove >= nr_irqs checking with config_have_sparse_irq Yinghai Lu
2008-08-10  7:36                                                                         ` [PATCH 37/43] x86_64: add irq_desc in function in paramater Yinghai Lu
2008-08-10  7:36                                                                           ` [PATCH 38/43] x86: check with without_new in show_interrupts Yinghai Lu
2008-08-10  7:36                                                                             ` [PATCH 39/43] x86_64: rename irq_desc/irq_desc_with_new Yinghai Lu
2008-08-10  7:36                                                                               ` [PATCH 40/43] seperate irq_descX with irq_descX_free Yinghai Lu
2008-08-10  7:36                                                                                 ` [PATCH 41/43] x86_64: sperate irq_cfgx with irq_cfgx_free Yinghai Lu
2008-08-10  7:36                                                                                   ` [PATCH 42/43] x86_64: make /proc/interrupts works with dyn irq_desc Yinghai Lu
2008-08-10  7:36                                                                                     ` [PATCH 43/43] x86: put irq_2_iommu pointer into irq_desc Yinghai Lu
2008-08-10  9:21 ` Yinghai Lu [this message]

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=86802c440808100221i64b580d7k8b3d6fb2b0f82049@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=travis@sgi.com \
    /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

all inboxes | Powered by JetHome®