platform/kernel/linux-rpi3.git
6 years agobcm: vcsm: fix for WORKAROUND to build on arm64 26/161226/2
Seung-Woo Kim [Wed, 22 Nov 2017 07:38:09 +0000 (16:38 +0900)]
bcm: vcsm: fix for WORKAROUND to build on arm64

The vcsm module for bcm has build error on arm64 because of not
matched pointer size and l2 cache function. Fix for WORKAROUND to
build on arm64 with commenting out cache functions and converting
pointer with proper size.

NOTE: it comments out cache operations, so it is not clear to work
properly.

Change-Id: Id67ae8aeaf59d7534dea6e3e39a0be322e04aa04
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agobcm2835-camera: fix for WORKAROUND to build on arm64 25/161225/1
Seung-Woo Kim [Wed, 22 Nov 2017 07:34:49 +0000 (16:34 +0900)]
bcm2835-camera: fix for WORKAROUND to build on arm64

The bcm2835-v4l2 module has build error on arm64 because of not
matched struct size and l2 cache function. Fix for WORKAROUND to
build on arm64 with commenting out them.

NOTE: it comments out cache operations and does not check vchiq
message size, so it is not clear to work properly.

Change-Id: Icd3e811cea4311499c3382d5a3bc9a2fbb1ad9f6
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoARM64: tizen_bcmrpi3_defconfig: enable crypt-related configs 98/160798/1 accepted/tizen/4.0/unified/20171121.061753 accepted/tizen/unified/20171121.061026 submit/tizen/20171120.223749 submit/tizen_4.0/20171120.223940
Junghoon Kim [Mon, 20 Nov 2017 05:56:07 +0000 (14:56 +0900)]
ARM64: tizen_bcmrpi3_defconfig: enable crypt-related configs

Enable crypt-related configs in order to support file system encryption.

Change-Id: Ib5d887db29d8431996f8acaa563ae67f159e0e4b
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
6 years agostaging: vchiq_arm: Add compatibility wrappers for ioctls 71/158771/2 accepted/tizen/unified/20171106.073114 submit/tizen/20171103.092224
Michael Zoran [Wed, 8 Mar 2017 03:23:35 +0000 (19:23 -0800)]
staging: vchiq_arm: Add compatibility wrappers for ioctls

This patch adds compatibility wrappers for the ioctls
exposed by vchiq/vc04_services.  The compat ioctls are
completely implemented on top of the native ioctls.  No
existing lines are modified.

While the ideal approach would be to cleanup the existing
code, this path is simplier and easier to review. While
it does have a small runtime performance penality vs
seperating the existing code into wrapper+worker functions,
the penality is small since only the metadata is copied
back onto the 32 bit user mode stack.

The on top of approach is the approach used by several
existing performance critical subsystems of Linux such
as the DRM 3D graphics subsystem.

Testing:

1. A 32 bit chroot was created on a RPI 3 and vchiq_test
was built for armhf.  The usual tests were run such as
vchiq_test -f 10 and vchiq_test -p.

2. This patch was copied onto the shipping version of
the Linux kernel used for the RPI and that kernel was
built for arm64. That kernel was used to boot Raspbian.
Many of the builtin features are now functional such
as the "hello_pi" examples, and minecraft_pi.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[lhs: cherry-pick from mainline commit 5569a1260933 to fix 32bit user issue]
Signed-off-by: Hackseung Lee <lhs@dignsys.com>
Change-Id: I7e1cb9db9c3e47bd72a3cccf57db6c9c92e8aa1e

6 years agorpi3: enable jtag gpio option 26/157726/2 accepted/tizen/4.0/unified/20171101.064807 accepted/tizen/unified/20171030.161639 submit/tizen/20171030.045800 submit/tizen_4.0/20171101.031724
Seung-Woo Kim [Thu, 26 Oct 2017 03:55:05 +0000 (12:55 +0900)]
rpi3: enable jtag gpio option

Enable jtag gpio option at 1st bootloader level. The option
enables jtag gpio as alt4 mode as like following:
 GPIO22 - PIN13 - TRST
 GPIO23 - PIN16 - RTCK
 GPIO24 - PIN18 - TDO
 GPIO25 - PIN22 - TCK
 GPIO26 - PIN37 - TDI
 GPIO27 - PIN07 - TMS

This is requested for debugging secure world with jtag.

Change-Id: I0e25dd9ecf95fa003e56eb73eae5a668a1f6e3ba
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agorpi3: Enable ARM atf boot for rpi3 31/154131/4 accepted/tizen/unified/20171026.074706 submit/tizen/20171025.075627 submit/tizen_4.0/20171025.075611
r.tyminski [Fri, 6 Oct 2017 15:39:37 +0000 (17:39 +0200)]
rpi3: Enable ARM atf boot for rpi3

Boot rpi3 with u-boot-spl.bin which enables ARM atf.
Other booting options are set as like:
https://github.com/OP-TEE/build/blob/master/rpi3/firmware/config.txt

Change-Id: I0c0559c3f72f252c2cd2716b746b3c49b04fd63e
Signed-off-by: Rafal Tyminski <r.tyminski@partner.samsung.com>
[sw0312.kim: add more options and adjust commit-msg]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoARM64: dts: bcm2710-rpi-3-b : add memory reserve 56/141656/4
egukim [Tue, 4 Jul 2017 04:53:36 +0000 (13:53 +0900)]
ARM64: dts: bcm2710-rpi-3-b : add memory reserve

add memory reserve for rpi3(64bit) secure OS

Change-Id: I346a2d7c1afc0441ab4655592f3d81836a106f94
Signed-off-by: eunggu kim <egukim@dignsys.com>
6 years agoARM64: dts: bcm2710: add psci device node 51/141151/6
egukim [Mon, 3 Jul 2017 05:06:47 +0000 (14:06 +0900)]
ARM64: dts: bcm2710: add psci device node

This patch changes the enable-method from 'spin-table' to
'PSCI (Power State Coordination Interface)' in order to control
the cpu state such as cpu up/down.

Change-Id: I92eaa95cbccbd86f6067bc9977acc45813703cad
Signed-off-by: eunggu kim <egukim@dignsys.com>
6 years agoARM64: tizen_bcmrpi3_defconfig: Enable TEE Driver 50/141150/5
egukim [Mon, 3 Jul 2017 05:00:28 +0000 (14:00 +0900)]
ARM64: tizen_bcmrpi3_defconfig: Enable TEE Driver

Set config CONFIG_TEE, CONFIG_OPTEE for enable optee kernel driver

Change-Id: Ib35167d8337126886b2bef03acf3aef6163d61ae
Signed-off-by: Eunggu kim <egukim@dignsys.com>
6 years agoARM64: dts: rpi3: Add optee node 49/141149/5
egukim [Mon, 3 Jul 2017 04:55:37 +0000 (13:55 +0900)]
ARM64: dts: rpi3: Add optee node

Add device node for optee kernel driver. This based on
https://github.com/linaro-swg/linux/commit/a3d16523b5c3bd3c21e2009f2af0901b0d6d09dd

Change-Id: I9cc6d97354897b4656b02744076efd91889d7630
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
[egukim: modified commit from linaro-swg/linux of github]
Signed-off-by: Eunggu kim <egukim@dignsys.com>
6 years agoscripts: mkbootimg_rpi3.sh: Add u-boot.img with optee os 62/156062/4
Seung-Woo Kim [Tue, 17 Oct 2017 05:33:57 +0000 (14:33 +0900)]
scripts: mkbootimg_rpi3.sh: Add u-boot.img with optee os

There is optee atf for rpi3, so it should be also installed in
boot.img. Add u-boot.img with optee os for atf.

Change-Id: I93e880f1310252b4d254e99a34803eb2094d1862
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoscripts: mkbootimg_rpi3.sh: replace waiting with sync command 23/156323/2
Seung-Woo Kim [Wed, 18 Oct 2017 05:31:06 +0000 (14:31 +0900)]
scripts: mkbootimg_rpi3.sh: replace waiting with sync command

The waiting with sleep command is not really required if there is
sync command before umount. Replace the waiting with sync command.

Change-Id: I97f886b9230aaafe20fc86caa2476d26c8464cde
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomisc: tizen-inform-reboot: resolve sync failure about reboot parameter 13/156113/2 accepted/tizen/4.0/unified/20171020.014638 submit/tizen_4.0/20171019.085158 tizen_4.0.m2_release
Junghoon Kim [Tue, 17 Oct 2017 05:43:04 +0000 (14:43 +0900)]
misc: tizen-inform-reboot: resolve sync failure about reboot parameter

Currently, writing reboot paramter into INFORM partition fails
infrequently.

Resolve this issue by calling sync_filesystem function so that it writes
out and waits upon all dirty data associated with this superblock.

Change-Id: Ic62df0c3c4e565ca7211eb85661ead6979f0ad8d
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
6 years agomisc: make sure Tizen notifier is executed before reset 03/153803/3 accepted/tizen/4.0/unified/20171017.212508 accepted/tizen/unified/20171017.071151 submit/tizen/20171017.031118 submit/tizen_4.0/20171017.030930
Łukasz Stelmach [Fri, 29 Sep 2017 13:24:05 +0000 (15:24 +0200)]
misc: make sure Tizen notifier is executed before reset

In case of RaspberryPi the CPU is reset by watchdog triggered from
the bcm2835_restart_notifier_call function. Tizen notifier needs higher
priority to be called before the watchdog.

Change-Id: Ia7f6d895f6f40d1a9b4e57ad41b5bdb55c94f4f2
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agorpi3: enable uart in bootcode.bin 04/153804/3
Łukasz Stelmach [Fri, 29 Sep 2017 13:51:08 +0000 (15:51 +0200)]
rpi3: enable uart in bootcode.bin

The uart_2ndstage option directs bootcode.bin to print some diagnostics,
that indicate the code is running.

Change-Id: I34a68ae3b5c2467ee58fd81adf687ce367e1ed1c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoARM64: tizen_bcmrpi3_defconfig: add i2c-stub to module 81/155381/2 accepted/tizen/4.0/unified/20171013.101136 accepted/tizen/unified/20171013.193310 submit/tizen/20171013.053004 submit/tizen_4.0/20171013.052910 tizen_4.0.IoT.p1_release
kibak.yoon [Fri, 13 Oct 2017 05:20:48 +0000 (14:20 +0900)]
ARM64: tizen_bcmrpi3_defconfig: add i2c-stub to module

We need a test method for the i2c driver and framework on RPI3.
And using a fake device is more convenient than a physical hardware device.
Therefore it would be good to enable i2c-stub for testing i2c feature on RPI3.
This will be used for testing purposes only.

Change-Id: I279bccabf709631130eae7b257bec6275b6acba0
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: support Western european languages 64/152864/3 accepted/tizen/4.0/unified/20170927.181936 accepted/tizen/unified/20170927.181406 submit/tizen/20170927.093519 submit/tizen_4.0/20170927.093628
Inki Dae [Wed, 27 Sep 2017 08:41:16 +0000 (17:41 +0900)]
ARM64: tizen_bcmrpi3_defconfig: support Western european languages

Add Western european language support.

This language support is required for mounting vfat filesystem with default
language set on USB storage.

Change-Id: Ibf479d540a0df8502cae5af0dc242b1cdce3d6c8
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: enable TIZEN_INFORM_REBOOT with inform path 04/145304/4 accepted/tizen/4.0/unified/20170925.150842 accepted/tizen/unified/20170925.150908 submit/tizen/20170922.070938 submit/tizen/20170925.094207 submit/tizen_4.0/20170922.072214 submit/tizen_4.0/20170925.094135
Junghoon Kim [Tue, 22 Aug 2017 04:46:05 +0000 (13:46 +0900)]
ARM64: tizen_bcmrpi3_defconfig: enable TIZEN_INFORM_REBOOT with inform path

Reboot parameter passing is required for determining booting mode for
rpi3.

Activate Tizen reboot parameter passing feature with inform file path.

Change-Id: I67a7c24548dda8e8dd860fa25b2f558dadb83cf5
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
7 years agomisc: add Tizen reboot notifier for passing reboot parameter 04/145004/7
Junghoon Kim [Mon, 21 Aug 2017 02:04:32 +0000 (11:04 +0900)]
misc: add Tizen reboot notifier for passing reboot parameter

To determine booting mode (e.g, fota or recovery) in u-boot side, reboot
parameter should be passed through inform partition.

Add Tizen reboot notifier for passing reboot parameter.

Change-Id: I5830dcf58ec6905b0bc382599aa9ff1251f817d8
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
7 years agoBluetooth: Properly check L2CAP config option output buffer length 96/150096/1 accepted/tizen/4.0/unified/20170920.081526 accepted/tizen/unified/20170920.081036 submit/tizen/20170915.014726 submit/tizen/20170919.044447 submit/tizen_4.0/20170915.014357 submit/tizen_4.0/20170919.044533
Ben Seri [Sat, 9 Sep 2017 21:15:59 +0000 (23:15 +0200)]
Bluetooth: Properly check L2CAP config option output buffer length

commit e860d2c904d1a9f38a24eb44c9f34b8f915a6ea3 upstream.

Validate the output buffer length for L2CAP config requests and responses
to avoid overflowing the stack buffer used for building the option blocks.

Signed-off-by: Ben Seri <ben@armis.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: Cherry-pick from linux-4.9.y tree to fix CVE-2017-1000251]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I6685f0bfbc098bbb284342453295da04cb19e29c

7 years agoLOCAL / fbdev: bcm2708_fb: fix build warnings on 64bit build 99/149999/2
Seung-Woo Kim [Thu, 14 Sep 2017 02:52:35 +0000 (11:52 +0900)]
LOCAL / fbdev: bcm2708_fb: fix build warnings on 64bit build

There are build warnings on arm64 build. Fix following build
warnings:
   drivers/video/fbdev/bcm2708_fb.c: In function 'vc_mem_copy':
   drivers/video/fbdev/bcm2708_fb.c:507:49: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t {aka long unsigned int}' [-Wformat=]
      pr_err("[%s]: failed to dma_alloc_coherent(%d)\n",
                                                    ^
   drivers/video/fbdev/bcm2708_fb.c:516:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      unsigned char *p = (unsigned char *)ioparam.src + offset;
                         ^
   drivers/video/fbdev/bcm2708_fb.c: In function 'bcm2708_fb_probe':
   drivers/video/fbdev/bcm2708_fb.c:844:9: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
     pr_info("BCM2708FB: allocated DMA memory %08x\n",
            ^~~~~~

This only fixes the warnings, but functionality of fb_dmacopy is
already broken on ARM64.

Change-Id: Ib9035e38c79e668f74b47139c2a39faf937226db
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / bcm2835: fix wrong type casting for arm64 12/149912/2
Seung-Woo Kim [Wed, 13 Sep 2017 11:43:11 +0000 (20:43 +0900)]
LOCAL / bcm2835: fix wrong type casting for arm64

On arm64, there are many wrong type casting from pointer and
dma_addr_t. Fix the wrong type casting for arm64 to remove
build warnings.

NOTE: fixed castings are only for debug message and 32bit variable,
so there is no functional change.

Change-Id: I2f1afcd29d2e20e6e8538162f08ef58c300d642b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / usb: dwc_otg: remove build warnings 11/149911/2
Seung-Woo Kim [Wed, 13 Sep 2017 12:29:31 +0000 (21:29 +0900)]
LOCAL / usb: dwc_otg: remove build warnings

There are build warnings for unused variable and casting from
pointer to integer of different size. Remove the build warnings.

NOTE: dwc_otg is not fully consider 64bit architecture and it
stores pointer into uint32_t variable already. This patch just
remove warnings for the converting.

Change-Id: I4182041881dbd3002f331a006e2b70a26e0b10c5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / misc: bcm2835-smi: use proper convert function for __be32 pointer 10/149910/2
Seung-Woo Kim [Wed, 13 Sep 2017 11:36:49 +0000 (20:36 +0900)]
LOCAL / misc: bcm2835-smi: use proper convert function for __be32 pointer

The of_get_address() returns __be32 pointer type, but it is
converted with __be32_to_cpu(). Use proper convert function
__be32_to_cpup() for the pointer.

This fixes following build warning:
   drivers/misc/bcm2835_smi.c: In function 'bcm2835_smi_probe':
   drivers/misc/bcm2835_smi.c:882:65: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     inst->smi_regs_busaddr = be32_to_cpu(addr);
                                                                    ^

Change-Id: I4230be2777eb02845bfaccf46e59d43ce0d90139
Fixes: 0f1ee9dcc3b3 ("MISC: bcm2835: smi: use clock manager and fix reload issues")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agocgroup: mark cgroup_get() with __maybe_unused 09/149909/2
Tejun Heo [Mon, 1 May 2017 19:24:14 +0000 (15:24 -0400)]
cgroup: mark cgroup_get() with __maybe_unused

commit 310b4816a5d8082416b4ab83e5a7b3cb92883a4d upstream.

a590b90d472f ("cgroup: fix spurious warnings on cgroup_is_dead() from
cgroup_sk_alloc()") converted most cgroup_get() usages to
cgroup_get_live() leaving cgroup_sk_alloc() the sole user of
cgroup_get().  When !CONFIG_SOCK_CGROUP_DATA, this ends up triggering
unused warning for cgroup_get().

Silence the warning by adding __maybe_unused to cgroup_get().

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: http://lkml.kernel.org/r/20170501145340.17e8ef86@canb.auug.org.au
Signed-off-by: Tejun Heo <tj@kernel.org>
[sw0312.kim: backport from mainline to fix build warning caused by the backported commite 54215a9bc4d ("cgroup_get() expected ...") in rpi-4.9.y]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ib70e3d4401f9e691940168ac7c4d819ab206c447

7 years agoARM64: tizen_bcmrpi3_defconfig: enable uprobes 50/149950/1
Karol Lewandowski [Fri, 8 Sep 2017 10:13:15 +0000 (12:13 +0200)]
ARM64: tizen_bcmrpi3_defconfig: enable uprobes

This functionality is needed for D-Bus Observability Tools
(developed in platform/tools/bcc).

uprobes allows monitoring userspace processes with eBPF
without code modification.

Change-Id: Ic163b72a8315602b89059f36615b88da892aeb0d

7 years agoarm64: fix error: conflicting types for 'kprobe_fault_handler' 49/149949/1
Pratyush Anand [Mon, 7 Nov 2016 17:37:22 +0000 (23:07 +0530)]
arm64: fix error: conflicting types for 'kprobe_fault_handler'

When CONFIG_KPROBE is disabled but CONFIG_UPROBE_EVENT is enabled, we get
following compilation error:

In file included from
.../arch/arm64/kernel/probes/decode-insn.c:20:0:
.../arch/arm64/include/asm/kprobes.h:52:5: error:
conflicting types for 'kprobe_fault_handler'
 int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
     ^~~~~~~~~~~~~~~~~~~~
In file included from
.../arch/arm64/kernel/probes/decode-insn.c:17:0:
.../include/linux/kprobes.h:398:90: note:
previous definition of 'kprobe_fault_handler' was here
 static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
                                                                                          ^
.../scripts/Makefile.build:290: recipe for target
'arch/arm64/kernel/probes/decode-insn.o' failed

<asm/kprobes.h> is already included from <linux/kprobes.h> under #ifdef
CONFIG_KPROBE. So, this patch fixes the error by removing it from
decode-insn.c.

Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit 7b03b62 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: Icd734933745ba4a19847aab800281e10085ad03b

7 years agoarm64: Add uprobe support 48/149948/1
Pratyush Anand [Wed, 2 Nov 2016 09:10:46 +0000 (14:40 +0530)]
arm64: Add uprobe support

This patch adds support for uprobe on ARM64 architecture.

Unit tests for following have been done so far and they have been found
working
    1. Step-able instructions, like sub, ldr, add etc.
    2. Simulation-able like ret, cbnz, cbz etc.
    3. uretprobe
    4. Reject-able instructions like sev, wfe etc.
    5. trapped and abort xol path
    6. probe at unaligned user address.
    7. longjump test cases

Currently it does not support aarch32 instruction probing.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit 9842cea ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: Iea3039116efc98e584185d3acdc1deb9eb8bc819

7 years agoarm64: introduce mm context flag to keep 32 bit task information 47/149947/1
Pratyush Anand [Wed, 2 Nov 2016 09:10:45 +0000 (14:40 +0530)]
arm64: introduce mm context flag to keep 32 bit task information

We need to decide in some cases like uprobe instruction analysis that
whether the current mm context belongs to a 32 bit task or 64 bit.

This patch has introduced an unsigned flag variable in mm_context_t.
Currently, we set and clear TIF_32BIT depending on the condition that
whether an elf binary load sets personality for 32 bit or 64 bit
respectively.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit 06beb72 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: If922121df743b54a94347f6adf8a0333b84d5a94

7 years agoarm64: Handle TRAP_BRKPT for user mode as well 46/149946/1
Pratyush Anand [Wed, 2 Nov 2016 09:10:44 +0000 (14:40 +0530)]
arm64: Handle TRAP_BRKPT for user mode as well

uprobe is registered at break_hook with a unique ESR code. So, when a
TRAP_BRKPT occurs, call_break_hook checks if it was for uprobe. If not,
then send a SIGTRAP to user.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit 53d07e218 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: I1845756c5987f975f57c1d25bec7985cd6642d1d

7 years agoarm64: Handle TRAP_TRACE for user mode as well 45/149945/1
Pratyush Anand [Wed, 2 Nov 2016 09:10:43 +0000 (14:40 +0530)]
arm64: Handle TRAP_TRACE for user mode as well

uprobe registers a handler at step_hook. So, single_step_handler now
checks for user mode as well if there is a valid hook.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit 3fb6964 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: Ie1d3f3a99c4e039043b991f1e7150d53f5a9a76e

7 years agoarm64: kgdb_step_brk_fn: ignore other's exception 44/149944/1
Pratyush Anand [Wed, 2 Nov 2016 09:10:42 +0000 (14:40 +0530)]
arm64: kgdb_step_brk_fn: ignore other's exception

ARM64 step exception does not have any syndrome information. So, it is
responsibility of exception handler to take care that they handle it
only if exception was raised for them.

Since kgdb_step_brk_fn() always returns 0, therefore we might have problem
when we will have other step handler registered as well.

This patch fixes kgdb_step_brk_fn() to return error in case of step handler
was not meant for kgdb.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit b66c987 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: I0feebaa2a0a6fd21df13e4bc4ef7409cefb7cd34

7 years agoarm64: kprobe: protect/rename few definitions to be reused by uprobe 43/149943/1
Pratyush Anand [Wed, 2 Nov 2016 09:10:41 +0000 (14:40 +0530)]
arm64: kprobe: protect/rename few definitions to be reused by uprobe

decode-insn code has to be reused by arm64 uprobe implementation as well.
Therefore, this patch protects some portion of kprobe code and renames few
other, so that decode-insn functionality can be reused by uprobe even when
CONFIG_KPROBES is not defined.

kprobe_opcode_t and struct arch_specific_insn are also defined by
linux/kprobes.h, when CONFIG_KPROBES is not defined. So, protect these
definitions in asm/probes.h.

linux/kprobes.h already includes asm/kprobes.h. Therefore, remove inclusion
of asm/kprobes.h from decode-insn.c.

There are some definitions like kprobe_insn and kprobes_handler_t etc can
be re-used by uprobe. So, it would be better to remove 'k' from their
names.

struct arch_specific_insn is specific to kprobe. Therefore, introduce a new
struct arch_probe_insn which will be common for both kprobe and uprobe, so
that decode-insn code can be shared. Modify kprobe code accordingly.

Function arm_probe_decode_insn() will be needed by uprobe as well. So make
it global.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ Mainline commit c224970 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Change-Id: Ibce8abdc439a53bfe4c448ed05d43f5e53c02144

7 years agoInput: rpi_ft5406 - add enable sysfs attribute 57/148857/8
KwangCheol Lee [Mon, 11 Sep 2017 05:09:08 +0000 (14:09 +0900)]
Input: rpi_ft5406 - add enable sysfs attribute

Add enable sysfs attribute for disable/enable the touchscreen input.
This feature is required to turn the touch screen display on or off.

Change-Id: I4d5250c32cc2118f0f19a8a3cfb76ea8574f6937
Signed-off-by: KwangCheol Lee <kclee@dignsys.com>
7 years agoscripts: mkbootimg_rpi3.sh: Add u-boot binaries to boot.img 34/149334/1
Seung-Woo Kim [Tue, 12 Sep 2017 05:55:31 +0000 (14:55 +0900)]
scripts: mkbootimg_rpi3.sh: Add u-boot binaries to boot.img

In boot.img for tizen rpi3 image, u-boot binaries are required.
Add U-Boot binaries recevied from download.tizen.org to boot.img.

Change-Id: I9778ea5c72697c3e7d0a534627fc65841bb792a1
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoscripts: mkbootimg_rpi3.sh: remove not required kernel.img 33/149333/1
Seung-Woo Kim [Tue, 12 Sep 2017 05:25:08 +0000 (14:25 +0900)]
scripts: mkbootimg_rpi3.sh: remove not required kernel.img

There is error for kernel.img because it is not built and u-boot
does not use fit style image. Remove not required kernel.img from
mkbootimg_rpi3.sh script.

Fixes: 5599e1371134 ("scripts: mkbootimg_rpi3.sh: Add ARM64 kernel/dtb binary to boot.img")

Change-Id: I50bb7be55932ef3c13ceafd5191aa17f8e2a5afc
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: enable BPF and KPROBES 32/148732/4 accepted/tizen/4.0/unified/20170913.003247 accepted/tizen/unified/20170913.070743 submit/tizen/20170911.105932 submit/tizen_4.0/20170911.105929
Maciej Slodczyk [Fri, 8 Sep 2017 12:56:42 +0000 (14:56 +0200)]
ARM64: tizen_bcmrpi3_defconfig: enable BPF and KPROBES

Enable BPF and KPROBES config options.

This functionality is needed for D-Bus Observability Tools,
eBPF (http://www.brendangregg.com/ebpf.html).

Change-Id: I2415ca28695e212ee1d02dd1480613cad8a5455c
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: synchronize the defconfig with pwm 97/148897/1
Seung-Woo Kim [Mon, 11 Sep 2017 05:58:06 +0000 (14:58 +0900)]
ARM64: tizen_bcmrpi3_defconfig: synchronize the defconfig with pwm

It synchronizes the defconfig with pwm backlight to fix the commit
d1b5d090a9f8 ("ARM64: tizen_bcmrpi3_defconfig: enable the RPI touchscreen LCD")
because PWM config option added more config options to backlight.

Change-Id: Ie831a2601807a1f9ba729cf64fb98449147ed018
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agodrm/vc4: Workaround for crtc scanout device problem 43/147043/6
Hoegeun Kwon [Thu, 7 Sep 2017 07:24:56 +0000 (16:24 +0900)]
drm/vc4: Workaround for crtc scanout device problem

Currently, the crtc device does not start a scanout, the time of
vblank is always calculated as future value. As a workaround, always
change vpos to a positive number.

Change-Id: I02527a0cfbd03d7713fa992d8ee039ffc8e0c5de
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
7 years agodrm/vc4: Fix refcounting of runtime PM get if it errors out. 13/148513/2
Eric Anholt [Mon, 17 Apr 2017 16:26:03 +0000 (09:26 -0700)]
drm/vc4: Fix refcounting of runtime PM get if it errors out.

We were returning without decrementing if the error happened, meaning
that at the next submit we wouldn't try to bring up the power domain.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: http://patchwork.freedesktop.org/patch/msgid/20170417162603.12726-1-eric@anholt.net
Reviewed-by: Sean Paul <seanpaul@chromium.org>
(cherry picked from commit 925d05e1f825db9490da33afe35bd5383d301e97)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Ib6a94bf23f289b6385373727fe54146ce25dddc6

7 years agodrm/vc4: Demote user-accessible DRM_ERROR paths to DRM_DEBUG. 12/148512/2
Eric Anholt [Mon, 24 Jul 2017 21:34:55 +0000 (14:34 -0700)]
drm/vc4: Demote user-accessible DRM_ERROR paths to DRM_DEBUG.

Userspace shouldn't be able to spam dmesg by passing bad arguments.
This has particularly become an issues since we started using a bad
argument to set_tiling to detect if set_tiling was supported.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 83753117f1de ("drm/vc4: Add get/set tiling ioctls.")

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: If0d72926b2a84d83eff06ae161502605df7e11e9

7 years agodrm/vc4: Fix pitch setup for T-format scanout. 11/148511/2
Eric Anholt [Sat, 15 Jul 2017 00:33:08 +0000 (17:33 -0700)]
drm/vc4: Fix pitch setup for T-format scanout.

The documentation said to use src_w here, and I didn't consider that
we actually needed to be using pitch somewhere in our setup.  Fixes
scanout on my DSI panel when X11 does initial setup with 1920x1080
HDMI and 800x480 DSI both at 0,0 of the same framebuffer.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 98830d91da08 ("drm/vc4: Add T-format scanout support.")

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Iad1f4838785a0956542cc54d88fdc96dade5e66c

7 years agodrm/vc4: prepare for CEC support 10/148510/2
Hans Verkuil [Sun, 16 Jul 2017 10:48:03 +0000 (12:48 +0200)]
drm/vc4: prepare for CEC support

In order to support CEC the hsm clock needs to be enabled in
vc4_hdmi_bind(), not in vc4_hdmi_encoder_enable(). Otherwise you wouldn't
be able to support CEC when there is no hotplug detect signal, which is
required by some monitors that turn off the HPD when in standby, but keep
the CEC bus alive so they can be woken up.

The HDMI core also has to be enabled in vc4_hdmi_bind() for the same
reason.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170716104804.48308-3-hverkuil@xs4all.nl
(cherry picked from commit 10ee275cb12f884ce09bed69ea387eae73d7fece)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I1b4e299411859c5e8478a93144e7f9496a4f578d

7 years agodrm/vc4: Add runtime PM support to the HDMI encoder driver 09/148509/2
Boris Brezillon [Tue, 11 Apr 2017 16:39:25 +0000 (18:39 +0200)]
drm/vc4: Add runtime PM support to the HDMI encoder driver

The HDMI driver is currently enabling all clocks at probe time and
keeps the power-domain connected to the HDMI encoder enabled.

Move all activation code to vc4_hdmi_encoder_enable() and make sure
the clks and power domain are released when the HDMI encoder is not used
by adding deactivation steps in vc4_hdmi_encoder_disable().

Note that the sequencing imposed by the IP requires that we move
vc4_hdmi_encoder_mode_set() code into vc4_hdmi_encoder_enable().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 4f6e3d66ac522dec9733d433ad00e8e77747c372)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I3ffc27cde4218eae97bc3358fe68185b34951810

7 years agodrm/vc4: Fix misleading name of the continuous flag. 08/148508/2
Eric Anholt [Tue, 27 Jun 2017 19:58:33 +0000 (12:58 -0700)]
drm/vc4: Fix misleading name of the continuous flag.

The logic was all right in the end, the name was just backwards.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-3-eric@anholt.net
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
(cherry picked from commit ec878c0756a0c202e86256dca1de307ab1189ab8)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I4cc6246a3b99ce4739131ccf9b9621aae61ce389

7 years agodrm/vc4: Fix DSI T_INIT timing. 07/148507/2
Eric Anholt [Tue, 27 Jun 2017 19:58:32 +0000 (12:58 -0700)]
drm/vc4: Fix DSI T_INIT timing.

The DPHY spec requires a much larger T_INIT than I was specifying
before.  In the absence of clear specs from the slave of what their
timing is, just use the value that the firmware was using.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-2-eric@anholt.net
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
(cherry picked from commit e65d51126f89a0d67ee6c5df58363730b1410ab5)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Ice356806cba9d0bb5a786e58d8835f79527d404a

7 years agodrm/vc4: Convert more lock requirement comments to lockdep assertions. 06/148506/2
Eric Anholt [Tue, 25 Jul 2017 18:27:18 +0000 (11:27 -0700)]
drm/vc4: Convert more lock requirement comments to lockdep assertions.

Since I do my development with lockdep on, this will help make sure I
don't introduce bugs here.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-3-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 4e6b1e91253ebf701b4ec3586cba5596527a4d0a)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I51614f8783c7e022e873bc40bca31beabf4a9ad0

7 years agodrm/vc4: Add an ioctl for labeling GEM BOs for summary stats 05/148505/2
Eric Anholt [Tue, 25 Jul 2017 18:27:17 +0000 (11:27 -0700)]
drm/vc4: Add an ioctl for labeling GEM BOs for summary stats

This has proven immensely useful for debugging memory leaks and
overallocation (which is a rather serious concern on the platform,
given that we typically run at about 256MB of CMA out of up to 1GB
total memory, with framebuffers that are about 8MB ecah).

The state of the art without this is to dump debug logs from every GL
application, guess as to kernel allocations based on bo_stats, and try
to merge that all together into a global picture of memory allocation
state.  With this, you can add a couple of calls to the debug build of
the 3D driver and get a pretty detailed view of GPU memory usage from
/debug/dri/0/bo_stats (or when we debug print to dmesg on allocation
failure).

The Mesa side currently labels at the gallium resource level (so you
see that a 1920x20 pixmap has been created, presumably for the window
system panel), but we could extend that to be even more useful with
glObjectLabel() names being sent all the way down to the kernel.

(partial) example of sorted debugfs output with Mesa labeling all
resources:

               kernel BO cache:  16392kb BOs (3)
       tiling shadow 1920x1080:   8160kb BOs (1)
       resource 1920x1080@32/0:   8160kb BOs (1)
scanout resource 1920x1080@32/0:   8100kb BOs (1)
                        kernel:   8100kb BOs (1)

v2: Use strndup_user(), use lockdep assertion instead of just a
    comment, fix an array[-1] reference, extend comment about name
    freeing.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-2-eric@anholt.net
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit f30994622b2bf8e4fa224237ac65304b27a9cb6a)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Ib460d3a57e148cddec4972c83a7d2567452f57e6

7 years agodrm/vc4: Start using u64_to_user_ptr. 03/148503/2
Eric Anholt [Tue, 25 Jul 2017 18:27:16 +0000 (11:27 -0700)]
drm/vc4: Start using u64_to_user_ptr.

Chris Wilson pointed out this little cleanup in a review of new code,
so let's fix up the code I was copying from.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 95d7cbcb6fbe3885d7a968cc86b98a08466742af)

[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Ie95aa6eebe152b453c3d6f5dd330c79af3b12353

7 years agodrm/vc4: Don't disable DSI clocks on component unload. 02/148502/2
Eric Anholt [Wed, 2 Aug 2017 18:46:51 +0000 (11:46 -0700)]
drm/vc4: Don't disable DSI clocks on component unload.

The clocks are enabled/disabled at encoder enable/disable time, not at
component load.  Fixes a WARN_ON at boot if V3D fails to probe.

Fixes: 4078f5757144 ("drm/vc4: Add DSI driver")
Signed-off-by: Eric Anholt <eric@anholt.net>
[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Ifdecf388b2fc838557d3a24265ff9e45c019f7d1

7 years agodrm/vc4: Fix double destroy of the BO cache on teardown. 01/148501/2
Eric Anholt [Wed, 2 Aug 2017 19:48:04 +0000 (12:48 -0700)]
drm/vc4: Fix double destroy of the BO cache on teardown.

It's also destroyed from the top level vc4_drv.c initialization, which
is where the cache was actually initialized from.

This used to just involve duplicate del_timer() and cancel_work_sync()
being called, but it started causing kmalloc issues once we
double-freed the new BO label array.

Fixes: 1908a876f909 ("drm/vc4: Add an ioctl for labeling GEM BOs for summary stats")
Signed-off-by: Eric Anholt <eric@anholt.net>
[inki.dae: apply from rpi3-4.9.y]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I1727a2c8c222f62fe314d7c800871c924905349c

7 years agoRevert "ARM: dts: Disable pixelvalve0/1 nodes as workaround" 66/144666/5 accepted/tizen/4.0/unified/20170908.222207 accepted/tizen/unified/20170908.220611 submit/tizen/20170908.045238 submit/tizen_4.0/20170908.045250
KwangCheol Lee [Thu, 17 Aug 2017 10:05:36 +0000 (19:05 +0900)]
Revert "ARM: dts: Disable pixelvalve0/1 nodes as workaround"

This reverts commit 1fdbcec8240fff33b28d3402cb07b851e7ec841e.
Enable pixelvalve0/1 nodes to support the official RPI touchscreen LCD.

Change-Id: I86b4c78dd4ada0ec9328ac8b797c95c48b9b7c6e
Signed-off-by: KwangCheol Lee <kclee@dignsys.com>
7 years agoARM64: dts: bcm2710-rpi-3-b: add DT support for DRM relevant devices 57/142757/8
KwangCheol Lee [Mon, 7 Aug 2017 07:33:36 +0000 (16:33 +0900)]
ARM64: dts: bcm2710-rpi-3-b: add DT support for DRM relevant devices

Add DTs to support the official RPI touchscreen LCD.

Change-Id: Ibf3b17bfe5d1f0bbe55f941018a489899e8ea9ef
Signed-off-by: KwangCheol Lee <kclee@dignsys.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: enable the RPI touchscreen LCD 56/142756/5
KwangCheol Lee [Mon, 7 Aug 2017 07:31:00 +0000 (16:31 +0900)]
ARM64: tizen_bcmrpi3_defconfig: enable the RPI touchscreen LCD

Enable following configurations for the official RPI touchscreen LCD.
+ TOUCHSCREEN_RPI_FT5406
+ I2C_GPIO
+ DRM_PANEL_RASPBERRYPI_TOUCHSCREEN
+ BACKLIGHT_RPI

Change-Id: I4c11ef34ea87ddeb120a5bc685905dffb5a8654c
Signed-off-by: KwangCheol Lee <kclee@dignsys.com>
7 years agoARM: dts: bcm2710-rpi-3-b: enable spi0 device node 70/147570/1 accepted/tizen/4.0/unified/20170906.143304 accepted/tizen/unified/20170906.060742 submit/tizen/20170905.080002 submit/tizen_4.0/20170905.075958
Inki Dae [Tue, 5 Sep 2017 03:09:36 +0000 (12:09 +0900)]
ARM: dts: bcm2710-rpi-3-b: enable spi0 device node

Enable spi0 device node.

This patch is required to create spidev node which is used
by user space to control spi.

Change-Id: I8dec8288f6b35f628b178e0056d664b96f18ac4b
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: enable SQUASHFS 59/146659/1 accepted/tizen/4.0/unified/20170830.134212 accepted/tizen/unified/20170830.161408 submit/tizen/20170830.084925 submit/tizen_4.0/20170830.085228
Seung-Woo Kim [Wed, 30 Aug 2017 02:59:40 +0000 (11:59 +0900)]
ARM64: tizen_bcmrpi3_defconfig: enable SQUASHFS

To support compressed readonly image from Tizen, squashfs will be
used. Enable SQUASHFS and realted configuration. For better
performance, also SQUASHFS_DECOMP_MULTI_PERCPU and
SQUASHFS_4K_DEVBLK_SIZE options are set.

Change-Id: I8d7fb37f8b2bbe102fedc6c9d7d9c4c242d6ec32
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: enable SMACK_NETFILTER 51/146651/1
Seung-Woo Kim [Tue, 29 Aug 2017 05:56:16 +0000 (14:56 +0900)]
ARM64: tizen_bcmrpi3_defconfig: enable SMACK_NETFILTER

On Tizen, nether service is failed because security smack netfilter
related configs are not enabled. So, enable related configs
including CONFIG_NETWORK_SECMARK, and CONFIG_SECURITY_SMACK_NETFILTER
and others.

Change-Id: Ia886ba9d5dd9bc559633acf3066818e57551f8f4
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: dts: bcm2710-rpi-3-b : Change audio node status as "okay" 62/145562/3 submit/tizen/20170828.224421
Lee Hackseung [Thu, 10 Aug 2017 06:48:39 +0000 (15:48 +0900)]
ARM: dts: bcm2710-rpi-3-b : Change audio node status as "okay"

Start.elf uses dt overlay concept, so each node status can be
overlayed with dtparam=audio=on in config.txt but u-boot does not.
So, change status of on-board audio dt node as "okay" because dt
overlay concept on u-boot requires too huge effort.

Fixing dts file from arm will also change arm64 because arm64 dts
includes arm dts.

Change-Id: I73b3c807968c031ba046f44e937c6828ee7f0119
Signed-off-by: Hackseung Lee <lhs@dignsys.com>
[jcsing.lee@samsung.com: modify commit message more clearly]
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
7 years agoarm64: bcmrpi3_defconfig: Enable features related to bcm sound 61/145561/5
Lee Hackseung [Thu, 10 Aug 2017 05:50:09 +0000 (14:50 +0900)]
arm64: bcmrpi3_defconfig: Enable features related to bcm sound

Enable SND_BCM2835 that has essential functionalities to
play and capture sounds and enable configurations related to PWM
because earjack works through PWM devices.

Change-Id: I04f7ea23b9bdd447a7f8084d8ce5c6f73ebd9992
Signed-off-by: Hackseung Lee <lhs@dignsys.com>
[jcsing.lee@samsung.com: modify commit message more clearly]
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
7 years agobcm2835: Change BCM2708_VCHIQ to BCM2835_VCHIQ 04/146304/3
Jaechul Lee [Mon, 28 Aug 2017 02:30:11 +0000 (11:30 +0900)]
bcm2835: Change BCM2708_VCHIQ to BCM2835_VCHIQ

RPI3 has been working without BCM2708_VCHIQ since a commit 60acf832db94
("staging: vc04_services: use bcm2835 consequently") from 4.10.y was
merged. I change all BCM2708_VCHIQ to BCM2835_VCHIQ.

Change-Id: Id1c469a489d54afbe863f46962d3459afb4481f4
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
7 years agopackaging: Disable UBSan build 92/146292/1 accepted/tizen/unified/20170828.164526 submit/tizen/20170828.023313
Denis Khalikov [Fri, 25 Aug 2017 13:11:14 +0000 (16:11 +0300)]
packaging: Disable UBSan build

UBSan build on kernel will cause build error because kernel has its own
sanitizer build options. So, dislable UBSan build from packaging spec.

Change-Id: Ife910a1e666c6fcafb7ef7bfcc072d88d8549d77
Signed-off-by: Denis Khalikov <d.khalikov@partner.samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: enable android logger 95/145695/2
Karol Lewandowski [Wed, 12 Jul 2017 09:54:23 +0000 (11:54 +0200)]
ARM64: tizen_bcmrpi3_defconfig: enable android logger

To support logger driver backend from Tizen dlog framework, enable
android logger.

Change-Id: I24960463efc40637858c0873ac7400fa0e806650
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agostaging: logger: fix build error due to removed ki_nbytes 93/145693/1
Inki Dae [Mon, 4 Jul 2016 08:28:46 +0000 (17:28 +0900)]
staging: logger: fix build error due to removed ki_nbytes

This patch fixes build error. Logger driver was removed
from mainline kernel and after that there was some changes and
one of them is that ki_nbytes member was removed from kiocb structure.
66ee59a fs: remove ki_nbytes

This patch makes count member of iov_iter structure to be used instead.

Change-Id: I11e9ebdac7dd86c02fd692a67562a23e5c685f69
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agoRevert "staging: Remove logger and alarm-dev from android Makefile" 92/145692/1
Karol Lewandowski [Mon, 3 Jul 2017 12:01:57 +0000 (14:01 +0200)]
Revert "staging: Remove logger and alarm-dev from android Makefile"

This reverts commit 71e365ed0ca893cae8d72cbd4b476a9589003098.

Change-Id: I190dabd2626ca7cb51d00d9fe186d15da21ae405
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agoRevert "staging: Remove the Android logger driver" 91/145691/1
Karol Lewandowski [Mon, 3 Jul 2017 12:00:55 +0000 (14:00 +0200)]
Revert "staging: Remove the Android logger driver"

This reverts commit a0a23bbce7818c90c3d3370af966fefce07a8c9b.

rpi3 is going to be used for various profiles - among these
there will be IoT and Headless, which still depend on legacy
android logger driver for application logging.

This commit reverts removal of the driver.

Change-Id: I61ab9e87c5bcbf318aa35ec2f92a470b54a98be1
Requested-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agoARM64: tizen_bcmrpi3_defconfig: update the defconfig for synchronization 85/145285/1
Jaehoon Chung [Tue, 22 Aug 2017 03:00:20 +0000 (12:00 +0900)]
ARM64: tizen_bcmrpi3_defconfig: update the defconfig for synchronization

It updates the defconfig for synchronization.

Change-Id: I2f1b2aa7cdcc82c0df0407cde155569884181471
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoARM64/SND_BCM2835: Port it to arm64.
Michael Zoran [Fri, 13 Jan 2017 03:05:46 +0000 (19:05 -0800)]
ARM64/SND_BCM2835: Port it to arm64.

In the messages sent to VCHIQ, SND_BCM2835 passes a callback
and a context into two 32 bit pointers.  Since this
message is interpreted by the firmware, it can't be easily
changed.  Luckily only one of these fields is actual used,
so on ARM64 only use one of the fields to store the upper
half of the 64 bit callback pointer.

The Kconfig is also changed to allow ARM audio to work for ARM64
as well.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
7 years agovchiq_arm: Tweak the logging output
Phil Elwell [Mon, 7 Mar 2016 15:05:11 +0000 (15:05 +0000)]
vchiq_arm: Tweak the logging output

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
7 years agoARM64: Fix bad cast in vc04_services
Michael Zoran [Fri, 13 Jan 2017 02:56:54 +0000 (18:56 -0800)]
ARM64: Fix bad cast in vc04_services

The function vchiq_copy_from_user contains a non-portable
cast to uint32_t.  Convert this to a cast to unsigned long
which is portable.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
7 years agovchiq_arm: Avoid use of mutex in add_completion
Phil Elwell [Mon, 20 Jun 2016 12:51:44 +0000 (13:51 +0100)]
vchiq_arm: Avoid use of mutex in add_completion

Claiming the completion_mutex within add_completion did prevent some
messages appearing twice, but provokes a deadlock caused by vcsm using
vchiq within a page fault handler.

Revert the use of completion_mutex, and instead fix the original
problem using more memory barriers.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
7 years agovchiq_arm: Access the dequeue_pending flag locked
Phil Elwell [Wed, 23 Mar 2016 14:16:25 +0000 (14:16 +0000)]
vchiq_arm: Access the dequeue_pending flag locked

Reading through this code looking for another problem (now found in userland)
the use of dequeue_pending outside a lock didn't seem safe.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
7 years agoRevert "staging: vc04_services: remove vchiq_copy_from_user"
popcornmix [Tue, 27 Dec 2016 22:13:42 +0000 (22:13 +0000)]
Revert "staging: vc04_services: remove vchiq_copy_from_user"

This reverts commit 49bec49fd7f273ec114e2e533c1bb8f21a654aaf.

7 years agostaging: vc04_services: add HAS_DMA dependancy
Greg Kroah-Hartman [Thu, 17 Nov 2016 08:39:59 +0000 (09:39 +0100)]
staging: vc04_services: add HAS_DMA dependancy

We need DMA for this, otherwise the build breaks, so fix this up.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: clarify firmware dependency
Arnd Bergmann [Wed, 16 Nov 2016 15:39:06 +0000 (16:39 +0100)]
staging: vc04_services: clarify firmware dependency

The raspberrypi-firmware driver may be built as a loadable module,
which causes a link-time failure if the vc04_services driver is
built-in during compile-testing:

drivers/staging/vc04_services/vchiq.o: In function `vchiq_probe':
vchiq_connected.c:(.text.vchiq_probe+0x2c): undefined reference to `rpi_firmware_get'
drivers/staging/vc04_services/vchiq.o: In function `vchiq_platform_init':
vchiq_connected.c:(.text.vchiq_platform_init+0x1f0): undefined reference to `rpi_firmware_property'

This extends the dependency list to ensure the firmware is either
reachable, or completely disabled in case of compile-testing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: remove duplicate mutex_lock_interruptible
Arnd Bergmann [Wed, 16 Nov 2016 15:39:05 +0000 (16:39 +0100)]
staging: vc04_services: remove duplicate mutex_lock_interruptible

The driver tries to redefine mutex_lock_interruptible as an open-coded
mutex_lock_killable, but that definition clashes with the normal
mutex_lock_interruptible definition when CONFIG_DEBUG_LOCK_ALLOC
is set:

staging/vc04_services/interface/vchiq_arm/vchiq_killable.h:67:0: error: "mutex_lock_interruptible" redefined [-Werror]
 #define mutex_lock_interruptible mutex_lock_interruptible_killable
include/linux/mutex.h:161:0: note: this is the location of the previous definition

This simply removes the private implementation and uses the
normal mutex_lock_killable directly.

We could do the same for the down_interruptible_killable here, but
it's better to just remove the semaphores entirely from the driver,
which also takes care of that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix ifnullfree.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 15:31:46 +0000 (23:31 +0800)]
staging: vc04_services: fix ifnullfree.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c:65:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix array_size.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 08:10:20 +0000 (16:10 +0800)]
staging: vc04_services: fix array_size.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:193:39-40: WARNING: Use ARRAY_SIZE

 Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
 This makes an effort to find cases where ARRAY_SIZE can be used such as
 where there is a division of sizeof the array by the sizeof its first
 element or by any indexed element or the element type. It replaces the
 division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix returnvar.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 08:10:20 +0000 (16:10 +0800)]
staging: vc04_services: fix returnvar.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1788:16-22: Unneeded variable: "status". Return "VCHIQ_SUCCESS" on line 1824

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix setup_timer.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 08:10:20 +0000 (16:10 +0800)]
staging: vc04_services: fix setup_timer.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1817:2-12: Use setup_timer function for function on line 1818.

 Use setup_timer function instead of initializing timer with the function
 and data fields
Generated by: scripts/coccinelle/api/setup_timer.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: add CONFIG_COMPILE_TEST ability
Greg Kroah-Hartman [Mon, 10 Oct 2016 10:05:14 +0000 (12:05 +0200)]
staging: vc04_services: add CONFIG_COMPILE_TEST ability

It would be nice to be able to build this code on other platforms other
than only the RPi, so add some empty macros to allow this to happen, and
turn off BROKEN as the code can now build properly thanks to Michael's
work.

Change-Id: I0a2a13332f5da2fd4072258e5c35ee99956f0b88
Cc: Michael Zoran <mzoran@crowfest.net>
Cc: Daniel Stone <daniels@collabora.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Pranith Kumar <bobby.prani@gmail.com>
Cc: popcornmix <popcornmix@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: add vchiq_pagelist_info structure
Michael Zoran [Mon, 7 Nov 2016 14:06:03 +0000 (06:06 -0800)]
staging: vc04_services: add vchiq_pagelist_info structure

The current dma_map_sg based implementation for bulk messages
computes many offsets into a single allocation multiple times in
both the create and free code paths.  This is inefficient,
error prone and in fact still has a few lingering issues
with arm64.

This change replaces a small portion of that inplementation with
new code that uses a new struct vchiq_pagelist_info to store the
needed information rather then complex offset calculations.

This improved implementation should be more efficient and easier
to understand and maintain.

Tests Run(Both Pass):
vchiq_test -p 1
vchiq_test -f 10

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix up some printk warnings
Greg Kroah-Hartman [Mon, 7 Nov 2016 10:18:42 +0000 (11:18 +0100)]
staging: vc04_services: fix up some printk warnings

Some more printk warnings snuck in recently, no one seems to be building
this on 64bit machines...

Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Michael Zoran <mzoran@crowfest.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: change order during module probe
Stefan Wahren [Mon, 31 Oct 2016 14:39:33 +0000 (14:39 +0000)]
staging: vchiq_arm: change order during module probe

The current order during module probe is prone to race conditions:

* debugfs entries, sysfs entries, platform code

So fix this by swapping the steps debugfs entries and platform code.
As a benefit this saves us a clean up step in the error path.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: remove debugfs entries on module unload
Stefan Wahren [Mon, 31 Oct 2016 14:39:32 +0000 (14:39 +0000)]
staging: vchiq_arm: remove debugfs entries on module unload

This removes the debugfs entries on module unload and fix one
of the many kernel oops after loading the module again.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: handle error case of get_user_pages
Stefan Wahren [Mon, 31 Oct 2016 14:39:31 +0000 (14:39 +0000)]
staging: vchiq_arm: handle error case of get_user_pages

It's possible that get_user_pages() could fail. So evaluate its
return code and handle this error case properly.

This issue has been found by Cppcheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: remove hardcoded buffer length
Stefan Wahren [Mon, 31 Oct 2016 14:39:30 +0000 (14:39 +0000)]
staging: vchiq_arm: remove hardcoded buffer length

We better use sizeof instead of hardcoding buffer length multiple
times. This make it easier to increase the buffer in the future.
In order to keep below 80 chars limit make the variable name shorter.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: add missing of_node_put
Stefan Wahren [Mon, 31 Oct 2016 14:39:29 +0000 (14:39 +0000)]
staging: vchiq_arm: add missing of_node_put

After device_node usage the refcount must be decremented with
of_node_put().

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_core: fix format strings in vchiq_dump_service_state
Stefan Wahren [Mon, 31 Oct 2016 14:39:28 +0000 (14:39 +0000)]
staging: vchiq_core: fix format strings in vchiq_dump_service_state

The member localport and remoteport are unsigned. So fix the format
string accordingly.

The issue has been found by Cppcheck.

Signed-off-by: Stefam Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_core: fix service dereference in unlock_service
Stefan Wahren [Mon, 31 Oct 2016 14:39:27 +0000 (14:39 +0000)]
staging: vchiq_core: fix service dereference in unlock_service

The service state is dereferenced before BUG_ON and outside of the
spin lock. So in order to avoid possible NULL pointer dereferences or
races move the whole scope at a safer place.

This issue has been found by Cppcheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: parse_rx_slots() - Fix compiler warning
Michael Zoran [Tue, 1 Nov 2016 15:21:14 +0000 (08:21 -0700)]
staging: vc04_services: parse_rx_slots() - Fix compiler warning

vc04_services contains a debug logging mechanism.  The log is
maintained in a shared memory area between the kernel and the
firmware.  Changing the sizes of the data in this area would
require a firmware change which is distributed independently
from the kernel binary.

One of the items logged is the address of received messages.
This address is a pointer, but the debugging slot used to store
the information is a 32 bit integer.

Luckily, this value is never interpreted by anything other
then debug tools and it is expected that a human debugging
the kernel interpret it.

This change adds a cast to long before the original cast
to int to silence the warning.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: remove vchiq_copy_from_user
Michael Zoran [Sun, 30 Oct 2016 12:55:07 +0000 (05:55 -0700)]
staging: vc04_services: remove vchiq_copy_from_user

The vchiq_copy_from_user function is not portable
and is consider "bad practice."  Replace this function
with a callback based mechanism that is passed downward
on the stack.  When it is actually time to copy the data,
the callback is called to copy the data into the message.

This callback is provided internally for userland calls
through ioctls on the device.

NOTE: Internal clients will need to be modified to work
with the new internal API.

Test Run:
vchiq_test -p 1
vchiq_test -f 10

Both tests pass.

Internal API Changes:

Change vchi_msg_queue to:
int32_t
vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle,
       ssize_t (*copy_callback)(void *context, void *dest,
        size_t offset, size_t maxsize),
       void *context,
       uint32_t data_size );

Remove:
vchi_msg_queuev_ex
vchi_msg_queuev

These functions were not implemented anyway so no need to fix them. It's
easier to just remove them.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: setup DMA and coherent mask
Michael Zoran [Mon, 31 Oct 2016 21:02:03 +0000 (14:02 -0700)]
staging: vc04_services: setup DMA and coherent mask

VCHI messages between the CPU and firmware use 32-bit
bus addresses. Explicitly set the DMA mask and coherent
on all platforms.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: call sg_init_table to init scatterlist
Michael Zoran [Fri, 28 Oct 2016 17:58:13 +0000 (10:58 -0700)]
staging: vc04_services: call sg_init_table to init scatterlist

Call the sg_init_table function to correctly initialze
the DMA scatterlist.  This function is required to completely
initialize the list and is mandatory if DMA debugging is
enabled in the build configuration.

One of the purposes of sg_init_table is to set
the magic "cookie" on each list element and ensure
the chain end is marked.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: use bcm2835 consequently
Stefan Wahren [Wed, 26 Oct 2016 18:34:21 +0000 (18:34 +0000)]
staging: vc04_services: use bcm2835 consequently

The naming bcm2708 is used only in the vendor kernel, so better
replace it with bcm2835 which is used in mainline in order
to avoid any confusion.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix CamelCase
Stefan Wahren [Wed, 26 Oct 2016 18:34:20 +0000 (18:34 +0000)]
staging: vc04_services: fix CamelCase

This fixes the CamelCase of some variables.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_shim: avoid code duplication
Stefan Wahren [Wed, 26 Oct 2016 18:34:19 +0000 (18:34 +0000)]
staging: vchiq_shim: avoid code duplication

Rearrange the polling loops in order to avoid code duplication. Btw we fix
the style of the comments.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: Make DT firmware node mandatory
Stefan Wahren [Wed, 26 Oct 2016 18:34:18 +0000 (18:34 +0000)]
staging: vchiq_arm: Make DT firmware node mandatory

In Linux Mainline there wasn't a chance to boot the RPi without DT.
So we can make the firmware node mandatory.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchiq_arm: add MODULE_DESCRIPTION
Stefan Wahren [Wed, 26 Oct 2016 18:34:17 +0000 (18:34 +0000)]
staging: vchiq_arm: add MODULE_DESCRIPTION

This patch adds the missing module description for the driver.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: Replace dmac_map_area with dmac_map_sg
Michael Zoran [Wed, 26 Oct 2016 02:23:27 +0000 (19:23 -0700)]
staging: vc04_services: Replace dmac_map_area with dmac_map_sg

The original arm implementation uses dmac_map_area which is not
portable.  Replace it with an architecture neutral version
which uses dma_map_sg.

As you can see that for larger page sizes, the dma_map_sg
implementation is faster then the original unportable dma_map_area
implementation.

Test                       dmac_map_area   dma_map_page dma_map_sg
vchiq_test -b 4 10000      51us/iter       76us/iter    76us
vchiq_test -b 8 10000      70us/iter       82us/iter    91us
vchiq_test -b 16 10000     94us/iter       118us/iter   121us
vchiq_test -b 32 10000     146us/iter      173us/iter   187us
vchiq_test -b 64 10000     263us/iter      328us/iter   299us
vchiq_test -b 128 10000    529us/iter      631us/iter   595us
vchiq_test -b 256 10000    2285us/iter     2275us/iter  2001us
vchiq_test -b 512 10000    4372us/iter     4616us/iter  4123us

For message sizes >= 64KB, dma_map_sg is faster then dma_map_page.

For message size >= 256KB, the dma_map_sg is the fastest
implementation.

"Normal" messages sizes should be about 1MB which is beyond
the length that this change shows a speed increase.

This is v2 of the patch which includes extra WARN_ONs and
incorporates feedback from Eric Anholt <eric@anholt.net>.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2708_vchiq: fix return value check in vchiq_init_state()
Wei Yongjun [Mon, 17 Oct 2016 15:05:36 +0000 (15:05 +0000)]
staging: bcm2708_vchiq: fix return value check in vchiq_init_state()

In case of error, the function kthread_create() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>