lkml.org 
[lkml]   [2021]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v4 12/21] arm64: cpufeature: Add an early command-line cpufeature override facility
    On Sat, 23 Jan 2021 13:43:52 +0000,
    Catalin Marinas <catalin.marinas@arm.com> wrote:
    >
    > On Mon, Jan 18, 2021 at 09:45:24AM +0000, Marc Zyngier wrote:
    > > +struct reg_desc {
    > > + const char * const name;
    > > + u64 * const val;
    > > + u64 * const mask;
    > > + struct {
    > > + const char * const name;
    > > + u8 shift;
    > > + } fields[];
    > > +};
    >
    > Sorry, I didn't see this earlier. Do we need to add all these consts
    > here? So you want the pointers to be const but why is 'shift' special
    > and not a const then? Is it modified later?
    >
    > Would this not work:
    >
    > struct reg_desc {
    > const char *name;
    > u64 *val;
    > u64 *mask;
    > struct {
    > const char *name;
    > u8 shift;
    > } fields[];
    > };
    >
    > > +static const struct reg_desc * const regs[] __initdata = {
    >
    > as we already declare the whole struct reg_desc pointers here as const.
    > I may have confused myself...

    It definitely is better. Specially given that we throw all of this
    away right after boot, there is no harm in keeping it simple.

    I've also renamed "reg_desc" to "ftr_set_desc", because we don't
    always describe a register (like for kaslr).

    Thanks,

    M.

    --
    Without deviation from the norm, progress is not possible.

    \
     
     \ /
      Last update: 2021-01-24 17:25    [W:2.255 / U:0.292 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site