From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 712C2606A31C for ; Mon, 30 Nov 2026 08:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=LxPEMP3T; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZLHTXZdW DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=/qQkGjXLGp7IOFNZvInophMjze3UoJXLFjPIHUCrVho=; b=LxPEMP3TeKVNmHaadc/GzSjqsx 5YOgR1hC3h2bGzsrwMPXdwqMDPu6mVZwaSOqHuQYksugbNRwKKQr3r0hKK8BQNpzEEtBkWFRlo3lS tQ2xuyWGKliCrGuFQxtWQH+43k29vSzG4us5nxh8m9Iqa3jQb+KXmAwypTIl2iuR9JEyw6oyczfPo tfHshrIiJNITuquJMscAlqEiXo1/3lXfj7dGuY/2/SUg9NTdBQEgT7hYAk9tY0TEy5GfF3Hz5lYSn 33IZad/a7Z6+1du/Cosh8b+ah15TtVzCQ+L2mJCxPf/yysqSGJTAabjGrKlmUBpaQfM1jpLEiYJxU Tx9EGEPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXwik-00000003jss-3g9p; Mon, 30 Nov 2026 08:26:46 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXwij-00000003jsj-1Fxy for linux-mtd@lists.infradead.org; Mon, 30 Nov 2026 08:26:45 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 952BE61DC9; Mon, 30 Nov 2026 08:26:44 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/