Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5092702imu; Tue, 25 Dec 2018 17:46:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN5IJ0wY73UK4ZrXh7NLKmGb7toaQJ97GYR3F5CdQFF2jKjtmFdPf7zSb8VGyS2hsQpb91bO X-Received: by 2002:a17:902:9a9:: with SMTP id 38mr17737440pln.204.1545788783301; Tue, 25 Dec 2018 17:46:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545788783; cv=none; d=google.com; s=arc-20160816; b=vxYnxU4TdWSyONc3XeuLnmgIHAcwTtJuXpACnP9AC3XgKwRD6cyc7fLv9bs/GyLyMn cwRJRK1vOPVpDju9P9FUOh041PRGibh+aMro2h3Q3UiDKEtWT6JA1/Y8rYD7TDcvPzn5 n8/nJN2UVGFAABpt3iSRH4h+OFSlrFkipGG4231XioBDUrbXREXhKQdPqSffpVC7VChh OC1BxCpkbxOpVo/hitFK0N4dxeHB308fJ7rqV2ZRZImI0qXAJqVZIziCj+55fWUpC71S ZpJcpw+n/k4ivCi806jgnAoDBccb/F2CH9aS0CBPyHACrgLUGliUTyoK0AEpNN/9XOLI V0Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=2ypitAvcdlraJA+Ba/Jpcxy189I5QGoI4RzBxU45eIE=; b=Au3hxepTCneOt8/TzcYvLjnPD8O9rdqp34Geuw0wCr5o2usQV+xA/3CmCHB1xXUiaq cH0WdchEakLx4f42D7+0xrhSsvaRzEvW861QXmu8W/TTbIT/quwNAOHqYF/70dBB3xCi hi1Thbm8qOlN6IZKRu+Sh8b44JlmGj9e1i6CnRrMXqhmT+ZihrEAFAlrwXv4RFLce+0a 3SfL815Aqm9KeE0ile7cjO+mufZVtFMhxhJV3jbRKvpdpi99Ha2V9DbgQftYwItG2NST 7/nSEJiiRRS8qAsOJ5FF/v/aqeprZteJ/Cv9bIHobF25AjrxfHnGnUemUrXF67PHrwpn /v/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25si33944848pfk.28.2018.12.25.17.46.07; Tue, 25 Dec 2018 17:46:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729737AbeLZApI (ORCPT + 99 others); Tue, 25 Dec 2018 19:45:08 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:57334 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbeLZAoB (ORCPT ); Tue, 25 Dec 2018 19:44:01 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 0B5692952C; Tue, 25 Dec 2018 19:43:57 -0500 (EST) To: Arnd Bergmann , Greg Kroah-Hartman , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org Message-Id: <22b3299016531a7a05c9c45b36d43565c794e67d.1545784679.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v8 22/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS Date: Wed, 26 Dec 2018 11:37:59 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch PPC32 kernels from the generic_nvram module to the nvram module. Also fix a theoretical bug where CHRP omits the chrp_nvram_init() call when CONFIG_NVRAM_MODULE=m. Signed-off-by: Finn Thain Tested-by: Laurent Vivier Tested-by: Stan Johnson --- The change in the name of the module is visible to userspace. The module that implements /dev/nvram on PowerPC now has suitable aliases, i.e. MODULE_ALIAS_MISCDEV(NVRAM_MINOR); MODULE_ALIAS("devname:nvram"); so that the device special file can be automatically created and the module automatically loaded when needed. Previously this was not the case. Changed since v7: - Improved Kconfig help text for CONFIG_NVRAM. - Changed the default for CONFIG_NVRAM, which used to be "n". This is to reduce the risk that CONFIG_GENERIC_NVRAM=y accidentally gets changed to CONFIG_NVRAM=n. --- arch/powerpc/Kconfig | 2 +- arch/powerpc/kernel/setup_32.c | 2 +- arch/powerpc/platforms/chrp/Makefile | 2 +- arch/powerpc/platforms/chrp/setup.c | 2 +- arch/powerpc/platforms/powermac/setup.c | 3 +-- drivers/char/Kconfig | 19 +++++++++---------- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 8be31261aec8..5b859b7f6599 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -272,7 +272,7 @@ config SYSVIPC_COMPAT default y # All PPC32s use generic nvram driver through ppc_md -config GENERIC_NVRAM +config HAVE_ARCH_NVRAM_OPS bool default y if PPC32 diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index bdbe6acbef11..96782abb0c41 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -150,7 +150,7 @@ static int __init ppc_setup_l3cr(char *str) } __setup("l3cr=", ppc_setup_l3cr); -#ifdef CONFIG_GENERIC_NVRAM +#if IS_ENABLED(CONFIG_NVRAM) static unsigned char ppc_nvram_read_byte(int addr) { diff --git a/arch/powerpc/platforms/chrp/Makefile b/arch/powerpc/platforms/chrp/Makefile index 4b3bfadc70fa..dc3465cc8bc6 100644 --- a/arch/powerpc/platforms/chrp/Makefile +++ b/arch/powerpc/platforms/chrp/Makefile @@ -1,3 +1,3 @@ obj-y += setup.o time.o pegasos_eth.o pci.o obj-$(CONFIG_SMP) += smp.o -obj-$(CONFIG_NVRAM) += nvram.o +obj-$(CONFIG_NVRAM:m=y) += nvram.o diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index d6d8ffc0271e..ba216aef964a 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c @@ -556,7 +556,7 @@ static void __init chrp_init_IRQ(void) static void __init chrp_init2(void) { -#ifdef CONFIG_NVRAM +#if IS_ENABLED(CONFIG_NVRAM) chrp_nvram_init(); #endif diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 2f00e3daafb0..ce340ae4ee38 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -316,8 +316,7 @@ static void __init pmac_setup_arch(void) find_via_pmu(); smu_init(); -#if defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) || \ - defined(CONFIG_PPC64) +#if IS_ENABLED(CONFIG_NVRAM) || defined(CONFIG_PPC64) pmac_nvram_init(); #endif #ifdef CONFIG_PPC32 diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index f9960bd65481..2a193b298d27 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -236,25 +236,24 @@ source "drivers/char/hw_random/Kconfig" config NVRAM tristate "/dev/nvram support" - depends on X86 || GENERIC_NVRAM || HAVE_ARCH_NVRAM_OPS - default M68K + depends on X86 || HAVE_ARCH_NVRAM_OPS + default M68K || PPC ---help--- If you say Y here and create a character special file /dev/nvram with major number 10 and minor number 144 using mknod ("man mknod"), - you get read and write access to the extra bytes of non-volatile - memory in the real time clock (RTC), which is contained in every PC - and most Ataris. The actual number of bytes varies, depending on the - nvram in the system, but is usually 114 (128-14 for the RTC). - - This memory is conventionally called "CMOS RAM" on PCs and "NVRAM" - on Ataris. /dev/nvram may be used to view settings there, or to - change them (with some utility). It could also be used to frequently + you get read and write access to the non-volatile memory. + + /dev/nvram may be used to view settings in NVRAM or to change them + (with some utility). It could also be used to frequently save a few bits of very important data that may not be lost over power-off and for which writing to disk is too insecure. Note however that most NVRAM space in a PC belongs to the BIOS and you should NEVER idly tamper with it. See Ralf Brown's interrupt list for a guide to the use of CMOS bytes by your BIOS. + This memory is conventionally called "NVRAM" on PowerPC machines, + "CMOS RAM" on PCs, "NVRAM" on Ataris and "PRAM" on Macintoshes. + To compile this driver as a module, choose M here: the module will be called nvram. -- 2.19.2