GitHub/moto-9609/android_kernel_motorola_exynos9610.git
6 years ago[COMMON] kernel: watchdog: detect hard lockups without NMIs using secondary cpus
Hyunki Koo [Sun, 25 Feb 2018 05:55:21 +0000 (14:55 +0900)]
[COMMON] kernel: watchdog: detect hard lockups without NMIs using secondary cpus

Emulate NMIs on systems where they are not available by using timer
interrupts on other cpus.  Each cpu will use its softlockup hrtimer
to check that the next cpu is processing hrtimer interrupts by
verifying that a counter is increasing.

This patch is useful on systems where the hardlockup detector is not
available due to a lack of NMIs, for example most ARM SoCs.
Without this patch any cpu stuck with interrupts disabled can
cause a hardware watchdog reset with no debugging information,
but with this patch the kernel can detect the lockup and panic,
which can result in useful debugging info.

Change-Id: I0363ee438625863f466dd07ef4b14d8094822840
Signed-off-by: Hyunki Koo <hyunki00.koo@samsung.com>
Signed-off-by: Changki Kim <changki.kim@samsung.com>
6 years ago[9610] arch: defconfig: add mali gpu configuration
Jinku Kang [Tue, 15 May 2018 12:42:14 +0000 (21:42 +0900)]
[9610] arch: defconfig: add mali gpu configuration

Change-Id: I55850586a0907f1fad5e102bdfecab74e3e9b516
Signed-off-by: Jinku Kang <jinku79.kang@samsung.com>
6 years ago[9610] arch: dtsi: add mali-gpu configuration
Jinku Kang [Tue, 15 May 2018 12:39:44 +0000 (21:39 +0900)]
[9610] arch: dtsi: add mali-gpu configuration

Change-Id: I733b8b187666620bcd2f947fcb6aef031348415f
Signed-off-by: Jinku Kang <jinku79.kang@samsung.com>
6 years ago[9610] gpu: add initial codes for mali r10p0, and remove unused codes
Jinku Kang [Tue, 15 May 2018 03:30:26 +0000 (12:30 +0900)]
[9610] gpu: add initial codes for mali r10p0, and remove unused codes

Change-Id: I2ba9eba4d9977c40a7f2da0f7c64357cd4ad1ca4
Signed-off-by: Jinku Kang <jinku79.kang@samsung.com>
6 years ago[COMMON] lib: dss: change variable form enabed log count to total log count
Donghyeok Choe [Wed, 16 May 2018 05:15:56 +0000 (14:15 +0900)]
[COMMON] lib: dss: change variable form enabed log count to total log count

Change-Id: Ife95505db80cac47d7852a511f8c5b71140a4b5e
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] arm64: config: enable PSTORE_PMSG
Donghyeok Choe [Wed, 16 May 2018 02:11:53 +0000 (11:11 +0900)]
[9610][ERD] arm64: config: enable PSTORE_PMSG

Change-Id: I3c0a84a475f2d127e8c5be5dd0202cff9d1d2e31
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[COMMON] fs: pstore: introduce new method for hooking platform log with DSS
Hosung Kim [Mon, 10 Apr 2017 10:26:21 +0000 (19:26 +0900)]
[COMMON] fs: pstore: introduce new method for hooking platform log with DSS

Since android M version, platform log is not dropped to kernel
space. This commit is needed to support other methods
log_main / log_radio are removed, divided space is combined
into one log called log_platform

This commit adds new method for hooking platform with using pstore.
Recently, pmsg added persistant file system to support userspace log.
Exynos-Snapshot hooks userspace log between them.

This commit adds pstore / pstore-ram / pmsg features support in
exynos-snapshot. It is available to logging kernel, ftrace data
and platform(userspace) log.
To support runtime logging(pstore-ram), platform device driver is
needed it has memory information we need

Change-Id: I45a6f61339660df755676da08cd52656b1fcc8b7
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
6 years ago[COMMON] fs: pstore: add hooking platform functions with DSS
Hosung Kim [Wed, 26 Apr 2017 05:09:24 +0000 (14:09 +0900)]
[COMMON] fs: pstore: add hooking platform functions with DSS

Change-Id: Ib1b0d29001e647b86c644248eafa02e051d069da
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
6 years ago[9610][ERD] arm64: configs: merge android-recommended.cfg
Youngmin Nam [Wed, 16 May 2018 06:21:44 +0000 (15:21 +0900)]
[9610][ERD] arm64: configs: merge android-recommended.cfg

Change-Id: I3b47eef62192711ad99473ceed42732b0261d279
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
6 years ago[9610][ERD] arm64: configs: merge android-base.cfg and android-base-arm64.cfg
Youngmin Nam [Wed, 16 May 2018 06:03:43 +0000 (15:03 +0900)]
[9610][ERD] arm64: configs: merge android-base.cfg and android-base-arm64.cfg

Change-Id: I99bec9b0314691dd0e4374e7483f73d5271f7f4d
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
6 years ago[9610][ERD] arm64: config: run savedefconfig
Youngmin Nam [Wed, 16 May 2018 05:35:19 +0000 (14:35 +0900)]
[9610][ERD] arm64: config: run savedefconfig

Change-Id: I6a48e81455ecbb51067e7f3ada539329cb211e3c
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
6 years ago[9610] fbdev: dpu: exynos folder build script is added
hwangjae lee [Tue, 15 May 2018 09:09:34 +0000 (18:09 +0900)]
[9610] fbdev: dpu: exynos folder build script is added

Change-Id: I651a6c3ac696edc33fbe6694efbd97c3dfdccaca
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[HACK] fbdev: dpu: PM_QOS definition is removed for compile
hwangjae lee [Tue, 15 May 2018 08:35:36 +0000 (17:35 +0900)]
[HACK] fbdev: dpu: PM_QOS definition is removed for compile

PM_QOS_BUS_THROUGHPUT,
PM_QOS_DEVICE_THROUGHPUT,
PM_QOS_DISPLAY_THROUGHPUT is not yet defiend.

Change-Id: Ie768c68dcf53fa25f8c893b197f5e550649d0dc9
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] configs: DPU drvier config is enabled
hwangjae lee [Sat, 12 May 2018 08:53:20 +0000 (17:53 +0900)]
[9610] configs: DPU drvier config is enabled

Change-Id: I04f8690d44fe5e2a21b25dac56a254ee5e6a5922
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] arm64: dts: display dts configure is added
hwangjae lee [Sat, 12 May 2018 08:20:40 +0000 (17:20 +0900)]
[9610] arm64: dts: display dts configure is added

Change-Id: I9db9ae2e99200cac1e89233371dd6f2b59c4565e
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] fbdev: dpu: PHY configure is changed by Exynos9610
hwangjae lee [Tue, 15 May 2018 07:48:31 +0000 (16:48 +0900)]
[9610] fbdev: dpu: PHY configure is changed by Exynos9610

1. PHY timing value is changed
2. PHY setting function is changed

Change-Id: Ied96bf2196ec73d687162fd58ac87dfcbaad7e1e
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] fbdev: dpu: DPP configure is modified to Exynos9610 spec
hwangjae lee [Tue, 15 May 2018 07:45:21 +0000 (16:45 +0900)]
[9610] fbdev: dpu: DPP configure is modified to Exynos9610 spec

1. IDMA Number, SFR address, SFR setting value is changed.
2. Base address setting function is changed.
3. DECON sram share size is changed.

Change-Id: I430a908233b880c4d9b057cdd34de51b541db8d8
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] fbdev: dpu: panels: 3fa0 panel file is added
hwangjae lee [Tue, 15 May 2018 08:28:11 +0000 (17:28 +0900)]
[9610] fbdev: dpu: panels: 3fa0 panel file is added

Change-Id: I4f700695031d126220c4e0eea7531e84ba240bdf
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] fbdev: dpu: bts.c code is changed
hwangjae lee [Tue, 15 May 2018 08:34:01 +0000 (17:34 +0900)]
[9610] fbdev: dpu: bts.c code is changed

DPU2, DPP4, DPP5 is removed.

Change-Id: I1daff85abf4b32e36d1cb80c744700b8d5eeb7b8
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] fbdev: dpu: DPU2.0 driver is added
hwangjae lee [Tue, 15 May 2018 07:29:50 +0000 (16:29 +0900)]
[9610] fbdev: dpu: DPU2.0 driver is added

Change-Id: I4e1dbb842bc57f704ef90885af7b4d89307e1062
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] include: video: DSC related definitions is added
hwangjae lee [Sat, 12 May 2018 08:47:04 +0000 (17:47 +0900)]
[9610] include: video: DSC related definitions is added

Change-Id: I7377aa2ddaee35e0fa13334b29fe12f52db17d1f
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] include: linux: videodev2_exynos_media.h file is added
hwangjae lee [Mon, 14 May 2018 02:26:12 +0000 (11:26 +0900)]
[9610] include: linux: videodev2_exynos_media.h file is added

Change-Id: Id4c02c2fcbc5c554d3b2bf44677bee7baf9bc2ca
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610] phy: samsung: add exynos8895 mipi phy driver for exynos9610
hwangjae lee [Fri, 11 May 2018 00:56:50 +0000 (09:56 +0900)]
[9610] phy: samsung: add exynos8895 mipi phy driver for exynos9610

Change-Id: I6bf30a8a38e5c06b9539f9f083b7adcb4e3952b4
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
6 years ago[9610][ERD] arm64: config: Enable CONFIG_SECCOMP config
Jaehyoung Choi [Tue, 15 May 2018 08:45:21 +0000 (17:45 +0900)]
[9610][ERD] arm64: config: Enable CONFIG_SECCOMP config

Change-Id: Iebcc85abd729a5c5b70da8695def4da83adec954
Signed-off-by: Jaehyoung Choi <jkkkkk.choi@samsung.com>
6 years agoRevert "[HACK] [9610] driver: turn on charger always if notifier is not enabled"
Keunho Hwang [Tue, 15 May 2018 02:02:48 +0000 (11:02 +0900)]
Revert "[HACK] [9610] driver: turn on charger always if notifier is not enabled"

This reverts commit 85f6fd13cf1adaa9420104d6ec297ed9a9499f5c.

Change-Id: I3f6edc0ad855a08c9bdd9d9c14b0c0f4814c661a
Signed-off-by: Keunho Hwang <keunho.hwang@samsung.com>
6 years ago[9610][ERD] arm64: config: Enable synaptics touch driver
Jaehyoung Choi [Thu, 10 May 2018 05:43:54 +0000 (14:43 +0900)]
[9610][ERD] arm64: config: Enable synaptics touch driver

Change-Id: Ib3c0d84aa12cea9683669f2cc87b852d08312706
Signed-off-by: Jaehyoung Choi <jkkkkk.choi@samsung.com>
6 years ago[9610][ERD] arm64: dts: Add synaptics touch device node
Jaehyoung Choi [Thu, 10 May 2018 05:43:23 +0000 (14:43 +0900)]
[9610][ERD] arm64: dts: Add synaptics touch device node

Change-Id: Id99f34ce20df90a5eb0dc63e939b01b17e32ea59
Signed-off-by: Jaehyoung Choi <jkkkkk.choi@samsung.com>
6 years ago[COMMON] touchscreen: synaptics: Remove stop touch screen code in probe
Jaehyoung Choi [Wed, 20 Sep 2017 12:44:07 +0000 (21:44 +0900)]
[COMMON] touchscreen: synaptics: Remove stop touch screen code in probe

Change-Id: I1d830cac9012dfd710f97121fcb10b6c13a4807c
Signed-off-by: Jaehyoung Choi <jkkkkk.choi@samsung.com>
6 years ago[COMMON] touchscreen: synaptics: Add avdd regulator
Jaehyoung Choi [Tue, 19 Sep 2017 04:43:04 +0000 (13:43 +0900)]
[COMMON] touchscreen: synaptics: Add avdd regulator

Change-Id: I586e16dc177d75ae90010767924095f5c2257f36
Signed-off-by: Jaehyoung Choi <jkkkkk.choi@samsung.com>
6 years ago[COMMON] touchscreen: synaptics: Add synaptics touch screen code
Jaehyoung Choi [Fri, 15 Sep 2017 00:56:20 +0000 (09:56 +0900)]
[COMMON] touchscreen: synaptics: Add synaptics touch screen code

Change-Id: I1b8d96fb7513ba7c089a05fdeeb986b2dbd757f9
Signed-off-by: Jaehyoung Choi <jkkkkk.choi@samsung.com>
6 years ago[9610][ERD] arm64: dts: fix chipid entry
Donghyeok Choe [Tue, 15 May 2018 04:21:54 +0000 (13:21 +0900)]
[9610][ERD] arm64: dts: fix chipid entry

Change-Id: I35fcd373fc8255cfe490187ceff8d8fdc96df4d3
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[COMMON] drivers: soc: modify chipid definition
Donghyeok Choe [Tue, 15 May 2018 04:20:55 +0000 (13:20 +0900)]
[COMMON] drivers: soc: modify chipid definition

Change-Id: Ia4379d6c91e6197f80c8e525e1f6d4deef901393
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years agoRevert "[HACK] disalbe chip-id driver function"
Donghyeok Choe [Tue, 15 May 2018 04:17:40 +0000 (13:17 +0900)]
Revert "[HACK] disalbe chip-id driver function"

This reverts commit 5319ec7d40f941588c8f7046d2a033349502c464.

Change-Id: I933e658ab4d386d84066e962ddedb0ac2dbbc86d
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] arm64: defconfig: enable EXYNOS_REBOOT
Donghyeok Choe [Mon, 14 May 2018 11:21:35 +0000 (20:21 +0900)]
[9610][ERD] arm64: defconfig: enable EXYNOS_REBOOT

Change-Id: I44757e451bc31fb8f005044595ea519be5f87a9b
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] arm64: dts: add exynos-reboot dt-entry
Donghyeok Choe [Mon, 14 May 2018 11:19:04 +0000 (20:19 +0900)]
[9610][ERD] arm64: dts: add exynos-reboot dt-entry

Change-Id: I674952fdd9e7ab81f6d94a08dc0c9a3f773dfbdd
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] samsung: exynos-reboot: introduce exynos-reboot
Donghyeok Choe [Mon, 14 May 2018 11:17:36 +0000 (20:17 +0900)]
[9610][ERD] samsung: exynos-reboot: introduce exynos-reboot

Change-Id: I3ae59ea7656948a3c3d6b54ac3a8fcac3aa9a4b4
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] arm64: defconfig: enable Debug SnapShot(DSS)
Donghyeok Choe [Mon, 14 May 2018 08:16:02 +0000 (17:16 +0900)]
[9610][ERD] arm64: defconfig: enable Debug SnapShot(DSS)

Change-Id: I93ec61f588ad93f7e272af46039692f350921d1c
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] arm64: defconfig: enable CONFIG_PRINTK_PROCESS
Donghyeok Choe [Mon, 14 May 2018 08:10:57 +0000 (17:10 +0900)]
[9610][ERD] arm64: defconfig: enable CONFIG_PRINTK_PROCESS

Change-Id: I84f00683730ce2dd7d20dd0b0f780cd0dcae33b2
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[HACK] lib: dss: skip cache flush all
Donghyeok Choe [Sun, 13 May 2018 06:38:15 +0000 (15:38 +0900)]
[HACK] lib: dss: skip cache flush all

Change-Id: I7502f4f6097fa3bfe73efb35ca260d6719b0da4e
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[9610][ERD] arm64: dts: add dtsi for debug feature
Donghyeok Choe [Sun, 13 May 2018 07:30:29 +0000 (16:30 +0900)]
[9610][ERD] arm64: dts: add dtsi for debug feature

Change-Id: I4fb9f7716549289b19e69d538f1dc27515c32a3b
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[COMMON] arm64: traps: add entry/exit point for lockup detector
Hosung Kim [Wed, 18 Apr 2018 04:25:23 +0000 (13:25 +0900)]
[COMMON] arm64: traps: add entry/exit point for lockup detector

Change-Id: I715f286fa249f98c1d698b8187443ea7627b173a
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
6 years ago[COMMON] kernel: panic: Remove show regs when WARNING
Changki Kim [Mon, 9 Apr 2018 07:12:31 +0000 (16:12 +0900)]
[COMMON] kernel: panic: Remove show regs when WARNING

Change-Id: I9b77a64da8731253c56c083190d8a1cfe3685bd1
Signed-off-by: Changki Kim <changki.kim@samsung.com>
6 years ago[COMMON] kernel: panic: add soc_early_panic function in panic
Donghyeok Choe [Mon, 14 May 2018 05:54:37 +0000 (14:54 +0900)]
[COMMON] kernel: panic: add soc_early_panic function in panic

Change-Id: I3cedf5f3a88e2b1f73540db0d1085ae2b636007d
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[COMMON] panic: NOT allowed re-entrance by same cpu
Hosung Kim [Thu, 21 Sep 2017 04:45:41 +0000 (13:45 +0900)]
[COMMON] panic: NOT allowed re-entrance by same cpu

if panic and then panic again on the same cpu, it is allowed
re-entrance. In that situation, it is likely to happen panic
again again. So this patch don't allow re-entrace of same cpu
to prevent that situation.

Change-Id: I766f4f72b589be675747f66bb2ec732c07f60b81
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
6 years ago[COMMON] lib: dss: add to support Debug-SnapShot(DSS)
Donghyeok Choe [Sun, 13 May 2018 06:21:23 +0000 (15:21 +0900)]
[COMMON] lib: dss: add to support Debug-SnapShot(DSS)

Change-Id: I28ab91356cc2852a38ee6b7c08d1bcb837d6e8ca
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[COMMON] lib: dss: rename exynos-snapshot to debug-snapshot
Donghyeok Choe [Sun, 13 May 2018 04:32:33 +0000 (13:32 +0900)]
[COMMON] lib: dss: rename exynos-snapshot to debug-snapshot

Change-Id: I196cfc11cd7d24d134bfbf89d5dec27c5450a22f
Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
6 years ago[COMMON] printk: add hooking function for exynos-snapshot
Hosung Kim [Sat, 13 Jun 2015 04:15:44 +0000 (13:15 +0900)]
[COMMON] printk: add hooking function for exynos-snapshot

This commit adds hooking function for gathering kernel log
in exynos-snapshot.

Change-Id: I4132288aec8664861f2b51873feb52d8a7da981b
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
6 years ago[COMMON] printk: add supporting core number and process information
Hosung Kim [Fri, 12 Jun 2015 13:40:21 +0000 (22:40 +0900)]
[COMMON] printk: add supporting core number and process information

This commit adds supporting to output the core number and process
information. They are depending on as following configuration.
- CONFIG_PRINTK_PROCESS

Change-Id: I09698dc00e5acd1bb11b9a564fdc3f129c04b642
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
Signed-off-by: Hyunki Koo <hyunki00.koo@samsung.com>
6 years ago[9610][ERD] arm64: created dt node and added configs for S2MPB02
Jieun Yi [Tue, 15 May 2018 02:23:07 +0000 (11:23 +0900)]
[9610][ERD] arm64: created dt node and added configs for S2MPB02

Change-Id: Id07066b8d4e5279f7a768f0099ed3137a96db83c
Signed-off-by: Jieun Yi <jieun.yi@samsung.com>
6 years ago[9610][ERD] drivers: leds: created led driver for S2MPB02
Jieun Yi [Tue, 15 May 2018 02:22:36 +0000 (11:22 +0900)]
[9610][ERD] drivers: leds: created led driver for S2MPB02

Change-Id: Ifbadf66539f5fb58734d4d9bf7dee37b083ff745
Signed-off-by: Jieun Yi <jieun.yi@samsung.com>
6 years ago[9610][ERD] drivers: regulator: created regulator driver for S2MPB02
Jieun Yi [Tue, 15 May 2018 02:21:59 +0000 (11:21 +0900)]
[9610][ERD] drivers: regulator: created regulator driver for S2MPB02

Change-Id: If727403c00e0f791aa683017abb8a47fbc18376e
Signed-off-by: Jieun Yi <jieun.yi@samsung.com>
6 years ago[9610][ERD] drivers: mfd: created mfd driver for S2MPB02
Jieun Yi [Tue, 15 May 2018 02:20:39 +0000 (11:20 +0900)]
[9610][ERD] drivers: mfd: created mfd driver for S2MPB02

Change-Id: I718feaf8c5b5a41ee9e2cb3056ce394c9afd88f2
Signed-off-by: Jieun Yi <jieun.yi@samsung.com>
6 years agoandroid: ion: confirm to unmap invalid secure iova
hyesoo.yu [Fri, 20 Apr 2018 08:19:55 +0000 (17:19 +0900)]
android: ion: confirm to unmap invalid secure iova

Change-Id: Ifc926d9f85bed09c7c953fd4126f8a22e9c16e76
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years agoandroid: ion: fix missing dma address assignment
Cho KyongHo [Thu, 19 Apr 2018 04:36:02 +0000 (13:36 +0900)]
android: ion: fix missing dma address assignment

Change-Id: I1653dd69e383d559cf3c0f1cb323d3e5640782c8
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix incorrect protection by HPA heap
Cho KyongHo [Wed, 18 Apr 2018 13:46:45 +0000 (22:46 +0900)]
android: ion: fix incorrect protection by HPA heap

<3>[   14.274076]  [4:HwBinder:2696_2: 2720] ion_secure_iova_alloc: failed alloc secure iova. 1610612736/1610612736 bytes used
<3>[   14.274091]  [4:HwBinder:2696_2: 2720] ion_secure_protect: PROT:-2113920752 (err=0,va=0x0,len=0x80000000,cnt=65536,flg=2)

It is caused by incorrect protection information from HPA heap:
- buffer count <-> buffer length in bytes
- chunk size <-> buffer count

Change-Id: I42cb1b31535c698d5ec063d0229a213913d863b4
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix showing incorrect value type
Cho KyongHo [Wed, 18 Apr 2018 13:45:09 +0000 (22:45 +0900)]
android: ion: fix showing incorrect value type

Error message when buffer protection is failed is misleading.

Change-Id: I399ebf66afb86e393e65903a11353775d4a37312
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix success on protection failure
Cho KyongHo [Wed, 18 Apr 2018 13:36:11 +0000 (22:36 +0900)]
android: ion: fix success on protection failure

Change-Id: I26a3055cbd6b20bac7cee26992ce7d308993f614
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix build break with secure DRM on
Cho KyongHo [Wed, 18 Apr 2018 05:52:33 +0000 (14:52 +0900)]
android: ion: fix build break with secure DRM on

Change-Id: I56841d7748b8ae1d546425b0fcbf70b83d443fda
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: assign ion_device for oom notifier
Janghyuck Kim [Fri, 30 Mar 2018 03:32:39 +0000 (12:32 +0900)]
android: ion: assign ion_device for oom notifier

ion_device should be assigned before registering oom notifier.

Change-Id: I14b0af58533591f0d01037607ab2e9f047034c41
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agoarm64: erd9610_defconfig: enable HPA
hyesoo.yu [Fri, 11 May 2018 07:43:00 +0000 (16:43 +0900)]
arm64: erd9610_defconfig: enable HPA

Change-Id: I322854cd634e48be078a22f2f37ec7199ec5104a
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years agoandroid: ion: show the list of buffers for debug
Cho KyongHo [Thu, 22 Mar 2018 11:20:41 +0000 (20:20 +0900)]
android: ion: show the list of buffers for debug

debugfs/ion/buffers shows the list of buffers and the page pools of
ion_system_heap.
Also added an oom notifier to show the list of buffers when OOM Killer
is invoked. It is very useful to see if the OOM is caused by too many
ION buffers.

Change-Id: I1784014099844917ad15901909a9c2c87e23f32f
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add buffer protection to HPA heap
Cho KyongHo [Wed, 21 Mar 2018 13:38:58 +0000 (22:38 +0900)]
android: ion: add buffer protection to HPA heap

Change-Id: I922780c3378a0e9d6e152ba1a41cc7aaa5cae0f2
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add HPA heap
Cho KyongHo [Wed, 21 Mar 2018 12:37:11 +0000 (21:37 +0900)]
android: ion: add HPA heap

Introducing HPA heap backed by High-order Pages Allocator which
guarantees allocation of higher order pages than PAGE_SIZE.

Change-Id: I1ff9c5727509e9e8cdec00469c704d489614bdf2
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agomm/hpa: fix dependency to lowmemorykiller
Cho KyongHo [Mon, 19 Mar 2018 13:33:19 +0000 (22:33 +0900)]
mm/hpa: fix dependency to lowmemorykiller

lowmemorykiller is removed from the tree by the following commit:
915e70f ("staging, android: remove lowmemory killer from the tree")

Instead HPA killer borrows victim selection logic from oom_killer.
oom_killer selectes a victim task with the combination of the total
rss of the task and oom_adj_score. But HPA killer selects the task
with the largest rss among the tasks with the same oom_adj_score that
is also the largest to select a task with less panelty.

Change-Id: I0ef31e5c44faad9c6216dbdbd085082167b3f256
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm/hpa: remove test condition that always true
Cho KyongHo [Fri, 8 Sep 2017 02:42:00 +0000 (11:42 +0900)]
[COMMON] mm/hpa: remove test condition that always true

Coverity CID197219

Change-Id: I6afd75fdaf705dbfa4c905bb8e0c859bd77999de
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa: reclaim non-lru movable pages in HPA
Cho KyongHo [Fri, 12 May 2017 12:16:25 +0000 (21:16 +0900)]
[COMMON] mm: hpa: reclaim non-lru movable pages in HPA

The patch series of "Support non-lru page migration"
(https://lwn.net/Articles/689343/) introduced the way of migrating
movable pages which are not in LRU list by providing callback
functions called on migration. With that patch series, zsmalloc()
starts allocating pages from Movable zone even though it it is not LRU
pages. Therefore HPA should check if a page is non-lru movable.
Otherwise, HPA may suffer from lack of pages to migrate to other
zones.

Change-Id: Iaa35d16e6b5af21a1eb30c518e371e28995d0d8a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa: fix parameter that hides global identifier
Cho KyongHo [Fri, 12 May 2017 11:54:25 +0000 (20:54 +0900)]
[COMMON] mm: hpa: fix parameter that hides global identifier

The first parameter to is_movable_chunk() is start_pfn that is
declared as a global variable with the file scope. It is not harm
even though the parameter hids the global variable but it causes
the readers confusing so that it likely leads a mistake in the change
of some statements in the function.
Therefore the name of the first parameter to is_movable_chunk() is
changed and modified the logic of the body of is_movable_chunk() for
clear understanding.

Change-Id: I7b97aefb0b25dd09ca6c22fe0077b3d76b372210
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa: fix using invalid array index
Cho KyongHo [Wed, 19 Apr 2017 14:27:03 +0000 (23:27 +0900)]
[COMMON] mm: hpa: fix using invalid array index

Change-Id: I433e9f33ae3931319b52cb977bbf178a74287fe4
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa/cma: introduce alloc_contig_range_fast()
Cho KyongHo [Wed, 19 Apr 2017 14:57:19 +0000 (23:57 +0900)]
[COMMON] mm: hpa/cma: introduce alloc_contig_range_fast()

HPA allocates lots of order-4 pages from alloc_contig_range(). But it
consumes the most of time to flush per-cpu LRU and per-cpu free pages
that is not required for HPA.
alloc_contig_range_fast() does not flush the per-cpu pages. Therefore
it may fail to reclaim the given range of pages. The users that need
guarantee of success of reclamation of the given range of pages, they
can call alloc_contig_range() as they did. Its behavior is unchanged.

Change-Id: Ie9d545132c7450713ff7724099d24a2ffd766cb1
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa: avoid selecting a victim that was a victim
Cho KyongHo [Fri, 3 Feb 2017 12:35:39 +0000 (21:35 +0900)]
[COMMON] mm: hpa: avoid selecting a victim that was a victim

Totally the same logic with the following patch:
0f7b387 [COMMON] lowmemorykiller: when killing timeout, choose other process

HPA eventually invokes its internal task killer, HPA Killer that
selects a victim task with the highest oom_adj and the largest rss. It
signals SIGKILL the victim task and expects the victim task to be soon
died.
HPA Killer skips selecting another task on the next invocation until
the victim task is finally died during a second unless it finds
another victim task that is more proper to kill. If the task is not
died in a second, HPA killer is to select the same task as a victim
because of the victim selection logic.
If the victim task is in disk sleep state and it waits for a resource
that is occupied by the task that invoking HPA Killer, HPA Killer will
be never finished until another larger task with higher oom_adj is
appeared.
To end ths dead-lock condition, HPA Killer should select next proper
victim task even though the current victim task is not died.

Change-Id: I73afdce457976c9a8f60e92d8d96e792ea854c7c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa: prevent allocating cma pages from HPA
Cho KyongHo [Thu, 2 Feb 2017 15:07:24 +0000 (00:07 +0900)]
[COMMON] mm: hpa: prevent allocating cma pages from HPA

HPA turns movable pages into the unmovable for playing DRM contents.
But CMA pages should be always ready for reclamation. Therefore, they
should not be unmovable at all time.

Change-Id: I4dbdd7bc065c1c40f7c6bd80fa55c49a46711482
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] mm: hpa: initialize local variable
Sunyoung Kang [Fri, 2 Sep 2016 02:47:26 +0000 (11:47 +0900)]
[COMMON] mm: hpa: initialize local variable

Fix Svace: 64228

Change-Id: Ic29475767bd4cbd8043677abf435c4ab478dd2b7
Signed-off-by: Sunyoung Kang <sy0816.kang@samsung.com>
6 years ago[COMMON] mm: introduce High-order Pages Allocator
Sunyoung Kang [Mon, 4 Jul 2016 06:50:57 +0000 (15:50 +0900)]
[COMMON] mm: introduce High-order Pages Allocator

The high-order pages allocator (aka. HPA) has been introduced to ensure
successful allocation of high-order pages always with given order and size.
The HPA tries to allocate pages from buddy and then if any pages are in use,
tries to reclaim and migrate pages.

Change-Id: I61a7fe76d4a1c6a1058d2fe731bbfef8d3e6959a
Signed-off-by: Jinsung Yang <jsgood.yang@samsung.com>
Signed-off-by: Sunyoung Kang <sy0816.kang@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix missing debug info of cma heap
Cho KyongHo [Tue, 6 Mar 2018 12:19:30 +0000 (21:19 +0900)]
android: ion: fix missing debug info of cma heap

cma heaps shows the list of allocated buffers from their heap. But
cma heaps do not show the list when cma fails to allocate, actually.

Change-Id: I4b2264bd213d77d7c4276a45b560e6611b4c3b93
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add dmabuf cpu access ops for exynos
Cho KyongHo [Fri, 2 Mar 2018 14:03:48 +0000 (23:03 +0900)]
android: ion: add dmabuf cpu access ops for exynos

.begin_cpu_access and .end_cpu_access of dmabuf ops provided by ION
needs scatter-gather list because they rely on dma-mapping api.

After 'commit 8dbbf7b ("android: ion: do not map in dma_map_attach()
for Exynos")', ion_dma_buf_begin_cpu_access() and
ion_dma_buf_end_cpu_access() loose scatter-gather list stored in
the dma-buf attachment that is eliminated by the above commit.

Instead, dma-mapping api can be used with ion_buffer.sg_table and the
miscdevice of ion_device because they are initialized at buffer
allocation and ION initialization, respectively since 'commit 10a41c2
("android: ion: add fixups to ion exynos extension")'.

Uncached buffers are not required to maintain CPU caches for CPU
accesses because dma_buf_kmap() returns the kernel address with the
cacheability attribute of the buffer.

Change-Id: I6656f22b696ae96de9f2766751970b25f17572f6
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix compile error
Janghyuck Kim [Tue, 6 Mar 2018 02:03:28 +0000 (11:03 +0900)]
android: ion: fix compile error

This patch fixed below compile error when CONFIG_ION_EXYNOS is not
defined.

In file included from drivers/staging/android/ion/ion.c:42:0:
drivers/staging/android/ion/ion_exynos.h:102:25: error:
'ion_exynos_map_dma_buf' defined but not used [-Werror=unused-function]
 static struct sg_table *ion_exynos_map_dma_buf(struct
dma_buf_attachment *att,

Change-Id: I22b9d0e87856bff9a9e307e49698fa9fa3677a3b
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agoandroid: ion: add checking of returned page
Janghyuck Kim [Wed, 28 Feb 2018 08:11:52 +0000 (17:11 +0900)]
android: ion: add checking of returned page

This patch added checking code to avoid invalid address access for cache
operation.
ion_page_pool_alloc_pages() might return NULL when alloc_pages() could
not get enough pages as requested order, especially in high-order case.

Change-Id: I7aa2bb08f32f523f5b76930b46c0f47d3457895b
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agoandroid: ion: free iova at buffer destruction time
Janghyuck Kim [Tue, 27 Feb 2018 09:24:10 +0000 (18:24 +0900)]
android: ion: free iova at buffer destruction time

In order to optimize the performance of ion_iovmm_unmap(), the actual
unmapping of the device virtual address is deferred. It is expected to
work at buffer destruction time, but this is missing. So unmapping code
is added to work properly.

Change-Id: Ie2dffa58df5125baf4a4e9723db241846e860443
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agoarm64: dts: add reserve mem for exynos9610 of 4.14
hyesoo.yu [Fri, 11 May 2018 07:06:00 +0000 (16:06 +0900)]
arm64: dts: add reserve mem for exynos9610 of 4.14

Change-Id: I4d304c4c8010febf5ffa25f660215a6020e0616e
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years agoarm64: erd9610_defconfig: enable the new ION
hyesoo.yu [Fri, 11 May 2018 06:54:56 +0000 (15:54 +0900)]
arm64: erd9610_defconfig: enable the new ION

Change-Id: I51e5aa321ffea0ad8147a5f3c3e4fc47eade0380
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years agoandroid: ion: add show all buffers of contig heaps
Cho KyongHo [Wed, 21 Feb 2018 09:28:52 +0000 (18:28 +0900)]
android: ion: add show all buffers of contig heaps

ION heaps of physically contiguous memory pool is vulnerable to memory
external fragmentations. If an allocation from such heaps has failed,
ION just returns 'out of memory' error. But users need to know if the
error is caused by insufficient free space or fragmentations. Their
actions to the error should be different according to the reason.
Therefore ION ought to tell the users the list of allocated buffers
from the physically contiguous heaps.

Change-Id: I0ea0dd81cfac8f8b019a763480f5c7af22b8eac0
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add kernel log on errors
Cho KyongHo [Thu, 22 Feb 2018 11:55:24 +0000 (20:55 +0900)]
android: ion: add kernel log on errors

It is very important to know the reason of an exception. It is too
difficult to know the details about the exception with an error
number returned by ION.

Change-Id: I51f92bb1cc1c1eee2e0a1a17803d4f5bb0720433
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: do not map in dma_map_attach() for Exynos
Cho KyongHo [Thu, 22 Feb 2018 06:40:48 +0000 (15:40 +0900)]
android: ion: do not map in dma_map_attach() for Exynos

dma_buf ops of ION does two unneccessary works. One is duplicating
sg_table in dma_map_attach() and the other is dma_map_sg() call in
dma_buf_map_attachment(). The duplication of sg_table is neccessary
in fact because dma_map_sg() updates dma_address fields of scatter-
gather list in sg_table with the DMA address of the given device.
It is true with the devices with IOMMU that provides dma-mapping ops.
But our IOMMU, System MMU driver does not provide dma-mapping ops.
Therefor, DMA addresses of the same physical memory location are not
different between devices in Exynos SoCs.

ion_buffer_create() calls dma_map_sg() to initialize dma_address
fields sg_table from the following commit:
'commit 8215d29 ("android: ion: add fixups to ion exynos extension")'

Now we can use the sg_table in ion_buffer for all devices. We can
avoid duplicating sg_table on every dma_buf_attach() call. We can
replace dma_map_sg() with dma_sync_sg_for_device() in
dma_buf_map_attachment().
ion_dma_buf_attach() and ion_dma_buf_detach() are no more required.
it does nothing after sg_table duplication is removed.

For the maintenance reason, we do not remove the unused dma_buf ops
of ION in ion.c. Instead we adds our implementation of map_dma_buf()
and unmap_dma_buf() ops to dma_buf ops of ION if CONFIG_ION_EXYNOS
is configured.

Change-Id: I1764a7eb62e948f074b596e316fe3f48ed3f8662
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add fixups to ion exynos extension
Cho KyongHo [Wed, 21 Feb 2018 12:42:47 +0000 (21:42 +0900)]
android: ion: add fixups to ion exynos extension

The purpose of the exynos extension is to attach addtional
improvements to ION. The first improvment is the elimination of
dma-mapping overhead.
dma_map_sg() and dma_unmap_sg() maps the given memory to the address
space of the given device. The mapping can be translation table update
if the device has iommu. It may allocate swiotlb buffer if the device
does not have iommu and the address space of the device is smaller
than the physical address space. dma_map_sg() and dma_unmap_sg() also
maintain CPU caches to ensure memory coherency.
The purpose of calls to dma_map_sg() and dma_unmap_sg() in
ion_map_dma_buf() and ion_unmap_dma_buf(), respectively is just
ensuring cache coherency in Exynos SoCs. We have another approach to
map the physical memory to the device address space, ion_iovmm_map().
But replacing dma_map_sg() with dma_sync_sg_for_device() does not work
because dma_sync_sg_for_device() needs dma_address fields to be
initialized by dma_map_sg().
This is the first step to replacing dma_map_sg() with
dma_sync_sg_for_device() in ion_map_dma_buf().
Buffer allocation now involves dma_map_sg() to assign dma_address
fields of ion_buffer.sg_table. dma_unmap_sg() is called by
ion_buffer_destroy().
Then we can finally use dma_sync_sg_for_device() in ion_map_dma_buf().

Change-Id: I8b439eddc0b3722a297ea395aa7e6f3ebc00b294
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: do not cache flush for uncached buffers
Cho KyongHo [Thu, 22 Feb 2018 06:52:48 +0000 (15:52 +0900)]
android: ion: do not cache flush for uncached buffers

Uncached buffers are touched by CPU with uncached addresses. Cache
maintenance on the uncached buffers is just redundant, no effect.

Change-Id: I04283f55760845834c1d12102669caa6ccc4f45a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: remove redundant statements
Cho KyongHo [Wed, 21 Feb 2018 12:55:22 +0000 (21:55 +0900)]
android: ion: remove redundant statements

Change-Id: Ibaef184155aaef44c6d471e3a1d567c21d3f9115
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add ION_FLAG_MAY_HWRENDER
Cho KyongHo [Mon, 12 Feb 2018 05:48:49 +0000 (14:48 +0900)]
android: ion: add ION_FLAG_MAY_HWRENDER

Clients of ION in userland can specify if the allocated buffer is
written by H/W like GPU before S/W initializes it. If the cache
maintenance is fully supported by all H/Ws that touch the buffer or
all H/Ws touching the buffer are in the same cache coherency domain,
everything goes right. But the problem occurs due to the drivers that
does not perform cache maintenance due to the performance reason.
For the the different H/Ws that touch the same buffer in the different
cache coherency domain, the drivers should care when creating IO
memory mapping. ION_FLAG_MAY_HWRENDER and ion_hwrender_dmabuf() helper
give information to such drivers if the buffer is initialized by H/W.
ION_FLAG_MAY_HWRENDER effects nonthing in ION. Just documentation
purpose.

Change-Id: Iab6293f2c5d6017cf67378356721de4256f049b9
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add ion_cached_dmabuf()
Cho KyongHo [Mon, 12 Feb 2018 05:35:24 +0000 (14:35 +0900)]
android: ion: add ion_cached_dmabuf()

Some kernel clients of ION need to know if an ION buffer is cached.

Change-Id: I8a179e2ba4476408732e2d32441268883c9dc2c6
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add ion_iovmm_[un]map()
Cho KyongHo [Mon, 12 Feb 2018 02:19:32 +0000 (11:19 +0900)]
android: ion: add ion_iovmm_[un]map()

iovmm_map() provided by exynos-iovmm is time-consuming. If the same
buffer is iovm mapped to a device, iovmm_map() does the same thing
with much time. iovmm_map() is not able to avoid this repeat because
it has no information to identify a buffer. Thus, ION provides the
avoidance of repeating mapping the same buffer.

Change-Id: I4c62f615dca6dfb5f8d2fe366ccc0a89af1d485e
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: make dma_buf_ops of ION global
Cho KyongHo [Mon, 12 Feb 2018 01:34:16 +0000 (10:34 +0900)]
android: ion: make dma_buf_ops of ION global

It is the only way to verify if the given dma-buf is exported by ION.

Change-Id: I7925e9f88e34f6ecd123a4178531fd237b807ffa
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: remove the list of attachments
Cho KyongHo [Mon, 12 Feb 2018 00:45:03 +0000 (09:45 +0900)]
android: ion: remove the list of attachments

dma_buf also has the list of attachments. ion_buffer.attachments is
redundant. So, let's remove it.
dma_buf.attachment should be accessed with dma_buf.lock held. Holding
dma_buf.lock in begin_cpu_access() and end_cpu_access() is okay. But
it should be handled with care to prevent possible deadlock.

Change-Id: I6a4a5c74c1030874fc08684c6c84485373b47919
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add ion_alloc_dmabuf()
Cho KyongHo [Sun, 11 Feb 2018 11:37:11 +0000 (20:37 +0900)]
android: ion: add ion_alloc_dmabuf()

ION does not provide API to the kernel drivers.
Thus, ion_alloc_dmabuf() is introduced. To allocate a buffer from a
specific heap of ION, the client should query heaps to search proper
heap then allocate buffers with heap mask of the found heap. This
is tedious and error-prone task for drivers.
Let's allow drivers select a heap with heap name. The Exynos extension
to ION will find the heap with the given name and select the heap for
buffer allocation.
ion_alloc_dmabuf() returns dma_buf instead of fd. To deliver the
allocated dma_buf from ion_alloc_dmabuf() to the userspace, the client
driver should assign it to an unused fd by itself.

Change-Id: Iedc0f970fcc2ddcf4739a5d8c3ecec3cd137e280
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add properties to ion_heap_data
Cho KyongHo [Sun, 11 Feb 2018 08:34:49 +0000 (17:34 +0900)]
android: ion: add properties to ion_heap_data

ion_heap_data is lack of heap properties that is critical to users.
Users may want to know the total size of the cma/carved out memory
pools served by cma heap and carveout heap, respectively. They also
need to know if a heap provides buffer protection for DRM video
streams or allocated buffer from a heap can be accessed.

Change-Id: I3c3a6b9a41d32398ddfe1b1c21b3977e790e5c25
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add buffer protection
Cho KyongHo [Sun, 11 Feb 2018 08:08:35 +0000 (17:08 +0900)]
android: ion: add buffer protection

DRM video contents need protection of the decrypted video stream from
copying to insecure buffer. For the protection from copying, Exynos
SoC provides H/W based protection. Since H/W has limitation of
resources, the H/W needs the types of buffer protection, some special
limitation to alignments and limits to the memory pool to serve buffer
protection.
Every memory pool needs buffer protection should be specified in the
flattened device tree under 'reserved-memory' node like cma heaps and
carveout heaps. The heaps needs protection should have 'ion,secure'
boolean property that specifies buffers from the heap may needs buffer
protection. They also need 'ion,protection_id' which specifies the
types of buffer protection.
Buffers from the secure heaps are not protected unless users gives ION
ION_FLAG_PROTECTED flag. non-secure heaps just ignore the flag.

Change-Id: Ibef18c3fde7d628c2298abb95e71379c67cf7471
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add nozero and sync_force flags
Cho KyongHo [Fri, 9 Feb 2018 07:18:43 +0000 (16:18 +0900)]
android: ion: add nozero and sync_force flags

Allocation with ION_FLAG_NOZERED returns buffers without clearing data
written by previous users. ION should not allow userspace accessing
the buffer due to the security reason.
ION_FLAG_SYNC_FORCE is also introduced for some users that want to
decide the point of cache maintenance by itself. With the flag, ION
performs cache flush to the allocated even for cached buffers. those
users want this redundant cache flush to prevent buffer corruption by
victim dirty cache lines about the buffer after DMA write without
proper cache maintenance.

Change-Id: Ib3c4f9c93a6cd0240ae12b8c061142355e2b1605
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: initialize cma heap from device tree
Cho KyongHo [Thu, 8 Feb 2018 08:05:11 +0000 (17:05 +0900)]
android: ion: initialize cma heap from device tree

ION creates cma heaps for all cma region but a lot of cma regions are
not needed to be serviced by ION. If cma heap is required, some users
of ION needs physically contiguous memory for graphics and multimedia.
Exynos SoCs traditionally defines such cma regions in the flattened
device tree node under 'reserved-memory' node.
Since the cma regions may have additional properties which are not
identified by of_reserved_mem.c, the cma region definitions should be
handled by ION.

Change-Id: Ia23fd12f9422f1d9e3a86e5b1d403caa12a29867
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add fdt handling for carveout_heap
Cho KyongHo [Wed, 7 Feb 2018 11:36:08 +0000 (20:36 +0900)]
android: ion: add fdt handling for carveout_heap

Carveout heap provides buffer management for a reserved pool of
physical memory which is carved out by an early allocator like
memblock. Current ION is lack of how to initialize carveout heap.
We have decided to define the reserved memory pool in
"reserved-memory" device tree node with "exynos9820-ion" compatible
string.
The node may have the following properties in addition to the properties
of the child nodes of "reserved-memory" node:
- ion,untouchable: the buffer from the heap should not creates a
              mapping in the kernel and userland.
- ion,heapname: The name of the heap.
- ion,alignment: The alignment of buffers from the heap.

Change-Id: I41cdc72078a88795c8d6aca6af2c40e910330894
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: add properties to carveout_heap
Cho KyongHo [Wed, 7 Feb 2018 08:01:10 +0000 (17:01 +0900)]
android: ion: add properties to carveout_heap

Added size, alloc_align, and untouchable properties to carveout heaps.
size property is used for debugging purpose. carvedout heaps are
suffering from the external fragmentations and out of memory when
users do not carefully handle the heaps. When allocation from a carved
out heap happens, the base and the size of the heap is very useful for
debugging.

Some heaps should have restriction of alignment of allocated buffers
to be larger than PAGE_SIZE. alloc_align property specifies this
restriction.

Some special heap has strange property, untouchable. If it is
specified, buffers from the heap should not be accessed from both of
userland and the kernel.

Change-Id: Ib4fd2a4af2e6307bf67aa28d06bbcbca393d4475
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: give name to carveout_heap
Cho KyongHo [Wed, 7 Feb 2018 07:38:09 +0000 (16:38 +0900)]
android: ion: give name to carveout_heap

Heap name is required by ion_query_heaps() because we cannot identify
a specific heap without name.

Change-Id: I39d886255c8381d11f067ec6f19a105e7269010c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agoandroid: ion: fix missing error number in cma heap
Cho KyongHo [Thu, 22 Feb 2018 12:05:28 +0000 (21:05 +0900)]
android: ion: fix missing error number in cma heap

Change-Id: Ib08aa1eefbeb954327ce8052471c621fb1a91063
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>