Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: "Jörg Rödel" <joro@8bytes.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>
Cc: philmd@linaro.org, marcel.apfelbaum@gmail.com,
	zhao1.liu@intel.com, berrange@redhat.com, mst@redhat.com,
	cohuck@redhat.com, mtosatti@redhat.com,
	Tom Lendacky <thomas.lendacky@amd.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	coconut-svsm@lists.linux.dev, joerg.roedel@amd.com
Subject: [RFC PATCH 07/10] hw/core/machine: Add device-plane property
Date: Mon,  8 Jun 2026 17:21:06 +0200	[thread overview]
Message-ID: <20260608152109.356783-8-joro@8bytes.org> (raw)
In-Reply-To: <20260608152109.356783-1-joro@8bytes.org>

From: Joerg Roedel <joerg.roedel@amd.com>

Add a property to the QEMU MachineState to specify the default plane
to send device interrupts to.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 hw/core/machine.c        | 22 ++++++++++++++++++++++
 include/hw/core/boards.h |  3 +++
 include/hw/core/qdev.h   |  1 +
 3 files changed, 26 insertions(+)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 0aa77a57e956..62ea86512645 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1218,6 +1218,7 @@ static void machine_initfn(Object *obj)
     ms->kernel_cmdline = g_strdup("");
     ms->ram_size = mc->default_ram_size;
     ms->maxram_size = mc->default_ram_size;
+    ms->device_plane = 0;
 
     if (mc->nvdimm_supported) {
         ms->nvdimms_state = g_new0(NVDIMMState, 1);
@@ -1253,6 +1254,12 @@ static void machine_initfn(Object *obj)
                                    "ACPI Serial Port Console Redirection "
                                    "Table (spcr)");
 
+    /* Default Device Plane */
+    object_property_add_uint8_ptr(obj, "device-plane", &ms->device_plane,
+                                  OBJ_PROP_FLAG_READWRITE);
+    object_property_set_description(obj, "device-plane",
+                                    "Default plane to receive device IRQs");
+
     /* default to mc->default_cpus */
     ms->smp.cpus = mc->default_cpus;
     ms->smp.max_cpus = mc->default_cpus;
@@ -1675,6 +1682,12 @@ void machine_run_board_init(MachineState *machine, const char *mem_path, Error *
                                    "on", false);
     }
 
+    if (machine->device_plane >= accel_nr_planes(machine)) {
+        error_report("Invalid plane specified: %d (highest supported plane: %d)",
+                     machine->device_plane, accel_nr_planes(machine) - 1);
+        exit(EXIT_FAILURE);
+    }
+
     accel_init_interfaces(ACCEL_GET_CLASS(machine->accelerator));
     machine_class->init(machine);
     phase_advance(PHASE_MACHINE_INITIALIZED);
@@ -1761,6 +1774,15 @@ void qdev_machine_creation_done(void)
     register_global_state();
 }
 
+uint8_t qdev_default_plane(void)
+{
+    if (current_machine != NULL) {
+        return current_machine->device_plane;
+    } else {
+        return 0;
+    }
+}
+
 static const TypeInfo machine_info = {
     .name = TYPE_MACHINE,
     .parent = TYPE_OBJECT,
diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
index b8dad0a1074d..d2d1336939ed 100644
--- a/include/hw/core/boards.h
+++ b/include/hw/core/boards.h
@@ -447,6 +447,9 @@ struct MachineState {
      * Set to false by default for all regular use.
      */
     bool new_accel_vmfd_on_reset;
+
+    /* Default plane to receive device IRQs */
+    uint8_t device_plane;
 };
 
 /*
diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h
index f99a8979ccb1..83ad1d5f1550 100644
--- a/include/hw/core/qdev.h
+++ b/include/hw/core/qdev.h
@@ -560,6 +560,7 @@ void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
                                   DeviceState *dev, Error **errp);
 void qdev_machine_creation_done(void);
 bool qdev_machine_modified(void);
+uint8_t qdev_default_plane(void);
 
 /**
  * qdev_add_unplug_blocker: Add an unplug blocker to a device
-- 
2.53.0


  parent reply	other threads:[~2026-06-08 15:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 15:20 [RFC PATCH 00/10] QEMU Support for KVM Planes Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 01/10] Update Linux Header for KVM Planes Support Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 02/10] accel/kvm: Extend KVMState to carry fds for planes Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 03/10] accel/kvm: Extend CPUState to handle Planes Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 04/10] accel: Add nr_planes() op Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 05/10] accel/kvm: Support nr_planes call-back Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 06/10] accel/kvm: Handle KVM_PLANE_EVENT_CREATE_CPU event Jörg Rödel
2026-06-08 15:21 ` Jörg Rödel [this message]
2026-06-08 15:21 ` [RFC PATCH 08/10] qdev: Add plane property Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 09/10] MSI: Inject into correct plane Jörg Rödel
2026-06-08 15:21 ` [RFC PATCH 10/10] KVM: Set GSI routes for default plane Jörg Rödel
2026-06-08 15:40 ` [RFC PATCH 00/10] QEMU Support for KVM Planes Daniel P. Berrangé
2026-06-08 15:45   ` Jörg Rödel

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=20260608152109.356783-8-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=berrange@redhat.com \
    --cc=coconut-svsm@lists.linux.dev \
    --cc=cohuck@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thomas.lendacky@amd.com \
    --cc=zhao1.liu@intel.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