All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] intel_iommu: Take the bql before registering a new address space
@ 2025-04-23  5:38 CLEMENT MATHIEU--DRIF
  2025-04-23  5:38 ` [PATCH v3 2/2] intel_iommu: Use BQL_LOCK_GUARD to manage cleanup automatically CLEMENT MATHIEU--DRIF
  2025-04-23  6:00 ` [PATCH v3 1/2] intel_iommu: Take the bql before registering a new address space Michael S. Tsirkin
  0 siblings, 2 replies; 6+ messages in thread
From: CLEMENT MATHIEU--DRIF @ 2025-04-23  5:38 UTC (permalink / raw)
  To: qemu-devel@nongnu.org
  Cc: jasowang@redhat.com, zhenzhong.duan@intel.com,
	kevin.tian@intel.com, yi.l.liu@intel.com, peterx@redhat.com,
	mst@redhat.com, CLEMENT MATHIEU--DRIF

Address space creation might end up being called without holding the
bql as it is exposed through the IOMMU ops.

Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
---
 hw/i386/intel_iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index dffd7ee885..cc8c9857e1 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -4238,6 +4238,12 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,
         vtd_dev_as->context_cache_entry.context_cache_gen = 0;
         vtd_dev_as->iova_tree = iova_tree_new();
 
+        /*
+         * memory_region_add_subregion_overlap requires the bql,
+         * make sure we own it.
+         */
+        BQL_LOCK_GUARD();
+
         memory_region_init(&vtd_dev_as->root, OBJECT(s), name, UINT64_MAX);
         address_space_init(&vtd_dev_as->as, &vtd_dev_as->root, "vtd-root");
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-23 10:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23  5:38 [PATCH v3 1/2] intel_iommu: Take the bql before registering a new address space CLEMENT MATHIEU--DRIF
2025-04-23  5:38 ` [PATCH v3 2/2] intel_iommu: Use BQL_LOCK_GUARD to manage cleanup automatically CLEMENT MATHIEU--DRIF
2025-04-23  6:00 ` [PATCH v3 1/2] intel_iommu: Take the bql before registering a new address space Michael S. Tsirkin
2025-04-23  9:15   ` CLEMENT MATHIEU--DRIF
2025-04-23 10:06     ` Michael S. Tsirkin
2025-04-23 10:09       ` CLEMENT MATHIEU--DRIF

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.