Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 6/6] ARM: dts: imx7s: add usb hsic phy domain
From: Fabio Estevam @ 2017-12-10 15:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205222707.11302-7-tyler@opensourcefoundries.com>

On Tue, Dec 5, 2017 at 8:27 PM,  <tyler@opensourcefoundries.com> wrote:
> From: Tyler Baker <tyler@opensourcefoundries.com>
>
> The GPCv2 driver should control the MIPI, PCIe,
> and USB HSIC PHY regulators. Add the USB HSIC
> power domain to the GPC node.
>
> Signed-off-by: Tyler Baker <tyler@opensourcefoundries.com>

Looks good. I am assuming you tested USB HSIC operation on the mx7
compulab board, right?

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

^ permalink raw reply

* [PATCH v1 5/6] ARM: dts: imx7d-sbc-iot: enable PCIe peripheral
From: Fabio Estevam @ 2017-12-10 15:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205222707.11302-6-tyler@opensourcefoundries.com>

On Tue, Dec 5, 2017 at 8:27 PM,  <tyler@opensourcefoundries.com> wrote:
> From: Tyler Baker <tyler@opensourcefoundries.com>
>
> Add a PCIe device tree node to enable PCIe support.
>
> Signed-off-by: Tyler Baker <tyler@opensourcefoundries.com>

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

^ permalink raw reply

* [PATCH v1 4/6] ARM: dts: imx7s: add node and supplies for vdd1p2
From: Fabio Estevam @ 2017-12-10 15:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205222707.11302-5-tyler@opensourcefoundries.com>

On Tue, Dec 5, 2017 at 8:27 PM,  <tyler@opensourcefoundries.com> wrote:
> From: Tyler Baker <tyler@opensourcefoundries.com>
>
> Add the regulator nodes and supplies for vdd1p2. This regulator is
> used to power the GPC and USB HSIC PHY.
>
> Signed-off-by: Tyler Baker <tyler@opensourcefoundries.com>
> ---
>  arch/arm/boot/dts/imx7s.dtsi | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index 7b85659..151ab34 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -522,6 +522,20 @@
>                                         anatop-max-voltage = <1200000>;
>                                         anatop-enable-bit = <0>;
>                                 };
> +
> +                               reg_1p2: regulator-vdd1p2 at 220 {

Using a unit address without a corresponding reg would give you a
warning with W=1.

Please see the patch I sent with Subject:
ARM: dts: imx7s: Add unit address and reg for the anatop nodes

^ permalink raw reply

* [PATCH v1 3/6] ARM: dts: imx7s: add dma support
From: Fabio Estevam @ 2017-12-10 15:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205222707.11302-4-tyler@opensourcefoundries.com>

On Tue, Dec 5, 2017 at 8:27 PM,  <tyler@opensourcefoundries.com> wrote:
> From: Tyler Baker <tyler@opensourcefoundries.com>
>
> Enable dma on all SPI interfaces.
>
> Signed-off-by: Tyler Baker <tyler@opensourcefoundries.com>

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

^ permalink raw reply

* [PATCH v1 2/6] ARM: dts: imx7d-cl-som: add nodes for usbh, and usbotg2
From: Fabio Estevam @ 2017-12-10 15:14 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205222707.11302-3-tyler@opensourcefoundries.com>

On Tue, Dec 5, 2017 at 8:27 PM,  <tyler@opensourcefoundries.com> wrote:
> From: Tyler Baker <tyler@opensourcefoundries.com>
>
> Add device tree nodes for the USB hub, and USB OTG. i2c2 on this
> platform supports low state retention power state so lets use it.

Looks like the I2C2 fix should be a separate patch.

^ permalink raw reply

* [PATCH v1 1/6] ARM: dts: imx7d-sbc-iot: add initial iot gateway dts
From: Fabio Estevam @ 2017-12-10 15:10 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205222707.11302-2-tyler@opensourcefoundries.com>

On Tue, Dec 5, 2017 at 8:27 PM,  <tyler@opensourcefoundries.com> wrote:

> +&usdhc1 {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_usdhc1>;
> +       cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
> +       wp-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
> +       enable-sdio-wakeup;

This is a deprecated property.

Please use wakeup-source as stated in
Documentation/devicetree/bindings/mmc/mmc.txt

^ permalink raw reply

* [PATCH] arm: imx: suspend/resume: use outer_disable/resume
From: Peng Fan @ 2017-12-10 12:07 UTC (permalink / raw)
  To: linux-arm-kernel

Use outer_disable/resume for suspend/resume.
With the two APIs used, code could be simplified and easy to extend
to introduce l2c_write_sec for i.MX platforms when moving Linux Kernel
runs in non-secure world.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Dong Aisheng <aisheng.dong@nxp.com>
---
 arch/arm/mach-imx/pm-imx6.c      |  2 ++
 arch/arm/mach-imx/suspend-imx6.S | 24 ------------------------
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index ecdf071653d4..153a0afc7645 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -392,8 +392,10 @@ static int imx6q_pm_enter(suspend_state_t state)
 			imx6_enable_rbc(true);
 		imx_gpc_pre_suspend(true);
 		imx_anatop_pre_suspend();
+		outer_disable();
 		/* Zzz ... */
 		cpu_suspend(0, imx6q_suspend_finish);
+		outer_resume();
 		if (cpu_is_imx6q() || cpu_is_imx6dl())
 			imx_smp_prepare();
 		imx_anatop_post_resume();
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
index 76ee2ceec8d5..324f6b165e82 100644
--- a/arch/arm/mach-imx/suspend-imx6.S
+++ b/arch/arm/mach-imx/suspend-imx6.S
@@ -74,24 +74,6 @@
 
 	.align 3
 
-	.macro  sync_l2_cache
-
-	/* sync L2 cache to drain L2's buffers to DRAM. */
-#ifdef CONFIG_CACHE_L2X0
-	ldr	r11, [r0, #PM_INFO_MX6Q_L2_V_OFFSET]
-	teq	r11, #0
-	beq	6f
-	mov	r6, #0x0
-	str	r6, [r11, #L2X0_CACHE_SYNC]
-1:
-	ldr	r6, [r11, #L2X0_CACHE_SYNC]
-	ands	r6, r6, #0x1
-	bne	1b
-6:
-#endif
-
-	.endm
-
 	.macro	resume_mmdc
 
 	/* restore MMDC IO */
@@ -185,9 +167,6 @@ ENTRY(imx6_suspend)
 	str	r9, [r11, #MX6Q_SRC_GPR1]
 	str	r1, [r11, #MX6Q_SRC_GPR2]
 
-	/* need to sync L2 cache before DSM. */
-	sync_l2_cache
-
 	ldr	r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET]
 	/*
 	 * put DDR explicitly into self-refresh and
@@ -342,8 +321,5 @@ ENDPROC(imx6_suspend)
 
 ENTRY(v7_cpu_resume)
 	bl	v7_invalidate_l1
-#ifdef CONFIG_CACHE_L2X0
-	bl	l2c310_early_resume
-#endif
 	b	cpu_resume
 ENDPROC(v7_cpu_resume)
-- 
2.14.1

^ permalink raw reply related

* WARNING: suspicious RCU usage
From: Russell King - ARM Linux @ 2017-12-10 12:00 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171210113930.zimywmxzsutwzzmz@linux-u7w5.ap.freescale.net>

+Paul

Annoyingly, it looks like calling "complete()" from a dying CPU is
triggering the RCU usage warning.  From what I remember, this is an
old problem, and we still have no better solution for this other than
to persist with the warning.

I suspect the following lockdep warning is triggered by the RCU code
bringing the console semaphore into the mix of locks.

On Sun, Dec 10, 2017 at 07:39:33PM +0800, Peng Fan wrote:
> Hi All,
> 
> I met an RCU warning when test suspend/resume on i.MX6Q-SDB(4 cortex-A9 cores).
> The suspend/resume function still work, but I do not have good idea about
> the RCU warning. Please help if you any ideas.
> 
> The defconfig is imx_v6_v7_defconfig of "4.15.0-rc2-00483-g4ded3bec65a0"
> 
> Test log:
> root at imx6qpdlsolox:~# /unit_tests/Power_Management/suspend_quick_auto.sh
> 
> ---- Running < suspend_quick_auto.sh > test ----
> 
> ---- Running < /unit_tests/SRTC/rtcwakeup.out > test ----
> 
> rtcwakeup.out: wakeup from "mem" using rtc0 at Thu Sep  7 00:06:21 2017
> [   21.688752] PM: suspend entry (deep)
> [   21.693550] PM: Syncing filesystems ... done.
> [   21.728528] Freezing user space processes ... (elapsed 0.002 seconds) done.
> [   21.739020] OOM killer disabled.
> [   21.742326] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
> [   21.816672] PM: suspend devices took 0.060 seconds
> [   21.832558] Disabling non-boot CPUs ...
> [   21.932773]
> [   21.933333] =============================
> [   21.933338] WARNING: suspicious RCU usage
> [   21.933342] 4.15.0-rc2-00483-g4ded3bec65a0 #85 Not tainted
> [   21.933348] -----------------------------
> [   21.933354] kernel/sched/fair.c:6333 suspicious rcu_dereference_check() usage!
> [   21.933358]
> [   21.933358] other info that might help us debug this:
> [   21.933358]
> [   21.933364]
> [   21.933364] RCU used illegally from offline CPU!
> [   21.933364] rcu_scheduler_active = 2, debug_locks = 0
> [   21.933369] 3 locks held by swapper/2/0:
> [   21.933373]  #0:  ((cpu_died).wait.lock){....}, at: [<4f528fc4>] complete+0x1c/0x58
> [   21.933396]  #1:  (&p->pi_lock){-.-.}, at: [<656ae3ef>] try_to_wake_up+0x28/0x368
> [   21.933415]  #2:  (rcu_read_lock){....}, at: [<73be2596>] select_task_rq_fair+0x150/0xf0c
> [   21.933433]
> [   21.933433] stack backtrace:
> [   21.933441] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.15.0-rc2-00483-g4ded3bec65a0 #85
> [   21.933445] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> [   21.933448] Backtrace:
> [   21.933459] [<c010c890>] (dump_backtrace) from [<c010cb60>] (show_stack+0x18/0x1c)
> [   21.933466]  r7:00000000 r6:60070093 r5:00000000 r4:c107bd50
> [   21.933475] [<c010cb48>] (show_stack) from [<c09eca50>] (dump_stack+0xb4/0xe8)
> [   21.933484] [<c09ec99c>] (dump_stack) from [<c016e47c>] (lockdep_rcu_suspicious+0xb0/0x110)
> [   21.933493]  r9:c0f7a380 r8:c107cd92 r7:c0cfc5c8 r6:000018bd r5:c0cff438 r4:ec0a0cc0
> [   21.933503] [<c016e3cc>] (lockdep_rcu_suspicious) from [<c015a4e8>] (select_task_rq_fair+0xcf8/0xf0c)
> [   21.933509]  r7:00000000 r6:00000000 r5:00000000 r4:00000000
> [   21.933518] [<c01597f0>] (select_task_rq_fair) from [<c01505e4>] (try_to_wake_up+0x108/0x368)
> [   21.933526]  r10:c1009290 r9:c0f7a380 r8:c01597f0 r7:40070093 r6:ec8e1e00 r5:00000000
> [   21.933531]  r4:ec8e1980
> [   21.933540] [<c01504dc>] (try_to_wake_up) from [<c0150918>] (default_wake_function+0x14/0x18)
> [   21.933548]  r10:00000000 r9:00000000 r8:c0150904 r7:00000000 r6:c100e470 r5:00000001
> [   21.933552]  r4:c100e464
> [   21.933562] [<c0150904>] (default_wake_function) from [<c0166bd4>] (__wake_up_common+0x94/0x154)
> [   21.933572] [<c0166b40>] (__wake_up_common) from [<c0166d8c>] (__wake_up_locked+0x20/0x28)
> [   21.933580]  r10:00000000 r9:412fc09a r8:c0f79840 r7:c1009174 r6:60070093 r5:c100e44c
> [   21.933584]  r4:c100e448
> [   21.933594] [<c0166d6c>] (__wake_up_locked) from [<c0167970>] (complete+0x48/0x58)
> [   21.933605] [<c0167928>] (complete) from [<c010fb98>] (arch_cpu_idle_dead+0x3c/0xa4)
> [   21.933611]  r7:c1009174 r6:00000004 r5:00000002 r4:c0db0054
> [   21.933622] [<c010fb5c>] (arch_cpu_idle_dead) from [<c0167d2c>] (do_idle+0x170/0x230)
> [   21.933629]  r5:c1009128 r4:ec0b0000
> [   21.933638] [<c0167bbc>] (do_idle) from [<c0168178>] (cpu_startup_entry+0x20/0x24)
> [   21.933647]  r10:00000000 r9:412fc09a r8:1000406a r7:c107dbe0 r6:10c0387d r5:00000002
> [   21.933653]  r4:00000085 r3:ec0a0cc0
> [   21.933663] [<c0168158>] (cpu_startup_entry) from [<c010fd48>] (secondary_start_kernel+0x148/0x174)
> [   21.933672] [<c010fc00>] (secondary_start_kernel) from [<10101a0c>] (0x10101a0c)
> [   21.933677]  r5:00000051 r4:3c08c06a
> [   21.991289] Enabling non-boot CPUs ...
> [   22.278265] CPU1 is up
> [   22.281305] CPU2 is up
> [   22.284299] CPU3 is up
> [   23.183405]
> [   23.183409] ======================================================
> [   23.183413] WARNING: possible circular locking dependency detected
> [   23.183415] 4.15.0-rc2-00483-g4ded3bec65a0 #85 Not tainted
> [   23.183418] ------------------------------------------------------
> [   23.183421] swapper/2/0 is trying to acquire lock:
> [   23.183423]  ((console_sem).lock){....}, at: [<66600b38>] down_trylock+0x14/0x34
> [   23.183431]
> [   23.183433] but task is already holding lock:
> [   23.183435]  (&p->pi_lock){-.-.}, at: [<656ae3ef>] try_to_wake_up+0x28/0x368
> [   23.183442]
> [   23.183444] which lock already depends on the new lock.
> [   23.183446]
> [   23.183448]
> [   23.183450] the existing dependency chain (in reverse order) is:
> [   23.183452]
> [   23.183453] -> #1 (&p->pi_lock){-.-.}:
> [   23.183461]        lock_acquire+0x70/0x90
> [   23.183463]        _raw_spin_lock_irqsave+0x40/0x54
> [   23.183466]        try_to_wake_up+0x28/0x368
> [   23.183468]        wake_up_process+0x18/0x1c
> [   23.183470]        __up+0x3c/0x40
> [   23.183472]        up+0x54/0x68
> [   23.183474]        __up_console_sem+0x34/0x60
> [   23.183476]        console_unlock+0x374/0x4d0
> [   23.183478]        vprintk_emit+0x220/0x2bc
> [   23.183480]        dev_vprintk_emit+0x9c/0x1d4
> [   23.183483]        dev_printk_emit+0x28/0x30
> [   23.183485]        __dev_printk+0x4c/0x90
> [   23.183487]        dev_warn+0x3c/0x48
> [   23.183489]        _request_firmware+0x448/0x610
> [   23.183491]        request_firmware_work_func+0x34/0x6c
> [   23.183493]        process_one_work+0x254/0x4f0
> [   23.183496]        worker_thread+0x40/0x5a8
> [   23.183498]        kthread+0x144/0x194
> [   23.183500]        ret_from_fork+0x14/0x20
> [   23.183501]
> [   23.183503] -> #0 ((console_sem).lock){....}:
> [   23.183510]        __lock_acquire+0x131c/0x14a8
> [   23.183513]        lock_acquire+0x70/0x90
> [   23.183515]        _raw_spin_lock_irqsave+0x40/0x54
> [   23.183517]        down_trylock+0x14/0x34
> [   23.183519]        __down_trylock_console_sem+0x2c/0x88
> [   23.183522]        console_trylock+0x18/0x60
> [   23.183524]        vprintk_emit+0x214/0x2bc
> [   23.183526]        vprintk_default+0x28/0x30
> [   23.183528]        vprintk_func+0x78/0xcc
> [   23.183530]        printk+0x28/0x30
> [   23.183532]        lockdep_rcu_suspicious+0x30/0x110
> [   23.183535]        select_task_rq_fair+0xcf8/0xf0c
> [   23.183537]        try_to_wake_up+0x108/0x368
> [   23.183539]        default_wake_function+0x14/0x18
> [   23.183541]        __wake_up_common+0x94/0x154
> [   23.183543]        __wake_up_locked+0x20/0x28
> [   23.183545]        complete+0x48/0x58
> [   23.183548]        arch_cpu_idle_dead+0x3c/0xa4
> [   23.183550]        do_idle+0x170/0x230
> [   23.183552]        cpu_startup_entry+0x20/0x24
> [   23.183554]        secondary_start_kernel+0x148/0x174
> [   23.183556]        0x10101a0c
> [   23.183557]
> [   23.183560] other info that might help us debug this:
> [   23.183561]
> [   23.183563]  Possible unsafe locking scenario:
> [   23.183565]
> [   23.183567]        CPU0                    CPU1
> [   23.183569]        ----                    ----
> [   23.183571]   lock(&p->pi_lock);
> [   23.183576]                                lock((console_sem).lock);
> [   23.183581]                                lock(&p->pi_lock);
> [   23.183586]   lock((console_sem).lock);
> [   23.183590]
> [   23.183592]  *** DEADLOCK ***
> [   23.183594]
> [   23.183596] 3 locks held by swapper/2/0:
> [   23.183597]  #0:  ((cpu_died).wait.lock){....}, at: [<4f528fc4>] complete+0x1c/0x58
> [   23.183605]  #1:  (&p->pi_lock){-.-.}, at: [<656ae3ef>] try_to_wake_up+0x28/0x368
> [   23.183613]  #2:  (rcu_read_lock){....}, at: [<73be2596>] select_task_rq_fair+0x150/0xf0c
> [   23.183621]
> [   23.183623] stack backtrace:
> [   23.183626] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.15.0-rc2-00483-g4ded3bec65a0 #85
> [   23.183629] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> [   23.183630] Backtrace:
> [   23.183635] [<c010c890>] (dump_backtrace) from [<c010cb60>] (show_stack+0x18/0x1c)
> [   23.183638]  r7:00000000 r6:60070093 r5:00000000 r4:c107bd50
> [   23.183641] [<c010cb48>] (show_stack) from [<c09eca50>] (dump_stack+0xb4/0xe8)
> [   23.183643] [<c09ec99c>] (dump_stack) from [<c016e750>] (print_circular_bug+0x218/0x3c8)
> [   23.183646]  r9:00000000 r8:ec0a0cc0 r7:c11a4120 r6:c11a4120 r5:ec0a11e0 r4:c11a8700
> [   23.183649] [<c016e538>] (print_circular_bug) from [<c016f938>] (check_prev_add+0x42c/0x7b4)
> [   23.183652]  r10:c1029bac r9:ec0a0cc0 r8:ec0a11e0 r7:ec0a1220 r6:ec0a11e0 r5:00000000
> [   23.183654]  r4:ec0a0cc0 r3:ec0a11e0
> [   23.183657] [<c016f50c>] (check_prev_add) from [<c0172678>] (__lock_acquire+0x131c/0x14a8)
> [   23.183660]  r10:c1029bac r9:ec0a0cc0 r8:ec0a11e0 r7:c17cad80 r6:00000001 r5:00000000
> [   23.183661]  r4:ec0a1220
> [   23.183664] [<c017135c>] (__lock_acquire) from [<c017307c>] (lock_acquire+0x70/0x90)
> [   23.183667]  r10:00000000 r9:60070093 r8:00000001 r7:00000001 r6:60070093 r5:00000000
> [   23.183669]  r4:ffffe000
> [   23.183672] [<c017300c>] (lock_acquire) from [<c0a094dc>] (_raw_spin_lock_irqsave+0x40/0x54)
> [   23.183674]  r8:00000000 r7:00000004 r6:c016b368 r5:60070093 r4:c101ba28
> [   23.183677] [<c0a0949c>] (_raw_spin_lock_irqsave) from [<c016b368>] (down_trylock+0x14/0x34)
> [   23.183679]  r6:c017cb30 r5:c101ba28 r4:00000000
> [   23.183682] [<c016b354>] (down_trylock) from [<c017b684>] (__down_trylock_console_sem+0x2c/0x88)
> [   23.183684]  r5:60070093 r4:00000000
> [   23.183687] [<c017b658>] (__down_trylock_console_sem) from [<c017b6f8>] (console_trylock+0x18/0x60)
> [   23.183690]  r6:00000006 r5:c017cb30 r4:00000000
> [   23.183692] [<c017b6e0>] (console_trylock) from [<c017cb30>] (vprintk_emit+0x214/0x2bc)
> [   23.183694]  r5:00000000 r4:00000000
> [   23.183697] [<c017c91c>] (vprintk_emit) from [<c017cd74>] (vprintk_default+0x28/0x30)
> [   23.183700]  r10:ec8e1980 r9:c0f7a380 r8:c107cd92 r7:c0cfc5c8 r6:000018bd r5:c0cffdfc
> [   23.183702]  r4:c1009290
> [   23.183705] [<c017cd4c>] (vprintk_default) from [<c017e130>] (vprintk_func+0x78/0xcc)
> [   23.183707] [<c017e0b8>] (vprintk_func) from [<c017da50>] (printk+0x28/0x30)
> [   23.183709]  r5:c0cff438 r4:ec0a0cc0
> [   23.183712] [<c017da2c>] (printk) from [<c016e3fc>] (lockdep_rcu_suspicious+0x30/0x110)
> [   23.183715]  r3:ec0b1df0 r2:c0cfc5c8 r1:000018bd r0:c0cffdfc
> [   23.183718] [<c016e3cc>] (lockdep_rcu_suspicious) from [<c015a4e8>] (select_task_rq_fair+0xcf8/0xf0c)
> [   23.183720]  r7:00000000 r6:00000000 r5:00000000 r4:00000000
> [   23.183723] [<c01597f0>] (select_task_rq_fair) from [<c01505e4>] (try_to_wake_up+0x108/0x368)
> [   23.183726]  r10:c1009290 r9:c0f7a380 r8:c01597f0 r7:40070093 r6:ec8e1e00 r5:00000000
> [   23.183728]  r4:ec8e1980
> [   23.183731] [<c01504dc>] (try_to_wake_up) from [<c0150918>] (default_wake_function+0x14/0x18)
> [   23.183734]  r10:00000000 r9:00000000 r8:c0150904 r7:00000000 r6:c100e470 r5:00000001
> [   23.183736]  r4:c100e464
> [   23.183739] [<c0150904>] (default_wake_function) from [<c0166bd4>] (__wake_up_common+0x94/0x154)
> [   23.183741] [<c0166b40>] (__wake_up_common) from [<c0166d8c>] (__wake_up_locked+0x20/0x28)
> [   23.183744]  r10:00000000 r9:412fc09a r8:c0f79840 r7:c1009174 r6:60070093 r5:c100e44c
> [   23.183746]  r4:c100e448
> [   23.183749] [<c0166d6c>] (__wake_up_locked) from [<c0167970>] (complete+0x48/0x58)
> [   23.183752] [<c0167928>] (complete) from [<c010fb98>] (arch_cpu_idle_dead+0x3c/0xa4)
> [   23.183754]  r7:c1009174 r6:00000004 r5:00000002 r4:c0db0054
> [   23.183757] [<c010fb5c>] (arch_cpu_idle_dead) from [<c0167d2c>] (do_idle+0x170/0x230)
> [   23.183759]  r5:c1009128 r4:ec0b0000
> [   23.183762] [<c0167bbc>] (do_idle) from [<c0168178>] (cpu_startup_entry+0x20/0x24)
> [   23.183765]  r10:00000000 r9:412fc09a r8:1000406a r7:c107dbe0 r6:10c0387d r5:00000002
> [   23.183767]  r4:00000085 r3:ec0a0cc0
> [   23.183770] [<c0168158>] (cpu_startup_entry) from [<c010fd48>] (secondary_start_kernel+0x148/0x174)
> [   23.183773] [<c010fc00>] (secondary_start_kernel) from [<10101a0c>] (0x10101a0c)
> [   23.183775]  r5:00000051 r4:3c08c06a
> [   23.471735] ata1: SATA link down (SStatus 0 SControl 300)
> [   23.899204] PM: resume devices took 0.750 seconds
> [   23.903961] OOM killer enabled.
> [   23.907111] Restarting tasks ... done.
> [   23.938591] PM: suspend exit
> ===============================
> suspend 1 times
> ===============================
> 
> Thanks,
> Peng.
> 
> -- 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

^ permalink raw reply

* WARNING: suspicious RCU usage
From: Peng Fan @ 2017-12-10 11:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi All,

I met an RCU warning when test suspend/resume on i.MX6Q-SDB(4 cortex-A9 cores).
The suspend/resume function still work, but I do not have good idea about
the RCU warning. Please help if you any ideas.

The defconfig is imx_v6_v7_defconfig of "4.15.0-rc2-00483-g4ded3bec65a0"

Test log:
root at imx6qpdlsolox:~# /unit_tests/Power_Management/suspend_quick_auto.sh

---- Running < suspend_quick_auto.sh > test ----

---- Running < /unit_tests/SRTC/rtcwakeup.out > test ----

rtcwakeup.out: wakeup from "mem" using rtc0 at Thu Sep  7 00:06:21 2017
[   21.688752] PM: suspend entry (deep)
[   21.693550] PM: Syncing filesystems ... done.
[   21.728528] Freezing user space processes ... (elapsed 0.002 seconds) done.
[   21.739020] OOM killer disabled.
[   21.742326] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
[   21.816672] PM: suspend devices took 0.060 seconds
[   21.832558] Disabling non-boot CPUs ...
[   21.932773]
[   21.933333] =============================
[   21.933338] WARNING: suspicious RCU usage
[   21.933342] 4.15.0-rc2-00483-g4ded3bec65a0 #85 Not tainted
[   21.933348] -----------------------------
[   21.933354] kernel/sched/fair.c:6333 suspicious rcu_dereference_check() usage!
[   21.933358]
[   21.933358] other info that might help us debug this:
[   21.933358]
[   21.933364]
[   21.933364] RCU used illegally from offline CPU!
[   21.933364] rcu_scheduler_active = 2, debug_locks = 0
[   21.933369] 3 locks held by swapper/2/0:
[   21.933373]  #0:  ((cpu_died).wait.lock){....}, at: [<4f528fc4>] complete+0x1c/0x58
[   21.933396]  #1:  (&p->pi_lock){-.-.}, at: [<656ae3ef>] try_to_wake_up+0x28/0x368
[   21.933415]  #2:  (rcu_read_lock){....}, at: [<73be2596>] select_task_rq_fair+0x150/0xf0c
[   21.933433]
[   21.933433] stack backtrace:
[   21.933441] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.15.0-rc2-00483-g4ded3bec65a0 #85
[   21.933445] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   21.933448] Backtrace:
[   21.933459] [<c010c890>] (dump_backtrace) from [<c010cb60>] (show_stack+0x18/0x1c)
[   21.933466]  r7:00000000 r6:60070093 r5:00000000 r4:c107bd50
[   21.933475] [<c010cb48>] (show_stack) from [<c09eca50>] (dump_stack+0xb4/0xe8)
[   21.933484] [<c09ec99c>] (dump_stack) from [<c016e47c>] (lockdep_rcu_suspicious+0xb0/0x110)
[   21.933493]  r9:c0f7a380 r8:c107cd92 r7:c0cfc5c8 r6:000018bd r5:c0cff438 r4:ec0a0cc0
[   21.933503] [<c016e3cc>] (lockdep_rcu_suspicious) from [<c015a4e8>] (select_task_rq_fair+0xcf8/0xf0c)
[   21.933509]  r7:00000000 r6:00000000 r5:00000000 r4:00000000
[   21.933518] [<c01597f0>] (select_task_rq_fair) from [<c01505e4>] (try_to_wake_up+0x108/0x368)
[   21.933526]  r10:c1009290 r9:c0f7a380 r8:c01597f0 r7:40070093 r6:ec8e1e00 r5:00000000
[   21.933531]  r4:ec8e1980
[   21.933540] [<c01504dc>] (try_to_wake_up) from [<c0150918>] (default_wake_function+0x14/0x18)
[   21.933548]  r10:00000000 r9:00000000 r8:c0150904 r7:00000000 r6:c100e470 r5:00000001
[   21.933552]  r4:c100e464
[   21.933562] [<c0150904>] (default_wake_function) from [<c0166bd4>] (__wake_up_common+0x94/0x154)
[   21.933572] [<c0166b40>] (__wake_up_common) from [<c0166d8c>] (__wake_up_locked+0x20/0x28)
[   21.933580]  r10:00000000 r9:412fc09a r8:c0f79840 r7:c1009174 r6:60070093 r5:c100e44c
[   21.933584]  r4:c100e448
[   21.933594] [<c0166d6c>] (__wake_up_locked) from [<c0167970>] (complete+0x48/0x58)
[   21.933605] [<c0167928>] (complete) from [<c010fb98>] (arch_cpu_idle_dead+0x3c/0xa4)
[   21.933611]  r7:c1009174 r6:00000004 r5:00000002 r4:c0db0054
[   21.933622] [<c010fb5c>] (arch_cpu_idle_dead) from [<c0167d2c>] (do_idle+0x170/0x230)
[   21.933629]  r5:c1009128 r4:ec0b0000
[   21.933638] [<c0167bbc>] (do_idle) from [<c0168178>] (cpu_startup_entry+0x20/0x24)
[   21.933647]  r10:00000000 r9:412fc09a r8:1000406a r7:c107dbe0 r6:10c0387d r5:00000002
[   21.933653]  r4:00000085 r3:ec0a0cc0
[   21.933663] [<c0168158>] (cpu_startup_entry) from [<c010fd48>] (secondary_start_kernel+0x148/0x174)
[   21.933672] [<c010fc00>] (secondary_start_kernel) from [<10101a0c>] (0x10101a0c)
[   21.933677]  r5:00000051 r4:3c08c06a
[   21.991289] Enabling non-boot CPUs ...
[   22.278265] CPU1 is up
[   22.281305] CPU2 is up
[   22.284299] CPU3 is up
[   23.183405]
[   23.183409] ======================================================
[   23.183413] WARNING: possible circular locking dependency detected
[   23.183415] 4.15.0-rc2-00483-g4ded3bec65a0 #85 Not tainted
[   23.183418] ------------------------------------------------------
[   23.183421] swapper/2/0 is trying to acquire lock:
[   23.183423]  ((console_sem).lock){....}, at: [<66600b38>] down_trylock+0x14/0x34
[   23.183431]
[   23.183433] but task is already holding lock:
[   23.183435]  (&p->pi_lock){-.-.}, at: [<656ae3ef>] try_to_wake_up+0x28/0x368
[   23.183442]
[   23.183444] which lock already depends on the new lock.
[   23.183446]
[   23.183448]
[   23.183450] the existing dependency chain (in reverse order) is:
[   23.183452]
[   23.183453] -> #1 (&p->pi_lock){-.-.}:
[   23.183461]        lock_acquire+0x70/0x90
[   23.183463]        _raw_spin_lock_irqsave+0x40/0x54
[   23.183466]        try_to_wake_up+0x28/0x368
[   23.183468]        wake_up_process+0x18/0x1c
[   23.183470]        __up+0x3c/0x40
[   23.183472]        up+0x54/0x68
[   23.183474]        __up_console_sem+0x34/0x60
[   23.183476]        console_unlock+0x374/0x4d0
[   23.183478]        vprintk_emit+0x220/0x2bc
[   23.183480]        dev_vprintk_emit+0x9c/0x1d4
[   23.183483]        dev_printk_emit+0x28/0x30
[   23.183485]        __dev_printk+0x4c/0x90
[   23.183487]        dev_warn+0x3c/0x48
[   23.183489]        _request_firmware+0x448/0x610
[   23.183491]        request_firmware_work_func+0x34/0x6c
[   23.183493]        process_one_work+0x254/0x4f0
[   23.183496]        worker_thread+0x40/0x5a8
[   23.183498]        kthread+0x144/0x194
[   23.183500]        ret_from_fork+0x14/0x20
[   23.183501]
[   23.183503] -> #0 ((console_sem).lock){....}:
[   23.183510]        __lock_acquire+0x131c/0x14a8
[   23.183513]        lock_acquire+0x70/0x90
[   23.183515]        _raw_spin_lock_irqsave+0x40/0x54
[   23.183517]        down_trylock+0x14/0x34
[   23.183519]        __down_trylock_console_sem+0x2c/0x88
[   23.183522]        console_trylock+0x18/0x60
[   23.183524]        vprintk_emit+0x214/0x2bc
[   23.183526]        vprintk_default+0x28/0x30
[   23.183528]        vprintk_func+0x78/0xcc
[   23.183530]        printk+0x28/0x30
[   23.183532]        lockdep_rcu_suspicious+0x30/0x110
[   23.183535]        select_task_rq_fair+0xcf8/0xf0c
[   23.183537]        try_to_wake_up+0x108/0x368
[   23.183539]        default_wake_function+0x14/0x18
[   23.183541]        __wake_up_common+0x94/0x154
[   23.183543]        __wake_up_locked+0x20/0x28
[   23.183545]        complete+0x48/0x58
[   23.183548]        arch_cpu_idle_dead+0x3c/0xa4
[   23.183550]        do_idle+0x170/0x230
[   23.183552]        cpu_startup_entry+0x20/0x24
[   23.183554]        secondary_start_kernel+0x148/0x174
[   23.183556]        0x10101a0c
[   23.183557]
[   23.183560] other info that might help us debug this:
[   23.183561]
[   23.183563]  Possible unsafe locking scenario:
[   23.183565]
[   23.183567]        CPU0                    CPU1
[   23.183569]        ----                    ----
[   23.183571]   lock(&p->pi_lock);
[   23.183576]                                lock((console_sem).lock);
[   23.183581]                                lock(&p->pi_lock);
[   23.183586]   lock((console_sem).lock);
[   23.183590]
[   23.183592]  *** DEADLOCK ***
[   23.183594]
[   23.183596] 3 locks held by swapper/2/0:
[   23.183597]  #0:  ((cpu_died).wait.lock){....}, at: [<4f528fc4>] complete+0x1c/0x58
[   23.183605]  #1:  (&p->pi_lock){-.-.}, at: [<656ae3ef>] try_to_wake_up+0x28/0x368
[   23.183613]  #2:  (rcu_read_lock){....}, at: [<73be2596>] select_task_rq_fair+0x150/0xf0c
[   23.183621]
[   23.183623] stack backtrace:
[   23.183626] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.15.0-rc2-00483-g4ded3bec65a0 #85
[   23.183629] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   23.183630] Backtrace:
[   23.183635] [<c010c890>] (dump_backtrace) from [<c010cb60>] (show_stack+0x18/0x1c)
[   23.183638]  r7:00000000 r6:60070093 r5:00000000 r4:c107bd50
[   23.183641] [<c010cb48>] (show_stack) from [<c09eca50>] (dump_stack+0xb4/0xe8)
[   23.183643] [<c09ec99c>] (dump_stack) from [<c016e750>] (print_circular_bug+0x218/0x3c8)
[   23.183646]  r9:00000000 r8:ec0a0cc0 r7:c11a4120 r6:c11a4120 r5:ec0a11e0 r4:c11a8700
[   23.183649] [<c016e538>] (print_circular_bug) from [<c016f938>] (check_prev_add+0x42c/0x7b4)
[   23.183652]  r10:c1029bac r9:ec0a0cc0 r8:ec0a11e0 r7:ec0a1220 r6:ec0a11e0 r5:00000000
[   23.183654]  r4:ec0a0cc0 r3:ec0a11e0
[   23.183657] [<c016f50c>] (check_prev_add) from [<c0172678>] (__lock_acquire+0x131c/0x14a8)
[   23.183660]  r10:c1029bac r9:ec0a0cc0 r8:ec0a11e0 r7:c17cad80 r6:00000001 r5:00000000
[   23.183661]  r4:ec0a1220
[   23.183664] [<c017135c>] (__lock_acquire) from [<c017307c>] (lock_acquire+0x70/0x90)
[   23.183667]  r10:00000000 r9:60070093 r8:00000001 r7:00000001 r6:60070093 r5:00000000
[   23.183669]  r4:ffffe000
[   23.183672] [<c017300c>] (lock_acquire) from [<c0a094dc>] (_raw_spin_lock_irqsave+0x40/0x54)
[   23.183674]  r8:00000000 r7:00000004 r6:c016b368 r5:60070093 r4:c101ba28
[   23.183677] [<c0a0949c>] (_raw_spin_lock_irqsave) from [<c016b368>] (down_trylock+0x14/0x34)
[   23.183679]  r6:c017cb30 r5:c101ba28 r4:00000000
[   23.183682] [<c016b354>] (down_trylock) from [<c017b684>] (__down_trylock_console_sem+0x2c/0x88)
[   23.183684]  r5:60070093 r4:00000000
[   23.183687] [<c017b658>] (__down_trylock_console_sem) from [<c017b6f8>] (console_trylock+0x18/0x60)
[   23.183690]  r6:00000006 r5:c017cb30 r4:00000000
[   23.183692] [<c017b6e0>] (console_trylock) from [<c017cb30>] (vprintk_emit+0x214/0x2bc)
[   23.183694]  r5:00000000 r4:00000000
[   23.183697] [<c017c91c>] (vprintk_emit) from [<c017cd74>] (vprintk_default+0x28/0x30)
[   23.183700]  r10:ec8e1980 r9:c0f7a380 r8:c107cd92 r7:c0cfc5c8 r6:000018bd r5:c0cffdfc
[   23.183702]  r4:c1009290
[   23.183705] [<c017cd4c>] (vprintk_default) from [<c017e130>] (vprintk_func+0x78/0xcc)
[   23.183707] [<c017e0b8>] (vprintk_func) from [<c017da50>] (printk+0x28/0x30)
[   23.183709]  r5:c0cff438 r4:ec0a0cc0
[   23.183712] [<c017da2c>] (printk) from [<c016e3fc>] (lockdep_rcu_suspicious+0x30/0x110)
[   23.183715]  r3:ec0b1df0 r2:c0cfc5c8 r1:000018bd r0:c0cffdfc
[   23.183718] [<c016e3cc>] (lockdep_rcu_suspicious) from [<c015a4e8>] (select_task_rq_fair+0xcf8/0xf0c)
[   23.183720]  r7:00000000 r6:00000000 r5:00000000 r4:00000000
[   23.183723] [<c01597f0>] (select_task_rq_fair) from [<c01505e4>] (try_to_wake_up+0x108/0x368)
[   23.183726]  r10:c1009290 r9:c0f7a380 r8:c01597f0 r7:40070093 r6:ec8e1e00 r5:00000000
[   23.183728]  r4:ec8e1980
[   23.183731] [<c01504dc>] (try_to_wake_up) from [<c0150918>] (default_wake_function+0x14/0x18)
[   23.183734]  r10:00000000 r9:00000000 r8:c0150904 r7:00000000 r6:c100e470 r5:00000001
[   23.183736]  r4:c100e464
[   23.183739] [<c0150904>] (default_wake_function) from [<c0166bd4>] (__wake_up_common+0x94/0x154)
[   23.183741] [<c0166b40>] (__wake_up_common) from [<c0166d8c>] (__wake_up_locked+0x20/0x28)
[   23.183744]  r10:00000000 r9:412fc09a r8:c0f79840 r7:c1009174 r6:60070093 r5:c100e44c
[   23.183746]  r4:c100e448
[   23.183749] [<c0166d6c>] (__wake_up_locked) from [<c0167970>] (complete+0x48/0x58)
[   23.183752] [<c0167928>] (complete) from [<c010fb98>] (arch_cpu_idle_dead+0x3c/0xa4)
[   23.183754]  r7:c1009174 r6:00000004 r5:00000002 r4:c0db0054
[   23.183757] [<c010fb5c>] (arch_cpu_idle_dead) from [<c0167d2c>] (do_idle+0x170/0x230)
[   23.183759]  r5:c1009128 r4:ec0b0000
[   23.183762] [<c0167bbc>] (do_idle) from [<c0168178>] (cpu_startup_entry+0x20/0x24)
[   23.183765]  r10:00000000 r9:412fc09a r8:1000406a r7:c107dbe0 r6:10c0387d r5:00000002
[   23.183767]  r4:00000085 r3:ec0a0cc0
[   23.183770] [<c0168158>] (cpu_startup_entry) from [<c010fd48>] (secondary_start_kernel+0x148/0x174)
[   23.183773] [<c010fc00>] (secondary_start_kernel) from [<10101a0c>] (0x10101a0c)
[   23.183775]  r5:00000051 r4:3c08c06a
[   23.471735] ata1: SATA link down (SStatus 0 SControl 300)
[   23.899204] PM: resume devices took 0.750 seconds
[   23.903961] OOM killer enabled.
[   23.907111] Restarting tasks ... done.
[   23.938591] PM: suspend exit
===============================
suspend 1 times
===============================

Thanks,
Peng.

-- 

^ permalink raw reply

* [GIT PULL] ARM: SoC fixes
From: Olof Johansson @ 2017-12-10  5:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus,

The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:

  Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git tags/armsoc-fixes

for you to fetch changes up to 8be0b9886b6470a1261c9c2d0cfc1f0f89bf21b9:

  Merge branch 'fixes' into for-next (2017-12-09 20:23:58 -0800)

----------------------------------------------------------------
ARM: SoC fixes for 4.15-rc

ARM SoC fixes for this merge window:

 - A revert of all SCPI changes from the 4.15 merge window. They had
   regressions on the Amlogic platforms, and the submaintainer isn't
   around to fix these bugs due to vacation, etc. So we agreed to revert
   and revisit in next release cycle.

 - A series fixing a number of bugs for ARM CCN interconnect, around
   module unload, smp_processor_id() in preemptable context, and fixing
   some memory allocation failure checks.

 - A handful of devicetree fixes for different platforms, fixing
   warnings and errors that were previously ignored by the compiler.

 - The usual set of mostly minor fixes for different platforms.

----------------------------------------------------------------
Adam Ford (2):
      ARM: dts: logicpd-som-lv: Fix gpmc addresses for NAND and enet
      ARM: dts: logicpd-somlv: Fix wl127x pinmux

Arnaud Patard (1):
      meson-gx-socinfo: Fix package id parsing

Arnd Bergmann (3):
      ARM: dts: r8a779x: Add '#reset-cells' in cpg-mssr
      ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds
      Merge branch 'fixes' into for-next

Arvind Yadav (1):
      bus: arm-ccn: constify attribute_group structures.

Christophe JAILLET (2):
      bus: arm-ccn: Check memory allocation failure
      bus: arm-ccn: Simplify code

Colin Ian King (1):
      ARM: meson: fix spelling mistake: "Couln't" -> "Couldn't"

Dai Okamura (1):
      arm64: dts: uniphier: correct on-board device IRQ number for PXs3

Dan Carpenter (1):
      ARM: OMAP2+: Missing error code in omap_device_build()

Fabio Estevam (2):
      ARM: dts: vf610-zii-dev-rev-c: Fix the I2C EEPROM address
      Revert "ARM: dts: imx53: add srtc node"

Florian Fainelli (3):
      ARM: dts: NSP: Disable AHCI controller for HR NSP boards
      ARM: dts: NSP: Fix PPI interrupt types
      Merge tag 'bcm2835-dt-next-fixes-2017-11-15' into devicetree/fixes

Jens Wiklander (1):
      optee: fix invalid of_node_put() in optee_driver_init()

Keerthy (1):
      ARM: AM33xx: PRM: Remove am33xx_pwrdm_read_prev_pwrst function

Kim Phillips (1):
      bus: arm-ccn: fix module unloading Error: Removing state 147 which has instances left.

Marc Zyngier (2):
      bus: arm-ccn: Fix use of smp_processor_id() in preemptible context
      bus: arm-cci: Fix use of smp_processor_id() in preemptible context

Martin Blumenstingl (2):
      ARM: dts: meson: correct the sort order for the the gpio_intc node
      ARM: dts: meson: fix the memory region of the GPIO interrupt controller

Masahiro Yamada (3):
      arm64: dts: uniphier: remove unnecessary interrupt-parent
      MAINTAINERS: exclude other Socionext SoC DT files from ARM/UNIPHIER entry
      arm64: dts: sort vendor subdirectories in Makefile alphabetically

Neil Armstrong (1):
      ARM64: dts: meson-gx: fix UART pclk clock name

Olof Johansson (12):
      Merge tag 'renesas-dt-fixes-for-v4.15' of https://git.kernel.org/.../horms/renesas into fixes
      Merge tag 'arm-soc/for-4.15/devicetree-fixes-1' of http://github.com/Broadcom/stblinux into fixes
      Merge tag 'tee-drv-fix-for-4.15' of https://git.linaro.org/people/jens.wiklander/linux-tee into fixes
      Merge tag 'uniphier-fixes-v4.15' of git://git.kernel.org/.../masahiroy/linux-uniphier into fixes
      Merge tag 'imx-fixes-4.15' of git://git.kernel.org/.../shawnguo/linux into fixes
      Merge tag 'omap-for-v4.15/fixes-v2-signed' of git://git.kernel.org/.../tmlind/linux-omap into fixes
      firmware: arm_scpi: Revert updates made during v4.15 merge window
      Merge branch 'fixes' into for-next
      Merge tag 'omap-for-v4.15/fixes-dt-warnings' of git://git.kernel.org/.../tmlind/linux-omap into fixes
      Merge tag 'ccn/fixes-for-4.15' of git://git.linaro.org/people/pawel.moll/linux into fixes
      Merge tag 'amlogic-fixes-1' of git://git.kernel.org/.../khilman/linux-amlogic into fixes
      Merge branch 'fixes' into for-next

Peter Ujfalusi (2):
      ARM: dts: am4372: Correct the interrupts_properties of McASP
      ARM: dts: am437x-cm-t43: Correct the dmas property of spi0

Rob Herring (4):
      ARM: dts: omap: Add missing #phy-cells to usb-nop-xceiv
      ARM: dts: am33xx: Add missing #phy-cells to ti,am335x-usb-phy
      arm: dts: marvell: Add missing #phy-cells to usb-nop-xceiv
      arm: dts: nspire: Add missing #phy-cells to usb-nop-xceiv

Stefan Wahren (1):
      ARM: dts: bcm283x: Fix DTC warnings about missing phy-cells

Tero Kristo (2):
      ARM: OMAP3: hwmod_data: add missing module_offs for MMC3
      ARM: OMAP2/3: CM: fix cm_split_idlest functionality

Tony Lindgren (10):
      ARM: OMAP2+: Fix smatch found issue for omap_device
      ARM: dts: Add remote-wakeup-connected for omap OHCI
      ARM: OMAP2+: Fix SRAM virt to phys translation for save_secure_ram_context
      ARM: dts: Fix omap4 hang with GPS connected to USB by using wakeupgen
      Merge branch 'soc-fixes' into omap-for-v4.15/fixes
      Merge branch 'dts-fixes' into omap-for-v4.15/fixes-dt
      Merge branch 'omap-for-v4.14/fixes' into omap-for-v4.15/fixes-v2
      Merge branch 'omap-for-v4.15/fixes-dt' into omap-for-v4.15/fixes-v2
      ARM: dts: Fix elm interrupt compiler warning
      ARM: dts: Fix dm814x missing phy-cells property

 .../devicetree/bindings/usb/am33xx-usb.txt         |   2 +
 MAINTAINERS                                        |   2 +-
 arch/arm/boot/dts/am33xx.dtsi                      |   2 +
 arch/arm/boot/dts/am4372.dtsi                      |   6 +-
 arch/arm/boot/dts/am437x-cm-t43.dts                |   4 +-
 arch/arm/boot/dts/armada-385-db-ap.dts             |   1 +
 arch/arm/boot/dts/armada-385-linksys.dtsi          |   1 +
 arch/arm/boot/dts/armada-385-synology-ds116.dts    |   2 +
 arch/arm/boot/dts/armada-388-gp.dts                |   2 +
 arch/arm/boot/dts/bcm-nsp.dtsi                     |   4 +-
 arch/arm/boot/dts/bcm283x.dtsi                     |   1 +
 arch/arm/boot/dts/bcm958623hr.dts                  |   4 -
 arch/arm/boot/dts/bcm958625hr.dts                  |   4 -
 arch/arm/boot/dts/dm814x.dtsi                      |   2 +
 arch/arm/boot/dts/imx53.dtsi                       |   9 -
 arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts   |   3 +-
 arch/arm/boot/dts/logicpd-som-lv.dtsi              |  17 +-
 arch/arm/boot/dts/meson.dtsi                       |  18 +-
 arch/arm/boot/dts/nspire.dtsi                      |   1 +
 arch/arm/boot/dts/omap3-beagle-xm.dts              |   1 +
 arch/arm/boot/dts/omap3-beagle.dts                 |   1 +
 arch/arm/boot/dts/omap3-cm-t3x.dtsi                |   2 +
 arch/arm/boot/dts/omap3-evm-common.dtsi            |   1 +
 arch/arm/boot/dts/omap3-gta04.dtsi                 |   1 +
 arch/arm/boot/dts/omap3-igep0020-common.dtsi       |   1 +
 arch/arm/boot/dts/omap3-igep0030-common.dtsi       |   1 +
 arch/arm/boot/dts/omap3-lilly-a83x.dtsi            |   1 +
 arch/arm/boot/dts/omap3-overo-base.dtsi            |   1 +
 arch/arm/boot/dts/omap3-pandora-common.dtsi        |   1 +
 arch/arm/boot/dts/omap3-tao3530.dtsi               |   1 +
 arch/arm/boot/dts/omap3.dtsi                       |   1 +
 arch/arm/boot/dts/omap4-droid4-xt894.dts           |   1 +
 arch/arm/boot/dts/omap4-duovero.dtsi               |   1 +
 arch/arm/boot/dts/omap4-panda-common.dtsi          |   1 +
 arch/arm/boot/dts/omap4-var-som-om44.dtsi          |   1 +
 arch/arm/boot/dts/omap4.dtsi                       |   5 +-
 arch/arm/boot/dts/omap5-board-common.dtsi          |   2 +
 arch/arm/boot/dts/omap5-cm-t54.dts                 |   2 +
 arch/arm/boot/dts/omap5.dtsi                       |   1 +
 arch/arm/boot/dts/r8a7790.dtsi                     |   1 +
 arch/arm/boot/dts/r8a7792.dtsi                     |   1 +
 arch/arm/boot/dts/r8a7793.dtsi                     |   1 +
 arch/arm/boot/dts/r8a7794.dtsi                     |   1 +
 arch/arm/boot/dts/vf610-zii-dev-rev-c.dts          |   2 +-
 arch/arm/mach-meson/platsmp.c                      |   2 +-
 arch/arm/mach-omap2/cm_common.c                    |   6 +-
 arch/arm/mach-omap2/omap-secure.c                  |  21 ++
 arch/arm/mach-omap2/omap-secure.h                  |   4 +
 arch/arm/mach-omap2/omap_device.c                  |  10 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |   1 +
 arch/arm/mach-omap2/pm.h                           |   4 -
 arch/arm/mach-omap2/pm34xx.c                       |  13 +-
 arch/arm/mach-omap2/prcm-common.h                  |   1 +
 arch/arm/mach-omap2/prm33xx.c                      |  12 --
 arch/arm/mach-omap2/sleep34xx.S                    |  26 +--
 arch/arm64/boot/dts/Makefile                       |   2 +-
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        |   4 +-
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         |   6 +-
 .../arm64/boot/dts/socionext/uniphier-ld11-ref.dts |   1 -
 .../arm64/boot/dts/socionext/uniphier-ld20-ref.dts |   1 -
 .../arm64/boot/dts/socionext/uniphier-pxs3-ref.dts |   3 +-
 drivers/bus/arm-cci.c                              |   7 +-
 drivers/bus/arm-ccn.c                              |  25 ++-
 drivers/firmware/arm_scpi.c                        | 216 ++++++++++++---------
 drivers/soc/amlogic/meson-gx-socinfo.c             |   4 +-
 drivers/tee/optee/core.c                           |   1 -
 66 files changed, 278 insertions(+), 210 deletions(-)

^ permalink raw reply

* [GIT PULL] Amlogic fixes for v4.15-rc (redo v2)
From: Olof Johansson @ 2017-12-10  4:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <7ha7ytm2tv.fsf@baylibre.com>

On Fri, Dec 08, 2017 at 11:34:04AM -0800, Kevin Hilman wrote:
> Arnd, Olof,
> 
> Here's a re-spin of the Amlogic fixes for v4.15-rc with the DT changes
> for new hardware dropped.  Will (re)send those for v4.16.
> 
> Also, since the last round, I've collected one more fix for a UART clock
> naming bug.
> 
> Kevin
> 
> The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:
> 
>   Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git tags/amlogic-fixes-1

Merged, thanks.


-Olof

^ permalink raw reply

* CC[NI] driver fixes for 4.15
From: Olof Johansson @ 2017-12-10  4:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512731264.3038.120.camel@arm.com>

On Fri, Dec 08, 2017 at 11:07:44AM +0000, Pawel Moll wrote:
> Hello,
> 
> A small series of fixes for the CCN driver, plus (one time only, guest
> staring) one for CCI.
> 
> Please consider pulling:
> 
> The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:
> 
>   Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)
> 
> are available in the git repository at:
> 
>   git://git.linaro.org/people/pawel.moll/linux.git tags/ccn/fixes-for-4.15


Merged, thanks.

^ permalink raw reply

* [GIT PULL] two dts compiler warning fixes for v4.15-rc cycle
From: Olof Johansson @ 2017-12-10  4:22 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <pull-1512681573-431149@atomide.com>

On Thu, Dec 07, 2017 at 01:19:59PM -0800, Tony Lindgren wrote:
> From: "Tony Lindgren" <tony@atomide.com>
> 
> The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:
> 
>   Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap tags/omap-for-v4.15/fixes-dt-warnings


Merged, thanks.


-Olof

^ permalink raw reply

* [PATCH 0/2] arm64 SMMUv3 PMU driver with IORT support
From: Linu Cherian @ 2017-12-10  2:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1501876754-1064-1-git-send-email-nleeder@codeaurora.org>

Hi,


On Fri Aug 04, 2017 at 03:59:12PM -0400, Neil Leeder wrote:
> This adds a driver for the SMMUv3 PMU into the perf framework.
> It includes an IORT update to support PM Counter Groups.
>

In one of Cavium's upcoming SOC, SMMU PMCG implementation is such a way
that platform bus id (Device ID in ITS terminmology)is shared with that of SMMU.
This would be a matter of concern for software if the SMMU and SMMU PMCG blocks
are managed by two independent drivers.

The problem arises when we want to alloc/free MSIs for these devices
using the APIs, platform_msi_domain_alloc/free_irqs. 
Platform bus id being same for these two hardware blocks, they end up sharing the same
ITT(Interrupt Translation Table) in GIC ITS and hence alloc, free and management 
of this shared ITT becomes a problem when they are managed by two independent
drivers.

We were looking into the option of keeping the SMMU PMCG nodes as sub nodes under
SMMUv3 node, so that SMMUv3 driver could probe and figure out the total vectors
required for SMMU PMCG devices and make a common platform_msi_domain_alloc/free_irqs
function call for all devices that share the platform bus id.

Would like to know your expert opinion on what would be the right approach 
to handle this case ?

Thanks.


 
> IORT has no mechanism for determining device names so PMUs
> are named based on their physical address. 
> 
> Tested on Qualcomm QDF2400. perf_fuzzer ran for 4+ hours
> with no failures.
> 
> Neil Leeder (2):
>   acpi: arm64: add iort support for PMCG
>   perf: add arm64 smmuv3 pmu driver
> 
>  drivers/acpi/arm64/iort.c     |  54 +++
>  drivers/perf/Kconfig          |   9 +
>  drivers/perf/Makefile         |   1 +
>  drivers/perf/arm_smmuv3_pmu.c | 823 ++++++++++++++++++++++++++++++++++++++++++
>  include/acpi/actbl2.h         |   9 +-
>  5 files changed, 895 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/perf/arm_smmuv3_pmu.c
> 
> -- 
> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies Inc.
> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project.
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Linu cherian

^ permalink raw reply

* [PATCH 00/12] Marvell NAND controller rework with ->exec_op()
From: Ezequiel Garcia @ 2017-12-09 23:27 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207201814.30411-1-miquel.raynal@free-electrons.com>

Miquel,

On 7 December 2017 at 17:18, Miquel Raynal
<miquel.raynal@free-electrons.com> wrote:
> Hi,
>
> After the addition of the NAND framework ->exec_op() interface (see [1]
> for the series preparing it and [2] for the last version of the
> core-side implementation of ->exec_op() itself), this series replaces
> the current Marvell NAND controller driver pxa3xx_nand.c with a rework
> called marvell_nand.c.
>

Nice to see this effort!

Unfortunately, I don't much time to spend reviewing this, but I'm super
happy to see a new driver fixing all the nasty issues the current one has.

Cheers,
-- 
Ezequiel Garc?a, VanguardiaSur
www.vanguardiasur.com.ar

^ permalink raw reply

* [PATCH net-next 2/2 v6] net: ethernet: Add a driver for Gemini gigabit ethernet
From: Linus Walleij @ 2017-12-09 23:27 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205190331.GA29007@qmqm.qmqm.pl>

On Tue, Dec 5, 2017 at 8:03 PM, Micha? Miros?aw <mirq-linux@rere.qmqm.pl> wrote:

> I'm happy to see that my work didn't go to /dev/null after all.
> I haven't finished it at the time because the box I had broke down
> beyond repair.

Ooops that explains why the submission was just haning in mid-air.
Sorry man :(

> I skimmed through the patch - please find my comments below.

Thanks a lot! :)

I fixed most of them for v8, just some comments:

> [...]
>> +static struct sk_buff *gmac_skb_if_good_frame(struct gemini_ethernet_port *port,
>> +     GMAC_RXDESC_0_T word0, unsigned frame_len)
>> +{
>> +     struct sk_buff *skb = NULL;
>> +     unsigned rx_status = word0.bits.status;
>> +     unsigned rx_csum = word0.bits.chksum_status;
>
>> +     port->rx_stats[rx_status]++;
>> +     port->rx_csum_stats[rx_csum]++;
>> +
>> +     if (word0.bits.derr || word0.bits.perr ||
>> +         rx_status || frame_len < ETH_ZLEN ||
>> +         rx_csum >= RX_CHKSUM_IP_ERR_UNKNOWN) {
>> +             port->stats.rx_errors++;
>> +
>> +             if (frame_len < ETH_ZLEN || RX_ERROR_LENGTH(rx_status))
>> +                     port->stats.rx_length_errors++;
>> +             if (RX_ERROR_OVER(rx_status))
>> +                     port->stats.rx_over_errors++;
>> +             if (RX_ERROR_CRC(rx_status))
>> +                     port->stats.rx_crc_errors++;
>> +             if (RX_ERROR_FRAME(rx_status))
>> +                     port->stats.rx_frame_errors++;
>> +
>> +             return NULL;
>
> Could support RXALL feature here.

Probably! I might experiment with it in a separate (follow up) patch
since I have to figure out how much the hardware supports ignoring
errors and exploit that properly.

>> +static unsigned int gmac_rx(struct net_device *netdev, unsigned budget)
>> +{
> [...]
>> +             if (unlikely(!mapping)) {
>> +                     netdev_err(netdev,
>> +                                "rxq[%u]: HW BUG: zero DMA desc\n", r);
>> +                     goto err_drop;
>> +             }
>
> I wonder if this was a bug in the driver or in HW. Does it trigger on
> your boxes?

No I haven't seen it. I think it may be a HW bug on elder chips
(before SL3512 and SL3516) that is just not manifesting on newer
hardware.

Better keep the code though.

>> +static void gmac_set_rx_mode(struct net_device *netdev)
>> +{
>> +     struct gemini_ethernet_port *port = netdev_priv(netdev);
>> +     struct netdev_hw_addr *ha;
>> +     __u32 mc_filter[2];
>> +     unsigned bit_nr;
>> +     GMAC_RX_FLTR_T filter = { .bits = {
>> +             .broadcast = 1,
>> +             .multicast = 1,
>> +             .unicast = 1,
>> +     } };
>> +
>> +     mc_filter[1] = mc_filter[0] = 0;
>
> Looks like this should be = ~0u (IFF_ALLMULTI case).

Yeah it's some error compared to the (horrible) vendor code
here. The vendor tree explicitly checks for both promiscuous
and multicast and sets the masks to ~0 in both cases
explicitly, else leave it as default 0 with the funky
algorithm to set up the mask bit by bit.

I rewrote this piece of code to do the same.

Yours,
Linus Walleij

^ permalink raw reply

* [PATCH 9/9] arm64: dts: allwinner: a64: Enable sound on Pine64 and SoPine
From: Vasily Khoruzhick @ 2017-12-09 19:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAGb2v65XC=0zwYu3Wjv0OcYrHfLbycBfaA4eW=HNN_8CzmcvRA@mail.gmail.com>

On Mon, Dec 4, 2017 at 7:24 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> On Mon, Dec 4, 2017 at 4:41 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>> This commit enables I2S, digital and analog parts of audiocodec on
>> Pine64 and SoPine boards.
>>
>> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
>> ---
>>  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts      | 16 ++++++++++++++++
>>  .../boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts   | 16 ++++++++++++++++
>>  2 files changed, 32 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
>> index 806442d3e846..369d9b749521 100644
>> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
>> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
>> @@ -64,6 +64,18 @@
>>         };
>>  };
>>
>> +&codec {
>> +       status = "okay";
>> +};
>> +
>> +&codec_analog {
>> +       status = "okay";
>> +};
>> +
>> +&dai {
>> +       status = "okay";
>> +};
>> +
>>  &ehci0 {
>>         status = "okay";
>>  };
>> @@ -229,6 +241,10 @@
>>         regulator-name = "vcc-rtc";
>>  };
>>
>> +&sound {
>> +       status = "okay";
>
> This is missing all the board level widgets and routing.
> Yes I know that it works right now, but that's because simple-card
> isn't a strict card, i.e. it doesn't force the need for actual inputs
> and outputs at both ends of the DAPM graph.
>
> Later on you'll find that missing the routing leaves the microphone
> unusable, because the microphone bias is not turned on.

sun8i-codec driver doesn't support capture at the moment. What else it
could be missing?

>
> ChenYu
>
>> +};
>> +
>>  /* On Exp and Euler connectors */
>>  &uart0 {
>>         pinctrl-names = "default";
>> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
>> index 0eb2acedf8c3..9de5ddcc3656 100644
>> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
>> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
>> @@ -69,6 +69,18 @@
>>         };
>>  };
>>
>> +&codec {
>> +       status = "okay";
>> +};
>> +
>> +&codec_analog {
>> +       status = "okay";
>> +};
>> +
>> +&dai {
>> +       status = "okay";
>> +};
>> +
>>  &ehci0 {
>>         status = "okay";
>>  };
>> @@ -133,6 +145,10 @@
>>         regulator-name = "vcc-wifi";
>>  };
>>
>> +&sound {
>> +       status = "okay";
>> +};
>> +
>>  &uart0 {
>>         pinctrl-names = "default";
>>         pinctrl-0 = <&uart0_pins_a>;
>> --
>> 2.15.0
>>

^ permalink raw reply

* [PATCH v2 08/36] KVM: arm64: Slightly improve debug save/restore functions
From: Marc Zyngier @ 2017-12-09 19:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207170630.592-9-christoffer.dall@linaro.org>

On Thu, 07 Dec 2017 17:06:02 +0000,
Christoffer Dall wrote:
> 
> The debug save/restore functions can be improved by using the has_vhe()
> static key instead of the instruction alternative.  Using the static key
> uses the same paradigm as we're going to use elsewhere, it makes the
> code more readable, and it generates slightly better code (no
> stack setups and function calls unless necessary).
> 
> We also use a static key on the restore path, because it will be
> marginally faster than loading a value from memory.
> 
> Finally, we don't have to conditionally clear the debug dirty flag if
> it's set, we can just clear it.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply

* [PATCH v2 07/36] KVM: arm64: Move debug dirty flag calculation out of world switch
From: Marc Zyngier @ 2017-12-09 19:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207170630.592-8-christoffer.dall@linaro.org>

On Thu, 07 Dec 2017 17:06:01 +0000,
Christoffer Dall wrote:
> 
> There is no need to figure out inside the world-switch if we should
> save/restore the debug registers or not, we can might as well do that in
> the higher level debug setup code, making it easier to optimize down the
> line.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply

* [Patch v6 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder
From: Stanimir Varbanov @ 2017-12-09 18:48 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512724105-1778-11-git-send-email-smitha.t@samsung.com>

Hi Smitha,

Thanks for the patches!

On 12/08/2017 11:08 AM, Smitha T Murthy wrote:
> Add v4l2 controls for HEVC encoder
> 
> Signed-off-by: Smitha T Murthy <smitha.t@samsung.com>
> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c | 118 +++++++++++++++++++++++++++++++++++
>  include/uapi/linux/v4l2-controls.h   |  92 ++++++++++++++++++++++++++-
>  2 files changed, 209 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 4e53a86..3f98318 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -480,6 +480,56 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>  		NULL,
>  	};
>  
> +	static const char * const hevc_profile[] = {
> +		"Main",

You forgot "Main 10" profile.

> +		"Main Still Picture",
> +		NULL,
> +	};
> +	static const char * const hevc_level[] = {
> +		"1",
> +		"2",
> +		"2.1",
> +		"3",
> +		"3.1",
> +		"4",
> +		"4.1",
> +		"5",
> +		"5.1",
> +		"5.2",
> +		"6",
> +		"6.1",
> +		"6.2",
> +		NULL,
> +	};
> +	static const char * const hevc_hierarchial_coding_type[] = {
> +		"B",
> +		"P",
> +		NULL,
> +	};
> +	static const char * const hevc_refresh_type[] = {
> +		"None",
> +		"CRA",
> +		"IDR",
> +		NULL,
> +	};
> +	static const char * const hevc_size_of_length_field[] = {
> +		"0",
> +		"1",
> +		"2",
> +		"4",
> +		NULL,
> +	};
> +	static const char * const hevc_tier_flag[] = {
> +		"Main",
> +		"High",
> +		NULL,
> +	};
> +	static const char * const hevc_loop_filter_mode[] = {
> +		"Disabled",
> +		"Enabled",
> +		"Disabled at slice boundary",
> +		"NULL",
> +	};
>  
>  	switch (id) {
>  	case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
> @@ -575,6 +625,20 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>  		return dv_it_content_type;
>  	case V4L2_CID_DETECT_MD_MODE:
>  		return detect_md_mode;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
> +		return hevc_profile;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
> +		return hevc_level;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE:
> +		return hevc_hierarchial_coding_type;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE:
> +		return hevc_refresh_type;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD:
> +		return hevc_size_of_length_field;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:

Could you drop _FLAG suffix? Looking (briefly) into the spec they not
specify `tier flag` but just `tier`.

> +		return hevc_tier_flag;
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE:
> +		return hevc_loop_filter_mode;
>  
>  	default:
>  		return NULL;
> @@ -776,6 +840,53 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:		return "VPX P-Frame QP Value";
>  	case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:			return "VPX Profile";
>  
> +	/* HEVC controls */
> +	case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP:		return "HEVC I-Frame QP Value";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP:		return "HEVC P-Frame QP Value";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP:		return "HEVC B-Frame QP Value";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP:			return "HEVC Minimum QP Value";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP:			return "HEVC Maximum QP Value";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:			return "HEVC Profile";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:			return "HEVC Level";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:		return "HEVC Tier Flag";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION:	return "HEVC Frame Rate Resolution";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH:	return "HEVC Maximum Coding Unit Depth";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE:		return "HEVC Refresh Type";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED:		return "HEVC Constant Intra Prediction";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU:		return "HEVC Lossless Encoding";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT:		return "HEVC Wavefront";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE:		return "HEVC Loop Filter";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP:			return "HEVC QP Values";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE:		return "HEVC Hierarchical Coding Type";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER:	return "HEVC Hierarchical Coding Layer";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_QP:	return "HEVC Hierarchical Lay 0 QP";

s/Lay/Layer here and below

> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_QP:	return "HEVC Hierarchical Lay 1 QP";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_QP:	return "HEVC Hierarchical Lay 2 QP";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_QP:	return "HEVC Hierarchical Lay 3 QP";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_QP:	return "HEVC Hierarchical Lay 4 QP";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_QP:	return "HEVC Hierarchical Lay 5 QP";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_QP:	return "HEVC Hierarchical Lay 6 QP";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BR:	return "HEVC Hierarchical Lay 0 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BR:	return "HEVC Hierarchical Lay 1 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BR:	return "HEVC Hierarchical Lay 2 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BR:	return "HEVC Hierarchical Lay 3 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BR:	return "HEVC Hierarchical Lay 4 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BR:	return "HEVC Hierarchical Lay 5 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR:	return "HEVC Hierarchical Lay 6 Bit Rate";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB:		return "HEVC General PB";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID:		return "HEVC Temporal ID";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING:		return "HEVC Strong Intra Smoothing";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT:		return "HEVC Intra PU Split";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION:		return "HEVC TMV Prediction";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1:	return "HEVC Max Number of Candidate MVs";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE:	return "HEVC ENC Without Startcode";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD:		return "HEVC Num of I-Frame b/w 2 IDR";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2:	return "HEVC Loop Filter Beta Offset";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2:	return "HEVC Loop Filter TC Offset";
> +	case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD:	return "HEVC Size of Length Field";
> +	case V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES:	return "Reference Frames for a P-Frame";
> +	case V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR:		return "Prepend SPS and PPS to IDR";
> +
>  	/* CAMERA controls */
>  	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
>  	case V4L2_CID_CAMERA_CLASS:		return "Camera Controls";
> @@ -1069,6 +1180,13 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  	case V4L2_CID_TUNE_DEEMPHASIS:
>  	case V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL:
>  	case V4L2_CID_DETECT_MD_MODE:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:
> +	case V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE:
>  		*type = V4L2_CTRL_TYPE_MENU;
>  		break;
>  	case V4L2_CID_LINK_FREQ:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index 31bfc68..a4b8489 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -588,6 +588,97 @@ enum v4l2_vp8_golden_frame_sel {
>  #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP		(V4L2_CID_MPEG_BASE+510)
>  #define V4L2_CID_MPEG_VIDEO_VPX_PROFILE			(V4L2_CID_MPEG_BASE+511)
>  
> +/* CIDs for HEVC encoding. Number gaps are for compatibility */
> +
> +#define V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP		(V4L2_CID_MPEG_BASE + 512)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP		(V4L2_CID_MPEG_BASE + 513)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP	(V4L2_CID_MPEG_BASE + 514)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP	(V4L2_CID_MPEG_BASE + 515)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP	(V4L2_CID_MPEG_BASE + 516)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP	(V4L2_CID_MPEG_BASE + 517)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE (V4L2_CID_MPEG_BASE + 518)
> +enum v4l2_mpeg_video_hevc_hier_coding_type {
> +	V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_B	= 0,
> +	V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_P	= 1,
> +};
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER	(V4L2_CID_MPEG_BASE + 519)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_QP	(V4L2_CID_MPEG_BASE + 520)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_QP	(V4L2_CID_MPEG_BASE + 521)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_QP	(V4L2_CID_MPEG_BASE + 522)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_QP	(V4L2_CID_MPEG_BASE + 523)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_QP	(V4L2_CID_MPEG_BASE + 524)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_QP	(V4L2_CID_MPEG_BASE + 525)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_QP	(V4L2_CID_MPEG_BASE + 526)
> +#define V4L2_CID_MPEG_VIDEO_HEVC_PROFILE	(V4L2_CID_MPEG_BASE + 527)
> +enum v4l2_mpeg_video_hevc_profile {
> +	V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN = 0,

you forgot V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN10 profile.

> +	V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE = 1,
> +};

<snip>

-- 
regards,
Stan

^ permalink raw reply

* Linux kernel configuration for MPS2 AN385
From: Guenter Roeck @ 2017-12-09 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi folks,

I am playing with qemu's mps2-an385 emulation and try to get Linux to boot with it,
so far with little (ie no) success.

Is a working kernel configuration for this board available somewhere ?

Thanks,
Guenter

^ permalink raw reply

* [PATCH v2 06/36] KVM: arm64: Defer restoring host VFP state to vcpu_put
From: Marc Zyngier @ 2017-12-09 17:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207170630.592-7-christoffer.dall@linaro.org>

On Thu, 07 Dec 2017 17:06:00 +0000,
Christoffer Dall wrote:
> 
> Avoid saving the guest VFP registers and restoring the host VFP
> registers on every exit from the VM.  Only when we're about to run
> userspace or other threads in the kernel do we really have to switch the
> state back to the host state.
> 
> We still initially configure the VFP registers to trap when entering the
> VM, but the difference is that we now leave the guest state in the
> hardware registers as long as we're running this VCPU, even if we
> occasionally trap to the host, and we only restore the host state when
> we return to user space or when scheduling another thread.
> 
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
> 
> Notes:
>     Changes since v1:
>      - Cosmetic changes
>      - Change the flags variable to a u8
>      - Expanded the commit message
> 
>  arch/arm64/include/asm/kvm_emulate.h |  5 ++++
>  arch/arm64/include/asm/kvm_host.h    |  3 +++
>  arch/arm64/kernel/asm-offsets.c      |  1 +
>  arch/arm64/kvm/hyp/entry.S           |  3 +++
>  arch/arm64/kvm/hyp/switch.c          | 48 +++++++++++-------------------------
>  arch/arm64/kvm/hyp/sysreg-sr.c       | 22 ++++++++++++++---
>  6 files changed, 46 insertions(+), 36 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
> index b36aaa1fe332..635137e6ed1c 100644
> --- a/arch/arm64/include/asm/kvm_emulate.h
> +++ b/arch/arm64/include/asm/kvm_emulate.h
> @@ -67,6 +67,11 @@ static inline unsigned long *vcpu_hcr(struct kvm_vcpu *vcpu)
>  	return (unsigned long *)&vcpu->arch.hcr_el2;
>  }
>  
> +static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu)
> +{
> +	return !(vcpu->arch.hcr_el2 & HCR_RW);
> +}

Since you now introduce this helper, could you use it to repaint
inject_fault.c which could make use of it too? This could actually be
a separate patch.

> +
>  static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu)
>  {
>  	return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc;
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 20fab9194794..c841eeeeb5c5 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -211,6 +211,9 @@ struct kvm_vcpu_arch {
>  	/* Guest debug state */
>  	u64 debug_flags;
>  
> +	/* 1 if the guest VFP state is loaded into the hardware */
> +	u8 guest_vfp_loaded;
> +
>  	/*
>  	 * We maintain more than a single set of debug registers to support
>  	 * debugging the guest from the host and to maintain separate host and
> diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> index 612021dce84f..99467327c043 100644
> --- a/arch/arm64/kernel/asm-offsets.c
> +++ b/arch/arm64/kernel/asm-offsets.c
> @@ -133,6 +133,7 @@ int main(void)
>    DEFINE(CPU_GP_REGS,		offsetof(struct kvm_cpu_context, gp_regs));
>    DEFINE(CPU_USER_PT_REGS,	offsetof(struct kvm_regs, regs));
>    DEFINE(CPU_FP_REGS,		offsetof(struct kvm_regs, fp_regs));
> +  DEFINE(VCPU_GUEST_VFP_LOADED,	offsetof(struct kvm_vcpu, arch.guest_vfp_loaded));
>    DEFINE(VCPU_FPEXC32_EL2,	offsetof(struct kvm_vcpu, arch.ctxt.sys_regs[FPEXC32_EL2]));
>    DEFINE(VCPU_HOST_CONTEXT,	offsetof(struct kvm_vcpu, arch.host_cpu_context));
>    DEFINE(HOST_CONTEXT_VCPU,	offsetof(struct kvm_cpu_context, __hyp_running_vcpu));
> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
> index a360ac6e89e9..53652287a236 100644
> --- a/arch/arm64/kvm/hyp/entry.S
> +++ b/arch/arm64/kvm/hyp/entry.S
> @@ -184,6 +184,9 @@ alternative_endif
>  	add	x0, x2, #CPU_GP_REG_OFFSET(CPU_FP_REGS)
>  	bl	__fpsimd_restore_state
>  
> +	mov	x0, #1
> +	strb	w0, [x3, #VCPU_GUEST_VFP_LOADED]
> +
>  	// Skip restoring fpexc32 for AArch64 guests
>  	mrs	x1, hcr_el2
>  	tbnz	x1, #HCR_RW_SHIFT, 1f
> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
> index 11ec1c6f3b84..f5d53ef9ca79 100644
> --- a/arch/arm64/kvm/hyp/switch.c
> +++ b/arch/arm64/kvm/hyp/switch.c
> @@ -24,43 +24,32 @@
>  #include <asm/fpsimd.h>
>  #include <asm/debug-monitors.h>
>  
> -static bool __hyp_text __fpsimd_enabled_nvhe(void)
> -{
> -	return !(read_sysreg(cptr_el2) & CPTR_EL2_TFP);
> -}
> -
> -static bool __hyp_text __fpsimd_enabled_vhe(void)
> -{
> -	return !!(read_sysreg(cpacr_el1) & CPACR_EL1_FPEN);
> -}
> -
> -static hyp_alternate_select(__fpsimd_is_enabled,
> -			    __fpsimd_enabled_nvhe, __fpsimd_enabled_vhe,
> -			    ARM64_HAS_VIRT_HOST_EXTN);
> -
> -bool __hyp_text __fpsimd_enabled(void)
> -{
> -	return __fpsimd_is_enabled()();
> -}
> -
> -static void __hyp_text __activate_traps_vhe(void)
> +static void __hyp_text __activate_traps_vhe(struct kvm_vcpu *vcpu)
>  {
>  	u64 val;
>  
>  	val = read_sysreg(cpacr_el1);
>  	val |= CPACR_EL1_TTA;
> -	val &= ~(CPACR_EL1_FPEN | CPACR_EL1_ZEN);
> +	val &= ~CPACR_EL1_ZEN;
> +	if (vcpu->arch.guest_vfp_loaded)
> +		val |= CPACR_EL1_FPEN;
> +	else
> +		val &= ~CPACR_EL1_FPEN;
>  	write_sysreg(val, cpacr_el1);
>  
>  	write_sysreg(__kvm_hyp_vector, vbar_el1);
>  }
>  
> -static void __hyp_text __activate_traps_nvhe(void)
> +static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu)
>  {
>  	u64 val;
>  
>  	val = CPTR_EL2_DEFAULT;
> -	val |= CPTR_EL2_TTA | CPTR_EL2_TFP | CPTR_EL2_TZ;
> +	val |= CPTR_EL2_TTA | CPTR_EL2_TZ;
> +	if (vcpu->arch.guest_vfp_loaded)
> +		val &= ~CPTR_EL2_TFP;
> +	else
> +		val |= CPTR_EL2_TFP;
>  	write_sysreg(val, cptr_el2);
>  }
>  
> @@ -83,7 +72,8 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu)
>  	 */
>  	val = vcpu->arch.hcr_el2;
>  
> -	if (!(val & HCR_RW) && system_supports_fpsimd()) {
> +	if (vcpu_el1_is_32bit(vcpu) && system_supports_fpsimd() &&
> +	    !vcpu->arch.guest_vfp_loaded) {
>  		write_sysreg(1 << 30, fpexc32_el2);
>  		isb();
>  	}
> @@ -100,7 +90,7 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu)
>  	write_sysreg(0, pmselr_el0);
>  	write_sysreg(ARMV8_PMU_USERENR_MASK, pmuserenr_el0);
>  	write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
> -	__activate_traps_arch()();
> +	__activate_traps_arch()(vcpu);
>  }
>  
>  static void __hyp_text __deactivate_traps_vhe(void)
> @@ -288,7 +278,6 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
>  {
>  	struct kvm_cpu_context *host_ctxt;
>  	struct kvm_cpu_context *guest_ctxt;
> -	bool fp_enabled;
>  	u64 exit_code;
>  
>  	vcpu = kern_hyp_va(vcpu);
> @@ -380,8 +369,6 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
>  		/* 0 falls through to be handled out of EL2 */
>  	}
>  
> -	fp_enabled = __fpsimd_enabled();
> -
>  	__sysreg_save_guest_state(guest_ctxt);
>  	__sysreg32_save_state(vcpu);
>  	__timer_disable_traps(vcpu);
> @@ -392,11 +379,6 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
>  
>  	__sysreg_restore_host_state(host_ctxt);
>  
> -	if (fp_enabled) {
> -		__fpsimd_save_state(&guest_ctxt->gp_regs.fp_regs);
> -		__fpsimd_restore_state(&host_ctxt->gp_regs.fp_regs);
> -	}
> -
>  	__debug_save_state(vcpu, kern_hyp_va(vcpu->arch.debug_ptr), guest_ctxt);
>  	/*
>  	 * This must come after restoring the host sysregs, since a non-VHE
> diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c
> index cbbcd6f410a8..68a7d164e5e1 100644
> --- a/arch/arm64/kvm/hyp/sysreg-sr.c
> +++ b/arch/arm64/kvm/hyp/sysreg-sr.c
> @@ -19,6 +19,7 @@
>  #include <linux/kvm_host.h>
>  
>  #include <asm/kvm_asm.h>
> +#include <asm/kvm_emulate.h>
>  #include <asm/kvm_hyp.h>
>  
>  /* Yes, this does nothing, on purpose */
> @@ -137,6 +138,11 @@ void __hyp_text __sysreg_restore_guest_state(struct kvm_cpu_context *ctxt)
>  	__sysreg_restore_common_state(ctxt);
>  }
>  
> +static void __hyp_text __fpsimd32_save_state(struct kvm_cpu_context *ctxt)
> +{
> +	ctxt->sys_regs[FPEXC32_EL2] = read_sysreg(fpexc32_el2);
> +}
> +
>  void __hyp_text __sysreg32_save_state(struct kvm_vcpu *vcpu)
>  {
>  	u64 *spsr, *sysreg;
> @@ -155,9 +161,6 @@ void __hyp_text __sysreg32_save_state(struct kvm_vcpu *vcpu)
>  	sysreg[DACR32_EL2] = read_sysreg(dacr32_el2);
>  	sysreg[IFSR32_EL2] = read_sysreg(ifsr32_el2);
>  
> -	if (__fpsimd_enabled())
> -		sysreg[FPEXC32_EL2] = read_sysreg(fpexc32_el2);
> -
>  	if (vcpu->arch.debug_flags & KVM_ARM64_DEBUG_DIRTY)
>  		sysreg[DBGVCR32_EL2] = read_sysreg(dbgvcr32_el2);
>  }
> @@ -212,6 +215,19 @@ void kvm_vcpu_load_sysregs(struct kvm_vcpu *vcpu)
>   */
>  void kvm_vcpu_put_sysregs(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_cpu_context *host_ctxt = vcpu->arch.host_cpu_context;
> +	struct kvm_cpu_context *guest_ctxt = &vcpu->arch.ctxt;
> +
> +	/* Restore host FP/SIMD state */
> +	if (vcpu->arch.guest_vfp_loaded) {
> +		if (vcpu_el1_is_32bit(vcpu)) {
> +			kvm_call_hyp(__fpsimd32_save_state,
> +				     kern_hyp_va(guest_ctxt));
> +		}
> +		__fpsimd_save_state(&guest_ctxt->gp_regs.fp_regs);
> +		__fpsimd_restore_state(&host_ctxt->gp_regs.fp_regs);
> +		vcpu->arch.guest_vfp_loaded = 0;
> +	}
>  }
>  
>  void __hyp_text __kvm_set_tpidr_el2(u64 tpidr_el2)
> -- 
> 2.14.2
> 

Otherwise,

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply

* [PATCH v2 05/36] KVM: arm/arm64: Add kvm_vcpu_load_sysregs and kvm_vcpu_put_sysregs
From: Marc Zyngier @ 2017-12-09 17:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207170630.592-6-christoffer.dall@linaro.org>

On Thu, 07 Dec 2017 17:05:59 +0000,
Christoffer Dall wrote:
> 
> As we are about to move a bunch of save/restore logic for VHE kernels to
> the load and put functions, we need some infrastructure to do this.
> 
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply

* [PATCH v2 02/36] KVM: arm64: Rework hyp_panic for VHE and non-VHE
From: Marc Zyngier @ 2017-12-09 17:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207170630.592-3-christoffer.dall@linaro.org>

On Thu, 07 Dec 2017 17:05:56 +0000,
Christoffer Dall wrote:
> 
> VHE actually doesn't rely on clearing the VTTBR when returning to the
> host kernel, and that is the current key mechanism of hyp_panic to
> figure out how to attempt to return to a state good enough to print a
> panic statement.
> 
> Therefore, we split the hyp_panic function into two functions, a VHE and
> a non-VHE, keeping the non-VHE version intact, but changing the VHE
> behavior.
> 
> The vttbr_el2 check on VHE doesn't really make that much sense, because
> the only situation where we can get here on VHE is when the hypervisor
> assembly code actually called into hyp_panic, which only happens when
> VBAR_EL2 has been set to the KVM exception vectors.  On VHE, we can
> always safely disable the traps and restore the host registers at this
> point, so we simply do that unconditionally and call into the panic
> function directly.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply

* [PATCH v2 01/36] KVM: arm64: Avoid storing the vcpu pointer on the stack
From: Marc Zyngier @ 2017-12-09 17:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207170630.592-2-christoffer.dall@linaro.org>

On Thu, 07 Dec 2017 17:05:55 +0000,
Christoffer Dall wrote:
> 
> We already have the percpu area for the host cpu state, which points to
> the VCPU, so there's no need to store the VCPU pointer on the stack on
> every context switch.  We can be a little more clever and just use
> tpidr_el2 for the percpu offset and load the VCPU pointer from the host
> context.
> 
> This does require us to calculate the percpu offset without including
> the offset from the kernel mapping of the percpu array to the linaro

"linaro"?

> mapping of the array (which is what we store in tpidr_el1), because a
> PC-relative generated address in EL2 is already giving us the hyp alias
> of the linear mapping of a kernel address.  We do this in
> __cpu_init_hyp_mode() by using kvm_ksym_ref().
> 
> This change also requires us to have a scratch register, so we take the
> chance to rearrange some of the el1_sync code to only look at the
> vttbr_el2 to determine if this is a trap from the guest or an HVC from
> the host.  We do add an extra check to call the panic code if the kernel
> is configured with debugging enabled and we saw a trap from the host
> which wasn't an HVC, indicating that we left some EL2 trap configured by
> mistake.
> 
> The code that accesses ESR_EL2 was previously using an alternative to
> use the _EL1 accessor on VHE systems, but this was actually unnecessary
> as the _EL1 accessor aliases the ESR_EL2 register on VHE, and the _EL2
> accessor does the same thing on both systems.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
> 
> Notes:
>     Changes since v1:
>      - Use PC-relative addressing to access per-cpu variables instead of
>        using a load from the literal pool.
>      - Remove stale comments as pointed out by Marc
>      - Reworded the commit message as suggested by Drew
> 
>  arch/arm64/include/asm/kvm_asm.h  | 15 ++++++++++++++
>  arch/arm64/include/asm/kvm_host.h | 15 ++++++++++++++
>  arch/arm64/kernel/asm-offsets.c   |  1 +
>  arch/arm64/kvm/hyp/entry.S        |  6 +-----
>  arch/arm64/kvm/hyp/hyp-entry.S    | 41 ++++++++++++++++++---------------------
>  arch/arm64/kvm/hyp/switch.c       |  5 +----
>  arch/arm64/kvm/hyp/sysreg-sr.c    |  5 +++++
>  7 files changed, 57 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
> index ab4d0a926043..33e0edc6f8be 100644
> --- a/arch/arm64/include/asm/kvm_asm.h
> +++ b/arch/arm64/include/asm/kvm_asm.h
> @@ -33,6 +33,7 @@
>  #define KVM_ARM64_DEBUG_DIRTY_SHIFT	0
>  #define KVM_ARM64_DEBUG_DIRTY		(1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
>  
> +/* Translate a kernel address of @sym into its equivalent linear mapping */
>  #define kvm_ksym_ref(sym)						\
>  	({								\
>  		void *val = &sym;					\
> @@ -70,4 +71,18 @@ extern u32 __init_stage2_translation(void);
>  
>  #endif
>  
> +#ifdef __ASSEMBLY__

You could turn this and the previous #endif into a simple #else.

> +.macro get_host_ctxt reg, tmp
> +	adr_l	\reg, kvm_host_cpu_state
> +	mrs	\tmp, tpidr_el2
> +	add	\reg, \reg, \tmp
> +.endm
> +
> +.macro get_vcpu vcpu, ctxt
> +	ldr	\vcpu, [\ctxt, #HOST_CONTEXT_VCPU]
> +	kern_hyp_va	\vcpu
> +.endm
> +
> +#endif
> +
>  #endif /* __ARM_KVM_ASM_H__ */
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 7ee72b402907..af58deb6ec3c 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -348,10 +348,15 @@ int kvm_perf_teardown(void);
>  
>  struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr);
>  
> +extern void __kvm_set_tpidr_el2(u64 tpidr_el2);

Is there any advantage in having this prototype in kvm_host.h, instead
of putting it in kvm_hyp.h (which feels more appropriate)?

> +DECLARE_PER_CPU(kvm_cpu_context_t, kvm_host_cpu_state);
> +
>  static inline void __cpu_init_hyp_mode(phys_addr_t pgd_ptr,
>  				       unsigned long hyp_stack_ptr,
>  				       unsigned long vector_ptr)
>  {
> +	u64 tpidr_el2;
> +
>  	/*
>  	 * Call initialization code, and switch to the full blown HYP code.
>  	 * If the cpucaps haven't been finalized yet, something has gone very
> @@ -360,6 +365,16 @@ static inline void __cpu_init_hyp_mode(phys_addr_t pgd_ptr,
>  	 */
>  	BUG_ON(!static_branch_likely(&arm64_const_caps_ready));
>  	__kvm_call_hyp((void *)pgd_ptr, hyp_stack_ptr, vector_ptr);
> +
> +	/*
> +	 * Calculate the raw per-cpu offset without a translation from the
> +	 * kernel's mapping to the linear mapping, and store it in tpidr_el2
> +	 * so that we can use adr_l to access per-cpu variables in EL2.
> +	 */
> +	tpidr_el2 = (u64)this_cpu_ptr(&kvm_host_cpu_state)
> +		- (u64)kvm_ksym_ref(kvm_host_cpu_state);
> +
> +	kvm_call_hyp(__kvm_set_tpidr_el2, tpidr_el2);
>  }
>  
>  static inline void kvm_arch_hardware_unsetup(void) {}
> diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> index 71bf088f1e4b..612021dce84f 100644
> --- a/arch/arm64/kernel/asm-offsets.c
> +++ b/arch/arm64/kernel/asm-offsets.c
> @@ -135,6 +135,7 @@ int main(void)
>    DEFINE(CPU_FP_REGS,		offsetof(struct kvm_regs, fp_regs));
>    DEFINE(VCPU_FPEXC32_EL2,	offsetof(struct kvm_vcpu, arch.ctxt.sys_regs[FPEXC32_EL2]));
>    DEFINE(VCPU_HOST_CONTEXT,	offsetof(struct kvm_vcpu, arch.host_cpu_context));
> +  DEFINE(HOST_CONTEXT_VCPU,	offsetof(struct kvm_cpu_context, __hyp_running_vcpu));
>  #endif
>  #ifdef CONFIG_CPU_PM
>    DEFINE(CPU_SUSPEND_SZ,	sizeof(struct cpu_suspend_ctx));
> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
> index 9a8ab5dddd9e..a360ac6e89e9 100644
> --- a/arch/arm64/kvm/hyp/entry.S
> +++ b/arch/arm64/kvm/hyp/entry.S
> @@ -62,9 +62,6 @@ ENTRY(__guest_enter)
>  	// Store the host regs
>  	save_callee_saved_regs x1
>  
> -	// Store host_ctxt and vcpu for use at exit time
> -	stp	x1, x0, [sp, #-16]!
> -
>  	add	x18, x0, #VCPU_CONTEXT
>  
>  	// Restore guest regs x0-x17
> @@ -118,8 +115,7 @@ ENTRY(__guest_exit)
>  	// Store the guest regs x19-x29, lr
>  	save_callee_saved_regs x1
>  
> -	// Restore the host_ctxt from the stack
> -	ldr	x2, [sp], #16
> +	get_host_ctxt	x2, x3
>  
>  	// Now restore the host regs
>  	restore_callee_saved_regs x2
> diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S
> index e4f37b9dd47c..71b4cc92895e 100644
> --- a/arch/arm64/kvm/hyp/hyp-entry.S
> +++ b/arch/arm64/kvm/hyp/hyp-entry.S
> @@ -56,18 +56,15 @@ ENDPROC(__vhe_hyp_call)
>  el1_sync:				// Guest trapped into EL2
>  	stp	x0, x1, [sp, #-16]!
>  
> -alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
> -	mrs	x1, esr_el2
> -alternative_else
> -	mrs	x1, esr_el1
> -alternative_endif
> -	lsr	x0, x1, #ESR_ELx_EC_SHIFT
> +	mrs	x1, vttbr_el2		// If vttbr is valid, this is a trap
> +	cbnz	x1, el1_trap		// from the guest
>  
> -	cmp	x0, #ESR_ELx_EC_HVC64
> -	b.ne	el1_trap
> -
> -	mrs	x1, vttbr_el2		// If vttbr is valid, the 64bit guest
> -	cbnz	x1, el1_trap		// called HVC
> +#ifdef CONFIG_DEBUG
> +	mrs	x0, esr_el2
> +	lsr	x0, x0, #ESR_ELx_EC_SHIFT
> +	cmp     x0, #ESR_ELx_EC_HVC64
> +	b.ne    __hyp_panic
> +#endif
>  
>  	/* Here, we're pretty sure the host called HVC. */
>  	ldp	x0, x1, [sp], #16
> @@ -101,10 +98,15 @@ alternative_endif
>  	eret
>  
>  el1_trap:
> +	get_host_ctxt	x0, x1
> +	get_vcpu	x1, x0
> +
> +	mrs		x0, esr_el2
> +	lsr		x0, x0, #ESR_ELx_EC_SHIFT
>  	/*
>  	 * x0: ESR_EC
> +	 * x1: vcpu pointer
>  	 */
> -	ldr	x1, [sp, #16 + 8]	// vcpu stored by __guest_enter
>  
>  	/*
>  	 * We trap the first access to the FP/SIMD to save the host context
> @@ -122,13 +124,15 @@ alternative_else_nop_endif
>  
>  el1_irq:
>  	stp     x0, x1, [sp, #-16]!
> -	ldr	x1, [sp, #16 + 8]
> +	get_host_ctxt	x0, x1
> +	get_vcpu	x1, x0
>  	mov	x0, #ARM_EXCEPTION_IRQ
>  	b	__guest_exit
>  
>  el1_error:
>  	stp     x0, x1, [sp, #-16]!
> -	ldr	x1, [sp, #16 + 8]
> +	get_host_ctxt	x0, x1
> +	get_vcpu	x1, x0
>  	mov	x0, #ARM_EXCEPTION_EL1_SERROR
>  	b	__guest_exit
>  
> @@ -164,14 +168,7 @@ ENTRY(__hyp_do_panic)
>  ENDPROC(__hyp_do_panic)
>  
>  ENTRY(__hyp_panic)
> -	/*
> -	 * '=kvm_host_cpu_state' is a host VA from the constant pool, it may
> -	 * not be accessible by this address from EL2, hyp_panic() converts
> -	 * it with kern_hyp_va() before use.
> -	 */
> -	ldr	x0, =kvm_host_cpu_state
> -	mrs	x1, tpidr_el2
> -	add	x0, x0, x1
> +	get_host_ctxt x0, x1
>  	b	hyp_panic
>  ENDPROC(__hyp_panic)
>  
> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
> index f7307b6b42f0..6fcb37e220b5 100644
> --- a/arch/arm64/kvm/hyp/switch.c
> +++ b/arch/arm64/kvm/hyp/switch.c
> @@ -449,7 +449,7 @@ static hyp_alternate_select(__hyp_call_panic,
>  			    __hyp_call_panic_nvhe, __hyp_call_panic_vhe,
>  			    ARM64_HAS_VIRT_HOST_EXTN);
>  
> -void __hyp_text __noreturn hyp_panic(struct kvm_cpu_context *__host_ctxt)
> +void __hyp_text __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
>  {
>  	struct kvm_vcpu *vcpu = NULL;
>  
> @@ -458,9 +458,6 @@ void __hyp_text __noreturn hyp_panic(struct kvm_cpu_context *__host_ctxt)
>  	u64 par = read_sysreg(par_el1);
>  
>  	if (read_sysreg(vttbr_el2)) {
> -		struct kvm_cpu_context *host_ctxt;
> -
> -		host_ctxt = kern_hyp_va(__host_ctxt);
>  		vcpu = host_ctxt->__hyp_running_vcpu;
>  		__timer_disable_traps(vcpu);
>  		__deactivate_traps(vcpu);
> diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c
> index c54cc2afb92b..e19d89cabf2a 100644
> --- a/arch/arm64/kvm/hyp/sysreg-sr.c
> +++ b/arch/arm64/kvm/hyp/sysreg-sr.c
> @@ -183,3 +183,8 @@ void __hyp_text __sysreg32_restore_state(struct kvm_vcpu *vcpu)
>  	if (vcpu->arch.debug_flags & KVM_ARM64_DEBUG_DIRTY)
>  		write_sysreg(sysreg[DBGVCR32_EL2], dbgvcr32_el2);
>  }
> +
> +void __hyp_text __kvm_set_tpidr_el2(u64 tpidr_el2)
> +{
> +	asm("msr tpidr_el2, %0": : "r" (tpidr_el2));
> +}
> -- 
> 2.14.2
> 

Other than the couple of nits above:

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>

	M.

-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox