• James Morse's avatar
    x86/resctrl: Add a helper to read a closid's configuration · f07e9d02
    James Morse authored
    Functions like show_doms() reach into the architecture's private
    structure to retrieve the configuration from the struct rdt_hw_resource.
    
    The hardware configuration may look completely different to the
    values resctrl gets from user-space. The staged configuration and
    resctrl_arch_update_domains() allow the architecture to convert or
    translate these values.
    
    Resctrl shouldn't read or write the ctrl_val[] values directly. Add
    a helper to read the current configuration. This will allow another
    architecture to scale the bitmaps if necessary, and possibly use
    controls that don't take the user-space control format at all.
    
    Of the remaining functions that access ctrl_val[] directly,
    apply_config() is part of the architecture-specific code, and is
    called via resctrl_arch_update_domains(). reset_all_ctrls() will be an
    architecture specific helper.
    
    update_mba_bw() manipulates both ctrl_val[], mbps_val[] and the
    hardware. The mbps_val[] that matches the mba_sc state of the resource
    is changed, but the other is left unchanged. Abstracting this is the
    subject of later patches that affect set_mba_sc() too.
    Signed-off-by: default avatarJames Morse <james.morse@arm.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Reviewed-by: default avatarJamie Iles <jamie@nuviainc.com>
    Reviewed-by: default avatarReinette Chatre <reinette.chatre@intel.com>
    Tested-by: default avatarBabu Moger <babu.moger@amd.com>
    Link: https://lkml.kernel.org/r/20210728170637.25610-17-james.morse@arm.com
    f07e9d02
ctrlmondata.c 13.1 KB