qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org,
	Pierrick Bouvier <pierrick.bouvier@linaro.org>
Subject: Re: [PATCH 16/19] target/arm: Add arm_cpu_has_feature() helper
Date: Wed, 14 May 2025 17:53:24 +0100	[thread overview]
Message-ID: <f7bcd8b2-2c0c-4907-8a0e-af172c235d56@linaro.org> (raw)
In-Reply-To: <b6c81748-091b-4d61-8d34-beaa0442aab3@linaro.org>

On 14/5/25 10:24, Richard Henderson wrote:
> On 5/13/25 18:39, Philippe Mathieu-Daudé wrote:
>> arm_cpu_has_feature() is equivalent of arm_feature(), however
>> while the latter uses CPUARMState so is target-specific, the
>> former doesn't and can be called by target-agnostic code in hw/.
> 
> CPUARMState is no more target-specific than ARMCPU.

ARMCPU is forward-declared as opaque pointer in target/arm/cpu-qom.h,
so we can expose prototypes using it to non-ARM units.
CPUARMState is only declared in "cpu.h", itself only accessible by
ARM-related units.

> 
> Did you really mean to use CPUState?
> Or is it merely that arm_cpu_has_feature is out-of-line?
> 
> 
> r~
> 
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>   target/arm/cpu_has_feature.h | 2 ++
>>   target/arm/cpu.c             | 7 +++++++
>>   2 files changed, 9 insertions(+)
>>
>> diff --git a/target/arm/cpu_has_feature.h b/target/arm/cpu_has_feature.h
>> index 2adfccd9208..352f9d75bed 100644
>> --- a/target/arm/cpu_has_feature.h
>> +++ b/target/arm/cpu_has_feature.h
>> @@ -62,4 +62,6 @@ typedef enum arm_features {
>>       ARM_FEATURE_BACKCOMPAT_CNTFRQ, /* 62.5MHz timer default */
>>   } ArmCpuFeature;
>> +bool arm_cpu_has_feature(ARMCPU *cpu, ArmCpuFeature feature);
>> +
>>   #endif
>> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
>> index 8c9d161f2ef..759636a3b0e 100644
>> --- a/target/arm/cpu.c
>> +++ b/target/arm/cpu.c
>> @@ -54,6 +54,13 @@
>>   #include "target/arm/gtimer.h"
>>   #include "target/arm/multiprocessing.h"
>> +bool arm_cpu_has_feature(ARMCPU *cpu, ArmCpuFeature feature)
>> +{
>> +    CPUARMState *env = &cpu->env;
>> +
>> +    return arm_feature(env, feature);
>> +}
>> +
>>   static void arm_cpu_set_pc(CPUState *cs, vaddr value)
>>   {
>>       ARMCPU *cpu = ARM_CPU(cs);
> 



  reply	other threads:[~2025-05-14 16:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 17:39 [PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 01/19] target/arm/tcg-stubs: compile file once (system) Philippe Mathieu-Daudé
2025-05-13 17:43   ` Philippe Mathieu-Daudé
2025-05-13 22:59   ` Pierrick Bouvier
2025-05-14  8:18   ` Richard Henderson
2025-05-13 17:39 ` [PATCH 02/19] target/arm/hvf_arm: Avoid using poisoned CONFIG_HVF definition Philippe Mathieu-Daudé
2025-05-13 22:58   ` Pierrick Bouvier
2025-05-14  8:19   ` Richard Henderson
2025-05-13 17:39 ` [PATCH 03/19] target/arm: Only link with zlib when TCG is enabled Philippe Mathieu-Daudé
2025-05-13 22:58   ` Pierrick Bouvier
2025-05-13 17:39 ` [PATCH 04/19] target/arm/cpregs: Include missing 'target/arm/cpu.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 05/19] hw/arm/boot: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 06/19] target/arm/cpu-features: Include missing 'cpu.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 07/19] target/arm/qmp: " Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 08/19] target/arm/kvm: Include missing 'cpu-qom.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 09/19] target/arm/hvf: " Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 10/19] hw/arm: Remove unnecessary 'cpu.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 11/19] target/arm: Restrict inclusion of 'multiprocessing.h' Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 12/19] target/arm: Move some definitions from 'cpu.h' to 'multiprocessing.h' Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 13/19] hw/arm: Include missing 'target/arm/gtimer.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 14/19] target/arm: Extract PSCI definitions to 'psci.h' Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 15/19] target/arm: Extract feature definitions to 'cpu_has_feature.h' header Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 16/19] target/arm: Add arm_cpu_has_feature() helper Philippe Mathieu-Daudé
2025-05-14  8:24   ` Richard Henderson
2025-05-14 16:53     ` Philippe Mathieu-Daudé [this message]
2025-05-14 16:59       ` Pierrick Bouvier
2025-05-15 11:05         ` Philippe Mathieu-Daudé
2025-05-15 15:22           ` Pierrick Bouvier
2025-05-15 16:14             ` Philippe Mathieu-Daudé
2025-05-15 16:20               ` Pierrick Bouvier
2025-05-13 17:39 ` [PATCH 17/19] hw/arm/realview: Replace arm_feature() -> arm_cpu_has_feature() Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 18/19] hw/arm/virt-acpi: " Philippe Mathieu-Daudé
2025-05-13 17:39 ` [PATCH 19/19] target/arm: Always include full path to 'cpu.h' Philippe Mathieu-Daudé
2025-05-13 22:57   ` Pierrick Bouvier
2025-05-13 17:42 ` [PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h Philippe Mathieu-Daudé
2025-05-13 23:00   ` Pierrick Bouvier
2025-05-29 15:37 ` Peter Maydell

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=f7bcd8b2-2c0c-4907-8a0e-af172c235d56@linaro.org \
    --to=philmd@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).