From nobody Sat Nov 15 16:07:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass(p=none dis=none) header.from=nutanix.com ARC-Seal: i=2; a=rsa-sha256; t=1750880008; cv=pass; d=zohomail.com; s=zohoarc; b=Iyn80hoKZp5uB16HS9+6hpuHycoKRVUPOfY5tcX+9vIAYvb06z0oCPF91zFD7z5u0M2gE31/GPVgQX8jRbW23+zJ7P630ePtmcUsJm7WZm7UVy0hayUFUpQCIeH0nsqlsInvGmFR+jcybyd50Rell50ZTcgBWCGhgz+eJzDADqA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750880008; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g9PhacUvZcUxmruVZsbtYmC6rCRxbgNXibolLRoSReM=; b=lGBliTdKc+R+SsVTB7IXzMizjmjGvpUDHG0E8QWemljcCdY/BYlHj9y8BYOEB5OPfxkCU0gfbSs5cgUUjNT4u/dX8egL+KxKmx/q1dGXZqmzCC17H0yZCVuyZzoeAwQHFYJtz9/l3VnhBO/Jb7M5FEz4hmJYswFNhJrvKpFRN/I= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nutanix.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175088000791717.456478385036462; Wed, 25 Jun 2025 12:33:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uUVpq-00087Y-74; Wed, 25 Jun 2025 15:31:06 -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 1uUVpo-00085l-9q for qemu-devel@nongnu.org; Wed, 25 Jun 2025 15:31:04 -0400 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uUVpk-00046Y-22 for qemu-devel@nongnu.org; Wed, 25 Jun 2025 15:31:04 -0400 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55PDoDdu015699; Wed, 25 Jun 2025 12:30:55 -0700 Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04on2116.outbound.protection.outlook.com [40.107.100.116]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 47gjbh0r93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 12:30:55 -0700 (PDT) Received: from CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) by PH0PR02MB8535.namprd02.prod.outlook.com (2603:10b6:510:dd::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8857.28; Wed, 25 Jun 2025 19:30:52 +0000 Received: from CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51]) by CH2PR02MB6760.namprd02.prod.outlook.com ([fe80::fd77:ea65:a159:ef51%2]) with mapi id 15.20.8880.015; Wed, 25 Jun 2025 19:30:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint20171006; bh=g9PhacUvZcUxmruVZsbtYmC6rCRxbgNXibolLRoSR eM=; b=y2dTbGfEIygrrfCbZHCEwklJSWNViQMvZhjq2HqXy4+h4AQ1HGxgklVAy 1UolKpOxZx84OOoujBDWUWfGv7/+33Rk45t9XGo7lP11WwHF63Xm/UUyKDPI0zzL qzBxxN/0c+CX9ggNCCE07/XuzImhFHJAy9ULr0L+CHmm5TOXn2ePetSL2cfuYFb1 ZbfzJ9aPozgsiafCCRkL5Ejh4k5MVvF3U09998m3UATTufQfizObirtj+rFdUeZK bdjavxjL4Xvh8deXCqE2gp/hTPqcH2ZYQnQ4KFlxjoKD+8HXcXHPyjewPOmx6XiA VLkA0+hTDB+V3Z3tac5ZnhwEDA/Nw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kQVhUscJ0/GzqhbVCerR5i9xYrUS6Y9T821WeL9qjSYfAlrCf71yc3PvF3jjrPK3aXgyQVWVB1MPY/ToDndl24LP6+Tb79QHE+wSDBBrmhB5WIOHowB/s5+6BQ/ICrw1+35reYVf746za7A1D/kpYSehtRcTxxVg3I2/NfMtSd4pmEIBtLQrH0QONFfC3o7pFCGFF0v+N0Me2mlj54/XlRxqBgoe64GIndm4xmUqF/3tR+zN0Oc0IUd7PQHzP9XHJnwxl9e0eNuPIGpnv9/RzHVYMTaCD8PyVpMt7vllUIekpYfOQaYegwZJzmdyndf0VvkJ9d7gJtWAk7ehipmjmw== 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=g9PhacUvZcUxmruVZsbtYmC6rCRxbgNXibolLRoSReM=; b=ajpCUiyWqeehmpOXZx3PmPnbCQ92JqV01AS4Wx1g03r9C5yy2rYHHIkA7ShgWri6T/Wh31YezkkaJzO8XwaOlxgNJePJEM4dLIX/wGclqDpFfYT6bG6rSdIJ/ieoIdOewHJKeYPPhs4LVSQ1Wk9806ObyH630zeoexsVFdGO7hNErZPStcDMC/uU+J2ecu30ik1XoZiRdF7MfiW1RAzPINvgLpv9bepTPeYruHdX75txEcsXCr0XKtBBWRHfcf/HjEHEvl2ExjrKOxonTHqXqJs1A5kXAjs3mm5nNof7WC3VoO2n7J+Tan62gtDh4Rq3L4SS8lWK0sjGS05TDvdtBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g9PhacUvZcUxmruVZsbtYmC6rCRxbgNXibolLRoSReM=; b=VoCvih44y6U/5UMEUUoEggjt/DbjZNZV4YCK06/0lNDkeFS9fSDTdoNb2VBODuEeYrfWONVLUz3RRnYcooyCBd+M7ZNA9O7dFYSQ5YO8DaZ5lfhrd6IBqfltmCgtOUPirVME/JeoJI1qpx7w14WL2GiRbPETJwp2wm3JEANEmNqe2b/Iv5eU1amd018hKfh/mDoC9iNgWZupqArKA4DusQLyUd+dZC0kZYkZRcZR0IGzI8c/VpSHnzrjNoYTeJYzPD9Vi6JH8+0NoHtXG5VEMy+ujiUbmOdDVTLtN8cnoF/PZweX+ljsG33LCVFlSu8TYGcpff8P0k+Drts1wHDTIQ== From: John Levon To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , John Levon , Thanos Makatos , Paolo Bonzini , Alex Williamson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Levon , John Johnson , Jagannathan Raman , Elena Ufimtseva Subject: [PATCH v5 13/19] vfio-user: implement VFIO_USER_DMA_MAP/UNMAP Date: Wed, 25 Jun 2025 20:30:05 +0100 Message-ID: <20250625193012.2316242-14-john.levon@nutanix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250625193012.2316242-1-john.levon@nutanix.com> References: <20250625193012.2316242-1-john.levon@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P190CA0019.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d0::18) To CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR02MB6760:EE_|PH0PR02MB8535:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f26237e-281d-4d64-2103-08ddb41ecc39 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?QQWNpkj2WltWtrVByn4aabaoyJSBrqvgpCmRb9YzWuK55ITvOSYdbuLZgUI3?= =?us-ascii?Q?7sQB+LGDK7z7QQBSeTTpPffcF2egMMYxOhLmTOzzfquXCrkvygxIEwXCxtIP?= =?us-ascii?Q?dev21RFHC1kxoT0ZfWy9RohoTCFUeE8lAlIDLHORMz985t2qggCtVvrEDwPF?= =?us-ascii?Q?Fo9TcgGL53kccxHqKhfCEQOUci2Wj74jexirO9wXxdMjgnKfANOqxYJqtz+z?= =?us-ascii?Q?c+9v2UthQ8LHg5eWkrzPh9Rx9M2Khvf+cKNwadJkCZerAaRFGbcL/RQwwt/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crYWcXKKN493naujfHAPBm8C?= =?us-ascii?Q?eotqhe6SnaClXGqz2piA3BBtrH4WMh/xqK8TyMRjBobvhudRt3pyxWyA0MQ0?= =?us-ascii?Q?A4kwHGVvca/o8Lh/JHWl4+ynyuqRnW6shH7IbjovHzoNzDYsk6i0fmJQo+Nx?= =?us-ascii?Q?nk7lkCQjxZFrgAJGHSoZen9ktqzn3o+KEICwtHZ/7/8oOSaMHhixnE0DWiBu?= =?us-ascii?Q?nxx/PgsIPm8yGLZnUmM/F/ZeGibph7/+3suDJsAeWNwy3Y208vtTSelCDdmh?= =?us-ascii?Q?qT98h1aeoDo=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR02MB6760.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(7416014)(376014)(366016)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RtodN0agUxhI71nskm0ojxstrV4+GsYCT64Cc//mcRfL1+tkA3A0DZPE9cSY?= =?us-ascii?Q?8vhQKYWKXjd1fVtJipgwkT1G4M6t95/pHIJR2q3qtCnJAtYIYxUKI9W61I3P?= =?us-ascii?Q?a6mv59rEnkBaEVXplbt9athNk4S1EAEjNdHSUHKLE2XCKbu3GWg/P4mFyMyA?= =?us-ascii?Q?xqvZH2Q8pguRRkfctzOaKu+pQnxykSc6IONNUMM8Yq7KApC5sm9xAIOSjVnY?= =?us-ascii?Q?LytfT5bUtyQO6zDyAwrst9lTANok0QeMsjjUKFHNmX8flTMifbEe9EFLASwI?= =?us-ascii?Q?LIRjGJ00tygGA4gXo4SPIgpbhS2CSaWH5TGemAOjcVjfn3C+/hLmh/K3ityv?= =?us-ascii?Q?b3CbRvTyzsi6UrIwhmXVY2x0peu7ku+fvHiEmkJWfkv7n8dY5JqeKJluITAy?= =?us-ascii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bxytmRdoj/CIdaZp?= =?us-ascii?Q?epxZSu6pdNP5ABuZhstx5raJD2JvhqHujKs/HbCfWkbRu/gPvod9oV4DVFYZ?= =?us-ascii?Q?fERzZP7hEgdj4qKcJrjJBb002djU4dDrO5SE0ev3dQ8YMC++yY4N+DHFSBb4?= =?us-ascii?Q?27LlOltslPERUbHU750fgAdnGIP6Iw+vhgvZCNlxhoxFzziorInwokEqkwMi?= =?us-ascii?Q?Yvf8YBe9llwjHkBfJK9+aLFcbfEEeVbF9by8TJoaOKaD7O/J5Jlxf4Z0fSZv?= =?us-ascii?Q?87ZtXszHApm+WuZFD/ZS6S8NnKZzLdrlYmOVG4DX?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f26237e-281d-4d64-2103-08ddb41ecc39 X-MS-Exchange-CrossTenant-AuthSource: CH2PR02MB6760.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2025 19:30:52.8284 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1U3FlfrGDJJ/sPNlhx5PHzMspYXMXi6Et127aaUnW752CDcxmrMrBMUuVJv2YeWl4nDjkOhhTQyTe1EYntrhNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB8535 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjI1MDE0NyBTYWx0ZWRfX0sDXIlzeAmR+ T16R9An6SKQEccy/F61yhAlhiReUZ5ZCgZZKIUmnKF3R+bdpME2vIHhXyUPMoL+qXLcL2UTh2gJ BdYKKqVkefely4lgagASAPmZmIoi1rCYitJlHy9Sf6j3OzTTOcsUld0Ih/+wJxfeJeSR9q1ZwWC zNHrhQpE7l80T2xs9WRdLH8pFzcB05UQYTb5iaHn9srZWSRTQC1xT/wPWkVg0kMc4ur9o+BtJTZ nTpYDlM8h6wfyR5H43fYI4kRdDQgmOR06NWZxBC4hLuQbglhushbks4HpU5hE3OpZ7AZeLWzUmj jsBmNATXN2OmVMuY1o3tpDVRUNX5sFIZ0999+iTZzPvKv5zxrg9cyuG7fm99nM4PfgOY2rnH3Uu NYgTT+eP6Gx2cbC0uzScKeK5CwQjXzjiO402WX7Ju+RbDDgZZIBwRVccyHhZV3zaV1bTdhgb X-Authority-Analysis: v=2.4 cv=WMl/XmsR c=1 sm=1 tr=0 ts=685c4e6f cx=c_pps a=ynxkwAiy9VFaaSOUVCgc6g==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=6IFa9wvqVegA:10 a=0kUYKlekyDsA:10 a=RQZ_2NmkAAAA:8 a=yPCof4ZbAAAA:8 a=64Cc0HZtAAAA:8 a=VuTGjHEVGySaywlrrqoA:9 a=46pEW5UW3zrkaSsnLxuo:22 X-Proofpoint-ORIG-GUID: sDgHTeq8oExXROuUzSpZ7pA2mwHI_zAz X-Proofpoint-GUID: sDgHTeq8oExXROuUzSpZ7pA2mwHI_zAz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-06-25_06,2025-06-25_01,2025-03-28_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.151.68; envelope-from=john.levon@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nutanix.com) X-ZM-MESSAGEID: 1750880009832116600 Content-Type: text/plain; charset="utf-8" From: John Levon When the vfio-user container gets mapping updates, share them with the vfio-user by sending a message; this can include the region fd, allowing the server to directly mmap() the region as needed. For performance, we only wait for the message responses when we're doing with a series of updates via the listener_commit() callback. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio-user/protocol.h | 32 +++++++++ hw/vfio-user/proxy.h | 6 ++ hw/vfio-user/container.c | 135 +++++++++++++++++++++++++++++++++++++- hw/vfio-user/proxy.c | 84 +++++++++++++++++++++++- hw/vfio-user/trace-events | 4 ++ 5 files changed, 257 insertions(+), 4 deletions(-) diff --git a/hw/vfio-user/protocol.h b/hw/vfio-user/protocol.h index 48144b2c33..524f3d633a 100644 --- a/hw/vfio-user/protocol.h +++ b/hw/vfio-user/protocol.h @@ -112,6 +112,31 @@ typedef struct { */ #define VFIO_USER_DEF_MAX_BITMAP (256 * 1024 * 1024) =20 +/* + * VFIO_USER_DMA_MAP + * imported from struct vfio_iommu_type1_dma_map + */ +typedef struct { + VFIOUserHdr hdr; + uint32_t argsz; + uint32_t flags; + uint64_t offset; /* FD offset */ + uint64_t iova; + uint64_t size; +} VFIOUserDMAMap; + +/* + * VFIO_USER_DMA_UNMAP + * imported from struct vfio_iommu_type1_dma_unmap + */ +typedef struct { + VFIOUserHdr hdr; + uint32_t argsz; + uint32_t flags; + uint64_t iova; + uint64_t size; +} VFIOUserDMAUnmap; + /* * VFIO_USER_DEVICE_GET_INFO * imported from struct vfio_device_info @@ -175,4 +200,11 @@ typedef struct { char data[]; } VFIOUserRegionRW; =20 +/*imported from struct vfio_bitmap */ +typedef struct { + uint64_t pgsize; + uint64_t size; + char data[]; +} VFIOUserBitmap; + #endif /* VFIO_USER_PROTOCOL_H */ diff --git a/hw/vfio-user/proxy.h b/hw/vfio-user/proxy.h index ba1c33aba8..e2fc83ca3b 100644 --- a/hw/vfio-user/proxy.h +++ b/hw/vfio-user/proxy.h @@ -70,6 +70,7 @@ typedef struct VFIOUserProxy { QemuCond close_cv; AioContext *ctx; QEMUBH *req_bh; + bool async_ops; =20 /* * above only changed when BQL is held @@ -99,9 +100,14 @@ void vfio_user_set_handler(VFIODevice *vbasedev, void *reqarg); bool vfio_user_validate_version(VFIOUserProxy *proxy, Error **errp); =20 +VFIOUserFDs *vfio_user_getfds(int numfds); + void vfio_user_request_msg(VFIOUserHdr *hdr, uint16_t cmd, uint32_t size, uint32_t flags); +void vfio_user_wait_reqs(VFIOUserProxy *proxy); bool vfio_user_send_wait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, VFIOUserFDs *fds, int rsize, Error **errp); +bool vfio_user_send_nowait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, + VFIOUserFDs *fds, int rsize, Error **errp); =20 #endif /* VFIO_USER_PROXY_H */ diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c index b4a5a840b0..3133fef177 100644 --- a/hw/vfio-user/container.c +++ b/hw/vfio-user/container.c @@ -12,23 +12,152 @@ =20 #include "hw/vfio-user/container.h" #include "hw/vfio-user/device.h" +#include "hw/vfio-user/trace.h" #include "hw/vfio/vfio-cpr.h" #include "hw/vfio/vfio-device.h" #include "hw/vfio/vfio-listener.h" #include "qapi/error.h" =20 +/* + * When DMA space is the physical address space, the region add/del listen= ers + * will fire during memory update transactions. These depend on BQL being= held, + * so do any resulting map/demap ops async while keeping BQL. + */ +static void vfio_user_listener_begin(VFIOContainerBase *bcontainer) +{ + VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, + bcontainer); + + container->proxy->async_ops =3D true; +} + +static void vfio_user_listener_commit(VFIOContainerBase *bcontainer) +{ + VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, + bcontainer); + + /* wait here for any async requests sent during the transaction */ + container->proxy->async_ops =3D false; + vfio_user_wait_reqs(container->proxy); +} + static int vfio_user_dma_unmap(const VFIOContainerBase *bcontainer, hwaddr iova, ram_addr_t size, IOMMUTLBEntry *iotlb, bool unmap_all) { - return -ENOTSUP; + VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, + bcontainer); + Error *local_err =3D NULL; + int ret =3D 0; + + VFIOUserDMAUnmap *msgp =3D g_malloc(sizeof(*msgp)); + + vfio_user_request_msg(&msgp->hdr, VFIO_USER_DMA_UNMAP, sizeof(*msgp), = 0); + msgp->argsz =3D sizeof(struct vfio_iommu_type1_dma_unmap); + msgp->flags =3D unmap_all ? VFIO_DMA_UNMAP_FLAG_ALL : 0; + msgp->iova =3D iova; + msgp->size =3D size; + trace_vfio_user_dma_unmap(msgp->iova, msgp->size, msgp->flags, + container->proxy->async_ops); + + if (container->proxy->async_ops) { + if (!vfio_user_send_nowait(container->proxy, &msgp->hdr, NULL, + 0, &local_err)) { + error_report_err(local_err); + ret =3D -EFAULT; + } else { + ret =3D 0; + } + } else { + if (!vfio_user_send_wait(container->proxy, &msgp->hdr, NULL, + 0, &local_err)) { + error_report_err(local_err); + ret =3D -EFAULT; + } + + if (msgp->hdr.flags & VFIO_USER_ERROR) { + ret =3D -msgp->hdr.error_reply; + } + + g_free(msgp); + } + + return ret; } =20 static int vfio_user_dma_map(const VFIOContainerBase *bcontainer, hwaddr i= ova, ram_addr_t size, void *vaddr, bool readonly, MemoryRegion *mrp) { - return -ENOTSUP; + VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, + bcontainer); + int fd =3D memory_region_get_fd(mrp); + Error *local_err =3D NULL; + int ret; + + VFIOUserFDs *fds =3D NULL; + VFIOUserDMAMap *msgp =3D g_malloc0(sizeof(*msgp)); + + vfio_user_request_msg(&msgp->hdr, VFIO_USER_DMA_MAP, sizeof(*msgp), 0); + msgp->argsz =3D sizeof(struct vfio_iommu_type1_dma_map); + msgp->flags =3D VFIO_DMA_MAP_FLAG_READ; + msgp->offset =3D 0; + msgp->iova =3D iova; + msgp->size =3D size; + + /* + * vaddr enters as a QEMU process address; make it either a file offset + * for mapped areas or leave as 0. + */ + if (fd !=3D -1) { + msgp->offset =3D qemu_ram_block_host_offset(mrp->ram_block, vaddr); + } + + if (!readonly) { + msgp->flags |=3D VFIO_DMA_MAP_FLAG_WRITE; + } + + trace_vfio_user_dma_map(msgp->iova, msgp->size, msgp->offset, msgp->fl= ags, + container->proxy->async_ops); + + /* + * The async_ops case sends without blocking. They're later waited for= in + * vfio_send_wait_reqs. + */ + if (container->proxy->async_ops) { + /* can't use auto variable since we don't block */ + if (fd !=3D -1) { + fds =3D vfio_user_getfds(1); + fds->send_fds =3D 1; + fds->fds[0] =3D fd; + } + + if (!vfio_user_send_nowait(container->proxy, &msgp->hdr, fds, + 0, &local_err)) { + error_report_err(local_err); + ret =3D -EFAULT; + } else { + ret =3D 0; + } + } else { + VFIOUserFDs local_fds =3D { 1, 0, &fd }; + + fds =3D fd !=3D -1 ? &local_fds : NULL; + + if (!vfio_user_send_wait(container->proxy, &msgp->hdr, fds, + 0, &local_err)) { + error_report_err(local_err); + ret =3D -EFAULT; + } + + if (msgp->hdr.flags & VFIO_USER_ERROR) { + ret =3D -msgp->hdr.error_reply; + } + + g_free(msgp); + } + + return ret; } =20 static int @@ -218,6 +347,8 @@ static void vfio_iommu_user_class_init(ObjectClass *kla= ss, const void *data) VFIOIOMMUClass *vioc =3D VFIO_IOMMU_CLASS(klass); =20 vioc->setup =3D vfio_user_setup; + vioc->listener_begin =3D vfio_user_listener_begin, + vioc->listener_commit =3D vfio_user_listener_commit, vioc->dma_map =3D vfio_user_dma_map; vioc->dma_unmap =3D vfio_user_dma_unmap; vioc->attach_device =3D vfio_user_device_attach; diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c index aed7b22e2a..c8ae8a59b4 100644 --- a/hw/vfio-user/proxy.c +++ b/hw/vfio-user/proxy.c @@ -27,7 +27,6 @@ static IOThread *vfio_user_iothread; static void vfio_user_shutdown(VFIOUserProxy *proxy); static VFIOUserMsg *vfio_user_getmsg(VFIOUserProxy *proxy, VFIOUserHdr *hd= r, VFIOUserFDs *fds); -static VFIOUserFDs *vfio_user_getfds(int numfds); static void vfio_user_recycle(VFIOUserProxy *proxy, VFIOUserMsg *msg); =20 static void vfio_user_recv(void *opaque); @@ -132,7 +131,7 @@ static void vfio_user_recycle(VFIOUserProxy *proxy, VFI= OUserMsg *msg) QTAILQ_INSERT_HEAD(&proxy->free, msg, next); } =20 -static VFIOUserFDs *vfio_user_getfds(int numfds) +VFIOUserFDs *vfio_user_getfds(int numfds) { VFIOUserFDs *fds =3D g_malloc0(sizeof(*fds) + (numfds * sizeof(int))); =20 @@ -618,6 +617,43 @@ static bool vfio_user_send_queued(VFIOUserProxy *proxy= , VFIOUserMsg *msg, return true; } =20 +/* + * nowait send - vfio_wait_reqs() can wait for it later + * + * Returns false if we did not successfully receive a reply message, in wh= ich + * case @errp will be populated. + * + * In either case, ownership of @hdr and @fds is taken, and the caller must + * *not* free them itself. + */ +bool vfio_user_send_nowait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, + VFIOUserFDs *fds, int rsize, Error **errp) +{ + VFIOUserMsg *msg; + + QEMU_LOCK_GUARD(&proxy->lock); + + msg =3D vfio_user_getmsg(proxy, hdr, fds); + msg->id =3D hdr->id; + msg->rsize =3D rsize ? rsize : hdr->size; + msg->type =3D VFIO_MSG_NOWAIT; + + if (hdr->flags & VFIO_USER_NO_REPLY) { + error_setg_errno(errp, EINVAL, "%s on NO_REPLY message", __func__); + vfio_user_recycle(proxy, msg); + return false; + } + + if (!vfio_user_send_queued(proxy, msg, errp)) { + vfio_user_recycle(proxy, msg); + return false; + } + + proxy->last_nowait =3D msg; + + return true; +} + /* * Returns false if we did not successfully receive a reply message, in wh= ich * case @errp will be populated. @@ -666,6 +702,50 @@ bool vfio_user_send_wait(VFIOUserProxy *proxy, VFIOUse= rHdr *hdr, return ok; } =20 +void vfio_user_wait_reqs(VFIOUserProxy *proxy) +{ + VFIOUserMsg *msg; + + /* + * Any DMA map/unmap requests sent in the middle + * of a memory region transaction were sent nowait. + * Wait for them here. + */ + qemu_mutex_lock(&proxy->lock); + if (proxy->last_nowait !=3D NULL) { + /* + * Change type to WAIT to wait for reply + */ + msg =3D proxy->last_nowait; + msg->type =3D VFIO_MSG_WAIT; + proxy->last_nowait =3D NULL; + while (!msg->complete) { + if (!qemu_cond_timedwait(&msg->cv, &proxy->lock, wait_time)) { + VFIOUserMsgQ *list; + + list =3D msg->pending ? &proxy->pending : &proxy->outgoing; + QTAILQ_REMOVE(list, msg, next); + error_printf("vfio_wait_reqs - timed out\n"); + break; + } + } + + if (msg->hdr->flags & VFIO_USER_ERROR) { + error_printf("vfio_user_wait_reqs - error reply on async "); + error_printf("request: command %x error %s\n", msg->hdr->comma= nd, + strerror(msg->hdr->error_reply)); + } + + /* + * Change type back to NOWAIT to free + */ + msg->type =3D VFIO_MSG_NOWAIT; + vfio_user_recycle(proxy, msg); + } + + qemu_mutex_unlock(&proxy->lock); +} + static QLIST_HEAD(, VFIOUserProxy) vfio_user_sockets =3D QLIST_HEAD_INITIALIZER(vfio_user_sockets); =20 diff --git a/hw/vfio-user/trace-events b/hw/vfio-user/trace-events index aa8f3c3d4d..44dde020b3 100644 --- a/hw/vfio-user/trace-events +++ b/hw/vfio-user/trace-events @@ -13,3 +13,7 @@ vfio_user_get_region_info(uint32_t index, uint32_t flags,= uint64_t size) " index vfio_user_region_rw(uint32_t region, uint64_t off, uint32_t count) " regio= n %d offset 0x%"PRIx64" count %d" vfio_user_get_irq_info(uint32_t index, uint32_t flags, uint32_t count) " i= ndex %d flags 0x%x count %d" vfio_user_set_irqs(uint32_t index, uint32_t start, uint32_t count, uint32_= t flags) " index %d start %d count %d flags 0x%x" + +# container.c +vfio_user_dma_map(uint64_t iova, uint64_t size, uint64_t off, uint32_t fla= gs, bool async_ops) " iova 0x%"PRIx64" size 0x%"PRIx64" off 0x%"PRIx64" fla= gs 0x%x async_ops %d" +vfio_user_dma_unmap(uint64_t iova, uint64_t size, uint32_t flags, bool as= ync_ops) " iova 0x%"PRIx64" size 0x%"PRIx64" flags 0x%x async_ops %d" --=20 2.43.0