From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796027204; b=a2sau6PeXHDOjbeuP6AYe1yhDDHDZTteB7kZSyTqk4Y44YSlDDdOjSwzNg9iyykvhGva 2y9fEsUG72t26SkMSsPvstWPH8Z06qtHJe+OAQaoMiANzn4jnY20wCuq6/NAcpCRqcirq RIw4Xp4Nd7tXb+NIDVcRakIW3k0k2xftI4k6FOGmlnPk7L+Vv8bZrZE5fGKBj6klpM02m zjl8i4GPT8292FqTmmoyN4AU9tHYBp0gpzeL0jV2uObd+1gt/obMCRopW7NgjDZVsWIaZ 4YExeXiiStEXPzfMj4Fev9If4jCLWEe8juNRM6Eyr3hjdazsLsNI+UafIk13Y9EN2PA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796027204; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=MDh1Q5cyXLE1/410czpFSb71Y1aaHCuvP33YxBs59lU=; b=FZ2B1FOg0pi9EVz6POkJqVwFgjMP2mqVVWzmIReH7+SE4pbIO9RxHRCScaQsyySDoejC itnRGOR4j9Tb5FefkU0OrFigQbrHc9x0GY2WU3TYXZsdQ/rwxQpLBdRN4Lkd1uLo/0e2c epm0jGJWSs9Z9YEwt+pJP50R4IqqLa+N1ZcJ5OZq6SWJXnBD3Vb1K99+u4V0+nF3OPBDR z4/WfBZEtzP6FSsZnH+6aimbrDMtGtOqhboDrCYRBxIB7UT/epvblmm8MM8n1I5OaNKoI 6xFhMebJ1bfXm3br79lBpo6T/DjOkCFTWkdGVzx6aM5emZ2XkeIffFnRKPOI+uF+1bw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZLHTXZdW; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF925606A31C; Mon, 30 Nov 2026 08:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZLHTXZdW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83EFD1F00896; Mon, 30 Nov 2026 08:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796027203; bh=MDh1Q5cyXLE1/410czpFSb71Y1aaHCuvP33YxBs59lU=; h=From:To:Cc:Subject:Date; b=ZLHTXZdWuhnqThnGm7ghpCrHx8MIuRCH6r3OwaCJXlqnUQxl0LmpUVhQOnR+it8XY j7/e/xuHOFARZmvmjL1cz3o3JVRPy2jzY7ASvo3dpUXKDtBaLFLzWEEmDLLcdUCFjn gT5Tw08l9/NUVAGQwDHBnutYL6oq2XAIiDsOVtIDAxAtdS2EAEk8j7SpvAI/mdmLBi bez6Cxb5/NygGP2BUhYqNxlu0jMUh4yt50Lu+u0o6zoFPxAXAhO7el3MGRe56PvDI7 wLaFFNrowGStnPCIFRAZPQz8GYuGwQnkvZ64Kg3NHqFNI6OB0avGkOvME+xhN8OExl LoWPn0GJZepuw== From: "Richard Weinberger (sigma star gmbh)" To: linux-mtd@lists.infradead.org Cc: fuse-devel@lists.linux.dev, netdev@vger.kernel.org, horms@kernel.org, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, miklos@szeredi.hu, vigneshr@ti.com, miquel.raynal@bootlin.com, david.oberhollenzer@sigma-star.at, upstream+linux@sigma-star.at, Richard Weinberger Subject: [PATCH 0/10] MUSE: Userspace backed MTD v4 Date: Mon, 30 Nov 2026 09:26:23 +0100 Message-ID: <20261130082634.2750846-1-rw@kernel.org> X-Mailer: git-send-email 2.55.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Richard Weinberger After a long hiatus I finally found some time to work on MUSE again. Rationale: ---------- A common task when working with flash devices is emulating them, to run tests or to inspect dumps from real hardware. The MTD subsystem has plenty of emulators for that: mtdram, block2mtd, nandsim. Each of them implements an ad-hoc MTD and has various drawbacks. Over the last years some developers tried to extend them, but these attempts were often rejected because they just added more ad-hoc features instead of addressing the overall problems. MUSE is a novel approach to address the need for advanced MTD emulators. Advanced means in this context: supporting different (vendor specific) image formats, different ways of fault injection (fuzzing), and recording and replaying IO to emulate power cuts. The core goal of MUSE is to have the complexity on the userspace side and only a small MTD driver in kernelspace. While playing with different approaches I realized that FUSE offers everything we need. So MUSE is a little like CUSE, except that it does not implement a bare character device but an MTD. Users of MUSE: -------------- mtdsim[0] is a MUSE based MTD simulator written in Rust I'm currently working on. So far it can simulate NOR, RAM and NAND style flashes. It can operate in memory and read/write nanddump style images. It also supports injecting bit-flips, and recording and replaying IO for deterministic power-cut testing of the users on top of the MTD. [0]: https://git.infradead.org/users/rw/mtdsim.git Changelog: ---------- Changes since v3: - Moved MUSE driver to drivers/mtd/ - Moved transport related FUSE header defines to include/net/fuse.h, including CUSE specific adoptions. - Many minor bug fixes - Support for in- and out-band within the same MTD operation - Code rebased to 7.4-rc4 Changes since v2 (RFC): - OOB support - MUSE_READ/WRITE opcodes are no longer a min IO MTD unit - MTD partitions support via mtdparts string - More code cleanup - Code rebased to 5.11-rc4 Changes since v1 (RFC): - Rewrote IO path, fuse_direct_io() is no longer used. Instead of cheating fuse_direct_io() use custom ops to implement reading and writing. That way MUSE no longer needs a dummy file object nor a fuse file object. In MTD all IO is synchronous and operations on kernel buffers, this makes IO processing simple for MUSE. - Support for bad blocks. - No more (ab)use of FUSE ops such as FUSE_FSYNC. - Major code cleanup. This series can also be found at: git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc.git muse_v4 Richard Weinberger (10): fuse: Share cuse_parse_one() as fuse_kv_parse_one() fuse: Add a public header for users outside of fs/fuse/ fuse: Add an interface for userspace backed devices fuse: Convert CUSE to the interface for userspace backed devices fuse: Allow three output arguments per request fuse: Add MUSE specific defines to FUSE interface mtd: Add MTD_MUSE flag mtd: Allow passing a custom mtdparts string to the cmdline parser mtd: Implement MUSE - MTD in userspace MAINTAINERS: Add entry for MUSE Documentation/ABI/testing/sysfs-class-mtd | 8 + MAINTAINERS | 8 + drivers/mtd/Kconfig | 15 + drivers/mtd/Makefile | 1 + drivers/mtd/muse.c | 995 ++++++++++++++++++++++ drivers/mtd/parsers/cmdlinepart.c | 99 ++- fs/fuse/Kconfig | 4 + fs/fuse/Makefile | 1 + fs/fuse/args.h | 44 +- fs/fuse/cuse.c | 114 +-- fs/fuse/dev.h | 12 +- fs/fuse/fuse_dev_i.h | 3 +- fs/fuse/fuse_i.h | 8 +- fs/fuse/helper.c | 242 ++++++ include/linux/mtd/partitions.h | 2 + include/net/fuse.h | 98 +++ include/uapi/linux/fuse.h | 249 +++++- include/uapi/mtd/mtd-abi.h | 1 + 18 files changed, 1736 insertions(+), 168 deletions(-) create mode 100644 drivers/mtd/muse.c create mode 100644 fs/fuse/helper.c create mode 100644 include/net/fuse.h -- 2.55.0