qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yubin Zou <yubinz@google.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Tyrone Ting <kfting@nuvoton.com>,  Hao Wu <wuhaotsh@google.com>,
	qemu-arm@nongnu.org,  Peter Maydell <peter.maydell@linaro.org>,
	Yubin Zou <yubinz@google.com>,
	 Titus Rwantare <titusr@google.com>
Subject: [PATCH 5/7] hw/pci-host: enable MSI on npcm PCIe root complex
Date: Tue, 09 Sep 2025 22:11:00 +0000	[thread overview]
Message-ID: <20250909-pcie-root-upstream-v1-5-d85883b2688d@google.com> (raw)
In-Reply-To: <20250909-pcie-root-upstream-v1-0-d85883b2688d@google.com>

From: Titus Rwantare <titusr@google.com>

This allows MSI capable qemu devices to attach to the root complex

Signed-off-by: Titus Rwantare <titusr@google.com>
---
 hw/pci-host/npcm_pcierc.c         | 5 +++++
 include/hw/pci-host/npcm_pcierc.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/hw/pci-host/npcm_pcierc.c b/hw/pci-host/npcm_pcierc.c
index a1767335fe79a30464acf32ae94fc14e417c89eb..0af76d1067a78bdbb169af3e3d5c4a2514cd0ff5 100644
--- a/hw/pci-host/npcm_pcierc.c
+++ b/hw/pci-host/npcm_pcierc.c
@@ -10,6 +10,7 @@
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "hw/pci-host/npcm_pcierc.h"
+#include "hw/pci/msi.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
 #include "qemu/units.h"
@@ -442,6 +443,10 @@ static void npcm_pcierc_realize(DeviceState *dev, Error **errp)
     address_space_init(&s->pcie_space, &s->pcie_root, "pcie-address-space");
     pci_realize_and_unref(root, pci->bus, &error_fatal);
     pci_setup_iommu(pci->bus, &npcm_pcierc_iommu_ops, s);
+
+    msi_nonbroken = true;
+    msi_init(root, NPCM_PCIERC_MSI_OFFSET, NPCM_PCIERC_MSI_NR,
+             true, true, errp);
 }
 
 static void npcm_pcie_root_port_realize(DeviceState *dev, Error **errp)
diff --git a/include/hw/pci-host/npcm_pcierc.h b/include/hw/pci-host/npcm_pcierc.h
index a47eae0084b88ba4388681b24ab97f77a4338594..7d18177510f60d49f7fae7908dd1e3bfbe9ae12b 100644
--- a/include/hw/pci-host/npcm_pcierc.h
+++ b/include/hw/pci-host/npcm_pcierc.h
@@ -87,6 +87,8 @@
 #define NPCM_PCIERC_NUM_PA_WINDOWS          2
 #define NPCM_PCIERC_NUM_AP_WINDOWS          5
 
+#define NPCM_PCIERC_MSI_NR                  32
+#define NPCM_PCIERC_MSI_OFFSET              0x50
 /* PCIe extended config space offsets */
 #define NPCM_PCIE_HEADER_OFFSET             0x80
 #define NPCM_PCIE_AER_OFFSET                0x100

-- 
2.51.0.384.g4c02a37b29-goog



  parent reply	other threads:[~2025-09-09 22:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 22:10 [PATCH 0/7] Introduce PCIE Root Complex on Nuvoton npcm8xx and npcm7xx Yubin Zou
2025-09-09 22:10 ` [PATCH 1/7] hw/pci-host: implement Nuvoton PCIE Root Complex stub Yubin Zou
2025-09-30  1:33   ` KFTING
2025-09-09 22:10 ` [PATCH 2/7] hw/pci-host: add basic Nuvoton PCIe window support Yubin Zou
2025-09-25 16:38   ` Peter Maydell
2025-09-25 19:39     ` Titus Rwantare
2025-09-26  9:07       ` Peter Maydell
2025-09-30  1:34         ` KFTING
2025-09-09 22:10 ` [PATCH 3/7] hw/arm: attach PCIe root complex to npmcm8xx Yubin Zou
2025-09-30  1:35   ` KFTING
2025-09-09 22:10 ` [PATCH 4/7] hw/pci-host: add Nuvoton PCIe root port Yubin Zou
2025-09-25 16:42   ` Peter Maydell
2025-09-30  1:34     ` KFTING
2025-09-09 22:11 ` Yubin Zou [this message]
2025-09-30  1:36   ` [PATCH 5/7] hw/pci-host: enable MSI on npcm PCIe root complex KFTING
2025-09-09 22:11 ` [PATCH 6/7] hw/pci-host: rework Nuvoton PCIe windowing and memory regions Yubin Zou
2025-09-25 16:40   ` Peter Maydell
2025-09-30  1:34     ` KFTING
2025-09-09 22:11 ` [PATCH 7/7] hw/arm: Add PCIERC to NPCM7xx SoC Yubin Zou
2025-09-30  1:36   ` KFTING
2025-09-25 16:43 ` [PATCH 0/7] Introduce PCIE Root Complex on Nuvoton npcm8xx and npcm7xx Peter Maydell
2025-09-30  1:32 ` KFTING

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=20250909-pcie-root-upstream-v1-5-d85883b2688d@google.com \
    --to=yubinz@google.com \
    --cc=kfting@nuvoton.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=titusr@google.com \
    --cc=wuhaotsh@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).