qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
	"Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>,
	qemu-arm@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Radoslaw Biernacki" <rad@semihalf.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Leif Lindholm" <quic_llindhol@quicinc.com>,
	"Rob Herring" <robh@kernel.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Alistair Francis" <alistair@alistair23.me>
Subject: Re: [PATCH v3 00/14] hw/arm: Prefer arm_feature() over object_property_find()
Date: Tue, 16 Jan 2024 17:20:13 +0100	[thread overview]
Message-ID: <7a73231a-d7ae-4abe-9bca-e8e295a5f70d@linaro.org> (raw)
In-Reply-To: <CAFEAcA9c58iVvgW4wnNT1H3tzsdYbxyU-kT7bJP=A3E+B-t7PA@mail.gmail.com>

On 13/1/24 14:36, Peter Maydell wrote:
> On Wed, 10 Jan 2024 at 19:53, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Since v2 [2]:
>> - Dropped "Simplify checking A64_MTE bit in FEATURE_ID register"
>> - Correct object_property_get_bool() uses
>> - Update ARM_FEATURE_AARCH64 && aa64_mte
>>
>> Since RFC [1]:
>> - Split one patch per feature
>> - Addressed Peter's review comments
>>
>> [1] https://lore.kernel.org/qemu-devel/20231214171447.44025-1-philmd@linaro.org/
>> [2] https://lore.kernel.org/qemu-devel/20240109180930.90793-1-philmd@linaro.org/
>>
>> Based-on: <20231123143813.42632-1-philmd@linaro.org>
>>    "hw: Simplify accesses to CPUState::'start-powered-off' property"
>>
>> Philippe Mathieu-Daudé (14):
>>    hw/arm/armv7m: Introduce cpudev variable in armv7m_realize()
>>    hw/arm/armv7m: Ensure requested CPU type implements ARM_FEATURE_M
>>    hw/arm/armv7m: Move code setting 'start-powered-off' property around
>>    hw/arm/armv7m: Always set 'init-nsvtor' property for Cortex-M CPUs


> The first part of this is fine and reasonable cleanup, but I
> continue to disagree about the later parts. What we want to do is
> "if this property is present, then set it", and that's what we do.
> Conversion to "if <some condition we know that the CPU is using to
> decide whether to define the property> then set it" is duplicating
> the condition logic in two places and opening the door for bugs
> where we change the condition in one place and not in the other.
> Where the <some condition> is a simple "feature X is set" it doesn't
> look too bad, but where it gets more complex it makes it IMHO more
> obvious that this is a bad idea, for example with:
> 
> -        if (object_property_find(cpuobj, "reset-cbar")) {
> +        if (arm_feature(&cpu->env, ARM_FEATURE_CBAR) ||
> +            arm_feature(&cpu->env, ARM_FEATURE_CBAR_RO)) {

For that we could add helpers such

   static inline bool arm_feature_cbar(CPUState *cpu) {
     return arm_feature(&cpu->env, ARM_FEATURE_CBAR) ||
            arm_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
   }

and use it in the target/ code where we register the property
and in the hw/ code where we set it.


Anyway I'll wait to see how Kevin's effort is going before
insisting with this series.
Do you mind taking the cleanup patches (1-4) meanwhile?

Thanks,

Phil.


  reply	other threads:[~2024-01-16 16:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 19:53 [PATCH v3 00/14] hw/arm: Prefer arm_feature() over object_property_find() Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 01/14] hw/arm/armv7m: Introduce cpudev variable in armv7m_realize() Philippe Mathieu-Daudé
2024-01-13 13:25   ` Peter Maydell
2024-01-10 19:53 ` [PATCH v3 02/14] hw/arm/armv7m: Ensure requested CPU type implements ARM_FEATURE_M Philippe Mathieu-Daudé
2024-01-13 13:26   ` Peter Maydell
2024-01-10 19:53 ` [PATCH v3 03/14] hw/arm/armv7m: Move code setting 'start-powered-off' property around Philippe Mathieu-Daudé
2024-01-13 13:26   ` Peter Maydell
2024-01-10 19:53 ` [PATCH v3 04/14] hw/arm/armv7m: Always set 'init-nsvtor' property for Cortex-M CPUs Philippe Mathieu-Daudé
2024-01-13 13:27   ` Peter Maydell
2024-01-10 19:53 ` [PATCH v3 05/14] hw/arm: Prefer arm_feature(M_SECURITY) over object_property_find() Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 06/14] hw/arm: Prefer arm_feature(THUMB_DSP) over object_property_find(dsp) Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 07/14] hw/arm: Prefer arm_feature(V7) over object_property_find(pmsav7-dregion) Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 08/14] hw/arm: Prefer arm_feature(EL3) over object_property_find(has_el3) Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 09/14] hw/arm: Prefer arm_feature(EL2) over object_property_find(has_el2) Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 10/14] hw/arm: Prefer arm_feature(CBAR*) over object_property_find(reset-cbar) Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 11/14] hw/arm: Prefer arm_feature(PMU) over object_property_find(pmu) Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 12/14] hw/arm: Prefer arm_feature(GENERIC_TMR) over 'kvm-no-adjvtime' property Philippe Mathieu-Daudé
2024-01-10 19:53 ` [PATCH v3 13/14] hw/arm: Prefer arm_feature(AARCH64) over object_property_find(aarch64) Philippe Mathieu-Daudé
2024-01-11  9:39   ` Philippe Mathieu-Daudé
2024-01-11  9:47     ` Marc Zyngier
2024-01-11 10:08       ` Philippe Mathieu-Daudé
2024-01-19 10:09         ` Kevin Wolf
2024-01-10 19:53 ` [PATCH v3 14/14] hw/arm: Prefer cpu_isar_feature(aa64_mte) over property_find(tag-memory) Philippe Mathieu-Daudé
2024-01-13 13:36 ` [PATCH v3 00/14] hw/arm: Prefer arm_feature() over object_property_find() Peter Maydell
2024-01-16 16:20   ` Philippe Mathieu-Daudé [this message]
2024-01-16 16:43     ` Peter Maydell
2024-01-19 16:54       ` 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=7a73231a-d7ae-4abe-9bca-e8e295a5f70d@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=alistair@alistair23.me \
    --cc=armbru@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=i.mitsyanko@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=marcin.juszkiewicz@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_llindhol@quicinc.com \
    --cc=rad@semihalf.com \
    --cc=robh@kernel.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).