linux-uconsole/drivers
Suzuki K Poulose b24c29a641 UPSTREAM: coresight: etm-perf: Support PID tracing for kernel at EL2
When the kernel is running at EL2, the PID is stored in CONTEXTIDR_EL2.
So, tracing CONTEXTIDR_EL1 doesn't give us the pid of the process.
Thus we should trace the VMID with VMIDOPT set to trace CONTEXTIDR_EL2
instead of CONTEXTIDR_EL1.  Given that we have an existing config
option "contextid" and this will be useful for tracing virtual machines
(when we get to support virtualization).

So instead, this patch extends option CTXTID with an extra bit
ETM_OPT_CTXTID2 (bit 15), thus on an EL2 kernel, we will have another
bit available for the perf tool: ETM_OPT_CTXTID is for kernel running in
EL1, ETM_OPT_CTXTID2 is used when kernel runs in EL2 with VHE enabled.

The tool must be backward compatible for users, i.e, "contextid" today
traces PID and that should remain the same; for this purpose, the perf
tool is updated to automatically set corresponding bit for the
"contextid" config, therefore, the user doesn't have to bother which EL
the kernel is running.

  i.e, perf record -e cs_etm/contextid/u --

will always do the "pid" tracing, independent of the kernel EL.

The driver parses the format "contextid", which traces CONTEXTIDR_EL1
for ETM_OPT_CTXTID (on EL1 kernel) and traces CONTEXTIDR_EL2 for
ETM_OPT_CTXTID2 (on EL2 kernel).

Besides the enhancement for format "contexid", extra two formats are
introduced: "contextid1" and "contextid2".  This considers to support
tracing both CONTEXTIDR_EL1 and CONTEXTIDR_EL2 when the kernel is
running at EL2.  Finally, the PMU formats are defined as follow:

  "contextid1": Available on both EL1 kernel and EL2 kernel.  When the
                kernel is running at EL1, "contextid1" enables the PID
		tracing; when the kernel is running at EL2, this enables
		tracing the PID of guest applications.

  "contextid2": Only usable when the kernel is running at EL2.  When
                selected, enables PID tracing on EL2 kernel.

  "contextid":  Will be an alias for the option that enables PID
                tracing.  I.e,
                contextid == contextid1, on EL1 kernel.
                contextid == contextid2, on EL2 kernel.

Bug: 174685394
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Al Grant <al.grant@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[ Added two config formats: contextid1, contextid2 ]
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20210206150833.42120-4-leo.yan@linaro.org
Link: https://lore.kernel.org/r/20210211172038.2483517-3-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 88f11864cf)
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Change-Id: Ied5b90940eb99386e70ad977ed10dd8ef0bd40e6
2021-03-01 12:52:12 -08:00
..
accessibility speakup: fix uninitialized flush_lock 2020-12-30 11:53:44 +01:00
acpi Merge 5.10.13 into android12-5.10 2021-02-05 10:38:34 +01:00
amba BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
android ANDROID: thermal: Add vendor thermal genl event function 2021-02-26 20:34:41 +00:00
ata libata-5.10-2020-10-30 2020-10-30 14:51:01 -07:00
atm atm: idt77252: call pci_disable_device() on error path 2021-01-12 20:18:09 +01:00
auxdisplay
base ANDROID: driver core: Set fw_devlink.strict=true by default 2021-02-25 17:04:04 -08:00
bcma
block Merge 5.10.18 into android12-5.10 2021-02-25 07:35:32 +01:00
bluetooth UPSTREAM: Bluetooth: hci_bcm: Add support for ISO packets 2021-02-26 22:20:27 +00:00
bus bus: fsl-mc: fix error return code in fsl_mc_object_allocate() 2020-12-30 11:53:46 +01:00
cdrom
char BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
clk UPSTREAM: clk: Mark fwnodes when their clock provider is added/removed 2021-02-25 15:16:39 -08:00
clocksource Merge 5.10.4 into android12-5.10 2020-12-30 12:47:03 +01:00
connector
counter counter:ti-eqep: remove floor 2021-01-27 11:55:12 +01:00
cpufreq Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
cpuidle ANDROID: cpuidle: export cpuidle_driver_state_disabled 2021-01-13 02:35:14 +00:00
crypto crypto: marvel/cesa - Fix tdma descriptor on 64-bit 2021-02-03 23:28:40 +01:00
dax device-dax: Fix range release 2021-01-06 14:56:56 +01:00
dca
devfreq
dio
dma BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
dma-buf ANDROID: dma-buf: Export is_dma_buf_file 2021-02-25 19:42:08 +00:00
edac EDAC/amd64: Fix PCI component registration 2020-12-30 11:54:11 +01:00
eisa
extcon extcon: max77693: Fix modalias string 2020-12-30 11:53:49 +01:00
firewire
firmware UPSTREAM: firmware: qcom_scm: update comment for ICE-related functions 2021-02-23 08:10:57 +01:00
fpga fpga: Specify HAS_IOMEM dependency for FPGA_DFL 2020-12-01 18:46:24 +01:00
fsi fsi: Aspeed: Add mutex to protect HW access 2020-12-30 11:53:46 +01:00
gnss
gpio UPSTREAM: gpiolib: Don't probe gpio_device if it's not the primary device 2021-02-25 15:16:38 -08:00
gpu BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
greybus
hid This is the 5.10.19 stable release 2021-02-26 10:21:27 +01:00
hsi HSI: omap_ssi: Don't jump to free ID in ssi_add_controller() 2020-12-30 11:53:24 +01:00
hv x86/hyperv: Fix kexec panic/hang issues 2021-01-27 11:54:57 +01:00
hwmon hwmon: (dell-smm) Add XPS 15 L502X to fan control blacklist 2021-02-26 10:13:00 +01:00
hwspinlock
hwtracing UPSTREAM: coresight: etm-perf: Support PID tracing for kernel at EL2 2021-03-01 12:52:12 -08:00
i2c BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
i3c i3c master: fix missing destroy_workqueue() on error in i3c_master_register 2021-01-06 14:56:53 +01:00
ide scsi: ide: Mark power management requests with RQF_PM instead of RQF_PREEMPT 2021-01-12 20:18:15 +01:00
idle intel_idle: Build fix 2020-12-03 10:00:23 +01:00
iio iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free() 2021-01-27 11:55:12 +01:00
infiniband IB/isert: add module param to set sg_tablesize for IO cmd 2021-02-23 15:53:23 +01:00
input BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
interconnect interconnect: imx8mq: Use icc_sync_state 2021-01-27 11:55:29 +01:00
iommu Merge 5.10.14 into android12-5.10 2021-02-08 20:05:12 -08:00
ipack
irqchip ANDROID: gic-v3: Update vendor hook to set affinity in GIC v3 2021-02-18 16:37:57 +00:00
isdn misdn: dsp: select CONFIG_BITREVERSE 2021-01-19 18:27:26 +01:00
leds leds: trigger: fix potential deadlock with libata 2021-02-03 23:28:41 +01:00
lightnvm lightnvm: fix memory leak when submit fails 2021-01-27 11:55:22 +01:00
macintosh macintosh/adb-iop: Send correct poll command 2020-12-30 11:53:39 +01:00
mailbox mailbox: arm_mhu_db: Fix mhu_db_shutdown by replacing kfree with devm_kfree 2020-12-30 11:53:28 +01:00
mcb
md ANDROID: dm: sync inline crypto support with patches going upstream 2021-02-19 10:48:51 +00:00
media Merge 5.10.18 into android12-5.10 2021-02-25 07:35:32 +01:00
memory BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
memstick memstick: r592: Fix error return in r592_probe() 2020-12-30 11:53:34 +01:00
message scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() 2020-10-26 16:57:18 -04:00
mfd mfd: cpcap: Fix interrupt regression with regmap clear_ack 2020-12-30 11:53:16 +01:00
misc Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
mmc BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
most
mtd mtd: rawnand: nandsim: Fix the logic when selecting Hamming soft ECC engine 2021-01-27 11:54:50 +01:00
mux
net This is the 5.10.19 stable release 2021-02-26 10:21:27 +01:00
nfc nfc: s3fwrn5: Release the nfc firmware 2020-12-30 11:53:53 +01:00
ntb Bug fixes for v5.10 2020-10-25 11:12:31 -07:00
nubus
nvdimm libnvdimm/dimm: Avoid race between probe and available_slots_show() 2021-02-10 09:29:17 +01:00
nvme nvme-rdma: Use ibdev_to_node instead of dereferencing ->dma_device 2021-02-26 10:12:59 +01:00
nvmem
of UPSTREAM: of: property: fw_devlink: Ignore interrupts property for some configs 2021-02-25 15:16:39 -08:00
opp opp: Call the missing clk_put() on error 2021-01-06 14:56:49 +01:00
oprofile
parisc
parport
pci Merge 5.10.4 into android12-5.10 2020-12-30 12:47:03 +01:00
pcmcia
perf
phy phy: cpcap-usb: Fix warning for missing regulator_disable 2021-02-07 15:37:13 +01:00
pinctrl UPSTREAM: pinctrl/meson: enable building as modules 2021-02-11 12:20:51 +00:00
platform Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
pnp PNP: fix kernel-doc markups 2020-10-27 19:23:04 +01:00
power Merge 5.10.4 into android12-5.10 2020-12-30 12:47:03 +01:00
powercap Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2020-11-10 10:02:31 -08:00
pps
ps3 powerpc/ps3: use dma_mapping_error() 2020-12-30 11:53:53 +01:00
ptp phy: dp83640: select CONFIG_CRC32 2021-01-17 14:17:02 +01:00
pwm Merge 5.10.4 into android12-5.10 2020-12-30 12:47:03 +01:00
rapidio rapidio: fix the missed put_device() for rio_mport_add_riodev 2020-10-16 11:11:22 -07:00
ras
regulator regulator: Fix lockdep warning resolving supplies 2021-02-13 13:55:14 +01:00
remoteproc UPSTREAM: remoteproc: coredump: Add minidump functionality 2021-02-18 20:10:00 +00:00
reset UPSTREAM: reset: meson: make it possible to build as a module 2021-02-11 12:27:53 +00:00
rpmsg Merge 2b71482060 ("Merge tag 'modules-for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux") into android-mainline 2020-10-27 11:41:53 +01:00
rtc BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
s390 Merge 5.10.13 into android12-5.10 2021-02-05 10:38:34 +01:00
sbus
scsi UPSTREAM: scsi: ufs: use devm_blk_ksm_init() 2021-02-23 08:10:56 +01:00
sfi
sh
siox
slimbus slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew() 2020-12-30 11:53:47 +01:00
soc Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
soundwire soundwire: master: use pm_runtime_set_active() on add 2020-12-30 11:53:28 +01:00
spi BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
spmi
ssb
staging Revert "ANDROID: staging: debug-kinfo: remove unnecessary defer probe" 2021-02-27 00:08:10 +00:00
target scsi: target: tcmu: Fix use-after-free of se_cmd->priv 2021-01-27 11:54:50 +01:00
tc
tee tee: optee: replace might_sleep with cond_resched 2021-02-03 23:28:43 +01:00
thermal ANDROID: thermal: Add vendor thermal genl event function 2021-02-26 20:34:41 +00:00
thunderbolt thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link() 2021-02-10 09:29:15 +01:00
tty BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
uio uio: Fix use-after-free in uio_unregister_device() 2020-11-09 18:54:30 +01:00
usb This is the 5.10.19 stable release 2021-02-26 10:21:27 +01:00
vdpa vdpa_sim: add get_config callback in vdpasim_dev_attr 2021-02-23 15:53:23 +01:00
vfio BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
vhost vhost_net: fix ubuf refcount incorrectly when sendmsg fails 2021-01-12 20:18:13 +01:00
video BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
virt nitro_enclaves: Fixup type and simplify logic of the poll mask setup 2020-11-09 18:20:36 +01:00
virtio ANDROID: virtio: disable virtio_dma_buf callback checks with CFI 2021-01-28 22:14:14 +00:00
visorbus
vlynq
vme
w1
watchdog BACKPORT: UPSTREAM: amba: Make the remove callback return void 2021-03-01 12:52:06 -08:00
xen xen-scsiback: don't "handle" error by BUG() 2021-02-23 15:53:24 +01:00
zorro
Kconfig
Makefile vdpa: mlx5: fix vdpa/vhost dependencies 2020-12-02 04:09:56 -05:00