mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-03 18:46:33 +00:00
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. Tracked-On: #3130 Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
90f3ce442d
commit
9876138b69
@ -952,6 +952,8 @@ static void dmar_enable_qi(struct dmar_drhd_rt *dmar_unit)
|
|||||||
{
|
{
|
||||||
uint32_t status = 0;
|
uint32_t status = 0;
|
||||||
|
|
||||||
|
spinlock_obtain(&(dmar_unit->lock));
|
||||||
|
|
||||||
dmar_unit->qi_queue = hva2hpa(get_qi_queue(dmar_unit->index));
|
dmar_unit->qi_queue = hva2hpa(get_qi_queue(dmar_unit->index));
|
||||||
iommu_write64(dmar_unit, DMAR_IQA_REG, dmar_unit->qi_queue);
|
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);
|
iommu_write32(dmar_unit, DMAR_GCMD_REG, dmar_unit->gcmd);
|
||||||
dmar_wait_completion(dmar_unit, DMAR_GSTS_REG, DMA_GSTS_QIES, false, &status);
|
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)
|
static void dmar_disable_qi(struct dmar_drhd_rt *dmar_unit)
|
||||||
{
|
{
|
||||||
uint32_t status = 0;
|
uint32_t status = 0;
|
||||||
|
|
||||||
|
spinlock_obtain(&(dmar_unit->lock));
|
||||||
|
|
||||||
if ((dmar_unit->gcmd & DMA_GCMD_QIE) == DMA_GCMD_QIE) {
|
if ((dmar_unit->gcmd & DMA_GCMD_QIE) == DMA_GCMD_QIE) {
|
||||||
dmar_unit->gcmd &= ~DMA_GCMD_QIE;
|
dmar_unit->gcmd &= ~DMA_GCMD_QIE;
|
||||||
iommu_write32(dmar_unit, DMAR_GCMD_REG, dmar_unit->gcmd);
|
iommu_write32(dmar_unit, DMAR_GCMD_REG, dmar_unit->gcmd);
|
||||||
dmar_wait_completion(dmar_unit, DMAR_GSTS_REG, DMA_GSTS_QIES, true, &status);
|
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)
|
static void dmar_prepare(struct dmar_drhd_rt *dmar_unit)
|
||||||
|
Loading…
Reference in New Issue
Block a user