From patchwork Thu Feb 22 15:02:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10235699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE46E60224 for ; Thu, 22 Feb 2018 15:02:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5CFE28BF2 for ; Thu, 22 Feb 2018 15:02:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8CAA28D92; Thu, 22 Feb 2018 15:02:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3974928BF2 for ; Thu, 22 Feb 2018 15:02:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CA626EE25; Thu, 22 Feb 2018 15:02:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C9FC89E86 for ; Thu, 22 Feb 2018 15:02:25 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id a20so2830135wmd.1 for ; Thu, 22 Feb 2018 07:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fIYqofv4K82DECq6BJpC1z1ciuM1q+7JxatVhXZ0Dno=; b=qiWkhmedeSGvGGsCzTbxlVvfBUR2WtNm9eMRb1PozAz3/Tbij0/S67lj7jcm7iUPB0 pKDStLqaUKrV+T7ujFyjw7YuyrXjB4cMqfceu5UJY+20LeOPe6BHA5EtNZLj2tq1eOIw sgG4XZKcFCAN381IHIG8jVK/swK5N3P/O3F0timhOHFHRRT8ZCh+u7S5QIPHnFi0TXya Zx9/FM0o4jiEou61ruralOZLoz5zN8mkJKJCxuuHldcaBbpaYN79nB4mqJlWl3yTjSCM fhEUkNIOkbsupajLMqQTqJQjLVYNFtt29s5BcVo01Uk7aMpUSWeqgGMWW9haAdzh9mgM L7gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fIYqofv4K82DECq6BJpC1z1ciuM1q+7JxatVhXZ0Dno=; b=dmteKn1ZlqWygXp4GhurEAW+OnWsXrzjO6MyK6E84AZZ5xSgeof39ZhGq5pvC4QDyq L/fDEM0q70+vR5eAiYL7CiGjuLWY+6WWBCQu3jh3lOy8f9HXL1dPo4qssxxBXv2QQQ+8 zauZfI/JuiOMJMU0sYURVDsuRbxlEvxMI2HIK4/I7pR9rJ6McscZsjoAQsHIg9t/MZY3 YcedWbw9NXh7IiEtwTbppA7piTUTgn/NZO5cKHUKGIiVLMJ/vX9JEJQ4w6xQgNy2pUmX rmQodSsXrym52i7YfGzl6ykFHRZOtpiu7MuUKv9YRBTJNqd1ZzYBICDJlcLp5dP/CvIn E6Bg== X-Gm-Message-State: APf1xPAJQNNcZOH1t4/JA9evWiKVOcDEyoQ07wUxxITylnsF2eOtzZYW rLCL54UXHycJsqhA0agsIuS2pw== X-Google-Smtp-Source: AH8x226c/YktGEO1pNQhrROgce3VJAn8G1W9b2LRmuWXX97slov2KovyWWsH17cs3lCTaIKearRAxA== X-Received: by 10.28.149.8 with SMTP id x8mr5482395wmd.24.1519311743864; Thu, 22 Feb 2018 07:02:23 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:88c:4715:87af:fa74]) by smtp.gmail.com with ESMTPSA id v63sm424613wrc.69.2018.02.22.07.02.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 07:02:23 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/6] drm/ttm: drop ttm->glob Date: Thu, 22 Feb 2018 16:02:16 +0100 Message-Id: <20180222150220.8702-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180222150220.8702-1-christian.koenig@amd.com> References: <20180222150220.8702-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The pointer is available as ttm->bdev->glob as well. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 +++--- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 ++++++----- drivers/gpu/drm/ttm/ttm_tt.c | 2 -- include/drm/ttm/ttm_bo_driver.h | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 5edcd896cd53..2c28c4568c5f 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -1072,6 +1072,7 @@ void ttm_page_alloc_fini(void) static void ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) { + struct ttm_mem_global *mem_glob = ttm->bdev->glob->mem_glob; unsigned i; if (mem_count_update == 0) @@ -1081,8 +1082,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) if (!ttm->pages[i]) continue; - ttm_mem_global_free_page(ttm->glob->mem_glob, ttm->pages[i], - PAGE_SIZE); + ttm_mem_global_free_page(mem_glob, ttm->pages[i], PAGE_SIZE); } put_pages: @@ -1093,7 +1093,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) { - struct ttm_mem_global *mem_glob = ttm->glob->mem_glob; + struct ttm_mem_global *mem_glob = ttm->bdev->glob->mem_glob; unsigned i; int ret; diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index b122f6eee94c..3b4c97011b5c 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -929,7 +929,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev, struct ttm_operation_ctx *ctx) { struct ttm_tt *ttm = &ttm_dma->ttm; - struct ttm_mem_global *mem_glob = ttm->glob->mem_glob; + struct ttm_mem_global *mem_glob = ttm->bdev->glob->mem_glob; unsigned long num_pages = ttm->num_pages; struct dma_pool *pool; struct dma_page *d_page; @@ -1031,6 +1031,7 @@ EXPORT_SYMBOL_GPL(ttm_dma_populate); void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) { struct ttm_tt *ttm = &ttm_dma->ttm; + struct ttm_mem_global *mem_glob = ttm->bdev->glob->mem_glob; struct dma_pool *pool; struct dma_page *d_page, *next; enum pool_type type; @@ -1051,8 +1052,8 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) count++; if (d_page->vaddr & VADDR_FLAG_UPDATED_COUNT) { - ttm_mem_global_free_page(ttm->glob->mem_glob, - d_page->p, pool->size); + ttm_mem_global_free_page(mem_glob, d_page->p, + pool->size); d_page->vaddr &= ~VADDR_FLAG_UPDATED_COUNT; } ttm_dma_page_put(pool, d_page); @@ -1080,8 +1081,8 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) count++; if (d_page->vaddr & VADDR_FLAG_UPDATED_COUNT) { - ttm_mem_global_free_page(ttm->glob->mem_glob, - d_page->p, pool->size); + ttm_mem_global_free_page(mem_glob, d_page->p, + pool->size); d_page->vaddr &= ~VADDR_FLAG_UPDATED_COUNT; } diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 65bf4eac184b..5d8f7f9b84b1 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -195,7 +195,6 @@ int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev, struct page *dummy_read_page) { ttm->bdev = bdev; - ttm->glob = bdev->glob; ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; ttm->caching_state = tt_cached; ttm->page_flags = page_flags; @@ -226,7 +225,6 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev, struct ttm_tt *ttm = &ttm_dma->ttm; ttm->bdev = bdev; - ttm->glob = bdev->glob; ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; ttm->caching_state = tt_cached; ttm->page_flags = page_flags; diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 738bb8d35c44..0e4ae26da093 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -123,7 +123,6 @@ struct ttm_tt { uint32_t page_flags; unsigned long num_pages; struct sg_table *sg; /* for SG objects via dma-buf */ - struct ttm_bo_global *glob; struct file *swap_storage; enum ttm_caching_state caching_state; enum {