summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-07-07Merge tag 'arm-soc/for-4.8/soc-arm64-part2' of ↵Arnd Bergmann4-5/+30
http://github.com/Broadcom/stblinux into next/arm64 Merge "Broadcom ARM64-based SoC changes for 4.8 second part" from Florian Fainelli: - Eric updates the bcm2836 interrupt controller driver not to rely on ARM/Linux specific functions in preparation for using it on ARM64 - Eric also adds a Kconfig entry for the BCM2835 Raspberry Pi family in the ARM64 Kconfig.platforms file - Eric cherry picked a patch from Alexander Graf with Acks from ARM64 maintainers to support different DMA and bus offsets, required for the Raspberry Pi 3 SoC * tag 'arm-soc/for-4.8/soc-arm64-part2' of http://github.com/Broadcom/stblinux: arm64: Add platform selection for BCM2835. arm64: Allow for different DMA and CPU bus offsets irqchip: bcm2835: Avoid arch/arm-specific handle_IRQ
2016-07-07Merge tag 'mvebu-arm64-4.8-1' of git://git.infradead.org/linux-mvebu into ↵Arnd Bergmann1-0/+1
next/arm64 Merge "mvebu arm64 for 4.8" from Gregory CLEMENT: enable Armada 3700 clock drivers * tag 'mvebu-arm64-4.8-1' of git://git.infradead.org/linux-mvebu: arm64: marvell: enable Armada 3700 clock drivers
2016-07-07Merge tag 'renesas-arm64-defconfig-for-v4.8' of ↵Olof Johansson1-0/+1
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/arm64 Renesas ARM64 Based SoC Defconfig Updates for v4.8 * Enable Renesas R8A7796 SoC in ARM64 defcnfig * tag 'renesas-arm64-defconfig-for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: arm64: defconfig: enable Renesas R8A7796 SoC Signed-off-by: Olof Johansson <olof@lixom.net>
2016-07-06Merge tag 'bcm2835-arm64-next-2016-07-03' into soc-arm64/nextFlorian Fainelli4-5/+30
This pull request brings in the build support for the Raspberry Pi arm64 port. This has an external dependency on Jason Cooper's irqchip/bcm branch, it is a stable branch based on v4.7-rc1, and it has been in -next for a couple of weeks. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2016-07-05Merge tag 'qcom-arm64-defconfig-for-4.8' of ↵Olof Johansson1-0/+4
git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux into next/arm64 Qualcomm ARM64 Based defconfig Updates for v4.8 * Enable PM8xxx pwrkey support * Enable MSM8996 support * tag 'qcom-arm64-defconfig-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux: arm64: defconfig: enable msm8996 pinctrl support arm64: defconfig: Enable qcom msm8996 clk drivers arm: defconfig: Enable PM8941 pwr key Signed-off-by: Olof Johansson <olof@lixom.net>
2016-07-05Merge tag 'juno-defconfig-4.8' of ↵Olof Johansson1-0/+2
git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into next/arm64 ARMv8 Juno/Vexpress defconfig updates for v4.8 1. Enable support for SCPI based sensors(temperature, voltage, current and power) 2. Enable the Generic on-chip SRAM driver. SRAM is used for SCPI based communication with SCP on Juno * tag 'juno-defconfig-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux: arm64: defconfig: enable SENSORS_ARM_SCPI arm64: defconfig: enable Generic on-chip SRAM driver Signed-off-by: Olof Johansson <olof@lixom.net>
2016-07-05Merge tag 'mvebu-defconfig64-4.8-1' of git://git.infradead.org/linux-mvebu ↵Olof Johansson1-0/+1
into next/arm64 mvebu defconfig64 for 4.8 (part 1) - Enable the PCIe host controller found on the Armada 7K/8K SoCs * tag 'mvebu-defconfig64-4.8-1' of git://git.infradead.org/linux-mvebu: arm64: configs: enable PCIe driver for Armada 7K/8K Signed-off-by: Olof Johansson <olof@lixom.net>
2016-07-04arm64: marvell: enable Armada 3700 clock driversGregory CLEMENT1-0/+1
This patch enables the support for the clocks drivers used on the Armada 3700. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
2016-06-25arm64: defconfig: enable msm8996 pinctrl supportSrinivas Kandagatla1-0/+1
This patch enables pinctrl support required to boot msm8996/apq8096 boards. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
2016-06-25arm64: defconfig: Enable qcom msm8996 clk driversStephen Boyd1-0/+1
Enable the clk drivers on msm8996. This allows us to boot and test most device drivers on this SoC. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
2016-06-25arm: defconfig: Enable PM8941 pwr keyAndy Gross1-0/+2
This patch enables the PM8941 pwr key driver. Signed-off-by: Andy Gross <andy.gross@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-06-24arm64: defconfig: enable stmmac and realtek PHY as modulesKevin Hilman1-0/+2
Some Amlogic GXBB boards use the stmmac ethernet driver. Also, enable the realtek PHY used on meson-gxbb-odroidc2. The micrel PHY used on the meson-gxbb-p20x boards is already enabled. Signed-off-by: Kevin Hilman <khilman@baylibre.com>
2016-06-21arm64: Kconfig: select PM{,_GENERIC_DOMAINS} for ARCH_VEXPRESSSudeep Holla1-0/+2
The Linux AMBA bus framework probes the peripheral IDs when adding the AMBA devices very early on the boot. Generally they are on APB bus and just require APB clocks to be on even when most of the core logic of the IP is powered down. However on Juno, the entire debugsys domain needs to be ON to access even the coresight components' CID/PID registers and hence broken by design. Accessing those while debugsys power domain is off will lead to the bridge stalling the transactions instead of returning the slave error. Further, the AMBA framework can't deal with !CONFIG_PM_GENERIC_DOMAINS case: it ignores the error and proceeds to access the device region. It was suggested to always enable CONFIG_PM{,_GENERIC_DOMAINS} in order to handle above explained scenario. Cc: Arnd Bergmann <arnd@arndb.de> Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Olof Johansson <olof@lixom.net>
2016-06-20arm64: defconfig: enable SENSORS_ARM_SCPIJavi Merino1-0/+1
ARM SCPI Sensors were merged for v4.4 and they are defined in the Juno dts. Enable it in the defconfig to get them registered automatically in Juno by default. Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-06-20arm64: defconfig: enable Generic on-chip SRAM driverSudeep Holla1-0/+1
Most of the ARM SoCs have small SRAM memory used for various purposes that require faster access to data compared to normal DDR. This patch enables the Generic on-chip SRAM driver on ARM64. Cc: Kevin Hilman <khilman@kernel.org> Cc: Olof Johansson <olof@lixom.net> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-06-20Merge tag 'arm-soc/for-4.8/soc-arm64' of http://github.com/Broadcom/stblinux ↵Olof Johansson1-0/+1
into next/arm64 This pull request contains SoC changes for Broadcom ARM64-based SoCs: - Kamlakant updates the Broadcom Vulcan Kconfig entry with GPIOLIB to enable GPIO on these platforms * tag 'arm-soc/for-4.8/soc-arm64' of http://github.com/Broadcom/stblinux: arm64: vulcan: enable GPIOLIB in Kconfig Signed-off-by: Olof Johansson <olof@lixom.net>
2016-06-16arm64: configs: enable PCIe driver for Armada 7K/8KThomas Petazzoni1-0/+1
This patch enables the driver for the PCIe host controller found on the Marvell Armada 7K/8K ARM64 SoCs. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
2016-06-16arm64: Add platform selection for BCM2835.Eric Anholt1-0/+13
Signed-off-by: Eric Anholt <eric@anholt.net> [ kraxel: copy some selects from arm to arm64 ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
2016-06-15Merge remote-tracking branch 'irqchip/irqchip/bcm' into bcm2835-arm64-nextEric Anholt2-3/+2
Bring in the build fix for arm64 before we add BCM2835 arm64 to Kconfig/Makefiles.
2016-06-14Merge tag 'amlogic-soc' of ↵Olof Johansson1-0/+2
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic into next/arm64 Amlogic SoC changes for v4.8 * tag 'amlogic-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic: ARM64: Kconfig: Select the Amlogic Meson pin controller driver Signed-off-by: Olof Johansson <olof@lixom.net>
2016-06-14arm64: defconfig: disable plain NEON implementation of AESArd Biesheuvel1-1/+1
The plain NEON implementation of AES is only suited for v8 cores that lack the ARMv8 Crypto Extensions but have an implementation of the NEON tbl/tbx instruction that is not pathetically slow. Unfortunately, this is currently the empty set, so there is no point in including this implementation by default. So disable it. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Olof Johansson <olof@lixom.net>
2016-06-14Merge tag 'samsung-soc64-4.8' of ↵Olof Johansson1-0/+1
git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into next/arm64 Samsung arm64 update for v4.8: 1. Select drivers/soc/samsung. * tag 'samsung-soc64-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: arm64: exynos: Select SOC specific drivers Signed-off-by: Olof Johansson <olof@lixom.net>
2016-06-06arm64: Allow for different DMA and CPU bus offsetsAlexander Graf1-2/+15
On arm64, all SoCs we supported so far either have an IOMMU or have bus addresses equal to CPU addresses. However, with the Raspberry Pi 3 coming up, this is no longer true. To allow DMA to work with an AArch64 kernel on those devices, let's allow devices to have DMA offsets again. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Eric Anholt <eric@anholt.net>
2016-06-06arm64: defconfig: enable Renesas R8A7796 SoCTakeshi Kihara1-0/+1
This patch enables the Renesas R8A7796 SoC in the arm64 defconfig. Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
2016-06-04irqchip: bcm2835: Avoid arch/arm-specific handle_IRQEric Anholt2-3/+2
With commit 76ba59f8366f genirq: Add irq_domain-aware core IRQ handler architecture-specific irq handlers are no longer necessary. Update the bcm2835 irq driver to use the core irq handler. As a bonus, this allows the driver to support arm64 as well. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Link: https://lkml.kernel.org/r/1464728727-16300-1-git-send-email-eric@anholt.net [jac reworded commit message for clarity] Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2016-06-03arm64: defconfig: Enable Cadence MACB/GEM supportChanho Min1-0/+1
This patch enables the cadence MACB/GEM support that is needed by lg1k SoCs. Signed-off-by: Chanho Min <chanho.min@lge.com> Signed-off-by: Olof Johansson <olof@lixom.net>
2016-06-01ARM64: Kconfig: Select the Amlogic Meson pin controller driverCarlo Caione1-0/+2
Select the Meson pin controller driver also for the AArch64 Meson platform. Signed-off-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
2016-05-31arm64: vulcan: enable GPIOLIB in KconfigKamlakant Patel1-0/+1
Add select GPIOLIB in Kconfig for Broadcom Vulcan ARM64 GPIO driver. Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2016-05-30arm64: exynos: Select SOC specific driversKrzysztof Kozlowski1-0/+1
Recently some Exynos drivers were moved from arm/mach-exynos to drivers/soc. Building the directory depends on SOC_SAMSUNG Kconfig option so we want it also on ARMv8 platforms, even though none of the drivers support ARMv8 SoCs yet. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2016-05-29Linux 4.7-rc1Linus Torvalds1-3/+3
2016-05-29hash_string: Fix zero-length case for !DCACHE_WORD_ACCESSGeorge Spelvin1-2/+2
The self-test was updated to cover zero-length strings; the function needs to be updated, too. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: George Spelvin <linux@sciencehorizons.net> Fixes: fcfd2fbf22d2 ("fs/namei.c: Add hashlen_string() function") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-29Rename other copy of hash_string to hashlen_stringGeorge Spelvin1-2/+2
The original name was simply hash_string(), but that conflicted with a function with that name in drivers/base/power/trace.c, and I decided that calling it "hashlen_" was better anyway. But you have to do it in two places. [ This caused build errors for architectures that don't define CONFIG_DCACHE_WORD_ACCESS - Linus ] Signed-off-by: George Spelvin <linux@sciencehorizons.net> Reported-by: Guenter Roeck <linux@roeck-us.net> Fixes: fcfd2fbf22d2 ("fs/namei.c: Add hashlen_string() function") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-29hpfs: implement the show_options methodMikulas Patocka1-11/+32
The HPFS filesystem used generic_show_options to produce string that is displayed in /proc/mounts. However, there is a problem that the options may disappear after remount. If we mount the filesystem with option1 and then remount it with option2, /proc/mounts should show both option1 and option2, however it only shows option2 because the whole option string is replaced with replace_mount_options in hpfs_remount_fs. To fix this bug, implement the hpfs_show_options function that prints options that are currently selected. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-29affs: fix remount failure when there are no options changedMikulas Patocka1-2/+3
Commit c8f33d0bec99 ("affs: kstrdup() memory handling") checks if the kstrdup function returns NULL due to out-of-memory condition. However, if we are remounting a filesystem with no change to filesystem-specific options, the parameter data is NULL. In this case, kstrdup returns NULL (because it was passed NULL parameter), although no out of memory condition exists. The mount syscall then fails with ENOMEM. This patch fixes the bug. We fail with ENOMEM only if data is non-NULL. The patch also changes the call to replace_mount_options - if we didn't pass any filesystem-specific options, we don't call replace_mount_options (thus we don't erase existing reported options). Fixes: c8f33d0bec99 ("affs: kstrdup() memory handling") Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-29hpfs: fix remount failure when there are no options changedMikulas Patocka1-2/+3
Commit ce657611baf9 ("hpfs: kstrdup() out of memory handling") checks if the kstrdup function returns NULL due to out-of-memory condition. However, if we are remounting a filesystem with no change to filesystem-specific options, the parameter data is NULL. In this case, kstrdup returns NULL (because it was passed NULL parameter), although no out of memory condition exists. The mount syscall then fails with ENOMEM. This patch fixes the bug. We fail with ENOMEM only if data is non-NULL. The patch also changes the call to replace_mount_options - if we didn't pass any filesystem-specific options, we don't call replace_mount_options (thus we don't erase existing reported options). Fixes: ce657611baf9 ("hpfs: kstrdup() out of memory handling") Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-29Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linusLinus Torvalds67-258/+373
Pull more MIPS updates from Ralf Baechle: "This is the secondnd batch of MIPS patches for 4.7. Summary: CPS: - Copy EVA configuration when starting secondary VPs. EIC: - Clear Status IPL. Lasat: - Fix a few off by one bugs. lib: - Mark intrinsics notrace. Not only are the intrinsics uninteresting, it would cause infinite recursion. MAINTAINERS: - Add file patterns for MIPS BRCM device tree bindings. - Add file patterns for mips device tree bindings. MT7628: - Fix MT7628 pinmux typos. - wled_an pinmux gpio. - EPHY LEDs pinmux support. Pistachio: - Enable KASLR VDSO: - Build microMIPS VDSO for microMIPS kernels. - Fix aliasing warning by building with `-fno-strict-aliasing' for debugging but also tracing them might result in recursion. Misc: - Add missing FROZEN hotplug notifier transitions. - Fix clk binding example for varioius PIC32 devices. - Fix cpu interrupt controller node-names in the DT files. - Fix XPA CPU feature separation. - Fix write_gc0_* macros when writing zero. - Add inline asm encoding helpers. - Add missing VZ accessor microMIPS encodings. - Fix little endian microMIPS MSA encodings. - Add 64-bit HTW fields and fix its configuration. - Fix sigreturn via VDSO on microMIPS kernel. - Lots of typo fixes. - Add definitions of SegCtl registers and use them" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (49 commits) MIPS: Add missing FROZEN hotplug notifier transitions MIPS: Build microMIPS VDSO for microMIPS kernels MIPS: Fix sigreturn via VDSO on microMIPS kernel MIPS: devicetree: fix cpu interrupt controller node-names MIPS: VDSO: Build with `-fno-strict-aliasing' MIPS: Pistachio: Enable KASLR MIPS: lib: Mark intrinsics notrace MIPS: Fix 64-bit HTW configuration MIPS: Add 64-bit HTW fields MAINTAINERS: Add file patterns for mips device tree bindings MAINTAINERS: Add file patterns for mips brcm device tree bindings MIPS: Simplify DSP instruction encoding macros MIPS: Add missing tlbinvf/XPA microMIPS encodings MIPS: Fix little endian microMIPS MSA encodings MIPS: Add missing VZ accessor microMIPS encodings MIPS: Add inline asm encoding helpers MIPS: Spelling fix lets -> let's MIPS: VR41xx: Fix typo MIPS: oprofile: Fix typo MIPS: math-emu: Fix typo ...
2016-05-29fs: fix binfmt_aout.c build errorGuenter Roeck1-1/+0
Various builds (such as i386:allmodconfig) fail with fs/binfmt_aout.c:133:2: error: expected identifier or '(' before 'return' fs/binfmt_aout.c:134:1: error: expected identifier or '(' before '}' token [ Oops. My bad, I had stupidly thought that "allmodconfig" covered this on x86-64 too, but it obviously doesn't. Egg on my face. - Linus ] Fixes: 5d22fc25d4fc ("mm: remove more IS_ERR_VALUE abuses") Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-29Merge branch 'hash' of git://ftp.sciencehorizons.net/linuxLinus Torvalds17-150/+734
Pull string hash improvements from George Spelvin: "This series does several related things: - Makes the dcache hash (fs/namei.c) useful for general kernel use. (Thanks to Bruce for noticing the zero-length corner case) - Converts the string hashes in <linux/sunrpc/svcauth.h> to use the above. - Avoids 64-bit multiplies in hash_64() on 32-bit platforms. Two 32-bit multiplies will do well enough. - Rids the world of the bad hash multipliers in hash_32. This finishes the job started in commit 689de1d6ca95 ("Minimal fix-up of bad hashing behavior of hash_64()") The vast majority of Linux architectures have hardware support for 32x32-bit multiply and so derive no benefit from "simplified" multipliers. The few processors that do not (68000, h8/300 and some models of Microblaze) have arch-specific implementations added. Those patches are last in the series. - Overhauls the dcache hash mixing. The patch in commit 0fed3ac866ea ("namei: Improve hash mixing if CONFIG_DCACHE_WORD_ACCESS") was an off-the-cuff suggestion. Replaced with a much more careful design that's simultaneously faster and better. (My own invention, as there was noting suitable in the literature I could find. Comments welcome!) - Modify the hash_name() loop to skip the initial HASH_MIX(). This would let us salt the hash if we ever wanted to. - Sort out partial_name_hash(). The hash function is declared as using a long state, even though it's truncated to 32 bits at the end and the extra internal state contributes nothing to the result. And some callers do odd things: - fs/hfs/string.c only allocates 32 bits of state - fs/hfsplus/unicode.c uses it to hash 16-bit unicode symbols not bytes - Modify bytemask_from_count to handle inputs of 1..sizeof(long) rather than 0..sizeof(long)-1. This would simplify users other than full_name_hash" Special thanks to Bruce Fields for testing and finding bugs in v1. (I learned some humbling lessons about "obviously correct" code.) On the arch-specific front, the m68k assembly has been tested in a standalone test harness, I've been in contact with the Microblaze maintainers who mostly don't care, as the hardware multiplier is never omitted in real-world applications, and I haven't heard anything from the H8/300 world" * 'hash' of git://ftp.sciencehorizons.net/linux: h8300: Add <asm/hash.h> microblaze: Add <asm/hash.h> m68k: Add <asm/hash.h> <linux/hash.h>: Add support for architecture-specific functions fs/namei.c: Improve dcache hash function Eliminate bad hash multipliers from hash_32() and hash_64() Change hash_64() return value to 32 bits <linux/sunrpc/svcauth.h>: Define hash_str() in terms of hashlen_string() fs/namei.c: Add hashlen_string() function Pull out string hash to <linux/stringhash.h>
2016-05-28h8300: Add <asm/hash.h>George Spelvin2-0/+54
This will improve the performance of hash_32() and hash_64(), but due to complete lack of multi-bit shift instructions on H8, performance will still be bad in surrounding code. Designing H8-specific hash algorithms to work around that is a separate project. (But if the maintainers would like to get in touch...) Signed-off-by: George Spelvin <linux@sciencehorizons.net> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: uclinux-h8-devel@lists.sourceforge.jp
2016-05-28microblaze: Add <asm/hash.h>George Spelvin2-0/+82
Microblaze is an FPGA soft core that can be configured various ways. If it is configured without a multiplier, the standard __hash_32() will require a call to __mulsi3, which is a slow software loop. Instead, use a shift-and-add sequence for the constant multiply. GCC knows how to do this, but it's not as clever as some. Signed-off-by: George Spelvin <linux@sciencehorizons.net> Cc: Alistair Francis <alistair.francis@xilinx.com> Cc: Michal Simek <michal.simek@xilinx.com>
2016-05-28m68k: Add <asm/hash.h>George Spelvin2-0/+60
This provides a multiply by constant GOLDEN_RATIO_32 = 0x61C88647 for the original mc68000, which lacks a 32x32-bit multiply instruction. Yes, the amount of optimization effort put in is excessive. :-) Shift-add chain found by Yevgen Voronenko's Hcub algorithm at http://spiral.ece.cmu.edu/mcm/gen.html Signed-off-by: George Spelvin <linux@sciencehorizons.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greg Ungerer <gerg@linux-m68k.org> Cc: Andreas Schwab <schwab@linux-m68k.org> Cc: Philippe De Muyter <phdm@macq.eu> Cc: linux-m68k@lists.linux-m68k.org
2016-05-28<linux/hash.h>: Add support for architecture-specific functionsGeorge Spelvin6-4/+299
This is just the infrastructure; there are no users yet. This is modelled on CONFIG_ARCH_RANDOM; a CONFIG_ symbol declares the existence of <asm/hash.h>. That file may define its own versions of various functions, and define HAVE_* symbols (no CONFIG_ prefix!) to suppress the generic ones. Included is a self-test (in lib/test_hash.c) that verifies the basics. It is NOT in general required that the arch-specific functions compute the same thing as the generic, but if a HAVE_* symbol is defined with the value 1, then equality is tested. Signed-off-by: George Spelvin <linux@sciencehorizons.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greg Ungerer <gerg@linux-m68k.org> Cc: Andreas Schwab <schwab@linux-m68k.org> Cc: Philippe De Muyter <phdm@macq.eu> Cc: linux-m68k@lists.linux-m68k.org Cc: Alistair Francis <alistai@xilinx.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: uclinux-h8-devel@lists.sourceforge.jp
2016-05-28fs/namei.c: Improve dcache hash functionGeorge Spelvin1-40/+81
Patch 0fed3ac866 improved the hash mixing, but the function is slower than necessary; there's a 7-instruction dependency chain (10 on x86) each loop iteration. Word-at-a-time access is a very tight loop (which is good, because link_path_walk() is one of the hottest code paths in the entire kernel), and the hash mixing function must not have a longer latency to avoid slowing it down. There do not appear to be any published fast hash functions that: 1) Operate on the input a word at a time, and 2) Don't need to know the length of the input beforehand, and 3) Have a single iterated mixing function, not needing conditional branches or unrolling to distinguish different loop iterations. One of the algorithms which comes closest is Yann Collet's xxHash, but that's two dependent multiplies per word, which is too much. The key insights in this design are: 1) Barring expensive ops like multiplies, to diffuse one input bit across 64 bits of hash state takes at least log2(64) = 6 sequentially dependent instructions. That is more cycles than we'd like. 2) An operation like "hash ^= hash << 13" requires a second temporary register anyway, and on a 2-operand machine like x86, it's three instructions. 3) A better use of a second register is to hold a two-word hash state. With careful design, no temporaries are needed at all, so it doesn't increase register pressure. And this gets rid of register copying on 2-operand machines, so the code is smaller and faster. 4) Using two words of state weakens the requirement for one-round mixing; we now have two rounds of mixing before cancellation is possible. 5) A two-word hash state also allows operations on both halves to be done in parallel, so on a superscalar processor we get more mixing in fewer cycles. I ended up using a mixing function inspired by the ChaCha and Speck round functions. It is 6 simple instructions and 3 cycles per iteration (assuming multiply by 9 can be done by an "lea" instruction): x ^= *input++; y ^= x; x = ROL(x, K1); x += y; y = ROL(y, K2); y *= 9; Not only is this reversible, two consecutive rounds are reversible: if you are given the initial and final states, but not the intermediate state, it is possible to compute both input words. This means that at least 3 words of input are required to create a collision. (It also has the property, used by hash_name() to avoid a branch, that it hashes all-zero to all-zero.) The rotate constants K1 and K2 were found by experiment. The search took a sample of random initial states (I used 1023) and considered the effect of flipping each of the 64 input bits on each of the 128 output bits two rounds later. Each of the 8192 pairs can be considered a biased coin, and adding up the Shannon entropy of all of them produces a score. The best-scoring shifts also did well in other tests (flipping bits in y, trying 3 or 4 rounds of mixing, flipping all 64*63/2 pairs of input bits), so the choice was made with the additional constraint that the sum of the shifts is odd and not too close to the word size. The final state is then folded into a 32-bit hash value by a less carefully optimized multiply-based scheme. This also has to be fast, as pathname components tend to be short (the most common case is one iteration!), but there's some room for latency, as there is a fair bit of intervening logic before the hash value is used for anything. (Performance verified with "bonnie++ -s 0 -n 1536:-2" on tmpfs. I need a better benchmark; the numbers seem to show a slight dip in performance between 4.6.0 and this patch, but they're too noisy to quote.) Special thanks to Bruce fields for diligent testing which uncovered a nasty fencepost error in an earlier version of this patch. [checkpatch.pl formatting complaints noted and respectfully disagreed with.] Signed-off-by: George Spelvin <linux@sciencehorizons.net> Tested-by: J. Bruce Fields <bfields@redhat.com>
2016-05-28Eliminate bad hash multipliers from hash_32() and hash_64()George Spelvin2-53/+36
The "simplified" prime multipliers made very bad hash functions, so get rid of them. This completes the work of 689de1d6ca. To avoid the inefficiency which was the motivation for the "simplified" multipliers, hash_64() on 32-bit systems is changed to use a different algorithm. It makes two calls to hash_32() instead. drivers/media/usb/dvb-usb-v2/af9015.c uses the old GOLDEN_RATIO_PRIME_32 for some horrible reason, so it inherits a copy of the old definition. Signed-off-by: George Spelvin <linux@sciencehorizons.net> Cc: Antti Palosaari <crope@iki.fi> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
2016-05-28Change hash_64() return value to 32 bitsGeorge Spelvin1-3/+3
That's all that's ever asked for, and it makes the return type of hash_long() consistent. It also allows (upcoming patch) an optimized implementation of hash_64 on 32-bit machines. I tried adding a BUILD_BUG_ON to ensure the number of bits requested was never more than 32 (most callers use a compile-time constant), but adding <linux/bug.h> to <linux/hash.h> breaks the tools/perf compiler unless tools/perf/MANIFEST is updated, and understanding that code base well enough to update it is too much trouble. I did the rest of an allyesconfig build with such a check, and nothing tripped. Signed-off-by: George Spelvin <linux@sciencehorizons.net>
2016-05-28<linux/sunrpc/svcauth.h>: Define hash_str() in terms of hashlen_string()George Spelvin1-31/+9
Finally, the first use of previous two patches: eliminate the separate ad-hoc string hash functions in the sunrpc code. Now hash_str() is a wrapper around hash_string(), and hash_mem() is likewise a wrapper around full_name_hash(). Note that sunrpc code *does* call hash_mem() with a zero length, which is why the previous patch needed to handle that in full_name_hash(). (Thanks, Bruce, for finding that!) This also eliminates the only caller of hash_long which asks for more than 32 bits of output. The comment about the quality of hashlen_string() and full_name_hash() is jumping the gun by a few patches; they aren't very impressive now, but will be improved greatly later in the series. Signed-off-by: George Spelvin <linux@sciencehorizons.net> Tested-by: J. Bruce Fields <bfields@redhat.com> Acked-by: J. Bruce Fields <bfields@redhat.com> Cc: Jeff Layton <jlayton@poochiereds.net> Cc: linux-nfs@vger.kernel.org
2016-05-28fs/namei.c: Add hashlen_string() functionGeorge Spelvin3-9/+53
We'd like to make more use of the highly-optimized dcache hash functions throughout the kernel, rather than have every subsystem create its own, and a function that hashes basic null-terminated strings is required for that. (The name is to emphasize that it returns both hash and length.) It's actually useful in the dcache itself, specifically d_alloc_name(). Other uses in the next patch. full_name_hash() is also tweaked to make it more generally useful: 1) Take a "char *" rather than "unsigned char *" argument, to be consistent with hash_name(). 2) Handle zero-length inputs. If we want more callers, we don't want to make them worry about corner cases. Signed-off-by: George Spelvin <linux@sciencehorizons.net>
2016-05-28Pull out string hash to <linux/stringhash.h>George Spelvin2-26/+73
... so they can be used without the rest of <linux/dcache.h> The hashlen_* macros will make sense next patch. Signed-off-by: George Spelvin <linux@sciencehorizons.net>
2016-05-28Merge branch 'i2c/for-next' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c fix from Wolfram Sang: "A fix for a regression introduced yesterday. The regression didn't show up here locally because I did not have PAGE_POISONING enabled. And buildbots discovered this only after it hit your tree. Thanks to Dan for the quick response" * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: dev: use after free in detach
2016-05-28Merge tag 'chrome-platform' of ↵Linus Torvalds9-17/+234
git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform Pull chrome platform updates from Olof Johansson "A handful of Chrome driver and binding changes this merge window: - a few patches to fix probing and configuration of pstore - a few patches adding Elan touchpad registration on a few devices - EC changes: a security fix dealing with max message sizes and addition of compat_ioctl support. - keyboard backlight control support There was also an accidential duplicate registration of trackpads on 'Leon', which was reverted just recently" * tag 'chrome-platform' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform: Revert "platform/chrome: chromeos_laptop: Add Leon Touch" platform/chrome: chromeos_laptop - Add Elan touchpad for Wolf platform/chrome: chromeos_laptop - Add elan trackpad option for C720 platform/chrome: cros_ec_dev - Populate compat_ioctl platform/chrome: cros_ec_lightbar - use name instead of ID to hide lightbar attributes platform/chrome: cros_ec_dev - Fix security issue platform/chrome: Add Chrome OS keyboard backlight LEDs support platform/chrome: use to_platform_device() platform/chrome: pstore: Move to larger record size. platform/chrome: pstore: probe for ramoops buffer using acpi platform/chrome: chromeos_laptop: Add Leon Touch