Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] drm/sun4i: dotclock: Allow divider = 127
From: Chen-Yu Tsai @ 2016-09-15 15:14 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915151402.15992-1-wens@csie.org>

The dot clock divider is 7 bits wide, and the divider range is 1 ~ 127,
or 6 ~ 127 if phase offsets are used. The 0 register value also
represents a divider of 1 or bypass.

Make the end condition of the for loop inclusive of 127 in the
round_rate callback.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/gpu/drm/sun4i/sun4i_dotclock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 1b6c2253192e..3eb99784f371 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -77,7 +77,7 @@ static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
 	u8 best_div = 1;
 	int i;
 
-	for (i = 6; i < 127; i++) {
+	for (i = 6; i <= 127; i++) {
 		unsigned long ideal = rate * i;
 		unsigned long rounded;
 
-- 
2.9.3

^ permalink raw reply related

* [PATCH 2/4] drm/sun4i: dotclock: Fix clock rate read back calcation
From: Chen-Yu Tsai @ 2016-09-15 15:14 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915151402.15992-1-wens@csie.org>

When reading back the divider set in the register, we mask off the
bits that aren't part of the divider. Unfortunately the mask used
here was not converted from the field width.

Fix this by converting the field width to a proper bit mask.

Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/gpu/drm/sun4i/sun4i_dotclock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 4332da48b1b3..1b6c2253192e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -62,7 +62,7 @@ static unsigned long sun4i_dclk_recalc_rate(struct clk_hw *hw,
 	regmap_read(dclk->regmap, SUN4I_TCON0_DCLK_REG, &val);
 
 	val >>= SUN4I_TCON0_DCLK_DIV_SHIFT;
-	val &= SUN4I_TCON0_DCLK_DIV_WIDTH;
+	val &= (1 << SUN4I_TCON0_DCLK_DIV_WIDTH) - 1;
 
 	if (!val)
 		val = 1;
-- 
2.9.3

^ permalink raw reply related

* [PATCH 1/4] drm/sun4i: rgb: Declare RGB encoder and connector as MIPI DPI
From: Chen-Yu Tsai @ 2016-09-15 15:13 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915151402.15992-1-wens@csie.org>

The 18 or 24 bit parallel RGB LCD panel interface found on Allwinner
SoCs matches the description of MIPI DPI. Declare the RGB encoder and
connector as MIPI DPI.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index c3ff10f559cc..8b520d9f5bd9 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -240,7 +240,7 @@ int sun4i_rgb_init(struct drm_device *drm)
 	ret = drm_encoder_init(drm,
 			       &rgb->encoder,
 			       &sun4i_rgb_enc_funcs,
-			       DRM_MODE_ENCODER_NONE,
+			       DRM_MODE_ENCODER_DPI,
 			       NULL);
 	if (ret) {
 		dev_err(drm->dev, "Couldn't initialise the rgb encoder\n");
@@ -255,7 +255,7 @@ int sun4i_rgb_init(struct drm_device *drm)
 					 &sun4i_rgb_con_helper_funcs);
 		ret = drm_connector_init(drm, &rgb->connector,
 					 &sun4i_rgb_con_funcs,
-					 DRM_MODE_CONNECTOR_Unknown);
+					 DRM_MODE_CONNECTOR_DPI);
 		if (ret) {
 			dev_err(drm->dev, "Couldn't initialise the rgb connector\n");
 			goto err_cleanup_connector;
-- 
2.9.3

^ permalink raw reply related

* [PATCH 0/4] drm/sun4i: rgb and dotclock misc fixes and improvements
From: Chen-Yu Tsai @ 2016-09-15 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Maxime,

Here are a few small fixes and improvements to the sun4i drm driver.

Patch 1 declares the LCD panel RGB interface encoder and connector types
as MIPI DPI. AFAIK DPI is the parallel RGB variant.

Patch 2 fixes the weird clock rates I was getting on the dot clock when
testing the RGB-to-VGA bridge patches. You may want to queue this as a
fix for 4.8.

Patch 3 increases the dot clock divider upper bound by 1 to 127. AFAIK
127 is a valid divider. I doubt we will ever use it, since the parents
will go way higher than they are supposed to, but getting it right is
nicer.

Patch 4 changes the dot clock's behavior to make it round to the closest
clock rate. I think this would make it easier to match the LCD panel's
timings. More on the LCD timings in a later patch set.


Regards
ChenYu

Chen-Yu Tsai (4):
  drm/sun4i: rgb: Declare RGB encoder and connector as MIPI DPI
  drm/sun4i: dotclock: Fix clock rate read back calcation
  drm/sun4i: dotclock: Allow divider = 127
  drm/sun4i: dotclock: Round to closest clock rate

 drivers/gpu/drm/sun4i/sun4i_dotclock.c | 7 ++++---
 drivers/gpu/drm/sun4i/sun4i_rgb.c      | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.9.3

^ permalink raw reply

* [PATCH v3 1/7] arm64: Factor out PAN enabling/disabling into separate uaccess_* macros
From: Mark Rutland @ 2016-09-15 15:10 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1473788797-10879-2-git-send-email-catalin.marinas@arm.com>

Hi Catalin,

On Tue, Sep 13, 2016 at 06:46:31PM +0100, Catalin Marinas wrote:
> This patch moves the directly coded alternatives for turning PAN on/off
> into separate uaccess_{enable,disable} macros or functions. The asm
> macros take a few arguments which will be used in subsequent patches.
> 
> Note that any (unlikely) access that the compiler might generate between
> uaccess_enable() and uaccess_disable(), other than those explicitly
> specified by the user access code, will not be protected by PAN.

There's one missing include that I've noted below, along with a number
we can now drop. Otherwise, the important parts all look good to me.

With the includes fixed up:

Reviewed-by: Mark Rutland <mark.rutland@arm.com>

[...]

> Cc: Will Deacon <will.deacon@arm.com>
> Cc: James Morse <james.morse@arm.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  arch/arm64/include/asm/futex.h       | 14 +++----
>  arch/arm64/include/asm/uaccess.h     | 79 ++++++++++++++++++++++++++++++++----
>  arch/arm64/kernel/armv8_deprecated.c | 10 ++---
>  arch/arm64/lib/clear_user.S          |  8 ++--
>  arch/arm64/lib/copy_from_user.S      |  8 ++--
>  arch/arm64/lib/copy_in_user.S        |  8 ++--
>  arch/arm64/lib/copy_to_user.S        |  8 ++--
>  7 files changed, 95 insertions(+), 40 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h
> index f2585cdd32c2..71dfa3b42313 100644
> --- a/arch/arm64/include/asm/futex.h
> +++ b/arch/arm64/include/asm/futex.h
> @@ -27,9 +27,9 @@
>  #include <asm/sysreg.h>
>  
>  #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg)		\
> +do {									\
> +	uaccess_enable();						\
>  	asm volatile(							\
> -	ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN,		\
> -		    CONFIG_ARM64_PAN)					\
>  "	prfm	pstl1strm, %2\n"					\
>  "1:	ldxr	%w1, %2\n"						\
>  	insn "\n"							\
> @@ -44,11 +44,11 @@
>  "	.popsection\n"							\
>  	_ASM_EXTABLE(1b, 4b)						\
>  	_ASM_EXTABLE(2b, 4b)						\
> -	ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN,		\
> -		    CONFIG_ARM64_PAN)					\
>  	: "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp)	\
>  	: "r" (oparg), "Ir" (-EFAULT)					\
> -	: "memory")
> +	: "memory");							\
> +	uaccess_disable();						\
> +} while (0)

With the uaccess_{enable,disable}* macros, we can drop the includes for
<asm/alternative.h>, <asm/cpufeature.h>, and <asm/sysreg.h> from
futex.h, as we no longer (directly) use anything from those.

[...]

> diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
> index c47257c91b77..cc6c32d4dcc4 100644
> --- a/arch/arm64/include/asm/uaccess.h
> +++ b/arch/arm64/include/asm/uaccess.h

> @@ -321,4 +357,31 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count);
>  extern __must_check long strlen_user(const char __user *str);
>  extern __must_check long strnlen_user(const char __user *str, long n);
>  
> +#else	/* __ASSEMBLY__ */
> +
> +#include <asm/alternative.h>
> +#include <asm/assembler.h>

We also need <asm/sysreg.h> for SET_PSTATE_PAN()

Given we use that and <asm/alternative.h> either way, should we pull
those above the #ifdef __ASSEMBLY__? I have no feeling either way.

[...]

> diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
> index 42ffdb54e162..7156e7bfcd89 100644
> --- a/arch/arm64/kernel/armv8_deprecated.c
> +++ b/arch/arm64/kernel/armv8_deprecated.c
> @@ -281,9 +281,9 @@ static void __init register_insn_emulation_sysctl(struct ctl_table *table)
>   * Error-checking SWP macros implemented using ldxr{b}/stxr{b}
>   */
>  #define __user_swpX_asm(data, addr, res, temp, B)		\
> +do {								\
> +	uaccess_enable();					\
>  	__asm__ __volatile__(					\
> -	ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN,	\
> -		    CONFIG_ARM64_PAN)				\
>  	"0:	ldxr"B"		%w2, [%3]\n"			\
>  	"1:	stxr"B"		%w0, %w1, [%3]\n"		\
>  	"	cbz		%w0, 2f\n"			\
> @@ -299,11 +299,11 @@ static void __init register_insn_emulation_sysctl(struct ctl_table *table)
>  	"	.popsection"					\
>  	_ASM_EXTABLE(0b, 4b)					\
>  	_ASM_EXTABLE(1b, 4b)					\
> -	ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN,	\
> -		CONFIG_ARM64_PAN)				\
>  	: "=&r" (res), "+r" (data), "=&r" (temp)		\
>  	: "r" (addr), "i" (-EAGAIN), "i" (-EFAULT)		\
> -	: "memory")
> +	: "memory");						\
> +	uaccess_disable();					\
> +} while (0)

With this, we can drop the include of <asm/alternative.h>, though unlike
futex.h we need to keep <asm/cpufeature.h> and <asm/sysreg.h>.

[...]

> diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S
> index 5d1cad3ce6d6..08b5f18ba604 100644
> --- a/arch/arm64/lib/clear_user.S
> +++ b/arch/arm64/lib/clear_user.S
> @@ -17,10 +17,10 @@
>   */
>  #include <linux/linkage.h>
>  
> -#include <asm/alternative.h>
>  #include <asm/assembler.h>
>  #include <asm/cpufeature.h>
>  #include <asm/sysreg.h>
> +#include <asm/uaccess.h>

As with futex.h, we can drop <asm/assembler.h>, <asm/cpufeature.h>, and
<asm/sysreg.h>, as the uaccess_{enable,disable}* macros mean we no
longer use anything from those directly.

[...]

> diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S
> index 0b90497d4424..6505ec81f1da 100644
> --- a/arch/arm64/lib/copy_from_user.S
> +++ b/arch/arm64/lib/copy_from_user.S
> @@ -16,11 +16,11 @@
>  
>  #include <linux/linkage.h>
>  
> -#include <asm/alternative.h>
>  #include <asm/assembler.h>
>  #include <asm/cache.h>
>  #include <asm/cpufeature.h>
>  #include <asm/sysreg.h>
> +#include <asm/uaccess.h>

Likewise, we can also drop <asm/assembler.h>, <asm/cpufeature.h>, and
<asm/sysreg.h> here.

[...]

> diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
> index f7292dd08c84..9b04ff3ab610 100644
> --- a/arch/arm64/lib/copy_in_user.S
> +++ b/arch/arm64/lib/copy_in_user.S
> @@ -18,11 +18,11 @@
>  
>  #include <linux/linkage.h>
>  
> -#include <asm/alternative.h>
>  #include <asm/assembler.h>
>  #include <asm/cache.h>
>  #include <asm/cpufeature.h>
>  #include <asm/sysreg.h>
> +#include <asm/uaccess.h>

Likewise, we can also drop <asm/assembler.h>, <asm/cpufeature.h>, and
<asm/sysreg.h> here.

[...]

> diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
> index 7a7efe255034..8077e4f34d56 100644
> --- a/arch/arm64/lib/copy_to_user.S
> +++ b/arch/arm64/lib/copy_to_user.S
> @@ -16,11 +16,11 @@
>  
>  #include <linux/linkage.h>
>  
> -#include <asm/alternative.h>
>  #include <asm/assembler.h>
>  #include <asm/cache.h>
>  #include <asm/cpufeature.h>
>  #include <asm/sysreg.h>
> +#include <asm/uaccess.h>

Likewise, we can also drop <asm/assembler.h>, <asm/cpufeature.h>, and
<asm/sysreg.h> here.

Thanks,
Mark.

^ permalink raw reply

* [PATCH] usb: gadget: udc: atmel: fix endpoint name
From: Alexandre Belloni @ 2016-09-15 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

Since commit c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes"),
atmel_usba_udc fails with:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at include/linux/usb/gadget.h:405
ecm_do_notify+0x188/0x1a0
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0+ #15
Hardware name: Atmel SAMA5
[<c010ccfc>] (unwind_backtrace) from [<c010a7ec>] (show_stack+0x10/0x14)
[<c010a7ec>] (show_stack) from [<c0115c10>] (__warn+0xe4/0xfc)
[<c0115c10>] (__warn) from [<c0115cd8>] (warn_slowpath_null+0x20/0x28)
[<c0115cd8>] (warn_slowpath_null) from [<c04377ac>] (ecm_do_notify+0x188/0x1a0)
[<c04377ac>] (ecm_do_notify) from [<c04379a4>] (ecm_set_alt+0x74/0x1ac)
[<c04379a4>] (ecm_set_alt) from [<c042f74c>] (composite_setup+0xfc0/0x19f8)
[<c042f74c>] (composite_setup) from [<c04356e8>] (usba_udc_irq+0x8f4/0xd9c)
[<c04356e8>] (usba_udc_irq) from [<c013ec9c>] (handle_irq_event_percpu+0x9c/0x158)
[<c013ec9c>] (handle_irq_event_percpu) from [<c013ed80>] (handle_irq_event+0x28/0x3c)
[<c013ed80>] (handle_irq_event) from [<c01416d4>] (handle_fasteoi_irq+0xa0/0x168)
[<c01416d4>] (handle_fasteoi_irq) from [<c013e3f8>] (generic_handle_irq+0x24/0x34)
[<c013e3f8>] (generic_handle_irq) from [<c013e640>] (__handle_domain_irq+0x54/0xa8)
[<c013e640>] (__handle_domain_irq) from [<c010b214>] (__irq_svc+0x54/0x70)
[<c010b214>] (__irq_svc) from [<c0107eb0>] (arch_cpu_idle+0x38/0x3c)
[<c0107eb0>] (arch_cpu_idle) from [<c0137300>] (cpu_startup_entry+0x9c/0xdc)
[<c0137300>] (cpu_startup_entry) from [<c0900c40>] (start_kernel+0x354/0x360)
[<c0900c40>] (start_kernel) from [<20008078>] (0x20008078)
---[ end trace e7cf9dcebf4815a6 ]---

Fixes: c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes")
Reported-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index bb1f6c8f0f01..45bc997d0711 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1978,7 +1978,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 			dev_err(&pdev->dev, "of_probe: name error(%d)\n", ret);
 			goto err;
 		}
-		ep->ep.name = name;
+		ep->ep.name = kasprintf(GFP_KERNEL, "ep%d", ep->index);
 
 		ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
 		ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
-- 
2.9.3

^ permalink raw reply related

* linux-next: Tree for Sep 15 (phy/phy-meson-usb2.c)
From: Randy Dunlap @ 2016-09-15 15:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915165008.40acdecf@canb.auug.org.au>

On 09/14/16 23:50, Stephen Rothwell wrote:
> Hi all,
> 
> Changes since 20160914:
> 

on x86_64:

drivers/built-in.o: In function `phy_meson_usb2_probe':
phy-meson-usb2.c:(.text+0x350c): undefined reference to `of_usb_get_dr_mode_by_phy'


when CONFIG_USB_SUPPORT is not enabled.

-- 
~Randy

^ permalink raw reply

* [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3
From: Maxime Ripard @ 2016-09-15 14:58 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1473703967-21356-1-git-send-email-jorik@kippendief.biz>

On Mon, Sep 12, 2016 at 08:12:42PM +0200, jorik at kippendief.biz wrote:
> From: Jorik Jonker <jorik@kippendief.biz>
> 
> This is my fifth attempt to complete the UART/I2C definitions on H3.
> 
> Many thanks to Maxime and Chen-Yu for helping me understand the 
> philosophy behind the DTS/DTSI structure. I hope I get it and five
> times is a charm :-)

I queued it, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160915/87dc4dd1/attachment.sig>

^ permalink raw reply

* [PATCH v2 6/8] ARM: dts: sun9i: a80-optimus: Add AXP806 PMIC device node and regulators
From: Maxime Ripard @ 2016-09-15 14:56 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAGb2v65cQR9F1=0_9mM6guKrMhOX7TqMqfHJU5hJxUXtBZiYaw@mail.gmail.com>

On Thu, Sep 15, 2016 at 10:33:50PM +0800, Chen-Yu Tsai wrote:
> Hi Maxime,
> 
> On Sat, Aug 27, 2016 at 3:55 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> > The AXP806 PMIC is the secondary PMIC. It provides various supply
> > voltages for the SoC and other peripherals. The PMIC's interrupt
> > line is connected to NMI pin of the SoC.
> >
> > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> 
> The driver patches have all been merged into the mfd tree. Could
> you queue up the dts patches?

I just did.

Thanks for the remainder,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160915/7d725958/attachment.sig>

^ permalink raw reply

* [PATCH v2] ARM: dts: da850-lcdk: Add NAND to DT
From: Sekhar Nori @ 2016-09-15 14:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAOi56cWJpx-+s7h_+qypj-0HOcC2vDs2PLtZbdMO92TzdvECpQ@mail.gmail.com>

Hi Kevin,

On Wednesday 14 September 2016 10:54 PM, Kevin Hilman wrote:
> Hi Sekhar,
> 
> On Thu, Sep 8, 2016 at 11:33 AM, Kevin Hilman <khilman@baylibre.com> wrote:
>> From: Karl Beldan <kbeldan@baylibre.com>
>>
>> This adds DT support for the NAND connected to the SoC AEMIF.
>> Passed torture hashing a 40MB file on top of UBIFS using subpages.
>>
>> Signed-off-by: Karl Beldan <kbeldan@baylibre.com>
>> [khilman: add back default partitions from an earlier patch]
>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>> ---
>> Applies on Sekhar's v4.9/dts branch.
>>
> 
> Looks like you need to respin your DT series for arm-soc due to build
> errors.  Can you add this while you're at it so we have 4-bit ECC in
> v4.9?

The comments in the patch were fine. I applied this patch and just sent
a pull request for ARM-SoC maintainers too. Hopefully its not too late
for v4.9

Thanks,
Sekhar

^ permalink raw reply

* [GIT PULL] DaVinci DTS updates for v4.9 (part 2)
From: Sekhar Nori @ 2016-09-15 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

The following changes since commit 9d05b389846312751108b16f3f8fccd51fa92715:

  ARM: dts: da850-lcdk: Audio support via simple-card (2016-08-19 17:51:27 +0530)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git tags/davinci-for-v4.9/dts-p2

for you to fetch changes up to 9304af1b9ffa95dcb37d642852f8c67b98ea349a:

  ARM: dts: da850-lcdk: Add NAND to DT (2016-09-15 19:37:32 +0530)

----------------------------------------------------------------
This pull request adds NAND support to
DA850 based LCDK board.

----------------------------------------------------------------
Karl Beldan (1):
      ARM: dts: da850-lcdk: Add NAND to DT

 arch/arm/boot/dts/da850-lcdk.dts | 83 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

^ permalink raw reply

* [PATCH] soc: rockchip: power-domain: Handle errors from of_genpd_add_provider_onecell
From: Heiko Stübner @ 2016-09-15 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1473936221-9248-1-git-send-email-tomeu.vizoso@collabora.com>

Am Donnerstag, 15. September 2016, 12:43:41 schrieb Tomeu Vizoso:
> It was a bit surprising that the device was reported to have probed just
> fine, but the provider hadn't been registered.
> 
> So handle any errors when registering the provider and fail the probe
> accordingly.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Caesar Wang <wxt@rock-chips.com>
> ---
>  drivers/soc/rockchip/pm_domains.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/rockchip/pm_domains.c
> b/drivers/soc/rockchip/pm_domains.c index 7acd1517dd37..57e920128cb2 100644
> --- a/drivers/soc/rockchip/pm_domains.c
> +++ b/drivers/soc/rockchip/pm_domains.c
> @@ -627,7 +627,11 @@ static int rockchip_pm_domain_probe(struct
> platform_device *pdev) goto err_out;
>  	}
> 
> -	of_genpd_add_provider_onecell(np, &pmu->genpd_data);
> +	error = of_genpd_add_provider_onecell(np, &pmu->genpd_data);
> +	if (error) {
> +		dev_err(dev, "failed to add provider: %d\n", error);
> +		goto err_out;
> +	}
> 
>  	return 0;

Looks good in itself, but seems to trigger some issue in the genpd code
when applied alone on top of linux-next-20160915. Looks like genpd
is missing counter-initialization somewhere, as I'm seeing now:

[    1.664744] genpd_poweroff_unused disabling (null)
[    1.669553] ------------[ cut here ]------------
[    1.674169] WARNING: CPU: 0 PID: 1 at ../kernel/workqueue.c:1440 __queue_work+0x2b8/0x3f8
[    1.682337] Modules linked in:
[    1.685401] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc6-next-20160915-00001-g7432710-dirty #5
[    1.694608] Hardware name: Rockchip (Device Tree)
[    1.699312] [<c0310388>] (unwind_backtrace) from [<c030ba04>] (show_stack+0x10/0x14)
[    1.707050] [<c030ba04>] (show_stack) from [<c0599c90>] (dump_stack+0x90/0xa4)
[    1.714267] [<c0599c90>] (dump_stack) from [<c0341bc0>] (__warn+0xe8/0x100)
[    1.721221] [<c0341bc0>] (__warn) from [<c0341c88>] (warn_slowpath_null+0x20/0x28)
[    1.728785] [<c0341c88>] (warn_slowpath_null) from [<c0355b28>] (__queue_work+0x2b8/0x3f8)
[    1.737041] [<c0355b28>] (__queue_work) from [<c0355ca8>] (queue_work_on+0x40/0x4c)
[    1.744692] [<c0355ca8>] (queue_work_on) from [<c103e8b8>] (genpd_poweroff_unused+0x78/0x9c)
[    1.753123] [<c103e8b8>] (genpd_poweroff_unused) from [<c0301e78>] (do_one_initcall+0x40/0x170)
[    1.761815] [<c0301e78>] (do_one_initcall) from [<c1000dc8>] (kernel_init_freeable+0x15c/0x1fc)
[    1.770507] [<c1000dc8>] (kernel_init_freeable) from [<c0bb7ba0>] (kernel_init+0x8/0x114)
[    1.778678] [<c0bb7ba0>] (kernel_init) from [<c0307df8>] (ret_from_fork+0x14/0x3c)
[    1.786240] ---[ end trace b38c51ace1463add ]---
[    1.790875] genpd_poweroff_unused disabling ??????
[    1.795856] genpd_poweroff_unused disabling ??????
[    1.800830] ------------[ cut here ]------------
[    1.805443] WARNING: CPU: 0 PID: 1 at ../kernel/workqueue.c:1440 __queue_work+0x2b8/0x3f8
[    1.813610] Modules linked in:
[    1.816673] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W       4.8.0-rc6-next-20160915-00001-g7432710-dirty #5
[    1.827094] Hardware name: Rockchip (Device Tree)
[    1.831795] [<c0310388>] (unwind_backtrace) from [<c030ba04>] (show_stack+0x10/0x14)
[    1.839532] [<c030ba04>] (show_stack) from [<c0599c90>] (dump_stack+0x90/0xa4)
[    1.846747] [<c0599c90>] (dump_stack) from [<c0341bc0>] (__warn+0xe8/0x100)
[    1.853700] [<c0341bc0>] (__warn) from [<c0341c88>] (warn_slowpath_null+0x20/0x28)
[    1.861264] [<c0341c88>] (warn_slowpath_null) from [<c0355b28>] (__queue_work+0x2b8/0x3f8)
[    1.869521] [<c0355b28>] (__queue_work) from [<c0355ca8>] (queue_work_on+0x40/0x4c)
[    1.877170] [<c0355ca8>] (queue_work_on) from [<c103e8b8>] (genpd_poweroff_unused+0x78/0x9c)
[    1.885600] [<c103e8b8>] (genpd_poweroff_unused) from [<c0301e78>] (do_one_initcall+0x40/0x170)
[    1.894290] [<c0301e78>] (do_one_initcall) from [<c1000dc8>] (kernel_init_freeable+0x15c/0x1fc)
[    1.902981] [<c1000dc8>] (kernel_init_freeable) from [<c0bb7ba0>] (kernel_init+0x8/0x114)
[    1.911152] [<c0bb7ba0>] (kernel_init) from [<c0307df8>] (ret_from_fork+0x14/0x3c)
[    1.918713] ---[ end trace b38c51ace1463ade ]---
[    1.923338] genpd_poweroff_unused disabling ??????
[    1.928325] genpd_poweroff_unused disabling ??????

[+ millions more of those]

^ permalink raw reply

* [PATCH v3 3/3] ASoC: sun4i-codec: Add custom regmap configs for the A10 and A20 variants.
From: Danny Milosavljevic @ 2016-09-15 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915143922.4890-1-dannym@scratchpost.org>

ASoC: sun4i-codec: Add custom regmap configs for the A10 and A20 variants.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 3b53b78..c5d6d84c 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -682,12 +682,37 @@ static const struct regmap_config sun4i_codec_regmap_config = {
 	.reg_bits	= 32,
 	.reg_stride	= 4,
 	.val_bits	= 32,
+	.max_register	= SUN4I_CODEC_ADC_RXCNT,
+};
+
+static const struct regmap_config sun7i_codec_regmap_config = {
+	.reg_bits	= 32,
+	.reg_stride	= 4,
+	.val_bits	= 32,
 	.max_register	= SUN7I_CODEC_AC_MIC_PHONE_CAL,
 };
 
+struct sun4i_codec_quirks {
+	const struct regmap_config *regmap_config;
+};
+
+static const struct sun4i_codec_quirks sun4i_codec_quirks = {
+	.regmap_config = &sun4i_codec_regmap_config,
+};
+
+static const struct sun4i_codec_quirks sun7i_codec_quirks = {
+	.regmap_config = &sun7i_codec_regmap_config,
+};
+
 static const struct of_device_id sun4i_codec_of_match[] = {
-	{ .compatible = "allwinner,sun4i-a10-codec" },
-	{ .compatible = "allwinner,sun7i-a20-codec" },
+	{
+		.compatible = "allwinner,sun4i-a10-codec",
+		.data = &sun4i_codec_quirks,
+	},
+	{
+		.compatible = "allwinner,sun7i-a20-codec",
+		.data = &sun7i_codec_quirks,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
@@ -760,6 +785,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card;
 	struct sun4i_codec *scodec;
+	const struct sun4i_codec_quirks *quirks;
 	struct resource *res;
 	void __iomem *base;
 	int ret;
@@ -777,8 +803,9 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 		return PTR_ERR(base);
 	}
 
+	quirks = of_device_get_match_data(&pdev->dev);
 	scodec->regmap = devm_regmap_init_mmio(&pdev->dev, base,
-					     &sun4i_codec_regmap_config);
+					       quirks->regmap_config);
 	if (IS_ERR(scodec->regmap)) {
 		dev_err(&pdev->dev, "Failed to create our regmap\n");
 		return PTR_ERR(scodec->regmap);

^ permalink raw reply related

* [PATCH v3 2/3] ASoC: rename "SUN4I_CODEC_SYS_VERI" to "SUN7I_CODEC_AC_DAC_CAL"; rename "SUN4I_CODEC_AC_MIC_PHONE_CAL" to "SUN7I_CODEC_AC_MIC_PHONE_CAL".
From: Danny Milosavljevic @ 2016-09-15 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915143922.4890-1-dannym@scratchpost.org>

This patch renames some sun7i-only registers to reflect that fact.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index c2c0583..3b53b78 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -96,8 +96,8 @@
 /* Other various ADC registers */
 #define SUN4I_CODEC_DAC_TXCNT			(0x30)
 #define SUN4I_CODEC_ADC_RXCNT			(0x34)
-#define SUN4I_CODEC_AC_SYS_VERI			(0x38)
-#define SUN4I_CODEC_AC_MIC_PHONE_CAL		(0x3c)
+#define SUN7I_CODEC_AC_DAC_CAL			(0x38)
+#define SUN7I_CODEC_AC_MIC_PHONE_CAL		(0x3c)
 
 struct sun4i_codec {
 	struct device	*dev;
@@ -682,7 +682,7 @@ static const struct regmap_config sun4i_codec_regmap_config = {
 	.reg_bits	= 32,
 	.reg_stride	= 4,
 	.val_bits	= 32,
-	.max_register	= SUN4I_CODEC_AC_MIC_PHONE_CAL,
+	.max_register	= SUN7I_CODEC_AC_MIC_PHONE_CAL,
 };
 
 static const struct of_device_id sun4i_codec_of_match[] = {

^ permalink raw reply related

* [PATCH v3 1/3] ASoC: sun4i-codec: rename "sun4i_codec_widgets" to "sun4i_codec_controls" for consistency with the struct field name.
From: Danny Milosavljevic @ 2016-09-15 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160915143922.4890-1-dannym@scratchpost.org>

ASoC: sun4i-codec: rename "sun4i_codec_widgets" to "sun4i_codec_controls" for
consistency with the struct field name.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 0e19c50..c2c0583 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -509,7 +509,7 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
 
 static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
 
-static const struct snd_kcontrol_new sun4i_codec_widgets[] = {
+static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
 		       sun4i_codec_pa_volume_scale),
@@ -629,8 +629,8 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 
 static struct snd_soc_codec_driver sun4i_codec_codec = {
 	.component_driver = {
-		.controls		= sun4i_codec_widgets,
-		.num_controls		= ARRAY_SIZE(sun4i_codec_widgets),
+		.controls		= sun4i_codec_controls,
+		.num_controls		= ARRAY_SIZE(sun4i_codec_controls),
 		.dapm_widgets		= sun4i_codec_codec_dapm_widgets,
 		.num_dapm_widgets	= ARRAY_SIZE(sun4i_codec_codec_dapm_widgets),
 		.dapm_routes		= sun4i_codec_codec_dapm_routes,

^ permalink raw reply related

* [PATCH v3 0/3] ASoC: sun4i-codec: Distinguish sun4i from sun7i
From: Danny Milosavljevic @ 2016-09-15 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

Introduce mechanism to detect sun7i and provide a different regmap different compared to sun4i Allwinner A10.
 
The controls will be extended in a forthcoming patch - it is necessary to
distinguish between sun4i and sun7i controls because they have different registers.
 
Renamed SUN4I_CODEC_AC_SYS_VERI to SUN7I_CODEC_AC_DAC_CAL and renamed
SUN4I_CODEC_AC_MIC_PHONE_CAL to SUN7I_CODEC_AC_MIC_PHONE_CAL because these
are actually not present on Allwinner A10.

Handle quirks by regmap config and codec and select the correct quirks
automatically.  

Danny Milosavljevic (3):
  ASoC: sun4i-codec: rename "sun4i_codec_widgets" to
    "sun4i_codec_controls" for consistency with the struct field name.
  ASoC: rename "SUN4I_CODEC_SYS_VERI" to "SUN7I_CODEC_AC_DAC_CAL";
    rename "SUN4I_CODEC_AC_MIC_PHONE_CAL" to
    "SUN7I_CODEC_AC_MIC_PHONE_CAL".
  ASoC: sun4i-codec: Add custom regmap configs for the A10 and A20
    variants.

 sound/soc/sunxi/sun4i-codec.c | 45 ++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

^ permalink raw reply

* [PATCH v2 6/8] ARM: dts: sun9i: a80-optimus: Add AXP806 PMIC device node and regulators
From: Chen-Yu Tsai @ 2016-09-15 14:33 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20160827075544.26316-7-wens@csie.org>

Hi Maxime,

On Sat, Aug 27, 2016 at 3:55 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> The AXP806 PMIC is the secondary PMIC. It provides various supply
> voltages for the SoC and other peripherals. The PMIC's interrupt
> line is connected to NMI pin of the SoC.
>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

The driver patches have all been merged into the mfd tree. Could
you queue up the dts patches?

Thanks
ChenYu

^ permalink raw reply

* [PATCH] ARM: multi_v7_defconfig: enable CONFIG_EFI
From: Ard Biesheuvel @ 2016-09-15 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

This enables CONFIG_EFI for multi_v7_defconfig, which adds support for
booting via EFI, and for the EFI framebuffer as builtin options. It
also enables the EFI rtc, the EFI variable pseudo-filesystem and the
EFI capsule loader as modules.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

We have been happily booting multi_v7_defconfig+CONFIG_EFI=y kernels on
kernelci for months now, so please consider enabling this by default.
The increase in compressed kernel footprint is ~30 KB, for the uncompressed
kernel it's ~10 KB, some of which is .init code.

 arch/arm/configs/multi_v7_defconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 2c8665cd9dc5..f30e8b44ea0d 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -129,6 +129,7 @@ CONFIG_CMA=y
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_KEXEC=y
+CONFIG_EFI=y
 CONFIG_CPU_FREQ=y
 CONFIG_CPU_FREQ_STAT_DETAILS=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
@@ -593,6 +594,7 @@ CONFIG_DRM_PANEL_SIMPLE=y
 CONFIG_DRM_STI=m
 CONFIG_DRM_VC4=y
 CONFIG_FB_ARMCLCD=y
+CONFIG_FB_EFI=y
 CONFIG_FB_WM8505=y
 CONFIG_FB_SH_MOBILE_LCDC=y
 CONFIG_FB_SIMPLE=y
@@ -750,6 +752,7 @@ CONFIG_RTC_DRV_S35390A=m
 CONFIG_RTC_DRV_RX8581=m
 CONFIG_RTC_DRV_EM3027=y
 CONFIG_RTC_DRV_DA9063=m
+CONFIG_RTC_DRV_EFI=m
 CONFIG_RTC_DRV_DIGICOLOR=m
 CONFIG_RTC_DRV_S5M=m
 CONFIG_RTC_DRV_S3C=m
@@ -867,6 +870,8 @@ CONFIG_NVMEM=y
 CONFIG_NVMEM_SUNXI_SID=y
 CONFIG_BCM2835_MBOX=y
 CONFIG_RASPBERRYPI_FIRMWARE=y
+CONFIG_EFI_VARS=m
+CONFIG_EFI_CAPSULE_LOADER=m
 CONFIG_EXT4_FS=y
 CONFIG_AUTOFS4_FS=y
 CONFIG_MSDOS_FS=y
-- 
2.7.4

^ permalink raw reply related

* [PATCH V3 2/4] ARM64 LPC: LPC driver implementation on Hip06
From: Gabriele Paoloni @ 2016-09-15 14:28 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <26171742.fWcrANu6EP@wuerfel>

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd at arndb.de]
> Sent: 15 September 2016 13:25
> To: linux-arm-kernel at lists.infradead.org
> Cc: Gabriele Paoloni; devicetree at vger.kernel.org;
> lorenzo.pieralisi at arm.com; minyard at acm.org; linux-pci at vger.kernel.org;
> gregkh at linuxfoundation.org; John Garry; will.deacon at arm.com; linux-
> kernel at vger.kernel.org; Yuanzhichang; Linuxarm; xuwei (O); linux-
> serial at vger.kernel.org; benh at kernel.crashing.org;
> zourongrong at gmail.com; liviu.dudau at arm.com; kantyzc at 163.com;
> zhichang.yuan02 at gmail.com
> Subject: Re: [PATCH V3 2/4] ARM64 LPC: LPC driver implementation on
> Hip06
> 
> On Thursday, September 15, 2016 12:05:51 PM CEST Gabriele Paoloni
> wrote:
> > > -----Original Message-----
> > > On Thursday, September 15, 2016 8:02:27 AM CEST Gabriele Paoloni
> wrote:
> > > >
> > > > From <<3.1.1. Open Firmware Properties for Bus Nodes>> in
> > > > http://www.firmware.org/1275/bindings/isa/isa0_4d.ps
> > > >
> > > > I quote:
> > > > "There shall be an entry in the "ranges" property for each
> > > > of the Memory and/or I/O spaces if that address space is
> > > > mapped through the bridge."
> > > >
> > > > It seems to me that it is ok to have 1:1 address mapping and that
> > > > therefore of_translate_address() should fail if "ranges" is not
> > > > present.
> > >
> > > The key here is the definition of "mapped through the bridge".
> > > I can only understand this as "directly mapped", i.e. an I/O
> > > port of the child bus corresponds directly to a memory address
> > > on the parent bus, but this is not the case here.
> > >
> > > The problem with adding the mapping here is that it looks
> > > like it should be valid to create a page table entry for
> > > the address returned from the translation and access it through
> > > a pointer dereference, but that is clearly not possible.
> >
> > I understand that somehow we are abusing of the ranges property
> > here however the point is that with the current implementation ranges
> > is needed because otherwise the ipmi driver probe will fail here:
> >
> > of_ipmi_probe -> of_address_to_resource -> __of_address_to_resource
> > -> of_translate_address -> __of_translate_address
> >
> > Now we had a bit of discussion internally and to avoid
> > having ranges we came up with two possible solutions:
> >
> > 1) Using bit 3 of phys.hi cell in 2.2.1 of
> > http://www.firmware.org/1275/bindings/isa/isa0_4d.ps
> > This would mean reworking of_bus_isa_get_flags in
> > http://lxr.free-electrons.com/source/drivers/of/address.c#L398
> > and setting a new flag to be checked in __of_address_to_resource
> >
> > 2) Adding a property in the bindings of each device that is
> > a child of our LPC bus and modify __of_address_to_resource
> > to check if the property is in the DT and eventually bypass
> > of_translate_address
> >
> > However in both 1) and 2) there are some issues:
> > in 1) we are not complying with the isa binding doc (we use
> > a bit that should be zero); in 2) we need to modify the
> > bindings documentation of the devices that are connected
> > to our LPC controller (therefore modifying other devices
> > bindings to fit our special case).
> >
> > I think that maybe having the 1:1 range mapping doesn't
> > reflect well the reality but it is the less painful
> > solution...
> >
> > What's your view?
> 
> We can check the 'i' bit for I/O space in of_bus_isa_get_flags,
> and that should be enough to translate the I/O port number.
> 
> The only part we need to change here is to not go through
> the crazy conversion all the way from PCI I/O space to a
> physical address and back to a (logical) port number
> that we do today with of_translate_address/pci_address_to_pio.
> 
> I can think of a several of ways to fix __of_address_to_resource
> to just do the right thing according to the ISA binding to
> make the normal drivers work.
> 
> The easiest solution is probably to hook into the
> "taddr == OF_BAD_ADDR" case in __of_address_to_resource
> and add a lookup for ISA buses there, and instead check
> if some special I/O port operations were registered
> for the port number, using an architecture specific
> function that arm64 implements. Other architectures
> like x86 that don't have a direct mapping between I/O
> ports and MMIO addresses would implement that same
> function differently.

So with respect to this patchset once we enter the
"taddr == OF_BAD_ADDR" case you would add an arch
specific function that checks if the resource is an I/O 
resource, if the parent node is an ISA bus (calling 
of_bus_isa_match) and if arm64_extio_ops is non NULL. 
 
I think it can work for us and it doesn't affect current
devices. I will talk to Zhichang about this for the next
patchset version.

Many Thanks for your ideas

Gab


> 
> 	Arnd

^ permalink raw reply

* [PATCH 4/5] ARM: dts: exynos: add support for ISP power domain to exynos4x12 clocks device
From: Ulf Hansson @ 2016-09-15 14:13 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <6e52af56-8b0e-d8c4-62c2-6efeee0e912d@samsung.com>

[...]

>>> I see some serious design problems with multiple entries in power domains
>>> property. First how to show that some part of the device IS NOT in
>>> any domain?
>>
>> Is that even possible? Every device should be in some power
>> domain, even if it's just an "always on" power domain that we
>> don't really control from software.
>
>
> Right now none dts of which I'm aware of doesn't define the power domain for
> the parts of the SoC, which are always on and doesn't need any additional
> management.

Actually there's is one reason for doing this, as it would allow
devices to be monitored for device PM QoS constraints by the genpd
governor.

Although, I doubt's someone actually does it because of this benefit,
at least yet.

[...]

Kind regards
Uffe

^ permalink raw reply

* [RFC PATCH v2 05/11] ACPI: platform: setup MSI domain for ACPI based platform device
From: Hanjun Guo @ 2016-09-15 14:05 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <57D97087.5040703@arm.com>

Hi Marc,

Thanks for your review, reply inline.

On 09/14/2016 11:45 PM, Marc Zyngier wrote:
> On 14/09/16 15:21, Hanjun Guo wrote:
>> From: Hanjun Guo <hanjun.guo@linaro.org>
>>
>> With the platform msi domain created, we can set up the msi domain
>> for a platform device when it's probed.
>>
>> This patch introduces acpi_configure_msi_domain(), which retrieves
>> the domain from iort and set it to platform device.
>>
>> As some platform devices such as an irqchip needs the msi irqdomain
>> to be the interrupt parent domain, we need to get irqdomain before
>> platform device is probed.
>>
>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>> Cc: Greg KH <gregkh@linuxfoundation.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Cc: Tomasz Nowicki <tn@semihalf.com>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> ---
>>   drivers/acpi/arm64/iort.c   |  5 ++++-
>>   drivers/base/platform-msi.c | 15 ++++++++++++++-
>>   drivers/base/platform.c     |  2 ++
>>   include/linux/msi.h         |  1 +
>>   4 files changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
>> index 13a1905..bccd3cc 100644
>> --- a/drivers/acpi/arm64/iort.c
>> +++ b/drivers/acpi/arm64/iort.c
>> @@ -478,6 +478,7 @@ struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id)
>>   {
>>   	struct fwnode_handle *handle;
>>   	int its_id;
>> +	enum irq_domain_bus_token bus_token;
>>
>>   	if (iort_dev_find_its_id(dev, req_id, 0, &its_id))
>>   		return NULL;
>> @@ -486,7 +487,9 @@ struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id)
>>   	if (!handle)
>>   		return NULL;
>>
>> -	return irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI);
>> +	bus_token = dev_is_pci(dev) ?
>> +			DOMAIN_BUS_PCI_MSI : DOMAIN_BUS_PLATFORM_MSI;
>> +	return irq_find_matching_fwnode(handle, bus_token);
>>   }
>>
>>   static int __get_pci_rid(struct pci_dev *pdev, u16 alias, void *data)
>> diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
>> index 279e539..f6eae18 100644
>> --- a/drivers/base/platform-msi.c
>> +++ b/drivers/base/platform-msi.c
>> @@ -17,8 +17,8 @@
>>    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>>    */
>>
>> +#include <linux/acpi_iort.h>
>>   #include <linux/device.h>
>> -#include <linux/idr.h>
>>   #include <linux/irq.h>
>>   #include <linux/irqdomain.h>
>>   #include <linux/msi.h>
>> @@ -416,3 +416,16 @@ int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq,
>>
>>   	return err;
>>   }
>> +
>> +int acpi_configure_msi_domain(struct device *dev)
>> +{
>> +	struct irq_domain *d = NULL;
>> +
>> +	d = iort_get_device_domain(dev, 0);
>
> This looks completely wrong. Why RID 0? As far as I can see, 0 is not a
> special value, and could be something else.

You are right. I tried to reuse the API of get irqdomain in IORT for
PCI devices, but for platform device, we don't have req id in named
component, so I just pass 0 here, I think I need to prepare another
API for platform devices.

>
>> +	if (d) {
>> +		dev_set_msi_domain(dev, d);
>> +		return 0;
>> +	}
>> +
>> +	return -EINVAL;
>> +}
>
> I really hate this, as the platform MSI code is intentionally free of
> any firmware reference. This should live in the ACPI code.

Will do, I think locate it in iort.c is better.

>
>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>> index 6482d47..ea01a37 100644
>> --- a/drivers/base/platform.c
>> +++ b/drivers/base/platform.c
>> @@ -24,6 +24,7 @@
>>   #include <linux/pm_domain.h>
>>   #include <linux/idr.h>
>>   #include <linux/acpi.h>
>> +#include <linux/msi.h>
>>   #include <linux/clk/clk-conf.h>
>>   #include <linux/limits.h>
>>   #include <linux/property.h>
>> @@ -500,6 +501,7 @@ struct platform_device *platform_device_register_full(
>>   	pdev->dev.parent = pdevinfo->parent;
>>   	pdev->dev.fwnode = pdevinfo->fwnode;
>>
>> +	acpi_configure_msi_domain(&pdev->dev);
>
> It feels odd to put this in the generic code, while you could perfectly
> put the call into acpi_platform.c and keep the firmware stuff away from
> the generic code.

My feeling is the same, I'm still trying to find a new way to do it,
but I can't simply put that in acpi_platform.c, because

acpi_create_platform_device()
    platform_device_register_full()
	platform_device_alloc()  --> dev is alloced
         ...
         dev.fwnode  is set
	(I get the msi domain by the fwnode in acpi_configure_msi_domain)
         ...
         platform_device_add()  --> which the device is probed.

For devices like irqchip which needs the dev->msi_domain to be
set before it's really probed, because it needs the msi domain
to be the parent domain.

If I call the function in acpi_create_platform_device() before
platform_device_register_full(), we just can't set dev's msi
domain, but if call it after platform_device_register_full(),
the irqchip like mbigen will not get its parent domain...

DT is using another API for platform device probe, so has no
problems like I said above, any suggestions to do it right in
ACPI?

Thanks
Hanjun

^ permalink raw reply

* [PATCH 0/8] drm/rockchip: Flip wait clean-up
From: Sean Paul @ 2016-09-15 14:02 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1473857701-9250-1-git-send-email-tfiga@chromium.org>

On Wed, Sep 14, 2016 at 8:54 AM, Tomasz Figa <tfiga@chromium.org> wrote:
> The display controller found on Rockchip SoCs supported by Rockchip DRM
> driver (VOP) is a bit problematic, because it does not provide hardware
> vblank counter. Because vblank interrupt is used to feed the software
> counter, the driver had custom code to wait for flip completion to avoid
> race between atomic flush and vblank interrupt handler.
>
> This, however, brought a different set of issues. In fact, even with the
> custom wait code, there is stil a race between the handler and driver
> state update (of the values used to compare with registers to determine
> if flip has completed). On top of that, legacy cursor updates are not
> implemented properly and have to wait for vblank to complete, which
> is against the API specification.
>
> This series attempts to clean up the driver from this custom waiting code,
> eliminating related races and bringing correct handling of legacy cursor
> plane. It also gives a nice effect of more than 100 lines of code removed.
>
> This is a forward port of patches from 4.4 kernel used by ChromiumOS and
> tested there. Even though the code base has not changed significantly, it
> would be nice if someone with proper testing environment could give them
> a try.
>
> Based on for-next branch of Sean Paul's dogwood tree:
> https://cgit.freedesktop.org/~seanpaul/dogwood/log/?h=for-next
> git://people.freedesktop.org/~seanpaul/dogwood
>

Thanks for the patches, Tomasz.

I'll queue them up in my rockchip for-next branch.

Sean



> Tomasz Figa (8):
>   drm/rockchip: Clear interrupt status bits before enabling
>   drm/rockchip: Get rid of some unnecessary code
>   drm/rockchip: Avoid race with vblank count increment
>   drm/rockchip: Unreference framebuffers from flip work
>   drm/rockchip: Replace custom wait_for_vblanks with helper
>   drm/rockchip: Do not enable vblank without event
>   drm/rockchip: Always signal event in next vblank after cfg_done
>   drm/rockchip: Kill vop_plane_state
>
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c  |  64 +------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 247 +++++++++++-----------------
>  3 files changed, 95 insertions(+), 217 deletions(-)
>
> --
> 2.8.0.rc3.226.g39d4020
>

^ permalink raw reply

* [REGRESSION] BISECTED : ethernet gadget not working anymore on several atmel platforms
From: Alexandre Belloni @ 2016-09-15 13:50 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CACQ1gAhUDq4G5Prjp0Fp2yY7++c3TNHuHZj=_st4JTVCLO1wRA@mail.gmail.com>

Hi,

On 15/09/2016 at 14:29:24 +0200, Richard Genoud wrote :
> Since:
> commit c32b5bcfa3c43a3c9bb59f65b5e76adb7384c4c8
> Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Date:   Tue Jul 12 22:45:59 2016 +0200
> 
>     ARM: dts: at91: Fix USB endpoint nodes
> 
>     Endpoint nodes have a reg property. Add their mandatory unit-address.
> 
> Booting with an USB gadget configured as Ethernet gadget + RNDIS

Good catch, I seem to have forgotten a patch in that series. I4ll send
that shortly.

> Gives a warning:
> 
> On AT91SAM9x5 platform (g35) :
> g_ether gadget: high-speed config #1: CDC Ethernet (ECM)
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at drivers/usb/gadget/udc/core.c:264
> usb_ep_queue+0x4c/0xec
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.8.0-rc6-00071-gcc183ac148d0 #134
> Hardware name: Atmel AT91SAM9
> [<c000f164>] (unwind_backtrace) from [<c000d158>] (show_stack+0x20/0x24)
> [<c000d158>] (show_stack) from [<c01ba940>] (dump_stack+0x20/0x28)
> [<c01ba940>] (dump_stack) from [<c0017f30>] (__warn+0xe0/0x10c)
> [<c0017f30>] (__warn) from [<c001802c>] (warn_slowpath_null+0x30/0x38)
> [<c001802c>] (warn_slowpath_null) from [<c02cd78c>] (usb_ep_queue+0x4c/0xec)
> [<c02cd78c>] (usb_ep_queue) from [<c02d55b8>] (ecm_do_notify+0x134/0x150)
> [<c02d55b8>] (ecm_do_notify) from [<c02d5840>] (ecm_set_alt+0x14c/0x154)
> [<c02d5840>] (ecm_set_alt) from [<c02c9144>] (composite_setup+0xa2c/0x13c0)
> [<c02c9144>] (composite_setup) from [<c02d3a90>] (usba_udc_irq+0x888/0xb4c)
> [<c02d3a90>] (usba_udc_irq) from [<c00458a0>]
> (__handle_irq_event_percpu+0x74/0x1dc)
> [<c00458a0>] (__handle_irq_event_percpu) from [<c0045a34>]
> (handle_irq_event_percpu+0x2c/0x68)
> [<c0045a34>] (handle_irq_event_percpu) from [<c0045aa8>]
> (handle_irq_event+0x38/0x4c)
> [<c0045aa8>] (handle_irq_event) from [<c0048a94>]
> (handle_fasteoi_irq+0xa0/0x114)
> [<c0048a94>] (handle_fasteoi_irq) from [<c004512c>]
> (generic_handle_irq+0x28/0x38)
> [<c004512c>] (generic_handle_irq) from [<c00451cc>]
> (__handle_domain_irq+0x90/0xb8)
> [<c00451cc>] (__handle_domain_irq) from [<c0009450>] (aic_handle+0xb0/0xb8)
> [<c0009450>] (aic_handle) from [<c000dca8>] (__irq_svc+0x68/0x84)
> Exception stack(0xc788dc68 to 0xc788dcb0)
> dc60:                   00000151 000004f6 00000151 c7075b70 c89693b0 c8964000
> dc80: c79c7400 000060e8 c79aa000 c7bd55c0 00000023 c788dd3c c788dd00 c788dcb8
> dca0: c0319cc0 c0319cd4 80000013 ffffffff
> [<c000dca8>] (__irq_svc) from [<c0319cd4>] (ubi_attach_fastmap+0x858/0xcc8)
> [<c0319cd4>] (ubi_attach_fastmap) from [<c0278744>]
> (ubi_scan_fastmap+0x644/0x854)
> [<c0278744>] (ubi_scan_fastmap) from [<c027542c>] (scan_fast+0x10c/0x17c)
> [<c027542c>] (scan_fast) from [<c02757c0>] (ubi_attach+0xb0/0x21c)
> [<c02757c0>] (ubi_attach) from [<c0269520>] (ubi_attach_mtd_dev+0x320/0x820)
> [<c0269520>] (ubi_attach_mtd_dev) from [<c06b42d4>] (ubi_init+0x1a8/0x248)
> [<c06b42d4>] (ubi_init) from [<c0697df0>] (do_one_initcall+0xb4/0x16c)
> [<c0697df0>] (do_one_initcall) from [<c0697fb0>]
> (kernel_init_freeable+0x108/0x1d4)
> [<c0697fb0>] (kernel_init_freeable) from [<c04e3c84>] (kernel_init+0x18/0x100)
> [<c04e3c84>] (kernel_init) from [<c000a470>] (ret_from_fork+0x14/0x24)
> ---[ end trace 8150ab0dc38dec93 ]---
> 
> Same on SAMA5D3:
> g_ether gadget: high-speed config #1: CDC Ethernet (ECM)
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 0 at drivers/usb/gadget/udc/core.c:264
> usb_ep_queue+0x5c/0x64
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper Not tainted 4.8.0-rc6+ #135
> Hardware name: Atmel SAMA5
> [<c010ce70>] (unwind_backtrace) from [<c010a88c>] (show_stack+0x10/0x14)
> [<c010a88c>] (show_stack) from [<c0115bb0>] (__warn+0xe4/0xfc)
> [<c0115bb0>] (__warn) from [<c0115c78>] (warn_slowpath_null+0x20/0x28)
> [<c0115c78>] (warn_slowpath_null) from [<c03cc608>] (usb_ep_queue+0x5c/0x64)
> [<c03cc608>] (usb_ep_queue) from [<c03d1124>] (ecm_do_notify+0xec/0x14c)
> [<c03d1124>] (ecm_do_notify) from [<c03d130c>] (ecm_set_alt+0x74/0x150)
> [<c03d130c>] (ecm_set_alt) from [<c03c9364>] (composite_setup+0xb84/0x1570)
> [<c03c9364>] (composite_setup) from [<c03cf364>] (usba_udc_irq+0x878/0xd4c)
> [<c03cf364>] (usba_udc_irq) from [<c013f12c>]
> (__handle_irq_event_percpu+0x88/0x124)
> [<c013f12c>] (__handle_irq_event_percpu) from [<c013f1e4>]
> (handle_irq_event_percpu+0x1c/0x58)
> [<c013f1e4>] (handle_irq_event_percpu) from [<c013f248>]
> (handle_irq_event+0x28/0x3c)
> [<c013f248>] (handle_irq_event) from [<c0141c8c>]
> (handle_fasteoi_irq+0xa0/0x168)
> [<c0141c8c>] (handle_fasteoi_irq) from [<c013e87c>]
> (generic_handle_irq+0x24/0x34)
> [<c013e87c>] (generic_handle_irq) from [<c013ead8>]
> (__handle_domain_irq+0x54/0xa8)
> [<c013ead8>] (__handle_domain_irq) from [<c010b34c>] (__irq_svc+0x6c/0x90)
> [<c010b34c>] (__irq_svc) from [<c0130be4>] (finish_task_switch+0x4c/0x144)
> [<c0130be4>] (finish_task_switch) from [<c054b9d0>] (schedule+0x44/0x9c)
> [<c054b9d0>] (schedule) from [<c054bbd4>] (schedule_preempt_disabled+0xc/0x10)
> [<c054bbd4>] (schedule_preempt_disabled) from [<c01374b8>]
> (cpu_startup_entry+0x98/0xf4)
> [<c01374b8>] (cpu_startup_entry) from [<c0800c38>] (start_kernel+0x35c/0x368)
> [<c0800c38>] (start_kernel) from [<20008078>] (0x20008078)
> ---[ end trace 27b3e952067e1be6 ]---
> 
> And I guess it's the same on g45, 9rl, sama5d[2-4].
> 
> Bisect done with a 4.8-rc6 kernel.
> Here's the bisect log:
> git bisect start 'arch/arm/boot/dts/'
> # good: [882bd9fc46321c9d4721b376039a142cbfe8a17a] usb: gadget: udc:
> atmel: Also get regmap for at91sam9x5-pmc
> git bisect good 882bd9fc46321c9d4721b376039a142cbfe8a17a
> # bad: [694d0d0bb2030d2e36df73e2d23d5770511dbc8d] Linux 4.8-rc2
> git bisect bad 694d0d0bb2030d2e36df73e2d23d5770511dbc8d
> # good: [ab4b4340c7d74310a132cb457665bf3d98fdff79] Merge tag
> 'imx-dt-4.8' of
> git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into
> next/dt
> git bisect good ab4b4340c7d74310a132cb457665bf3d98fdff79
> # good: [349f9d5239c3dae3b984679fc9ee00b8deec542b] Merge tag
> 'sunxi-dt-for-4.8' of
> https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into
> next/dt
> git bisect good 349f9d5239c3dae3b984679fc9ee00b8deec542b
> # bad: [262a5d84b2aea8deb67eca813dc3008836330596] Merge tag
> 'sunxi-dt-for-4.8-2-bis' of
> https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into
> next/dt
> git bisect bad 262a5d84b2aea8deb67eca813dc3008836330596
> # good: [cda1c2bdf6df90c12363877fda594a0a1b7ac74a] Merge tag
> 'sti-late-v4.8' of
> git://git.kernel.org/pub/scm/linux/kernel/git/pchotard/sti into
> next/late
> git bisect good cda1c2bdf6df90c12363877fda594a0a1b7ac74a
> # good: [a0e4eb4b81b44663f21b289d8126ca6f6dc8a863] ARM: dts: sun8i:
> Use sun8i-reference-design-tablet for polaroid mid2809pxe04
> git bisect good a0e4eb4b81b44663f21b289d8126ca6f6dc8a863
> # bad: [d3c1c7181f55f3464529decad189f2317a2932da] ARM: dts: at91:
> vinco: fix regulator name
> git bisect bad d3c1c7181f55f3464529decad189f2317a2932da
> # bad: [a63f6a64cc1e78366382657cab70772240b6dcc2] ARM: dts: at91:
> sama5d3_xplained: fix regulator name
> git bisect bad a63f6a64cc1e78366382657cab70772240b6dcc2
> # bad: [c32b5bcfa3c43a3c9bb59f65b5e76adb7384c4c8] ARM: dts: at91: Fix
> USB endpoint nodes
> git bisect bad c32b5bcfa3c43a3c9bb59f65b5e76adb7384c4c8
> # good: [c94afa132b6d7f8e412a12da44da6203d2cd23d4] ARM: dts: at91: Fix
> ADC trigger nodes
> git bisect good c94afa132b6d7f8e412a12da44da6203d2cd23d4
> # first bad commit: [c32b5bcfa3c43a3c9bb59f65b5e76adb7384c4c8] ARM:
> dts: at91: Fix USB endpoint nodes
> 
> on xplained board, I used at91-sama5d3_xplained.dtb and sama5_defconfig plus :
> CONFIG_USB_ETH=y
> CONFIG_USB_ETH_RNDIS=y

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply

* [RFC PATCH 8/8] arm64: split thread_info from task stack
From: Mark Rutland @ 2016-09-15 13:49 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1473947349-14521-1-git-send-email-mark.rutland@arm.com>

This patch moves arm64's struct thread_info from the task stack into
task_struct. This protects thread_info from corruption in the case of
stack overflows, and makes its address harder to determine if stack
addresses are leaked, making a number of attacks more difficult. Precise
detection and handling of overflow is left for subsequent patches.

Largely, this involves changing code to store the task_struct in sp_el0,
and acquire the thread_info from the task struct (which is the opposite
way around to the current code). Both secondary entry and idle are
updated to stash the sp and task pointer separately.

Userspace clobbers sp_el0, and we can no longer restore this from the
stack. Instead, the current task is cached in a per-cpu variable that we
can safely access from early assembly as interrupts are disabled (and we
are thus not preemptible).

There remain opportunities for improvement. Currently we cannot remove
thread_info::cpu and always use task_struct::cpu, as this would result
in a circular include dependency for raw_smp_processor_id():

  <asm/smp.h> -> <linux/sched.h> -> <linux/smp.h> -> <asm/smp.h>

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/Kconfig                   |  2 ++
 arch/arm64/include/asm/Kbuild        |  1 -
 arch/arm64/include/asm/current.h     | 22 ++++++++++++++++++++++
 arch/arm64/include/asm/smp.h         |  1 +
 arch/arm64/include/asm/thread_info.h | 19 -------------------
 arch/arm64/kernel/asm-offsets.c      |  1 +
 arch/arm64/kernel/entry.S            |  4 ++--
 arch/arm64/kernel/head.S             | 11 +++++------
 arch/arm64/kernel/process.c          | 31 ++++++++++++++++++++++++++-----
 arch/arm64/kernel/smp.c              |  2 ++
 arch/arm64/kernel/stacktrace.c       |  5 +++++
 11 files changed, 66 insertions(+), 33 deletions(-)
 create mode 100644 arch/arm64/include/asm/current.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index bc3f00f..9f57318 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -11,6 +11,7 @@ config ARM64
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_SG_CHAIN
+	select ARCH_HAS_OWN_THREAD_INFO
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select ARCH_SUPPORTS_ATOMIC_RMW
@@ -110,6 +111,7 @@ config ARM64
 	select POWER_SUPPLY
 	select SPARSE_IRQ
 	select SYSCTL_EXCEPTION_TRACE
+	select THREAD_INFO_IN_TASK
 	help
 	  ARM 64-bit (AArch64) Linux support.
 
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index f43d2c4..a716c6f 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -2,7 +2,6 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += clkdev.h
 generic-y += cputime.h
-generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
 generic-y += dma.h
diff --git a/arch/arm64/include/asm/current.h b/arch/arm64/include/asm/current.h
new file mode 100644
index 0000000..f2bcbe2
--- /dev/null
+++ b/arch/arm64/include/asm/current.h
@@ -0,0 +1,22 @@
+#ifndef __ASM_CURRENT_H
+#define __ASM_CURRENT_H
+
+#include <linux/compiler.h>
+
+#include <asm/sysreg.h>
+
+#ifndef __ASSEMBLY__
+
+struct task_struct;
+
+static __always_inline struct task_struct *get_current(void)
+{
+	return (struct task_struct *)read_sysreg(sp_el0);
+}
+
+#define current get_current()
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ASM_CURRENT_H */
+
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 0226447..fef90c0 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -73,6 +73,7 @@ asmlinkage void secondary_start_kernel(void);
  */
 struct secondary_data {
 	void *stack;
+	struct task_struct *task;
 	long status;
 };
 
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index 796af24..5b16b34 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -46,14 +46,12 @@ typedef unsigned long mm_segment_t;
 struct thread_info {
 	unsigned long		flags;		/* low level flags */
 	mm_segment_t		addr_limit;	/* address limit */
-	struct task_struct	*task;		/* main task structure */
 	int			preempt_count;	/* 0 => preemptable, <0 => bug */
 	int			cpu;		/* cpu */
 };
 
 #define INIT_THREAD_INFO(tsk)						\
 {									\
-	.task		= &tsk,						\
 	.flags		= 0,						\
 	.preempt_count	= INIT_PREEMPT_COUNT,				\
 	.addr_limit	= KERNEL_DS,					\
@@ -66,23 +64,6 @@ struct thread_info {
  */
 register unsigned long current_stack_pointer asm ("sp");
 
-/*
- * how to get the thread information struct from C
- */
-static inline struct thread_info *current_thread_info(void) __attribute_const__;
-
-/*
- * struct thread_info can be accessed directly via sp_el0.
- */
-static inline struct thread_info *current_thread_info(void)
-{
-	unsigned long sp_el0;
-
-	asm ("mrs %0, sp_el0" : "=r" (sp_el0));
-
-	return (struct thread_info *)sp_el0;
-}
-
 #define thread_saved_pc(tsk)	\
 	((unsigned long)(tsk->thread.cpu_context.pc))
 #define thread_saved_sp(tsk)	\
diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
index ee764eb..242fe909 100644
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -120,6 +120,7 @@ int main(void)
   DEFINE(TZ_DSTTIME,		offsetof(struct timezone, tz_dsttime));
   BLANK();
   DEFINE(CPU_BOOT_STACK,	offsetof(struct secondary_data, stack));
+  DEFINE(CPU_BOOT_TASK,		offsetof(struct secondary_data, task));
   BLANK();
 #ifdef CONFIG_KVM_ARM_HOST
   DEFINE(VCPU_CONTEXT,		offsetof(struct kvm_vcpu, arch.ctxt));
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 52b4241..f844e7f 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -123,6 +123,7 @@
 	 * Set sp_el0 to current thread_info.
 	 */
 	.if	\el == 0
+	ldr_this_cpu	tsk, __entry_task, x21
 	msr	sp_el0, tsk
 	.endif
 
@@ -680,8 +681,7 @@ ENTRY(cpu_switch_to)
 	ldp	x29, x9, [x8], #16
 	ldr	lr, [x8]
 	mov	sp, x9
-	and	x9, x9, #~(THREAD_SIZE - 1)
-	msr	sp_el0, x9
+	msr	sp_el0, x1
 	ret
 ENDPROC(cpu_switch_to)
 
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index b77f583..abc7330 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -433,8 +433,7 @@ __primary_switched:
 	dsb	ishst				// Make zero page visible to PTW
 
 	adr_l	sp, initial_sp, x4
-	mov	x4, sp
-	and	x4, x4, #~(THREAD_SIZE - 1)
+	adr_l	x4, init_task
 	msr	sp_el0, x4			// Save thread_info
 	str_l	x21, __fdt_pointer, x5		// Save FDT pointer
 
@@ -680,10 +679,10 @@ __secondary_switched:
 	isb
 
 	adr_l	x0, secondary_data
-	ldr	x0, [x0, #CPU_BOOT_STACK]	// get secondary_data.stack
-	mov	sp, x0
-	and	x0, x0, #~(THREAD_SIZE - 1)
-	msr	sp_el0, x0			// save thread_info
+	ldr	x1, [x0, #CPU_BOOT_STACK]	// get secondary_data.stack
+	mov	sp, x1
+	ldr	x2, [x0, #CPU_BOOT_TASK]
+	msr	sp_el0, x2
 	mov	x29, #0
 	b	secondary_start_kernel
 ENDPROC(__secondary_switched)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 6cd2612..e35043d 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -45,6 +45,7 @@
 #include <linux/personality.h>
 #include <linux/notifier.h>
 #include <trace/events/power.h>
+#include <linux/percpu.h>
 
 #include <asm/alternative.h>
 #include <asm/compat.h>
@@ -314,6 +315,17 @@ static void uao_thread_switch(struct task_struct *next)
 }
 
 /*
+ * We store our current task in sp_el0, which is clobbered by userspace. Keep a
+ * shadow copy so that we can restore this upon entry from userspace.
+ */
+DEFINE_PER_CPU(struct task_struct *, __entry_task) = &init_task;
+
+static void entry_task_switch(struct task_struct *next)
+{
+	__this_cpu_write(__entry_task, next);
+}
+
+/*
  * Thread switching.
  */
 struct task_struct *__switch_to(struct task_struct *prev,
@@ -325,6 +337,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
 	tls_thread_switch(next);
 	hw_breakpoint_thread_switch(next);
 	contextidr_thread_switch(next);
+	entry_task_switch(next);
 	uao_thread_switch(next);
 
 	/*
@@ -342,11 +355,14 @@ struct task_struct *__switch_to(struct task_struct *prev,
 unsigned long get_wchan(struct task_struct *p)
 {
 	struct stackframe frame;
-	unsigned long stack_page;
+	unsigned long stack_page, ret = 0;
 	int count = 0;
 	if (!p || p == current || p->state == TASK_RUNNING)
 		return 0;
 
+	if (!try_get_task_stack(p))
+		return 0;
+
 	frame.fp = thread_saved_fp(p);
 	frame.sp = thread_saved_sp(p);
 	frame.pc = thread_saved_pc(p);
@@ -358,11 +374,16 @@ unsigned long get_wchan(struct task_struct *p)
 		if (frame.sp < stack_page ||
 		    frame.sp >= stack_page + THREAD_SIZE ||
 		    unwind_frame(p, &frame))
-			return 0;
-		if (!in_sched_functions(frame.pc))
-			return frame.pc;
+			goto out;
+		if (!in_sched_functions(frame.pc)) {
+			ret = frame.pc;
+			goto out;
+		}
 	} while (count ++ < 16);
-	return 0;
+
+out:
+	put_task_stack(p);
+	return ret;
 }
 
 unsigned long arch_align_stack(unsigned long sp)
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index d93d433..d84be9db 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -146,6 +146,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 	 * We need to tell the secondary core where to find its stack and the
 	 * page tables.
 	 */
+	secondary_data.task = idle;
 	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
 	update_cpu_boot_status(CPU_MMU_OFF);
 	__flush_dcache_area(&secondary_data, sizeof(secondary_data));
@@ -170,6 +171,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 		pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
 	}
 
+	secondary_data.task = NULL;
 	secondary_data.stack = NULL;
 	status = READ_ONCE(secondary_data.status);
 	if (ret && status) {
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index d9751a4..4e0efe8 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -157,6 +157,9 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 	struct stack_trace_data data;
 	struct stackframe frame;
 
+	if (!try_get_task_stack(tsk))
+		return;
+
 	data.trace = trace;
 	data.skip = trace->skip;
 
@@ -178,6 +181,8 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 	walk_stackframe(tsk, &frame, save_trace, &data);
 	if (trace->nr_entries < trace->max_entries)
 		trace->entries[trace->nr_entries++] = ULONG_MAX;
+
+	put_task_stack(tsk);
 }
 
 void save_stack_trace(struct stack_trace *trace)
-- 
1.9.1

^ permalink raw reply related

* [RFC PATCH 7/8] arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx
From: Mark Rutland @ 2016-09-15 13:49 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1473947349-14521-1-git-send-email-mark.rutland@arm.com>

When returning from idle, we rely on the fact that thread_info lives at
the end of the kernel stack, and restore this by masking the saved stack
pointer. Subsequent patches will sever the relationship between the
stack and thread_info, and to cater for this we must save/restore sp_el0
explicitly, storing it in cpu_suspend_ctx.

As cpu_suspend_ctx must be doubleword aligned, this leaves us with an
extra slot in cpu_suspend_ctx. We can use this to save/restore tpidr_el1
in the same way, which simplifies the code, avoiding pointer chasing on
the restore path (as we no longer need to load thread_info::cpu followed
by the relevant slot in __per_cpu_offset based on this).

This patch stashes both registers in cpu_suspend_ctx.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/include/asm/suspend.h | 2 +-
 arch/arm64/kernel/sleep.S        | 3 ---
 arch/arm64/kernel/suspend.c      | 6 ------
 arch/arm64/mm/proc.S             | 6 ++++++
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h
index 024d623..92d6a62 100644
--- a/arch/arm64/include/asm/suspend.h
+++ b/arch/arm64/include/asm/suspend.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_SUSPEND_H
 #define __ASM_SUSPEND_H
 
-#define NR_CTX_REGS 10
+#define NR_CTX_REGS 12
 #define NR_CALLEE_SAVED_REGS 12
 
 /*
diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index ccf79d8..74e6e19 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -132,9 +132,6 @@ ENTRY(_cpu_resume)
 	/* load sp from context */
 	ldr	x2, [x0, #CPU_CTX_SP]
 	mov	sp, x2
-	/* save thread_info */
-	and	x2, x2, #~(THREAD_SIZE - 1)
-	msr	sp_el0, x2
 	/*
 	 * cpu_do_resume expects x0 to contain context address pointer
 	 */
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index b616e365..9c33a49 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -42,12 +42,6 @@ void notrace __cpu_suspend_exit(void)
 	cpu_uninstall_idmap();
 
 	/*
-	 * Restore per-cpu offset before any kernel
-	 * subsystem relying on it has a chance to run.
-	 */
-	set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
-
-	/*
 	 * Restore HW breakpoint registers to sane values
 	 * before debug exceptions are possibly reenabled
 	 * through local_dbg_restore.
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index 5bb61de..0293db1 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -70,11 +70,14 @@ ENTRY(cpu_do_suspend)
 	mrs	x8, mdscr_el1
 	mrs	x9, oslsr_el1
 	mrs	x10, sctlr_el1
+	mrs	x11, tpidr_el1
+	mrs	x12, sp_el0
 	stp	x2, x3, [x0]
 	stp	x4, xzr, [x0, #16]
 	stp	x5, x6, [x0, #32]
 	stp	x7, x8, [x0, #48]
 	stp	x9, x10, [x0, #64]
+	stp	x11, x12, [x0, #80]
 	ret
 ENDPROC(cpu_do_suspend)
 
@@ -89,6 +92,7 @@ ENTRY(cpu_do_resume)
 	ldp	x6, x8, [x0, #32]
 	ldp	x9, x10, [x0, #48]
 	ldp	x11, x12, [x0, #64]
+	ldp	x13, x14, [x0, #80]
 	msr	tpidr_el0, x2
 	msr	tpidrro_el0, x3
 	msr	contextidr_el1, x4
@@ -102,6 +106,8 @@ ENTRY(cpu_do_resume)
 	msr	vbar_el1, x9
 	msr	mdscr_el1, x10
 	msr	sctlr_el1, x12
+	msr	tpidr_el1, x13
+	msr	sp_el0, x14
 	/*
 	 * Restore oslsr_el1 by writing oslar_el1
 	 */
-- 
1.9.1

^ permalink raw reply related


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