Skip to content

Commit

Permalink
Merge tag 'stm-intel_th-for-greg-20180329' of git://git.kernel.org/pu…
Browse files Browse the repository at this point in the history
…b/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
  • Loading branch information
gregkh committed Mar 29, 2018
2 parents 45ea83f + 72ef0f2 commit 86f690e
Show file tree
Hide file tree
Showing 27 changed files with 172 additions and 200 deletions.
5 changes: 5 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6244,6 +6244,11 @@ F: Documentation/hw_random.txt
F: drivers/char/hw_random/
F: include/linux/hw_random.h

HARDWARE TRACING FACILITIES
M: Alexander Shishkin <[email protected]>
S: Maintained
F: drivers/hwtracing/

HARDWARE SPINLOCK CORE
M: Ohad Ben-Cohen <[email protected]>
M: Bjorn Andersson <[email protected]>
Expand Down
4 changes: 1 addition & 3 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
7 changes: 7 additions & 0 deletions drivers/hwtracing/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
menu "HW tracing support"

source "drivers/hwtracing/stm/Kconfig"

source "drivers/hwtracing/intel_th/Kconfig"

endmenu
12 changes: 12 additions & 0 deletions drivers/hwtracing/intel_th/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions drivers/hwtracing/intel_th/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
79 changes: 79 additions & 0 deletions drivers/hwtracing/intel_th/acpi.c
Original file line number Diff line number Diff line change
@@ -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 <linux/types.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/sysfs.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>

#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 <[email protected]>");
31 changes: 18 additions & 13 deletions drivers/hwtracing/intel_th/core.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -638,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;
}

Expand Down Expand Up @@ -737,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;

/*
Expand Down Expand Up @@ -813,7 +807,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)
Expand Down Expand Up @@ -935,9 +936,13 @@ 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);

/* In host mode, this is up to the external debugger, do nothing. */
if (hub->host_mode)
return 0;

if (!hubdrv->set_output)
return -ENOTSUPP;

Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/debug.c
Original file line number Diff line number Diff line change
@@ -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 <linux/types.h>
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/debug.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/gth.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/gth.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
14 changes: 4 additions & 10 deletions drivers/hwtracing/intel_th/intel_th.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down Expand Up @@ -50,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)
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/msu.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/msu.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/pci.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 1 addition & 9 deletions drivers/hwtracing/intel_th/pti.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit 86f690e

Please sign in to comment.