HV: add spinlock to dmar_enable/disable_qi
add spinlock to dmar_enable_qi & dmar_disable_qi to protect
struct dmar_unit variables; keep consistent with other same
level functions.
Acked-by: Eddie Dong
@@ -952,6 +952,8 @@ static void dmar_enable_qi(struct dmar_drhd_rt *dmar_unit)
{
uint32_t status = 0;
+ spinlock_obtain(&(dmar_unit->lock));
+
dmar_unit->qi_queue = hva2hpa(get_qi_queue(dmar_unit->index));
iommu_write64(dmar_unit, DMAR_IQA_REG, dmar_unit->qi_queue);
@@ -962,17 +964,23 @@ static void dmar_enable_qi(struct dmar_drhd_rt *dmar_unit)
iommu_write32(dmar_unit, DMAR_GCMD_REG, dmar_unit->gcmd);
dmar_wait_completion(dmar_unit, DMAR_GSTS_REG, DMA_GSTS_QIES, false, &status);
}
+
+ spinlock_release(&(dmar_unit->lock));
}
static void dmar_disable_qi(struct dmar_drhd_rt *dmar_unit)
{
uint32_t status = 0;
+ spinlock_obtain(&(dmar_unit->lock));
+
if ((dmar_unit->gcmd & DMA_GCMD_QIE) == DMA_GCMD_QIE) {
dmar_unit->gcmd &= ~DMA_GCMD_QIE;
iommu_write32(dmar_unit, DMAR_GCMD_REG, dmar_unit->gcmd);
dmar_wait_completion(dmar_unit, DMAR_GSTS_REG, DMA_GSTS_QIES, true, &status);
}
+
+ spinlock_release(&(dmar_unit->lock));
}
static void dmar_prepare(struct dmar_drhd_rt *dmar_unit)
