diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-06-21 10:21:50 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-06-21 10:38:40 -0400 |
commit | cb17b2a674f2059343f997599b4b001e64eec516 (patch) | |
tree | 40f60475bc55b0775631c59a37bffd01cb5c6d96 | |
parent | bafac298fb20e9ae1305c710d4fd8d20c5911afa (diff) |
x86/hpet: Use proper hpet device number for MSI allocation
hpet_assign_irq() is called with hpet_device->num as "hardware
interrupt number", but hpet_device->num is initialized after the
interrupt has been assigned, so it's always 0. As a consequence only
the first MSI allocation succeeds, the following ones fail because the
"hardware interrupt number" already exists.
Move the initialization of dev->num and other fields before the call
to hpet_assign_irq(), which is the ordering before the offending
commit which introduced that regression.
Fixes: "3cb96f0c9733 x86/hpet: Enhance HPET IRQ to support hierarchical irqdomains"
Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1506211635010.4107@nanos
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
-rw-r--r-- | arch/x86/kernel/hpet.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index c47aab35a17e..10757d0a3fcf 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -577,16 +577,17 @@ static void hpet_msi_capability_lookup(unsigned int start_timer) | |||
577 | if (!(cfg & HPET_TN_FSB_CAP)) | 577 | if (!(cfg & HPET_TN_FSB_CAP)) |
578 | continue; | 578 | continue; |
579 | 579 | ||
580 | hdev->flags = 0; | ||
581 | if (cfg & HPET_TN_PERIODIC_CAP) | ||
582 | hdev->flags |= HPET_DEV_PERI_CAP; | ||
583 | sprintf(hdev->name, "hpet%d", i); | ||
584 | hdev->num = i; | ||
585 | |||
580 | irq = hpet_assign_irq(hpet_domain, hdev, hdev->num); | 586 | irq = hpet_assign_irq(hpet_domain, hdev, hdev->num); |
581 | if (irq <= 0) | 587 | if (irq <= 0) |
582 | continue; | 588 | continue; |
583 | 589 | ||
584 | sprintf(hdev->name, "hpet%d", i); | ||
585 | hdev->num = i; | ||
586 | hdev->irq = irq; | 590 | hdev->irq = irq; |
587 | hdev->flags = 0; | ||
588 | if (cfg & HPET_TN_PERIODIC_CAP) | ||
589 | hdev->flags |= HPET_DEV_PERI_CAP; | ||
590 | hdev->flags |= HPET_DEV_FSB_CAP; | 591 | hdev->flags |= HPET_DEV_FSB_CAP; |
591 | hdev->flags |= HPET_DEV_VALID; | 592 | hdev->flags |= HPET_DEV_VALID; |
592 | num_timers_used++; | 593 | num_timers_used++; |