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 E7028C25B48 for ; Thu, 26 Oct 2023 04:02:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5ED710E75C; Thu, 26 Oct 2023 04:02:00 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F38B10E756 for ; Thu, 26 Oct 2023 04:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698292914; x=1729828914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hc44vc91Luy5gSYju8OK5LLKARQ6je7d/bA50smnxjU=; b=ZOrflJNFNYF1KMa9lz6oc7PqtYzS3u5vCUJbUX9A1LgQzcbiftQgAflc CEvWJJPyEvHAHOztueAgmcVNKyoMabZLYCXMi2MDZ1snFj6mFiBQeWT/d lhGKsPpB3M91CCECRpK2S1gSK5w0Ub8c7mJapoPHK5eEfennyFq4gmPRc xUZWf+TcRrQnmuGNdrtjlk3E4nDkR+hIf5Gp6Az83PajELvmPxw4F/z/F cELjRGeBq6nnb4neRdlqPfsaSCTfzfaiCsvnWnZ1WH21FggmYzdZKOnzb 840UrDSomLse9+FygLoZOadVwxGiVXgjY+GGhmcEJkiT1aUW0Xe0629gV g==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="377822013" X-IronPort-AV: E=Sophos;i="6.03,252,1694761200"; d="scan'208";a="377822013" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 21:01:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="762682418" X-IronPort-AV: E=Sophos;i="6.03,252,1694761200"; d="scan'208";a="762682418" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 21:01:51 -0700 From: Matthew Brost To: Date: Wed, 25 Oct 2023 21:02:09 -0700 Message-Id: <20231026040213.1272993-23-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026040213.1272993-1-matthew.brost@intel.com> References: <20231026040213.1272993-1-matthew.brost@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH 22/26] drm/xe: Add __xe_migrate_update_pgtables_cpu helper 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 will help implement CPU binds as the submision backend can call this helper when a bind jobs dependencies are resolved. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_migrate.c | 54 +++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index a0cedff0908c..a547c2c6eef7 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -1116,6 +1116,34 @@ struct migrate_test_params { container_of(_priv, struct migrate_test_params, base) #endif +static void +__xe_migrate_update_pgtables_cpu(struct xe_vm *vm, struct xe_tile *tile, + const struct xe_migrate_pt_update_ops *ops, + struct xe_vm_pgtable_update_op *pt_op, + int 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]; + + 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) @@ -1128,7 +1156,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 j, i; if (XE_TEST_ONLY(test && test->force_gpu)) return ERR_PTR(-ETIME); @@ -1140,28 +1167,9 @@ xe_migrate_update_pgtables_cpu(struct xe_migrate *m, return ERR_PTR(err); } - for (j = 0; j < pt_update_ops->num_ops; ++j) { - const struct xe_vm_pgtable_update_op *pt_op = - &pt_update_ops->ops[j]; - - for (i = 0; i < pt_op->num_entries; i++) { - const struct xe_vm_pgtable_update *update = - &pt_op->entries[i]; - - 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(vm, m->tile, ops, + pt_update_ops->ops, + pt_update_ops->num_ops); return dma_fence_get_stub(); } -- 2.34.1