[PATCH v2 11/17] arm64: cpufeature: Add an early command-line cpufeature override facility

Marc Zyngier maz at kernel.org
Wed Jan 6 04:03:47 EST 2021


On 2021-01-06 02:16, Jing Zhang wrote:
> On Mon, Jan 4, 2021 at 8:20 AM Marc Zyngier <maz at 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...



More information about the linux-arm-kernel mailing list