All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Jing Zhang <jingzhangos@google.com>
Cc: kernel-team@android.com,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>, Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 11/17] arm64: cpufeature: Add an early command-line cpufeature override facility
Date: Wed, 06 Jan 2021 09:03:47 +0000	[thread overview]
Message-ID: <90dccfccbfdfa8abb05716c2572af9ca@kernel.org> (raw)
In-Reply-To: <CAAdAUtjNiBACFbxp-0x_ar9RcnFDkiSoGqOn0XKiwtJAd3qCHg@mail.gmail.com>

On 2021-01-06 02:16, Jing Zhang wrote:
> On Mon, Jan 4, 2021 at 8:20 AM Marc Zyngier <maz@kernel.org> wrote:

[...]

>> +static __init void parse_cmdline(void)
>> +{
>> +       if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) {
>> +               const u8 *prop;
>> +               void *fdt;
>> +               int node;
>> +
>> +               fdt = get_early_fdt_ptr();
>> +               if (!fdt)
>> +                       goto out;
>> +
>> +               node = fdt_path_offset(fdt, "/chosen");
>> +               if (node < 0)
>> +                       goto out;
>> +
>> +               prop = fdt_getprop(fdt, node, "bootargs", NULL);
>> +               if (!prop)
>> +                       goto out;
>> +
>> +               match_options(prop);
>> +
>> +               if (!IS_ENABLED(CONFIG_CMDLINE_EXTEND))
>> +                       return;
>> +       }
>> +
>> +out:
>> +       match_options(CONFIG_CMDLINE);
>> +}
>> +
>> +void __init init_shadow_regs(void)
>> +{
>> +       int i;
>> +
>> +       for (i = 0; i < ARRAY_SIZE(regs); i++) {
>> +               if (regs[i]->val)
>> +                       *regs[i]->val  = 0;
>> +               if (regs[i]->mask)
>> +                       *regs[i]->mask = 0;
>> +       }
>> +
>> +       parse_cmdline();
>> +
>> +       for (i = 0; i < ARRAY_SIZE(regs); i++) {
>> +               if (regs[i]->val)
>> +                       __flush_dcache_area(regs[i]->val, 
>> sizeof(*regs[i]->val));
>> +               if (regs[i]->mask)
>> +                       __flush_dcache_area(regs[i]->mask, 
>> sizeof(*regs[i]->mask));
>> +       }
> Could you shed some light on the usage of __flush_dcache_area here? 
> Thanks.

Some of this data gets used by secondary CPUs when they have their
MMU off. If we don't clean to the PoC, they will miss the updates
and things will randomly fail.

         M.
-- 
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Jing Zhang <jingzhangos@google.com>
Cc: kernel-team@android.com,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>, Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 11/17] arm64: cpufeature: Add an early command-line cpufeature override facility
Date: Wed, 06 Jan 2021 09:03:47 +0000	[thread overview]
Message-ID: <90dccfccbfdfa8abb05716c2572af9ca@kernel.org> (raw)
In-Reply-To: <CAAdAUtjNiBACFbxp-0x_ar9RcnFDkiSoGqOn0XKiwtJAd3qCHg@mail.gmail.com>

On 2021-01-06 02:16, Jing Zhang wrote:
> On Mon, Jan 4, 2021 at 8:20 AM Marc Zyngier <maz@kernel.org> wrote:

[...]

>> +static __init void parse_cmdline(void)
>> +{
>> +       if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) {
>> +               const u8 *prop;
>> +               void *fdt;
>> +               int node;
>> +
>> +               fdt = get_early_fdt_ptr();
>> +               if (!fdt)
>> +                       goto out;
>> +
>> +               node = fdt_path_offset(fdt, "/chosen");
>> +               if (node < 0)
>> +                       goto out;
>> +
>> +               prop = fdt_getprop(fdt, node, "bootargs", NULL);
>> +               if (!prop)
>> +                       goto out;
>> +
>> +               match_options(prop);
>> +
>> +               if (!IS_ENABLED(CONFIG_CMDLINE_EXTEND))
>> +                       return;
>> +       }
>> +
>> +out:
>> +       match_options(CONFIG_CMDLINE);
>> +}
>> +
>> +void __init init_shadow_regs(void)
>> +{
>> +       int i;
>> +
>> +       for (i = 0; i < ARRAY_SIZE(regs); i++) {
>> +               if (regs[i]->val)
>> +                       *regs[i]->val  = 0;
>> +               if (regs[i]->mask)
>> +                       *regs[i]->mask = 0;
>> +       }
>> +
>> +       parse_cmdline();
>> +
>> +       for (i = 0; i < ARRAY_SIZE(regs); i++) {
>> +               if (regs[i]->val)
>> +                       __flush_dcache_area(regs[i]->val, 
>> sizeof(*regs[i]->val));
>> +               if (regs[i]->mask)
>> +                       __flush_dcache_area(regs[i]->mask, 
>> sizeof(*regs[i]->mask));
>> +       }
> Could you shed some light on the usage of __flush_dcache_area here? 
> Thanks.

Some of this data gets used by secondary CPUs when they have their
MMU off. If we don't clean to the PoC, they will miss the updates
and things will randomly fail.

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-01-06  9:03 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 13:49 [PATCH v2 00/17] arm64: Early CPU feature override, and an application to VHE Marc Zyngier
2021-01-04 13:49 ` Marc Zyngier
2021-01-04 13:49 ` [PATCH v2 01/17] arm64: Fix labels in el2_setup macros Marc Zyngier
2021-01-04 13:49   ` Marc Zyngier
2021-01-04 13:49 ` [PATCH v2 02/17] arm64: Fix outdated TCR setup comment Marc Zyngier
2021-01-04 13:49   ` Marc Zyngier
2021-01-04 13:49 ` [PATCH v2 03/17] arm64: Turn the MMU-on sequence into a macro Marc Zyngier
2021-01-04 13:49   ` Marc Zyngier
2021-01-04 13:49 ` [PATCH v2 04/17] arm64: Provide an 'upgrade to VHE' stub hypercall Marc Zyngier
2021-01-04 13:49   ` Marc Zyngier
2021-01-05 20:35   ` Jing Zhang
2021-01-05 20:35     ` Jing Zhang
2021-01-05 21:03     ` Marc Zyngier
2021-01-05 21:03       ` Marc Zyngier
2021-01-04 13:49 ` [PATCH v2 05/17] arm64: Initialise as nVHE before switching to VHE Marc Zyngier
2021-01-04 13:49   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 06/17] arm64: Move VHE-specific SPE setup to mutate_to_vhe() Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 07/17] arm64: Simplify init_el2_state to be non-VHE only Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 08/17] arm64: Move SCTLR_EL1 initialisation to EL-agnostic code Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 09/17] arm64: cpufeature: Add global feature override facility Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 10/17] arm64: Extract early FDT mapping from kaslr_early_init() Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 11/17] arm64: cpufeature: Add an early command-line cpufeature override facility Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-06  2:16   ` Jing Zhang
2021-01-06  2:16     ` Jing Zhang
2021-01-06  9:03     ` Marc Zyngier [this message]
2021-01-06  9:03       ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 12/17] arm64: Allow ID_AA64MMFR1_EL1.VH to be overridden from the command line Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-05 22:42   ` Jing Zhang
2021-01-05 22:42     ` Jing Zhang
2021-01-04 13:50 ` [PATCH v2 13/17] arm64: Honor VHE being disabled from the command-line Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 14/17] arm64: Add an aliasing facility for the idreg override Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 15/17] arm64: Make kvm-arm.mode={nvhe, protected} an alias of id_aa64mmfr1.vh=0 Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-04 13:50 ` [PATCH v2 16/17] KVM: arm64: Document HVC_VHE_RESTART stub hypercall Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier
2021-01-05 22:58   ` Jing Zhang
2021-01-05 22:58     ` Jing Zhang
2021-01-04 13:50 ` [PATCH v2 17/17] arm64: Move "nokaslr" over to the early cpufeature infrastructure Marc Zyngier
2021-01-04 13:50   ` Marc Zyngier

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=90dccfccbfdfa8abb05716c2572af9ca@kernel.org \
    --to=maz@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jingzhangos@google.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.