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 7D10BC79F97 for ; Fri, 4 Sep 2026 21:16:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDFF910FB53; Fri, 4 Sep 2026 21:16:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Ftv+fQ9P"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 22AAA10E42F for ; Fri, 4 Sep 2026 21:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788556581; x=1820092581; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tKnM+GazFSxwfln1/qX/fDBu0bmNVEp1H7Ehlp8csMU=; b=Ftv+fQ9PDx+aZHhwVcZiIWo5WPD33jRIIN53aXZ2Q5J27nK3smEtI7LC Wtug0EScjdCEw6WVha8ZDtR8I71NKZmVZScmiUGkQyumVC/+lcQKK7fOB 4keSxJ1rLd3FEBDjP+DXdrr9IPxVI5A9iikCCGOTNgWsecNo6x61Si0sV SXDC0Kns7lVdPtdC91T65P+m5+um5mKcyDJDYMuX68VhoBWjmPlrccWAG Wjr+IyIPG5NUCPwigaeNKRlObZv8XtuHJ8TT89QleCa9tpNuhscJ9cAVt AiY2No1pNDimKyOh/YatvGdnIyArB79Uqrz6cyOVORN1SK2vORPY+qbVY g==; X-CSE-ConnectionGUID: O9q5ydUYQOmvduoiTU3Swg== X-CSE-MsgGUID: or27xVeUQy6iIkgShLbjyw== X-IronPort-AV: E=McAfee;i="6800,10657,11896"; a="89096799" X-IronPort-AV: E=Sophos;i="6.25,262,1779174000"; d="scan'208";a="89096799" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2026 14:16:20 -0700 X-CSE-ConnectionGUID: r2XPpwAUR9ezaeymfY9leg== X-CSE-MsgGUID: 0XcU/e0sRQaxtllmSGL+Qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,262,1779174000"; d="scan'208";a="267563410" Received: from gsse-cloud1.jf.intel.com ([10.54.39.91]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2026 14:16:20 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org Cc: Francois Dugast Subject: [PATCH v6 02/24] drm/xe: Add xe_migrate_update_pgtables_cpu_execute helper Date: Fri, 4 Sep 2026 14:15:51 -0700 Message-Id: <20260904211613.3934307-3-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260904211613.3934307-1-matthew.brost@intel.com> References: <20260904211613.3934307-1-matthew.brost@intel.com> 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" Add the xe_migrate_update_pgtables_cpu_execute helper, which performs the CPU-side page-table update. This will support implementing CPU binds, as the submission backend can call this helper once a bind job’s dependencies are resolved. While here, add assertions to provide basic sanity checks on tht function arguments. Signed-off-by: Matthew Brost Reviewed-by: Francois Dugast Link: https://patch.msgid.link/20260228013501.106680-3-matthew.brost@intel.com Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/xe/xe_migrate.c | 58 ++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index 149c5fa654e6..68a0b05f56ec 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -1819,6 +1819,38 @@ struct migrate_test_params { container_of(_priv, struct migrate_test_params, base) #endif +static void +xe_migrate_update_pgtables_cpu_execute(struct xe_vm *vm, struct xe_tile *tile, + const struct xe_migrate_pt_update_ops *ops, + struct xe_vm_pgtable_update_op *pt_op, + u32 num_ops) +{ + u32 j, i; + + for (j = 0; j < num_ops; ++j, ++pt_op) { + for (i = 0; i < pt_op->num_entries; i++) { + const struct xe_vm_pgtable_update *update = + &pt_op->entries[i]; + + xe_tile_assert(tile, update); + xe_tile_assert(tile, update->pt_bo); + xe_tile_assert(tile, !iosys_map_is_null(&update->pt_bo->vmap)); + + if (pt_op->bind) + ops->populate(tile, &update->pt_bo->vmap, + NULL, update->ofs, update->qwords, + update); + else + ops->clear(vm, tile, &update->pt_bo->vmap, + NULL, update->ofs, update->qwords, + update); + } + } + + trace_xe_vm_cpu_bind(vm); + xe_device_wmb(vm->xe); +} + static struct dma_fence * xe_migrate_update_pgtables_cpu(struct xe_migrate *m, struct xe_migrate_pt_update *pt_update) @@ -1831,7 +1863,6 @@ xe_migrate_update_pgtables_cpu(struct xe_migrate *m, struct xe_vm_pgtable_update_ops *pt_update_ops = &pt_update->vops->pt_update_ops[pt_update->tile_id]; int err; - u32 i, j; if (XE_TEST_ONLY(test && test->force_gpu)) return ERR_PTR(-ETIME); @@ -1843,28 +1874,9 @@ xe_migrate_update_pgtables_cpu(struct xe_migrate *m, return ERR_PTR(err); } - for (i = 0; i < pt_update_ops->num_ops; ++i) { - const struct xe_vm_pgtable_update_op *pt_op = - &pt_update_ops->ops[i]; - - for (j = 0; j < pt_op->num_entries; j++) { - const struct xe_vm_pgtable_update *update = - &pt_op->entries[j]; - - if (pt_op->bind) - ops->populate(m->tile, - &update->pt_bo->vmap, NULL, - update->ofs, update->qwords, - update); - else - ops->clear(vm, m->tile, - &update->pt_bo->vmap, NULL, - update->ofs, update->qwords, update); - } - } - - trace_xe_vm_cpu_bind(vm); - xe_device_wmb(vm->xe); + xe_migrate_update_pgtables_cpu_execute(vm, m->tile, ops, + pt_update_ops->ops, + pt_update_ops->num_ops); return dma_fence_get_stub(); } -- 2.34.1