Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2086507pxj; Sat, 19 Jun 2021 02:30:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD6JwJWr7uA/8YBCvcaqNJQLNGrwahaj62Imo9jq4erYBsGP0+HiyTtT4nY49EUm0QwQ26 X-Received: by 2002:a17:906:110b:: with SMTP id h11mr13031462eja.356.1624095018203; Sat, 19 Jun 2021 02:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624095018; cv=none; d=google.com; s=arc-20160816; b=pURfAncwTnjh6XzxYyqcsQmPHDQ28ZJ2mV8XP5GDYQMUzAfOsaQeIqJi5+NfpW4fX0 10KaOdZ6ss6RCFFxGkfciN/ctg8Ncwuz4GJH2RGPueqHyNdhQSbmTJ8kVBH4eh+XWi66 MWZ9sGzrYKfS37u57LCt4p1ZfdKFQUlQfsSEoAwanqKkRrj+kAZ8+jNpZqZoNAbDpPBO ySZasFmKEmlEseN/p5bCmW4jNTo8MObUGvKCDuWB2puzeu2Dd+oMWiC26018z0M7jVZG XX327RQ+/P8IooGf0cfoZH/wPKIhnYNkuYmkZ86h1GNZFrR6e8bO9PGj1zFYwlG9LfO0 8TkA== 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=87F32lyNJPVTVtO+0wV8iOXVR4FYPSJ8Efeoe/l3AWY=; b=RqXhElprYYRIu7Cg2KWSjdKFKfr/ga5CMjoejCXaneS65+3mSTzMACBe3Z7J19n/gB esK0J+rS0YPd+q+ltIWnYyMGaCodnJURBREEC7A+bs6mTw64ASti1M8DfHMJYntZWq4r DBw6+sHFZuoysrmNHMjVKM/m9VuuswXlnvcPOCH0Ep5i3JRvPYzdqkdbzdmDZivZpCjs CUj/BL8YOQ1FHgv61AhdExgA8cr9ZsB/4OlDEM8Hs1TFWPMVcFUu2EGOwoBewE6iOxIb DKovenBtKzuBiaMJiXyV4yDxHJZuk+PAaLf6IPInIrh0gEn7Qb21t5XvoPPyynIkIBpE +9Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i1ENWaFN; 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 z18si5101788edx.445.2021.06.19.02.29.55; Sat, 19 Jun 2021 02:30:18 -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=i1ENWaFN; 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 S235719AbhFSDod (ORCPT + 99 others); Fri, 18 Jun 2021 23:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235674AbhFSDoY (ORCPT ); Fri, 18 Jun 2021 23:44:24 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E16C0617AE for ; Fri, 18 Jun 2021 20:41:12 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id e22so3262743pgv.10 for ; Fri, 18 Jun 2021 20:41:12 -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=87F32lyNJPVTVtO+0wV8iOXVR4FYPSJ8Efeoe/l3AWY=; b=i1ENWaFNKwGMCMiAeHBUHeHeWCgJo2DMoHTJ8FYIFrvt5MmhJ7OFiSW0SvgsImDco7 eyyIqWu+/Z0bEeYC6m5AiJ1SXr0nn6NCHriX3ZUuh6wWoj4iO9mtnXQIU1hsa49/kNzW JSXwJ+CCVTQ+vErOyYxRYe6Lgoq4CUcXaMXXc= 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=87F32lyNJPVTVtO+0wV8iOXVR4FYPSJ8Efeoe/l3AWY=; b=f4Vn2J5feRtrKp6y6s9S1+Gduu+Kz4zTdNKQIShrl/z8PY8qd6ORl0Ti3LG1wOmdzf 92ShP7fZPngKSf69TYzza5i5btGPUs3lfhOA1fpdOawObhdeuf7k3Fcmcoeo5F3B3+gi GEPvJ8W9NzY8jrqZwFOTufoHRwP8gWoZ+JLPcRUf3W/7Z2q2RKDDqURJ7RH6cyXmSY8U 0MRgmFCxYGmdmuf/uenlYG1bMU/RF61fbHW9uUCf+n4ZD9/95PTNd1R6fCCruVmQH1Lm bhhnUcTMp7Yi4TNM47FFZmozgDlYo28EMwsuYTV6Ldo4CySP7BFQgV/7DJO5sP1j254r G2eA== X-Gm-Message-State: AOAM5327NSJVPCejH27rK0xkb++Ojw7ElAO6EkiOxrn8ZEjoXkVBtWRi 9+PEzqws5Eog7j6HX5iCcDFSVQ== X-Received: by 2002:a63:4915:: with SMTP id w21mr13046659pga.363.1624074072021; Fri, 18 Jun 2021 20:41:12 -0700 (PDT) Received: from localhost ([2401:fa00:95:205:4a46:e208:29e8:e076]) by smtp.gmail.com with UTF8SMTPSA id 25sm10160700pgp.51.2021.06.18.20.41.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Jun 2021 20:41:11 -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, thomas.lendacky@amd.com Subject: [PATCH v14 02/12] swiotlb: Refactor swiotlb_create_debugfs Date: Sat, 19 Jun 2021 11:40:33 +0800 Message-Id: <20210619034043.199220-3-tientzu@chromium.org> X-Mailer: git-send-email 2.32.0.288.g62a8d224e6-goog In-Reply-To: <20210619034043.199220-1-tientzu@chromium.org> References: <20210619034043.199220-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 Tested-by: Stefano Stabellini Tested-by: Will Deacon --- 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 1f9b2b9e7490..ede66df6835b 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -671,19 +671,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.288.g62a8d224e6-goog