From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D9305C71157 for ; Wed, 18 Jun 2025 20:16:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79B2310E93E; Wed, 18 Jun 2025 20:16:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="L11xK6pg"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B0D810E93E; Wed, 18 Jun 2025 20:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750277797; x=1781813797; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TleW0sR74ZultZ+4vurCLG+Y8IG4i9egSlRCEL20yVs=; b=L11xK6pg7JQ2Y2+uPaARus68Wb8jSPk88wqg4qfdNpvb2KUs6F1I9EGe FMMZc9P/I3JVYuQ9+Jr0ESYvpDSy5K/kPnCXbKk3/kMeQlS75fVCFGsEv 0pV4kSzy78gQ2cKPTGQHQYLGBdhBInD7SlzNmr9qXAqKlIwDFU8lcPlsp OcK6VBQw5Ef8e1VK2sCjY6mA+ioyo8KWaiEG6TdCQYPvAkQ783gZNezRZ mUjoQhA2c8WGVRUSjMCzz4T13mdnJ7as59EKHkGZJqNQ7zVFqDO4nuy1B vCwcJLucYCQ/i4kQuE+qa6nrF7MtCRv1Abzvzq87gDHj3idkEOKVC6nHB w==; X-CSE-ConnectionGUID: kLVg3PtRS46WXnGK4kz8DA== X-CSE-MsgGUID: gkd89vl0SYSfEoZ2TzWk6w== X-IronPort-AV: E=McAfee;i="6800,10657,11468"; a="52663120" X-IronPort-AV: E=Sophos;i="6.16,246,1744095600"; d="scan'208";a="52663120" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2025 13:16:37 -0700 X-CSE-ConnectionGUID: SnAkpWWuQ/KzyOhT9Ktykw== X-CSE-MsgGUID: TAbJ+j8qQo+csZSmp9IeDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,246,1744095600"; d="scan'208";a="154706385" Received: from bergbenj-mobl1.ger.corp.intel.com (HELO fedora..) ([10.245.244.50]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2025 13:16:32 -0700 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: intel-xe@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , dri-devel@lists.freedesktop.org, himal.prasad.ghimiray@intel.com, apopple@nvidia.com, airlied@gmail.com, Simona Vetter , =?UTF-8?q?Felix=20K=C3=BChling?= , "Philip Yang" , Matthew Brost , =?UTF-8?q?Christian=20K=C3=B6nig?= , dakr@kernel.org, "Mrozek, Michal" , Joonas Lahtinen Subject: [PATCH v5 0/3] drm/gpusvm, drm/pagemap, drm/xe: Restructure migration in preparation for multi-device Date: Wed, 18 Jun 2025 22:16:14 +0200 Message-ID: <20250618201617.54100-1-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" This patchset modifies the migration part of drm_gpusvm to drm_pagemap and adds a populate_mm() op to drm_pagemap. The idea is that the device that receives a pagefault determines if it wants to migrate content and to where. It then calls the populate_mm() method of relevant drm_pagemap. This functionality was mostly already in place, but hard-coded for xe only without going through a pagemap op. Since we might be dealing with separate devices moving forward, it also now becomes the responsibilit of the populate_mm() op to grab any necessary local device runtime pm references and keep them held while its pages are present in an mm (struct mm_struct). On thing to decide here is whether the populate_mm() callback should sit on a struct drm_pagemap for now while we sort multi-device usability out or whether we should add it (or something equivalent) to struct dev_pagemap. v2: - Rebase. v3: - Documentation updates (CI, Matt Brost) - Don't change TTM buffer object type for VRAM allocations (Matt Brost) v4: - Documentation Updates (Himal Ghimiray, Matt Brost) - Add an assert (Matt Brost) v5: - Rebase - Add R-Bs and SOBs. Matthew Brost (1): drm/gpusvm, drm/pagemap: Move migration functionality to drm_pagemap Thomas Hellström (2): drm/pagemap: Add a populate_mm op drm/xe: Implement and use the drm_pagemap populate_mm op Documentation/gpu/rfc/gpusvm.rst | 12 +- drivers/gpu/drm/Makefile | 6 +- drivers/gpu/drm/drm_gpusvm.c | 761 +----------------------- drivers/gpu/drm/drm_pagemap.c | 838 +++++++++++++++++++++++++++ drivers/gpu/drm/xe/Kconfig | 10 +- drivers/gpu/drm/xe/xe_bo_types.h | 2 +- drivers/gpu/drm/xe/xe_device_types.h | 2 +- drivers/gpu/drm/xe/xe_svm.c | 125 ++-- drivers/gpu/drm/xe/xe_svm.h | 10 +- drivers/gpu/drm/xe/xe_tile.h | 11 + drivers/gpu/drm/xe/xe_vm.c | 2 +- include/drm/drm_gpusvm.h | 96 --- include/drm/drm_pagemap.h | 135 +++++ 13 files changed, 1098 insertions(+), 912 deletions(-) create mode 100644 drivers/gpu/drm/drm_pagemap.c -- 2.49.0