From: Finn Thain <fthain@telegraphics.com.au> To: <linux-kernel@vger.kernel.org>, <linux-m68k@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org> Subject: [RFC v4 00/25] Re-use nvram module Date: Sun, 12 Jul 2015 20:25:27 +1000 [thread overview] Message-ID: <20150712102527.356151908@telegraphics.com.au> (raw) The generic NVRAM module, drivers/char/generic_nvram, implements a /dev/nvram misc device. It is used only by 32-bit PowerPC platforms and isn't generic enough to be more widely used. The RTC NVRAM module, drivers/char/nvram, also implements a /dev/nvram misc device. It is used by x86, ARM and m68k. The former module cannot be used on x86, ARM or m68k because it cannot co-exist with the latter module, partly due to the Kconfig logic. It is possible to modify the modules so that one kernel binary could have either, neither or both. However, automatically loading the appropriate module is then impossible; if both provide the char-major-10-144 alias then the wrong module will end up being loaded. Hence a multi-platform kernel binary needs a single generic nvram module with alias char-major-10-144. Therefore, drivers/char/nvram.c should be made more generic and the arch-specific code therein should be moved to a more appropriate place under arch/. Also, drivers/char/generic_nvram.c should be removed to reduce code duplication. In this patch series, Atari-specific code is moved from the nvram module to arch/m68k/atari. More arch-specific code in the nvram module could be moved, probably to arch/x86, but it is difficult to determine just what code is relevant to ARM platforms and what code is x86-only. In addressing code duplication, this patch series removes three inconsistent /dev/nvram misc device implementations. One of these, drivers/macintosh/nvram.c is entirely unused already. The other two, drivers/char/generic_nvram.c and the misc device implementation in arch/powerpc/kernel/nvram_64.c, are replaced by drivers/char/nvram.c. A benefit of this work is better consistency -- between PPC32 and PPC64 as well as between PPC_PMAC and MAC. This new uniformity does have implications for userspace, that is, some error codes for some ioctl calls become consistent on all PowerPC platforms. The drivers/char/nvram module becomes sufficiently generic to be useful to other platforms and architectures, besides those with "CMOS" RTC. At the end of this patch series the module is adopted by the m68k Mac port, which already has PRAM access functions but lacks the /dev/nvram misc device. This patch series has been compile-tested for arm, m68k, powerpc and x86. The nvram and thinkpad_acpi modules were regression tested on a ThinkPad T43. The /dev/nvram functionality was also regression tested on a G3 PowerMac. The nvram module was also tested on a PowerBook 520 and Quadra 650. Note that my testing doesn't cover PPC64 or Atari. Changes since v1: - Minor changes to patches 7, 15 and 20 as described in commit logs. - Revised patches 21 and 24 to address comments from Geert. Changes since v2: - Dropped patch 1, "macintosh/nvram: Remove as unused", because it has since been merged. - Inserted a new patch, "m68k/mac: Use macros for RTC accesses not magic numbers". - Revised patches 21 and 23 to address comments from Geert. Changes since v3: - Split the patch, "m68k/atari: Move Atari-specific code out of drivers/char/nvram.c", as suggested by Geert. - Revised patches 11 and 25 to address comments from Geert. - Minor change to patch 21 as described in commit log. --- arch/m68k/Kconfig | 3 arch/m68k/Kconfig.machine | 2 arch/m68k/atari/Makefile | 2 arch/m68k/atari/nvram.c | 291 +++++++++++ arch/m68k/include/asm/atarihw.h | 6 arch/m68k/include/asm/macintosh.h | 4 arch/m68k/kernel/setup_mm.c | 100 +++ arch/m68k/mac/misc.c | 207 +++++--- arch/powerpc/Kconfig | 5 arch/powerpc/include/asm/nvram.h | 9 arch/powerpc/kernel/nvram_64.c | 203 +------ arch/powerpc/kernel/setup_32.c | 27 - arch/powerpc/platforms/chrp/Makefile | 2 arch/powerpc/platforms/chrp/nvram.c | 14 arch/powerpc/platforms/chrp/setup.c | 2 arch/powerpc/platforms/powermac/Makefile | 5 arch/powerpc/platforms/powermac/nvram.c | 9 arch/powerpc/platforms/powermac/setup.c | 3 arch/powerpc/platforms/pseries/nvram.c | 2 drivers/char/Kconfig | 13 drivers/char/Makefile | 6 drivers/char/generic_nvram.c | 174 ------ drivers/char/nvram.c | 742 ++++++++++++----------------- drivers/platform/x86/thinkpad_acpi.c | 20 drivers/scsi/Kconfig | 6 drivers/scsi/atari_scsi.c | 16 drivers/video/fbdev/controlfb.c | 4 drivers/video/fbdev/imsttfb.c | 7 drivers/video/fbdev/matrox/matroxfb_base.c | 4 drivers/video/fbdev/platinumfb.c | 4 drivers/video/fbdev/valkyriefb.c | 4 include/linux/nvram.h | 23 include/uapi/linux/pmu.h | 2 33 files changed, 986 insertions(+), 935 deletions(-)
WARNING: multiple messages have this Message-ID (diff)
From: Finn Thain <fthain@telegraphics.com.au> To: linux-kernel@vger.kernel.org, linux-m68k@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC v4 00/25] Re-use nvram module Date: Sun, 12 Jul 2015 20:25:27 +1000 [thread overview] Message-ID: <20150712102527.356151908@telegraphics.com.au> (raw) The generic NVRAM module, drivers/char/generic_nvram, implements a /dev/nvram misc device. It is used only by 32-bit PowerPC platforms and isn't generic enough to be more widely used. The RTC NVRAM module, drivers/char/nvram, also implements a /dev/nvram misc device. It is used by x86, ARM and m68k. The former module cannot be used on x86, ARM or m68k because it cannot co-exist with the latter module, partly due to the Kconfig logic. It is possible to modify the modules so that one kernel binary could have either, neither or both. However, automatically loading the appropriate module is then impossible; if both provide the char-major-10-144 alias then the wrong module will end up being loaded. Hence a multi-platform kernel binary needs a single generic nvram module with alias char-major-10-144. Therefore, drivers/char/nvram.c should be made more generic and the arch-specific code therein should be moved to a more appropriate place under arch/. Also, drivers/char/generic_nvram.c should be removed to reduce code duplication. In this patch series, Atari-specific code is moved from the nvram module to arch/m68k/atari. More arch-specific code in the nvram module could be moved, probably to arch/x86, but it is difficult to determine just what code is relevant to ARM platforms and what code is x86-only. In addressing code duplication, this patch series removes three inconsistent /dev/nvram misc device implementations. One of these, drivers/macintosh/nvram.c is entirely unused already. The other two, drivers/char/generic_nvram.c and the misc device implementation in arch/powerpc/kernel/nvram_64.c, are replaced by drivers/char/nvram.c. A benefit of this work is better consistency -- between PPC32 and PPC64 as well as between PPC_PMAC and MAC. This new uniformity does have implications for userspace, that is, some error codes for some ioctl calls become consistent on all PowerPC platforms. The drivers/char/nvram module becomes sufficiently generic to be useful to other platforms and architectures, besides those with "CMOS" RTC. At the end of this patch series the module is adopted by the m68k Mac port, which already has PRAM access functions but lacks the /dev/nvram misc device. This patch series has been compile-tested for arm, m68k, powerpc and x86. The nvram and thinkpad_acpi modules were regression tested on a ThinkPad T43. The /dev/nvram functionality was also regression tested on a G3 PowerMac. The nvram module was also tested on a PowerBook 520 and Quadra 650. Note that my testing doesn't cover PPC64 or Atari. Changes since v1: - Minor changes to patches 7, 15 and 20 as described in commit logs. - Revised patches 21 and 24 to address comments from Geert. Changes since v2: - Dropped patch 1, "macintosh/nvram: Remove as unused", because it has since been merged. - Inserted a new patch, "m68k/mac: Use macros for RTC accesses not magic numbers". - Revised patches 21 and 23 to address comments from Geert. Changes since v3: - Split the patch, "m68k/atari: Move Atari-specific code out of drivers/char/nvram.c", as suggested by Geert. - Revised patches 11 and 25 to address comments from Geert. - Minor change to patch 21 as described in commit log. --- arch/m68k/Kconfig | 3 arch/m68k/Kconfig.machine | 2 arch/m68k/atari/Makefile | 2 arch/m68k/atari/nvram.c | 291 +++++++++++ arch/m68k/include/asm/atarihw.h | 6 arch/m68k/include/asm/macintosh.h | 4 arch/m68k/kernel/setup_mm.c | 100 +++ arch/m68k/mac/misc.c | 207 +++++--- arch/powerpc/Kconfig | 5 arch/powerpc/include/asm/nvram.h | 9 arch/powerpc/kernel/nvram_64.c | 203 +------ arch/powerpc/kernel/setup_32.c | 27 - arch/powerpc/platforms/chrp/Makefile | 2 arch/powerpc/platforms/chrp/nvram.c | 14 arch/powerpc/platforms/chrp/setup.c | 2 arch/powerpc/platforms/powermac/Makefile | 5 arch/powerpc/platforms/powermac/nvram.c | 9 arch/powerpc/platforms/powermac/setup.c | 3 arch/powerpc/platforms/pseries/nvram.c | 2 drivers/char/Kconfig | 13 drivers/char/Makefile | 6 drivers/char/generic_nvram.c | 174 ------ drivers/char/nvram.c | 742 ++++++++++++----------------- drivers/platform/x86/thinkpad_acpi.c | 20 drivers/scsi/Kconfig | 6 drivers/scsi/atari_scsi.c | 16 drivers/video/fbdev/controlfb.c | 4 drivers/video/fbdev/imsttfb.c | 7 drivers/video/fbdev/matrox/matroxfb_base.c | 4 drivers/video/fbdev/platinumfb.c | 4 drivers/video/fbdev/valkyriefb.c | 4 include/linux/nvram.h | 23 include/uapi/linux/pmu.h | 2 33 files changed, 986 insertions(+), 935 deletions(-)
next reply other threads:[~2015-07-12 10:40 UTC|newest] Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-12 10:25 Finn Thain [this message] 2015-07-12 10:25 ` [RFC v4 00/25] Re-use nvram module Finn Thain 2015-07-12 10:25 ` [RFC v4 01/25] scsi/atari_scsi: Dont select CONFIG_NVRAM Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 02/25] char/nvram: Use bitwise OR to obtain Atari video mode data Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-13 18:13 ` Andreas Schwab 2015-07-13 18:13 ` Andreas Schwab 2015-07-14 8:17 ` Finn Thain 2015-07-14 8:23 ` Geert Uytterhoeven 2015-07-14 8:33 ` Andreas Schwab 2015-07-14 8:33 ` Andreas Schwab 2015-07-22 3:52 ` Michael Schmitz 2015-07-22 4:22 ` Finn Thain 2015-07-22 14:32 ` Christian T. Steigies 2015-07-22 23:46 ` Michael Schmitz 2015-07-23 0:49 ` Finn Thain 2015-07-23 9:21 ` Christian T. Steigies 2015-07-24 2:56 ` Michael Schmitz 2015-07-24 19:07 ` Christian T. Steigies 2015-07-25 0:35 ` Finn Thain 2015-07-25 1:00 ` Michael Ellerman 2015-07-25 7:38 ` Finn Thain 2015-07-26 1:37 ` Finn Thain 2015-07-25 0:51 ` Michael Schmitz 2015-07-25 7:27 ` Finn Thain 2015-07-26 1:02 ` Michael Schmitz 2015-07-26 1:19 ` Finn Thain 2015-07-27 2:23 ` Michael Schmitz 2015-07-27 5:51 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 04/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops Finn Thain 2015-07-12 10:25 ` [RFC v4 04/25] m68k/atari: Replace nvram_{read, write}_byte " Finn Thain 2015-07-12 10:25 ` [RFC v4 04/25] m68k/atari: Replace nvram_{read,write}_byte " Finn Thain 2015-07-12 10:25 ` [RFC v4 05/25] char/nvram: Re-order functions to remove forward declarations and #ifdefs Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 06/25] char/nvram: Adopt arch_nvram_ops Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 07/25] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 08/25] char/nvram: Allow the set_checksum and initialize ioctls to be omitted Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 09/25] char/nvram: Implement NVRAM read/write methods Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 10/25] char/nvram: Use generic fixed_size_llseek() Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 11/25] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 12/25] char/nvram: Add "devname:nvram" module alias Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 13/25] powerpc: Cleanup nvram includes Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 14/25] powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMac Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 15/25] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 16/25] powerpc: Implement nvram sync ioctl Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_wri Finn Thain 2015-07-12 10:25 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain 2015-07-14 7:58 ` Finn Thain 2015-07-14 7:58 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram Finn Thain 2015-07-14 11:52 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Benjamin Herrenschmidt 2015-07-14 11:52 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram Benjamin Herrenschmidt 2015-07-15 5:21 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain 2015-07-15 5:21 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram Finn Thain 2015-07-16 6:01 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain 2015-07-16 6:01 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram Finn Thain 2015-09-18 8:17 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain 2015-09-18 8:17 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram Finn Thain 2015-07-12 10:25 ` [RFC v4 18/25] nvram: Drop nvram_* symbol exports and prototypes Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 19/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 20/25] char/generic_nvram: Remove as unused Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 21/25] powerpc: Adopt nvram module for PPC64 Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 22/25] m68k/mac: Adopt naming and calling conventions for PRAM routines Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 23/25] m68k/mac: Use macros for RTC accesses not magic numbers Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 24/25] m68k/mac: Fix PRAM accessors Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` [RFC v4 25/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-12 10:25 ` Finn Thain 2015-07-13 7:55 ` [RFC v4 00/25] Re-use nvram module Geert Uytterhoeven 2015-07-14 7:57 ` Finn Thain
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20150712102527.356151908@telegraphics.com.au \ --to=fthain@telegraphics.com.au \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-m68k@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.