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 F3ED2CCF9F8 for ; Wed, 5 Nov 2025 15:12:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5917D10E77D; Wed, 5 Nov 2025 15:12:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="QhM787yz"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 56EC110E6C8; Wed, 5 Nov 2025 15:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762355528; x=1793891528; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=CVjqfeR12Xyzu8V1OQp2jQi6WGSSn1l2qx2ax7lIGm4=; b=QhM787yz4sCwAQgCbCgrJSmmPEJGnYhUxUs/ahcfiALMZABllTMeOURr LkBy1KWUE2TIOojoFFjkznLTRBtWC7Gq6wBuLGSEBQAGUaKb+kxO32eW1 DSnfilrZk7c4RXiQIYa5mvAFODK4q+zd6QAH6g+EY1hxnQTf/mYUFMbtc F5D0kdLPOQbFhSuxOZxjxiyRaajJKkHFMBJetJeyaiPUk7UcIV3Ac9+0Q Qwv2OBHFX1Huf/oCSGc1jI/DpL3sV/s4VNzfjdT5HdOElo1Z4iICOoC7q fg0bNzbjnu39G72Q75jXgkT17BjuyHSSifpwlC4VWbe+qGv8uGQKdvIIP A==; X-CSE-ConnectionGUID: WPqxnWD9Svq69fLePJZ6iA== X-CSE-MsgGUID: vPLdth5sQf2w8E9EA3vUHQ== X-IronPort-AV: E=McAfee;i="6800,10657,11603"; a="64387019" X-IronPort-AV: E=Sophos;i="6.19,282,1754982000"; d="scan'208";a="64387019" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2025 07:12:08 -0800 X-CSE-ConnectionGUID: 2rvrECN7TtSl5Q1rBCCn/g== X-CSE-MsgGUID: 7+BUixknQ4aNiV3T7/xqww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,282,1754982000"; d="scan'208";a="186766482" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by orviesa010.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2025 07:12:07 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27; Wed, 5 Nov 2025 07:12:07 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27 via Frontend Transport; Wed, 5 Nov 2025 07:12:07 -0800 Received: from BN1PR04CU002.outbound.protection.outlook.com (52.101.56.7) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27; Wed, 5 Nov 2025 07:12:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uLWsdOZV5II3LS96pH+P2KQXRpCzGZZzUE6PZpt36+Mmc1YgGEO6dPBk6s6UDsAvEQ88Nq/YfSr5hLGmX9E/KfvmkTunQJnC8L9wqMbxZbNjZvNVOigVCfxsRvkNApb+VksdZq058l0FsxV8GSRH1FNhv+HfIJuRrbi+9hkuMx9UkTwNe2EafAsOFAazJkOpO1hMv/CP/+3COyUjjeL/ZUrHpvK2aX6Hu1LivmlChao5FJqjeZ8pxzcZ0f3WZRNpHzLlKHCcz6jOVSTRazJm175Bs7r5VdoND3G/dnRwnsxf3QK/yhp40dC7Ag6Wa6SUWUpnNLp9a3gq0hHLjuDXpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bgV8G2AT70uYdGuxPDmZ/ytF37C6MNJibsl0ainXu94=; b=uGzCWQBY4rfyRZA4Y13lgTrRL2uHfitvppCrGnZfIgqrCzTZKtVka2jpbwr3TowEBJNrqUdHCUIH5D7PkpY6n+9nhwKT7ZrJrfyxw15g0BG/6Wb4ZBo5OJxTpVEvBaSHWPJJmPfRduf/iSvw4KBcFVk5igYoRIbDyirJgvJbwwv1Xgmg2RBU8O+XFMA9c8zJhwFfII68M2qNu5GywUnLe/uvIRjspcVRdbEoPWZn4RaoM7heRVm2XOXKIscBrZvt4RM/NqNhB865IWQt9h8DsfStwCadoiO1XLZFM6lSxKxky+IEgVagQVxgQcED3oI8H+TjoPnZN/BeNVFCaFtXBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by DM4PR11MB8226.namprd11.prod.outlook.com (2603:10b6:8:182::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.9; Wed, 5 Nov 2025 15:12:01 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::927a:9c08:26f7:5b39]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::927a:9c08:26f7:5b39%5]) with mapi id 15.20.9298.007; Wed, 5 Nov 2025 15:12:01 +0000 From: =?UTF-8?q?Micha=C5=82=20Winiarski?= To: Alex Williamson , Lucas De Marchi , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Rodrigo Vivi , Jason Gunthorpe , Yishai Hadas , Kevin Tian , Shameer Kolothum , , , , Matthew Brost , "Michal Wajdeczko" CC: , Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Simona Vetter , "Lukasz Laguna" , Christoph Hellwig , =?UTF-8?q?Micha=C5=82=20Winiarski?= Subject: [PATCH v4 15/28] drm/xe/pf: Switch VF migration GuC save/restore to struct migration data Date: Wed, 5 Nov 2025 16:10:13 +0100 Message-ID: <20251105151027.540712-16-michal.winiarski@intel.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251105151027.540712-1-michal.winiarski@intel.com> References: <20251105151027.540712-1-michal.winiarski@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BE1P281CA0278.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:84::13) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|DM4PR11MB8226:EE_ X-MS-Office365-Filtering-Correlation-Id: 23315a62-7e3f-42f3-7c06-08de1c7daba1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|7416014|366016|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alMxQm9BbndTbWRVMlAxRDRub1oySmtpUDVPUHZ6VGY1amVvZVo5R2Jx?= =?utf-8?B?L1hBaUU1MC9teDAwdUx0cDNla2hlK0xNeSsxeHVQZVdjMmpmQmhXSnpPM0dt?= =?utf-8?B?NDNENDI5RmVBWC9BWnkvSE9sdUluSzNRU1NvT0FRRFg0OXdUUnZXaTdSa296?= =?utf-8?B?M2QyekJLak9ubFd6QXF0dkxoUlkrOWpoTStqMFBRbzk2bFd2ZzU0bTNneU1h?= =?utf-8?Q?+QzsTQE+H5LnJBKWCgggkem9G+6ivI=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(7416014)(366016)(1800799024)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?a2dtQU9oMGc1eVBEUFlES3ZEaWNWdmhXT2J5UHU1a3pXMUlqY0ZhT3h3Z2Q4?= =?utf-8?B?MFg0RDVESTgrbXVYVDR0R0lGa1RiUnE0N21QUWNvSngxRHNvNFdlUWNtOGVD?= =?utf-8?B?WkNuS29WTTlaZDI1UnJvem5UOGIwNHBxS0I2aUt0bWtxNnNDWjR6dmlpVG1B?= =?utf-8?B?TlNIWFU1S09TZXRGZnBEc1p2akNyQWhpZ2NHR3E2Nnh2MlNXRE95b1NPRHND?= =?utf-8?B?SGJTc2Y1eEVBeUhPclBtTkRia0x1NnF0QXZRaUpPSWRtVDNVbWZXTWFlZG9l?= =?utf-8?B?cStmeWVLWWJMdlJsNmdtY0UvakRoYURWT0JzcDJ3N2ZVMkFHbnYrTk14Z1gz?= =?utf-8?B?UnpzcE81azUvRWgraTBPWWgzSy9iaUlYcHVkblRKNWFjazZiNzlRTHExNEdr?= =?utf-8?B?bTNsaWN6em9Oa2Q4e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e3f-42f3-7c06-08de1c7daba1 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2025 15:12:01.3557 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rjsS0L+PlrewNcHReRkWB9mWsXBewZXz92QfWppurAxMAjeU8Kl42Gt2aFv8/9/jHgbRit4YoPvHz+OSEhwI3PcwC7PT08Ci6ckU1jTAzZA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB8226 X-OriginatorOrg: intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In upcoming changes, the GuC VF migration data will be handled as part of separate SAVE/RESTORE states in VF control state machine. Now that the data is decoupled from both guc_state debugfs and PAUSE state, we can safely remove the struct xe_gt_sriov_state_snapshot and modify the GuC save/restore functions to operate on struct xe_sriov_migration_data. Signed-off-by: MichaƂ Winiarski Reviewed-by: Michal Wajdeczko --- drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 265 +++++------------- drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h | 13 +- .../drm/xe/xe_gt_sriov_pf_migration_types.h | 27 -- drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h | 4 - 4 files changed, 79 insertions(+), 230 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c index 88371c205add7..6e2b076065f3b 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c @@ -28,6 +28,19 @@ static struct xe_gt_sriov_migration_data *pf_pick_gt_migration(struct xe_gt *gt, return >->sriov.pf.vfs[vfid].migration; } +static void pf_dump_mig_data(struct xe_gt *gt, unsigned int vfid, + struct xe_sriov_packet *data, + const char *what) +{ + if (IS_ENABLED(CONFIG_DRM_XE_DEBUG_SRIOV)) { + struct drm_printer p = xe_gt_dbg_printer(gt); + + drm_printf(&p, "VF%u %s (%llu bytes)\n", vfid, what, data->size); + drm_print_hex_dump(&p, "mig_hdr: ", (void *)&data->hdr, sizeof(data->hdr)); + drm_print_hex_dump(&p, "mig_data: ", data->vaddr, min(SZ_64, data->size)); + } +} + /* Return: number of dwords saved/restored/required or a negative error code on failure */ static int guc_action_vf_save_restore(struct xe_guc *guc, u32 vfid, u32 opcode, u64 addr, u32 ndwords) @@ -47,7 +60,7 @@ static int guc_action_vf_save_restore(struct xe_guc *guc, u32 vfid, u32 opcode, } /* Return: size of the state in dwords or a negative error code on failure */ -static int pf_send_guc_query_vf_state_size(struct xe_gt *gt, unsigned int vfid) +static int pf_send_guc_query_vf_mig_data_size(struct xe_gt *gt, unsigned int vfid) { int ret; @@ -56,8 +69,8 @@ static int pf_send_guc_query_vf_state_size(struct xe_gt *gt, unsigned int vfid) } /* Return: number of state dwords saved or a negative error code on failure */ -static int pf_send_guc_save_vf_state(struct xe_gt *gt, unsigned int vfid, - void *dst, size_t size) +static int pf_send_guc_save_vf_mig_data(struct xe_gt *gt, unsigned int vfid, + void *dst, size_t size) { const int ndwords = size / sizeof(u32); struct xe_guc *guc = >->uc.guc; @@ -86,8 +99,8 @@ static int pf_send_guc_save_vf_state(struct xe_gt *gt, unsigned int vfid, } /* Return: number of state dwords restored or a negative error code on failure */ -static int pf_send_guc_restore_vf_state(struct xe_gt *gt, unsigned int vfid, - const void *src, size_t size) +static int pf_send_guc_restore_vf_mig_data(struct xe_gt *gt, unsigned int vfid, + const void *src, size_t size) { const int ndwords = size / sizeof(u32); struct xe_guc *guc = >->uc.guc; @@ -115,120 +128,66 @@ static bool pf_migration_supported(struct xe_gt *gt) return xe_sriov_pf_migration_supported(gt_to_xe(gt)); } -static struct mutex *pf_migration_mutex(struct xe_gt *gt) +static int pf_save_vf_guc_mig_data(struct xe_gt *gt, unsigned int vfid) { - xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); - return >->sriov.pf.migration.snapshot_lock; -} - -static struct xe_gt_sriov_state_snapshot *pf_pick_vf_snapshot(struct xe_gt *gt, - unsigned int vfid) -{ - xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); - xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt))); - lockdep_assert_held(pf_migration_mutex(gt)); - - return >->sriov.pf.vfs[vfid].snapshot; -} - -static unsigned int pf_snapshot_index(struct xe_gt *gt, struct xe_gt_sriov_state_snapshot *snapshot) -{ - return container_of(snapshot, struct xe_gt_sriov_metadata, snapshot) - gt->sriov.pf.vfs; -} - -static void pf_free_guc_state(struct xe_gt *gt, struct xe_gt_sriov_state_snapshot *snapshot) -{ - struct xe_device *xe = gt_to_xe(gt); - - drmm_kfree(&xe->drm, snapshot->guc.buff); - snapshot->guc.buff = NULL; - snapshot->guc.size = 0; -} - -static int pf_alloc_guc_state(struct xe_gt *gt, - struct xe_gt_sriov_state_snapshot *snapshot, - size_t size) -{ - struct xe_device *xe = gt_to_xe(gt); - void *p; - - pf_free_guc_state(gt, snapshot); - - if (!size) - return -ENODATA; - - if (size % sizeof(u32)) - return -EINVAL; - - if (size > SZ_2M) - return -EFBIG; - - p = drmm_kzalloc(&xe->drm, size, GFP_KERNEL); - if (!p) - return -ENOMEM; - - snapshot->guc.buff = p; - snapshot->guc.size = size; - return 0; -} - -static void pf_dump_guc_state(struct xe_gt *gt, struct xe_gt_sriov_state_snapshot *snapshot) -{ - if (IS_ENABLED(CONFIG_DRM_XE_DEBUG_SRIOV)) { - unsigned int vfid __maybe_unused = pf_snapshot_index(gt, snapshot); - - xe_gt_sriov_dbg_verbose(gt, "VF%u GuC state is %zu dwords:\n", - vfid, snapshot->guc.size / sizeof(u32)); - print_hex_dump_bytes("state: ", DUMP_PREFIX_OFFSET, - snapshot->guc.buff, min(SZ_64, snapshot->guc.size)); - } -} - -static int pf_save_vf_guc_state(struct xe_gt *gt, unsigned int vfid) -{ - struct xe_gt_sriov_state_snapshot *snapshot = pf_pick_vf_snapshot(gt, vfid); + struct xe_sriov_packet *data; size_t size; int ret; - ret = pf_send_guc_query_vf_state_size(gt, vfid); + ret = pf_send_guc_query_vf_mig_data_size(gt, vfid); if (ret < 0) goto fail; + size = ret * sizeof(u32); - xe_gt_sriov_dbg_verbose(gt, "VF%u state size is %d dwords (%zu bytes)\n", vfid, ret, size); - ret = pf_alloc_guc_state(gt, snapshot, size); - if (ret < 0) + data = xe_sriov_packet_alloc(gt_to_xe(gt)); + if (!data) { + ret = -ENOMEM; goto fail; + } + + ret = xe_sriov_packet_init(data, gt->tile->id, gt->info.id, + XE_SRIOV_PACKET_TYPE_GUC, 0, size); + if (ret) + goto fail_free; - ret = pf_send_guc_save_vf_state(gt, vfid, snapshot->guc.buff, size); + ret = pf_send_guc_save_vf_mig_data(gt, vfid, data->vaddr, size); if (ret < 0) - goto fail; + goto fail_free; size = ret * sizeof(u32); xe_gt_assert(gt, size); - xe_gt_assert(gt, size <= snapshot->guc.size); - snapshot->guc.size = size; + xe_gt_assert(gt, size <= data->size); + data->size = size; + data->remaining = size; + + pf_dump_mig_data(gt, vfid, data, "GuC data save"); + + ret = xe_gt_sriov_pf_migration_save_produce(gt, vfid, data); + if (ret) + goto fail_free; - pf_dump_guc_state(gt, snapshot); return 0; +fail_free: + xe_sriov_packet_free(data); fail: - xe_gt_sriov_dbg(gt, "Unable to save VF%u state (%pe)\n", vfid, ERR_PTR(ret)); - pf_free_guc_state(gt, snapshot); + xe_gt_sriov_err(gt, "Failed to save VF%u GuC data (%pe)\n", + vfid, ERR_PTR(ret)); return ret; } /** - * xe_gt_sriov_pf_migration_save_guc_state() - Take a GuC VF state snapshot. + * xe_gt_sriov_pf_migration_guc_size() - Get the size of VF GuC migration data. * @gt: the &xe_gt * @vfid: the VF identifier * * This function is for PF only. * - * Return: 0 on success or a negative error code on failure. + * Return: size in bytes or a negative error code on failure. */ -int xe_gt_sriov_pf_migration_save_guc_state(struct xe_gt *gt, unsigned int vfid) +ssize_t xe_gt_sriov_pf_migration_guc_size(struct xe_gt *gt, unsigned int vfid) { - int err; + ssize_t size; xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); xe_gt_assert(gt, vfid != PFID); @@ -237,37 +196,15 @@ int xe_gt_sriov_pf_migration_save_guc_state(struct xe_gt *gt, unsigned int vfid) if (!pf_migration_supported(gt)) return -ENOPKG; - mutex_lock(pf_migration_mutex(gt)); - err = pf_save_vf_guc_state(gt, vfid); - mutex_unlock(pf_migration_mutex(gt)); + size = pf_send_guc_query_vf_mig_data_size(gt, vfid); + if (size >= 0) + size *= sizeof(u32); - return err; -} - -static int pf_restore_vf_guc_state(struct xe_gt *gt, unsigned int vfid) -{ - struct xe_gt_sriov_state_snapshot *snapshot = pf_pick_vf_snapshot(gt, vfid); - int ret; - - if (!snapshot->guc.size) - return -ENODATA; - - xe_gt_sriov_dbg_verbose(gt, "restoring %zu dwords of VF%u GuC state\n", - snapshot->guc.size / sizeof(u32), vfid); - ret = pf_send_guc_restore_vf_state(gt, vfid, snapshot->guc.buff, snapshot->guc.size); - if (ret < 0) - goto fail; - - xe_gt_sriov_dbg_verbose(gt, "restored %d dwords of VF%u GuC state\n", ret, vfid); - return 0; - -fail: - xe_gt_sriov_dbg(gt, "Failed to restore VF%u GuC state (%pe)\n", vfid, ERR_PTR(ret)); - return ret; + return size; } /** - * xe_gt_sriov_pf_migration_restore_guc_state() - Restore a GuC VF state. + * xe_gt_sriov_pf_migration_guc_save() - Save VF GuC migration data. * @gt: the &xe_gt * @vfid: the VF identifier * @@ -275,10 +212,8 @@ static int pf_restore_vf_guc_state(struct xe_gt *gt, unsigned int vfid) * * Return: 0 on success or a negative error code on failure. */ -int xe_gt_sriov_pf_migration_restore_guc_state(struct xe_gt *gt, unsigned int vfid) +int xe_gt_sriov_pf_migration_guc_save(struct xe_gt *gt, unsigned int vfid) { - int ret; - xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); xe_gt_assert(gt, vfid != PFID); xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt))); @@ -286,75 +221,42 @@ int xe_gt_sriov_pf_migration_restore_guc_state(struct xe_gt *gt, unsigned int vf if (!pf_migration_supported(gt)) return -ENOPKG; - mutex_lock(pf_migration_mutex(gt)); - ret = pf_restore_vf_guc_state(gt, vfid); - mutex_unlock(pf_migration_mutex(gt)); - - return ret; + return pf_save_vf_guc_mig_data(gt, vfid); } -#ifdef CONFIG_DEBUG_FS -/** - * xe_gt_sriov_pf_migration_read_guc_state() - Read a GuC VF state. - * @gt: the &xe_gt - * @vfid: the VF identifier - * @buf: the user space buffer to read to - * @count: the maximum number of bytes to read - * @pos: the current position in the buffer - * - * This function is for PF only. - * - * This function reads up to @count bytes from the saved VF GuC state buffer - * at offset @pos into the user space address starting at @buf. - * - * Return: the number of bytes read or a negative error code on failure. - */ -ssize_t xe_gt_sriov_pf_migration_read_guc_state(struct xe_gt *gt, unsigned int vfid, - char __user *buf, size_t count, loff_t *pos) +static int pf_restore_vf_guc_state(struct xe_gt *gt, unsigned int vfid, + struct xe_sriov_packet *data) { - struct xe_gt_sriov_state_snapshot *snapshot; - ssize_t ret; + int ret; - xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); - xe_gt_assert(gt, vfid != PFID); - xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt))); + xe_gt_assert(gt, data->size); - if (!pf_migration_supported(gt)) - return -ENOPKG; + pf_dump_mig_data(gt, vfid, data, "GuC data restore"); - mutex_lock(pf_migration_mutex(gt)); - snapshot = pf_pick_vf_snapshot(gt, vfid); - if (snapshot->guc.size) - ret = simple_read_from_buffer(buf, count, pos, snapshot->guc.buff, - snapshot->guc.size); - else - ret = -ENODATA; - mutex_unlock(pf_migration_mutex(gt)); + ret = pf_send_guc_restore_vf_mig_data(gt, vfid, data->vaddr, data->size); + if (ret < 0) + goto fail; + + return 0; +fail: + xe_gt_sriov_err(gt, "Failed to restore VF%u GuC data (%pe)\n", + vfid, ERR_PTR(ret)); return ret; } /** - * xe_gt_sriov_pf_migration_write_guc_state() - Write a GuC VF state. + * xe_gt_sriov_pf_migration_guc_restore() - Restore VF GuC migration data. * @gt: the &xe_gt * @vfid: the VF identifier - * @buf: the user space buffer with GuC VF state - * @size: the size of GuC VF state (in bytes) * * This function is for PF only. * - * This function reads @size bytes of the VF GuC state stored at user space - * address @buf and writes it into a internal VF state buffer. - * - * Return: the number of bytes used or a negative error code on failure. + * Return: 0 on success or a negative error code on failure. */ -ssize_t xe_gt_sriov_pf_migration_write_guc_state(struct xe_gt *gt, unsigned int vfid, - const char __user *buf, size_t size) +int xe_gt_sriov_pf_migration_guc_restore(struct xe_gt *gt, unsigned int vfid, + struct xe_sriov_packet *data) { - struct xe_gt_sriov_state_snapshot *snapshot; - loff_t pos = 0; - ssize_t ret; - xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); xe_gt_assert(gt, vfid != PFID); xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt))); @@ -362,21 +264,8 @@ ssize_t xe_gt_sriov_pf_migration_write_guc_state(struct xe_gt *gt, unsigned int if (!pf_migration_supported(gt)) return -ENOPKG; - mutex_lock(pf_migration_mutex(gt)); - snapshot = pf_pick_vf_snapshot(gt, vfid); - ret = pf_alloc_guc_state(gt, snapshot, size); - if (!ret) { - ret = simple_write_to_buffer(snapshot->guc.buff, size, &pos, buf, size); - if (ret < 0) - pf_free_guc_state(gt, snapshot); - else - pf_dump_guc_state(gt, snapshot); - } - mutex_unlock(pf_migration_mutex(gt)); - - return ret; + return pf_restore_vf_guc_state(gt, vfid, data); } -#endif /* CONFIG_DEBUG_FS */ /** * xe_gt_sriov_pf_migration_size() - Total size of migration data from all components within a GT. @@ -618,10 +507,6 @@ int xe_gt_sriov_pf_migration_init(struct xe_gt *gt) if (!pf_migration_supported(gt)) return 0; - err = drmm_mutex_init(&xe->drm, >->sriov.pf.migration.snapshot_lock); - if (err) - return err; - totalvfs = xe_sriov_pf_get_totalvfs(xe); for (n = 1; n <= totalvfs; n++) { struct xe_gt_sriov_migration_data *migration = pf_pick_gt_migration(gt, n); diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h index 148ee07dd23a9..fd81942bfd7a2 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h @@ -15,8 +15,10 @@ struct xe_sriov_packet; #define XE_GT_SRIOV_PF_MIGRATION_GUC_DATA_MAX_SIZE SZ_8M int xe_gt_sriov_pf_migration_init(struct xe_gt *gt); -int xe_gt_sriov_pf_migration_save_guc_state(struct xe_gt *gt, unsigned int vfid); -int xe_gt_sriov_pf_migration_restore_guc_state(struct xe_gt *gt, unsigned int vfid); +ssize_t xe_gt_sriov_pf_migration_guc_size(struct xe_gt *gt, unsigned int vfid); +int xe_gt_sriov_pf_migration_guc_save(struct xe_gt *gt, unsigned int vfid); +int xe_gt_sriov_pf_migration_guc_restore(struct xe_gt *gt, unsigned int vfid, + struct xe_sriov_packet *data); ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid); @@ -34,11 +36,4 @@ int xe_gt_sriov_pf_migration_restore_produce(struct xe_gt *gt, unsigned int vfid struct xe_sriov_packet * xe_gt_sriov_pf_migration_save_consume(struct xe_gt *gt, unsigned int vfid); -#ifdef CONFIG_DEBUG_FS -ssize_t xe_gt_sriov_pf_migration_read_guc_state(struct xe_gt *gt, unsigned int vfid, - char __user *buf, size_t count, loff_t *pos); -ssize_t xe_gt_sriov_pf_migration_write_guc_state(struct xe_gt *gt, unsigned int vfid, - const char __user *buf, size_t count); -#endif - #endif diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h index 84be6fac16c8b..75d8b94cbbefb 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h @@ -6,24 +6,7 @@ #ifndef _XE_GT_SRIOV_PF_MIGRATION_TYPES_H_ #define _XE_GT_SRIOV_PF_MIGRATION_TYPES_H_ -#include #include -#include - -/** - * struct xe_gt_sriov_state_snapshot - GT-level per-VF state snapshot data. - * - * Used by the PF driver to maintain per-VF migration data. - */ -struct xe_gt_sriov_state_snapshot { - /** @guc: GuC VF state snapshot */ - struct { - /** @guc.buff: buffer with the VF state */ - u32 *buff; - /** @guc.size: size of the buffer (must be dwords aligned) */ - u32 size; - } guc; -}; /** * struct xe_gt_sriov_migration_data - GT-level per-VF migration data. @@ -35,14 +18,4 @@ struct xe_gt_sriov_migration_data { struct ptr_ring ring; }; -/** - * struct xe_gt_sriov_pf_migration - GT-level data. - * - * Used by the PF driver to maintain non-VF specific per-GT data. - */ -struct xe_gt_sriov_pf_migration { - /** @snapshot_lock: protects all VFs snapshots */ - struct mutex snapshot_lock; -}; - #endif diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h index 812e74d3f8f80..667b8310478d4 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h @@ -31,9 +31,6 @@ struct xe_gt_sriov_metadata { /** @version: negotiated VF/PF ABI version */ struct xe_gt_sriov_pf_service_version version; - /** @snapshot: snapshot of the VF state data */ - struct xe_gt_sriov_state_snapshot snapshot; - /** @migration: per-VF migration data. */ struct xe_gt_sriov_migration_data migration; }; @@ -61,7 +58,6 @@ struct xe_gt_sriov_pf { struct xe_gt_sriov_pf_service service; struct xe_gt_sriov_pf_control control; struct xe_gt_sriov_pf_policy policy; - struct xe_gt_sriov_pf_migration migration; struct xe_gt_sriov_spare_config spare; struct xe_gt_sriov_metadata *vfs; }; -- 2.51.2