Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2933457pxy; Mon, 3 May 2021 11:11:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB1syXd3zQYeRimVsxyUl9gijzZAWzw0MVHUo1ZQpLowlCEDdmu7lAO3PIBreRJe1S4ZWs X-Received: by 2002:a17:903:248e:b029:ec:9c4f:765e with SMTP id p14-20020a170903248eb02900ec9c4f765emr22055052plw.17.1620065464673; Mon, 03 May 2021 11:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065464; cv=none; d=google.com; s=arc-20160816; b=P95ItdWhZmZgamwgQnyr89ks5s+5Goi2WQlszcqQemOnXsDEVmopqIoEONW1FdycIF aJoqrJkHod/ZLa1D3TTPYq8lQDMsgaDu1VFTa9lW4IUqdlnjLWp3m/pOmlvnXi3N0qj0 ofQAUeGYjqYjKnBHk8zzQ14QRAHWKnpjHb6x1ASWi+g+eoX3oZWY6aZcKxYNgufY5QeW ezJR6vrbg9HcUMCjL0tebaBc3N21AAlcRQg6LhbLvhkKlQXQLto6jMyO+0OHmOKhYBWJ Ma6uWfTwC8jJ565zC7H9Rz4CRcvcBnW6lUhRFV46qtADx8nJQ1SFqQJ0ipE2upg0YAZ2 8J2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=uuqfiplscz8tL1AG85dsCVML65qyBq7VxtDx/MN6lAA=; b=ijJaoJCD7WVA14xIVg879E8W7hxaeMzZH5ySAE28AnoP5llnSExnpFTYbGEdtmYQuk ILQYs/eMLj66Mmq2JJZICTBt3duc6HXtWd2k5McLcZXzRbpjzkIkIpE4+D/py6myFwGZ OFrgNAbu+dLAv1H6pz4jOTg/0XTLUTU4qcZ9J/u6eREIeEyrAVv87amIgLb0h9B+SZOD EUTHiJxVMUoiyVvZKKJ7fjAhCBPiTEYsBqt5aCuZh+5OwuaCaEte+4fkVwT1k+YrdQBl l1f6z9HGKon/iWmmDLEr1BZVsTNIYYBx/1ZzLfmWGD1gSG034JVhvuZ+evy8ATrNvp0r w8Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WSV00z25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si453920plf.317.2021.05.03.11.10.51; Mon, 03 May 2021 11:11:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WSV00z25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231158AbhECQUh (ORCPT + 99 others); Mon, 3 May 2021 12:20:37 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:58633 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbhECQUg (ORCPT ); Mon, 3 May 2021 12:20:36 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1620058782; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=uuqfiplscz8tL1AG85dsCVML65qyBq7VxtDx/MN6lAA=; b=WSV00z25LbK2o6nYedZtIe5UVykxiR62OsCKsKw/PpQwBaJB8RUHzNbhQw504HOjoVmaPMzy k34Meq37NN1mCnX9i8FfsTnjJcExo4DJk/yAxOs0mR2HZkJ5LGBsM2JE6SjROFv2hjUyNRcx FsWdtVf6g4mHfnHbA/zRvZTr8JA= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 6090229d8807bcde1dc45f8f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 03 May 2021 16:19:41 GMT Sender: schowdhu=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C5919C43460; Mon, 3 May 2021 16:19:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-525.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: schowdhu) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2AAD4C433F1; Mon, 3 May 2021 16:19:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2AAD4C433F1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=schowdhu@codeaurora.org From: Souradeep Chowdhury To: Andy Gross , Bjorn Andersson , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Sai Prakash Ranjan , Sibi Sankar , Rajendra Nayak , vkoul@kernel.org, Souradeep Chowdhury Subject: [PATCH V4 0/4] Add driver support for Data Capture and Compare Engine(DCC) for SM8150 Date: Mon, 3 May 2021 21:47:26 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DCC(Data Capture and Compare) is a DMA engine designed for debugging purposes.In case of a system crash or manual software triggers by the user the DCC hardware stores the value at the register addresses which can be used for debugging purposes.The DCC driver provides the user with sysfs interface to configure the register addresses.The options that the DCC hardware provides include reading from registers,writing to registers,first reading and then writing to registers and looping through the values of the same register. In certain cases a register write needs to be executed for accessing the rest of the registers, also the user might want to record the changing values of a register with time for which he has the option to use the loop feature. The options mentioned above are exposed to the user by sysfs files once the driver is probed.The details and usage of this sysfs files are documented in Documentation/ABI/testing/sysfs-driver-dcc. As an example let us consider a couple of debug scenarios where DCC has been proved to be effective for debugging purposes:- i)TimeStamp Related Issue On SC7180, there was a coresight timestamp issue where it would occasionally be all 0 instead of proper timestamp values. Proper timestamp: Idx:3373; ID:10; I_TIMESTAMP : Timestamp.; Updated val = 0x13004d8f5b7aa; CC=0x9e Zero timestamp: Idx:3387; ID:10; I_TIMESTAMP : Timestamp.; Updated val = 0x0; CC=0xa2 Now this is a non-fatal issue and doesn't need a system reset, but still needs to be rootcaused and fixed for those who do care about coresight etm traces. Since this is a timestamp issue, we would be looking for any timestamp related clocks and such. o we get all the clk register details from IP documentation and configure it via DCC config syfs node. Before that we set the current linked list. /* Set the current linked list */ echo 3 > /sys/bus/platform/devices/10a2000.dcc/curr_list /* Program the linked list with the addresses */ echo 0x10c004 > /sys/bus/platform/devices/10a2000.dcc/config echo 0x10c008 > /sys/bus/platform/devices/10a2000.dcc/config echo 0x10c00c > /sys/bus/platform/devices/10a2000.dcc/config echo 0x10c010 > /sys/bus/platform/devices/10a2000.dcc/config ..... and so on for other timestamp related clk registers /* Other way of specifying is in "addr len" pair, in below case it specifies to capture 4 words starting 0x10C004 */ echo 0x10C004 4 > /sys/bus/platform/devices/10a2000.dcc/config /* Enable DCC */ echo 1 > /sys/bus/platform/devices/10a2000.dcc/enable /* Run the timestamp test for working case */ /* Send SW trigger */ echo 1 > /sys/bus/platform/devices/10a2000.dcc/trigger /* Read SRAM */ cat /dev/dcc_sram > dcc_sram1.bin /* Run the timestamp test for non-working case */ /* Send SW trigger */ echo 1 > /sys/bus/platform/devices/10a2000.dcc/trigger /* Read SRAM */ cat /dev/dcc_sram > dcc_sram2.bin Get the parser from [1] and checkout the latest branch. /* Parse the SRAM bin */ python dcc_parser.py -s dcc_sram1.bin --v2 -o output/ python dcc_parser.py -s dcc_sram2.bin --v2 -o output/ Sample parsed output of dcc_sram1.bin: 03/14/21 Linux DCC Parser next_ll_offset : 0x1c ii)NOC register errors A particular class of registers called NOC which are functional registers was reporting errors while logging the values.To trace these errors the DCC has been used effectively. The steps followed were similar to the ones mentioned above. In addition to NOC registers a few other dependent registers were configured in DCC to monitor it's values during a crash. A look at the dependent register values revealed that the crash was happening due to a secured access to one of these dependent registers. All these debugging activity and finding the root cause was achieved using DCC. DCC parser is available at the following open source location https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/tools/tree/dcc_parser Changes in v4: *Implement all the comments on v3 of the patch. *Incorporate code change for handling multiple SoCs. *Incorporate code change for DCC_SRAM content to persist across warm reboots. *Fixed the issue with the Makefile in v3 of the patch. Souradeep Chowdhury (4): dt-bindings: Added the yaml bindings for DCC soc: qcom: dcc:Add driver support for Data Capture and Compare unit(DCC) MAINTAINERS: Add the entry for DCC(Data Capture and Compare) driver support arm64: dts: qcom: sm8150: Add Data Capture and Compare(DCC) support node Documentation/ABI/testing/sysfs-driver-dcc | 114 ++ .../devicetree/bindings/arm/msm/qcom,dcc.yaml | 40 + MAINTAINERS | 8 + arch/arm64/boot/dts/qcom/sm8150.dtsi | 6 + drivers/soc/qcom/Kconfig | 8 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/dcc.c | 1534 ++++++++++++++++++++ 7 files changed, 1711 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-dcc create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dcc.yaml create mode 100644 drivers/soc/qcom/dcc.c -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation