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: 376887 Delivered-To: patches@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2008318jah; Fri, 5 Feb 2021 00:06:29 -0800 (PST) X-Received: by 2002:a17:90a:fb83:: with SMTP id cp3mr2919915pjb.168.1612512389605; Fri, 05 Feb 2021 00:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612512389; cv=none; d=google.com; s=arc-20160816; b=g/NW99FzXWLJQDKrB4aZhl6zS6QYUsvUwqXD5KuJizE6h2/sjg7ScYZwdxO9020qMf hYIf/h7Cx9lmplVGFqiVeb5mSpPzcv75TeBJYlkVbI7WrcZqkqbACjLssuGVhIai1a5p hF8iKbHab/kcIiIuYixzb1ZRsQKBQq7WHfDQEq3/6fWlWLo4D0+9zOu8u7zAWozUJWbX ZHe1TP8Bfwdyn4qz1gqOzITCKLzinKJzHDbNYjs6UHibbr+51u8BT6rz1j+grpqZJZQ6 odYbQPQQfmH3of3RTteSp+0y2hbNpyh53ECQa9UyIIAFTxlUX/eeaCe7u7vfoVwb5x4I 3PkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=bGslspb5ZylZ8O2t/OXWAgcgjW5wijqWH0egOe8ik7I=; b=IKD0bWd8WVy9mQ6hrczySHWDUd7MZhrNdHjaxv0Qxt/mGU6Wy2qxyIGTsjiMCOWJEO rtNVqEcaSGQAPq2zmrWhyyE1T30tP4Um3cuaWiCTm7WlxJ1OspK4AWcmJmWgUN5BwxBU hV3ohHdaS3abWc/K8ifcKSrg5klmwubkXK96GkNQWBrkPp277g1CgxnzR9mQmSeJM6V0 ZI5MUBC0mx2vSgDxpS7UuFG4q6IcQ4s8oAZdcSlgRzppRGo2ArL95RsDu1IiKtYD3EWn BA3FxUti0ae1SqYWPwd23cMc+UQ9sjAuEKBI17vIAmZDwbgOA35URlBVhMeqBZ8jpzq/ UlRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=myIEhqRz; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id y69sor3814555pfb.93.2021.02.05.00.06.29 for (Google Transport Security); Fri, 05 Feb 2021 00:06:29 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=myIEhqRz; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=LIgx3J89he8+I2HfZALuAlC3XkonNs9aohYRJ+ywc23MIiyBbfaJOnWVv2/EythQIb D0tnqHcJiV9CnuGP7V4uNxdQPDsdolGrgq9W2ASsEWj+MpIelk54hqRsE62JqvJQqCEk 82TCFkIK/pWeewM5tdHLoRj9TTiz6YULwXyvE9XRuziuBjKTve6DpquWdFQGqgEYTXlg 5iTUnazNy3BkooGXBMcimo1oJ5CF01FD69ZLmSY5TLZ/+9IN8soIl08MJBp+QELTw6pk cwEZEXPxtraAxMJINtn5Zqa83AunIsEKyALlxPjAZZsQMu8ugaiiP9UFGLnIt83FKpws i1hw== X-Gm-Message-State: AOAM533GYgrDwWEKGhZ7FARYAU47FA/7m1xemg5S/QwAFFplzugrnERp JBXzm6OkhKyxDUF0sRvaDSnHYLkV 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) Return-Path: 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 Cc: John Stultz , Daniel Vetter , Christian Koenig , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org 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 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(-) -- 2.25.1 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;