Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2752054pxb; Mon, 31 Jan 2022 03:36:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeztPPyEFWr7sgdDExLtgGoY8uy8otoNxYFBoBfQdNuSX2bmh8TcJeOzHqwJhm2GnLXHlZ X-Received: by 2002:a62:7bcf:: with SMTP id w198mr19808018pfc.12.1643628905059; Mon, 31 Jan 2022 03:35:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643628905; cv=pass; d=google.com; s=arc-20160816; b=KZhIZK8PQklTAipJ1YkQZxUImUL7PZEvpJoTuX20S6RHRAHcjo2mASK9PRQ8LbsBau mkRce/V4bGDdAfbH8ttwStUdDWkszfzJWRLCOdRDvBasnXMyDd1QOlLesCHHu5rFdBII 2oD8rX9gelYSsG/pVPqvz97WSWb/phgxR8biJ8gTBOPBDjULGcjK4CRKscg0/oRuMDen XTVA1GT1JJAhWLg0BQ6TI0jsDk0FvSajmx56PcrzDwqgFC8ADRfkJrEGueleLD0Gq9JT TBem3qseJWx3/jVZWWnB6mE0UMvzlSEnDRdROQacTzjdJsY/pDOthHFTy6oNFVpk9Ijt bIAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cKdah9ociAAjWA8oWytWUkonkykx0MrDTa+hoh93Wfs=; b=dDGg5kGdbTdUsHHNYc7I/NQP33rmSrsOCZLmwhQQpuSlmyVxIY3dkRZNt0KisexlFy aTyrFH8Z+lVxWRZ8xYdCCR/cxnN8w9+g7c5yJJrWiP8pSJF7cHEzvFCTgvjK14B4Lw2j Cd3fZt3cvLqp5LdQvndGfiKgczBWeygiIbqmLjBg4GilD1YMG91h3BvKhE/Ky+JZ7Ui6 KuDgQAkEXI3/uFPsUo1LJhLXHFKkIyUht5qyfBBZ9sgj/Rof8yk+TMuc7HvPNLjEd5GU TI6N7Vyfj6lwysPIi06uebfNH6k7IdqnkuC5PmO2IbCUtEpd90Ze+5B6HL17/8b4AAMK rDrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=M8Gvx6oG; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si9402561pjx.70.2022.01.31.03.34.52; Mon, 31 Jan 2022 03:35:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=M8Gvx6oG; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351161AbiA1UJC (ORCPT + 99 others); Fri, 28 Jan 2022 15:09:02 -0500 Received: from mail-sn1anam02on2056.outbound.protection.outlook.com ([40.107.96.56]:35138 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1351139AbiA1UI5 (ORCPT ); Fri, 28 Jan 2022 15:08:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKW2u8eN2V/lb2x70V94SyGJMwPr2u5JZo/jZzuzsCwqWipXIU9jh3cIw5sH57RWJMn3fQv8WmUBp0N48IvEos4Hx9LlmW7PzBtUg4z5Y0ceDVEgqafTT60JfauJycyIkQDB9bhcO4Bxejo02eWx+ix/UVHhyiIbs44dD367EHK7lcfGtZjtxC3nySKGMWb/sbxuPfojwqD6VvqlGU5PEYTyYNMzzHCTBKosDLP/EKOJbHI3aE3fMrek/QVmOZP7VLfRVAUFfTi7fuqNZAs29V1gD+0T3oMUKbcdgbHehdHqJDhrp/K3/f586dT18Vecu45BkVpnM3UqQiZh3KNZ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cKdah9ociAAjWA8oWytWUkonkykx0MrDTa+hoh93Wfs=; b=BalulE5x/gHeqpWxONIxaixkE6JnOpBi7Rf3I4yHCpZ6+go+L30GCa/Q3pyUV34/E841lvA2d++lICsKsjJhSTC7ZE1KTEbnpVyN/x3hHpWyoovmixYab5IJtdQ2Wn5Ora/G94hP+WARw/aDHdXbMPXy5wwRS0gy6cZZYZU2HlOi79i1//yag4e+w5X93EZqWwCqCiBXgi+4ZUvVBP1BGRC+aaXswhnf89Oernmpf7RaZaFQGxPmS9AlFCfEUDER6A3qeXaapo/eR7+hsQkLEg6iPsihj3eSGZnnUJwvX7N4TUUCeOmqd1b1UP81fjftAja1fKpuencJqMZR+tIQew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cKdah9ociAAjWA8oWytWUkonkykx0MrDTa+hoh93Wfs=; b=M8Gvx6oGJiBTIIPDW+tOI8Ix4BbJCgCduQ9tzEp+UJ2Ntm07Fa5dz7miSeaXNDYtkQf1ukMHxKonDJjYVvVTSIvuE8YXAVI3trw4PS/q52zqVLuZDUFiA/ioUEOGs12uIFuN+qFsdHbFKKg/3omwL/rCECWDXUsNh6IvWF6rr2k= Received: from MWHPR19CA0072.namprd19.prod.outlook.com (2603:10b6:300:94::34) by BY5PR12MB4068.namprd12.prod.outlook.com (2603:10b6:a03:203::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Fri, 28 Jan 2022 20:08:55 +0000 Received: from CO1NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:300:94:cafe::17) by MWHPR19CA0072.outlook.office365.com (2603:10b6:300:94::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.17 via Frontend Transport; Fri, 28 Jan 2022 20:08:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT022.mail.protection.outlook.com (10.13.175.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4930.15 via Frontend Transport; Fri, 28 Jan 2022 20:08:55 +0000 Received: from alex-MS-7B09.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Fri, 28 Jan 2022 14:08:53 -0600 From: Alex Sierra To: , , , , , CC: , , , , , , Subject: [PATCH v5 05/10] drm/amdkfd: coherent type as sys mem on migration to ram Date: Fri, 28 Jan 2022 14:08:20 -0600 Message-ID: <20220128200825.8623-6-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220128200825.8623-1-alex.sierra@amd.com> References: <20220128200825.8623-1-alex.sierra@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c4a7eac3-f2b5-4dfb-4595-08d9e29a0320 X-MS-TrafficTypeDiagnostic: BY5PR12MB4068:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ivIm9OFEQDGJtC1pCqekWnu5B3EY/r8eY4s0x3DxbUwwd48NNY1oXLGCVHl68ZZMA9YU194LNP3Sm6magQqGghIkSV3FwNYjezb92n0vaL3kAcUWn5g1osuFe6STvccZMei2//Yct6J3oEmO8kCT8yEWwVglqz9tb5CdBFmhcqHUapEjJPGFkpjfrbzBx66+8xaaDYlA0+1C93TLiCWVnp5PDmqf/SwiK3ftrCjLiz+00BlwSjEHyXywEMcY13K4DQfnzCd0HMnsv2G+RqaZYOjCaGHw9PLQ6ASUw2SHPStIROPldb9dOoq+tkOzcKqW754WRjPObZ1qAgw4XfMcmvCszFu2eJ6kFEBSqGl8OiwegBZ+XYKiaUk8Q+UxYRtjHnvdda01brl4Euukcqao/e435oSBVc3alnyDblkcb8EM7FOjLEpojHOYCLh5Iiq1WJyayvMMETeQPiwRhIHZecCrnenglz+jev5RpRhptruFzJusO3dGhX18gjXNQyt4bqwzfZxW28QYwsFxWqER0bz/UhYeYGHQ/ViTm/uMJNkMY/Q8/FQFrb1izI00A9amg63rwcSCrgm15NxsnOBLtbqp9rWT0bL6q7Qv8Fy2RfYvUow5pc3vHewUa0dITdxtnVOE2KzA8EVrf/+XkFPG/ccKuwIJ1stvmW7K/pZohfzCOTd/P/Hg7IN/tGA37O01rffyXa08zehKsfAyT6P3iA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(7696005)(6666004)(40460700003)(36756003)(508600001)(54906003)(110136005)(316002)(26005)(7416002)(4326008)(70586007)(70206006)(8936002)(8676002)(82310400004)(2906002)(16526019)(426003)(2616005)(1076003)(83380400001)(86362001)(47076005)(336012)(186003)(5660300002)(81166007)(44832011)(356005)(36860700001)(36900700001)(20210929001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 20:08:55.3048 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4a7eac3-f2b5-4dfb-4595-08d9e29a0320 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4068 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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 5e8d944d359e..846ba55723fb 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); -- 2.32.0