From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Alexander Graf" <agraf@csgraf.de>,
qemu-arm@nongnu.org
Subject: Re: [PATCH 3/6] target/arm: Better describe PMU depends on TCG or HVF
Date: Mon, 30 Jun 2025 10:03:11 -0700 [thread overview]
Message-ID: <93cc9ec2-2f79-43df-96e3-fb216862561c@linaro.org> (raw)
In-Reply-To: <20250630130937.3487-4-philmd@linaro.org>
On 6/30/25 6:09 AM, Philippe Mathieu-Daudé wrote:
> Simplify PMU logic by rewriting '!KVM' as 'TCG || HVF'
> (ignoring QTest, because vCPUs are not available there).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/cpu.c | 2 +-
> target/arm/machine.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index b6a8ba83a46..0311ff315fe 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -2352,7 +2352,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
> if (arm_feature(env, ARM_FEATURE_PMU)) {
> pmu_init(cpu);
>
> - if (!kvm_enabled()) {
> + if (tcg_enabled() || hvf_enabled()) {
> arm_register_pre_el_change_hook(cpu, &pmu_pre_el_change, 0);
> arm_register_el_change_hook(cpu, &pmu_post_el_change, 0);
> }
> diff --git a/target/arm/machine.c b/target/arm/machine.c
> index e442d485241..baa7ad25ca9 100644
> --- a/target/arm/machine.c
> +++ b/target/arm/machine.c
> @@ -1,7 +1,7 @@
> #include "qemu/osdep.h"
> #include "cpu.h"
> #include "qemu/error-report.h"
> -#include "system/kvm.h"
> +#include "system/hvf.h"
> #include "system/tcg.h"
> #include "kvm_arm.h"
> #include "internals.h"
> @@ -853,7 +853,7 @@ static int cpu_pre_save(void *opaque)
> {
> ARMCPU *cpu = opaque;
>
> - if (!kvm_enabled()) {
> + if (tcg_enabled() || hvf_enabled()) {
> pmu_op_start(&cpu->env);
> }
>
> @@ -888,7 +888,7 @@ static int cpu_post_save(void *opaque)
> {
> ARMCPU *cpu = opaque;
>
> - if (!kvm_enabled()) {
> + if (tcg_enabled() || hvf_enabled()) {
> pmu_op_finish(&cpu->env);
> }
>
> @@ -921,7 +921,7 @@ static int cpu_pre_load(void *opaque)
> */
> env->irq_line_state = UINT32_MAX;
>
> - if (!kvm_enabled()) {
> + if (tcg_enabled() || hvf_enabled()) {
> pmu_op_start(env);
> }
>
> @@ -1013,7 +1013,7 @@ static int cpu_post_load(void *opaque, int version_id)
> }
> }
>
> - if (!kvm_enabled()) {
> + if (tcg_enabled() || hvf_enabled()) {
> pmu_op_finish(env);
> }
>
If I understand correctly, this is supported for tcg and hvf, but not
kvm, right?
I'm just a bit confused by commit description mentioning "simplify
logic", which is more "make it explicit".
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Thanks,
Pierrick
next prev parent reply other threads:[~2025-06-30 17:04 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 13:09 [PATCH 0/6] target/arm: Few accel cleanups Philippe Mathieu-Daudé
2025-06-30 13:09 ` [PATCH 1/6] target/arm: Only set CPU_INTERRUPT_EXITTB for TCG Philippe Mathieu-Daudé
2025-06-30 13:49 ` Richard Henderson
2025-06-30 16:48 ` Pierrick Bouvier
2025-06-30 13:09 ` [PATCH 2/6] target/arm: Only allow disabling NEON when using TCG Philippe Mathieu-Daudé
2025-06-30 13:51 ` Richard Henderson
2025-06-30 16:49 ` Pierrick Bouvier
2025-07-04 13:03 ` Peter Maydell
2025-07-04 13:17 ` Philippe Mathieu-Daudé
2025-07-04 13:32 ` Peter Maydell
2025-06-30 13:09 ` [PATCH 3/6] target/arm: Better describe PMU depends on TCG or HVF Philippe Mathieu-Daudé
2025-06-30 17:03 ` Pierrick Bouvier [this message]
2025-06-30 17:03 ` Pierrick Bouvier
2025-06-30 13:09 ` [PATCH 4/6] target/arm: Re-use arm_is_psci_call() in HVF Philippe Mathieu-Daudé
2025-06-30 13:52 ` Richard Henderson
2025-06-30 16:50 ` Pierrick Bouvier
2025-06-30 13:09 ` [PATCH 5/6] target/arm: Share ARM_PSCI_CALL trace event between TCG and HVF Philippe Mathieu-Daudé
2025-06-30 13:53 ` Richard Henderson
2025-06-30 15:36 ` Philippe Mathieu-Daudé
2025-06-30 16:53 ` Pierrick Bouvier
2025-07-04 13:14 ` Peter Maydell
2025-07-07 14:02 ` Stefan Hajnoczi
2025-07-07 14:12 ` Peter Maydell
2025-07-07 14:08 ` Daniel P. Berrangé
2025-06-30 13:09 ` [PATCH 6/6] target/arm: Allow arm_cpu_tlb_fill_align optionally set CPUTLBEntryFull Philippe Mathieu-Daudé
2025-06-30 13:56 ` Richard Henderson
2025-06-30 15:35 ` Philippe Mathieu-Daudé
2025-06-30 17:00 ` Pierrick Bouvier
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=93cc9ec2-2f79-43df-96e3-fb216862561c@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=agraf@csgraf.de \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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).