From patchwork Sat Jun 23 23:53:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy Pearson X-Patchwork-Id: 933823 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Cv6S2Xc3z9s2R for ; Sun, 24 Jun 2018 10:57:36 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="pFHCWTws"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41Cv6S0psgzF164 for ; Sun, 24 Jun 2018 10:57:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="pFHCWTws"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=raptorengineering.com (client-ip=192.119.205.245; helo=mail.rptsys.com; envelope-from=tpearson@raptorengineering.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="pFHCWTws"; dkim-atps=neutral Received: from mail.rptsys.com (mail.rptsys.com [192.119.205.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Csw03nSmzF14f for ; Sun, 24 Jun 2018 10:03:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id 938486428B1; Sat, 23 Jun 2018 18:53:29 -0500 (CDT) Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vveHCvE8w5vr; Sat, 23 Jun 2018 18:53:28 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id C12656428AE; Sat, 23 Jun 2018 18:53:28 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.rptsys.com C12656428AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raptorengineering.com; s=B8E824E6-0BE2-11E6-931D-288C65937AAD; t=1529798008; bh=F4yDmmbHH69y3+VTut3UdpNOzoOmUoZtCzaSs61LV2s=; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=pFHCWTwsCoFzPwDoDMMusBYyKObCYtsGlVf5D3UN8jYK6kDXKHIzt/PQ5XnDk1Vwe Zgd7Ncif43MKDTGLOFn8+7XDUOoigJX9mOgdC78VozYbtLg4xEMS8d+eoQ6UQLNdSY X17mK5dB7LgztZXwjM6WsOYlJ++DdfAsAhD76kNg= X-Virus-Scanned: amavisd-new at rptsys.com Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aVxyrZ4_1tye; Sat, 23 Jun 2018 18:53:28 -0500 (CDT) Received: from vali.starlink.edu (vali.starlink.edu [192.168.3.21]) by mail.rptsys.com (Postfix) with ESMTP id 7C9C2642869; Sat, 23 Jun 2018 18:53:28 -0500 (CDT) Date: Sat, 23 Jun 2018 18:53:28 -0500 (CDT) From: Timothy Pearson To: linuxppc-dev@lists.ozlabs.org Message-ID: <1820986268.2569250.1529798008396.JavaMail.zimbra@raptorengineeringinc.com> Subject: [PATCH 3/7] powerpc/powernv/pci: Track DMA and TCE tables in debugfs MIME-Version: 1.0 X-Mailer: Zimbra 8.5.0_GA_3042 (ZimbraWebClient - FF3.6 (Linux)/8.5.0_GA_3042) Thread-Topic: powerpc/powernv/pci: Track DMA and TCE tables in debugfs Thread-Index: oG83j61aOBSIlGh5LUfZgfdaH1NwPw== X-Mailman-Approved-At: Sun, 24 Jun 2018 10:42:17 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Add a new debugfs entry to trigger dumping out the tracking table and TCEs for a given PE, for example PE 0x4 of PHB 2: echo 0x4 > /sys/kernel/debug/powerpc/PCI0002/sketchy This will result in the table being dumped out in dmesg. Signed-off-by: Russell Currey --- arch/powerpc/platforms/powernv/pci-ioda.c | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 7ecc186493ca..55f0f7b885bc 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -3342,6 +3342,47 @@ static int pnv_pci_diag_data_set(void *data, u64 val) DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_diag_data_fops, NULL, pnv_pci_diag_data_set, "%llu\n"); +static int pnv_pci_sketchy_set(void *data, u64 val) +{ + struct pci_controller *hose; + struct pnv_ioda_pe *pe; + struct pnv_phb *phb; + u64 entry1, entry2; + int i; + + hose = (struct pci_controller *)data; + if (!hose || !hose->private_data) + return -ENODEV; + + phb = hose->private_data; + pe = &phb->ioda.pe_array[val]; + + if (!pe) + return -EINVAL; + + if (!pe->tces || !pe->tce_tracker) + return -EIO; + + for (i = 0; i < pe->tce_count; i++) { + if (i > 16 && pe->tces[i] == 0) + break; + pr_info("%3d: %016llx\n", i, be64_to_cpu(pe->tces[i])); + } + + for (i = 0; i < pe->tce_count; i++) { + entry1 = pe->tce_tracker[i * 2]; + entry2 = pe->tce_tracker[i * 2 + 1]; + if (!entry1) + break; + pr_info("%3d: %016llx %016llx\n", i, entry1, entry2); + } + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_sketchy_fops, NULL, + pnv_pci_sketchy_set, "%llu\n"); + + #endif /* CONFIG_DEBUG_FS */ static void pnv_pci_ioda_create_dbgfs(void) @@ -3367,6 +3408,8 @@ static void pnv_pci_ioda_create_dbgfs(void) debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, hose, &pnv_pci_diag_data_fops); + debugfs_create_file("sketchy", 0200, phb->dbgfs, hose, + &pnv_pci_sketchy_fops); } #endif /* CONFIG_DEBUG_FS */ }