Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp181354pxj; Tue, 15 Jun 2021 23:23:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZGBo4k/ljOwmImUCPvHmZOxBbLRecbdgkhiJVkWviMHlOjv3tgyBKpXnbaDHwqLzgckXa X-Received: by 2002:aa7:c68f:: with SMTP id n15mr2204693edq.145.1623824638821; Tue, 15 Jun 2021 23:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623824638; cv=none; d=google.com; s=arc-20160816; b=EQRSYTS65wAUs5nnpqQWoNpimUTMlNrf8UOPdLRyirUX5yEVmeeNrmSRuKYG98KX8t 0tLD63CmGaJaphi9YH88Rz5UdCaJg2SfC7GO4Q6eeYS/eqLNbDvUzTzWv5UW+dg/m4qW 2yzegHgzRL5YQQHES6N+sko3d4nSQ8KwDKrc7nB6RrMlsNiEdcVJIAVuzJweOkhxIOmV B8JWKSHiDRizjrYXps21DbnYRob4SM+xKrkDZEFOhrLcr/s12uZoFK23h97qvdqDibUY 6Sd8Bj3gEYAfrLl6s/gCqFOA6Nhw7vJN9wwuRjooTkM2vVh9EtmYFViTRtInyCPBa/A6 BIOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U6ZYMbmpZtiKwFDcQ7JFrtewUpbfgXD5Ls9ZoD2Zrzg=; b=NcJoRf1yxPO0JlLOTpUMrd5lSiXjWhyABc+6h7lP51Hi+DV6y3mtkwM5qbky19XmSc zqRNfaM40vaTDppcD7T7KaP8YiGTeK68YYiCZOChordwDx+dxiUWOdsUWlRaVNE/jStg aMpRQrEETuEAtnW0mjYZ9xLGm5J/YIBudZPncOenStjRf0PFf+rE0t4uR8QuVHad/OlT EMVWg8YjSWJc8O5So+3oioisePPi+c/XClwrIuZcSeKtNnNjRNEaz1ky40gtoHXumJ1v 7y9rEf57TPy+xNBabqZ6ILJzkzhSObPrV/4Mftsqav5KGq2CfYVcZAqGLHD9Xy5WWCGV C83w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PJvHRcLL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si1524935ejd.203.2021.06.15.23.23.36; Tue, 15 Jun 2021 23:23:58 -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=@chromium.org header.s=google header.b=PJvHRcLL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231344AbhFPGYc (ORCPT + 99 others); Wed, 16 Jun 2021 02:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231361AbhFPGYc (ORCPT ); Wed, 16 Jun 2021 02:24:32 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBFDAC061760 for ; Tue, 15 Jun 2021 23:22:26 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id k22-20020a17090aef16b0290163512accedso3108538pjz.0 for ; Tue, 15 Jun 2021 23:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U6ZYMbmpZtiKwFDcQ7JFrtewUpbfgXD5Ls9ZoD2Zrzg=; b=PJvHRcLLv4fhlWeXvSfKMQcWBxKOg+Fvvldtj3Y2Rwy0NG+fV8esg1TcKHxfLuji8x fALYR4BBGda9gTcNxGVF5jiXo1hdqXLQ9/EojERkZznhsp+lq9qt4VGs9UqStorOUfPe QcYH5iC4/YfxuhCJrGU8L8Q0LpoEXtWiU0umg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U6ZYMbmpZtiKwFDcQ7JFrtewUpbfgXD5Ls9ZoD2Zrzg=; b=dsynC+Y07AklCEeoZ+eaSknKZsrx69z3MNFjXfB+V+gP5RQPIAfl2vqk6Tojs5xtE+ zrqaMdd64QkHVu/b/Kbed8PO+gqN2SVb6gOFh5ZiakzheDTCBHvez5144IUhEGvFTgjv DVs+F18LyNuP0Q+TOJIHxXSjr8n8VKWkyZoJ+vXC+9Znnks3WLI9VG3yul1RzOCC2LV8 xtknYtNxANeEw/svaHiD7ci6jQhkc286d9JbZ2nysGc1ZlZF91J8lUM4/OsODsj1gYxF nOU02tL2c/9VCiGMT84pvIrr/VC7jSZClIpVkeq6T///NzhpCfkOQNMA3olHRHiLPLBB CPPA== X-Gm-Message-State: AOAM532fSurYJmYZzK0EOfqsHWYBA3iEBpJLDCx3inS2jS1YIw/f2VVb U8rnHGbDqXLU9D2QFfI/yXtxYA== X-Received: by 2002:a17:902:860b:b029:103:b23b:f1c3 with SMTP id f11-20020a170902860bb0290103b23bf1c3mr7842702plo.34.1623824546376; Tue, 15 Jun 2021 23:22:26 -0700 (PDT) Received: from localhost ([2401:fa00:95:205:3d52:f252:7393:1992]) by smtp.gmail.com with UTF8SMTPSA id 21sm1024194pfy.92.2021.06.15.23.22.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 23:22:26 -0700 (PDT) From: Claire Chang To: Rob Herring , mpe@ellerman.id.au, Joerg Roedel , Will Deacon , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, Christoph Hellwig , Marek Szyprowski Cc: benh@kernel.crashing.org, paulus@samba.org, "list@263.net:IOMMU DRIVERS" , sstabellini@kernel.org, Robin Murphy , grant.likely@arm.com, xypron.glpk@gmx.de, Thierry Reding , mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, Greg KH , Saravana Kannan , "Rafael J . Wysocki" , heikki.krogerus@linux.intel.com, Andy Shevchenko , Randy Dunlap , Dan Williams , Bartosz Golaszewski , linux-devicetree , lkml , linuxppc-dev@lists.ozlabs.org, xen-devel@lists.xenproject.org, Nicolas Boichat , Jim Quinlan , tfiga@chromium.org, bskeggs@redhat.com, bhelgaas@google.com, chris@chris-wilson.co.uk, tientzu@chromium.org, daniel@ffwll.ch, airlied@linux.ie, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com, jxgao@google.com, joonas.lahtinen@linux.intel.com, linux-pci@vger.kernel.org, maarten.lankhorst@linux.intel.com, matthew.auld@intel.com, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com Subject: [PATCH v12 02/12] swiotlb: Refactor swiotlb_create_debugfs Date: Wed, 16 Jun 2021 14:21:47 +0800 Message-Id: <20210616062157.953777-3-tientzu@chromium.org> X-Mailer: git-send-email 2.32.0.272.g935e593368-goog In-Reply-To: <20210616062157.953777-1-tientzu@chromium.org> References: <20210616062157.953777-1-tientzu@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split the debugfs creation to make the code reusable for supporting different bounce buffer pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 3ba0f08a39a1..af416bcd1914 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -670,19 +670,26 @@ bool is_swiotlb_active(void) EXPORT_SYMBOL_GPL(is_swiotlb_active); #ifdef CONFIG_DEBUG_FS +static struct dentry *debugfs_dir; -static int __init swiotlb_create_debugfs(void) +static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem) { - struct io_tlb_mem *mem = io_tlb_default_mem; - - if (!mem) - return 0; - mem->debugfs = debugfs_create_dir("swiotlb", NULL); debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs); debugfs_create_ulong("io_tlb_used", 0400, mem->debugfs, &mem->used); +} + +static int __init swiotlb_create_default_debugfs(void) +{ + struct io_tlb_mem *mem = io_tlb_default_mem; + + debugfs_dir = debugfs_create_dir("swiotlb", NULL); + if (mem) { + mem->debugfs = debugfs_dir; + swiotlb_create_debugfs_files(mem); + } return 0; } -late_initcall(swiotlb_create_debugfs); +late_initcall(swiotlb_create_default_debugfs); #endif -- 2.32.0.272.g935e593368-goog