From patchwork Fri Feb 5 08:06:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 12069521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C068AC433E6 for ; Fri, 5 Feb 2021 08:06:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 748CE64F87 for ; Fri, 5 Feb 2021 08:06:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 748CE64F87 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98AF16F405; Fri, 5 Feb 2021 08:06:31 +0000 (UTC) Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by gabe.freedesktop.org (Postfix) with ESMTPS id C2E4D6F406 for ; Fri, 5 Feb 2021 08:06:29 +0000 (UTC) Received: by mail-pf1-x433.google.com with SMTP id t29so3805194pfg.11 for ; Fri, 05 Feb 2021 00:06:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bGslspb5ZylZ8O2t/OXWAgcgjW5wijqWH0egOe8ik7I=; b=myIEhqRzrTikD8EItrnbeyf5x9l+O7Db+kYOX/uF/5YLTldD3qEiitvk/zymRNh1nf UdidOIpR8pxH9oBWs0ZimTUW2/nA4Nd2oNrtZSb+ybMj+Ee5VVbJ2S0PDYSJgV+7V+ij Y1xRIiFT8GDSh9M1dOyDVMcimak6xUOHE5hI3n6Ul8DMPdzK46MqqDIHXXS6d+IjwXDg yVOSYtiDkxpppCcR273ZVLICDotzauJ/m5GpvMWT6IHnqo1q9RmfxhgKE+xVvjqB+OrX iLbsppKzlvpOQ90V4hwOjKAwsWppvN+0Fra8i9u0M5rjaVbuPAjZWTSugG32ObW6kkoy zb5g== 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=bGslspb5ZylZ8O2t/OXWAgcgjW5wijqWH0egOe8ik7I=; b=Ct+8pPp10ldEuvDtIL9z53kCVaiIb8+ImvO7JJ0YptnhGoYkOONddDOW/WDA+KcPi2 nlrdk4rvK2/xVMvbsdsgb5Kk6HX80lXQFqd4kkLfTJBPfPeZuRTX58+3zjjbrLKFaX7B TPrlmoJtz6RHXspSGbbJEG+G+y2RMRz7OHQLWZ3et1drg5N121P30rnXiTpbqObIYQT0 alydKQ1Y+kFa2TqbwEco1G2Ds+Ef0J7P+XYvrGWxiSlfY1s4q1Bk9sMdUABS7ggXsvjA DIMPIJBoHasFVb+p/98v484SbIfiykHuHTUEL0vDYpQTterp5vPUTDAQluXKGjkSxD4i 6LJA== X-Gm-Message-State: AOAM5330hwbWEyj15Gice4swJT0EsfInJGCTiBLcx30AS1e/KFb1xP1Q qgfUYqLJ7l7AKsmQhl2FF9tHQw== X-Google-Smtp-Source: ABdhPJzU4JdgWWY9tKHhmR96s6DGwgFRranOd/IzqxxC3jYaykmK4MxZFD94Gt6pxtBeA1R3QeiLbA== X-Received: by 2002:a62:19d1:0:b029:1d7:f8f2:7b04 with SMTP id 200-20020a6219d10000b02901d7f8f27b04mr1403660pfz.10.1612512389229; Fri, 05 Feb 2021 00:06:29 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id 32sm9520070pgq.80.2021.02.05.00.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 00:06:28 -0800 (PST) From: John Stultz To: lkml Subject: [RFC][PATCH v6 2/7] drm: ttm_pool: Rename the ttm_pool_dma structure to ttm_pool_page_dat Date: Fri, 5 Feb 2021 08:06:16 +0000 Message-Id: <20210205080621.3102035-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210205080621.3102035-1-john.stultz@linaro.org> References: <20210205080621.3102035-1-john.stultz@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Sandeep Patil , Ezequiel Garcia , Robin Murphy , James Jones , Liam Mark , Laura Abbott , Chris Goldsworthy , Hridya Valsaraju , =?utf-8?q?=C3=98rjan_Eide?= , linux-media@vger.kernel.org, Suren Baghdasaryan , Christian Koenig , Daniel Mentz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch simply renames the ttm_pool_dma structure to ttm_pool_page_dat, as we will extend it to store more then just dma related info in it. Cc: Daniel Vetter Cc: Christian Koenig Cc: Sumit Semwal Cc: Liam Mark Cc: Chris Goldsworthy Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/gpu/drm/ttm/ttm_pool.c | 37 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 11e0313db0ea..c0274e256be3 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -37,18 +37,17 @@ #ifdef CONFIG_X86 #include #endif - #include #include #include /** - * struct ttm_pool_dma - Helper object for coherent DMA mappings + * struct ttm_pool_page_dat - Helper object for coherent DMA mappings * * @addr: original DMA address returned for the mapping * @vaddr: original vaddr return for the mapping and order in the lower bits */ -struct ttm_pool_dma { +struct ttm_pool_page_dat { dma_addr_t addr; unsigned long vaddr; }; @@ -75,7 +74,7 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags, unsigned int order) { unsigned long attr = DMA_ATTR_FORCE_CONTIGUOUS; - struct ttm_pool_dma *dma; + struct ttm_pool_page_dat *dat; struct page *p; void *vaddr; @@ -94,15 +93,15 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags, return p; } - dma = kmalloc(sizeof(*dma), GFP_KERNEL); - if (!dma) + dat = kmalloc(sizeof(*dat), GFP_KERNEL); + if (!dat) return NULL; if (order) attr |= DMA_ATTR_NO_WARN; vaddr = dma_alloc_attrs(pool->dev, (1ULL << order) * PAGE_SIZE, - &dma->addr, gfp_flags, attr); + &dat->addr, gfp_flags, attr); if (!vaddr) goto error_free; @@ -114,12 +113,12 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags, else p = virt_to_page(vaddr); - dma->vaddr = (unsigned long)vaddr | order; - p->private = (unsigned long)dma; + dat->vaddr = (unsigned long)vaddr | order; + p->private = (unsigned long)dat; return p; error_free: - kfree(dma); + kfree(dat); return NULL; } @@ -128,7 +127,7 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching, unsigned int order, struct page *p) { unsigned long attr = DMA_ATTR_FORCE_CONTIGUOUS; - struct ttm_pool_dma *dma; + struct ttm_pool_page_dat *dat; void *vaddr; #ifdef CONFIG_X86 @@ -147,11 +146,11 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching, if (order) attr |= DMA_ATTR_NO_WARN; - dma = (void *)p->private; - vaddr = (void *)(dma->vaddr & PAGE_MASK); - dma_free_attrs(pool->dev, (1UL << order) * PAGE_SIZE, vaddr, dma->addr, + dat = (void *)p->private; + vaddr = (void *)(dat->vaddr & PAGE_MASK); + dma_free_attrs(pool->dev, (1UL << order) * PAGE_SIZE, vaddr, dat->addr, attr); - kfree(dma); + kfree(dat); } /* Apply a new caching to an array of pages */ @@ -184,9 +183,9 @@ static int ttm_pool_map(struct ttm_pool *pool, unsigned int order, unsigned int i; if (pool->use_dma_alloc) { - struct ttm_pool_dma *dma = (void *)p->private; + struct ttm_pool_page_dat *dat = (void *)p->private; - addr = dma->addr; + addr = dat->addr; } else { size_t size = (1ULL << order) * PAGE_SIZE; @@ -324,9 +323,9 @@ static unsigned int ttm_pool_shrink(void) static unsigned int ttm_pool_page_order(struct ttm_pool *pool, struct page *p) { if (pool->use_dma_alloc) { - struct ttm_pool_dma *dma = (void *)p->private; + struct ttm_pool_page_dat *dat = (void *)p->private; - return dma->vaddr & ~PAGE_MASK; + return dat->vaddr & ~PAGE_MASK; } return p->private;