From patchwork Thu Feb 10 07:28:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12741504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92BBCC433F5 for ; Thu, 10 Feb 2022 07:29:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3041C6B0071; Thu, 10 Feb 2022 02:29:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B4386B0098; Thu, 10 Feb 2022 02:29:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 154E96B0099; Thu, 10 Feb 2022 02:29:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 033F76B0071 for ; Thu, 10 Feb 2022 02:29:40 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C1F459791D for ; Thu, 10 Feb 2022 07:29:39 +0000 (UTC) X-FDA: 79126045278.21.46125E1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf06.hostedemail.com (Postfix) with ESMTP id 6E7E2180004 for ; Thu, 10 Feb 2022 07:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=jUampNuN0AAfy565dU6BaB5W601SZBgSqrEDAPl/+vc=; b=sDnGGhHbueSF3Ak0EohahA9BV4 rqaWiiPucO1EyVfXvpG5bVDtmX6Yd3CSVEQmrwHdbSLa5+QpAUXIvVH7LtwHdLXngY/sK/NbnxiaY 4prWu/9NtnKuMr/o/Kw2RD0ICezVdRCaAyzcCDqSukrxAUshHCIt6sx7MqRb82MaPMRNJq5bDI07S /U8WRjhnQROEK1Av44QWdwlN7RaTDxSO20qmeAKfQxkWWvE9GP3z9LMcPS2uV8X7d9h0f6XvF6dXl l0VoAuAyX1iyPbWaLNnFaT7OT9zw9Hvqkbxw0sLTGxsYFnL3lxu6nY+f8XedbOG3RuA1cbR+3ezZw RwbalyQw==; Received: from [2001:4bb8:188:3efc:8014:b2f2:fdfd:57ea] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI3tN-002sCq-6Z; Thu, 10 Feb 2022 07:29:25 +0000 From: Christoph Hellwig To: Andrew Morton , Dan Williams Cc: Felix Kuehling , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , Ben Skeggs , Karol Herbst , Lyude Paul , Jason Gunthorpe , Alistair Popple , Logan Gunthorpe , Ralph Campbell , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, nvdimm@lists.linux.dev, linux-mm@kvack.org, Alex Sierra Subject: [PATCH 19/27] drm/amdkfd: coherent type as sys mem on migration to ram Date: Thu, 10 Feb 2022 08:28:20 +0100 Message-Id: <20220210072828.2930359-20-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220210072828.2930359-1-hch@lst.de> References: <20220210072828.2930359-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=sDnGGhHb; dmarc=none; spf=none (imf06.hostedemail.com: domain of BATV+4801fb5fa93fa27e8109+6745+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+4801fb5fa93fa27e8109+6745+infradead.org+hch@bombadil.srs.infradead.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6E7E2180004 X-Stat-Signature: c4usjkasdieajk59mnuze9ufkxyc9tae X-HE-Tag: 1644478179-205370 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Alex Sierra Coherent device type memory on VRAM to RAM migration, has similar access as System RAM from the CPU. This flag sets the source from the sender. Which in Coherent type case, should be set as MIGRATE_VMA_SELECT_DEVICE_COHERENT. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index 2c51f2ac3b46ac..6646291d75d574 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -659,9 +659,12 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange, migrate.vma = vma; migrate.start = start; migrate.end = end; - migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE; migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev); + if (adev->gmc.xgmi.connected_to_cpu) + migrate.flags = MIGRATE_VMA_SELECT_DEVICE_COHERENT; + else + migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE; size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t); size *= npages; buf = kvmalloc(size, GFP_KERNEL | __GFP_ZERO);