From nobody Tue Dec 2 00:46:32 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB8D62F6922; Mon, 24 Nov 2025 23:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764025755; cv=fail; b=bXBRZWW5DLG5iQi6W0XryA6QsZyqg2r2dK96wS8MHtXTx/pZV47UAznipK8UGKGAOvGiDY/fEbd277iYVInesKs/wMwN7/ur4YykgXQyAaxHL7fgJEa0QOTQszcsC8TqvF6rZFwBwg9jOYZyke2KAliiXJ9hU+cMDFEWIeOpvaE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764025755; c=relaxed/simple; bh=rFMkxEJYtP9I04/fEW5184Wg7uqHYIl6Kadzci4xaqU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ZFg4ZP/iF7Ka+4m65qXtxwebA4RNSzQ63ikHHV/KHhwnZhS7cNquXr7DT0zNgp7gHXZFLqn9yoZ+cLrnjanC9cyTOM0aWnmyrUjuSQbZWOGtiqabFzWwgB6+5O2g71y4whenVVBzMzvWgb+jgZRi6TuAQqkaMkhpIH97zYqhFAk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gkJc5uDE; arc=fail smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gkJc5uDE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1764025753; x=1795561753; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=rFMkxEJYtP9I04/fEW5184Wg7uqHYIl6Kadzci4xaqU=; b=gkJc5uDEi2hPMdrcCEK2q+5zmVJDYYCTRYjavqPtULZHuAXwND1dJoC3 l5mx3MC1KDCZJ6cA+xp8z/x84gT83JIwjNYWAS3ME92vvI16b3lAJ4rfJ W0cYvzRppK/fRgZBQCPpEFJvpU2ZuOcbxt53ogvdTGUKy3w67yURwpNZa OXDwQpP/qqFw/0ALLU9M7rCUdTKPB/MQIAe/hqh3cmsxERs0TqOmR1+0k z3OBU12dGgBE70wnFT4SeJywIvPo3xHNxLwSijYQDlwzG+r4bRS7hnaKT 8giIiCM/z2Sho903WDLoZydqXWAN12RhHgU8KwcN6+gl6+rcNwdwRHb6J w==; X-CSE-ConnectionGUID: /coEak6YRE6pw3Kxn/otKw== X-CSE-MsgGUID: SRXMfmbGQNKRjWu/NvvzZg== X-IronPort-AV: E=McAfee;i="6800,10657,11623"; a="65923873" X-IronPort-AV: E=Sophos;i="6.20,224,1758610800"; d="scan'208";a="65923873" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2025 15:09:13 -0800 X-CSE-ConnectionGUID: jC2OKdiEQNCEIXeMbJ3uiw== X-CSE-MsgGUID: BvcmSaiwQdePxw77Ya72KA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,224,1758610800"; d="scan'208";a="229739041" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by orviesa001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2025 15:09:13 -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.29; Mon, 24 Nov 2025 15:09:12 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) 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.29 via Frontend Transport; Mon, 24 Nov 2025 15:09:12 -0800 Received: from CY3PR05CU001.outbound.protection.outlook.com (40.93.201.53) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27; Mon, 24 Nov 2025 15:09:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oFTv3Bb27k2110UZuJxBuNEur6gc0faN4A71SW2jp+A8NHKQmrMU7TKQRZwPQUktAl0HbnqTFWcIkMWE5M9AQMEVvU/995h5WnpRtm6ViAi25XupqmXbYiiAS17jfVxc47V/Bz+8mxaiRnFF+nl1hg27X7jqTCcxH+VOzRRF0zBoQx6yOO8/BeswJ6PBMA+UBzunlKSg9jpFh+DsbXwmc9vwN6bzzMXDS4i8hUSlSoTARhnmCYbEJG0opM5XWR1XJ3u+Ttxhgl3VuiIxu6/Yr9xzORZuZXHJ+BqlNmhA/BjvOIfOVtoGqDc8gNi6QeC+YOG/pcBN3vmwEVWR0aRRhA== 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=hUpOUeqM9kCoKM1CfOCgA8+YQPtw3nVEBDtNZKNKZa8=; b=qGA2WRtejQJ5osdXyhzUzVPhazh+p7JJgV5UJ3Bk1twZB95So64/mJyX/BF8i/l/6Zsrm47iGmaTgg8PZtyB5lUcO1MT6vnWbjME/gcilsICS9sXJQR9pKKsirW5JXmFp0d9uMoDQmAzwQX/7HQpM+ELkL4yolOyjXdwaMXVG2SCdTqsa27g2A5cx8Lm+UYJiBDEi1aCWgsucYI4HhjKhVzn5Hu8A7wiV19C7cd4IT3zyU1m+t3qMkfCpV8KXhph2/iEZIxzyW7lw7KnSt+duFUZxIZssAVasUQ6X296newM6G5Z/5Iry2yOGfOGeOQ78ZtclOuYKWtqvQxCj5y1ig== 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 DM3PPF9EFFC957B.namprd11.prod.outlook.com (2603:10b6:f:fc00::f40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.17; Mon, 24 Nov 2025 23:09:10 +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.9343.016; Mon, 24 Nov 2025 23:09:10 +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 v6 4/4] vfio/xe: Add device specific vfio_pci driver variant for Intel graphics Date: Tue, 25 Nov 2025 00:08:41 +0100 Message-ID: <20251124230841.613894-5-michal.winiarski@intel.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251124230841.613894-1-michal.winiarski@intel.com> References: <20251124230841.613894-1-michal.winiarski@intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR04CA0128.eurprd04.prod.outlook.com (2603:10a6:803:f0::26) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|DM3PPF9EFFC957B:EE_ X-MS-Office365-Filtering-Correlation-Id: 102687e0-ac9f-409e-7a69-08de2bae79ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?B?QWpYVDBYMGU4a3pzc1BaRXh2NlNLOThDSnNXZkZHaW5NcnFaUVFDSVBjdUFE?= =?utf-8?B?R2tGOGFsUDZoZkZBdmJPY1lHeThTRkdUQk1aUHo1bzJsbmhqdkhXRmJaYXFq?= =?utf-8?B?TzdVMVN2MkgwL1gyTDVmUENBSjhmOFpDaldlWWFFVmZPeUFSdzYrTk05ZlE5?= =?utf-8?B?c1VDZXRkeDJFUXJma3BzL3JBTytkSXFNWGJMTmJKTWp0RGY3NmlHeFRRU3pR?= =?utf-8?B?dVVXZkNGbDhrWmpnOUVmbTdiOXg4clFMNTRkZmphSC9XNDBYUEZ0SGY4U0FO?= =?utf-8?B?Q2cvdjRuS21lZXNaQVlnV0o5RWZuWURmRm0yb0Jhc2NSNFJPbm52TGh3RkYx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cwY3BoVlFERER4bDdW?= =?utf-8?B?MGNYaVptcmJHUnN5K0k4Y080cTFxc1RvOUN6T1NwVW9kZTQxNC9TNnR4RXhv?= =?utf-8?B?Z3JETkxJU3JYLzg2Uk94aTg3STZvOFRQK1VYTVJocGpFWURFeGg5cXhmWGY1?= =?utf-8?B?czFzZkYwSXlYSXFzbmk2cGFqa0pKN3hlZnh1MHRXOW1Sc0xVWTI0S3p1c0E2?= =?utf-8?B?VENLblY4R0ZiRjd2WGxoWk1MMExkTlJ5alo2NVRoeGZVVk00ZmZUNVZsZzJj?= =?utf-8?B?ZlJQUjJqM054V29WRnRiWkQzZHhwSjk2OFNPdXhmWWl3b0xMS3NTci9ySUZv?= =?utf-8?B?RzdSN09OVHExQXZNQnJrNy9RK0Q1bzhhNmtneTVLSjF3aXhNYkZsMFZ0QjJL?= =?utf-8?B?N04zMzdMbHk5TGZVR2lSbElianZxY0dINGxqVjhaRm8xdDdQZ0FEdU5lMnFX?= =?utf-8?B?cUlzVUxPNDNVeUIzSk0zSm5kdncySS9PVFozcm9vektkVVlSaHNHZ080R09w?= =?utf-8?B?SjJkSjNnRUZRVHg0emh5bDc2LzhRZEpnRDUycmdXQjVTUkpqMHhveVQ3L2I4?= =?utf-8?B?YzlHODJmcXVrM1VacHE4SzlDT3VBajV5NDk2OFVGYXM3cHR4VFBNTUI3aUZ4?= =?utf-8?B?U0gxVHJUMk1XdzlQZU1kWmRzaVdSRmI0b3NLUjdZWG9tMW1VZEhBRDg0SnpN?= =?utf-8?B?aUdpUW1tMmY1TEsxR1kxa3dYdTdKQ3ZSU21sUTJXMnZSRzg5ZDdMRVM2Rkpv?= =?utf-8?Q?ZMsLx/4kiiw0HnMkCj3VQJ3WhBSmEw=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)(366016)(1800799024)(376014)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WDlWUDlWZTYwclBSMGpPeFJEL2dmUm5WNlp2L0NNdkRQeEF4?= =?utf-8?B?WlpSNjI3NnpGMklBSEdrbW44TEg3NnBJRjczeE13T2J4L3VoR0VIUFQ4Rlg3?= =?utf-8?B?Nml1R05YMm1OZFZ2Z2EzT250ZHI3SkVxb3l3YTF4VlNpWVBhMkd6N2Vhb054?= =?utf-8?B?ZTBqUnZlRnFWVXVSaTB2Z3dZYlNGSmRHYm45RzVnRS9xU3RBUkZHM0hScDBP?= =?utf-8?B?bHRkYmQyYUNvaVJYbmt2TDlSV1dRZS91WWFYbXBmbDkyeHdlMkJRano4ellJ?= =?utf-8?B?RkJrZXhkcXpxbEw5VTBLbGcxUmZpZUN3eSsvbHhqYmRoLytuSzltUy9OblFs?= =?utf-8?B?NGk5NHRhNWlmMVpDOGtoSHFVYU1RRnRiVHJNQmhabUw5UEYvdWhXQmhtOTdm?= =?utf-8?B?NzdqUStJUWNaRWxPakl5WjJQL25kR3pDNFZjRFMrb1RYbmxERTdVYkN3bFRO?= =?utf-8?B?S0E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 102687e0-ac9f-409e-7a69-08de2bae79ce X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2025 23:09:10.3775 (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: tF9QqLFQttjbFfHsEPSUaUc8pqrq+Jd12YdCcjdlpMgWzsAMDyFmeQwUMrXIxK+E8AexbnbYDMKdxX+Qa6hIz1/IIvETZM9wyDRo4bZQ9eQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PPF9EFFC957B X-OriginatorOrg: intel.com In addition to generic VFIO PCI functionality, the driver implements VFIO migration uAPI, allowing userspace to enable migration for Intel Graphics SR-IOV Virtual Functions. The driver binds to VF device and uses API exposed by Xe driver to transfer the VF migration data under the control of PF device. Signed-off-by: Micha=C5=82 Winiarski Acked-by: Rodrigo Vivi Reviewed-by: Kevin Tian --- MAINTAINERS | 7 + drivers/vfio/pci/Kconfig | 2 + drivers/vfio/pci/Makefile | 2 + drivers/vfio/pci/xe/Kconfig | 12 + drivers/vfio/pci/xe/Makefile | 3 + drivers/vfio/pci/xe/main.c | 568 +++++++++++++++++++++++++++++++++++ 6 files changed, 594 insertions(+) create mode 100644 drivers/vfio/pci/xe/Kconfig create mode 100644 drivers/vfio/pci/xe/Makefile create mode 100644 drivers/vfio/pci/xe/main.c diff --git a/MAINTAINERS b/MAINTAINERS index acc951f122eaf..adb5aa9cd29e9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -27025,6 +27025,13 @@ L: virtualization@lists.linux.dev S: Maintained F: drivers/vfio/pci/virtio =20 +VFIO XE PCI DRIVER +M: Micha=C5=82 Winiarski +L: kvm@vger.kernel.org +L: intel-xe@lists.freedesktop.org +S: Supported +F: drivers/vfio/pci/xe + VGA_SWITCHEROO R: Lukas Wunner S: Maintained diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig index 2b0172f546652..c100f0ab87f2d 100644 --- a/drivers/vfio/pci/Kconfig +++ b/drivers/vfio/pci/Kconfig @@ -67,4 +67,6 @@ source "drivers/vfio/pci/nvgrace-gpu/Kconfig" =20 source "drivers/vfio/pci/qat/Kconfig" =20 +source "drivers/vfio/pci/xe/Kconfig" + endmenu diff --git a/drivers/vfio/pci/Makefile b/drivers/vfio/pci/Makefile index cf00c0a7e55c8..f5d46aa9347b9 100644 --- a/drivers/vfio/pci/Makefile +++ b/drivers/vfio/pci/Makefile @@ -19,3 +19,5 @@ obj-$(CONFIG_VIRTIO_VFIO_PCI) +=3D virtio/ obj-$(CONFIG_NVGRACE_GPU_VFIO_PCI) +=3D nvgrace-gpu/ =20 obj-$(CONFIG_QAT_VFIO_PCI) +=3D qat/ + +obj-$(CONFIG_XE_VFIO_PCI) +=3D xe/ diff --git a/drivers/vfio/pci/xe/Kconfig b/drivers/vfio/pci/xe/Kconfig new file mode 100644 index 0000000000000..4253f2a86ca1f --- /dev/null +++ b/drivers/vfio/pci/xe/Kconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +config XE_VFIO_PCI + tristate "VFIO support for Intel Graphics" + depends on DRM_XE + select VFIO_PCI_CORE + help + This option enables device specific VFIO driver variant for Intel Graph= ics. + In addition to generic VFIO PCI functionality, it implements VFIO + migration uAPI allowing userspace to enable migration for + Intel Graphics SR-IOV Virtual Functions supported by the Xe driver. + + If you don't know what to do here, say N. diff --git a/drivers/vfio/pci/xe/Makefile b/drivers/vfio/pci/xe/Makefile new file mode 100644 index 0000000000000..13aa0fd192cd4 --- /dev/null +++ b/drivers/vfio/pci/xe/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_XE_VFIO_PCI) +=3D xe-vfio-pci.o +xe-vfio-pci-y :=3D main.o diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c new file mode 100644 index 0000000000000..ce0ed82ee4d31 --- /dev/null +++ b/drivers/vfio/pci/xe/main.c @@ -0,0 +1,568 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright =C2=A9 2025 Intel Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct xe_vfio_pci_migration_file { + struct file *filp; + /* serializes accesses to migration data */ + struct mutex lock; + bool disabled; + struct xe_vfio_pci_core_device *xe_vdev; +}; + +struct xe_vfio_pci_core_device { + struct vfio_pci_core_device core_device; + struct xe_device *xe; + /* PF internal control uses vfid index starting from 1 */ + unsigned int vfid; + u8 migrate_cap:1; + u8 deferred_reset:1; + /* protects migration state */ + struct mutex state_mutex; + enum vfio_device_mig_state mig_state; + /* protects the reset_done flow */ + spinlock_t reset_lock; + struct xe_vfio_pci_migration_file *migf; +}; + +#define xe_vdev_to_dev(xe_vdev) (&(xe_vdev)->core_device.pdev->dev) + +static void xe_vfio_pci_disable_file(struct xe_vfio_pci_migration_file *mi= gf) +{ + mutex_lock(&migf->lock); + migf->disabled =3D true; + mutex_unlock(&migf->lock); +} + +static void xe_vfio_pci_put_file(struct xe_vfio_pci_core_device *xe_vdev) +{ + xe_vfio_pci_disable_file(xe_vdev->migf); + fput(xe_vdev->migf->filp); + xe_vdev->migf =3D NULL; +} + +static void xe_vfio_pci_reset(struct xe_vfio_pci_core_device *xe_vdev) +{ + if (xe_vdev->migf) + xe_vfio_pci_put_file(xe_vdev); + + xe_vdev->mig_state =3D VFIO_DEVICE_STATE_RUNNING; +} + +static void xe_vfio_pci_state_mutex_lock(struct xe_vfio_pci_core_device *x= e_vdev) +{ + mutex_lock(&xe_vdev->state_mutex); +} + +/* + * This function is called in all state_mutex unlock cases to + * handle a 'deferred_reset' if exists. + */ +static void xe_vfio_pci_state_mutex_unlock(struct xe_vfio_pci_core_device = *xe_vdev) +{ +again: + spin_lock(&xe_vdev->reset_lock); + if (xe_vdev->deferred_reset) { + xe_vdev->deferred_reset =3D false; + spin_unlock(&xe_vdev->reset_lock); + xe_vfio_pci_reset(xe_vdev); + goto again; + } + mutex_unlock(&xe_vdev->state_mutex); + spin_unlock(&xe_vdev->reset_lock); +} + +static void xe_vfio_pci_reset_done(struct pci_dev *pdev) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D pci_get_drvdata(pdev); + int ret; + + if (!xe_vdev->vfid) + return; + + /* + * VF FLR requires additional processing done by PF driver. + * The processing is done after FLR is already finished from PCIe + * perspective. + * In order to avoid a scenario where VF is used while PF processing + * is still in progress, additional synchronization point is needed. + */ + ret =3D xe_sriov_vfio_wait_flr_done(xe_vdev->xe, xe_vdev->vfid); + if (ret) + dev_err(&pdev->dev, "Failed to wait for FLR: %d\n", ret); + + if (!xe_vdev->migrate_cap) + return; + + /* + * As the higher VFIO layers are holding locks across reset and using + * those same locks with the mm_lock we need to prevent ABBA deadlock + * with the state_mutex and mm_lock. + * In case the state_mutex was taken already we defer the cleanup work + * to the unlock flow of the other running context. + */ + spin_lock(&xe_vdev->reset_lock); + xe_vdev->deferred_reset =3D true; + if (!mutex_trylock(&xe_vdev->state_mutex)) { + spin_unlock(&xe_vdev->reset_lock); + return; + } + spin_unlock(&xe_vdev->reset_lock); + xe_vfio_pci_state_mutex_unlock(xe_vdev); + + xe_vfio_pci_reset(xe_vdev); +} + +static const struct pci_error_handlers xe_vfio_pci_err_handlers =3D { + .reset_done =3D xe_vfio_pci_reset_done, + .error_detected =3D vfio_pci_core_aer_err_detected, +}; + +static int xe_vfio_pci_open_device(struct vfio_device *core_vdev) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D + container_of(core_vdev, struct xe_vfio_pci_core_device, core_device.vdev= ); + struct vfio_pci_core_device *vdev =3D &xe_vdev->core_device; + int ret; + + ret =3D vfio_pci_core_enable(vdev); + if (ret) + return ret; + + vfio_pci_core_finish_enable(vdev); + + return 0; +} + +static int xe_vfio_pci_release_file(struct inode *inode, struct file *filp) +{ + struct xe_vfio_pci_migration_file *migf =3D filp->private_data; + + xe_vfio_pci_disable_file(migf); + mutex_destroy(&migf->lock); + kfree(migf); + + return 0; +} + +static ssize_t xe_vfio_pci_save_read(struct file *filp, char __user *buf, = size_t len, loff_t *pos) +{ + struct xe_vfio_pci_migration_file *migf =3D filp->private_data; + ssize_t ret; + + if (pos) + return -ESPIPE; + + mutex_lock(&migf->lock); + if (migf->disabled) { + mutex_unlock(&migf->lock); + return -ENODEV; + } + + ret =3D xe_sriov_vfio_data_read(migf->xe_vdev->xe, migf->xe_vdev->vfid, b= uf, len); + mutex_unlock(&migf->lock); + + return ret; +} + +static const struct file_operations xe_vfio_pci_save_fops =3D { + .owner =3D THIS_MODULE, + .read =3D xe_vfio_pci_save_read, + .release =3D xe_vfio_pci_release_file, + .llseek =3D noop_llseek, +}; + +static ssize_t xe_vfio_pci_resume_write(struct file *filp, const char __us= er *buf, + size_t len, loff_t *pos) +{ + struct xe_vfio_pci_migration_file *migf =3D filp->private_data; + ssize_t ret; + + if (pos) + return -ESPIPE; + + mutex_lock(&migf->lock); + if (migf->disabled) { + mutex_unlock(&migf->lock); + return -ENODEV; + } + + ret =3D xe_sriov_vfio_data_write(migf->xe_vdev->xe, migf->xe_vdev->vfid, = buf, len); + mutex_unlock(&migf->lock); + + return ret; +} + +static const struct file_operations xe_vfio_pci_resume_fops =3D { + .owner =3D THIS_MODULE, + .write =3D xe_vfio_pci_resume_write, + .release =3D xe_vfio_pci_release_file, + .llseek =3D noop_llseek, +}; + +static const char *vfio_dev_state_str(u32 state) +{ + switch (state) { + case VFIO_DEVICE_STATE_RUNNING: return "running"; + case VFIO_DEVICE_STATE_RUNNING_P2P: return "running_p2p"; + case VFIO_DEVICE_STATE_STOP_COPY: return "stopcopy"; + case VFIO_DEVICE_STATE_STOP: return "stop"; + case VFIO_DEVICE_STATE_RESUMING: return "resuming"; + case VFIO_DEVICE_STATE_ERROR: return "error"; + default: return ""; + } +} + +enum xe_vfio_pci_file_type { + XE_VFIO_FILE_SAVE =3D 0, + XE_VFIO_FILE_RESUME, +}; + +static struct xe_vfio_pci_migration_file * +xe_vfio_pci_alloc_file(struct xe_vfio_pci_core_device *xe_vdev, + enum xe_vfio_pci_file_type type) +{ + struct xe_vfio_pci_migration_file *migf; + const struct file_operations *fops; + int flags; + + migf =3D kzalloc(sizeof(*migf), GFP_KERNEL); + if (!migf) + return ERR_PTR(-ENOMEM); + + fops =3D type =3D=3D XE_VFIO_FILE_SAVE ? &xe_vfio_pci_save_fops : &xe_vfi= o_pci_resume_fops; + flags =3D type =3D=3D XE_VFIO_FILE_SAVE ? O_RDONLY : O_WRONLY; + migf->filp =3D anon_inode_getfile("xe_vfio_mig", fops, migf, flags); + if (IS_ERR(migf->filp)) { + kfree(migf); + return ERR_CAST(migf->filp); + } + + mutex_init(&migf->lock); + migf->xe_vdev =3D xe_vdev; + xe_vdev->migf =3D migf; + + stream_open(migf->filp->f_inode, migf->filp); + + return migf; +} + +static struct file * +xe_vfio_set_state(struct xe_vfio_pci_core_device *xe_vdev, u32 new) +{ + u32 cur =3D xe_vdev->mig_state; + int ret; + + dev_dbg(xe_vdev_to_dev(xe_vdev), + "state: %s->%s\n", vfio_dev_state_str(cur), vfio_dev_state_str(new)); + + /* + * "STOP" handling is reused for "RUNNING_P2P", as the device doesn't + * have the capability to selectively block outgoing p2p DMA transfers. + * While the device is allowing BAR accesses when the VF is stopped, it + * is not processing any new workload requests, effectively stopping + * any outgoing DMA transfers (not just p2p). + * Any VRAM / MMIO accesses occurring during "RUNNING_P2P" are kept and + * will be migrated to target VF during stop-copy. + */ + if (cur =3D=3D VFIO_DEVICE_STATE_RUNNING && new =3D=3D VFIO_DEVICE_STATE_= RUNNING_P2P) { + ret =3D xe_sriov_vfio_suspend_device(xe_vdev->xe, xe_vdev->vfid); + if (ret) + goto err; + + return NULL; + } + + if ((cur =3D=3D VFIO_DEVICE_STATE_RUNNING_P2P && new =3D=3D VFIO_DEVICE_S= TATE_STOP) || + (cur =3D=3D VFIO_DEVICE_STATE_STOP && new =3D=3D VFIO_DEVICE_STATE_RU= NNING_P2P)) + return NULL; + + if (cur =3D=3D VFIO_DEVICE_STATE_RUNNING_P2P && new =3D=3D VFIO_DEVICE_ST= ATE_RUNNING) { + ret =3D xe_sriov_vfio_resume_device(xe_vdev->xe, xe_vdev->vfid); + if (ret) + goto err; + + return NULL; + } + + if (cur =3D=3D VFIO_DEVICE_STATE_STOP && new =3D=3D VFIO_DEVICE_STATE_STO= P_COPY) { + struct xe_vfio_pci_migration_file *migf; + + migf =3D xe_vfio_pci_alloc_file(xe_vdev, XE_VFIO_FILE_SAVE); + if (IS_ERR(migf)) { + ret =3D PTR_ERR(migf); + goto err; + } + get_file(migf->filp); + + ret =3D xe_sriov_vfio_stop_copy_enter(xe_vdev->xe, xe_vdev->vfid); + if (ret) { + fput(migf->filp); + goto err; + } + + return migf->filp; + } + + if (cur =3D=3D VFIO_DEVICE_STATE_STOP_COPY && new =3D=3D VFIO_DEVICE_STAT= E_STOP) { + if (xe_vdev->migf) + xe_vfio_pci_put_file(xe_vdev); + + ret =3D xe_sriov_vfio_stop_copy_exit(xe_vdev->xe, xe_vdev->vfid); + if (ret) + goto err; + + return NULL; + } + + if (cur =3D=3D VFIO_DEVICE_STATE_STOP && new =3D=3D VFIO_DEVICE_STATE_RES= UMING) { + struct xe_vfio_pci_migration_file *migf; + + migf =3D xe_vfio_pci_alloc_file(xe_vdev, XE_VFIO_FILE_RESUME); + if (IS_ERR(migf)) { + ret =3D PTR_ERR(migf); + goto err; + } + get_file(migf->filp); + + ret =3D xe_sriov_vfio_resume_data_enter(xe_vdev->xe, xe_vdev->vfid); + if (ret) { + fput(migf->filp); + goto err; + } + + return migf->filp; + } + + if (cur =3D=3D VFIO_DEVICE_STATE_RESUMING && new =3D=3D VFIO_DEVICE_STATE= _STOP) { + if (xe_vdev->migf) + xe_vfio_pci_put_file(xe_vdev); + + ret =3D xe_sriov_vfio_resume_data_exit(xe_vdev->xe, xe_vdev->vfid); + if (ret) + goto err; + + return NULL; + } + + WARN(true, "Unknown state transition %d->%d", cur, new); + return ERR_PTR(-EINVAL); + +err: + dev_dbg(xe_vdev_to_dev(xe_vdev), + "Failed to transition state: %s->%s err=3D%d\n", + vfio_dev_state_str(cur), vfio_dev_state_str(new), ret); + return ERR_PTR(ret); +} + +static struct file * +xe_vfio_pci_set_device_state(struct vfio_device *core_vdev, + enum vfio_device_mig_state new_state) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D + container_of(core_vdev, struct xe_vfio_pci_core_device, core_device.vdev= ); + enum vfio_device_mig_state next_state; + struct file *f =3D NULL; + int ret; + + xe_vfio_pci_state_mutex_lock(xe_vdev); + while (new_state !=3D xe_vdev->mig_state) { + ret =3D vfio_mig_get_next_state(core_vdev, xe_vdev->mig_state, + new_state, &next_state); + if (ret) { + xe_sriov_vfio_error(xe_vdev->xe, xe_vdev->vfid); + f =3D ERR_PTR(ret); + break; + } + f =3D xe_vfio_set_state(xe_vdev, next_state); + if (IS_ERR(f)) + break; + + xe_vdev->mig_state =3D next_state; + + /* Multiple state transitions with non-NULL file in the middle */ + if (f && new_state !=3D xe_vdev->mig_state) { + fput(f); + f =3D ERR_PTR(-EINVAL); + break; + } + } + xe_vfio_pci_state_mutex_unlock(xe_vdev); + + return f; +} + +static int xe_vfio_pci_get_device_state(struct vfio_device *core_vdev, + enum vfio_device_mig_state *curr_state) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D + container_of(core_vdev, struct xe_vfio_pci_core_device, core_device.vdev= ); + + xe_vfio_pci_state_mutex_lock(xe_vdev); + *curr_state =3D xe_vdev->mig_state; + xe_vfio_pci_state_mutex_unlock(xe_vdev); + + return 0; +} + +static int xe_vfio_pci_get_data_size(struct vfio_device *vdev, + unsigned long *stop_copy_length) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D + container_of(vdev, struct xe_vfio_pci_core_device, core_device.vdev); + + xe_vfio_pci_state_mutex_lock(xe_vdev); + *stop_copy_length =3D xe_sriov_vfio_stop_copy_size(xe_vdev->xe, xe_vdev->= vfid); + xe_vfio_pci_state_mutex_unlock(xe_vdev); + + return 0; +} + +static const struct vfio_migration_ops xe_vfio_pci_migration_ops =3D { + .migration_set_state =3D xe_vfio_pci_set_device_state, + .migration_get_state =3D xe_vfio_pci_get_device_state, + .migration_get_data_size =3D xe_vfio_pci_get_data_size, +}; + +static void xe_vfio_pci_migration_init(struct xe_vfio_pci_core_device *xe_= vdev) +{ + struct vfio_device *core_vdev =3D &xe_vdev->core_device.vdev; + struct pci_dev *pdev =3D to_pci_dev(core_vdev->dev); + struct xe_device *xe =3D xe_sriov_vfio_get_pf(pdev); + int ret; + + if (!xe) + return; + if (!xe_sriov_vfio_migration_supported(xe)) + return; + + ret =3D pci_iov_vf_id(pdev); + if (ret < 0) + return; + + mutex_init(&xe_vdev->state_mutex); + spin_lock_init(&xe_vdev->reset_lock); + + /* PF internal control uses vfid index starting from 1 */ + xe_vdev->vfid =3D ret + 1; + xe_vdev->xe =3D xe; + xe_vdev->migrate_cap =3D true; + + core_vdev->migration_flags =3D VFIO_MIGRATION_STOP_COPY | VFIO_MIGRATION_= P2P; + core_vdev->mig_ops =3D &xe_vfio_pci_migration_ops; +} + +static void xe_vfio_pci_migration_fini(struct xe_vfio_pci_core_device *xe_= vdev) +{ + if (!xe_vdev->migrate_cap) + return; + + mutex_destroy(&xe_vdev->state_mutex); +} + +static int xe_vfio_pci_init_dev(struct vfio_device *core_vdev) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D + container_of(core_vdev, struct xe_vfio_pci_core_device, core_device.vdev= ); + + xe_vfio_pci_migration_init(xe_vdev); + + return vfio_pci_core_init_dev(core_vdev); +} + +static void xe_vfio_pci_release_dev(struct vfio_device *core_vdev) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D + container_of(core_vdev, struct xe_vfio_pci_core_device, core_device.vdev= ); + + xe_vfio_pci_migration_fini(xe_vdev); +} + +static const struct vfio_device_ops xe_vfio_pci_ops =3D { + .name =3D "xe-vfio-pci", + .init =3D xe_vfio_pci_init_dev, + .release =3D xe_vfio_pci_release_dev, + .open_device =3D xe_vfio_pci_open_device, + .close_device =3D vfio_pci_core_close_device, + .ioctl =3D vfio_pci_core_ioctl, + .device_feature =3D vfio_pci_core_ioctl_feature, + .read =3D vfio_pci_core_read, + .write =3D vfio_pci_core_write, + .mmap =3D vfio_pci_core_mmap, + .request =3D vfio_pci_core_request, + .match =3D vfio_pci_core_match, + .match_token_uuid =3D vfio_pci_core_match_token_uuid, + .bind_iommufd =3D vfio_iommufd_physical_bind, + .unbind_iommufd =3D vfio_iommufd_physical_unbind, + .attach_ioas =3D vfio_iommufd_physical_attach_ioas, + .detach_ioas =3D vfio_iommufd_physical_detach_ioas, +}; + +static int xe_vfio_pci_probe(struct pci_dev *pdev, const struct pci_device= _id *id) +{ + struct xe_vfio_pci_core_device *xe_vdev; + int ret; + + xe_vdev =3D vfio_alloc_device(xe_vfio_pci_core_device, core_device.vdev, = &pdev->dev, + &xe_vfio_pci_ops); + if (IS_ERR(xe_vdev)) + return PTR_ERR(xe_vdev); + + dev_set_drvdata(&pdev->dev, &xe_vdev->core_device); + + ret =3D vfio_pci_core_register_device(&xe_vdev->core_device); + if (ret) { + vfio_put_device(&xe_vdev->core_device.vdev); + return ret; + } + + return 0; +} + +static void xe_vfio_pci_remove(struct pci_dev *pdev) +{ + struct xe_vfio_pci_core_device *xe_vdev =3D pci_get_drvdata(pdev); + + vfio_pci_core_unregister_device(&xe_vdev->core_device); + vfio_put_device(&xe_vdev->core_device.vdev); +} + +#define INTEL_PCI_VFIO_DEVICE(_id) { \ + PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_INTEL, (_id)) \ +} + +static const struct pci_device_id xe_vfio_pci_table[] =3D { + INTEL_PTL_IDS(INTEL_PCI_VFIO_DEVICE), + INTEL_WCL_IDS(INTEL_PCI_VFIO_DEVICE), + INTEL_BMG_IDS(INTEL_PCI_VFIO_DEVICE), + {} +}; +MODULE_DEVICE_TABLE(pci, xe_vfio_pci_table); + +static struct pci_driver xe_vfio_pci_driver =3D { + .name =3D "xe-vfio-pci", + .id_table =3D xe_vfio_pci_table, + .probe =3D xe_vfio_pci_probe, + .remove =3D xe_vfio_pci_remove, + .err_handler =3D &xe_vfio_pci_err_handlers, + .driver_managed_dma =3D true, +}; +module_pci_driver(xe_vfio_pci_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Micha=C5=82 Winiarski "); +MODULE_DESCRIPTION("VFIO PCI driver with migration support for Intel Graph= ics"); --=20 2.51.2