From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Sriram Yagnaraman" <sriram.yagnaraman@ericsson.com>,
"Jason Wang" <jasowangio@gmail.com>,
"Alex Williamson" <alex@shazbot.org>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Avihai Horon" <avihaih@nvidia.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: [RFC PATCH 01/11] pci: Add PCI_BASE_ADDRESS_MEM_ALWAYS_ON BAR flag
Date: Mon, 27 Jul 2026 07:39:25 +0200 [thread overview]
Message-ID: <20260727053935.1392269-2-clg@redhat.com> (raw)
In-Reply-To: <20260727053935.1392269-1-clg@redhat.com>
When VFIO opens a VF, it issues a Function Level Reset which clears
PCI_COMMAND_MEMORY. This unmaps all BARs, including the migration
BAR.
Add a QEMU-internal BAR type flag that keeps a memory BAR mapped
regardless of PCI_COMMAND_MEMORY. This is needed for host-only
control regions (e.g. migration BARs) that are accessed by a VFIO
variant driver, not by the guest.
Assisted-by: Claude
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/pci/pci.h | 6 ++++++
hw/pci/pci.c | 6 ++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index f2448e941a0b..923c8f0e15bc 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -164,6 +164,12 @@ typedef struct PCIIORegion {
MemoryRegion *address_space;
} PCIIORegion;
+/*
+ * QEMU-internal: keep this BAR mapped regardless of PCI_COMMAND_MEMORY.
+ * Stripped before writing to config space.
+ */
+#define PCI_BASE_ADDRESS_MEM_ALWAYS_ON 0x10
+
#define PCI_ROM_SLOT 6
#define PCI_NUM_REGIONS 7
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index d3191609e283..1394132c1472 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1544,7 +1544,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
}
addr = pci_bar(pci_dev, region_num);
- pci_set_long(pci_dev->config + addr, type);
+ pci_set_long(pci_dev->config + addr,
+ type & ~PCI_BASE_ADDRESS_MEM_ALWAYS_ON);
if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
@@ -1686,7 +1687,8 @@ pcibus_t pci_bar_address(PCIDevice *d,
return new_addr;
}
- if (!(cmd & PCI_COMMAND_MEMORY)) {
+ if (!(cmd & PCI_COMMAND_MEMORY) &&
+ !(type & PCI_BASE_ADDRESS_MEM_ALWAYS_ON)) {
return PCI_BAR_UNMAPPED;
}
new_addr = pci_config_get_bar_addr(d, reg, type, size);
--
2.55.0
next prev parent reply other threads:[~2026-07-27 5:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 5:39 [RFC PATCH 00/11] igb: Add experimental VF live migration support Cédric Le Goater
2026-07-27 5:39 ` Cédric Le Goater [this message]
2026-07-27 5:39 ` [RFC PATCH 02/11] igb: Add x-vf-migration property and vendor-specific capability for IGBVF Cédric Le Goater
2026-07-27 7:13 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 03/11] igb: Add migration BAR with state machine Cédric Le Goater
2026-07-27 7:16 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 04/11] igb: Add VF state serialization for live migration Cédric Le Goater
2026-07-27 7:31 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 05/11] igb: Add VF post-load fixups " Cédric Le Goater
2026-07-27 7:53 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 06/11] igb: Add dirty page tracking for IGBVF migration Cédric Le Goater
2026-07-27 8:15 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 07/11] igb: Quiesce VFs on STOP and include PF enable state in migration blob Cédric Le Goater
2026-07-27 8:19 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 08/11] igb: Fix post-migration RX ring deadlock Cédric Le Goater
2026-07-27 9:36 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 09/11] igb: Send RARP after VF migration to update bridge FDB Cédric Le Goater
2026-07-27 10:33 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 10/11] docs: Add igb VF migration testing setup guide Cédric Le Goater
2026-07-27 10:54 ` Akihiko Odaki
2026-07-27 5:39 ` [RFC PATCH 11/11] igb: Add migration statistics registers to VF migration BAR Cédric Le Goater
2026-07-27 11:05 ` Akihiko Odaki
2026-07-27 17:35 ` [RFC PATCH 00/11] igb: Add experimental VF live migration support Cédric Le Goater
2026-07-28 5:50 ` Akihiko Odaki
2026-07-28 10:03 ` Cédric Le Goater
2026-07-27 20:36 ` Alex Williamson
2026-07-28 8:25 ` Cédric Le Goater
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=20260727053935.1392269-2-clg@redhat.com \
--to=clg@redhat.com \
--cc=alex@shazbot.org \
--cc=avihaih@nvidia.com \
--cc=jasowangio@gmail.com \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sriram.yagnaraman@ericsson.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.