From nobody Sat Nov 30 00:58:47 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=1620640349; cv=none; d=zohomail.com; s=zohoarc; b=nX52wIytxOkDDbRUwIj3UMD1QnFPkHu6da4stknHpI9q32audAnV2bxOJmNM+Rl8FaIMa/tWnK864IPRAW8+D8SpnMdIOmSmUi41i5iiIowlN1h8MWYlm7/J+rlssy1dDQ78NLUKbxTFbPDF+3FePoWYia7Ty7uTxzR8uJT8i/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620640349; 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=t6SScDqP0X0FEaGwYViR1WRhEa6WWe5PW8l4/cNEd6s=; b=O8csep+wNW7RMvvpYI+cm7XK5MM6sJsA+J3K73Ucuus1GiKx9LGS/J08UNGtGvukrrwLsE76tqagSqtoN2t3iEKDgf7Fkd4N2xZiSNveFZ/H8QQcxcUi3VPvbN6SrdPFfnr2n3Nw6W3DP1lttSvUV45tlCFPSdOHhOJg2kigaPw= 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 1620640349217325.65139154369103; Mon, 10 May 2021 02:52:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.125085.235534 (Exim 4.92) (envelope-from ) id 1lg2aH-00043a-IK; Mon, 10 May 2021 09:52:17 +0000 Received: by outflank-mailman (output) from mailman id 125085.235534; Mon, 10 May 2021 09:52:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lg2aH-00043P-FE; Mon, 10 May 2021 09:52:17 +0000 Received: by outflank-mailman (input) for mailman id 125085; Mon, 10 May 2021 09:52:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lg2aG-00040y-CP for xen-devel@lists.xenproject.org; Mon, 10 May 2021 09:52:16 +0000 Received: from mail-pf1-x429.google.com (unknown [2607:f8b0:4864:20::429]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id dba3aafc-f0ea-43de-8bc7-4122807dadbf; Mon, 10 May 2021 09:52:15 +0000 (UTC) Received: by mail-pf1-x429.google.com with SMTP id c17so13247880pfn.6 for ; Mon, 10 May 2021 02:52:15 -0700 (PDT) Received: from localhost ([2401:fa00:95:205:a524:abe8:94e3:5601]) by smtp.gmail.com with UTF8SMTPSA id g2sm4121532pfj.218.2021.05.10.02.52.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 May 2021 02:52:14 -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: dba3aafc-f0ea-43de-8bc7-4122807dadbf 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=t6SScDqP0X0FEaGwYViR1WRhEa6WWe5PW8l4/cNEd6s=; b=Np+mNLfnE5UH9v+sj7M7sXVpWmpJwNO1DnmfTEXXKWEeG5PclaliBfYf0J+kN7jfVA EwzmyQstbxUWNj9zGZGjDfvTwocid9N4ile+tbERZqEa6UZsUV+1sXylz+EEx90dcYpA QDp+I0oGFi86MOxid3sXnhVs4C0s/bcSV7YyE= 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=t6SScDqP0X0FEaGwYViR1WRhEa6WWe5PW8l4/cNEd6s=; b=kxjQWgJoucIKqnKnJR+8kAg8VtsFPC0Y/DufhbuRe8QVe1iF7y9GkdI+ecLmnGlyel +2/PH2oKZm+QC0IkEJefZbN+KaXU6UvKAI9xvmEy6A+ohfGFXdOVziJsaqwuMi18ALrK kZ4abwJYihQB88TuaU5rgVw7GjhwyOlzAlMClXF83eUgPVxktCsvFZFf6j6+U2BKrYn1 VztjTXQl5lNcVfXY5G9CWl5MhKMtvziuEFx2inVc9+9/V6JfQjVfMsEtUhkwxOv5GByj Pbwg8WVnmMUToGG/Y7IjR+5ZHXFA84YKMOc6k4vLluvtizs70vQZyKeQxVr/CbIJVmij xMCw== X-Gm-Message-State: AOAM530jkSrmpHxrFs16Ang7dQ+J24IEMY69TNp9UvoXgqHtKSQU+5dB Bho+gRlyZ7QPKPfBBcGgOraAQQ== X-Google-Smtp-Source: ABdhPJzTQch1UU+UQmd61gbcCZP+myc5F721Mj+utWhy5ilRUzzapDijoDqtK3NL+wBlztaE9YFArQ== X-Received: by 2002:a63:fc11:: with SMTP id j17mr20874729pgi.355.1620640335011; Mon, 10 May 2021 02:52:15 -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 11/15] dma-direct: Add a new wrapper __dma_direct_free_pages() Date: Mon, 10 May 2021 17:50:22 +0800 Message-Id: <20210510095026.3477496-12-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" Add a new wrapper __dma_direct_free_pages() that will be useful later for swiotlb_free(). Signed-off-by: Claire Chang --- kernel/dma/direct.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 078f7087e466..eb4098323bbc 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -75,6 +75,12 @@ static bool dma_coherent_ok(struct device *dev, phys_add= r_t phys, size_t size) min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit); } =20 +static void __dma_direct_free_pages(struct device *dev, struct page *page, + size_t size) +{ + dma_free_contiguous(dev, page, size); +} + static struct page *__dma_direct_alloc_pages(struct device *dev, size_t si= ze, gfp_t gfp) { @@ -237,7 +243,7 @@ void *dma_direct_alloc(struct device *dev, size_t size, return NULL; } out_free_pages: - dma_free_contiguous(dev, page, size); + __dma_direct_free_pages(dev, page, size); return NULL; } =20 @@ -273,7 +279,7 @@ void dma_direct_free(struct device *dev, size_t size, else if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CLEAR_UNCACHED)) arch_dma_clear_uncached(cpu_addr, size); =20 - dma_free_contiguous(dev, dma_direct_to_page(dev, dma_addr), size); + __dma_direct_free_pages(dev, dma_direct_to_page(dev, dma_addr), size); } =20 struct page *dma_direct_alloc_pages(struct device *dev, size_t size, @@ -310,7 +316,7 @@ struct page *dma_direct_alloc_pages(struct device *dev,= size_t size, *dma_handle =3D phys_to_dma_direct(dev, page_to_phys(page)); return page; out_free_pages: - dma_free_contiguous(dev, page, size); + __dma_direct_free_pages(dev, page, size); return NULL; } =20 @@ -329,7 +335,7 @@ void dma_direct_free_pages(struct device *dev, size_t s= ize, if (force_dma_unencrypted(dev)) set_memory_encrypted((unsigned long)vaddr, 1 << page_order); =20 - dma_free_contiguous(dev, page, size); + __dma_direct_free_pages(dev, page, size); } =20 #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ --=20 2.31.1.607.g51e8a6a459-goog