[PATCH 08/10] x86/HPET: shrink IRQ-descriptor locked region in set_channel_irq_affinity()

Jan Beulich posted 10 patches 2 weeks ago
There is a newer version of this series
[PATCH 08/10] x86/HPET: shrink IRQ-descriptor locked region in set_channel_irq_affinity()
Posted by Jan Beulich 2 weeks ago
Along the lines of hpet_disable_channel(), split out hpet_enable_channel()
as well, to then use both functions from set_channel_irq_affinity().

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -257,10 +257,9 @@ static void cf_check hpet_interrupt_hand
     handle_hpet_broadcast(ch);
 }
 
-static void cf_check hpet_msi_unmask(struct irq_desc *desc)
+static void hpet_enable_channel(struct hpet_event_channel *ch)
 {
     u32 cfg;
-    struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg |= HPET_TN_ENABLE;
@@ -268,6 +267,11 @@ static void cf_check hpet_msi_unmask(str
     ch->msi.msi_attrib.host_masked = 0;
 }
 
+static void cf_check hpet_msi_unmask(struct irq_desc *desc)
+{
+    hpet_enable_channel(desc->action->dev_id);
+}
+
 static void hpet_disable_channel(struct hpet_event_channel *ch)
 {
     u32 cfg;
@@ -503,14 +507,15 @@ static void set_channel_irq_affinity(str
 
     per_cpu(lru_channel, ch->cpu) = ch;
 
+    hpet_disable_channel(ch);
+
     ASSERT(!local_irq_is_enabled());
     spin_lock(&desc->lock);
-    hpet_msi_mask(desc);
     hpet_msi_set_affinity(desc, cpumask_of(ch->cpu));
     per_cpu(vector_irq, ch->cpu)[HPET_BROADCAST_VECTOR] = ch->msi.irq;
-    hpet_msi_unmask(desc);
     spin_unlock(&desc->lock);
 
+    hpet_enable_channel(ch);
     spin_unlock(&ch->lock);
 
     /* We may have missed an interrupt due to the temporary masking. */