• Nathan Lynch's avatar
    powerpc/pseries/papr-sysparm: Expose character device to user space · 905b9e48
    Nathan Lynch authored
    Until now the papr_sysparm APIs have been kernel-internal. But user
    space needs access to PAPR system parameters too. The only method
    available to user space today to get or set system parameters is using
    sys_rtas() and /dev/mem to pass RTAS-addressable buffers between user
    space and firmware. This is incompatible with lockdown and should be
    deprecated.
    
    So provide an alternative ABI to user space in the form of a
    /dev/papr-sysparm character device with just two ioctl commands (get
    and set). The data payloads involved are small enough to fit in the
    ioctl argument buffer, making the code relatively simple.
    
    Exposing the system parameters through sysfs has been considered but
    it would be too awkward:
    
    * The kernel currently does not have to contain an exhaustive list of
      defined system parameters. This is a convenient property to maintain
      because we don't have to update the kernel whenever a new parameter
      is added to PAPR. Exporting a named attribute in sysfs for each
      parameter would negate this.
    
    * Some system parameters are text-based and some are not.
    
    * Retrieval of at least one system parameter requires input data,
      which a simple read-oriented interface can't support.
    Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20231212-papr-sys_rtas-vs-lockdown-v6-11-e9eafd0c8c6c@linux.ibm.com
    905b9e48
papr-sysparm.c 8.5 KB