From patchwork Thu Dec 16 08:34:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 1568952 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RfBLABXY; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kempniu.pl header.i=@kempniu.pl header.a=rsa-sha256 header.s=google header.b=jnhRuiTb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JF55x6978z9s5P for ; Thu, 16 Dec 2021 19:35:17 +1100 (AEDT) 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-Owner; bh=P52JwI2vJQXPOKtv+Dhm9UqgjS/zMIp0XcKS+j4CujU=; b=RfBLABXYhMqLeW 5c1trrmK/S1R1oHN7QvpVPo3uvxCF/Wjc8NZp51w7JwAdFo1RXqadQseOVuyQrZA+pRzeUi+J6Q0z mdCkFznG9Mq6ZH99p2ZPJ7mYAsVMpGXbhcwUxR5p7KPJnda0mjgvQ2r+uDDFWYclPs6rBCMRxcKNd zAxlpNfXwrK+ZW75xNYYeYTv/dGrTKnqCLYSJhAQRS651Sj47CPt4v098chOf/D4+Qw/UQwS+kccF pnaCsPs1r32C4vp7/j+RQOINQDX2ZKKt6baP00lg2mGM2Sgzf1dQVuBUmli5tSw3cR074Jsryy9px qJzfcrikYoj8Qt7gtvvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxmDk-00484J-6U; Thu, 16 Dec 2021 08:34:36 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxmDg-00482H-AG for linux-mtd@lists.infradead.org; Thu, 16 Dec 2021 08:34:33 +0000 Received: by mail-lj1-x236.google.com with SMTP id m12so37352674ljj.6 for ; Thu, 16 Dec 2021 00:34:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bJOl4JkalmkkKaSfxJZNe6fs4zRAwFffrMK7a1d+U4I=; b=jnhRuiTbeU78C+OUofudoXlAy+jqgmR5VIGlzVM8fTZAVSAKBHcOURAxvOgeHA6w9D vMiaDZldxfTYBiw//2OLgy5H+ry3YJjMV2pFLRke2Xb/8r3zy50csfnFxqGvQpUhOgaj kdZUbuPncKGBnHwsT85SvH3nZT/ho+bVtQWio= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bJOl4JkalmkkKaSfxJZNe6fs4zRAwFffrMK7a1d+U4I=; b=xzbW3RXjWf6J/h1abJ8u4sT+JvFg2pGW0VyssSxSRR3HC83bvbEFVIBP14co4jseAW wO3pNucMR/GhjVCPRYcJm6KsYTmzAEuTpGI+l9hNk2j2A6/3vfO5bigbvYHxkTAyYiKz 0Oy+O7W0IejtKNofEiTxZkUtmxI3i8ySC+ncRszXTjHKa1TF8MozwAbQUUID9/b7OJjX vyN1FODPiDk+zx03x9iJyLyjWBpwdqlxy1YOm89dBLuzI7gK115MB5INl3B3qJXwVifS Lo9CEy/0CSNGE4oI9SaYeDfMr41eoveyfPLN9GcMEzu2heVXKIlN5WoJhw5VcM2YG0zH J8fw== X-Gm-Message-State: AOAM530qfVFW2P9nqOtTZn8g+rfpjTfYaYKGcKttfPKjJIhClwVjGVig 6qnUF6/8Xt5lnC2MWAfqbTl6Eg== X-Google-Smtp-Source: ABdhPJxpEdkTJ7XAiaDmXTExNTDlhMnD5luYX0j+GFWk6L3K2/pqWTO+l2yYKH4qUJ6zfUrwOm1bzw== X-Received: by 2002:a05:651c:106a:: with SMTP id y10mr14313443ljm.455.1639643669994; Thu, 16 Dec 2021 00:34:29 -0800 (PST) Received: from larwa.hq.kempniu.pl ([2001:470:64df:111::e02]) by smtp.gmail.com with ESMTPSA id c2sm985679ljf.50.2021.12.16.00.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 00:34:29 -0800 (PST) From: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/5] mtdchar: add MEMREAD ioctl Date: Thu, 16 Dec 2021 09:34:13 +0100 Message-Id: <20211216083418.13512-1-kernel@kempniu.pl> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211216_003432_456752_CAAF4A5D X-CRM114-Status: GOOD ( 11.20 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This patch series adds a new mtdchar ioctl, MEMREAD. Its purpose is to serve as a read counterpart of the MEMWRITE ioctl, exposing a broader set of capabilities for read operations (e.g. use of MTD_OP [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:236 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch series adds a new mtdchar ioctl, MEMREAD. Its purpose is to serve as a read counterpart of the MEMWRITE ioctl, exposing a broader set of capabilities for read operations (e.g. use of MTD_OPS_AUTO_OOB, access to ECC statistics) to user-space applications making use of MTD devices via /dev/mtd* character devices. Changes from v1: - Added patches 2-5 which enable the new MEMREAD ioctl to report ECC statistics for the read operation back to user space. (There are obviously different ways these changes can be split up into separate commits; I was aiming for maximum ease of review.) - The 'retlen' and 'oobretlen' fields were not set in the struct mtd_read_req returned to userspace. This was done properly in Boris' original draft patch [1], but I missed it in my v1. - Invalid IS_ERR() checks were replaced with NULL checks. This was an artifact of copy-pasting mtdchar_write_ioctl() in v1: unlike memdup_user() used therein, kmalloc() always returns NULL on error. - Minor subject prefix adjustment for patch 1/5 ("mtd" -> "mtdchar"). [1] https://www.infradead.org/pipermail/linux-mtd/2016-April/067187.html Michał Kępień (5): mtdchar: add MEMREAD ioctl mtd: track maximum number of bitflips for each read request mtd: always initialize 'stats' in struct mtd_oob_ops mtd: add ECC error accounting for each read request mtdchar: extend MEMREAD ioctl to return ECC statistics drivers/mtd/devices/docg3.c | 8 ++ drivers/mtd/inftlcore.c | 6 +- drivers/mtd/mtdchar.c | 136 ++++++++++++++++++++++++ drivers/mtd/mtdcore.c | 5 + drivers/mtd/mtdswap.c | 6 +- drivers/mtd/nand/onenand/onenand_base.c | 16 ++- drivers/mtd/nand/onenand/onenand_bbt.c | 2 +- drivers/mtd/nand/raw/nand_base.c | 10 ++ drivers/mtd/nand/raw/nand_bbt.c | 8 +- drivers/mtd/nand/raw/sm_common.c | 2 +- drivers/mtd/nand/spi/core.c | 10 ++ drivers/mtd/nftlcore.c | 6 +- drivers/mtd/sm_ftl.c | 4 +- drivers/mtd/ssfdc.c | 2 +- drivers/mtd/tests/nandbiterrs.c | 2 +- drivers/mtd/tests/oobtest.c | 8 +- drivers/mtd/tests/readtest.c | 2 +- fs/jffs2/wbuf.c | 6 +- include/linux/mtd/mtd.h | 7 ++ include/uapi/mtd/mtd-abi.h | 64 ++++++++++- 20 files changed, 276 insertions(+), 34 deletions(-)