• Suzuki K Poulose's avatar
    coresight: tmc-etr: Handle driver mode specific ETR buffers · 96a7f644
    Suzuki K Poulose authored
    Since the ETR could be driven either by SYSFS or by perf, it
    becomes complicated how we deal with the buffers used for each
    of these modes. The ETR driver cannot simply free the current
    attached buffer without knowing the provider (i.e, sysfs vs perf).
    
    To solve this issue, we provide:
    1) the driver-mode specific etr buffer to be retained in the drvdata
    2) the etr_buf for a session should be passed on when enabling the
       hardware, which will be stored in drvdata->etr_buf. This will be
       replaced (not free'd) as soon as the hardware is disabled, after
       necessary sync operation.
    
    The advantages of this are :
    
    1) The common code path doesn't need to worry about how to dispose
       an existing buffer, if it is about to start a new session with a
       different buffer, possibly in a different mode.
    2) The driver mode can control its buffers and can get access to the
       saved session even when the hardware is operating in a different
       mode. (e.g, we can still access a trace buffer from a sysfs mode
       even if the etr is now used in perf mode, without disrupting the
       current session.)
    
    Towards this, we introduce a sysfs specific data which will hold the
    etr_buf used for sysfs mode of operation, controlled solely by the
    sysfs mode handling code.
    
    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
    Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    96a7f644
coresight-tmc.h 9.08 KB