Re: [PATCH] char: nvram: disable on ARM
From: Arnd Bergmann <arnd@arndb.de>
Date: 2018-02-07 10:33:55
Also in:
lkml
On Wed, Feb 7, 2018 at 2:55 AM, Alexandre Belloni [off-list ref] wrote:
On 06/02/2018 at 23:55:02 +0100, Arnd Bergmann wrote:quoted
* arch/arm/kernel/time.c has this code #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \ defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) /* this needs a better home */ DEFINE_SPINLOCK(rtc_lock); EXPORT_SYMBOL(rtc_lock); #endif /* pc-style 'CMOS' RTC support */ That can be adapted now, or maybe we could move all definitions into a common place (that needs some more planning).Yes, on arm, the rtc_lock is mostly there to please drivers/rtc/rtc-cmos.c. Maybe we could make the locking in this driver x86 and PPC specific. If we can get rid of arch/powerpc/platforms/chrp/time.c and arch/powerpc/platforms/maple/time.c (so much duplicated code), then it is x86 only.
What about these: arch/alpha/kernel/rtc.c: spin_lock(&rtc_lock); arch/alpha/kernel/rtc.c: spin_unlock(&rtc_lock); arch/alpha/kernel/time.c:DEFINE_SPINLOCK(rtc_lock); arch/alpha/kernel/time.c:EXPORT_SYMBOL(rtc_lock); arch/arm/kernel/time.c:DEFINE_SPINLOCK(rtc_lock); arch/arm/kernel/time.c:EXPORT_SYMBOL(rtc_lock); arch/m32r/kernel/time.c:DEFINE_SPINLOCK(rtc_lock); arch/m32r/kernel/time.c:EXPORT_SYMBOL(rtc_lock); arch/m68k/atari/time.c:DEFINE_SPINLOCK(rtc_lock); arch/m68k/atari/time.c:EXPORT_SYMBOL_GPL(rtc_lock); arch/mn10300/kernel/rtc.c:DEFINE_SPINLOCK(rtc_lock); arch/mn10300/kernel/rtc.c:EXPORT_SYMBOL(rtc_lock); arch/powerpc/kernel/time.c:DEFINE_SPINLOCK(rtc_lock); arch/powerpc/kernel/time.c:EXPORT_SYMBOL_GPL(rtc_lock); arch/sparc/kernel/time_32.c:DEFINE_SPINLOCK(rtc_lock); arch/sparc/kernel/time_32.c:EXPORT_SYMBOL(rtc_lock); arch/sparc/kernel/time_64.c:DEFINE_SPINLOCK(rtc_lock); Are they all obsolete?
quoted
* similarly, this line in nvram.c can be simplified: #if defined(CONFIG_ATARI) # define MACH ATARI #elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and ?? */ # define MACH PC #else # error Cannot build nvram driver for this machine configuration. #endif * GENERIC_NVRAM is not really generic, instead this seems to be the chardev that is used for 32-bit powerpc (powermac, 85xx, 86xx), while 64-bit powerpc (cell, maple, opal, pseries) use code from arch/powerpc/kernel/nvram_64.c, with the same underlying arch hooks. The nvram_64 code appears to be mostly a superset of the 32-bit generic_nvram one. * The code in drivers/char/nvram is not used at all when GENERIC_NVRAM is set, and half the code in there is different between x86 and atari. * most of the external interface in include/linux/nvram.h is unused, the rest tends to be architecture specific * The procfs file appears to be completely useless on any 64-bit x86 machine, this is what I see: $ cat /proc/driver/nvram Checksum status: valid # floppies : 0 Floppy 0 type : none Floppy 1 type : none HD 0 type : none HD 1 type : none HD type 48 data: 0/0/0 C/H/S, precomp 0, lz 0 HD type 49 data: 156/0/0 C/H/S, precomp 0, lz 0 DOS base memory: 635 kB Extended memory: 65535 kB (configured), 65535 kB (tested) Gfx adapter : EGA, VGA, ... (with BIOS) FPU : not installedI really don't think anyone is using that but I don't really know much about x86 and the specification this may be part of. I see the info may be used in drivers/video/fbdev/ and drivers/platform/x86/thinkpad_acpi.c
The thinkpad_acpi driver seems to look at some other bytes
in the nvram, which have a platform specific meaning.
For drivers/video/fbdev/, these appear to all be for pre-x86
Apple Macintosh (m68k or powerpc).
Arnd