Skip to content

Commit 86f690e

Browse files
committed
Merge tag 'stm-intel_th-for-greg-20180329' of git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm into char-misc-next
Alexander writes: stm class/intel_th: Updates for 4.17 These are: * Mass conversion to GPL-2 SPDX header * Moved "hwtracing" to now its own submenu, to uncrowd the parent menu a bit * Added MAINTAINERS entry for drivers/hwtracing * Somewhat small Trace Hub fixes * Added ACPI glue layer for the Trace Hub * Added more module parameters to dummy_stm for better test coverage
2 parents 45ea83f + 72ef0f2 commit 86f690e

File tree

27 files changed

+172
-200
lines changed

27 files changed

+172
-200
lines changed

MAINTAINERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6244,6 +6244,11 @@ F: Documentation/hw_random.txt
62446244
F: drivers/char/hw_random/
62456245
F: include/linux/hw_random.h
62466246

6247+
HARDWARE TRACING FACILITIES
6248+
M: Alexander Shishkin <[email protected]>
6249+
S: Maintained
6250+
F: drivers/hwtracing/
6251+
62476252
HARDWARE SPINLOCK CORE
62486253
M: Ohad Ben-Cohen <[email protected]>
62496254
M: Bjorn Andersson <[email protected]>

drivers/Kconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ source "drivers/dax/Kconfig"
199199

200200
source "drivers/nvmem/Kconfig"
201201

202-
source "drivers/hwtracing/stm/Kconfig"
203-
204-
source "drivers/hwtracing/intel_th/Kconfig"
202+
source "drivers/hwtracing/Kconfig"
205203

206204
source "drivers/fpga/Kconfig"
207205

drivers/hwtracing/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
menu "HW tracing support"
2+
3+
source "drivers/hwtracing/stm/Kconfig"
4+
5+
source "drivers/hwtracing/intel_th/Kconfig"
6+
7+
endmenu

drivers/hwtracing/intel_th/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ config INTEL_TH_PCI
2525

2626
Say Y here to enable PCI Intel TH support.
2727

28+
config INTEL_TH_ACPI
29+
tristate "Intel(R) Trace Hub ACPI controller"
30+
depends on ACPI
31+
help
32+
Intel(R) Trace Hub may exist as an ACPI device. This option enables
33+
support glue layer for ACPI-based Intel TH. This typically implies
34+
'host debugger' mode, that is, the trace configuration and capture
35+
is handled by an external debug host and corresponding controls will
36+
not be available on the target.
37+
38+
Say Y here to enable ACPI Intel TH support.
39+
2840
config INTEL_TH_GTH
2941
tristate "Intel(R) Trace Hub Global Trace Hub"
3042
help

drivers/hwtracing/intel_th/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ intel_th-$(CONFIG_INTEL_TH_DEBUG) += debug.o
66
obj-$(CONFIG_INTEL_TH_PCI) += intel_th_pci.o
77
intel_th_pci-y := pci.o
88

9+
obj-$(CONFIG_INTEL_TH_ACPI) += intel_th_acpi.o
10+
intel_th_acpi-y := acpi.o
11+
912
obj-$(CONFIG_INTEL_TH_GTH) += intel_th_gth.o
1013
intel_th_gth-y := gth.o
1114

drivers/hwtracing/intel_th/acpi.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Intel(R) Trace Hub ACPI driver
4+
*
5+
* Copyright (C) 2017 Intel Corporation.
6+
*/
7+
8+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9+
10+
#include <linux/types.h>
11+
#include <linux/module.h>
12+
#include <linux/device.h>
13+
#include <linux/sysfs.h>
14+
#include <linux/platform_device.h>
15+
#include <linux/acpi.h>
16+
17+
#include "intel_th.h"
18+
19+
#define DRIVER_NAME "intel_th_acpi"
20+
21+
static const struct intel_th_drvdata intel_th_acpi_pch = {
22+
.host_mode_only = 1,
23+
};
24+
25+
static const struct intel_th_drvdata intel_th_acpi_uncore = {
26+
.host_mode_only = 1,
27+
};
28+
29+
static const struct acpi_device_id intel_th_acpi_ids[] = {
30+
{ "INTC1000", (kernel_ulong_t)&intel_th_acpi_uncore },
31+
{ "INTC1001", (kernel_ulong_t)&intel_th_acpi_pch },
32+
{ "", 0 },
33+
};
34+
35+
MODULE_DEVICE_TABLE(acpi, intel_th_acpi_ids);
36+
37+
static int intel_th_acpi_probe(struct platform_device *pdev)
38+
{
39+
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
40+
const struct acpi_device_id *id;
41+
struct intel_th *th;
42+
43+
id = acpi_match_device(intel_th_acpi_ids, &pdev->dev);
44+
if (!id)
45+
return -ENODEV;
46+
47+
th = intel_th_alloc(&pdev->dev, (void *)id->driver_data,
48+
pdev->resource, pdev->num_resources, -1);
49+
if (IS_ERR(th))
50+
return PTR_ERR(th);
51+
52+
adev->driver_data = th;
53+
54+
return 0;
55+
}
56+
57+
static int intel_th_acpi_remove(struct platform_device *pdev)
58+
{
59+
struct intel_th *th = platform_get_drvdata(pdev);
60+
61+
intel_th_free(th);
62+
63+
return 0;
64+
}
65+
66+
static struct platform_driver intel_th_acpi_driver = {
67+
.probe = intel_th_acpi_probe,
68+
.remove = intel_th_acpi_remove,
69+
.driver = {
70+
.name = DRIVER_NAME,
71+
.acpi_match_table = intel_th_acpi_ids,
72+
},
73+
};
74+
75+
module_platform_driver(intel_th_acpi_driver);
76+
77+
MODULE_LICENSE("GPL v2");
78+
MODULE_DESCRIPTION("Intel(R) Trace Hub ACPI controller driver");
79+
MODULE_AUTHOR("Alexander Shishkin <[email protected]>");

drivers/hwtracing/intel_th/core.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub driver core
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -638,7 +630,8 @@ intel_th_subdevice_alloc(struct intel_th *th,
638630
thdev->output.port = -1;
639631
thdev->output.scratchpad = subdev->scrpd;
640632
} else if (subdev->type == INTEL_TH_SWITCH) {
641-
thdev->host_mode = host_mode;
633+
thdev->host_mode =
634+
INTEL_TH_CAP(th, host_mode_only) ? true : host_mode;
642635
th->hub = thdev;
643636
}
644637

@@ -737,7 +730,8 @@ static int intel_th_populate(struct intel_th *th)
737730
struct intel_th_device *thdev;
738731

739732
/* only allow SOURCE and SWITCH devices in host mode */
740-
if (host_mode && subdev->type == INTEL_TH_OUTPUT)
733+
if ((INTEL_TH_CAP(th, host_mode_only) || host_mode) &&
734+
subdev->type == INTEL_TH_OUTPUT)
741735
continue;
742736

743737
/*
@@ -813,7 +807,14 @@ intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
813807
struct resource *devres, unsigned int ndevres, int irq)
814808
{
815809
struct intel_th *th;
816-
int err;
810+
int err, r;
811+
812+
if (irq == -1)
813+
for (r = 0; r < ndevres; r++)
814+
if (devres[r].flags & IORESOURCE_IRQ) {
815+
irq = devres[r].start;
816+
break;
817+
}
817818

818819
th = kzalloc(sizeof(*th), GFP_KERNEL);
819820
if (!th)
@@ -935,9 +936,13 @@ EXPORT_SYMBOL_GPL(intel_th_trace_disable);
935936
int intel_th_set_output(struct intel_th_device *thdev,
936937
unsigned int master)
937938
{
938-
struct intel_th_device *hub = to_intel_th_device(thdev->dev.parent);
939+
struct intel_th_device *hub = to_intel_th_hub(thdev);
939940
struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver);
940941

942+
/* In host mode, this is up to the external debugger, do nothing. */
943+
if (hub->host_mode)
944+
return 0;
945+
941946
if (!hubdrv->set_output)
942947
return -ENOTSUPP;
943948

drivers/hwtracing/intel_th/debug.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub driver debugging
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#include <linux/types.h>

drivers/hwtracing/intel_th/debug.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* Intel(R) Trace Hub driver debugging
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#ifndef __INTEL_TH_DEBUG_H__

drivers/hwtracing/intel_th/gth.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub Global Trace Hub
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

drivers/hwtracing/intel_th/gth.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* Intel(R) Trace Hub Global Trace Hub (GTH) data structures
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#ifndef __INTEL_TH_GTH_H__

drivers/hwtracing/intel_th/intel_th.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* Intel(R) Trace Hub data structures
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#ifndef __INTEL_TH_H__
@@ -50,9 +42,11 @@ struct intel_th_output {
5042
/**
5143
* struct intel_th_drvdata - describes hardware capabilities and quirks
5244
* @tscu_enable: device needs SW to enable time stamping unit
45+
* @host_mode_only: device can only operate in 'host debugger' mode
5346
*/
5447
struct intel_th_drvdata {
55-
unsigned int tscu_enable : 1;
48+
unsigned int tscu_enable : 1,
49+
host_mode_only : 1;
5650
};
5751

5852
#define INTEL_TH_CAP(_th, _cap) ((_th)->drvdata ? (_th)->drvdata->_cap : 0)

drivers/hwtracing/intel_th/msu.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub Memory Storage Unit
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

drivers/hwtracing/intel_th/msu.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub Memory Storage Unit (MSU) data structures
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#ifndef __INTEL_TH_MSU_H__

drivers/hwtracing/intel_th/pci.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub pci driver
34
*
45
* Copyright (C) 2014-2015 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

drivers/hwtracing/intel_th/pti.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Intel(R) Trace Hub PTI output driver
34
*
45
* Copyright (C) 2014-2016 Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
146
*/
157

168
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

0 commit comments

Comments
 (0)