From: Shaoqin Huang <shahuang@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-arm@nongnu.org, Eric Auger <eauger@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH v8] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER
Date: Fri, 29 Mar 2024 11:45:21 +0800 [thread overview]
Message-ID: <46f0c5ab-dee7-4cd4-844d-c418818e187c@redhat.com> (raw)
In-Reply-To: <ZgE71v8uGDNihQ5H@redhat.com>
Hi Daniel,
On 3/25/24 16:55, Daniel P. Berrangé wrote:
> On Mon, Mar 25, 2024 at 01:35:58PM +0800, Shaoqin Huang wrote:
>> Hi Daniel,
>>
>> Thanks for your reviewing. I see your comments in the v7.
>>
>> I have some doubts about what you said about the QAPI. Do you want me to
>> convert the current design into the QAPI parsing like the
>> IOThreadVirtQueueMapping? And we need to add new json definition in the
>> qapi/ directory?
I have defined the QAPI for kvm-pmu-filter like below:
+##
+# @FilterAction:
+#
+# The Filter Action
+#
+# @a: Allow
+#
+# @d: Disallow
+#
+# Since: 9.0
+##
+{ 'enum': 'FilterAction',
+ 'data': [ 'a', 'd' ] }
+
+##
+# @SingleFilter:
+#
+# Lazy
+#
+# @action: the action
+#
+# @start: the start
+#
+# @end: the end
+#
+# Since: 9.0
+##
+
+{ 'struct': 'SingleFilter',
+ 'data': { 'action': 'FilterAction', 'start': 'int', 'end': 'int' } }
+
+##
+# @KVMPMUFilter:
+#
+# Lazy
+#
+# @filter: the filter
+#
+# Since: 9.0
+##
+
+{ 'struct': 'KVMPMUFilter',
+ 'data': { 'filter': ['SingleFilter'] }}
And I guess I can use it by adding code like below:
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -1206,3 +1206,35 @@ const PropertyInfo
qdev_prop_iothread_vq_mapping_list = {
.set = set_iothread_vq_mapping_list,
.release = release_iothread_vq_mapping_list,
};
+
+/* --- kvm-pmu-filter ---*/
+
+static void get_kvm_pmu_filter(Object *obj, Visitor *v,
+ const char *name, void *opaque, Error **errp)
+{
+ KVMPMUFilter **prop_ptr = object_field_prop_ptr(obj, opaque);
+
+ visit_type_KVMPMUFilter(v, name, prop_ptr, errp);
+}
+
+static void set_kvm_pmu_filter(Object *obj, Visitor *v,
+ const char *name, void *opaque, Error **errp)
+{
+ KVMPMUFilter **prop_ptr = object_field_prop_ptr(obj, opaque);
+ KVMPMUFilter *list;
+
+ printf("running the %s\n", __func__);
+ if (!visit_type_KVMPMUFilter(v, name, &list, errp)) {
+ return;
+ }
+
+ printf("The name is %s\n", name);
+ *prop_ptr = list;
+}
+
+const PropertyInfo qdev_prop_kvm_pmu_filter = {
+ .name = "KVMPMUFilter",
+ .description = "der der",
+ .get = get_kvm_pmu_filter,
+ .set = set_kvm_pmu_filter,
+};
+#define DEFINE_PROP_KVM_PMU_FILTER(_name, _state, _field) \
+ DEFINE_PROP(_name, _state, _field, qdev_prop_kvm_pmu_filter, \
+ KVMPMUFilter *)
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2439,6 +2441,7 @@ static Property arm_cpu_properties[] = {
mp_affinity, ARM64_AFFINITY_INVALID),
DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID),
DEFINE_PROP_INT32("core-count", ARMCPU, core_count, -1),
+ DEFINE_PROP_KVM_PMU_FILTER("kvm-pmu-filter", ARMCPU, kvm_pmu_filter),
DEFINE_PROP_END_OF_LIST()
};
And I guess I can use the new json format input like below:
qemu-system-aarch64 \
-cpu host, '{"filter": [{"action": "a", "start": 0x10, "end": "0x11"}]}'
But it doesn't work. It seems like because the -cpu option doesn't
support json format parameter.
Maybe I'm wrong. So I want to double check with if the -cpu option
support json format nowadays?
If the -cpu option doesn't support json format, how I can use the QAPI
for kvm-pmu-filter property?
Thanks,
Shaoqin
>
> Yes, you would define a type in the qapi dir similar to how is
> done for IOThreadVirtQueueMapping, and then you can use that
> in the property setter method.
>
>
> With regards,
> Daniel
--
Shaoqin
next prev parent reply other threads:[~2024-03-29 3:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 7:48 [PATCH v8] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER Shaoqin Huang
2024-03-19 15:23 ` Eric Auger
2024-04-09 2:43 ` Shaoqin Huang
2024-03-22 14:53 ` Daniel P. Berrangé
2024-03-25 5:35 ` Shaoqin Huang
2024-03-25 8:55 ` Daniel P. Berrangé
2024-03-29 3:45 ` Shaoqin Huang [this message]
2024-04-02 13:01 ` Kevin Wolf
2024-04-09 1:57 ` Shaoqin Huang
2024-04-15 17:31 ` 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=46f0c5ab-dee7-4cd4-844d-c418818e187c@redhat.com \
--to=shahuang@redhat.com \
--cc=berrange@redhat.com \
--cc=eauger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).