From patchwork Fri Jan 20 00:51:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13109024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D84DC38142 for ; Fri, 20 Jan 2023 00:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W7+BouQ+ATXdNhGWWfR8/NsLQiz8/3C9VHNUauxmmDU=; b=Vr8svHP8TS+V5l SzQsVXrNfkygYvd/B6uxddMPAzQjwGfU//UqPSZicVPvNPczC2g1Gr8aMHsCFi4i6g+W4bhwWaJFR kiNgDR4mdqfofrlAzeTSkOZgZg54Vigi3dMmW0twqRRnBArywNOmq/vSlWvg6uGC1dEuRvUV8U3HW erVtREG68MzXts+rROMenU70ngJAqEpGso6okMPWs0tSqYjeFa17Y3/TLh6Q99GW1oGCDRGvhsH3G bq+TDAvM0+3AwwBgcNl+9REFKbrNFbjJS7R7auT/iOfmr26J7dvkCDI3hAy2UlbYX4s505Hglxr0g Y982CAflEMU1y0YO3p7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIfe9-007obc-7Z; Fri, 20 Jan 2023 00:52:45 +0000 Received: from mail-bn1nam02on2103.outbound.protection.outlook.com ([40.107.212.103] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIfdo-007oXt-Pv for linux-arm-kernel@lists.infradead.org; Fri, 20 Jan 2023 00:52:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nbl5eCXBhbupQLxBjdTfcbBiGnrfU7RyRTBrJqQ25qmO2jGdAro1OS95C6zTZT2cJCTHo2g4XkP6CadHe4hL8gjVxw35iJFfVC8xffKEmFxr+YYXFWobL7YDiHFh0vGAXHPZNGjTF71SM8IF3jvyfoFypSWJLmwjn56xZAIJcsAxAjMZKINFGmFgwTQBM4z+vu2arGfhWdLLi8bcZFxJBiGH2wALw/BUeVwiGiKM8Btt4AtE4eU6hgH6cqo1N3qMFpYbHUNcxhPiRLvo7XsostmrUcR3GXuH7E7g4/Pvou3KKiPQha407QF+rn2ymmAo33b6obsQNHYZHp6Ps6RyHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bSUw8EJMKsO5ZrDBFVE2HTQ2RmU7dLewulN9sKUbgPo=; b=ZLSsf7Ezpc92zk6TBhrPX11aT/i98NtaTptWQPG+F7wLXxWDZOIHUZfWU6lCoO5KCF7hh/B6dHTjYTvHc3mcGYUZ+qO3G+1dgu441iZe0tUQZmoOJxg4CHoo8PAUBwHVmrkhv8qF4SQZ7XNP/EUxNVQQv7s/X64Se2xfjYp4mNUmloWI3RaWor+GOSC29yIKYKijnm+MwZRoEGrdGENBWH5ahaRhBX/IjJ9c5KUvzY2fByf86f3uEfV2C3HFTp83lUksAaPOeMNaMeoaH9J/oxT1sT/syPrjEQAWJmbQHRoY2cNzbdsirrPbVLkk5mUuZcto8Fm0bI8Kl6xgrcasSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bSUw8EJMKsO5ZrDBFVE2HTQ2RmU7dLewulN9sKUbgPo=; b=eTknfgg0V2ghhjJNVaAGJpeFaMVWRfdeozOULLGDkjoE5q/mTafgQ4T7ED7yidJLbYsRG+sm14jDBDnKpgQxlpsSeqUdw5yi8e4D/3OOy8sj0m9UEOolno7bGzveJU1QHNnv8P5tCytT14wF5kvkn0F+IUpktAp8jVETLtlEQY0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SN2PR01MB2143.prod.exchangelabs.com (2603:10b6:804:d::13) by SN6PR0102MB3407.prod.exchangelabs.com (2603:10b6:805:11::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Fri, 20 Jan 2023 00:52:20 +0000 Received: from SN2PR01MB2143.prod.exchangelabs.com ([fe80::eef8:5973:baee:184c]) by SN2PR01MB2143.prod.exchangelabs.com ([fe80::eef8:5973:baee:184c%12]) with mapi id 15.20.5986.023; Fri, 20 Jan 2023 00:52:20 +0000 From: Steve Clevenger To: mathieu.poirier@linaro.org, suzuki.poulose@arm.com Cc: mike.leach@linaro.org, leo.yan@linaro.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] coresight etm4x: Add 32-bit read/write option to split 64-bit words Date: Thu, 19 Jan 2023 17:51:55 -0700 Message-Id: <126be7005569dadf5bb8970c45843848134828f7.1674174972.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR04CA0008.namprd04.prod.outlook.com (2603:10b6:610:52::18) To SN2PR01MB2143.prod.exchangelabs.com (2603:10b6:804:d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN2PR01MB2143:EE_|SN6PR0102MB3407:EE_ X-MS-Office365-Filtering-Correlation-Id: 7aaa2b50-1819-4858-d136-08dafa8095a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Of6b897sjQNtmI3NadvF63X6CSG6QMRHMBxyyQcsRunenGEkEwzuehUqtIrJU2J5WI8UmhAaZ9Jp8ZRq23pBWNsRk4rkn4Sp4vEal3inwqqiPs/AoZyG/O9hz7WdM3wbeECTwIdLR9XBBo3d11UGob+PsJQOqWSABsmiTL0HDpJchYyepSHTh2+2O/uLj717nyjPMVhg6iWLwDU0+lRu4AAwxSfzNfjUZtXa8qbIQzVeUa3Tgd5t5PsnDzuDMhEDu17StP98/MTJNpvvCN692yUDr7YjIS7P+YKS9hQqptGiiASEfk+cTyLSY1t8UhDzN0WmwjsRnw7i7h9K8oCG0YRDoDQCaFfyFXv+4fNdM0L3p/IXVWtJqbFjmvtj+wUw7MneKpaDtUUHWgb78EWZL7yfzHm0rZWrSzzXG/9StEBv8zonlvZ32ahMxHbo7PamreMkY80AO+K5zCWL7tgoTLdTxMrJAzxV9jR79bN0Lhil8E8UD4B/J0ySqQGlcqusmPd+JQKohwJ4fljOIAvnUQIG6Ebvx21fdsvGzCssuzs3SDPJSyddhFLsDNibLnpnghqvEiRBDa4pGJ4Ne70ceD9xLyM0Bi/mFZerw+vfvmj/iLtpuGdCVEC0hkbyTtqTVMjNvcLC1mou5sLjUxnVCUr688ACUqcVkPY1p72aLQnMje1eAdxSkqkmsgX3w+6wblwCJ7Mdl4wN3F3jXSAH7TggnPFdHTN2oKCoOPcTU5R+Vn0FDSFFTnw0m4SZdqtZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN2PR01MB2143.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(366004)(39850400004)(376002)(396003)(136003)(451199015)(26005)(66946007)(186003)(478600001)(966005)(6506007)(6486002)(6512007)(6666004)(52116002)(8676002)(4326008)(66476007)(41300700001)(8936002)(316002)(2616005)(83380400001)(2906002)(66556008)(38100700002)(5660300002)(86362001)(38350700002)(32563001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bLZlVhRf++CNlQAPCqpKiUq6+OQtfkZ2u22VWTvjoI6bnm7MslYohs25p5gFnWXM8+9yEry8mt/MgviSlMWG4u/v54uWWITI+YMrIPYyyiYTenBlkhAocnXW9dgWrbkP8Q3A+pab9m6Ww88zJsOYjgxR8FnjPWw7hg6ixnxE8MT2/5R9DtjJli828YzJlbrsqoU/22qM2Yx3WhWeMhCCFxnh1XcFD2b5eTMCfqvTHpXvD6s8RXdLTJA7qfeE7MgIVwzBzKpIoJJ3RDxw/oMJW4lx6A9paN/lV6VdfLcbwGwXizwtEsT4cJQIilFyhYS18wBj5RJSAlJ/jsp9t65DBHYVLx+wm6l89NIOhzhuc8HJgKus4wgMi7BCu0uziNmV/IVa0dnshsQkI0rQrtsUVnHjt9kyVmYa42nBwk0pfbCjtZ3DvDsFCgoHDXn/+Rtg60Oo1S25NEQAXTtBWkjl6c4ujd8p3ETLeA+qEPighrUswltFXH3lnS9zSKnBguBspwOPns8AQ1WsnCQxldzHh8rTUp3g68J8VHq+ky/A4H4ZGv11nWr5TRPDRW4gmzz6Wor/jCbnDE5m715W6jmp7UuE0ugaR82eFhBI4baH5MUuaMGpDtKVmfgrrORa7GDkCkhtM1MSFm+k4QRFY0aqse2ub0wXjQht6RQ3wAsNjHytDoNVllAjUA37pRg/d2Q9h2r7DpEl8drfAe0p7lBTT6emNnPWAMfw6LPcW5ZZlKCK2ST7pvEIxcqVw29BHPTC/UJ6ECLBXeRRcRccVOKLjflSd3/qCJtJwW8BSDR6hICR3DeiC5OgNqGAQJao7pdHYjAdzG2tTYLxwHWBBHDneoQDJsIIwnq0fnxhswk49oZkzILv1EwLnrSda+Lc22ns3mcq1iOu2DsGb1nUIYAVCi3Apoji5gjbUy/062hcHHjSj/VnU03orHqi9G2U9v0lnNFh8ZD1zn0xr8F1ekgOob0gaBT+OlH+8O5BlpIdth3BSKOCe0m3j4RTx1J2RzUxgDodOElRn+fgSwcIsW8uJqynopW0AZEVJe00JeW0JPkO0DhOqeSN1mVFACC86FQQaUYcl39w8iaojsV1vwJzf+DO61I0ZWlRn5OLMA7Ct2G+JzcHw3YVkKsorUb+DQcuCpr1sVu58NbHulA9jxwc2RP1WBkkr1HP7g9nEOciDaoSkRaKHqIKK9iDxlsZiCqifHYGhV4p3vG6kfbUnGZTKVyTb7cm2eJllJ4eRiFSCFGlQR6IRiPdzyy8AG3NEhIzThf2EhcL7UApEj3lOX9WKNdS3pUX/MQ3dk3+J03GeiFzFOWkMUyITnaz3tcHuixNmq4KiJWl53T6CpJ1WbkbSniwO/p2jhUgqBwAXfWd/x/Uo3tihJi/pW9EpakovX66BOvoDxsuINzez4yndt8lhhmPdPQ7752IVSa8f5lM2rgt915Ab08mRXjejvxH7SjXYpLbIQWrhbsHzqxfeZTnpEWh71I0ODOS0Pg9OJ5nBPF3zuAO+be4pGPXbQiJuQtDKLNm8k9GQdmjXRU37DcMu/wJKUb17evvKmukY108I/oGulCex8glboQApuJkF3ZWrJ6KOYeDvICL3hMsxQCcepthhqI/CEGuOtTtSGsCuWYS2j/Nwz1tCTQWZuhW37HK X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7aaa2b50-1819-4858-d136-08dafa8095a5 X-MS-Exchange-CrossTenant-AuthSource: SN2PR01MB2143.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2023 00:52:20.1182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0p4GXoCZNJ/W0X1fUxtmXmQnunb5AoUhnS3W0PXGDI0P7jJ1fun++/Snrv8998n48HvoFy/y3mRuY+FtOdAWxH08c09Q/s2FC4d7ET7ecOFHOv383OIrNJtWz0aF8/Yw X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR0102MB3407 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230119_165224_872099_A1759F33 X-CRM114-Status: GOOD ( 17.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add 32-bit read/write access option for Ampere ETMv4.6 64-bit registers. Ampere Computing erratum AC03_DEBUG_10 describes a design decision where 64-bit read/write access is not supported for the ETMv4.6 implementation. These 64-bit registers must be accessed as 2 ea. 32-bit registers. AC03_DEBUG_10 is described in the AmpereOne Developer Errata: https://solutions.amperecomputing.com/customer-connect/products/AmpereOne-device-documentation Fix drvdata->nr_addr_cmp for() loop range bug to drvdata->nr_addr_cmp * 2 in etm_enable_hw. Signed-off-by: Steve Clevenger --- .../coresight/coresight-etm4x-core.c | 81 ++++++++++++++----- drivers/hwtracing/coresight/coresight-etm4x.h | 32 ++++++++ 2 files changed, 93 insertions(+), 20 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 533be1928a09..bf4daa649cdf 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -452,18 +452,31 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) if (etm4x_sspcicrn_present(drvdata, i)) etm4x_relaxed_write32(csa, config->ss_pe_cmp[i], TRCSSPCICRn(i)); } - for (i = 0; i < drvdata->nr_addr_cmp; i++) { - etm4x_relaxed_write64(csa, config->addr_val[i], TRCACVRn(i)); - etm4x_relaxed_write64(csa, config->addr_acc[i], TRCACATRn(i)); + for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { + if (drvdata->no_quad_mmio) { + etm4x_split_write64(csa, config->addr_val[i], TRCACVRn(i)); + etm4x_split_write64(csa, config->addr_acc[i], TRCACATRn(i)); + } else { + etm4x_relaxed_write64(csa, config->addr_val[i], TRCACVRn(i)); + etm4x_relaxed_write64(csa, config->addr_acc[i], TRCACATRn(i)); + } + } + for (i = 0; i < drvdata->numcidc; i++) { + if (drvdata->no_quad_mmio) + etm4x_split_write64(csa, config->ctxid_pid[i], TRCCIDCVRn(i)); + else + etm4x_relaxed_write64(csa, config->ctxid_pid[i], TRCCIDCVRn(i)); } - for (i = 0; i < drvdata->numcidc; i++) - etm4x_relaxed_write64(csa, config->ctxid_pid[i], TRCCIDCVRn(i)); etm4x_relaxed_write32(csa, config->ctxid_mask0, TRCCIDCCTLR0); if (drvdata->numcidc > 4) etm4x_relaxed_write32(csa, config->ctxid_mask1, TRCCIDCCTLR1); - for (i = 0; i < drvdata->numvmidc; i++) - etm4x_relaxed_write64(csa, config->vmid_val[i], TRCVMIDCVRn(i)); + for (i = 0; i < drvdata->numvmidc; i++) { + if (drvdata->no_quad_mmio) + etm4x_split_write64(csa, config->vmid_val[i], TRCVMIDCVRn(i)); + else + etm4x_relaxed_write64(csa, config->vmid_val[i], TRCVMIDCVRn(i)); + } etm4x_relaxed_write32(csa, config->vmid_mask0, TRCVMIDCCTLR0); if (drvdata->numvmidc > 4) etm4x_relaxed_write32(csa, config->vmid_mask1, TRCVMIDCCTLR1); @@ -1670,8 +1683,13 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) } for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { - state->trcacvr[i] = etm4x_read64(csa, TRCACVRn(i)); - state->trcacatr[i] = etm4x_read64(csa, TRCACATRn(i)); + if (drvdata->no_quad_mmio) { + state->trcacvr[i] = etm4x_split_read64(csa, TRCACVRn(i)); + state->trcacatr[i] = etm4x_split_read64(csa, TRCACATRn(i)); + } else { + state->trcacvr[i] = etm4x_read64(csa, TRCACVRn(i)); + state->trcacatr[i] = etm4x_read64(csa, TRCACATRn(i)); + } } /* @@ -1681,11 +1699,19 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) * unit") of ARM IHI 0064D. */ - for (i = 0; i < drvdata->numcidc; i++) - state->trccidcvr[i] = etm4x_read64(csa, TRCCIDCVRn(i)); + for (i = 0; i < drvdata->numcidc; i++) { + if (drvdata->no_quad_mmio) + state->trccidcvr[i] = etm4x_split_read64(csa, TRCCIDCVRn(i)); + else + state->trccidcvr[i] = etm4x_read64(csa, TRCCIDCVRn(i)); + } - for (i = 0; i < drvdata->numvmidc; i++) - state->trcvmidcvr[i] = etm4x_read64(csa, TRCVMIDCVRn(i)); + for (i = 0; i < drvdata->numvmidc; i++) { + if (drvdata->no_quad_mmio) + state->trcvmidcvr[i] = etm4x_split_read64(csa, TRCVMIDCVRn(i)); + else + state->trcvmidcvr[i] = etm4x_read64(csa, TRCVMIDCVRn(i)); + } state->trccidcctlr0 = etm4x_read32(csa, TRCCIDCCTLR0); if (drvdata->numcidc > 4) @@ -1799,15 +1825,28 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) } for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { - etm4x_relaxed_write64(csa, state->trcacvr[i], TRCACVRn(i)); - etm4x_relaxed_write64(csa, state->trcacatr[i], TRCACATRn(i)); + if (drvdata->no_quad_mmio) { + etm4x_split_write64(csa, state->trcacvr[i], TRCACVRn(i)); + etm4x_split_write64(csa, state->trcacatr[i], TRCACATRn(i)); + } else { + etm4x_relaxed_write64(csa, state->trcacvr[i], TRCACVRn(i)); + etm4x_relaxed_write64(csa, state->trcacatr[i], TRCACATRn(i)); + } } - for (i = 0; i < drvdata->numcidc; i++) - etm4x_relaxed_write64(csa, state->trccidcvr[i], TRCCIDCVRn(i)); + for (i = 0; i < drvdata->numcidc; i++) { + if (drvdata->no_quad_mmio) + etm4x_split_write64(csa, state->trccidcvr[i], TRCCIDCVRn(i)); + else + etm4x_relaxed_write64(csa, state->trccidcvr[i], TRCCIDCVRn(i)); + } - for (i = 0; i < drvdata->numvmidc; i++) - etm4x_relaxed_write64(csa, state->trcvmidcvr[i], TRCVMIDCVRn(i)); + for (i = 0; i < drvdata->numvmidc; i++) { + if (drvdata->no_quad_mmio) + etm4x_split_write64(csa, state->trcvmidcvr[i], TRCVMIDCVRn(i)); + else + etm4x_relaxed_write64(csa, state->trcvmidcvr[i], TRCVMIDCVRn(i)); + } etm4x_relaxed_write32(csa, state->trccidcctlr0, TRCCIDCCTLR0); if (drvdata->numcidc > 4) @@ -2047,8 +2086,10 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) * isolates the manufacturer JEP106 ID in the PID. * TRCPIDR2 (JEDC|DES_1) << 16 | TRCPIDR1 (DES_0) << 8) */ - if ((init_arg.pid & 0x000FF000) == 0x00096000) + if ((init_arg.pid & 0x000FF000) == 0x00096000) { drvdata->mmio_external = true; + drvdata->no_quad_mmio = true; + } /* * Serialize against CPUHP callbacks to avoid race condition diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index cf4f9f2e1807..0650bcdff410 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -1016,6 +1016,7 @@ struct etmv4_save_state { * the trace unit. * @arch_features: Bitmap of arch features of etmv4 devices. * @mmio_external: True if ETM considers MMIO an external access. + * @no_quad_mmio: True if ETM does not support 64-bit (quad) access. */ struct etmv4_drvdata { void __iomem *base; @@ -1069,6 +1070,7 @@ struct etmv4_drvdata { bool skip_power_up; DECLARE_BITMAP(arch_features, ETM4_IMPDEF_FEATURE_MAX); bool mmio_external; + bool no_quad_mmio; }; /* Address comparator access types */ @@ -1093,6 +1095,36 @@ void etm4_config_trace_mode(struct etmv4_config *config); u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit); void etm4x_sysreg_write(u64 val, u32 offset, bool _relaxed, bool _64bit); +/* 64-bit aligned to convert 64-bit access to 2 ea. 32-bit access */ +#pragma pack(push, 8) + +struct etm_quad_split { + u32 lsw; + u32 msw; +}; + +#pragma pack(pop) + +static inline u64 etm4x_split_read64(struct csdev_access *csa, unsigned int offset) +{ + struct etm_quad_split container; + + container.lsw = etm4x_read32(csa, offset); + container.msw = etm4x_read32(csa, offset + sizeof(u32)); + + return *(u64 *) &container; +} + +static inline void etm4x_split_write64(struct csdev_access *csa, u64 quad, unsigned int offset) +{ + struct etm_quad_split container; + + *(u64 *) &container = quad; + + etm4x_relaxed_write32(csa, container.lsw, offset); + etm4x_relaxed_write32(csa, container.msw, offset + sizeof(u32)); +} + static inline bool etm4x_is_ete(struct etmv4_drvdata *drvdata) { return drvdata->arch >= ETM_ARCH_ETE;