{"id":2220216,"url":"http://patchwork.ozlabs.org/api/covers/2220216/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/cover/20260406165120.166928-1-wenzhaoliao@ruc.edu.cn/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","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":"<20260406165120.166928-1-wenzhaoliao@ruc.edu.cn>","list_archive_url":null,"date":"2026-04-06T16:51:14","name":"[RFC,v3,0/6] Rust goldfish_address_space driver (ioctl-only subset)","submitter":{"id":93071,"url":"http://patchwork.ozlabs.org/api/people/93071/?format=json","name":"Wenzhao Liao","email":"wenzhaoliao@ruc.edu.cn"},"mbox":"http://patchwork.ozlabs.org/project/linux-pci/cover/20260406165120.166928-1-wenzhaoliao@ruc.edu.cn/mbox/","series":[{"id":498880,"url":"http://patchwork.ozlabs.org/api/series/498880/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=498880","date":"2026-04-06T16:51:15","name":"Rust goldfish_address_space driver (ioctl-only subset)","version":3,"mbox":"http://patchwork.ozlabs.org/series/498880/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2220216/comments/","headers":{"Return-Path":"\n <linux-pci+bounces-51968-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=ruc.edu.cn header.i=@ruc.edu.cn header.a=rsa-sha256\n header.s=default header.b=B5oda5J2;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-51968-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=ruc.edu.cn header.i=@ruc.edu.cn\n header.b=\"B5oda5J2\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.195.24.77","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=ruc.edu.cn","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=ruc.edu.cn"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqFq72HQHz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 07 Apr 2026 02:56:51 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 6FDE230138B4\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  6 Apr 2026 16:56:48 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 28E4538B7DE;\n\tMon,  6 Apr 2026 16:56:47 +0000 (UTC)","from mail-m2477.xmail.ntesmail.com (mail-m2477.xmail.ntesmail.com\n [45.195.24.77])\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 91D2438838B;\n\tMon,  6 Apr 2026 16:56:43 +0000 (UTC)","from lwz.tail698a0e.ts.net\n (gy-adaptive-ssl-proxy-1-entmail-virt204.gy.ntes [36.112.3.244])\n\tby smtp.qiye.163.com (Hmail) with ESMTP id 39aaefbda;\n\tTue, 7 Apr 2026 00:51:21 +0800 (GMT+08:00)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775494607; cv=none;\n b=uSSg4ELwWJmyT88gvFFsDzHzr94Ko6U/qbMm/SAPPuCZMzJCMgscJ0Up/aiHhqLc1Hb9oelCGQbQq0FP8p7WtjTvZUPtFsyBkAamxJ93wfG/CC7+hIRgXqsIxoDZXjKPK8Do1uBofTDGeqnM3mIsiLjVkfBWT8yrfntRhYCd4/k=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775494607; c=relaxed/simple;\n\tbh=7N4XBttMaUfHvT10Bjf8wMO7OY346LDy5mrmbVDtCK0=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=cO1SRPC/dEGH13H5bNE4QwZNW4sDlgZ2mNfp5eK+mRIEXFq3Vr1L5ecbgyQmIrcQv57OAYkFqL6W2rDlX0l86jJMCMSzJBlrCWDWrUhR3T5lY0x83pL9KNhYqW/yaKnJX1BxmrQoOMXW2+/3WEztkSe0j7hf6H/j5XochvWzF2A=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=ruc.edu.cn;\n spf=pass smtp.mailfrom=ruc.edu.cn;\n dkim=pass (1024-bit key) header.d=ruc.edu.cn header.i=@ruc.edu.cn\n header.b=B5oda5J2; arc=none smtp.client-ip=45.195.24.77","From":"Wenzhao Liao <wenzhaoliao@ruc.edu.cn>","To":"rust-for-linux@vger.kernel.org,\n\tlinux-pci@vger.kernel.org","Cc":"ojeda@kernel.org,\n\tdakr@kernel.org,\n\tbhelgaas@google.com,\n\tkwilczynski@kernel.org,\n\tarnd@arndb.de,\n\tgregkh@linuxfoundation.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-api@vger.kernel.org","Subject":"[RFC PATCH v3 0/6] Rust goldfish_address_space driver (ioctl-only\n subset)","Date":"Mon,  6 Apr 2026 12:51:14 -0400","Message-Id":"<20260406165120.166928-1-wenzhaoliao@ruc.edu.cn>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<cover.1775456181.git.wenzhaoliao@ruc.edu.cn>","References":"<cover.1775456181.git.wenzhaoliao@ruc.edu.cn>","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","Content-Transfer-Encoding":"8bit","X-HM-Tid":"0a9d63b4b85003a2kunm562d3b0d647e52","X-HM-MType":"10","X-HM-Spam-Status":"e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly\n\ttZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlDThpMVk5DQktMSxofSB4aGlYeHw5VEwETFhoSFy\n\tQUDg9ZV1kYEgtZQVlITVVKSklVSFVJT09ZV1kWGg8SFR0UWUFZT0tIVUpLSEpOTE5VSktLVUpCS0\n\ttZBg++","DKIM-Signature":"a=rsa-sha256;\n\tb=B5oda5J2EW5s+7mkPYu2H4P4OvncI9pvTRvKqr+bHhU7kHMJ90kgvYEQ9WC3su49q65DCD25J1pK59lGm2OO65m8tA7y9/C4/T2SyFsEeZhR538ALa3Sr/d+wj72Ef0WFy4hUY5wr9SCXG8DONtSTrEXBYrHUhO14aEK/IZBCMU=;\n c=relaxed/relaxed; s=default; d=ruc.edu.cn; v=1;\n\tbh=DrGe7dDIenQDEOD5TVrW9lT5Xaaahb+DDLbuVFdBaKc=;\n\th=date:mime-version:subject:message-id:from;"},"content":"This respin narrows the Rust goldfish_address_space RFC to the\nopen/release/ioctl ABI subset. Userspace mmap and PING_WITH_DATA are\nnot part of this series.\n\nI would like to send this as a small first upstream step for the Rust\ndriver, instead of asking reviewers to take the mmap/VMA lifecycle work\nin the same round.\n\nThe goal of the respin is to keep only the pieces that are still\nrequired by the current driver:\n- the goldfish UAPI header and Rust bindings exposure,\n- minimal page helpers for the ping page,\n- a small SharedMemoryBar abstraction for shared BAR reservation,\n  memremap() lifetime, and physical base discovery,\n- hardened miscdevice registration/open boundaries,\n- and the Rust goldfish_address_space driver itself.\n\nCompared to the previous round, this drops the Rust VMA/BAR-to-VMA\nmapping work from the series and rewrites the driver and miscdevice\npieces around the current teardown and publication model. The driver\nremains #![forbid(unsafe_code)].\n\nFeedback would be especially helpful on:\n- whether the ioctl-only ABI subset is a reasonable first upstream step\n  for goldfish_address_space;\n- whether SharedMemoryBar is the right minimal Rust abstraction for\n  shared-memory BAR reservation plus memremap() lifetime;\n- whether the miscdevice hardening direction makes sense, especially the\n  publication-safe open context and the THIS_MODULE-owned safe\n  file_operations path.\n\nChanges since v2:\n- dropped the userspace mmap portion of the RFC and removed the unused\n  Rust VMA/BAR-to-VMA mapping patch from the series;\n- narrowed the goldfish Kconfig help text and driver description to the\n  open/release/ioctl ABI subset;\n- reworked miscdevice so safe open() only sees publication-safe state\n  and safe drivers no longer have a raw file_operations escape hatch;\n- reworked goldfish teardown around deregister() -> shutdown() ->\n  disable_device(), with live-file revocation before PCI disable and\n  explicit enable_device_mem() probe unwind;\n- kept the in-tree Rust VMA helpers still used by binder out of this\n  series, so the respin only carries code with a current caller.\n\nBehavior exercised for the RFC-limited ABI subset:\n- open / release\n- allocate_block / deallocate_block\n- ping\n- claim_shared / unclaim_shared\n- unknown ioctl\n- reopen\n\nNo claim is made beyond that subset in this respin.\n\nBuild-tested:\n- make LLVM=1 rust/kernel.o\n- make LLVM=1 drivers/platform/goldfish/goldfish_address_space.o\n- make LLVM=1 samples/rust/rust_misc_device.o\n\nWenzhao Liao (6):\n  uapi: add goldfish_address_space userspace ABI header\n  rust: bindings: expose goldfish address-space headers\n  rust: page: add helpers for page-backed ping state\n  rust: pci: add shared BAR memremap support\n  rust: miscdevice: harden registration and safe file_operations\n    invariants\n  platform/goldfish: add Rust goldfish_address_space driver\n\n MAINTAINERS                                   |  10 +\n drivers/platform/goldfish/Kconfig             |  11 +\n drivers/platform/goldfish/Makefile            |   1 +\n .../goldfish/goldfish_address_space.rs        | 917 ++++++++++++++++++\n include/uapi/linux/goldfish_address_space.h   |  54 ++\n rust/bindings/bindings_helper.h               |   1 +\n rust/helpers/page.c                           |   5 +\n rust/kernel/miscdevice.rs                     | 409 +++++---\n rust/kernel/page.rs                           |  52 +-\n rust/kernel/pci.rs                            |   8 +\n rust/kernel/pci/id.rs                         |   2 +-\n rust/kernel/pci/io.rs                         | 112 ++-\n rust/uapi/uapi_helper.h                       |   1 +\n samples/rust/rust_misc_device.rs              |   9 +-\n 14 files changed, 1453 insertions(+), 139 deletions(-)\n create mode 100644 drivers/platform/goldfish/goldfish_address_space.rs\n create mode 100644 include/uapi/linux/goldfish_address_space.h"}