From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0983CC433E1 for ; Thu, 13 Aug 2020 15:41:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6AF020829 for ; Thu, 13 Aug 2020 15:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbgHMPl3 (ORCPT ); Thu, 13 Aug 2020 11:41:29 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:48215 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726679AbgHMPl2 (ORCPT ); Thu, 13 Aug 2020 11:41:28 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MLz3R-1kNV7k1PST-00I0Ew for ; Thu, 13 Aug 2020 17:41:25 +0200 Received: by mail-qt1-f173.google.com with SMTP id v22so4676395qtq.8 for ; Thu, 13 Aug 2020 08:41:25 -0700 (PDT) X-Gm-Message-State: AOAM53023WOGA20bLKlx8JzwlZi4H5vsQEziMk+7XuJPCb8Xla85bUfB 5fXQpCFBzAg1bhq/3K2EJUkbi4mmNxK2zoyiw1U= X-Google-Smtp-Source: ABdhPJwBmHbur4R9QAEADlY4bGOU5Jt/LG8dUKhZzbWmRZKmKNVU9XmwD/IPUYWNtlm4yEdoEp1pVW6E6FaFtYVihzs= X-Received: by 2002:ac8:688e:: with SMTP id m14mr5976151qtq.7.1597333284188; Thu, 13 Aug 2020 08:41:24 -0700 (PDT) MIME-Version: 1.0 References: <20200804135817.5495-1-daniel.gutson@eclypsium.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 13 Aug 2020 17:41:07 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mtd: spi-nor: intel-spi: Do not try to make the SPI flash chip writable To: Daniel Gutson Cc: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mika Westerberg , Boris Brezillon , linux-mtd , "linux-kernel@vger.kernel.org" , Alex Bazhaniuk , Richard Hughes , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:yYRwo/T7qD5jYkdy4a4BA5kceI6rHyB7iJnj7QET+1JZfQPqIPd whRpw9kNzk9hZ5+4NwVVu2HnQpEwj8xJLMnPiw/SSjE8dBLdYzpyUoGy/E+zBFb6SQTxqX/ A1uSgaWhBWkAv3RcF78ImeaGfX3pDuDvn+eA3GZTE3CADBSfFvn5QvCOS7TbC5bY+qxl2Y5 cGQUYladuMXCxqBxnAUpQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:PHUbVkQMu1o=:i1hoozi4LG1fQla+wh3QmW X6USbcd9AVhYFb+er0NiUG3zvfC4MeR6bpFXc8cZBwDqVYFpm3WMiMuTLV5G1p5prKxPc0Cwe FJfDNTj0B1GVvIlsZP3TjQrwmj2fLWKOlEWTWRfFsmt9P+yP2yseeI0x9EZVLwo9Cxre+Kuht csmdtRzXEmrni8cY6oUaQ0piNPsUnMhOQrD0UA5yk10wU5/5cRFbqx1PUgEPqxDVrHMoCauXg skHScRMZpQSs1+kf6D02r1F6iq4/ZzAbJxVXLlxFWN2eiZB0q9ltMhkTyPqlf1dJ+txezHc6F jlVtpYmwKCX/YgUhCcXi5Q2/y2afUkTqi/16N/zDwktUn06MINUzMzr6xBqFHSikN1NQDXxkt w702iE/n10S2BvSbBDeZz75S+zJ3eeUh+I6TRvZZEsYLyWajngPw60jvk2ZcCT+e1NV+d6vTx a8K+E9+fDb8Y+VZIysEKB/shAfyDgYr6d3ns07kR7KQnbLaZ3I9IC93VP9ogG5c/6tx6Rza5H 4MJcxTa/u7ECUAsylVWzGO5OLg3DRiUvGfWF4pVcHilaopwqSD4Z9bfd41987LHFGKhLZrAsU NTJynTBo03ZDgrItL/Mx5C/E14graWqeShHvbMU7Dz7FDfro5+e1ggl5eVpcwgBDXEb7EGje6 aBFGr39V2F3SoPFUej9yay7nvEi3We+MrrAXD5Wz1PUqB8PwHlrp/PewQ6LP8ixgRuEmB2BXl 76DyX3rUv8NkdndPet6scXAn9jIzAY3E8b2xZklGFt0Ahyh6fDsybfbIAmWtxFkRa9tZ9yq35 OJl41cm9IaC4cY7qc+HO7l20kElgvzWeUk+wERJHfPHTtf3Y81xyLX5m6GebdVvMNrAh/aG Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 4, 2020 at 11:26 PM Daniel Gutson wrote: > On Tue, Aug 4, 2020 at 5:46 PM Arnd Bergmann wrote: > > > But wait, Mika, the author of the file, asked earlier not to remove > > > the module parameter of intel-spi, and just remove the unconditional > > > attempt to turn the chip writable in intle-spi-pci. > > > > Yes, and I think that is fine (aside from the inconsistency with bay trail > > that you have not commented on), > > There are two inconsistencies before any of my patches: > 1) in intel-spi.c: uses the module parameter only for bay trail. > 2) intel-spi.c uses a module parameter whereas intel-spi-pci doesn't Neither of these matches what I see in the source code. Please check again. Once more: intel-spi.c has a module parameter that controls writing to the device regardless of the back-end (platform or pci), purely in software. The hardware write-protect setting where available works in addition that and prevents writing even if the module parameter is set to writeable. > > but that only touches the hardware > > write-protection, which doesn't really have any effect unless user > > space also configures the driver module to allow writing to the > > mtd device. > > > > > So I'm not touching intel-pci, just removing that code from > > > intel-spi-pci without adding a new module parameter. > > > > > > Are you aligned on this? > > > > One of us is still very confused about what the driver does. > > You seem to have gone back to saying that without the > > change a user could just write to the device even without > > passing the module parameter to intel-spi.ko? > > What I'm trying to say is that, if the BIOS is unlocked > (no driver involvement here), the intel-spi-pci turns the > chip writable even without changing the module parameter of intel-spi. > This is because the attempt to turn the chip writable occurs in > the probing of intel-spi-pci, that is, earlier than the intel-spi > initialization. My question was why you even care whether the hardware bit is set to writeable if the driver disallows writing. I think the answer is that you misread the driver. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73ADBC433E1 for ; Thu, 13 Aug 2020 15:42:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33FBC20829 for ; Thu, 13 Aug 2020 15:42:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uUPfUTUd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33FBC20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vvXklX+PZbJtJqx53eYw/fQsNLeBYDr4+MGAZSmfjNg=; b=uUPfUTUdmhaIQov3SZjqgK3zF DOMqJUYwKP1QSv2wzRY1agQHOQMDdGbPqagCO06qmv5jowZx8WZxjtKGR7cQHswz0C3awmTYXseop MhljFks0Mf69PpXdE1XuRdP3Sk9BxQSn15p8V8FbZPN0jV2VDtOgKomZ0tseJaSbisOzdRGoxPKWR A1VZjcjwQrUcJgzd7IKWoJRQ0ZlAXkxGKqPqclrBy1e8GSfJKha0sVeBwK6Jao+hyFJJEHmQyym3v zkjWoeTOERg8N5ZhaqQC3A9iBQebL9j4DZExEXVGxpAyVXS0NpP8haJYf2pQO+68Dhc8GsqjcRqGx Xs9DVtQFQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6FMF-0000Zo-Kh; Thu, 13 Aug 2020 15:41:35 +0000 Received: from mout.kundenserver.de ([212.227.126.130]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6FMC-0000YU-O5 for linux-mtd@lists.infradead.org; Thu, 13 Aug 2020 15:41:33 +0000 Received: from mail-qt1-f175.google.com ([209.85.160.175]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPSA (Nemesis) id 1Mow4E-1kU2FU2EIw-00qV9d for ; Thu, 13 Aug 2020 17:41:26 +0200 Received: by mail-qt1-f175.google.com with SMTP id o22so4649375qtt.13 for ; Thu, 13 Aug 2020 08:41:25 -0700 (PDT) X-Gm-Message-State: AOAM533WvNROKVgddHPLnWaaM7Nn+R8Uqsvz5s4Gy104M3D0h0dHgEE4 8AHI31NG4LhRbaXghSOL4q4DhEqFhWvIm08bMts= X-Google-Smtp-Source: ABdhPJwBmHbur4R9QAEADlY4bGOU5Jt/LG8dUKhZzbWmRZKmKNVU9XmwD/IPUYWNtlm4yEdoEp1pVW6E6FaFtYVihzs= X-Received: by 2002:ac8:688e:: with SMTP id m14mr5976151qtq.7.1597333284188; Thu, 13 Aug 2020 08:41:24 -0700 (PDT) MIME-Version: 1.0 References: <20200804135817.5495-1-daniel.gutson@eclypsium.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 13 Aug 2020 17:41:07 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mtd: spi-nor: intel-spi: Do not try to make the SPI flash chip writable To: Daniel Gutson X-Provags-ID: V03:K1:RNWcU+gqQ9LIhsuBlY0HgxZL66UVIEmIIUt9CoeVHUZx0b7J8bV Tx8ogxaB1uwWWuF2IEJBJVa8ZZAQK218KPoNwujussjyZtVUwZiVgXOhDtultEwuJSABwps Ho35xuvBZ9149hHgM493lC9f4o0AXNpSknZfiue23g+Sx6hbkV+D2lGNYIeERGm616JYruD FwNl7lUJ1vZ+OFNfSf4PQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:X/UDncSMP6s=:7liksHWiJI5mFFaqu+gSAn HhGsQtW3OeMQYGn4w1VBKtiPSeLIFVvyjDWzmv/u7nO1VnABfm9fRu5vM38oUtQu0ZeJrC/R9 dTrf6AZsKtGR7qNlmdaK1D9+bVpzy0gk8e1gi5J9qmKD6cg9Uhzfx3ziYgqA64UGtJ+O4TOgy FI6rCsn0HjvTngVx/UmAV2jiC1FtxZN3/zal1a/8/s3iWsdlKVL9g5ABkdDWiSvNZweZs+ZkO IstKWEKK6N3RcxGCBhwsNG9tn4P9DDq4IFb/7U4Wg40p9fPg4MZb1hUvhWt8nEFfA0RLbUy8X 0MnMjDWtOtv3nYS5GAv9EBu9r4r/W9JFmcKtG4oQcMzXh64zW+M+kXjHhk3gp0dYjjDRIPXuS xKHDikU9L4ce+ihor9W7+CRXl614tnP+TTexp7wHjcPoBgeiz9r81izUwJ+0kXLlidhCjwpAw KqYxhLk213c8PBBnJrYekeTp5OI/vJo/PVYakbGM22sqNJqU2a3c40x2QkS1Q2rZ8FqgVarUh L6a3FdxHvELm0InZu6eTObcGDulAipfoD9ogPEdni2wN8yd10h4Axd9vhFjwjxffw3wkSj76s 5Vky0KNh4ZwqVXjZHr+KT0Yb+RZrKC2GYjiPyApPJAsfYt5Vbc7Qjve3TV4eF/pdM56davlHG q9mI2vvwKVsoM6Hrq3PJsXOXhQsaUGR9S5BggODo/69e12+QdlpG90gGA59o52u3iZTzsI3pQ 9ETy94fcjyM+W4uYeWUTAcsxlyD33otfJR5B5DZPKHjZcWylMA+GCsWXIslRJv24L36tEXVIm qyrNxMePytGciqC4AufWAfgx1609mdrgbJQdNZqhuTlCr8mlc/Y/zxrol+lBAfHb1dmNTzw X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200813_114132_995838_139BE061 X-CRM114-Status: GOOD ( 31.73 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Hughes , Vignesh Raghavendra , Boris Brezillon , Richard Weinberger , Tudor Ambarus , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , linux-mtd , Miquel Raynal , Alex Bazhaniuk , Mika Westerberg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Tue, Aug 4, 2020 at 11:26 PM Daniel Gutson wrote: > On Tue, Aug 4, 2020 at 5:46 PM Arnd Bergmann wrote: > > > But wait, Mika, the author of the file, asked earlier not to remove > > > the module parameter of intel-spi, and just remove the unconditional > > > attempt to turn the chip writable in intle-spi-pci. > > > > Yes, and I think that is fine (aside from the inconsistency with bay trail > > that you have not commented on), > > There are two inconsistencies before any of my patches: > 1) in intel-spi.c: uses the module parameter only for bay trail. > 2) intel-spi.c uses a module parameter whereas intel-spi-pci doesn't Neither of these matches what I see in the source code. Please check again. Once more: intel-spi.c has a module parameter that controls writing to the device regardless of the back-end (platform or pci), purely in software. The hardware write-protect setting where available works in addition that and prevents writing even if the module parameter is set to writeable. > > but that only touches the hardware > > write-protection, which doesn't really have any effect unless user > > space also configures the driver module to allow writing to the > > mtd device. > > > > > So I'm not touching intel-pci, just removing that code from > > > intel-spi-pci without adding a new module parameter. > > > > > > Are you aligned on this? > > > > One of us is still very confused about what the driver does. > > You seem to have gone back to saying that without the > > change a user could just write to the device even without > > passing the module parameter to intel-spi.ko? > > What I'm trying to say is that, if the BIOS is unlocked > (no driver involvement here), the intel-spi-pci turns the > chip writable even without changing the module parameter of intel-spi. > This is because the attempt to turn the chip writable occurs in > the probing of intel-spi-pci, that is, earlier than the intel-spi > initialization. My question was why you even care whether the hardware bit is set to writeable if the driver disallows writing. I think the answer is that you misread the driver. Arnd ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/