From patchwork Fri Jan 29 09:06:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Wang X-Patchwork-Id: 12055493 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=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 56A98C433DB for ; Fri, 29 Jan 2021 09:12:15 +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 0B19B64E25 for ; Fri, 29 Jan 2021 09:12:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B19B64E25 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:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=4ceMEj3bHCKtKkGmKUqAD9fol9tup/LUL6QSYvU43c4=; b=h0/SzqBtO8ov4yymlWKW9zAtR4 a7pAk3C+gANAJxJPaF6bWuo2lflE0IrwIIjQ1+rSBcJrHN3Phg0OmwHfnW5pA00BWh+WqDNni16CN 75IjV/89KSnOmpujoXXMvw5+4qJhYcR3OknoFIQSDpGtyf9upqqsx6/svrKcAfU9ihz4w60Ly0fAT W3hkqk8ocUzDynmw0efHDE/kCIhYA/rIzSMri9dnBoNvsCyNeeJ8Pb6ovxzq6VRroRaGj6sUshZE6 /Z7DUApq1k6qoIYw4agMdcdPHr0Rlkg1UV6p88B5EK8nJySG5ZGhCJH4ekAmWquPjUYwL3LGYlwgs wKtqEm6g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Po3-0003TR-2L; Fri, 29 Jan 2021 09:11:07 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Pns-0003OT-FM for linux-arm-kernel@lists.infradead.org; Fri, 29 Jan 2021 09:10:58 +0000 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DRs3Y3sLjzjG2K; Fri, 29 Jan 2021 17:09:29 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Fri, 29 Jan 2021 17:10:35 +0800 From: Zhou Wang To: Will Deacon , Rob Herring Subject: [RFC PATCH 0/3] iommu/arm-smmu-v3: Add debug interfaces for SMMUv3 Date: Fri, 29 Jan 2021 17:06:21 +0800 Message-ID: <1611911184-116261-1-git-send-email-wangzhou1@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210129_041056_785724_84106FF4 X-CRM114-Status: GOOD ( 11.34 ) 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: iommu@lists.linux-foundation.org, Zhou Wang , linux-arm-kernel@lists.infradead.org, chenxiang66@hisilicon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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