From patchwork Tue Mar 6 14:43:46 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: 10261967 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 2DAA86016D for ; Tue, 6 Mar 2018 14:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E9632900D for ; Tue, 6 Mar 2018 14:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1289A2900F; Tue, 6 Mar 2018 14:44:16 +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 BD2622900D for ; Tue, 6 Mar 2018 14:44:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D1EB6E1C4; Tue, 6 Mar 2018 14:44:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id D49AC6E0F3; Tue, 6 Mar 2018 14:43:53 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id t3so23239454wmc.2; Tue, 06 Mar 2018 06:43:53 -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=usDy+fKXI2u6ZA+ePDfvcQ7h1zsyNQL8JpPk88ASuF4=; b=CMmsKTsLEhwV2rn760OcKdO/+SY+luZxGngHTCLjEPXxyAIqJ2VQLSWFmoOCYjkcmR 8tT6SmKK7PexYvP4dmVqwPuoP3C1mCNMCU1FVBrsh7kWJuwf8/+rJUfls/J3uv9UTOT9 i99CzNduPMZ350tpWibkg//6Z1h0/MKlCG3zlHZ0LLIE5k/u3z7D3YUW21NpGKAqDVF8 2/4dy1IuNGUzlxFQQl7mOY7E1ebOYyurzDd90RWcumI0RGFkKY84yeaIWFJOTN10As9Q rbylmpn4nj1ZA2PVoPvlLrc4KHGHn0Qiv9tWmcxYBqOCCNMQkkIJDknky6rH837k0XEi UUrw== 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=usDy+fKXI2u6ZA+ePDfvcQ7h1zsyNQL8JpPk88ASuF4=; b=On8wX3zhz0lbEtOImwostYFC1TF5gZdA2WYSY9vHi2EgjG6az3AoqIJQ1eSz+mn8qo HAN44khdCGQaZ/pB2MwB5w0Gd60amrtn+TrrY7vxpYCAS98U/wwmgPOYnnpUw1FWJZyZ tsx4vl1Md+CCk4xSe49fEfeVcXicZxyfynqbZPEmXMFqsZDWn6X3wEFoPmH8vFs/ALtq 0r1G6HSU5ZMAPw/e0YxcxJKutVoTyNxor3j81bZPD259f83MIgr9rNn+O9y7As3S3mI5 /RD3TpNN1xC9Qgo3Q30ZZ6Why2ZJPwxWkumgWJNMEAPv9lOGcjd4Svt0pClmLmEXpIhl XnFQ== X-Gm-Message-State: AElRT7EKVBypgC4i4f6jYTvepx/QHBSe16lug/OFrf1umgR90DMd3b+M RFs/GjAsT73ekF3KLb8wey+YDQ== X-Google-Smtp-Source: AG47ELtLl2BY23Af7NDjH+u+UsLEEQPSK9dAuw6ZXwriGEsUQ2GfS1L/G9EUFKWIOoiKPKqDnnZXJQ== X-Received: by 10.28.67.65 with SMTP id q62mr10495231wma.110.1520347432158; Tue, 06 Mar 2018 06:43:52 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:44ab:16c7:7c4f:90f9]) by smtp.gmail.com with ESMTPSA id s21sm13419206wra.45.2018.03.06.06.43.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 06:43:51 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 5/6] drm/amdgpu: initial validate the prime BOs into the CPU domain Date: Tue, 6 Mar 2018 15:43:46 +0100 Message-Id: <20180306144347.1702-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180306144347.1702-1-christian.koenig@amd.com> References: <20180306144347.1702-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 Just set the GTT domain as mandatory, so that the BO is validated into it on first use. This allows us to setup the sg table later on. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index fb66b45548d3..44230165e181 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c @@ -106,10 +106,12 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev, ww_mutex_lock(&resv->lock, NULL); ret = amdgpu_bo_create(adev, attach->dmabuf->size, PAGE_SIZE, false, - AMDGPU_GEM_DOMAIN_GTT, 0, sg, resv, &bo); + AMDGPU_GEM_DOMAIN_CPU, 0, sg, resv, &bo); if (ret) goto error; + bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT; + bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT; if (attach->dmabuf->ops != &amdgpu_dmabuf_ops) bo->prime_shared_count = 1;