Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp270671pxx; Thu, 29 Oct 2020 02:06:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW/6jldn0WHkoR6RxJVQcdW5e9kcQuxSOjYWk1GikhuVjXqsPyhd1BzuG53Tx7UJylMuRG X-Received: by 2002:a17:906:48b:: with SMTP id f11mr3103561eja.293.1603962385262; Thu, 29 Oct 2020 02:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603962385; cv=none; d=google.com; s=arc-20160816; b=LV81/axWIPKoQmOrwNHjPKn4smQ68TQX5honlOirtSpvpfvoVr0a6BDfoMupDdA/j8 WLEHypmDOAN8s74oPbkzeBu+tuZv4+REyH8BrQ7UCIuYyrFKIp+09+7rdkIARe2WGWDv hnF6FRL3r1HyV6QP1+JGGxOtSla+sdxvmOQE/GjngBq97fgExL3V/79Cy84idNPUSGjJ Psq5jSJPKslu79cSUVk8Dx3ZgQkotxUvwcX/Dqm7rJHNVt8xVIc5EQlA1VXXj2HJiyLM irP3vBeyUedYeY1cOjkX5InjF2vQmNdZV9AZvOvg2eDqdcx6FMoSIpByINltWhwHzXUk WwZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Mr6O4X0SAYml01n0bQC0xzH69EptlePez606qtE4EH4=; b=PX9lPR/qwyeuN46xz+QybeT1ugssE6zYBuG1e9AXH71cVidizB5pm6eQbc3OW6QT5m cLLI58durRbwjJxIisobpI87m4txBYy1kCLmh7njK7pfkkHaujgD8tPIMeqkuRfWO6jq BrVHTFFgM6DtTP78q8yDM0GFutFilW0r8UpiOWnA40NOacM8kqqfmY+PsYYzXBW1VNso gWz4i/i9kWZ3gRE/bRjYnpqKaSgISg0+RAgUt0EbbPPZI0MYs+ocwM3NPs3Wx4hKanbc jI53xs0l+Z2o2CZrz5vMlQl7w0s3Cr0oOV/7DGqad7wyaTLTqEdTn8EBCk9sGWurrQWI DsxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FACJz91Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si1658986ejo.534.2020.10.29.02.06.03; Thu, 29 Oct 2020 02:06:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FACJz91Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725885AbgJ2IHe (ORCPT + 99 others); Thu, 29 Oct 2020 04:07:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:34640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbgJ2IHY (ORCPT ); Thu, 29 Oct 2020 04:07:24 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7151821582; Thu, 29 Oct 2020 05:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603950019; bh=GrMW5+ilrmR3ZGg03ZOtbXJLBdgIpx5whB9lK2osPi0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FACJz91ZJ7uADs2e2VRJrnhDqM6Iz+ENqHHlsad6Aq3NcF95uSTuMMoxofMUq2b/I eD+95MYpEZA/YcBfYIRHwHjGpIg7P+1M7Do9fNyClyzuEb8jRI4Xwl4Un4UVY0uiLN FTHSUuaN1y5gichZdjEYgHyK0ZX8UPkg7rHT90as= Date: Thu, 29 Oct 2020 06:41:10 +0100 From: Greg Kroah-Hartman To: Daniel Gutson Cc: Derek Kiernan , Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mika Westerberg , Arnd Bergmann , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Richard Hughes , Alex Bazhaniuk , linux-mtd@lists.infradead.org Subject: Re: [PATCH] mtd: spi-nor: intel-spi: Split intel-spi reading from writing Message-ID: <20201029054110.GA3039992@kroah.com> References: <20201028214359.384918-1-daniel.gutson@eclypsium.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201028214359.384918-1-daniel.gutson@eclypsium.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 28, 2020 at 06:43:59PM -0300, Daniel Gutson wrote: > This patch separates the writing part of the intel-spi drivers > so the 'dangerous' part can be set/unset independently. > This way, the kernel can be configured to include the reading > parts of the driver which can be used without > the dangerous write operations that can turn the system > unbootable. > > Signed-off-by: Daniel Gutson > --- > drivers/mtd/spi-nor/controllers/Kconfig | 39 ++++++++++++--------- > drivers/mtd/spi-nor/controllers/intel-spi.c | 12 +++++-- > 2 files changed, 33 insertions(+), 18 deletions(-) > > diff --git a/drivers/mtd/spi-nor/controllers/Kconfig b/drivers/mtd/spi-nor/controllers/Kconfig > index 5c0e0ec2e6d1..491c755fea49 100644 > --- a/drivers/mtd/spi-nor/controllers/Kconfig > +++ b/drivers/mtd/spi-nor/controllers/Kconfig > @@ -31,34 +31,41 @@ config SPI_INTEL_SPI > tristate > > config SPI_INTEL_SPI_PCI > - tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)" > + tristate "Intel PCH/PCU SPI flash PCI driver" > depends on X86 && PCI > select SPI_INTEL_SPI > help > - This enables PCI support for the Intel PCH/PCU SPI controller in > - master mode. This controller is present in modern Intel hardware > - and is used to hold BIOS and other persistent settings. Using > - this driver it is possible to upgrade BIOS directly from Linux. > - > - Say N here unless you know what you are doing. Overwriting the > - SPI flash may render the system unbootable. > + This enables read only PCI support for the Intel PCH/PCU SPI > + controller in master mode. This controller is present in modern > + Intel hardware and is used to hold BIOS and other persistent settings. > + Using this driver it is possible to read the SPI chip directly > + from Linux. > > To compile this driver as a module, choose M here: the module > will be called intel-spi-pci. > > config SPI_INTEL_SPI_PLATFORM > - tristate "Intel PCH/PCU SPI flash platform driver (DANGEROUS)" > + tristate "Intel PCH/PCU SPI flash platform driver" > depends on X86 > select SPI_INTEL_SPI > help > - This enables platform support for the Intel PCH/PCU SPI > + This enables read only platform support for the Intel PCH/PCU SPI > controller in master mode. This controller is present in modern > - Intel hardware and is used to hold BIOS and other persistent > - settings. Using this driver it is possible to upgrade BIOS > - directly from Linux. > + Intel hardware and is used to hold BIOS and other persistent settings. > + Using this driver it is possible to read the SPI chip directly > + from Linux. > + > + To compile this driver as a module, choose M here: the module > + will be called intel-spi-pci. > + > +config SPI_INTEL_SPI_WRITE > + bool "Intel PCH/PCU SPI flash drivers write operations (DANGEROUS)" > + depends on SPI_INTEL_SPI_PCI || SPI_INTEL_SPI_PLATFORM > + help > + This enables full read/write support for the Intel PCH/PCU SPI > + controller. > + Using this option it may be possible to upgrade BIOS directly > + from Linux. > > Say N here unless you know what you are doing. Overwriting the > SPI flash may render the system unbootable. > - > - To compile this driver as a module, choose M here: the module > - will be called intel-spi-platform. > diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c > index b54a56a68100..8d8053395c3d 100644 > --- a/drivers/mtd/spi-nor/controllers/intel-spi.c > +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c > @@ -266,6 +266,7 @@ static int intel_spi_read_block(struct intel_spi *ispi, void *buf, size_t size) > return 0; > } > > +#ifdef CONFIG_SPI_INTEL_SPI_WRITE Please do not add #ifdef to .c files, that's not the proper kernel coding style at all, and just makes maintaining this file much much harder over time. Split things out into two different files if you really need to do this. thanks, greg k-h