From nobody Sat Nov 30 00:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=chromium.org ARC-Seal: i=1; a=rsa-sha256; t=1620640271; cv=none; d=zohomail.com; s=zohoarc; b=ghmLk3oKyUEztkPiIdUOe6L+lhHSUYR24JxvIEdaZpaOElGXoj2eoYljfr1FXkRaGzDTMypg+xalWgB0eyB8tZBPBLUMfaEeSk4aNmabNv9cqMXAZQXjfTKozbXCqWFyKlLEO81OKmOXcm4mUW3geapg4RHzFtAvXhMSjwIf4k0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620640271; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xzceaTJbUUoQMRiby9lwQqwtKo4y5qZbVn1w31ybRrg=; b=mCphoiyamt4BsG2ydCZ3GPG5NOfLjo/svX663NQU5BCgo5hLJ6yZhPrCD7vdbGo7h1PnOu1dalwloWGRdKQdpQq9Bcf+dIcXOIb/LLfbMp/8m3TaA5WQvJ/N1to1hGqukEGKdgTCEzcGkTZ54rxxgZMaCCQ/l2pUKUdaY8dyR48= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1620640271406376.1854949124289; Mon, 10 May 2021 02:51:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.125051.235426 (Exim 4.92) (envelope-from ) id 1lg2Z1-000718-Gy; Mon, 10 May 2021 09:50:59 +0000 Received: by outflank-mailman (output) from mailman id 125051.235426; Mon, 10 May 2021 09:50:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lg2Z1-000711-DD; Mon, 10 May 2021 09:50:59 +0000 Received: by outflank-mailman (input) for mailman id 125051; Mon, 10 May 2021 09:50:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lg2Z0-0006yg-86 for xen-devel@lists.xenproject.org; Mon, 10 May 2021 09:50:58 +0000 Received: from mail-pj1-x102f.google.com (unknown [2607:f8b0:4864:20::102f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c12bb93c-f2ba-419c-84de-ec0eb41aa6f3; Mon, 10 May 2021 09:50:57 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id lj11-20020a17090b344bb029015bc3073608so9988256pjb.3 for ; Mon, 10 May 2021 02:50:57 -0700 (PDT) Received: from localhost ([2401:fa00:95:205:a524:abe8:94e3:5601]) by smtp.gmail.com with UTF8SMTPSA id 14sm10615255pfv.33.2021.05.10.02.50.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 May 2021 02:50:56 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c12bb93c-f2ba-419c-84de-ec0eb41aa6f3 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=xzceaTJbUUoQMRiby9lwQqwtKo4y5qZbVn1w31ybRrg=; b=bOYHl1lk+9c5fpkjvJLlW2V+ZW1HWQZ8+GqQWpRXOyRwXl5gJ0b79YDClCoBfBBm4i Lg3ZY42RA3b3XCB5qgKa30diM6DGWie5c/Bp8lBvVatzuKYQ+cRSVyrR3Vn43XQ38Fby 6vdAkHilxAu/KAE1HFPNhr6sG764ExUW8d2uc= 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=xzceaTJbUUoQMRiby9lwQqwtKo4y5qZbVn1w31ybRrg=; b=Fk2TUqJxqirNlYbd3NLfg8yIFYOdTCgVsVgoqiSbaAB2/sKGA+1/EK+boKq5kU46J4 qLtoAmwMAkKG+2h5UuD+YirSS3StLbsQ+R1z6kaRC4gk4F+QY6yuhhbgP6URhVNOxZ9m qxuJ15dFgmvHXjGbOpXukC4IG++bQ3WNsdTKnT+YXwftrO7epCUs+PZwxwmUA0A9q+PO zlKa+HBTXjIXnXUN/BnESig2AhJRb/P5V8lw9oJF9gJF1xoFKsGqWXcgnGN/iwwQk95B /1ChRyl8aSruuC2UC1W/T9fhbhg4gRPzFnEPwsxoLXMmKH38JEBCYVI6vlq0Mx79ihjL qIgA== X-Gm-Message-State: AOAM533P8N+Y96HwxyKdWwpSVtzUG+TE5cf3P4R1Zgsc8qMFvAhcPiA0 6LcWKReWZrg+STYFseUO3BJWXA== X-Google-Smtp-Source: ABdhPJxwy0teVP8y0d4KrEbfmPne0jX/g2pgdK0Y1sxb/62SuqcTyQ5c51wqp1akhS8ac/pL7Mr0nw== X-Received: by 2002:a17:90a:bf0c:: with SMTP id c12mr25754828pjs.206.1620640256876; Mon, 10 May 2021 02:50: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, nouveau@lists.freedesktop.org, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com Subject: [PATCH v6 02/15] swiotlb: Refactor swiotlb_create_debugfs Date: Mon, 10 May 2021 17:50:13 +0800 Message-Id: <20210510095026.3477496-3-tientzu@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210510095026.3477496-1-tientzu@chromium.org> References: <20210510095026.3477496-1-tientzu@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @chromium.org) Content-Type: text/plain; charset="utf-8" Split the debugfs creation to make the code reusable for supporting different bounce buffer pools, e.g. restricted DMA pool. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index d3232fc19385..858475bd6923 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -64,6 +64,7 @@ enum swiotlb_force swiotlb_force; =20 struct io_tlb_mem *io_tlb_default_mem; +static struct dentry *debugfs_dir; =20 /* * Max segment that we can provide which (if pages are contingous) will @@ -662,18 +663,27 @@ EXPORT_SYMBOL_GPL(is_swiotlb_active); =20 #ifdef CONFIG_DEBUG_FS =20 -static int __init swiotlb_create_debugfs(void) +static void swiotlb_create_debugfs(struct io_tlb_mem *mem, const char *nam= e, + struct dentry *node) { - struct io_tlb_mem *mem =3D io_tlb_default_mem; - if (!mem) - return 0; - mem->debugfs =3D debugfs_create_dir("swiotlb", NULL); + return; + + mem->debugfs =3D debugfs_create_dir(name, node); 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 =3D io_tlb_default_mem; + + swiotlb_create_debugfs(mem, "swiotlb", NULL); + debugfs_dir =3D mem->debugfs; + return 0; } =20 -late_initcall(swiotlb_create_debugfs); +late_initcall(swiotlb_create_default_debugfs); =20 #endif --=20 2.31.1.607.g51e8a6a459-goog