Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2225780/?format=api
{ "id": 2225780, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2225780/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260421-io_projection-v2-10-4c251c692ef4@garyguo.net/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.2/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260421-io_projection-v2-10-4c251c692ef4@garyguo.net>", "list_archive_url": null, "date": "2026-04-21T14:56:21", "name": "[v2,10/11] rust: dma: drop `dma_read!` and `dma_write!` API", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "639b8de98f050fb4e41ec5e8e8bc87fdba49f4dd", "submitter": { "id": 76823, "url": "http://patchwork.ozlabs.org/api/1.2/people/76823/?format=api", "name": "Gary Guo", "email": "gary@garyguo.net" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260421-io_projection-v2-10-4c251c692ef4@garyguo.net/mbox/", "series": [ { "id": 500833, "url": "http://patchwork.ozlabs.org/api/1.2/series/500833/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=500833", "date": "2026-04-21T14:56:19", "name": "rust: I/O type generalization and projection", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/500833/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225780/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225780/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-52848-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=garyguo.net header.i=@garyguo.net header.a=rsa-sha256\n header.s=selector1 header.b=uDjVdfSu;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52848-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=garyguo.net header.i=@garyguo.net\n header.b=\"uDjVdfSu\"", "smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=52.101.100.95", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=garyguo.net", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=garyguo.net", "dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=garyguo.net;" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0Qg55yvGz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 01:06:41 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E409F30C4E95\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 14:58:00 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 1E3553DC4AA;\n\tTue, 21 Apr 2026 14:56:44 +0000 (UTC)", "from CWXP265CU009.outbound.protection.outlook.com\n (mail-ukwestazon11021095.outbound.protection.outlook.com [52.101.100.95])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id E3A253DB64F;\n\tTue, 21 Apr 2026 14:56:41 +0000 (UTC)", "from LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:488::16)\n by CWLP265MB5674.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1b0::13) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.16; Tue, 21 Apr\n 2026 14:56:31 +0000", "from LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM\n ([fe80::1c3:ceba:21b4:9986]) by LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM\n ([fe80::1c3:ceba:21b4:9986%4]) with mapi id 15.20.9846.016; Tue, 21 Apr 2026\n 14:56:31 +0000" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776783404; cv=fail;\n b=SzoxB1aqBiFCxYIKCtJFd38pd/esNsF22CgOcxgSGS+CNvIRkqJuTprAIS/tc1U9jBce0Txu9nmeuroKweN1imj2RUOml0dQRx/NnP6AbNR5uG2HMSogRtimCZM4WmSk4BqZlc1zEMPOU4rsXyODMjo1at+3VGJhiPXa561yQa0=", "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=KKZiEYpepveV1NDs+cVzuz8AVkf8f0HKM9cr0WYQe6XoX2dVLL5DxeaEkBs94n7diPS/ghWZMcuvc3+w2uRv71fu2L7hTW6id4cNroH17e81QHpKNy95MOWIy2AKpP5T186Z4zU78R43hAOq/Rv5zYZhYZ06bJchWDSAawn2T2WSlvgKfn06UlKigecHu9fv/AKFbGWGOB0dgZbaURv7OlTyoQfGmwc9sZ1GlaOyDSidw8ySQhNtd/jTX7GwEBWdazsgs71R8cWMkUchxRvBgZX1V/M7JcvcPrpEyrSb6igxT2jBk/kvMdn8fYfsAg+Kpqy8N/dNCFxyHpZEsTfTTQ==" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776783404; c=relaxed/simple;\n\tbh=REIYrCsog4jKSossyNrV9NAWmOpEvzTGJMg8c+iA2tw=;\n\th=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:\n\t To:Cc:MIME-Version;\n b=JkZIZgq/YxWtO8bOMiw5TtzoKca1bnnMMcYzggefU1FmlIqqZq82t1wNZm82H6DQHHs2/WpK2NWUPN1WJbBj4F+Ep0dm9Ps0/mmucDDUO8p1ojukKxnfPFxd3C4cktOYPK974g/B1lQ8XIGsQ67gnHQiXbWM1k9lPczVCHDaqTI=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n 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;\n bh=cOPnJ8/rArX21QGk5WpOti5jc4cbsiKxm9EchkvMApg=;\n b=xCjbr0BH7q2pxuoKfDVGvvaO4pG3b4B/2uIzlZWRxJdnouCuuwdOo398n+7udeBpDUw4VB1MmwlYiF6+tbfKnWgHwDZEG1OySt/TmiaZxYoK8Q29Jzilk0jGZASOvRdKws3Z3zY1NbzzG8krknHdZpc6aUsHA78mV97CFfFzAktzBqR03RpTvfKXyUsRCf7EPW7j4bYXhMP+tsIP4WZY/ZCyKQQ702i+bsM7m3ONbx10enCpsyY3wNpKlKK6CpQMSkUQleTOmOu2jZUwsHqr6TDV3AT63MdG48LdprMSLcMCzk6Rx1yo1HLDxCGQ7Gr+L654HxH5TJ3hAPHHK9RdDA==" ], "ARC-Authentication-Results": [ "i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=garyguo.net;\n spf=pass smtp.mailfrom=garyguo.net;\n dkim=pass (1024-bit key) header.d=garyguo.net header.i=@garyguo.net\n header.b=uDjVdfSu; arc=fail smtp.client-ip=52.101.100.95", "i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=garyguo.net; dmarc=pass action=none header.from=garyguo.net;\n dkim=pass header.d=garyguo.net; arc=none" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net;\n s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=cOPnJ8/rArX21QGk5WpOti5jc4cbsiKxm9EchkvMApg=;\n b=uDjVdfSu6sOy7Mxzgg08DYLOsQVvW2hFV090Tim7j85NWuHNw89g6XH2loEZLmJTIx2g25OvRVqvG42+5OoK6cbC2azd4nybNJ0g9ZhNk2cELkXMhLrQLXRHlyNLmkgtaWhPZtDD5ph/6QdbxUwyszvRJVQ29FfyAsNxBA33Be4=", "From": "Gary Guo <gary@garyguo.net>", "Date": "Tue, 21 Apr 2026 15:56:21 +0100", "Subject": "[PATCH v2 10/11] rust: dma: drop `dma_read!` and `dma_write!` API", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260421-io_projection-v2-10-4c251c692ef4@garyguo.net>", "References": "<20260421-io_projection-v2-0-4c251c692ef4@garyguo.net>", "In-Reply-To": "<20260421-io_projection-v2-0-4c251c692ef4@garyguo.net>", "To": "Greg Kroah-Hartman <gregkh@linuxfoundation.org>,\n \"Rafael J. Wysocki\" <rafael@kernel.org>, Danilo Krummrich <dakr@kernel.org>,\n Miguel Ojeda <ojeda@kernel.org>, Boqun Feng <boqun@kernel.org>,\n Gary Guo <gary@garyguo.net>,\n =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>,\n Benno Lossin <lossin@kernel.org>, Andreas Hindborg <a.hindborg@kernel.org>,\n Alice Ryhl <aliceryhl@google.com>, Trevor Gross <tmgross@umich.edu>,\n Daniel Almeida <daniel.almeida@collabora.com>,\n Bjorn Helgaas <bhelgaas@google.com>,\n =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>,\n Abdiel Janulgue <abdiel.janulgue@gmail.com>,\n Robin Murphy <robin.murphy@arm.com>,\n Alexandre Courbot <acourbot@nvidia.com>, David Airlie <airlied@gmail.com>,\n Simona Vetter <simona@ffwll.ch>", "Cc": "driver-core@lists.linux.dev, rust-for-linux@vger.kernel.org,\n linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,\n nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org", "X-Mailer": "b4 0.15.1", "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1776783386; l=9221;\n i=gary@garyguo.net; s=20221204; h=from:subject:message-id;\n bh=REIYrCsog4jKSossyNrV9NAWmOpEvzTGJMg8c+iA2tw=;\n b=LuAgQuSw8Ou9slF2iDjHLVQajkitMXsFiUlYzh8tm0bNggeeRvCe9j6sgAMxSZI2tQ70fU6/I\n Kl0lp6+kd1hADXhZ9bhgcMAuElCCQmegjdzjKzdxGNUMrRSZfkSLH95", "X-Developer-Key": "i=gary@garyguo.net; a=ed25519;\n pk=vB3uIX95SM4eVrIqo1DWNWKDKD2xzB+yLLLr0yOPYMo=", "X-ClientProxiedBy": "LO4P123CA0142.GBRP123.PROD.OUTLOOK.COM\n (2603:10a6:600:193::21) To LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM\n (2603:10a6:600:488::16)", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "X-MS-PublicTrafficType": "Email", "X-MS-TrafficTypeDiagnostic": "LOVP265MB8871:EE_|CWLP265MB5674:EE_", "X-MS-Office365-Filtering-Correlation-Id": "1f06d217-a096-40be-f5f0-08de9fb62c4b", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "\n\tBCL:0;ARA:13230040|1800799024|376014|7416014|10070799003|366016|921020|22082099003|18002099003|56012099003;", "X-Microsoft-Antispam-Message-Info": "\n\t5ocNZWZgcd37BmPL0woIBLIYT+mV+v++X3PLhzEdBAE95vJaqoUde/DHDg6WCV3kjwv7Z2dkofOM8QkyIQvxshgALD2+Nw3B5yMMOYxRaxanMaFNqetzBBQ4lkJkctTaB6A11hZpNioR0LtbnDorLWhv1HD+0nlVYWSZw3A/SKsfYBdaBjZfNzlBED2c/Ht2cdnmhUc7Ux79k7DZb3H+zXcKoIui7yW2fTjNpJFpqFAPvWgGTwv5bJOi/ajvKnblvTSwhXU8MgySO/LV14aK8ottnHElYdwNdfnQyjSg2vG37YVr1xpCl4ciN7UBb8nWGV4wyC7EBdHGN4ZY5ljnPT3BJmJKThLWoNbbBaACBV8dS4Ozk/lcgVo9kOFWsHowQR5ITrIqEV/svpqmWaaHSAaTAJ5h7UBOb7w08ZbX8Utg5clSYSYYquh37fOWJfbf3O1BfQYFV7XNz0weDTo5y93Cb2yw6QVzxsMLxfBp+QymTDfPhLzS3vxbzYWSerkrh6gpYzWgXgUoySSEht+Pd7gOiYtzkSEhGUmK37mn2t/lh2gZON58uSbspF3nTOBAnpwZk54FI3CCQJbO6MefAm530Ff6X2nJW6IETg856MRFq3xrO7wlMhQseS9LuQp0c1MKnD1Cf9dbBzke1D81srxjiOR/1mhJdsJTK2yDCm5+1o4PcH+x/XSX911sLIz1frRKkoFXQeEKqoJLa8OstpS4pXt8t2/xNh/384XFNtjHREfMFTNO+vJHxMA4SK+T6Nio+7cFRtk0jBf7/4fhdA==", "X-Forefront-Antispam-Report": "\n\tCIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(10070799003)(366016)(921020)(22082099003)(18002099003)(56012099003);DIR:OUT;SFP:1102;", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "=?utf-8?q?3Q9yI/ZUc3Jvf4q8WAzxvyKl/pVM?=\n\t=?utf-8?q?KV+Eo1OPr/XoRQ5XQzvOLzyvCqCyOhmhLEspJFooJoH2gZm+ntzMYlOjtoktp4R4D?=\n\t=?utf-8?q?2fx+4UIbtNa8/6M1wseA/MOlgUJT3AE081moZCmFOsJyQ2y2d5ZwtEonzETDzOBbo?=\n\t=?utf-8?q?HTNYp1fJmrjE/WzE0b+16camYZwmFvcvK4ROq2hGFfHdTgzfn7+onBNFrcBB2Jfoq?=\n\t=?utf-8?q?7RRIdN1Zeu+IPtjpaLROnf+kyG6iivgVPTkVz9bOrphec5WKAemhSUdSla6AcqGjv?=\n\t=?utf-8?q?qx7LPoQEJHPqInF2zeufrsujoQhliUZjhLzjrXH2DpcYvDBkKf4gZZ6xJKKPRFVGu?=\n\t=?utf-8?q?AeA3wtBHmKTJNiu/vzA/ZG5/jt3wucYd++pENehxIA6L3w3pWoF6h12DGZKLQsdnU?=\n\t=?utf-8?q?ULgd7NX6z1/fX65OK8fPfX/IZBMKLZIZtJ2PJG+bMJFfGV+8zI5ibbw2DqKB3Vi21?=\n\t=?utf-8?q?Gu4MXc9jbO0oFxash0HU3ZgNYd1gGb2PDKepu//12CaxkjN4/j8p/zJ9rMsj+OIUi?=\n\t=?utf-8?q?9UjPDQZ6eZOa/8HyzNJhmaeW+rMBvgaabLJ6OhkozwVxv8rogoYO3TrfwrdFODOmc?=\n\t=?utf-8?q?cILUHAhWHP/3viPNqLeUq7lo3nWekA3inN0dJviemflJhFMsnYM5XAY+4NUI3ZDyH?=\n\t=?utf-8?q?FBPA80xSjqvMQhCoe2/LIEkNXImKUQE5MfqRT8tkOE3kXAp3OiYf6B/VDCvfIdbL6?=\n\t=?utf-8?q?a0+dBq0H68P5naNirhu2PJs3rHdBMZAns+8tyRn6qr5zhk2LKYwo7qzPH85zsd/p5?=\n\t=?utf-8?q?FjnSDYmCdGT7wK8S4vhO2DXo/vjknuemwCs1bipkm5dYb12ucKJURPwqGJQomEtya?=\n\t=?utf-8?q?InFtitVVGJEf2f3BFh79lfd74jHGAycYk2jwieyanhHBsi1Jqd0Is/4fxR5Z58KyI?=\n\t=?utf-8?q?3VRLuN8GqssrzlGy8LTaiwWhv/moIfGo+D/9s7/LUk+7HRxVlOy3ubE+kpBTCP75g?=\n\t=?utf-8?q?gvpPB0OsDofupAQNvTXD9qwqVYKxKSuNjSes3J3X5gekSTaHI8cLjuH0Dgj0FLtwE?=\n\t=?utf-8?q?wkmOgThwK0S/kk4K9qXR2XT4lFWhsdiA3rRknsKn2qyqr3IGoaBt4TSOVawZ9wWDp?=\n\t=?utf-8?q?lxHnec9bFqJDik+IH66CwPwPRclW4ECXvAXthhfKnCHzWqRNxJo4xnuVThPFD6sK8?=\n\t=?utf-8?q?Cgx8GrFyuUzvdaTYzonWFNud93/5DDrikLZtpFJJ5mlLHt0w9MUfbdgfkxgVx04yU?=\n\t=?utf-8?q?6lo8mcN7rWWgARsCT2RmT2DteNa4e1ZU+4rPV3eSBdajTMVhZajs/o1Wvee6iKtI5?=\n\t=?utf-8?q?gNzmYCTkEqQWiL8BTTriptM9qdgB+FggrVMokbCXvua5o7coxNoyTIj+AWswnI/6V?=\n\t=?utf-8?q?k9Z+5FJAoP+Blou3iDMZCul7ZuqTWnzmHn+IHfwaO1tw5DBIGftbvM4ekf8mZ9A9k?=\n\t=?utf-8?q?5km7HsJVTwzmcv3VN/zkE59AuDuEgIkVm4dvpXWsJp/XIXpzwExkxT+7XRRP7LWkv?=\n\t=?utf-8?q?/x9uzKy4cOHfANwMyKy3rQDJf4SYizmXbMv1i4ereohvoMsi9y6ffpUz3mPFexhZa?=\n\t=?utf-8?q?/R3P0unNnuzlYmH+EXwEMmJGeJagnCdI8L90JafZ7ABh95EDQqX76vArYtuHacy/a?=\n\t=?utf-8?q?w7O9mYdlXkdNqH6FoEtGWcD4i9mUPDsPkoCI4ViOcX2JT0KmuKL5RhcpZ+yOmrYV/?=\n\t=?utf-8?q?wCDKB0OCCCYTIOJRxTmfjNPPQ3OW5J8A=3D=3D?=", "X-OriginatorOrg": "garyguo.net", "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 1f06d217-a096-40be-f5f0-08de9fb62c4b", "X-MS-Exchange-CrossTenant-AuthSource": "LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM", "X-MS-Exchange-CrossTenant-AuthAs": "Internal", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "21 Apr 2026 14:56:31.0027\n (UTC)", "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted", "X-MS-Exchange-CrossTenant-Id": "bbc898ad-b10f-4e10-8552-d9377b823d45", "X-MS-Exchange-CrossTenant-MailboxType": "HOSTED", "X-MS-Exchange-CrossTenant-UserPrincipalName": "\n fvm+s4jTJs/7Y5L7YSN3N3hy0iD0ZUw4ienwhPt+01g8XWpZXbM+NHOei5q/S0pHJwDR0nvG8ViwbJh4md/AUQ==", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "CWLP265MB5674" }, "content": "The primitive read/write use case is covered by the `io_read!` and\n`io_write!` macro. The non-primitive use case was finicky; they should\neither be achieved using `CoherentBox` or `as_ref()/as_mut()` to assert the\nlack of concurrent access, or should be using memcpy-like APIs to express\nthe non-atomic and tearable nature.\n\nSigned-off-by: Gary Guo <gary@garyguo.net>\n---\n rust/kernel/dma.rs | 128 -----------------------------------------------\n samples/rust/rust_dma.rs | 14 +++---\n 2 files changed, 8 insertions(+), 134 deletions(-)", "diff": "diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs\nindex d0b86aeebfe2..bbdeb117c145 100644\n--- a/rust/kernel/dma.rs\n+++ b/rust/kernel/dma.rs\n@@ -658,52 +658,6 @@ pub unsafe fn as_mut(&self) -> &mut T {\n // SAFETY: per safety requirement.\n unsafe { &mut *self.as_mut_ptr() }\n }\n-\n- /// Reads the value of `field` and ensures that its type is [`FromBytes`].\n- ///\n- /// # Safety\n- ///\n- /// This must be called from the [`dma_read`] macro which ensures that the `field` pointer is\n- /// validated beforehand.\n- ///\n- /// Public but hidden since it should only be used from [`dma_read`] macro.\n- #[doc(hidden)]\n- pub unsafe fn field_read<F: FromBytes>(&self, field: *const F) -> F {\n- // SAFETY:\n- // - By the safety requirements field is valid.\n- // - Using read_volatile() here is not sound as per the usual rules, the usage here is\n- // a special exception with the following notes in place. When dealing with a potential\n- // race from a hardware or code outside kernel (e.g. user-space program), we need that\n- // read on a valid memory is not UB. Currently read_volatile() is used for this, and the\n- // rationale behind is that it should generate the same code as READ_ONCE() which the\n- // kernel already relies on to avoid UB on data races. Note that the usage of\n- // read_volatile() is limited to this particular case, it cannot be used to prevent\n- // the UB caused by racing between two kernel functions nor do they provide atomicity.\n- unsafe { field.read_volatile() }\n- }\n-\n- /// Writes a value to `field` and ensures that its type is [`AsBytes`].\n- ///\n- /// # Safety\n- ///\n- /// This must be called from the [`dma_write`] macro which ensures that the `field` pointer is\n- /// validated beforehand.\n- ///\n- /// Public but hidden since it should only be used from [`dma_write`] macro.\n- #[doc(hidden)]\n- pub unsafe fn field_write<F: AsBytes>(&self, field: *mut F, val: F) {\n- // SAFETY:\n- // - By the safety requirements field is valid.\n- // - Using write_volatile() here is not sound as per the usual rules, the usage here is\n- // a special exception with the following notes in place. When dealing with a potential\n- // race from a hardware or code outside kernel (e.g. user-space program), we need that\n- // write on a valid memory is not UB. Currently write_volatile() is used for this, and the\n- // rationale behind is that it should generate the same code as WRITE_ONCE() which the\n- // kernel already relies on to avoid UB on data races. Note that the usage of\n- // write_volatile() is limited to this particular case, it cannot be used to prevent\n- // the UB caused by racing between two kernel functions nor do they provide atomicity.\n- unsafe { field.write_volatile(val) }\n- }\n }\n \n impl<T: AsBytes + FromBytes> Coherent<T> {\n@@ -1230,85 +1184,3 @@ unsafe impl Send for CoherentHandle {}\n // operations on `&CoherentHandle` are reading the DMA handle and size, both of which are\n // plain `Copy` values.\n unsafe impl Sync for CoherentHandle {}\n-\n-/// Reads a field of an item from an allocated region of structs.\n-///\n-/// The syntax is of the form `kernel::dma_read!(dma, proj)` where `dma` is an expression evaluating\n-/// to a [`Coherent`] and `proj` is a [projection specification](kernel::ptr::project!).\n-///\n-/// # Examples\n-///\n-/// ```\n-/// use kernel::device::Device;\n-/// use kernel::dma::{attrs::*, Coherent};\n-///\n-/// struct MyStruct { field: u32, }\n-///\n-/// // SAFETY: All bit patterns are acceptable values for `MyStruct`.\n-/// unsafe impl kernel::transmute::FromBytes for MyStruct{};\n-/// // SAFETY: Instances of `MyStruct` have no uninitialized portions.\n-/// unsafe impl kernel::transmute::AsBytes for MyStruct{};\n-///\n-/// # fn test(alloc: &kernel::dma::Coherent<[MyStruct]>) -> Result {\n-/// let whole = kernel::dma_read!(alloc, [try: 2]);\n-/// let field = kernel::dma_read!(alloc, [panic: 1].field);\n-/// # Ok::<(), Error>(()) }\n-/// ```\n-#[macro_export]\n-macro_rules! dma_read {\n- ($dma:expr, $($proj:tt)*) => {{\n- let dma = &$dma;\n- let ptr = $crate::ptr::project!(\n- $crate::dma::Coherent::as_ptr(dma), $($proj)*\n- );\n- // SAFETY: The pointer created by the projection is within the DMA region.\n- unsafe { $crate::dma::Coherent::field_read(dma, ptr) }\n- }};\n-}\n-\n-/// Writes to a field of an item from an allocated region of structs.\n-///\n-/// The syntax is of the form `kernel::dma_write!(dma, proj, val)` where `dma` is an expression\n-/// evaluating to a [`Coherent`], `proj` is a\n-/// [projection specification](kernel::ptr::project!), and `val` is the value to be written to the\n-/// projected location.\n-///\n-/// # Examples\n-///\n-/// ```\n-/// use kernel::device::Device;\n-/// use kernel::dma::{attrs::*, Coherent};\n-///\n-/// struct MyStruct { member: u32, }\n-///\n-/// // SAFETY: All bit patterns are acceptable values for `MyStruct`.\n-/// unsafe impl kernel::transmute::FromBytes for MyStruct{};\n-/// // SAFETY: Instances of `MyStruct` have no uninitialized portions.\n-/// unsafe impl kernel::transmute::AsBytes for MyStruct{};\n-///\n-/// # fn test(alloc: &kernel::dma::Coherent<[MyStruct]>) -> Result {\n-/// kernel::dma_write!(alloc, [try: 2].member, 0xf);\n-/// kernel::dma_write!(alloc, [panic: 1], MyStruct { member: 0xf });\n-/// # Ok::<(), Error>(()) }\n-/// ```\n-#[macro_export]\n-macro_rules! dma_write {\n- (@parse [$dma:expr] [$($proj:tt)*] [, $val:expr]) => {{\n- let dma = &$dma;\n- let ptr = $crate::ptr::project!(\n- mut $crate::dma::Coherent::as_mut_ptr(dma), $($proj)*\n- );\n- let val = $val;\n- // SAFETY: The pointer created by the projection is within the DMA region.\n- unsafe { $crate::dma::Coherent::field_write(dma, ptr, val) }\n- }};\n- (@parse [$dma:expr] [$($proj:tt)*] [.$field:tt $($rest:tt)*]) => {\n- $crate::dma_write!(@parse [$dma] [$($proj)* .$field] [$($rest)*])\n- };\n- (@parse [$dma:expr] [$($proj:tt)*] [[$flavor:ident: $index:expr] $($rest:tt)*]) => {\n- $crate::dma_write!(@parse [$dma] [$($proj)* [$flavor: $index]] [$($rest)*])\n- };\n- ($dma:expr, $($rest:tt)*) => {\n- $crate::dma_write!(@parse [$dma] [] [$($rest)*])\n- };\n-}\ndiff --git a/samples/rust/rust_dma.rs b/samples/rust/rust_dma.rs\nindex a2c34bb74273..9250ed6f6673 100644\n--- a/samples/rust/rust_dma.rs\n+++ b/samples/rust/rust_dma.rs\n@@ -8,10 +8,12 @@\n device::Core,\n dma::{\n Coherent,\n+ CoherentBox,\n DataDirection,\n Device,\n DmaMask, //\n },\n+ io::io_read,\n page, pci,\n prelude::*,\n scatterlist::{Owned, SGTable},\n@@ -69,11 +71,11 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E\n // SAFETY: There are no concurrent calls to DMA allocation and mapping primitives.\n unsafe { pdev.dma_set_mask_and_coherent(mask)? };\n \n- let ca: Coherent<[MyStruct]> =\n- Coherent::zeroed_slice(pdev.as_ref(), TEST_VALUES.len(), GFP_KERNEL)?;\n+ let mut ca: CoherentBox<[MyStruct]> =\n+ CoherentBox::zeroed_slice(pdev.as_ref(), TEST_VALUES.len(), GFP_KERNEL)?;\n \n for (i, value) in TEST_VALUES.into_iter().enumerate() {\n- kernel::dma_write!(ca, [try: i], MyStruct::new(value.0, value.1));\n+ ca.init_at(i, MyStruct::new(value.0, value.1))?;\n }\n \n let size = 4 * page::PAGE_SIZE;\n@@ -83,7 +85,7 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E\n \n Ok(try_pin_init!(Self {\n pdev: pdev.into(),\n- ca,\n+ ca: ca.into(),\n sgt <- sgt,\n }))\n })\n@@ -93,8 +95,8 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E\n impl DmaSampleDriver {\n fn check_dma(&self) {\n for (i, value) in TEST_VALUES.into_iter().enumerate() {\n- let val0 = kernel::dma_read!(self.ca, [panic: i].h);\n- let val1 = kernel::dma_read!(self.ca, [panic: i].b);\n+ let val0 = io_read!(self.ca, [panic: i].h);\n+ let val1 = io_read!(self.ca, [panic: i].b);\n \n assert_eq!(val0, value.0);\n assert_eq!(val1, value.1);\n", "prefixes": [ "v2", "10/11" ] }