From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Helge Deller" <deller@gmx.de>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v2 1/7] hw/pci/pci_host: Add 'config-reg-check-high-bit' property
Date: Mon, 27 Oct 2025 17:52:57 +0100 [thread overview]
Message-ID: <20251027165304.98296-2-philmd@linaro.org> (raw)
In-Reply-To: <20251027165304.98296-1-philmd@linaro.org>
In order to have more PCI host bridges to re-use the
generic pci_host_data_le_ops MemoryRegionOps, add the
'config-reg-check-high-bit' property (%true by default).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/pci/pci_host.h | 1 +
hw/pci/pci_host.c | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h
index 954dd446fa4..c04a567ec57 100644
--- a/include/hw/pci/pci_host.h
+++ b/include/hw/pci/pci_host.h
@@ -43,6 +43,7 @@ struct PCIHostState {
MemoryRegion data_mem;
MemoryRegion mmcfg;
uint32_t config_reg;
+ bool config_reg_check_high_bit;
bool mig_enabled;
PCIBus *bus;
bool bypass_iommu;
diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index b5c624e12e8..d6db365e327 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -184,8 +184,10 @@ static void pci_host_data_write(void *opaque, hwaddr addr,
{
PCIHostState *s = opaque;
- if (s->config_reg & (1u << 31))
- pci_data_write(s->bus, s->config_reg | (addr & 3), val, len);
+ if (s->config_reg_check_high_bit && !(s->config_reg & (1U << 31))) {
+ return;
+ }
+ pci_data_write(s->bus, s->config_reg | (addr & 3), val, len);
}
static uint64_t pci_host_data_read(void *opaque,
@@ -193,7 +195,7 @@ static uint64_t pci_host_data_read(void *opaque,
{
PCIHostState *s = opaque;
- if (!(s->config_reg & (1U << 31))) {
+ if (s->config_reg_check_high_bit && !(s->config_reg & (1U << 31))) {
return 0xffffffff;
}
return pci_data_read(s->bus, s->config_reg | (addr & 3), len);
@@ -235,6 +237,8 @@ const VMStateDescription vmstate_pcihost = {
};
static const Property pci_host_properties_common[] = {
+ DEFINE_PROP_BOOL("config-reg-check-high-bit", PCIHostState,
+ config_reg_check_high_bit, true),
DEFINE_PROP_BOOL("x-config-reg-migration-enabled", PCIHostState,
mig_enabled, true),
DEFINE_PROP_BOOL(PCI_HOST_BYPASS_IOMMU, PCIHostState, bypass_iommu, false),
--
2.51.0
next prev parent reply other threads:[~2025-10-27 16:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 16:52 [PATCH v2 0/7] hw/pci-host: Re-use generic pci_host_data_le_ops MemoryRegionOps Philippe Mathieu-Daudé
2025-10-27 16:52 ` Philippe Mathieu-Daudé [this message]
2025-10-27 17:28 ` [PATCH v2 1/7] hw/pci/pci_host: Add 'config-reg-check-high-bit' property Peter Maydell
2025-10-28 7:35 ` Marc-André Lureau
2025-10-27 16:52 ` [PATCH v2 2/7] hw/pci-host/astro: Re-use generic pci_host_data_le_ops MemoryRegionOps Philippe Mathieu-Daudé
2025-10-27 16:52 ` [PATCH v2 3/7] hw/pci-host/dino: " Philippe Mathieu-Daudé
2025-10-27 16:53 ` [PATCH v2 4/7] hw/pci-host/sabre: Remove pointless OBJECT() cast Philippe Mathieu-Daudé
2025-10-27 16:53 ` [PATCH v2 5/7] hw/pci-host/sabre: Include 'host' in host bridge method names Philippe Mathieu-Daudé
2025-10-27 16:53 ` [PATCH v2 6/7] hw/pci-host/sabre: Re-use generic pci_host_data_le_ops MemoryRegionOps Philippe Mathieu-Daudé
2025-10-27 17:00 ` Philippe Mathieu-Daudé
2025-10-27 16:53 ` [PATCH v2 7/7] hw/pci-host/typhoon: " Philippe Mathieu-Daudé
2025-10-27 16:59 ` Philippe Mathieu-Daudé
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=20251027165304.98296-2-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=deller@gmx.de \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).