From 4a8ae3353694014241b3f44303c3a597e9ef0c15 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Wed, 28 Mar 2018 14:30:27 +0300 Subject: MAINTAINERS: Bestow upon myself the care for drivers/hwtracing Although all components of drivers/hwtracing are Maintained, the directory itself isn't, which leads to confusion when people want to patch the Kconfig file, for example. This adds an entry to the MAINTAINERS file with myself as a maintainer. Signed-off-by: Alexander Shishkin --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3bdc260..48e426f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6242,6 +6242,11 @@ F: Documentation/hw_random.txt F: drivers/char/hw_random/ F: include/linux/hw_random.h +HARDWARE TRACING FACILITIES +M: Alexander Shishkin +S: Maintained +F: drivers/hwtracing/ + HARDWARE SPINLOCK CORE M: Ohad Ben-Cohen M: Bjorn Andersson -- cgit v1.1 From 9ea393d8d8377b6da8ee25c6a114ec24c0687c7c Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Wed, 28 Mar 2018 18:43:57 +0300 Subject: stm class: Add SPDX GPL-2.0 header to replace GPLv2 boilerplate This adds SPDX GPL-2.0 header to to stm core files and removes the GPLv2 boilerplate text. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/stm/console.c | 10 +--------- drivers/hwtracing/stm/core.c | 10 +--------- drivers/hwtracing/stm/dummy_stm.c | 10 +--------- drivers/hwtracing/stm/heartbeat.c | 10 +--------- drivers/hwtracing/stm/policy.c | 10 +--------- drivers/hwtracing/stm/stm.h | 10 +--------- include/linux/stm.h | 10 +--------- include/uapi/linux/stm.h | 9 --------- 8 files changed, 7 insertions(+), 72 deletions(-) diff --git a/drivers/hwtracing/stm/console.c b/drivers/hwtracing/stm/console.c index c9d9a8d..a00f65e 100644 --- a/drivers/hwtracing/stm/console.c +++ b/drivers/hwtracing/stm/console.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Simple kernel console driver for STM devices * Copyright (c) 2014, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * STM console will send kernel messages over STM devices to a trace host. */ diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index f129869..05386b7 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * System Trace Module (STM) infrastructure * Copyright (c) 2014, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * STM class implements generic infrastructure for System Trace Module devices * as defined in MIPI STPv2 specification. */ diff --git a/drivers/hwtracing/stm/dummy_stm.c b/drivers/hwtracing/stm/dummy_stm.c index c5f94ca..6328802 100644 --- a/drivers/hwtracing/stm/dummy_stm.c +++ b/drivers/hwtracing/stm/dummy_stm.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * A dummy STM device for stm/stm_source class testing. * Copyright (c) 2014, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * STM class implements generic infrastructure for System Trace Module devices * as defined in MIPI STPv2 specification. */ diff --git a/drivers/hwtracing/stm/heartbeat.c b/drivers/hwtracing/stm/heartbeat.c index 3da7b67..7db4239 100644 --- a/drivers/hwtracing/stm/heartbeat.c +++ b/drivers/hwtracing/stm/heartbeat.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Simple heartbeat STM source driver * Copyright (c) 2016, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * Heartbeat STM source will send repetitive messages over STM devices to a * trace host. */ diff --git a/drivers/hwtracing/stm/policy.c b/drivers/hwtracing/stm/policy.c index 33e9a1b..3fd07e2 100644 --- a/drivers/hwtracing/stm/policy.c +++ b/drivers/hwtracing/stm/policy.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * System Trace Module (STM) master/channel allocation policy management * Copyright (c) 2014, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * A master/channel allocation policy allows mapping string identifiers to * master and channel ranges, where allocation can be done. */ diff --git a/drivers/hwtracing/stm/stm.h b/drivers/hwtracing/stm/stm.h index 4e8c6926..923571a 100644 --- a/drivers/hwtracing/stm/stm.h +++ b/drivers/hwtracing/stm/stm.h @@ -1,16 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * System Trace Module (STM) infrastructure * Copyright (c) 2014, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * STM class implements generic infrastructure for System Trace Module devices * as defined in MIPI STPv2 specification. */ diff --git a/include/linux/stm.h b/include/linux/stm.h index 210ff22..c6f577a 100644 --- a/include/linux/stm.h +++ b/include/linux/stm.h @@ -1,15 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * System Trace Module (STM) infrastructure apis * Copyright (C) 2014 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef _STM_H_ diff --git a/include/uapi/linux/stm.h b/include/uapi/linux/stm.h index dbffdc2..29c89be 100644 --- a/include/uapi/linux/stm.h +++ b/include/uapi/linux/stm.h @@ -3,15 +3,6 @@ * System Trace Module (STM) userspace interfaces * Copyright (c) 2014, Intel Corporation. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * * STM class implements generic infrastructure for System Trace Module devices * as defined in MIPI STPv2 specification. */ -- cgit v1.1 From 4f0c7c6a12906e3571abb3c2b93eca8f727f4c9c Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Fri, 23 Feb 2018 13:19:43 +0200 Subject: stm class: Make dummy's master/channel ranges configurable To allow for more flexible testing of the stm class, make it possible to specify the ranges of masters and channels that the dummy_stm devices cover. This is done via module parameters. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/stm/dummy_stm.c | 24 +++++++++++++++++++++--- include/uapi/linux/stm.h | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/stm/dummy_stm.c b/drivers/hwtracing/stm/dummy_stm.c index 6328802..38528ff 100644 --- a/drivers/hwtracing/stm/dummy_stm.c +++ b/drivers/hwtracing/stm/dummy_stm.c @@ -12,6 +12,7 @@ #include #include #include +#include static ssize_t notrace dummy_stm_packet(struct stm_data *stm_data, unsigned int master, @@ -44,6 +45,18 @@ static unsigned int fail_mode; module_param(fail_mode, int, 0600); +static unsigned int master_min; + +module_param(master_min, int, 0400); + +static unsigned int master_max = STP_MASTER_MAX; + +module_param(master_max, int, 0400); + +static unsigned int nr_channels = STP_CHANNEL_MAX; + +module_param(nr_channels, int, 0400); + static int dummy_stm_link(struct stm_data *data, unsigned int master, unsigned int channel) { @@ -60,14 +73,19 @@ static int dummy_stm_init(void) if (nr_dummies < 0 || nr_dummies > DUMMY_STM_MAX) return -EINVAL; + if (master_min > master_max || + master_max > STP_MASTER_MAX || + nr_channels > STP_CHANNEL_MAX) + return -EINVAL; + for (i = 0; i < nr_dummies; i++) { dummy_stm[i].name = kasprintf(GFP_KERNEL, "dummy_stm.%d", i); if (!dummy_stm[i].name) goto fail_unregister; - dummy_stm[i].sw_start = 0x0000; - dummy_stm[i].sw_end = 0xffff; - dummy_stm[i].sw_nchannels = 0xffff; + dummy_stm[i].sw_start = master_min; + dummy_stm[i].sw_end = master_max; + dummy_stm[i].sw_nchannels = nr_channels; dummy_stm[i].packet = dummy_stm_packet; dummy_stm[i].link = dummy_stm_link; diff --git a/include/uapi/linux/stm.h b/include/uapi/linux/stm.h index 29c89be..7bac318b 100644 --- a/include/uapi/linux/stm.h +++ b/include/uapi/linux/stm.h @@ -12,6 +12,10 @@ #include +/* Maximum allowed master and channel values */ +#define STP_MASTER_MAX 0xffff +#define STP_CHANNEL_MAX 0xffff + /** * struct stp_policy_id - identification for the STP policy * @size: size of the structure including real id[] length -- cgit v1.1 From 50352fa730328b2e946fb912d495653b627c0bf9 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Wed, 28 Mar 2018 18:46:15 +0300 Subject: intel_th: Add SPDX GPL-2.0 header to replace GPLv2 boilerplate This adds SPDX GPL-2.0 header to the Trace Hub driver and removes the GPLv2 boilerplate text. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/intel_th/core.c | 10 +--------- drivers/hwtracing/intel_th/debug.c | 10 +--------- drivers/hwtracing/intel_th/debug.h | 10 +--------- drivers/hwtracing/intel_th/gth.c | 10 +--------- drivers/hwtracing/intel_th/gth.h | 10 +--------- drivers/hwtracing/intel_th/intel_th.h | 10 +--------- drivers/hwtracing/intel_th/msu.c | 10 +--------- drivers/hwtracing/intel_th/msu.h | 10 +--------- drivers/hwtracing/intel_th/pci.c | 10 +--------- drivers/hwtracing/intel_th/pti.c | 10 +--------- drivers/hwtracing/intel_th/pti.h | 10 +--------- drivers/hwtracing/intel_th/sth.c | 10 +--------- drivers/hwtracing/intel_th/sth.h | 10 +--------- 13 files changed, 13 insertions(+), 117 deletions(-) diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index 1a023e3..bf1e454 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub driver core * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/hwtracing/intel_th/debug.c b/drivers/hwtracing/intel_th/debug.c index 788a1f0..ff79063 100644 --- a/drivers/hwtracing/intel_th/debug.c +++ b/drivers/hwtracing/intel_th/debug.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub driver debugging * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #include diff --git a/drivers/hwtracing/intel_th/debug.h b/drivers/hwtracing/intel_th/debug.h index 88311ba..78bd7e4 100644 --- a/drivers/hwtracing/intel_th/debug.h +++ b/drivers/hwtracing/intel_th/debug.h @@ -1,16 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Intel(R) Trace Hub driver debugging * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef __INTEL_TH_DEBUG_H__ diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c index 018678e..8426b79 100644 --- a/drivers/hwtracing/intel_th/gth.c +++ b/drivers/hwtracing/intel_th/gth.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub Global Trace Hub * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/hwtracing/intel_th/gth.h b/drivers/hwtracing/intel_th/gth.h index f3d2342..6f2b0b9 100644 --- a/drivers/hwtracing/intel_th/gth.h +++ b/drivers/hwtracing/intel_th/gth.h @@ -1,16 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Intel(R) Trace Hub Global Trace Hub (GTH) data structures * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef __INTEL_TH_GTH_H__ diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h index 99ad563..cdeed3b 100644 --- a/drivers/hwtracing/intel_th/intel_th.h +++ b/drivers/hwtracing/intel_th/intel_th.h @@ -1,16 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Intel(R) Trace Hub data structures * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef __INTEL_TH_H__ diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index dfb57ea..ede3883 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub Memory Storage Unit * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/hwtracing/intel_th/msu.h b/drivers/hwtracing/intel_th/msu.h index 9b710e4..9cc8ace 100644 --- a/drivers/hwtracing/intel_th/msu.h +++ b/drivers/hwtracing/intel_th/msu.h @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub Memory Storage Unit (MSU) data structures * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef __INTEL_TH_MSU_H__ diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c index c2a2ce8..c2e55e5 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub pci driver * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/hwtracing/intel_th/pti.c b/drivers/hwtracing/intel_th/pti.c index e96a1fc..5669433 100644 --- a/drivers/hwtracing/intel_th/pti.c +++ b/drivers/hwtracing/intel_th/pti.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub PTI output driver * * Copyright (C) 2014-2016 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/hwtracing/intel_th/pti.h b/drivers/hwtracing/intel_th/pti.h index 30827be..e9381ba 100644 --- a/drivers/hwtracing/intel_th/pti.h +++ b/drivers/hwtracing/intel_th/pti.h @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub PTI output data structures * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef __INTEL_TH_STH_H__ diff --git a/drivers/hwtracing/intel_th/sth.c b/drivers/hwtracing/intel_th/sth.c index b034446..4b7ae47 100644 --- a/drivers/hwtracing/intel_th/sth.c +++ b/drivers/hwtracing/intel_th/sth.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Intel(R) Trace Hub Software Trace Hub support * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/hwtracing/intel_th/sth.h b/drivers/hwtracing/intel_th/sth.h index f1390cd..f97fc0c 100644 --- a/drivers/hwtracing/intel_th/sth.h +++ b/drivers/hwtracing/intel_th/sth.h @@ -1,16 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Intel(R) Trace Hub Software Trace Hub (STH) data structures * * Copyright (C) 2014-2015 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #ifndef __INTEL_TH_STH_H__ -- cgit v1.1 From 9ad577087165478c9d9be82b15ed9bf2db5835f5 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Thu, 1 Mar 2018 10:15:32 +0200 Subject: intel_th: Use correct method of finding hub Since commit 8edc514b01e9 ("intel_th: Make SOURCE devices children of the root device") the hub is not the parent of SOURCE devices any more, so the new helper function should be used for that instead of always using the parent. The intel_th_set_output() path, however, still uses the old logic, leading to the hub driver structure being aliased with something else, like struct pci_driver or struct acpi_driver, and an incorrect call to an address inferred from that, potentially resulting in a crash. Fixes: 8edc514b01e9 ("intel_th: Make SOURCE devices children of the root device") Signed-off-by: Alexander Shishkin --- drivers/hwtracing/intel_th/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index bf1e454..8e4f5fd 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -927,7 +927,7 @@ EXPORT_SYMBOL_GPL(intel_th_trace_disable); int intel_th_set_output(struct intel_th_device *thdev, unsigned int master) { - struct intel_th_device *hub = to_intel_th_device(thdev->dev.parent); + struct intel_th_device *hub = to_intel_th_hub(thdev); struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver); if (!hubdrv->set_output) -- cgit v1.1 From c2d2c7de972d7a08533bde622c36ff6feb112907 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Thu, 1 Mar 2018 10:17:25 +0200 Subject: intel_th: Don't touch switch routing in host mode When the Trace Hub is operating in Host Debugger mode, it is up to the debugger to configure master routing even for the software sources. Do not do this in the driver in this case. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/intel_th/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index 8e4f5fd..d295b22 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -930,6 +930,10 @@ int intel_th_set_output(struct intel_th_device *thdev, struct intel_th_device *hub = to_intel_th_hub(thdev); struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver); + /* In host mode, this is up to the external debugger, do nothing. */ + if (hub->host_mode) + return 0; + if (!hubdrv->set_output) return -ENOTSUPP; -- cgit v1.1 From 661b0df8489a35da4ee8acaaf43f204a913ccfc9 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Wed, 23 Aug 2017 09:47:19 +0300 Subject: intel_th: Pick up irq number from resources Platform devices pass their IRQs around as resources, so as a convenience for the glue layer code, allow them pass the IRQ to the core driver in the resources array. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/intel_th/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index d295b22..8f820c1 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -805,7 +805,14 @@ intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata, struct resource *devres, unsigned int ndevres, int irq) { struct intel_th *th; - int err; + int err, r; + + if (irq == -1) + for (r = 0; r < ndevres; r++) + if (devres[r].flags & IORESOURCE_IRQ) { + irq = devres[r].start; + break; + } th = kzalloc(sizeof(*th), GFP_KERNEL); if (!th) -- cgit v1.1 From 282ffec565c2e9fe18bbb48c19767cccd2437f11 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Wed, 23 Aug 2017 09:52:00 +0300 Subject: intel_th: Allow forcing host mode through drvdata Some devices can only operate in host mode, so we need means of communicating this to the core driver on per-device basis. This adds a flag to drvdata to signal host-only capability to the core. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/intel_th/core.c | 6 ++++-- drivers/hwtracing/intel_th/intel_th.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index 8f820c1..da962aa 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -630,7 +630,8 @@ intel_th_subdevice_alloc(struct intel_th *th, thdev->output.port = -1; thdev->output.scratchpad = subdev->scrpd; } else if (subdev->type == INTEL_TH_SWITCH) { - thdev->host_mode = host_mode; + thdev->host_mode = + INTEL_TH_CAP(th, host_mode_only) ? true : host_mode; th->hub = thdev; } @@ -729,7 +730,8 @@ static int intel_th_populate(struct intel_th *th) struct intel_th_device *thdev; /* only allow SOURCE and SWITCH devices in host mode */ - if (host_mode && subdev->type == INTEL_TH_OUTPUT) + if ((INTEL_TH_CAP(th, host_mode_only) || host_mode) && + subdev->type == INTEL_TH_OUTPUT) continue; /* diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h index cdeed3b..780206d 100644 --- a/drivers/hwtracing/intel_th/intel_th.h +++ b/drivers/hwtracing/intel_th/intel_th.h @@ -42,9 +42,11 @@ struct intel_th_output { /** * struct intel_th_drvdata - describes hardware capabilities and quirks * @tscu_enable: device needs SW to enable time stamping unit + * @host_mode_only: device can only operate in 'host debugger' mode */ struct intel_th_drvdata { - unsigned int tscu_enable : 1; + unsigned int tscu_enable : 1, + host_mode_only : 1; }; #define INTEL_TH_CAP(_th, _cap) ((_th)->drvdata ? (_th)->drvdata->_cap : 0) -- cgit v1.1 From ebc57e399b8efb68293f206333985a3394c3acf8 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Wed, 23 Aug 2017 09:59:55 +0300 Subject: intel_th: Add ACPI glue layer The Trace Hub devices now can be enumerated as ACPI devices, which translates into "Host Debugger mode". There are two IDs: one for PCH Trace Hub, and one for the uncore Trace Hub. These are expected to stay the same across all platforms. Signed-off-by: Alexander Shishkin --- drivers/hwtracing/intel_th/Kconfig | 12 ++++++ drivers/hwtracing/intel_th/Makefile | 3 ++ drivers/hwtracing/intel_th/acpi.c | 79 +++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 drivers/hwtracing/intel_th/acpi.c diff --git a/drivers/hwtracing/intel_th/Kconfig b/drivers/hwtracing/intel_th/Kconfig index 1b412f8..ca0527d 100644 --- a/drivers/hwtracing/intel_th/Kconfig +++ b/drivers/hwtracing/intel_th/Kconfig @@ -25,6 +25,18 @@ config INTEL_TH_PCI Say Y here to enable PCI Intel TH support. +config INTEL_TH_ACPI + tristate "Intel(R) Trace Hub ACPI controller" + depends on ACPI + help + Intel(R) Trace Hub may exist as an ACPI device. This option enables + support glue layer for ACPI-based Intel TH. This typically implies + 'host debugger' mode, that is, the trace configuration and capture + is handled by an external debug host and corresponding controls will + not be available on the target. + + Say Y here to enable ACPI Intel TH support. + config INTEL_TH_GTH tristate "Intel(R) Trace Hub Global Trace Hub" help diff --git a/drivers/hwtracing/intel_th/Makefile b/drivers/hwtracing/intel_th/Makefile index 880c9b5..d9252fa 100644 --- a/drivers/hwtracing/intel_th/Makefile +++ b/drivers/hwtracing/intel_th/Makefile @@ -6,6 +6,9 @@ intel_th-$(CONFIG_INTEL_TH_DEBUG) += debug.o obj-$(CONFIG_INTEL_TH_PCI) += intel_th_pci.o intel_th_pci-y := pci.o +obj-$(CONFIG_INTEL_TH_ACPI) += intel_th_acpi.o +intel_th_acpi-y := acpi.o + obj-$(CONFIG_INTEL_TH_GTH) += intel_th_gth.o intel_th_gth-y := gth.o diff --git a/drivers/hwtracing/intel_th/acpi.c b/drivers/hwtracing/intel_th/acpi.c new file mode 100644 index 0000000..87bc374 --- /dev/null +++ b/drivers/hwtracing/intel_th/acpi.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Intel(R) Trace Hub ACPI driver + * + * Copyright (C) 2017 Intel Corporation. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include + +#include "intel_th.h" + +#define DRIVER_NAME "intel_th_acpi" + +static const struct intel_th_drvdata intel_th_acpi_pch = { + .host_mode_only = 1, +}; + +static const struct intel_th_drvdata intel_th_acpi_uncore = { + .host_mode_only = 1, +}; + +static const struct acpi_device_id intel_th_acpi_ids[] = { + { "INTC1000", (kernel_ulong_t)&intel_th_acpi_uncore }, + { "INTC1001", (kernel_ulong_t)&intel_th_acpi_pch }, + { "", 0 }, +}; + +MODULE_DEVICE_TABLE(acpi, intel_th_acpi_ids); + +static int intel_th_acpi_probe(struct platform_device *pdev) +{ + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); + const struct acpi_device_id *id; + struct intel_th *th; + + id = acpi_match_device(intel_th_acpi_ids, &pdev->dev); + if (!id) + return -ENODEV; + + th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, + pdev->resource, pdev->num_resources, -1); + if (IS_ERR(th)) + return PTR_ERR(th); + + adev->driver_data = th; + + return 0; +} + +static int intel_th_acpi_remove(struct platform_device *pdev) +{ + struct intel_th *th = platform_get_drvdata(pdev); + + intel_th_free(th); + + return 0; +} + +static struct platform_driver intel_th_acpi_driver = { + .probe = intel_th_acpi_probe, + .remove = intel_th_acpi_remove, + .driver = { + .name = DRIVER_NAME, + .acpi_match_table = intel_th_acpi_ids, + }, +}; + +module_platform_driver(intel_th_acpi_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Intel(R) Trace Hub ACPI controller driver"); +MODULE_AUTHOR("Alexander Shishkin "); -- cgit v1.1 From 72ef0f24d587d38f235334aef69afe611bba0d16 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 3 Oct 2017 16:27:30 -0700 Subject: hwtracing: Add HW tracing support menu Make a "HW tracing support" menu and move 2 entries into it. (No change in Coresight, which is ARM-specific and is only listed for ARM & ARM64.) This makes the Device Drivers menu more consistent and prevents these drivers from being listed at the top level of the Device Drivers menu. Signed-off-by: Randy Dunlap Signed-off-by: Alexander Shishkin --- drivers/Kconfig | 4 +--- drivers/hwtracing/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 drivers/hwtracing/Kconfig diff --git a/drivers/Kconfig b/drivers/Kconfig index 879dc06..95b9ccc 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -199,9 +199,7 @@ source "drivers/dax/Kconfig" source "drivers/nvmem/Kconfig" -source "drivers/hwtracing/stm/Kconfig" - -source "drivers/hwtracing/intel_th/Kconfig" +source "drivers/hwtracing/Kconfig" source "drivers/fpga/Kconfig" diff --git a/drivers/hwtracing/Kconfig b/drivers/hwtracing/Kconfig new file mode 100644 index 0000000..f68e025 --- /dev/null +++ b/drivers/hwtracing/Kconfig @@ -0,0 +1,7 @@ +menu "HW tracing support" + +source "drivers/hwtracing/stm/Kconfig" + +source "drivers/hwtracing/intel_th/Kconfig" + +endmenu -- cgit v1.1