From patchwork Wed Mar 11 13:51:56 2020 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: 11431969 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 8FCC913B1 for ; Wed, 11 Mar 2020 15:04:40 +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 C2D6F206E7 for ; Wed, 11 Mar 2020 15:04:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dS70QwaB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2D6F206E7 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 3054E6E9A9; Wed, 11 Mar 2020 15:04:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id C39DF6E1F7; Wed, 11 Mar 2020 13:52:06 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id n2so2224578wmc.3; Wed, 11 Mar 2020 06:52:06 -0700 (PDT) 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=BrBZ7BRIxlz8FrRAnyr/unjtGHr0zUbPTL3/EC4XXLw=; b=dS70QwaBALfXqGFh/hPS8VDcp5/7jII+D3MVVverNaHTK0+3xxLLx5wdKoel7HDXvH 2arfrNFDrlq4xaO0fExSZFdqDXFqzM/swpL9Yh3vbc2a420rhI6Yf8H7uW/PYnHz0798 Ub6jVwv4dTq8r3RDb5Z1Wu8tkx23tosGteiETYrR/esHHoiQouzpRG5TBWDMnZg4Xv0d JZ8lW2kXCthRwELDrGi5AdQyu8Cd3mvP682JoPMNBkIoX4wIy9WiC8H7psnVj99+7vgq 1XQ5Oy2eNN+1260mvCQiVl9c8lRsZaa9vHb239GMQLVVtNFZOTD2lxsEDS2iijhG6Y1U 4wRQ== 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=BrBZ7BRIxlz8FrRAnyr/unjtGHr0zUbPTL3/EC4XXLw=; b=J5nT2C+KayKLmNggsIOF0dqsmXJcm1bqMcW1O+SMfhFvYH0p+trBBNFBqbOr84+8xG cjnCjL2hveGGANy/jltN4TTw1v/YtmFS6EYqyE9+1O5fBLiE7A5dQCmgWPsXq7y2nTvt 7+0NFNPLryWQ7/7LVHzYvSLSrvdYkKgrPNtSKZ+jmoOfQt0sZozkFtEZScQMZZPCLM30 K740w+r1KRh65gav/00DOUj8GWDkgkhm3NdC/w4SUrkd3kTcDiY6XwUH2wD1iQs8YX8r C+zkINfpdaE/zQVJcvzSPqMPe68XdE3ByP1fqv+euw9OKNYuWUlUcVUO1JGOtpC0lQnO 1NBA== X-Gm-Message-State: ANhLgQ0HAZ/4gnN5opOztwJXRvOxDgeRb8Cp0lp8Mx/OGP8yrwIw7RHJ V5YmhtNpzm54AF4GjPO9N3A= X-Google-Smtp-Source: ADFU+vsPAfdCms9K/oMpKj27gQSzAvyZZSi4wAa/XqnIbxORrNV6RGa/WoMb+HcXHpWWm6Gw162qsA== X-Received: by 2002:a1c:35c6:: with SMTP id c189mr3752519wma.108.1583934725433; Wed, 11 Mar 2020 06:52:05 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:8dc:e796:e7da:a319]) by smtp.gmail.com with ESMTPSA id 138sm3183811wmb.21.2020.03.11.06.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 06:52:04 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: David1.Zhou@amd.com, hch@infradead.org, jgg@ziepe.ca, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org Date: Wed, 11 Mar 2020 14:51:56 +0100 Message-Id: <20200311135158.3310-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200311135158.3310-1-christian.koenig@amd.com> References: <20200311135158.3310-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 11 Mar 2020 15:04:30 +0000 Subject: [Intel-gfx] [PATCH 4/6] drm/amdgpu: add checks if DMA-buf P2P is supported X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Check if we can do peer2peer on the PCIe bus. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c index aef12ee2f1e3..bbf67800c8a6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -38,6 +38,7 @@ #include #include #include +#include /** * amdgpu_gem_prime_vmap - &dma_buf_ops.vmap implementation @@ -179,6 +180,9 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf, struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); int r; + if (pci_p2pdma_distance_many(adev->pdev, &attach->dev, 1, true) < 0) + attach->peer2peer = false; + if (attach->dev->driver == adev->dev->driver) return 0;