Commit cb17b2a6 authored by Thomas Gleixner's avatar Thomas Gleixner

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: "3cb96f0c x86/hpet: Enhance HPET IRQ to support hierarchical irqdomains"
Reported-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarThomas 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>
parent bafac298
...@@ -577,16 +577,17 @@ static void hpet_msi_capability_lookup(unsigned int start_timer) ...@@ -577,16 +577,17 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
if (!(cfg & HPET_TN_FSB_CAP)) if (!(cfg & HPET_TN_FSB_CAP))
continue; continue;
hdev->flags = 0;
if (cfg & HPET_TN_PERIODIC_CAP)
hdev->flags |= HPET_DEV_PERI_CAP;
sprintf(hdev->name, "hpet%d", i);
hdev->num = i;
irq = hpet_assign_irq(hpet_domain, hdev, hdev->num); irq = hpet_assign_irq(hpet_domain, hdev, hdev->num);
if (irq <= 0) if (irq <= 0)
continue; continue;
sprintf(hdev->name, "hpet%d", i);
hdev->num = i;
hdev->irq = irq; hdev->irq = irq;
hdev->flags = 0;
if (cfg & HPET_TN_PERIODIC_CAP)
hdev->flags |= HPET_DEV_PERI_CAP;
hdev->flags |= HPET_DEV_FSB_CAP; hdev->flags |= HPET_DEV_FSB_CAP;
hdev->flags |= HPET_DEV_VALID; hdev->flags |= HPET_DEV_VALID;
num_timers_used++; num_timers_used++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment