qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jamin Lin via <qemu-devel@nongnu.org>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Steven Lee" <steven_lee@aspeedtech.com>,
	"Troy Lee" <leetroy@gmail.com>,
	"Andrew Jeffery" <andrew@codeconstruct.com.au>,
	"Joel Stanley" <joel@jms.id.au>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>,
	"open list:ASPEED BMCs" <qemu-arm@nongnu.org>
Cc: <jamin_lin@aspeedtech.com>, <troy_lee@aspeedtech.com>,
	<nabihestefan@google.com>
Subject: [PATCH v1 0/1] hw/pci-host/aspeed_pcie: Update ASPEED PCIe Root Port capabilities and enable MSI to support hotplug
Date: Fri, 21 Nov 2025 12:08:48 +0800	[thread overview]
Message-ID: <20251121040849.3287437-1-jamin_lin@aspeedtech.com> (raw)

v1:
  1.  Update ASPEED PCIe Root Port capabilities and enable MSI to support hotplug

How to test it:

Firmware Requirements
 
Before testing, please make sure the Linux kernel has the following configuration enabled:
Reference defconfig:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/configs/aspeed_g7_defconfig

--- a/arch/arm64/configs/aspeed_g7_defconfig
+++ b/arch/arm64/configs/aspeed_g7_defconfig
@@ -66,6 +66,11 @@ CONFIG_PCI_IOV=y
CONFIG_PCI_PRI=y
CONFIG_PCIE_BUS_SAFE=y
CONFIG_PCIE_ASPEED=y
+CONFIG_HOTPLUG_PCI_PCIE=y
+CONFIG_HOTPLUG_PCI=y
+# CONFIG_HOTPLUG_PCI_CPCI is not set
+# CONFIG_HOTPLUG_PCI_SHPC is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_DEVTMPFS_SAFE=y

QEMU Testing Procedure
1. Boot Linux and verify the root port

root@ast2700-a1-spl:~# lspci
0002:00:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge

2. Add an e1000e device dynamically (Hot-plug)

In QEMU monitor:
(qemu) device_add e1000e,bus=pcie.2,id=mye1000e
[  103.919703] pcieport 0002:00:00.0: pciehp: Slot(0): Button press: will power on in 5 sec
[  103.921921] pcieport 0002:00:00.0: pciehp: Slot(0): Card present
[  103.922557] pcieport 0002:00:00.0: pciehp: Slot(0): Link Up
[  105.047374] pci 0002:01:00.0: [8086:10d3] type 00 class 0x020000
[  105.048859] pci 0002:01:00.0: reg 0x10: [mem 0x00000000-0x0001ffff]
[  105.049786] pci 0002:01:00.0: reg 0x14: [mem 0x00000000-0x0001ffff]
[  105.050453] pci 0002:01:00.0: reg 0x18: [io  0x0000-0x001f]
[  105.051049] pci 0002:01:00.0: reg 0x1c: [mem 0x00000000-0x00003fff]
[  105.051904] pci 0002:01:00.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[  105.052880] pci 0002:01:00.0: enabling Extended Tags
[  105.063878] pci 0002:01:00.0: BAR 6: assigned [mem 0xa0000000-0xa003ffff pref]
[  105.064889] pci 0002:01:00.0: BAR 0: assigned [mem 0xa0040000-0xa005ffff]
[  105.066104] pci 0002:01:00.0: BAR 1: assigned [mem 0xa0060000-0xa007ffff]
[  105.066881] pci 0002:01:00.0: BAR 3: assigned [mem 0xa0080000-0xa0083fff]
[  105.067637] pci 0002:01:00.0: BAR 2: assigned [io  0x1000-0x101f]
[  105.068360] pcieport 0002:00:00.0: PCI bridge to [bus 01]
[  105.068828] pcieport 0002:00:00.0:   bridge window [io  0x1000-0x1fff]
[  105.072140] pcieport 0002:00:00.0:   bridge window [mem 0xa0000000-0xa01fffff]
[  105.075017] pcieport 0002:00:00.0:   bridge window [mem 0xa0200000-0xa03fffff 64bit pref]
[  105.081561] pcieport 0002:00:00.0: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[  105.082733] pci 0002:01:00.0: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[  105.089597] e1000e 0002:01:00.0: enabling device (0000 -> 0002)
[  105.098995] e1000e 0002:01:00.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
[  105.160515] e1000e 0002:01:00.0 0002:01:00.0 (uninitialized): registered PHC clock
[  105.231396] e1000e 0002:01:00.0 eth2: (PCI Express:2.5GT/s:Width x1) 52:54:00:12:34:56
[  105.232279] e1000e 0002:01:00.0 eth2: Intel(R) PRO/1000 Network Connection
[  105.233696] e1000e 0002:01:00.0 eth2: MAC: 3, PHY: 8, PBA No: 000000-000
[  105.489627] 8021q: adding VLAN 0 to HW filter on device eth2
[  105.788193] e1000e 0002:01:00.0 eth2: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx

Leave QEMU monitor mode and lspci now lists the device:

root@ast2700-a1-spl:~# lspci
0002:00:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge
0002:01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection

3. Remove the device dynamically (Hot-unplug)  

In QEMU monitor:
(qemu) device_del mye1000e
[  203.354941] pcieport 0002:00:00.0: pciehp: Slot(0): Button press: will power off in 5 sec
[  208.411558] e1000e 0002:01:00.0 eth2: removed PHC
[  208.486799] e1000e 0002:01:00.0 eth2: NIC Link is Down

Leave QEMU monitor mode and lspci again shows only the root port:
root@ast2700-a1-spl:~# lspci
0002:00:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge

Jamin Lin (1):
  hw/pci-host/aspeed_pcie: Update ASPEED PCIe Root Port capabilities and
    enable MSI to support hotplug

 hw/pci-host/aspeed_pcie.c | 40 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

-- 
2.43.0



             reply	other threads:[~2025-11-21  4:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  4:08 Jamin Lin via [this message]
2025-11-21  4:08 ` [PATCH v1 1/1] hw/pci-host/aspeed_pcie: Update ASPEED PCIe Root Port capabilities and enable MSI to support hotplug Jamin Lin via

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=20251121040849.3287437-1-jamin_lin@aspeedtech.com \
    --to=qemu-devel@nongnu.org \
    --cc=andrew@codeconstruct.com.au \
    --cc=clg@kaod.org \
    --cc=jamin_lin@aspeedtech.com \
    --cc=joel@jms.id.au \
    --cc=leetroy@gmail.com \
    --cc=nabihestefan@google.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=steven_lee@aspeedtech.com \
    --cc=troy_lee@aspeedtech.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).