qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shameer Kolothum <shameerkolothum@gmail.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: eric.auger@redhat.com, peter.maydell@linaro.org,
	cohuck@redhat.com, sebott@redhat.com, berrange@redhat.com,
	maz@kernel.org, oliver.upton@linux.dev, armbru@redhat.com,
	linuxarm@huawei.com, wangzhou1@hisilicon.com,
	jiangkunkun@huawei.com, jonathan.cameron@huawei.com,
	salil.mehta@huawei.com, yangjinqian1@huawei.com,
	shameerkolothum@gmail.com, shameerali.kolothum.thodi@huawei.com
Subject: [RFC PATCH RESEND 2/4] target/arm/kvm: Add QAPI struct ArmTargetImplCPU
Date: Fri,  1 Aug 2025 08:47:28 +0100	[thread overview]
Message-ID: <20250801074730.28329-3-shameerkolothum@gmail.com> (raw)
In-Reply-To: <20250801074730.28329-1-shameerkolothum@gmail.com>

From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>

Introduce a QAPI‐defined struct (and its array) for target implementation
CPUs. This enables specifying target implementation CPU parameters
via -machine, for example:

-M virt, \
  impl-cpu.0.midr=1,impl-cpu.0.revidr=1,impl-cpu.0.aidr=1, \
  impl-cpu.1.midr=2,impl-cpu.1.revidr=2,impl-cpu.1.aidr=0

Subsequent patch will make use of this by using object_property_add(),
allowing users to configure each target CPU’s midr, revidr, and aidr
fields directly from the command line.

While at it, also provide a helper function to set the target CPUs.

Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
 qapi/machine.json    | 34 ++++++++++++++++++++++++++++++++++
 target/arm/kvm.c     | 16 ++++++++++++++++
 target/arm/kvm_arm.h |  8 ++++++++
 3 files changed, 58 insertions(+)

diff --git a/qapi/machine.json b/qapi/machine.json
index a6b8795b09..d6e0e3b2e3 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1898,3 +1898,37 @@
 { 'command': 'x-query-interrupt-controllers',
   'returns': 'HumanReadableText',
   'features': [ 'unstable' ]}
+
+##
+# @ArmTargetImplCPU:
+#
+# Info for a single target implementation CPU.
+#
+# @midr: MIDR value
+# @revidr: REVIDR value
+# @aidr: AIDR value
+#
+# Since: 10.2
+##
+{ 'struct': 'ArmTargetImplCPU',
+  'data': {
+    'midr': 'uint64',
+    'revidr': 'uint64',
+    'aidr': 'uint64'
+  }
+}
+
+##
+# @ArmTargetImplCPUs:
+#
+# List of target implementation CPUs.
+#
+# @target-cpus: List of ArmTargetImplCPU entries.
+#
+# Since: 10.2
+##
+{ 'struct': 'ArmTargetImplCPUs',
+  'data': {
+    'target-cpus': ['ArmTargetImplCPU']
+  }
+}
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index eb04640b50..8f325c4ca4 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -66,6 +66,9 @@ typedef struct ARMHostCPUFeatures {
 
 static ARMHostCPUFeatures arm_host_cpu_features;
 
+static uint64_t target_impl_cpus_num;
+static ArmTargetImplCPU *target_impl_cpus;
+
 /**
  * kvm_arm_vcpu_init:
  * @cpu: ARMCPU
@@ -2816,3 +2819,16 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp)
         cpu->kvm_mte = true;
     }
 }
+
+bool kvm_arm_set_target_impl_cpus(uint64_t num, ArmTargetImplCPU *cpus)
+{
+
+    if (target_impl_cpus_num) {
+        return false;
+    }
+
+    target_impl_cpus_num = num;
+    target_impl_cpus = cpus;
+
+    return true;
+}
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 3cd6447901..8754302333 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -244,6 +244,8 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp);
 
 int kvm_arm_get_writable_id_regs(ARMCPU *cpu, IdRegMap *idregmap);
 
+bool kvm_arm_set_target_impl_cpus(uint64_t num, ArmTargetImplCPU *cpus);
+
 #else
 
 /*
@@ -280,6 +282,12 @@ static inline int kvm_arm_get_writable_id_regs(ARMCPU *cpu, IdRegMap *idregmap)
     return -ENOSYS;
 }
 
+static inline
+bool kvm_arm_set_target_impl_cpus(uint64_t num, ArmTargetImplCPU *cpus)
+{
+    return false;
+}
+
 /*
  * These functions should never actually be called without KVM support.
  */
-- 
2.34.1



  parent reply	other threads:[~2025-08-01 13:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01  7:47 [RFC PATCH RESEND 0/4] hw/arm/virt: Add support for Target Implementation CPUs Shameer Kolothum
2025-08-01  7:47 ` [RFC PATCH RESEND 1/4] target/arm/kvm: Introduce helper to check target impl CPU support Shameer Kolothum
2025-08-09 16:21   ` Eric Auger
2025-08-01  7:47 ` Shameer Kolothum [this message]
2025-08-09 16:23   ` [RFC PATCH RESEND 2/4] target/arm/kvm: Add QAPI struct ArmTargetImplCPU Eric Auger
2025-08-01  7:47 ` [RFC PATCH RESEND 3/4] target/arm/kvm: Handle KVM Target Imp CPU hypercalls Shameer Kolothum
2025-09-19 10:51   ` Sebastian Ott
2025-08-01  7:47 ` [RFC PATCH RESEND 4/4] hw/arm/virt: Add Target Implementation CPU support Shameer Kolothum
2025-08-09 16:21   ` Eric Auger
2025-08-01  8:31 ` [RFC PATCH RESEND 0/4] hw/arm/virt: Add support for Target Implementation CPUs Cornelia Huck

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=20250801074730.28329-3-shameerkolothum@gmail.com \
    --to=shameerkolothum@gmail.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=jiangkunkun@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linuxarm@huawei.com \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=salil.mehta@huawei.com \
    --cc=sebott@redhat.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=yangjinqian1@huawei.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).