From nobody Sat Nov 15 17:07:32 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=1749255235; cv=pass; d=zohomail.com; s=zohoarc; b=FrTWDQu2DU780ZmOwJPeUoXDBcMrS9dk20o2mUpb2YJiy3eXoSBFd9xcGXUSfhwfxMbaUuV0UVs2I4R8zZI1FS4YXZgN2a2xD+pjtp9eTeN0VFPUz0nPzr0VmmfIPm0BT37mlTLvFsep1o8hAYrp9LN5wX2sIN7EqquTsnOFj0I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749255235; 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=9s8GGmvHd7YbLvsT1cNsRFjqwTXQbF/N8tWvGuRlBX4=; b=IRnzgUAPagTRNoSzXbPLRUBcsn5x52+cgIgjmlxevc+vp+is4eRNDeqIp4E/rV7B2vPL4GnlM5MFElk8STFYV5hmx4a3HsUqv5iS5g/xw/PdnFHy9kJc95jk4T3e+5INcA7N6IcBKEqzuZwo1Y3TDr95AwNLhaLkvpyu3uumAjQ= 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 1749255235364182.6119248547709; Fri, 6 Jun 2025 17:13:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uNhA1-00034O-6g; Fri, 06 Jun 2025 20:11:45 -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 1uNh9z-000348-Sl for qemu-devel@nongnu.org; Fri, 06 Jun 2025 20:11:43 -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 1uNh9x-0006R2-P9 for qemu-devel@nongnu.org; Fri, 06 Jun 2025 20:11:43 -0400 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556N0Rt7023133; Fri, 6 Jun 2025 17:11:28 -0700 Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02on2126.outbound.protection.outlook.com [40.107.212.126]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 472njsxqb2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Jun 2025 17:11:28 -0700 (PDT) Received: from CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) by CO1PR02MB8441.namprd02.prod.outlook.com (2603:10b6:303:154::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.17; Sat, 7 Jun 2025 00:11:25 +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.8813.016; Sat, 7 Jun 2025 00:11:25 +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=9s8GGmvHd7YbLvsT1cNsRFjqwTXQbF/N8tWvGuRlB X4=; b=Y2t+ZSEBtZUmnmGIwot7rDasOPywYpZn3nWhNG/N4xwjlt+tTfZa9TlLr sWJJenq9SHz2TNF0rlCofb++w2UOzJSXxClfobYduHI3wJ1n3GhbWsawpInyA+nx 8UWC20iXV8ax2V+be1nhiMx1TU/8CJC9jQ5xCXlYko2Xq3jpSXrxa45dPGkSjdDJ 5uA2zVN4zTXI+YxDbm9IsPr8kfI2FGFvtMUkux57JeRDTIi93uQ3w03ZnVlJGSEF +3gpDlNQBlKamURzoKQcTIN7HPztgGJByRqkde4e+WOhgRyEd1FI6jqAFL8orkXa UTa/P3bFdXUFg/J/tiqFY7Zu/LNPA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yRyqt9KFcA1e3K9spFbi5dlaxBolS/VRDx/2sKl5r92R1ejgauSANdORV4gHjYdDpEc1FdxSC9ZYX2kqp45HcdozIpE5M1P8T9rv4557e41cGFHIepr0wb9WaIspZBIR+bzY0mqMvHzbr3nK4X7TNx+U3qx0929j4SU7NjSJoohvRRr6onXFWD6nu8u5dz5NUSz5WbfsEdfolTDGyGoHP4X+tQpgxnbwNzrH+FZFe2KdrXoFU0bRaucG7QZ8bKCnhhiAIFNaMsXjMk1DFJ8G4bhzXcH3est6I6WaISE2St2VNHaP6lQ4q6bD77eE1ANqBe5kvtBrwLMZIoiyh1OXZA== 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=9s8GGmvHd7YbLvsT1cNsRFjqwTXQbF/N8tWvGuRlBX4=; b=csawmvjo8AdFpzNVAVpJM7YxJyfKVQKKnztZZe2+7H4ZtBhxFX3AnBGbUOrmT9xZnQXAZf6ybdhZNgXNxbe7ctF9wUc9IeIGHCMN43maLj3E+/JUegeLFRfc57LC6OIiT9PHBvdU5ifZS5poOjXE7fEaan3YH49DGM58VMFPmxVy2FTrQk6/aywo1Pl28dw10ORm0FcAwEXdIbVi9BoxWFjJeky987+QGW7A4mRb6WKYIKoIzeN3wbh8fe9uXx85wnXCZXu875hnaLojoQ4AzDmVYctnHS5/n/bUQ9mh9cBL4qXj6zv+FXwCANn/G9owv/3e+1agZgqHpq3kuPmP5A== 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=9s8GGmvHd7YbLvsT1cNsRFjqwTXQbF/N8tWvGuRlBX4=; b=yZvc7sRCG4B5CYlPGTdMAY/mRrmSLQQLEbkI2SIwPlewDU2kb5bQeAZ8r7oqnsJK7WdQV8p8SeTGHuRDCvpcomp96eFan7sYyauNHtRBDWMzb3qlRfz2tBfinBU9DCTKu45sWh6GMgXdDCOb5AtYJ/0M+XEQqEYtWcc6eSKV2LRYkeFHzKuSoWXzXcyaExXuPtHoBRtoQR8XIAVMJtMhLPyxx0qJlYzUBcQzlzsTiFF2XoYEo3IL6l/EludXdAd7V9TEXLy1IJyaTBo7TX9TsFZYhg2Z0RKxjfbFul8nY7ABAqHDpJIHgPOeYh2ePwjH6aIE6U6rgx5J2Wqy66Ak/w== From: John Levon To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , Thanos Makatos , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Levon , John Levon , John Johnson , Jagannathan Raman , Elena Ufimtseva Subject: [PATCH v3 18/23] vfio-user: implement VFIO_USER_DMA_MAP/UNMAP Date: Fri, 6 Jun 2025 17:10:50 -0700 Message-ID: <20250607001056.335310-19-john.levon@nutanix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250607001056.335310-1-john.levon@nutanix.com> References: <20250607001056.335310-1-john.levon@nutanix.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PH8PR22CA0004.namprd22.prod.outlook.com (2603:10b6:510:2d1::19) To CH2PR02MB6760.namprd02.prod.outlook.com (2603:10b6:610:7f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR02MB6760:EE_|CO1PR02MB8441:EE_ X-MS-Office365-Filtering-Correlation-Id: acf2b94b-b746-4a3d-3dd8-08dda557d73b x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?KHOm3rgVa41x8vlS+uZHqF+pQ0BcDOgStXHJyAeqAxR36N+tO376olDOYtAf?= =?us-ascii?Q?nI1JeC+P1xFDFJnAMCvjD25VAgSMcA39+goZCEb7qRYOKmvIzEQ4vpMsKfHn?= =?us-ascii?Q?0A+3Z6hu3iL9JpZ+muIxhsG68Dg/QpxlR3vWBsvfCRcw21uGkzBMcyKe8a0Q?= =?us-ascii?Q?a+qwa8bseUoV3KrSfHKzYUdG+R3ndfRkWUA8LozuKpQJEOQdReq7v3f/yhDG?= =?us-ascii?Q?09gZ6nAVjvlkIa0KfQ8NyxiOH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ii?Q?HGeB1PKZnY+xZpHwZUpkKLyucn7/cVlUBDmRSWHhPAd/UGnBxXOE3eDg/b0n?= =?us-ascii?Q?BbUVp1EufQ1l0to+z/cREIAWuM2W+LoBMVbGppyfu0yTSrC2WO0V4EICUNbx?= =?us-ascii?Q?Y+boQf2F5iNmVRlIt7UUX3SXiC8KKLGRfH6uDgDaW9x9F/iGN2Xj7iq0441e?= =?us-ascii?Q?W/PRSOE8ZFoXDKNrQG5XlAQ/SwWtKm1HbnafsuCnGhyXnvGlC4zK7n7I469m?= =?us-ascii?Q?z258PYKpXjTmPcR2vpekrBCazmCtrk39azMvIItyf9S16WcmBZfN1rZmf7Of?= =?us-ascii?Q?9cOF8RDEp1A=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)(1800799024)(366016)(376014)(7416014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bykdDqr2knG2iPXfKC/lUpr9Hb+7sMfH4StnU5cT78ZOZH3XbrDqhjGMt0g+?= =?us-ascii?Q?w1+r/SmqoYYLTS159ZttN50O9uRy33UAUti30b9+tjHw1VRPrW3sdY7iBrw3?= =?us-ascii?Q?jhajQl+J1AdKi+UKpTmT5hpKxSW9oh2d/cOCDgqfgHPn3jGOnlxm1ho0VD91?= =?us-ascii?Q?gE3Er7Nrbx4WNNHKOIi7giWWjVbMm37SK3wXHfkw1WwkwXmpF5TQ9Aj1YraS?= =?us-ascii?Q?84GrE0o8rw6I4M1wcFFahF0vL8/WOlhp2X+CZLMkAdZCDrV3+Mop1wWfztOv?= =?us-ascii?Q?XGsX9DlYqNoElCsOz21HHFlP8uKV38+02K1mYClad3dd3eA5gz+8QUak55ZM?= =?us-ascii?Q?4bv1NCDwyZ3Xpv9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=?us-ascii?Q?+obTv3rcGtX4HVkrh9BLqRh8wPicW9AU0OKxm2rmd1JTcrvjtnomxcb45+C0?= =?us-ascii?Q?175zC2+qFL47BupPuluxLpFeSrCu/IqDwO6bk3ZHsedoJ+TuqIH38r7GD9IH?= =?us-ascii?Q?bRfsu/n0KKQfLhNy3MegkKn7DM95SEuCbZAKg+TLhTKizumE6H7f1hLcV/jM?= =?us-ascii?Q?GADsbCGF0Z41QSteMH/7tDg/6bDsDGFbWv3NO426FqHJKtyeIW+g2oO5jJe3?= =?us-ascii?Q?6li1kJg9kHp6GXJ+JUYyIJAVI1aEghB/qo1CWYJqtfw/CkYWhDhtQy6SQ7Y7?= =?us-ascii?Q?baXIpEDk+J9Qe037/bpQh8Zi7BVtzdGLUIfog3aw?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: acf2b94b-b746-4a3d-3dd8-08dda557d73b X-MS-Exchange-CrossTenant-AuthSource: CH2PR02MB6760.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2025 00:11:25.0387 (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: p7y1n1dgQK4BaNMh2UtdkT82L443aCnDnQTN2c2qTcoIK35JKwVxUwR6Rh5QXSumMzbpNoBH/T7yG7caO63j6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR02MB8441 X-Authority-Analysis: v=2.4 cv=f9JIBPyM c=1 sm=1 tr=0 ts=684383b0 cx=c_pps a=JomqzcHDjT5Ni/tnCvtrfQ==: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=QltQKaWwH6ua0DdkohUA:9 a=46pEW5UW3zrkaSsnLxuo:22 X-Proofpoint-GUID: -un85e7K5-t7RPu05QAYDX7gTiOVlCcl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDE5OSBTYWx0ZWRfX5Tm+xCAeihnY ECRrNfrQ1QE6EMEFBY4iML/oH/fCjNMehHD0tE+TyXlDCyVdm9S1wL/Hu7MErPtc78G551DNwUT Y4jImeO1JfPSh4DXb8HlAw/lbjWV0oTF5ihtHjtJd0rdL1ezftXGfGu5y6zopoa4oyl/MJtz2NH t3kcek6Fgt51hDY/7PH9Z2wXRoCquEtZ4eYmGYcRk0HpHQqYcshmN0FmAC+eGTbXGZMwIQpMYS6 /RHOxZA9dSr5lCXNk2VYfxDYYFpwlR2SukhzPYyQ3rjRP4Lw4oBCijipzRlo0aEjrGXW2Wnn3IK NBHWr40ofxOlGxErZpApqxIDo+IlnOrdQJ9QfkmBA0uKHFi/nE1Wilgyjm9hf5fzSL9cbuZMs1j ce/5+o7arC8CjyQ0X8XghUIYnDBRlN3G/Rx60ilTdBqYcpKSa5HDDp9aQutGRc6YDbBHzYK9 X-Proofpoint-ORIG-GUID: -un85e7K5-t7RPu05QAYDX7gTiOVlCcl 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-06_09,2025-06-05_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.155.12; envelope-from=john.levon@nutanix.com; helo=mx0b-002c1b01.pphosted.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.104, 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: 1749255237472116600 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 | 107 +++++++++++++++++++++++++++++++++++++- hw/vfio-user/proxy.c | 77 ++++++++++++++++++++++++++- hw/vfio-user/trace-events | 4 ++ 5 files changed, 222 insertions(+), 4 deletions(-) diff --git a/hw/vfio-user/protocol.h b/hw/vfio-user/protocol.h index 920b9c44ec..4fa6d03b3f 100644 --- a/hw/vfio-user/protocol.h +++ b/hw/vfio-user/protocol.h @@ -115,6 +115,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 @@ -178,4 +203,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 e2cfaeead8..01fed3f17d 100644 --- a/hw/vfio-user/proxy.h +++ b/hw/vfio-user/proxy.h @@ -73,6 +73,7 @@ typedef struct VFIOUserProxy { QemuCond close_cv; AioContext *ctx; QEMUBH *req_bh; + bool async_ops; =20 /* * above only changed when BQL is held @@ -102,9 +103,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 38e9cf8d8a..5a109c591e 100644 --- a/hw/vfio-user/container.c +++ b/hw/vfio-user/container.c @@ -21,18 +21,119 @@ #include "qapi/error.h" #include "trace.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 @@ -224,6 +325,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 34df9bba7b..6d1446c38b 100644 --- a/hw/vfio-user/proxy.c +++ b/hw/vfio-user/proxy.c @@ -31,7 +31,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); @@ -133,7 +132,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 @@ -609,6 +608,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) { @@ -647,6 +676,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