public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: "Thierry Escande" <thierry.escande@vates.tech>
To: qemu-devel@nongnu.org
Cc: "Thierry Escande" <thierry.escande@vates.tech>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Anthony PERARD" <anthony@xenproject.org>,
	xen-devel@lists.xenproject.org
Subject: [PATCH 2/4] q35/xen: Add Xen support for Q35
Date: Fri, 13 Mar 2026 16:47:12 +0000	[thread overview]
Message-ID: <20260313164649.794591-3-thierry.escande@vates.tech> (raw)
In-Reply-To: <20260313164649.794591-1-thierry.escande@vates.tech>

This patch intializes HVM pc machine in pc_q35_init() if Xen support is
enabled.

As done for i440 machine, this also cleanups unrealized flash devices.
See commit dd29b5c30c (xen: cleanup unrealized flash devices).

Signed-off-by: Thierry Escande <thierry.escande@vates.tech>
---
 hw/i386/pc_q35.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index cb23322f5a..89dd736d95 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -35,8 +35,10 @@
 #include "hw/core/loader.h"
 #include "hw/i2c/smbus_eeprom.h"
 #include "hw/rtc/mc146818rtc.h"
+#include "hw/xen/xen-x86.h"
 #include "system/tcg.h"
 #include "system/kvm.h"
+#include "system/xen.h"
 #include "hw/i386/kvm/clock.h"
 #include "hw/pci-host/q35.h"
 #include "hw/pci/pcie_port.h"
@@ -190,6 +192,10 @@ static void pc_q35_init(MachineState *machine)
         x86ms->below_4g_mem_size = machine->ram_size;
     }
 
+    if (xen_enabled()) {
+        xen_hvm_init_pc(pcms, &machine->ram);
+    }
+
     pc_machine_init_sgx_epc(pcms);
     x86_cpus_init(x86ms, pcmc->default_cpu_version);
 
@@ -206,7 +212,11 @@ static void pc_q35_init(MachineState *machine)
 
     /* allocate ram and load rom/bios */
     memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
-    pc_memory_init(pcms, system_memory, pci_memory, pci_hole64_size);
+    if (!xen_enabled()) {
+        pc_memory_init(pcms, system_memory, pci_memory, pci_hole64_size);
+    } else {
+        pc_system_flash_cleanup_unused(pcms);
+    }
 
     object_property_add_child(OBJECT(machine), "q35", phb);
     object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM,
-- 
2.51.0



--
Thierry Escande | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



  parent reply	other threads:[~2026-03-13 17:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 16:46 [PATCH 0/4] Xen: Add Q35 initial support for HVM guests Thierry Escande
2026-03-13 16:47 ` [PATCH 1/4] pc/xen: Xen Q35 support: provide IRQ handling for PCI devices Thierry Escande
2026-03-13 16:47 ` Thierry Escande [this message]
2026-03-13 16:47 ` [PATCH 3/4] q35: Fix incorrect values for PCIEXBAR masks Thierry Escande
2026-03-13 16:47 ` [PATCH 4/4] xen: Handle PCIe config space size in cpu_ioreq_config() Thierry Escande
2026-03-14 14:16 ` [PATCH 0/4] Xen: Add Q35 initial support for HVM guests Marek Marczykowski-Górecki
2026-03-24  9:28   ` Anthony PERARD
2026-03-24  9:59     ` Daniel P. Berrangé

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=20260313164649.794591-3-thierry.escande@vates.tech \
    --to=thierry.escande@vates.tech \
    --cc=anthony@xenproject.org \
    --cc=eduardo@habkost.net \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=xen-devel@lists.xenproject.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