linux/drivers
Stephen Boyd a098ecd2fa firmware: support loading into a pre-allocated buffer
Some systems are memory constrained but they need to load very large
firmwares.  The firmware subsystem allows drivers to request this
firmware be loaded from the filesystem, but this requires that the
entire firmware be loaded into kernel memory first before it's provided
to the driver.  This can lead to a situation where we map the firmware
twice, once to load the firmware into kernel memory and once to copy the
firmware into the final resting place.

This creates needless memory pressure and delays loading because we have
to copy from kernel memory to somewhere else.  Let's add a
request_firmware_into_buf() API that allows drivers to request firmware
be loaded directly into a pre-allocated buffer.  This skips the
intermediate step of allocating a buffer in kernel memory to hold the
firmware image while it's read from the filesystem.  It also requires
that drivers know how much memory they'll require before requesting the
firmware and negates any benefits of firmware caching because the
firmware layer doesn't manage the buffer lifetime.

For a 16MB buffer, about half the time is spent performing a memcpy from
the buffer to the final resting place.  I see loading times go from
0.081171 seconds to 0.047696 seconds after applying this patch.  Plus
the vmalloc pressure is reduced.

This is based on a patch from Vikram Mulukutla on codeaurora.org:
  https://www.codeaurora.org/cgit/quic/la/kernel/msm-3.18/commit/drivers/base/firmware_class.c?h=rel/msm-3.18&id=0a328c5f6cd999f5c591f172216835636f39bcb5

Link: http://lkml.kernel.org/r/20160607164741.31849-4-stephen.boyd@linaro.org
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Vikram Mulukutla <markivx@codeaurora.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Ming Lei <ming.lei@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-02 19:35:10 -04:00
..
accessibility
acpi treewide: replace obsolete _refok by __ref 2016-08-02 17:31:41 -04:00
amba
android
ata New LED class driver: 2016-07-27 14:03:52 -07:00
atm drivers: atm: nicstar: Use the correct function to free some resources 2016-07-19 11:30:26 -07:00
auxdisplay
base firmware: support loading into a pre-allocated buffer 2016-08-02 19:35:10 -04:00
bcma wireless-drivers-next patches for 4.8 2016-07-25 11:09:19 -07:00
block dynamic_debug: only add header when used 2016-08-02 19:35:03 -04:00
bluetooth Bluetooth: btmrvl: reset is_suspending flag in failure path 2016-07-18 10:13:02 +02:00
bus ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
cdrom cdrom: support read sub-channel command in LBA format 2016-07-12 08:24:50 -07:00
char Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
clk treewide: replace obsolete _refok by __ref 2016-08-02 17:31:41 -04:00
clocksource ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
connector
cpufreq ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
cpuidle powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-08-01 14:28:42 -04:00
dax
dca
devfreq
dio
dma dmaengine updates for 4.8-rc1 2016-07-28 15:45:17 -07:00
dma-buf dma-buf: Release module reference on creation failure 2016-07-18 14:10:49 +02:00
edac * Altera Arria10 ethernet FIFO buffer support (Thor Thayer) 2016-07-27 13:40:47 -07:00
eisa
extcon
firewire
firmware ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
fmc
fpga
gpio This is the bulk of GPIO changes for the v4.8 kernel cycle. 2016-07-26 19:16:01 -07:00
gpu Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
hid Merge branch 'for-4.8/hid-led' into for-linus 2016-07-28 10:49:23 +02:00
hsi
hv
hwmon hwmon updates for v4.8 (take 2) 2016-08-01 16:49:13 -04:00
hwspinlock
hwtracing Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
i2c powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
ide Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide 2016-07-29 13:29:06 -07:00
idle Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-30 12:56:26 -07:00
iio Third set of IIO new device support, features and cleanups for the 4.8 cycle. 2016-07-14 12:05:29 +09:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-07-24 00:53:32 -04:00
input ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
iommu IOMMU Updates for Linux v4.8 2016-08-01 07:25:10 -04:00
ipack
irqchip ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
isdn
leds powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
lguest
lightnvm block: get rid of bio_rw and READA 2016-07-20 17:37:01 -06:00
macintosh powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
mailbox mailbox: Fix format and type mismatches in Broadcom PDC driver 2016-07-28 21:27:31 +05:30
mcb
md Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md 2016-07-28 18:04:39 -07:00
media Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
memory ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
memstick memstick: don't allocate unused major for ms_block 2016-08-02 17:31:41 -04:00
message
mfd ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
misc powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
mmc MMC core: 2016-07-31 21:36:58 -04:00
mtd powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
net Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
nfc NFC 4.8 pull request 2016-07-20 23:39:36 -07:00
ntb
nubus
nvdimm libnvdimm for 4.8 2016-07-28 17:38:16 -07:00
nvme Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block 2016-07-26 15:37:51 -07:00
nvmem
of powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
oprofile
parisc
parport
pci treewide: replace obsolete _refok by __ref 2016-08-02 17:31:41 -04:00
pcmcia
perf Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
phy MMC core: 2016-07-31 21:36:58 -04:00
pinctrl This is the bulk of pin control changes for the v4.8 kernel cycle. 2016-07-28 17:06:51 -07:00
platform Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
pnp PNP material for v4.8-rc1 2016-07-26 18:27:20 -07:00
power ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
powercap
pps pps: do not crash when failed to register 2016-07-23 10:25:54 +09:00
ps3
ptp
pwm ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
rapidio
ras
regulator ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
remoteproc remoteproc: qcom: hexagon: Clean up mpss validation 2016-07-14 20:11:36 -07:00
reset
rpmsg
rtc
s390 s390/zcrypt: fix possible memory leak in ap_module_init() 2016-07-31 06:10:41 -04:00
sbus
scsi powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
sfi
sh
sn
soc ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
spi ARM: DT updates for v4.8 2016-08-01 18:37:45 -04:00
spmi
ssb
staging Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
target Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-07-27 12:03:20 -07:00
tc
thermal
thunderbolt
tty ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
uio
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2016-07-28 14:30:16 -07:00
uwb
vfio vfio: platform: check reset call return code during release 2016-07-19 10:54:45 -06:00
vhost
video fbdev/bfin_adv7393fb: move DRIVER_NAME before its first use 2016-08-02 19:35:05 -04:00
virt
virtio mm: fix build warnings in <linux/compaction.h> 2016-07-26 16:19:19 -07:00
vlynq
vme
w1
watchdog watchdog: gpio_wdt: Fix missing platform_set_drvdata() in gpio_wdt_probe() 2016-07-27 10:47:43 +02:00
xen xen: features and fixes for 4.8-rc0 2016-07-27 11:35:37 -07:00
zorro
Kconfig
Makefile HSI changes for the v4.8 series 2016-07-27 15:18:53 -07:00