From patchwork Tue Oct 29 10:40:47 2019 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: 11218007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C4D414DB for ; Tue, 29 Oct 2019 14:36:35 +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 43F3A2087E for ; Tue, 29 Oct 2019 14:36:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43F3A2087E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B54A86EB80; Tue, 29 Oct 2019 14:36:31 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E73B6EB55; Tue, 29 Oct 2019 10:40:56 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id g7so1968219wmk.4; Tue, 29 Oct 2019 03:40:56 -0700 (PDT) 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=JrtmnJD8rRoA4aU6RxbjoQ7ftgr4ATrOSLPRwD6iD7I=; b=Q6jfyUTOhF2mnhZyNBz3nBqMgckTpG27VW+8OQklRtinFdXg9dHZOcxMhj9GqI42Si RegITFYCR/vUrrU5a/i4kJ8qDo7nEadR0Kp5Nf57294fDqufejQqijLqTAPHzso1gUhi qk5YKddo7pZQl1cGXz7IeoQEhH3YNxgTyIlVFSa4ntT25OwZ3YLdcBvyD0J6GGKCxBZe nyWkve3P1YI3lV8lAm8zCEPpZqFta+2dfKIYuSvlAotWWIApccM8ygRaDMI+hN5mT1Tx EyhR81bYPmlRNUZkGOmko7OlP+p7lxAvmEseyHnynS4Fp5CnVEJwo7owpR70I43K6Rpz vQ6g== X-Gm-Message-State: APjAAAWimX/Wx8UkjOX88YZYRLzjWwo2EnFntmX+BCFEg95MvaYXD4BO knzM2vHnbHp+P4YyhZkSCYawpTMD X-Google-Smtp-Source: APXvYqywd45SuZHc6tzGxan37IIvXllMU1fkjAN+J9Wuzvbw2vsvSsaL6CXVyAifdCs1CAlLtXsGfA== X-Received: by 2002:a1c:6588:: with SMTP id z130mr3091142wmb.87.1572345654660; Tue, 29 Oct 2019 03:40:54 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:c5d9:7998:9ca6:452]) by smtp.gmail.com with ESMTPSA id v10sm2910210wmg.48.2019.10.29.03.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 03:40:54 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, sumit.semwal@linaro.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org Date: Tue, 29 Oct 2019 11:40:47 +0100 Message-Id: <20191029104049.9011-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191029104049.9011-1-christian.koenig@amd.com> References: <20191029104049.9011-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 29 Oct 2019 14:36:30 +0000 X-Mailman-Original-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=JrtmnJD8rRoA4aU6RxbjoQ7ftgr4ATrOSLPRwD6iD7I=; b=IrsHzhrnBciJGRA3vcwXhL5uTgBSW7l03hLEhfoHyNB1ADGdSuQsA+09JtfHGuJIMC yfU2/CoIUdwdTIW1u2rPkTfQFzMi+sKJ9UgYF33GLmaB9VXUpdSZNhAEB8NprulFOfle QrxxZVwz6ww1gEr8NdiX4ABgltm6tICR+oEDz6gGBlclQZbjupE5LaCXDMxQ4dfmZQGC DV0U1oQjL3CzBZsG5p/n2t4xvzk9bYBiisOmp/g3ME/hKSNO1Q67wPbmn/wAVRWseZzV MuIfjSBMwBQzrojRad8AtQKeA/f45tqKyxvLveo7TtxVVN5uV++3hyBBwXZJ68eu+7vK TFWw== Subject: [Intel-gfx] [PATCH 3/5] drm/amdgpu: use allowed_domains for exported DMA-bufs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Avoid that we ping/pong the buffers when we stop to pin DMA-buf exports by using the allowed domains for exported buffers. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 253158fc378f..0253e0889daf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -414,7 +415,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p, /* Don't move this buffer if we have depleted our allowance * to move it. Don't move anything if the threshold is zero. */ - if (p->bytes_moved < p->bytes_moved_threshold) { + if (p->bytes_moved < p->bytes_moved_threshold && + (!bo->tbo.base.dma_buf || + list_empty(&bo->tbo.base.dma_buf->attachments))) { if (!amdgpu_gmc_vram_full_visible(&adev->gmc) && (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)) { /* And don't move a CPU_ACCESS_REQUIRED BO to limited