[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/27] intel_iommu: Use BQL_LOCK_GUARD to manage cleanup automatic
From: |
Michael S. Tsirkin |
Subject: |
[PULL 24/27] intel_iommu: Use BQL_LOCK_GUARD to manage cleanup automatically |
Date: |
Wed, 14 May 2025 07:51:16 -0400 |
From: CLEMENT MATHIEU--DRIF <clement.mathieu--drif@eviden.com>
vtd_switch_address_space needs to take the BQL if not already held.
Use BQL_LOCK_GUARD to make the iommu implementation more consistent.
Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
Message-Id: <20250430124750.240412-2-clement.mathieu--drif@eviden.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/intel_iommu.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 5f8ed1243d..b925e65b02 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -1728,8 +1728,6 @@ static bool vtd_as_pt_enabled(VTDAddressSpace *as)
static bool vtd_switch_address_space(VTDAddressSpace *as)
{
bool use_iommu, pt;
- /* Whether we need to take the BQL on our own */
- bool take_bql = !bql_locked();
assert(as);
@@ -1746,9 +1744,7 @@ static bool vtd_switch_address_space(VTDAddressSpace *as)
* from vtd_pt_enable_fast_path(). However the memory APIs need
* it. We'd better make sure we have had it already, or, take it.
*/
- if (take_bql) {
- bql_lock();
- }
+ BQL_LOCK_GUARD();
/* Turn off first then on the other */
if (use_iommu) {
@@ -1801,10 +1797,6 @@ static bool vtd_switch_address_space(VTDAddressSpace *as)
memory_region_set_enabled(&as->iommu_ir_fault, false);
}
- if (take_bql) {
- bql_unlock();
- }
-
return use_iommu;
}
--
MST
- [PULL 12/27] pcie_sriov: Allow user to create SR-IOV device, (continued)
- [PULL 12/27] pcie_sriov: Allow user to create SR-IOV device, Michael S. Tsirkin, 2025/05/14
- [PULL 13/27] virtio-pci: Implement SR-IOV PF, Michael S. Tsirkin, 2025/05/14
- [PULL 14/27] virtio-net: Implement SR-IOV VF, Michael S. Tsirkin, 2025/05/14
- [PULL 15/27] docs: Document composable SR-IOV device, Michael S. Tsirkin, 2025/05/14
- [PULL 16/27] pcie_sriov: Make a PCI device with user-created VF ARI-capable, Michael S. Tsirkin, 2025/05/14
- [PULL 17/27] pci-testdev.c: Add membar-backed option for backing membar, Michael S. Tsirkin, 2025/05/14
- [PULL 19/27] vhost: return failure if stop virtqueue failed in vhost_dev_stop, Michael S. Tsirkin, 2025/05/14
- [PULL 18/27] system/runstate: add VM state change cb with return value, Michael S. Tsirkin, 2025/05/14
- [PULL 21/27] vhost-scsi: support VIRTIO_SCSI_F_HOTPLUG, Michael S. Tsirkin, 2025/05/14
- [PULL 20/27] vhost-user: return failure if backend crash when live migration, Michael S. Tsirkin, 2025/05/14
- [PULL 24/27] intel_iommu: Use BQL_LOCK_GUARD to manage cleanup automatically,
Michael S. Tsirkin <=
- [PULL 22/27] virtio: Call set_features during reset, Michael S. Tsirkin, 2025/05/14
- [PULL 25/27] intel_iommu: Take locks when looking for and creating address spaces, Michael S. Tsirkin, 2025/05/14
- [PULL 26/27] hw/i386/amd_iommu: Isolate AMDVI-PCI from amd-iommu device to allow full control over the PCI device creation, Michael S. Tsirkin, 2025/05/14
- [PULL 23/27] virtio: Move virtio_reset(), Michael S. Tsirkin, 2025/05/14
- [PULL 27/27] hw/i386/amd_iommu: Allow migration when explicitly create the AMDVI-PCI device, Michael S. Tsirkin, 2025/05/14