mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
kernel bump to 4.9.186, 4.14.134, 4.19.62
This commit is contained in:
parent
540c4ab1e9
commit
95d74fb479
@ -6,13 +6,13 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
LINUX_VERSION-4.9 = .184
|
||||
LINUX_VERSION-4.14 = .131
|
||||
LINUX_VERSION-4.19 = .56
|
||||
LINUX_VERSION-4.9 = .186
|
||||
LINUX_VERSION-4.14 = .134
|
||||
LINUX_VERSION-4.19 = .62
|
||||
|
||||
LINUX_KERNEL_HASH-4.9.184 = 033114d5350525dede995d31b596c31b0e26db8d77a0a1c53d36cdc36ead9faf
|
||||
LINUX_KERNEL_HASH-4.14.131 = 19f6404c30f4a9a1fe3315b902676b6d63a470be5d55cf2a0e47983c643c8ff5
|
||||
LINUX_KERNEL_HASH-4.19.56 = 7326943215b9496f302e95892457a63d9a77e0446e99dd7bade6b425bc966bdf
|
||||
LINUX_KERNEL_HASH-4.9.186 = 242484430d0729791d8efd92181b7d34b4021050646c6e00cf459866eab94b6a
|
||||
LINUX_KERNEL_HASH-4.14.134 = 0b21e7b5effd92303a551b5be2380c9703d6fb87cfe5189fe0d795cc73903d2d
|
||||
LINUX_KERNEL_HASH-4.19.62 = 07be647189ced7eb8ba5ee769906e67919975772184842cc517f609df50cdadc
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
@ -20,7 +20,7 @@ ath9k_eeprom_extract() {
|
||||
[ -n "$mtd" ] || \
|
||||
ath9k_eeprom_die "no mtd device found for partition $part"
|
||||
|
||||
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
||||
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
||||
ath9k_eeprom_die "failed to extract from $mtd"
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ ath9k_ubi_eeprom_extract() {
|
||||
[ -n "$ubi" ] || \
|
||||
ath9k_eeprom_die "no UBI volume found for $part"
|
||||
|
||||
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
||||
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
||||
ath9k_eeprom_die "failed to extract from $ubi"
|
||||
}
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
BOARD=$(board_name)
|
||||
|
||||
if [ $BOARD == "netgear,wndr4700" ]; then
|
||||
case "$ACTION" in
|
||||
released)
|
||||
rmmod dwc2
|
||||
;;
|
||||
pressed)
|
||||
modprobe dwc2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return 0
|
@ -22,7 +22,7 @@ platform_do_upgrade() {
|
||||
|
||||
case "$board" in
|
||||
wd,mybooklive)
|
||||
mbl_do_upgrade "$ARGV"
|
||||
mbl_do_upgrade "$1"
|
||||
;;
|
||||
meraki,mr24|\
|
||||
meraki,mx60|\
|
||||
@ -32,7 +32,7 @@ platform_do_upgrade() {
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
*)
|
||||
default_do_upgrade "$ARGV"
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ mbl_do_platform_check() {
|
||||
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
export_bootdevice && export_partdevice diskdev -2 || {
|
||||
export_bootdevice && export_partdevice diskdev 0 || {
|
||||
echo "Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
@ -36,7 +36,7 @@ mbl_do_platform_check() {
|
||||
mbl_do_upgrade() {
|
||||
local diskdev partdev diff
|
||||
|
||||
export_bootdevice && export_partdevice diskdev -2 || {
|
||||
export_bootdevice && export_partdevice diskdev 0 || {
|
||||
echo "Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
@ -70,10 +70,6 @@ mbl_do_upgrade() {
|
||||
|
||||
#iterate over each partition from the image and write it to the boot disk
|
||||
while read part start size; do
|
||||
# root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem
|
||||
# one of which is this offset, I'm not sure what's the best fix, so
|
||||
# here's a WA.
|
||||
let part=$((part - 2))
|
||||
if export_partdevice partdev $part; then
|
||||
echo "Writing image to /dev/$partdev..."
|
||||
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
|
||||
@ -90,8 +86,7 @@ mbl_do_upgrade() {
|
||||
mbl_copy_config() {
|
||||
local partdev
|
||||
|
||||
# Same as above /dev/sd[a|b]2 is root, so /boot is -1
|
||||
if export_partdevice partdev -1; then
|
||||
if export_partdevice partdev 1; then
|
||||
mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
|
||||
cp -af "$CONF_TAR" /mnt/
|
||||
umount /mnt
|
||||
|
@ -54,9 +54,10 @@ CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
CONFIG_CONSISTENT_SIZE=0x00200000
|
||||
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
|
||||
CONFIG_CPU_BIG_ENDIAN=y
|
||||
CONFIG_CRC16=y
|
||||
# CONFIG_CRC32_SARWATE is not set
|
||||
CONFIG_CRC32_SLICEBY8=y
|
||||
CONFIG_CRYPTO_ACOMP2=y
|
||||
CONFIG_CRYPTO_AEAD=y
|
||||
CONFIG_CRYPTO_AEAD2=y
|
||||
@ -212,6 +213,7 @@ CONFIG_LZO_DECOMPRESS=y
|
||||
# CONFIG_MATH_EMULATION is not set
|
||||
CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MIGRATION=y
|
||||
# CONFIG_MMIO_NVRAM is not set
|
||||
CONFIG_MODULES_USE_ELF_RELA=y
|
||||
# CONFIG_MPIC is not set
|
||||
@ -321,7 +323,6 @@ CONFIG_PPC_WERROR=y
|
||||
# CONFIG_PPC_XIVE is not set
|
||||
# CONFIG_PPC_XIVE_SPAPR is not set
|
||||
# CONFIG_PQ2ADS is not set
|
||||
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13
|
||||
CONFIG_PTE_64BIT=y
|
||||
# CONFIG_RAINIER is not set
|
||||
CONFIG_RAS=y
|
||||
|
@ -60,6 +60,8 @@ CONFIG_CONSISTENT_SIZE=0x00200000
|
||||
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
|
||||
CONFIG_CPU_BIG_ENDIAN=y
|
||||
CONFIG_CRC16=y
|
||||
# CONFIG_CRC32_SARWATE is not set
|
||||
CONFIG_CRC32_SLICEBY8=y
|
||||
CONFIG_CRYPTO_ACOMP2=y
|
||||
CONFIG_CRYPTO_AEAD=y
|
||||
CONFIG_CRYPTO_AEAD2=y
|
||||
|
@ -253,8 +253,6 @@
|
||||
reg = <00000003 00000000 00002000>;
|
||||
ccr = <0x00001000>;
|
||||
bank-settings = <0x80002222>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
status = "disabled";
|
||||
|
||||
nand {
|
||||
|
@ -50,9 +50,6 @@
|
||||
status = "okay";
|
||||
/* 32 MiB NAND Flash */
|
||||
nand {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x00000000 0x00150000>;
|
||||
@ -129,7 +126,7 @@
|
||||
};
|
||||
|
||||
&POB0 {
|
||||
gpio-leds {
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
status: power-green {
|
||||
@ -168,18 +165,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys_polled {
|
||||
compatible = "gpio-keys-polled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
poll-interval = <60>; /* 3 * 20 = 60ms */
|
||||
autorepeat;
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
/* Label as per Meraki's "MR24 Installation Guide" */
|
||||
label = "Factory Reset Button";
|
||||
linux,code = <KEY_RESTART>;
|
||||
interrupt-parent = <&UIC1>;
|
||||
interrupts = <0x15 IRQ_TYPE_EDGE_FALLING>;
|
||||
gpios = <&GPIO0 16 GPIO_ACTIVE_LOW>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -53,9 +53,6 @@
|
||||
ndfc@1,0 {
|
||||
status = "okay";
|
||||
nand {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x00000000 0x00100000>;
|
||||
@ -103,6 +100,8 @@
|
||||
phy0: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-id004d.d034";
|
||||
reg = <0>;
|
||||
qca,mib-poll-interval = <500>;
|
||||
|
||||
qca,ar8327-initvals = <
|
||||
0x0010 0x40000000
|
||||
0x0624 0x007f7f7f
|
||||
@ -115,7 +114,7 @@
|
||||
};
|
||||
|
||||
&POB0 {
|
||||
gpio-leds {
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
status: power-green {
|
||||
@ -159,17 +158,16 @@
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys_polled {
|
||||
compatible = "gpio-keys-polled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
poll-interval = <60>; /* 3 * 20 = 60ms */
|
||||
autorepeat;
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "Reset button";
|
||||
linux,code = <KEY_RESTART>;
|
||||
gpios = <&GPIO0 16 GPIO_ACTIVE_LOW>;
|
||||
interrupt-parent = <&UIC1>;
|
||||
interrupts = <0x15 IRQ_TYPE_EDGE_FALLING>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -39,9 +39,6 @@
|
||||
status = "okay";
|
||||
/* 32 MiB SLC NAND Flash */
|
||||
nand {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x00000000 0x00100000>;
|
||||
@ -125,24 +122,20 @@
|
||||
};
|
||||
|
||||
&POB0 {
|
||||
gpio_keys_polled {
|
||||
compatible = "gpio-keys-polled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#interrupt-cells = <2>;
|
||||
poll-interval = <60>; /* 3 * 20 = 60ms */
|
||||
autorepeat;
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "Reset Button";
|
||||
gpios = <&GPIO0 16 GPIO_ACTIVE_HIGH>;
|
||||
gpios = <&GPIO0 16 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
interrupt-parent = <&UIC1>;
|
||||
interrupts = <0x15 IRQ_TYPE_EDGE_FALLING>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
};
|
||||
|
||||
LEDS: gpio-leds {
|
||||
LEDS: leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
status: power {
|
||||
|
@ -157,9 +157,6 @@
|
||||
status = "okay";
|
||||
/* 128 MiB Nand Flash */
|
||||
nand {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition0,0@0 {
|
||||
label = "NAND 128MiB 3,3V 8-bit";
|
||||
reg = <0x00000000 0x08000000>;
|
||||
@ -296,6 +293,8 @@
|
||||
phy0: ethernet-phy@0 {
|
||||
device_type = "ethernet-phy";
|
||||
reg = <0>;
|
||||
qca,mib-poll-interval = <500>;
|
||||
|
||||
qca,ar8327-initvals = <
|
||||
0x0010 0x40000000
|
||||
0x0624 0x007f7f7f
|
||||
@ -308,54 +307,48 @@
|
||||
};
|
||||
|
||||
&POB0 {
|
||||
gpio_keys_polled {
|
||||
compatible = "gpio-keys-polled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#interrupt-cells = <2>;
|
||||
autorepeat;
|
||||
poll-interval = <60>; /* 3 * 20 = 60ms */
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "Reset button";
|
||||
gpios = <&GPIO0 15 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
gpios = <&GPIO0 15 GPIO_ACTIVE_HIGH>;
|
||||
interrupt-parent = <&UIC1>;
|
||||
interrupts = <0x14 IRQ_TYPE_EDGE_FALLING>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
|
||||
backup_hd {
|
||||
label = "Backup HD button";
|
||||
gpios = <&GPIO0 19 GPIO_ACTIVE_HIGH>;
|
||||
gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <BTN_0>;
|
||||
interrupt-parent = <&UIC1>;
|
||||
interrupts = <0x1e IRQ_TYPE_EDGE_FALLING>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
|
||||
rfkill {
|
||||
label = "RFKILL button";
|
||||
gpios = <&GPIO0 20 GPIO_ACTIVE_HIGH>;
|
||||
gpios = <&GPIO0 20 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RFKILL>;
|
||||
interrupt-parent = <&UIC1>;
|
||||
interrupts = <0x1f IRQ_TYPE_EDGE_FALLING>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
|
||||
wps {
|
||||
label = "WPS button";
|
||||
gpios = <&GPIO0 23 GPIO_ACTIVE_HIGH>;
|
||||
gpios = <&GPIO0 23 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_WPS_BUTTON>;
|
||||
interrupt-parent = <&UIC2>;
|
||||
interrupts = <0x19 IRQ_TYPE_EDGE_FALLING>;
|
||||
};
|
||||
|
||||
sdcard {
|
||||
label = "SDCard inserted";
|
||||
gpios = <&GPIO0 7 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <BTN_1>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
};
|
||||
|
||||
gpio-leds {
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
status: power-green {
|
||||
label = "wndr4700:green:power";
|
||||
|
@ -40,19 +40,19 @@
|
||||
reg = <0x00000000 0x0001e000>;
|
||||
};
|
||||
|
||||
partition@1 {
|
||||
partition@1e000 {
|
||||
label = "env";
|
||||
reg = <0x0001e000 0x00002000>;
|
||||
};
|
||||
|
||||
partition@2 {
|
||||
partition@20000 {
|
||||
label = "uboot";
|
||||
reg = <0x00020000 0x00050000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
GPIO1: gpio1@e0000000 {
|
||||
GPIO1: gpio@e0000000 {
|
||||
compatible = "wd,mbl-gpio", "ti,74273";
|
||||
reg-names = "dat";
|
||||
reg = <0xe0000000 0x1>;
|
||||
@ -77,7 +77,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
GPIO2: gpio2@e0100000 {
|
||||
GPIO2: gpio@e0100000 {
|
||||
compatible = "wd,mbl-gpio", "ti,74244";
|
||||
reg-names = "dat";
|
||||
reg = <0xe0100000 0x1>;
|
||||
@ -86,7 +86,7 @@
|
||||
no-output;
|
||||
};
|
||||
|
||||
gpio-leds {
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
failsafe: power-red {
|
||||
@ -107,10 +107,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
keys {
|
||||
compatible = "gpio-keys-polled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
poll-interval = <60>; /* 3 * 20 = 60ms */
|
||||
autorepeat;
|
||||
|
||||
|
@ -226,6 +226,7 @@ ifeq ($(SUBTARGET),sata)
|
||||
define Device/wd_mybooklive
|
||||
DEVICE_TITLE := Western Digital My Book Live Series (Single + Duo)
|
||||
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-basic
|
||||
DEVICE_TYPE := nas
|
||||
DEVICE_DTS := wd-mybooklive
|
||||
SUPPORTED_DEVICES += mbl wd,mybooklive-duo
|
||||
BLOCKSIZE := 1k
|
||||
@ -233,7 +234,7 @@ define Device/wd_mybooklive
|
||||
KERNEL := kernel-bin | dtb | gzip | uImage gzip
|
||||
KERNEL_INITRAMFS := kernel-bin | gzip | dtb | MuImage-initramfs gzip
|
||||
IMAGES := factory.img.gz kernel.dtb sysupgrade.img.gz
|
||||
ARTIFACTS := kernel.dtb
|
||||
ARTIFACTS := apollo3g.dtb
|
||||
DEVICE_DTB := apollo3g.dtb
|
||||
FILESYSTEMS := ext4 squashfs
|
||||
IMAGE/factory.img.gz := boot-script | boot-img | hdd-img | gzip
|
||||
|
@ -0,0 +1,447 @@
|
||||
From 6396bb221514d2876fd6dc0aa2a1f240d99b37bb Mon Sep 17 00:00:00 2001
|
||||
From: Kees Cook <keescook@chromium.org>
|
||||
Date: Tue, 12 Jun 2018 14:03:40 -0700
|
||||
Subject: [PATCH 01/15] treewide: kzalloc() -> kcalloc()
|
||||
|
||||
The kzalloc() function has a 2-factor argument form, kcalloc(). This
|
||||
patch replaces cases of:
|
||||
|
||||
kzalloc(a * b, gfp)
|
||||
|
||||
with:
|
||||
kcalloc(a * b, gfp)
|
||||
|
||||
as well as handling cases of:
|
||||
|
||||
kzalloc(a * b * c, gfp)
|
||||
|
||||
with:
|
||||
|
||||
kzalloc(array3_size(a, b, c), gfp)
|
||||
|
||||
as it's slightly less ugly than:
|
||||
|
||||
kzalloc_array(array_size(a, b), c, gfp)
|
||||
|
||||
This does, however, attempt to ignore constant size factors like:
|
||||
|
||||
kzalloc(4 * 1024, gfp)
|
||||
|
||||
though any constants defined via macros get caught up in the conversion.
|
||||
|
||||
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
|
||||
dropped, since they're redundant.
|
||||
|
||||
The Coccinelle script used for this was:
|
||||
|
||||
// Fix redundant parens around sizeof().
|
||||
@@
|
||||
type TYPE;
|
||||
expression THING, E;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(
|
||||
- (sizeof(TYPE)) * E
|
||||
+ sizeof(TYPE) * E
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (sizeof(THING)) * E
|
||||
+ sizeof(THING) * E
|
||||
, ...)
|
||||
)
|
||||
|
||||
// Drop single-byte sizes and redundant parens.
|
||||
@@
|
||||
expression COUNT;
|
||||
typedef u8;
|
||||
typedef __u8;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(
|
||||
- sizeof(u8) * (COUNT)
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(__u8) * (COUNT)
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(char) * (COUNT)
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(unsigned char) * (COUNT)
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(u8) * COUNT
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(__u8) * COUNT
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(char) * COUNT
|
||||
+ COUNT
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(unsigned char) * COUNT
|
||||
+ COUNT
|
||||
, ...)
|
||||
)
|
||||
|
||||
// 2-factor product with sizeof(type/expression) and identifier or constant.
|
||||
@@
|
||||
type TYPE;
|
||||
expression THING;
|
||||
identifier COUNT_ID;
|
||||
constant COUNT_CONST;
|
||||
@@
|
||||
|
||||
(
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(TYPE) * (COUNT_ID)
|
||||
+ COUNT_ID, sizeof(TYPE)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(TYPE) * COUNT_ID
|
||||
+ COUNT_ID, sizeof(TYPE)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(TYPE) * (COUNT_CONST)
|
||||
+ COUNT_CONST, sizeof(TYPE)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(TYPE) * COUNT_CONST
|
||||
+ COUNT_CONST, sizeof(TYPE)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(THING) * (COUNT_ID)
|
||||
+ COUNT_ID, sizeof(THING)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(THING) * COUNT_ID
|
||||
+ COUNT_ID, sizeof(THING)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(THING) * (COUNT_CONST)
|
||||
+ COUNT_CONST, sizeof(THING)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(THING) * COUNT_CONST
|
||||
+ COUNT_CONST, sizeof(THING)
|
||||
, ...)
|
||||
)
|
||||
|
||||
// 2-factor product, only identifiers.
|
||||
@@
|
||||
identifier SIZE, COUNT;
|
||||
@@
|
||||
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- SIZE * COUNT
|
||||
+ COUNT, SIZE
|
||||
, ...)
|
||||
|
||||
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
|
||||
// redundant parens removed.
|
||||
@@
|
||||
expression THING;
|
||||
identifier STRIDE, COUNT;
|
||||
type TYPE;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(
|
||||
- sizeof(TYPE) * (COUNT) * (STRIDE)
|
||||
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(TYPE) * (COUNT) * STRIDE
|
||||
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(TYPE) * COUNT * (STRIDE)
|
||||
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(TYPE) * COUNT * STRIDE
|
||||
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(THING) * (COUNT) * (STRIDE)
|
||||
+ array3_size(COUNT, STRIDE, sizeof(THING))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(THING) * (COUNT) * STRIDE
|
||||
+ array3_size(COUNT, STRIDE, sizeof(THING))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(THING) * COUNT * (STRIDE)
|
||||
+ array3_size(COUNT, STRIDE, sizeof(THING))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(THING) * COUNT * STRIDE
|
||||
+ array3_size(COUNT, STRIDE, sizeof(THING))
|
||||
, ...)
|
||||
)
|
||||
|
||||
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
|
||||
@@
|
||||
expression THING1, THING2;
|
||||
identifier COUNT;
|
||||
type TYPE1, TYPE2;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(
|
||||
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
|
||||
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
|
||||
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(THING1) * sizeof(THING2) * COUNT
|
||||
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(THING1) * sizeof(THING2) * (COUNT)
|
||||
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(TYPE1) * sizeof(THING2) * COUNT
|
||||
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
|
||||
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
|
||||
, ...)
|
||||
)
|
||||
|
||||
// 3-factor product, only identifiers, with redundant parens removed.
|
||||
@@
|
||||
identifier STRIDE, SIZE, COUNT;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(
|
||||
- (COUNT) * STRIDE * SIZE
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- COUNT * (STRIDE) * SIZE
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- COUNT * STRIDE * (SIZE)
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (COUNT) * (STRIDE) * SIZE
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- COUNT * (STRIDE) * (SIZE)
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (COUNT) * STRIDE * (SIZE)
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (COUNT) * (STRIDE) * (SIZE)
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- COUNT * STRIDE * SIZE
|
||||
+ array3_size(COUNT, STRIDE, SIZE)
|
||||
, ...)
|
||||
)
|
||||
|
||||
// Any remaining multi-factor products, first at least 3-factor products,
|
||||
// when they're not all constants...
|
||||
@@
|
||||
expression E1, E2, E3;
|
||||
constant C1, C2, C3;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(C1 * C2 * C3, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (E1) * E2 * E3
|
||||
+ array3_size(E1, E2, E3)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (E1) * (E2) * E3
|
||||
+ array3_size(E1, E2, E3)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- (E1) * (E2) * (E3)
|
||||
+ array3_size(E1, E2, E3)
|
||||
, ...)
|
||||
|
|
||||
kzalloc(
|
||||
- E1 * E2 * E3
|
||||
+ array3_size(E1, E2, E3)
|
||||
, ...)
|
||||
)
|
||||
|
||||
// And then all remaining 2 factors products when they're not all constants,
|
||||
// keeping sizeof() as the second factor argument.
|
||||
@@
|
||||
expression THING, E1, E2;
|
||||
type TYPE;
|
||||
constant C1, C2, C3;
|
||||
@@
|
||||
|
||||
(
|
||||
kzalloc(sizeof(THING) * C2, ...)
|
||||
|
|
||||
kzalloc(sizeof(TYPE) * C2, ...)
|
||||
|
|
||||
kzalloc(C1 * C2 * C3, ...)
|
||||
|
|
||||
kzalloc(C1 * C2, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(TYPE) * (E2)
|
||||
+ E2, sizeof(TYPE)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(TYPE) * E2
|
||||
+ E2, sizeof(TYPE)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(THING) * (E2)
|
||||
+ E2, sizeof(THING)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- sizeof(THING) * E2
|
||||
+ E2, sizeof(THING)
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- (E1) * E2
|
||||
+ E1, E2
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- (E1) * (E2)
|
||||
+ E1, E2
|
||||
, ...)
|
||||
|
|
||||
- kzalloc
|
||||
+ kcalloc
|
||||
(
|
||||
- E1 * E2
|
||||
+ E1, E2
|
||||
, ...)
|
||||
)
|
||||
|
||||
Signed-off-by: Kees Cook <keescook@chromium.org>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -141,11 +141,11 @@ static void crypto4xx_hw_init(struct cry
|
||||
|
||||
int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size)
|
||||
{
|
||||
- ctx->sa_in = kzalloc(size * 4, GFP_ATOMIC);
|
||||
+ ctx->sa_in = kcalloc(size, 4, GFP_ATOMIC);
|
||||
if (ctx->sa_in == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
- ctx->sa_out = kzalloc(size * 4, GFP_ATOMIC);
|
||||
+ ctx->sa_out = kcalloc(size, 4, GFP_ATOMIC);
|
||||
if (ctx->sa_out == NULL) {
|
||||
kfree(ctx->sa_in);
|
||||
ctx->sa_in = NULL;
|
||||
@@ -180,8 +180,8 @@ static u32 crypto4xx_build_pdr(struct cr
|
||||
if (!dev->pdr)
|
||||
return -ENOMEM;
|
||||
|
||||
- dev->pdr_uinfo = kzalloc(sizeof(struct pd_uinfo) * PPC4XX_NUM_PD,
|
||||
- GFP_KERNEL);
|
||||
+ dev->pdr_uinfo = kcalloc(PPC4XX_NUM_PD, sizeof(struct pd_uinfo),
|
||||
+ GFP_KERNEL);
|
||||
if (!dev->pdr_uinfo) {
|
||||
dma_free_coherent(dev->core_dev->device,
|
||||
sizeof(struct ce_pd) * PPC4XX_NUM_PD,
|
@ -0,0 +1,84 @@
|
||||
From 2c95e6d97892235b5b98cd4805e47fac87c2226f Mon Sep 17 00:00:00 2001
|
||||
From: Eric Biggers <ebiggers@google.com>
|
||||
Date: Sat, 30 Jun 2018 15:16:15 -0700
|
||||
Subject: [PATCH 02/15] crypto: skcipher - remove useless setting of type flags
|
||||
|
||||
Some skcipher algorithms set .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER. But
|
||||
this is redundant with the C structure type ('struct skcipher_alg'), and
|
||||
crypto_register_skcipher() already sets the type flag automatically,
|
||||
clearing any type flag that was already there. Apparently the useless
|
||||
assignment has just been copy+pasted around.
|
||||
|
||||
So, remove the useless assignment from all the skcipher algorithms.
|
||||
|
||||
This patch shouldn't change any actual behavior.
|
||||
|
||||
Signed-off-by: Eric Biggers <ebiggers@google.com>
|
||||
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 18 ++++++------------
|
||||
1 file changed, 6 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1132,8 +1132,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_name = "cbc(aes)",
|
||||
.cra_driver_name = "cbc-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER |
|
||||
- CRYPTO_ALG_ASYNC |
|
||||
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
@@ -1153,8 +1152,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_name = "cfb(aes)",
|
||||
.cra_driver_name = "cfb-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER |
|
||||
- CRYPTO_ALG_ASYNC |
|
||||
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
@@ -1174,8 +1172,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_name = "ctr(aes)",
|
||||
.cra_driver_name = "ctr-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER |
|
||||
- CRYPTO_ALG_NEED_FALLBACK |
|
||||
+ .cra_flags = CRYPTO_ALG_NEED_FALLBACK |
|
||||
CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
@@ -1196,8 +1193,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_name = "rfc3686(ctr(aes))",
|
||||
.cra_driver_name = "rfc3686-ctr-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER |
|
||||
- CRYPTO_ALG_ASYNC |
|
||||
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
@@ -1217,8 +1213,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_name = "ecb(aes)",
|
||||
.cra_driver_name = "ecb-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER |
|
||||
- CRYPTO_ALG_ASYNC |
|
||||
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
@@ -1237,8 +1232,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_name = "ofb(aes)",
|
||||
.cra_driver_name = "ofb-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
- .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER |
|
||||
- CRYPTO_ALG_ASYNC |
|
||||
+ .cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
@ -0,0 +1,34 @@
|
||||
From 1ad0f1603a6b2afb62a1c065409aaa4e43ca7627 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Biggers <ebiggers@google.com>
|
||||
Date: Wed, 14 Nov 2018 12:19:39 -0800
|
||||
Subject: [PATCH 03/15] crypto: drop mask=CRYPTO_ALG_ASYNC from 'cipher' tfm
|
||||
allocations
|
||||
|
||||
'cipher' algorithms (single block ciphers) are always synchronous, so
|
||||
passing CRYPTO_ALG_ASYNC in the mask to crypto_alloc_cipher() has no
|
||||
effect. Many users therefore already don't pass it, but some still do.
|
||||
This inconsistency can cause confusion, especially since the way the
|
||||
'mask' argument works is somewhat counterintuitive.
|
||||
|
||||
Thus, just remove the unneeded CRYPTO_ALG_ASYNC flags.
|
||||
|
||||
This patch shouldn't change any actual behavior.
|
||||
|
||||
Signed-off-by: Eric Biggers <ebiggers@google.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_alg.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_alg.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
|
||||
@@ -520,8 +520,7 @@ static int crypto4xx_compute_gcm_hash_ke
|
||||
uint8_t src[16] = { 0 };
|
||||
int rc = 0;
|
||||
|
||||
- aes_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC |
|
||||
- CRYPTO_ALG_NEED_FALLBACK);
|
||||
+ aes_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_NEED_FALLBACK);
|
||||
if (IS_ERR(aes_tfm)) {
|
||||
rc = PTR_ERR(aes_tfm);
|
||||
pr_warn("could not load aes cipher driver: %d\n", rc);
|
@ -0,0 +1,30 @@
|
||||
From 67d8208fba1324fa0198f9fc58a9edbe09596947 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Hellwig <hch@lst.de>
|
||||
Date: Sun, 16 Dec 2018 18:19:46 +0100
|
||||
Subject: [PATCH 04/15] crypto4xx_core: don't abuse __dma_sync_page
|
||||
|
||||
This function is internal to the DMA API implementation. Instead use
|
||||
the DMA API to properly unmap. Note that the DMA API usage in this
|
||||
driver is a disaster and urgently needs some work - it is missing all
|
||||
the unmaps, seems to do a secondary map where it looks like it should
|
||||
to a unmap in one place to work around cache coherency and the
|
||||
directions passed in seem to be partially wrong.
|
||||
|
||||
Signed-off-by: Christoph Hellwig <hch@lst.de>
|
||||
Tested-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -596,7 +596,7 @@ static void crypto4xx_aead_done(struct c
|
||||
pd->pd_ctl_len.bf.pkt_len,
|
||||
dst);
|
||||
} else {
|
||||
- __dma_sync_page(sg_page(dst), dst->offset, dst->length,
|
||||
+ dma_unmap_page(dev->core_dev->device, pd->dest, dst->length,
|
||||
DMA_FROM_DEVICE);
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
From 750afb08ca71310fcf0c4e2cb1565c63b8235b60 Mon Sep 17 00:00:00 2001
|
||||
From: Luis Chamberlain <mcgrof@kernel.org>
|
||||
Date: Fri, 4 Jan 2019 09:23:09 +0100
|
||||
Subject: [PATCH 05/15] cross-tree: phase out dma_zalloc_coherent()
|
||||
|
||||
We already need to zero out memory for dma_alloc_coherent(), as such
|
||||
using dma_zalloc_coherent() is superflous. Phase it out.
|
||||
|
||||
This change was generated with the following Coccinelle SmPL patch:
|
||||
|
||||
@ replace_dma_zalloc_coherent @
|
||||
expression dev, size, data, handle, flags;
|
||||
@@
|
||||
|
||||
-dma_zalloc_coherent(dev, size, handle, flags)
|
||||
+dma_alloc_coherent(dev, size, handle, flags)
|
||||
|
||||
Suggested-by: Christoph Hellwig <hch@lst.de>
|
||||
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
|
||||
[hch: re-ran the script on the latest tree]
|
||||
Signed-off-by: Christoph Hellwig <hch@lst.de>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -283,9 +283,9 @@ static u32 crypto4xx_put_pd_to_pdr(struc
|
||||
*/
|
||||
static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
|
||||
{
|
||||
- dev->gdr = dma_zalloc_coherent(dev->core_dev->device,
|
||||
- sizeof(struct ce_gd) * PPC4XX_NUM_GD,
|
||||
- &dev->gdr_pa, GFP_ATOMIC);
|
||||
+ dev->gdr = dma_alloc_coherent(dev->core_dev->device,
|
||||
+ sizeof(struct ce_gd) * PPC4XX_NUM_GD,
|
||||
+ &dev->gdr_pa, GFP_ATOMIC);
|
||||
if (!dev->gdr)
|
||||
return -ENOMEM;
|
||||
|
@ -0,0 +1,199 @@
|
||||
From d072bfa4885354fff86aa1fb1dbc4f1533c9e0bf Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sun, 23 Dec 2018 02:16:13 +0100
|
||||
Subject: [PATCH 06/15] crypto: crypto4xx - add prng crypto support
|
||||
|
||||
This patch adds support for crypto4xx's ANSI X9.17 Annex C compliant
|
||||
pseudo random number generator which provides a pseudo random source
|
||||
for the purpose of generating Initialization Vectors (IV's) for AES
|
||||
algorithms to the Packet Engine and other pseudo random number
|
||||
requirements.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 87 +++++++++++++++++++++++++
|
||||
drivers/crypto/amcc/crypto4xx_core.h | 4 ++
|
||||
drivers/crypto/amcc/crypto4xx_reg_def.h | 1 +
|
||||
3 files changed, 92 insertions(+)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -40,9 +40,11 @@
|
||||
#include <crypto/ctr.h>
|
||||
#include <crypto/gcm.h>
|
||||
#include <crypto/sha.h>
|
||||
+#include <crypto/rng.h>
|
||||
#include <crypto/scatterwalk.h>
|
||||
#include <crypto/skcipher.h>
|
||||
#include <crypto/internal/aead.h>
|
||||
+#include <crypto/internal/rng.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_core.h"
|
||||
@@ -1035,6 +1037,10 @@ static int crypto4xx_register_alg(struct
|
||||
rc = crypto_register_ahash(&alg->alg.u.hash);
|
||||
break;
|
||||
|
||||
+ case CRYPTO_ALG_TYPE_RNG:
|
||||
+ rc = crypto_register_rng(&alg->alg.u.rng);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
rc = crypto_register_skcipher(&alg->alg.u.cipher);
|
||||
break;
|
||||
@@ -1064,6 +1070,10 @@ static void crypto4xx_unregister_alg(str
|
||||
crypto_unregister_aead(&alg->alg.u.aead);
|
||||
break;
|
||||
|
||||
+ case CRYPTO_ALG_TYPE_RNG:
|
||||
+ crypto_unregister_rng(&alg->alg.u.rng);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
crypto_unregister_skcipher(&alg->alg.u.cipher);
|
||||
}
|
||||
@@ -1122,6 +1132,69 @@ static irqreturn_t crypto4xx_ce_interrup
|
||||
PPC4XX_TMO_ERR_INT);
|
||||
}
|
||||
|
||||
+static int ppc4xx_prng_data_read(struct crypto4xx_device *dev,
|
||||
+ u8 *data, unsigned int max)
|
||||
+{
|
||||
+ unsigned int i, curr = 0;
|
||||
+ u32 val[2];
|
||||
+
|
||||
+ do {
|
||||
+ /* trigger PRN generation */
|
||||
+ writel(PPC4XX_PRNG_CTRL_AUTO_EN,
|
||||
+ dev->ce_base + CRYPTO4XX_PRNG_CTRL);
|
||||
+
|
||||
+ for (i = 0; i < 1024; i++) {
|
||||
+ /* usually 19 iterations are enough */
|
||||
+ if ((readl(dev->ce_base + CRYPTO4XX_PRNG_STAT) &
|
||||
+ CRYPTO4XX_PRNG_STAT_BUSY))
|
||||
+ continue;
|
||||
+
|
||||
+ val[0] = readl_be(dev->ce_base + CRYPTO4XX_PRNG_RES_0);
|
||||
+ val[1] = readl_be(dev->ce_base + CRYPTO4XX_PRNG_RES_1);
|
||||
+ break;
|
||||
+ }
|
||||
+ if (i == 1024)
|
||||
+ return -ETIMEDOUT;
|
||||
+
|
||||
+ if ((max - curr) >= 8) {
|
||||
+ memcpy(data, &val, 8);
|
||||
+ data += 8;
|
||||
+ curr += 8;
|
||||
+ } else {
|
||||
+ /* copy only remaining bytes */
|
||||
+ memcpy(data, &val, max - curr);
|
||||
+ break;
|
||||
+ }
|
||||
+ } while (curr < max);
|
||||
+
|
||||
+ return curr;
|
||||
+}
|
||||
+
|
||||
+static int crypto4xx_prng_generate(struct crypto_rng *tfm,
|
||||
+ const u8 *src, unsigned int slen,
|
||||
+ u8 *dstn, unsigned int dlen)
|
||||
+{
|
||||
+ struct rng_alg *alg = crypto_rng_alg(tfm);
|
||||
+ struct crypto4xx_alg *amcc_alg;
|
||||
+ struct crypto4xx_device *dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.rng);
|
||||
+ dev = amcc_alg->dev;
|
||||
+
|
||||
+ mutex_lock(&dev->core_dev->rng_lock);
|
||||
+ ret = ppc4xx_prng_data_read(dev, dstn, dlen);
|
||||
+ mutex_unlock(&dev->core_dev->rng_lock);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int crypto4xx_prng_seed(struct crypto_rng *tfm, const u8 *seed,
|
||||
+ unsigned int slen)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Supported Crypto Algorithms
|
||||
*/
|
||||
@@ -1291,6 +1364,18 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_module = THIS_MODULE,
|
||||
},
|
||||
} },
|
||||
+ { .type = CRYPTO_ALG_TYPE_RNG, .u.rng = {
|
||||
+ .base = {
|
||||
+ .cra_name = "stdrng",
|
||||
+ .cra_driver_name = "crypto4xx_rng",
|
||||
+ .cra_priority = 300,
|
||||
+ .cra_ctxsize = 0,
|
||||
+ .cra_module = THIS_MODULE,
|
||||
+ },
|
||||
+ .generate = crypto4xx_prng_generate,
|
||||
+ .seed = crypto4xx_prng_seed,
|
||||
+ .seedsize = 0,
|
||||
+ } },
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1360,6 +1445,7 @@ static int crypto4xx_probe(struct platfo
|
||||
core_dev->dev->core_dev = core_dev;
|
||||
core_dev->dev->is_revb = is_revb;
|
||||
core_dev->device = dev;
|
||||
+ mutex_init(&core_dev->rng_lock);
|
||||
spin_lock_init(&core_dev->lock);
|
||||
INIT_LIST_HEAD(&core_dev->dev->alg_list);
|
||||
ratelimit_default_init(&core_dev->dev->aead_ratelimit);
|
||||
@@ -1439,6 +1525,7 @@ static int crypto4xx_remove(struct platf
|
||||
tasklet_kill(&core_dev->tasklet);
|
||||
/* Un-register with Linux CryptoAPI */
|
||||
crypto4xx_unregister_alg(core_dev->dev);
|
||||
+ mutex_destroy(&core_dev->rng_lock);
|
||||
/* Free all allocated memory */
|
||||
crypto4xx_stop_all(core_dev);
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.h
|
||||
@@ -23,8 +23,10 @@
|
||||
#define __CRYPTO4XX_CORE_H__
|
||||
|
||||
#include <linux/ratelimit.h>
|
||||
+#include <linux/mutex.h>
|
||||
#include <crypto/internal/hash.h>
|
||||
#include <crypto/internal/aead.h>
|
||||
+#include <crypto/internal/rng.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_sa.h"
|
||||
@@ -119,6 +121,7 @@ struct crypto4xx_core_device {
|
||||
u32 irq;
|
||||
struct tasklet_struct tasklet;
|
||||
spinlock_t lock;
|
||||
+ struct mutex rng_lock;
|
||||
};
|
||||
|
||||
struct crypto4xx_ctx {
|
||||
@@ -143,6 +146,7 @@ struct crypto4xx_alg_common {
|
||||
struct skcipher_alg cipher;
|
||||
struct ahash_alg hash;
|
||||
struct aead_alg aead;
|
||||
+ struct rng_alg rng;
|
||||
} u;
|
||||
};
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_reg_def.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
|
||||
@@ -100,6 +100,7 @@
|
||||
#define CRYPTO4XX_ENDIAN_CFG 0x000600d8
|
||||
|
||||
#define CRYPTO4XX_PRNG_STAT 0x00070000
|
||||
+#define CRYPTO4XX_PRNG_STAT_BUSY 0x1
|
||||
#define CRYPTO4XX_PRNG_CTRL 0x00070004
|
||||
#define CRYPTO4XX_PRNG_SEED_L 0x00070008
|
||||
#define CRYPTO4XX_PRNG_SEED_H 0x0007000c
|
@ -0,0 +1,39 @@
|
||||
From 6e88098ca43a3d80ae86908f7badba683c8a0d84 Mon Sep 17 00:00:00 2001
|
||||
From: Corentin Labbe <clabbe@baylibre.com>
|
||||
Date: Wed, 23 Jan 2019 11:24:18 +0000
|
||||
Subject: [PATCH 07/15] crypto: crypto4xx - Fix wrong
|
||||
ppc4xx_trng_probe()/ppc4xx_trng_remove() arguments
|
||||
|
||||
When building without CONFIG_HW_RANDOM_PPC4XX, I hit the following build failure:
|
||||
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_probe':
|
||||
drivers/crypto/amcc/crypto4xx_core.c:1407:20: error: passing argument 1 of 'ppc4xx_trng_probe' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
In file included from drivers/crypto/amcc/crypto4xx_core.c:50:0:
|
||||
drivers/crypto/amcc/crypto4xx_trng.h:28:20: note: expected 'struct crypto4xx_device *' but argument is of type 'struct crypto4xx_core_device *'
|
||||
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_remove':
|
||||
drivers/crypto/amcc/crypto4xx_core.c:1434:21: error: passing argument 1 of 'ppc4xx_trng_remove' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
In file included from drivers/crypto/amcc/crypto4xx_core.c:50:0:
|
||||
drivers/crypto/amcc/crypto4xx_trng.h:30:20: note: expected 'struct crypto4xx_device *' but argument is of type 'struct crypto4xx_core_device *'
|
||||
|
||||
This patch fix the needed argument of ppc4xx_trng_probe()/ppc4xx_trng_remove() in that case.
|
||||
|
||||
Fixes: 5343e674f32f ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
|
||||
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_trng.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_trng.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_trng.h
|
||||
@@ -26,9 +26,9 @@ void ppc4xx_trng_probe(struct crypto4xx_
|
||||
void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev);
|
||||
#else
|
||||
static inline void ppc4xx_trng_probe(
|
||||
- struct crypto4xx_device *dev __maybe_unused) { }
|
||||
+ struct crypto4xx_core_device *dev __maybe_unused) { }
|
||||
static inline void ppc4xx_trng_remove(
|
||||
- struct crypto4xx_device *dev __maybe_unused) { }
|
||||
+ struct crypto4xx_core_device *dev __maybe_unused) { }
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,60 @@
|
||||
From bfa2ba7d9e6b20aca82b99e6842fe18842ae3a0f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Fri, 17 May 2019 23:15:57 +0200
|
||||
Subject: [PATCH 13/15] crypto: crypto4xx - fix AES CTR blocksize value
|
||||
|
||||
This patch fixes a issue with crypto4xx's ctr(aes) that was
|
||||
discovered by libcapi's kcapi-enc-test.sh test.
|
||||
|
||||
The some of the ctr(aes) encryptions test were failing on the
|
||||
non-power-of-two test:
|
||||
|
||||
kcapi-enc - Error: encryption failed with error 0
|
||||
kcapi-enc - Error: decryption failed with error 0
|
||||
[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits):
|
||||
original file (1d100e..cc96184c) and generated file (e3b0c442..1b7852b855)
|
||||
[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
|
||||
(openssl generated CT): original file (e3b0..5) and generated file (3..8e)
|
||||
[PASSED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
|
||||
(openssl generated PT)
|
||||
[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (password):
|
||||
original file (1d1..84c) and generated file (e3b..852b855)
|
||||
|
||||
But the 16, 32, 512, 65536 tests always worked.
|
||||
|
||||
Thankfully, this isn't a hidden hardware problem like previously,
|
||||
instead this turned out to be a copy and paste issue.
|
||||
|
||||
With this patch, all the tests are passing with and
|
||||
kcapi-enc-test.sh gives crypto4xx's a clean bill of health:
|
||||
"Number of failures: 0" :).
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: 98e87e3d933b ("crypto: crypto4xx - add aes-ctr support")
|
||||
Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1248,7 +1248,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_flags = CRYPTO_ALG_NEED_FALLBACK |
|
||||
CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
- .cra_blocksize = AES_BLOCK_SIZE,
|
||||
+ .cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
.cra_module = THIS_MODULE,
|
||||
},
|
||||
@@ -1268,7 +1268,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
- .cra_blocksize = AES_BLOCK_SIZE,
|
||||
+ .cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
.cra_module = THIS_MODULE,
|
||||
},
|
@ -0,0 +1,44 @@
|
||||
From 70c4997f34b6c6888b3ac157adec49e01d0df2d5 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sat, 18 May 2019 23:28:11 +0200
|
||||
Subject: [PATCH 14/15] crypto: crypto4xx - fix blocksize for cfb and ofb
|
||||
|
||||
While the hardware consider them to be blockciphers, the
|
||||
reference implementation defines them as streamciphers.
|
||||
|
||||
Do the right thing and set the blocksize to 1. This
|
||||
was found by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS.
|
||||
|
||||
This fixes the following issues:
|
||||
skcipher: blocksize for ofb-aes-ppc4xx (16) doesn't match generic impl (1)
|
||||
skcipher: blocksize for cfb-aes-ppc4xx (16) doesn't match generic impl (1)
|
||||
|
||||
Cc: Eric Biggers <ebiggers@kernel.org>
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1227,7 +1227,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
- .cra_blocksize = AES_BLOCK_SIZE,
|
||||
+ .cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
.cra_module = THIS_MODULE,
|
||||
},
|
||||
@@ -1307,7 +1307,7 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
- .cra_blocksize = AES_BLOCK_SIZE,
|
||||
+ .cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
|
||||
.cra_module = THIS_MODULE,
|
||||
},
|
@ -0,0 +1,172 @@
|
||||
From 0f7a81374060828280fcfdfbaa162cb559017f9f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sat, 18 May 2019 23:28:12 +0200
|
||||
Subject: [PATCH 15/15] crypto: crypto4xx - block ciphers should only accept
|
||||
complete blocks
|
||||
|
||||
The hardware automatically zero pads incomplete block ciphers
|
||||
blocks without raising any errors. This is a screw-up. This
|
||||
was noticed by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS tests that
|
||||
sent a incomplete blocks and expect them to fail.
|
||||
|
||||
This fixes:
|
||||
cbc-aes-ppc4xx encryption unexpectedly succeeded on test vector
|
||||
"random: len=2409 klen=32"; expected_error=-22, cfg="random:
|
||||
may_sleep use_digest src_divs=[96.90%@+2295, 2.34%@+4066,
|
||||
0.32%@alignmask+12, 0.34%@+4087, 0.9%@alignmask+1787, 0.1%@+3767]
|
||||
iv_offset=6"
|
||||
|
||||
ecb-aes-ppc4xx encryption unexpectedly succeeded on test vector
|
||||
"random: len=1011 klen=32"; expected_error=-22, cfg="random:
|
||||
may_sleep use_digest src_divs=[100.0%@alignmask+20]
|
||||
dst_divs=[3.12%@+3001, 96.88%@+4070]"
|
||||
|
||||
Cc: Eric Biggers <ebiggers@kernel.org>
|
||||
Cc: stable@vger.kernel.org [4.19, 5.0 and 5.1]
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_alg.c | 36 +++++++++++++++++++---------
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 16 ++++++-------
|
||||
drivers/crypto/amcc/crypto4xx_core.h | 10 ++++----
|
||||
3 files changed, 39 insertions(+), 23 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_alg.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
|
||||
@@ -76,12 +76,16 @@ static void set_dynamic_sa_command_1(str
|
||||
}
|
||||
|
||||
static inline int crypto4xx_crypt(struct skcipher_request *req,
|
||||
- const unsigned int ivlen, bool decrypt)
|
||||
+ const unsigned int ivlen, bool decrypt,
|
||||
+ bool check_blocksize)
|
||||
{
|
||||
struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req);
|
||||
struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher);
|
||||
__le32 iv[AES_IV_SIZE];
|
||||
|
||||
+ if (check_blocksize && !IS_ALIGNED(req->cryptlen, AES_BLOCK_SIZE))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
if (ivlen)
|
||||
crypto4xx_memcpy_to_le32(iv, req->iv, ivlen);
|
||||
|
||||
@@ -90,24 +94,34 @@ static inline int crypto4xx_crypt(struct
|
||||
ctx->sa_len, 0, NULL);
|
||||
}
|
||||
|
||||
-int crypto4xx_encrypt_noiv(struct skcipher_request *req)
|
||||
+int crypto4xx_encrypt_noiv_block(struct skcipher_request *req)
|
||||
+{
|
||||
+ return crypto4xx_crypt(req, 0, false, true);
|
||||
+}
|
||||
+
|
||||
+int crypto4xx_encrypt_iv_stream(struct skcipher_request *req)
|
||||
+{
|
||||
+ return crypto4xx_crypt(req, AES_IV_SIZE, false, false);
|
||||
+}
|
||||
+
|
||||
+int crypto4xx_decrypt_noiv_block(struct skcipher_request *req)
|
||||
{
|
||||
- return crypto4xx_crypt(req, 0, false);
|
||||
+ return crypto4xx_crypt(req, 0, true, true);
|
||||
}
|
||||
|
||||
-int crypto4xx_encrypt_iv(struct skcipher_request *req)
|
||||
+int crypto4xx_decrypt_iv_stream(struct skcipher_request *req)
|
||||
{
|
||||
- return crypto4xx_crypt(req, AES_IV_SIZE, false);
|
||||
+ return crypto4xx_crypt(req, AES_IV_SIZE, true, false);
|
||||
}
|
||||
|
||||
-int crypto4xx_decrypt_noiv(struct skcipher_request *req)
|
||||
+int crypto4xx_encrypt_iv_block(struct skcipher_request *req)
|
||||
{
|
||||
- return crypto4xx_crypt(req, 0, true);
|
||||
+ return crypto4xx_crypt(req, AES_IV_SIZE, false, true);
|
||||
}
|
||||
|
||||
-int crypto4xx_decrypt_iv(struct skcipher_request *req)
|
||||
+int crypto4xx_decrypt_iv_block(struct skcipher_request *req)
|
||||
{
|
||||
- return crypto4xx_crypt(req, AES_IV_SIZE, true);
|
||||
+ return crypto4xx_crypt(req, AES_IV_SIZE, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,8 +286,8 @@ crypto4xx_ctr_crypt(struct skcipher_requ
|
||||
return ret;
|
||||
}
|
||||
|
||||
- return encrypt ? crypto4xx_encrypt_iv(req)
|
||||
- : crypto4xx_decrypt_iv(req);
|
||||
+ return encrypt ? crypto4xx_encrypt_iv_stream(req)
|
||||
+ : crypto4xx_decrypt_iv_stream(req);
|
||||
}
|
||||
|
||||
static int crypto4xx_sk_setup_fallback(struct crypto4xx_ctx *ctx,
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1215,8 +1215,8 @@ static struct crypto4xx_alg_common crypt
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_IV_SIZE,
|
||||
.setkey = crypto4xx_setkey_aes_cbc,
|
||||
- .encrypt = crypto4xx_encrypt_iv,
|
||||
- .decrypt = crypto4xx_decrypt_iv,
|
||||
+ .encrypt = crypto4xx_encrypt_iv_block,
|
||||
+ .decrypt = crypto4xx_decrypt_iv_block,
|
||||
.init = crypto4xx_sk_init,
|
||||
.exit = crypto4xx_sk_exit,
|
||||
} },
|
||||
@@ -1235,8 +1235,8 @@ static struct crypto4xx_alg_common crypt
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_IV_SIZE,
|
||||
.setkey = crypto4xx_setkey_aes_cfb,
|
||||
- .encrypt = crypto4xx_encrypt_iv,
|
||||
- .decrypt = crypto4xx_decrypt_iv,
|
||||
+ .encrypt = crypto4xx_encrypt_iv_stream,
|
||||
+ .decrypt = crypto4xx_decrypt_iv_stream,
|
||||
.init = crypto4xx_sk_init,
|
||||
.exit = crypto4xx_sk_exit,
|
||||
} },
|
||||
@@ -1295,8 +1295,8 @@ static struct crypto4xx_alg_common crypt
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.setkey = crypto4xx_setkey_aes_ecb,
|
||||
- .encrypt = crypto4xx_encrypt_noiv,
|
||||
- .decrypt = crypto4xx_decrypt_noiv,
|
||||
+ .encrypt = crypto4xx_encrypt_noiv_block,
|
||||
+ .decrypt = crypto4xx_decrypt_noiv_block,
|
||||
.init = crypto4xx_sk_init,
|
||||
.exit = crypto4xx_sk_exit,
|
||||
} },
|
||||
@@ -1315,8 +1315,8 @@ static struct crypto4xx_alg_common crypt
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_IV_SIZE,
|
||||
.setkey = crypto4xx_setkey_aes_ofb,
|
||||
- .encrypt = crypto4xx_encrypt_iv,
|
||||
- .decrypt = crypto4xx_decrypt_iv,
|
||||
+ .encrypt = crypto4xx_encrypt_iv_stream,
|
||||
+ .decrypt = crypto4xx_decrypt_iv_stream,
|
||||
.init = crypto4xx_sk_init,
|
||||
.exit = crypto4xx_sk_exit,
|
||||
} },
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.h
|
||||
@@ -183,10 +183,12 @@ int crypto4xx_setkey_rfc3686(struct cryp
|
||||
const u8 *key, unsigned int keylen);
|
||||
int crypto4xx_encrypt_ctr(struct skcipher_request *req);
|
||||
int crypto4xx_decrypt_ctr(struct skcipher_request *req);
|
||||
-int crypto4xx_encrypt_iv(struct skcipher_request *req);
|
||||
-int crypto4xx_decrypt_iv(struct skcipher_request *req);
|
||||
-int crypto4xx_encrypt_noiv(struct skcipher_request *req);
|
||||
-int crypto4xx_decrypt_noiv(struct skcipher_request *req);
|
||||
+int crypto4xx_encrypt_iv_stream(struct skcipher_request *req);
|
||||
+int crypto4xx_decrypt_iv_stream(struct skcipher_request *req);
|
||||
+int crypto4xx_encrypt_iv_block(struct skcipher_request *req);
|
||||
+int crypto4xx_decrypt_iv_block(struct skcipher_request *req);
|
||||
+int crypto4xx_encrypt_noiv_block(struct skcipher_request *req);
|
||||
+int crypto4xx_decrypt_noiv_block(struct skcipher_request *req);
|
||||
int crypto4xx_rfc3686_encrypt(struct skcipher_request *req);
|
||||
int crypto4xx_rfc3686_decrypt(struct skcipher_request *req);
|
||||
int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm);
|
@ -0,0 +1,30 @@
|
||||
From 9b84ad676e248a3e3c81db7f5d39e1739b3780aa Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sat, 15 Jun 2019 16:35:26 +0200
|
||||
Subject: [PATCH] powerpc/4xx/uic: clear pending interrupt after irq type/pol
|
||||
change
|
||||
|
||||
When testing out gpio-keys with a button, a spurious
|
||||
interrupt (and therefore a key press or release event)
|
||||
gets triggered as soon as the driver enables the irq
|
||||
line for the first time.
|
||||
|
||||
This patch clears any potential bogus generated interrupt
|
||||
that was caused by the switching of the associated irq's
|
||||
type and polarity.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
---
|
||||
arch/powerpc/platforms/4xx/uic.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/powerpc/platforms/4xx/uic.c
|
||||
+++ b/arch/powerpc/platforms/4xx/uic.c
|
||||
@@ -158,6 +158,7 @@ static int uic_set_irq_type(struct irq_d
|
||||
|
||||
mtdcr(uic->dcrbase + UIC_PR, pr);
|
||||
mtdcr(uic->dcrbase + UIC_TR, tr);
|
||||
+ mtdcr(uic->dcrbase + UIC_SR, ~mask);
|
||||
|
||||
raw_spin_unlock_irqrestore(&uic->lock, flags);
|
||||
|
@ -521,7 +521,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
|
||||
+
|
||||
+ default:
|
||||
+ return retval;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
driver = (struct hc_driver *)id->driver_data;
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
From 1ad0f1603a6b2afb62a1c065409aaa4e43ca7627 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Biggers <ebiggers@google.com>
|
||||
Date: Wed, 14 Nov 2018 12:19:39 -0800
|
||||
Subject: [PATCH 03/15] crypto: drop mask=CRYPTO_ALG_ASYNC from 'cipher' tfm
|
||||
allocations
|
||||
|
||||
'cipher' algorithms (single block ciphers) are always synchronous, so
|
||||
passing CRYPTO_ALG_ASYNC in the mask to crypto_alloc_cipher() has no
|
||||
effect. Many users therefore already don't pass it, but some still do.
|
||||
This inconsistency can cause confusion, especially since the way the
|
||||
'mask' argument works is somewhat counterintuitive.
|
||||
|
||||
Thus, just remove the unneeded CRYPTO_ALG_ASYNC flags.
|
||||
|
||||
This patch shouldn't change any actual behavior.
|
||||
|
||||
Signed-off-by: Eric Biggers <ebiggers@google.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_alg.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_alg.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
|
||||
@@ -540,8 +540,7 @@ static int crypto4xx_compute_gcm_hash_ke
|
||||
uint8_t src[16] = { 0 };
|
||||
int rc = 0;
|
||||
|
||||
- aes_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC |
|
||||
- CRYPTO_ALG_NEED_FALLBACK);
|
||||
+ aes_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_NEED_FALLBACK);
|
||||
if (IS_ERR(aes_tfm)) {
|
||||
rc = PTR_ERR(aes_tfm);
|
||||
pr_warn("could not load aes cipher driver: %d\n", rc);
|
@ -0,0 +1,30 @@
|
||||
From 67d8208fba1324fa0198f9fc58a9edbe09596947 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Hellwig <hch@lst.de>
|
||||
Date: Sun, 16 Dec 2018 18:19:46 +0100
|
||||
Subject: [PATCH 04/15] crypto4xx_core: don't abuse __dma_sync_page
|
||||
|
||||
This function is internal to the DMA API implementation. Instead use
|
||||
the DMA API to properly unmap. Note that the DMA API usage in this
|
||||
driver is a disaster and urgently needs some work - it is missing all
|
||||
the unmaps, seems to do a secondary map where it looks like it should
|
||||
to a unmap in one place to work around cache coherency and the
|
||||
directions passed in seem to be partially wrong.
|
||||
|
||||
Signed-off-by: Christoph Hellwig <hch@lst.de>
|
||||
Tested-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -596,7 +596,7 @@ static void crypto4xx_aead_done(struct c
|
||||
pd->pd_ctl_len.bf.pkt_len,
|
||||
dst);
|
||||
} else {
|
||||
- __dma_sync_page(sg_page(dst), dst->offset, dst->length,
|
||||
+ dma_unmap_page(dev->core_dev->device, pd->dest, dst->length,
|
||||
DMA_FROM_DEVICE);
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
From 750afb08ca71310fcf0c4e2cb1565c63b8235b60 Mon Sep 17 00:00:00 2001
|
||||
From: Luis Chamberlain <mcgrof@kernel.org>
|
||||
Date: Fri, 4 Jan 2019 09:23:09 +0100
|
||||
Subject: [PATCH 05/15] cross-tree: phase out dma_zalloc_coherent()
|
||||
|
||||
We already need to zero out memory for dma_alloc_coherent(), as such
|
||||
using dma_zalloc_coherent() is superflous. Phase it out.
|
||||
|
||||
This change was generated with the following Coccinelle SmPL patch:
|
||||
|
||||
@ replace_dma_zalloc_coherent @
|
||||
expression dev, size, data, handle, flags;
|
||||
@@
|
||||
|
||||
-dma_zalloc_coherent(dev, size, handle, flags)
|
||||
+dma_alloc_coherent(dev, size, handle, flags)
|
||||
|
||||
Suggested-by: Christoph Hellwig <hch@lst.de>
|
||||
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
|
||||
[hch: re-ran the script on the latest tree]
|
||||
Signed-off-by: Christoph Hellwig <hch@lst.de>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -283,9 +283,9 @@ static u32 crypto4xx_put_pd_to_pdr(struc
|
||||
*/
|
||||
static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
|
||||
{
|
||||
- dev->gdr = dma_zalloc_coherent(dev->core_dev->device,
|
||||
- sizeof(struct ce_gd) * PPC4XX_NUM_GD,
|
||||
- &dev->gdr_pa, GFP_ATOMIC);
|
||||
+ dev->gdr = dma_alloc_coherent(dev->core_dev->device,
|
||||
+ sizeof(struct ce_gd) * PPC4XX_NUM_GD,
|
||||
+ &dev->gdr_pa, GFP_ATOMIC);
|
||||
if (!dev->gdr)
|
||||
return -ENOMEM;
|
||||
|
@ -0,0 +1,199 @@
|
||||
From d072bfa4885354fff86aa1fb1dbc4f1533c9e0bf Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sun, 23 Dec 2018 02:16:13 +0100
|
||||
Subject: [PATCH 06/15] crypto: crypto4xx - add prng crypto support
|
||||
|
||||
This patch adds support for crypto4xx's ANSI X9.17 Annex C compliant
|
||||
pseudo random number generator which provides a pseudo random source
|
||||
for the purpose of generating Initialization Vectors (IV's) for AES
|
||||
algorithms to the Packet Engine and other pseudo random number
|
||||
requirements.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 87 +++++++++++++++++++++++++
|
||||
drivers/crypto/amcc/crypto4xx_core.h | 4 ++
|
||||
drivers/crypto/amcc/crypto4xx_reg_def.h | 1 +
|
||||
3 files changed, 92 insertions(+)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -40,9 +40,11 @@
|
||||
#include <crypto/ctr.h>
|
||||
#include <crypto/gcm.h>
|
||||
#include <crypto/sha.h>
|
||||
+#include <crypto/rng.h>
|
||||
#include <crypto/scatterwalk.h>
|
||||
#include <crypto/skcipher.h>
|
||||
#include <crypto/internal/aead.h>
|
||||
+#include <crypto/internal/rng.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_core.h"
|
||||
@@ -1046,6 +1048,10 @@ static int crypto4xx_register_alg(struct
|
||||
rc = crypto_register_ahash(&alg->alg.u.hash);
|
||||
break;
|
||||
|
||||
+ case CRYPTO_ALG_TYPE_RNG:
|
||||
+ rc = crypto_register_rng(&alg->alg.u.rng);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
rc = crypto_register_skcipher(&alg->alg.u.cipher);
|
||||
break;
|
||||
@@ -1075,6 +1081,10 @@ static void crypto4xx_unregister_alg(str
|
||||
crypto_unregister_aead(&alg->alg.u.aead);
|
||||
break;
|
||||
|
||||
+ case CRYPTO_ALG_TYPE_RNG:
|
||||
+ crypto_unregister_rng(&alg->alg.u.rng);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
crypto_unregister_skcipher(&alg->alg.u.cipher);
|
||||
}
|
||||
@@ -1133,6 +1143,69 @@ static irqreturn_t crypto4xx_ce_interrup
|
||||
PPC4XX_TMO_ERR_INT);
|
||||
}
|
||||
|
||||
+static int ppc4xx_prng_data_read(struct crypto4xx_device *dev,
|
||||
+ u8 *data, unsigned int max)
|
||||
+{
|
||||
+ unsigned int i, curr = 0;
|
||||
+ u32 val[2];
|
||||
+
|
||||
+ do {
|
||||
+ /* trigger PRN generation */
|
||||
+ writel(PPC4XX_PRNG_CTRL_AUTO_EN,
|
||||
+ dev->ce_base + CRYPTO4XX_PRNG_CTRL);
|
||||
+
|
||||
+ for (i = 0; i < 1024; i++) {
|
||||
+ /* usually 19 iterations are enough */
|
||||
+ if ((readl(dev->ce_base + CRYPTO4XX_PRNG_STAT) &
|
||||
+ CRYPTO4XX_PRNG_STAT_BUSY))
|
||||
+ continue;
|
||||
+
|
||||
+ val[0] = readl_be(dev->ce_base + CRYPTO4XX_PRNG_RES_0);
|
||||
+ val[1] = readl_be(dev->ce_base + CRYPTO4XX_PRNG_RES_1);
|
||||
+ break;
|
||||
+ }
|
||||
+ if (i == 1024)
|
||||
+ return -ETIMEDOUT;
|
||||
+
|
||||
+ if ((max - curr) >= 8) {
|
||||
+ memcpy(data, &val, 8);
|
||||
+ data += 8;
|
||||
+ curr += 8;
|
||||
+ } else {
|
||||
+ /* copy only remaining bytes */
|
||||
+ memcpy(data, &val, max - curr);
|
||||
+ break;
|
||||
+ }
|
||||
+ } while (curr < max);
|
||||
+
|
||||
+ return curr;
|
||||
+}
|
||||
+
|
||||
+static int crypto4xx_prng_generate(struct crypto_rng *tfm,
|
||||
+ const u8 *src, unsigned int slen,
|
||||
+ u8 *dstn, unsigned int dlen)
|
||||
+{
|
||||
+ struct rng_alg *alg = crypto_rng_alg(tfm);
|
||||
+ struct crypto4xx_alg *amcc_alg;
|
||||
+ struct crypto4xx_device *dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.rng);
|
||||
+ dev = amcc_alg->dev;
|
||||
+
|
||||
+ mutex_lock(&dev->core_dev->rng_lock);
|
||||
+ ret = ppc4xx_prng_data_read(dev, dstn, dlen);
|
||||
+ mutex_unlock(&dev->core_dev->rng_lock);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int crypto4xx_prng_seed(struct crypto_rng *tfm, const u8 *seed,
|
||||
+ unsigned int slen)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Supported Crypto Algorithms
|
||||
*/
|
||||
@@ -1302,6 +1375,18 @@ static struct crypto4xx_alg_common crypt
|
||||
.cra_module = THIS_MODULE,
|
||||
},
|
||||
} },
|
||||
+ { .type = CRYPTO_ALG_TYPE_RNG, .u.rng = {
|
||||
+ .base = {
|
||||
+ .cra_name = "stdrng",
|
||||
+ .cra_driver_name = "crypto4xx_rng",
|
||||
+ .cra_priority = 300,
|
||||
+ .cra_ctxsize = 0,
|
||||
+ .cra_module = THIS_MODULE,
|
||||
+ },
|
||||
+ .generate = crypto4xx_prng_generate,
|
||||
+ .seed = crypto4xx_prng_seed,
|
||||
+ .seedsize = 0,
|
||||
+ } },
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1371,6 +1456,7 @@ static int crypto4xx_probe(struct platfo
|
||||
core_dev->dev->core_dev = core_dev;
|
||||
core_dev->dev->is_revb = is_revb;
|
||||
core_dev->device = dev;
|
||||
+ mutex_init(&core_dev->rng_lock);
|
||||
spin_lock_init(&core_dev->lock);
|
||||
INIT_LIST_HEAD(&core_dev->dev->alg_list);
|
||||
ratelimit_default_init(&core_dev->dev->aead_ratelimit);
|
||||
@@ -1450,6 +1536,7 @@ static int crypto4xx_remove(struct platf
|
||||
tasklet_kill(&core_dev->tasklet);
|
||||
/* Un-register with Linux CryptoAPI */
|
||||
crypto4xx_unregister_alg(core_dev->dev);
|
||||
+ mutex_destroy(&core_dev->rng_lock);
|
||||
/* Free all allocated memory */
|
||||
crypto4xx_stop_all(core_dev);
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.h
|
||||
@@ -23,8 +23,10 @@
|
||||
#define __CRYPTO4XX_CORE_H__
|
||||
|
||||
#include <linux/ratelimit.h>
|
||||
+#include <linux/mutex.h>
|
||||
#include <crypto/internal/hash.h>
|
||||
#include <crypto/internal/aead.h>
|
||||
+#include <crypto/internal/rng.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_sa.h"
|
||||
@@ -119,6 +121,7 @@ struct crypto4xx_core_device {
|
||||
u32 irq;
|
||||
struct tasklet_struct tasklet;
|
||||
spinlock_t lock;
|
||||
+ struct mutex rng_lock;
|
||||
};
|
||||
|
||||
struct crypto4xx_ctx {
|
||||
@@ -143,6 +146,7 @@ struct crypto4xx_alg_common {
|
||||
struct skcipher_alg cipher;
|
||||
struct ahash_alg hash;
|
||||
struct aead_alg aead;
|
||||
+ struct rng_alg rng;
|
||||
} u;
|
||||
};
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_reg_def.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
|
||||
@@ -100,6 +100,7 @@
|
||||
#define CRYPTO4XX_ENDIAN_CFG 0x000600d8
|
||||
|
||||
#define CRYPTO4XX_PRNG_STAT 0x00070000
|
||||
+#define CRYPTO4XX_PRNG_STAT_BUSY 0x1
|
||||
#define CRYPTO4XX_PRNG_CTRL 0x00070004
|
||||
#define CRYPTO4XX_PRNG_SEED_L 0x00070008
|
||||
#define CRYPTO4XX_PRNG_SEED_H 0x0007000c
|
@ -0,0 +1,39 @@
|
||||
From 6e88098ca43a3d80ae86908f7badba683c8a0d84 Mon Sep 17 00:00:00 2001
|
||||
From: Corentin Labbe <clabbe@baylibre.com>
|
||||
Date: Wed, 23 Jan 2019 11:24:18 +0000
|
||||
Subject: [PATCH 07/15] crypto: crypto4xx - Fix wrong
|
||||
ppc4xx_trng_probe()/ppc4xx_trng_remove() arguments
|
||||
|
||||
When building without CONFIG_HW_RANDOM_PPC4XX, I hit the following build failure:
|
||||
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_probe':
|
||||
drivers/crypto/amcc/crypto4xx_core.c:1407:20: error: passing argument 1 of 'ppc4xx_trng_probe' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
In file included from drivers/crypto/amcc/crypto4xx_core.c:50:0:
|
||||
drivers/crypto/amcc/crypto4xx_trng.h:28:20: note: expected 'struct crypto4xx_device *' but argument is of type 'struct crypto4xx_core_device *'
|
||||
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_remove':
|
||||
drivers/crypto/amcc/crypto4xx_core.c:1434:21: error: passing argument 1 of 'ppc4xx_trng_remove' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
In file included from drivers/crypto/amcc/crypto4xx_core.c:50:0:
|
||||
drivers/crypto/amcc/crypto4xx_trng.h:30:20: note: expected 'struct crypto4xx_device *' but argument is of type 'struct crypto4xx_core_device *'
|
||||
|
||||
This patch fix the needed argument of ppc4xx_trng_probe()/ppc4xx_trng_remove() in that case.
|
||||
|
||||
Fixes: 5343e674f32f ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
|
||||
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_trng.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_trng.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_trng.h
|
||||
@@ -26,9 +26,9 @@ void ppc4xx_trng_probe(struct crypto4xx_
|
||||
void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev);
|
||||
#else
|
||||
static inline void ppc4xx_trng_probe(
|
||||
- struct crypto4xx_device *dev __maybe_unused) { }
|
||||
+ struct crypto4xx_core_device *dev __maybe_unused) { }
|
||||
static inline void ppc4xx_trng_remove(
|
||||
- struct crypto4xx_device *dev __maybe_unused) { }
|
||||
+ struct crypto4xx_core_device *dev __maybe_unused) { }
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,63 @@
|
||||
From 38cf5533d7a876f75088bacc1277046f30005f28 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Mon, 22 Apr 2019 13:26:01 +0200
|
||||
Subject: [PATCH 12/15] crypto: crypto4xx - get rid of redundant using_sd
|
||||
variable
|
||||
|
||||
using_sd is used as a stand-in for sa_command_0.bf.scatter
|
||||
that we need to set anyway, so we might as well just prevent
|
||||
double-accounting.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_core.c | 6 ++----
|
||||
drivers/crypto/amcc/crypto4xx_core.h | 1 -
|
||||
2 files changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -539,7 +539,7 @@ static void crypto4xx_cipher_done(struct
|
||||
|
||||
req = skcipher_request_cast(pd_uinfo->async_req);
|
||||
|
||||
- if (pd_uinfo->using_sd) {
|
||||
+ if (pd_uinfo->sa_va->sa_command_0.bf.scatter) {
|
||||
crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
|
||||
req->cryptlen, req->dst);
|
||||
} else {
|
||||
@@ -593,7 +593,7 @@ static void crypto4xx_aead_done(struct c
|
||||
u32 icv[AES_BLOCK_SIZE];
|
||||
int err = 0;
|
||||
|
||||
- if (pd_uinfo->using_sd) {
|
||||
+ if (pd_uinfo->sa_va->sa_command_0.bf.scatter) {
|
||||
crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
|
||||
pd->pd_ctl_len.bf.pkt_len,
|
||||
dst);
|
||||
@@ -887,7 +887,6 @@ int crypto4xx_build_pd(struct crypto_asy
|
||||
* we know application give us dst a whole piece of memory
|
||||
* no need to use scatter ring.
|
||||
*/
|
||||
- pd_uinfo->using_sd = 0;
|
||||
pd_uinfo->first_sd = 0xffffffff;
|
||||
sa->sa_command_0.bf.scatter = 0;
|
||||
pd->dest = (u32)dma_map_page(dev->core_dev->device,
|
||||
@@ -901,7 +900,6 @@ int crypto4xx_build_pd(struct crypto_asy
|
||||
u32 sd_idx = fst_sd;
|
||||
nbytes = datalen;
|
||||
sa->sa_command_0.bf.scatter = 1;
|
||||
- pd_uinfo->using_sd = 1;
|
||||
pd_uinfo->first_sd = fst_sd;
|
||||
sd = crypto4xx_get_sdp(dev, &sd_dma, sd_idx);
|
||||
pd->dest = sd_dma;
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.h
|
||||
@@ -64,7 +64,6 @@ union shadow_sa_buf {
|
||||
struct pd_uinfo {
|
||||
struct crypto4xx_device *dev;
|
||||
u32 state;
|
||||
- u32 using_sd;
|
||||
u32 first_gd; /* first gather discriptor
|
||||
used by this packet */
|
||||
u32 num_gd; /* number of gather discriptor
|
@ -0,0 +1,30 @@
|
||||
From 9b84ad676e248a3e3c81db7f5d39e1739b3780aa Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sat, 15 Jun 2019 16:35:26 +0200
|
||||
Subject: [PATCH] powerpc/4xx/uic: clear pending interrupt after irq type/pol
|
||||
change
|
||||
|
||||
When testing out gpio-keys with a button, a spurious
|
||||
interrupt (and therefore a key press or release event)
|
||||
gets triggered as soon as the driver enables the irq
|
||||
line for the first time.
|
||||
|
||||
This patch clears any potential bogus generated interrupt
|
||||
that was caused by the switching of the associated irq's
|
||||
type and polarity.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
---
|
||||
arch/powerpc/platforms/4xx/uic.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/powerpc/platforms/4xx/uic.c
|
||||
+++ b/arch/powerpc/platforms/4xx/uic.c
|
||||
@@ -158,6 +158,7 @@ static int uic_set_irq_type(struct irq_d
|
||||
|
||||
mtdcr(uic->dcrbase + UIC_PR, pr);
|
||||
mtdcr(uic->dcrbase + UIC_TR, tr);
|
||||
+ mtdcr(uic->dcrbase + UIC_SR, ~mask);
|
||||
|
||||
raw_spin_unlock_irqrestore(&uic->lock, flags);
|
||||
|
@ -521,7 +521,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
|
||||
+
|
||||
+ default:
|
||||
+ return retval;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
driver = (struct hc_driver *)id->driver_data;
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#define AR7_IRQ_UART0 15
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -161,7 +161,7 @@ config AR7
|
||||
@@ -162,7 +162,7 @@ config AR7
|
||||
select HAVE_CLK
|
||||
help
|
||||
Support for the Texas Instruments AR7 System-on-a-Chip
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
config ATH25
|
||||
bool "Atheros AR231x/AR531x SoC support"
|
||||
@@ -1008,6 +1008,7 @@ config MIPS_PARAVIRT
|
||||
@@ -1009,6 +1009,7 @@ config MIPS_PARAVIRT
|
||||
endchoice
|
||||
|
||||
source "arch/mips/alchemy/Kconfig"
|
||||
|
@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
|
||||
--- a/drivers/net/can/spi/mcp251x.c
|
||||
+++ b/drivers/net/can/spi/mcp251x.c
|
||||
@@ -952,6 +952,9 @@ static int mcp251x_open(struct net_devic
|
||||
@@ -951,6 +951,9 @@ static int mcp251x_open(struct net_devic
|
||||
priv->tx_skb = NULL;
|
||||
priv->tx_len = 0;
|
||||
|
||||
|
@ -18,7 +18,7 @@ Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
|
||||
|
||||
--- a/drivers/usb/gadget/function/u_ether.c
|
||||
+++ b/drivers/usb/gadget/function/u_ether.c
|
||||
@@ -848,6 +848,10 @@ struct net_device *gether_setup_name_def
|
||||
@@ -850,6 +850,10 @@ struct net_device *gether_setup_name_def
|
||||
net->ethtool_ops = &ops;
|
||||
SET_NETDEV_DEVTYPE(net, &gadget_type);
|
||||
|
||||
|
@ -917,7 +917,7 @@ Fixes https://github.com/raspberrypi/linux/issues/2408
|
||||
}
|
||||
--- a/drivers/usb/core/hub.c
|
||||
+++ b/drivers/usb/core/hub.c
|
||||
@@ -5207,7 +5207,7 @@ static void port_event(struct usb_hub *h
|
||||
@@ -5210,7 +5210,7 @@ static void port_event(struct usb_hub *h
|
||||
u16 status = 0, unused;
|
||||
port_dev->over_current_count++;
|
||||
|
||||
|
@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
|
||||
--- a/drivers/net/can/spi/mcp251x.c
|
||||
+++ b/drivers/net/can/spi/mcp251x.c
|
||||
@@ -951,6 +951,9 @@ static int mcp251x_open(struct net_devic
|
||||
@@ -950,6 +950,9 @@ static int mcp251x_open(struct net_devic
|
||||
priv->tx_skb = NULL;
|
||||
priv->tx_len = 0;
|
||||
|
||||
|
@ -35,7 +35,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
gpiod_err(desc,
|
||||
"%s: tried to set a GPIO tied to an IRQ as output\n",
|
||||
__func__);
|
||||
@@ -3311,7 +3313,7 @@ int gpiochip_lock_as_irq(struct gpio_chi
|
||||
@@ -3312,7 +3314,7 @@ int gpiochip_lock_as_irq(struct gpio_chi
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/drivers/hid/hid-ids.h
|
||||
+++ b/drivers/hid/hid-ids.h
|
||||
@@ -232,6 +232,9 @@
|
||||
@@ -233,6 +233,9 @@
|
||||
#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
|
||||
#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
|
||||
|
||||
|
@ -26,7 +26,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
int bcm2835_v4l2_debug;
|
||||
module_param_named(debug, bcm2835_v4l2_debug, int, 0644);
|
||||
MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2");
|
||||
@@ -1967,3 +1961,9 @@ static struct platform_driver bcm2835_ca
|
||||
@@ -1980,3 +1974,9 @@ static struct platform_driver bcm2835_ca
|
||||
};
|
||||
|
||||
module_platform_driver(bcm2835_camera_driver)
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -1539,8 +1539,11 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1552,8 +1552,11 @@ static int mmal_init(struct bm2835_mmal_
|
||||
struct vchiq_mmal_component *camera;
|
||||
|
||||
ret = vchiq_mmal_init(&dev->instance);
|
||||
@ -28,7 +28,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
|
||||
/* get the camera component ready */
|
||||
ret = vchiq_mmal_component_init(dev->instance, "ril.camera",
|
||||
@@ -1549,7 +1552,9 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1562,7 +1565,9 @@ static int mmal_init(struct bm2835_mmal_
|
||||
goto unreg_mmal;
|
||||
|
||||
camera = dev->component[MMAL_COMPONENT_CAMERA];
|
||||
@ -39,7 +39,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
ret = -EINVAL;
|
||||
goto unreg_camera;
|
||||
}
|
||||
@@ -1557,8 +1562,11 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1570,8 +1575,11 @@ static int mmal_init(struct bm2835_mmal_
|
||||
ret = set_camera_parameters(dev->instance,
|
||||
camera,
|
||||
dev);
|
||||
@ -52,7 +52,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
|
||||
/* There was an error in the firmware that meant the camera component
|
||||
* produced BGR instead of RGB.
|
||||
@@ -1647,8 +1655,8 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1660,8 +1668,8 @@ static int mmal_init(struct bm2835_mmal_
|
||||
|
||||
if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) {
|
||||
ret = -EINVAL;
|
||||
@ -63,7 +63,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
goto unreg_preview;
|
||||
}
|
||||
|
||||
@@ -1661,8 +1669,8 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1674,8 +1682,8 @@ static int mmal_init(struct bm2835_mmal_
|
||||
|
||||
if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) {
|
||||
ret = -EINVAL;
|
||||
@ -74,7 +74,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
1);
|
||||
goto unreg_image_encoder;
|
||||
}
|
||||
@@ -1676,8 +1684,8 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1689,8 +1697,8 @@ static int mmal_init(struct bm2835_mmal_
|
||||
|
||||
if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) {
|
||||
ret = -EINVAL;
|
||||
@ -85,7 +85,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
1);
|
||||
goto unreg_vid_encoder;
|
||||
}
|
||||
@@ -1706,8 +1714,11 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1719,8 +1727,11 @@ static int mmal_init(struct bm2835_mmal_
|
||||
sizeof(enable));
|
||||
}
|
||||
ret = bm2835_mmal_set_all_camera_controls(dev);
|
||||
@ -98,7 +98,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1867,21 +1878,29 @@ static int bcm2835_mmal_probe(struct pla
|
||||
@@ -1880,21 +1891,29 @@ static int bcm2835_mmal_probe(struct pla
|
||||
snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name),
|
||||
"%s", BM2835_MMAL_MODULE_NAME);
|
||||
ret = v4l2_device_register(NULL, &dev->v4l2_dev);
|
||||
@ -132,7 +132,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
/* initialize queue */
|
||||
q = &dev->capture.vb_vidq;
|
||||
memset(q, 0, sizeof(*q));
|
||||
@@ -1899,16 +1918,19 @@ static int bcm2835_mmal_probe(struct pla
|
||||
@@ -1912,16 +1931,19 @@ static int bcm2835_mmal_probe(struct pla
|
||||
|
||||
/* initialise video devices */
|
||||
ret = bm2835_mmal_init_device(dev, &dev->vdev);
|
||||
@ -155,7 +155,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
goto unreg_dev;
|
||||
}
|
||||
|
||||
@@ -1932,8 +1954,6 @@ cleanup_gdev:
|
||||
@@ -1945,8 +1967,6 @@ cleanup_gdev:
|
||||
bcm2835_cleanup_instance(gdev[i]);
|
||||
gdev[i] = NULL;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
@@ -1624,8 +1624,11 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1620,8 +1620,11 @@ int vchiq_mmal_component_init(struct vch
|
||||
component = &instance->component[instance->component_idx];
|
||||
|
||||
ret = create_component(instance, component, name);
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -1847,6 +1847,12 @@ static int bcm2835_mmal_probe(struct pla
|
||||
@@ -1860,6 +1860,12 @@ static int bcm2835_mmal_probe(struct pla
|
||||
num_cameras = get_num_cameras(instance,
|
||||
resolutions,
|
||||
MAX_BCM2835_CAMERAS);
|
||||
@ -29,7 +29,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
if (num_cameras > MAX_BCM2835_CAMERAS)
|
||||
num_cameras = MAX_BCM2835_CAMERAS;
|
||||
|
||||
@@ -1955,6 +1961,9 @@ cleanup_gdev:
|
||||
@@ -1968,6 +1974,9 @@ cleanup_gdev:
|
||||
gdev[i] = NULL;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* mmal instance */
|
||||
struct vchiq_mmal_instance *instance;
|
||||
/* mmal port */
|
||||
@@ -167,6 +169,9 @@ struct vchiq_mmal_instance {
|
||||
@@ -168,6 +170,9 @@ struct vchiq_mmal_instance {
|
||||
/* component to use next */
|
||||
int component_idx;
|
||||
struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
|
||||
@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
};
|
||||
|
||||
static struct mmal_msg_context *
|
||||
@@ -248,7 +253,44 @@ static void buffer_work_cb(struct work_s
|
||||
@@ -251,7 +256,44 @@ static void buffer_work_cb(struct work_s
|
||||
msg_context->u.bulk.mmal_flags,
|
||||
msg_context->u.bulk.dts,
|
||||
msg_context->u.bulk.pts);
|
||||
@ -87,7 +87,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
/* enqueue a bulk receive for a given message context */
|
||||
@@ -257,7 +299,6 @@ static int bulk_receive(struct vchiq_mma
|
||||
@@ -260,7 +302,6 @@ static int bulk_receive(struct vchiq_mma
|
||||
struct mmal_msg_context *msg_context)
|
||||
{
|
||||
unsigned long rd_len;
|
||||
@ -95,7 +95,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
rd_len = msg->u.buffer_from_host.buffer_header.length;
|
||||
|
||||
@@ -293,45 +334,10 @@ static int bulk_receive(struct vchiq_mma
|
||||
@@ -294,45 +335,10 @@ static int bulk_receive(struct vchiq_mma
|
||||
msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
|
||||
msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
|
||||
|
||||
@ -144,16 +144,16 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
/* data in message, memcpy from packet into output buffer */
|
||||
@@ -379,6 +385,8 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
@@ -380,6 +386,8 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
|
||||
/* initialise work structure ready to schedule callback */
|
||||
INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb);
|
||||
+ INIT_WORK(&msg_context->u.bulk.buffer_to_host_work,
|
||||
+ buffer_to_host_work_cb);
|
||||
|
||||
/* prep the buffer from host message */
|
||||
memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */
|
||||
@@ -459,7 +467,7 @@ static void buffer_to_host_cb(struct vch
|
||||
atomic_inc(&port->buffers_with_vpu);
|
||||
|
||||
@@ -465,7 +473,7 @@ static void buffer_to_host_cb(struct vch
|
||||
if (msg->u.buffer_from_host.buffer_header.flags &
|
||||
MMAL_BUFFER_HEADER_FLAG_EOS) {
|
||||
msg_context->u.bulk.status =
|
||||
@ -162,7 +162,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (msg_context->u.bulk.status == 0)
|
||||
return; /* successful bulk submission, bulk
|
||||
* completion will trigger callback
|
||||
@@ -1793,6 +1801,9 @@ int vchiq_mmal_finalise(struct vchiq_mma
|
||||
@@ -1789,6 +1797,9 @@ int vchiq_mmal_finalise(struct vchiq_mma
|
||||
|
||||
mutex_unlock(&instance->vchiq_mutex);
|
||||
|
||||
@ -172,7 +172,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
vfree(instance->bulk_scratch);
|
||||
|
||||
idr_destroy(&instance->context_map);
|
||||
@@ -1862,6 +1873,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in
|
||||
@@ -1858,6 +1869,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in
|
||||
|
||||
params.callback_param = instance;
|
||||
|
||||
@ -184,7 +184,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
status = vchi_service_open(vchi_instance, ¶ms, &instance->handle);
|
||||
if (status) {
|
||||
pr_err("Failed to open VCHI service connection (status=%d)\n",
|
||||
@@ -1876,8 +1892,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in
|
||||
@@ -1872,8 +1888,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in
|
||||
return 0;
|
||||
|
||||
err_close_services:
|
||||
|
@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -360,8 +360,13 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
@@ -363,8 +363,13 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
}
|
||||
} else {
|
||||
if (dev->capture.frame_count) {
|
||||
@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
ktime_t timestamp;
|
||||
s64 runtime_us = pts -
|
||||
dev->capture.vc_start_timestamp;
|
||||
@@ -374,10 +379,28 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
@@ -377,10 +382,28 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
ktime_to_ns(timestamp));
|
||||
buf->vb.vb2_buf.timestamp = ktime_to_ns(timestamp);
|
||||
} else {
|
||||
@ -66,7 +66,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
|
||||
if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS &&
|
||||
@@ -543,6 +566,7 @@ static int start_streaming(struct vb2_qu
|
||||
@@ -546,6 +569,7 @@ static int start_streaming(struct vb2_qu
|
||||
dev->capture.vc_start_timestamp, parameter_size);
|
||||
|
||||
dev->capture.kernel_start_ts = ktime_get();
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -398,6 +398,9 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
@@ -401,6 +401,9 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
dev->capture.last_timestamp = buf->vb.vb2_buf.timestamp;
|
||||
|
||||
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length);
|
||||
|
@ -24,10 +24,10 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
+
|
||||
+ if (length == 0) {
|
||||
/* stream ended */
|
||||
if (buf) {
|
||||
/* this should only ever happen if the port is
|
||||
@@ -358,71 +360,72 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
/* signal frame completion */
|
||||
if (dev->capture.frame_count) {
|
||||
/* empty buffer whilst capturing - expected to be an
|
||||
@@ -361,71 +363,72 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
complete(&dev->capture.frame_cmplt);
|
||||
}
|
||||
- } else {
|
||||
@ -158,7 +158,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
static int enable_camera(struct bm2835_mmal_dev *dev)
|
||||
@@ -802,27 +805,29 @@ static int vidioc_overlay(struct file *f
|
||||
@@ -815,27 +818,29 @@ static int vidioc_overlay(struct file *f
|
||||
|
||||
ret = vchiq_mmal_port_set_format(dev->instance, src);
|
||||
if (ret < 0)
|
||||
|
@ -152,7 +152,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
static void buffer_cb(struct vchiq_mmal_instance *instance,
|
||||
@@ -436,7 +436,7 @@ static int enable_camera(struct bm2835_m
|
||||
@@ -439,7 +439,7 @@ static int enable_camera(struct bm2835_m
|
||||
if (!dev->camera_use_count) {
|
||||
ret = vchiq_mmal_port_parameter_set(
|
||||
dev->instance,
|
||||
@ -161,7 +161,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
|
||||
sizeof(dev->camera_num));
|
||||
if (ret < 0) {
|
||||
@@ -447,7 +447,7 @@ static int enable_camera(struct bm2835_m
|
||||
@@ -450,7 +450,7 @@ static int enable_camera(struct bm2835_m
|
||||
|
||||
ret = vchiq_mmal_component_enable(
|
||||
dev->instance,
|
||||
@ -170,7 +170,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"Failed enabling camera, ret %d\n", ret);
|
||||
@@ -479,7 +479,7 @@ static int disable_camera(struct bm2835_
|
||||
@@ -482,7 +482,7 @@ static int disable_camera(struct bm2835_
|
||||
ret =
|
||||
vchiq_mmal_component_disable(
|
||||
dev->instance,
|
||||
@ -179,7 +179,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"Failed disabling camera, ret %d\n", ret);
|
||||
@@ -487,7 +487,7 @@ static int disable_camera(struct bm2835_
|
||||
@@ -490,7 +490,7 @@ static int disable_camera(struct bm2835_
|
||||
}
|
||||
vchiq_mmal_port_parameter_set(
|
||||
dev->instance,
|
||||
@ -188,7 +188,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
MMAL_PARAMETER_CAMERA_NUM, &i,
|
||||
sizeof(i));
|
||||
}
|
||||
@@ -539,7 +539,7 @@ static int start_streaming(struct vb2_qu
|
||||
@@ -542,7 +542,7 @@ static int start_streaming(struct vb2_qu
|
||||
/* if the preview is not already running, wait for a few frames for AGC
|
||||
* to settle down.
|
||||
*/
|
||||
@ -197,7 +197,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
msleep(300);
|
||||
|
||||
/* enable the connection from camera to encoder (if applicable) */
|
||||
@@ -762,9 +762,9 @@ static int vidioc_s_fmt_vid_overlay(stru
|
||||
@@ -775,9 +775,9 @@ static int vidioc_s_fmt_vid_overlay(stru
|
||||
vidioc_try_fmt_vid_overlay(file, priv, f);
|
||||
|
||||
dev->overlay = f->fmt.win;
|
||||
@ -209,7 +209,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -777,13 +777,13 @@ static int vidioc_overlay(struct file *f
|
||||
@@ -790,13 +790,13 @@ static int vidioc_overlay(struct file *f
|
||||
struct vchiq_mmal_port *src;
|
||||
struct vchiq_mmal_port *dst;
|
||||
|
||||
@ -227,7 +227,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
if (!on) {
|
||||
/* disconnect preview ports and disable component */
|
||||
@@ -795,14 +795,14 @@ static int vidioc_overlay(struct file *f
|
||||
@@ -808,14 +808,14 @@ static int vidioc_overlay(struct file *f
|
||||
if (ret >= 0)
|
||||
ret = vchiq_mmal_component_disable(
|
||||
dev->instance,
|
||||
@ -244,7 +244,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
ret = vchiq_mmal_port_set_format(dev->instance, src);
|
||||
if (ret < 0)
|
||||
@@ -819,7 +819,7 @@ static int vidioc_overlay(struct file *f
|
||||
@@ -832,7 +832,7 @@ static int vidioc_overlay(struct file *f
|
||||
|
||||
ret = vchiq_mmal_component_enable(
|
||||
dev->instance,
|
||||
@ -253,7 +253,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -840,8 +840,8 @@ static int vidioc_g_fbuf(struct file *fi
|
||||
@@ -853,8 +853,8 @@ static int vidioc_g_fbuf(struct file *fi
|
||||
*/
|
||||
struct bm2835_mmal_dev *dev = video_drvdata(file);
|
||||
struct vchiq_mmal_port *preview_port =
|
||||
@ -264,7 +264,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY |
|
||||
V4L2_FBUF_CAP_GLOBAL_ALPHA;
|
||||
@@ -1044,31 +1044,31 @@ static int mmal_setup_components(struct
|
||||
@@ -1057,31 +1057,31 @@ static int mmal_setup_components(struct
|
||||
}
|
||||
/* format dependent port setup */
|
||||
switch (mfmt->mmal_component) {
|
||||
@ -311,7 +311,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1110,13 +1110,12 @@ static int mmal_setup_components(struct
|
||||
@@ -1123,13 +1123,12 @@ static int mmal_setup_components(struct
|
||||
|
||||
if (!ret
|
||||
&& camera_port ==
|
||||
@ -329,7 +329,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* Preview and encode ports need to match on resolution */
|
||||
if (overlay_enabled) {
|
||||
/* Need to disable the overlay before we can update
|
||||
@@ -1147,7 +1146,7 @@ static int mmal_setup_components(struct
|
||||
@@ -1160,7 +1159,7 @@ static int mmal_setup_components(struct
|
||||
ret = vchiq_mmal_port_connect_tunnel(
|
||||
dev->instance,
|
||||
preview_port,
|
||||
@ -338,7 +338,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (!ret)
|
||||
ret = vchiq_mmal_port_enable(dev->instance,
|
||||
preview_port,
|
||||
@@ -1201,11 +1200,11 @@ static int mmal_setup_components(struct
|
||||
@@ -1214,11 +1213,11 @@ static int mmal_setup_components(struct
|
||||
port->format.encoding_variant = 0;
|
||||
/* Set any encoding specific parameters */
|
||||
switch (mfmt->mmal_component) {
|
||||
@ -352,7 +352,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* Could set EXIF parameters here */
|
||||
break;
|
||||
default:
|
||||
@@ -1580,14 +1579,14 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1593,14 +1592,14 @@ static int mmal_init(struct bm2835_mmal_
|
||||
|
||||
/* get the camera component ready */
|
||||
ret = vchiq_mmal_component_init(dev->instance, "ril.camera",
|
||||
@ -371,7 +371,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
ret = -EINVAL;
|
||||
goto unreg_camera;
|
||||
}
|
||||
@@ -1609,7 +1608,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1622,7 +1621,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
dev->rgb_bgr_swapped = true;
|
||||
param_size = sizeof(supported_encodings);
|
||||
ret = vchiq_mmal_port_parameter_get(dev->instance,
|
||||
@ -380,7 +380,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
MMAL_PARAMETER_SUPPORTED_ENCODINGS,
|
||||
&supported_encodings,
|
||||
¶m_size);
|
||||
@@ -1630,7 +1629,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1643,7 +1642,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -389,7 +389,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
format->encoding = MMAL_ENCODING_OPAQUE;
|
||||
format->encoding_variant = MMAL_ENCODING_I420;
|
||||
@@ -1644,7 +1643,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1657,7 +1656,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
format->es->video.frame_rate.num = 0; /* Rely on fps_range */
|
||||
format->es->video.frame_rate.den = 1;
|
||||
|
||||
@ -398,7 +398,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
format->encoding = MMAL_ENCODING_OPAQUE;
|
||||
format->encoding_variant = MMAL_ENCODING_I420;
|
||||
@@ -1658,7 +1657,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1671,7 +1670,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
format->es->video.frame_rate.num = 0; /* Rely on fps_range */
|
||||
format->es->video.frame_rate.den = 1;
|
||||
|
||||
@ -407,7 +407,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
format->encoding = MMAL_ENCODING_OPAQUE;
|
||||
|
||||
@@ -1682,28 +1681,28 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1695,28 +1694,28 @@ static int mmal_init(struct bm2835_mmal_
|
||||
/* get the preview component ready */
|
||||
ret = vchiq_mmal_component_init(
|
||||
dev->instance, "ril.video_render",
|
||||
@ -442,7 +442,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
1);
|
||||
goto unreg_image_encoder;
|
||||
}
|
||||
@@ -1711,21 +1710,21 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1724,21 +1723,21 @@ static int mmal_init(struct bm2835_mmal_
|
||||
/* get the video encoder component ready */
|
||||
ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode",
|
||||
&dev->
|
||||
@ -468,7 +468,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
encoder_port->format.encoding = MMAL_ENCODING_H264;
|
||||
ret = vchiq_mmal_port_set_format(dev->instance,
|
||||
encoder_port);
|
||||
@@ -1736,12 +1735,12 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1749,12 +1748,12 @@ static int mmal_init(struct bm2835_mmal_
|
||||
|
||||
vchiq_mmal_port_parameter_set(
|
||||
dev->instance,
|
||||
@ -483,7 +483,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
|
||||
&enable,
|
||||
sizeof(enable));
|
||||
@@ -1759,23 +1758,23 @@ unreg_vid_encoder:
|
||||
@@ -1772,23 +1771,23 @@ unreg_vid_encoder:
|
||||
pr_err("Cleanup: Destroy video encoder\n");
|
||||
vchiq_mmal_component_finalise(
|
||||
dev->instance,
|
||||
@ -511,7 +511,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
unreg_mmal:
|
||||
vchiq_mmal_finalise(dev->instance);
|
||||
@@ -1831,21 +1830,21 @@ static void bcm2835_cleanup_instance(str
|
||||
@@ -1844,21 +1843,21 @@ static void bcm2835_cleanup_instance(str
|
||||
dev->capture.encode_component);
|
||||
}
|
||||
vchiq_mmal_component_disable(dev->instance,
|
||||
|
@ -23,7 +23,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
static void buffer_cb(struct vchiq_mmal_instance *instance,
|
||||
@@ -782,8 +781,7 @@ static int vidioc_overlay(struct file *f
|
||||
@@ -795,8 +794,7 @@ static int vidioc_overlay(struct file *f
|
||||
return 0; /* already in requested state */
|
||||
|
||||
src =
|
||||
@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
if (!on) {
|
||||
/* disconnect preview ports and disable component */
|
||||
@@ -840,8 +838,7 @@ static int vidioc_g_fbuf(struct file *fi
|
||||
@@ -853,8 +851,7 @@ static int vidioc_g_fbuf(struct file *fi
|
||||
*/
|
||||
struct bm2835_mmal_dev *dev = video_drvdata(file);
|
||||
struct vchiq_mmal_port *preview_port =
|
||||
@ -43,7 +43,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY |
|
||||
V4L2_FBUF_CAP_GLOBAL_ALPHA;
|
||||
@@ -1033,8 +1030,7 @@ static int mmal_setup_components(struct
|
||||
@@ -1046,8 +1043,7 @@ static int mmal_setup_components(struct
|
||||
dev->capture.camera_port, NULL);
|
||||
dev->capture.camera_port = NULL;
|
||||
ret = vchiq_mmal_component_disable(dev->instance,
|
||||
@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (ret)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"Failed to disable encode component %d\n",
|
||||
@@ -1049,26 +1045,22 @@ static int mmal_setup_components(struct
|
||||
@@ -1062,26 +1058,22 @@ static int mmal_setup_components(struct
|
||||
if (f->fmt.pix.width <= max_video_width
|
||||
&& f->fmt.pix.height <= max_video_height)
|
||||
camera_port = port =
|
||||
@ -84,7 +84,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1110,8 +1102,7 @@ static int mmal_setup_components(struct
|
||||
@@ -1123,8 +1115,7 @@ static int mmal_setup_components(struct
|
||||
|
||||
if (!ret
|
||||
&& camera_port ==
|
||||
@ -94,7 +94,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
bool overlay_enabled =
|
||||
!!dev->component[COMP_PREVIEW]->enabled;
|
||||
struct vchiq_mmal_port *preview_port =
|
||||
@@ -1248,9 +1239,8 @@ static int mmal_setup_components(struct
|
||||
@@ -1261,9 +1252,8 @@ static int mmal_setup_components(struct
|
||||
port->current_buffer.size);
|
||||
port->current_buffer.size =
|
||||
(f->fmt.pix.sizeimage <
|
||||
@ -106,7 +106,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
v4l2_dbg(1, bcm2835_v4l2_debug,
|
||||
&dev->v4l2_dev,
|
||||
@@ -1709,8 +1699,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
@@ -1722,8 +1712,7 @@ static int mmal_init(struct bm2835_mmal_
|
||||
|
||||
/* get the video encoder component ready */
|
||||
ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode",
|
||||
@ -116,7 +116,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
if (ret < 0)
|
||||
goto unreg_image_encoder;
|
||||
|
||||
@@ -1833,12 +1822,10 @@ static void bcm2835_cleanup_instance(str
|
||||
@@ -1846,12 +1835,10 @@ static void bcm2835_cleanup_instance(str
|
||||
dev->component[COMP_CAMERA]);
|
||||
|
||||
vchiq_mmal_component_finalise(dev->instance,
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -566,10 +566,11 @@ static int start_streaming(struct vb2_qu
|
||||
@@ -569,10 +569,11 @@ static int start_streaming(struct vb2_qu
|
||||
|
||||
/* Flag to indicate just to rely on kernel timestamps */
|
||||
dev->capture.vc_start_timestamp = -1;
|
||||
@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev,
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
@@ -1262,9 +1262,10 @@ static int port_parameter_get(struct vch
|
||||
@@ -1268,9 +1268,10 @@ static int port_parameter_get(struct vch
|
||||
memcpy(value, &rmsg->u.port_parameter_get_reply.value,
|
||||
*value_size);
|
||||
*value_size = rmsg->u.port_parameter_get_reply.size;
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -542,8 +542,8 @@ static int start_streaming(struct vb2_qu
|
||||
@@ -545,8 +545,8 @@ static int start_streaming(struct vb2_qu
|
||||
msleep(300);
|
||||
|
||||
/* enable the connection from camera to encoder (if applicable) */
|
||||
@ -25,7 +25,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
ret = vchiq_mmal_port_enable(dev->instance,
|
||||
dev->capture.camera_port, NULL);
|
||||
if (ret) {
|
||||
@@ -1043,8 +1043,8 @@ static int mmal_setup_components(struct
|
||||
@@ -1056,8 +1056,8 @@ static int mmal_setup_components(struct
|
||||
switch (mfmt->mmal_component) {
|
||||
case COMP_CAMERA:
|
||||
/* Make a further decision on port based on resolution */
|
||||
@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
camera_port = port =
|
||||
&dev->component[COMP_CAMERA]->output[CAM_PORT_VIDEO];
|
||||
else
|
||||
@@ -1101,8 +1101,8 @@ static int mmal_setup_components(struct
|
||||
@@ -1114,8 +1114,8 @@ static int mmal_setup_components(struct
|
||||
|
||||
ret = vchiq_mmal_port_set_format(dev->instance, camera_port);
|
||||
|
||||
|
@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -412,8 +412,7 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
@@ -415,8 +415,7 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
buf->vb.flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
|
||||
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
|
||||
@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
|
||||
if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS &&
|
||||
@@ -581,8 +580,8 @@ static int start_streaming(struct vb2_qu
|
||||
@@ -584,8 +583,8 @@ static int start_streaming(struct vb2_qu
|
||||
vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb);
|
||||
if (ret) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
@ -38,7 +38,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
vchiq_mmal_port_disable(dev->instance,
|
||||
dev->capture.camera_port);
|
||||
@@ -978,8 +977,7 @@ static int vidioc_try_fmt_vid_cap(struct
|
||||
@@ -991,8 +990,7 @@ static int vidioc_try_fmt_vid_cap(struct
|
||||
f->fmt.pix.bytesperline =
|
||||
(f->fmt.pix.bytesperline + align_mask) & ~align_mask;
|
||||
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
|
||||
@ -48,7 +48,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
f->fmt.pix.bytesperline, align_mask);
|
||||
}
|
||||
|
||||
@@ -1325,7 +1323,7 @@ static int vidioc_s_fmt_vid_cap(struct f
|
||||
@@ -1338,7 +1336,7 @@ static int vidioc_s_fmt_vid_cap(struct f
|
||||
}
|
||||
|
||||
static int vidioc_enum_framesizes(struct file *file, void *fh,
|
||||
@ -104,7 +104,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
case MMAL_CONTROL_TYPE_CLUSTER:
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
@@ -645,7 +645,7 @@ static int send_synchronous_mmal_msg(str
|
||||
@@ -651,7 +651,7 @@ static int send_synchronous_mmal_msg(str
|
||||
if (payload_len >
|
||||
(MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) {
|
||||
pr_err("payload length %d exceeds max:%d\n", payload_len,
|
||||
@ -115,7 +115,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
|
||||
@@ -128,7 +128,7 @@ int vchiq_mmal_port_enable(
|
||||
@@ -131,7 +131,7 @@ int vchiq_mmal_port_enable(
|
||||
* disable a port will dequeue any pending buffers
|
||||
*/
|
||||
int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance,
|
||||
@ -124,7 +124,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance,
|
||||
struct vchiq_mmal_port *port,
|
||||
@@ -146,8 +146,8 @@ int vchiq_mmal_port_set_format(struct vc
|
||||
@@ -149,8 +149,8 @@ int vchiq_mmal_port_set_format(struct vc
|
||||
struct vchiq_mmal_port *port);
|
||||
|
||||
int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
|
||||
|
@ -1,95 +0,0 @@
|
||||
From 754a5ed1aa42ce9d5be5f84a5a0888f850b15e00 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
Date: Thu, 28 Jun 2018 15:57:25 +0100
|
||||
Subject: [PATCH 252/703] staging: bcm2835_camera: Ensure all buffers are
|
||||
returned on disable
|
||||
|
||||
With the recent change to match MMAL and V4L2 buffers there
|
||||
is a need to wait for all MMAL buffers to be returned during
|
||||
stop_streaming.
|
||||
|
||||
Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
|
||||
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
---
|
||||
.../bcm2835-camera/bcm2835-camera.c | 22 ++++++++++++++-----
|
||||
.../vc04_services/bcm2835-camera/mmal-vchiq.c | 4 ++++
|
||||
.../vc04_services/bcm2835-camera/mmal-vchiq.h | 3 +++
|
||||
3 files changed, 23 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -607,6 +607,7 @@ static void stop_streaming(struct vb2_qu
|
||||
int ret;
|
||||
unsigned long timeout;
|
||||
struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
|
||||
+ struct vchiq_mmal_port *port = dev->capture.port;
|
||||
|
||||
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n",
|
||||
__func__, dev);
|
||||
@@ -630,12 +631,6 @@ static void stop_streaming(struct vb2_qu
|
||||
&dev->capture.frame_count,
|
||||
sizeof(dev->capture.frame_count));
|
||||
|
||||
- /* wait for last frame to complete */
|
||||
- timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ);
|
||||
- if (timeout == 0)
|
||||
- v4l2_err(&dev->v4l2_dev,
|
||||
- "timed out waiting for frame completion\n");
|
||||
-
|
||||
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
|
||||
"disabling connection\n");
|
||||
|
||||
@@ -650,6 +645,21 @@ static void stop_streaming(struct vb2_qu
|
||||
ret);
|
||||
}
|
||||
|
||||
+ /* wait for all buffers to be returned */
|
||||
+ while (atomic_read(&port->buffers_with_vpu)) {
|
||||
+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
|
||||
+ "%s: Waiting for buffers to be returned - %d outstanding\n",
|
||||
+ __func__, atomic_read(&port->buffers_with_vpu));
|
||||
+ timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt,
|
||||
+ HZ);
|
||||
+ if (timeout == 0) {
|
||||
+ v4l2_err(&dev->v4l2_dev, "%s: Timeout waiting for buffers to be returned - %d outstanding\n",
|
||||
+ __func__,
|
||||
+ atomic_read(&port->buffers_with_vpu));
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (disable_camera(dev) < 0)
|
||||
v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n");
|
||||
}
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
@@ -246,6 +246,8 @@ static void buffer_work_cb(struct work_s
|
||||
struct mmal_msg_context *msg_context =
|
||||
container_of(work, struct mmal_msg_context, u.bulk.work);
|
||||
|
||||
+ atomic_dec(&msg_context->u.bulk.port->buffers_with_vpu);
|
||||
+
|
||||
msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance,
|
||||
msg_context->u.bulk.port,
|
||||
msg_context->u.bulk.status,
|
||||
@@ -389,6 +391,8 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
INIT_WORK(&msg_context->u.bulk.buffer_to_host_work,
|
||||
buffer_to_host_work_cb);
|
||||
|
||||
+ atomic_inc(&port->buffers_with_vpu);
|
||||
+
|
||||
/* prep the buffer from host message */
|
||||
memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
|
||||
@@ -72,6 +72,9 @@ struct vchiq_mmal_port {
|
||||
struct list_head buffers;
|
||||
/* lock to serialise adding and removing buffers from list */
|
||||
spinlock_t slock;
|
||||
+
|
||||
+ /* Count of buffers the VPU has yet to return */
|
||||
+ atomic_t buffers_with_vpu;
|
||||
/* callback on buffer completion */
|
||||
vchiq_mmal_buffer_cb buffer_cb;
|
||||
/* callback context */
|
@ -1,39 +0,0 @@
|
||||
From 98457a5263c83026cf1d451d44d8b028b8423b87 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
Date: Wed, 4 Jul 2018 17:01:15 +0100
|
||||
Subject: [PATCH 253/703] staging: bcm2835-camera: Remove check of the number
|
||||
of buffers supplied
|
||||
|
||||
Before 9384167 there was a need to ensure that there were sufficient
|
||||
buffers supplied from the user to cover those being sent to the VPU
|
||||
(always 1).
|
||||
With 9384167 the buffers are linked 1:1 between MMAL and V4L2,
|
||||
therefore there is no need for that check, and indeed it is wrong
|
||||
as there is no need to submit all the buffers before starting streaming.
|
||||
|
||||
Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
|
||||
|
||||
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
---
|
||||
.../staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 10 ----------
|
||||
1 file changed, 10 deletions(-)
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
@@ -1338,16 +1338,6 @@ static int port_enable(struct vchiq_mmal
|
||||
if (port->enabled)
|
||||
return 0;
|
||||
|
||||
- /* ensure there are enough buffers queued to cover the buffer headers */
|
||||
- if (port->buffer_cb) {
|
||||
- hdr_count = 0;
|
||||
- list_for_each(buf_head, &port->buffers) {
|
||||
- hdr_count++;
|
||||
- }
|
||||
- if (hdr_count < port->current_buffer.num)
|
||||
- return -ENOSPC;
|
||||
- }
|
||||
-
|
||||
ret = port_action_port(instance, port,
|
||||
MMAL_MSG_PORT_ACTION_TYPE_ENABLE);
|
||||
if (ret)
|
@ -1,84 +0,0 @@
|
||||
From 1da35962d95cdb8648cb85c4b6f3d3367be88601 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
Date: Thu, 5 Jul 2018 16:17:03 +0100
|
||||
Subject: [PATCH 254/703] staging: bcm2835-camera: Handle empty EOS buffers
|
||||
whilst streaming
|
||||
|
||||
The change to mapping V4L2 to MMAL buffers 1:1 didn't handle
|
||||
the condition we get with raw pixel buffers (eg YUV and RGB)
|
||||
direct from the camera's stills port. That sends the pixel buffer
|
||||
and then an empty buffer with the EOS flag set. The EOS buffer
|
||||
wasn't handled and returned an error up the stack.
|
||||
|
||||
Handle the condition correctly by returning it to the component
|
||||
if streaming, or returning with an error if stopping streaming.
|
||||
|
||||
Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
|
||||
|
||||
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
---
|
||||
.../bcm2835-camera/bcm2835-camera.c | 21 +++++++++++--------
|
||||
.../vc04_services/bcm2835-camera/mmal-vchiq.c | 5 +++--
|
||||
2 files changed, 15 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
|
||||
@@ -339,16 +339,13 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
|
||||
if (length == 0) {
|
||||
/* stream ended */
|
||||
- if (buf) {
|
||||
- /* this should only ever happen if the port is
|
||||
- * disabled and there are buffers still queued
|
||||
+ if (dev->capture.frame_count) {
|
||||
+ /* empty buffer whilst capturing - expected to be an
|
||||
+ * EOS, so grab another frame
|
||||
*/
|
||||
- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
- pr_debug("Empty buffer");
|
||||
- } else if (dev->capture.frame_count) {
|
||||
- /* grab another frame */
|
||||
if (is_capturing(dev)) {
|
||||
- pr_debug("Grab another frame");
|
||||
+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
|
||||
+ "Grab another frame");
|
||||
vchiq_mmal_port_parameter_set(
|
||||
instance,
|
||||
dev->capture.camera_port,
|
||||
@@ -356,8 +353,14 @@ static void buffer_cb(struct vchiq_mmal_
|
||||
&dev->capture.frame_count,
|
||||
sizeof(dev->capture.frame_count));
|
||||
}
|
||||
+ if (vchiq_mmal_submit_buffer(instance, port, buf))
|
||||
+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
|
||||
+ "Failed to return EOS buffer");
|
||||
} else {
|
||||
- /* signal frame completion */
|
||||
+ /* stopping streaming.
|
||||
+ * return buffer, and signal frame completion
|
||||
+ */
|
||||
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
complete(&dev->capture.frame_cmplt);
|
||||
}
|
||||
return;
|
||||
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
|
||||
@@ -332,8 +332,6 @@ static int bulk_receive(struct vchiq_mma
|
||||
|
||||
/* store length */
|
||||
msg_context->u.bulk.buffer_used = rd_len;
|
||||
- msg_context->u.bulk.mmal_flags =
|
||||
- msg->u.buffer_from_host.buffer_header.flags;
|
||||
msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
|
||||
msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
|
||||
|
||||
@@ -461,6 +459,9 @@ static void buffer_to_host_cb(struct vch
|
||||
return;
|
||||
}
|
||||
|
||||
+ msg_context->u.bulk.mmal_flags =
|
||||
+ msg->u.buffer_from_host.buffer_header.flags;
|
||||
+
|
||||
if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) {
|
||||
/* message reception had an error */
|
||||
pr_warn("error %d in reply\n", msg->h.status);
|
File diff suppressed because it is too large
Load Diff
@ -30,16 +30,16 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
/*#define FULL_MSG_DUMP 1*/
|
||||
|
||||
@@ -173,8 +176,6 @@ struct vchiq_mmal_instance {
|
||||
struct idr context_map;
|
||||
spinlock_t context_map_lock;
|
||||
@@ -174,8 +177,6 @@ struct vchiq_mmal_instance {
|
||||
/* protect accesses to context_map */
|
||||
struct mutex context_map_lock;
|
||||
|
||||
- /* component to use next */
|
||||
- int component_idx;
|
||||
struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
|
||||
|
||||
/* ordered workqueue to process all bulk operations */
|
||||
@@ -1631,18 +1632,24 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1632,18 +1633,24 @@ int vchiq_mmal_component_init(struct vch
|
||||
{
|
||||
int ret;
|
||||
int idx; /* port index */
|
||||
@ -68,7 +68,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
ret = create_component(instance, component, name);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to create component %d (Not enough GPU mem?)\n",
|
||||
@@ -1693,8 +1700,6 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1694,8 +1701,6 @@ int vchiq_mmal_component_init(struct vch
|
||||
goto release_component;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
*component_out = component;
|
||||
|
||||
mutex_unlock(&instance->vchiq_mutex);
|
||||
@@ -1704,6 +1709,8 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1705,6 +1710,8 @@ int vchiq_mmal_component_init(struct vch
|
||||
release_component:
|
||||
destroy_component(instance, component);
|
||||
unlock:
|
||||
@ -86,7 +86,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
mutex_unlock(&instance->vchiq_mutex);
|
||||
|
||||
return ret;
|
||||
@@ -1726,6 +1733,8 @@ int vchiq_mmal_component_finalise(struct
|
||||
@@ -1727,6 +1734,8 @@ int vchiq_mmal_component_finalise(struct
|
||||
|
||||
ret = destroy_component(instance, component);
|
||||
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -860,9 +860,9 @@ static int port_info_get(struct vchiq_mm
|
||||
@@ -861,9 +861,9 @@ static int port_info_get(struct vchiq_mm
|
||||
goto release_msg;
|
||||
|
||||
if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
|
||||
@ -26,7 +26,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
/* copy the values out of the message */
|
||||
port->handle = rmsg->u.port_info_get_reply.port_handle;
|
||||
@@ -1299,7 +1299,7 @@ static int port_disable(struct vchiq_mma
|
||||
@@ -1300,7 +1300,7 @@ static int port_disable(struct vchiq_mma
|
||||
if (!port->enabled)
|
||||
return 0;
|
||||
|
||||
@ -35,7 +35,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
ret = port_action_port(instance, port,
|
||||
MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
|
||||
@@ -1351,7 +1351,7 @@ static int port_enable(struct vchiq_mmal
|
||||
@@ -1352,7 +1352,7 @@ static int port_enable(struct vchiq_mmal
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
@ -44,7 +44,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
if (port->buffer_cb) {
|
||||
/* send buffer headers to videocore */
|
||||
@@ -1523,7 +1523,7 @@ int vchiq_mmal_port_connect_tunnel(struc
|
||||
@@ -1524,7 +1524,7 @@ int vchiq_mmal_port_connect_tunnel(struc
|
||||
pr_err("failed disconnecting src port\n");
|
||||
goto release_unlock;
|
||||
}
|
||||
@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
src->connected = NULL;
|
||||
}
|
||||
|
||||
@@ -1759,7 +1759,7 @@ int vchiq_mmal_component_enable(struct v
|
||||
@@ -1760,7 +1760,7 @@ int vchiq_mmal_component_enable(struct v
|
||||
|
||||
ret = enable_component(instance, component);
|
||||
if (ret == 0)
|
||||
@ -62,7 +62,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
mutex_unlock(&instance->vchiq_mutex);
|
||||
|
||||
@@ -1785,7 +1785,7 @@ int vchiq_mmal_component_disable(struct
|
||||
@@ -1786,7 +1786,7 @@ int vchiq_mmal_component_disable(struct
|
||||
|
||||
ret = disable_component(instance, component);
|
||||
if (ret == 0)
|
||||
|
@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/*#define FULL_MSG_DUMP 1*/
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -691,7 +697,7 @@ static int send_synchronous_mmal_msg(str
|
||||
@@ -692,7 +698,7 @@ static int send_synchronous_mmal_msg(str
|
||||
}
|
||||
|
||||
timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
|
||||
|
@ -216,7 +216,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* */
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -258,17 +258,25 @@ static void buffer_work_cb(struct work_s
|
||||
@@ -259,17 +259,25 @@ static void buffer_work_cb(struct work_s
|
||||
{
|
||||
struct mmal_msg_context *msg_context =
|
||||
container_of(work, struct mmal_msg_context, u.bulk.work);
|
||||
@ -247,7 +247,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
/* workqueue scheduled callback to handle receiving buffers
|
||||
@@ -1326,11 +1334,14 @@ static int port_disable(struct vchiq_mma
|
||||
@@ -1327,11 +1335,14 @@ static int port_disable(struct vchiq_mma
|
||||
mmalbuf = list_entry(buf_head, struct mmal_buffer,
|
||||
list);
|
||||
list_del(buf_head);
|
||||
|
@ -83,7 +83,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
int status; /* context status */
|
||||
|
||||
@@ -237,18 +239,6 @@ release_msg_context(struct mmal_msg_cont
|
||||
@@ -238,18 +240,6 @@ release_msg_context(struct mmal_msg_cont
|
||||
kfree(msg_context);
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* workqueue scheduled callback
|
||||
*
|
||||
* we do this because it is important we do not call any other vchiq
|
||||
@@ -270,13 +260,18 @@ static void buffer_work_cb(struct work_s
|
||||
@@ -271,13 +261,18 @@ static void buffer_work_cb(struct work_s
|
||||
buffer->mmal_flags = msg_context->u.bulk.mmal_flags;
|
||||
buffer->dts = msg_context->u.bulk.dts;
|
||||
buffer->pts = msg_context->u.bulk.pts;
|
||||
@ -122,7 +122,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
/* workqueue scheduled callback to handle receiving buffers
|
||||
@@ -355,6 +350,7 @@ static int bulk_receive(struct vchiq_mma
|
||||
@@ -356,6 +351,7 @@ static int bulk_receive(struct vchiq_mma
|
||||
msg_context->u.bulk.buffer_used = rd_len;
|
||||
msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
|
||||
msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
|
||||
@ -130,7 +130,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
queue_work(msg_context->instance->bulk_wq,
|
||||
&msg_context->u.bulk.buffer_to_host_work);
|
||||
@@ -456,6 +452,103 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
@@ -457,6 +453,103 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* deals with receipt of buffer to host message */
|
||||
static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,
|
||||
struct mmal_msg *msg, u32 msg_len)
|
||||
@@ -1339,6 +1432,7 @@ static int port_disable(struct vchiq_mma
|
||||
@@ -1340,6 +1433,7 @@ static int port_disable(struct vchiq_mma
|
||||
mmalbuf->mmal_flags = 0;
|
||||
mmalbuf->dts = MMAL_TIME_UNKNOWN;
|
||||
mmalbuf->pts = MMAL_TIME_UNKNOWN;
|
||||
@ -242,7 +242,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
port->buffer_cb(instance,
|
||||
port, 0, mmalbuf);
|
||||
}
|
||||
@@ -1640,6 +1734,43 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
@@ -1641,6 +1735,43 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mmal_vchi_buffer_cleanup);
|
||||
|
||||
@ -286,7 +286,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* Initialise a mmal component and its ports
|
||||
*
|
||||
*/
|
||||
@@ -1683,6 +1814,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1684,6 +1815,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
ret = port_info_get(instance, &component->control);
|
||||
if (ret < 0)
|
||||
goto release_component;
|
||||
@ -294,7 +294,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
for (idx = 0; idx < component->inputs; idx++) {
|
||||
component->input[idx].type = MMAL_PORT_TYPE_INPUT;
|
||||
@@ -1693,6 +1825,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1694,6 +1826,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
ret = port_info_get(instance, &component->input[idx]);
|
||||
if (ret < 0)
|
||||
goto release_component;
|
||||
@ -302,7 +302,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
for (idx = 0; idx < component->outputs; idx++) {
|
||||
@@ -1704,6 +1837,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1705,6 +1838,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
ret = port_info_get(instance, &component->output[idx]);
|
||||
if (ret < 0)
|
||||
goto release_component;
|
||||
@ -310,7 +310,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
for (idx = 0; idx < component->clocks; idx++) {
|
||||
@@ -1715,6 +1849,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1716,6 +1850,7 @@ int vchiq_mmal_component_init(struct vch
|
||||
ret = port_info_get(instance, &component->clock[idx]);
|
||||
if (ret < 0)
|
||||
goto release_component;
|
||||
@ -318,7 +318,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
}
|
||||
|
||||
*component_out = component;
|
||||
@@ -1740,7 +1875,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_component_i
|
||||
@@ -1741,7 +1876,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_component_i
|
||||
int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance,
|
||||
struct vchiq_mmal_component *component)
|
||||
{
|
||||
@ -327,7 +327,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
if (mutex_lock_interruptible(&instance->vchiq_mutex))
|
||||
return -EINTR;
|
||||
@@ -1752,6 +1887,13 @@ int vchiq_mmal_component_finalise(struct
|
||||
@@ -1753,6 +1888,13 @@ int vchiq_mmal_component_finalise(struct
|
||||
|
||||
component->in_use = 0;
|
||||
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -427,11 +427,19 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
@@ -428,11 +428,19 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
m.u.buffer_from_host.buffer_header.data =
|
||||
(u32)(unsigned long)buf->buffer;
|
||||
m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size;
|
||||
|
@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
#define USE_VCHIQ_ARM
|
||||
#include "interface/vchi/vchi.h"
|
||||
|
||||
@@ -424,8 +427,13 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
@@ -425,8 +428,13 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
|
||||
/* buffer header */
|
||||
m.u.buffer_from_host.buffer_header.cmd = 0;
|
||||
@ -69,7 +69,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size;
|
||||
if (port->type == MMAL_PORT_TYPE_OUTPUT) {
|
||||
m.u.buffer_from_host.buffer_header.length = 0;
|
||||
@@ -590,6 +598,22 @@ static void buffer_to_host_cb(struct vch
|
||||
@@ -591,6 +599,22 @@ static void buffer_to_host_cb(struct vch
|
||||
|
||||
msg_context->u.bulk.status = msg->h.status;
|
||||
|
||||
@ -92,7 +92,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
} else if (msg->u.buffer_from_host.buffer_header.length == 0) {
|
||||
/* empty buffer */
|
||||
if (msg->u.buffer_from_host.buffer_header.flags &
|
||||
@@ -1537,6 +1561,9 @@ int vchiq_mmal_port_parameter_set(struct
|
||||
@@ -1538,6 +1562,9 @@ int vchiq_mmal_port_parameter_set(struct
|
||||
|
||||
mutex_unlock(&instance->vchiq_mutex);
|
||||
|
||||
@ -102,7 +102,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vchiq_mmal_port_parameter_set);
|
||||
@@ -1705,6 +1732,31 @@ int vchiq_mmal_submit_buffer(struct vchi
|
||||
@@ -1706,6 +1733,31 @@ int vchiq_mmal_submit_buffer(struct vchi
|
||||
unsigned long flags = 0;
|
||||
int ret;
|
||||
|
||||
@ -134,7 +134,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
ret = buffer_from_host(instance, port, buffer);
|
||||
if (ret == -EINVAL) {
|
||||
/* Port is disabled. Queue for when it is enabled. */
|
||||
@@ -1738,6 +1790,16 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
@@ -1739,6 +1791,16 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
release_msg_context(msg_context);
|
||||
buf->msg_context = NULL;
|
||||
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
@@ -1847,12 +1847,12 @@ static int __find_plane_by_offset(struct
|
||||
@@ -1851,12 +1851,12 @@ static int __find_plane_by_offset(struct
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
struct dma_buf *dbuf;
|
||||
|
||||
if (q->memory != VB2_MEMORY_MMAP) {
|
||||
@@ -1902,6 +1902,21 @@ int vb2_core_expbuf(struct vb2_queue *q,
|
||||
@@ -1906,6 +1906,21 @@ int vb2_core_expbuf(struct vb2_queue *q,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ Signed-off-by: Tomasz Figa <tfiga@chromium.org>
|
||||
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
@@ -550,20 +550,6 @@ bool vb2_buffer_in_use(struct vb2_queue
|
||||
@@ -554,20 +554,6 @@ bool vb2_buffer_in_use(struct vb2_queue
|
||||
}
|
||||
EXPORT_SYMBOL(vb2_buffer_in_use);
|
||||
|
||||
@ -57,7 +57,7 @@ Signed-off-by: Tomasz Figa <tfiga@chromium.org>
|
||||
void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb)
|
||||
{
|
||||
call_void_bufop(q, fill_user_buffer, q->bufs[index], pb);
|
||||
@@ -675,16 +661,7 @@ int vb2_core_reqbufs(struct vb2_queue *q
|
||||
@@ -679,16 +665,7 @@ int vb2_core_reqbufs(struct vb2_queue *q
|
||||
|
||||
if (*count == 0 || q->num_buffers != 0 ||
|
||||
(q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) {
|
||||
|
@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -472,9 +472,9 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
@@ -473,9 +473,9 @@ buffer_from_host(struct vchiq_mmal_insta
|
||||
static void event_to_host_cb(struct vchiq_mmal_instance *instance,
|
||||
struct mmal_msg *msg, u32 msg_len)
|
||||
{
|
||||
@ -34,7 +34,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
struct vchiq_mmal_port *port = NULL;
|
||||
struct mmal_msg_context *msg_context;
|
||||
u32 port_num = msg->u.event_to_host.port_num;
|
||||
@@ -1073,7 +1073,7 @@ static int create_component(struct vchiq
|
||||
@@ -1074,7 +1074,7 @@ static int create_component(struct vchiq
|
||||
|
||||
/* build component create message */
|
||||
m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
|
||||
@ -43,7 +43,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
strncpy(m.u.component_create.name, name,
|
||||
sizeof(m.u.component_create.name));
|
||||
|
||||
@@ -1868,6 +1868,12 @@ int vchiq_mmal_component_init(struct vch
|
||||
@@ -1869,6 +1869,12 @@ int vchiq_mmal_component_init(struct vch
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
u32 cmd; /* MMAL command. 0=data. */
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -1793,7 +1793,7 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
@@ -1794,7 +1794,7 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
if (buf->vcsm_handle) {
|
||||
int ret;
|
||||
|
||||
|
@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -1412,11 +1412,12 @@ static int port_parameter_get(struct vch
|
||||
@@ -1413,11 +1413,12 @@ static int port_parameter_get(struct vch
|
||||
*/
|
||||
memcpy(value, &rmsg->u.port_parameter_get_reply.value,
|
||||
*value_size);
|
||||
|
@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -1400,7 +1400,8 @@ static int port_parameter_get(struct vch
|
||||
@@ -1401,7 +1401,8 @@ static int port_parameter_get(struct vch
|
||||
goto release_msg;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
/* If both ports disabled, then disable the component */
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -1784,13 +1784,9 @@ int mmal_vchi_buffer_init(struct vchiq_m
|
||||
@@ -1785,13 +1785,9 @@ int mmal_vchi_buffer_init(struct vchiq_m
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mmal_vchi_buffer_init);
|
||||
|
||||
@ -153,7 +153,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
if (buf->vcsm_handle) {
|
||||
int ret;
|
||||
@@ -1802,6 +1798,19 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
@@ -1803,6 +1799,19 @@ int mmal_vchi_buffer_cleanup(struct mmal
|
||||
pr_err("%s: vcsm_free failed, ret %d\n", __func__, ret);
|
||||
buf->vcsm_handle = 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -1981,6 +1981,8 @@ int vchiq_mmal_component_finalise(struct
|
||||
@@ -1982,6 +1982,8 @@ int vchiq_mmal_component_finalise(struct
|
||||
for (idx = 0; idx < component->clocks; idx++)
|
||||
free_event_context(&component->clock[idx]);
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
From 39464cbb618af3ddf6427d77b0c0be0042bcaaf9 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
Date: Wed, 1 May 2019 15:17:00 +0100
|
||||
Subject: [PATCH 489/703] staging: mmal-vchiq: Replace spinlock protecting
|
||||
context_map with mutex
|
||||
|
||||
950fd86 staging: bcm2835-camera: Replace open-coded idr with a struct idr.
|
||||
replaced an internal implementation of an idr with the standard functions
|
||||
and a spinlock.
|
||||
idr_alloc(GFP_KERNEL) can sleep whilst calling kmem_cache_alloc to allocate
|
||||
the new node, but this is not valid whilst in an atomic context due to the
|
||||
spinlock.
|
||||
|
||||
There is no need for this to be a spinlock as a standard mutex is
|
||||
sufficient.
|
||||
|
||||
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
---
|
||||
.../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
|
||||
@@ -185,7 +185,8 @@ struct vchiq_mmal_instance {
|
||||
void *bulk_scratch;
|
||||
|
||||
struct idr context_map;
|
||||
- spinlock_t context_map_lock;
|
||||
+ /* protect accesses to context_map */
|
||||
+ struct mutex context_map_lock;
|
||||
|
||||
struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
|
||||
|
||||
@@ -209,10 +210,10 @@ get_msg_context(struct vchiq_mmal_instan
|
||||
* that when we service the VCHI reply, we can look up what
|
||||
* message is being replied to.
|
||||
*/
|
||||
- spin_lock(&instance->context_map_lock);
|
||||
+ mutex_lock(&instance->context_map_lock);
|
||||
handle = idr_alloc(&instance->context_map, msg_context,
|
||||
0, 0, GFP_KERNEL);
|
||||
- spin_unlock(&instance->context_map_lock);
|
||||
+ mutex_unlock(&instance->context_map_lock);
|
||||
|
||||
if (handle < 0) {
|
||||
kfree(msg_context);
|
||||
@@ -236,9 +237,9 @@ release_msg_context(struct mmal_msg_cont
|
||||
{
|
||||
struct vchiq_mmal_instance *instance = msg_context->instance;
|
||||
|
||||
- spin_lock(&instance->context_map_lock);
|
||||
+ mutex_lock(&instance->context_map_lock);
|
||||
idr_remove(&instance->context_map, msg_context->handle);
|
||||
- spin_unlock(&instance->context_map_lock);
|
||||
+ mutex_unlock(&instance->context_map_lock);
|
||||
kfree(msg_context);
|
||||
}
|
||||
|
||||
@@ -2143,7 +2144,7 @@ int vchiq_mmal_init(struct vchiq_mmal_in
|
||||
|
||||
instance->bulk_scratch = vmalloc(PAGE_SIZE);
|
||||
|
||||
- spin_lock_init(&instance->context_map_lock);
|
||||
+ mutex_init(&instance->context_map_lock);
|
||||
idr_init_base(&instance->context_map, 1);
|
||||
|
||||
params.callback_param = instance;
|
@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
/* Disable rate control for now */
|
||||
bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
|
||||
TDMA_FLOW_PERIOD);
|
||||
@@ -3576,9 +3576,12 @@ static int bcmgenet_probe(struct platfor
|
||||
@@ -3571,9 +3571,12 @@ static int bcmgenet_probe(struct platfor
|
||||
netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1);
|
||||
|
||||
/* Set default coalescing parameters */
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
@@ -550,6 +550,20 @@ bool vb2_buffer_in_use(struct vb2_queue
|
||||
@@ -554,6 +554,20 @@ bool vb2_buffer_in_use(struct vb2_queue
|
||||
}
|
||||
EXPORT_SYMBOL(vb2_buffer_in_use);
|
||||
|
||||
@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb)
|
||||
{
|
||||
call_void_bufop(q, fill_user_buffer, q->bufs[index], pb);
|
||||
@@ -661,7 +675,16 @@ int vb2_core_reqbufs(struct vb2_queue *q
|
||||
@@ -665,7 +679,16 @@ int vb2_core_reqbufs(struct vb2_queue *q
|
||||
|
||||
if (*count == 0 || q->num_buffers != 0 ||
|
||||
(q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) {
|
||||
|
@ -92,7 +92,7 @@ Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
============
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
@@ -680,11 +680,9 @@ int vb2_core_reqbufs(struct vb2_queue *q
|
||||
@@ -684,11 +684,9 @@ int vb2_core_reqbufs(struct vb2_queue *q
|
||||
* are not in use and can be freed.
|
||||
*/
|
||||
mutex_lock(&q->mmap_lock);
|
||||
|
@ -458,7 +458,7 @@
|
||||
/*
|
||||
--- a/arch/mips/mm/tlbex.c
|
||||
+++ b/arch/mips/mm/tlbex.c
|
||||
@@ -971,6 +971,9 @@ void build_get_pgde32(u32 **p, unsigned
|
||||
@@ -976,6 +976,9 @@ void build_get_pgde32(u32 **p, unsigned
|
||||
uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
|
||||
uasm_i_addu(p, ptr, tmp, ptr);
|
||||
#else
|
||||
@ -468,7 +468,7 @@
|
||||
UASM_i_LA_mostly(p, ptr, pgdc);
|
||||
#endif
|
||||
uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
|
||||
@@ -1331,6 +1334,9 @@ static void build_r4000_tlb_refill_handl
|
||||
@@ -1337,6 +1340,9 @@ static void build_r4000_tlb_refill_handl
|
||||
#ifdef CONFIG_64BIT
|
||||
build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
|
||||
#else
|
||||
@ -478,7 +478,7 @@
|
||||
build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
|
||||
#endif
|
||||
|
||||
@@ -1342,6 +1348,9 @@ static void build_r4000_tlb_refill_handl
|
||||
@@ -1348,6 +1354,9 @@ static void build_r4000_tlb_refill_handl
|
||||
build_update_entries(&p, K0, K1);
|
||||
build_tlb_write_entry(&p, &l, &r, tlb_random);
|
||||
uasm_l_leave(&l, p);
|
||||
@ -488,7 +488,7 @@
|
||||
uasm_i_eret(&p); /* return from trap */
|
||||
}
|
||||
#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
|
||||
@@ -2046,6 +2055,9 @@ build_r4000_tlbchange_handler_head(u32 *
|
||||
@@ -2057,6 +2066,9 @@ build_r4000_tlbchange_handler_head(u32 *
|
||||
#ifdef CONFIG_64BIT
|
||||
build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
|
||||
#else
|
||||
@ -498,7 +498,7 @@
|
||||
build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
|
||||
#endif
|
||||
|
||||
@@ -2092,6 +2104,9 @@ build_r4000_tlbchange_handler_tail(u32 *
|
||||
@@ -2103,6 +2115,9 @@ build_r4000_tlbchange_handler_tail(u32 *
|
||||
build_tlb_write_entry(p, l, r, tlb_indexed);
|
||||
uasm_l_leave(l, *p);
|
||||
build_restore_work_registers(p);
|
||||
|
@ -458,7 +458,7 @@
|
||||
/*
|
||||
--- a/arch/mips/mm/tlbex.c
|
||||
+++ b/arch/mips/mm/tlbex.c
|
||||
@@ -967,6 +967,9 @@ void build_get_pgde32(u32 **p, unsigned
|
||||
@@ -972,6 +972,9 @@ void build_get_pgde32(u32 **p, unsigned
|
||||
uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
|
||||
uasm_i_addu(p, ptr, tmp, ptr);
|
||||
#else
|
||||
@ -468,7 +468,7 @@
|
||||
UASM_i_LA_mostly(p, ptr, pgdc);
|
||||
#endif
|
||||
uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
|
||||
@@ -1327,6 +1330,9 @@ static void build_r4000_tlb_refill_handl
|
||||
@@ -1333,6 +1336,9 @@ static void build_r4000_tlb_refill_handl
|
||||
#ifdef CONFIG_64BIT
|
||||
build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
|
||||
#else
|
||||
@ -478,7 +478,7 @@
|
||||
build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
|
||||
#endif
|
||||
|
||||
@@ -1338,6 +1344,9 @@ static void build_r4000_tlb_refill_handl
|
||||
@@ -1344,6 +1350,9 @@ static void build_r4000_tlb_refill_handl
|
||||
build_update_entries(&p, K0, K1);
|
||||
build_tlb_write_entry(&p, &l, &r, tlb_random);
|
||||
uasm_l_leave(&l, p);
|
||||
@ -488,7 +488,7 @@
|
||||
uasm_i_eret(&p); /* return from trap */
|
||||
}
|
||||
#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
|
||||
@@ -2028,6 +2037,9 @@ build_r4000_tlbchange_handler_head(u32 *
|
||||
@@ -2039,6 +2048,9 @@ build_r4000_tlbchange_handler_head(u32 *
|
||||
#ifdef CONFIG_64BIT
|
||||
build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
|
||||
#else
|
||||
@ -498,7 +498,7 @@
|
||||
build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
|
||||
#endif
|
||||
|
||||
@@ -2074,6 +2086,9 @@ build_r4000_tlbchange_handler_tail(u32 *
|
||||
@@ -2085,6 +2097,9 @@ build_r4000_tlbchange_handler_tail(u32 *
|
||||
build_tlb_write_entry(p, l, r, tlb_indexed);
|
||||
uasm_l_leave(l, *p);
|
||||
build_restore_work_registers(p);
|
||||
|
@ -13,7 +13,7 @@ FEATURES:=squashfs pci rtc usb dt gpio display ext4 rootfs-part boot-part
|
||||
CPU_TYPE:=fa526
|
||||
MAINTAINER:=Roman Yeryomin <roman@advem.lv>
|
||||
|
||||
KERNEL_PATCHVER:=4.14
|
||||
KERNEL_PATCHVER:=4.19
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for the StorLink/Cortina Gemini CS351x ARM FA526 CPU
|
||||
|
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2019 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
fixwrgg() {
|
||||
local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd)
|
||||
|
||||
[ "$kernel_size" ] && mtd -c 0x$kernel_size fixwrgg firmware
|
||||
}
|
||||
|
||||
case "$board" in
|
||||
dlink,dir-685)
|
||||
fixwrgg
|
||||
;;
|
||||
esac
|
@ -1,27 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
set_ether_mac() {
|
||||
# Most devices have a standard "VCTL" partition
|
||||
CONFIG_PARTITION="$(grep "VCTL" /proc/mtd | cut -d: -f1)"
|
||||
if [ ! -z $CONFIG_PARTITION ] ; then
|
||||
MAC1="$(strings /dev/$CONFIG_PARTITION |grep MAC|cut -d: -f2|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
|
||||
MAC2="$(strings /dev/$CONFIG_PARTITION |grep MAC|cut -d: -f8|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
|
||||
local part
|
||||
local DEVID
|
||||
local MAC1
|
||||
local MAC2
|
||||
|
||||
ifconfig eth0 hw ether $MAC1 2>/dev/null
|
||||
ifconfig eth1 hw ether $MAC2 2>/dev/null
|
||||
return 0
|
||||
fi
|
||||
|
||||
# The DNS-313 has a special field in its RedBoot
|
||||
# binary that we need to check
|
||||
CONFIG_PARTITION="$(grep "RedBoot" /proc/mtd | cut -d: -f1)"
|
||||
if [ ! -z $CONFIG_PARTITION ] ; then
|
||||
DEVID="$(dd if=/dev/mtdblock0 bs=1 skip=119508 count=7 2>/dev/null)"
|
||||
if [ "x$DEVID" = "xdns-313" ] ; then
|
||||
MAC1="$(dd if=/dev/mtdblock0 bs=1 skip=119540 count=6 2>/dev/null | hexdump -n6 -e '/1 ":%02X"' | sed s/^://g)"
|
||||
ifconfig eth0 hw ether $MAC1 2>/dev/null
|
||||
return 0
|
||||
case "$(board_name)" in
|
||||
dlink,dns-313)
|
||||
# The DNS-313 has a special field in its RedBoot
|
||||
# binary that we need to check
|
||||
part="$(find_mtd_part RedBoot)"
|
||||
if [ -n "$part" ]; then
|
||||
DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)"
|
||||
if [ "$DEVID" = "dns-313" ]; then
|
||||
MAC1="$(mtd_get_mac_binary RedBoot 119540)"
|
||||
ip link set eth0 address "$MAC1" 2>/dev/null
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
dlink,dir-685)
|
||||
# The DIR-685 has a special field in its RedBoot
|
||||
# binary that we need to check
|
||||
part=$(find_mtd_part RedBoot)
|
||||
if [ -n "$part" ] ; then
|
||||
DEVID="$(dd if=$part bs=1 skip=81516 count=7 2>/dev/null)"
|
||||
if [ "$DEVID" = "ILI9322" ] ; then
|
||||
MAC1=$(mtd_get_mac_binary RedBoot 95040)
|
||||
MAC2=$(mtd_get_mac_binary RedBoot 95046)
|
||||
ip link set eth0 address "$MAC1" 2>/dev/null
|
||||
ip link set eth1 address "$MAC2" 2>/dev/null
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Most devices have a standard "VCTL" partition
|
||||
part="$(find_mtd_part VCTL)"
|
||||
if [ -n "$part" ]; then
|
||||
MAC1="$(strings $part |grep MAC|cut -d: -f2|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
|
||||
MAC2="$(strings $part |grep MAC|cut -d: -f8|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
|
||||
|
||||
ip link set eth0 address "$MAC1" 2>/dev/null
|
||||
ip link set eth1 address "$MAC2" 2>/dev/null
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
25
target/linux/gemini/base-files/lib/upgrade/platform.sh
Normal file
25
target/linux/gemini/base-files/lib/upgrade/platform.sh
Normal file
@ -0,0 +1,25 @@
|
||||
REQUIRE_IMAGE_METADATA=1
|
||||
|
||||
platform_check_image() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
dlink,dir-685)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Sysupgrade is not yet supported on $board."
|
||||
return 1
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
dlink,dir-685)
|
||||
PART_NAME=firmware
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
@ -44,7 +44,6 @@ CONFIG_ATA=y
|
||||
CONFIG_ATAGS=y
|
||||
CONFIG_ATA_VERBOSE_ERROR=y
|
||||
CONFIG_AUTO_ZRELADDR=y
|
||||
CONFIG_BINFMT_MISC=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BLK_SCSI_REQUEST=y
|
||||
@ -56,8 +55,6 @@ CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
CONFIG_CLKSRC_MMIO=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="console=ttyS0,19200n8"
|
||||
CONFIG_CMDLINE_FROM_BOOTLOADER=y
|
||||
CONFIG_COMMON_CLK=y
|
||||
CONFIG_COMMON_CLK_GEMINI=y
|
||||
CONFIG_CONSOLE_TRANSLATIONS=y
|
||||
@ -309,7 +306,6 @@ CONFIG_OF_PCI_IRQ=y
|
||||
CONFIG_OF_RESERVED_MEM=y
|
||||
CONFIG_OLD_SIGACTION=y
|
||||
CONFIG_OLD_SIGSUSPEND3=y
|
||||
# CONFIG_PACKET is not set
|
||||
CONFIG_PAGE_OFFSET=0xC0000000
|
||||
# CONFIG_PANIC_ON_OOPS is not set
|
||||
CONFIG_PANIC_ON_OOPS_VALUE=0
|
||||
@ -392,13 +388,10 @@ CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPLIT_PTLOCK_CPUS=999999
|
||||
CONFIG_SRCU=y
|
||||
# CONFIG_STAGING is not set
|
||||
# CONFIG_STRICT_KERNEL_RWX is not set
|
||||
# CONFIG_STRICT_MODULE_RWX is not set
|
||||
# CONFIG_STRIP_ASM_SYMS is not set
|
||||
CONFIG_SWIOTLB=y
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SYNC_FILE=y
|
||||
# CONFIG_SYN_COOKIES is not set
|
||||
CONFIG_SYSFS_SYSCALL=y
|
||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||
CONFIG_TASKS_RCU=y
|
||||
|
@ -44,7 +44,6 @@ CONFIG_ATA=y
|
||||
CONFIG_ATAGS=y
|
||||
CONFIG_ATA_VERBOSE_ERROR=y
|
||||
CONFIG_AUTO_ZRELADDR=y
|
||||
CONFIG_BINFMT_MISC=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BLK_SCSI_REQUEST=y
|
||||
@ -63,8 +62,6 @@ CONFIG_CMA_SIZE_MBYTES=16
|
||||
CONFIG_CMA_SIZE_SEL_MBYTES=y
|
||||
# CONFIG_CMA_SIZE_SEL_MIN is not set
|
||||
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
|
||||
CONFIG_CMDLINE="console=ttyS0,19200n8"
|
||||
CONFIG_CMDLINE_FROM_BOOTLOADER=y
|
||||
CONFIG_COMMON_CLK=y
|
||||
CONFIG_COMMON_CLK_GEMINI=y
|
||||
CONFIG_CONSOLE_TRANSLATIONS=y
|
||||
@ -323,7 +320,6 @@ CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MODULE_UNLOAD is not set
|
||||
CONFIG_MQ_IOSCHED_DEADLINE=y
|
||||
CONFIG_MQ_IOSCHED_KYBER=y
|
||||
# CONFIG_MSCC_OCELOT_SWITCH is not set
|
||||
CONFIG_MTD_CFI_STAA=y
|
||||
# CONFIG_MTD_IMPA7 is not set
|
||||
CONFIG_MTD_JEDECPROBE=y
|
||||
@ -337,7 +333,6 @@ CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_KUSER_HELPERS=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_DSA=y
|
||||
# CONFIG_NET_DSA_LEGACY is not set
|
||||
CONFIG_NET_DSA_REALTEK_SMI=y
|
||||
CONFIG_NET_DSA_VITESSE_VSC73XX=y
|
||||
CONFIG_NET_NS=y
|
||||
@ -360,7 +355,6 @@ CONFIG_OF_NET=y
|
||||
CONFIG_OF_RESERVED_MEM=y
|
||||
CONFIG_OLD_SIGACTION=y
|
||||
CONFIG_OLD_SIGSUSPEND3=y
|
||||
# CONFIG_PACKET is not set
|
||||
CONFIG_PAGE_OFFSET=0xC0000000
|
||||
# CONFIG_PANIC_ON_OOPS is not set
|
||||
CONFIG_PANIC_ON_OOPS_VALUE=0
|
||||
@ -447,12 +441,9 @@ CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPLIT_PTLOCK_CPUS=999999
|
||||
CONFIG_SRCU=y
|
||||
# CONFIG_STAGING is not set
|
||||
# CONFIG_STRICT_KERNEL_RWX is not set
|
||||
# CONFIG_STRICT_MODULE_RWX is not set
|
||||
# CONFIG_STRIP_ASM_SYMS is not set
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SYNC_FILE=y
|
||||
# CONFIG_SYN_COOKIES is not set
|
||||
CONFIG_SYSFS_SYSCALL=y
|
||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||
CONFIG_TASKS_RCU=y
|
||||
|
18
target/linux/gemini/image/ImageInfo-storlink_sl93512r
Normal file
18
target/linux/gemini/image/ImageInfo-storlink_sl93512r
Normal file
@ -0,0 +1,18 @@
|
||||
UpgradeImages="zImage rd.gz hddapp.tgz"
|
||||
Procduction="SL3516"
|
||||
BOOT_VER="1.0.5"
|
||||
FIRMWARE_VER="firmware-openwrt-DATESTR"
|
||||
INTERNAL_FIRMWARE_VER="firmware-openwrt-DATESTR"
|
||||
CONFIGURATION_VER="firmware-openwrt"
|
||||
DESCRIPTION="Storlink SL93512r Reference Design"
|
||||
TSS="enabled"
|
||||
DIRECT_MODE="disabled"
|
||||
DEFAULT_LAN_IPADDR="192.168.1.1"
|
||||
DEFAULT_LAN_NETMASK="255.255.255.0"
|
||||
DEFAULT_LAN_BOOTPROTO="none"
|
||||
DEFAULT_WAN_BOOTPROTO="dhcp"
|
||||
DEFAULT_WAN_ENABLED="yes"
|
||||
DEFAULT_WLAN_DEVICENAME="eth0"
|
||||
VER_zImage="DATESTR"
|
||||
VER_Ramdisk="DATESTR"
|
||||
VER_hddapp="DATESTR"
|
@ -74,14 +74,15 @@ define Build/wiligear-image
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
# Create the special NAS4220B and Itian Square One SQ201 image
|
||||
# format with the squashfs and overlay inside the "rd.gz" file.
|
||||
# Create the default image format used by the StorLink reference design
|
||||
# SL93512r, Raidsonic NAS4220B and Itian Square One SQ201
|
||||
# with the squashfs and overlay inside the "rd.gz" file.
|
||||
# We pad it out to 6144K which is the size of the initramfs partition.
|
||||
#
|
||||
# The "application" partition is just blank. You can put anything
|
||||
# there when using OpenWRT. We just use that to create the
|
||||
# "sysupgrade" firmware image.
|
||||
define Build/nas4220b-sq201-images
|
||||
define Build/storlink-default-images
|
||||
mkdir -p $@.tmp
|
||||
|
||||
mv $@ $@.tmp/rd.gz
|
||||
@ -115,6 +116,7 @@ define Device/Default
|
||||
KERNEL_NAME := zImage
|
||||
KERNEL := kernel-bin | append-dtb
|
||||
BLOCKSIZE := 128k
|
||||
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
||||
endef
|
||||
|
||||
# A reasonable set of default packages handling the NAS type
|
||||
@ -141,11 +143,11 @@ define Device/dlink_dir-685
|
||||
DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
|
||||
DEVICE_DTS := gemini-dlink-dir-685
|
||||
DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \
|
||||
kmod-switch-rtl8366rb swconfig \
|
||||
kmod-rt2800-pci
|
||||
IMAGES := factory.bin
|
||||
IMAGES := factory.bin sysupgrade.bin
|
||||
# Pad to 128k erase blocks with 160 bytes WRGG header
|
||||
IMAGE/factory.bin := append-kernel | pad-offset 128k 160 | append-rootfs | dir685-pad-rootfs | dir685-image
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-offset 128k 160 | dir685-image | append-rootfs | dir685-pad-rootfs | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += dlink_dir-685
|
||||
|
||||
@ -161,15 +163,16 @@ define Device/dlink_dns-313
|
||||
endef
|
||||
TARGET_DEVICES += dlink_dns-313
|
||||
|
||||
define Device/itian-raidsonic
|
||||
# Default images setup used by the StorLink reference designs
|
||||
define Device/storlink-reference
|
||||
IMAGES := factory.bin
|
||||
IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
|
||||
nas4220b-sq201-images $(1)
|
||||
storlink-default-images $(1)
|
||||
DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
|
||||
endef
|
||||
|
||||
define Device/itian_sq201
|
||||
$(Device/itian-raidsonic)
|
||||
$(Device/storlink-reference)
|
||||
DEVICE_TITLE := ITian Square One SQ201
|
||||
DEVICE_DTS := gemini-sq201
|
||||
DEVICE_PACKAGES += kmod-rt61-pci kmod-usb2-pci
|
||||
@ -177,13 +180,21 @@ endef
|
||||
TARGET_DEVICES += itian_sq201
|
||||
|
||||
define Device/raidsonic_ib-4220-b
|
||||
$(Device/itian-raidsonic)
|
||||
$(Device/storlink-reference)
|
||||
DEVICE_TITLE := Raidsonic NAS IB-4220-B
|
||||
DEVICE_DTS := gemini-nas4220b
|
||||
DEVICE_TYPE := nas
|
||||
endef
|
||||
TARGET_DEVICES += raidsonic_ib-4220-b
|
||||
|
||||
define Device/storlink_sl93512r
|
||||
$(Device/storlink-reference)
|
||||
DEVICE_TITLE := StorLink SL93512r
|
||||
DEVICE_DTS := gemini-sl93512r
|
||||
endef
|
||||
TARGET_DEVICES += storlink_sl93512r
|
||||
|
||||
|
||||
# The wiliboard images need some changes to be functional and buildable.
|
||||
#
|
||||
# The dts would need to use the ecoscentric,redboot-fis-partitions partition
|
||||
|
@ -42,7 +42,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
+
|
||||
+/ {
|
||||
+ model = "D-Link DNS-313 1-Bay Network Storage Enclosure";
|
||||
+ compatible = "dlink,dir-313", "cortina,gemini";
|
||||
+ compatible = "dlink,dns-313", "cortina,gemini";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 854934b0ce8e758ce581f5ddbc30e618ab46fbdb Mon Sep 17 00:00:00 2001
|
||||
From ea99e7570882df53478f9b5fa5886a6e92fc2c7f Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 11 Mar 2019 15:44:29 +0100
|
||||
Subject: [PATCH 2/2] ARM: dts: Augment DIR-685 partition table for OpenWrt
|
||||
Subject: [PATCH] ARM: dts: Augment DIR-685 partition table for OpenWrt
|
||||
|
||||
Rename the firmware partition so that the firmware MTD
|
||||
splitter will do its job, drop the rootfs arguments as
|
||||
@ -9,8 +9,8 @@ the MTD splitter will set this up automatically.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
arch/arm/boot/dts/gemini-dlink-dir-685.dts | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
arch/arm/boot/dts/gemini-dlink-dir-685.dts | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
|
||||
@ -23,7 +23,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
stdout-path = "uart0:19200n8";
|
||||
};
|
||||
|
||||
@@ -286,7 +286,8 @@
|
||||
@@ -286,9 +286,9 @@
|
||||
* this is called "upgrade" on the vendor system.
|
||||
*/
|
||||
partition@40000 {
|
||||
@ -31,5 +31,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
+ compatible = "wrg";
|
||||
+ label = "firmware";
|
||||
reg = <0x00040000 0x01f40000>;
|
||||
read-only;
|
||||
- read-only;
|
||||
};
|
||||
/* RGDB, Residental Gateway Database? */
|
||||
partition@1f80000 {
|
||||
|
@ -55,7 +55,7 @@ Cc: Kir Kolyshkin <kir@openvz.org>
|
||||
rwlock_t sk_callback_lock;
|
||||
--- a/net/core/sock.c
|
||||
+++ b/net/core/sock.c
|
||||
@@ -2743,6 +2743,7 @@ void sock_init_data(struct socket *sock,
|
||||
@@ -2740,6 +2740,7 @@ void sock_init_data(struct socket *sock,
|
||||
|
||||
sk->sk_max_pacing_rate = ~0U;
|
||||
sk->sk_pacing_rate = ~0U;
|
||||
|
@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold <johan@kernel.org>
|
||||
|
||||
--- a/drivers/usb/serial/option.c
|
||||
+++ b/drivers/usb/serial/option.c
|
||||
@@ -1947,7 +1947,8 @@ static const struct usb_device_id option
|
||||
@@ -1948,7 +1948,8 @@ static const struct usb_device_id option
|
||||
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */
|
||||
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) },
|
||||
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) },
|
||||
|
@ -48,7 +48,7 @@ Reviewed-by: John Gilmore <gnu@toad.com>
|
||||
#define INADDR_ANY ((unsigned long int) 0x00000000)
|
||||
--- a/net/ipv4/devinet.c
|
||||
+++ b/net/ipv4/devinet.c
|
||||
@@ -941,7 +941,7 @@ static int inet_abc_len(__be32 addr)
|
||||
@@ -949,7 +949,7 @@ static int inet_abc_len(__be32 addr)
|
||||
{
|
||||
int rc = -1; /* Something else, probably a multicast. */
|
||||
|
||||
@ -57,7 +57,7 @@ Reviewed-by: John Gilmore <gnu@toad.com>
|
||||
rc = 0;
|
||||
else {
|
||||
__u32 haddr = ntohl(addr);
|
||||
@@ -952,6 +952,8 @@ static int inet_abc_len(__be32 addr)
|
||||
@@ -960,6 +960,8 @@ static int inet_abc_len(__be32 addr)
|
||||
rc = 16;
|
||||
else if (IN_CLASSC(haddr))
|
||||
rc = 24;
|
||||
|
@ -48,7 +48,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
|
||||
--- a/net/netfilter/nft_flow_offload.c
|
||||
+++ b/net/netfilter/nft_flow_offload.c
|
||||
@@ -197,47 +197,14 @@ static struct nft_expr_type nft_flow_off
|
||||
@@ -208,47 +208,14 @@ static struct nft_expr_type nft_flow_off
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
@ -25,9 +25,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache;
|
||||
+ rt = (struct rtable *)flow->tuplehash[!dir].tuple.dst_cache;
|
||||
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)) &&
|
||||
(ip_hdr(skb)->frag_off & htons(IP_DF)) != 0)
|
||||
@@ -465,7 +465,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
|
||||
return NF_ACCEPT;
|
||||
@@ -464,7 +464,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
|
||||
dir = tuplehash->tuple.dir;
|
||||
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
|
||||
@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
return NF_ACCEPT;
|
||||
--- a/net/netfilter/nft_flow_offload.c
|
||||
+++ b/net/netfilter/nft_flow_offload.c
|
||||
@@ -18,13 +18,11 @@ struct nft_flow_offload {
|
||||
@@ -17,13 +17,11 @@ struct nft_flow_offload {
|
||||
struct nft_flowtable *flowtable;
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
struct flowi fl;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
@@ -39,8 +37,21 @@ static int nft_flow_route(const struct n
|
||||
@@ -38,8 +36,21 @@ static int nft_flow_route(const struct n
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
||||
|
||||
--- a/include/linux/compiler-gcc.h
|
||||
+++ b/include/linux/compiler-gcc.h
|
||||
@@ -338,3 +338,30 @@
|
||||
@@ -351,3 +351,30 @@
|
||||
#if GCC_VERSION >= 50100
|
||||
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
|
||||
#endif
|
||||
@ -117,7 +117,7 @@ Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
||||
+
|
||||
--- a/include/linux/compiler.h
|
||||
+++ b/include/linux/compiler.h
|
||||
@@ -578,4 +578,23 @@ static __always_inline void __write_once
|
||||
@@ -583,4 +583,23 @@ static __always_inline void __write_once
|
||||
# define __kprobes
|
||||
# define nokprobe_inline inline
|
||||
#endif
|
||||
|
@ -351,7 +351,6 @@ CONFIG_ARM_GIC_MAX_NR=1
|
||||
# CONFIG_ARM_UNWIND is not set
|
||||
# CONFIG_ARM_VIRT_EXT is not set
|
||||
# CONFIG_AS3935 is not set
|
||||
# CONFIG_ASIX_PHY is not set
|
||||
# CONFIG_ASM9260_TIMER is not set
|
||||
# CONFIG_ASUS_LAPTOP is not set
|
||||
# CONFIG_ASUS_WIRELESS is not set
|
||||
@ -425,6 +424,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y
|
||||
# CONFIG_AX25 is not set
|
||||
# CONFIG_AX25_DAMA_SLAVE is not set
|
||||
# CONFIG_AX88796 is not set
|
||||
# CONFIG_AX88796B_PHY is not set
|
||||
# CONFIG_AXP20X_ADC is not set
|
||||
# CONFIG_AXP20X_POWER is not set
|
||||
# CONFIG_AXP288_ADC is not set
|
||||
|
@ -0,0 +1,100 @@
|
||||
From 5a4d7714faa28c03e85d696fba82716fbda5c432 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Date: Sat, 23 Mar 2019 09:29:49 +0000
|
||||
Subject: [PATCH] netfilter: connmark: introduce savedscp
|
||||
|
||||
savedscp is a method of storing the DSCP of an ip packet into conntrack
|
||||
mark. In combination with a suitable tc filter action (conndscp but may
|
||||
end up being integrated into connmark) DSCP values are able to be stored
|
||||
on egress and restored on ingress across links that otherwise alter or
|
||||
bleach DSCP.
|
||||
|
||||
This is useful for qdiscs such as CAKE which are able to shape according
|
||||
to policies based on DSCP.
|
||||
|
||||
Ingress classification is traditionally a challenging task since
|
||||
iptables rules haven't yet run and tc filter/eBPF programs are pre-NAT
|
||||
lookups, hence are unable to see internal IPv4 addresses as used on the
|
||||
typical home masquerading gateway.
|
||||
|
||||
The ingress problem is solved by the tc filter, but the tc people didn't
|
||||
like the idea of tc setting conntrack mark values, though they are ok
|
||||
with reading conntrack values and hence restoring DSCP from conntrack
|
||||
marks.
|
||||
|
||||
x_tables CONNMARK with the new savedscp action solves the problem of
|
||||
storing the DSCP to the conntrack mark.
|
||||
|
||||
It accepts 2 parameters. The mark is a 32bit value with usually one 1
|
||||
bit set. This bit is set when savedscp saves the DSCP to the mark.
|
||||
This is useful to implement a 'one shot'
|
||||
iptables based classification where the 'complicated' iptables rules are
|
||||
only run once to classify the connection on initial (egress) packet and
|
||||
subsequent packets are all marked/restored with the same DSCP. A mark
|
||||
of zero disables the setting of a status bit/s.
|
||||
|
||||
The mask is a 32bit value of at least 6 contiguous bits and represents
|
||||
the area where the DSCP will be stored.
|
||||
|
||||
e.g.
|
||||
|
||||
iptables -A QOS_MARK_eth0 -t mangle -j CONNMARK --savedscp-mark 0xfc000000/0x01000000
|
||||
|
||||
Would store the DSCP in the top 6 bits of the 32bit mark field, and use
|
||||
the LSB of the top byte as the 'DSCP has been stored' marker.
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
include/uapi/linux/netfilter/xt_connmark.h | 3 ++-
|
||||
net/netfilter/xt_connmark.c | 21 ++++++++++++++++++++-
|
||||
2 files changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/include/uapi/linux/netfilter/xt_connmark.h
|
||||
+++ b/include/uapi/linux/netfilter/xt_connmark.h
|
||||
@@ -16,7 +16,8 @@
|
||||
enum {
|
||||
XT_CONNMARK_SET = 0,
|
||||
XT_CONNMARK_SAVE,
|
||||
- XT_CONNMARK_RESTORE
|
||||
+ XT_CONNMARK_RESTORE,
|
||||
+ XT_CONNMARK_SAVEDSCP
|
||||
};
|
||||
|
||||
struct xt_connmark_tginfo1 {
|
||||
--- a/net/netfilter/xt_connmark.c
|
||||
+++ b/net/netfilter/xt_connmark.c
|
||||
@@ -42,6 +42,7 @@ connmark_tg(struct sk_buff *skb, const s
|
||||
enum ip_conntrack_info ctinfo;
|
||||
struct nf_conn *ct;
|
||||
u_int32_t newmark;
|
||||
+ u_int8_t dscp, maskshift;
|
||||
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (ct == NULL)
|
||||
@@ -57,7 +58,25 @@ connmark_tg(struct sk_buff *skb, const s
|
||||
break;
|
||||
case XT_CONNMARK_SAVE:
|
||||
newmark = (ct->mark & ~info->ctmask) ^
|
||||
- (skb->mark & info->nfmask);
|
||||
+ (skb->mark & info->nfmask);
|
||||
+ if (ct->mark != newmark) {
|
||||
+ ct->mark = newmark;
|
||||
+ nf_conntrack_event_cache(IPCT_MARK, ct);
|
||||
+ }
|
||||
+ break;
|
||||
+ case XT_CONNMARK_SAVEDSCP:
|
||||
+ if (skb->protocol == htons(ETH_P_IP))
|
||||
+ dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2;
|
||||
+ else if (skb->protocol == htons(ETH_P_IPV6))
|
||||
+ dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;
|
||||
+ else /* protocol doesn't have diffserv */
|
||||
+ break;
|
||||
+
|
||||
+ /* nfmask contains the mask shift value */
|
||||
+ maskshift = info->nfmask & 0x1f;
|
||||
+ newmark = (ct->mark & ~info->ctmark) |
|
||||
+ (info->ctmask | (dscp << maskshift));
|
||||
+
|
||||
if (ct->mark != newmark) {
|
||||
ct->mark = newmark;
|
||||
nf_conntrack_event_cache(IPCT_MARK, ct);
|
@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)
|
||||
{
|
||||
struct dst_entry *dst = __sk_dst_get(sk);
|
||||
@@ -1596,9 +1608,11 @@ void sk_destruct(struct sock *sk)
|
||||
@@ -1593,9 +1605,11 @@ void sk_destruct(struct sock *sk)
|
||||
|
||||
static void __sk_free(struct sock *sk)
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/net/core/sock.c
|
||||
+++ b/net/core/sock.c
|
||||
@@ -3382,6 +3382,8 @@ static __net_initdata struct pernet_oper
|
||||
@@ -3379,6 +3379,8 @@ static __net_initdata struct pernet_oper
|
||||
|
||||
static int __init proto_init(void)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/of.h>
|
||||
@@ -3037,3 +3038,5 @@ static int __init regmap_initcall(void)
|
||||
@@ -3039,3 +3040,5 @@ static int __init regmap_initcall(void)
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(regmap_initcall);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user