All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sairaj Kodilkar <sarunkod@amd.com>
To: <qemu-devel@nongnu.org>
Cc: <mst@redhat.com>, <marcel.apfelbaum@gmail.com>,
	<pbonzini@redhat.com>, <eduardo@habkost.net>,
	<richard.henderson@linaro.org>, <alejandro.j.jimenez@oracle.com>,
	Sairaj Kodilkar <sarunkod@amd.com>,
	"Vasant Hegde" <vasant.hegde@amd.com>
Subject: [PATCH 3/7] hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
Date: Wed, 16 Jul 2025 13:01:41 +0530	[thread overview]
Message-ID: <20250716073145.915-4-sarunkod@amd.com> (raw)
In-Reply-To: <20250716073145.915-1-sarunkod@amd.com>

Setting up IOAPIC memory region requires mr_sys and mr_ir. Currently
these two memory regions are setup after the initializing the IOAPIC
memory region, which cause `amdvi_host_dma_iommu()` to use unitialized
mr_sys and mr_ir.

Move the IOAPIC memory region initialization to the end in order to use
the mr_sys and mr_ir regions after they are fully initialized.

Fixes: 577c470f4326 ("x86_iommu/amd: Prepare for interrupt remap support")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
---
 hw/i386/amd_iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index c8fa98142940..784be78f402d 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -2343,9 +2343,6 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    /* Pseudo address space under root PCI bus. */
-    x86ms->ioapic_as = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID);
-
     /* set up MMIO */
     memory_region_init_io(&s->mr_mmio, OBJECT(s), &mmio_mem_ops, s,
                           "amdvi-mmio", AMDVI_MMIO_SIZE);
@@ -2368,6 +2365,9 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
     memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST,
                                         &s->mr_ir, 1);
 
+    /* Pseudo address space under root PCI bus. */
+    x86ms->ioapic_as = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID);
+
     if (kvm_enabled() && x86ms->apic_id_limit > 255 && !s->xtsup) {
         error_report("AMD IOMMU with x2APIC configuration requires xtsup=on");
         exit(EXIT_FAILURE);
-- 
2.34.1



  parent reply	other threads:[~2025-07-16  7:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16  7:31 [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes Sairaj Kodilkar
2025-07-16  7:31 ` [PATCH 1/7] hw/i386/amd_iommu: Fix MMIO register write tracing Sairaj Kodilkar
2025-07-16 12:31   ` Philippe Mathieu-Daudé
2025-07-16  7:31 ` [PATCH 2/7] hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field Sairaj Kodilkar
2025-07-16 12:35   ` Philippe Mathieu-Daudé
2025-07-16  7:31 ` Sairaj Kodilkar [this message]
2025-07-16  7:31 ` [PATCH 4/7] hw/i386/amd_iommu: Support MMIO writes to the status register Sairaj Kodilkar
2025-07-16 14:27   ` Ethan MILON
2025-07-17  6:41     ` Sairaj Kodilkar
2025-07-16  7:31 ` [PATCH 5/7] hw/i386/amd_iommu: Fix event log generation Sairaj Kodilkar
2025-07-16 14:50   ` Ethan MILON
2025-07-21 10:44     ` Sairaj Kodilkar
2025-07-16  7:31 ` [PATCH 6/7] hw/i386/amd_iommu: Fix handling device on buses != 0 Sairaj Kodilkar
2025-07-16 15:18   ` Ethan MILON
2025-07-17  6:47     ` Sairaj Kodilkar
2025-07-16  7:31 ` [PATCH 7/7] hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup Sairaj Kodilkar
2025-07-16 12:37 ` [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes Philippe Mathieu-Daudé
2025-07-16 12:56   ` Sairaj Kodilkar
2025-07-16 13:29     ` Michael S. Tsirkin
2025-07-17  5:47       ` Sairaj Kodilkar
2025-07-17  6:07         ` Michael S. Tsirkin
2025-07-17 13:48           ` Alejandro Jimenez
2025-07-18 13:28             ` Vasant Hegde
2025-07-18 14:30               ` Alejandro Jimenez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250716073145.915-4-sarunkod@amd.com \
    --to=sarunkod@amd.com \
    --cc=alejandro.j.jimenez@oracle.com \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=vasant.hegde@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.