platform/kernel/linux-rpi.git
3 years agoARM64: tizen_bcm2711_defconfig: Enable USB_PRINTER config 09/255809/1 old/tizen_20210330 accepted/tizen/unified/20210330.084808 submit/tizen/20210329.080334
Chanwoo Choi [Wed, 24 Mar 2021 03:45:52 +0000 (12:45 +0900)]
ARM64: tizen_bcm2711_defconfig: Enable USB_PRINTER config

Enable USB_PRINTER config to suppot USB printer device.

Change-Id: I2068a283928c8f3c85d5f31b25a13300cdc52783
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoARM: tizen_bcm2711_defconfig: Enable USB_PRINTER config 08/255808/1
Chanwoo Choi [Wed, 24 Mar 2021 03:44:24 +0000 (12:44 +0900)]
ARM: tizen_bcm2711_defconfig: Enable USB_PRINTER config

Enable USB_PRINTER config to suppot USB printer device.

Change-Id: Ic63797d93520e4bc50175c53c7e7328b55a0f724
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoARM64: tizen_bcm2711_defconfig: Enable CONFIG_CFG80211_CRDA_SUPPORT 69/255669/1
Jaehoon Chung [Mon, 22 Mar 2021 08:06:33 +0000 (17:06 +0900)]
ARM64: tizen_bcm2711_defconfig: Enable CONFIG_CFG80211_CRDA_SUPPORT

Enable CONFIG_CFG80211_CRDA_SUPPORT.

Change-Id: If60cab97a05ca8bc01633255ede56279fcc599a8
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoRevert "ARM: configs: tizen_bcm2711_defconfig: Disable CONFIG_CFG80211_CRDA_SUPPORT" 68/255668/1
Jaehoon Chung [Mon, 22 Mar 2021 07:56:08 +0000 (16:56 +0900)]
Revert "ARM: configs: tizen_bcm2711_defconfig: Disable CONFIG_CFG80211_CRDA_SUPPORT"

This reverts commit 6485924bd76b70c8ed6ba334ef9b5045f4a3686d.
- Enable CONFIG_CFG80211_CRDA_SUPPORT to use country code.

Change-Id: I951b32c86611b6240991e9bb8b362c98bb56b72c
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agomedia: uvcvideo: Add a probe quirk to Jieli Technology USB PHY 2.0 (1224:2a25) 72/254272/1 accepted/tizen/unified/20210303.130703 submit/tizen/20210303.050006
Seung-Woo Kim [Thu, 25 Feb 2021 08:17:12 +0000 (17:17 +0900)]
media: uvcvideo: Add a probe quirk to Jieli Technology USB PHY 2.0 (1224:2a25)

Repeated video request on Jieli Technology USB PHY 2.0 (1224:2a25)
device causes data stall with below error until reconnection:
  uvcvideo: Failed to set UVC probe control : -32 (exp. 26).

To resolve the wrong state, add PROBE quirk bits.

Change-Id: I5efba6ac26d5eea70e2227f9ff9801dd5d8d4790
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoARM/ARM64: defconfig: disable SECURITY_SMACK_NETFILTER config 09/253709/1 accepted/tizen/unified/20210217.120458 submit/tizen/20210217.042922
Jaehoon Chung [Wed, 17 Feb 2021 01:02:48 +0000 (10:02 +0900)]
ARM/ARM64: defconfig: disable SECURITY_SMACK_NETFILTER config

Disable SECURITY_SMACK_NETFILTER configuration.

Change-Id: Id95847392ac2bf53b92dae5ee2c0d4b5c1e41ece
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoARM: tizen_bcm2711_defconfig: Enable OVERLAY_FS 78/252178/1 accepted/tizen/unified/20210126.141628 submit/tizen/20210125.080748
Seung-Woo Kim [Mon, 25 Jan 2021 07:24:54 +0000 (16:24 +0900)]
ARM: tizen_bcm2711_defconfig: Enable OVERLAY_FS

Enable CONFIG_OVERLAY_FS for tizen application space.

Change-Id: I46b011effa26e1f7ef9acf5f18d52bc7b54452c5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoARM64: tizen_bcm2711_defconfig: Enable OVERLAY_FS 77/252177/1
Seung-Woo Kim [Mon, 25 Jan 2021 07:24:03 +0000 (16:24 +0900)]
ARM64: tizen_bcm2711_defconfig: Enable OVERLAY_FS

Enable CONFIG_OVERLAY_FS for tizen application space.

Change-Id: I1b2aafaeea24b6ef6b07d3c57d542dce13c53b8f
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agousb: gadget: f_fs: Fix use-after-free for unbind with remaining io 37/252037/1 accepted/tizen/unified/20210122.123002 submit/tizen/20210122.073514
Dongwoo Lee [Fri, 22 Jan 2021 03:40:18 +0000 (12:40 +0900)]
usb: gadget: f_fs: Fix use-after-free for unbind with remaining io

If usb has stall, then there can be remaining submitted io and
unbinding f_fs with the remaining io, there is use-after-free.
Fix the use-after-free by checking endpoint after wait.

This fixes following kasan warning:
   BUG: KASAN: use-after-free in ffs_epfile_io+0x654/0xb58
   Read of size 4 at addr ffffffc0a44e65dc by task mtp-responder/5117
   ...
   [<ffffff900a037794>] ffs_epfile_io+0x654/0xb58
   [<ffffff900a03818c>] ffs_epfile_read_iter+0x1ac/0x3e0
   ...

   Allocated by task 3869:
   ...
    __kmalloc+0x234/0x760
    _ffs_func_bind+0x264/0x7c8
    ffs_func_bind+0xe8/0x650
    usb_add_function+0x13c/0x378
   ...
   Freed by task 3869:
   ...
    kfree+0xa4/0x750
    ffs_func_unbind+0x150/0x248
    purge_configs_funcs+0x1a0/0x310
   ...

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[dwoo08.lee: cherry-picked from linux-amlogic commit 5dd3ffecd46f to prevent use-after-free when f_fs is unbound before all requests are over]
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Change-Id: Idf2391c53ca0f90fc9484d725304b88fc57fa8a6

3 years agokdbus: build and package kdbus-tests 13/251413/5 accepted/tizen/unified/20210119.130216 submit/tizen/20210119.051826
Łukasz Stelmach [Tue, 22 Dec 2020 11:56:00 +0000 (12:56 +0100)]
kdbus: build and package kdbus-tests

Change-Id: Ie5a32cb744a28b242aac1f43e879306a43795bb5
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agokdbus: test suite changed to common format 12/251412/5
Konrad Lipinski [Wed, 11 Sep 2019 13:42:10 +0000 (15:42 +0200)]
kdbus: test suite changed to common format

This commit adapts the kdbus test suite to use with
dbus-integration-tests.

Change-Id: Ifee21253f4e3c732b27517a0c566d4b9a569d5af
Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agoARM/ARM64: tizen_bcm2711_defconfig: Enable KDBUS 76/251476/3
Łukasz Stelmach [Thu, 14 Jan 2021 06:02:02 +0000 (15:02 +0900)]
ARM/ARM64: tizen_bcm2711_defconfig: Enable KDBUS

Change-Id: I3f40022fa9bbb04a0cbcca1fde45a569ca2c4538
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agokdbus: porting to to 5.4 11/251411/4
Łukasz Stelmach [Mon, 21 Dec 2020 15:34:08 +0000 (16:34 +0100)]
kdbus: porting to to 5.4

The following changes were made to adapt kdbus driver to 5.4 kernel

- use KERNEL_DS instead of get_ds()
- remove ITER_KVEC flag
- remove 'type' argument from access_ok()
- use memfd_fcntl() instead of shmem_get_seals()
- use uapi/linux/mount.h

Fixes: 736706bee329 ("get rid of legacy 'get_ds()' function")
Fixes: aa563d7bca6e ("iov_iter: Separate type from direction and use accessor functions")
Fixes: 96d4f267e40f ("Remove 'type' argument from access_ok() function")
Fixes: 5aadc431a593 ("shmem: rename functions that are memfd-related")
Fixes: 5d752600a8c3 ("mm: restructure memfd code")
Fixes: e262e32d6bde ("vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
Change-Id: I8d2b3db1c83bb21114554ba9eb38e5e439f5c141
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agokdbus: Revert "fs: unexport poll_schedule_timeout" 10/251410/4
Łukasz Stelmach [Mon, 21 Dec 2020 11:40:27 +0000 (12:40 +0100)]
kdbus: Revert "fs: unexport poll_schedule_timeout"

This reverts commit 8f546ae1fc5ce8396827d4868c7eee1f1cc6947a.

Change-Id: I5429471eeb092c55a50e37c0b642d50d69daebc7
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agokdbus: porting to 4.14 09/251409/4
Adrian Szyndela [Wed, 11 Sep 2019 13:34:33 +0000 (15:34 +0200)]
kdbus: porting to 4.14

This commit makes kdbus driver working with kernel 4.14.
It also enabled compilation of the driver if enabled in config.

The list of changes needed to make it compile with kernel 4.14:
- Add missing includes for <linux/cred.h>
- put inode_lock()/inode_unlock() in place of explicit mutex locking
- replace CURRENT_TIME with proper call to current_time()
- replace PAGE_CACHE_* with PAGE_*
- replace GFP_TEMPORARY with GFP_KERNEL
- use kvecs for kernel memory, iovec for user memory instead of only iovec
  for both
- fix usage of task_cgroup_path()
- replace GROUP_AT usage with 'gid' field dereference
- add 0 as an argument to init_name_hash
- add 0 as flags as an argument to vfs_iter_write
- replace __vfs_read with kernel_read to allow compilation into module

Change-Id: I3dd066ab531d0d3f7082556e4d38381961998015
Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agokdbus: the driver, original and non-working 08/251408/4
Adrian Szyndela [Fri, 9 Sep 2016 11:35:49 +0000 (13:35 +0200)]
kdbus: the driver, original and non-working

[based on commit 216823ac83c0ab89348e2ed6f66179f53626586e]

Introduce the kdbus driver again. This driver worked previously
on kernel 4.1. This is the source code taken from the working driver.
It is non-working and disabled. It is a base for porting.

The documentation is moved from Documentation to ipc/kdbus/Documentation.

The references to kdbus source code are commented out or removed in Makefiles.

Original authors of the files are those from commit 216823ac83c0ab8934.

Cherry-picked from 4.14 commit 970070c4f68f113284f86cf7b6fbd23d6b35b511.

Change-Id: Id60af5faf794fc4ae7122976621076f1021f6c38
Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agospec: set CONFIG_LOCALVERSION 07/251407/4
Łukasz Stelmach [Mon, 4 Jan 2021 19:23:41 +0000 (20:23 +0100)]
spec: set CONFIG_LOCALVERSION

Set CONFIG_LOCALVERSION insetad of EXTRAVERSION in Makefile to carry
information about the platform variant.

Change-Id: If1650692162832ea86988e4adb610ce0148edde3
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agospec: support gbs(1) incremental builds 06/251406/4
Łukasz Stelmach [Mon, 4 Jan 2021 13:41:58 +0000 (14:41 +0100)]
spec: support gbs(1) incremental builds

gbs(1) enable incremental builds that are significantly faster, hoewever,
spec files need some adjustments.

+ You can't use -n <name> with %setup
+ There is no point in making mrproper
+ use rsync(1) instead of cp(1)+find(1) to copy devel files

Other changes are:
+ use make headers_install to install headers in the buildroot
+ add _smp_mflags to make(1) things faster

Change-Id: Ia14fbe7acab8b83683f9e07757b4f62a7657b2a5
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agoscript: adjust ccache support 05/251405/2
Łukasz Stelmach [Mon, 21 Dec 2020 12:46:37 +0000 (13:46 +0100)]
script: adjust ccache support

Change-Id: I735295fc21cf7caa29b84548a8f21449ed97800e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agoscript: increase the number of concurrent compilers 04/251404/1
Łukasz Stelmach [Wed, 13 Jan 2021 10:24:40 +0000 (11:24 +0100)]
script: increase the number of concurrent compilers

It is safe to run as many compilation processes as twice the number of
CPUs. This is the default settings of RPM building process in Tizen.

Change-Id: Id68d9d31bc54da11c8732689645408241a517887
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agoscript: use $NCPUS for arm64 builds too 03/251403/1
Łukasz Stelmach [Wed, 13 Jan 2021 10:12:04 +0000 (11:12 +0100)]
script: use $NCPUS for arm64 builds too

Fixes: b371be68152e ("script: Fix to use NCPUS dynamically")
Change-Id: I32b5c08f4b00ca24032a2f9355d308f3df825fbd
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 years agoARM: mm: Free memblock from free_initrd_mem() 95/251095/1 accepted/tizen/unified/20210111.125453 submit/tizen/20210111.031323
Seung-Woo Kim [Thu, 7 Jan 2021 09:09:20 +0000 (18:09 +0900)]
ARM: mm: Free memblock from free_initrd_mem()

Even after free_initrd_mem(), memblock for initrd remains. Free
memblock for initrd from free_initrd_mem().

Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[sw0312.kim: port mainline posted patch to 5.4.y]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I42a7461558868cdfdc559959112c81bc4c8b10c5

3 years agoARM: dts: bcm2711-rpi-4-b: Adjust CMA size due to the OOM issue 27/251027/2 accepted/tizen/unified/20210107.123346 submit/tizen/20210107.044235
Sung-hun Kim [Thu, 7 Jan 2021 04:01:01 +0000 (13:01 +0900)]
ARM: dts: bcm2711-rpi-4-b: Adjust CMA size due to the OOM issue

Since 32-bit kernel has a limitation in the lowmem size, big CMA size
severely affect on available memory for kernel. Because of that, some test
cases make OOM kills due to the exhaustion in kernel available memory that
was reported by Jaehoon Chung (jh80.chung@samsung.com).

To handle this, I adjusted CMA size to 400MB while it meets the requirement
for UHD resolution.

Change-Id: I189699d4ce5f2866c01edf68c8138e9278679188
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
3 years agomm, page_alloc: fix core hung in free_pcppages_bulk() 24/250724/1
Charan Teja Reddy [Fri, 21 Aug 2020 00:42:27 +0000 (17:42 -0700)]
mm, page_alloc: fix core hung in free_pcppages_bulk()

commit 88e8ac11d2ea3acc003cf01bb5a38c8aa76c3cfd upstream.

The following race is observed with the repeated online, offline and a
delay between two successive online of memory blocks of movable zone.

P1 P2

Online the first memory block in
the movable zone. The pcp struct
values are initialized to default
values,i.e., pcp->high = 0 &
pcp->batch = 1.

Allocate the pages from the
movable zone.

Try to Online the second memory
block in the movable zone thus it
entered the online_pages() but yet
to call zone_pcp_update().
This process is entered into
the exit path thus it tries
to release the order-0 pages
to pcp lists through
free_unref_page_commit().
As pcp->high = 0, pcp->count = 1
proceed to call the function
free_pcppages_bulk().
Update the pcp values thus the
new pcp values are like, say,
pcp->high = 378, pcp->batch = 63.
Read the pcp's batch value using
READ_ONCE() and pass the same to
free_pcppages_bulk(), pcp values
passed here are, batch = 63,
count = 1.

Since num of pages in the pcp
lists are less than ->batch,
then it will stuck in
while(list_empty(list)) loop
with interrupts disabled thus
a core hung.

Avoid this by ensuring free_pcppages_bulk() is called with proper count of
pcp list pages.

The mentioned race is some what easily reproducible without [1] because
pcp's are not updated for the first memory block online and thus there is
a enough race window for P2 between alloc+free and pcp struct values
update through onlining of second memory block.

With [1], the race still exists but it is very narrow as we update the pcp
struct values for the first memory block online itself.

This is not limited to the movable zone, it could also happen in cases
with the normal zone (e.g., hotplug to a node that only has DMA memory, or
no other memory yet).

[1]: https://patchwork.kernel.org/patch/11696389/

Fixes: 5f8dcc21211a ("page-allocator: split per-cpu list into one-list-per-migrate-type")
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Vinayak Menon <vinmenon@codeaurora.org>
Cc: <stable@vger.kernel.org> [2.6+]
Link: http://lkml.kernel.org/r/1597150703-19003-1-git-send-email-charante@codeaurora.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick linux-5.4.y commit 0cfb9320d00c to resolved too larget cma issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I55f884f9950a35c8d75affebe426d176cd91702b

3 years agomm: include CMA pages in lowmem_reserve at boot 23/250723/1
Doug Berger [Fri, 21 Aug 2020 00:42:24 +0000 (17:42 -0700)]
mm: include CMA pages in lowmem_reserve at boot

commit e08d3fdfe2dafa0331843f70ce1ff6c1c4900bf4 upstream.

The lowmem_reserve arrays provide a means of applying pressure against
allocations from lower zones that were targeted at higher zones.  Its
values are a function of the number of pages managed by higher zones and
are assigned by a call to the setup_per_zone_lowmem_reserve() function.

The function is initially called at boot time by the function
init_per_zone_wmark_min() and may be called later by accesses of the
/proc/sys/vm/lowmem_reserve_ratio sysctl file.

The function init_per_zone_wmark_min() was moved up from a module_init to
a core_initcall to resolve a sequencing issue with khugepaged.
Unfortunately this created a sequencing issue with CMA page accounting.

The CMA pages are added to the managed page count of a zone when
cma_init_reserved_areas() is called at boot also as a core_initcall.  This
makes it uncertain whether the CMA pages will be added to the managed page
counts of their zones before or after the call to
init_per_zone_wmark_min() as it becomes dependent on link order.  With the
current link order the pages are added to the managed count after the
lowmem_reserve arrays are initialized at boot.

This means the lowmem_reserve values at boot may be lower than the values
used later if /proc/sys/vm/lowmem_reserve_ratio is accessed even if the
ratio values are unchanged.

In many cases the difference is not significant, but for example
an ARM platform with 1GB of memory and the following memory layout

  cma: Reserved 256 MiB at 0x0000000030000000
  Zone ranges:
    DMA      [mem 0x0000000000000000-0x000000002fffffff]
    Normal   empty
    HighMem  [mem 0x0000000030000000-0x000000003fffffff]

would result in 0 lowmem_reserve for the DMA zone.  This would allow
userspace to deplete the DMA zone easily.

Funnily enough

  $ cat /proc/sys/vm/lowmem_reserve_ratio

would fix up the situation because as a side effect it forces
setup_per_zone_lowmem_reserve.

This commit breaks the link order dependency by invoking
init_per_zone_wmark_min() as a postcore_initcall so that the CMA pages
have the chance to be properly accounted in their zone(s) and allowing
the lowmem_reserve arrays to receive consistent values.

Fixes: bc22af74f271 ("mm: update min_free_kbytes from khugepaged after core initialization")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Jason Baron <jbaron@akamai.com>
Cc: David Rientjes <rientjes@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/1597423766-27849-1-git-send-email-opendmb@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick linux-5.4.y commit 5663159e2930 to resolve too larget cma issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I59cbe93ed28f09d08dced520667b32e2fb030c21

3 years agoARM: dts: bcm2711-rpi-4-b: Fix CMA size to 512M 27/250127/1 accepted/tizen/unified/20201222.122545 submit/tizen/20201222.024625
Hoegeun Kwon [Mon, 21 Dec 2020 04:54:55 +0000 (13:54 +0900)]
ARM: dts: bcm2711-rpi-4-b: Fix CMA size to 512M

Increase cma size to 512 for use 4k GL on tizen platform.

When using RPI4 1GB model + 4k UHD, reclaim occurs a lot and it is slow.

Change-Id: Iac60a9fa0d5f76085e60cbf3db9a90585597de57
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
3 years agoRevert "ALSA: usb-audio: Improve frames size computation" 27/249927/1 accepted/tizen/6.0/unified/20210121.212556 accepted/tizen/6.0/unified/hotfix/20210121.101657 accepted/tizen/unified/20201218.124446 submit/tizen/20201218.004559 submit/tizen_6.0/20210121.055004 submit/tizen_6.0_hotfix/20210121.065852
Greg Kroah-Hartman [Tue, 7 Jul 2020 12:42:38 +0000 (14:42 +0200)]
Revert "ALSA: usb-audio: Improve frames size computation"

This reverts commit aba41867dd66939d336fdf604e4d73b805d8039f which is
commit f0bd62b64016508938df9babe47f65c2c727d25c upstream.

It causes a number of reported issues and a fix for it has not hit
Linus's tree yet.  Revert this to resolve those problems.

Cc: Alexander Tsoy <alexander@tsoy.me>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Hans de Goede <jwrdegoede@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick linux-5.4.y commit e0ed5a36fb3a to fix specific usb-audio distortion issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I9e7ca39dddc28d8c29bf0488419c1fbdbddfb61a

3 years agoscript: Fix to use NCPUS dynamically 28/249728/1
Hoegeun Kwon [Mon, 14 Dec 2020 14:24:34 +0000 (23:24 +0900)]
script: Fix to use NCPUS dynamically

It uses NCPUS dynamically.

Change-Id: Ib7b1229f387b9c91f4eb2b29cc8f3bfe207fcaaa
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@gmail.com>
3 years agostaging: vc04_services: codec: Fix component enable/disable 09/249309/1 accepted/tizen/unified/20201211.124322 submit/tizen/20201211.031336
Dave Stevenson [Thu, 13 Aug 2020 16:04:53 +0000 (17:04 +0100)]
staging: vc04_services: codec: Fix component enable/disable

start_streaming enabled the VPU component if ctx->component_enabled
was not set.
stop_streaming disabled the VPU component if both ports were
disabled. It didn't clear ctx->component_enabled.

If seeking, this meant that the component never got re-enabled,
and buffers never got processed afterwards.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
[sw0312.kim: cherry-pick rpi-5.4.y commit to fix video decoding seek issue]
Ref: https://github.com/raspberrypi/linux/pull/3790
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ibf27e3ed2dc3d98d64a78b10878d6339d77f8a33

3 years agostaging: vc04_service: codec: Allow start_streaming to update the buffernum 08/249308/1
Dave Stevenson [Thu, 13 Aug 2020 16:01:27 +0000 (17:01 +0100)]
staging: vc04_service: codec: Allow start_streaming to update the buffernum

start_streaming passes a count of how many buffers have been queued
to videobuf2.

Allow this value to update the number of buffers the VPU allocates
on a port to avoid buffer recycling issues.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
[sw0312.kim: cherry-pick rpi-5.4.y commit to fix video decoding seek issue]
Ref: https://github.com/raspberrypi/linux/pull/3790
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Iaf37f57df95789cc8987b268feab1f0fa7377849

3 years agostaging: vc04_services: codec: Fix incorrect buffer cleanup 07/249307/1
Dave Stevenson [Thu, 13 Aug 2020 15:58:18 +0000 (16:58 +0100)]
staging: vc04_services: codec: Fix incorrect buffer cleanup

The allocated input and output buffers are initialised in
buf_init and should only be cleared up in buf_cleanup.
stop_streaming was (incorrectly) cleaning up the buffers to
avoid an issue in videobuf2 that had been fixed by the orphaned
buffer support.

Remove the erroneous cleanup.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
[sw0312.kim: cherry-pick rpi-5.4.y commit to fix video decoding seek issue]
Ref: https://github.com/raspberrypi/linux/pull/3790
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I38e3a257a941753b02e448d6d5dd1c8486b648f1

3 years agoARM: tizen_bcm2711_defconfig: Fix console loglevel for logo display 44/247244/2
Hoegeun Kwon [Mon, 9 Nov 2020 07:44:46 +0000 (16:44 +0900)]
ARM: tizen_bcm2711_defconfig: Fix console loglevel for logo display

Modifiy CONSOLE_LOGLEVEL_QUIET defconfig to 3 for logo display.

Change-Id: Idae234c40304fbe8fd5f02941e53505a6bd189fa
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
3 years agoarm64: tizen_bcm2711_defconfig: Fix console loglevel for logo display 25/247225/2
Hoegeun Kwon [Mon, 9 Nov 2020 07:03:59 +0000 (16:03 +0900)]
arm64: tizen_bcm2711_defconfig: Fix console loglevel for logo display

Modifiy CONSOLE_LOGLEVEL_QUIET defconfig to 3 for logo display.

Change-Id: I5112d85dedd1e116a75af0d07c09d77182ff4f5a
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agorpi4: boot: config: Enable hdmi_force_hotplug 07/246707/1 accepted/tizen/unified/20201105.124359 submit/tizen/20201104.114006
Hoegeun Kwon [Tue, 3 Nov 2020 08:09:20 +0000 (17:09 +0900)]
rpi4: boot: config: Enable hdmi_force_hotplug

There is a problem that the booting stops when booting without connecting
HDMI. To fix it we need to enable hdmi_force_hotplug.

Change-Id: I44e960a04f75c999ab69a75ad72d67311f8b70c1
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agodrm/vc4: kms: Don't disable the muxing of an active CRTC 06/246706/1
Maxime Ripard [Tue, 3 Nov 2020 08:09:17 +0000 (17:09 +0900)]
drm/vc4: kms: Don't disable the muxing of an active CRTC

The current HVS muxing code will consider the CRTCs in a given state to
setup their muxing in the HVS, and disable the other CRTCs muxes.

However, it's valid to only update a single CRTC with a state, and in this
situation we would mux out a CRTC that was enabled but left untouched by
the new state.

Fix this by setting a flag on the CRTC state when the muxing has been
changed, and only change the muxing configuration when that flag is there.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi and for enable
force hotplug configure. ]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I5c9fb79c9ad07caa8fe77ea724f35c955df6edcf

4 years agodrm/vc4: kms: Store the unassigned channel list in the state 05/246705/1
Maxime Ripard [Tue, 3 Nov 2020 08:09:14 +0000 (17:09 +0900)]
drm/vc4: kms: Store the unassigned channel list in the state

If a CRTC is enabled but not active, and that we're then doing a page
flip on another CRTC, drm_atomic_get_crtc_state will bring the first
CRTC state into the global state, and will make us wait for its vblank
as well, even though that might never occur.

Instead of creating the list of the free channels each time atomic_check
is called, and calling drm_atomic_get_crtc_state to retrieve the
allocated channels, let's create a private state object in the main
atomic state, and use it to store the available channels.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi and for enable
force hotplug configure. fix to unsigned long unassigned_channels instead
of integer to fix build errors.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ic8bf07502f614595070e21ecc7912e671a193b09

4 years agodrm/vc4: kms: Add functions to create the state objects 04/246704/1
Maxime Ripard [Tue, 3 Nov 2020 08:09:12 +0000 (17:09 +0900)]
drm/vc4: kms: Add functions to create the state objects

We're going to add a new private state, so let's move the previous state
function creation to some functions to make further additions easier.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi and for enable
force hotplug configure.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ice57c56dfbdfbb81f486cba7626512cfbb12b905

4 years agodrm/vc4: kms: Rename NUM_CHANNELS 03/246703/1
Maxime Ripard [Tue, 3 Nov 2020 08:09:01 +0000 (17:09 +0900)]
drm/vc4: kms: Rename NUM_CHANNELS

The NUM_CHANNELS define has a pretty generic name and was right before the
function using it. Let's move to something that makes the hardware-specific
nature more obvious, and to a more appropriate place.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi and for enable
force hotplug configure.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ib94c2b3ffbc7e5c95f2c3a965919e523c68f8a12

4 years agodrm/vc4: kms: Remove useless define 02/246702/1
Maxime Ripard [Tue, 3 Nov 2020 08:08:59 +0000 (17:08 +0900)]
drm/vc4: kms: Remove useless define

NUM_OUTPUTS isn't used anymore, let's remove it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi and for enable
force hotplug configure.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I20b47a2da045094a06cef9e9a924f46c4dd1d4a9

4 years agoRevert "drm/vc4: kms: Don't disable the muxing of an active CRTC" 01/246701/1
Hoegeun Kwon [Tue, 3 Nov 2020 08:08:57 +0000 (17:08 +0900)]
Revert "drm/vc4: kms: Don't disable the muxing of an active CRTC"

This reverts commit 5d2fec61a25bacc49ee8e84b3c19aee1522f7289.

Revert this patch for apply patch version 2.

Change-Id: Ib7ff9b242dc3f208cf58f7d8f0741321b725c657
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoRevert "drm/vc4: kms: Fix VBLANK reporting on a disabled CRTC" 00/246700/1
Hoegeun Kwon [Tue, 3 Nov 2020 08:08:54 +0000 (17:08 +0900)]
Revert "drm/vc4: kms: Fix VBLANK reporting on a disabled CRTC"

This reverts commit e805316d5d44b1f1f080fd8ae8a34b69329d940c.

Revert this patch for apply patch version 2.

Change-Id: If9525aaa3835ab80b8ca83271dc584f68254018a
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agomm: LKSM: bug fix for KASAN out-of-bound access error on accessing a filter 44/246344/3 accepted/tizen/unified/20201102.124307 submit/tizen/20201030.062213
Sung-hun Kim [Wed, 28 Oct 2020 10:26:31 +0000 (19:26 +0900)]
mm: LKSM: bug fix for KASAN out-of-bound access error on accessing a filter

KASAN reports out-of-bound accesses (reported by Jaehoon Chung)
on slab which is performed for obtaining a next filtered
address to find a sharable page.

LKSM exploits bitmap-based filters to find sharable pages in
an efficient way. A buggy code is a kind of miscalculation for
boundary of the allocated bitmap. This patch takes care of it.

Change-Id: If45c5ce175db067523b60f11e69e12d2bc798659
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agomm: LKSM: bug fix for kernel memory leak 43/246343/2
Sung-hun Kim [Tue, 27 Oct 2020 11:48:36 +0000 (20:48 +0900)]
mm: LKSM: bug fix for kernel memory leak

For efficiency, LKSM cleans exited processes in a batched manner when it
finishes a scanning iteration. When it finds exited process while it is in
the scanning iteration, it just pends the mm_slot of the exited process to
the internal list.

On the other hend, when KSM daemon cleans mm_slots of exited processes, it
should care regions of exited processes to remove unreferenced lksm_region
objects.

Previously, most regions are maintained properly but only regions in "head"
of the exited process list does not be cleaned due to the buggy implementation.
At last, uncleaned objects are remained as unreferenced garbages.

Follow message is detected by kmemleak (reported by Suengwoo Kim):
=========================================================================
unreferenced object 0xffffff80c7083600 (size 128):
  comm "ksm_crawld", pid 41, jiffies 4294918362 (age 95.632s)
  hex dump (first 32 bytes):
    00 37 08 c7 80 ff ff ff 60 82 19 bd 80 ff ff ff  .7......`.......
    00 35 08 c7 80 ff ff ff 00 00 00 00 00 00 00 00  .5..............
  backtrace:
    [<0000000048313958>] kmem_cache_alloc_trace+0x1e0/0x348
    [<00000000fd246822>] lksm_region_ref_append+0x48/0xf8
    [<00000000c5a818a0>] ksm_join+0x3a0/0x498
    [<00000000b2c3f36a>] lksm_prepare_full_scan+0xe8/0x390
    [<00000000013943b5>] lksm_crawl_thread+0x214/0xbf8
    [<00000000b4ce0593>] kthread+0x1b0/0x1b8
    [<000000002a3f7216>] ret_from_fork+0x10/0x18
unreferenced object 0xffffff80c7083700 (size 128):
  comm "ksm_crawld", pid 41, jiffies 4294918362 (age 95.632s)
  hex dump (first 32 bytes):
    00 39 08 c7 80 ff ff ff 00 36 08 c7 80 ff ff ff  .9.......6......
    00 35 08 c7 80 ff ff ff 00 00 00 00 00 00 00 00  .5..............
  backtrace:
    [<0000000048313958>] kmem_cache_alloc_trace+0x1e0/0x348
    [<00000000fd246822>] lksm_region_ref_append+0x48/0xf8
    [<00000000c5a818a0>] ksm_join+0x3a0/0x498
    [<00000000b2c3f36a>] lksm_prepare_full_scan+0xe8/0x390
    [<00000000013943b5>] lksm_crawl_thread+0x214/0xbf8
    [<00000000b4ce0593>] kthread+0x1b0/0x1b8
    [<000000002a3f7216>] ret_from_fork+0x10/0x18
...
=========================================================================

This patch takes care of such possible kernel memory leak problem.

Change-Id: Ifb4963773b8803da239a1d3108c5b2690d22d531
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agobrcmfmac: Fix memory leak for unpaired brcmf_{alloc/free} 63/246263/1
Seung-Woo Kim [Tue, 27 Oct 2020 10:23:56 +0000 (19:23 +0900)]
brcmfmac: Fix memory leak for unpaired brcmf_{alloc/free}

There are missig brcmf_free() for brcmf_alloc(). Fix memory leak
by adding missed brcmf_free().

Change-Id: I050398a7b828b0fb2aadbe491f353b3d3c47bdd6
Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodrm/vc4: drv: Add error handding for bind 86/246186/2 accepted/tizen/unified/20201028.123938 submit/tizen/20201027.005200
Hoegeun Kwon [Mon, 26 Oct 2020 11:47:31 +0000 (20:47 +0900)]
drm/vc4: drv: Add error handding for bind

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side. Add error handding for drm_mode_config.

Change-Id: If23c0dabf01b85368871981f0cba427982922615
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agostaging: mmal-vchiq: Fix memory leak for vchi_instance 65/246165/1
Seung-Woo Kim [Mon, 26 Oct 2020 07:37:19 +0000 (16:37 +0900)]
staging: mmal-vchiq: Fix memory leak for vchi_instance

The vchi_instance is allocated with vchiq_initialise() but never
handled properly. Fix memory leak for the vchi_instance.

This fixes below kmemleak report:
    [<000000002312557f>] kmem_cache_alloc_trace+0x1e0/0x348
    [<000000002ee5d470>] vchiq_initialise+0xd0/0x258
    [<000000009b51d8f4>] vchi_initialise+0x84/0xc8
    [<00000000a58f68c5>] vchiq_mmal_init+0xb0/0x2f0
    [<000000006c68d7bf>] bcm2835_mmal_probe+0x90/0x660
    ...

Change-Id: Ib10f194aa4058b3e39ec0a250fa36fd00daf9feb
Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodrm/vc4: kms: Fix VBLANK reporting on a disabled CRTC 42/245642/1
Maxime Ripard [Mon, 12 Oct 2020 03:44:25 +0000 (12:44 +0900)]
drm/vc4: kms: Fix VBLANK reporting on a disabled CRTC

If a CRTC is enabled but not active, and that we're then doing a page flip
on another CRTC, drm_atomic_get_crtc_state will bring the first CRTC state
into the global state, and will make us wait for its vblank as well, even
though that might never occur.

Fix this by considering all the enabled CRTCs by either using their new
state in the global state, or using their current state if they aren't part
of the new state being checked, to remove their assigned channel from the
pool before started to assign channels to CRTCs enabled by the state.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ic8b8083a652df142a17ec0d50f6c2572494ba3c0

4 years agodrm/vc4: kms: Don't disable the muxing of an active CRTC 41/245641/1
Maxime Ripard [Thu, 8 Oct 2020 11:25:18 +0000 (13:25 +0200)]
drm/vc4: kms: Don't disable the muxing of an active CRTC

The current HVS muxing code will consider the CRTCs in a given state to
setup their muxing in the HVS, and disable the other CRTCs muxes.

However, it's valid to only update a single CRTC with a state, and in this
situation we would mux out a CRTC that was enabled but left untouched by
the new state.

Fix this by considering all the CRTCs in the state and the ones with a
state and active.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Idb6e79214f52e470e9fcf5a0579873402c631eb2

4 years agodrm/vc4: kms: Fix to split vc4 and vc5 hvs pv muxing commit 40/245640/1
Hoegeun Kwon [Mon, 12 Oct 2020 12:10:58 +0000 (21:10 +0900)]
drm/vc4: kms: Fix to split vc4 and vc5 hvs pv muxing commit

In order to use dual HDMI normally, vc4 and vc5 should be separated.
Split vc4 hvs pv muxing commit and vc5 referring to patch[1].

[1] drm/vc4: crtc: Assign output to channel automatically
    https://cgit.freedesktop.org/drm/drm-misc/commit/?id=87ebcd42fb7b8d1d3269007a621e41ae96a0077e

Change-Id: I5427cfd885c4643f764f8f84bed0f017c5d2a562
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agodrm/vc4: kms: Document the muxing corner cases 39/245639/1
Maxime Ripard [Thu, 8 Oct 2020 11:25:17 +0000 (13:25 +0200)]
drm/vc4: kms: Document the muxing corner cases

We've had a number of muxing corner-cases with specific ways to reproduce
them, so let's document them to make sure they aren't lost and introduce
regressions later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Icc4f82cd0c22f7b0b7e3c33be37d2e9d287638e4

4 years agodrm/vc4: kms: Split the HVS muxing check in a separate function 38/245638/1
Maxime Ripard [Mon, 12 Oct 2020 07:55:43 +0000 (16:55 +0900)]
drm/vc4: kms: Split the HVS muxing check in a separate function

The code that assigns HVS channels during atomic_check is starting to grow
a bit big, let's move it into a separate function.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Icf636a846282981d21ad3e6652a3ec51f14993a4

4 years agodrm/vc4: crtc: Keep the previously assigned HVS FIFO 37/245637/1
Maxime Ripard [Mon, 12 Oct 2020 07:44:43 +0000 (16:44 +0900)]
drm/vc4: crtc: Keep the previously assigned HVS FIFO

The HVS FIFOs are currently assigned each time we have an atomic_check
for all the enabled CRTCs.

However, if we are running multiple outputs in parallel and we happen to
disable the first (by index) CRTC, we end up changing the assigned FIFO
of the second CRTC without disabling and reenabling the pixelvalve which
ends up in a stall and eventually a VBLANK timeout.

In order to fix this, we can create a special value for our assigned
channel to mark it as disabled, and if our CRTC already had an assigned
channel in its previous state, we keep on using it.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I70e0d6b563d5c7f22a1a7e1527a401ac42395b78

4 years agodrm/vc4: kms: Assign a FIFO to enabled CRTCs instead of active 36/245636/1
Maxime Ripard [Mon, 12 Oct 2020 04:26:40 +0000 (13:26 +0900)]
drm/vc4: kms: Assign a FIFO to enabled CRTCs instead of active

The HVS has three FIFOs that can be assigned to a number of PixelValves
through a mux.

However, changing that FIFO requires that we disable and then enable the
pixelvalve, so we want to assign FIFOs to all the enabled CRTCs, and not
just the active ones.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
[hoegeun.kwon: Needed to fix page flip issue of dual hdmi.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Id418d321e3cfc9b992bd1868e8084d9f8694a46e

4 years agobrcmfmac: change from brcmf_dbg to brcmf_info 18/245218/1 accepted/tizen/6.0/unified/20201030.104454 accepted/tizen/6.0/unified/hotfix/20201102.235212 accepted/tizen/unified/20201006.080059 submit/tizen/20201006.033113 submit/tizen_6.0/20201029.205501 submit/tizen_6.0_hotfix/20201102.192901 submit/tizen_6.0_hotfix/20201103.115101 tizen_6.0.m2_release
Jaehoon Chung [Mon, 5 Oct 2020 11:39:01 +0000 (20:39 +0900)]
brcmfmac: change from brcmf_dbg to brcmf_info

Change from brcmf_dbg to brcmf_info.
This patch is workaround to check debug message on Testhub.

Change-Id: I7fef8f64fc38e43b6544fab3e9474e7f1829cc60
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agodrm/vc4: hvs: Pull the state of all the CRTCs prior to PV muxing 24/244524/2 accepted/tizen/unified/20200922.053406 submit/tizen/20200922.014449
Maxime Ripard [Thu, 17 Sep 2020 12:16:23 +0000 (14:16 +0200)]
drm/vc4: hvs: Pull the state of all the CRTCs prior to PV muxing

The vc4 display engine has a first controller called the HVS that will
perform the composition of the planes. That HVS has 3 FIFOs and can
therefore compose planes for up to three outputs. The timings part is
generated through a component called the Pixel Valve, and the BCM2711 has 6
of them.

Thus, the HVS has some bits to control which FIFO gets output to which
Pixel Valve. The current code supports that muxing by looking at all the
CRTCs in a new DRM atomic state in atomic_check, and given the set of
constraints that we have, assigns FIFOs to CRTCs or reject the mode
entirely. The actual muxing will occur during atomic_commit.

However, that doesn't work if only a fraction of the CRTCs' state is
updated in that state, since it will ignore the CRTCs that are kept running
unmodified, and will thus unassign its associated FIFO, and later disable
it.

In order to make the code work as expected, let's pull the CRTC state of
all the enabled CRTC in our atomic_check so that we can operate on all the
running CRTCs, no matter whether they are affected by the new state or not.

Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917121623.42023-1-maxime@cerno.tech
[hoegeun.kwon: Fix dual hdmi issue]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I750e253c7415b09e546beb2608445d581c441efe

4 years agodrm/vc4: crtc: Add null pointer error handling 02/244402/1
Hoegeun Kwon [Fri, 18 Sep 2020 06:54:43 +0000 (15:54 +0900)]
drm/vc4: crtc: Add null pointer error handling

Crash occurs when vc4_encoder is null. Add null error handling

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000090
  Mem abort info:
    ESR = 0x96000005
    EC = 0x25: DABT (current EL), IL = 32 bits
    SET = 0, FnV = 0
    EA = 0, S1PTW = 0
  Data abort info:
    ISV = 0, ISS = 0x00000005
    CM = 0, WnR = 0
  user pgtable: 4k pages, 39-bit VAs, pgdp=00000000f2a96000
  [0000000000000090] pgd=0000000000000000, pud=0000000000000000
  Internal error: Oops: 96000005 [#1] PREEMPT SMP
  Modules linked in: brcmfmac joydev brcmutil rpivid_mem
  CPU: 0 PID: 32 Comm: kworker/0:1 Not tainted 5.4.50-v8+ #414
  Hardware name: Raspberry Pi 4 Model B (DT)
  Workqueue: events output_poll_execute
  pstate: 80000005 (Nzcv daif -PAN -UAO)
  pc : vc4_crtc_atomic_disable+0x150/0x2e8
  lr : vc4_crtc_atomic_disable+0x50/0x2e8
  ...
  Call trace:
   vc4_crtc_atomic_disable+0x150/0x2e8
   drm_atomic_helper_commit_modeset_disables+0x344/0x410
   vc4_atomic_complete_commit+0xd4/0x530
   vc4_atomic_commit+0xf4/0x190
   drm_atomic_commit+0x54/0x60
   ...

Change-Id: Ib3271bb3c8318079fe5815711f89a217e835adc6
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoscripts: mkbootimg_rpi4.sh: use compress image 65/244165/1
Seung-Woo Kim [Tue, 15 Sep 2020 09:48:22 +0000 (18:48 +0900)]
scripts: mkbootimg_rpi4.sh: use compress image

Use compressed image for less size.

Change-Id: I9ec8b7e5e35bfa8ae6ac2832d52d4748e9a79668
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodrm/vc4: hvs: Boost the core clock during modeset 75/244075/3
Hoegeun Kwon [Tue, 15 Sep 2020 00:32:49 +0000 (09:32 +0900)]
drm/vc4: hvs: Boost the core clock during modeset

In order to prevent timeouts and stalls in the pipeline, the core clock
needs to be maxed at 500MHz during a modeset on the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/37ed9e0124c5cce005ddc8dafe821d8b0da036ff.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: A screen cracking problem occurs in FHD(1920x1080). The
cause is that the clock should be kept at 500MHz, but it occurred when
the clock fell to 200MHz, so apply a patch.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ie0d4880966c1644bfdf56bb49dbb82559978538c

4 years agodrm/vc4: hdmi: Fix to use clk_set_min_rate 74/244074/1
Hoegeun Kwon [Fri, 11 Sep 2020 04:39:40 +0000 (13:39 +0900)]
drm/vc4: hdmi: Fix to use clk_set_min_rate

There is a problem that rpi_firmware_transaction fails while setting
the clock rate. Add the missing code applied to the mainline.

Change-Id: I56bcb00037fc85bb01f8a876ccd26798b4bddb39
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d757ddd6549da140f178563e5fd2bf1d129913fd.1599120059.git-series.maxime@cerno.tech
4 years agodrm/vc4: hdmi: Switch to blank pixels when disabled 89/243889/1
Maxime Ripard [Tue, 25 Aug 2020 09:44:04 +0000 (18:44 +0900)]
drm/vc4: hdmi: Switch to blank pixels when disabled

In order to avoid pixels getting stuck in an unflushable FIFO, we need when
we disable the HDMI controller to switch away from getting our pixels from
the pixelvalve and instead use blank pixels, and switch back to the
pixelvalve when we enable the HDMI controller.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/fde3efb1ad79f4476a73d310cbba3ec07dc6dabe.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Needed to troubleshoot page flip timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I497f96e6d9b535d9d173d486fe1829c30093d88f

4 years agodrm/vc4: hdmi: Do the VID_CTL configuration at once 88/243888/1
Maxime Ripard [Tue, 25 Aug 2020 09:39:06 +0000 (18:39 +0900)]
drm/vc4: hdmi: Do the VID_CTL configuration at once

The VID_CTL setup is done in several places in the driver even though it's
not really required. Let's simplify it a bit to do the configuration in one
go.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/08e7ebb605a560fcc149b69b4af52753a7870b2f.1599120059.git-series.maxime@cerno.tech
[cw00.choi: Apply it to both vc4_hdmi_set_timings and vc5_hdmi_set_timings,
needed to troubleshoot page flip timed out issue.]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I3b12049c9bfb69d5d21c7186b677e8e32d756959

4 years agodrm/vc4: hdmi: Implement finer-grained hooks 87/243887/1
Maxime Ripard [Tue, 25 Aug 2020 09:26:58 +0000 (18:26 +0900)]
drm/vc4: hdmi: Implement finer-grained hooks

In order to prevent some pixels getting stuck in an unflushable FIFO on
bcm2711, we need to enable the HVS, the pixelvalve (the CRTC) and the HDMI
controller (the encoder) in an intertwined way, and with tight delays.

However, the atomic callbacks don't really provide a way to work with
either constraints, so we need to roll our own callbacks so that we can
provide those guarantees.

Since those callbacks have been implemented and called in the CRTC code, we
can just implement them in the HDMI driver now.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2e9226d971117065f3b97e597f04f7fe2f0c134c.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Needed to troubleshoot page flip timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ice9a866f353d8e478e8f24c66b6e2e836e474817

4 years agodrm/vc4: hdmi: Always recenter the HDMI FIFO 86/243886/1
Maxime Ripard [Tue, 25 Aug 2020 09:21:50 +0000 (18:21 +0900)]
drm/vc4: hdmi: Always recenter the HDMI FIFO

In order to avoid a pixel getting stuck in an unflushable FIFO, we need to
recenter the FIFO every time we're doing a modeset and not only if we're
connected to an HDMI monitor.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b3faaf05ac6c4d3c364d28fa441571eb85903269.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Needed to troubleshoot page flip timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: Ife295f612fb32ef2a02e1494c3a4b532735c989e

4 years agodrm/vc4: hdmi: Remove register dumps in enable 85/243885/1
Maxime Ripard [Tue, 25 Aug 2020 09:18:19 +0000 (18:18 +0900)]
drm/vc4: hdmi: Remove register dumps in enable

The current code has some logic, disabled by default, to dump the register
setup in the HDMI controller.

However, since we're going to split those functions in multiple, shorter,
functions that only make sense where they are called in sequence, keeping
the register dump makes little sense.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c8c8d388f2d32fc3536336be36d003a862487eb7.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Remove hdmi reg dumps, needed to troubleshoot page flip
timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I8048f58783639cf790c8bb691007099943733a71

4 years agodrm/vc4: hdmi: Use clk_set_min_rate instead 84/243884/1
Maxime Ripard [Tue, 25 Aug 2020 09:07:16 +0000 (18:07 +0900)]
drm/vc4: hdmi: Use clk_set_min_rate instead

The HSM clock needs to be running at 101% the pixel clock of the HDMI
controller, however it's shared between the two HDMI controllers, which
means that if the resolutions are different between the two HDMI
controllers, and the lowest resolution is on the second (in enable order)
controller, the first HDMI controller will end up with a smaller than
expected clock rate.

Since we don't really need an exact frequency there, we can simply change
the minimum rate we expect instead.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/821992209cc0d7a83254bf26fe2bf507ef0994d2.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Needed to troubleshoot page flip timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I5666bf89beb6bada919b279846e5c204fabd0ffc

4 years agodrm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate 83/243883/1
Maxime Ripard [Tue, 25 Aug 2020 08:31:56 +0000 (17:31 +0900)]
drm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate

The HSM clock needs to be setup at around 101% of the pixel rate. This
was done previously by setting the clock rate to 163.7MHz at probe time and
only check in mode_valid whether the mode pixel clock was under the pixel
clock +1% or not.

However, with 4k we need to change that frequency to a higher frequency
than 163.7MHz, and yet want to have the lowest clock as possible to have a
decent power saving.

Let's change that logic a bit by setting the clock rate of the HSM clock
to the pixel rate at encoder_enable time. This would work for the
BCM2711 that support 4k resolutions and has a clock that can provide it,
but we still have to take care of a 4k panel plugged on a BCM283x SoCs
that wouldn't be able to use those modes, so let's define the limit in
the variant.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7e692ddc231d33dd671e70ea04dd1dcf56c1ecb3.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Applied missing code, needed to troubleshoot page flip
timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I43328575d59a0bbccac8d4153ac5ed54f029550b

4 years agodrm/vc4: hdmi: Add reset callback 82/243882/1
Maxime Ripard [Tue, 25 Aug 2020 06:53:28 +0000 (15:53 +0900)]
drm/vc4: hdmi: Add reset callback

The BCM2711 and BCM283x HDMI controllers use a slightly different reset
sequence, so let's add a callback to reset the controller.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a34bcb493da07eae58ed704f65e72ce0748e8952.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: Apply the missing code, needed to troubleshoot page flip
timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: If0383cb9b5f8ba5d3f309bfeab3e3c74272d8723

4 years agodrm/vc4: encoder: Add finer-grained encoder callbacks 81/243881/1
Maxime Ripard [Mon, 24 Aug 2020 10:56:15 +0000 (19:56 +0900)]
drm/vc4: encoder: Add finer-grained encoder callbacks

In the BCM2711, the setup of the HVS, pixelvalve and HDMI controller
requires very precise ordering and timing that the regular atomic callbacks
don't provide. Let's add new callbacks on top of the regular ones to be
able to split the configuration as needed.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1dd78efe8f29add73c97d0148cfd4ec8e34aaf22.1599120059.git-series.maxime@cerno.tech
[hoegeun.kwon: For use encoder callback, needed to troubleshoot page
flip timed out issue.]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Change-Id: I16a1a59ad753d7c4e211c24a3563a607faa03a5c

4 years agoARM64: tizen_bcm2711_defconfig: Enable VIDEO_CODEC_BCM2835 76/243776/1 accepted/tizen/unified/20200911.043201 submit/tizen/20200910.072016
Seung-Woo Kim [Thu, 10 Sep 2020 04:28:11 +0000 (13:28 +0900)]
ARM64: tizen_bcm2711_defconfig: Enable VIDEO_CODEC_BCM2835

To support v4l2 codec device, enable VIDEO_CODEC_BCM2835 and
to meet dependency, enable MEDIA_CONTROLLER.

Change-Id: Id473825163c409ceaab5d4b618cf8bddd6af0f68
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoARM: configs: tizen_bcm2711_defconfig: Enable VIDEO_CODEC_BCM2835 75/243775/1
Seung-Woo Kim [Thu, 10 Sep 2020 04:25:20 +0000 (13:25 +0900)]
ARM: configs: tizen_bcm2711_defconfig: Enable VIDEO_CODEC_BCM2835

To support v4l2 codec device, enable VIDEO_CODEC_BCM2835.

Change-Id: I7f7147901b77b3ff01afc1a7c3c7f0ab9cc20701
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoRevert "block: zram: Add support for dynamic compressor switch" 35/242135/1 accepted/tizen/unified/20200825.142845 submit/tizen/20200825.023546
Dongwoo Lee [Fri, 21 Aug 2020 11:53:46 +0000 (20:53 +0900)]
Revert "block: zram: Add support for dynamic compressor switch"

Since dynamic compress switch increases memory usage of meta data along
with the size of zram, in order to saving memory, this reverts commit
'2aab8469d74f ("block: zram Add support for dynamic compressor switch")'

Change-Id: Idd6e1f6f938ca2ebb24ba3e8c65a838bf8fc84d4
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agoARM64: tizen_bcm2711_defconfig: Enable RTL8192CU config as module 65/242065/2 accepted/tizen/unified/20200825.033245 submit/tizen/20200824.091314
Jaehoon Chung [Mon, 24 Aug 2020 02:34:08 +0000 (11:34 +0900)]
ARM64: tizen_bcm2711_defconfig: Enable RTL8192CU config as module

Enable RTL8192CU configuration as module.

Change-Id: I4597976b08b9e1e98d61f42da674c28c5e476f10
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoARM: tizen_bcm2711_defconfig: Enable RTL8192CU config as module 64/242064/2
Jaehoon Chung [Mon, 24 Aug 2020 02:33:04 +0000 (11:33 +0900)]
ARM: tizen_bcm2711_defconfig: Enable RTL8192CU config as module

Enable RTL8192CU configuration as module.

Change-Id: Ibe38cc889d5e2973028b28615a2210f87056763f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agomm: memcontrol: Add force_reclaim to reclaim tasks' memory in memcg 36/242036/1
Dongwoo Lee [Mon, 3 Aug 2020 05:44:43 +0000 (14:44 +0900)]
mm: memcontrol: Add force_reclaim to reclaim tasks' memory in memcg

These days, platforms tend to manage memory on low memory state
like andloid's lowmemory killer. These platforms might want to
reclaim memory from background tasks as well as kill victims
to guarantee free memory at use space level. This patch provides
an interface to reclaim a given memcg. After platform's low memory
handler moves tasks that the platform wants to reclaim to
a memcg and decides how many pages should be reclaimed, it can
reclaim the pages from the tasks by writing the number of pages
at memory.force_reclaim.

Signed-off-by: Hyunhee Kim <hyunhee.kim@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
[dwoo08.lee: ported from mailing list https://www.spinics.net/lists/cgroups/msg07874.html]

Change-Id: I40b1322dfe2628ca306690a15958881b3026606f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agoRevert "WORKAROUND: security: smack: Allow ptracing even processes in onlycap set" 16/241916/1 accepted/tizen/unified/20200824.030012 submit/tizen/20200820.145124
Seung-Woo Kim [Fri, 21 Aug 2020 01:08:34 +0000 (10:08 +0900)]
Revert "WORKAROUND: security: smack: Allow ptracing even processes in onlycap set"

This reverts commit 38b1ae4b960c310b02d7d6935b97d289f0326800.

Now crash-worker has System::Privileged privilege, so not anymore
ptrace related workaround is necessary. So revert the workaround.

Change-Id: I42b535e4152eb742df011a5a08324764b49f989a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoscripts: mkbootimg_rpi4.sh: Fix module image size to 32MB 27/241427/1
Hoegeun Kwon [Thu, 20 Aug 2020 05:24:51 +0000 (14:24 +0900)]
scripts: mkbootimg_rpi4.sh: Fix module image size to 32MB

The partition module size has been modified to 32MB.

Change-Id: I467fd7618d345a25d87af62985a1c2f8f47ad0eb
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoARM: dts: bcm2711-rpi-4-b: Enable uart2 node 68/241068/1 accepted/tizen/unified/20200819.035952 submit/tizen/20200818.094753
Seung-Woo Kim [Fri, 14 Aug 2020 07:47:15 +0000 (16:47 +0900)]
ARM: dts: bcm2711-rpi-4-b: Enable uart2 node

Enable uart2 to support '/dev/ttyAMA1'. The node setting is from
arch/arm/boot/dts/overlays/uart2-overlay.dts, without cts, rts.
Tx pin is gpio 0, pin 27, and Rx pin is gpio 1, pin 28.

Ref: https://www.raspberrypi.org/forums/viewtopic.php?t=244827

Change-Id: Ib6c460f6c8e46f3ef7d2d40ab23b3524e438c6c9
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agorpi4: boot: config: disable eeprom i2c hat auto detect 67/241067/1
Seung-Woo Kim [Fri, 14 Aug 2020 07:24:24 +0000 (16:24 +0900)]
rpi4: boot: config: disable eeprom i2c hat auto detect

From raspberry pi gpio pins, ID_SC and ID_SD are reserved by
firmware to detect HAT with i2c, but in Tizen, auto-detection
and dynamical setting dt with overlay is not supported.
To use the pins for uart2, explictly disable eeprom i2c hat
auto detect.

Ref: https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md

Change-Id: Id5cf016b09e7661317529e1174842915165955bc
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoARM64: configs: tizen_bcm2711_defconfig: enable I2C_STUB as module 77/240977/1 accepted/tizen/unified/20200814.123119 submit/tizen/20200813.100152
Seung-Woo Kim [Thu, 13 Aug 2020 09:57:09 +0000 (18:57 +0900)]
ARM64: configs: tizen_bcm2711_defconfig: enable I2C_STUB as module

Tizen peripheral-io tct requires i2c_stub module to test i2c
functionality. Enable I2C_STUB as module.

Change-Id: I93ea159349dd5bcfea7ceabd04af239c7f2a1b96
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agomm: LKSM: remove unnecessary debug messages 59/240959/2
Sung-hun Kim [Thu, 13 Aug 2020 06:46:36 +0000 (15:46 +0900)]
mm: LKSM: remove unnecessary debug messages

In order to get scanning candidates, LKSM hooks fork and exit calls even though
LKSM does not run. Previous patches include debugging messages when LKSM hooks
exit calls, and it can flush old kernel logs. To handle this, this patch removes
unnecessary debugging messages.

Change-Id: If475a880ee931668b6bebf53322622ba2a042c89
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agomm: Change fault_around_bytes default value from 65536 to 4096 28/239728/3 accepted/tizen/unified/20200812.143848 submit/tizen/20200812.081439
Chanwoo Choi [Wed, 29 Jul 2020 07:52:52 +0000 (16:52 +0900)]
mm: Change fault_around_bytes default value from 65536 to 4096

To apply the 4K value for falut_around_bytes at the early booting step,
change fault_around_bytes default value from 65536 to 4096.

Change-Id: Id97650a035b524d7132bca6164581c8e15096354
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agoARM64: configs: tizen_bcm2711_defconfig: enable CONFIG_LKSM_FILTER 99/239599/15
Sung-hun Kim [Thu, 16 Jul 2020 07:00:07 +0000 (16:00 +0900)]
ARM64: configs: tizen_bcm2711_defconfig: enable CONFIG_LKSM_FILTER

Change-Id: I54bbb1ee0a5e3923ebdb4b62038c3ba999e38dab
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agomm: LKSM: new feature: use filter-based scanning to reduce scanning cost 98/239598/15
Sung-hun Kim [Thu, 16 Jul 2020 06:58:28 +0000 (15:58 +0900)]
mm: LKSM: new feature: use filter-based scanning to reduce scanning cost

LKSM_FILTER is a new feature which is intended to reduce the computation cost.
LKSM_FILTER exploits bitmap-based filters to skip scanning of unnecessary
pages. To this end, LKSM collects addresses of shared pages to make filters.

The rationale of LKSM_FILTER is that user-level programs share common runtime
framework and libraries. Because of that processes can have similar address
space layout. It means that if a page is merged with another page, the same
virtual address in different process can be merged with this merged page.
In this regard, KSM can use a single global filter to cover all sharable areas
in the system.

The challenge is caused by a secure construct of Linux kernel, namely ASLR.
ASLR enforces to have randomized address space for each process, and it
severely disrupts making a global filter.

To overcome this challenge, LKSM exploits two information: regions and offsets.
A region means the physically mapped area. Each process has its own VMAs but
they may mapped same files. A region means the original one.
An address space of a process is randomized in the unit of VMA. It means that
if pages are merged even in the different virtual addresses, there can be at
same offsets from individual VMAs.

LKSM leverages both regions and offsets to construct per-region filters.
By using per-region filters, LKSM could effectively reduce its scanning space
and also computation cost by up to 46% against previous version of LKSM at the
expense of somewhat sharing chances.

Change-Id: I6f010d991b514268a897ce8f7b88fb1442ef39b4
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agoARM64: configs: tizen_bcm2711_defconfig: enable CONFIG_LKSM 97/239597/13
Sung-hun Kim [Thu, 16 Jul 2020 00:07:37 +0000 (09:07 +0900)]
ARM64: configs: tizen_bcm2711_defconfig: enable CONFIG_LKSM

Change-Id: Ifa373a977364866a3c472665b21b44cf2b29cffc
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agomm: LKSM: lightweight memory deduplication for embedded devices 96/239596/12
Sung-hun Kim [Thu, 16 Jul 2020 00:05:12 +0000 (09:05 +0900)]
mm: LKSM: lightweight memory deduplication for embedded devices

Lightweight KSM (in short, LKSM) is a variant of KSM that is implemented in
a fully event-triggered manner. LKSM provides a memory deduplication facility
like vanilla KSM while it extremely reduces overhead.

Normally, LKSM is blocked and waits for incoming deduplication requests from
user-level process (e.g., resourced). When a user-level process submits
deduplication request via sysfs, LKSM performs requested-level of deduplication,
such as partial and full deduplications.
After that, LKSM is going to sleep again and waits for next request coming.

By doing so, LKSM mitigates side effects that impact on system performance,
for instance, occupying system resources such as CPU and incurring cache
pollutions.

Change-Id: I551feb45d8c59ccddea60ced96225780d50e1c43
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agomm: LKSM: prepare to add LKSM code 95/239595/9
Sung-hun Kim [Tue, 14 Jul 2020 06:04:38 +0000 (15:04 +0900)]
mm: LKSM: prepare to add LKSM code

A new feature, namely lightweight KSM (LKSM), is based on KSM in Linux and
much of codes are copied from KSM to LKSM.

To distinguish original KSM codes and developed codes in LKSM, original KSM
file (mm/ksm.c) is copied to mm/lksm.c.

Change-Id: I4e2a149f0978d0b74e9ecc7eedbd7901eb54ad44
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
4 years agoRevert "ARM: dts: bcm2711-rpi-4-b: Fix CMA size to 512M" 14/240714/1 accepted/tizen/unified/20200811.050507 submit/tizen/20200811.014146
Jaehoon Chung [Tue, 11 Aug 2020 01:31:25 +0000 (10:31 +0900)]
Revert "ARM: dts: bcm2711-rpi-4-b: Fix CMA size to 512M"

There is a problem of oom. CMA size is changed from 512M to 256M.
In future, it needs to fix.

This reverts commit f643c9fa8706284868003f2f376d51dd0383b4b3.

Change-Id: I5a855ba31dc19898a3721bb694700004a7a5504f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoWORKAROUND: security: smack: Allow ptracing even processes in onlycap set 64/240564/4 accepted/tizen/unified/20200810.123100 submit/tizen/20200810.050403
Karol Lewandowski [Fri, 7 Aug 2020 11:49:30 +0000 (13:49 +0200)]
WORKAROUND: security: smack: Allow ptracing even processes in onlycap set

Change-Id: I708d19703da0f1b83950454fda1362bec7369b5c
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoRevert "brd: remove support for BLKFLSBUF" 83/239983/2 accepted/tizen/unified/20200806.062547 submit/tizen/20200806.024854
Seung-Woo Kim [Fri, 31 Jul 2020 06:19:08 +0000 (15:19 +0900)]
Revert "brd: remove support for BLKFLSBUF"

This reverts commit ff26956875c2f05e12ecec9938411a2c7dfc767d.

To free ramdisk memory, BLKFLSBUF support is required.

Change-Id: Ib363fdcb65a21914c8baa2099e4b1ce6242428e2
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoRevert "brd: remove discard support" 82/239982/2
Seung-Woo Kim [Fri, 31 Jul 2020 06:18:06 +0000 (15:18 +0900)]
Revert "brd: remove discard support"

This reverts commit f09a06a193d942a12c1a33c153388b3962222006.

To support ramdisk flush, discard is required. So, revert the commit.
Note: struct queue_limit::discard_zeroes_data flag setting is
removed and queue_flag_set_unlocked() is replaced
blk_queue_flag_set().

Change-Id: Iead94d2263ce7ab688e57de587fa77f649285b10
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoRevert "brd: remove unused brd_mutex" 81/239981/2
Seung-Woo Kim [Fri, 31 Jul 2020 06:38:14 +0000 (15:38 +0900)]
Revert "brd: remove unused brd_mutex"

This reverts commit 15f7b41f70ddcca3b555bd0fdc7c8da7466b517e.

To support brd flush to free ramdisk brd_mutex is required.

Change-Id: Ide75bcb73812c3c7e04bfe6ebaed0d6d511e01dd
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoARM: dts: bcm2711-rpi-4-b: Fix CMA size to 512M 72/240072/2
Hoegeun Kwon [Mon, 3 Aug 2020 05:28:50 +0000 (14:28 +0900)]
ARM: dts: bcm2711-rpi-4-b: Fix CMA size to 512M

Increase cma size to 512 for use 4k GL on tizen platform.

When using RPI4 1GB model + 4k UHD, reclaim occurs a lot and it is slow.

Change-Id: I672b5be8df8d51a47e50eea04e445529568474ff
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoRevert "brcmfmac: move configuration of probe request IEs" 81/240081/1 accepted/tizen/unified/20200803.122231 submit/tizen/20200803.071449
Jaehoon Chung [Mon, 3 Aug 2020 05:45:35 +0000 (14:45 +0900)]
Revert "brcmfmac: move configuration of probe request IEs"

This reverts commit bd99a3013bdc00f8fc7534c657b39616792b4467.

It doesn't find any p2p-device with wpa_supplicant on Tizen.
- After reverted this, it's working fine.

Change-Id: I5fa0924e888b91fef17ac3d174ee2a2e49d5e5a6
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoARM64: configs: tizen_bcm2711_defconfig: Disable unused dwcotg 42/239642/2 accepted/tizen/unified/20200730.063301 submit/tizen/20200729.105144
Seung-Woo Kim [Tue, 28 Jul 2020 09:40:06 +0000 (18:40 +0900)]
ARM64: configs: tizen_bcm2711_defconfig: Disable unused dwcotg

In rpi4, usb dwc2 is used for usb peripheral port. Disable unused
dwcotg driver.

Change-Id: I3488508db5925f28d95dc2687814f061f2430622
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoARM: configs: tizen_bcm2711_defconfig: Disable unused dwcotg 41/239641/1
Seung-Woo Kim [Tue, 28 Jul 2020 09:38:42 +0000 (18:38 +0900)]
ARM: configs: tizen_bcm2711_defconfig: Disable unused dwcotg

In rpi4, usb dwc2 is used for usb peripheral port. Disable unused
dwcotg driver.

Change-Id: I89196a59929c1e5dedcf31dd81acaef3c07f2043
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodrm/vc4: hdmi: Add pixel bvb clock control 08/239608/3
Hoegeun Kwon [Mon, 27 Jul 2020 12:37:18 +0000 (21:37 +0900)]
drm/vc4: hdmi: Add pixel bvb clock control

There is a problem that the output does not work at a resolution
exceeding FHD. To solve this, we need to adjust the bvb clock at a
resolution exceeding FHD.

Change-Id: I488cbf5c9ec90e6429833edd94f8fe7e5e57bfdf
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoARM: dts: bcm2711: Add bvb clock for hdmi-pixel 07/239607/1
Hoegeun Kwon [Mon, 27 Jul 2020 12:36:02 +0000 (21:36 +0900)]
ARM: dts: bcm2711: Add bvb clock for hdmi-pixel

It is necessary to control the hdmi pixel bvb clock. Add bvb clock.

Change-Id: I8d8eedd31eb6b3ceabc5ef98c2312c28664f9046
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoclk: rpi: Add register to control pixel bvb clk 06/239606/1
Hoegeun Kwon [Mon, 27 Jul 2020 12:35:01 +0000 (21:35 +0900)]
clk: rpi: Add register to control pixel bvb clk

To use QHD or higher, we need to modify the pixel_bvb_clk value. So
add register to control this clock.

Change-Id: Ie6a37bba8b6872f8007ab20a370f268f3766711f
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
4 years agoASoC: bcm2835: Silence clk_get() error on -EPROBE_DEFER 75/239575/1 accepted/tizen/unified/20200729.165701 submit/tizen/20200728.021629
Seung-Woo Kim [Fri, 24 Jul 2020 04:11:08 +0000 (13:11 +0900)]
ASoC: bcm2835: Silence clk_get() error on -EPROBE_DEFER

Silence clk_get() error with dev_dbg() on -EPROBE_DEFER.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[sw0312.kim: post on mainline, https://patchwork.kernel.org/patch/11687251/ and apply]

Change-Id: I770815bd80af8ee0fa856f14d5d075d9471208c7

4 years agospi: bcm2835: no dev_err() on clk_get() -EPROBE_DEFER 22/239322/2
Jim Quinlan [Mon, 16 Dec 2019 23:08:02 +0000 (18:08 -0500)]
spi: bcm2835: no dev_err() on clk_get() -EPROBE_DEFER

Use dev_dbg() on -EPROBE_DEFER and dev_err() on all
other errors.

Signed-off-by: Jim Quinlan <jquinlan@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20191216230802.45715-2-jquinlan@broadcom.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[sw0312.kim: cherry-pick mainline commit f4dc4abdce4c to remove unnecessary message]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I43fda55a507e6f1371ed1fe33756d6fe823cfd2a