• James Clark's avatar
    perf cs-etm: Fix contextid validation · bfd431cb
    James Clark authored
    Pre 5.11 kernels don't support 'contextid1' and 'contextid2' so
    validation would be skipped. By adding an additional check for
    'contextid', old kernels will still have validation done even though
    contextid would either be contextid1 or contextid2.
    
    Additionally now that it's possible to override options, an existing bug
    in the validation is revealed. 'val' is overwritten by the contextid1
    validation, and re-used for contextid2 validation causing it to always
    fail. '!val || val != 0x4' is the same as 'val != 0x4' because 0 is also
    != 4, so that expression can be simplified and the temp variable not
    overwritten.
    
    Fixes: 35c51f83 ("perf cs-etm: Validate options after applying them")
    Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
    Signed-off-by: default avatarJames Clark <james.clark@arm.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: John Garry <john.g.garry@oracle.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Cc: Mike Leach <mike.leach@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: coresight@lists.linaro.org
    Cc: linux-arm-kernel@lists.infradead.org
    Link: https://lore.kernel.org/all/20230501073452.GA4660@leoy-yangtze.lan
    Link: https://lore.kernel.org/r/20230504144822.1938717-1-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    bfd431cb
cs-etm.c 26.7 KB