Skip to contentSkip to conversation

VT-d: split .ack and .disable DMA-MSI actors

PATCH In review Jan Beulich 3 participants 4 messages Sep 7, 2012 – Sep 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VT-d: split .ack and .disable DMA-MSI actors

Calling irq_complete_move() from .disable is wrong, breaking S3 resume.

Comparing with all other .ack actors, it was also missing a call to move_{native,masked}_irq(). As the actor is masking its interrupt anyway (albeit it's not immediately obvious why), the latter is the better choice.

xen/drivers/passthrough/vtd/iommu.c +8 -3
@@ -1039,8 +1039,6 @@ static void dma_msi_mask(struct irq_desc
     unsigned long flags;
     struct iommu *iommu = desc->action->dev_id;
 
-    irq_complete_move(desc);
-
     /* mask it */
     spin_lock_irqsave(&iommu->register_lock, flags);
     dmar_writel(iommu->reg, DMAR_FECTL_REG, DMA_FECTL_IM);
@@ -1053,6 +1051,13 @@ static unsigned int dma_msi_startup(stru
     return 0;
 }
 
+static void dma_msi_ack(struct irq_desc *desc)
+{
+    irq_complete_move(desc);
+    dma_msi_mask(desc);
+    move_masked_irq(desc);
+}
+
 static void dma_msi_end(struct irq_desc *desc, u8 vector)
 {
     dma_msi_unmask(desc);
@@ -1114,7 +1119,7 @@ static hw_irq_controller dma_msi_type = 
     .shutdown = dma_msi_mask,
     .enable = dma_msi_unmask,
     .disable = dma_msi_mask,
-    .ack = dma_msi_mask,
+    .ack = dma_msi_ack,
     .end = dma_msi_end,
     .set_affinity = dma_msi_set_affinity,
 };

VT-d: split .ack and .disable DMA-MSI actors

Calling irq_complete_move() from .disable is wrong, breaking S3 resume.

Comparing with all other .ack actors, it was also missing a call to move_{native,masked}_irq(). As the actor is masking its interrupt anyway (albeit it's not immediately obvious why), the latter is the better choice.

xen/drivers/passthrough/vtd/iommu.c +8 -3
@@ -1039,8 +1039,6 @@ static void dma_msi_mask(struct irq_desc
     unsigned long flags;
     struct iommu *iommu = desc->action->dev_id;
 
-    irq_complete_move(desc);
-
     /* mask it */
     spin_lock_irqsave(&iommu->register_lock, flags);
     dmar_writel(iommu->reg, DMAR_FECTL_REG, DMA_FECTL_IM);
@@ -1053,6 +1051,13 @@ static unsigned int dma_msi_startup(stru
     return 0;
 }
 
+static void dma_msi_ack(struct irq_desc *desc)
+{
+    irq_complete_move(desc);
+    dma_msi_mask(desc);
+    move_masked_irq(desc);
+}
+
 static void dma_msi_end(struct irq_desc *desc, u8 vector)
 {
     dma_msi_unmask(desc);
@@ -1114,7 +1119,7 @@ static hw_irq_controller dma_msi_type = 
     .shutdown = dma_msi_mask,
     .enable = dma_msi_unmask,
     .disable = dma_msi_mask,
-    .ack = dma_msi_mask,
+    .ack = dma_msi_ack,
     .end = dma_msi_end,
     .set_affinity = dma_msi_set_affinity,
 };

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

Calling irq_complete_move() from .disable is wrong, breaking S3 resume.

Comparing with all other .ack actors, it was also missing a call to move_{native,masked}_irq(). As the actor is masking its interrupt anyway (albeit it's not immediately obvious why), the latter is the better choice.

As far as I understand it

I guess you are looking for an Intel ack as well.

-- Keir

Quoted 41 lines
xen/drivers/passthrough/vtd/iommu.c +8 -3
@@ -1039,8 +1039,6 @@ static void dma_msi_mask(struct irq_desc
     unsigned long flags;
     struct iommu *iommu = desc->action->dev_id;
 
-    irq_complete_move(desc);
-
     /* mask it */
     spin_lock_irqsave(&iommu->register_lock, flags);
     dmar_writel(iommu->reg, DMAR_FECTL_REG, DMA_FECTL_IM);
@@ -1053,6 +1051,13 @@ static unsigned int dma_msi_startup(stru
     return 0;
 }
 
+static void dma_msi_ack(struct irq_desc *desc)
+{
+    irq_complete_move(desc);
+    dma_msi_mask(desc);
+    move_masked_irq(desc);
+}
+
 static void dma_msi_end(struct irq_desc *desc, u8 vector)
 {
     dma_msi_unmask(desc);
@@ -1114,7 +1119,7 @@ static hw_irq_controller dma_msi_type =
     .shutdown = dma_msi_mask,
     .enable = dma_msi_unmask,
     .disable = dma_msi_mask,
-    .ack = dma_msi_mask,
+    .ack = dma_msi_ack,
     .end = dma_msi_end,
     .set_affinity = dma_msi_set_affinity,
 };

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 7 lines · Jan Beulich

Calling irq_complete_move() from .disable is wrong, breaking S3 resume.

Comparing with all other .ack actors, it was also missing a call to move_{native,masked}_irq(). As the actor is masking its interrupt anyway (albeit it's not immediately obvious why), the latter is the better choice.

Quoted 6 lines
Quoted 1 line

As far as I understand it

I guess you are looking for an Intel ack as well.

Yes, that's why I Cc-ed Xiantao.

Jan

#3 lore raw
Quoted 20 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, September 07, 2012 11:52 PM
To: Keir Fraser; xen-devel
Cc: Zhang, Xiantao
Subject: Re: [Xen-devel] [PATCH] VT-d: split .ack and .disable DMA-MSI actors

Quoted 10 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 7 lines · Jan Beulich

Calling irq_complete_move() from .disable is wrong, breaking S3 resume.

Comparing with all other .ack actors, it was also missing a call to move_{native,masked}_irq(). As the actor is masking its interrupt anyway (albeit it's not immediately obvious why), the latter is the better choice.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

As far as I understand it

I guess you are looking for an Intel ack as well.

Yes, that's why I Cc-ed Xiantao.

Thanks for the fix!
Acked-by Xiantao Zhang <[email protected]>!
Xiantao