[PATCH v3 06/15] drm/sun4i: Force the mixer rate at 150MHz

2017-12-05 Thread Maxime Ripard
It seems like the mixer can only run properly when clocked at 150MHz. In
order to have something more robust than simply a fire-and-forget
assigned-clocks-rate, let's put that in the code.

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c |  9 +
 drivers/gpu/drm/sun4i/sun8i_mixer.h |  3 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c 
b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index 29ceeb016d72..ff235e3228ce 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -400,6 +400,14 @@ static int sun8i_mixer_bind(struct device *dev, struct 
device *master,
}
clk_prepare_enable(mixer->mod_clk);
 
+   /*
+* It seems that we need to enforce that rate for whatever
+* reason for the mixer to be functional. Make sure it's the
+* case.
+*/
+   if (mixer->cfg->mod_rate)
+   clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate);
+
list_add_tail(&mixer->engine.list, &drv->engine_list);
 
/* Reset the registers */
@@ -474,6 +482,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
.ui_num = 1,
.scaler_mask = 0x3,
.ccsc = 0,
+   .mod_rate = 15000,
 };
 
 static const struct of_device_id sun8i_mixer_of_table[] = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h 
b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index bc58040a88f9..f34e70c42adf 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -121,12 +121,15 @@ struct de2_fmt_info {
  * Set value to 0 if this is first mixer or second mixer with VEP support.
  * Set value to 1 if this is second mixer without VEP support. Other values
  * are invalid.
+ * @mod_rate: module clock rate that needs to be set in order to have
+ * a functional block.
  */
 struct sun8i_mixer_cfg {
int vi_num;
int ui_num;
int scaler_mask;
int ccsc;
+   unsigned long   mod_rate;
 };
 
 struct sun8i_mixer {
-- 
git-series 0.9.1


[PATCH v3 00/15] drm/sun4i: Add A83t LVDS support

2017-12-05 Thread Maxime Ripard
Hi,

Here is an attempt at supporting the LVDS output in our DRM driver. This
has been tested on the A83T (with DE2), but since everything is basically
in the TCON, it should also be usable on the older SoCs with minor
modifications.

This was the occasion to refactor a bunch of things. The most notable ones
would be the documentation, and split of the UI layers in the mixer code,
and the switch to kfifo for our endpoint parsing code in the driver that
fixes an issue introduced by the switch to BFS.

Let me know what you think,
Maxime

Changes from v2:
  - Move the module clock rate to the mixer structure
  - Adjusted the simple-panel documentation for power-supply
  - Changed the compatible for the first A83t mixer to mixer 0
  - Rebased on top of current drm-misc
  - Split out the A83t bindings in its separate patch

Changes from v1:
  - Added a fix for the error path handling in the TCON
  - Enable the TCON by default
  - Removed the patch that changes the channels offset but kept most of the
modifications as a cleanup
  - Deal with the LVDS clock being able to have another PLL parent on some
SoCs
  - Renamed the TCON compatible to TCON-TV, following the convention used
on newer SoCs
  - Removed the hardcoded timings
  - Moved LVDS enable quirks to a separate function
  - Used clock indices define in the DT
  - Removed the hardcoded clock rate in the DT and moved it to the driver
  - Changed sun8i_mixer_planes to sun8i_mixer_ui_planes to be consistent
  - Added the various tags collected
  - Rebased on top of 4.15

Maxime Ripard (15):
  dt-bindings: panel: lvds: Document power-supply property
  drm/panel: lvds: Add support for the power-supply property
  dt-bindings: display: sun4i-drm: Add LVDS properties
  dt-bindings: display: sun4i-drm: Add A83T pipeline
  drm/sun4i: Fix error path handling
  drm/sun4i: Force the mixer rate at 150MHz
  drm/sun4i: Create minimal multipliers and dividers
  drm/sun4i: Add LVDS support
  drm/sun4i: Add A83T support
  ARM: dts: sun8i: a83t: Add display pipeline
  ARM: dts: sun8i: a83t: Enable the PWM
  ARM: dts: sun8i: a83t: Add LVDS pins group
  ARM: dts: sun8i: a83t: Add the PWM pin group
  ARM: dts: sun8i: a711: Reinstate the PMIC compatible
  ARM: dts: sun8i: a711: Enable the LCD

 Documentation/devicetree/bindings/display/panel/panel-common.txt |   6 ++-
 Documentation/devicetree/bindings/display/panel/panel-lvds.txt   |   1 +-
 Documentation/devicetree/bindings/display/panel/simple-panel.txt |   2 +-
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt|  11 +++-
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts|  62 
++-
 arch/arm/boot/dts/sun8i-a83t.dtsi|  99 
+-
 drivers/gpu/drm/panel/panel-lvds.c   |  23 +++-
 drivers/gpu/drm/sun4i/Makefile   |   1 +-
 drivers/gpu/drm/sun4i/sun4i_dotclock.c   |  10 ++-
 drivers/gpu/drm/sun4i/sun4i_drv.c|   1 +-
 drivers/gpu/drm/sun4i/sun4i_lvds.c   | 183 
+-
 drivers/gpu/drm/sun4i/sun4i_lvds.h   |  18 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c   | 247 
+++-
 drivers/gpu/drm/sun4i/sun4i_tcon.h   |  31 
+-
 drivers/gpu/drm/sun4i/sun8i_mixer.c  |  18 +-
 drivers/gpu/drm/sun4i/sun8i_mixer.h  |   3 +-
 16 files changed, 709 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_lvds.c
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_lvds.h

base-commit: 3b71239181e5429702387666f1ac70a9e6856cce
-- 
git-series 0.9.1


[PATCH v3 07/15] drm/sun4i: Create minimal multipliers and dividers

2017-12-05 Thread Maxime Ripard
The various outputs the TCON can provide have different constraints on the
dotclock divider. Let's make them configurable by the various mode_set
functions.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun4i_dotclock.c | 10 +++---
 drivers/gpu/drm/sun4i/sun4i_tcon.c |  2 ++
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c 
b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index d401156490f3..023f39bda633 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -17,8 +17,9 @@
 #include "sun4i_dotclock.h"
 
 struct sun4i_dclk {
-   struct clk_hw   hw;
-   struct regmap   *regmap;
+   struct clk_hw   hw;
+   struct regmap   *regmap;
+   struct sun4i_tcon   *tcon;
 };
 
 static inline struct sun4i_dclk *hw_to_dclk(struct clk_hw *hw)
@@ -73,11 +74,13 @@ static unsigned long sun4i_dclk_recalc_rate(struct clk_hw 
*hw,
 static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
  unsigned long *parent_rate)
 {
+   struct sun4i_dclk *dclk = hw_to_dclk(hw);
+   struct sun4i_tcon *tcon = dclk->tcon;
unsigned long best_parent = 0;
u8 best_div = 1;
int i;
 
-   for (i = 6; i <= 127; i++) {
+   for (i = tcon->dclk_min_div; i <= tcon->dclk_max_div; i++) {
unsigned long ideal = rate * i;
unsigned long rounded;
 
@@ -167,6 +170,7 @@ int sun4i_dclk_create(struct device *dev, struct sun4i_tcon 
*tcon)
dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL);
if (!dclk)
return -ENOMEM;
+   dclk->tcon = tcon;
 
init.name = clk_name;
init.ops = &sun4i_dclk_ops;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index ea056a3d2131..46e28ca1f676 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -177,6 +177,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon 
*tcon,
u8 clk_delay;
u32 val = 0;
 
+   tcon->dclk_min_div = 6;
+   tcon->dclk_max_div = 127;
sun4i_tcon0_mode_set_common(tcon, mode);
 
/* Adjust clock delay */
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h 
b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 839266a38505..bd3ad7684870 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -169,6 +169,8 @@ struct sun4i_tcon {
 
/* Pixel clock */
struct clk  *dclk;
+   u8  dclk_max_div;
+   u8  dclk_min_div;
 
/* Reset control */
struct reset_control*lcd_rst;
-- 
git-series 0.9.1


Attention Dear,

2017-12-05 Thread United Nation
Attention Dear,

It's my pleasure to inform you that we have been working towards the 
eradication of fraudsters artists in the world with the help of the African 
Union (AU) United Nations (UN) European Union (EU) and we have been able to 
track down some artists in various parts of the world and they are all in 
government custody now.

During the investigation, they were able to recover some funds from these 
artists and all the organizations have agreed and ordered Mr. David John, the 
funds recovered to be shared among the 15 Lucky people listed as a 
compensation. This notice is been directed to you because your e-mail address 
was found in one of the artist file and computer hard-disk while investigating, 
you are therefore being compensated with sum of US$4 Million dollars in ATM 
card.

contact Mr. David John, with your personal information on his E-mail; 
(davidjohnofficef...@gmail.com)

Name
Country
Delivery Address
Telephone Number
Occupation
Age
Gender

Thanks
Best Regards
Signed by UN Secretary-General Antonio Guterres,


[PATCH v3 09/15] drm/sun4i: Add A83T support

2017-12-05 Thread Maxime Ripard
Add support for the A83T display pipeline.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun4i_drv.c   |  1 +
 drivers/gpu/drm/sun4i/sun4i_tcon.c  |  5 +
 drivers/gpu/drm/sun4i/sun8i_mixer.c |  9 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c 
b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 49215d91c853..6f5e721b545e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -347,6 +347,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
{ .compatible = "allwinner,sun6i-a31s-display-engine" },
{ .compatible = "allwinner,sun7i-a20-display-engine" },
{ .compatible = "allwinner,sun8i-a33-display-engine" },
+   { .compatible = "allwinner,sun8i-a83t-display-engine" },
{ .compatible = "allwinner,sun8i-v3s-display-engine" },
{ }
 };
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 92f4738101e6..9b757450555f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -1132,6 +1132,10 @@ static const struct sun4i_tcon_quirks sun8i_a33_quirks = 
{
.has_lvds_pll   = true,
 };
 
+static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = {
+   /* nothing is supported */
+};
+
 static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
/* nothing is supported */
 };
@@ -1144,6 +1148,7 @@ const struct of_device_id sun4i_tcon_of_table[] = {
{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks 
},
{ .compatible = "allwinner,sun7i-a20-tcon", .data = &sun7i_a20_quirks },
{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
+   { .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data = 
&sun8i_a83t_lcd_quirks },
{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
{ }
 };
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c 
b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index ff235e3228ce..6829bec4ba68 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -477,6 +477,11 @@ static int sun8i_mixer_remove(struct platform_device *pdev)
return 0;
 }
 
+static const struct sun8i_mixer_cfg sun8i_a83t_mixer_cfg = {
+   .vi_num = 1,
+   .ui_num = 3,
+};
+
 static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
.vi_num = 2,
.ui_num = 1,
@@ -487,6 +492,10 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
 
 static const struct of_device_id sun8i_mixer_of_table[] = {
{
+   .compatible = "allwinner,sun8i-a83t-de2-mixer-0",
+   .data = &sun8i_a83t_mixer_cfg,
+   },
+   {
.compatible = "allwinner,sun8i-v3s-de2-mixer",
.data = &sun8i_v3s_mixer_cfg,
},
-- 
git-series 0.9.1


[PATCH v3 10/15] ARM: dts: sun8i: a83t: Add display pipeline

2017-12-05 Thread Maxime Ripard
The display pipeline on the A83T is mainly composed of the mixers and
TCONs, plus various encoders.

Let's add the first mixer and TCON to the DTSI since the only board I have
can use only the LVDS output on the first TCON. The other parts will be
added eventually.

Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 79 -
 1 file changed, 79 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi 
b/arch/arm/boot/dts/sun8i-a83t.dtsi
index 19acae1b4089..e4db38c717d9 100644
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
@@ -45,8 +45,10 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 
 / {
@@ -151,6 +153,12 @@
};
};
 
+   de: display-engine {
+   compatible = "allwinner,sun8i-a83t-display-engine";
+   allwinner,pipelines = <&mixer0>;
+   status = "disabled";
+   };
+
memory {
reg = <0x4000 0x8000>;
device_type = "memory";
@@ -162,6 +170,44 @@
#size-cells = <1>;
ranges;
 
+   display_clocks: clock@100 {
+   compatible = "allwinner,sun8i-a83t-de2-clk";
+   reg = <0x0100 0x10>;
+   clocks = <&ccu CLK_PLL_DE>,
+<&ccu CLK_BUS_DE>;
+   clock-names = "mod",
+ "bus";
+   resets = <&ccu RST_BUS_DE>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   };
+
+   mixer0: mixer@110 {
+   compatible = "allwinner,sun8i-a83t-de2-mixer-0";
+   reg = <0x0110 0x10>;
+   clocks = <&display_clocks CLK_BUS_MIXER0>,
+<&display_clocks CLK_MIXER0>;
+   clock-names = "bus",
+ "mod";
+   resets = <&display_clocks RST_MIXER0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mixer0_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   mixer0_out_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = 
<&tcon0_in_mixer0>;
+   };
+   };
+   };
+   };
+
syscon: syscon@1c0 {
compatible = "allwinner,sun8i-a83t-system-controller",
"syscon";
@@ -177,6 +223,39 @@
#dma-cells = <1>;
};
 
+   tcon0: lcd-controller@1c0c000 {
+   compatible = "allwinner,sun8i-a83t-tcon-lcd";
+   reg = <0x01c0c000 0x1000>;
+   interrupts = ;
+   clocks = <&ccu CLK_BUS_TCON0>, <&ccu CLK_TCON0>;
+   clock-names = "ahb", "tcon-ch0";
+   clock-output-names = "tcon-pixel-clock";
+   resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>;
+   reset-names = "lcd", "lvds";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   tcon0_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+
+   tcon0_in_mixer0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = 
<&mixer0_out_tcon0>;
+   };
+   };
+
+   tcon0_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+   };
+   };
+   };
+
mmc0: mmc@1c0f000 {
compatible = "allwinner,sun8i-a83t-mmc",
 "allwinner,sun7i-a20-mmc";
-- 
git-series 0.9.1


[PATCH v3 13/15] ARM: dts: sun8i: a83t: Add the PWM pin group

2017-12-05 Thread Maxime Ripard
The A83T has a PWM that can be output from the SoC. Let's add a pinctrl
group for it.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi 
b/arch/arm/boot/dts/sun8i-a83t.dtsi
index e200df5a9058..a37517d4472a 100644
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
@@ -446,6 +446,11 @@
bias-pull-up;
};
 
+   pwm_pin: pwm-pin {
+   pins = "PD28";
+   function = "pwm";
+   };
+
spdif_tx_pin: spdif-tx-pin {
pins = "PE18";
function = "spdif";
-- 
git-series 0.9.1


[PATCH v3 12/15] ARM: dts: sun8i: a83t: Add LVDS pins group

2017-12-05 Thread Maxime Ripard
The A83T has an LVDS bus that can be connected to a panel or a bridge. Add
the pinctrl group for it.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi 
b/arch/arm/boot/dts/sun8i-a83t.dtsi
index 7a49b9f085eb..e200df5a9058 100644
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
@@ -415,6 +415,12 @@
#interrupt-cells = <3>;
#gpio-cells = <3>;
 
+   lcd_lvds_pins: lcd-lvds-pins {
+   pins = "PD18", "PD19", "PD20", "PD21", "PD22",
+  "PD23", "PD24", "PD25", "PD26", "PD27";
+   function = "lvds0";
+   };
+
mmc0_pins: mmc0-pins {
pins = "PF0", "PF1", "PF2",
   "PF3", "PF4", "PF5";
-- 
git-series 0.9.1


[PATCH v3 15/15] ARM: dts: sun8i: a711: Enable the LCD

2017-12-05 Thread Maxime Ripard
The A711 has 1024x600 LVDS panel, with a PWM-based backlight. Add it to our
DT.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 61 -
 1 file changed, 61 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..511fca491fe8 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -45,6 +45,7 @@
 #include "sun8i-a83t.dtsi"
 
 #include 
+#include 
 
 / {
model = "TBS A711 Tablet";
@@ -59,6 +60,44 @@
stdout-path = "serial0:115200n8";
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = <&pwm 0 5 PWM_POLARITY_INVERTED>;
+   enable-gpios = <&pio 3 29 GPIO_ACTIVE_HIGH>;
+
+   brightness-levels = <0 1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <9>;
+   };
+
+   panel {
+   compatible = "tbs,a711-panel", "panel-lvds";
+   backlight = <&backlight>;
+   power-supply = <®_sw>;
+
+   width-mm = <153>;
+   height-mm = <90>;
+   data-mapping = "vesa-24";
+
+   panel-timing {
+   /* 1024x600 @60Hz */
+   clock-frequency = <5200>;
+   hactive = <1024>;
+   vactive = <600>;
+   hsync-len = <20>;
+   hfront-porch = <180>;
+   hback-porch = <160>;
+   vfront-porch = <12>;
+   vback-porch = <23>;
+   vsync-len = <5>;
+   };
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <&tcon0_out_lcd>;
+   };
+   };
+   };
+
reg_vbat: reg-vbat {
compatible = "regulator-fixed";
regulator-name = "vbat";
@@ -89,6 +128,10 @@
};
 };
 
+&de {
+   status = "okay";
+};
+
 /*
  * An USB-2 hub is connected here, which also means we don't need to
  * enable the OHCI controller.
@@ -142,6 +185,12 @@
status = "okay";
 };
 
+&pwm {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pwm_pin>;
+   status = "okay";
+};
+
 &r_rsb {
status = "okay";
 
@@ -323,6 +372,18 @@
regulator-name = "vcc-lcd";
 };
 
+&tcon0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&lcd_lvds_pins>;
+};
+
+&tcon0_out {
+   tcon0_out_lcd: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <&panel_input>;
+   };
+};
+
 &uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pb_pins>;
-- 
git-series 0.9.1


[PATCH v3 01/15] dt-bindings: panel: lvds: Document power-supply property

2017-12-05 Thread Maxime Ripard
The power-supply property is used by a vast majority of panels, including
panel-simple. Let's document it as a common property

Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/display/panel/panel-common.txt | 6 ++
 Documentation/devicetree/bindings/display/panel/panel-lvds.txt   | 1 +
 Documentation/devicetree/bindings/display/panel/simple-panel.txt | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-common.txt 
b/Documentation/devicetree/bindings/display/panel/panel-common.txt
index ec52c472c845..125ea68052af 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-common.txt
+++ b/Documentation/devicetree/bindings/display/panel/panel-common.txt
@@ -78,6 +78,12 @@ used for panels that implement compatible control signals.
   while active. Active high reset signals can be supported by inverting the
   GPIO specifier polarity flag.
 
+Power
+-
+
+- power-supply: many display panels need an additional power supply in
+  order to be fully powered-up. For such panels, power-supply contains
+  a phandle to the regulator powering the panel.
 
 Backlight
 -
diff --git a/Documentation/devicetree/bindings/display/panel/panel-lvds.txt 
b/Documentation/devicetree/bindings/display/panel/panel-lvds.txt
index b938269f841e..250850a2150b 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-lvds.txt
+++ b/Documentation/devicetree/bindings/display/panel/panel-lvds.txt
@@ -32,6 +32,7 @@ Optional properties:
 - label: See panel-common.txt.
 - gpios: See panel-common.txt.
 - backlight: See panel-common.txt.
+- power-supply: See panel-common.txt.
 - data-mirror: If set, reverse the bit order described in the data mappings
   below on all data lanes, transmitting bits for slots 6 to 0 instead of
   0 to 6.
diff --git a/Documentation/devicetree/bindings/display/panel/simple-panel.txt 
b/Documentation/devicetree/bindings/display/panel/simple-panel.txt
index 1341bbf4aa3d..16d8ff088b7d 100644
--- a/Documentation/devicetree/bindings/display/panel/simple-panel.txt
+++ b/Documentation/devicetree/bindings/display/panel/simple-panel.txt
@@ -1,7 +1,7 @@
 Simple display panel
 
 Required properties:
-- power-supply: regulator to provide the supply voltage
+- power-supply: See panel-common.txt
 
 Optional properties:
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
-- 
git-series 0.9.1


[PATCH v3 14/15] ARM: dts: sun8i: a711: Reinstate the PMIC compatible

2017-12-05 Thread Maxime Ripard
When we added the regulator support in commit 90c5d7cdae64 ("ARM: dts:
sun8i: a711: Add regulator support"), we also dropped the PMIC's
compatible. Since it's not in the PMIC DTSI, unlike most other PMIC
DTSI, it obviously wasn't probing anymore.

Re-add it so that everything works again.

Fixes: 90c5d7cdae64 ("ARM: dts: sun8i: a711: Add regulator support")
Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts 
b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index 98715538932f..a021ee6da396 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -146,6 +146,7 @@
status = "okay";
 
axp81x: pmic@3a3 {
+   compatible = "x-powers,axp813";
reg = <0x3a3>;
interrupt-parent = <&r_intc>;
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-- 
git-series 0.9.1


[PATCH v3 11/15] ARM: dts: sun8i: a83t: Enable the PWM

2017-12-05 Thread Maxime Ripard
The A83T has the same PWM block than the H3. Add it to our DT.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun8i-a83t.dtsi |  9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi 
b/arch/arm/boot/dts/sun8i-a83t.dtsi
index e4db38c717d9..7a49b9f085eb 100644
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
@@ -497,6 +497,15 @@
status = "disabled";
};
 
+   pwm: pwm@1c21400 {
+   compatible = "allwinner,sun8i-a83t-pwm",
+"allwinner,sun8i-h3-pwm";
+   reg = <0x01c21400 0x400>;
+   clocks = <&osc24M>;
+   #pwm-cells = <3>;
+   status = "disabled";
+   };
+
uart0: serial@1c28000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c28000 0x400>;
-- 
git-series 0.9.1


[PATCH v3 08/15] drm/sun4i: Add LVDS support

2017-12-05 Thread Maxime Ripard
The TCON supports the LVDS interface to output to a panel or a bridge.
Let's add support for it.

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/Makefile |   1 +-
 drivers/gpu/drm/sun4i/sun4i_lvds.c | 183 +++-
 drivers/gpu/drm/sun4i/sun4i_lvds.h |  18 ++-
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 238 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  29 -
 5 files changed, 467 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_lvds.c
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_lvds.h

diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
index 82a6ac57fbe3..2b37a6abbb1d 100644
--- a/drivers/gpu/drm/sun4i/Makefile
+++ b/drivers/gpu/drm/sun4i/Makefile
@@ -15,6 +15,7 @@ sun8i-mixer-y += sun8i_mixer.o 
sun8i_ui_layer.o \
 
 sun4i-tcon-y   += sun4i_crtc.o
 sun4i-tcon-y   += sun4i_dotclock.o
+sun4i-tcon-y   += sun4i_lvds.o
 sun4i-tcon-y   += sun4i_tcon.o
 sun4i-tcon-y   += sun4i_rgb.o
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c 
b/drivers/gpu/drm/sun4i/sun4i_lvds.c
new file mode 100644
index ..635a3f505ecb
--- /dev/null
+++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2015 NextThing Co
+ * Copyright (C) 2015-2017 Free Electrons
+ *
+ * Maxime Ripard 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sun4i_crtc.h"
+#include "sun4i_tcon.h"
+#include "sun4i_lvds.h"
+
+struct sun4i_lvds {
+   struct drm_connectorconnector;
+   struct drm_encoder  encoder;
+
+   struct sun4i_tcon   *tcon;
+};
+
+static inline struct sun4i_lvds *
+drm_connector_to_sun4i_lvds(struct drm_connector *connector)
+{
+   return container_of(connector, struct sun4i_lvds,
+   connector);
+}
+
+static inline struct sun4i_lvds *
+drm_encoder_to_sun4i_lvds(struct drm_encoder *encoder)
+{
+   return container_of(encoder, struct sun4i_lvds,
+   encoder);
+}
+
+static int sun4i_lvds_get_modes(struct drm_connector *connector)
+{
+   struct sun4i_lvds *lvds =
+   drm_connector_to_sun4i_lvds(connector);
+   struct sun4i_tcon *tcon = lvds->tcon;
+
+   return drm_panel_get_modes(tcon->panel);
+}
+
+static struct drm_connector_helper_funcs sun4i_lvds_con_helper_funcs = {
+   .get_modes  = sun4i_lvds_get_modes,
+};
+
+static void
+sun4i_lvds_connector_destroy(struct drm_connector *connector)
+{
+   struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
+   struct sun4i_tcon *tcon = lvds->tcon;
+
+   drm_panel_detach(tcon->panel);
+   drm_connector_cleanup(connector);
+}
+
+static const struct drm_connector_funcs sun4i_lvds_con_funcs = {
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .destroy= sun4i_lvds_connector_destroy,
+   .reset  = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
+};
+
+static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder)
+{
+   struct sun4i_lvds *lvds = drm_encoder_to_sun4i_lvds(encoder);
+   struct sun4i_tcon *tcon = lvds->tcon;
+
+   DRM_DEBUG_DRIVER("Enabling LVDS output\n");
+
+   if (!IS_ERR(tcon->panel)) {
+   drm_panel_prepare(tcon->panel);
+   drm_panel_enable(tcon->panel);
+   }
+}
+
+static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder)
+{
+   struct sun4i_lvds *lvds = drm_encoder_to_sun4i_lvds(encoder);
+   struct sun4i_tcon *tcon = lvds->tcon;
+
+   DRM_DEBUG_DRIVER("Disabling LVDS output\n");
+
+   if (!IS_ERR(tcon->panel)) {
+   drm_panel_disable(tcon->panel);
+   drm_panel_unprepare(tcon->panel);
+   }
+}
+
+static const struct drm_encoder_helper_funcs sun4i_lvds_enc_helper_funcs = {
+   .disable= sun4i_lvds_encoder_disable,
+   .enable = sun4i_lvds_encoder_enable,
+};
+
+static const struct drm_encoder_funcs sun4i_lvds_enc_funcs = {
+   .destroy= drm_encoder_cleanup,
+};
+
+int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
+{
+   struct drm_encoder *encoder;
+   struct drm_bridge *bridge;
+   struct sun4i_lvds *lvds;
+   int ret;
+
+   lvds = devm_kzalloc(drm->dev, sizeof(*lvds), GFP_KERNEL);
+   if (!lvds)
+   return -ENOMEM;
+   lvds->tcon = tcon;
+   encoder = &lvds->encoder;
+
+   ret = drm_of_find_panel_or_bridge

[PATCH v3 02/15] drm/panel: lvds: Add support for the power-supply property

2017-12-05 Thread Maxime Ripard
A significant number of panels need to power up a regulator in order to
operate properly. Add support for the power-supply property to enable and
disable such a regulator whenever needed.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/panel/panel-lvds.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c 
b/drivers/gpu/drm/panel/panel-lvds.c
index e2d57c01200b..57e38a9e7ab4 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -39,6 +40,7 @@ struct panel_lvds {
bool data_mirror;
 
struct backlight_device *backlight;
+   struct regulator *supply;
 
struct gpio_desc *enable_gpio;
struct gpio_desc *reset_gpio;
@@ -69,6 +71,9 @@ static int panel_lvds_unprepare(struct drm_panel *panel)
if (lvds->enable_gpio)
gpiod_set_value_cansleep(lvds->enable_gpio, 0);
 
+   if (lvds->supply)
+   regulator_disable(lvds->supply);
+
return 0;
 }
 
@@ -76,6 +81,17 @@ static int panel_lvds_prepare(struct drm_panel *panel)
 {
struct panel_lvds *lvds = to_panel_lvds(panel);
 
+   if (lvds->supply) {
+   int err;
+
+   err = regulator_enable(lvds->supply);
+   if (err < 0) {
+   dev_err(lvds->dev, "failed to enable supply: %d\n",
+   err);
+   return err;
+   }
+   }
+
if (lvds->enable_gpio)
gpiod_set_value_cansleep(lvds->enable_gpio, 1);
 
@@ -196,6 +212,13 @@ static int panel_lvds_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
 
+   lvds->supply = devm_regulator_get_optional(lvds->dev, "power");
+   if (IS_ERR(lvds->supply)) {
+   ret = PTR_ERR(lvds->supply);
+   dev_err(lvds->dev, "failed to request regulator: %d\n", ret);
+   return ret;
+   }
+
/* Get GPIOs and backlight controller. */
lvds->enable_gpio = devm_gpiod_get_optional(lvds->dev, "enable",
 GPIOD_OUT_LOW);
-- 
git-series 0.9.1


[PATCH v3 03/15] dt-bindings: display: sun4i-drm: Add LVDS properties

2017-12-05 Thread Maxime Ripard
Some clocks and resets supposed to drive the LVDS logic in the display
engine have been overlooked when the driver was first introduced.

Add those additional resources to the binding, and we'll deal with the ABI
stability in the code.

Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 8 +++-
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt 
b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index 50cc72ee1168..d4259a4f5171 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -121,6 +121,14 @@ Required properties:
 On SoCs other than the A33 and V3s, there is one more clock required:
- 'tcon-ch1': The clock driving the TCON channel 1
 
+On SoCs that support LVDS (all SoCs but the A13, H3, H5 and V3s), you
+need one more reset line:
+   - 'lvds': The reset line driving the LVDS logic
+
+And on the SoCs newer than the A31 (sun6i and sun8i families), you
+need one more clock line:
+   - 'lvds-pll': The PLL that can be used to drive the LVDS clock
+
 DRC
 ---
 
-- 
git-series 0.9.1


Re: [RFC PATCH v2 1/8] sched/cpufreq_schedutil: make use of DEADLINE utilization signal

2017-12-05 Thread Patrick Bellasi
Hi Juri,

On 04-Dec 11:23, Juri Lelli wrote:
> From: Juri Lelli 
> 
> SCHED_DEADLINE tracks active utilization signal with a per dl_rq
> variable named running_bw.
> 
> Make use of that to drive cpu frequency selection: add up FAIR and
> DEADLINE contribution to get the required CPU capacity to handle both
> requirements (while RT still selects max frequency).
> 
> Co-authored-by: Claudio Scordino 
> Signed-off-by: Juri Lelli 
> Cc: Peter Zijlstra 
> Cc: Ingo Molnar 
> Cc: Rafael J. Wysocki 
> Cc: Viresh Kumar 
> Cc: Luca Abeni 
> Acked-by: Viresh Kumar 
> ---
>  include/linux/sched/cpufreq.h|  2 --
>  kernel/sched/cpufreq_schedutil.c | 25 +++--
>  2 files changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
> index d1ad3d825561..0b55834efd46 100644
> --- a/include/linux/sched/cpufreq.h
> +++ b/include/linux/sched/cpufreq.h
> @@ -12,8 +12,6 @@
>  #define SCHED_CPUFREQ_DL (1U << 1)
>  #define SCHED_CPUFREQ_IOWAIT (1U << 2)
>  
> -#define SCHED_CPUFREQ_RT_DL  (SCHED_CPUFREQ_RT | SCHED_CPUFREQ_DL)
> -
>  #ifdef CONFIG_CPU_FREQ
>  struct update_util_data {
> void (*func)(struct update_util_data *data, u64 time, unsigned int 
> flags);
> diff --git a/kernel/sched/cpufreq_schedutil.c 
> b/kernel/sched/cpufreq_schedutil.c
> index 2f52ec0f1539..de1ad1fffbdc 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -179,12 +179,17 @@ static unsigned int get_next_freq(struct sugov_policy 
> *sg_policy,
>  static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu)
>  {
>   struct rq *rq = cpu_rq(cpu);
> - unsigned long cfs_max;
> + unsigned long dl_util = (rq->dl.running_bw * SCHED_CAPACITY_SCALE)
> + >> BW_SHIFT;

What about using a pair of getter methods (e.g. cpu_util_{cfs,dl}) to
be defined in kernel/sched/sched.h?

This would help to hide class-specific signals mangling from cpufreq.
And here we can have something "more abstract" like:

   unsigned long util_cfs = cpu_util_cfs(rq);
   unsigned long util_dl = cpu_util_dl(rq);

>  
> - cfs_max = arch_scale_cpu_capacity(NULL, cpu);
> + *max = arch_scale_cpu_capacity(NULL, cpu);
>  
> - *util = min(rq->cfs.avg.util_avg, cfs_max);
> - *max = cfs_max;
> + /*
> +  * Ideally we would like to set util_dl as min/guaranteed freq and
> +  * util_cfs + util_dl as requested freq. However, cpufreq is not yet
> +  * ready for such an interface. So, we only do the latter for now.
> +  */

Maybe I don't completely get the above comment, but to me it is not
really required.

When you say that "util_dl" should be set to a min/guaranteed freq
are you not actually talking about a DL implementation detail?

>From the cpufreq standpoint instead, we should always set a capacity
which can accommodate util_dl + util_cfs.

We don't care about the meaning of util_dl and we should always assume
(by default) that the signal is properly updated by the scheduling
class... which unfortunately does not always happen for CFS.


> + *util = min(rq->cfs.avg.util_avg + dl_util, *max);

With the above proposal, here also we will have:

*util = min(util_cfs + util_dl, *max);

>  }
>  
>  static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time,
> @@ -272,7 +277,7 @@ static void sugov_update_single(struct update_util_data 
> *hook, u64 time,
>  
>   busy = sugov_cpu_is_busy(sg_cpu);
>  
> - if (flags & SCHED_CPUFREQ_RT_DL) {
> + if (flags & SCHED_CPUFREQ_RT) {
>   next_f = policy->cpuinfo.max_freq;
>   } else {
>   sugov_get_util(&util, &max, sg_cpu->cpu);
> @@ -317,7 +322,7 @@ static unsigned int sugov_next_freq_shared(struct 
> sugov_cpu *sg_cpu, u64 time)
>   j_sg_cpu->iowait_boost_pending = false;
>   continue;
>   }
> - if (j_sg_cpu->flags & SCHED_CPUFREQ_RT_DL)
> + if (j_sg_cpu->flags & SCHED_CPUFREQ_RT)
>   return policy->cpuinfo.max_freq;
>  
>   j_util = j_sg_cpu->util;
> @@ -353,7 +358,7 @@ static void sugov_update_shared(struct update_util_data 
> *hook, u64 time,
>   sg_cpu->last_update = time;
>  
>   if (sugov_should_update_freq(sg_policy, time)) {
> - if (flags & SCHED_CPUFREQ_RT_DL)
> + if (flags & SCHED_CPUFREQ_RT)
>   next_f = sg_policy->policy->cpuinfo.max_freq;
>   else
>   next_f = sugov_next_freq_shared(sg_cpu, time);
> @@ -383,9 +388,9 @@ static void sugov_irq_work(struct irq_work *irq_work)
>   sg_policy = container_of(irq_work, struct sugov_policy, irq_work);
>  
>   /*
> -  * For RT and deadline tasks, the schedutil governor shoots the
> -  * frequency to maximum. Special care must be taken to ensure that this
> -  * kthread doesn't result in the same behavior.
> +  

[PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror)

2017-12-05 Thread julien . boibessot
From: Julien BOIBESSOT 

Fixes following build error:
vhci_driver.c: In function 'refresh_imported_device_list':
vhci_driver.c:118:37: error: 'snprintf' output may be truncated before
the last format character [-Werror=format-truncation=]
snprintf(status, sizeof(status), "status.%d", i);
 ^~~
vhci_driver.c:118:4: note: 'snprintf' output between 9 and 18 bytes into
a destination of size 17
snprintf(status, sizeof(status), "status.%d", i);
^~~~
cc1: all warnings being treated as errors

Signed-off-by: Julien BOIBESSOT 
---
 tools/usb/usbip/libsrc/vhci_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index 5727dfb..a9ce431 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -106,7 +106,7 @@ static int parse_status(const char *value)
return 0;
 }
 
-#define MAX_STATUS_NAME 16
+#define MAX_STATUS_NAME 18
 
 static int refresh_imported_device_list(void)
 {
-- 
2.1.4



[tip:WIP.x86/pti 20/70] arch/x86/mm/kasan_init_64.c:158:2: error: implicit declaration of function 'kasan_populate_shadow'; did you mean 'kasan_populate_zero_shadow'?

2017-12-05 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/pti
head:   16db81a1bfe0974b6ed3ed102150e23449ab0c7f
commit: ba3c7d9977a2724d42bf728cbfe7a401539f [20/70] x86/kasan/64: Teach 
KASAN about the cpu_entry_area
config: x86_64-randconfig-x018-201749 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
git checkout ba3c7d9977a2724d42bf728cbfe7a401539f
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   arch/x86/mm/kasan_init_64.c: In function 'kasan_init':
>> arch/x86/mm/kasan_init_64.c:158:2: error: implicit declaration of function 
>> 'kasan_populate_shadow'; did you mean 'kasan_populate_zero_shadow'? 
>> [-Werror=implicit-function-declaration]
 kasan_populate_shadow((unsigned long)shadow_cpu_entry_begin,
 ^
 kasan_populate_zero_shadow
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
   Cyclomatic Complexity 2 arch/x86/include/asm/page_64.h:__phys_addr_nodebug
   Cyclomatic Complexity 1 arch/x86/include/asm/pgtable_types.h:native_pgd_val
   Cyclomatic Complexity 1 include/asm-generic/pgtable-nop4d.h:p4d_offset
   Cyclomatic Complexity 1 arch/x86/include/asm/pgtable_types.h:native_p4d_val
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:write_cr3
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:__flush_tlb
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:__flush_tlb_global
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:__pte
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:__pgd
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:set_pte
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:__pmd
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:__pud
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:set_p4d
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:p4d_clear
   Cyclomatic Complexity 1 include/linux/kasan.h:kasan_mem_to_shadow
   Cyclomatic Complexity 2 arch/x86/include/asm/tlbflush.h:__flush_tlb_all
   Cyclomatic Complexity 2 arch/x86/mm/kasan_init_64.c:clear_pgds
   Cyclomatic Complexity 2 arch/x86/mm/kasan_init_64.c:kasan_map_early_shadow
   Cyclomatic Complexity 1 arch/x86/mm/kasan_init_64.c:map_range
   Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:load_cr3
   Cyclomatic Complexity 2 arch/x86/mm/kasan_init_64.c:kasan_die_handler
   Cyclomatic Complexity 4 arch/x86/mm/kasan_init_64.c:kasan_early_init
   Cyclomatic Complexity 4 arch/x86/mm/kasan_init_64.c:kasan_init
   Cyclomatic Complexity 1 
arch/x86/mm/kasan_init_64.c:_GLOBAL__sub_I_00100_0_kasan_early_init
   Cyclomatic Complexity 1 
arch/x86/mm/kasan_init_64.c:_GLOBAL__sub_D_00100_1_kasan_early_init
   cc1: some warnings being treated as errors

vim +158 arch/x86/mm/kasan_init_64.c

   120  
   121  memcpy(early_top_pgt, init_top_pgt, sizeof(early_top_pgt));
   122  load_cr3(early_top_pgt);
   123  __flush_tlb_all();
   124  
   125  clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END);
   126  
   127  kasan_populate_zero_shadow((void *)KASAN_SHADOW_START,
   128  kasan_mem_to_shadow((void *)PAGE_OFFSET));
   129  
   130  for (i = 0; i < E820_MAX_ENTRIES; i++) {
   131  if (pfn_mapped[i].end == 0)
   132  break;
   133  
   134  if (map_range(&pfn_mapped[i]))
   135  panic("kasan: unable to allocate shadow!");
   136  }
   137  kasan_populate_zero_shadow(
   138  kasan_mem_to_shadow((void *)PAGE_OFFSET + MAXMEM),
   139  kasan_mem_to_shadow((void *)__START_KERNEL_map));
   140  
   141  vmemmap_populate((unsigned long)kasan_mem_to_shadow(_stext),
   142  (unsigned long)kasan_mem_to_shadow(_end),
   143  NUMA_NO_NODE);
   144  
   145  shadow_cpu_entry_begin = (void 
*)__fix_to_virt(FIX_CPU_ENTRY_AREA_BOTTOM);
   146  shadow_cpu_entry_begin = 
kasan_mem_to_shadow(shadow_cpu_entry_begin);
   147  shadow_cpu_entry_begin = (void *)round_down((unsigned 
long)shadow_cpu_entry_begin,
   148  PAGE_SIZE);
   149  
   150  shadow_cpu_entry_end = (void 
*)(__fix_to_virt(FIX_CPU_ENTRY_AREA_TOP) + PAGE_SIZE);
   151  shadow_cpu_entry_end = 
kasan_mem_to_shadow(shadow_cpu_entry_end);
   152  shadow_cpu_entry_end = (void *)round_up((unsigned 
long)shadow_cpu_entry_end,
   153  PAGE_SIZE);
   154  
   155  kasan_populate_zero_shadow(kasan_mem_to_shadow((void 
*)MODULES_END),
   156 shadow_cpu_entry_begin);
   157  
 > 158  kasan_populate_shadow((unsigned long)shadow_cpu_entry_begin,

---
0-DAY kernel test infrastructure 

Re: [RFC 00/19] KVM: s390/crypto/vfio: guest dedicated crypto adapters

2017-12-05 Thread Tony Krowiak

On 12/05/2017 09:06 AM, Cornelia Huck wrote:

On Mon, 27 Nov 2017 19:39:32 -0500
Tony Krowiak  wrote:


On 11/22/2017 08:47 AM, Cornelia Huck wrote:

On Tue, 21 Nov 2017 11:08:01 -0500
Tony Krowiak  wrote:

  

I am not quite sure what you are asking, but I'll attempt to answer
what I think you're asking. A new type of mediated matrix device
will be introduced to configure a virtual matrix for a guest that
provides the interfaces to map a virtual adapter/domain ID to one
or more real adapter/domain IDs. If by virtualization facility,
you are talking about the VFIO AP matrix driver, then yes,
the driver will handle ioctl requests based on the type of the
mediated matrix device through which the request was submitted:

If the request is to configure the KVM guest's matrix:

* If the mediated matrix device type is passthrough:
 * Do validation of matrix
 * Configure the APM, AQM and ADM in the KVM guest's CRYCB
   according to the configuration specified via the mediated
   device's sysfs attribute files.
* If the mediated matrix device type is virtual:
 * Do validation of matrix
 * No need to configure CRYCB since all instructions will be
   intercepted

Ok, so we would have two distinct paths here...

It depends upon what you mean by two distinct paths. Configuring the
mediated device would require a new mediated device type for virtualized
AP matrices. The ioctl for configuring the KVM guest's CRYCB would
require an additional check to determine whether the CRYCB need be
configured or not.

Yes, the new type makes this distinct enough so that we can think about
this later.

  

If the request is to execute an intercepted AP instruction:

* If the mediated matrix device type is passthrough:
 * Forward the instruction to the AP device and return the
   result to QEMU.

* If the mediated matrix device type is virtual:

 * Retrieve all of the real APQNs mapped to the virtual
   adapter and domain IDs configured in the mediated matrix
   device's sysfs attribute files
 * If there is more than one APQN mapping, then determine
   which would be best to use - algorithm TBD
 * Forward the instruction to the AP device and return the
   result.

...and two distinct paths for most instructions here as well.

The driver would require additional ioctls to handle
interception of all AP instructions for virtual matrices and additional
code to remap virtual APQNs to real APQNs and determine which real APQN
to which intercepted instructions should be forwarded.
  

Of course, these are just preliminary ideas at this time.
I've only prototyped the sysfs configuration interfaces. No
back end prototyping has been undertaken yet. If the ideas do
not pan out, however; I think virtualization can be introduced
as an independent design.

Yes, let's cross that bridge when we get to it.

That is the plan. Given Pierre's objections, I thought it might help
to touch on this.

OK, so I admit that I lost track a bit. Are there any remaining issues
beyond the feature handling? Would it make sense to post a v2?

I was planning on posting a V2 once the features issue is settled.






Re: [PATCH tip/core/rcu 16/21] drivers/infiniband: Remove now-redundant smp_read_barrier_depends()

2017-12-05 Thread Jason Gunthorpe
> commit c389c98ec5f4a7aa4c36853e89801eb5ea81870e
> Author: Paul E. McKenney 
> Date:   Mon Nov 27 09:04:22 2017 -0800
> 
> drivers/infiniband: Remove now-redundant smp_read_barrier_depends()
> 
> The smp_read_barrier_depends() does nothing at all except on DEC Alpha,
> and no current DEC Alpha systems use Infiniband:
> 
>   lkml.kernel.org/r/20171023085921.jwbntptn6ictbnvj@tower
> 
> This commit therefore makes Infiniband depend on !ALPHA and removes
> the now-ineffective invocations of smp_read_barrier_depends() from
> the InfiniBand driver.
> 
> Please note that this patch should not be construed as my saying that
> InfiniBand's memory ordering is correct, but rather that this patch does
> not in any way affect InfiniBand's correctness.  In other words, the
> result of applying this patch is bug-for-bug compatible with the original.
> 
> Signed-off-by: Paul E. McKenney 
> Cc: Doug Ledford 
> Cc: Jason Gunthorpe 
> Cc: Richard Henderson 
> Cc: Ivan Kokshaysky 
> Cc: Matt Turner 
> Cc: Michael Cree 
> Cc: Andrea Parri 
> Cc: 
> Cc: 
> [ paulmck: Removed drivers/dma/ioat/dma.c per Jason Gunthorpe's feedback. 
> ]

Let me know if you want this patch to flow through the rdma tree..

Acked-by: Jason Gunthorpe 


Re: [PATCH net-next v3 1/4] phylib: Add device reset delay support

2017-12-05 Thread Richard Leitner
Hi Geert,

On 12/05/2017 02:54 PM, Geert Uytterhoeven wrote:
> Hi Richard,
> 
> On Tue, Dec 5, 2017 at 2:25 PM, Richard Leitner  wrote:
>> From: Richard Leitner 
>>
>> Some PHYs need a minimum time after the reset gpio was asserted and/or
>> deasserted. To ensure we meet these timing requirements add two new
>> optional devicetree parameters for the phy: reset-delay-us and
>> reset-post-delay-us.
> 
> Thanks for your patch!
> 
>> This patch depends on the "phylib: Add device reset GPIO support" patch
>> submitted by Geert Uytterhoeven/Sergei Shtylyov, see:
>> https://patchwork.kernel.org/patch/10090149/
> 
> The above paragraph belongs under the "---" line below, as it is not intended
> to be preserved in the eternal git history.

Ok. Thanks. That makes sense. I'll take it into account for v4.

> 
>> Signed-off-by: Richard Leitner 
> 
> Reviewed-by: Geert Uytterhoeven 
> 
> Although I have a few suggestions below:

Thank you for your review and suggestions (they make the code look way
more neater). I'll adapt v4 accordingly.

> 
>> --- a/drivers/net/phy/mdio_device.c
>> +++ b/drivers/net/phy/mdio_device.c
>> @@ -118,8 +119,16 @@ EXPORT_SYMBOL(mdio_device_remove);
>>
>>  void mdio_device_reset(struct mdio_device *mdiodev, int value)
>>  {
>> -   if (mdiodev->reset)
>> -   gpiod_set_value(mdiodev->reset, value);
>> +   if (!mdiodev->reset)
>> +   return;
>> +
>> +   gpiod_set_value(mdiodev->reset, value);
>> +
>> +   if (value && mdiodev->reset_delay)
>> +   usleep_range(mdiodev->reset_delay, mdiodev->reset_delay + 
>> 100);
>> +   else if (!value && mdiodev->reset_post_delay)
>> +   usleep_range(mdiodev->reset_post_delay,
>> +mdiodev->reset_post_delay + 100);
> 
> I think this can be written simpler using e.g.:
> 
> unsigned int delay;
> 
> ...
> delay = value ? mdiodev->reset_delay : mdiodev->reset_post_delay;
> if (delay)
> usleep_range(delay, delay + 100);
> 
> Perhaps the range extension should be relative, e.g.
> "delay + min(delay / 10, 100)"?
> 
>> --- a/drivers/of/of_mdio.c
>> +++ b/drivers/of/of_mdio.c
>> @@ -77,6 +77,14 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
>> if (of_property_read_bool(child, "broken-turn-around"))
>> mdio->phy_ignore_ta_mask |= 1 << addr;
>>
>> +   if (of_property_read_u32(child, "reset-delay-us",
>> +&phy->mdio.reset_delay))
>> +   phy->mdio.reset_delay = 0;
>> +
>> +   if (of_property_read_u32(child, "reset-post-delay-us",
>> +&phy->mdio.reset_post_delay))
>> +   phy->mdio.reset_post_delay = 0;
> 
> If of_property_read_u32() fails, it doesn't write to its output parameter.
> As the structure should be zeroed during allocation, you can just write:
> 
> of_property_read_u32(child, "reset-delay-us", &phy->mdio.reset_delay);
> of_property_read_u32(child, "reset-post-delay-us",
>  &phy->mdio.reset_post_delay);


Re: [PATCH] ACPI / LPSS: Add device link for CHT SD card dependency on I2C

2017-12-05 Thread Rafael J. Wysocki
On Tue, Dec 5, 2017 at 3:25 PM, Adrian Hunter  wrote:
> On 04/12/17 17:00, Rafael J. Wysocki wrote:
>> On Monday, December 4, 2017 3:41:45 PM CET Adrian Hunter wrote:
>>> On 04/12/17 16:33, Hans de Goede wrote:
 Hi,

 On 04-12-17 15:30, Adrian Hunter wrote:
> On 04/12/17 15:48, Hans de Goede wrote:
>> Hi,
>>
>> Wouldn't it be easier to use the ACPI _DEP tracking for this, e.g.
>
> It is using _DEP, see acpi_lpss_dep()
>
>> add something like this to the the probe function:
>>
>>  struct acpi_device = ACPI_COMPANION(device);
>>
>>  if (acpi_device->dep_unmet)
>>  return -EPROBE_DEFER;
>>
>> No idea if this will work, but if it does work, using the deps described
>> in the ACPI tables seems like a better solution then hardcoding this.
>
> That would not work because there are other devices listed in the _DEP
> method so dep_unmet is always true.  So we are left checking _DEP but only
> for specific device dependencies.

 Ugh, understood thank you for explaining this. Perhaps it is a good idea
 to mention in the commit message why acpi_dev->dep_unmet cannot be used
 here?
>>>
>>> dep_unmet predates device links, but now we have device links, they are
>>> better anyway.
>>
>> Right (they cover PM too, for example), but it would be good to note why
>> it is necessary to hardcode the links information in the code.
>
> It isn't entirely necessary to hardcode the links information.  For example,
> another possibility is to create device links for all LPSS devices with _DEP
> methods that point to other LPSS devices i.e. match against
> acpi_lpss_device_ids.  The assumptions would be that all LPSS devices have
> drivers so it would be safe to create links between them, and that the
> nature of the dependency is correctly represented by a device link.
>
> An advantage of that approach would be that it might work for future
> dependencies between LPSS devices without having to add entries to a table.
> The disadvantage would be the possibility that creating a device link
> somehow turns out not to be the right thing to do.

OK

To me, hardcoding is fine for the time being, but I would just add the
above information as a comment to explain the choice made.

Thanks,
Rafael


Re: [PATCH v2 10/22] mmc: tmio: support IP-builtin card detection logic

2017-12-05 Thread Masahiro Yamada
2017-12-05 0:13 GMT+09:00 Wolfram Sang :
>> +static int tmio_mmc_get_cd(struct mmc_host *mmc)
>> +{
>> + struct tmio_mmc_host *host = mmc_priv(mmc);
>> + int ret;
>> +
>> + ret = mmc_gpio_get_cd(mmc);
>> + if (ret >= 0)
>> + return ret;
>> +
>> + return !!(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) &
>> + TMIO_STAT_SIGSTATE);
>> +}


I just followed tmio_mmc_get_ro() implementation.

If we do not care the symmetry between _get_ro() and _get_cd() hooks,
yes, your suggestion makes sense.



> I wonder if we shouldn't do something like:
>
> if (mmc_can_gpio_cd())
> return mmc_gpio_get_cd()
> else
> return !!(sd_ctrl_read16_and_16_as_32...)
>
> If we have a GPIO CD defined, I think we want the value of
> mmc_gpio_get_cd() in all cases. It makes clearer that this is an
> 'either-or' case and not a fallback mechanism.
>


Another possibility would select this in _probe().
We would need to evaluate mmc_can_gpio_cd() only once when probing.

I will follow your suggestion, though.
Either way is fine with me.



static int tmio_mmc_get_cd(struct mmc_host *mmc)
{
   struct tmio_mmc_host *host = mmc_priv(mmc);

   return !!(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) &
TMIO_STAT_SIGSTATE);
}

static const struct mmc_host_ops tmio_mmc_ops = {
  ...
  .get_cd  = tmio_mmc_get_cd,
  ...
};

int tmio_mmc_host_probe( ... )
{
  

  /* replace get_cd hook when we use GPIO for card detection */
  if (mmc_can_gpio_cd(mmc))
_host->ops.get_cd = mmc_gpio_get_cd;


}





-- 
Best Regards
Masahiro Yamada


[PATCH] arch, mm: introduce arch_tlb_gather_mmu_exit

2017-12-05 Thread Michal Hocko
From: Michal Hocko 

5a7862e83000 ("arm64: tlbflush: avoid flushing when fullmm == 1") has
introduced an optimization to not flush tlb when we are tearing the
whole address space down. Will goes on to explain

: Basically, we tag each address space with an ASID (PCID on x86) which
: is resident in the TLB. This means we can elide TLB invalidation when
: pulling down a full mm because we won't ever assign that ASID to
: another mm without doing TLB invalidation elsewhere (which actually
: just nukes the whole TLB).

This all is nice but tlb_gather users are not aware of that and this can
actually cause some real problems. E.g. the oom_reaper tries to reap the
whole address space but it might race with threads accessing the memory [1].
It is possible that soft-dirty handling might suffer from the same
problem [2] as soon as it starts supporting the feature.

Introduce an explicit exit variant tlb_gather_mmu_exit which allows the
behavior arm64 implements for the fullmm case and replace it by an
explicit exit flag in the mmu_gather structure. exit_mmap path is then
turned into the explicit exit variant. Other architectures simply ignore
the flag.

Changes since RFC
- remove address range from tlb_gather_mmu_exit as it will always
  operate on the full range - as per Will

[1] http://lkml.kernel.org/r/20171106033651.172368-1-wangn...@huawei.com
[2] http://lkml.kernel.org/r/20171110001933.GA12421@bbox
Signed-off-by: Michal Hocko 
---

Hi,
I have posted this as an RFC [1]. There was minor suggestion about the
API by Will which is integrated into this patch. No other fundamental
objections so I am asking for inclusion. I suspect that routing this via
Andrew's tree is the easiest.

[1] http://lkml.kernel.org/r/20171123090236.18574-1-mho...@kernel.org

 arch/arm/include/asm/tlb.h   |  3 ++-
 arch/arm64/include/asm/tlb.h |  2 +-
 arch/ia64/include/asm/tlb.h  |  3 ++-
 arch/s390/include/asm/tlb.h  |  3 ++-
 arch/sh/include/asm/tlb.h|  2 +-
 arch/um/include/asm/tlb.h|  2 +-
 include/asm-generic/tlb.h|  6 --
 include/linux/mm_types.h |  1 +
 mm/memory.c  | 16 ++--
 mm/mmap.c|  2 +-
 10 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index d5562f9ce600..f2696f831cae 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -149,7 +149,8 @@ static inline void tlb_flush_mmu(struct mmu_gather *tlb)
 
 static inline void
 arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
-   unsigned long start, unsigned long end)
+   unsigned long start, unsigned long end,
+   bool exit)
 {
tlb->mm = mm;
tlb->fullmm = !(start | (end+1));
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index ffdaea7954bb..812c12f5e634 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -43,7 +43,7 @@ static inline void tlb_flush(struct mmu_gather *tlb)
 * The ASID allocator will either invalidate the ASID or mark
 * it as used.
 */
-   if (tlb->fullmm)
+   if (tlb->fullmm && tlb->exit)
return;
 
/*
diff --git a/arch/ia64/include/asm/tlb.h b/arch/ia64/include/asm/tlb.h
index 44f0ac0df308..f3639447e26d 100644
--- a/arch/ia64/include/asm/tlb.h
+++ b/arch/ia64/include/asm/tlb.h
@@ -170,7 +170,8 @@ static inline void __tlb_alloc_page(struct mmu_gather *tlb)
 
 static inline void
 arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
-   unsigned long start, unsigned long end)
+   unsigned long start, unsigned long end,
+   bool exit)
 {
tlb->mm = mm;
tlb->max = ARRAY_SIZE(tlb->local);
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index 457b7ba0fbb6..c02207eb4278 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -50,7 +50,8 @@ extern void tlb_remove_table(struct mmu_gather *tlb, void 
*table);
 
 static inline void
 arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
-   unsigned long start, unsigned long end)
+   unsigned long start, unsigned long end,
+   bool exit)
 {
tlb->mm = mm;
tlb->start = start;
diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h
index 77abe192fb43..c4248c8b1e6b 100644
--- a/arch/sh/include/asm/tlb.h
+++ b/arch/sh/include/asm/tlb.h
@@ -38,7 +38,7 @@ static inline void init_tlb_gather(struct mmu_gather *tlb)
 
 static inline void
 arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
-   unsigned long start, unsigned long end)
+   unsigned long start, unsigned long end, bool exit)
 {
tlb->mm = mm;
tlb->start = start;
diff --git a/arch/um/include/asm/tlb.h b/arch/um/include/asm/tlb.h
index dce6db

RE: [PATCH] PM / runtime: Drop children check from __pm_runtime_set_status()

2017-12-05 Thread Alan Stern
On Tue, 5 Dec 2017, Yoshihiro Shimoda wrote:

> Hi,
> 
> > From: Ulf Hansson, Sent: Monday, December 4, 2017 7:41 PM
> > 
> > On 1 December 2017 at 12:03, Yoshihiro Shimoda
> >  wrote:
> 
> > > Sure! I tested your patch, and then the following message disappeared!
> > >
> > >Enabling runtime PM for inactive device (ee080200.usb-phy) with active 
> > > children
> > 
> > Great, that confirms my theory.
> > 
> > I will re-work the patch and re-post it to see what people thinks about it.
> 
> Thank you!
> 
> > >
> > > However, the following message still exists.
> > >
> > >Enabling runtime PM for inactive device (ee08.usb) with active 
> > > children
> > >
> > > So, I guess ohci-platform.c also has similar issue.
> > 
> > Yes, very likely!
> > 
> > However, I need some more time to look into this to be able to suggest
> > a solution.
> 
> I found a solution and sent a report as below:
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1551146.html
> 
> What do you think about using pm_runtime_forbid()?

In general, drivers should not use pm_runtime_forbid().

It is meant for use by userspace, through the /sys/.../power/control 
file.  Drivers cannot rely on the result of calling pm_runtime_forbid() 
or pm_runtime_allow(), because the user can change it at any time.

If you really want to prevent the OHCI controller from going into 
runtime suspend, the proper approach is to call pm_runtime_get() in the 
probe routine and pm_runtime_put() in the release routine.  However, 
this will waste energy because it will force the controller to remain 
at full power even when no active devices are attached.

In this case, there probably is a better to solution to your problem 
(such as fixing the runtime PM support in the phy driver).

Alan Stern



Re: GemniLake laptops goes power off directly after performing suspend

2017-12-05 Thread Rafael J. Wysocki
On Tue, Dec 5, 2017 at 11:32 AM, Chris Chiu  wrote:
> Hi,
> I have 2 GemniLake laptops from ASUS, named X441MB and X507MA,
> both go power off after I do "systemctl suspend" on top of kerne head
> fd6d2e506ce6 (Merge tag 'docs-4.15-fixes' of git://git.lwn.net/linux).
> I then wipe it out and install Windows RS3 instead, also goes to power
> off after pressing media key for suspend(S3). Then I installed intel
> graphic driver with the following version number, Windows has no
> problem on suspend resume then.

There is a suspend-related fix missing in 4.15-rc at this point, so
please test 4.14.y or wait for the fix to be merged.

Thanks,
Rafael


Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

2017-12-05 Thread Tony Krowiak

On 12/05/2017 09:04 AM, Cornelia Huck wrote:

On Tue, 5 Dec 2017 08:52:57 +0100
Harald Freudenberger  wrote:


On 12/02/2017 02:30 AM, Tony Krowiak wrote:

I agree with your suggestion that defining a new CPU model feature is probably
the best way to resolve this issue. The question is, should we define a single
feature indicating whether AP instructions are installed and set features bits
for the guest based on whether or not they are set in the linux host, or should
we define additional CPU model features for turning features bits on and off?
I guess it boils down to what behavior is expected for the AP bus running on
the linux guest. Here is a rundown of the facilities bits associated with AP
and how they affect the behavior of the AP bus:

* STFLE.12 indicates whether the AP query function is available. If this bit
   is not set, then the AP bus scan will only test domains 0-15. For example,
   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
   queues 04.0047, 05.0047 and 06.0047 will not be made available.

STFLE 12 is the indication for Query AP Configuration Information (QCI) 
available.

* STFLE.15 indicates whether the AP facilities test function is available. If
   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
   by the AP bus scan will not get bound to any AP device drivers. Since the
   AP matrix model supports only CEX4 and greater, no devices will be bound
   to any driver for a guest.

This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
supports CEX4 and upper then this bit could also act as the indicator for
AP instructions available. Of course if you want to implement pure virtual
full simulated AP without any real AP hardware on the host this bit can't
be the indicator.

It would probably make sense to group these two together. Or is there
any advantage in supporting only a part of it?

After thinking about this a little more, I've come to the conclusion that
all of this might be moot for the following reasons:

* If STFLE.12 is not set for the linux host, then AP bus scan running on
  the host will not detect any domains with a domain number higher than 15,
  so no AP queues with a queue index higher than 15 will be available to
  bind to the vfio_ap_matrix driver. Consequently, no domain higher than
  15 can be assigned to any guest. In this case, the AP bus scan 
running on

  the guest will never detect a domain higher than 15, regardless of the
  setting of STFLE.12 for the guest.

* If STFLE.15 is not set for the linux host, then then there will be no
  CEX4, CEX5 or CEX6 queues available to bind to the vfio_ap_matrix
  driver, so no AP adapters or domains can be assigned to any KVM guest.

The bottom line is the STFLE bit settings for the linux host will control
what APs are available to the KVM guest. Since STFLE.15 controls whether
any CEX4,5 or 6 devices are even available, I think this bit can be
combined into the feature that indicates whether AP is available. As long
as AP instructions are available on the linux host, I'm not sure whether
STFLE.12 needs a feature at all.



* STFLE.65 indicates whether AP interrupts are available. If this bit is not
   set, then the AP bus will use polling instead of using interrupt handlers
   to process AP events.

So, does this indicate "adapter interrupts for AP" only? If so, we
should keep this separate and only enable it when we have the gisa etc.
ready.

Yes, this indicates AP interrupts only. The plan is to enable this when
GISA is available and we can implement interrupt processing.






[PATCH] mfd: stm32: Adopt SPDX identifier

2017-12-05 Thread Benjamin Gaignard
Add SPDX identifier

Signed-off-by: Benjamin Gaignard 
---
 drivers/mfd/stm32-lptimer.c   | 2 +-
 drivers/mfd/stm32-timers.c| 2 +-
 include/linux/mfd/stm32-lptimer.h | 2 +-
 include/linux/mfd/stm32-timers.h  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/stm32-lptimer.c b/drivers/mfd/stm32-lptimer.c
index 075330a25f61..2606e340c9f7 100644
--- a/drivers/mfd/stm32-lptimer.c
+++ b/drivers/mfd/stm32-lptimer.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * STM32 Low-Power Timer parent driver.
  *
@@ -7,7 +8,6 @@
  *
  * Inspired by Benjamin Gaignard's stm32-timers driver
  *
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #include 
diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
index a6675a449409..250c4c4411cd 100644
--- a/drivers/mfd/stm32-timers.c
+++ b/drivers/mfd/stm32-timers.c
@@ -1,9 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) STMicroelectronics 2016
  *
  * Author: Benjamin Gaignard 
  *
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #include 
diff --git a/include/linux/mfd/stm32-lptimer.h 
b/include/linux/mfd/stm32-lptimer.h
index 77c7cf40d9b4..e5a2cc8aea56 100644
--- a/include/linux/mfd/stm32-lptimer.h
+++ b/include/linux/mfd/stm32-lptimer.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * STM32 Low-Power Timer parent driver.
  *
@@ -7,7 +8,6 @@
  *
  * Inspired by Benjamin Gaignard's stm32-timers driver
  *
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #ifndef _LINUX_STM32_LPTIMER_H_
diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h
index ce7346e7f77a..13ffe2696e4b 100644
--- a/include/linux/mfd/stm32-timers.h
+++ b/include/linux/mfd/stm32-timers.h
@@ -1,9 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) STMicroelectronics 2016
  *
  * Author: Benjamin Gaignard 
  *
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #ifndef _LINUX_STM32_GPTIMER_H_
-- 
2.15.0



[PATCH] pwn: stm32: Adopt SPDX identifier

2017-12-05 Thread Benjamin Gaignard
Add SPDX identifer

Signed-off-by: Benjamin Gaignard 
---
 drivers/pwm/pwm-stm32-lp.c | 3 +--
 drivers/pwm/pwm-stm32.c| 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c
index 1ac9e4384142..cbd271e80c3c 100644
--- a/drivers/pwm/pwm-stm32-lp.c
+++ b/drivers/pwm/pwm-stm32-lp.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * STM32 Low-Power Timer PWM driver
  *
@@ -5,8 +6,6 @@
  *
  * Author: Gerald Baeza 
  *
- * License terms: GNU General Public License (GPL), version 2
- *
  * Inspired by Gerald Baeza's pwm-stm32 driver
  */
 
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 6139512aab7b..be56d7af89c9 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) STMicroelectronics 2016
  *
  * Author: Gerald Baeza 
  *
- * License terms: GNU General Public License (GPL), version 2
- *
  * Inspired by timer-stm32.c from Maxime Coquelin
  * pwm-atmel.c from Bo Shen
  */
-- 
2.15.0



[PATCH] iio: stm32: Adopt SPDX identifier

2017-12-05 Thread Benjamin Gaignard
Add SPDX identifier in stm32's files in IIO directory

Signed-off-by: Benjamin Gaignard 
---
 drivers/iio/adc/stm32-adc-core.c| 14 +-
 drivers/iio/adc/stm32-adc-core.h| 14 +-
 drivers/iio/adc/stm32-adc.c | 15 +--
 drivers/iio/counter/stm32-lptimer-cnt.c |  2 +-
 drivers/iio/dac/stm32-dac-core.c| 14 +-
 drivers/iio/dac/stm32-dac-core.h| 15 +--
 drivers/iio/dac/stm32-dac.c | 15 +--
 drivers/iio/trigger/stm32-lptimer-trigger.c |  3 +--
 drivers/iio/trigger/stm32-timer-trigger.c   |  2 +-
 9 files changed, 9 insertions(+), 85 deletions(-)

diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
index 6aefef99f935..40be7d9fadbf 100644
--- a/drivers/iio/adc/stm32-adc-core.c
+++ b/drivers/iio/adc/stm32-adc-core.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This file is part of STM32 ADC driver
  *
@@ -6,19 +7,6 @@
  *
  * Inspired from: fsl-imx25-tsadc
  *
- * License type: GPLv2
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
  */
 
 #include 
diff --git a/drivers/iio/adc/stm32-adc-core.h b/drivers/iio/adc/stm32-adc-core.h
index 250ee958a669..8af507b3f32d 100644
--- a/drivers/iio/adc/stm32-adc-core.h
+++ b/drivers/iio/adc/stm32-adc-core.h
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * This file is part of STM32 ADC driver
  *
  * Copyright (C) 2016, STMicroelectronics - All Rights Reserved
  * Author: Fabrice Gasnier .
  *
- * License type: GPLv2
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
  */
 
 #ifndef __STM32_ADC_H
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index c9d96f935dba..f9ccd705bcbb 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This file is part of STM32 ADC driver
  *
  * Copyright (C) 2016, STMicroelectronics - All Rights Reserved
  * Author: Fabrice Gasnier .
- *
- * License type: GPLv2
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
  */
 
 #include 
diff --git a/drivers/iio/counter/stm32-lptimer-cnt.c 
b/drivers/iio/counter/stm32-lptimer-cnt.c
index 81ae5f74216d..42fb8ba67090 100644
--- a/drivers/iio/counter/stm32-lptimer-cnt.c
+++ b/drivers/iio/counter/stm32-lptimer-cnt.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * STM32 Low-Power Timer Encoder and Counter driver
  *
@@ -7,7 +8,6 @@
  *
  * Inspired by 104-quad-8 and stm32-timer-trigger drivers.
  *
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #include 
diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
index 55026fe1c610..d0fb3124de07 100644
--- a/drivers/iio/dac/stm32-dac-core.c
+++ b/drivers/iio/dac/stm32-dac-core.c
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This file is part of STM32 DAC driver
  *
  * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
  * Author: Fabrice Gasnier .
  *
- * License type: GPLv2
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; 

Re: [Kgdb-bugreport] [PATCH] MAINTAINERS: kgdb: Replace Jason with Daniel

2017-12-05 Thread Daniel Thompson

On 05/12/17 14:37, Jason Wessel wrote:

On 12/05/2017 08:09 AM, Lee Jones wrote:

On Tue, 05 Dec 2017, Daniel Thompson wrote:


... with many, many thanks for Jason for all his hard work.

Cc: Jason Wessel 
Signed-off-by: Daniel Thompson 
---

Notes:
 Over the years Jason has become increasingly hard to get hold off
 and I think he must now be regarded as inactive.
 Patches in kgdb-next (mine as it happens) have been there for 
over a
 year without a corresponding pull request and a couple of 
architecture
 specific kgdb fixes have ended up missing a release cycle (or 
two) as

 the architecture maintainer waits for an Acked-by from Jason.
 In the past I've had to rely on Andrew M. to land my own changes to
 kgdb and in the v4.14 cycle you'll find my Acked-by on b8347c219649
 ("x86/debug: Handle warnings before the notifier chain, to fix KGDB
 crash"). That I was sharing surrogate acks convinced me we need a
 change here and I've offered Jason help via private e-mail without
 reply.
 So, I really would prefer it it if this patch listed me as a
 co-maintainer or, failing that, as least had Jason's blessing... 
but

 it doesn't. I certainly suggest this patch takes a long time in
 review, and if it doesn't attract Jason's attention then I can only
 reiterate what is says in the commit log: Thanks Jason!

  MAINTAINERS | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)


It looks like Jason has been inactive in all aspects of upstream
maintainership and as a contributor for well over a year now.


I have not been working directly on upstream kernel contributions for 
quite some time.  It doesn't mean I haven't been involved with kernel 
development.  Patches that I have reviewed or suggested to other 
developers generally don't bare my name.  I wouldn't mind trying to take 
a slightly more gradual passing of the baton and add Daniel as 
co-maintainer for a while before I retire from kernel work and merge 
myself away in the coming years. :-)


Great to hear from you again! I shall consider this patch nacked or the 
time being ;-)... and if you are happy with help from me I shall leave 
it to you to propose an update to MAINTAINERS.



I have a series of 50+ patches for kgdb/kdb/usb which have never been 
published.  I am not saying that we actually need any of those patches, 
but it would be nice to let the community decide, and we can see if 
there is anything worth merging into the next cycle or future work with 
other maintainers.   My kernel.org tree stopped working a long time ago, 
probably from inactivity.  I'll see if that can get restored in the next 
few days, or I'll use my github tree and send the unpublished work to 
the mailing list as an RFC.


I, for one, would be interested to see these.


Daniel.


[PATCH] media: platform: sti: Adopt SPDX identifier

2017-12-05 Thread Benjamin Gaignard
Add SPDX identifiers to files under sti directory

Signed-off-by: Benjamin Gaignard 
---
 drivers/media/platform/sti/bdisp/bdisp-debug.c   |  2 +-
 drivers/media/platform/sti/bdisp/bdisp-filter.h  |  2 +-
 drivers/media/platform/sti/bdisp/bdisp-hw.c  |  2 +-
 drivers/media/platform/sti/bdisp/bdisp-reg.h |  2 +-
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c|  2 +-
 drivers/media/platform/sti/bdisp/bdisp.h |  2 +-
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c  |  5 +
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.h  |  5 +
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c|  5 +
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.h|  5 +
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.c |  9 +
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.h |  9 +
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c | 11 +--
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.h |  5 +
 drivers/media/platform/sti/cec/stih-cec.c|  5 +
 drivers/media/platform/sti/delta/delta-cfg.h |  2 +-
 drivers/media/platform/sti/delta/delta-debug.c   |  2 +-
 drivers/media/platform/sti/delta/delta-debug.h   |  2 +-
 drivers/media/platform/sti/delta/delta-ipc.c |  2 +-
 drivers/media/platform/sti/delta/delta-ipc.h |  2 +-
 drivers/media/platform/sti/delta/delta-mem.c |  2 +-
 drivers/media/platform/sti/delta/delta-mem.h |  2 +-
 drivers/media/platform/sti/delta/delta-mjpeg-dec.c   |  2 +-
 drivers/media/platform/sti/delta/delta-mjpeg-fw.h|  2 +-
 drivers/media/platform/sti/delta/delta-mjpeg-hdr.c   |  2 +-
 drivers/media/platform/sti/delta/delta-mjpeg.h   |  2 +-
 drivers/media/platform/sti/delta/delta-v4l2.c|  2 +-
 drivers/media/platform/sti/delta/delta.h |  2 +-
 drivers/media/platform/sti/hva/hva-debugfs.c |  2 +-
 drivers/media/platform/sti/hva/hva-h264.c|  2 +-
 drivers/media/platform/sti/hva/hva-hw.c  |  2 +-
 drivers/media/platform/sti/hva/hva-hw.h  |  2 +-
 drivers/media/platform/sti/hva/hva-mem.c |  2 +-
 drivers/media/platform/sti/hva/hva-mem.h |  2 +-
 drivers/media/platform/sti/hva/hva-v4l2.c|  2 +-
 drivers/media/platform/sti/hva/hva.h |  2 +-
 36 files changed, 36 insertions(+), 77 deletions(-)

diff --git a/drivers/media/platform/sti/bdisp/bdisp-debug.c 
b/drivers/media/platform/sti/bdisp/bdisp-debug.c
index 2cc289e4dea1..c6a4e2de5c0c 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-debug.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-debug.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) STMicroelectronics SA 2014
  * Authors: Fabien Dessenne  for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #include 
diff --git a/drivers/media/platform/sti/bdisp/bdisp-filter.h 
b/drivers/media/platform/sti/bdisp/bdisp-filter.h
index 53e52fb4127f..d25adb57e3d0 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-filter.h
+++ b/drivers/media/platform/sti/bdisp/bdisp-filter.h
@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) STMicroelectronics SA 2014
  * Authors: Fabien Dessenne  for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #define BDISP_HF_NB 64
diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c 
b/drivers/media/platform/sti/bdisp/bdisp-hw.c
index b7892f3efd98..e7836b307d21 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) STMicroelectronics SA 2014
  * Authors: Fabien Dessenne  for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 #include 
diff --git a/drivers/media/platform/sti/bdisp/bdisp-reg.h 
b/drivers/media/platform/sti/bdisp/bdisp-reg.h
index e7e1a425f65a..b07ecc903707 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-reg.h
+++ b/drivers/media/platform/sti/bdisp/bdisp-reg.h
@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) STMicroelectronics SA 2014
  * Authors: Fabien Dessenne  for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
  */
 
 struct bdisp_node {
diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c 
b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
index 7e9ed9c7b3e1..bf4ca16db440 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) STMicroelectronics SA 2014
  * Authors: Fabien Dessenne  for STMicroelectronics.
- * License terms:  GNU Genera

Re: [PATCH v5 00/11] add pinmuxing support for pins in AXP209 and AXP813 PMICs

2017-12-05 Thread Quentin Schulz
Hi all,

Copy pasting of the cover letter done wrong, there are only 9 patches in
this patch series unlike what's specified in the title of the cover
letter for this patch series.

Sorry for the noise.

Quentin

On 05/12/2017 15:46, Quentin Schulz wrote:
> The AXP209 and AXP813 PMICs have several pins (respectively 3 and 2) that can
> be used either as GPIOs or for other purposes (ADC or LDO here).
> 
> We already have a GPIO driver for the GPIO use of those pins on the AXP209.
> Let's "upgrade" this driver to support all the functions these pins can have.
> 
> Then we add support to this driver for the AXP813 which is slighlty different
> (basically a different offset in two registers and one less pin).
> 
> I suggest patches 1 to 8 go through Linus's tree and 9 via Lee's.
> 
> v5:
>   - add reference to pinctrl dt-bindings in driver's dt-binding,
>   - add statement that this driver employs per-pin muxing pattern,
>   - add a patch on top of the patch series to fix checkpatch warnings,
>   - add a few information to the Kconfig to make checkpatch happy,
> 
> v4:
>   - separate dt-binding patch when adding pinctrl feature,
>   - use - instead of _ in DT node name,
>   - remove muxing operation from pinctrl driver when choosing LDO mux in order
>   to not interfere with the regulator framework,
>   - add adc_mux to specify specific mux value for ADC (different between 
> AXP209
>   and AXP813),
>   - misc modifications (header include reordering, unsigned int -> u8,
>   new line removal),
> 
> v3:
>   - add defines for GPIO funcs,
>   - use again get_regs function instead of drv_data (which was implemented in
>   v2),
>   - use of_device_id data for device specific data (gpio_status_offset and 
> pins
>   description),
>   - change compatible from axp813-pctl to axp813-gpio,
>   - use axp81x DT label instead of axp813 since AXP813 and AXP818 are similar,
>   - add dtsi include for all boards embedding axp813/axp818,
> 
> v2:
>   - add support for AXP813 pins,
>   - split into more patches so it is easier to follow the modifications,
>   - reorder of some patches,
>   - register all pins within the same range instead of a range per pin,
> 
> Thanks,
> Quentin
> 
> Quentin Schulz (9):
>   gpio: axp209: switch unsigned variables to unsigned int
>   pinctrl: move gpio-axp209 to pinctrl
>   pinctrl: axp209: add pinctrl features
>   dt-bindings: gpio: gpio-axp209: add pinctrl features
>   pinctrl: axp209: rename everything from gpio to pctl
>   pinctrl: axp209: add programmable gpio_status_offset
>   pinctrl: axp209: add programmable ADC muxing value
>   pinctrl: axp209: add support for AXP813 GPIOs
>   mfd: axp20x: add pinctrl cell for AXP813
> 
>  .../devicetree/bindings/gpio/gpio-axp209.txt   |  49 ++-
>  drivers/gpio/Kconfig   |   6 -
>  drivers/gpio/Makefile  |   1 -
>  drivers/gpio/gpio-axp209.c | 188 
>  drivers/mfd/axp20x.c   |   3 +
>  drivers/pinctrl/Kconfig|  10 +
>  drivers/pinctrl/Makefile   |   1 +
>  drivers/pinctrl/pinctrl-axp209.c   | 476 
> +
>  8 files changed, 537 insertions(+), 197 deletions(-)
>  delete mode 100644 drivers/gpio/gpio-axp209.c
>  create mode 100644 drivers/pinctrl/pinctrl-axp209.c
> 

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


[PATCH] media: platform: stm32: Adopt SPDX identifier

2017-12-05 Thread Benjamin Gaignard
Add SPDX identifiers to files under stm32 directory

Signed-off-by: Benjamin Gaignard 
---
 drivers/media/platform/stm32/stm32-cec.c  | 5 +
 drivers/media/platform/stm32/stm32-dcmi.c | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-cec.c 
b/drivers/media/platform/stm32/stm32-cec.c
index 0e5aa17bdd40..7c496bc1cf38 100644
--- a/drivers/media/platform/stm32/stm32-cec.c
+++ b/drivers/media/platform/stm32/stm32-cec.c
@@ -1,11 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * STM32 CEC driver
  * Copyright (C) STMicroelectronics SA 2017
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 
 #include 
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c 
b/drivers/media/platform/stm32/stm32-dcmi.c
index ac4c450a6c7d..519952bec6d5 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Driver for STM32 Digital Camera Memory Interface
  *
@@ -5,7 +6,6 @@
  * Authors: Yannick Fertre 
  *  Hugues Fruchet 
  *  for STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
  *
  * This driver is based on atmel_isi.c
  *
-- 
2.15.0



[PATCH v5 3/9] pinctrl: axp209: add pinctrl features

2017-12-05 Thread Quentin Schulz
The X-Powers AXP209 has 3 GPIOs. GPIO0/1 can each act either as a GPIO,
an ADC or a LDO regulator. GPIO2 can only act as a GPIO.

This adds the pinctrl features to the driver so GPIO0/1 can be used as
ADC or LDO regulator.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
---
 drivers/pinctrl/pinctrl-axp209.c | 304 ---
 1 file changed, 284 insertions(+), 20 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 6ee7dc1418fa..48cb57dcc575 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -1,7 +1,8 @@
 /*
- * AXP20x GPIO driver
+ * AXP20x pinctrl and GPIO driver
  *
  * Copyright (C) 2016 Maxime Ripard 
+ * Copyright (C) 2017 Quentin Schulz 
  *
  * This program is free software; you can redistribute it and/or modify it
  * under  the terms of the GNU General  Public License as published by the
@@ -18,6 +19,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -27,9 +31,52 @@
 #define AXP20X_GPIO_FUNCTION_OUT_HIGH  1
 #define AXP20X_GPIO_FUNCTION_INPUT 2
 
+#define AXP20X_FUNC_GPIO_OUT   0
+#define AXP20X_FUNC_GPIO_IN1
+#define AXP20X_FUNC_LDO2
+#define AXP20X_FUNC_ADC3
+#define AXP20X_FUNCS_NB4
+
+#define AXP20X_MUX_GPIO_OUT0
+#define AXP20X_MUX_GPIO_IN BIT(1)
+#define AXP20X_MUX_ADC BIT(2)
+
+struct axp20x_pctrl_desc {
+   const struct pinctrl_pin_desc   *pins;
+   unsigned intnpins;
+   /* Stores the pins supporting LDO function. Bit offset is pin number. */
+   u8  ldo_mask;
+   /* Stores the pins supporting ADC function. Bit offset is pin number. */
+   u8  adc_mask;
+};
+
+struct axp20x_pinctrl_function {
+   const char  *name;
+   unsigned intmuxval;
+   const char  **groups;
+   unsigned intngroups;
+};
+
 struct axp20x_gpio {
struct gpio_chipchip;
struct regmap   *regmap;
+   struct pinctrl_dev  *pctl_dev;
+   struct device   *dev;
+   const struct axp20x_pctrl_desc  *desc;
+   struct axp20x_pinctrl_function  funcs[AXP20X_FUNCS_NB];
+};
+
+static const struct pinctrl_pin_desc axp209_pins[] = {
+   PINCTRL_PIN(0, "GPIO0"),
+   PINCTRL_PIN(1, "GPIO1"),
+   PINCTRL_PIN(2, "GPIO2"),
+};
+
+static const struct axp20x_pctrl_desc axp20x_data = {
+   .pins   = axp209_pins,
+   .npins  = ARRAY_SIZE(axp209_pins),
+   .ldo_mask = BIT(0) | BIT(1),
+   .adc_mask = BIT(0) | BIT(1),
 };
 
 static int axp20x_gpio_get_reg(unsigned int offset)
@@ -48,16 +95,7 @@ static int axp20x_gpio_get_reg(unsigned int offset)
 
 static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset)
 {
-   struct axp20x_gpio *gpio = gpiochip_get_data(chip);
-   int reg;
-
-   reg = axp20x_gpio_get_reg(offset);
-   if (reg < 0)
-   return reg;
-
-   return regmap_update_bits(gpio->regmap, reg,
- AXP20X_GPIO_FUNCTIONS,
- AXP20X_GPIO_FUNCTION_INPUT);
+   return pinctrl_gpio_direction_input(chip->base + offset);
 }
 
 static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset)
@@ -105,30 +143,221 @@ static int axp20x_gpio_get_direction(struct gpio_chip 
*chip,
 
 static int axp20x_gpio_output(struct gpio_chip *chip, unsigned int offset,
  int value)
+{
+   chip->set(chip, offset, value);
+
+   return 0;
+}
+
+static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset,
+   int value)
 {
struct axp20x_gpio *gpio = gpiochip_get_data(chip);
int reg;
 
+   reg = axp20x_gpio_get_reg(offset);
+   if (reg < 0)
+   return;
+
+   regmap_update_bits(gpio->regmap, reg,
+  AXP20X_GPIO_FUNCTIONS,
+  value ? AXP20X_GPIO_FUNCTION_OUT_HIGH :
+  AXP20X_GPIO_FUNCTION_OUT_LOW);
+}
+
+static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset,
+ u8 config)
+{
+   struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+   int reg;
+
reg = axp20x_gpio_get_reg(offset);
if (reg < 0)
return reg;
 
-   return regmap_update_bits(gpio->regmap, reg,
- AXP20X_GPIO_FUNCTIONS,
- value ? AXP20X_GPIO_FUNCTION_OUT_HIGH
- : AXP20X_GPIO_FUNCTION_OUT_LOW);
+   return regmap_update_bits(gpio->regmap, reg, AXP20X_GPIO_FUNCTIONS,
+ config);
 }
 
-static void axp20x_gpio_set(struct gpio_chip 

[PATCH v5 4/9] dt-bindings: gpio: gpio-axp209: add pinctrl features

2017-12-05 Thread Quentin Schulz
The X-Powers AXP209 has 3 GPIOs. GPIO0/1 can each act either as a GPIO,
an ADC or a LDO regulator. GPIO2 can only act as a GPIO.

This adds the pinctrl features to the driver so GPIO0/1 can be used as
ADC or LDO regulator.

Signed-off-by: Quentin Schulz 
Acked-by: Rob Herring 
Acked-by: Maxime Ripard 
---
 .../devicetree/bindings/gpio/gpio-axp209.txt   | 36 +-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt 
b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
index a6611304dd3c..0d77597c3f92 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
@@ -1,8 +1,13 @@
-AXP209 GPIO controller
+AXP209 GPIO & pinctrl controller
 
 This driver follows the usual GPIO bindings found in
 Documentation/devicetree/bindings/gpio/gpio.txt
 
+This driver follows the usual pinctrl bindings found in
+Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+
+This driver employs the per-pin muxing pattern.
+
 Required properties:
 - compatible: Should be "x-powers,axp209-gpio"
 - #gpio-cells: Should be two. The first cell is the pin number and the
@@ -28,3 +33,32 @@ axp209: pmic@34 {
#gpio-cells = <2>;
};
 };
+
+The GPIOs can be muxed to other functions and therefore, must be a subnode of
+axp_gpio.
+
+Example:
+
+&axp_gpio {
+   gpio0_adc: gpio0-adc {
+   pins = "GPIO0";
+   function = "adc";
+   };
+};
+
+&example_node {
+   pinctrl-names = "default";
+   pinctrl-0 = <&gpio0_adc>;
+};
+
+GPIOs and their functions
+-
+
+Each GPIO is independent from the other (i.e. GPIO0 in gpio_in function does
+not force GPIO1 and GPIO2 to be in gpio_in function as well).
+
+GPIO   |   Functions
+
+GPIO0  |   gpio_in, gpio_out, ldo, adc
+GPIO1  |   gpio_in, gpio_out, ldo, adc
+GPIO2  |   gpio_in, gpio_out
-- 
2.14.1



[PATCH v5 7/9] pinctrl: axp209: add programmable ADC muxing value

2017-12-05 Thread Quentin Schulz
To prepare for patches that will add support for a new PMIC that has a
different GPIO adc muxing value, add an adc_mux within axp20x_pctl
structure and use it.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
---
 drivers/pinctrl/pinctrl-axp209.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index db8e319b6e11..9bb8722ba90f 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -49,6 +49,7 @@ struct axp20x_pctrl_desc {
/* Stores the pins supporting ADC function. Bit offset is pin number. */
u8  adc_mask;
u8  gpio_status_offset;
+   u8  adc_mux;
 };
 
 struct axp20x_pinctrl_function {
@@ -79,6 +80,7 @@ static const struct axp20x_pctrl_desc axp20x_data = {
.ldo_mask = BIT(0) | BIT(1),
.adc_mask = BIT(0) | BIT(1),
.gpio_status_offset = 4,
+   .adc_mux = AXP20X_MUX_ADC,
 };
 
 static int axp20x_gpio_get_reg(unsigned int offset)
@@ -334,7 +336,7 @@ static void axp20x_build_funcs_groups(struct 
platform_device *pdev)
 * See comment in axp20x_pmx_set_mux.
 */
pctl->funcs[AXP20X_FUNC_ADC].name = "adc";
-   pctl->funcs[AXP20X_FUNC_ADC].muxval = AXP20X_MUX_ADC;
+   pctl->funcs[AXP20X_FUNC_ADC].muxval = pctl->desc->adc_mux;
 
/* Every pin supports GPIO_OUT and GPIO_IN functions */
for (i = 0; i <= AXP20X_FUNC_GPIO_IN; i++) {
-- 
2.14.1



[PATCH v5 9/9] mfd: axp20x: add pinctrl cell for AXP813

2017-12-05 Thread Quentin Schulz
As GPIO/pinctrl driver now supports AXP813, add a cell for it.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
Acked-by: Linus Walleij 
Acked-for-MFD-by: Lee Jones 
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 2468b431bb22..d8c92fbbd170 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -878,6 +878,9 @@ static struct mfd_cell axp813_cells[] = {
.resources  = axp803_pek_resources,
}, {
.name   = "axp20x-regulator",
+   }, {
+   .name   = "axp20x-gpio",
+   .of_compatible  = "x-powers,axp813-gpio",
}
 };
 
-- 
2.14.1



Re: [PATCH] list_lru: Prefetch neighboring list entries before acquiring lock

2017-12-05 Thread Michal Hocko
On Wed 29-11-17 09:17:34, Waiman Long wrote:
> The list_lru_del() function removes the given item from the LRU list.
> The operation looks simple, but it involves writing into the cachelines
> of the two neighboring list entries in order to get the deletion done.
> That can take a while if the cachelines aren't there yet, thus
> prolonging the lock hold time.
> 
> To reduce the lock hold time, the cachelines of the two neighboring
> list entries are now prefetched before acquiring the list_lru_node's
> lock.
> 
> Using a multi-threaded test program that created a large number
> of dentries and then killed them, the execution time was reduced
> from 38.5s to 36.6s after applying the patch on a 2-socket 36-core
> 72-thread x86-64 system.
> 
> Signed-off-by: Waiman Long 

The patch still seems to be in the mmotm tree while it breaks
compilation. At least m32r defconfig complains with
mm/list_lru.c: In function 'list_lru_del':
mm/list_lru.c:141:2: error: implicit declaration of function 'prefetchw' 
[-Werror=implicit-function-declaration]
  prefetchw(item->prev);

It also seems that there is no general agreement in the patch. Andrew,
do you plan to keep it?
-- 
Michal Hocko
SUSE Labs


[PATCH v5 00/11] add pinmuxing support for pins in AXP209 and AXP813 PMICs

2017-12-05 Thread Quentin Schulz
The AXP209 and AXP813 PMICs have several pins (respectively 3 and 2) that can
be used either as GPIOs or for other purposes (ADC or LDO here).

We already have a GPIO driver for the GPIO use of those pins on the AXP209.
Let's "upgrade" this driver to support all the functions these pins can have.

Then we add support to this driver for the AXP813 which is slighlty different
(basically a different offset in two registers and one less pin).

I suggest patches 1 to 8 go through Linus's tree and 9 via Lee's.

v5:
  - add reference to pinctrl dt-bindings in driver's dt-binding,
  - add statement that this driver employs per-pin muxing pattern,
  - add a patch on top of the patch series to fix checkpatch warnings,
  - add a few information to the Kconfig to make checkpatch happy,

v4:
  - separate dt-binding patch when adding pinctrl feature,
  - use - instead of _ in DT node name,
  - remove muxing operation from pinctrl driver when choosing LDO mux in order
  to not interfere with the regulator framework,
  - add adc_mux to specify specific mux value for ADC (different between AXP209
  and AXP813),
  - misc modifications (header include reordering, unsigned int -> u8,
  new line removal),

v3:
  - add defines for GPIO funcs,
  - use again get_regs function instead of drv_data (which was implemented in
  v2),
  - use of_device_id data for device specific data (gpio_status_offset and pins
  description),
  - change compatible from axp813-pctl to axp813-gpio,
  - use axp81x DT label instead of axp813 since AXP813 and AXP818 are similar,
  - add dtsi include for all boards embedding axp813/axp818,

v2:
  - add support for AXP813 pins,
  - split into more patches so it is easier to follow the modifications,
  - reorder of some patches,
  - register all pins within the same range instead of a range per pin,

Thanks,
Quentin

Quentin Schulz (9):
  gpio: axp209: switch unsigned variables to unsigned int
  pinctrl: move gpio-axp209 to pinctrl
  pinctrl: axp209: add pinctrl features
  dt-bindings: gpio: gpio-axp209: add pinctrl features
  pinctrl: axp209: rename everything from gpio to pctl
  pinctrl: axp209: add programmable gpio_status_offset
  pinctrl: axp209: add programmable ADC muxing value
  pinctrl: axp209: add support for AXP813 GPIOs
  mfd: axp20x: add pinctrl cell for AXP813

 .../devicetree/bindings/gpio/gpio-axp209.txt   |  49 ++-
 drivers/gpio/Kconfig   |   6 -
 drivers/gpio/Makefile  |   1 -
 drivers/gpio/gpio-axp209.c | 188 
 drivers/mfd/axp20x.c   |   3 +
 drivers/pinctrl/Kconfig|  10 +
 drivers/pinctrl/Makefile   |   1 +
 drivers/pinctrl/pinctrl-axp209.c   | 476 +
 8 files changed, 537 insertions(+), 197 deletions(-)
 delete mode 100644 drivers/gpio/gpio-axp209.c
 create mode 100644 drivers/pinctrl/pinctrl-axp209.c

-- 
2.14.1



Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-05 Thread Namhyung Kim
Hi Arnaldo,

On Tue, Dec 05, 2017 at 10:37:40AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Dec 05, 2017 at 05:11:56PM +0900, Namhyung Kim escreveu:
> > Also I'm not sure that the allocation failure check would work
> > correctly since it decrements nr_callchain_events when it fails.
> 
> Can you elaborate a bit more?

Sure, I mean the following code:

mutex_lock(&callchain_mutex);

count = atomic_inc_return(&nr_callchain_events);
if (WARN_ON_ONCE(count < 1)) {
err = -EINVAL;
goto exit;
}

if (count > 1) {
/* If the allocation failed, give up */
if (!callchain_cpus_entries)
err = -ENOMEM;

goto exit;
}

err = alloc_callchain_buffers();
exit:
if (err)
atomic_dec(&nr_callchain_events);

mutex_unlock(&callchain_mutex);


The callchain_cpus_entries is allocated in alloc_callchain_buffers()
only when the count is 1.  But if it failed to allocate, it decrease
the count so next event would try to allocate it again.  Thus it seems
not possible to see the callchain_cpus_entries being NULL in the
'if (count > 1)' block.  If you want to make next event give up, it'd
need to take an additional count IMHO.

Thanks,
Namhyung


[PATCH v5 8/9] pinctrl: axp209: add support for AXP813 GPIOs

2017-12-05 Thread Quentin Schulz
The AXP813 has only two GPIOs. GPIO0 can either be used as a GPIO, an
LDO regulator or an ADC. GPIO1 can be used either as a GPIO or an LDO
regulator.

Moreover, the status bit of the GPIOs when in input mode is not offset
by 4 unlike the AXP209.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/gpio/gpio-axp209.txt   | 13 +++-
 drivers/pinctrl/pinctrl-axp209.c   | 35 +-
 2 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt 
b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
index 0d77597c3f92..fc42b2caa06d 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
@@ -9,7 +9,9 @@ Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
 This driver employs the per-pin muxing pattern.
 
 Required properties:
-- compatible: Should be "x-powers,axp209-gpio"
+- compatible: Should be one of:
+   - "x-powers,axp209-gpio"
+   - "x-powers,axp813-gpio"
 - #gpio-cells: Should be two. The first cell is the pin number and the
   second is the GPIO flags.
 - gpio-controller: Marks the device node as a GPIO controller.
@@ -57,8 +59,17 @@ GPIOs and their functions
 Each GPIO is independent from the other (i.e. GPIO0 in gpio_in function does
 not force GPIO1 and GPIO2 to be in gpio_in function as well).
 
+axp209
+--
 GPIO   |   Functions
 
 GPIO0  |   gpio_in, gpio_out, ldo, adc
 GPIO1  |   gpio_in, gpio_out, ldo, adc
 GPIO2  |   gpio_in, gpio_out
+
+axp813
+--
+GPIO   |   Functions
+
+GPIO0  |   gpio_in, gpio_out, ldo, adc
+GPIO1  |   gpio_in, gpio_out, ldo
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 9bb8722ba90f..22d3bb0bf927 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,6 +42,8 @@
 #define AXP20X_MUX_GPIO_IN BIT(1)
 #define AXP20X_MUX_ADC BIT(2)
 
+#define AXP813_MUX_ADC (BIT(2) | BIT(0))
+
 struct axp20x_pctrl_desc {
const struct pinctrl_pin_desc   *pins;
unsigned intnpins;
@@ -74,6 +77,11 @@ static const struct pinctrl_pin_desc axp209_pins[] = {
PINCTRL_PIN(2, "GPIO2"),
 };
 
+static const struct pinctrl_pin_desc axp813_pins[] = {
+   PINCTRL_PIN(0, "GPIO0"),
+   PINCTRL_PIN(1, "GPIO1"),
+};
+
 static const struct axp20x_pctrl_desc axp20x_data = {
.pins   = axp209_pins,
.npins  = ARRAY_SIZE(axp209_pins),
@@ -83,6 +91,15 @@ static const struct axp20x_pctrl_desc axp20x_data = {
.adc_mux = AXP20X_MUX_ADC,
 };
 
+static const struct axp20x_pctrl_desc axp813_data = {
+   .pins   = axp813_pins,
+   .npins  = ARRAY_SIZE(axp813_pins),
+   .ldo_mask = BIT(0) | BIT(1),
+   .adc_mask = BIT(0),
+   .gpio_status_offset = 0,
+   .adc_mux = AXP813_MUX_ADC,
+};
+
 static int axp20x_gpio_get_reg(unsigned int offset)
 {
switch (offset) {
@@ -357,10 +374,18 @@ static void axp20x_build_funcs_groups(struct 
platform_device *pdev)
  pctl->desc->pins);
 }
 
+static const struct of_device_id axp20x_pctl_match[] = {
+   { .compatible = "x-powers,axp209-gpio", .data = &axp20x_data, },
+   { .compatible = "x-powers,axp813-gpio", .data = &axp813_data, },
+   { }
+};
+MODULE_DEVICE_TABLE(of, axp20x_pctl_match);
+
 static int axp20x_pctl_probe(struct platform_device *pdev)
 {
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
struct axp20x_pctl *pctl;
+   struct device *dev = &pdev->dev;
struct pinctrl_desc *pctrl_desc;
int ret;
 
@@ -388,9 +413,9 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
pctl->chip.set  = axp20x_gpio_set;
pctl->chip.direction_input  = axp20x_gpio_input;
pctl->chip.direction_output = axp20x_gpio_output;
-   pctl->chip.ngpio= 3;
+   pctl->chip.ngpio= pctl->desc->npins;
 
-   pctl->desc = &axp20x_data;
+   pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev);
pctl->regmap = axp20x->regmap;
pctl->dev = &pdev->dev;
 
@@ -435,12 +460,6 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
return 0;
 }
 
-static const struct of_device_id axp20x_pctl_match[] = {
-   { .compatible = "x-powers,axp209-gpio" },
-   { }
-};
-MODULE_DEVICE_TABLE(of, axp20x_pctl_match);
-
 static struct platform_driver axp20x_pctl_driver = {
.probe  = axp20x_pctl_probe,
.driver = {
-- 
2.14.1



[PATCH v5 2/9] pinctrl: move gpio-axp209 to pinctrl

2017-12-05 Thread Quentin Schulz
To prepare the driver for the upcoming pinctrl features, move the GPIO
driver AXP209 from GPIO to pinctrl subsystem.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
Acked-by: Chen-Yu Tsai 
---
 drivers/gpio/Kconfig |  6 --
 drivers/gpio/Makefile|  1 -
 drivers/pinctrl/Kconfig  | 10 ++
 drivers/pinctrl/Makefile |  1 +
 drivers/{gpio/gpio-axp209.c => pinctrl/pinctrl-axp209.c} |  0
 5 files changed, 11 insertions(+), 7 deletions(-)
 rename drivers/{gpio/gpio-axp209.c => pinctrl/pinctrl-axp209.c} (100%)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d6a8e851ad13..395669bfcc26 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -122,12 +122,6 @@ config GPIO_ATH79
  Select this option to enable GPIO driver for
  Atheros AR71XX/AR724X/AR913X SoC devices.
 
-config GPIO_AXP209
-   tristate "X-Powers AXP209 PMIC GPIO Support"
-   depends on MFD_AXP20X
-   help
- Say yes to enable GPIO support for the AXP209 PMIC
-
 config GPIO_BCM_KONA
bool "Broadcom Kona GPIO"
depends on OF_GPIO && (ARCH_BCM_MOBILE || COMPILE_TEST)
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 4bc24febb889..bc5dd673fa11 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_GPIO_AMDPT)  += gpio-amdpt.o
 obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o
 obj-$(CONFIG_GPIO_ATH79)   += gpio-ath79.o
 obj-$(CONFIG_GPIO_ASPEED)  += gpio-aspeed.o
-obj-$(CONFIG_GPIO_AXP209)  += gpio-axp209.o
 obj-$(CONFIG_GPIO_BCM_KONA)+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BD9571MWV)   += gpio-bd9571mwv.o
 obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 4571cc098b76..ce126955212c 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -63,6 +63,16 @@ config PINCTRL_AS3722
  open drain configuration for the GPIO pins of AS3722 devices. It also
  supports the GPIO functionality through gpiolib.
 
+config PINCTRL_AXP209
+   tristate "X-Powers AXP209 PMIC pinctrl and GPIO Support"
+   depends on MFD_AXP20X
+   help
+ AXP PMICs provides multiple GPIOs that can be muxed for different
+ functions. This driver bundles a pinctrl driver to select the function
+ muxing and a GPIO driver to handle the GPIO when the GPIO function is
+ selected.
+ Say yes to enable pinctrl and GPIO support for the AXP209 PMIC
+
 config PINCTRL_BF54x
def_bool y if BF54x
select PINCTRL_ADI2
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index d0d4844f8022..4777f1595ce2 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
 obj-$(CONFIG_PINCTRL_ADI2) += pinctrl-adi2.o
 obj-$(CONFIG_PINCTRL_ARTPEC6)  += pinctrl-artpec6.o
 obj-$(CONFIG_PINCTRL_AS3722)   += pinctrl-as3722.o
+obj-$(CONFIG_PINCTRL_AXP209)   += pinctrl-axp209.o
 obj-$(CONFIG_PINCTRL_BF54x)+= pinctrl-adi2-bf54x.o
 obj-$(CONFIG_PINCTRL_BF60x)+= pinctrl-adi2-bf60x.o
 obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o
diff --git a/drivers/gpio/gpio-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
similarity index 100%
rename from drivers/gpio/gpio-axp209.c
rename to drivers/pinctrl/pinctrl-axp209.c
-- 
2.14.1



[PATCH v5 1/9] gpio: axp209: switch unsigned variables to unsigned int

2017-12-05 Thread Quentin Schulz
Checkpatch complains with the following message:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Let's make it happy by switching over to unsigned int.

Signed-off-by: Quentin Schulz 
---
 drivers/gpio/gpio-axp209.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-axp209.c b/drivers/gpio/gpio-axp209.c
index 4a346b7b4172..6ee7dc1418fa 100644
--- a/drivers/gpio/gpio-axp209.c
+++ b/drivers/gpio/gpio-axp209.c
@@ -32,7 +32,7 @@ struct axp20x_gpio {
struct regmap   *regmap;
 };
 
-static int axp20x_gpio_get_reg(unsigned offset)
+static int axp20x_gpio_get_reg(unsigned int offset)
 {
switch (offset) {
case 0:
@@ -46,7 +46,7 @@ static int axp20x_gpio_get_reg(unsigned offset)
return -EINVAL;
 }
 
-static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset)
+static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset)
 {
struct axp20x_gpio *gpio = gpiochip_get_data(chip);
int reg;
@@ -60,7 +60,7 @@ static int axp20x_gpio_input(struct gpio_chip *chip, unsigned 
offset)
  AXP20X_GPIO_FUNCTION_INPUT);
 }
 
-static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
+static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset)
 {
struct axp20x_gpio *gpio = gpiochip_get_data(chip);
unsigned int val;
@@ -73,7 +73,8 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned 
offset)
return !!(val & BIT(offset + 4));
 }
 
-static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
+static int axp20x_gpio_get_direction(struct gpio_chip *chip,
+unsigned int offset)
 {
struct axp20x_gpio *gpio = gpiochip_get_data(chip);
unsigned int val;
@@ -102,7 +103,7 @@ static int axp20x_gpio_get_direction(struct gpio_chip 
*chip, unsigned offset)
return val & 2;
 }
 
-static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset,
+static int axp20x_gpio_output(struct gpio_chip *chip, unsigned int offset,
  int value)
 {
struct axp20x_gpio *gpio = gpiochip_get_data(chip);
@@ -118,7 +119,7 @@ static int axp20x_gpio_output(struct gpio_chip *chip, 
unsigned offset,
  : AXP20X_GPIO_FUNCTION_OUT_LOW);
 }
 
-static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
+static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset,
int value)
 {
axp20x_gpio_output(chip, offset, value);
-- 
2.14.1



[PATCH v5 6/9] pinctrl: axp209: add programmable gpio_status_offset

2017-12-05 Thread Quentin Schulz
To prepare for patches that will add support for a new PMIC that has a
different GPIO input status register, add a gpio_status_offset within
axp20x_pctl structure and use it.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
Acked-by: Chen-Yu Tsai 
---
 drivers/pinctrl/pinctrl-axp209.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 17eeb0410a5b..db8e319b6e11 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -48,6 +48,7 @@ struct axp20x_pctrl_desc {
u8  ldo_mask;
/* Stores the pins supporting ADC function. Bit offset is pin number. */
u8  adc_mask;
+   u8  gpio_status_offset;
 };
 
 struct axp20x_pinctrl_function {
@@ -77,6 +78,7 @@ static const struct axp20x_pctrl_desc axp20x_data = {
.npins  = ARRAY_SIZE(axp209_pins),
.ldo_mask = BIT(0) | BIT(1),
.adc_mask = BIT(0) | BIT(1),
+   .gpio_status_offset = 4,
 };
 
 static int axp20x_gpio_get_reg(unsigned int offset)
@@ -108,7 +110,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned 
int offset)
if (ret)
return ret;
 
-   return !!(val & BIT(offset + 4));
+   return !!(val & BIT(offset + pctl->desc->gpio_status_offset));
 }
 
 static int axp20x_gpio_get_direction(struct gpio_chip *chip,
-- 
2.14.1



[PATCH v5 5/9] pinctrl: axp209: rename everything from gpio to pctl

2017-12-05 Thread Quentin Schulz
This driver used to do only GPIO features of the GPIOs in X-Powers
AXP20X. Now that we have migrated everything to the pinctrl subsystem
and added pinctrl features, rename everything related to pinctrl from
gpio to pctl to ease the understanding of differences between GPIO
and pinctrl features.

Signed-off-by: Quentin Schulz 
Acked-by: Maxime Ripard 
---
 drivers/pinctrl/pinctrl-axp209.c | 176 +++
 1 file changed, 88 insertions(+), 88 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 48cb57dcc575..17eeb0410a5b 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -57,7 +57,7 @@ struct axp20x_pinctrl_function {
unsigned intngroups;
 };
 
-struct axp20x_gpio {
+struct axp20x_pctl {
struct gpio_chipchip;
struct regmap   *regmap;
struct pinctrl_dev  *pctl_dev;
@@ -100,11 +100,11 @@ static int axp20x_gpio_input(struct gpio_chip *chip, 
unsigned int offset)
 
 static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset)
 {
-   struct axp20x_gpio *gpio = gpiochip_get_data(chip);
+   struct axp20x_pctl *pctl = gpiochip_get_data(chip);
unsigned int val;
int ret;
 
-   ret = regmap_read(gpio->regmap, AXP20X_GPIO20_SS, &val);
+   ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val);
if (ret)
return ret;
 
@@ -114,7 +114,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned 
int offset)
 static int axp20x_gpio_get_direction(struct gpio_chip *chip,
 unsigned int offset)
 {
-   struct axp20x_gpio *gpio = gpiochip_get_data(chip);
+   struct axp20x_pctl *pctl = gpiochip_get_data(chip);
unsigned int val;
int reg, ret;
 
@@ -122,7 +122,7 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip,
if (reg < 0)
return reg;
 
-   ret = regmap_read(gpio->regmap, reg, &val);
+   ret = regmap_read(pctl->regmap, reg, &val);
if (ret)
return ret;
 
@@ -152,14 +152,14 @@ static int axp20x_gpio_output(struct gpio_chip *chip, 
unsigned int offset,
 static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset,
int value)
 {
-   struct axp20x_gpio *gpio = gpiochip_get_data(chip);
+   struct axp20x_pctl *pctl = gpiochip_get_data(chip);
int reg;
 
reg = axp20x_gpio_get_reg(offset);
if (reg < 0)
return;
 
-   regmap_update_bits(gpio->regmap, reg,
+   regmap_update_bits(pctl->regmap, reg,
   AXP20X_GPIO_FUNCTIONS,
   value ? AXP20X_GPIO_FUNCTION_OUT_HIGH :
   AXP20X_GPIO_FUNCTION_OUT_LOW);
@@ -168,30 +168,30 @@ static void axp20x_gpio_set(struct gpio_chip *chip, 
unsigned int offset,
 static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset,
  u8 config)
 {
-   struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+   struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
int reg;
 
reg = axp20x_gpio_get_reg(offset);
if (reg < 0)
return reg;
 
-   return regmap_update_bits(gpio->regmap, reg, AXP20X_GPIO_FUNCTIONS,
+   return regmap_update_bits(pctl->regmap, reg, AXP20X_GPIO_FUNCTIONS,
  config);
 }
 
 static int axp20x_pmx_func_cnt(struct pinctrl_dev *pctldev)
 {
-   struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+   struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
 
-   return ARRAY_SIZE(gpio->funcs);
+   return ARRAY_SIZE(pctl->funcs);
 }
 
 static const char *axp20x_pmx_func_name(struct pinctrl_dev *pctldev,
unsigned int selector)
 {
-   struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+   struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
 
-   return gpio->funcs[selector].name;
+   return pctl->funcs[selector].name;
 }
 
 static int axp20x_pmx_func_groups(struct pinctrl_dev *pctldev,
@@ -199,10 +199,10 @@ static int axp20x_pmx_func_groups(struct pinctrl_dev 
*pctldev,
  const char * const **groups,
  unsigned int *num_groups)
 {
-   struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+   struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
 
-   *groups = gpio->funcs[selector].groups;
-   *num_groups = gpio->funcs[selector].ngroups;
+   *groups = pctl->funcs[selector].groups;
+   *num_groups = pctl->funcs[selector].ngroups;
 
return 0;
 }
@@ -210,18 +210,18 @@ static int axp20x_pmx_func_groups(struct pinctrl_dev 
*pctldev,
 static int axp20x_pmx_set_mux(struct pinctrl_dev *pctldev,
  unsign

Re: [alsa-devel] [PATCH v4 06/15] soundwire: Add IO transfer

2017-12-05 Thread Pierre-Louis Bossart

On 12/5/17 7:43 AM, Pierre-Louis Bossart wrote:

On 12/5/17 12:31 AM, Vinod Koul wrote:

On Sun, Dec 03, 2017 at 09:01:41PM -0600, Pierre-Louis Bossart wrote:

On 12/3/17 11:04 AM, Vinod Koul wrote:

On Fri, Dec 01, 2017 at 05:27:31PM -0600, Pierre-Louis Bossart wrote:


Sorry looks like I missed replying to this one earlier.


+static inline int find_response_code(enum sdw_command_response resp)
+{
+    switch (resp) {
+    case SDW_CMD_OK:
+    return 0;
+
+    case SDW_CMD_IGNORED:
+    return -ENODATA;
+
+    case SDW_CMD_TIMEOUT:
+    return -ETIMEDOUT;
+
+    default:
+    return -EIO;


the 'default' case will handle both SDW_CMD_FAIL (which is a bus event
usually due to bus clash or parity issues) and SDW_CMD_FAIL_OTHER 
(which is

an imp-def IP event).

Do they really belong in the same basket? From a debug perspective 
there is

quite a bit of information lost.


at higher level the error handling is same. the information is not 
lost as

it is expected that you would log it at error source.


I don't understand this. It's certainly not the same for me if you 
detect an
electric problem or if the IP is in the weeds. Logging at the source 
is fine

but this filtering prevents higher levels from doing anything different.


The point is higher levels like here cant do much than bail out and 
complain.


Can you point out what would be different behaviour in each of these 
cases?


+static inline int do_transfer(struct sdw_bus *bus, struct sdw_msg 
*msg)

+{
+    int retry = bus->prop.err_threshold;
+    enum sdw_command_response resp;
+    int ret = 0, i;
+
+    for (i = 0; i <= retry; i++) {
+    resp = bus->ops->xfer_msg(bus, msg);
+    ret = find_response_code(resp);
+
+    /* if cmd is ok or ignored return */
+    if (ret == 0 || ret == -ENODATA)


Can you document why you don't retry on a CMD_IGNORED? I know there 
was a

reason, I just can't remember it.


CMD_IGNORED can be okay on broadcast. User of this API can retry all 
they

want!


So you retry if this is a CMD_FAILED but let higher levels retry for
CMD_IGNORED, sorry I don't see the logic.


Yes that is right.

If I am doing a broadcast read, lets say for Device Id registers, why 
in the
world would I want to retry? CMD_IGNORED is a valid response and 
required to

stop enumeration cycle in that case.

But if I am not expecting a CMD_IGNORED response, I can very well go 
ahead
and retry from caller. The context is with caller and they can choose 
to do

appropriate handling.

And I have clarified this couple of times to you already, not sure how 
many

more times I would have to do that.


Until you clarify what you are doing.
There is ONE case where IGNORED is a valid answer (reading the Prepare 
not finished bits), and it should not only be documented but analyzed in 
more details.
I meant Read SCP_DevID registers from Device0... prepare bits should 
never return a CMD_IGNORED



For a write an IGNORED is never OK.



Now that I think of it, the retry on TIMEOUT makes no sense to me. 
The retry
was intended for bus-level issues, where maybe a single bit error 
causes an
issue without consequences, but the TIMEOUT is a completely 
different beast,
it's the master IP that doesn't answer really, a completely 
different case.


well in those cases where you have blue wires, it actually helps :)


Blue wires are not supposed to change electrical behavior. TIMEOUT is 
only

an internal SOC level issue, so no I don't get how this helps.

You have a retry count that is provided in the BIOS/firmware through 
disco
properties and it's meant to bus errors. You are abusing the 
definitions. A

command failed is supposed to be detected at the frame rate, which is
typically 20us. a timeout is likely a 100s of ms value, so if you 
retry on

top it's going to lock up the bus.


The world is not perfect! A guy debugging setups needs all the help. I do
not see any reason for not to retry. Bus is anyway locked up while a
transfer is ongoing (we serialize transfers).

Now if you feel this should be abhorred, I can change this for timeout.


This TIMEOUT thing is your own definition, it's not part of the spec, so 
I don't see how it can be lumped together with spec-related parts.


It's fine to keep a retry but please document what the expectations are 
for the TIMEOUT case.





+enum sdw_command_response {
+    SDW_CMD_OK = 0,
+    SDW_CMD_IGNORED = 1,
+    SDW_CMD_FAIL = 2,
+    SDW_CMD_TIMEOUT = 4,
+    SDW_CMD_FAIL_OTHER = 8,


Humm, I can't recall if/why this is a mask? does it need to be?


mask, not following!

Taking a wild guess that you are asking about last error, which is 
for SW

errors like malloc fail etc...


no, I was asking why this is declared as if it was used for a 
bitmask, why

not 0,1,2,3,4?


Oh okay, I think it was something to do with bits for errors, but don 
see it

helping so I can change it either way...


Unless you use bit-wise operators and combined responses there is no 
reason to keep 

Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-05 Thread Alexey Brodkin
Hi Jose,

On Tue, 2017-12-05 at 12:26 +, Jose Abreu wrote:
> On 05-12-2017 11:53, Alexey Brodkin wrote:
> > 
> > 
> > From my note above about udl_drm_gem_mmap() being only used in case of 
> > Xserver
> > I barely may conclude anything. Given my lack of knowledge of DRM guts
> > especially
> > when it comes to complicated cases with DMA buffer exports/imports I cannot 
> > say
> > immediately if that's just improper implementation of
> > udl_drm_gem_mmap() or not.
> > Even though I do see some differences between implementation of 
> > file_operations->mmap()
> > callback in UDL and
> > say exynos_drm_gem_mmap() or qxl_mmap() it's not clear
> > why this and that implementation was done.
> 
> Oh, I've seen this before. This is the same thing that arcpgu
> used to do in the mmap callback! Please comment out the call to
> update_vm_cache_attr() in the mmap callback and check if it works.

Actually I did it as the first thing when I spotted it in udl_drm_gem_mmap().
But that made no difference at all :(

-Alexey

Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

2017-12-05 Thread Pierre Morel

On 05/12/2017 15:30, Cornelia Huck wrote:

On Tue, 5 Dec 2017 15:23:50 +0100
Pierre Morel  wrote:


On 05/12/2017 15:04, Cornelia Huck wrote:

On Tue, 5 Dec 2017 08:52:57 +0100
Harald Freudenberger  wrote:
   

On 12/02/2017 02:30 AM, Tony Krowiak wrote:
   

I agree with your suggestion that defining a new CPU model feature is probably
the best way to resolve this issue. The question is, should we define a single
feature indicating whether AP instructions are installed and set features bits
for the guest based on whether or not they are set in the linux host, or should
we define additional CPU model features for turning features bits on and off?
I guess it boils down to what behavior is expected for the AP bus running on
the linux guest. Here is a rundown of the facilities bits associated with AP
and how they affect the behavior of the AP bus:

* STFLE.12 indicates whether the AP query function is available. If this bit
    is not set, then the AP bus scan will only test domains 0-15. For example,
    if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
    queues 04.0047, 05.0047 and 06.0047 will not be made available.

STFLE 12 is the indication for Query AP Configuration Information (QCI) 
available.

* STFLE.15 indicates whether the AP facilities test function is available. If
    this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
    by the AP bus scan will not get bound to any AP device drivers. Since the
    AP matrix model supports only CEX4 and greater, no devices will be bound
    to any driver for a guest.

This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
supports CEX4 and upper then this bit could also act as the indicator for
AP instructions available. Of course if you want to implement pure virtual
full simulated AP without any real AP hardware on the host this bit can't
be the indicator.


It would probably make sense to group these two together. Or is there
any advantage in supporting only a part of it?
   

* STFLE.65 indicates whether AP interrupts are available. If this bit is not
    set, then the AP bus will use polling instead of using interrupt handlers
    to process AP events.


So, does this indicate "adapter interrupts for AP" only? If so, we
should keep this separate and only enable it when we have the gisa etc.
ready.
   


Yes, STFLE 65, it is for AP only.

QCI, STFLE 12, is no present on older systems, in this case AP uses TAPQ
to retrieve information for each AP


Dumb question: How old? Machines that are still supported?


No idea which machine are supported or not, will ask.

What I can say is that I have here a Lpar which does not support QCI.
It seems to be a zEC12.2.
z13 support it.





So for my point of view, it make sense to separate the three facilities
to enable migration on older systems.


OK, if STFLE 12 might not be present (pending my question above), but
STFLE 15 is indeed a must-have, we should split this up.





--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany



Re: [Kgdb-bugreport] [PATCH] MAINTAINERS: kgdb: Replace Jason with Daniel

2017-12-05 Thread Lee Jones
On Tue, 05 Dec 2017, Jason Wessel wrote:

> On 12/05/2017 08:09 AM, Lee Jones wrote:
> > On Tue, 05 Dec 2017, Daniel Thompson wrote:
> > 
> > > ... with many, many thanks for Jason for all his hard work.
> > > 
> > > Cc: Jason Wessel 
> > > Signed-off-by: Daniel Thompson 
> > > ---
> > > 
> > > Notes:
> > >  Over the years Jason has become increasingly hard to get hold off
> > >  and I think he must now be regarded as inactive.
> > >  Patches in kgdb-next (mine as it happens) have been there for over a
> > >  year without a corresponding pull request and a couple of 
> > > architecture
> > >  specific kgdb fixes have ended up missing a release cycle (or two) as
> > >  the architecture maintainer waits for an Acked-by from Jason.
> > >  In the past I've had to rely on Andrew M. to land my own changes to
> > >  kgdb and in the v4.14 cycle you'll find my Acked-by on b8347c219649
> > >  ("x86/debug: Handle warnings before the notifier chain, to fix KGDB
> > >  crash"). That I was sharing surrogate acks convinced me we need a
> > >  change here and I've offered Jason help via private e-mail without
> > >  reply.
> > >  So, I really would prefer it it if this patch listed me as a
> > >  co-maintainer or, failing that, as least had Jason's blessing... but
> > >  it doesn't. I certainly suggest this patch takes a long time in
> > >  review, and if it doesn't attract Jason's attention then I can only
> > >  reiterate what is says in the commit log: Thanks Jason!
> > > 
> > >   MAINTAINERS | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > It looks like Jason has been inactive in all aspects of upstream
> > maintainership and as a contributor for well over a year now.
> 
> I have not been working directly on upstream kernel contributions
> for quite some time.  It doesn't mean I haven't been involved with
> kernel development.  Patches that I have reviewed or suggested to
> other developers generally don't bare my name.  I wouldn't mind
> trying to take a slightly more gradual passing of the baton and add
> Daniel as co-maintainer for a while before I retire from kernel work
> and merge myself away in the coming years. :-) 
> 
> I have a series of 50+ patches for kgdb/kdb/usb which have never
> been published.  I am not saying that we actually need any of those
> patches, but it would be nice to let the community decide, and we
> can see if there is anything worth merging into the next cycle or
> future work with other maintainers.   My kernel.org tree stopped
> working a long time ago, probably from inactivity.  I'll see if that
> can get restored in the next few days, or I'll use my github tree
> and send the unpublished work to the mailing list as an RFC.  And
> for what it is worth if none of this happens by the end of 4.16, by
> all means Daniel has my blessing to be the sole maintainer.

Thanks for your reply Jason.

Sounds like a perfectly reasonable way forward.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


[linux-next][41e83b9][gcc 4.8.5] make modules fail at net/netfilter/xt_bpf.ko

2017-12-05 Thread Abdul Haleem
Hi Al Viro,

Today's next kernel build failed with commit 41e83b9: fix "netfilter:
xt_bpf: Fix XT_BPF_MODE_FD_PINNED

Machine Type: Power 7
kernel version: 4.15.0-rc2-next-20171204
kernel config: attached
test: 'make modules'

ERROR: ".bpf_prog_get_type_path" [net/netfilter/xt_bpf.ko] undefined!

Kernel built fine when bad commit is reverted.

-- 
Regard's

Abdul Haleem
IBM Linux Technology Centre


#
# Automatically generated file; DO NOT EDIT.
# Linux/powerpc 4.10.0-rc5 Kernel Configuration
#
CONFIG_PPC64=y

#
# Processor support
#
CONFIG_PPC_BOOK3S_64=y
# CONFIG_PPC_BOOK3E_64 is not set
CONFIG_GENERIC_CPU=y
# CONFIG_CELL_CPU is not set
# CONFIG_POWER4_CPU is not set
# CONFIG_POWER5_CPU is not set
# CONFIG_POWER6_CPU is not set
# CONFIG_POWER7_CPU is not set
# CONFIG_POWER8_CPU is not set
CONFIG_PPC_BOOK3S=y
CONFIG_PPC_FPU=y
CONFIG_ALTIVEC=y
CONFIG_VSX=y
CONFIG_PPC_ICSWX=y
# CONFIG_PPC_ICSWX_PID is not set
# CONFIG_PPC_ICSWX_USE_SIGILL is not set
CONFIG_PPC_STD_MMU=y
CONFIG_PPC_STD_MMU_64=y
CONFIG_PPC_RADIX_MMU=y
CONFIG_PPC_MM_SLICES=y
CONFIG_PPC_HAVE_PMU_SUPPORT=y
CONFIG_PPC_PERF_CTRS=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2048
CONFIG_PPC_DOORBELL=y
CONFIG_VDSO32=y
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
CONFIG_64BIT=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_MMU=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NR_IRQS=512
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_ARCH_HAS_ILOG2_U64=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
CONFIG_PPC=y
# CONFIG_GENERIC_CSUM is not set
CONFIG_EARLY_PRINTK=y
CONFIG_PANIC_TIMEOUT=180
CONFIG_COMPAT=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_UDBG_16550=y
# CONFIG_GENERIC_TBSYNC is not set
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
CONFIG_EPAPR_BOOT=y
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
# CONFIG_PPC_DCR_NATIVE is not set
# CONFIG_PPC_DCR_MMIO is not set
# CONFIG_PPC_OF_PLATFORM_PCI is not set
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_PPC_EMULATE_SSTEP=y
CONFIG_ZONE_DMA32=y
CONFIG_PGTABLE_LEVELS=4
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_XZ is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_FHANDLE=y
# CONFIG_USELIB is not set
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_IRQ_DOMAIN=y
CONFIG_GENERIC_MSI_IRQ=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_ARCH_HAS_TICK_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
# CONFIG_NO_HZ_IDLE is not set
CONFIG_NO_HZ_FULL=y
# CONFIG_NO_HZ_FULL_ALL is not set
# CONFIG_NO_HZ_FULL_SYSIDLE is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y

#
# CPU/Task time and stats accounting
#
CONFIG_VIRT_CPU_ACCOUNTING=y
CONFIG_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_SRCU=y
CONFIG_TASKS_RCU=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_CONTEXT_TRACKING=y
# CONFIG_CONTEXT_TRACKING_FORCE is not set
# CONFIG_TREE_RCU_TRACE is not set
CONFIG_RCU_NOCB_CPU=y
# CONFIG_RCU_NOCB_CPU_NONE is not set
# CONFIG_RCU_NOCB_CPU_ZERO is not set
CONFIG_RCU_NOCB_CPU_ALL=y
# CONFIG_BUILD_BIN2C is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=20
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
#CONFIG_NUMA_BALANCING is not set
#CONFIG_NUMA_BALANCING_DEFAULT_ENABLED is not set
CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
# CONFIG_CGROUP_PIDS is not set
# CONFIG_CGROUP_RDMA is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPU

Re: [PATCH] lib/plist.c: Export plist_*() APIs

2017-12-05 Thread Peter Zijlstra
On Tue, Dec 05, 2017 at 08:05:43PM +0530, Hareesh Gundu wrote:
> Allow plist_add(), plist_del() and plist_requeue() APIs to
> be referenced by kernel modules by adding the EXPORT_SYMBOL().

No, not without also showing those modules.


Re: [PATCH 1/1] mm/page_owner: ignore everything below the IRQ entry point

2017-12-05 Thread Alexander Potapenko
On Mon, Dec 4, 2017 at 5:43 AM, Maninder Singh  wrote:
> Check whether the allocation happens in an IRQ handler.
> This lets us strip everything below the IRQ entry point to reduce the
> number of unique stack traces needed to be stored.
>
> so moved code of KASAN in generic file so that page_owner can also
> do same filteration.
>
> Initial KASAN commit
> id=be7635e7287e0e8013af3c89a6354a9e0182594c
>
> Signed-off-by: Vaneet Narang 
> Signed-off-by: Maninder Singh 
Reviewed-by: Alexander Potapenko 
> ---
>  include/linux/stacktrace.h | 25 +
>  mm/kasan/kasan.c   | 22 --
>  mm/page_owner.c|  1 +
>  3 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
> index ba29a06..2c1a562 100644
> --- a/include/linux/stacktrace.h
> +++ b/include/linux/stacktrace.h
> @@ -3,6 +3,7 @@
>  #define __LINUX_STACKTRACE_H
>
>  #include 
> +#include 
>
>  struct task_struct;
>  struct pt_regs;
> @@ -26,6 +27,28 @@ extern int save_stack_trace_tsk_reliable(struct 
> task_struct *tsk,
>  extern int snprint_stack_trace(char *buf, size_t size,
> struct stack_trace *trace, int spaces);
>
> +static inline int in_irqentry_text(unsigned long ptr)
> +{
> +   return (ptr >= (unsigned long)&__irqentry_text_start &&
> +   ptr < (unsigned long)&__irqentry_text_end) ||
> +   (ptr >= (unsigned long)&__softirqentry_text_start &&
> +ptr < (unsigned long)&__softirqentry_text_end);
> +}
> +
> +static inline void filter_irq_stacks(struct stack_trace *trace)
> +{
> +   int i;
> +
> +   if (!trace->nr_entries)
> +   return;
> +   for (i = 0; i < trace->nr_entries; i++)
> +   if (in_irqentry_text(trace->entries[i])) {
> +   /* Include the irqentry function into the stack. */
> +   trace->nr_entries = i + 1;
> +   break;
> +   }
> +}
> +
>  #ifdef CONFIG_USER_STACKTRACE_SUPPORT
>  extern void save_stack_trace_user(struct stack_trace *trace);
>  #else
> @@ -38,6 +61,8 @@ extern int snprint_stack_trace(char *buf, size_t size,
>  # define save_stack_trace_user(trace)  do { } while (0)
>  # define print_stack_trace(trace, spaces)  do { } while (0)
>  # define snprint_stack_trace(buf, size, trace, spaces) do { } while (0)
> +# define filter_irq_stacks(trace)  do { } while (0)
> +# define in_irqentry_text(ptr) do { } while (0)
>  # define save_stack_trace_tsk_reliable(tsk, trace) ({ -ENOSYS; })
>  #endif /* CONFIG_STACKTRACE */
>
> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
> index 405bba4..129e7b8 100644
> --- a/mm/kasan/kasan.c
> +++ b/mm/kasan/kasan.c
> @@ -412,28 +412,6 @@ void kasan_poison_object_data(struct kmem_cache *cache, 
> void *object)
> KASAN_KMALLOC_REDZONE);
>  }
>
> -static inline int in_irqentry_text(unsigned long ptr)
> -{
> -   return (ptr >= (unsigned long)&__irqentry_text_start &&
> -   ptr < (unsigned long)&__irqentry_text_end) ||
> -   (ptr >= (unsigned long)&__softirqentry_text_start &&
> -ptr < (unsigned long)&__softirqentry_text_end);
> -}
> -
> -static inline void filter_irq_stacks(struct stack_trace *trace)
> -{
> -   int i;
> -
> -   if (!trace->nr_entries)
> -   return;
> -   for (i = 0; i < trace->nr_entries; i++)
> -   if (in_irqentry_text(trace->entries[i])) {
> -   /* Include the irqentry function into the stack. */
> -   trace->nr_entries = i + 1;
> -   break;
> -   }
> -}
> -
>  static inline depot_stack_handle_t save_stack(gfp_t flags)
>  {
> unsigned long entries[KASAN_STACK_DEPTH];
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 8602fb4..30e9cb2 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -148,6 +148,7 @@ static noinline depot_stack_handle_t save_stack(gfp_t 
> flags)
> depot_stack_handle_t handle;
>
> save_stack_trace(&trace);
> +   filter_irq_stacks(&trace);
> if (trace.nr_entries != 0 &&
> trace.entries[trace.nr_entries-1] == ULONG_MAX)
> trace.nr_entries--;
> --
> 1.9.1
>



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg


[RFC v2 2/6] batman-adv: Rename batman-adv.h to batadv_genl.h

2017-12-05 Thread Sven Eckelmann
This file contains the relevant information to let userspace communicate
with batman-adv over generic netlink. The relevant genl enums for the
attributes and commands have the prefix batadv_genl. Renaming this file to
this name therefore represents the content better and avoids confusion with
the file which will contain the packet format definitions.

Signed-off-by: Sven Eckelmann 
---
 MAINTAINERS| 2 +-
 include/uapi/linux/{batman_adv.h => batadv_genl.h} | 6 +++---
 net/batman-adv/bat_algo.c  | 2 +-
 net/batman-adv/bat_iv_ogm.c| 2 +-
 net/batman-adv/bat_v.c | 2 +-
 net/batman-adv/bridge_loop_avoidance.c | 2 +-
 net/batman-adv/gateway_client.c| 2 +-
 net/batman-adv/main.c  | 2 +-
 net/batman-adv/netlink.c   | 2 +-
 net/batman-adv/originator.c| 2 +-
 net/batman-adv/tp_meter.c  | 2 +-
 net/batman-adv/translation-table.c | 2 +-
 net/batman-adv/types.h | 2 +-
 13 files changed, 15 insertions(+), 15 deletions(-)
 rename include/uapi/linux/{batman_adv.h => batadv_genl.h} (98%)

diff --git a/MAINTAINERS b/MAINTAINERS
index aa71ab52fd76..68abe39ee87a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2563,7 +2563,7 @@ S:Maintained
 F: Documentation/ABI/testing/sysfs-class-net-batman-adv
 F: Documentation/ABI/testing/sysfs-class-net-mesh
 F: Documentation/networking/batman-adv.rst
-F: include/uapi/linux/batman_adv.h
+F: include/uapi/linux/batadv_genl.h
 F: net/batman-adv/
 
 BAYCOM/HDLCDRV DRIVERS FOR AX.25
diff --git a/include/uapi/linux/batman_adv.h b/include/uapi/linux/batadv_genl.h
similarity index 98%
rename from include/uapi/linux/batman_adv.h
rename to include/uapi/linux/batadv_genl.h
index a0fed6c01a46..8ed28676e198 100644
--- a/include/uapi/linux/batman_adv.h
+++ b/include/uapi/linux/batadv_genl.h
@@ -22,8 +22,8 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#ifndef _UAPI_LINUX_BATMAN_ADV_H_
-#define _UAPI_LINUX_BATMAN_ADV_H_
+#ifndef _UAPI_LINUX_BATADV_GENL_H_
+#define _UAPI_LINUX_BATADV_GENL_H_
 
 #define BATADV_GENL_NAME "batadv"
 
@@ -423,4 +423,4 @@ enum batadv_tp_meter_reason {
BATADV_TP_REASON_TOO_MANY   = 133,
 };
 
-#endif /* _UAPI_LINUX_BATMAN_ADV_H_ */
+#endif /* _UAPI_LINUX_BATADV_GENL_H_ */
diff --git a/net/batman-adv/bat_algo.c b/net/batman-adv/bat_algo.c
index 37390a21e5e9..07392a25235f 100644
--- a/net/batman-adv/bat_algo.c
+++ b/net/batman-adv/bat_algo.c
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "bat_algo.h"
 #include "netlink.h"
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 4055338de7f0..7727a39c4265 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -54,7 +54,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "bat_algo.h"
 #include "bitarray.h"
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 7eea24204b55..b43ba53daafd 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -39,7 +39,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "bat_algo.h"
 #include "bat_v_elp.h"
diff --git a/net/batman-adv/bridge_loop_avoidance.c 
b/net/batman-adv/bridge_loop_avoidance.c
index 15d64a575034..1a9594d68db2 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -52,7 +52,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "hard-interface.h"
 #include "hash.h"
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 5e2d00731e9f..23c8032ce478 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -45,7 +45,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "gateway_common.h"
 #include "hard-interface.h"
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index a56ae758f799..c034e5c504c4 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -48,7 +48,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "bat_algo.h"
 #include "bat_iv_ogm.h"
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index a9679bdca432..5a66eb6c45f1 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -42,7 +42,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "bat_algo.h"
 #include "bridge_loop_avoidance.h"
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index dafc73811aa6..ec7b357e1781 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -41,7 +41,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "bat_algo.h"
 #include "distributed-arp-table.h"
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index d73346057310

Re: [Kgdb-bugreport] [PATCH] MAINTAINERS: kgdb: Replace Jason with Daniel

2017-12-05 Thread Jason Wessel

On 12/05/2017 08:09 AM, Lee Jones wrote:

On Tue, 05 Dec 2017, Daniel Thompson wrote:


... with many, many thanks for Jason for all his hard work.

Cc: Jason Wessel 
Signed-off-by: Daniel Thompson 
---

Notes:
 Over the years Jason has become increasingly hard to get hold off
 and I think he must now be regarded as inactive.
 
 Patches in kgdb-next (mine as it happens) have been there for over a

 year without a corresponding pull request and a couple of architecture
 specific kgdb fixes have ended up missing a release cycle (or two) as
 the architecture maintainer waits for an Acked-by from Jason.
 
 In the past I've had to rely on Andrew M. to land my own changes to

 kgdb and in the v4.14 cycle you'll find my Acked-by on b8347c219649
 ("x86/debug: Handle warnings before the notifier chain, to fix KGDB
 crash"). That I was sharing surrogate acks convinced me we need a
 change here and I've offered Jason help via private e-mail without
 reply.
 
 So, I really would prefer it it if this patch listed me as a

 co-maintainer or, failing that, as least had Jason's blessing... but
 it doesn't. I certainly suggest this patch takes a long time in
 review, and if it doesn't attract Jason's attention then I can only
 reiterate what is says in the commit log: Thanks Jason!

  MAINTAINERS | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)


It looks like Jason has been inactive in all aspects of upstream
maintainership and as a contributor for well over a year now.


I have not been working directly on upstream kernel contributions for quite 
some time.  It doesn't mean I haven't been involved with kernel development.  
Patches that I have reviewed or suggested to other developers generally don't 
bare my name.  I wouldn't mind trying to take a slightly more gradual passing 
of the baton and add Daniel as co-maintainer for a while before I retire from 
kernel work and merge myself away in the coming years. :-)

I have a series of 50+ patches for kgdb/kdb/usb which have never been 
published.  I am not saying that we actually need any of those patches, but it 
would be nice to let the community decide, and we can see if there is anything 
worth merging into the next cycle or future work with other maintainers.   My 
kernel.org tree stopped working a long time ago, probably from inactivity.  
I'll see if that can get restored in the next few days, or I'll use my github 
tree and send the unpublished work to the mailing list as an RFC.  And for what 
it is worth if none of this happens by the end of 4.16, by all means Daniel has 
my blessing to be the sole maintainer.

Many thanks to Daniel for his contributions!

Cheers,
Jason.


[RFC v2 4/6] batman-adv: Remove usage of BIT(x) in packet.h

2017-12-05 Thread Sven Eckelmann
The BIT(x) macro is no longer available for uapi headers because it is
defined outside of it (linux/bitops.h). The use of it must therefore be
avoided and replaced by an appropriate other representation.

Signed-off-by: Sven Eckelmann 
---
 net/batman-adv/packet.h | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 0d011012c71a..311ac6fd76ff 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -22,7 +22,6 @@
 #define _NET_BATMAN_ADV_PACKET_H_
 
 #include 
-#include 
 #include 
 #include 
 
@@ -94,9 +93,9 @@ enum batadv_subtype {
  * one hop neighbor on the interface where it was originally received.
  */
 enum batadv_iv_flags {
-   BATADV_NOT_BEST_NEXT_HOP   = BIT(0),
-   BATADV_PRIMARIES_FIRST_HOP = BIT(1),
-   BATADV_DIRECTLINK  = BIT(2),
+   BATADV_NOT_BEST_NEXT_HOP   = 1UL << 0,
+   BATADV_PRIMARIES_FIRST_HOP = 1UL << 1,
+   BATADV_DIRECTLINK  = 1UL << 2,
 };
 
 /**
@@ -125,9 +124,9 @@ enum batadv_icmp_packettype {
  * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets
  */
 enum batadv_mcast_flags {
-   BATADV_MCAST_WANT_ALL_UNSNOOPABLES  = BIT(0),
-   BATADV_MCAST_WANT_ALL_IPV4  = BIT(1),
-   BATADV_MCAST_WANT_ALL_IPV6  = BIT(2),
+   BATADV_MCAST_WANT_ALL_UNSNOOPABLES  = 1UL << 0,
+   BATADV_MCAST_WANT_ALL_IPV4  = 1UL << 1,
+   BATADV_MCAST_WANT_ALL_IPV6  = 1UL << 2,
 };
 
 /* tt data subtypes */
@@ -141,10 +140,10 @@ enum batadv_mcast_flags {
  * @BATADV_TT_FULL_TABLE: contains full table to replace existing table
  */
 enum batadv_tt_data_flags {
-   BATADV_TT_OGM_DIFF   = BIT(0),
-   BATADV_TT_REQUEST= BIT(1),
-   BATADV_TT_RESPONSE   = BIT(2),
-   BATADV_TT_FULL_TABLE = BIT(4),
+   BATADV_TT_OGM_DIFF   = 1UL << 0,
+   BATADV_TT_REQUEST= 1UL << 1,
+   BATADV_TT_RESPONSE   = 1UL << 2,
+   BATADV_TT_FULL_TABLE = 1UL << 4,
 };
 
 /**
@@ -152,7 +151,7 @@ enum batadv_tt_data_flags {
  * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
  */
 enum batadv_vlan_flags {
-   BATADV_VLAN_HAS_TAG = BIT(15),
+   BATADV_VLAN_HAS_TAG = 1UL << 15,
 };
 
 /**
-- 
2.11.0



[RFC v2 5/6] batman-adv: Convert packet.h to uapi header

2017-12-05 Thread Sven Eckelmann
The header file is used by different userspace programs to inject packets
or to decode sniffed packets. It should therefore be available to them as
userspace header.

Also other components in the kernel (like the flow dissector) require
access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
packets.

Signed-off-by: Sven Eckelmann 
---
 MAINTAINERS| 1 +
 net/batman-adv/packet.h => include/uapi/linux/batadv.h | 9 +
 net/batman-adv/bat_iv_ogm.c| 2 +-
 net/batman-adv/bat_v.c | 2 +-
 net/batman-adv/bat_v_elp.c | 2 +-
 net/batman-adv/bat_v_ogm.c | 2 +-
 net/batman-adv/bridge_loop_avoidance.c | 2 +-
 net/batman-adv/distributed-arp-table.h | 2 +-
 net/batman-adv/fragmentation.c | 2 +-
 net/batman-adv/gateway_client.c| 2 +-
 net/batman-adv/gateway_common.c| 2 +-
 net/batman-adv/hard-interface.c| 2 +-
 net/batman-adv/icmp_socket.c   | 2 +-
 net/batman-adv/main.c  | 2 +-
 net/batman-adv/main.h  | 2 +-
 net/batman-adv/multicast.c | 2 +-
 net/batman-adv/netlink.c   | 2 +-
 net/batman-adv/network-coding.c| 2 +-
 net/batman-adv/routing.c   | 2 +-
 net/batman-adv/send.h  | 3 +--
 net/batman-adv/soft-interface.c| 2 +-
 net/batman-adv/sysfs.c | 2 +-
 net/batman-adv/tp_meter.c  | 2 +-
 net/batman-adv/translation-table.c | 2 +-
 net/batman-adv/tvlv.c  | 2 +-
 net/batman-adv/types.h | 3 +--
 26 files changed, 30 insertions(+), 30 deletions(-)
 rename net/batman-adv/packet.h => include/uapi/linux/batadv.h (98%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 68abe39ee87a..10c42a978c59 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2563,6 +2563,7 @@ S:Maintained
 F: Documentation/ABI/testing/sysfs-class-net-batman-adv
 F: Documentation/ABI/testing/sysfs-class-net-mesh
 F: Documentation/networking/batman-adv.rst
+F: include/uapi/linux/batadv.h
 F: include/uapi/linux/batadv_genl.h
 F: net/batman-adv/
 
diff --git a/net/batman-adv/packet.h b/include/uapi/linux/batadv.h
similarity index 98%
rename from net/batman-adv/packet.h
rename to include/uapi/linux/batadv.h
index 311ac6fd76ff..46a22ab79b76 100644
--- a/net/batman-adv/packet.h
+++ b/include/uapi/linux/batadv.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */
 /* Copyright (C) 2007-2017  B.A.T.M.A.N. contributors:
  *
  * Marek Lindner, Simon Wunderlich
@@ -16,10 +16,11 @@
  * along with this program; if not, see .
  *
  * License-Filename: LICENSES/preferred/GPL-2.0
+ * License-Filename: LICENSES/exceptions/Linux-syscall-note
  */
 
-#ifndef _NET_BATMAN_ADV_PACKET_H_
-#define _NET_BATMAN_ADV_PACKET_H_
+#ifndef _UAPI_LINUX_BATADV_H_
+#define _UAPI_LINUX_BATADV_H_
 
 #include 
 #include 
@@ -643,4 +644,4 @@ struct batadv_tvlv_mcast_data {
u8 reserved[3];
 };
 
-#endif /* _NET_BATMAN_ADV_PACKET_H_ */
+#endif /* _UAPI_LINUX_BATADV_H_ */
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 7727a39c4265..201529d1f015 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "bat_algo.h"
@@ -65,7 +66,6 @@
 #include "netlink.h"
 #include "network-coding.h"
 #include "originator.h"
-#include "packet.h"
 #include "routing.h"
 #include "send.h"
 #include "translation-table.h"
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index b43ba53daafd..4b08d2b4d66f 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "bat_algo.h"
@@ -51,7 +52,6 @@
 #include "log.h"
 #include "netlink.h"
 #include "originator.h"
-#include "packet.h"
 
 struct sk_buff;
 
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 0908e313d121..9fb1718248b8 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -44,13 +44,13 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "bat_algo.h"
 #include "bat_v_ogm.h"
 #include "hard-interface.h"
 #include "log.h"
 #include "originator.h"
-#include "packet.h"
 #include "routing.h"
 #include "send.h"
 
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index a79e89ca5667..0f4050193e30 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/b

[RFC v2 6/6] flow_dissector: Parse batman-adv unicast headers

2017-12-05 Thread Sven Eckelmann
The batman-adv unicast packets contain a full layer 2 frame in encapsulated
form. The flow dissector must therefore be able to parse the batman-adv
unicast header to reach the layer 2+3 information.

  ++
  | ip(v6)hdr  |
  ++
  | inner ethhdr   |
  ++
  | batadv unicast hdr |
  ++
  | outer ethhdr   |
  ++

The obtained information from the upper layer can then be used by RPS to
schedule the processing on separate cores. This allows better distribution
of multiple flows from the same neighbor to different cores.

Signed-off-by: Sven Eckelmann 
---
 net/core/flow_dissector.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 15ce30063765..784cc07fc58e 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static void dissector_set_key(struct flow_dissector *flow_dissector,
  enum flow_dissector_key_id key_id)
@@ -696,6 +697,35 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 
break;
}
+   case htons(ETH_P_BATMAN): {
+   struct {
+   struct batadv_unicast_packet batadv_unicast;
+   struct ethhdr eth;
+   } *hdr, _hdr;
+
+   hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen,
+  &_hdr);
+   if (!hdr) {
+   fdret = FLOW_DISSECT_RET_OUT_BAD;
+   break;
+   }
+
+   if (hdr->batadv_unicast.version != BATADV_COMPAT_VERSION) {
+   fdret = FLOW_DISSECT_RET_OUT_BAD;
+   break;
+   }
+
+   if (hdr->batadv_unicast.packet_type != BATADV_UNICAST) {
+   fdret = FLOW_DISSECT_RET_OUT_BAD;
+   break;
+   }
+
+   proto = hdr->eth.h_proto;
+   nhoff += sizeof(*hdr);
+
+   fdret = FLOW_DISSECT_RET_PROTO_AGAIN;
+   break;
+   }
case htons(ETH_P_8021AD):
case htons(ETH_P_8021Q): {
const struct vlan_hdr *vlan;
-- 
2.11.0



[RFC v2 3/6] batman-adv: Let packet.h include its headers directly

2017-12-05 Thread Sven Eckelmann
The headers used by packet.h should also be included by it directly. main.h
is currently dealing with it in batman-adv, but this will no longer work
when this header is moved to include/uapi/linux/.

Signed-off-by: Sven Eckelmann 
---
 net/batman-adv/main.h   | 2 --
 net/batman-adv/packet.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 69c2ab666961..231bbc47910e 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -219,10 +219,8 @@ enum batadv_uev_type {
 
 /* Kernel headers */
 
-#include  /* for packet.h */
 #include 
 #include 
-#include  /* for packet.h */
 #include 
 #include 
 #include 
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index ebe0605d1505..0d011012c71a 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -22,6 +22,8 @@
 #define _NET_BATMAN_ADV_PACKET_H_
 
 #include 
+#include 
+#include 
 #include 
 
 /**
-- 
2.11.0



[RFC v2 1/6] batman-adv: Change nl references to genl

2017-12-05 Thread Sven Eckelmann
The batman-adv netlink functionality is actually not pure netlink but is
using NETLINK_GENERIC and related API. The code should therefore also use
this "genl" instead of "nl" to make this more clear.

Signed-off-by: Sven Eckelmann 
---
 include/uapi/linux/batman_adv.h | 14 +++---
 net/batman-adv/main.c   |  2 +-
 net/batman-adv/netlink.c| 10 ++
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/uapi/linux/batman_adv.h b/include/uapi/linux/batman_adv.h
index ae00c99cbed0..a0fed6c01a46 100644
--- a/include/uapi/linux/batman_adv.h
+++ b/include/uapi/linux/batman_adv.h
@@ -25,9 +25,9 @@
 #ifndef _UAPI_LINUX_BATMAN_ADV_H_
 #define _UAPI_LINUX_BATMAN_ADV_H_
 
-#define BATADV_NL_NAME "batadv"
+#define BATADV_GENL_NAME "batadv"
 
-#define BATADV_NL_MCAST_GROUP_TPMETER  "tpmeter"
+#define BATADV_GENL_MCAST_GROUP_TPMETER "tpmeter"
 
 /**
  * enum batadv_tt_client_flags - TT client specific flags
@@ -92,9 +92,9 @@ enum batadv_tt_client_flags {
 };
 
 /**
- * enum batadv_nl_attrs - batman-adv netlink attributes
+ * enum batadv_genl_attrs - batman-adv netlink attributes
  */
-enum batadv_nl_attrs {
+enum batadv_genl_attrs {
/**
 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
 */
@@ -280,7 +280,7 @@ enum batadv_nl_attrs {
__BATADV_ATTR_AFTER_LAST,
 
/**
-* @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
+* @NUM_BATADV_ATTR: total number of batadv_genl_attrs available
 */
NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
 
@@ -291,9 +291,9 @@ enum batadv_nl_attrs {
 };
 
 /**
- * enum batadv_nl_commands - supported batman-adv netlink commands
+ * enum batadv_genl_commands - supported batman-adv netlink commands
  */
-enum batadv_nl_commands {
+enum batadv_genl_commands {
/**
 * @BATADV_CMD_UNSPEC: unspecified command to catch errors
 */
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index fc6dcea30238..a56ae758f799 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -687,4 +687,4 @@ MODULE_DESCRIPTION(BATADV_DRIVER_DESC);
 MODULE_SUPPORTED_DEVICE(BATADV_DRIVER_DEVICE);
 MODULE_VERSION(BATADV_SOURCE_VERSION);
 MODULE_ALIAS_RTNL_LINK("batadv");
-MODULE_ALIAS_GENL_FAMILY(BATADV_NL_NAME);
+MODULE_ALIAS_GENL_FAMILY(BATADV_GENL_NAME);
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index a68443d3f119..a9679bdca432 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -58,11 +58,13 @@ struct genl_family batadv_netlink_family;
 
 /* multicast groups */
 enum batadv_netlink_multicast_groups {
-   BATADV_NL_MCGRP_TPMETER,
+   BATADV_GENL_MCGRP_TPMETER,
 };
 
 static const struct genl_multicast_group batadv_netlink_mcgrps[] = {
-   [BATADV_NL_MCGRP_TPMETER] = { .name = BATADV_NL_MCAST_GROUP_TPMETER },
+   [BATADV_GENL_MCGRP_TPMETER] = {
+   .name = BATADV_GENL_MCAST_GROUP_TPMETER
+   },
 };
 
 static const struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = {
@@ -298,7 +300,7 @@ int batadv_netlink_tpmeter_notify(struct batadv_priv 
*bat_priv, const u8 *dst,
 
genlmsg_multicast_netns(&batadv_netlink_family,
dev_net(bat_priv->soft_iface), msg, 0,
-   BATADV_NL_MCGRP_TPMETER, GFP_KERNEL);
+   BATADV_GENL_MCGRP_TPMETER, GFP_KERNEL);
 
return 0;
 
@@ -611,7 +613,7 @@ static const struct genl_ops batadv_netlink_ops[] = {
 
 struct genl_family batadv_netlink_family __ro_after_init = {
.hdrsize = 0,
-   .name = BATADV_NL_NAME,
+   .name = BATADV_GENL_NAME,
.version = 1,
.maxattr = BATADV_ATTR_MAX,
.netnsok = true,
-- 
2.11.0



[PATCH] lib/plist.c: Export plist_*() APIs

2017-12-05 Thread Hareesh Gundu
Allow plist_add(), plist_del() and plist_requeue() APIs to
be referenced by kernel modules by adding the EXPORT_SYMBOL().

Signed-off-by: Hareesh Gundu 
---
 lib/plist.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/plist.c b/lib/plist.c
index 199408f..6109b75 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -103,6 +103,7 @@ void plist_add(struct plist_node *node, struct plist_head 
*head)
 
plist_check_head(head);
 }
+EXPORT_SYMBOL(plist_add);
 
 /**
  * plist_del - Remove a @node from plist.
@@ -132,6 +133,7 @@ void plist_del(struct plist_node *node, struct plist_head 
*head)
 
plist_check_head(head);
 }
+EXPORT_SYMBOL(plist_del);
 
 /**
  * plist_requeue - Requeue @node at end of same-prio entries.
@@ -172,6 +174,7 @@ void plist_requeue(struct plist_node *node, struct 
plist_head *head)
 
plist_check_head(head);
 }
+EXPORT_SYMBOL(plist_requeue);
 
 #ifdef CONFIG_DEBUG_PI_LIST
 #include 
-- 
1.9.1



[RFC v2 0/6] flow_dissector: Provide basic batman-adv unicast handling

2017-12-05 Thread Sven Eckelmann
Hi,

we are currently starting to use batman-adv as mesh protocol on multicore
embedded devices. These usually don't have a lot of CPU power per core but
are reasonable fast when using multiple cores.

It was noticed that sending was working very well but receiving was
basically only using on CPU core per neighbor. The reason for that is
format of the (normal) incoming packet:


++
| ip(v6)hdr  |
++
| inner ethhdr   |
++
| batadv unicast hdr |
++
| outer ethhdr   |
++

The flow dissector will therefore stop after parsing the outer ethernet
header and will not parse the actual ipv(4|6)/... header of the packet. Our
assumption was now that it would help us to add minimal support to the flow
dissector to jump over the batman-adv unicast and inner ethernet header
(like in gre ETH_P_TEB). The patch was implemented in a slightly hacky
way [1] and the results looked quite promising.

Now we comes the actual "problematic" part. The packet format is currently
only available in net/batman-adv/packet.h. I've guessed that it should be
moved somewhere under include/ to make it accessible to the flow dissector
in a "standard way".

First we have to find the correct place for it. I am not aware of any
standard for that - so I've grepped for some packet headers which are used
by the dissector and found following files (most likely not a complete
list):

* linux/if_vlan.h
* net/gre.h
* net/tipc.h
* uapi/linux/if_arp.h
* uapi/linux/if_ether.h
* uapi/linux/if_pppox.h
* uapi/linux/ip.h
* uapi/linux/ipv6.h
* uapi/linux/mpls.h
* uapi/linux/tcp.h


So I would say that uapi/linux is the "winner" here. This would actually
also helpful for userspace tools which either inject packets or monitor
interfaces + dissect packets (for example batctl). Now to the actual
filename. batman_adv.h is already used in the moment for the netlink
definition and I would like to avoid that these two things are placed in
the same file. 

A quick grep for "NL_NAME" showed me following names:

* linux/nl802154.h
* net/nl802154.h
* uapi/linux/batman_adv.h
* uapi/linux/devlink.h
* uapi/linux/dlm_netlink.h
* uapi/linux/fou.h
* uapi/linux/if_macsec.h
* uapi/linux/if_team.h
* uapi/linux/ila.h
* uapi/linux/ip_vs.h
* uapi/linux/irda.h
* uapi/linux/l2tp.h
* uapi/linux/nfc.h
* uapi/linux/nl80211.h
* uapi/linux/psample.h
* uapi/linux/seg6_genl.h
* uapi/linux/taskstats.h
* uapi/linux/tcp_metrics.h
* uapi/linux/tipc_config.h
* uapi/linux/tipc_netlink.h

There doesn't seem to be any common way to do it - so I have to guess what
the best names could be. I've decided (but please provide better
alternatives) to use batadv_genl.h (for generic netlink stuff) and batadv.h
(for the packet format).


I would really appreciate it when you would provide feedback to the
naming/placement of the files. Btw. the patches are currently based on the
top of batadv/net-next [2] and this repository contains changes which still
have to be submitted to net-next.

Changes in v2:
=

* removed the batman-adv unicast packet header definition from flow_dissector.c
* moved the batman-adv packet.h/uapi headers around to provide the correct
  definitions to flow_dissector.c

Kind regards,
Sven

[1] https://patchwork.open-mesh.org/patch/17162/
[2] 
https://git.open-mesh.org/linux-merge.git/shortlog/refs/heads/batadv/net-next

Sven Eckelmann (6):
  batman-adv: Change nl references to genl
  batman-adv: Rename batman-adv.h to batadv_genl.h
  batman-adv: Let packet.h include its headers directly
  batman-adv: Remove usage of BIT(x) in packet.h
  batman-adv: Convert packet.h to uapi header
  flow_dissector: Parse batman-adv unicast headers

 MAINTAINERS|  3 +-
 .../packet.h => include/uapi/linux/batadv.h| 32 --
 include/uapi/linux/{batman_adv.h => batadv_genl.h} | 20 +++---
 net/batman-adv/bat_algo.c  |  2 +-
 net/batman-adv/bat_iv_ogm.c|  4 +--
 net/batman-adv/bat_v.c |  4 +--
 net/batman-adv/bat_v_elp.c |  2 +-
 net/batman-adv/bat_v_ogm.c |  2 +-
 net/batman-adv/bridge_loop_avoidance.c |  4 +--
 net/batman-adv/distributed-arp-table.h |  2 +-
 net/batman-adv/fragmentation.c |  2 +-
 net/batman-adv/gateway_client.c|  4 +--
 net/batman-adv/gateway_common.c|  2 +-
 net/batman-adv/hard-interface.c|  2 +-
 net/batman-adv/icmp_socket.c   |  2 +-
 net/batman-adv/main.c  |  6 ++--
 net/batman-adv/main.h  |  4 +--
 net/batman-adv/multicast.c |  2 +-
 net/batman-adv/netlink.c   | 14 ++
 net/batman-adv/network-codi

Re: [patch 28/60] x86/mm/kpti: Disable global pages if KERNEL_PAGE_TABLE_ISOLATION=y

2017-12-05 Thread Borislav Petkov
On Mon, Dec 04, 2017 at 03:07:34PM +0100, Thomas Gleixner wrote:
> From: Dave Hansen 
> 
> Global pages stay in the TLB across context switches.  Since all contexts
> share the same kernel mapping, these mappings are marked as global pages
> so kernel entries in the TLB are not flushed out on a context switch.
> 
> But, even having these entries in the TLB opens up something that an
> attacker can use, such as the double-page-fault attack:
> 
>http://www.ieee-security.org/TC/SP2013/papers/4977a191.pdf
> 
> That means that even when KERNEL_PAGE_TABLE_ISOLATION switches page tables
> on return to user space the global pages would stay in the TLB cache.
> 
> Disable global pages so that kernel TLB entries can be flushed before
> returning to user space. This way, all accesses to kernel addresses from
> userspace result in a TLB miss independent of the existence of a kernel
> mapping.
> 
> Supress global pages via the __supported_pte_mask. The user space

"Suppress"

Otherwise

Reviewed-by: Borislav Petkov 

-- 
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 
(AG Nürnberg)
-- 


Re: [PATCH v3 9/9] drm/i915: Implement HDCP for DisplayPort

2017-12-05 Thread Ramalingam C



On Tuesday 05 December 2017 10:45 AM, Sean Paul wrote:

+static
+bool intel_dp_hdcp_check_link(struct intel_digital_port *intel_dig_port)
+{
+   ssize_t ret;
+   u8 bstatus;
+   ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, DP_AUX_HDCP_BSTATUS,
+  &bstatus, 1);
+   if (ret != 1) {
+   DRM_ERROR("Read bstatus from DP/AUX failed (%ld)\n", ret);
+   return ret >= 0 ? -EIO : ret;
+   }
+   return !(bstatus & DP_BSTATUS_LINK_FAILURE);
+}
as per link integrity check should cover other indication from the 
repeater like


REAUTHENTICATION_REQUEST - request for reauth due to unauthenticated 
state at downstream for some unknown reason


-Ram



Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

2017-12-05 Thread Cornelia Huck
On Tue, 5 Dec 2017 15:23:50 +0100
Pierre Morel  wrote:

> On 05/12/2017 15:04, Cornelia Huck wrote:
> > On Tue, 5 Dec 2017 08:52:57 +0100
> > Harald Freudenberger  wrote:
> >   
> >> On 12/02/2017 02:30 AM, Tony Krowiak wrote:  
> >   
> >>> I agree with your suggestion that defining a new CPU model feature is 
> >>> probably
> >>> the best way to resolve this issue. The question is, should we define a 
> >>> single
> >>> feature indicating whether AP instructions are installed and set features 
> >>> bits
> >>> for the guest based on whether or not they are set in the linux host, or 
> >>> should
> >>> we define additional CPU model features for turning features bits on and 
> >>> off?
> >>> I guess it boils down to what behavior is expected for the AP bus running 
> >>> on
> >>> the linux guest. Here is a rundown of the facilities bits associated with 
> >>> AP
> >>> and how they affect the behavior of the AP bus:
> >>>
> >>> * STFLE.12 indicates whether the AP query function is available. If this 
> >>> bit
> >>>    is not set, then the AP bus scan will only test domains 0-15. For 
> >>> example,
> >>>    if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, 
> >>> then AP
> >>>    queues 04.0047, 05.0047 and 06.0047 will not be made available.  
> >> STFLE 12 is the indication for Query AP Configuration Information (QCI) 
> >> available.  
> >>> * STFLE.15 indicates whether the AP facilities test function is 
> >>> available. If
> >>>    this bit is not set, then the CEX4, CEX5 and CEX6 device drivers 
> >>> discovered
> >>>    by the AP bus scan will not get bound to any AP device drivers. Since 
> >>> the
> >>>    AP matrix model supports only CEX4 and greater, no devices will be 
> >>> bound
> >>>    to any driver for a guest.  
> >> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
> >> supports CEX4 and upper then this bit could also act as the indicator for
> >> AP instructions available. Of course if you want to implement pure virtual
> >> full simulated AP without any real AP hardware on the host this bit can't
> >> be the indicator.  
> > 
> > It would probably make sense to group these two together. Or is there
> > any advantage in supporting only a part of it?
> >   
> >>> * STFLE.65 indicates whether AP interrupts are available. If this bit is 
> >>> not
> >>>    set, then the AP bus will use polling instead of using interrupt 
> >>> handlers
> >>>    to process AP events.  
> > 
> > So, does this indicate "adapter interrupts for AP" only? If so, we
> > should keep this separate and only enable it when we have the gisa etc.
> > ready.
> >   
> 
> Yes, STFLE 65, it is for AP only.
> 
> QCI, STFLE 12, is no present on older systems, in this case AP uses TAPQ 
> to retrieve information for each AP

Dumb question: How old? Machines that are still supported?

> 
> So for my point of view, it make sense to separate the three facilities 
> to enable migration on older systems.

OK, if STFLE 12 might not be present (pending my question above), but
STFLE 15 is indeed a must-have, we should split this up.


Re: b1cbacc866 ("x86/smpboot: Do not use smp_num_siblings in .."): divide error: 0000 [#1] SMP DEBUG_PAGEALLOC

2017-12-05 Thread Prarit Bhargava
>[0.029102] Hierarchical SRCU implementation.
>[0.030040] smp: Bringing up secondary CPUs ...
>[0.030528] smp: Brought up 1 node, 1 CPU
>[0.030953] divide error:  [#1] SMP DEBUG_PAGEALLOC
>[0.031000] Modules linked in:
>[0.031000] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.0-01223-gb1cbacc 
>#1
>[0.031000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
>1.10.2-1 04/01/2014
>[0.031000] task: 88001e46 task.stack: c9008000

A single socket/package, single core, single thread system
has 1 thread.  __max_smt_threads is not set to 1 since smp_callin() is never
called.  The minimum value of __max_smt_threads must be 1.

tglx, this is built on -tip.

P.
8<

Subject: [PATCH] arch/x86: Initialize __max_smt_threads to 1

A single socket, single core, single thread system has __max_smt_threads
set to 0 since smp_callin() is not called.

__max_smt_threads must be a minimum of 1.

Fixes: b1cbacc8663a ("x86/smpboot: Do not use smp_num_siblings in 
__max_logical_packages calculation)
Signed-off-by: Prarit Bhargava 
Cc: Jakub Kicinski 
Cc: net...@vger.kernel.org
Cc: "net...@vger.kernel.org"
Cc: Clark Williams 
Cc: Andi Kleen 
Cc: x...@kernel.org
Link: https://marc.info/?t=15124609214&r=1&w=2
---
 arch/x86/kernel/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index eaee15fb7d8b..882c61e1d7a2 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(__max_logical_packages);
 static unsigned int logical_packages __read_mostly;
 
 /* Maximum number of SMT threads on any online core */
-int __max_smt_threads __read_mostly;
+int __read_mostly __max_smt_threads = 1;
 
 /* Flag to indicate if a complete sched domain rebuild is required */
 bool x86_topology_update;
-- 
2.15.0.rc0.39.g2f0e14e64



Re: [PATCH 1/2] drm/nouveau/bar/gf100: fix hang when calling ->fini() before ->init()

2017-12-05 Thread Jon Hunter

On 04/12/17 18:37, Guillaume Tucker wrote:
> If the firmware fails to load then ->fini() will be called before the
> device has been initialised, causing the kernel to hang while trying
> to write to a register.  Add a test in ->fini() to avoid this issue.
> 
> This fixes a kernel hang on tegra124.
> 
> Fixes: b17de35a2ebbe ("drm/nouveau/bar: implement bar1 teardown")
> Signed-off-by: Guillaume Tucker 
> CC: Ben Skeggs 
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c 
> b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
> index a3ba7f50198b..95e2aba64aad 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
> @@ -43,9 +43,12 @@ gf100_bar_bar1_wait(struct nvkm_bar *base)
>  }
>  
>  void
> -gf100_bar_bar1_fini(struct nvkm_bar *bar)
> +gf100_bar_bar1_fini(struct nvkm_bar *base)
>  {
> - nvkm_mask(bar->subdev.device, 0x001704, 0x8000, 0x);
> + struct nvkm_device *device = base->subdev.device;
> +
> + if (base->subdev.oneinit)
> + nvkm_mask(device, 0x001704, 0x8000, 0x);
>  }
>  
>  void

I have tested this and it works for me. Thanks for fixing this! Would be
good to get Ben's ACK, but you can have my ...

Tested-by: Jon Hunter 

Cheers
Jon

-- 
nvpublic


Re: [PATCH] SCSI: run queue if SCSI device queue isn't ready and queue is idle

2017-12-05 Thread Johannes Thumshirn
[ +Cc Omar ]

Ming Lei  writes:
> Before commit 0df21c86bdbf ("scsi: implement .get_budget and .put_budget
> for blk-mq"), we run queue after 3ms if queue is idle and SCSI device
> queue isn't ready, which is done in handling BLK_STS_RESOURCE. After
> commit 0df21c86bdbf is introduced, queue won't be run any more under
> this situation.
>
> IO hang is observed when timeout happened, and this patch fixes the IO
> hang issue by running queue after delay in scsi_dev_queue_ready, just like
> non-mq. This issue can be triggered by the following script[1].
>
> There is another issue which can be covered by running idle queue:
> when .get_budget() is called on request coming from hctx->dispatch_list,
> if one request just completes during .get_budget(), we can't depend on
> SCSI's restart to make progress any more. This patch fixes the race too.
>
> With this patch, we basically recover to previous behaviour(before commit
> 0df21c86bdbf) of handling idle queue when running out of resource.
>
> [1] script for test/verify SCSI timeout
> rmmod scsi_debug
> modprobe scsi_debug max_queue=1
>
> DEVICE=`ls -d 
> /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*/block/* | head -1 
> | xargs basename`
> DISK_DIR=`ls -d /sys/block/$DEVICE/device/scsi_disk/*`
>
> echo "using scsi device $DEVICE"
> echo "-1" >/sys/bus/pseudo/drivers/scsi_debug/every_nth
> echo "temporary write through" >$DISK_DIR/cache_type
> echo "128" >/sys/bus/pseudo/drivers/scsi_debug/opts
> echo none > /sys/block/$DEVICE/queue/scheduler
> dd if=/dev/$DEVICE of=/dev/null bs=1M iflag=direct count=1 &
> sleep 5
> echo "0" >/sys/bus/pseudo/drivers/scsi_debug/opts
> wait
> echo "SUCCESS"

SO I turned the above into a blktest but have found some shortcommings
of my bash skills. Maybe you or Omar has a soution for it:

--- 8< ---
>From 80e5810011d52bc188cd858962ce202bfd4dbee5 Mon Sep 17 00:00:00 2001
From: Johannes Thumshirn 
Date: Tue, 5 Dec 2017 15:21:08 +0100
Subject: [PATCH blktests] block/013: add test for scsi_device queue starvation

Add a test for Ming Lei's patch titled "SCSI: run queue if SCSI device
queue isn't ready and queue is idle"

Signed-off-by: Johannes Thumshirn 

---
This test case has two shortcommings, which need to be addressed I'm
just lacking a bit of the shell magic to address them properly.

1) Testing without the patch applied hangs the test forever as it
   doesn't get killed after a specific timeout (I think this should be
   solved in a common function).
2) It has a nasty sleep at it's end to wait for scsi_debug's refcounts
   to drop to 0 before removing the module or removing will fail and thus
   the test case. This as well should be solved in a more generic way.
---
 tests/block/013 | 63 +
 tests/block/013.out |  2 ++
 2 files changed, 65 insertions(+)
 create mode 100755 tests/block/013
 create mode 100644 tests/block/013.out

diff --git a/tests/block/013 b/tests/block/013
new file mode 100755
index ..f73724fc9ed2
--- /dev/null
+++ b/tests/block/013
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# Regression test for patch "SCSI: delay run queue if device is
+# blocked in scsi_dev_queue_ready()"
+#
+# Copyright (C) 2017 Johannes Thumshirn
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see .
+
+. common/scsi_debug
+
+DESCRIPTION="Test if a SCSI device's queue can be run if it isn't ready but 
the device is idle"
+TIMED=1
+
+requires() {
+   _have_scsi_debug && _have_module sd_mod && \
+   grep -q Y /sys/module/scsi_mod/parameters/use_blk_mq
+}
+
+test_one_device()
+{
+local device=$1
+
+echo "-1" > /sys/bus/pseudo/drivers/scsi_debug/every_nth
+echo "temporary write through" > \
+   /sys/block/"${device}"/device/scsi_disk/"$(basename $(readlink 
/sys/block/${device}/device))"/cache_type
+echo "128" > /sys/bus/pseudo/drivers/scsi_debug/opts
+echo "none" > /sys/block/${device}/queue/scheduler
+dd if=/dev/"${device}" of=/dev/null bs=1M iflag=direct \
+   count=1 2> /dev/null &
+sleep 5
+echo 0 > /sys/bus/pseudo/drivers/scsi_debug/opts
+wait
+}
+
+test() {
+   echo "Running ${TEST_NAME}"
+
+   if ! _init_scsi_debug statistics=1 max_queue=1; then
+   return
+   fi
+
+   local device
+   for device in "${SCSI_DEBUG_DEVICES[@]}"; do
+   test_one_device ${device}   
+   done
+
+  

Re: [PATCH] ACPI / LPSS: Add device link for CHT SD card dependency on I2C

2017-12-05 Thread Adrian Hunter
On 04/12/17 17:00, Rafael J. Wysocki wrote:
> On Monday, December 4, 2017 3:41:45 PM CET Adrian Hunter wrote:
>> On 04/12/17 16:33, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 04-12-17 15:30, Adrian Hunter wrote:
 On 04/12/17 15:48, Hans de Goede wrote:
> Hi,
>
> Wouldn't it be easier to use the ACPI _DEP tracking for this, e.g.

 It is using _DEP, see acpi_lpss_dep()

> add something like this to the the probe function:
>
>  struct acpi_device = ACPI_COMPANION(device);
>
>  if (acpi_device->dep_unmet)
>  return -EPROBE_DEFER;
>
> No idea if this will work, but if it does work, using the deps described
> in the ACPI tables seems like a better solution then hardcoding this.

 That would not work because there are other devices listed in the _DEP
 method so dep_unmet is always true.  So we are left checking _DEP but only
 for specific device dependencies.
>>>
>>> Ugh, understood thank you for explaining this. Perhaps it is a good idea
>>> to mention in the commit message why acpi_dev->dep_unmet cannot be used
>>> here?
>>
>> dep_unmet predates device links, but now we have device links, they are
>> better anyway.
> 
> Right (they cover PM too, for example), but it would be good to note why
> it is necessary to hardcode the links information in the code.

It isn't entirely necessary to hardcode the links information.  For example,
another possibility is to create device links for all LPSS devices with _DEP
methods that point to other LPSS devices i.e. match against
acpi_lpss_device_ids.  The assumptions would be that all LPSS devices have
drivers so it would be safe to create links between them, and that the
nature of the dependency is correctly represented by a device link.

An advantage of that approach would be that it might work for future
dependencies between LPSS devices without having to add entries to a table.
The disadvantage would be the possibility that creating a device link
somehow turns out not to be the right thing to do.


[PATCH] ARM: dts: introduce the sama5d2 ptc ek board

2017-12-05 Thread Ludovic Desroches
Add the official SAMA5D2 Peripheral Touch Controller Evaluation
Kit board.

Signed-off-by: Ludovic Desroches 
---
 arch/arm/boot/dts/Makefile|   1 +
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 442 ++
 2 files changed, 443 insertions(+)
 create mode 100644 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 043d7c720d0c..ed60582eb1da 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -48,6 +48,7 @@ dtb-$(CONFIG_SOC_AT91SAM9) += \
 dtb-$(CONFIG_SOC_SAM_V7) += \
at91-kizbox2.dtb \
at91-sama5d27_som1_ek.dtb \
+   at91-sama5d2_ptc_ek.dtb \
at91-sama5d2_xplained.dtb \
at91-sama5d3_xplained.dtb \
at91-tse850-3.dtb \
diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts 
b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
new file mode 100644
index ..46e8bb668546
--- /dev/null
+++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
@@ -0,0 +1,442 @@
+/*
+ * at91-sama5d2_ptc_ek.dts - Device Tree file for SAMA5D2 PTC EK board
+ *
+ *  Copyright (C) 2017 Microchip/Atmel,
+ *   2017 Wenyou Yang 
+ *   2017 Ludovic Desroches 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+/dts-v1/;
+#include "sama5d2.dtsi"
+#include "sama5d2-pinfunc.h"
+#include 
+#include 
+
+/ {
+   model = "Atmel SAMA5D2 PTC EK";
+   compatible = "atmel,sama5d2-ptc_ek", "atmel,sama5d2", "atmel,sama5";
+
+   aliases {
+   serial0 = &uart0;
+   i2c0= &i2c0;
+   i2c1= &i2c1;
+   i2c2= &i2c2;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory {
+   reg = <0x2000 0x8>;
+   };
+
+   clocks {
+   slow_xtal {
+   clock-frequency = <32768>;
+   };
+
+   main_xtal {
+   clock-frequency = <2400>;
+   };
+   };
+
+   ahb {
+   usb0: gadget@30 {
+   atmel,vbus-gpio = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_usba_vbus>;
+   status = "okay";
+   };
+
+   usb1: ohci@40 {
+   num-ports = <3>;
+   atmel,vbus-gpio = <0
+  &pioA PIN_PB12 GPIO_ACTIVE_HIGH
+  0
+ >;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_usb_default>;
+   status = "okay";
+   };
+
+   usb2: ehci@50 {
+   status = "okay";
+   };
+
+   ebi: ebi@1000 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_nand_default>;
+   stat

Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

2017-12-05 Thread Pierre Morel

On 05/12/2017 15:04, Cornelia Huck wrote:

On Tue, 5 Dec 2017 08:52:57 +0100
Harald Freudenberger  wrote:


On 12/02/2017 02:30 AM, Tony Krowiak wrote:



I agree with your suggestion that defining a new CPU model feature is probably
the best way to resolve this issue. The question is, should we define a single
feature indicating whether AP instructions are installed and set features bits
for the guest based on whether or not they are set in the linux host, or should
we define additional CPU model features for turning features bits on and off?
I guess it boils down to what behavior is expected for the AP bus running on
the linux guest. Here is a rundown of the facilities bits associated with AP
and how they affect the behavior of the AP bus:

* STFLE.12 indicates whether the AP query function is available. If this bit
   is not set, then the AP bus scan will only test domains 0-15. For example,
   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
   queues 04.0047, 05.0047 and 06.0047 will not be made available.

STFLE 12 is the indication for Query AP Configuration Information (QCI) 
available.

* STFLE.15 indicates whether the AP facilities test function is available. If
   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
   by the AP bus scan will not get bound to any AP device drivers. Since the
   AP matrix model supports only CEX4 and greater, no devices will be bound
   to any driver for a guest.

This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
supports CEX4 and upper then this bit could also act as the indicator for
AP instructions available. Of course if you want to implement pure virtual
full simulated AP without any real AP hardware on the host this bit can't
be the indicator.


It would probably make sense to group these two together. Or is there
any advantage in supporting only a part of it?


* STFLE.65 indicates whether AP interrupts are available. If this bit is not
   set, then the AP bus will use polling instead of using interrupt handlers
   to process AP events.


So, does this indicate "adapter interrupts for AP" only? If so, we
should keep this separate and only enable it when we have the gisa etc.
ready.



Yes, STFLE 65, it is for AP only.

QCI, STFLE 12, is no present on older systems, in this case AP uses TAPQ 
to retrieve information for each AP


So for my point of view, it make sense to separate the three facilities 
to enable migration on older systems.


Pierre


--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany



Re: [PATCH v2] thinkad_acpi: Support the battery wear control

2017-12-05 Thread Christoph Böhmwalder
On Sun, Dec 03, 2017 at 11:56:40PM +0100, Ognjen Galic wrote:
> Add support for the ACPI batteries on newer thinkpad models
> (>Sandy Bridge) that support the setting of start and stop
> thresholds.
> 
> The actual interface to the driver is a extension for the
> existing ACPI battery driver. This was done so that users
> can write transparently to the interface of the ACPI battery
> driver and dont have to use some private interface
> (for ex. /sys/devices/platform/thinkpad_acpi/).
> 
> Two new interfaces are created:
> 
> /sys/class/power_supply/BAT{0,1}/charge_start_threshold
> /sys/class/power_supply/BAT{0,1}/charge_stop_threshold

Just tried this on my X1 Carbon (i7-3667U Ivy Lake):

# cat /sys/class/power_supply/BAT0/charge_stop_threshold
100
# cat /sys/class/power_supply/BAT0/charge_start_threshold
100

That doesn't seem to make any sense.  Is my battery somehow reporting
false values here?  Any way to cross check these values?

--
Regards,
Christoph


RE: [PATCH v2 2/5] ARM: dts: imx53: add srtc node

2017-12-05 Thread Patrick Brünn
>From: Fabio Estevam [mailto:feste...@gmail.com]
>Sent: Dienstag, 5. Dezember 2017 15:14
>On Tue, Dec 5, 2017 at 12:06 PM,   wrote:
>
>> srtc: srtc@53fa4000 {
>> -   compatible = "fsl,imx53-rtc", 
>> "fsl,imx25-rtc";
>> +   compatible = "fsl,imx53-rtc";
>> reg = <0x53fa4000 0x4000>;
>> interrupts = <24>;
>> -   interrupt-parent = <&tzic>;
>> clocks = <&clks IMX5_CLK_SRTC_GATE>;
>> -   clock-names = "ipg";
>
>srtc node has been removed in linux-next.
>
>You need to re-add it.
Thanks for this super-fast responses!
I will wait a few days for more reviewers and then integrate your comments in a 
v3. If nothing major show up I will wait until the imx53.dtsi revert landed in 
Linus tree.

Best regards,
Patrick

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075




Re: [PATCH 06/11] change memory_is_poisoned_16 for aligned error

2017-12-05 Thread Liuwenliang (Abbott Liu)
On Nov 23, 2017  20:30  Russell King - ARM Linux [mailto:li...@armlinux.org.uk] 
 wrote:
>On Thu, Oct 12, 2017 at 11:27:40AM +, Liuwenliang (Lamb) wrote:
>> >> - I don't understand why this is necessary.  memory_is_poisoned_16()
>> >>   already handles unaligned addresses?
>> >>
>> >> - If it's needed on ARM then presumably it will be needed on other
>> >>   architectures, so CONFIG_ARM is insufficiently general.
>> >>
>> >> - If the present memory_is_poisoned_16() indeed doesn't work on ARM,
>> >>   it would be better to generalize/fix it in some fashion rather than
>> >>   creating a new variant of the function.
>>
>>
>> >Yes, I think it will be better to fix the current function rather then
>> >have 2 slightly different copies with ifdef's.
>> >Will something along these lines work for arm? 16-byte accesses are
>> >not too common, so it should not be a performance problem. And
>> >probably modern compilers can turn 2 1-byte checks into a 2-byte check
>> >where safe (x86).
>>
>> >static __always_inline bool memory_is_poisoned_16(unsigned long addr)
>> >{
>> >u8 *shadow_addr = (u8 *)kasan_mem_to_shadow((void *)addr);
>> >
>> >if (shadow_addr[0] || shadow_addr[1])
>> >return true;
>> >/* Unaligned 16-bytes access maps into 3 shadow bytes. */
>> >if (unlikely(!IS_ALIGNED(addr, KASAN_SHADOW_SCALE_SIZE)))
>> >return memory_is_poisoned_1(addr + 15);
>> >return false;
>> >}
>>
>> Thanks for Andrew Morton and Dmitry Vyukov's review.
>> If the parameter addr=0xc008, now in function:
>> static __always_inline bool memory_is_poisoned_16(unsigned long addr)
>> {
>>  --- //shadow_addr = (u16 *)(KASAN_OFFSET+0x1801(=0xc008>>3)) is 
>> not
>>  --- // unsigned by 2 bytes.
>> u16 *shadow_addr = (u16 *)kasan_mem_to_shadow((void *)addr);
>>
>> /* Unaligned 16-bytes access maps into 3 shadow bytes. */
>> if (unlikely(!IS_ALIGNED(addr, KASAN_SHADOW_SCALE_SIZE)))
>> return *shadow_addr || memory_is_poisoned_1(addr + 15);
>>   //here is going to be error on arm, specially when kernel has not 
>> finished yet.
>>   //Because the unsigned accessing cause DataAbort Exception which 
>> is not
>>   //initialized when kernel is starting.
>> return *shadow_addr;
>> }
>>
>> I also think it is better to fix this problem.

>What about using get_unaligned() ?

Thanks for your review.

I think it is good idea to use get_unaligned. But ARMv7 support CONFIG_ 
HAVE_EFFICIENT_UNALIGNED_ACCESS
(arch/arm/Kconfig : select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || 
CPU_V6K || CPU_V7) && MMU).
So on ARMv7, the code:
u16 *shadow_addr = get_unaligned((u16 *)kasan_mem_to_shadow((void *)addr));
equals the code:000
u16 *shadow_addr = (u16 *)kasan_mem_to_shadow((void *)addr);

On ARMv7, if SCRLR.A is 0, unaligned access is OK.  Here is the description 
comes from ARM(r) Architecture Reference
Manual ARMv7-A and ARMv7-R edition :

A3.2.1 Unaligned data access
An ARMv7 implementation must support unaligned data accesses by some load and 
store instructions, as
Table A3-1 shows. Software can set the SCTLR.A bit to control whether a 
misaligned access by one of these
instructions causes an Alignment fault Data abort exception.

Table A3-1 Alignment requirements of load/store instructions
Instructions Alignment check SCTLR.A is 0   
 SCTLR.A is 1

LDRB, LDREXB, LDRBT,
LDRSB, LDRSBT, STRB, None   --
STREXB, STRBT, SWPB, 
TBB 

LDRH, LDRHT, LDRSH, 
LDRSHT, STRH, STRHT,HalfwordUnaligned access
Alignment fault
TBH 

LDREXH, STREXHHalfwordAlignment fault  
Alignment fault

LDR, LDRT, STR, STRT
PUSH, encodings T3 and A2 only Word  Unaligned access   
  Alignment fault
POP, encodings T3 and A2 only

LDREX, STREXWord Alignment fault   
Alignment fault

LDREXD, STREXD DoublewordAlignment fault   
Alignment fault

All forms of LDM and STM,
LDRD, RFE, SRS, STRD, SWP
PUSH, except for encodings 
T3 and A2   Word  Alignment fault   
Alignment fault
POP, except for encodings 
T3 and A2

LDC, LDC2, STC, STC2 Word  Alignment fault  
 Alignment fault

VLDM, VLDR, VPOP,
 VPUSH, VSTM, VSTR Word  Alignment fault   
Alignment fault

VLD1, VLD2, VLD3, VLD4,
 VST1, VST2, VST3, VST4,  Element sizeUnaligned access  
   Alignment fault
 all with standard alignmenta  

VLD1, VLD2, VLD3, VLD4, 
VST1, VST2, VST3, VST4,   As specified by@   Alignment fault 
  Alignment fault  
all with @ specifieda


On ARMv7, the following code can guarantee that if SCRLR.A is 0:
__enable_mmu:
#if defined(CONFIG_ALIGNME

Announce loop-AES-v3.7m file/swap crypto package

2017-12-05 Thread Jari Ruusu
loop-AES changes since previous release:
- Worked around kernel interface changes on 4.14 and 4.15-rc kernels.
- Fixed possible timer delete race condition at loop detach time when key
  scrubbing was enabled.


bzip2 compressed tarball is here:

http://loop-aes.sourceforge.net/loop-AES/loop-AES-v3.7m.tar.bz2
md5sum 288105b86f7733224ddd5f7369b6a025

http://loop-aes.sourceforge.net/loop-AES/loop-AES-v3.7m.tar.bz2.sign

-- 
Jari Ruusu  4096R/8132F189 12D6 4C3A DCDA 0AA4 27BD  ACDF F073 3C80 8132 F189


Re: [PATCH v4 2/5] media: dt-bindings: Add bindings for TDA1997X

2017-12-05 Thread Sakari Ailus
On Wed, Nov 29, 2017 at 01:19:54PM -0800, Tim Harvey wrote:
> Cc: Rob Herring 
> Cc: Sakari Ailus 
> Signed-off-by: Tim Harvey 

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi


Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

2017-12-05 Thread Tony Krowiak

On 12/05/2017 02:52 AM, Harald Freudenberger wrote:

On 12/02/2017 02:30 AM, Tony Krowiak wrote:

On 11/03/2017 04:47 AM, Christian Borntraeger wrote:

On 11/02/2017 07:49 PM, Tony Krowiak wrote:

On 11/02/2017 11:53 AM, Christian Borntraeger wrote:

On 11/02/2017 04:36 PM, Tony Krowiak wrote:

On 11/02/2017 08:08 AM, Christian Borntraeger wrote:

On 10/16/2017 11:25 AM, Martin Schwidefsky wrote:

On Fri, 13 Oct 2017 13:39:04 -0400
Tony Krowiak  wrote:


Sets up the following facilities bits to enable the specified AP
facilities for the guest VM:
   * STFLE.12: Enables the AP Query Configuration Information
   facility. The AP bus running in the guest uses
   the information returned from this instruction
   to configure AP adapters and domains for the
   guest machine.
   * STFLE.15: Indicates the AP facilities test is available.
   The AP bus running in the guest uses the
   information.

Signed-off-by: Tony Krowiak 
---
arch/s390/tools/gen_facilities.c |2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
index 70dd8f1..eeaa7db 100644
--- a/arch/s390/tools/gen_facilities.c
+++ b/arch/s390/tools/gen_facilities.c
@@ -74,8 +74,10 @@ struct facility_def {
8,  /* enhanced-DAT 1 */
9,  /* sense-running-status */
10, /* conditional sske */
+12, /* AP query configuration */
13, /* ipte-range */
14, /* nonquiescing key-setting */
+15, /* AP special-command facility */
73, /* transactional execution */
75, /* access-exception-fetch/store indication */
76, /* msa extension 3 */

With this all KVM guests will always have the AP instructions available, no?
In principles I like this approach, but it differs from the way z/VM does 
things,
there the guest will get an exception if it tries to execute an AP instruction
if there are no AP devices assigned to the guest. I wonder if there is a reason
why z/VM does it the way it does.

A good question. For LPAR it seems that you have AP instructions even if you 
have
no crypto cards.


I don't believe these facilities control whether or not AP instructions will be 
available

to the guest.

This is actually handled by your patch2 enabling the ECA bit.
I think we must decide if we want to be able to disable these instructions
via the cpu model. If yes we must then couple the facilities with the 
enablement.

The ECA.28 bit controls whether instructions are intercepted or interpreted - 
i.e., handled via hardware
virtualization. If set, as is done in patch2, then instructions will be 
interpreted. I don't see how
that affects enabling or disabling AP instructions, unless we don't set ECA.28, 
intercept every instruction
and program check. Am I missing something here?

If we do not set ECA.28 these instructions intercept and we (the hypervisor) 
can then
decide what to do. For example we can give an PIC01 operation exception (illegal
instruction) - thats what we do today.

Now: if we want to be able to migrate a guest from a new kernel back to an old 
kernel,
there must be a way to disable the new behaviour so that the user can configure 
a guest
that does NOT have these 3 instructions. That means, I want to bind the ap 
instruction
to a cpu model feature, so that we only enable ECA.28 and the facility bits, if 
the
feature is enabled in the CPU model. Otherwise we have no control on what 
happens
when the guest issues these instructions.

Imagine what happens if we not do this and you migrate from an identical hw 
with an
identical libvirt/qemu but from a new kernel to an old kernel:

The guest boots starts up on the new kernel
guest kernel: drivers/s390/crypto/ap_bus.c  ap_module_init -> 
ap_instructions_available
checks if the instructions work. They do and now the guest driver assumes that 
all
instructions will continue to work.

Now the guest is migrated back to an old kernel
sooner or later the ap_scan_bus kthread will run to scan the bus (or some 
crypto operation
is started) and the instruction will be rejected with a PIC01. kernel oops.

There are several scenarios that have to be accounted for, such as:
* Migrating from a linux host where both the KVM/kernel and QEMU support AP 
matrix
   devices to a guest host where neither the KVM/kernel nor QEMU support AP 
matrix
   devices;
* Migrating from a linux host where both the KVM/kernel and QEMU support AP 
matrix
   devices to a guest host where the KVM/kernel does not support AP matrix 
devices
   but QEMU does;
* Starting a guest on a linux host where QEMU supports AP matrix devices and
   the KVM/kernel does not;
* etc.

I agree with your suggestion that defining a new CPU model feature is probably
the best way to resolve this issue. The question is, should we define a

Re: [PATCH v2 2/5] ARM: dts: imx53: add srtc node

2017-12-05 Thread Fabio Estevam
On Tue, Dec 5, 2017 at 12:06 PM,   wrote:

> srtc: srtc@53fa4000 {
> -   compatible = "fsl,imx53-rtc", "fsl,imx25-rtc";
> +   compatible = "fsl,imx53-rtc";
> reg = <0x53fa4000 0x4000>;
> interrupts = <24>;
> -   interrupt-parent = <&tzic>;
> clocks = <&clks IMX5_CLK_SRTC_GATE>;
> -   clock-names = "ipg";

srtc node has been removed in linux-next.

You need to re-add it.


[PATCH v3 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint

2017-12-05 Thread Yafang Shao
The TCP/IP transition from TCP_LISTEN to TCP_SYN_RECV and some other
transitions are not traced with tcp_set_state tracepoint.

In order to trace the whole tcp lifespans, two helpers are introduced,
void __tcp_set_state(struct sock *sk, int state);
void sk_state_store(struct sock *sk, int newstate);

When do TCP/IP state transition, we should use these two helpers or use
tcp_set_state() other than assigning a value to sk_state directly.

Signed-off-by: Yafang Shao 
Acked-by: Song Liu 
---
v2->v3: Per suggestion from Marcelo Ricardo Leitner, inverting  __
to sk_state_store. 
---
 include/net/sock.h  |  7 +--
 include/net/tcp.h   |  1 +
 net/ipv4/inet_connection_sock.c |  4 ++--
 net/ipv4/inet_hashtables.c  |  2 +-
 net/ipv4/tcp.c  | 14 +-
 5 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 79e1a2c..e89a098 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2349,18 +2349,21 @@ static inline int sk_state_load(const struct sock *sk)
 }
 
 /**
- * sk_state_store - update sk->sk_state
+ * __sk_state_store - update sk->sk_state
  * @sk: socket pointer
  * @newstate: new state
  *
  * Paired with sk_state_load(). Should be used in contexts where
  * state change might impact lockless readers.
  */
-static inline void sk_state_store(struct sock *sk, int newstate)
+static inline void __sk_state_store(struct sock *sk, int newstate)
 {
smp_store_release(&sk->sk_state, newstate);
 }
 
+/* For tcp_set_state tracepoint */
+void sk_state_store(struct sock *sk, int newstate);
+
 void sock_enable_timestamp(struct sock *sk, int flag);
 int sock_get_timestamp(struct sock *, struct timeval __user *);
 int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 4e09398..cc43ce9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1247,6 +1247,7 @@ static inline bool tcp_checksum_complete(struct sk_buff 
*skb)
"Close Wait","Last ACK","Listen","Closing"
 };
 #endif
+void __tcp_set_state(struct sock *sk, int state);
 void tcp_set_state(struct sock *sk, int state);
 
 void tcp_done(struct sock *sk);
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 4ca46dc..74523c4 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -783,7 +783,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
if (newsk) {
struct inet_connection_sock *newicsk = inet_csk(newsk);
 
-   newsk->sk_state = TCP_SYN_RECV;
+   __tcp_set_state(newsk, TCP_SYN_RECV);
newicsk->icsk_bind_hash = NULL;
 
inet_sk(newsk)->inet_dport = inet_rsk(req)->ir_rmt_port;
@@ -888,7 +888,7 @@ int inet_csk_listen_start(struct sock *sk, int backlog)
return 0;
}
 
-   sk->sk_state = TCP_CLOSE;
+   __tcp_set_state(sk, TCP_CLOSE);
return err;
 }
 EXPORT_SYMBOL_GPL(inet_csk_listen_start);
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index f6f5810..b24cc12 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -544,7 +544,7 @@ bool inet_ehash_nolisten(struct sock *sk, struct sock *osk)
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
} else {
percpu_counter_inc(sk->sk_prot->orphan_count);
-   sk->sk_state = TCP_CLOSE;
+   __tcp_set_state(sk, TCP_CLOSE);
sock_set_flag(sk, SOCK_DEAD);
inet_csk_destroy_sock(sk);
}
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1803116..4ade887 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2036,6 +2036,18 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, 
size_t len, int nonblock,
 }
 EXPORT_SYMBOL(tcp_recvmsg);
 
+void sk_state_store(struct sock *sk, int newstate)
+{
+   trace_tcp_set_state(sk, sk->sk_state, newstate);
+   __sk_state_store(sk, newstate);
+}
+
+void __tcp_set_state(struct sock *sk, int state)
+{
+   trace_tcp_set_state(sk, sk->sk_state, state);
+   sk->sk_state = state;
+}
+
 void tcp_set_state(struct sock *sk, int state)
 {
int oldstate = sk->sk_state;
@@ -2065,7 +2077,7 @@ void tcp_set_state(struct sock *sk, int state)
/* Change state AFTER socket is unhashed to avoid closed
 * socket sitting in hash tables.
 */
-   sk_state_store(sk, state);
+   __sk_state_store(sk, state);
 
 #ifdef STATE_TRACE
SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n", sk, statename[oldstate], 
statename[state]);
-- 
1.8.3.1



Re: [PATCH v2 3/5] rtc: mxc_v2: add driver for i.MX53 SRTC

2017-12-05 Thread Fabio Estevam
On Tue, Dec 5, 2017 at 12:06 PM,   wrote:
> From: Patrick Bruenn 
>
> Add RTC_DRV_MXC_V2 config option
>
> Signed-off-by: Patrick Bruenn 

You should add the Kconfig as part of the patch that introduces the driver.


Re: [PATCH] pata_pdc2027x: Fix coding sytle error

2017-12-05 Thread Bartlomiej Zolnierkiewicz
On Tuesday, December 05, 2017 03:02:13 PM Bartlomiej Zolnierkiewicz wrote:
> On Saturday, November 25, 2017 04:04:07 PM Arvind Yadav wrote:
> > Fix these checkpatch.pl error:
> > ERROR: space prohibited before open square bracket '['.
> > 
> > ERROR: space prohibited after that '~' (ctx:WxW)
> > +   mask &= ~ (1 << (6 + ATA_SHIFT_UDMA));
> > 
> > ERROR: spaces required around that '?' (ctx:VxW)
> > +   long pout_required = board_idx? PDC_133_MHZ:PDC_100_MHZ;
> > 
> > ERROR: that open brace { should be on the previous line
> > +   const struct ata_port_info *ppi[] =
> > +   { &pdc2027x_port_info[board_idx], NULL };
> > 
> > Signed-off-by: Arvind Yadav 
> 
> Acked-by: Bartlomiej Zolnierkiewicz 

PS two small things than still can be fixed:

* s/sytle error/style errors/ in the patch summary

* s/error/errors/ in the patch description

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics



Re: [PATCH v2 4/5] ARM: imx_v4_v5_defconfig: enable RTC_DRV_MXC_V2

2017-12-05 Thread Fabio Estevam
Hi Patrick,


On Tue, Dec 5, 2017 at 12:06 PM,   wrote:

>  arch/arm/configs/imx_v4_v5_defconfig | 1 +

i.mx53 uses imx_v6_v7_defconfig, not imx_v4_v5_defconfig.


Re: Linux 4.9.67

2017-12-05 Thread Greg KH
diff --git a/Documentation/devicetree/bindings/hwmon/jc42.txt 
b/Documentation/devicetree/bindings/hwmon/jc42.txt
index 07a250498fbb..f569db58f64a 100644
--- a/Documentation/devicetree/bindings/hwmon/jc42.txt
+++ b/Documentation/devicetree/bindings/hwmon/jc42.txt
@@ -34,6 +34,10 @@ Required properties:
 
 - reg: I2C address
 
+Optional properties:
+- smbus-timeout-disable: When set, the smbus timeout function will be disabled.
+This is not supported on all chips.
+
 Example:
 
 temp-sensor@1a {
diff --git a/Makefile b/Makefile
index 8e62f9e2a08c..70546af61a0a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 66
+SUBLEVEL = 67
 EXTRAVERSION =
 NAME = Roaring Lionus
 
diff --git a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts 
b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
index 08cce17a25a0..b4575bbaf085 100644
--- a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
+++ b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
@@ -192,7 +192,7 @@
interrupts-extended = <&intc 83 &omap3_pmx_core 0x11a>;
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pins &mmc1_cd>;
-   cd-gpios = <&gpio4 31 IRQ_TYPE_LEVEL_LOW>;  /* gpio127 */
+   cd-gpios = <&gpio4 31 GPIO_ACTIVE_LOW>; /* gpio127 */
vmmc-supply = <&vmmc1>;
bus-width = <4>;
cap-power-off-card;
@@ -249,9 +249,9 @@
OMAP3_CORE1_IOPAD(0x2110, PIN_INPUT | MUX_MODE0)   /* 
cam_xclka.cam_xclka */
OMAP3_CORE1_IOPAD(0x2112, PIN_INPUT | MUX_MODE0)   /* 
cam_pclk.cam_pclk */
 
-   OMAP3_CORE1_IOPAD(0x2114, PIN_INPUT | MUX_MODE0)   /* 
cam_d0.cam_d0 */
-   OMAP3_CORE1_IOPAD(0x2116, PIN_INPUT | MUX_MODE0)   /* 
cam_d1.cam_d1 */
-   OMAP3_CORE1_IOPAD(0x2118, PIN_INPUT | MUX_MODE0)   /* 
cam_d2.cam_d2 */
+   OMAP3_CORE1_IOPAD(0x2116, PIN_INPUT | MUX_MODE0)   /* 
cam_d0.cam_d0 */
+   OMAP3_CORE1_IOPAD(0x2118, PIN_INPUT | MUX_MODE0)   /* 
cam_d1.cam_d1 */
+   OMAP3_CORE1_IOPAD(0x211a, PIN_INPUT | MUX_MODE0)   /* 
cam_d2.cam_d2 */
OMAP3_CORE1_IOPAD(0x211c, PIN_INPUT | MUX_MODE0)   /* 
cam_d3.cam_d3 */
OMAP3_CORE1_IOPAD(0x211e, PIN_INPUT | MUX_MODE0)   /* 
cam_d4.cam_d4 */
OMAP3_CORE1_IOPAD(0x2120, PIN_INPUT | MUX_MODE0)   /* 
cam_d5.cam_d5 */
diff --git a/arch/arm/mach-omap2/pdata-quirks.c 
b/arch/arm/mach-omap2/pdata-quirks.c
index 770216baa737..da310bb779b9 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -162,7 +162,7 @@ static struct ti_st_plat_data wilink7_pdata = {
.nshutdown_gpio = 162,
.dev_name = "/dev/ttyO1",
.flow_cntrl = 1,
-   .baud_rate = 30,
+   .baud_rate = 300,
 };
 
 static struct platform_device wl128x_device = {
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index be9df513141e..e7b0e7ff4c58 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -54,19 +54,15 @@ ENTRY(native_usergs_sysret64)
 ENDPROC(native_usergs_sysret64)
 #endif /* CONFIG_PARAVIRT */
 
-.macro TRACE_IRQS_FLAGS flags:req
+.macro TRACE_IRQS_IRETQ
 #ifdef CONFIG_TRACE_IRQFLAGS
-   bt  $9, \flags  /* interrupts off? */
+   bt  $9, EFLAGS(%rsp)/* interrupts off? */
jnc 1f
TRACE_IRQS_ON
 1:
 #endif
 .endm
 
-.macro TRACE_IRQS_IRETQ
-   TRACE_IRQS_FLAGS EFLAGS(%rsp)
-.endm
-
 /*
  * When dynamic function tracer is enabled it will add a breakpoint
  * to all locations that it is about to modify, sync CPUs, update
@@ -872,13 +868,11 @@ idtentry simd_coprocessor_error   
do_simd_coprocessor_error   has_error_code=0
 ENTRY(native_load_gs_index)
pushfq
DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
-   TRACE_IRQS_OFF
SWAPGS
 .Lgs_change:
movl%edi, %gs
 2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
SWAPGS
-   TRACE_IRQS_FLAGS (%rsp)
popfq
ret
 END(native_load_gs_index)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 3f05c044720b..b24b3c6d686e 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -246,9 +246,14 @@ static inline void kvm_apic_set_ldr(struct kvm_lapic 
*apic, u32 id)
recalculate_apic_map(apic->vcpu->kvm);
 }
 
+static inline u32 kvm_apic_calc_x2apic_ldr(u32 id)
+{
+   return ((id >> 4) << 16) | (1 << (id & 0xf));
+}
+
 static inline void kvm_apic_set_x2apic_id(struct kvm_lapic *apic, u32 id)
 {
-   u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf));
+   u32 ldr = kvm_apic_calc_x2apic_ldr(id);
 
kvm_lapic_set_reg(apic, APIC_ID, id);
kvm_lapic_set_reg(apic, APIC_LDR, ldr);
@@ -2029,6 +2034,7 @@ static int kvm_apic_state_fixup(struct kvm_vcpu *vcpu,
 {
if (apic_x2apic_mode(vcpu->ar

Re: [PATCH] MAINTAINERS: kgdb: Replace Jason with Daniel

2017-12-05 Thread Lee Jones
On Tue, 05 Dec 2017, Daniel Thompson wrote:

> ... with many, many thanks for Jason for all his hard work.
> 
> Cc: Jason Wessel 
> Signed-off-by: Daniel Thompson 
> ---
> 
> Notes:
> Over the years Jason has become increasingly hard to get hold off
> and I think he must now be regarded as inactive.
> 
> Patches in kgdb-next (mine as it happens) have been there for over a
> year without a corresponding pull request and a couple of architecture
> specific kgdb fixes have ended up missing a release cycle (or two) as
> the architecture maintainer waits for an Acked-by from Jason.
> 
> In the past I've had to rely on Andrew M. to land my own changes to
> kgdb and in the v4.14 cycle you'll find my Acked-by on b8347c219649
> ("x86/debug: Handle warnings before the notifier chain, to fix KGDB
> crash"). That I was sharing surrogate acks convinced me we need a
> change here and I've offered Jason help via private e-mail without
> reply.
> 
> So, I really would prefer it it if this patch listed me as a
> co-maintainer or, failing that, as least had Jason's blessing... but
> it doesn't. I certainly suggest this patch takes a long time in
> review, and if it doesn't attract Jason's attention then I can only
> reiterate what is says in the commit log: Thanks Jason!
> 
>  MAINTAINERS | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

It looks like Jason has been inactive in all aspects of upstream
maintainership and as a contributor for well over a year now.

I strongly support the move to make Daniel KGDB Maintainer:

  Acked-by: Lee Jones 

(NB: If this patch does not receive any opposition by the end of this
cycle, it would be my pleasure to take it through one of my trees.) 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [patch 55/60] x86/mm: Use INVPCID for __native_flush_tlb_single()

2017-12-05 Thread Peter Zijlstra
On Tue, Dec 05, 2017 at 05:51:28AM -0800, Dave Hansen wrote:
> On 12/04/2017 02:51 PM, Peter Zijlstra wrote:
> > We should find some of the benchmarks that were used to determine
> > tlb_single_page_flush_ceiling and measure. I've not gotten around to
> > doing either.
> > 
> > Someone called Dave Hansen did that patch and might still have something
> > lying around to help with that:
> > 
> >   a5102476a24b ("x86/mm: Set TLB flush tunable to sane value (33)")
> 
> I hate git. :)

:-)

> But, yeah, we have certainly changed enough variables to necessitate
> measuring it again.

Its more than that, I think much of that could show if it makes sense to
use invpcid_flush_one() at all.


[PATCH v2 5/5] rtc: add mxc driver for i.MX53 SRTC

2017-12-05 Thread linux-kernel-dev
From: Patrick Bruenn 

Neither rtc-imxdi, rtc-mxc nor rtc-snvs are compatible with i.MX53.

This is driver enables support for the low power domain SRTC features:
- 32-bit MSB of non-rollover time counter
- 32-bit alarm register

Based on:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/rtc/rtc-mxc_v2.c?h=imx_2.6.35_11.09.01

Signed-off-by: Patrick Bruenn 

---

v2:
- have seperate patches for dt-binding, CONFIG option, imx53.dtsi and driver
- add SPDX-License-Identifier and cleanup copyright notice
- replace __raw_readl/writel() with readl/writel()
- fix PM_SLEEP callbacks
- add CONFIG_RTC_DRV_MXC_V2 to build rtc-mxc_v2.c
- remove misleading or obvious comments and fix style of the remaining
- avoid endless loop while waiting for hw
- implement consistent locking; make spinlock a member of dev struct
- enable clk only for register accesses
- remove all udelay() calls since they are obsolete or redundant
  (we are already waiting for register flags to change)
- init platform_data before registering irq callback
- let set_time() fail, when 32 bit rtc counter exceeded
- make names more consistent
- cleanup and reorder includes
- cleanup and remove unused defines

To: Alessandro Zummo 
To: Alexandre Belloni 
Cc: Rob Herring 
Cc: Mark Rutland  (maintainer:OPEN FIRMWARE AND FLATTENED 
DEVICE TREE BINDINGS)
Cc: linux-...@vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)
Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE 
TREE BINDINGS)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: Fabio Estevam 
Cc: Juergen Borleis 
Cc: Noel Vellemans 
Cc: Shawn Guo 
Cc: Sascha Hauer  (maintainer:ARM/FREESCALE IMX / MXC 
ARM ARCHITECTURE)
Cc: Russell King  (maintainer:ARM PORT)
Cc: linux-arm-ker...@lists.infradead.org (moderated list:ARM/FREESCALE IMX / 
MXC ARM ARCHITECTURE)

Cc: Philippe Ombredanne 
Cc: Lothar Waßmann 
---
 drivers/rtc/Makefile |   1 +
 drivers/rtc/rtc-mxc_v2.c | 433 +++
 2 files changed, 434 insertions(+)
 create mode 100644 drivers/rtc/rtc-mxc_v2.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index f2f50c11dc38..dcf60e61ae5c 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -106,6 +106,7 @@ obj-$(CONFIG_RTC_DRV_MT6397)+= rtc-mt6397.o
 obj-$(CONFIG_RTC_DRV_MT7622)   += rtc-mt7622.o
 obj-$(CONFIG_RTC_DRV_MV)   += rtc-mv.o
 obj-$(CONFIG_RTC_DRV_MXC)  += rtc-mxc.o
+obj-$(CONFIG_RTC_DRV_MXC_V2)   += rtc-mxc_v2.o
 obj-$(CONFIG_RTC_DRV_NUC900)   += rtc-nuc900.o
 obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
 obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o
diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
new file mode 100644
index ..c5a6d2c293bb
--- /dev/null
+++ b/drivers/rtc/rtc-mxc_v2.c
@@ -0,0 +1,433 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Real Time Clock (RTC) Driver for i.MX53
+ * Copyright (c) 2004-2011 Freescale Semiconductor, Inc.
+ * Copyright (c) 2017 Beckhoff Automation GmbH & Co. KG
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SRTC_LPPDR_INIT   0x41736166   /* init for glitch detect */
+
+#define SRTC_LPCR_EN_LP   BIT(3)   /* lp enable */
+#define SRTC_LPCR_WAE BIT(4)   /* lp wakeup alarm enable */
+#define SRTC_LPCR_ALP BIT(7)   /* lp alarm flag */
+#define SRTC_LPCR_NSA BIT(11)  /* lp non secure access */
+#define SRTC_LPCR_NVE BIT(14)  /* lp non valid state exit bit */
+#define SRTC_LPCR_IE  BIT(15)  /* lp init state exit bit */
+
+#define SRTC_LPSR_ALP BIT(3)   /* lp alarm flag */
+#define SRTC_LPSR_NVESBIT(14)  /* lp non-valid state exit status */
+#define SRTC_LPSR_IES BIT(15)  /* lp init state exit status */
+
+#define SRTC_LPSCMR0x00/* LP Secure Counter MSB Reg */
+#define SRTC_LPSCLR0x04/* LP Secure Counter LSB Reg */
+#define SRTC_LPSAR 0x08/* LP Secure Alarm Reg */
+#define SRTC_LPCR  0x10/* LP Control Reg */
+#define SRTC_LPSR  0x14/* LP Status Reg */
+#define SRTC_LPPDR 0x18/* LP Power Supply Glitch Detector Reg */
+
+/* max. number of retries to read registers, 120 was max during test */
+#define REG_READ_TIMEOUT 2000
+
+struct mxc_rtc_data {
+   struct rtc_device *rtc;
+   void __iomem *ioaddr;
+   struct clk *clk;
+   spinlock_t lock; /* protects register access */
+   int irq;
+};
+
+/*
+ * This function does write synchronization for writes to the lp srtc block.
+ * To take care of the asynchronous CKIL clock, all writes from the IP domain
+ * will be synchronized to the CKIL domain.
+ * The caller should hold the pdata->lock
+ */
+static inline void mxc_rtc_sync_lp_locked(void __iomem *ioaddr)
+{
+   unsigned int i;
+
+   /* Wait for 3 CKIL cycles */
+   for (i = 0; i < 3; i++) {
+   const u32 count = readl(ioaddr + SRTC_LPSCLR);
+   unsigned int timeout = REG_READ_TIMEOUT;
+
+   while

[PATCH v2 4/5] ARM: imx_v4_v5_defconfig: enable RTC_DRV_MXC_V2

2017-12-05 Thread linux-kernel-dev
From: Patrick Bruenn 

Enable SRTC driver for i.MX53 in default config

Signed-off-by: Patrick Bruenn 

---

To: Shawn Guo 
To: Sascha Hauer  (maintainer:ARM/FREESCALE IMX / MXC 
ARM ARCHITECTURE)

Cc: Alessandro Zummo 
Cc: Alexandre Belloni 
Cc: Rob Herring 
Cc: Mark Rutland  (maintainer:OPEN FIRMWARE AND FLATTENED 
DEVICE TREE BINDINGS)
Cc: linux-...@vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)
Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE 
TREE BINDINGS)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: Fabio Estevam 
Cc: Juergen Borleis 
Cc: Noel Vellemans 
Cc: Russell King  (maintainer:ARM PORT)
Cc: linux-arm-ker...@lists.infradead.org (moderated list:ARM/FREESCALE IMX / 
MXC ARM ARCHITECTURE)

Cc: Philippe Ombredanne 
Cc: Lothar Waßmann 
---
 arch/arm/configs/imx_v4_v5_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/imx_v4_v5_defconfig 
b/arch/arm/configs/imx_v4_v5_defconfig
index ca0f13cafe38..b48efd5ff8a7 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -167,6 +167,7 @@ CONFIG_RTC_DRV_PCF8563=y
 CONFIG_RTC_DRV_IMXDI=y
 CONFIG_RTC_DRV_MC13XXX=y
 CONFIG_RTC_DRV_MXC=y
+CONFIG_RTC_DRV_MXC_V2=y
 CONFIG_DMADEVICES=y
 CONFIG_IMX_DMA=y
 CONFIG_IMX_SDMA=y
-- 
2.11.0


Linux 4.14.4

2017-12-05 Thread Greg KH
I'm announcing the release of the 4.14.4 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/hwmon/jc42.txt|4 
 Makefile|2 
 arch/arm64/Makefile |3 
 arch/arm64/include/asm/module.h |   46 +
 arch/arm64/kernel/Makefile  |3 
 arch/arm64/kernel/ftrace-mod.S  |   18 --
 arch/arm64/kernel/ftrace.c  |   14 -
 arch/arm64/kernel/module-plts.c |   50 +-
 arch/arm64/kernel/module.lds|1 
 arch/powerpc/kernel/misc_64.S   |2 
 arch/powerpc/mm/hash_native_64.c|   15 +
 arch/s390/include/asm/elf.h |   15 -
 arch/x86/entry/entry_64.S   |   10 -
 arch/x86/include/asm/pgtable.h  |6 
 arch/x86/kvm/lapic.c|   12 +
 arch/x86/kvm/svm.c  |2 
 arch/x86/kvm/vmx.c  |2 
 arch/x86/kvm/x86.c  |5 
 crypto/af_alg.c |   21 +-
 crypto/algif_aead.c |   56 --
 crypto/algif_skcipher.c |   23 +-
 crypto/skcipher.c   |3 
 drivers/acpi/ec.c   |   69 +---
 drivers/acpi/internal.h |1 
 drivers/acpi/scan.c |   21 ++
 drivers/dax/device.c|   12 +
 drivers/dma-buf/reservation.c   |   56 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h |   20 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c|   38 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c|6 
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |6 
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c |2 
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  |   15 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   |   15 +
 drivers/gpu/drm/amd/amdgpu/soc15.c  |5 
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   |2 
 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c |4 
 drivers/gpu/drm/drm_edid.c  |   12 +
 drivers/gpu/drm/drm_fb_helper.c |4 
 drivers/gpu/drm/drm_vblank.c|6 
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c   |5 
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c |3 
 drivers/gpu/drm/i915/gvt/gtt.c  |6 
 drivers/gpu/drm/i915/i915_drv.c |2 
 drivers/gpu/drm/i915/intel_fbdev.c  |   10 -
 drivers/gpu/drm/i915/intel_hdmi.c   |3 
 drivers/gpu/drm/i915/intel_i2c.c|4 
 drivers/gpu/drm/i915/intel_uncore.c |   13 +
 drivers/gpu/drm/i915/intel_uncore.h |1 
 drivers/gpu/drm/omapdrm/dss/dpi.c   |4 
 drivers/gpu/drm/omapdrm/dss/hdmi4_core.c|   23 ++
 drivers/gpu/drm/panel/panel-simple.c|2 
 drivers/gpu/drm/radeon/atombios_dp.c|   38 ++--
 drivers/gpu/drm/radeon/radeon_fb.c  |1 
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c|   13 +
 drivers/gpu/drm/ttm/ttm_bo.c|   43 ++---
 drivers/gpu/drm/ttm/ttm_bo_util.c   |1 
 drivers/gpu/drm/vc4/vc4_hdmi.c  |3 
 drivers/hwmon/jc42.c|   21 ++
 drivers/i2c/busses/i2c-i801.c   |3 
 drivers/infiniband/core/umem.c  |2 
 drivers/infiniband/core/user_mad.c  |   11 +
 drivers/infiniband/hw/hfi1/mad.c|7 
 drivers/md/bcache/alloc.c   |2 
 drivers/md/bcache/extents.c |2 
 drivers/md/bcache/journa

Re: Linux 4.14.4

2017-12-05 Thread Greg KH
diff --git a/Documentation/devicetree/bindings/hwmon/jc42.txt 
b/Documentation/devicetree/bindings/hwmon/jc42.txt
index 07a250498fbb..f569db58f64a 100644
--- a/Documentation/devicetree/bindings/hwmon/jc42.txt
+++ b/Documentation/devicetree/bindings/hwmon/jc42.txt
@@ -34,6 +34,10 @@ Required properties:
 
 - reg: I2C address
 
+Optional properties:
+- smbus-timeout-disable: When set, the smbus timeout function will be disabled.
+This is not supported on all chips.
+
 Example:
 
 temp-sensor@1a {
diff --git a/Makefile b/Makefile
index ede4de0d8634..ba1648c093fe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 3
+SUBLEVEL = 4
 EXTRAVERSION =
 NAME = Petit Gorille
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 939b310913cf..3eb4397150df 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -77,9 +77,6 @@ endif
 
 ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
 KBUILD_LDFLAGS_MODULE  += -T $(srctree)/arch/arm64/kernel/module.lds
-ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
-KBUILD_LDFLAGS_MODULE  += $(objtree)/arch/arm64/kernel/ftrace-mod.o
-endif
 endif
 
 # Default value
diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h
index 19bd97671bb8..4f766178fa6f 100644
--- a/arch/arm64/include/asm/module.h
+++ b/arch/arm64/include/asm/module.h
@@ -32,7 +32,7 @@ struct mod_arch_specific {
struct mod_plt_sec  init;
 
/* for CONFIG_DYNAMIC_FTRACE */
-   void*ftrace_trampoline;
+   struct plt_entry*ftrace_trampoline;
 };
 #endif
 
@@ -45,4 +45,48 @@ extern u64 module_alloc_base;
 #define module_alloc_base  ((u64)_etext - MODULES_VSIZE)
 #endif
 
+struct plt_entry {
+   /*
+* A program that conforms to the AArch64 Procedure Call Standard
+* (AAPCS64) must assume that a veneer that alters IP0 (x16) and/or
+* IP1 (x17) may be inserted at any branch instruction that is
+* exposed to a relocation that supports long branches. Since that
+* is exactly what we are dealing with here, we are free to use x16
+* as a scratch register in the PLT veneers.
+*/
+   __le32  mov0;   /* movn x16, #0x*/
+   __le32  mov1;   /* movk x16, #0x, lsl #16   */
+   __le32  mov2;   /* movk x16, #0x, lsl #32   */
+   __le32  br; /* br   x16 */
+};
+
+static inline struct plt_entry get_plt_entry(u64 val)
+{
+   /*
+* MOVK/MOVN/MOVZ opcode:
+* ++++---+-+-+
+* | sf[31] | opc[30:29] | 100101 | hw[22:21] | imm16[20:5] | Rd[4:0] |
+* ++++---+-+-+
+*
+* Rd := 0x10 (x16)
+* hw := 0b00 (no shift), 0b01 (lsl #16), 0b10 (lsl #32)
+* opc:= 0b11 (MOVK), 0b00 (MOVN), 0b10 (MOVZ)
+* sf := 1 (64-bit variant)
+*/
+   return (struct plt_entry){
+   cpu_to_le32(0x92800010 | (((~val  ) & 0x)) << 5),
+   cpu_to_le32(0xf2a00010 | ((( val >> 16) & 0x)) << 5),
+   cpu_to_le32(0xf2c00010 | ((( val >> 32) & 0x)) << 5),
+   cpu_to_le32(0xd61f0200)
+   };
+}
+
+static inline bool plt_entries_equal(const struct plt_entry *a,
+const struct plt_entry *b)
+{
+   return a->mov0 == b->mov0 &&
+  a->mov1 == b->mov1 &&
+  a->mov2 == b->mov2;
+}
+
 #endif /* __ASM_MODULE_H */
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 0029e13adb59..2f5ff2a65db3 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -63,6 +63,3 @@ extra-y   += $(head-y) 
vmlinux.lds
 ifeq ($(CONFIG_DEBUG_EFI),y)
 AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\""
 endif
-
-# will be included by each individual module but not by the core kernel itself
-extra-$(CONFIG_DYNAMIC_FTRACE) += ftrace-mod.o
diff --git a/arch/arm64/kernel/ftrace-mod.S b/arch/arm64/kernel/ftrace-mod.S
deleted file mode 100644
index 00c4025be4ff..
--- a/arch/arm64/kernel/ftrace-mod.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (C) 2017 Linaro Ltd 
- *
- * 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.
- */
-
-#include 
-#include 
-
-   .section".text.ftrace_trampoline", "ax"
-   .align  3
-0: .quad   0
-__ftrace_trampoline:
-   ldr x16, 0b
-   br  x16
-ENDPROC(__ftrace_trampoline)
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index c13b1fca0e5b..50986e388d2b 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/k

[PATCH v2 0/5] add mxc driver for i.MX53 SRTC

2017-12-05 Thread linux-kernel-dev
From: Patrick Bruenn 

Neither rtc-imxdi, rtc-mxc nor rtc-snvs are compatible with i.MX53.

This is driver enables support for the low power domain SRTC features:
- 32-bit MSB of non-rollover time counter
- 32-bit alarm register

Based on:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/rtc/rtc-mxc_v2.c?h=imx_2.6.35_11.09.01

v2:
- have seperate patches for dt-binding, CONFIG option, imx53.dtsi and driver
- add SPDX-License-Identifier and cleanup copyright notice
- replace __raw_readl/writel() with readl/writel()
- fix PM_SLEEP callbacks
- add CONFIG_RTC_DRV_MXC_V2 to build rtc-mxc_v2.c
- remove misleading or obvious comments and fix style of the remaining
- avoid endless loop while waiting for hw
- implement consistent locking; make spinlock a member of dev struct
- enable clk only for register accesses
- remove all udelay() calls since they are obsolete or redundant
  (we are already waiting for register flags to change)
- init platform_data before registering irq callback
- let set_time() fail, when 32 bit rtc counter exceeded
- make names more consistent
- cleanup and reorder includes
- cleanup and remove unused defines

To: Alessandro Zummo 
To: Alexandre Belloni 
Cc: Rob Herring 
Cc: Mark Rutland  (maintainer:OPEN FIRMWARE AND FLATTENED 
DEVICE TREE BINDINGS)
Cc: linux-...@vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)
Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE 
TREE BINDINGS)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: Fabio Estevam 
Cc: Juergen Borleis 
Cc: Noel Vellemans 
Cc: Shawn Guo 
Cc: Sascha Hauer  (maintainer:ARM/FREESCALE IMX / MXC 
ARM ARCHITECTURE)
Cc: Russell King  (maintainer:ARM PORT)
Cc: linux-arm-ker...@lists.infradead.org (moderated list:ARM/FREESCALE IMX / 
MXC ARM ARCHITECTURE)

Cc: Philippe Ombredanne 
Cc: Lothar Waßmann 

Patrick Bruenn (5):
  dt-bindings: rtc: add bindings for i.MX53 SRTC
  ARM: dts: imx53: add srtc node
  rtc: mxc_v2: add driver for i.MX53 SRTC
  ARM: imx_v4_v5_defconfig: enable RTC_DRV_MXC_V2
  rtc: add mxc driver for i.MX53 SRTC

 .../devicetree/bindings/rtc/rtc-mxc_v2.txt |  17 +
 arch/arm/boot/dts/imx53.dtsi   |   4 +-
 arch/arm/configs/imx_v4_v5_defconfig   |   1 +
 drivers/rtc/Kconfig|  10 +
 drivers/rtc/Makefile   |   1 +
 drivers/rtc/rtc-mxc_v2.c   | 433 +
 6 files changed, 463 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt
 create mode 100644 drivers/rtc/rtc-mxc_v2.c

-- 
2.11.0


[PATCH v2 1/5] dt-bindings: rtc: add bindings for i.MX53 SRTC

2017-12-05 Thread linux-kernel-dev
From: Patrick Bruenn 

Document the binding for i.MX53 SRTC implemented by rtc-mxc_v2

Signed-off-by: Patrick Bruenn 

---

To: Alessandro Zummo 
To: Alexandre Belloni 

Cc: Rob Herring 
Cc: Mark Rutland  (maintainer:OPEN FIRMWARE AND FLATTENED 
DEVICE TREE BINDINGS)
Cc: linux-...@vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)
Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE 
TREE BINDINGS)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: Fabio Estevam 
Cc: Juergen Borleis 
Cc: Noel Vellemans 
Cc: Shawn Guo 
Cc: Sascha Hauer  (maintainer:ARM/FREESCALE IMX / MXC 
ARM ARCHITECTURE)
Cc: Russell King  (maintainer:ARM PORT)
Cc: linux-arm-ker...@lists.infradead.org (moderated list:ARM/FREESCALE IMX / 
MXC ARM ARCHITECTURE)

Cc: Philippe Ombredanne 
Cc: Lothar Waßmann 
---
 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt

diff --git a/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt 
b/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt
new file mode 100644
index ..796e7f4995db
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt
@@ -0,0 +1,17 @@
+* i.MX53 Real Time Clock controller
+
+Required properties:
+- compatible: should be: "fsl,imx53-rtc"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- clocks: should contain the phandle for the rtc clock
+- interrupts: rtc alarm interrupt
+
+Example:
+
+srtc@53fa4000 {
+   compatible = "fsl,imx53-rtc";
+   reg = <0x53fa4000 0x4000>;
+   interrupts = <24>;
+   clocks = <&clks IMX5_CLK_SRTC_GATE>;
+};
-- 
2.11.0


[PATCH v2 3/5] rtc: mxc_v2: add driver for i.MX53 SRTC

2017-12-05 Thread linux-kernel-dev
From: Patrick Bruenn 

Add RTC_DRV_MXC_V2 config option

Signed-off-by: Patrick Bruenn 

---

To: Alessandro Zummo 
To: Alexandre Belloni 

Cc: Rob Herring 
Cc: Mark Rutland  (maintainer:OPEN FIRMWARE AND FLATTENED 
DEVICE TREE BINDINGS)
Cc: linux-...@vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)
Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE 
TREE BINDINGS)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: Fabio Estevam 
Cc: Juergen Borleis 
Cc: Noel Vellemans 
Cc: Shawn Guo 
Cc: Sascha Hauer  (maintainer:ARM/FREESCALE IMX / MXC 
ARM ARCHITECTURE)
Cc: Russell King  (maintainer:ARM PORT)
Cc: linux-arm-ker...@lists.infradead.org (moderated list:ARM/FREESCALE IMX / 
MXC ARM ARCHITECTURE)

Cc: Philippe Ombredanne 
Cc: Lothar Waßmann 
---
 drivers/rtc/Kconfig | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index b59a31b079a5..440edebf5c71 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1689,6 +1689,16 @@ config RTC_DRV_MXC
   This driver can also be built as a module, if so, the module
   will be called "rtc-mxc".
 
+config RTC_DRV_MXC_V2
+   tristate "Freescale MXC Real Time Clock for i.MX53"
+   depends on ARCH_MXC
+   help
+  If you say yes here you get support for the Freescale MXC
+  SRTC module in i.MX53 processor.
+
+  This driver can also be built as a module, if so, the module
+  will be called "rtc-mxc_v2".
+
 config RTC_DRV_SNVS
tristate "Freescale SNVS RTC support"
select REGMAP_MMIO
-- 
2.11.0


[PATCH v2 2/5] ARM: dts: imx53: add srtc node

2017-12-05 Thread linux-kernel-dev
From: Patrick Bruenn 

rtc-mxc_v2 driver will add support for the i.MX53 SRTC

Signed-off-by: Patrick Bruenn 

---

To: Shawn Guo 
To: Sascha Hauer  (maintainer:ARM/FREESCALE IMX / MXC 
ARM ARCHITECTURE)

Cc: Alessandro Zummo 
Cc: Alexandre Belloni 
Cc: Rob Herring 
Cc: Mark Rutland  (maintainer:OPEN FIRMWARE AND FLATTENED 
DEVICE TREE BINDINGS)
Cc: linux-...@vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)
Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE 
TREE BINDINGS)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: Fabio Estevam 
Cc: Juergen Borleis 
Cc: Noel Vellemans 
Cc: Russell King  (maintainer:ARM PORT)
Cc: linux-arm-ker...@lists.infradead.org (moderated list:ARM/FREESCALE IMX / 
MXC ARM ARCHITECTURE)

Cc: Philippe Ombredanne 
Cc: Lothar Waßmann 
---
 arch/arm/boot/dts/imx53.dtsi | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 589a67c5f796..e4ca9d9ba2fe 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -434,12 +434,10 @@
};
 
srtc: srtc@53fa4000 {
-   compatible = "fsl,imx53-rtc", "fsl,imx25-rtc";
+   compatible = "fsl,imx53-rtc";
reg = <0x53fa4000 0x4000>;
interrupts = <24>;
-   interrupt-parent = <&tzic>;
clocks = <&clks IMX5_CLK_SRTC_GATE>;
-   clock-names = "ipg";
};
 
iomuxc: iomuxc@53fa8000 {
-- 
2.11.0


Re: [RFC 00/19] KVM: s390/crypto/vfio: guest dedicated crypto adapters

2017-12-05 Thread Cornelia Huck
On Mon, 27 Nov 2017 19:39:32 -0500
Tony Krowiak  wrote:

> On 11/22/2017 08:47 AM, Cornelia Huck wrote:
> > On Tue, 21 Nov 2017 11:08:01 -0500
> > Tony Krowiak  wrote:
> >
> >  
> >> I am not quite sure what you are asking, but I'll attempt to answer
> >> what I think you're asking. A new type of mediated matrix device
> >> will be introduced to configure a virtual matrix for a guest that
> >> provides the interfaces to map a virtual adapter/domain ID to one
> >> or more real adapter/domain IDs. If by virtualization facility,
> >> you are talking about the VFIO AP matrix driver, then yes,
> >> the driver will handle ioctl requests based on the type of the
> >> mediated matrix device through which the request was submitted:
> >>
> >> If the request is to configure the KVM guest's matrix:
> >>
> >> * If the mediated matrix device type is passthrough:
> >> * Do validation of matrix
> >> * Configure the APM, AQM and ADM in the KVM guest's CRYCB
> >>   according to the configuration specified via the mediated
> >>   device's sysfs attribute files.
> >> * If the mediated matrix device type is virtual:
> >> * Do validation of matrix
> >> * No need to configure CRYCB since all instructions will be
> >>   intercepted  
> > Ok, so we would have two distinct paths here...  
> It depends upon what you mean by two distinct paths. Configuring the
> mediated device would require a new mediated device type for virtualized
> AP matrices. The ioctl for configuring the KVM guest's CRYCB would
> require an additional check to determine whether the CRYCB need be
> configured or not.

Yes, the new type makes this distinct enough so that we can think about
this later.

> >  
> >> If the request is to execute an intercepted AP instruction:
> >>
> >> * If the mediated matrix device type is passthrough:
> >> * Forward the instruction to the AP device and return the
> >>   result to QEMU.
> >>
> >> * If the mediated matrix device type is virtual:
> >>
> >> * Retrieve all of the real APQNs mapped to the virtual
> >>   adapter and domain IDs configured in the mediated matrix
> >>   device's sysfs attribute files
> >> * If there is more than one APQN mapping, then determine
> >>   which would be best to use - algorithm TBD
> >> * Forward the instruction to the AP device and return the
> >>   result.  
> > ...and two distinct paths for most instructions here as well.  
> The driver would require additional ioctls to handle
> interception of all AP instructions for virtual matrices and additional
> code to remap virtual APQNs to real APQNs and determine which real APQN
> to which intercepted instructions should be forwarded.
> >  
> >> Of course, these are just preliminary ideas at this time.
> >> I've only prototyped the sysfs configuration interfaces. No
> >> back end prototyping has been undertaken yet. If the ideas do
> >> not pan out, however; I think virtualization can be introduced
> >> as an independent design.  
> > Yes, let's cross that bridge when we get to it.  
> That is the plan. Given Pierre's objections, I thought it might help
> to touch on this.

OK, so I admit that I lost track a bit. Are there any remaining issues
beyond the feature handling? Would it make sense to post a v2?


Linux 4.9.67

2017-12-05 Thread Greg KH
I'm announcing the release of the 4.9.67 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/hwmon/jc42.txt|4 
 Makefile|2 
 arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts   |8 
 arch/arm/mach-omap2/pdata-quirks.c  |2 
 arch/x86/entry/entry_64.S   |   10 -
 arch/x86/kvm/lapic.c|   12 +
 arch/x86/kvm/svm.c  |2 
 arch/x86/kvm/vmx.c  |2 
 arch/x86/kvm/x86.c  |5 
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c|   38 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c |2 
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  |2 
 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c |4 
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c |3 
 drivers/gpu/drm/i915/intel_i2c.c|4 
 drivers/gpu/drm/panel/panel-simple.c|2 
 drivers/gpu/drm/radeon/atombios_dp.c|   38 ++--
 drivers/gpu/drm/radeon/radeon_fb.c  |1 
 drivers/gpu/drm/ttm/ttm_bo_util.c   |1 
 drivers/hwmon/jc42.c|   21 ++
 drivers/i2c/busses/i2c-i801.c   |3 
 drivers/md/bcache/alloc.c   |2 
 drivers/md/bcache/extents.c |2 
 drivers/md/bcache/journal.c |2 
 drivers/mfd/twl4030-power.c |1 
 drivers/misc/eeprom/at24.c  |   19 ++
 drivers/mmc/core/bus.c  |3 
 drivers/mmc/core/mmc.c  |2 
 drivers/mmc/core/sd.c   |2 
 drivers/nvme/host/nvme.h|2 
 drivers/nvme/host/pci.c |2 
 fs/btrfs/extent-tree.c  |   14 -
 fs/nfs/dir.c|3 
 fs/nfsd/nfs4state.c |   99 
 include/linux/mm.h  |1 
 include/uapi/linux/bcache.h |2 
 mm/huge_memory.c|   19 --
 mm/hugetlb.c|8 
 mm/madvise.c|4 
 mm/mmap.c   |8 
 mm/page_alloc.c |9 -
 41 files changed, 249 insertions(+), 121 deletions(-)

Adam Ford (4):
  ARM: dts: LogicPD Torpedo: Fix camera pin mux
  ARM: dts: omap3: logicpd-torpedo-37xx-devkit: Fix MMC1 cd-gpio
  mfd: twl4030-power: Fix pmic for boards that need vmmc1 on reboot
  ARM: OMAP2+: Fix WL1283 Bluetooth Baud Rate

Adrian Hunter (1):
  mmc: core: Do not leave the block driver in a suspended state

Alex Deucher (1):
  Revert "drm/radeon: dont switch vt on suspend"

Bartosz Golaszewski (1):
  eeprom: at24: correctly set the size for at24mac402

Bastian Stender (1):
  mmc: core: prepend 0x to OCR entry in sysfs

Christian König (1):
  drm/ttm: once more fix ttm_buffer_object_transfer

Dan Carpenter (2):
  drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs()
  drm/amdgpu: Potential uninitialized variable in 
amdgpu_vm_update_directories()

Dan Williams (1):
  mm, hugetlbfs: introduce ->split() to vm_operations_struct

Dr. David Alan Gilbert (2):
  KVM: lapic: Split out x2apic ldr calculation
  KVM: lapic: Fixup LDR on load in x2apic

Greg Kroah-Hartman (2):
  Revert "x86/entry/64: Add missing irqflags tracing to 
native_load_gs_index()"
  Linux 4.9.67

Hans de Goede (1):
  i2c: i801: Fix Failed to allocate irq -2147483648 error

Heiner Kallweit (2):
  eeprom: at24: fix reading from 24MAC402/24MAC602
  eeprom: at24: check at24_read/write arguments

Huacai Chen (1):
  bcache: Fix building error on MIPS

Jeff Lien (1):
  nvme-pci: add quirk for delay before CHK RDY for WDC SN200

Jonathan Liu (1):
  drm/panel: simple: Add missing panel_simple_unprepare() calls

Josef Bacik (1):
  btrfs: clear space cache inod

[PATCH 1/3 v3] kernel: make groups_sort globally visible

2017-12-05 Thread Thiago Rafael Becker
In preparation to move group_info sorting to the caller,
make group_sort globally visible.

Signed-off-by: Thiago Rafael Becker 
---
 include/linux/cred.h | 1 +
 kernel/groups.c  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/cred.h b/include/linux/cred.h
index 099058e..6312865 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -83,6 +83,7 @@ extern int set_current_groups(struct group_info *);
 extern void set_groups(struct cred *, struct group_info *);
 extern int groups_search(const struct group_info *, kgid_t);
 extern bool may_setgroups(void);
+extern void groups_sort(struct group_info *);
 
 /*
  * The security context of a task
diff --git a/kernel/groups.c b/kernel/groups.c
index e357bc8..4c9c9ed 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -86,11 +86,13 @@ static int gid_cmp(const void *_a, const void *_b)
return gid_gt(a, b) - gid_lt(a, b);
 }
 
-static void groups_sort(struct group_info *group_info)
+void groups_sort(struct group_info *group_info)
 {
sort(group_info->gid, group_info->ngroups, sizeof(*group_info->gid),
 gid_cmp, NULL);
 }
+EXPORT_SYMBOL(groups_sort);
+
 
 /* a simple bsearch */
 int groups_search(const struct group_info *group_info, kgid_t grp)
-- 
2.9.5



[PATCH 2/3 v3] kernel: Move groups_sort to the caller of set_groups.

2017-12-05 Thread Thiago Rafael Becker
The responsibility for calling groups_sort is now on the caller
of set_groups.

Signed-off-by: Thiago Rafael Becker 
---
 fs/nfsd/auth.c| 3 +++
 kernel/groups.c   | 1 +
 kernel/uid16.c| 1 +
 net/sunrpc/auth_gss/gss_rpc_xdr.c | 1 +
 net/sunrpc/auth_gss/svcauth_gss.c | 1 +
 net/sunrpc/svcauth_unix.c | 8 
 6 files changed, 15 insertions(+)

diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index 697f8ae..7b5099b 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -60,6 +60,9 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export 
*exp)
gi->gid[i] = exp->ex_anon_gid;
else
gi->gid[i] = rqgi->gid[i];
+
+   /* Should be race free as long as each thread allocates 
a new gi */
+   groups_sort(gi);
}
} else {
gi = get_group_info(rqgi);
diff --git a/kernel/groups.c b/kernel/groups.c
index 4c9c9ed..17073a9 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -208,6 +208,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, 
grouplist)
return retval;
}
 
+   groups_sort(group_info);
retval = set_current_groups(group_info);
put_group_info(group_info);
 
diff --git a/kernel/uid16.c b/kernel/uid16.c
index ce74a49..ef1da2a 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -192,6 +192,7 @@ SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t 
__user *, grouplist)
return retval;
}
 
+   groups_sort(group_info);
retval = set_current_groups(group_info);
put_group_info(group_info);
 
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c 
b/net/sunrpc/auth_gss/gss_rpc_xdr.c
index c4778ca..444380f 100644
--- a/net/sunrpc/auth_gss/gss_rpc_xdr.c
+++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c
@@ -231,6 +231,7 @@ static int gssx_dec_linux_creds(struct xdr_stream *xdr,
goto out_free_groups;
creds->cr_group_info->gid[i] = kgid;
}
+   groups_sort(creds->cr_group_info);
 
return 0;
 out_free_groups:
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c 
b/net/sunrpc/auth_gss/svcauth_gss.c
index 5dd4e6c..2653119 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -481,6 +481,7 @@ static int rsc_parse(struct cache_detail *cd,
goto out;
rsci.cred.cr_group_info->gid[i] = kgid;
}
+   groups_sort(rsci.cred.cr_group_info);
 
/* mech name */
len = qword_get(&mesg, buf, mlen);
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 740b67d..99841e1 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -20,6 +20,7 @@
 
 
 #include "netns.h"
+void groups_sort(struct group_info *group_info);
 
 /*
  * AUTHUNIX and AUTHNULL credentials are both handled here.
@@ -520,6 +521,12 @@ static int unix_gid_parse(struct cache_detail *cd,
ug.gi->gid[i] = kgid;
}
 
+   /* Sort the groups before inserting this entry
+* into the cache to avoid future corrutpions
+* by multiple simultaneous attempts to sort this
+* entry.
+*/
+   groups_sort(ug.gi);
ugp = unix_gid_lookup(cd, uid);
if (ugp) {
struct cache_head *ch;
@@ -819,6 +826,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
kgid_t kgid = make_kgid(&init_user_ns, svc_getnl(argv));
cred->cr_group_info->gid[i] = kgid;
}
+   groups_sort(cred->cr_group_info);
if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) {
*authp = rpc_autherr_badverf;
return SVC_DENIED;
-- 
2.9.5



Contact Delivery Agent For Your Package!

2017-12-05 Thread Executive Governor
DIPLOMATIC COURIER SERVICE

We met today with the President and Accountant General of the Federation Office 
of the Senate House, and House of Representatives we came to a conclusion that 
your outstanding payment the sum of US$21.5m as your contract entitlement will 
come to you via Diplomatic courier service, so therefore you are to rec-confirm 
the following info;

1) Your Full Name.
2) Phone No:
3) Residential Address:
4) Nearest Airport

And use this below information to reach the deliveryman;

Contact Name: Edward Mark
Email: emark...@hotmail.com
Phone No:  +1(469)406-0563

Your immediate respond is urgently needed.

Best Regards
Dr.John Adams
Executive Governor


[PATCH 3/3 v3] kernel: set_groups doesn't call groups_sort anymore.

2017-12-05 Thread Thiago Rafael Becker
When the group_info is cached (e.g. sunrpc) there's the possibility
that threads calling set_groups will attempt to do so simultaneously.

Moving the responsibility of sorting to the caller of set_groups, or
in the case of nfsd, to the point where it is received from rpc.mountd
avoids this issue.

Moving it to the caller has the added benifit of a slight improvement on
the nfsd performance.

Signed-off-by: Thiago Rafael Becker 
---
 kernel/groups.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/groups.c b/kernel/groups.c
index 17073a9..8620ad3 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -124,7 +124,6 @@ int groups_search(const struct group_info *group_info, 
kgid_t grp)
 void set_groups(struct cred *new, struct group_info *group_info)
 {
put_group_info(new->group_info);
-   groups_sort(group_info);
get_group_info(group_info);
new->group_info = group_info;
 }
-- 
2.9.5



[PATCH 0/3 v3] Move groups_sort outisde of set_groups

2017-12-05 Thread Thiago Rafael Becker
In cases where group_info is cached (e.g. sunrpc), multiplpe
threads may call set_groups with a freshly created group_info
cache (e.g. nfsd), and attempt to sort them simultaneously,
which configures a race condition that can overwrite some
groups in the cache and lead to errors. In the case of nfsd,
the client was receiving EPERM if the group used to provide
authorization was overwritten by this race condition.

In an email exchange with bfields, we agreed that it seems
unintuitive that the groups are sorted on set_groups, and that
it would be better to move the responsibility of sorting to
the caller of set_groups.

These patches:
 - Export groups_sort in include/linux/cred.h
 - Add a call to groups_sort after the groups are inserted in
   group_info
 - Remove the call to sort_groups from set_groups

Thiago Rafael Becker (3):
  kernel: make groups_sort globally visible
  kernel: Move groups_sort to the caller of set_groups.
  kernel: set_groups doesn't call groups_sort anymore.

 include/linux/cred.h  | 1 +
 kernel/groups.c   | 6 --
 kernel/uid16.c| 1 +
 net/sunrpc/svcauth_unix.c | 7 +++
 4 files changed, 13 insertions(+), 2 deletions(-)

-- 
2.9.5



<    4   5   6   7   8   9   10   11   12   13   >