From patchwork Wed May 15 13:21:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avihai Horon X-Patchwork-Id: 13665258 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 70AA1C25B75 for ; Wed, 15 May 2024 13:23:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7EaO-0001Ju-R8; Wed, 15 May 2024 09:22:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7EaM-0001Ji-0G for qemu-devel@nongnu.org; Wed, 15 May 2024 09:22:22 -0400 Received: from mail-mw2nam04on20600.outbound.protection.outlook.com ([2a01:111:f403:240a::600] helo=NAM04-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7EaH-0007GI-LY for qemu-devel@nongnu.org; Wed, 15 May 2024 09:22:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pqa5/4E85Cqrx9nR69XtHTaRh5vFgb4Q+SCxfoUbrXWw48HeiEZI5pRXMByD4828+jQ4c7Pp8AJyBO6Wa90UEIZfjqwZ74WapdFiFoivfF1bW9Q+dAG6MhMX1WXY9U9Y1QPZwEknKe7nB+8cJ9BcpQiLnWiuY/bD8SxGxwNd3IhctG+I5MAdaG6mxX5EDV2qmx8M+f3a0SOHpBYmAuRi4o7xdD1miUoXUqT4HqxjT6PBWGuNV4WzgkRPdb1wrokUH14p2MRc+WzsMbDVVDnSCItRqE7A2s4MpRYphIcYffb0JMxxerMHERSGQ6U/gU+g9CRB+UeO/T01RQTgW+hRbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=g3v4MwIILt0hVpRGgXts2QqxePURMW4ShrS6/Ze6KEA=; b=Rlo7XbFdOs0wbkRtgL/9S5Lbfdpv1KOZW+0pyQQrmox45TQQfiY3tx3s0pfmLv1goGf8fpVcvMOO3ENKKIGXbC8wENeth9E5VdZ35S0oztsbPcuI3xNQZRmeK7dowkBsR/ybC7dvnVr59AwJb+bt1e3qz/CkP8aaGQeoyC9Co/saprEeUMgVTVncSd38p8o+ZBSF0YG1kTpeS52EmYl2bC8BdY+VyCg4ddhUplEqh95uGayDutdpdMCKoGyw1wmRY3WRESxt2pukigC2y75AxQ22Xnh2blf7rRxD54yGTZCBqwj1dLYF/rOCYXPdPaxz9Z33xtggWntxuBlVUpOscQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=nongnu.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g3v4MwIILt0hVpRGgXts2QqxePURMW4ShrS6/Ze6KEA=; b=iKjp7w2ur88GY3tXLdgZ416Py1sLu62YCS78XTolFuJyHMK9WFzOvkTWEBdmREomTOyVpieE9bHSM2wjJJwUxvDfQw8nWtjcSm9300dt1e7AJK4Q1/DlwSHQnBSd9yuXkNQT6XSr2kPMJGjwuAtHhCgaNeMUOjT9aspY6nc2nrYSmo+OZvl6OlI1SyTujiCu8UVHdYjDfWxqlZ50nykKsfCILMFJewg0KT5ZdE0GRFU7ooNtRGbKHflpp/RSMGmsbI8sRV6GWMz7E+oUJ2nRouyiaqxczm2PyyLnL5lzSbIZj7dLNgKoasg8VCQCt3FNwNo5mRYEe53Oj1CrlyCEcw== Received: from BL1PR13CA0147.namprd13.prod.outlook.com (2603:10b6:208:2bb::32) by CYYPR12MB8856.namprd12.prod.outlook.com (2603:10b6:930:c0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Wed, 15 May 2024 13:22:11 +0000 Received: from MN1PEPF0000F0E2.namprd04.prod.outlook.com (2603:10b6:208:2bb:cafe::d0) by BL1PR13CA0147.outlook.office365.com (2603:10b6:208:2bb::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.9 via Frontend Transport; Wed, 15 May 2024 13:22:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by MN1PEPF0000F0E2.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.21 via Frontend Transport; Wed, 15 May 2024 13:22:10 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 15 May 2024 06:21:42 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 15 May 2024 06:21:41 -0700 Received: from vdi.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 15 May 2024 06:21:39 -0700 From: Avihai Horon To: CC: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Markus Armbruster , Michael Roth , Eric Blake , Peter Xu , Fabiano Rosas , Joao Martins , Maor Gottlieb , Avihai Horon Subject: [PATCH v3 0/4] qapi/vfio: Add VFIO migration QAPI event Date: Wed, 15 May 2024 16:21:34 +0300 Message-ID: <20240515132138.4560-1-avihaih@nvidia.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E2:EE_|CYYPR12MB8856:EE_ X-MS-Office365-Filtering-Correlation-Id: 52b52d72-7019-44c1-59d0-08dc74e206ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|36860700004|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?XxBqtvRaAeyN/WMHwsii5uQspi/jNNZ?= =?utf-8?q?+dW1H6qCIGjg02PxfHCio92lLXOnxVfTd1h0DmT3Hmq9o93QIGnSerI07wuhlcyJz?= =?utf-8?q?8i6tjCJ01nh8BlNd7RUz8363cmcEJhRwTn16+zKVgwRlreKmcAxixbLw5SSrbIY0h?= =?utf-8?q?egfRRUkBFcH+tk5QVtArWJUUd2MfOOHaj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OW0vmvSakdE2YaVRIOB+mPvszIwGBd65Av0xplaS?= =?utf-8?q?+Jwz46NMNZSXS/AzLUK6bG7crib0PrlYjXx4miAe68LvZmONe/kb4TB3GoJ2EdHn1?= =?utf-8?q?RLnMTnUydNiBMqgPvRrMnW+la5V9TZ2mhfCWKVz92EjbvQg+CHR/8dJDD/RVqUAS7?= =?utf-8?q?9o9EszEINcwCM0iWpyuwTiJ8gDltyVjvdfCqwADRk2Dt99M/3TZflcxFquv1ZKORp?= =?utf-8?q?7niCqKvYpHyocfgNS21QXopTE7xuqX/VLXnMf9nNeaaEvoPa77elQ9Dd0pMxvWmWs?= =?utf-8?q?zpQQv4Zwdfwm?= X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(82310400017)(1800799015)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2024 13:22:10.0904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52b52d72-7019-44c1-59d0-08dc74e206ab X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8856 Received-SPF: softfail client-ip=2a01:111:f403:240a::600; envelope-from=avihaih@nvidia.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.935, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Hello, This series adds a new QAPI event for VFIO device migration state change. This event will be emitted when a VFIO device changes its state, for example, during migration or when stopping/starting the guest. This event can be used by management applications to get updates on the current state of the VFIO device for their own purposes. A new per VFIO device capability, "migration-events", is added so events can be enabled only for the required devices. It is disabled by default. Feedback/comments are appreciated, Thanks. Changes from v2 [2]: * Added assert for vbasedev->ops->vfio_get_object and obj. (Cedric) * Renamed set_state() to vfio_migration_set_device_state(). (Cedric) * Enhanced tracing of device state change. (Cedric) * Added Cedric's R-b. Changes from v1 [1]: * Added more info to patch #1 commit mesasge. (Markus) * Renamed VFIODeviceMigState to VfioMigrationState and VFIO_DEVICE_MIG_STATE_CHANGED to VFIO_MIGRATION. (Joao, Markus) * Added qom-path and qdev id to VFIO_MIGRATION event data. (Markus) * Handled no-op state transitions in vfio_migration_set_state(). (Cedric) * Added helper to set VFIO state and emit VFIO event. (Peter) [1] https://lore.kernel.org/qemu-devel/20240430051621.19597-1-avihaih@nvidia.com/ [2] https://lore.kernel.org/qemu-devel/20240509090954.16447-1-avihaih@nvidia.com/ Avihai Horon (4): qapi/vfio: Add VFIO migration QAPI event vfio/migration: Emit VFIO migration QAPI event vfio/migration: Don't emit STOP_COPY VFIO migration QAPI event twice vfio/migration: Enhance VFIO migration state tracing MAINTAINERS | 1 + qapi/qapi-schema.json | 1 + qapi/vfio.json | 67 +++++++++++++++++++++++++++++++++ include/hw/vfio/vfio-common.h | 1 + hw/vfio/migration.c | 71 ++++++++++++++++++++++++++++++++--- hw/vfio/pci.c | 2 + hw/vfio/trace-events | 3 +- qapi/meson.build | 1 + 8 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 qapi/vfio.json