From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32829C433DB for ; Thu, 4 Feb 2021 13:02:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB18464F44 for ; Thu, 4 Feb 2021 13:02:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB18464F44 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eYp1w+vWG0YHPm6N7DK/2KrW5XG1WANMA1vGGDQZicc=; b=h6qBLJjMi22SemkEORhN7uKPG Mnq743MFHNapkfmAljCeV+Jjwz5LUcnA6Kk2t7DEycGd02ILFn+/3UFntqfZ7sjLVxgl3yXmjkjoB oar6uQSJRSTJd8H6ypv9Npro1eTt6wlpDJHI+jlwg4ME7dekraSSuZxLqKptNHeUxnqPbs+E92enL UqznrS84skFtbQlINia5CMpkNlUjS6geGMWBs1HGwRWyTGozJkjAPzJeXbxXRfBkif/AX5gbv+8r3 lMN3u9uw2iFzq1iNxShTvqWFKNN9LCNjEMUFjvxnhd0xRfIQhjaKkaelXrr+xdedZF1KViTO7+moa cjBhU+cEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7eGQ-0003yh-9E; Thu, 04 Feb 2021 13:01:38 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7eGM-0003ww-0R for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2021 13:01:36 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DWdtk6XTQz1644Z; Thu, 4 Feb 2021 20:59:58 +0800 (CST) Received: from [127.0.0.1] (10.40.188.87) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Thu, 4 Feb 2021 21:01:09 +0800 Subject: Re: [RFC PATCH 0/3] iommu/arm-smmu-v3: Add debug interfaces for SMMUv3 To: Will Deacon , Robin Murphy References: <1611911184-116261-1-git-send-email-wangzhou1@hisilicon.com> <5001d8b3-ed2c-f3e3-80c5-d0b6b5df634c@hisilicon.com> <20210203213851.GA19847@willie-the-truck> From: Zhou Wang Message-ID: <79449b02-49b4-35bd-90e0-c62db8b754ff@hisilicon.com> Date: Thu, 4 Feb 2021 21:01:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20210203213851.GA19847@willie-the-truck> X-Originating-IP: [10.40.188.87] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210204_080135_063437_6178FECE X-CRM114-Status: GOOD ( 21.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, chenxiang66@hisilicon.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021/2/4 5:38, Will Deacon wrote: > On Wed, Feb 03, 2021 at 11:15:18AM +0800, Zhou Wang wrote: >> On 2021/1/29 17:06, Zhou Wang wrote: >>> This RFC series is the followed patch of this discussion: >>> https://www.spinics.net/lists/arm-kernel/msg866187.html. >>> >>> Currently there is no debug interface about SMMUv3 driver, which makes it >>> not convenient when we want to dump some information, like the value of >>> CD/STE, S1/S2 page table, SMMU registers or cmd/event/pri queues. >>> >>> This series tries to add support of dumping CD/STE and page table. The >>> interface design is that user sets device/pasid firstly by sysfs files >>> and then read related sysfs file to get information: >>> >>> (currently only support PCI device) >>> echo ::. > /sys/kernel/debug/iommu/smmuv3/pci_dev >>> echo > /sys/kernel/debug/iommu/smmuv3/pasid >>> >>> Then value in CD and STE can be got by: >>> cat /sys/kernel/debug/iommu/smmuv3/ste >>> cat /sys/kernel/debug/iommu/smmuv3/cd >>> >>> S1 and S2 page tables can be got by: >>> cat /sys/kernel/debug/iommu/smmuv3/pt_dump_s1 >>> cat /sys/kernel/debug/iommu/smmuv3/pt_dump_s2 >>> >>> For STE, CD and page table, related device and pasid are set in pci_dev >>> and pasid files as above. >>> >>> First and second patch export some help functions or macros in arm-smmu-v3 >>> and io-pgtable-arm codes, so we can reuse them in debugfs.c. As a RFC, this >>> series does not go further to dump SMMU registers and cmd/event/pri queues. >>> I am not sure this series is in the right way, so let's post it out and have a >>> discussion. Looking forward to any feedback. >>> >>> Zhou Wang (3): >>> iommu/arm-smmu-v3: Export cd/ste get functions >>> iommu/io-pgtable: Export page table walk needed functions and macros >>> iommu/arm-smmu-v3: Add debug interfaces for SMMUv3 >>> >>> drivers/iommu/Kconfig | 11 + >>> drivers/iommu/arm/arm-smmu-v3/Makefile | 1 + >>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 +- >>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 10 + >>> drivers/iommu/arm/arm-smmu-v3/debugfs.c | 398 ++++++++++++++++++++++++++++ >>> drivers/iommu/io-pgtable-arm.c | 47 +--- >>> drivers/iommu/io-pgtable-arm.h | 43 +++ >>> 7 files changed, 475 insertions(+), 45 deletions(-) >>> create mode 100644 drivers/iommu/arm/arm-smmu-v3/debugfs.c >>> >> >> Any comments about this series? > > Truthfully, I don't really see the use in dumping the state of the SMMU > data structures. They're not especially dynamic, and there are higher level > ways to determine how devices map to groups etc. Here the aim is not to find the device/groups maps, but to dump CD/STE value. Of cause, we can know them from reading codes, however, we expect to dump hardware configures quickly and directly when debugging hardware related problem. It is a real pain when your hardware guy ask you to do this :) > > However, I can see some utility in dumping the page-tables. We have that > functionality for the CPU side via /sys/kernel/debug/kernel_page_tables, > so something similar in the io-pgtable code could be quite neat. In > particular, the logic to expose things in debugfs and drive the dumping > could be agnostic of the page-table format, while the formats themselves Do you mean different page-table format, like 64_s1, 64_s2, 32_s1, 32_s2? Seems in io-pgtable code, we only tell them in arm_lpae_prot_to_pte, and currently in this RFC patch, we do not print attributes. Thanks, Zhou > coule implement optional callback(s) to return the data. > > Will > > . > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel