提交 503a839f 编写于 作者: A Alexander Shishkin 提交者: Yang Yingliang

intel_th: Wait until port is in reset before programming it

stable inclusion
from linux-4.19.198
commit c79fef7357e5930648d7d5991bdfedaca3eb89ad

--------------------------------

[ Upstream commit ab1afed7 ]

Some devices don't drain their pipelines if we don't make sure that
the corresponding output port is in reset before programming it for
a new trace capture, resulting in bits of old trace appearing in the
new trace capture. Fix that by explicitly making sure the reset is
asserted before programming new trace capture.
Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lore.kernel.org/r/20210621151246.31891-5-alexander.shishkin@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 d43fbe0c
...@@ -215,6 +215,22 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, ...@@ -215,6 +215,22 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR_RO(port); static DEVICE_ATTR_RO(port);
static void intel_th_trace_prepare(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);
if (hub->type != INTEL_TH_SWITCH)
return;
if (thdev->type != INTEL_TH_OUTPUT)
return;
pm_runtime_get_sync(&thdev->dev);
hubdrv->prepare(hub, &thdev->output);
pm_runtime_put(&thdev->dev);
}
static int intel_th_output_activate(struct intel_th_device *thdev) static int intel_th_output_activate(struct intel_th_device *thdev)
{ {
struct intel_th_driver *thdrv = struct intel_th_driver *thdrv =
...@@ -235,6 +251,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev) ...@@ -235,6 +251,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
if (ret) if (ret)
goto fail_put; goto fail_put;
intel_th_trace_prepare(thdev);
if (thdrv->activate) if (thdrv->activate)
ret = thdrv->activate(thdev); ret = thdrv->activate(thdev);
else else
......
...@@ -513,6 +513,21 @@ static void gth_tscu_resync(struct gth_device *gth) ...@@ -513,6 +513,21 @@ static void gth_tscu_resync(struct gth_device *gth)
iowrite32(reg, gth->base + REG_TSCU_TSUCTRL); iowrite32(reg, gth->base + REG_TSCU_TSUCTRL);
} }
static void intel_th_gth_prepare(struct intel_th_device *thdev,
struct intel_th_output *output)
{
struct gth_device *gth = dev_get_drvdata(&thdev->dev);
int count;
/*
* Wait until the output port is in reset before we start
* programming it.
*/
for (count = GTH_PLE_WAITLOOP_DEPTH;
count && !(gth_output_get(gth, output->port) & BIT(5)); count--)
cpu_relax();
}
/** /**
* intel_th_gth_enable() - enable tracing to an output device * intel_th_gth_enable() - enable tracing to an output device
* @thdev: GTH device * @thdev: GTH device
...@@ -734,6 +749,7 @@ static struct intel_th_driver intel_th_gth_driver = { ...@@ -734,6 +749,7 @@ static struct intel_th_driver intel_th_gth_driver = {
.assign = intel_th_gth_assign, .assign = intel_th_gth_assign,
.unassign = intel_th_gth_unassign, .unassign = intel_th_gth_unassign,
.set_output = intel_th_gth_set_output, .set_output = intel_th_gth_set_output,
.prepare = intel_th_gth_prepare,
.enable = intel_th_gth_enable, .enable = intel_th_gth_enable,
.disable = intel_th_gth_disable, .disable = intel_th_gth_disable,
.driver = { .driver = {
......
...@@ -134,6 +134,7 @@ intel_th_output_assigned(struct intel_th_device *thdev) ...@@ -134,6 +134,7 @@ intel_th_output_assigned(struct intel_th_device *thdev)
* @remove: remove method * @remove: remove method
* @assign: match a given output type device against available outputs * @assign: match a given output type device against available outputs
* @unassign: deassociate an output type device from an output port * @unassign: deassociate an output type device from an output port
* @prepare: prepare output port for tracing
* @enable: enable tracing for a given output device * @enable: enable tracing for a given output device
* @disable: disable tracing for a given output device * @disable: disable tracing for a given output device
* @irq: interrupt callback * @irq: interrupt callback
...@@ -155,6 +156,8 @@ struct intel_th_driver { ...@@ -155,6 +156,8 @@ struct intel_th_driver {
struct intel_th_device *othdev); struct intel_th_device *othdev);
void (*unassign)(struct intel_th_device *thdev, void (*unassign)(struct intel_th_device *thdev,
struct intel_th_device *othdev); struct intel_th_device *othdev);
void (*prepare)(struct intel_th_device *thdev,
struct intel_th_output *output);
void (*enable)(struct intel_th_device *thdev, void (*enable)(struct intel_th_device *thdev,
struct intel_th_output *output); struct intel_th_output *output);
void (*disable)(struct intel_th_device *thdev, void (*disable)(struct intel_th_device *thdev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册