Received: by 10.223.185.116 with SMTP id b49csp5960988wrg; Wed, 7 Mar 2018 22:42:53 -0800 (PST) X-Google-Smtp-Source: AG47ELtX8AgYbmcTqO8fGBF4InLc/JrBZI7/1hXh7rflysfbziQdBeNvtTe72+jd/kjCnOODQ9vw X-Received: by 2002:a17:902:b606:: with SMTP id b6-v6mr22568032pls.93.1520491373694; Wed, 07 Mar 2018 22:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491373; cv=none; d=google.com; s=arc-20160816; b=SoHNtwhGOW5pnrlg0kAsa6y1px5Cm7jzECJQ6UtXEY8omQ1MoBrsjWT8CFCiobO3nv PRbQwpwidrDRgdtm+46NNf3YzTeRfcMFF8W0k9CF6ZppFIWcGvPLy3QQ0+syrX4hl4Tj SCARDRzmpKa9F4ZNrIXP1Dvu25b5vkGB87pJrMKjIYv7zHAtUBk8hAbIsq3DE/hNUZ2z G4BzlmhrJr+GE8hKvt+6wvguzcHzvsGGN9DhgTtEsGx6gziBMmOxNRaPKcPfw/xHWT/r ebHqmv30XgDhP+O+1Sd5LimAKsA6QZrr36mIprS8MJqrj9igX6m0mj/3Jx9qrPQ2fyHH zsjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=t0My6eCNx4Fop/4QYpq7twaSzB58j26I8bUKZn0TUII=; b=LlodZ6gfz1FakW08ZcO1Bl11VZmez0d7RtVM7lTTsJ8/3E4za3FpVc5/iBAgUMAMuR ntbUe49yYAEyz0wxjwKzowwCMQ6v9RLaPmHvPLqphpHPGdX1A0he5GpKfjVKcYuYGQ1Q nivU7oJw9z3Xedc+Q3d/oO+Z7kvBENa2v6q/4uTsxWMRn2VVFsHOGv1cqrZMzS2Pb6vI f1yGlOOIoHKS890S1M84XHeod3x6tVDPr5G7KF6yPcxxkHBc68l0WPf0DpOuTuOqdNNo GpmNmWBYNrUtL6buel+kfx18MSQDkwZJVZxQAcoUY2jQ5rQEY+8S+9xAJZjXCnfwdP4s lfmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LDPrjsSa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c15si15093678pfm.199.2018.03.07.22.42.39; Wed, 07 Mar 2018 22:42:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LDPrjsSa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965380AbeCHGl0 (ORCPT + 99 others); Thu, 8 Mar 2018 01:41:26 -0500 Received: from mail-sn1nam01on0106.outbound.protection.outlook.com ([104.47.32.106]:14491 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965292AbeCHE7H (ORCPT ); Wed, 7 Mar 2018 23:59:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=t0My6eCNx4Fop/4QYpq7twaSzB58j26I8bUKZn0TUII=; b=LDPrjsSajzR7ShINoqOZ8FGfB5f/lfCZ4rnbF77/gxLVPBmA1RQdf4asGXPKfkZdeLMLNkKFps2gYbAJX6TYFNTgASSXSgIlltnRbbM6ttW7vfrslGMzTVihB8RygA+iuk9+10TlbKOQGDZJszUUQd1oXyEfdmBqeYDMP7Apd3E= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:59:00 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:59:00 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Robert Walker , Mathieu Poirier , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 45/67] coresight: Fix disabling of CoreSight TPIU Thread-Topic: [PATCH AUTOSEL for 4.14 45/67] coresight: Fix disabling of CoreSight TPIU Thread-Index: AQHTtpoCLfBW9vOLdkejNDY+6VcdnQ== Date: Thu, 8 Mar 2018 04:57:51 +0000 Message-ID: <20180308045641.7814-45-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:+h8u6jchjqWp2By56I6iygDIPj4OCZDZB+tCDPaGiECAvrEaojJfgBml3uRsKCCpDJYRkLpEanH0q/auKUJrs06sQPAj5TJhALzSfVFMYmJ/rYtluStASXkCSuMBMXz+Foex0oWHWDSOdv2TRDZAPOJstTGXFg7l7xJCeHNrvobVN0CtrtJ070IXedYvRTEwLGruS91fDwkVIyGXVFI9+/2lrj+NH6Ks7qxbC5B8y5IWvg4epdJJtpSfzCSYxaIR;20:jN+tt8vVpaZIvn1ZI3qRiDPnjq3ojmLOrIPb+DpafM6FoRPGFdWiV+qe5FUzh2FNQW8w97yHq3HuKG+8c0W6yHPzNIrxUJzfxKLikhonFUJB3mo7spre71f4zN4ijrdaDnvJtyZ89nQtCHWQQEeHdmLmFxiitr5++dhxUrAbK5k= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 99620a20-bacb-4717-e430-08d584b14e8d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(396003)(366004)(39860400002)(39380400002)(346002)(189003)(199004)(6116002)(53936002)(1076002)(107886003)(3846002)(3660700001)(10090500001)(6666003)(2950100002)(2906002)(6512007)(99286004)(8936002)(6486002)(76176011)(6506007)(68736007)(59450400001)(316002)(110136005)(81156014)(81166006)(8676002)(54906003)(3280700002)(2900100001)(6436002)(97736004)(72206003)(25786009)(10290500003)(86612001)(4326008)(305945005)(7736002)(66066001)(22452003)(478600001)(5660300001)(86362001)(14454004)(106356001)(36756003)(102836004)(5250100002)(105586002)(26005)(2501003)(186003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vZtJ257VxRP3ukb8CrH2cR4sXowgn+rAo8WEcGPwPKTgUkRWLUB8wYzfhRg3g2U2ll67rtXgtZ0LWZrNy0fV1OrtxTHdrOhNVUAGTD3IOdGA5Io8UYKSgyNmBSnJanjqFeXpHLkKKInpvLViHm7sWtEPClAJgDHJ1jDLBoTusaGsNMoEnt6xCNhx++j0G9tn3MzDZrp0dcFw9Fdx6xweZSpNPkOnQxJQLzmYTmJ22anFthSOyCPv9i9hYf/88FuKRlrPnafntAEhm5U6W8BaJB30YY0xZZ7Ia6gVzHnAIrn6lyx5HlJLdWu780hTDc1IJUlPxwkdhxRNnsuQklT/0Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99620a20-bacb-4717-e430-08d584b14e8d X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:51.1765 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Walker [ Upstream commit 11595db8e17faaa05fadc25746c870e31276962f ] The CoreSight TPIU should be disabled when tracing to other sinks to allow them to operate at full bandwidth. This patch fixes tpiu_disable_hw() to correctly disable the TPIU by configuring the TPIU to stop on flush, initiating a manual flush, waiting for the flush to complete and then waits for the TPIU to indicate it has stopped. Signed-off-by: Robert Walker Tested-by: Mike Leach Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtraci= ng/coresight/coresight-tpiu.c index d7a3e453016d..735dca089389 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -46,8 +46,11 @@ #define TPIU_ITATBCTR0 0xef8 =20 /** register definition **/ +/* FFSR - 0x300 */ +#define FFSR_FT_STOPPED BIT(1) /* FFCR - 0x304 */ #define FFCR_FON_MAN BIT(6) +#define FFCR_STOP_FI BIT(12) =20 /** * @base: memory mapped base address for this component. @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdat= a) { CS_UNLOCK(drvdata->base); =20 - /* Clear formatter controle reg. */ - writel_relaxed(0x0, drvdata->base + TPIU_FFCR); + /* Clear formatter and stop on flush */ + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR); /* Generate manual flush */ - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR); + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR); + /* Wait for flush to complete */ + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0); + /* Wait for formatter to stop */ + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1); =20 CS_LOCK(drvdata->base); } --=20 2.14.1