From nobody Sat Nov 15 16:36:42 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=1750340155; cv=pass; d=zohomail.com; s=zohoarc; b=gvt31vdtJsS9UCdYxZTZL+8oGsta4XEDN4AVXoPmPh+joXbXLXwx6/cuQQHCX5wLwXDuDxmbShwcgXQZY84MdMw4b1J/0wfxFiO57xbTBwLhQGDVDWxd5JV+AWL1seAxoSOW7/msmHPXq+/rXVmsaAQIzA397dKMvGHtTrLGX0w= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750340155; 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=6311tszg3B3Xgw32Umsi2InitNKIbeJrTmEavkjkrtI=; b=M15a+v+MWMpvd/j1bhN+Uh54RLlVYiIwx3jZ31fc852hS3rlOszQRFLsF8fV61K8O48nhXd/hVOw3EYXEHUXE3jieYz/YW6RY7PNNqrL0JTKSdXS8hUOCkuuB5J0oA4rIQ89cfyPazpv5rgNkpXK8h7k2OM/3rdXzBszOoLBx3s= 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 17503401556074.984622447761922; Thu, 19 Jun 2025 06:35:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSFO8-0004lJ-T3; Thu, 19 Jun 2025 09:33:09 -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 1uSFNq-0004Sd-UN for qemu-devel@nongnu.org; Thu, 19 Jun 2025 09:32:51 -0400 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uSFNm-0008GX-Hq for qemu-devel@nongnu.org; Thu, 19 Jun 2025 09:32:50 -0400 Received: from pps.filterd (m0127843.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55JAvH22013023; Thu, 19 Jun 2025 06:32:41 -0700 Received: from sj2pr03cu002.outbound.protection.outlook.com (mail-westusazon11023091.outbound.protection.outlook.com [52.101.44.91]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 47976j3rag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Jun 2025 06:32:41 -0700 (PDT) Received: from CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) by PH0PR02MB9383.namprd02.prod.outlook.com (2603:10b6:510:289::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.19; Thu, 19 Jun 2025 13:32:31 +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.8857.016; Thu, 19 Jun 2025 13:32:31 +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=6311tszg3B3Xgw32Umsi2InitNKIbeJrTmEavkjkr tI=; b=s7wFWXN7Thm+svKBHxws0SxtU9oXzUVvlIfucwJo1bIoZVoJwRN1xlA3g HCli0sIUIRDZ/csMSgNlIr3gIXg/Z4dv81lR6OEb59yXL6017czciX6T2rI11Feq wiXrEBwQ0nkYn+SXik+LzFElMMyBCEMBj724QYf48HwBxIBzIJJwspZ2U92mJ9rS t58UVIAKhqISdxot5BTT4kQ8Kt4yx35w9Gz5az3Jmhnh26PacyA2TNiO+n6FxK8m XTPJfFTRDGOdpilsEv/pVC+CxkBZxCH+oz/NS6xTP7Daf0AHLrctnueyhvD+71u6 8iJOyMuIDOuVYV3BS6cIUthINcpTQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rgjTK9mE24alg/OHl25xfl4OREIfn+Ji6kzIPnRXB06ylgvLGCgrO0ZdQlqflbaVnejipE+A1qxw0BZYyZtvxf7PlsLgWWXmUgfVKRz3bl5t+AVfLRlO8LNNqlI0b8jT9NDvS9JppAiujGYPLyelRv0frmxiF2v9K8YADMLkgAqQsV2tNXqmqJa3KfEytv7NhdskY14l4JzWRn5FQgRhlNO7LFznc+wzhPjStWl7FjmYYyYrVz+xNXSChUBDdTi6UOZqchCE1xuNpho4Zn0J1BUH96OzinRXuzDBjMAOBAtvwkznRUGy7l2t+NYQrv0xCVZK+lzvI9/bZMp1X+bGkg== 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=6311tszg3B3Xgw32Umsi2InitNKIbeJrTmEavkjkrtI=; b=Nyr3Mmbi01cbvE9jTvAs5vWw0HO+i/G/I8ZVWdaitrfFi46+eCcX0GqRBap6kYcuHkAy5cpT/YaMoyU0jUAIP+XnNVVx/ISqR/QmSJYJzqXaNVa+40nER+TQLJFETypzAPeHNL/m07Iks+FGGkkE0KA83sCFbHKS5En/OnDSVo66FOQkFXAtQjNXWI3boFeggmUjxb/NFKdwiGxB6pPHIbIQnQos+f2iXziPqq7sAJ9TxK23abDWr/BWp02506D5Ii6203II11jrwH8Qo0k3SMd0NiPYL+TQqFjHcvXyEDdf8S3bAJ42n5VxhvLwxknc++kJ+79Ulo2r7vGFnrVr0Q== 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=6311tszg3B3Xgw32Umsi2InitNKIbeJrTmEavkjkrtI=; b=TQPQjIMawCyqraNbA37rMPy4YV/VgF6JanLqNJe3hpOcQ4YKEHSei0bisdDMg+ofZhEO5K2IwYLOF2DXrvou7cOcnQk2Scj9O1ULiJjvtdQOL91jL4Pl2rSu/WyYzpv3W88P/OSQo9nWF0DGTdAny/ibI1owoFTv7we3X995NOVnWXf4eaVCQjjYrp1pvmlDppXMfrT+fD6imm/1uqaU6LjUnc41F1v4Zz5KEDcMeUVAd7BURRrUx/oaMa9pdYo/NufqV8nw/rQXdS+I1/qJDGeZGrH2FE/qfeU7uYGGqYcCaq23sOA02CC6H5ZXgMvLnqFYWVrMSCQjqVWi2VAPaA== From: John Levon To: qemu-devel@nongnu.org Cc: Thanos Makatos , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , John Levon , Alex Williamson , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , John Levon , John Johnson , Jagannathan Raman , Elena Ufimtseva Subject: [PATCH v4 13/19] vfio-user: implement VFIO_USER_DMA_MAP/UNMAP Date: Thu, 19 Jun 2025 06:31:47 -0700 Message-ID: <20250619133154.264786-14-john.levon@nutanix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250619133154.264786-1-john.levon@nutanix.com> References: <20250619133154.264786-1-john.levon@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO3P265CA0025.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:387::6) To CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR02MB6760:EE_|PH0PR02MB9383:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cd8a697-9efc-4f23-e367-08ddaf35bdb3 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2HZ66Ku1qsiAGTxD0i4EHC3YTLxGPZnVDh/+PvzaAw+o9XqX0szk4keljwfn?= =?us-ascii?Q?tXvHVH4WnFQZ9nuoQS3hXuNi/YkoQDksKqnuxEkb1237laSw32ZTTpzE4pFK?= =?us-ascii?Q?EMtUa9R4AzqG7Knh/ZUzDSR4vgLpsutXk0M6/Z60Z/h/Obgui5fJGpXTc2Ay?= =?us-ascii?Q?4M08znCraYMyZdEQMDMzW46ICPHXbVcVBVsysADz4wHIxaueU7bEsH2zyJQa?= =?us-ascii?Q?r6EctisFBHlRQpMf6nY/1cEQ0uqEAMpM1UbYNFgx1Jgt4G/nQlsJ4SrdMBgW?= =?us-asc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RhdI7wQB67IRuw?= =?us-ascii?Q?Fbmr5JV9l1nhtiPdHS3uZ9toDJNy/3Ii1SXBObrvUZoibnoSJaKtOn3LERYc?= =?us-ascii?Q?zXqnb0V2qM0lZzQz/qI7u5cImAoCXDw3tnn6hhLthykbKDzGkkm86+S8v1H3?= =?us-ascii?Q?I5B10y21FP1iyvs84HDIaQYTVLnb4o+3VUMUHUSA1T94zrNz+oFtJ5D5ArrS?= =?us-ascii?Q?bqi0SIZMO56xsyWaPD7KQDIpQk4tjvnxiZMgl/J97Q3ge0hQax5WlDf5Vp1o?= =?us-ascii?Q?Xzmm/SSdQgw=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)(376014)(7416014)(1800799024)(366016); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6cfM4El49kJQH+Uftw5zUa1sokNu+qMORRdwJgI63IvZ0O1CpA3alRethhvP?= =?us-ascii?Q?diIDJ8kagzMlWnm9mDt+PYlajoVGdRdBs7nPH0Yjmk/+7KzvK/R372YKvV1o?= =?us-ascii?Q?mXBqblqxfJNGIKh8ZjnCMZJpoak+SmShO0GSTOEArJnFWIR/sp/pIfldL15f?= =?us-ascii?Q?3KwdePiIerJkqPnTGKdbP2qE50b92SOfFHJbgJgvYqWEov7gwLUMeY4lEub5?= =?us-ascii?Q?3kKdl5eGc44aUIxstisSjYdS2A7Wn8x9vnYJkL2EGW4n+E8lprHmuKUh5HOi?= =?us-ascii?Q?VJ4I+n/QZLi/Tux9VrKCC0hPKEolHwmEuWV4gKZUQ9R025o0jrU/OaPqYzw2?= =?us-ascii?Q?+Rd0FkwEGAVl6SbHnySE/fD8XwgX39jUBygo+5EzSplq8zZwTOOvp6cOBY4b?= =?us-ascii?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9Wiw5UVRSJ?= =?us-ascii?Q?UzrIGYGojXLUeoNep/84pFjdPz1zM/vPHjFgknhArPA2m4tapcPE/fLpL8re?= =?us-ascii?Q?psGv+fFX2C9KcQgJdYBG4JsJYVklx3vdqNLJlMQr0NAY4NS7XCiStukT9c/C?= =?us-ascii?Q?+pAXQvJ1lYgLDFKns1gmxtdq4db3fj/H6MfjXCCZNbzCBJ2vUQUNK9q8+csl?= =?us-ascii?Q?uQFMrSHsbyMxu3GqUr9Rs8VRXxeMBfG+N6ysv88uLpIIqSqiqNG8fYZukooB?= =?us-ascii?Q?V6LztHb+h+K17Jzwj2KPV7it/jbWP16Na/yeHUVv?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cd8a697-9efc-4f23-e367-08ddaf35bdb3 X-MS-Exchange-CrossTenant-AuthSource: CH2PR02MB6760.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2025 13:32:31.0910 (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: 0xWYn7+CqJ7wNkxitx5y9gQBk+qTo2zn1k4trGBlA583bDieUy1GcwiXxQnW3Ox1sjS8sMGdKjnILjXGxm2/sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB9383 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE5MDExMyBTYWx0ZWRfX6/gZbH2FUjTv Wty4y9DZg7M30fg3yUGHyzfZ2BJ7T6ImumjHMa36UTF3PC4uSJBa+3CibBKE4A7oA6oI12ob7TI 2DbD1SoDfTzjUk1oMlzWup49YlWFFo0JRDTUowxy3TVqXzEKR5UKXEpifJrgbGzphvVENGnelyr o8LYtTGFJntwkUQ1J15rhnjfpY9GAL4TpIkaV3DGzfdtXxcIsXbl//wvAuO2fonSivIOO6w3YH+ PWZhH3F97WnNaFLQuNDV1mJN4nw9HWA8ymBXCHhjgmV6kw43ZZW17hd+Db/uhua2c0GTK36HK+f OTBoK4xyOAPgVILKClIHht2UAIVL2T7sAQEzVTLgKQpQQnJUHqxO8fsBhvmQFSI3xLs0nS/+7Uy WpiI8oD31gJood3rFwEvc2KO3MAt1sA4VHTgT4sVc49zeE2nJuhKt56X35uPFOcNKiG1SusH X-Authority-Analysis: v=2.4 cv=RcqQC0tv c=1 sm=1 tr=0 ts=68541179 cx=c_pps a=b9bpObgcEOTp51h0EtjbnQ==: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=1ZqixiJJ9Y4JtCwCYkQA:9 a=46pEW5UW3zrkaSsnLxuo:22 X-Proofpoint-ORIG-GUID: noPGGX5BtC_ph3nHya6cpVFeI-3AAl2r X-Proofpoint-GUID: noPGGX5BtC_ph3nHya6cpVFeI-3AAl2r X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-19_05,2025-06-18_03,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.155.12; envelope-from=john.levon@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.897, 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_MSPIKE_H2=0.001, 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: 1750340157781116600 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 --- hw/vfio-user/protocol.h | 32 +++++++++++ hw/vfio-user/proxy.h | 6 +++ hw/vfio-user/container.c | 108 +++++++++++++++++++++++++++++++++++++- hw/vfio-user/proxy.c | 77 ++++++++++++++++++++++++++- hw/vfio-user/trace-events | 4 ++ 5 files changed, 223 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 e5ac558a65..a9a36e4110 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); void vfio_user_send_wait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, VFIOUserFDs *fds, int rsize); +void vfio_user_send_nowait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, + VFIOUserFDs *fds, int rsize); =20 #endif /* VFIO_USER_PROXY_H */ diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c index f7c285ec2d..a9cc4b197e 100644 --- a/hw/vfio-user/container.c +++ b/hw/vfio-user/container.c @@ -12,23 +12,125 @@ =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); + + 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) { + vfio_user_send_nowait(container->proxy, &msgp->hdr, NULL, 0); + return 0; + } + + vfio_user_send_wait(container->proxy, &msgp->hdr, NULL, 0); + if (msgp->hdr.flags & VFIO_USER_ERROR) { + return -msgp->hdr.error_reply; + } + + g_free(msgp); + return 0; } =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); + + VFIOUserProxy *proxy =3D container->proxy; + int fd =3D memory_region_get_fd(mrp); + 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; + } + vfio_user_send_nowait(proxy, &msgp->hdr, fds, 0); + ret =3D 0; + } else { + VFIOUserFDs local_fds =3D { 1, 0, &fd }; + + fds =3D fd !=3D -1 ? &local_fds : NULL; + vfio_user_send_wait(proxy, &msgp->hdr, fds, 0); + ret =3D (msgp->hdr.flags & VFIO_USER_ERROR) ? -msgp->hdr.error_rep= ly : 0; + g_free(msgp); + } + + return ret; } =20 static int @@ -220,6 +322,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 c6b6628505..315f5fd350 100644 --- a/hw/vfio-user/proxy.c +++ b/hw/vfio-user/proxy.c @@ -28,7 +28,6 @@ static void vfio_user_shutdown(VFIOUserProxy *proxy); static int vfio_user_send_qio(VFIOUserProxy *proxy, VFIOUserMsg *msg); 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); @@ -130,7 +129,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 @@ -606,6 +605,36 @@ static int vfio_user_send_queued(VFIOUserProxy *proxy,= VFIOUserMsg *msg) return 0; } =20 +/* + * nowait send - vfio_wait_reqs() can wait for it later + */ +void vfio_user_send_nowait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, + VFIOUserFDs *fds, int rsize) +{ + VFIOUserMsg *msg; + int ret; + + if (hdr->flags & VFIO_USER_NO_REPLY) { + error_printf("vfio_user_send_nowait on async message\n"); + return; + } + + 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; + + ret =3D vfio_user_send_queued(proxy, msg); + if (ret < 0) { + vfio_user_recycle(proxy, msg); + return; + } + + proxy->last_nowait =3D msg; +} + void vfio_user_send_wait(VFIOUserProxy *proxy, VFIOUserHdr *hdr, VFIOUserFDs *fds, int rsize) { @@ -644,6 +673,50 @@ void vfio_user_send_wait(VFIOUserProxy *proxy, VFIOUse= rHdr *hdr, qemu_mutex_unlock(&proxy->lock); } =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 053f5932eb..7ef98813b3 100644 --- a/hw/vfio-user/trace-events +++ b/hw/vfio-user/trace-events @@ -11,3 +11,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