]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
coresight: Fix TRCCONFIGR.QE sysfs interface
authorJames Clark <james.clark@arm.com>
Thu, 20 Jan 2022 11:30:47 +0000 (11:30 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:56:25 +0000 (11:56 +0200)
commit03c826b7706f71166ac0dfb469de9f7b01c4c19b
tree36a5cf6182a0cb38ed216742809e64cf36dac6b1
parent4ad1af6cd0846253065c6160783ed89ed57c8f1d
coresight: Fix TRCCONFIGR.QE sysfs interface

BugLink: https://bugs.launchpad.net/bugs/1969110
commit ea75a342aed5ed72c87f38fbe0df2f5df7eae374 upstream.

It's impossible to program a valid value for TRCCONFIGR.QE
when TRCIDR0.QSUPP==0b10. In that case the following is true:

  Q element support is implemented, and only supports Q elements without
  instruction counts. TRCCONFIGR.QE can only take the values 0b00 or 0b11.

Currently the low bit of QSUPP is checked to see if the low bit of QE can
be written to, but as you can see when QSUPP==0b10 the low bit is cleared
making it impossible to ever write the only valid value of 0b11 to QE.
0b10 would be written instead, which is a reserved QE value even for all
values of QSUPP.

The fix is to allow writing the low bit of QE for any non zero value of
QSUPP.

This change also ensures that the low bit is always set, even when the
user attempts to only set the high bit.

Signed-off-by: James Clark <james.clark@arm.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Fixes: d8c66962084f ("coresight-etm4x: Controls pertaining to the reset, mode, pe and events")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220120113047.2839622-2-james.clark@arm.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ba81399402b7d3dee1b8dfb92c008d90da0cd580)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c