From patchwork Tue Feb 27 11:50:00 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: 10244973 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 E388260211 for ; Tue, 27 Feb 2018 11:50:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7E9528907 for ; Tue, 27 Feb 2018 11:50:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C22D428A05; Tue, 27 Feb 2018 11:50:47 +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 2904C28907 for ; Tue, 27 Feb 2018 11:50:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EFAD6E655; Tue, 27 Feb 2018 11:50:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A59B6E643; Tue, 27 Feb 2018 11:50:06 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id v111so12319557wrb.3; Tue, 27 Feb 2018 03:50:06 -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=g5qMIU7/X9FHpw3yI/ZF3RG/RnCpJMsqVYSTXmGsIXM=; b=gumrEZLY3b+zjM6q5wHsakGfntOThrvHPRSniByQaXFKrmvkqyV5tn3LKV4d00sW2g ES20SmK3aEmFlXI9FWdYoDrSVkcuA9CE/SqEbYNIwEVTI151M+r7oT9S2LGOvDgcdodl iL0QeLb3CKQ+BMZaEDhBp3dtPEoVe0aea0J0DNqNZ82RMMnEtcrh9Ep96kXpWJeNB75O 39f+JszZG0d8uRjNYimZXqRmdwnfqn+oBsfTDGFyMUXS96+hnZW9S+kWhj2YqDZ4TESv f+Op2KZ57dnvUBypMY65VoO+e2uDsKNnJghniazt6tmZKMTnyvDPQbLG0VaHfO8002YZ gdNg== 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=g5qMIU7/X9FHpw3yI/ZF3RG/RnCpJMsqVYSTXmGsIXM=; b=h59RfDp/rnvcvfQaVz8kGmCx/8eslb+MPv1SEYs5mTh2gLsIrgpyoCF1/vlEZ1MSpo XBdcheyTbbRRKCJCrBi0yjm9GZhHIGib75almHts9rul45sB62fC4/APp2VUsepLhdmw /yiGFd9NYvaAz8n6/uBi/4/r3rS0T6L1MMQE9H8cpXMcusvvUBxSAXHU8Yfs8RXinMtO Dalv/ckqFvMnz7u0kccC5N2gvLLpxL28WxSCUs3FlcqB127e5UZIRNl5FXK/uUvodKLQ NO/IrrjEy0RR2SXrA/QPrXyoklquCuAVkiW5e3dLvltPPAWnMEhCgQL9bCC4lUGqIeGH AmFw== X-Gm-Message-State: APf1xPCiZZx+9MRe4iHuVl2eUBgCbqYckdAN4AIHPw3YWgUEfUNbCGrB W6oZ9YN0qQsuNecYZ49qJ45XIw== X-Google-Smtp-Source: AH8x227qxTwJFMzurPOwEtl5rKy15dpYDZiWQg89SNu2OYuAI7DTTL3RztUikLkLVSfKh9QD1lBYag== X-Received: by 10.223.189.8 with SMTP id j8mr13448559wrh.20.1519732204602; Tue, 27 Feb 2018 03:50:04 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:652a:9b33:8ae4:9f2c]) by smtp.gmail.com with ESMTPSA id k2sm8618568wmf.10.2018.02.27.03.50.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 03:50:04 -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, amd-gfx@lists.freedesktop.org Subject: [PATCH 5/5] drm/amdgpu: stop allocating a page array for prime shared BOs Date: Tue, 27 Feb 2018 12:50:00 +0100 Message-Id: <20180227115000.4105-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180227115000.4105-1-christian.koenig@amd.com> References: <20180227115000.4105-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 We don't need the page array for prime shared BOs, stop allocating it. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index 137145dd14a9..dc8d9f3216fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c @@ -315,7 +315,7 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset, t = offset / AMDGPU_GPU_PAGE_SIZE; p = t / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE); for (i = 0; i < pages; i++, p++) - adev->gart.pages[p] = pagelist[i]; + adev->gart.pages[p] = pagelist ? pagelist[i] : NULL; #endif if (!adev->gart.ptr) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index e38e6db8f760..854421af1982 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -982,7 +982,7 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev, } gtt->ttm.ttm.func = &amdgpu_backend_func; gtt->adev = adev; - if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags)) { + if (ttm_sg_tt_init(>t->ttm, bdev, size, page_flags)) { kfree(gtt); return NULL; } @@ -1008,7 +1008,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm, if (slave && ttm->sg) { drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages, - gtt->ttm.dma_address, ttm->num_pages); + gtt->ttm.dma_address, + ttm->num_pages); ttm->state = tt_unbound; return 0; }