Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 8/8] x86/kernel: jump_table: use relative references
From: Steven Rostedt @ 2017-12-28 16:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAKv+Gu9Gza=RN_v_H-G7m7-qKg9B4Xf4GFvd_H-Gut-V3eabmA@mail.gmail.com>

On Thu, 28 Dec 2017 16:26:07 +0000
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> On 28 December 2017 at 16:19, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Wed, 27 Dec 2017 08:50:33 +0000
> > Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> >  
> >>  static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
> >>  {
> >> -     return entry->code;
> >> +     return (jump_label_t)&entry->code + entry->code;  
> >
> > I'm paranoid about doing arithmetic on abstract types. What happens in
> > the future if jump_label_t becomes a pointer? You will get a different
> > result.
> >  
> 
> In general, I share your concern. In this case, however, jump_label_t
> is typedef'd three lines up and is never used anywhere else.

I would agree if this was in a .c file, but it's in a header file,
which causes me to be more paranoid.

> 
> > Could we switch these calculations to something like:
> >
> >         return (jump_label_t)((long)&entrty->code + entry->code);
> >  
> 
> jump_label_t is local to this .h file, so it can be defined as u32 or
> u64 depending on the word size. I don't mind adding the extra cast,
> but I am not sure if your paranoia is justified in this particular
> case. Perhaps we should just use 'unsigned long' throughout?

Actually, that may be better. Have the return value be jump_label_t,
but the cast be "unsigned long". That way it should always work.

static inline jump_label_t jump_entry_code(...)
{
	return (unsigned long)&entry->code + entry->code;
}


-- Steve

^ permalink raw reply

* [PATCH v2 2/2] arm: dts: sun8i: a83t: a711: Add touchscreen node
From: Mylène Josserand @ 2017-12-28 16:33 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228163336.28131-1-mylene.josserand@free-electrons.com>

Tha A711 tablet has a FocalTech EDT-FT5x06 Polytouch touchscreen.
It is connected via I2C0. The reset line is PD5, the interrupt
line is PL7 and the VCC supply is the ldo_io0 regulator.

Signed-off-by: Myl?ne Josserand <mylene.josserand@free-electrons.com>
---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index a021ee6da396..7840f9aa9094 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -105,6 +105,22 @@
 	status = "okay";
 };
 
+&i2c0 {
+	clock-frequency = <400000>;
+	status = "okay";
+
+	touchscreen at 38 {
+		compatible = "edt,edt-ft5x06";
+		reg = <0x38>;
+		interrupt-parent = <&r_pio>;
+		interrupts = <0 7 IRQ_TYPE_EDGE_FALLING>;
+		reset-gpios = <&pio 3 5 GPIO_ACTIVE_LOW>;
+		vcc-supply = <&reg_ldo_io0>;
+		touchscreen-size-x = <1024>;
+		touchscreen-size-y = <600>;
+	};
+};
+
 &mmc0 {
 	vmmc-supply = <&reg_dcdc1>;
 	pinctrl-names = "default";
-- 
2.11.0

^ permalink raw reply related

* [PATCH v2 1/2] Input: edt-ft5x06 - Add support for regulator
From: Mylène Josserand @ 2017-12-28 16:33 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228163336.28131-1-mylene.josserand@free-electrons.com>

Add the support of regulator to use it as VCC source.

Signed-off-by: Myl?ne Josserand <mylene.josserand@free-electrons.com>
---
 .../bindings/input/touchscreen/edt-ft5x06.txt      |  1 +
 drivers/input/touchscreen/edt-ft5x06.c             | 33 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
index 025cf8c9324a..48e975b9c1aa 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
@@ -30,6 +30,7 @@ Required properties:
 Optional properties:
  - reset-gpios: GPIO specification for the RESET input
  - wake-gpios:  GPIO specification for the WAKE input
+ - vcc-supply:  Regulator that supplies the touchscreen
 
  - pinctrl-names: should be "default"
  - pinctrl-0:   a phandle pointing to the pin settings for the
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index c53a3d7239e7..5ee14a25a382 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -39,6 +39,7 @@
 #include <linux/input/mt.h>
 #include <linux/input/touchscreen.h>
 #include <linux/of_device.h>
+#include <linux/regulator/consumer.h>
 
 #define WORK_REGISTER_THRESHOLD		0x00
 #define WORK_REGISTER_REPORT_RATE	0x08
@@ -91,6 +92,7 @@ struct edt_ft5x06_ts_data {
 	struct touchscreen_properties prop;
 	u16 num_x;
 	u16 num_y;
+	struct regulator *vcc;
 
 	struct gpio_desc *reset_gpio;
 	struct gpio_desc *wake_gpio;
@@ -993,6 +995,23 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 
 	tsdata->max_support_points = chip_data->max_support_points;
 
+	tsdata->vcc = devm_regulator_get(&client->dev, "vcc");
+	if (IS_ERR(tsdata->vcc)) {
+		error = PTR_ERR(tsdata->vcc);
+		dev_err(&client->dev, "failed to request regulator: %d\n",
+			error);
+		return error;
+	};
+
+	if (tsdata->vcc) {
+		error = regulator_enable(tsdata->vcc);
+		if (error < 0) {
+			dev_err(&client->dev, "failed to enable vcc: %d\n",
+				error);
+			return error;
+		}
+	}
+
 	tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
 						     "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(tsdata->reset_gpio)) {
@@ -1122,20 +1141,34 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	if (device_may_wakeup(dev))
 		enable_irq_wake(client->irq);
 
+	if (tsdata->vcc)
+		regulator_disable(tsdata->vcc);
+
 	return 0;
 }
 
 static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
+	int ret;
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(client->irq);
 
+	if (tsdata->vcc) {
+		ret = regulator_enable(tsdata->vcc);
+		if (ret < 0) {
+			dev_err(dev, "failed to enable vcc: %d\n", ret);
+			return ret;
+		}
+	}
+
 	return 0;
 }
 
-- 
2.11.0

^ permalink raw reply related

* [PATCH v2 0/2] sun8i-a83t: Add touchscreen support on TBS A711
From: Mylène Josserand @ 2017-12-28 16:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hello everyone,

This is a V2 of the patch series that adds touchscreen support
(FocalTech EDT-FT5x06 Polytouch) for TBS A711 (Allwinner sun8i-a83t SoC).
Based on last linux-next (next-20171222).

Changes since v1:
   - Remove patches 01 and 02 as Chen-Yu Tsai sent a similar patch:
   https://patchwork.kernel.org/patch/10111431/
   and it is merged on last next-20171222.
   (See commit f066f46ce5a5 "ARM: dts: sun8i: a83t: Add I2C device nodes and pinmux settings")
   - Update regulator according to Dmitry Torokhov's review: remove "optional"
   suffix while retrieving the regulator, rename it into "vcc" instead of
   "power" and add bindings documentation.
   - Update device tree according to Maxime Ripard's review: remove the
   label and rename the node.
   - Squash patch 03 with patch 05 to add I2C0 and touchscreen's node
   in one patch (see patch 02).

Patch 01: Add support for regulator in the FocalTech touchscreen driver
because A711 tablet is using a regulator to power-up the touchscreen.
Patch 02: Add i2c0 and touchscreen's node for A711 TBS tablet.

Thank you in advance for any review.
Best regards,
Myl?ne

Myl?ne Josserand (2):
  Input: edt-ft5x06 - Add support for regulator
  arm: dts: sun8i: a83t: a711: Add touchscreen node

 .../bindings/input/touchscreen/edt-ft5x06.txt      |  1 +
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts          | 16 +++++++++++
 drivers/input/touchscreen/edt-ft5x06.c             | 33 ++++++++++++++++++++++
 3 files changed, 50 insertions(+)

-- 
2.11.0

^ permalink raw reply

* [PATCH v6 8/8] x86/kernel: jump_table: use relative references
From: Ard Biesheuvel @ 2017-12-28 16:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228111926.28e82877@gandalf.local.home>

On 28 December 2017 at 16:19, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 27 Dec 2017 08:50:33 +0000
> Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>
>>  static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
>>  {
>> -     return entry->code;
>> +     return (jump_label_t)&entry->code + entry->code;
>
> I'm paranoid about doing arithmetic on abstract types. What happens in
> the future if jump_label_t becomes a pointer? You will get a different
> result.
>

In general, I share your concern. In this case, however, jump_label_t
is typedef'd three lines up and is never used anywhere else.

> Could we switch these calculations to something like:
>
>         return (jump_label_t)((long)&entrty->code + entry->code);
>

jump_label_t is local to this .h file, so it can be defined as u32 or
u64 depending on the word size. I don't mind adding the extra cast,
but I am not sure if your paranoia is justified in this particular
case. Perhaps we should just use 'unsigned long' throughout?

>> +}
>> +
>> +static inline jump_label_t jump_entry_target(const struct jump_entry *entry)
>> +{
>> +     return (jump_label_t)&entry->target + entry->target;
>>  }
>>
>>  static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
>>  {
>> -     return (struct static_key *)((unsigned long)entry->key & ~1UL);
>> +     unsigned long key = (unsigned long)&entry->key + entry->key;
>> +
>> +     return (struct static_key *)(key & ~1UL);
>>  }
>>
>>  static inline bool jump_entry_is_branch(const struct jump_entry *entry)
>> @@ -99,7 +106,7 @@ static inline void jump_entry_set_module_init(struct jump_entry *entry)
>>       entry->code = 0;
>>  }
>>
>> -#define jump_label_swap              NULL
>> +void jump_label_swap(void *a, void *b, int size);
>>
>>  #else        /* __ASSEMBLY__ */
>>
>> @@ -114,8 +121,8 @@ static inline void jump_entry_set_module_init(struct jump_entry *entry)
>>       .byte           STATIC_KEY_INIT_NOP
>>       .endif
>>       .pushsection __jump_table, "aw"
>> -     _ASM_ALIGN
>> -     _ASM_PTR        .Lstatic_jump_\@, \target, \key
>> +     .balign         4
>> +     .long           .Lstatic_jump_\@ - ., \target - ., \key - .
>>       .popsection
>>  .endm
>>
>> @@ -130,8 +137,8 @@ static inline void jump_entry_set_module_init(struct jump_entry *entry)
>>  .Lstatic_jump_after_\@:
>>       .endif
>>       .pushsection __jump_table, "aw"
>> -     _ASM_ALIGN
>> -     _ASM_PTR        .Lstatic_jump_\@, \target, \key + 1
>> +     .balign         4
>> +     .long           .Lstatic_jump_\@ - ., \target - ., \key - . + 1
>>       .popsection
>>  .endm
>>
>> diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
>> index e56c95be2808..cc5034b42335 100644
>> --- a/arch/x86/kernel/jump_label.c
>> +++ b/arch/x86/kernel/jump_label.c
>> @@ -52,22 +52,24 @@ static void __jump_label_transform(struct jump_entry *entry,
>>                        * Jump label is enabled for the first time.
>>                        * So we expect a default_nop...
>>                        */
>> -                     if (unlikely(memcmp((void *)entry->code, default_nop, 5)
>> -                                  != 0))
>> -                             bug_at((void *)entry->code, __LINE__);
>> +                     if (unlikely(memcmp((void *)jump_entry_code(entry),
>> +                                         default_nop, 5) != 0))
>> +                             bug_at((void *)jump_entry_code(entry),
>
> You have the functions already made before this patch. Perhaps we
> should have a separate patch to use them (here and elsewhere) before
> you make the conversion to using relative references. It will help out
> in debugging and bisects. To know if the use of functions is an issue,
> or the conversion of relative references is an issue.
>
> I suggest splitting this into two patches.
>

Fair enough.


>> +                                    __LINE__);
>>               } else {
>>                       /*
>>                        * ...otherwise expect an ideal_nop. Otherwise
>>                        * something went horribly wrong.
>>                        */
>> -                     if (unlikely(memcmp((void *)entry->code, ideal_nop, 5)
>> -                                  != 0))
>> -                             bug_at((void *)entry->code, __LINE__);
>> +                     if (unlikely(memcmp((void *)jump_entry_code(entry),
>> +                                         ideal_nop, 5) != 0))
>> +                             bug_at((void *)jump_entry_code(entry),
>> +                                    __LINE__);
>>               }
>>
>>               code.jump = 0xe9;
>> -             code.offset = entry->target -
>> -                             (entry->code + JUMP_LABEL_NOP_SIZE);
>> +             code.offset = jump_entry_target(entry) -
>> +                           (jump_entry_code(entry) + JUMP_LABEL_NOP_SIZE);
>>       } else {
>>               /*
>>                * We are disabling this jump label. If it is not what
>> @@ -76,14 +78,18 @@ static void __jump_label_transform(struct jump_entry *entry,
>>                * are converting the default nop to the ideal nop.
>>                */
>>               if (init) {
>> -                     if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0))
>> -                             bug_at((void *)entry->code, __LINE__);
>> +                     if (unlikely(memcmp((void *)jump_entry_code(entry),
>> +                                         default_nop, 5) != 0))
>> +                             bug_at((void *)jump_entry_code(entry),
>> +                                    __LINE__);
>>               } else {
>>                       code.jump = 0xe9;
>> -                     code.offset = entry->target -
>> -                             (entry->code + JUMP_LABEL_NOP_SIZE);
>> -                     if (unlikely(memcmp((void *)entry->code, &code, 5) != 0))
>> -                             bug_at((void *)entry->code, __LINE__);
>> +                     code.offset = jump_entry_target(entry) -
>> +                             (jump_entry_code(entry) + JUMP_LABEL_NOP_SIZE);
>> +                     if (unlikely(memcmp((void *)jump_entry_code(entry),
>> +                                  &code, 5) != 0))
>> +                             bug_at((void *)jump_entry_code(entry),
>> +                                    __LINE__);
>>               }
>>               memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
>>       }
>> @@ -97,10 +103,13 @@ static void __jump_label_transform(struct jump_entry *entry,
>>        *
>>        */
>>       if (poker)
>> -             (*poker)((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE);
>> +             (*poker)((void *)jump_entry_code(entry), &code,
>> +                      JUMP_LABEL_NOP_SIZE);
>>       else
>> -             text_poke_bp((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE,
>> -                          (void *)entry->code + JUMP_LABEL_NOP_SIZE);
>> +             text_poke_bp((void *)jump_entry_code(entry), &code,
>> +                          JUMP_LABEL_NOP_SIZE,
>> +                          (void *)jump_entry_code(entry) +
>> +                          JUMP_LABEL_NOP_SIZE);
>>  }
>>
>>  void arch_jump_label_transform(struct jump_entry *entry,
>> @@ -140,4 +149,20 @@ __init_or_module void arch_jump_label_transform_static(struct jump_entry *entry,
>>               __jump_label_transform(entry, type, text_poke_early, 1);
>>  }
>>
>> +void jump_label_swap(void *a, void *b, int size)
>> +{
>> +     long delta = (unsigned long)a - (unsigned long)b;
>> +     struct jump_entry *jea = a;
>> +     struct jump_entry *jeb = b;
>> +     struct jump_entry tmp = *jea;
>> +
>> +     jea->code       = jeb->code - delta;
>> +     jea->target     = jeb->target - delta;
>> +     jea->key        = jeb->key - delta;
>> +
>> +     jeb->code       = tmp.code + delta;
>> +     jeb->target     = tmp.target + delta;
>> +     jeb->key        = tmp.key + delta;
>> +}
>> +
>>  #endif
>> diff --git a/tools/objtool/special.c b/tools/objtool/special.c
>> index 84f001d52322..98ae55b39037 100644
>> --- a/tools/objtool/special.c
>> +++ b/tools/objtool/special.c
>> @@ -30,9 +30,9 @@
>>  #define EX_ORIG_OFFSET               0
>>  #define EX_NEW_OFFSET                4
>>
>> -#define JUMP_ENTRY_SIZE              24
>> +#define JUMP_ENTRY_SIZE              12
>>  #define JUMP_ORIG_OFFSET     0
>> -#define JUMP_NEW_OFFSET              8
>> +#define JUMP_NEW_OFFSET              4
>>
>>  #define ALT_ENTRY_SIZE               13
>>  #define ALT_ORIG_OFFSET              0
>

^ permalink raw reply

* [PATCH v6 8/8] x86/kernel: jump_table: use relative references
From: Steven Rostedt @ 2017-12-28 16:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-9-ard.biesheuvel@linaro.org>

On Wed, 27 Dec 2017 08:50:33 +0000
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

>  static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
>  {
> -	return entry->code;
> +	return (jump_label_t)&entry->code + entry->code;

I'm paranoid about doing arithmetic on abstract types. What happens in
the future if jump_label_t becomes a pointer? You will get a different
result.

Could we switch these calculations to something like:

	return (jump_label_t)((long)&entrty->code + entry->code);

> +}
> +
> +static inline jump_label_t jump_entry_target(const struct jump_entry *entry)
> +{
> +	return (jump_label_t)&entry->target + entry->target;
>  }
>  
>  static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
>  {
> -	return (struct static_key *)((unsigned long)entry->key & ~1UL);
> +	unsigned long key = (unsigned long)&entry->key + entry->key;
> +
> +	return (struct static_key *)(key & ~1UL);
>  }
>  
>  static inline bool jump_entry_is_branch(const struct jump_entry *entry)
> @@ -99,7 +106,7 @@ static inline void jump_entry_set_module_init(struct jump_entry *entry)
>  	entry->code = 0;
>  }
>  
> -#define jump_label_swap		NULL
> +void jump_label_swap(void *a, void *b, int size);
>  
>  #else	/* __ASSEMBLY__ */
>  
> @@ -114,8 +121,8 @@ static inline void jump_entry_set_module_init(struct jump_entry *entry)
>  	.byte		STATIC_KEY_INIT_NOP
>  	.endif
>  	.pushsection __jump_table, "aw"
> -	_ASM_ALIGN
> -	_ASM_PTR	.Lstatic_jump_\@, \target, \key
> +	.balign		4
> +	.long		.Lstatic_jump_\@ - ., \target - ., \key - .
>  	.popsection
>  .endm
>  
> @@ -130,8 +137,8 @@ static inline void jump_entry_set_module_init(struct jump_entry *entry)
>  .Lstatic_jump_after_\@:
>  	.endif
>  	.pushsection __jump_table, "aw"
> -	_ASM_ALIGN
> -	_ASM_PTR	.Lstatic_jump_\@, \target, \key + 1
> +	.balign		4
> +	.long		.Lstatic_jump_\@ - ., \target - ., \key - . + 1
>  	.popsection
>  .endm
>  
> diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
> index e56c95be2808..cc5034b42335 100644
> --- a/arch/x86/kernel/jump_label.c
> +++ b/arch/x86/kernel/jump_label.c
> @@ -52,22 +52,24 @@ static void __jump_label_transform(struct jump_entry *entry,
>  			 * Jump label is enabled for the first time.
>  			 * So we expect a default_nop...
>  			 */
> -			if (unlikely(memcmp((void *)entry->code, default_nop, 5)
> -				     != 0))
> -				bug_at((void *)entry->code, __LINE__);
> +			if (unlikely(memcmp((void *)jump_entry_code(entry),
> +					    default_nop, 5) != 0))
> +				bug_at((void *)jump_entry_code(entry),

You have the functions already made before this patch. Perhaps we
should have a separate patch to use them (here and elsewhere) before
you make the conversion to using relative references. It will help out
in debugging and bisects. To know if the use of functions is an issue,
or the conversion of relative references is an issue.

I suggest splitting this into two patches.

-- Steve


> +				       __LINE__);
>  		} else {
>  			/*
>  			 * ...otherwise expect an ideal_nop. Otherwise
>  			 * something went horribly wrong.
>  			 */
> -			if (unlikely(memcmp((void *)entry->code, ideal_nop, 5)
> -				     != 0))
> -				bug_at((void *)entry->code, __LINE__);
> +			if (unlikely(memcmp((void *)jump_entry_code(entry),
> +					    ideal_nop, 5) != 0))
> +				bug_at((void *)jump_entry_code(entry),
> +				       __LINE__);
>  		}
>  
>  		code.jump = 0xe9;
> -		code.offset = entry->target -
> -				(entry->code + JUMP_LABEL_NOP_SIZE);
> +		code.offset = jump_entry_target(entry) -
> +			      (jump_entry_code(entry) + JUMP_LABEL_NOP_SIZE);
>  	} else {
>  		/*
>  		 * We are disabling this jump label. If it is not what
> @@ -76,14 +78,18 @@ static void __jump_label_transform(struct jump_entry *entry,
>  		 * are converting the default nop to the ideal nop.
>  		 */
>  		if (init) {
> -			if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0))
> -				bug_at((void *)entry->code, __LINE__);
> +			if (unlikely(memcmp((void *)jump_entry_code(entry),
> +					    default_nop, 5) != 0))
> +				bug_at((void *)jump_entry_code(entry),
> +				       __LINE__);
>  		} else {
>  			code.jump = 0xe9;
> -			code.offset = entry->target -
> -				(entry->code + JUMP_LABEL_NOP_SIZE);
> -			if (unlikely(memcmp((void *)entry->code, &code, 5) != 0))
> -				bug_at((void *)entry->code, __LINE__);
> +			code.offset = jump_entry_target(entry) -
> +				(jump_entry_code(entry) + JUMP_LABEL_NOP_SIZE);
> +			if (unlikely(memcmp((void *)jump_entry_code(entry),
> +				     &code, 5) != 0))
> +				bug_at((void *)jump_entry_code(entry),
> +				       __LINE__);
>  		}
>  		memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
>  	}
> @@ -97,10 +103,13 @@ static void __jump_label_transform(struct jump_entry *entry,
>  	 *
>  	 */
>  	if (poker)
> -		(*poker)((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE);
> +		(*poker)((void *)jump_entry_code(entry), &code,
> +			 JUMP_LABEL_NOP_SIZE);
>  	else
> -		text_poke_bp((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE,
> -			     (void *)entry->code + JUMP_LABEL_NOP_SIZE);
> +		text_poke_bp((void *)jump_entry_code(entry), &code,
> +			     JUMP_LABEL_NOP_SIZE,
> +			     (void *)jump_entry_code(entry) +
> +			     JUMP_LABEL_NOP_SIZE);
>  }
>  
>  void arch_jump_label_transform(struct jump_entry *entry,
> @@ -140,4 +149,20 @@ __init_or_module void arch_jump_label_transform_static(struct jump_entry *entry,
>  		__jump_label_transform(entry, type, text_poke_early, 1);
>  }
>  
> +void jump_label_swap(void *a, void *b, int size)
> +{
> +	long delta = (unsigned long)a - (unsigned long)b;
> +	struct jump_entry *jea = a;
> +	struct jump_entry *jeb = b;
> +	struct jump_entry tmp = *jea;
> +
> +	jea->code	= jeb->code - delta;
> +	jea->target	= jeb->target - delta;
> +	jea->key	= jeb->key - delta;
> +
> +	jeb->code	= tmp.code + delta;
> +	jeb->target	= tmp.target + delta;
> +	jeb->key	= tmp.key + delta;
> +}
> +
>  #endif
> diff --git a/tools/objtool/special.c b/tools/objtool/special.c
> index 84f001d52322..98ae55b39037 100644
> --- a/tools/objtool/special.c
> +++ b/tools/objtool/special.c
> @@ -30,9 +30,9 @@
>  #define EX_ORIG_OFFSET		0
>  #define EX_NEW_OFFSET		4
>  
> -#define JUMP_ENTRY_SIZE		24
> +#define JUMP_ENTRY_SIZE		12
>  #define JUMP_ORIG_OFFSET	0
> -#define JUMP_NEW_OFFSET		8
> +#define JUMP_NEW_OFFSET		4
>  
>  #define ALT_ENTRY_SIZE		13
>  #define ALT_ORIG_OFFSET		0

^ permalink raw reply

* [PATCH 0/3] [v11] pinctrl: qcom: add support for sparse GPIOs
From: Stephen Boyd @ 2017-12-28 16:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CACRpkda5FQg3W4rnxihVB9y2yv-oF1CwBzFJsKB8cxzQ+zoHNg@mail.gmail.com>

On 12/28, Linus Walleij wrote:
> On Wed, Dec 27, 2017 at 3:01 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> 
> > The different approaches come down to expressing
> > which pins are available through the gpio valid mask, or through
> > the npins field of the msm pinctrl driver. Also, my approach
> > covers more than just GPIOs, it covers irqs and adjusts the
> > pinctrl pin request function so that pinctrl can't request
> > unavailable pins.
> 
> I agree, this is better.

Thanks for the feedback. I'll update and resend my patch to the
list.

> 
> Would even patch 1 be needed after this? Maybe I should
> revert that too. Leaving that code in has the upside of showing
> the actual initial directions of GPIO lines even if they have
> not been requested, in e.g. debugfs.
> 

Patch 1 is still needed. Without that patch, we'll be poking each
GPIO to figure out the direction at boot without checking any
valid mask or calling the request APIs. I don't see the part in
debugfs where we show the direction of a GPIO if it hasn't been
requested. Don't we skip over the unrequested GPIOs because of
this code in gpiolib_dbg_show()?

	if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) {
		...
		continue;
	}

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply

* [PATCH v6 5/8] kernel: tracepoints: add support for relative references
From: Steven Rostedt @ 2017-12-28 15:42 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-6-ard.biesheuvel@linaro.org>

On Wed, 27 Dec 2017 08:50:30 +0000
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> To avoid the need for relocating absolute references to tracepoint
> structures at boot time when running relocatable kernels (which may
> take a disproportionate amount of space), add the option to emit
> these tables as relative references instead.
> 

I gave this patch a quick skim over. It appears to not modify anything
when CONFIG_HAVE_PREL32_RELOCATIONS is not defined. I haven't
thoroughly reviewed it or tested it. But if it doesn't break anything,
I'm fine giving you an ack.

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

--  Steve

^ permalink raw reply

* [PATCH 2/2] tee: optee: check type of registered shared memory
From: Jens Wiklander @ 2017-12-28 15:38 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228153857.30086-1-jens.wiklander@linaro.org>

Checks the memory type of the pages to be registered as shared memory.
Only normal cached memory is allowed.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 drivers/tee/optee/call.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
index d61c14b788f2..47b12b7fd02d 100644
--- a/drivers/tee/optee/call.c
+++ b/drivers/tee/optee/call.c
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/errno.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/tee_drv.h>
 #include <linux/types.h>
@@ -535,6 +536,41 @@ void optee_free_pages_list(void *list, size_t num_entries)
 	free_pages_exact(list, get_pages_list_size(num_entries));
 }
 
+static bool is_normal_memory(pgprot_t p)
+{
+#if defined(CONFIG_ARM)
+	return (pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC;
+#elif defined(CONFIG_ARM64)
+	return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL);
+#else
+#error "Unuspported architecture"
+#endif
+}
+
+static int __check_mem_type(struct vm_area_struct *vma, unsigned long end)
+{
+	while (vma && is_normal_memory(vma->vm_page_prot)) {
+		if (vma->vm_end >= end)
+			return 0;
+		vma = vma->vm_next;
+	}
+
+	return -EINVAL;
+}
+
+static int check_mem_type(unsigned long start, size_t num_pages)
+{
+	struct mm_struct *mm = current->mm;
+	int rc;
+
+	down_read(&mm->mmap_sem);
+	rc = __check_mem_type(find_vma(mm, start),
+			      start + num_pages * PAGE_SIZE);
+	up_read(&mm->mmap_sem);
+
+	return rc;
+}
+
 int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
 		       struct page **pages, size_t num_pages,
 		       unsigned long start)
@@ -543,11 +579,15 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
 	struct optee_msg_arg *msg_arg;
 	u64 *pages_list;
 	phys_addr_t msg_parg;
-	int rc = 0;
+	int rc;
 
 	if (!num_pages)
 		return -EINVAL;
 
+	rc = check_mem_type(start, num_pages);
+	if (rc)
+		return rc;
+
 	pages_list = optee_allocate_pages_list(num_pages);
 	if (!pages_list)
 		return -ENOMEM;
@@ -614,7 +654,7 @@ int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
 	 * We don't want to register supplicant memory in OP-TEE.
 	 * Instead information about it will be passed in RPC code.
 	 */
-	return 0;
+	return check_mem_type(start, num_pages);
 }
 
 int optee_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm)
-- 
2.14.1

^ permalink raw reply related

* [PATCH 1/2] tee: add start argument to shm_register callback
From: Jens Wiklander @ 2017-12-28 15:38 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228153857.30086-1-jens.wiklander@linaro.org>

Adds a start argument to the shm_register callback to allow the callback
to check memory type of the passed pages.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 drivers/tee/optee/call.c          | 6 ++++--
 drivers/tee/optee/optee_private.h | 6 ++++--
 drivers/tee/tee_shm.c             | 2 +-
 include/linux/tee_drv.h           | 3 ++-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
index e675e82ff095..d61c14b788f2 100644
--- a/drivers/tee/optee/call.c
+++ b/drivers/tee/optee/call.c
@@ -536,7 +536,8 @@ void optee_free_pages_list(void *list, size_t num_entries)
 }
 
 int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
-		       struct page **pages, size_t num_pages)
+		       struct page **pages, size_t num_pages,
+		       unsigned long start)
 {
 	struct tee_shm *shm_arg = NULL;
 	struct optee_msg_arg *msg_arg;
@@ -606,7 +607,8 @@ int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
 }
 
 int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
-			    struct page **pages, size_t num_pages)
+			    struct page **pages, size_t num_pages,
+			    unsigned long start)
 {
 	/*
 	 * We don't want to register supplicant memory in OP-TEE.
diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
index de7962ebc1b6..f04930879762 100644
--- a/drivers/tee/optee/optee_private.h
+++ b/drivers/tee/optee/optee_private.h
@@ -173,11 +173,13 @@ void optee_enable_shm_cache(struct optee *optee);
 void optee_disable_shm_cache(struct optee *optee);
 
 int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
-		       struct page **pages, size_t num_pages);
+		       struct page **pages, size_t num_pages,
+		       unsigned long start);
 int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm);
 
 int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
-			    struct page **pages, size_t num_pages);
+			    struct page **pages, size_t num_pages,
+			    unsigned long start);
 int optee_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm);
 
 int optee_from_msg_param(struct tee_param *params, size_t num_params,
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index 04e1b8b37046..6a17b02ada5e 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -299,7 +299,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
 	}
 
 	rc = teedev->desc->ops->shm_register(ctx, shm, shm->pages,
-					     shm->num_pages);
+					     shm->num_pages, start);
 	if (rc) {
 		ret = ERR_PTR(rc);
 		goto err;
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index a1d7f467657c..230a1ebbf3bc 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -108,7 +108,8 @@ struct tee_driver_ops {
 	int (*supp_send)(struct tee_context *ctx, u32 ret, u32 num_params,
 			 struct tee_param *param);
 	int (*shm_register)(struct tee_context *ctx, struct tee_shm *shm,
-			    struct page **pages, size_t num_pages);
+			    struct page **pages, size_t num_pages,
+			    unsigned long start);
 	int (*shm_unregister)(struct tee_context *ctx, struct tee_shm *shm);
 };
 
-- 
2.14.1

^ permalink raw reply related

* [PATCH 0/2] Fix tee: optee: add dynamic shared memory support
From: Jens Wiklander @ 2017-12-28 15:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

These two patches complements the previously posted patchset
"tee: optee: add dynamic shared memory support"
https://lwn.net/Articles/740242/

Tests are added to see that the registered shared memory cache attributes
are compatible with OP-TEE in secure world. Under normal circumstances they
will be compatible, but if memory has been previously mapped from a device
with special page attributes it could lead to trouble.

Thanks,
Jens

Jens Wiklander (2):
  tee: add start argument to shm_register callback
  tee: optee: check type of registered shared memory

 drivers/tee/optee/call.c          | 50 +++++++++++++++++++++++++++++++++++----
 drivers/tee/optee/optee_private.h |  6 +++--
 drivers/tee/tee_shm.c             |  2 +-
 include/linux/tee_drv.h           |  3 ++-
 4 files changed, 53 insertions(+), 8 deletions(-)

-- 
2.14.1

^ permalink raw reply

* [GIT PULL 00/35] perf/core improvements and fixes
From: Ingo Molnar @ 2017-12-28 15:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228143027.30547-1-acme@kernel.org>


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit faaf95677f33dac910b6cbe917cabea43c8c1616:
> 
>   Merge branch 'perf/urgent' into perf/core, to pick up fixes (2017-12-18 18:13:00 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.16-20171227
> 
> for you to fetch changes up to 5d4fd9c8b83b36d34521b3af361a5726899045bf:
> 
>   perf tools: Auto-complete for events with ':' (2017-12-27 12:16:00 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> - Allow system wide 'perf stat --per-thread', sorting the result (Jin Yao)
> 
>   E.g.:
> 
>   [root at jouet ~]# perf stat --per-thread --metrics IPC
>   ^C
>    Performance counter stats for 'system wide':
> 
>               make-22229  23,012,094,032  inst_retired.any   #  0.8 IPC
>                cc1-22419     692,027,497  inst_retired.any   #  0.8 IPC
>                gcc-22418     328,231,855  inst_retired.any   #  0.9 IPC
>                cc1-22509     220,853,647  inst_retired.any   #  0.8 IPC
>                gcc-22486     199,874,810  inst_retired.any   #  1.0 IPC
>                 as-22466     177,896,365  inst_retired.any   #  0.9 IPC
>                cc1-22465     150,732,374  inst_retired.any   #  0.8 IPC
>                gcc-22508     112,555,593  inst_retired.any   #  0.9 IPC
>                cc1-22487     108,964,079  inst_retired.any   #  0.7 IPC
>    qemu-system-x86-2697       21,330,550  inst_retired.any   #  0.3 IPC
>    systemd-journal-551        20,642,951  inst_retired.any   #  0.4 IPC
>    docker-containe-17651       9,552,892  inst_retired.any   #  0.5 IPC
>    dockerd-current-9809        7,528,586  inst_retired.any   #  0.5 IPC
>               make-22153  12,504,194,380  inst_retired.any   #  0.8 IPC
>            python2-22429  12,081,290,954  inst_retired.any   #  0.8 IPC
>   <SNIP>
>            python2-22429  15,026,328,103  cpu_clk_unhalted.thread
>                cc1-22419     826,660,193  cpu_clk_unhalted.thread
>                gcc-22418     365,321,295  cpu_clk_unhalted.thread
>                cc1-22509     279,169,362  cpu_clk_unhalted.thread
>                gcc-22486     210,156,950  cpu_clk_unhalted.thread
>   <SNIP>
> 
>        5.638075538 seconds time elapsed
> 
>   [root at jouet ~]#
> 
> - Improve shell auto-completion of perf events (Jin Yao)
> 
> -  Fix symbol fixup issues in arm64 due to ELF type (Kim Phillips)
> 
> - Ignore threads when they vanish after procfs based enumeration and
>   before we try to use them with sys_perf_event_open(), i.e. just remove
>   them from the thread_map and continue with the rest. This makes, among
>   other cases, the previous new feature (perf stat --per-thread for system
>   wide, albeit that not seeming to be the motivation for this patch) more
>   robust. (Mengting Zhang)
> 
> - Generate s390 syscall table from asm/unistd.h, doing like x86,
>   removing the dependency on audit-libs to do this id->string translation,
>   speeding up the support for newly introducted syscalls (Hendrik Brueckner)
> 
> - Fix 'perf test' on filesystems where readdir() returns d_type == DT_UNKNOWN,
>   such as XFS (Jiri Olsa)
> 
> - Fix PERF_SAMPLE_RAW_DATA endianity handling for cross-arch tracepoint
>   processing (Jiri Olsa)
> 
> - Add __return suffix for return events in 'perf probe', streamlining
>   entry/exit tracing (Masami Hiramatsu)
> 
> - Improve support for versioned symbols in 'perf probe" (Masami Hiramatsu)
> 
> - Clarify error message about invalid 'perf probe' event names (Masami Hiramatsu)
> 
> - Fix check open filename arg using 'perf trace' in a 'perf test' entry for
>   systems using glibc >= 2.26, such as some ARM and s390 distros (Michael Petlan)
> 
> - Make method for obtaining the (normalized) architecture id for a
>   perf.data file or for the running system used by the annotation routines
>   generally available, next user will be for generating per arch errno
>   string tables to allow for pretty printing errno codes recorded in a
>   perf.data file in architecture A to be properly decoded on hardware
>   archictecture B.  (Arnaldo Carvalho de Melo)
> 
> - Remove duplicate includes, found using scripts/checkincludes.pl (Pravin Shedge)
> 
> - s390 needs -fPIC, enable it, also revert a patch that supposedly did
>   that but instead enabled -fPIC for x86 (Hendrik Brueckner, Arnaldo Carvalho de Melo)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (4):
>       perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
>       perf annotate: Use perf_env when obtaining the arch name
>       perf env: Adopt perf_env__arch() from the annotate code
>       Revert "perf s390: Always build with -fPIC"
> 
> Hendrik Brueckner (4):
>       tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
>       perf s390: Generate system call table from asm/unistd.h
>       perf trace: Use generated syscall table on s390 too
>       perf s390: Always build with -fPIC
> 
> Jin Yao (14):
>       perf stat: Define a structure for per-thread shadow stats
>       perf stat: Extend rbtree to support per-thread shadow stats
>       perf stat: Create the runtime_stat init/exit function
>       perf stat: Update per-thread shadow stats
>       perf stat: Print per-thread shadow stats
>       perf stat: Remove a set of shadow stats static variables
>       perf stat: Allocate shadow stats buffer for threads
>       perf stat: Update or print per-thread stats
>       perf thread_map: Enumerate all threads from /proc
>       perf stat: Remove --per-thread pid/tid limitation
>       perf stat: Resort '--per-thread' result
>       perf tool: Improve bash command line auto-complete for multiple events with comma
>       perf tools: Return all events as auto-completions after comma
>       perf tools: Auto-complete for events with ':'
> 
> Jiri Olsa (3):
>       perf utils: Move is_directory() to path.h
>       perf test: Handle properly readdir DT_UNKNOWN
>       perf evsel: Fix swap for samples with raw data
> 
> Kim Phillips (1):
>       perf probe arm64: Fix symbol fixup issues due to ELF type
> 
> Masami Hiramatsu (6):
>       perf probe: Add warning message if there is unexpected event name
>       perf probe: Cut off the version suffix from event name
>       perf probe: Add __return suffix for return events
>       perf probe: Find versioned symbols from map
>       perf string: Add {strdup,strpbrk}_esc()
>       perf probe: Support escaped character in parser
> 
> Mengting Zhang (1):
>       perf evsel: Enable ignore_missing_thread for pid option
> 
> Michael Petlan (1):
>       perf test shell: Fix check open filename arg using 'perf trace'
> 
> Pravin Shedge (1):
>       perf perf: Remove duplicate includes
> 
>  tools/arch/s390/include/uapi/asm/unistd.h          | 412 ++++++++++++++++++++
>  tools/perf/Documentation/perf-probe.txt            |  18 +-
>  tools/perf/Makefile.config                         |  11 +-
>  tools/perf/arch/arm64/util/Build                   |   1 +
>  tools/perf/arch/arm64/util/sym-handling.c          |  22 ++
>  tools/perf/arch/common.c                           |  44 +--
>  tools/perf/arch/common.h                           |   1 -
>  tools/perf/arch/powerpc/util/sym-handling.c        |   8 +
>  tools/perf/arch/s390/Makefile                      |  21 ++
>  tools/perf/arch/s390/entry/syscalls/mksyscalltbl   |  36 ++
>  tools/perf/bench/futex-hash.c                      |   1 -
>  tools/perf/builtin-c2c.c                           |   3 -
>  tools/perf/builtin-record.c                        |   5 +-
>  tools/perf/builtin-script.c                        |  20 +-
>  tools/perf/builtin-stat.c                          | 168 +++++++--
>  tools/perf/builtin-top.c                           |   2 +-
>  tools/perf/check-headers.sh                        |   1 +
>  tools/perf/perf-completion.sh                      |  47 ++-
>  tools/perf/tests/builtin-test.c                    |  10 +-
>  tools/perf/tests/parse-events.c                    |   1 -
>  tools/perf/tests/shell/trace+probe_vfs_getname.sh  |   7 +-
>  tools/perf/tests/thread-map.c                      |   2 +-
>  tools/perf/ui/browsers/annotate.c                  |   4 +-
>  tools/perf/ui/gtk/annotate.c                       |   2 +-
>  tools/perf/util/annotate.c                         |  26 +-
>  tools/perf/util/annotate.h                         |   2 +-
>  tools/perf/util/auxtrace.c                         |   3 -
>  tools/perf/util/env.c                              |  47 +++
>  tools/perf/util/env.h                              |   2 +
>  tools/perf/util/evlist.c                           |   3 +-
>  tools/perf/util/evsel.c                            |  80 +++-
>  tools/perf/util/evsel.h                            |   3 +-
>  tools/perf/util/header.c                           |   2 -
>  tools/perf/util/metricgroup.c                      |   2 -
>  tools/perf/util/path.c                             |  14 +
>  tools/perf/util/path.h                             |   3 +
>  tools/perf/util/probe-event.c                      |  85 +++--
>  tools/perf/util/python-ext-sources                 |   1 +
>  .../util/scripting-engines/trace-event-python.c    |   1 -
>  tools/perf/util/stat-shadow.c                      | 416 ++++++++++++---------
>  tools/perf/util/stat.c                             |  15 +-
>  tools/perf/util/stat.h                             |  63 +++-
>  tools/perf/util/string.c                           |  46 +++
>  tools/perf/util/string2.h                          |   2 +
>  tools/perf/util/symbol.c                           |   5 +
>  tools/perf/util/symbol.h                           |   1 +
>  tools/perf/util/syscalltbl.c                       |   4 +
>  tools/perf/util/target.h                           |   7 +
>  tools/perf/util/thread_map.c                       |   5 +-
>  tools/perf/util/thread_map.h                       |   2 +-
>  tools/perf/util/unwind-libunwind.c                 |   4 +-
>  51 files changed, 1328 insertions(+), 363 deletions(-)
>  create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
>  create mode 100644 tools/perf/arch/arm64/util/sym-handling.c
>  create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply

* [PATCH net-next 5/6] arm64: dts: marvell: mcbin: enable the fourth network interface
From: Florian Fainelli @ 2017-12-28 15:02 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228100519.GE2626@kwain>



On 12/28/2017 02:05 AM, Antoine Tenart wrote:
> Hi Andrew,
> 
> On Thu, Dec 28, 2017 at 08:46:23AM +0100, Andrew Lunn wrote:
>> On Wed, Dec 27, 2017 at 10:24:01PM +0000, Russell King - ARM Linux wrote:
>>> On Wed, Dec 27, 2017 at 11:14:45PM +0100, Antoine Tenart wrote:
>>>>  
>>>> +&cps_eth2 {
>>>> +	/* CPS Lane 5 */
>>>> +	status = "okay";
>>>> +	phy-mode = "2500base-x";
>>>> +	/* Generic PHY, providing serdes lanes */
>>>> +	phys = <&cps_comphy5 2>;
>>>> +};
>>>> +
>>>
>>> This is wrong.  This lane is connected to a SFP cage which can support
>>> more than just 2500base-X.  Tying it in this way to 2500base-X means
>>> that this port does not support conenctions at 1000base-X, despite
>>> that's one of the most popular and more standardised speeds.
>>>
>>
>> I agree with Russell here. SFP modules are hot pluggable, and support
>> a range of interface modes. You need to query what the SFP module is
>> in order to know how to configure the SERDES interface. The phylink
>> infrastructure does that for you.
> 
> Sure, I understand. We'll be able to support such interfaces only when
> the phylink PPv2 support lands in.

Should we expect PHYLINK support to make it as the first patch in your
v2 of this patch series, or is someone else doing that?
-- 
Florian

^ permalink raw reply

* [PATCH v2] dt: psci: Update DT bindings to support hierarchical PSCI states
From: Ulf Hansson @ 2017-12-28 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Lina Iyer <lina.iyer@linaro.org>

Update DT bindings to represent hierarchical CPU and CPU domain idle states
for PSCI. Also update the PSCI examples to clearly show how flattened and
hierarchical idle states can be represented in DT.

Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---

Changes in v2:
	- Addressed comments from Rob.
	- Updated some labels in the examples to get more consistency.

For your information, I have picked up the work from Lina Iyer around the so
called CPU cluster idling series [1,2] and I working on new versions. However,
I decided to post the updates to the PSCI DT bindings first, as they will be
needed to be agreed upon before further changes can be done to the PSCI firmware
driver.

Note, these bindings have been discussed over and over again, at LKML, but
especially also at various Linux conferences, like LPC and Linaro Connect. We
finally came to a conclusion and the changes we agreed upon, should be reflected
in this update.

Of course, it's a while ago since the latest discussions, but hopefully people
don't have too hard time to remember.

Kind regards
Uffe

[1]
https://www.spinics.net/lists/arm-kernel/msg566200.html

[2]
https://lwn.net/Articles/716300/

---
 Documentation/devicetree/bindings/arm/psci.txt | 152 +++++++++++++++++++++++++
 1 file changed, 152 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/psci.txt b/Documentation/devicetree/bindings/arm/psci.txt
index a2c4f1d..8a09bd2 100644
--- a/Documentation/devicetree/bindings/arm/psci.txt
+++ b/Documentation/devicetree/bindings/arm/psci.txt
@@ -105,7 +105,159 @@ Case 3: PSCI v0.2 and PSCI v0.1.
 		...
 	};
 
+PSCI v1.0 onwards, supports OS-Initiated mode for powering off CPUs and CPU
+clusters from the firmware. For such topologies the PSCI firmware driver acts
+as pseudo-controller, which may be specified in the psci DT node. The
+definitions of the CPU and the CPU cluster topology, must conform to the domain
+idle state specification [3]. The domain idle states themselves, must be
+compatible with the defined 'domain-idle-state' binding [1], and also need to
+specify the arm,psci-suspend-param property for each idle state.
+
+DT allows representing CPU and CPU cluster idle states in two different ways -
+
+The flattened model as given in Example 1, lists CPU's idle states followed by
+the domain idle state that the CPUs may choose. This is the general practice
+followed in PSCI firmwares that support Platform Coordinated mode. Note that
+the idle states are all compatible with "arm,idle-state".
+
+Example 2 represents the hierarchical model of CPU and domain idle states.
+CPUs define their domain provider in their DT node. The domain controls the
+power to the CPU and possibly other h/w blocks that would be powered off when
+the CPU is powered off. The CPU's idle states may therefore be considered as
+the domain's idle states and have the compatible "arm,idle-state". Such domains
+may be embedded within another domain that represents common h/w blocks between
+these CPUs viz. the cluster. The idle states of the cluster would be
+represented as the domain's idle states. In order to use OS-Initiated mode of
+PSCI in the firmware, the hierarchical representation must be used.
+
+Example 1: Flattened representation of CPU and domain idle states
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		CPU0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0>;
+			enable-method = "psci";
+			cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>,
+					  <&CLUSTER_PWRDN>;
+		};
+
+		CPU1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a57", "arm,armv8";
+			reg = <0x100>;
+			enable-method = "psci";
+			cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>,
+					  <&CLUSTER_PWRDN>;
+		};
+
+		idle-states {
+			CPU_PWRDN: cpu-power-down {
+				compatible = "arm,idle-state";
+				arm,psci-suspend-param = <0x000001>;
+				entry-latency-us = <10>;
+				exit-latency-us = <10>;
+				min-residency-us = <100>;
+			};
+
+			CLUSTER_RET: cluster-retention {
+				compatible = "arm,idle-state";
+				arm,psci-suspend-param = <0x1000010>;
+				entry-latency-us = <500>;
+				exit-latency-us = <500>;
+				min-residency-us = <2000>;
+			};
+
+			CLUSTER_PWRDN: cluster-power-down {
+				compatible = "arm,idle-state";
+				arm,psci-suspend-param = <0x1000030>;
+				entry-latency-us = <2000>;
+				exit-latency-us = <2000>;
+				min-residency-us = <6000>;
+			};
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+	};
+
+Example 2: Hierarchical representation of CPU and domain idle states
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		CPU0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0>;
+			enable-method = "psci";
+			power-domains = <&CPU_PD0>;
+		};
+
+		CPU1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a57", "arm,armv8";
+			reg = <0x100>;
+			enable-method = "psci";
+			power-domains = <&CPU_PD1>;
+		};
+
+		idle-states {
+			CPU_PWRDN: cpu-power-down {
+				compatible = "arm,idle-state";
+				arm,psci-suspend-param = <0x000001>;
+				entry-latency-us = <10>;
+				exit-latency-us = <10>;
+				min-residency-us = <100>;
+			};
+
+			CLUSTER_RET: cluster-retention {
+				compatible = "domain-idle-state";
+				arm,psci-suspend-param = <0x1000010>;
+				entry-latency-us = <500>;
+				exit-latency-us = <500>;
+				min-residency-us = <2000>;
+			};
+
+			CLUSTER_PWRDN: cluster-power-down {
+				compatible = "domain-idle-state";
+				arm,psci-suspend-param = <0x1000030>;
+				entry-latency-us = <2000>;
+				exit-latency-us = <2000>;
+				min-residency-us = <6000>;
+			};
+		};
+	};
+
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+
+		CPU_PD0: cpu-pd0 {
+			#power-domain-cells = <0>;
+			domain-idle-states = <&CPU_PWRDN>;
+			power-domains = <&CLUSTER_PD>;
+		};
+
+		CPU_PD1: cpu-pd1 {
+			#power-domain-cells = <0>;
+			domain-idle-states =  <&CPU_PWRDN>;
+			power-domains = <&CLUSTER_PD>;
+		};
+
+		CLUSTER_PD: cluster-pd {
+			#power-domain-cells = <0>;
+			domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWRDN>;
+		};
+	};
+
 [1] Kernel documentation - ARM idle states bindings
     Documentation/devicetree/bindings/arm/idle-states.txt
 [2] Power State Coordination Interface (PSCI) specification
     http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
+[3]. PM Domains description
+    Documentation/devicetree/bindings/power/power_domain.txt
-- 
2.7.4

^ permalink raw reply related

* [PATCH 32/35] perf probe arm64: Fix symbol fixup issues due to ELF type
From: Arnaldo Carvalho de Melo @ 2017-12-28 14:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228143027.30547-1-acme@kernel.org>

From: Kim Phillips <kim.phillips@arm.com>

On an arm64 machine running a CONFIG_RANDOMIZE_BASE=y kernel, perf
kernel symbol resolution fails.  Debugging saw symsrc_init calling the
default elf__needs_adjust_symbols() where checks for an ET_DYN (3)
ehdr.e_type failed when they should have succeeded.

Fix by adopting powerpc version of the weak elf__needs_adjust_symbols()
function, as done in commit d2332098331f ("perf probe ppc: Fix symbol
fixup issues due to ELF type").

Prior to this patch, perf test 1 would fail:

  $ sudo oldperf test -v 1 |& head
   1: vmlinux symtab matches kallsyms                       :
  test child forked, pid 33374
  Looking at the vmlinux_path (8 entries long)
  Using /usr/lib/debug/boot/vmlinux for symbols
  ERR : 0xfffe0000100f1000: do_undefinstr not on kallsyms
  ERR : 0xfffe0000100f1320: do_sysinstr not on kallsyms
  ERR : 0xfffe0000100f13b0: do_debug_exception not on kallsyms
  ERR : 0xfffe0000100f1498: do_mem_abort not on kallsyms
  ERR : 0xfffe0000100f1580: do_sp_pc_abort not on kallsyms
  ...

After applying this patch, perf test 1 now succeeds:

  $ sudo ./newperf test -v 1 |& head
   1: vmlinux symtab matches kallsyms                       :
  test child forked, pid 33378
  Looking at the vmlinux_path (8 entries long)
  Using /usr/lib/debug/boot/vmlinux for symbols
  WARN: 0xffff000008081000: diff name v: do_undefinstr k: __exception_text_start
  WARN: 0xffff0000080819e8: diff name v: __irqentry_text_end k: __softirqentry_text_start
  WARN: 0xffff000008081d08: diff name v: __entry_text_start k: __softirqentry_text_end
  WARN: 0xffff00000809db5c: diff name v: flush_icache_range k: __flush_cache_user_range
  WARN: 0xffff000008101908: diff name v: sys_ni_syscall k: sys_vm86old
  ...

Signed-off-by: Kim Phillips <kim.phillips@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel at lists.infradead.org
Link: http://lkml.kernel.org/r/20171214175242.e30450f17f93ad675d968fa3 at arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/arch/arm64/util/Build          |  1 +
 tools/perf/arch/arm64/util/sym-handling.c | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 tools/perf/arch/arm64/util/sym-handling.c

diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build
index b1ab72d2a42e..e04f6cdd6f32 100644
--- a/tools/perf/arch/arm64/util/Build
+++ b/tools/perf/arch/arm64/util/Build
@@ -1,4 +1,5 @@
 libperf-y += header.o
+libperf-y += sym-handling.o
 libperf-$(CONFIG_DWARF)     += dwarf-regs.o
 libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
 
diff --git a/tools/perf/arch/arm64/util/sym-handling.c b/tools/perf/arch/arm64/util/sym-handling.c
new file mode 100644
index 000000000000..0051b1ee8450
--- /dev/null
+++ b/tools/perf/arch/arm64/util/sym-handling.c
@@ -0,0 +1,22 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
+ */
+
+#include "debug.h"
+#include "symbol.h"
+#include "map.h"
+#include "probe-event.h"
+#include "probe-file.h"
+
+#ifdef HAVE_LIBELF_SUPPORT
+bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
+{
+	return ehdr.e_type == ET_EXEC ||
+	       ehdr.e_type == ET_REL ||
+	       ehdr.e_type == ET_DYN;
+}
+#endif
-- 
2.13.6

^ permalink raw reply related

* [GIT PULL 00/35] perf/core improvements and fixes
From: Arnaldo Carvalho de Melo @ 2017-12-28 14:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ingo,

	Please consider pulling,

- Arnaldo


Test results at the end of this message, as usual.

The following changes since commit faaf95677f33dac910b6cbe917cabea43c8c1616:

  Merge branch 'perf/urgent' into perf/core, to pick up fixes (2017-12-18 18:13:00 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.16-20171227

for you to fetch changes up to 5d4fd9c8b83b36d34521b3af361a5726899045bf:

  perf tools: Auto-complete for events with ':' (2017-12-27 12:16:00 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

- Allow system wide 'perf stat --per-thread', sorting the result (Jin Yao)

  E.g.:

  [root at jouet ~]# perf stat --per-thread --metrics IPC
  ^C
   Performance counter stats for 'system wide':

              make-22229  23,012,094,032  inst_retired.any   #  0.8 IPC
               cc1-22419     692,027,497  inst_retired.any   #  0.8 IPC
               gcc-22418     328,231,855  inst_retired.any   #  0.9 IPC
               cc1-22509     220,853,647  inst_retired.any   #  0.8 IPC
               gcc-22486     199,874,810  inst_retired.any   #  1.0 IPC
                as-22466     177,896,365  inst_retired.any   #  0.9 IPC
               cc1-22465     150,732,374  inst_retired.any   #  0.8 IPC
               gcc-22508     112,555,593  inst_retired.any   #  0.9 IPC
               cc1-22487     108,964,079  inst_retired.any   #  0.7 IPC
   qemu-system-x86-2697       21,330,550  inst_retired.any   #  0.3 IPC
   systemd-journal-551        20,642,951  inst_retired.any   #  0.4 IPC
   docker-containe-17651       9,552,892  inst_retired.any   #  0.5 IPC
   dockerd-current-9809        7,528,586  inst_retired.any   #  0.5 IPC
              make-22153  12,504,194,380  inst_retired.any   #  0.8 IPC
           python2-22429  12,081,290,954  inst_retired.any   #  0.8 IPC
  <SNIP>
           python2-22429  15,026,328,103  cpu_clk_unhalted.thread
               cc1-22419     826,660,193  cpu_clk_unhalted.thread
               gcc-22418     365,321,295  cpu_clk_unhalted.thread
               cc1-22509     279,169,362  cpu_clk_unhalted.thread
               gcc-22486     210,156,950  cpu_clk_unhalted.thread
  <SNIP>

       5.638075538 seconds time elapsed

  [root at jouet ~]#

- Improve shell auto-completion of perf events (Jin Yao)

-  Fix symbol fixup issues in arm64 due to ELF type (Kim Phillips)

- Ignore threads when they vanish after procfs based enumeration and
  before we try to use them with sys_perf_event_open(), i.e. just remove
  them from the thread_map and continue with the rest. This makes, among
  other cases, the previous new feature (perf stat --per-thread for system
  wide, albeit that not seeming to be the motivation for this patch) more
  robust. (Mengting Zhang)

- Generate s390 syscall table from asm/unistd.h, doing like x86,
  removing the dependency on audit-libs to do this id->string translation,
  speeding up the support for newly introducted syscalls (Hendrik Brueckner)

- Fix 'perf test' on filesystems where readdir() returns d_type == DT_UNKNOWN,
  such as XFS (Jiri Olsa)

- Fix PERF_SAMPLE_RAW_DATA endianity handling for cross-arch tracepoint
  processing (Jiri Olsa)

- Add __return suffix for return events in 'perf probe', streamlining
  entry/exit tracing (Masami Hiramatsu)

- Improve support for versioned symbols in 'perf probe" (Masami Hiramatsu)

- Clarify error message about invalid 'perf probe' event names (Masami Hiramatsu)

- Fix check open filename arg using 'perf trace' in a 'perf test' entry for
  systems using glibc >= 2.26, such as some ARM and s390 distros (Michael Petlan)

- Make method for obtaining the (normalized) architecture id for a
  perf.data file or for the running system used by the annotation routines
  generally available, next user will be for generating per arch errno
  string tables to allow for pretty printing errno codes recorded in a
  perf.data file in architecture A to be properly decoded on hardware
  archictecture B.  (Arnaldo Carvalho de Melo)

- Remove duplicate includes, found using scripts/checkincludes.pl (Pravin Shedge)

- s390 needs -fPIC, enable it, also revert a patch that supposedly did
  that but instead enabled -fPIC for x86 (Hendrik Brueckner, Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (4):
      perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
      perf annotate: Use perf_env when obtaining the arch name
      perf env: Adopt perf_env__arch() from the annotate code
      Revert "perf s390: Always build with -fPIC"

Hendrik Brueckner (4):
      tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
      perf s390: Generate system call table from asm/unistd.h
      perf trace: Use generated syscall table on s390 too
      perf s390: Always build with -fPIC

Jin Yao (14):
      perf stat: Define a structure for per-thread shadow stats
      perf stat: Extend rbtree to support per-thread shadow stats
      perf stat: Create the runtime_stat init/exit function
      perf stat: Update per-thread shadow stats
      perf stat: Print per-thread shadow stats
      perf stat: Remove a set of shadow stats static variables
      perf stat: Allocate shadow stats buffer for threads
      perf stat: Update or print per-thread stats
      perf thread_map: Enumerate all threads from /proc
      perf stat: Remove --per-thread pid/tid limitation
      perf stat: Resort '--per-thread' result
      perf tool: Improve bash command line auto-complete for multiple events with comma
      perf tools: Return all events as auto-completions after comma
      perf tools: Auto-complete for events with ':'

Jiri Olsa (3):
      perf utils: Move is_directory() to path.h
      perf test: Handle properly readdir DT_UNKNOWN
      perf evsel: Fix swap for samples with raw data

Kim Phillips (1):
      perf probe arm64: Fix symbol fixup issues due to ELF type

Masami Hiramatsu (6):
      perf probe: Add warning message if there is unexpected event name
      perf probe: Cut off the version suffix from event name
      perf probe: Add __return suffix for return events
      perf probe: Find versioned symbols from map
      perf string: Add {strdup,strpbrk}_esc()
      perf probe: Support escaped character in parser

Mengting Zhang (1):
      perf evsel: Enable ignore_missing_thread for pid option

Michael Petlan (1):
      perf test shell: Fix check open filename arg using 'perf trace'

Pravin Shedge (1):
      perf perf: Remove duplicate includes

 tools/arch/s390/include/uapi/asm/unistd.h          | 412 ++++++++++++++++++++
 tools/perf/Documentation/perf-probe.txt            |  18 +-
 tools/perf/Makefile.config                         |  11 +-
 tools/perf/arch/arm64/util/Build                   |   1 +
 tools/perf/arch/arm64/util/sym-handling.c          |  22 ++
 tools/perf/arch/common.c                           |  44 +--
 tools/perf/arch/common.h                           |   1 -
 tools/perf/arch/powerpc/util/sym-handling.c        |   8 +
 tools/perf/arch/s390/Makefile                      |  21 ++
 tools/perf/arch/s390/entry/syscalls/mksyscalltbl   |  36 ++
 tools/perf/bench/futex-hash.c                      |   1 -
 tools/perf/builtin-c2c.c                           |   3 -
 tools/perf/builtin-record.c                        |   5 +-
 tools/perf/builtin-script.c                        |  20 +-
 tools/perf/builtin-stat.c                          | 168 +++++++--
 tools/perf/builtin-top.c                           |   2 +-
 tools/perf/check-headers.sh                        |   1 +
 tools/perf/perf-completion.sh                      |  47 ++-
 tools/perf/tests/builtin-test.c                    |  10 +-
 tools/perf/tests/parse-events.c                    |   1 -
 tools/perf/tests/shell/trace+probe_vfs_getname.sh  |   7 +-
 tools/perf/tests/thread-map.c                      |   2 +-
 tools/perf/ui/browsers/annotate.c                  |   4 +-
 tools/perf/ui/gtk/annotate.c                       |   2 +-
 tools/perf/util/annotate.c                         |  26 +-
 tools/perf/util/annotate.h                         |   2 +-
 tools/perf/util/auxtrace.c                         |   3 -
 tools/perf/util/env.c                              |  47 +++
 tools/perf/util/env.h                              |   2 +
 tools/perf/util/evlist.c                           |   3 +-
 tools/perf/util/evsel.c                            |  80 +++-
 tools/perf/util/evsel.h                            |   3 +-
 tools/perf/util/header.c                           |   2 -
 tools/perf/util/metricgroup.c                      |   2 -
 tools/perf/util/path.c                             |  14 +
 tools/perf/util/path.h                             |   3 +
 tools/perf/util/probe-event.c                      |  85 +++--
 tools/perf/util/python-ext-sources                 |   1 +
 .../util/scripting-engines/trace-event-python.c    |   1 -
 tools/perf/util/stat-shadow.c                      | 416 ++++++++++++---------
 tools/perf/util/stat.c                             |  15 +-
 tools/perf/util/stat.h                             |  63 +++-
 tools/perf/util/string.c                           |  46 +++
 tools/perf/util/string2.h                          |   2 +
 tools/perf/util/symbol.c                           |   5 +
 tools/perf/util/symbol.h                           |   1 +
 tools/perf/util/syscalltbl.c                       |   4 +
 tools/perf/util/target.h                           |   7 +
 tools/perf/util/thread_map.c                       |   5 +-
 tools/perf/util/thread_map.h                       |   2 +-
 tools/perf/util/unwind-libunwind.c                 |   4 +-
 51 files changed, 1328 insertions(+), 363 deletions(-)
 create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
 create mode 100644 tools/perf/arch/arm64/util/sym-handling.c
 create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support.  Where clang is available, it is also used to build
perf with/without libelf.

The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.

Several are cross builds, the ones with -x-ARCH and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.

The second column is the time it takes on a i5-7500 CPU @ 3.40GHz, with
a 240 GB SSD from Sandisk. Take it with a grain of salt because we do
the build with clang as well when availalbe.

The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 38.08 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0
   2 44.14 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822
   3 39.23 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0
   4 39.94 alpine:edge                   : Ok   gcc (Alpine 6.4.0) 6.4.0
   5 34.36 amazonlinux:1                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
   6 39.75 amazonlinux:2                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
   7 28.21 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
   8 26.06 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
   9 20.89 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  10 33.98 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
  11 38.71 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
  12 32.67 debian:7                      : Ok   gcc (Debian 4.7.2-5) 4.7.2
  13 35.71 debian:8                      : Ok   gcc (Debian 4.9.2-10) 4.9.2
  14 60.76 debian:9                      : Ok   gcc (Debian 6.3.0-18) 6.3.0 20170516
  15 63.80 debian:experimental           : Ok   gcc (Debian 7.2.0-18) 7.2.0
  16 37.26 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
  17 36.71 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
  18 33.56 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 7.2.0-11) 7.2.0
  19 37.09 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
  20 37.44 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  21 38.19 fedora:21                     : Ok   gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
  22 37.92 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  23 39.25 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  24 39.44 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  25 34.11 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  26 76.13 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
  27 80.30 fedora:26                     : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
  28 75.38 fedora:27                     : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
  29 78.37 fedora:rawhide                : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-4)
  30 42.54 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 6.4.0 p1.1) 6.4.0
  31 44.86 mageia:5                      : Ok   gcc (GCC) 4.9.2
  32 45.95 mageia:6                      : Ok   gcc (Mageia 5.4.0-5.mga6) 5.4.0
  33 44.47 opensuse:42.1                 : Ok   gcc (SUSE Linux) 4.8.5
  34 46.53 opensuse:42.2                 : Ok   gcc (SUSE Linux) 4.8.5
  35 45.51 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5
  36 89.91 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 7.2.1 20171020 [gcc-7-branch revision 253932]
  37 40.36 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
  38 42.95 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
  39 37.95 ubuntu:12.04.5                : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  40 37.70 ubuntu:14.04.4                : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
  41 37.09 ubuntu:14.04.4-x-linaro-arm64 : Ok   aarch64-linux-gnu-gcc (Linaro GCC 5.5-2017.10) 5.5.0
  42 69.99 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
  43 38.08 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  44 36.04 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  45 34.35 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  46 35.10 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609
  47 34.80 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  48 34.28 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  49 66.92 ubuntu:16.10                  : Ok   gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
  50 66.80 ubuntu:17.04                  : Ok   gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
  51 74.57 ubuntu:17.10                  : Ok   gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
  52 73.70 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.2.0-18ubuntu2) 7.2.0
  # 

  # uname -a
  Linux jouet 4.15.0-rc3+ #3 SMP Wed Dec 13 10:14:18 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
  # perf test
   1: vmlinux symtab matches kallsyms                       : Ok
   2: Detect openat syscall event                           : Ok
   3: Detect openat syscall event on all cpus               : Ok
   4: Read samples using the mmap interface                 : Ok
   5: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Number of exit events of a simple workload            : Ok
  22: Software clock events period values                   : Ok
  23: Object code reading                                   : Ok
  24: Sample parsing                                        : Ok
  25: Use a dummy software event to keep tracking           : Ok
  26: Parse with no sample_id_all bit set                   : Ok
  27: Filter hist entries                                   : Ok
  28: Lookup mmap thread                                    : Ok
  29: Share thread mg                                       : Ok
  30: Sort output of hist entries                           : Ok
  31: Cumulate child hist entries                           : Ok
  32: Track with sched_switch                               : Ok
  33: Filter fds with revents mask in a fdarray             : Ok
  34: Add fd to a fdarray, making it autogrow               : Ok
  35: kmod_path__parse                                      : Ok
  36: Thread map                                            : Ok
  37: LLVM search and compile                               :
  37.1: Basic BPF llvm compile                              : Ok
  37.2: kbuild searching                                    : Ok
  37.3: Compile source for BPF prologue generation          : Ok
  37.4: Compile source for BPF relocation                   : Ok
  38: Session topology                                      : Ok
  39: BPF filter                                            :
  39.1: Basic BPF filtering                                 : Ok
  39.2: BPF pinning                                         : Ok
  39.3: BPF prologue generation                             : Ok
  39.4: BPF relocation checker                              : Ok
  40: Synthesize thread map                                 : Ok
  41: Remove thread map                                     : Ok
  42: Synthesize cpu map                                    : Ok
  43: Synthesize stat config                                : Ok
  44: Synthesize stat                                       : Ok
  45: Synthesize stat round                                 : Ok
  46: Synthesize attr update                                : Ok
  47: Event times                                           : Ok
  48: Read backward ring buffer                             : Ok
  49: Print cpu map                                         : Ok
  50: Probe SDT events                                      : Ok
  51: is_printable_array                                    : Ok
  52: Print bitmap                                          : Ok
  53: perf hooks                                            : Ok
  54: builtin clang support                                 : Skip (not compiled in)
  55: unit_number__scnprintf                                : Ok
  56: x86 rdpmc                                             : Ok
  57: Convert perf time to TSC                              : Ok
  58: DWARF unwind                                          : Ok
  59: x86 instruction decoder - new instructions            : Ok
  60: Use vfs_getname probe to get syscall args filenames   : Ok
  61: probe libc's inet_pton & backtrace it with ping       : Ok
  62: Check open filename arg using perf trace + vfs_getname: Ok
  63: Add vfs_getname probe to get syscall args filenames   : Ok
  # 
  
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/perf/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
                   make_tags_O: make tags
              make_no_libelf_O: make NO_LIBELF=1
           make_no_backtrace_O: make NO_BACKTRACE=1
           make_no_libpython_O: make NO_LIBPYTHON=1
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
                   make_pure_O: make
                 make_perf_o_O: make perf.o
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
             make_no_libnuma_O: make NO_LIBNUMA=1
             make_util_map_o_O: make util/map.o
                  make_debug_O: make DEBUG=1
                   make_help_O: make help
                make_no_newt_O: make NO_NEWT=1
                    make_doc_O: make doc
             make_no_libperl_O: make NO_LIBPERL=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
         make_install_prefix_O: make install prefix=/tmp/krava
               make_no_slang_O: make NO_SLANG=1
         make_with_clangllvm_O: make LIBCLANGLLVM=1
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
       make_util_pmu_bison_o_O: make util/pmu-bison.o
           make_no_libbionic_O: make NO_LIBBIONIC=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
            make_install_bin_O: make install-bin
                make_install_O: make install
                make_no_gtk2_O: make NO_GTK2=1
                 make_static_O: make LDFLAGS=-static
                 make_cscope_O: make cscope
              make_no_libbpf_O: make NO_LIBBPF=1
            make_no_demangle_O: make NO_DEMANGLE=1
              make_clean_all_O: make clean all
  OK
  make: Leaving directory '/home/acme/git/perf/tools/perf'
  $

^ permalink raw reply

* [PATCH net-next 1/6] phy: add 2.5G SGMII mode to the phy_mode enum
From: Florian Fainelli @ 2017-12-28 14:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228100656.GF2626@kwain>



On 12/28/2017 02:06 AM, Antoine Tenart wrote:
> Hi Andrew,
> 
> On Thu, Dec 28, 2017 at 08:20:53AM +0100, Andrew Lunn wrote:
>> On Wed, Dec 27, 2017 at 11:14:41PM +0100, Antoine Tenart wrote:
>>> This patch adds one more generic PHY mode to the phy_mode enum, to allow
>>> configuring generic PHYs to the 2.5G SGMII mode by using the set_mode
>>> callback.
>>>
>>> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
>>> ---
>>>  include/linux/phy/phy.h | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
>>> index 4f8423a948d5..70459a28f3a1 100644
>>> --- a/include/linux/phy/phy.h
>>> +++ b/include/linux/phy/phy.h
>>> @@ -28,6 +28,7 @@ enum phy_mode {
>>>  	PHY_MODE_USB_DEVICE,
>>>  	PHY_MODE_USB_OTG,
>>>  	PHY_MODE_SGMII,
>>> +	PHY_MODE_SGMII_2_5G,
>>>  	PHY_MODE_10GKR,
>>>  	PHY_MODE_UFS_HS_A,
>>>  	PHY_MODE_UFS_HS_B,
>>
>> There was a discussion maybe last month about adding 2.5G SGMII. I
>> would prefer 2500SGMII. Putting the number first makes it uniform with
>> the other defines, 1000BASEX, 25000BASEX, 10GKR.
> 
> Good to know. I wasn't completely sure how to name this mode properly,
> but I'm fine with PHY_MODE_2500SGMII. I'll update the patches and send a
> v2 (without the dt part).

And since you are respinning, please make sure you update phy_modes() in
the same header file as well as
Documentation/devicetree/bindings/net/ethernet.txt with the newly added
PHY interface mode.
-- 
Florian

^ permalink raw reply

* [PATCH] pinctrl: sunxi: fix a typo when merging A20 support to A10 driver
From: Linus Walleij @ 2017-12-28 14:06 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228132009.12839-1-icenowy@aosc.io>

On Thu, Dec 28, 2017 at 2:20 PM, Icenowy Zheng <icenowy@aosc.io> wrote:

> When merging A20 pinctrl support to A10 pinctrl driver, the I2C function
> of PI3 is wrongly written as "i2c3" (it should be "i2c4").
>
> Fix this typo.
>
> Fixes: cad4e209c102 ("pinctrl: sunxi: add support of R40 to A10 pinctrl driver")
> Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply

* [PATCH] ARM: dts: sun8i: fix USB Ethernet of Orange Pi R1
From: Icenowy Zheng @ 2017-12-28 14:05 UTC (permalink / raw)
  To: linux-arm-kernel

Orange Pi R1 uses a Realtek RTL8152B USB Ethernet chip, which is easily
seen on the board but not show in the schematics. A regulator for the
power of the RTL8152B chip is hidden, which uses the same pin with the
Wi-Fi regulator on the original Orange Pi Zero.

Add this regulator back to the device tree, and bind it to USB1.

Tested-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
index 32a6d312422e..f7f61cbcd15a 100644
--- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
+++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
@@ -49,6 +49,20 @@
 
 	/delete-node/ reg_vcc_wifi;
 
+	/*
+	 * Ths pin of this regulator is the same with the Wi-Fi extra
+	 * regulator on the original Zero. However it's used for USB
+	 * Ethernet rather than the Wi-Fi now.
+	 */
+	reg_vcc_usb_eth: reg-vcc-usb-ethernet {
+		compatible = "regulator-fixed";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-name = "vcc-usb-ethernet";
+		enable-active-high;
+		gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
+	};
+
 	aliases {
 		ethernet1 = &rtl8189etv;
 	};
@@ -71,3 +85,7 @@
 		reg = <1>;
 	};
 };
+
+&usbphy {
+	usb1_vbus-supply = <&reg_vcc_usb_eth>;
+};
-- 
2.14.2

^ permalink raw reply related

* [PATCH v2 4/5] ARM: dts: Add support for emtrion emCON-MX6 series
From: Alexandre Belloni @ 2017-12-28 13:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAL_JsqKKwDmq953x+0SnZ_u4T5kXyQza9rnEOzyyomSTmf7Hqw@mail.gmail.com>

On 26/12/2017 at 11:16:34 -0600, Rob Herring wrote:
> On Fri, Dec 22, 2017 at 4:56 AM, Alexandre Belloni
> <alexandre.belloni@free-electrons.com> wrote:
> > + Philippe
> >
> > On 22/12/2017 at 11:43:33 +0100, Andreas F?rber wrote:
> >> >> I'll change it for v3 of this patch however it will end up like this:
> >> >> //SPDX-License...
> >> >
> >> > That should be /* SPDX-License */, // is for c files.
> >>
> >> Got any reference for that? Since we're using the C preprocessor before
> >> feeding them to dtc, we can use the same // style for both, builds fine.
> >>
> >> Only for my private DT overlay files that I use directly with dtc I
> >> couldn't adopt that style.
> 
> We are well past the point of being able to build most dts files with just dtc.
> 
> > The doc states:
> >
> > If a specific tool cannot handle the standard comment style, then the
> > appropriate comment mechanism which the tool accepts shall be used. This
> > is the reason for having the "/\* \*/" style comment in C header
> > files.
> >
> > I interpreted that as dtc doesn't handle // comments, use /**/
> 
> It's been so long, I'd forgotten that. Perhaps we should fix dtc to
> handle // comments.
> 

The would probably be the best solution so we get a somewhat consistent
style before people start moving the existing SDPX identifiers to the
top of their dtsi/dts files.

> >
> > But I agree it also states:
> > .dts{i}:          // SPDX-License-Identifier: <SPDX License Expression>
> 
> Or we could still change this. The guidelines aren't merged yet.
> 
> Rob

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

^ permalink raw reply

* [PATCH] pinctrl: sunxi: fix a typo when merging A20 support to A10 driver
From: Icenowy Zheng @ 2017-12-28 13:20 UTC (permalink / raw)
  To: linux-arm-kernel

When merging A20 pinctrl support to A10 pinctrl driver, the I2C function
of PI3 is wrongly written as "i2c3" (it should be "i2c4").

Fix this typo.

Fixes: cad4e209c102 ("pinctrl: sunxi: add support of R40 to A10 pinctrl driver")
Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
index 295e48fc94bc..0c7c361ebac5 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
@@ -1167,7 +1167,7 @@ static const struct sunxi_desc_pin sun4i_a10_pins[] = {
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
 		  SUNXI_FUNCTION(0x2, "pwm"),		/* PWM1 */
-		  SUNXI_FUNCTION_VARIANT(0x3, "i2c3",	/* SDA */
+		  SUNXI_FUNCTION_VARIANT(0x3, "i2c4",	/* SDA */
 					 PINCTRL_SUN7I_A20 |
 					 PINCTRL_SUN8I_R40)),
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 4),
-- 
2.14.2

^ permalink raw reply related

* [PATCH 2/2] ARM: multi_v7_defconfig: Enable OP-TEE
From: Krzysztof Kozlowski @ 2017-12-28 13:03 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1514453660-15373-2-git-send-email-peng.fan@nxp.com>

On Thu, Dec 28, 2017 at 10:34 AM, Peng Fan <peng.fan@nxp.com> wrote:
> Enable OP-TEE for multi_v7_defconfig

Why? You essentially copied here the subject of patch. That is not enough.

Best regards,
Krzysztof

^ permalink raw reply

* [PATCH 1/2] ARM: multi_v7_defconfig: select CONFIG_RTC_DRV_SNVS
From: Krzysztof Kozlowski @ 2017-12-28 13:02 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1514453660-15373-1-git-send-email-peng.fan@nxp.com>

On Thu, Dec 28, 2017 at 10:34 AM, Peng Fan <peng.fan@nxp.com> wrote:
> Select CONFIG_RTC_DRV_SNVS for i.MX6 to use RTC to wakeup system
> Patch generated with:
>         make ARCH=arm multi_v7_defconfig
>         select CONFIG_RTC_DRV_SNVS
>         make savedefconfig

No. You are doing hundreds of changes just to enable one option. There
is no way to review this...

Instead if you need to cleanup the defconfig, first do this in
separate step without any other changes.

Then send a patch adding necessary options.

Best regards,
Krzysztof

^ permalink raw reply

* [PATCH] ARM: dts: sun8i: Fix power for USB Ethernet controller
From: Icenowy Zheng @ 2017-12-28 13:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171228125222.12942-1-hauke@hauke-m.de>

? 2017?12?28???? CST ??8:52:22?Hauke Mehrtens ???
> The RTL8152B USB controller needs a 3.3 volt power supply which is
> controlled by PAD20. Without this patch Linux will not see that there is
> a device connected to the USB bus and the 2. USB port will not work.
> 
> I do not of a better solution to add a regulator to a USB device.

I have one.

Please check the patch I will send you soon.

> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
> b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts index
> 32a6d312422e..1d5db0e0bd12 100644
> --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
> +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
> @@ -47,13 +47,15 @@
>  	model = "Xunlong Orange Pi R1";
>  	compatible = "xunlong,orangepi-r1", "allwinner,sun8i-h2-plus";
> 
> -	/delete-node/ reg_vcc_wifi;
> -
>  	aliases {
>  		ethernet1 = &rtl8189etv;
>  	};
>  };
> 
> +&reg_vcc_wifi {
> +	regulator-always-on;
> +};
> +
>  &ohci1 {
>  	/*
>  	 * RTL8152B USB-Ethernet adapter is connected to USB1,

^ permalink raw reply

* [PATCH] dt: psci: Update DT bindings to support hierarchical PSCI states
From: Ulf Hansson @ 2017-12-28 13:00 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171226221311.4vx7f3kmcvt5t6gt@rob-hp-laptop>

On 26 December 2017 at 23:13, Rob Herring <robh@kernel.org> wrote:
> On Fri, Dec 22, 2017 at 03:32:07PM +0100, Ulf Hansson wrote:
>> From: Lina Iyer <lina.iyer@linaro.org>
>>
>> Update DT bindings to represent hierarchical CPU and CPU domain idle states
>> for PSCI. Also update the PSCI examples to clearly show how flattened and
>> hierarchical idle states can be represented in DT.
>>
>> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>
>> For your information, I have picked up the work from Lina Iyer around the so
>> called CPU cluster idling series [1,2] and I working on new versions. However,
>> I decided to post the updates to the PSCI DT bindings first, as they will be
>> needed to be agreed upon before further changes can be done to the PSCI firmware
>> driver.
>>
>> Note, these bindings have been discussed over and over again, at LKML, but
>> especially also at various Linux conferences, like LPC and Linaro Connect. We
>> finally came to a conclusion and the changes we agreed upon, should be reflected
>> in this update.
>>
>> Of course, it's a while ago since the latest discussions, but hopefully people
>> don't have too hard time to remember.
>
> Vaguely...
>
>>
>> Kind regards
>> Uffe
>>
>> [1]
>> https://www.spinics.net/lists/arm-kernel/msg566200.html
>>
>> [2]
>> https://lwn.net/Articles/716300/
>>
>> ---
>>  Documentation/devicetree/bindings/arm/psci.txt | 152 +++++++++++++++++++++++++
>>  1 file changed, 152 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/psci.txt b/Documentation/devicetree/bindings/arm/psci.txt
>> index a2c4f1d..5a8f11b 100644
>> --- a/Documentation/devicetree/bindings/arm/psci.txt
>> +++ b/Documentation/devicetree/bindings/arm/psci.txt
>> @@ -105,7 +105,159 @@ Case 3: PSCI v0.2 and PSCI v0.1.
>>               ...
>>       };
>>
>> +PSCI v1.0 onwards, supports OS-Initiated mode for powering off CPUs and CPU
>> +clusters from the firmware. For such topologies the PSCI firmware driver acts
>> +as pseudo-controller, which may be specified in the psci DT node. The
>> +definitions of the CPU and the CPU cluster topology, must conform to the domain
>> +idle state specification [3]. The domain idle states themselves, must be
>> +compatible with the defined 'domain-idle-state' binding [1], and also need to
>> +specify the arm,psci-suspend-param property for each idle state.
>> +
>> +DT allows representing CPU and CPU cluster idle states in two different ways -
>> +
>> +The flattened model as given in Example 1, lists CPU's idle states followed by
>> +the domain idle state that the CPUs may choose. This is the general practice
>> +followed in PSCI firmwares that support Platform Coordinated mode. Note that
>> +the idle states are all compatible with "arm,idle-state".
>> +
>> +Example 2 represents the hierarchical model of CPU and domain idle states.
>> +CPUs define their domain provider in their DT node. The domain controls the
>> +power to the CPU and possibly other h/w blocks that would be powered off when
>> +the CPU is powered off. The CPU's idle states may therefore be considered as
>> +the domain's idle states and have the compatible "arm,idle-state". Such domains
>> +may be embedded within another domain that represents common h/w blocks between
>> +these CPUs viz. the cluster. The idle states of the cluster would be
>> +represented as the domain's idle states. In order to use OS-Initiated mode of
>> +PSCI in the firmware, the hierarchical representation must be used.
>> +
>> +Example 1: Flattened representation of CPU and domain idle states
>> +     cpus {
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +
>> +             CPU0: cpu at 0 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a53", "arm,armv8";
>> +                     reg = <0x0>;
>> +                     enable-method = "psci";
>> +                     cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>,
>> +                                       <&CLUSTER_PWR_DWN>;
>> +             };
>> +
>> +             CPU1: cpu at 1 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a57", "arm,armv8";
>> +                     reg = <0x100>;
>> +                     enable-method = "psci";
>> +                     cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>,
>> +                                       <&CLUSTER_PWR_DWN>;
>> +             };
>> +
>> +             idle-states {
>> +                     CPU_PWRDN: cpu_power_down{
>
> Use '-' rather than '_'. dtc has more warnings since last time...

Yes, I found this on a couple of more places and fixed them all.

>
>> +                             compatible = "arm,idle-state";
>> +                             arm,psci-suspend-param = <0x000001>;
>> +                             entry-latency-us = <10>;
>> +                             exit-latency-us = <10>;
>> +                             min-residency-us = <100>;
>> +                     };
>> +
>> +                     CLUSTER_RET: domain_ret {
>> +                             compatible = "arm,idle-state";
>> +                             arm,psci-suspend-param = <0x1000010>;
>> +                             entry-latency-us = <500>;
>> +                             exit-latency-us = <500>;
>> +                             min-residency-us = <2000>;
>> +                     };
>> +
>> +                     CLUSTER_PWR_DWN: domain_off {
>> +                             compatible = "arm,idle-state";
>> +                             arm,psci-suspend-param = <0x1000030>;
>> +                             entry-latency-us = <2000>;
>> +                             exit-latency-us = <2000>;
>> +                             min-residency-us = <6000>;
>> +                     };
>> +     };
>> +
>> +     psci {
>> +             compatible = "arm,psci-0.2";
>> +             method = "smc";
>> +     };
>> +
>> +Example 2: Hierarchical representation of CPU and domain idle states
>> +
>> +     cpus {
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +
>> +             CPU0: cpu at 0 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a53", "arm,armv8";
>> +                     reg = <0x0>;
>> +                     enable-method = "psci";
>> +                     power-domains = <&CPU_PD0>;
>> +             };
>> +
>> +             CPU1: cpu at 1 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a57", "arm,armv8";
>> +                     reg = <0x100>;
>> +                     enable-method = "psci";
>> +                     power-domains = <&CPU_PD1>;
>> +             };
>> +
>> +             idle-states {
>> +                     CPU_PWRDN: cpu_power_down{
>> +                             compatible = "arm,idle-state";
>> +                             arm,psci-suspend-param = <0x000001>;
>> +                             entry-latency-us = <10>;
>> +                             exit-latency-us = <10>;
>> +                             min-residency-us = <100>;
>> +                     };
>> +
>> +                     CLUSTER_RET: domain_ret {
>> +                             compatible = "domain-idle-state";
>> +                             arm,psci-suspend-param = <0x1000010>;
>> +                             entry-latency-us = <500>;
>> +                             exit-latency-us = <500>;
>> +                             min-residency-us = <2000>;
>> +                     };
>> +
>> +                     CLUSTER_PWR_DWN: domain_off {
>> +                             compatible = "domain-idle-state";
>> +                             arm,psci-suspend-param = <0x1000030>;
>> +                             entry-latency-us = <2000>;
>> +                             exit-latency-us = <2000>;
>> +                             min-residency-us = <6000>;
>> +                     };
>> +             };
>> +     };
>> +
>> +     psci {
>> +             compatible = "arm,psci-1.0";
>> +             method = "smc";
>> +
>> +             CPU_PD0: cpu-pd at 0 {
>
> A unit address without reg property is now a warning.

There is currently no need for reg property, so let me replace this with:

CPU_PD0: cpu-pd0

>
>> +                     #power-domain-cells = <0>;
>> +                     domain-idle-states = <&CPU_PWRDN>;
>> +                     power-domains = <&CLUSTER_PD>;
>> +             };
>> +
>> +             CPU_PD1: cpu-pd at 1 {
>> +                     #power-domain-cells = <0>;
>> +                     domain-idle-states =  <&CPU_PWRDN>;
>> +                     power-domains = <&CLUSTER_PD>;
>
> Could this node be a child of CLUSTER_PD rather than having a phandle?
> Doesn't matter so much here, but when you have 3 levels?

This follows existing bindings for power-domains as per
Documentation/devicetree/bindings/power/power_domain.txt. I guess it's
better to stick to that!?

>
>> +             };
>
> These 2 nodes are identical, so why do you need both?

Each node represents a power domain, which contains devices (in this
case CPUs) that are specific to each power domain.

In other words, we are trying to describe the HW using a hierarchical layout.

>
>> +
>> +             CLUSTER_PD: cluster-pd at 0 {
>> +                     #power-domain-cells = <0>;
>> +                     domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWR_DWN>;
>> +             };
>> +     };
>> +
>>  [1] Kernel documentation - ARM idle states bindings
>>      Documentation/devicetree/bindings/arm/idle-states.txt
>>  [2] Power State Coordination Interface (PSCI) specification
>>      http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
>> +[3]. PM Domains description
>> +    Documentation/devicetree/bindings/power/power_domain.txt
>> --
>> 2.7.4
>>

Kind regards
Uffe

^ 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