Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp334592pxv; Thu, 24 Jun 2021 08:57:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKfw2IfTvX14DCrfarwCHNN0ZnlvUSXXAMBLRMYnTI4hN3vGc6t15o+OWF9pmmYJFM/rym X-Received: by 2002:a05:6402:4387:: with SMTP id o7mr8146339edc.319.1624550251645; Thu, 24 Jun 2021 08:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624550251; cv=none; d=google.com; s=arc-20160816; b=ODGnEqNIVP4YE1/EXrrONUEX1I+fDLqUBIxuVSoXfB42PYLfTKRVTmIi6n2eeblmsF 53DzgRokJ0IlQk1g/Bd+vpyF8xTeKfy38Wk1jVG0RZYNAc2/KQ752CyyX6Z9ej13+aAX 2VxIlvjcdVHLehtB+3R18YlXkCpdMCse8mgot0FfnxcE8BEvKBdPPLdgdKyK42RaXzO9 GjzskqTZSeXDFxehDMHmyQ7lPxw/+tmkyI4Z9frnvbg8PZbjHGhql2Re3JpkTOtJXXvO oIo7vPjGCIaD1qkvyrfZ/O6MrfMlktKUqjd/kBa+cc+g0rDzFL9J5TSPJbFEoB9a+TQg 9tWg== 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=DIG6HIo+T2rtQ6h2RGJ8MRLENxwq4AupE9mc0haPMfnA1tHm78dO21DimCv+YfSl8I fz0+TGW6bDqVStG4HRwXXsSbfLb6sKzwhnUoGtm4cnmBx4mBu7rM8OKA567+nj49/HGy j8AB5xtaBZlRdSpR6Pu/kVlb7VEGYx6uqDL9dDhvPG8S0/NMZMMr0AUZAHcpE6J1SSwT paxyXPkpRn3F1tBanhhsjjg1EQ8TZjLTjdIFekwqjf4KBavXn8zpqU5w9cxtq96dIs94 vvOvbMtJTLl1GzPqRDSmieCuy1oERrd3bXcMsWSYX7jyn9bK4o39cYMXjvLeFnHdWuop 23ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fPyR7LNf; 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 a6si3495823edk.546.2021.06.24.08.57.08; Thu, 24 Jun 2021 08:57:31 -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=fPyR7LNf; 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 S232348AbhFXP6S (ORCPT + 99 others); Thu, 24 Jun 2021 11:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbhFXP6Q (ORCPT ); Thu, 24 Jun 2021 11:58:16 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0B31C061574 for ; Thu, 24 Jun 2021 08:55:56 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id v7so5088234pgl.2 for ; Thu, 24 Jun 2021 08:55:56 -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=fPyR7LNfa+/lU3WGWQPO3NZkUjo26lxHQdRzo89jZMyBjRWMed8i0Y6RqoJEyweboI IubDRG9d7RiT3UTHReJE0MAliYBlmMLlLps0zkeHlwgKitR9Va5Y9JWu2QIhfoUNH31f Sz4HZ90/m+NBhkrEaC1sLlamv48IpLCMUi5TY= 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=rCXpNOLRYeIhkDZlonkaKgqPby0yYz+lCUc2RWQqfmtjyWJXCQskTUlkGckG6GRIqV 8Q536+COpqN1XOe5hE6KbTc4MLA86FT7qboNoDDZ2tGhy6be13y629qj5zEAukxEVh6s qBsd8lvwa9gJhxsp4a+e5UM+B+sW8yyoebdqtm4/TiQJlasCSMwsafXoAKhfTYw5vpqK 9krtIn8aoCVRLz8Im0aN8xHlSuW8UX2AFu6uWmL3c+o4h0jsUGSDYeAh/j35eNVkjaYQ uV25CoLuJHvG23TasYa0oSoBzjQhJOW96a9UZeR85+FBc2hYvQMqdvYzMRuNUptzCppy 3NPw== X-Gm-Message-State: AOAM530bIGJ2+vNNofbsqEXrkIuH7qAlQyhllFwoay4Pj2x6SVKKFaDX biKOVSj8DIZ0Fu+3/o40uBuToQ== X-Received: by 2002:a63:4e4d:: with SMTP id o13mr5258697pgl.361.1624550156451; Thu, 24 Jun 2021 08:55:56 -0700 (PDT) Received: from localhost ([2401:fa00:95:205:165a:99ec:42d5:d8b]) by smtp.gmail.com with UTF8SMTPSA id la18sm5913675pjb.55.2021.06.24.08.55.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 08:55:56 -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, quic_qiancai@quicinc.com Subject: [PATCH v15 02/12] swiotlb: Refactor swiotlb_create_debugfs Date: Thu, 24 Jun 2021 23:55:16 +0800 Message-Id: <20210624155526.2775863-3-tientzu@chromium.org> X-Mailer: git-send-email 2.32.0.288.g62a8d224e6-goog In-Reply-To: <20210624155526.2775863-1-tientzu@chromium.org> References: <20210624155526.2775863-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