[PATCH] ARM: imx_v6_v7_defconfig: select the CONFIG_CPUFREQ_DT

2018-01-03 Thread Anson Huang
Select CONFIG_CPUFREQ_DT by default to enable
cpu-freq driver for i.MX7D.

The rest changes are generated by "make savedefconfig".

Signed-off-by: Anson Huang 
---
 arch/arm/configs/imx_v6_v7_defconfig | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig 
b/arch/arm/configs/imx_v6_v7_defconfig
index 0d44949..d4c8f35 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -48,9 +48,7 @@ CONFIG_PCI_IMX6=y
 CONFIG_SMP=y
 CONFIG_ARM_PSCI=y
 CONFIG_PREEMPT_VOLUNTARY=y
-CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
-CONFIG_CMA=y
 CONFIG_FORCE_MAX_ZONEORDER=14
 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
 CONFIG_KEXEC=y
@@ -59,6 +57,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+CONFIG_CPUFREQ_DT=y
 CONFIG_ARM_IMX6Q_CPUFREQ=y
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
@@ -81,7 +80,6 @@ CONFIG_CAN_FLEXCAN=y
 CONFIG_BT=y
 CONFIG_BT_HCIUART=y
 CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_LL=y
 CONFIG_CFG80211=y
 CONFIG_CFG80211_WEXT=y
 CONFIG_MAC80211=y
@@ -90,7 +88,6 @@ CONFIG_RFKILL_INPUT=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
-CONFIG_DMA_CMA=y
 CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_IMX_WEIM=y
 CONFIG_CONNECTOR=y
@@ -167,9 +164,9 @@ CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_ADS7846=y
 CONFIG_TOUCHSCREEN_EGALAX=y
+CONFIG_TOUCHSCREEN_MAX11801=y
 CONFIG_TOUCHSCREEN_IMX6UL_TSC=y
 CONFIG_TOUCHSCREEN_EDT_FT5X06=y
-CONFIG_TOUCHSCREEN_MAX11801=y
 CONFIG_TOUCHSCREEN_MC13783=y
 CONFIG_TOUCHSCREEN_TSC2004=y
 CONFIG_TOUCHSCREEN_TSC2007=y
@@ -178,7 +175,6 @@ CONFIG_TOUCHSCREEN_SX8654=y
 CONFIG_TOUCHSCREEN_COLIBRI_VF50=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MMA8450=y
-CONFIG_HID_MULTITOUCH=y
 CONFIG_SERIO_SERPORT=m
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_IMX=y
@@ -210,7 +206,6 @@ CONFIG_POWER_RESET_SYSCON_POWEROFF=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_SENSORS_GPIO_FAN=y
 CONFIG_SENSORS_IIO_HWMON=y
-CONFIG_THERMAL=y
 CONFIG_THERMAL_WRITABLE_TRIPS=y
 CONFIG_CPU_THERMAL=y
 CONFIG_IMX_THERMAL=y
@@ -228,13 +223,13 @@ CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MC13783=y
 CONFIG_REGULATOR_MC13892=y
 CONFIG_REGULATOR_PFUZE100=y
+CONFIG_RC_CORE=y
+CONFIG_RC_DEVICES=y
+CONFIG_IR_GPIO_CIR=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_MEDIA_CAMERA_SUPPORT=y
-CONFIG_RC_CORE=y
 CONFIG_MEDIA_CONTROLLER=y
 CONFIG_VIDEO_V4L2_SUBDEV_API=y
-CONFIG_RC_DEVICES=y
-CONFIG_IR_GPIO_CIR=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
@@ -245,7 +240,6 @@ CONFIG_VIDEO_CODA=m
 # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
 CONFIG_VIDEO_ADV7180=m
 CONFIG_VIDEO_OV5640=m
-CONFIG_SOC_CAMERA_OV2640=y
 CONFIG_IMX_IPUV3_CORE=y
 CONFIG_DRM=y
 CONFIG_DRM_PANEL_SIMPLE=y
@@ -283,6 +277,7 @@ CONFIG_SND_SOC_CS42XX8_I2C=y
 CONFIG_SND_SOC_TLV320AIC3X=y
 CONFIG_SND_SOC_WM8960=y
 CONFIG_SND_SIMPLE_CARD=y
+CONFIG_HID_MULTITOUCH=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_MXC=y
-- 
1.9.1



[PATCH] ARM: imx_v6_v7_defconfig: select the CONFIG_CPUFREQ_DT

2018-01-03 Thread Anson Huang
Select CONFIG_CPUFREQ_DT by default to enable
cpu-freq driver for i.MX7D.

The rest changes are generated by "make savedefconfig".

Signed-off-by: Anson Huang 
---
 arch/arm/configs/imx_v6_v7_defconfig | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig 
b/arch/arm/configs/imx_v6_v7_defconfig
index 0d44949..d4c8f35 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -48,9 +48,7 @@ CONFIG_PCI_IMX6=y
 CONFIG_SMP=y
 CONFIG_ARM_PSCI=y
 CONFIG_PREEMPT_VOLUNTARY=y
-CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
-CONFIG_CMA=y
 CONFIG_FORCE_MAX_ZONEORDER=14
 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
 CONFIG_KEXEC=y
@@ -59,6 +57,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+CONFIG_CPUFREQ_DT=y
 CONFIG_ARM_IMX6Q_CPUFREQ=y
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
@@ -81,7 +80,6 @@ CONFIG_CAN_FLEXCAN=y
 CONFIG_BT=y
 CONFIG_BT_HCIUART=y
 CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_LL=y
 CONFIG_CFG80211=y
 CONFIG_CFG80211_WEXT=y
 CONFIG_MAC80211=y
@@ -90,7 +88,6 @@ CONFIG_RFKILL_INPUT=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
-CONFIG_DMA_CMA=y
 CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_IMX_WEIM=y
 CONFIG_CONNECTOR=y
@@ -167,9 +164,9 @@ CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_ADS7846=y
 CONFIG_TOUCHSCREEN_EGALAX=y
+CONFIG_TOUCHSCREEN_MAX11801=y
 CONFIG_TOUCHSCREEN_IMX6UL_TSC=y
 CONFIG_TOUCHSCREEN_EDT_FT5X06=y
-CONFIG_TOUCHSCREEN_MAX11801=y
 CONFIG_TOUCHSCREEN_MC13783=y
 CONFIG_TOUCHSCREEN_TSC2004=y
 CONFIG_TOUCHSCREEN_TSC2007=y
@@ -178,7 +175,6 @@ CONFIG_TOUCHSCREEN_SX8654=y
 CONFIG_TOUCHSCREEN_COLIBRI_VF50=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MMA8450=y
-CONFIG_HID_MULTITOUCH=y
 CONFIG_SERIO_SERPORT=m
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_IMX=y
@@ -210,7 +206,6 @@ CONFIG_POWER_RESET_SYSCON_POWEROFF=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_SENSORS_GPIO_FAN=y
 CONFIG_SENSORS_IIO_HWMON=y
-CONFIG_THERMAL=y
 CONFIG_THERMAL_WRITABLE_TRIPS=y
 CONFIG_CPU_THERMAL=y
 CONFIG_IMX_THERMAL=y
@@ -228,13 +223,13 @@ CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MC13783=y
 CONFIG_REGULATOR_MC13892=y
 CONFIG_REGULATOR_PFUZE100=y
+CONFIG_RC_CORE=y
+CONFIG_RC_DEVICES=y
+CONFIG_IR_GPIO_CIR=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_MEDIA_CAMERA_SUPPORT=y
-CONFIG_RC_CORE=y
 CONFIG_MEDIA_CONTROLLER=y
 CONFIG_VIDEO_V4L2_SUBDEV_API=y
-CONFIG_RC_DEVICES=y
-CONFIG_IR_GPIO_CIR=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
@@ -245,7 +240,6 @@ CONFIG_VIDEO_CODA=m
 # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
 CONFIG_VIDEO_ADV7180=m
 CONFIG_VIDEO_OV5640=m
-CONFIG_SOC_CAMERA_OV2640=y
 CONFIG_IMX_IPUV3_CORE=y
 CONFIG_DRM=y
 CONFIG_DRM_PANEL_SIMPLE=y
@@ -283,6 +277,7 @@ CONFIG_SND_SOC_CS42XX8_I2C=y
 CONFIG_SND_SOC_TLV320AIC3X=y
 CONFIG_SND_SOC_WM8960=y
 CONFIG_SND_SIMPLE_CARD=y
+CONFIG_HID_MULTITOUCH=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_MXC=y
-- 
1.9.1



Re: [PATCH v5 26/39] nds32: Device tree support

2018-01-03 Thread Greentime Hu
2018-01-04 3:14 GMT+08:00 Rob Herring :
> On Tue, Jan 2, 2018 at 2:24 AM, Greentime Hu  wrote:
>> From: Greentime Hu 
>>
>> This patch adds support for device tree.
>>
>> Signed-off-by: Vincent Chen 
>> Signed-off-by: Greentime Hu 
>> ---
>>  arch/nds32/boot/dts/Makefile  |8 +
>>  arch/nds32/boot/dts/ae3xx.dts |   73 
>> +
>>  arch/nds32/kernel/devtree.c   |   19 +++
>>  3 files changed, 100 insertions(+)
>>  create mode 100644 arch/nds32/boot/dts/Makefile
>>  create mode 100644 arch/nds32/boot/dts/ae3xx.dts
>>  create mode 100644 arch/nds32/kernel/devtree.c
>>
>> diff --git a/arch/nds32/boot/dts/Makefile b/arch/nds32/boot/dts/Makefile
>> new file mode 100644
>> index 000..d31faa8
>> --- /dev/null
>> +++ b/arch/nds32/boot/dts/Makefile
>> @@ -0,0 +1,8 @@
>> +ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
>> +BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o
>> +else
>> +BUILTIN_DTB :=
>> +endif
>> +obj-$(CONFIG_OF) += $(BUILTIN_DTB)
>> +
>> +clean-files := *.dtb *.dtb.S
>> diff --git a/arch/nds32/boot/dts/ae3xx.dts b/arch/nds32/boot/dts/ae3xx.dts
>> new file mode 100644
>> index 000..6b23d60
>> --- /dev/null
>> +++ b/arch/nds32/boot/dts/ae3xx.dts
>> @@ -0,0 +1,73 @@
>> +/dts-v1/;
>> +/ {
>> +   compatible = "andestech,ae3xx";
>> +   #address-cells = <1>;
>> +   #size-cells = <1>;
>> +   interrupt-parent = <>;
>> +
>> +   chosen {
>> +   stdout-path = 
>> +   };
>> +
>> +   memory@0 {
>> +   device_type = "memory";
>> +   reg = <0x 0x4000>;
>> +   };
>> +
>> +   cpus {
>> +   #address-cells = <1>;
>> +   #size-cells = <0>;
>> +   cpu@0 {
>> +   device_type = "cpu";
>> +   compatible = "andestech,n13", "andestech,nds32v3";
>> +   reg = <0>;
>> +   clock-frequency = <6000>;
>> +   next-level-cache = <>;
>> +   };
>> +   };
>> +
>> +   L2: l2-cache@e050 {
>> +   compatible = "andestech,atl2c";
>> +   reg = <0xe050 0x1000>;
>> +   cache-unified;
>> +   cache-level = <2>;
>> +   };
>> +
>> +   apb: clk@0 {
>
> unit address without reg is not valid. Drop the "@0".
>
>> +   #clock-cells = <0>;
>> +   compatible = "fixed-clock";
>> +   clock-frequency = <3000>;
>> +   };
>> +
>> +
>> +   intc: interrupt-controller {
>> +   compatible = "andestech,ativic32";
>> +   #interrupt-cells = <1>;
>> +   interrupt-controller;
>> +   };
>> +
>> +   serial0: serial@f030 {
>
> All the memory mapped peripherals should be under at least one simple-bus 
> node.
>
>> +   compatible = "andestech,uart16550", "ns16550a";
>> +   reg = <0xf030 0x1000>;
>> +   interrupts = <8>;
>> +   clock-frequency = <14745600>;
>> +   reg-shift = <2>;
>> +   reg-offset = <32>;
>> +   no-loopback-test = <1>;
>> +   };
>> +
>> +   timer0: timer@f040 {
>> +   compatible = "andestech,atcpit100";
>> +   reg = <0xf040 0x1000>;
>> +   interrupts = <2>;
>> +   clocks = <>;
>> +   clock-names = "PCLK";
>> +   };
>> +
>> +   mac0: mac@e010 {
>
> ethernet@...
>

Hi, Rob:

I'd like to modify it like this in the next version patch.

 clock: clk {
 #clock-cells = <0>;
 compatible = "fixed-clock";
 clock-frequency = <3000>;
 };

 apb {
 compatible = "simple-bus";
 #address-cells = <1>;
 #size-cells = <1>;
 ranges;

 serial0: serial@f030 {
 compatible = "andestech,uart16550", "ns16550a";
 reg = <0xf030 0x1000>;
 interrupts = <8>;
 clock-frequency = <14745600>;
 reg-shift = <2>;
 reg-offset = <32>;
 no-loopback-test = <1>;
 };

 timer0: timer@f040 {
 compatible = "andestech,atcpit100";
 reg = <0xf040 0x1000>;
 interrupts = <2>;
 clocks = <>;
 clock-names = "PCLK";
 };
 };

 ahb {
 compatible = "simple-bus";
 #address-cells = <1>;
 #size-cells = <1>;
 ranges;

 L2: cache-controller@e050 {
 

Re: [PATCH v5 26/39] nds32: Device tree support

2018-01-03 Thread Greentime Hu
2018-01-04 3:14 GMT+08:00 Rob Herring :
> On Tue, Jan 2, 2018 at 2:24 AM, Greentime Hu  wrote:
>> From: Greentime Hu 
>>
>> This patch adds support for device tree.
>>
>> Signed-off-by: Vincent Chen 
>> Signed-off-by: Greentime Hu 
>> ---
>>  arch/nds32/boot/dts/Makefile  |8 +
>>  arch/nds32/boot/dts/ae3xx.dts |   73 
>> +
>>  arch/nds32/kernel/devtree.c   |   19 +++
>>  3 files changed, 100 insertions(+)
>>  create mode 100644 arch/nds32/boot/dts/Makefile
>>  create mode 100644 arch/nds32/boot/dts/ae3xx.dts
>>  create mode 100644 arch/nds32/kernel/devtree.c
>>
>> diff --git a/arch/nds32/boot/dts/Makefile b/arch/nds32/boot/dts/Makefile
>> new file mode 100644
>> index 000..d31faa8
>> --- /dev/null
>> +++ b/arch/nds32/boot/dts/Makefile
>> @@ -0,0 +1,8 @@
>> +ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
>> +BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o
>> +else
>> +BUILTIN_DTB :=
>> +endif
>> +obj-$(CONFIG_OF) += $(BUILTIN_DTB)
>> +
>> +clean-files := *.dtb *.dtb.S
>> diff --git a/arch/nds32/boot/dts/ae3xx.dts b/arch/nds32/boot/dts/ae3xx.dts
>> new file mode 100644
>> index 000..6b23d60
>> --- /dev/null
>> +++ b/arch/nds32/boot/dts/ae3xx.dts
>> @@ -0,0 +1,73 @@
>> +/dts-v1/;
>> +/ {
>> +   compatible = "andestech,ae3xx";
>> +   #address-cells = <1>;
>> +   #size-cells = <1>;
>> +   interrupt-parent = <>;
>> +
>> +   chosen {
>> +   stdout-path = 
>> +   };
>> +
>> +   memory@0 {
>> +   device_type = "memory";
>> +   reg = <0x 0x4000>;
>> +   };
>> +
>> +   cpus {
>> +   #address-cells = <1>;
>> +   #size-cells = <0>;
>> +   cpu@0 {
>> +   device_type = "cpu";
>> +   compatible = "andestech,n13", "andestech,nds32v3";
>> +   reg = <0>;
>> +   clock-frequency = <6000>;
>> +   next-level-cache = <>;
>> +   };
>> +   };
>> +
>> +   L2: l2-cache@e050 {
>> +   compatible = "andestech,atl2c";
>> +   reg = <0xe050 0x1000>;
>> +   cache-unified;
>> +   cache-level = <2>;
>> +   };
>> +
>> +   apb: clk@0 {
>
> unit address without reg is not valid. Drop the "@0".
>
>> +   #clock-cells = <0>;
>> +   compatible = "fixed-clock";
>> +   clock-frequency = <3000>;
>> +   };
>> +
>> +
>> +   intc: interrupt-controller {
>> +   compatible = "andestech,ativic32";
>> +   #interrupt-cells = <1>;
>> +   interrupt-controller;
>> +   };
>> +
>> +   serial0: serial@f030 {
>
> All the memory mapped peripherals should be under at least one simple-bus 
> node.
>
>> +   compatible = "andestech,uart16550", "ns16550a";
>> +   reg = <0xf030 0x1000>;
>> +   interrupts = <8>;
>> +   clock-frequency = <14745600>;
>> +   reg-shift = <2>;
>> +   reg-offset = <32>;
>> +   no-loopback-test = <1>;
>> +   };
>> +
>> +   timer0: timer@f040 {
>> +   compatible = "andestech,atcpit100";
>> +   reg = <0xf040 0x1000>;
>> +   interrupts = <2>;
>> +   clocks = <>;
>> +   clock-names = "PCLK";
>> +   };
>> +
>> +   mac0: mac@e010 {
>
> ethernet@...
>

Hi, Rob:

I'd like to modify it like this in the next version patch.

 clock: clk {
 #clock-cells = <0>;
 compatible = "fixed-clock";
 clock-frequency = <3000>;
 };

 apb {
 compatible = "simple-bus";
 #address-cells = <1>;
 #size-cells = <1>;
 ranges;

 serial0: serial@f030 {
 compatible = "andestech,uart16550", "ns16550a";
 reg = <0xf030 0x1000>;
 interrupts = <8>;
 clock-frequency = <14745600>;
 reg-shift = <2>;
 reg-offset = <32>;
 no-loopback-test = <1>;
 };

 timer0: timer@f040 {
 compatible = "andestech,atcpit100";
 reg = <0xf040 0x1000>;
 interrupts = <2>;
 clocks = <>;
 clock-names = "PCLK";
 };
 };

 ahb {
 compatible = "simple-bus";
 #address-cells = <1>;
 #size-cells = <1>;
 ranges;

 L2: cache-controller@e050 {
 compatible = "andestech,atl2c";
 reg = <0xe050 0x1000>;
 

[PATCH v1 3/6] ASoC: mediatek: update MT2701 AFE documentation to adapt mfd device

2018-01-03 Thread Ryder Lee
As the new MFD parent is in place, modify MT2701 AFE documentation to
adapt it. Also add three core clocks in example.

Signed-off-by: Ryder Lee 
---
 .../devicetree/bindings/sound/mt2701-afe-pcm.txt   | 171 +++--
 1 file changed, 93 insertions(+), 78 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt 
b/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt
index 0450baa..12f147b 100644
--- a/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt
+++ b/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt
@@ -2,15 +2,17 @@ Mediatek AFE PCM controller for mt2701
 
 Required properties:
 - compatible = "mediatek,mt2701-audio";
-- reg: register location and size
 - interrupts: should contain AFE and ASYS interrupts
 - interrupt-names: should be "afe" and "asys"
 - power-domains: should define the power domain
 - clocks: Must contain an entry for each entry in clock-names
   See ../clocks/clock-bindings.txt for details
 - clock-names: should have these clock names:
+   "infra_sys_audio_clk",
"top_audio_mux1_sel",
"top_audio_mux2_sel",
+   "top_audio_a1sys_hp",
+   "top_audio_a2sys_hp",
"i2s0_src_sel",
"i2s1_src_sel",
"i2s2_src_sel",
@@ -45,85 +47,98 @@ Required properties:
 - assigned-clocks-parents: parent of input clocks of assigned clocks.
 - assigned-clock-rates: list of clock frequencies of assigned clocks.
 
+Must be a subnode of MediaTek audsys device tree node.
+See ../arm/mediatek/mediatek,audsys.txt for details about the parent node.
+
 Example:
 
-   afe: mt2701-afe-pcm@1122 {
-   compatible = "mediatek,mt2701-audio";
-   reg = <0 0x1122 0 0x2000>,
- <0 0x112A 0 0x2>;
-   interrupts = ,
-;
-   interrupt-names = "afe", "asys";
-   power-domains = < MT2701_POWER_DOMAIN_IFR_MSC>;
-   clocks = < CLK_TOP_AUD_MUX1_SEL>,
-< CLK_TOP_AUD_MUX2_SEL>,
-< CLK_TOP_AUD_K1_SRC_SEL>,
-< CLK_TOP_AUD_K2_SRC_SEL>,
-< CLK_TOP_AUD_K3_SRC_SEL>,
-< CLK_TOP_AUD_K4_SRC_SEL>,
-< CLK_TOP_AUD_K1_SRC_DIV>,
-< CLK_TOP_AUD_K2_SRC_DIV>,
-< CLK_TOP_AUD_K3_SRC_DIV>,
-< CLK_TOP_AUD_K4_SRC_DIV>,
-< CLK_TOP_AUD_I2S1_MCLK>,
-< CLK_TOP_AUD_I2S2_MCLK>,
-< CLK_TOP_AUD_I2S3_MCLK>,
-< CLK_TOP_AUD_I2S4_MCLK>,
-< CLK_AUD_I2SO1>,
-< CLK_AUD_I2SO2>,
-< CLK_AUD_I2SO3>,
-< CLK_AUD_I2SO4>,
-< CLK_AUD_I2SIN1>,
-< CLK_AUD_I2SIN2>,
-< CLK_AUD_I2SIN3>,
-< CLK_AUD_I2SIN4>,
-< CLK_AUD_ASRCO1>,
-< CLK_AUD_ASRCO2>,
-< CLK_AUD_ASRCO3>,
-< CLK_AUD_ASRCO4>,
-< CLK_AUD_AFE>,
-< CLK_AUD_AFE_CONN>,
-< CLK_AUD_A1SYS>,
-< CLK_AUD_A2SYS>,
-< CLK_AUD_AFE_MRGIF>;
+   audsys: audio-subsystem@1122 {
+   compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd";
+   ...
+
+   afe: audio-controller {
+   compatible = "mediatek,mt2701-audio";
+   interrupts =  ,
+ ;
+   interrupt-names = "afe", "asys";
+   power-domains = < MT2701_POWER_DOMAIN_IFR_MSC>;
+
+   clocks = < CLK_INFRA_AUDIO>,
+< CLK_TOP_AUD_MUX1_SEL>,
+< CLK_TOP_AUD_MUX2_SEL>,
+< CLK_TOP_AUD_48K_TIMING>,
+< CLK_TOP_AUD_44K_TIMING>,
+< CLK_TOP_AUD_K1_SRC_SEL>,
+< CLK_TOP_AUD_K2_SRC_SEL>,
+< CLK_TOP_AUD_K3_SRC_SEL>,
+< CLK_TOP_AUD_K4_SRC_SEL>,
+< CLK_TOP_AUD_K1_SRC_DIV>,
+< CLK_TOP_AUD_K2_SRC_DIV>,
+< CLK_TOP_AUD_K3_SRC_DIV>,
+< CLK_TOP_AUD_K4_SRC_DIV>,
+< CLK_TOP_AUD_I2S1_MCLK>,
+< CLK_TOP_AUD_I2S2_MCLK>,
+< CLK_TOP_AUD_I2S3_MCLK>,
+< CLK_TOP_AUD_I2S4_MCLK>,
+  

[PATCH v1 3/6] ASoC: mediatek: update MT2701 AFE documentation to adapt mfd device

2018-01-03 Thread Ryder Lee
As the new MFD parent is in place, modify MT2701 AFE documentation to
adapt it. Also add three core clocks in example.

Signed-off-by: Ryder Lee 
---
 .../devicetree/bindings/sound/mt2701-afe-pcm.txt   | 171 +++--
 1 file changed, 93 insertions(+), 78 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt 
b/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt
index 0450baa..12f147b 100644
--- a/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt
+++ b/Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt
@@ -2,15 +2,17 @@ Mediatek AFE PCM controller for mt2701
 
 Required properties:
 - compatible = "mediatek,mt2701-audio";
-- reg: register location and size
 - interrupts: should contain AFE and ASYS interrupts
 - interrupt-names: should be "afe" and "asys"
 - power-domains: should define the power domain
 - clocks: Must contain an entry for each entry in clock-names
   See ../clocks/clock-bindings.txt for details
 - clock-names: should have these clock names:
+   "infra_sys_audio_clk",
"top_audio_mux1_sel",
"top_audio_mux2_sel",
+   "top_audio_a1sys_hp",
+   "top_audio_a2sys_hp",
"i2s0_src_sel",
"i2s1_src_sel",
"i2s2_src_sel",
@@ -45,85 +47,98 @@ Required properties:
 - assigned-clocks-parents: parent of input clocks of assigned clocks.
 - assigned-clock-rates: list of clock frequencies of assigned clocks.
 
+Must be a subnode of MediaTek audsys device tree node.
+See ../arm/mediatek/mediatek,audsys.txt for details about the parent node.
+
 Example:
 
-   afe: mt2701-afe-pcm@1122 {
-   compatible = "mediatek,mt2701-audio";
-   reg = <0 0x1122 0 0x2000>,
- <0 0x112A 0 0x2>;
-   interrupts = ,
-;
-   interrupt-names = "afe", "asys";
-   power-domains = < MT2701_POWER_DOMAIN_IFR_MSC>;
-   clocks = < CLK_TOP_AUD_MUX1_SEL>,
-< CLK_TOP_AUD_MUX2_SEL>,
-< CLK_TOP_AUD_K1_SRC_SEL>,
-< CLK_TOP_AUD_K2_SRC_SEL>,
-< CLK_TOP_AUD_K3_SRC_SEL>,
-< CLK_TOP_AUD_K4_SRC_SEL>,
-< CLK_TOP_AUD_K1_SRC_DIV>,
-< CLK_TOP_AUD_K2_SRC_DIV>,
-< CLK_TOP_AUD_K3_SRC_DIV>,
-< CLK_TOP_AUD_K4_SRC_DIV>,
-< CLK_TOP_AUD_I2S1_MCLK>,
-< CLK_TOP_AUD_I2S2_MCLK>,
-< CLK_TOP_AUD_I2S3_MCLK>,
-< CLK_TOP_AUD_I2S4_MCLK>,
-< CLK_AUD_I2SO1>,
-< CLK_AUD_I2SO2>,
-< CLK_AUD_I2SO3>,
-< CLK_AUD_I2SO4>,
-< CLK_AUD_I2SIN1>,
-< CLK_AUD_I2SIN2>,
-< CLK_AUD_I2SIN3>,
-< CLK_AUD_I2SIN4>,
-< CLK_AUD_ASRCO1>,
-< CLK_AUD_ASRCO2>,
-< CLK_AUD_ASRCO3>,
-< CLK_AUD_ASRCO4>,
-< CLK_AUD_AFE>,
-< CLK_AUD_AFE_CONN>,
-< CLK_AUD_A1SYS>,
-< CLK_AUD_A2SYS>,
-< CLK_AUD_AFE_MRGIF>;
+   audsys: audio-subsystem@1122 {
+   compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd";
+   ...
+
+   afe: audio-controller {
+   compatible = "mediatek,mt2701-audio";
+   interrupts =  ,
+ ;
+   interrupt-names = "afe", "asys";
+   power-domains = < MT2701_POWER_DOMAIN_IFR_MSC>;
+
+   clocks = < CLK_INFRA_AUDIO>,
+< CLK_TOP_AUD_MUX1_SEL>,
+< CLK_TOP_AUD_MUX2_SEL>,
+< CLK_TOP_AUD_48K_TIMING>,
+< CLK_TOP_AUD_44K_TIMING>,
+< CLK_TOP_AUD_K1_SRC_SEL>,
+< CLK_TOP_AUD_K2_SRC_SEL>,
+< CLK_TOP_AUD_K3_SRC_SEL>,
+< CLK_TOP_AUD_K4_SRC_SEL>,
+< CLK_TOP_AUD_K1_SRC_DIV>,
+< CLK_TOP_AUD_K2_SRC_DIV>,
+< CLK_TOP_AUD_K3_SRC_DIV>,
+< CLK_TOP_AUD_K4_SRC_DIV>,
+< CLK_TOP_AUD_I2S1_MCLK>,
+< CLK_TOP_AUD_I2S2_MCLK>,
+< CLK_TOP_AUD_I2S3_MCLK>,
+< CLK_TOP_AUD_I2S4_MCLK>,
+< CLK_AUD_I2SO1>,

[PATCH v1 5/6] clk: mediatek: update missing clock data for MT7622 audsys

2018-01-03 Thread Ryder Lee
Add missing clock data 'CLK_AUDIO_AFE_CONN' for MT7622 audsys.

Signed-off-by: Ryder Lee 
---
 drivers/clk/mediatek/clk-mt7622-aud.c  | 3 ++-
 include/dt-bindings/clock/mt7622-clk.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt7622-aud.c 
b/drivers/clk/mediatek/clk-mt7622-aud.c
index fad7d9f..96959ad 100644
--- a/drivers/clk/mediatek/clk-mt7622-aud.c
+++ b/drivers/clk/mediatek/clk-mt7622-aud.c
@@ -106,6 +106,7 @@
GATE_AUDIO1(CLK_AUDIO_INTDIR, "audio_intdir", "intdir_sel", 20),
GATE_AUDIO1(CLK_AUDIO_A1SYS, "audio_a1sys", "a1sys_hp_sel", 21),
GATE_AUDIO1(CLK_AUDIO_A2SYS, "audio_a2sys", "a2sys_hp_sel", 22),
+   GATE_AUDIO1(CLK_AUDIO_AFE_CONN, "audio_afe_conn", "a1sys_hp_sel", 23),
/* AUDIO2 */
GATE_AUDIO2(CLK_AUDIO_UL1, "audio_ul1", "a1sys_hp_sel", 0),
GATE_AUDIO2(CLK_AUDIO_UL2, "audio_ul2", "a1sys_hp_sel", 1),
@@ -146,7 +147,7 @@ static int clk_mt7622_audiosys_init(struct platform_device 
*pdev)
clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
 
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
-  clk_data);
+  clk_data);
 
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
if (r)
diff --git a/include/dt-bindings/clock/mt7622-clk.h 
b/include/dt-bindings/clock/mt7622-clk.h
index 3e514ed..e9d77f0 100644
--- a/include/dt-bindings/clock/mt7622-clk.h
+++ b/include/dt-bindings/clock/mt7622-clk.h
@@ -235,7 +235,8 @@
 #define CLK_AUDIO_MEM_ASRC343
 #define CLK_AUDIO_MEM_ASRC444
 #define CLK_AUDIO_MEM_ASRC545
-#define CLK_AUDIO_NR_CLK   46
+#define CLK_AUDIO_AFE_CONN 46
+#define CLK_AUDIO_NR_CLK   47
 
 /* SSUSBSYS */
 
-- 
1.9.1



[PATCH v1 5/6] clk: mediatek: update missing clock data for MT7622 audsys

2018-01-03 Thread Ryder Lee
Add missing clock data 'CLK_AUDIO_AFE_CONN' for MT7622 audsys.

Signed-off-by: Ryder Lee 
---
 drivers/clk/mediatek/clk-mt7622-aud.c  | 3 ++-
 include/dt-bindings/clock/mt7622-clk.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt7622-aud.c 
b/drivers/clk/mediatek/clk-mt7622-aud.c
index fad7d9f..96959ad 100644
--- a/drivers/clk/mediatek/clk-mt7622-aud.c
+++ b/drivers/clk/mediatek/clk-mt7622-aud.c
@@ -106,6 +106,7 @@
GATE_AUDIO1(CLK_AUDIO_INTDIR, "audio_intdir", "intdir_sel", 20),
GATE_AUDIO1(CLK_AUDIO_A1SYS, "audio_a1sys", "a1sys_hp_sel", 21),
GATE_AUDIO1(CLK_AUDIO_A2SYS, "audio_a2sys", "a2sys_hp_sel", 22),
+   GATE_AUDIO1(CLK_AUDIO_AFE_CONN, "audio_afe_conn", "a1sys_hp_sel", 23),
/* AUDIO2 */
GATE_AUDIO2(CLK_AUDIO_UL1, "audio_ul1", "a1sys_hp_sel", 0),
GATE_AUDIO2(CLK_AUDIO_UL2, "audio_ul2", "a1sys_hp_sel", 1),
@@ -146,7 +147,7 @@ static int clk_mt7622_audiosys_init(struct platform_device 
*pdev)
clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
 
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
-  clk_data);
+  clk_data);
 
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
if (r)
diff --git a/include/dt-bindings/clock/mt7622-clk.h 
b/include/dt-bindings/clock/mt7622-clk.h
index 3e514ed..e9d77f0 100644
--- a/include/dt-bindings/clock/mt7622-clk.h
+++ b/include/dt-bindings/clock/mt7622-clk.h
@@ -235,7 +235,8 @@
 #define CLK_AUDIO_MEM_ASRC343
 #define CLK_AUDIO_MEM_ASRC444
 #define CLK_AUDIO_MEM_ASRC545
-#define CLK_AUDIO_NR_CLK   46
+#define CLK_AUDIO_AFE_CONN 46
+#define CLK_AUDIO_NR_CLK   47
 
 /* SSUSBSYS */
 
-- 
1.9.1



[PATCH v1 6/6] clk: mediatek: add audsys support for MT2701

2018-01-03 Thread Ryder Lee
Add clock driver support for MT2701 audsys.

Signed-off-by: Ryder Lee 
---
 drivers/clk/mediatek/Kconfig  |   6 ++
 drivers/clk/mediatek/Makefile |   1 +
 drivers/clk/mediatek/clk-mt2701-aud.c | 174 ++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-aud.c

diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index 59dc0aa..efb6f58 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -50,6 +50,12 @@ config COMMON_CLK_MT2701_BDPSYS
---help---
  This driver supports Mediatek MT2701 bdpsys clocks.
 
+config COMMON_CLK_MT2701_AUDSYS
+   bool "Clock driver for Mediatek MT2701 audsys"
+   depends on COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 audsys clocks.
+
 config COMMON_CLK_MT2712
bool "Clock driver for Mediatek MT2712"
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index c421ffc..c4ab7d3 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_COMMON_CLK_MT6797_MMSYS) += clk-mt6797-mm.o
 obj-$(CONFIG_COMMON_CLK_MT6797_VDECSYS) += clk-mt6797-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT6797_VENCSYS) += clk-mt6797-venc.o
 obj-$(CONFIG_COMMON_CLK_MT2701) += clk-mt2701.o
+obj-$(CONFIG_COMMON_CLK_MT2701_AUDSYS) += clk-mt2701-aud.o
 obj-$(CONFIG_COMMON_CLK_MT2701_BDPSYS) += clk-mt2701-bdp.o
 obj-$(CONFIG_COMMON_CLK_MT2701_ETHSYS) += clk-mt2701-eth.o
 obj-$(CONFIG_COMMON_CLK_MT2701_HIFSYS) += clk-mt2701-hif.o
diff --git a/drivers/clk/mediatek/clk-mt2701-aud.c 
b/drivers/clk/mediatek/clk-mt2701-aud.c
new file mode 100644
index 000..eafc18e
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt2701-aud.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Ryder Lee 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+#include "clk-gate.h"
+
+#include 
+
+#define GATE_AUDIO0(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+#define GATE_AUDIO1(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+#define GATE_AUDIO2(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+#define GATE_AUDIO3(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+static const struct mtk_gate_regs audio0_cg_regs = {
+   .set_ofs = 0x0,
+   .clr_ofs = 0x0,
+   .sta_ofs = 0x0,
+};
+
+static const struct mtk_gate_regs audio1_cg_regs = {
+   .set_ofs = 0x10,
+   .clr_ofs = 0x10,
+   .sta_ofs = 0x10,
+};
+
+static const struct mtk_gate_regs audio2_cg_regs = {
+   .set_ofs = 0x14,
+   .clr_ofs = 0x14,
+   .sta_ofs = 0x14,
+};
+
+static const struct mtk_gate_regs audio3_cg_regs = {
+   .set_ofs = 0x634,
+   .clr_ofs = 0x634,
+   .sta_ofs = 0x634,
+};
+
+static const struct mtk_gate audio_clks[] = {
+   /* AUDIO0 */
+   GATE_AUDIO0(CLK_AUD_AFE, "audio_afe", "aud_intbus_sel", 2),
+   GATE_AUDIO0(CLK_AUD_HDMI, "audio_hdmi", "audpll_sel", 20),
+   GATE_AUDIO0(CLK_AUD_SPDF, "audio_spdf", "audpll_sel", 21),
+   GATE_AUDIO0(CLK_AUD_SPDF2, "audio_spdf2", "audpll_sel", 22),
+   GATE_AUDIO0(CLK_AUD_APLL, "audio_apll", "audpll_sel", 23),
+   /* AUDIO1 */
+   GATE_AUDIO1(CLK_AUD_I2SIN1, "audio_i2sin1", "aud_mux1_sel", 0),
+   GATE_AUDIO1(CLK_AUD_I2SIN2, "audio_i2sin2", "aud_mux1_sel", 1),
+   GATE_AUDIO1(CLK_AUD_I2SIN3, "audio_i2sin3", "aud_mux1_sel", 2),
+   

[PATCH v1 1/6] ASoC: mediatek: add some core clocks for MT2701 AFE

2018-01-03 Thread Ryder Lee
Add three core clocks for MT2701 AFE.

Signed-off-by: Ryder Lee 
---
 sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c | 30 ++-
 sound/soc/mediatek/mt2701/mt2701-afe-common.h |  3 +++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c 
b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c
index 56a057c..949fc3a 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c
@@ -18,8 +18,11 @@
 #include "mt2701-afe-clock-ctrl.h"
 
 static const char *const base_clks[] = {
+   [MT2701_INFRA_SYS_AUDIO] = "infra_sys_audio_clk",
[MT2701_TOP_AUD_MCLK_SRC0] = "top_audio_mux1_sel",
[MT2701_TOP_AUD_MCLK_SRC1] = "top_audio_mux2_sel",
+   [MT2701_TOP_AUD_A1SYS] = "top_audio_a1sys_hp",
+   [MT2701_TOP_AUD_A2SYS] = "top_audio_a2sys_hp",
[MT2701_AUDSYS_AFE] = "audio_afe_pd",
[MT2701_AUDSYS_AFE_CONN] = "audio_afe_conn_pd",
[MT2701_AUDSYS_A1SYS] = "audio_a1sys_pd",
@@ -169,10 +172,26 @@ static int mt2701_afe_enable_audsys(struct mtk_base_afe 
*afe)
struct mt2701_afe_private *afe_priv = afe->platform_priv;
int ret;
 
-   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+   /* Enable infra clock gate */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_INFRA_SYS_AUDIO]);
if (ret)
return ret;
 
+   /* Enable top a1sys clock gate */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_TOP_AUD_A1SYS]);
+   if (ret)
+   goto err_a1sys;
+
+   /* Enable top a2sys clock gate */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_TOP_AUD_A2SYS]);
+   if (ret)
+   goto err_a2sys;
+
+   /* Internal clock gates */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+   if (ret)
+   goto err_afe;
+
ret = clk_prepare_enable(afe_priv->base_ck[MT2701_AUDSYS_A1SYS]);
if (ret)
goto err_audio_a1sys;
@@ -193,6 +212,12 @@ static int mt2701_afe_enable_audsys(struct mtk_base_afe 
*afe)
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_A1SYS]);
 err_audio_a1sys:
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+err_afe:
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A2SYS]);
+err_a2sys:
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A1SYS]);
+err_a1sys:
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_INFRA_SYS_AUDIO]);
 
return ret;
 }
@@ -205,6 +230,9 @@ static void mt2701_afe_disable_audsys(struct mtk_base_afe 
*afe)
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_A2SYS]);
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_A1SYS]);
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A1SYS]);
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A2SYS]);
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_INFRA_SYS_AUDIO]);
 }
 
 int mt2701_afe_enable_clock(struct mtk_base_afe *afe)
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-common.h 
b/sound/soc/mediatek/mt2701/mt2701-afe-common.h
index 9a2b301..ae8ddea 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-common.h
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-common.h
@@ -61,8 +61,11 @@ enum {
 };
 
 enum audio_base_clock {
+   MT2701_INFRA_SYS_AUDIO,
MT2701_TOP_AUD_MCLK_SRC0,
MT2701_TOP_AUD_MCLK_SRC1,
+   MT2701_TOP_AUD_A1SYS,
+   MT2701_TOP_AUD_A2SYS,
MT2701_AUDSYS_AFE,
MT2701_AUDSYS_AFE_CONN,
MT2701_AUDSYS_A1SYS,
-- 
1.9.1



[PATCH v1 4/6] dt-bindings: clock: mediatek: add "simple-mfd" in audsys documentation

2018-01-03 Thread Ryder Lee
Add "simple-mfd" to support MFD device and add a compatible string for MT2701.

Signed-off-by: Ryder Lee 
---
 .../bindings/arm/mediatek/mediatek,audsys.txt   | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
index 9b8f578..6e97552 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
@@ -6,17 +6,25 @@ The MediaTek AUDSYS controller provides various clocks to the 
system.
 Required Properties:
 
 - compatible: Should be one of:
-   - "mediatek,mt7622-audsys", "syscon"
+   - "mediatek,mt2701-audsys", "syscon", "simple-mfd"
+   - "mediatek,mt7622-audsys", "syscon", "simple-mfd"
 - #clock-cells: Must be 1
 
 The AUDSYS controller uses the common clk binding from
 Documentation/devicetree/bindings/clock/clock-bindings.txt
 The available clocks are defined in dt-bindings/clock/mt*-clk.h.
 
+See ../sound/mt2701-afe-pcm.txt for details about required subnode.
+
 Example:
 
-audsys: audsys@1122 {
-   compatible = "mediatek,mt7622-audsys", "syscon";
-   reg = <0 0x1122 0 0x1000>;
-   #clock-cells = <1>;
-};
+   audsys: audio-subsystem@1122 {
+   compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd";
+   reg = <0 0x1122 0 0x1000>;
+   #clock-cells = <1>;
+
+   afe: audio-controller {
+   compatible = "mediatek,mt2701-audio";
+   ...
+   };
+   };
-- 
1.9.1



Re: [PATCH] mm/fadvise: discard partial pages iff endbyte is also eof

2018-01-03 Thread 夷则(Caspar)



On 2018/1/4 14:13, 夷则(Caspar) wrote:


This patch is trying to help to solve a real issue. Sometimes we need to 
evict the whole file from page cache because we are sure it will not be 
used in the near future. We try to use posix_fadvise() to finish our 
work but we often see a "small tail" at the end of some files could not 
be evicted, after digging a little bit, we find those file sizes are not 
page-aligned and the "tail" turns out to be partial pages.


We fail to find a standard from posix_fadvise() manual page to subscribe 
the function behaviors if the `offset' and `len' params are not 


Oops, I find a 'standard' documented in latest man-pages.git[1], blame 
my centos7, it runs with an old man-pages.rpm :-(


Thanks,
Caspar

[1] 
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?h=ceb1c326b9f3e863dfd9bf33bc7118bb1fa29bfc



page-aligned, then we go to kernel tree and see this:

     /*
  * First and last FULL page! Partial pages are deliberately
  * preserved on the expectation that it is better to preserve
  * needed memory than to discard unneeded memory.
  */


[PATCH v1 6/6] clk: mediatek: add audsys support for MT2701

2018-01-03 Thread Ryder Lee
Add clock driver support for MT2701 audsys.

Signed-off-by: Ryder Lee 
---
 drivers/clk/mediatek/Kconfig  |   6 ++
 drivers/clk/mediatek/Makefile |   1 +
 drivers/clk/mediatek/clk-mt2701-aud.c | 174 ++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-aud.c

diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index 59dc0aa..efb6f58 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -50,6 +50,12 @@ config COMMON_CLK_MT2701_BDPSYS
---help---
  This driver supports Mediatek MT2701 bdpsys clocks.
 
+config COMMON_CLK_MT2701_AUDSYS
+   bool "Clock driver for Mediatek MT2701 audsys"
+   depends on COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 audsys clocks.
+
 config COMMON_CLK_MT2712
bool "Clock driver for Mediatek MT2712"
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index c421ffc..c4ab7d3 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_COMMON_CLK_MT6797_MMSYS) += clk-mt6797-mm.o
 obj-$(CONFIG_COMMON_CLK_MT6797_VDECSYS) += clk-mt6797-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT6797_VENCSYS) += clk-mt6797-venc.o
 obj-$(CONFIG_COMMON_CLK_MT2701) += clk-mt2701.o
+obj-$(CONFIG_COMMON_CLK_MT2701_AUDSYS) += clk-mt2701-aud.o
 obj-$(CONFIG_COMMON_CLK_MT2701_BDPSYS) += clk-mt2701-bdp.o
 obj-$(CONFIG_COMMON_CLK_MT2701_ETHSYS) += clk-mt2701-eth.o
 obj-$(CONFIG_COMMON_CLK_MT2701_HIFSYS) += clk-mt2701-hif.o
diff --git a/drivers/clk/mediatek/clk-mt2701-aud.c 
b/drivers/clk/mediatek/clk-mt2701-aud.c
new file mode 100644
index 000..eafc18e
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt2701-aud.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Ryder Lee 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+#include "clk-gate.h"
+
+#include 
+
+#define GATE_AUDIO0(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+#define GATE_AUDIO1(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+#define GATE_AUDIO2(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+#define GATE_AUDIO3(_id, _name, _parent, _shift) { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_name = _parent, \
+   .regs = _cg_regs,\
+   .shift = _shift,\
+   .ops = _clk_gate_ops_no_setclr, \
+   }
+
+static const struct mtk_gate_regs audio0_cg_regs = {
+   .set_ofs = 0x0,
+   .clr_ofs = 0x0,
+   .sta_ofs = 0x0,
+};
+
+static const struct mtk_gate_regs audio1_cg_regs = {
+   .set_ofs = 0x10,
+   .clr_ofs = 0x10,
+   .sta_ofs = 0x10,
+};
+
+static const struct mtk_gate_regs audio2_cg_regs = {
+   .set_ofs = 0x14,
+   .clr_ofs = 0x14,
+   .sta_ofs = 0x14,
+};
+
+static const struct mtk_gate_regs audio3_cg_regs = {
+   .set_ofs = 0x634,
+   .clr_ofs = 0x634,
+   .sta_ofs = 0x634,
+};
+
+static const struct mtk_gate audio_clks[] = {
+   /* AUDIO0 */
+   GATE_AUDIO0(CLK_AUD_AFE, "audio_afe", "aud_intbus_sel", 2),
+   GATE_AUDIO0(CLK_AUD_HDMI, "audio_hdmi", "audpll_sel", 20),
+   GATE_AUDIO0(CLK_AUD_SPDF, "audio_spdf", "audpll_sel", 21),
+   GATE_AUDIO0(CLK_AUD_SPDF2, "audio_spdf2", "audpll_sel", 22),
+   GATE_AUDIO0(CLK_AUD_APLL, "audio_apll", "audpll_sel", 23),
+   /* AUDIO1 */
+   GATE_AUDIO1(CLK_AUD_I2SIN1, "audio_i2sin1", "aud_mux1_sel", 0),
+   GATE_AUDIO1(CLK_AUD_I2SIN2, "audio_i2sin2", "aud_mux1_sel", 1),
+   GATE_AUDIO1(CLK_AUD_I2SIN3, "audio_i2sin3", "aud_mux1_sel", 2),
+   GATE_AUDIO1(CLK_AUD_I2SIN4, "audio_i2sin4", 

[PATCH v1 1/6] ASoC: mediatek: add some core clocks for MT2701 AFE

2018-01-03 Thread Ryder Lee
Add three core clocks for MT2701 AFE.

Signed-off-by: Ryder Lee 
---
 sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c | 30 ++-
 sound/soc/mediatek/mt2701/mt2701-afe-common.h |  3 +++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c 
b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c
index 56a057c..949fc3a 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c
@@ -18,8 +18,11 @@
 #include "mt2701-afe-clock-ctrl.h"
 
 static const char *const base_clks[] = {
+   [MT2701_INFRA_SYS_AUDIO] = "infra_sys_audio_clk",
[MT2701_TOP_AUD_MCLK_SRC0] = "top_audio_mux1_sel",
[MT2701_TOP_AUD_MCLK_SRC1] = "top_audio_mux2_sel",
+   [MT2701_TOP_AUD_A1SYS] = "top_audio_a1sys_hp",
+   [MT2701_TOP_AUD_A2SYS] = "top_audio_a2sys_hp",
[MT2701_AUDSYS_AFE] = "audio_afe_pd",
[MT2701_AUDSYS_AFE_CONN] = "audio_afe_conn_pd",
[MT2701_AUDSYS_A1SYS] = "audio_a1sys_pd",
@@ -169,10 +172,26 @@ static int mt2701_afe_enable_audsys(struct mtk_base_afe 
*afe)
struct mt2701_afe_private *afe_priv = afe->platform_priv;
int ret;
 
-   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+   /* Enable infra clock gate */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_INFRA_SYS_AUDIO]);
if (ret)
return ret;
 
+   /* Enable top a1sys clock gate */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_TOP_AUD_A1SYS]);
+   if (ret)
+   goto err_a1sys;
+
+   /* Enable top a2sys clock gate */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_TOP_AUD_A2SYS]);
+   if (ret)
+   goto err_a2sys;
+
+   /* Internal clock gates */
+   ret = clk_prepare_enable(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+   if (ret)
+   goto err_afe;
+
ret = clk_prepare_enable(afe_priv->base_ck[MT2701_AUDSYS_A1SYS]);
if (ret)
goto err_audio_a1sys;
@@ -193,6 +212,12 @@ static int mt2701_afe_enable_audsys(struct mtk_base_afe 
*afe)
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_A1SYS]);
 err_audio_a1sys:
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+err_afe:
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A2SYS]);
+err_a2sys:
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A1SYS]);
+err_a1sys:
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_INFRA_SYS_AUDIO]);
 
return ret;
 }
@@ -205,6 +230,9 @@ static void mt2701_afe_disable_audsys(struct mtk_base_afe 
*afe)
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_A2SYS]);
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_A1SYS]);
clk_disable_unprepare(afe_priv->base_ck[MT2701_AUDSYS_AFE]);
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A1SYS]);
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_TOP_AUD_A2SYS]);
+   clk_disable_unprepare(afe_priv->base_ck[MT2701_INFRA_SYS_AUDIO]);
 }
 
 int mt2701_afe_enable_clock(struct mtk_base_afe *afe)
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-common.h 
b/sound/soc/mediatek/mt2701/mt2701-afe-common.h
index 9a2b301..ae8ddea 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-common.h
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-common.h
@@ -61,8 +61,11 @@ enum {
 };
 
 enum audio_base_clock {
+   MT2701_INFRA_SYS_AUDIO,
MT2701_TOP_AUD_MCLK_SRC0,
MT2701_TOP_AUD_MCLK_SRC1,
+   MT2701_TOP_AUD_A1SYS,
+   MT2701_TOP_AUD_A2SYS,
MT2701_AUDSYS_AFE,
MT2701_AUDSYS_AFE_CONN,
MT2701_AUDSYS_A1SYS,
-- 
1.9.1



[PATCH v1 4/6] dt-bindings: clock: mediatek: add "simple-mfd" in audsys documentation

2018-01-03 Thread Ryder Lee
Add "simple-mfd" to support MFD device and add a compatible string for MT2701.

Signed-off-by: Ryder Lee 
---
 .../bindings/arm/mediatek/mediatek,audsys.txt   | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
index 9b8f578..6e97552 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
@@ -6,17 +6,25 @@ The MediaTek AUDSYS controller provides various clocks to the 
system.
 Required Properties:
 
 - compatible: Should be one of:
-   - "mediatek,mt7622-audsys", "syscon"
+   - "mediatek,mt2701-audsys", "syscon", "simple-mfd"
+   - "mediatek,mt7622-audsys", "syscon", "simple-mfd"
 - #clock-cells: Must be 1
 
 The AUDSYS controller uses the common clk binding from
 Documentation/devicetree/bindings/clock/clock-bindings.txt
 The available clocks are defined in dt-bindings/clock/mt*-clk.h.
 
+See ../sound/mt2701-afe-pcm.txt for details about required subnode.
+
 Example:
 
-audsys: audsys@1122 {
-   compatible = "mediatek,mt7622-audsys", "syscon";
-   reg = <0 0x1122 0 0x1000>;
-   #clock-cells = <1>;
-};
+   audsys: audio-subsystem@1122 {
+   compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd";
+   reg = <0 0x1122 0 0x1000>;
+   #clock-cells = <1>;
+
+   afe: audio-controller {
+   compatible = "mediatek,mt2701-audio";
+   ...
+   };
+   };
-- 
1.9.1



Re: [PATCH] mm/fadvise: discard partial pages iff endbyte is also eof

2018-01-03 Thread 夷则(Caspar)



On 2018/1/4 14:13, 夷则(Caspar) wrote:


This patch is trying to help to solve a real issue. Sometimes we need to 
evict the whole file from page cache because we are sure it will not be 
used in the near future. We try to use posix_fadvise() to finish our 
work but we often see a "small tail" at the end of some files could not 
be evicted, after digging a little bit, we find those file sizes are not 
page-aligned and the "tail" turns out to be partial pages.


We fail to find a standard from posix_fadvise() manual page to subscribe 
the function behaviors if the `offset' and `len' params are not 


Oops, I find a 'standard' documented in latest man-pages.git[1], blame 
my centos7, it runs with an old man-pages.rpm :-(


Thanks,
Caspar

[1] 
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?h=ceb1c326b9f3e863dfd9bf33bc7118bb1fa29bfc



page-aligned, then we go to kernel tree and see this:

     /*
  * First and last FULL page! Partial pages are deliberately
  * preserved on the expectation that it is better to preserve
  * needed memory than to discard unneeded memory.
  */


[PATCH v1 0/6] add "simple-mfd" support for MediaTek audio subsystem

2018-01-03 Thread Ryder Lee
Hi,

The reason for this series is that MediaTek audio hardware block expose more 
than
a single functionality, but register those in different kernel subsystems.
Same issue could also be found in MMSYS: https://lkml.org/lkml/2017/11/14/669

Hence use "simple-mfd" to handle this kind of situation, that will make sure all
children are registered - and we don't need to write an MFD driver specially.
It was tested on the bananapi-r2 and the MT2701/MT7622 EVB.

[1]~[3]: modify the current audio driver accordingly.
[5][6]: add clock driver for MT2701 and add missing data for MT7622.

changes since v1:
 - To avoid writing an MFD driver, we add "simple-mfd" in the audsys binding.
 - Move three top clocks to audio driver [1] as we remove mfd/mtk-audsys.c in 
v1.

Ryder Lee (6):
  ASoC: mediatek: add some core clocks for MT2701 AFE
  ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device
  ASoC: mediatek: update MT2701 AFE documentation to adapt mfd device
  dt-bindings: clock: mediatek: add "simple-mfd" in audsys documentation
  clk: mediatek: update missing clock data for MT7622 audsys
  clk: mediatek: add audsys support for MT2701

 .../bindings/arm/mediatek/mediatek,audsys.txt  |  21 ++-
 .../devicetree/bindings/sound/mt2701-afe-pcm.txt   | 171 +++-
 drivers/clk/mediatek/Kconfig   |   6 +
 drivers/clk/mediatek/Makefile  |   1 +
 drivers/clk/mediatek/clk-mt2701-aud.c  | 174 +
 drivers/clk/mediatek/clk-mt7622-aud.c  |   3 +-
 include/dt-bindings/clock/mt7622-clk.h |   3 +-
 sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c  |  30 +++-
 sound/soc/mediatek/mt2701/mt2701-afe-common.h  |   3 +
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c |  45 +++---
 sound/soc/mediatek/mt2701/mt2701-reg.h |   1 -
 11 files changed, 345 insertions(+), 113 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-aud.c

-- 
1.9.1



[PATCH v1 2/6] ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device

2018-01-03 Thread Ryder Lee
As the new MFD parent is in place, modify MT2701 AFE driver to adapt it.

Signed-off-by: Ryder Lee 
---
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 45 +-
 sound/soc/mediatek/mt2701/mt2701-reg.h |  1 -
 2 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c 
b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
index 0edadca..f0cd08f 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1368,14 +1369,6 @@ static int mt2701_irq_fs(struct snd_pcm_substream 
*substream, unsigned int rate)
},
 };
 
-static const struct regmap_config mt2701_afe_regmap_config = {
-   .reg_bits = 32,
-   .reg_stride = 4,
-   .val_bits = 32,
-   .max_register = AFE_END_ADDR,
-   .cache_type = REGCACHE_NONE,
-};
-
 static irqreturn_t mt2701_asys_isr(int irq_id, void *dev)
 {
int id;
@@ -1414,9 +1407,9 @@ static int mt2701_afe_runtime_resume(struct device *dev)
 
 static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
 {
+   struct snd_soc_component *component;
struct mtk_base_afe *afe;
struct mt2701_afe_private *afe_priv;
-   struct resource *res;
struct device *dev;
int i, irq_id, ret;
 
@@ -1446,17 +1439,11 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
return ret;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-   afe->base_addr = devm_ioremap_resource(>dev, res);
-
-   if (IS_ERR(afe->base_addr))
-   return PTR_ERR(afe->base_addr);
-
-   afe->regmap = devm_regmap_init_mmio(>dev, afe->base_addr,
-   _afe_regmap_config);
-   if (IS_ERR(afe->regmap))
-   return PTR_ERR(afe->regmap);
+   afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
+   if (!afe->regmap) {
+   dev_err(dev, "could not get regmap from parent\n");
+   return -ENODEV;
+   }
 
mutex_init(>irq_alloc_lock);
 
@@ -1490,6 +1477,12 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
= _i2s_data[i][I2S_IN];
}
 
+   component = kzalloc(sizeof(*component), GFP_KERNEL);
+   if (!component)
+   return -ENOMEM;
+
+   component->regmap = afe->regmap;
+
afe->mtk_afe_hardware = _afe_hardware;
afe->memif_fs = mt2701_memif_fs;
afe->irq_fs = mt2701_irq_fs;
@@ -1502,7 +1495,7 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
ret = mt2701_init_clock(afe);
if (ret) {
dev_err(dev, "init clock error\n");
-   return ret;
+   goto err_init_clock;
}
 
platform_set_drvdata(pdev, afe);
@@ -1521,10 +1514,10 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
goto err_platform;
}
 
-   ret = snd_soc_register_component(>dev,
-_afe_pcm_dai_component,
-mt2701_afe_pcm_dais,
-ARRAY_SIZE(mt2701_afe_pcm_dais));
+   ret = snd_soc_add_component(dev, component,
+   _afe_pcm_dai_component,
+   mt2701_afe_pcm_dais,
+   ARRAY_SIZE(mt2701_afe_pcm_dais));
if (ret) {
dev_warn(dev, "err_dai_component\n");
goto err_dai_component;
@@ -1538,6 +1531,8 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
pm_runtime_put_sync(dev);
 err_pm_disable:
pm_runtime_disable(dev);
+err_init_clock:
+   kfree(component);
 
return ret;
 }
diff --git a/sound/soc/mediatek/mt2701/mt2701-reg.h 
b/sound/soc/mediatek/mt2701/mt2701-reg.h
index f17c76f..18e6769 100644
--- a/sound/soc/mediatek/mt2701/mt2701-reg.h
+++ b/sound/soc/mediatek/mt2701/mt2701-reg.h
@@ -145,5 +145,4 @@
 #define ASYS_I2S_CON_WIDE_MODE_SET(x)  ((x) << 1)
 #define ASYS_I2S_IN_PHASE_FIX  (0x1 << 31)
 
-#define AFE_END_ADDR 0x15e0
 #endif
-- 
1.9.1



[PATCH v1 0/6] add "simple-mfd" support for MediaTek audio subsystem

2018-01-03 Thread Ryder Lee
Hi,

The reason for this series is that MediaTek audio hardware block expose more 
than
a single functionality, but register those in different kernel subsystems.
Same issue could also be found in MMSYS: https://lkml.org/lkml/2017/11/14/669

Hence use "simple-mfd" to handle this kind of situation, that will make sure all
children are registered - and we don't need to write an MFD driver specially.
It was tested on the bananapi-r2 and the MT2701/MT7622 EVB.

[1]~[3]: modify the current audio driver accordingly.
[5][6]: add clock driver for MT2701 and add missing data for MT7622.

changes since v1:
 - To avoid writing an MFD driver, we add "simple-mfd" in the audsys binding.
 - Move three top clocks to audio driver [1] as we remove mfd/mtk-audsys.c in 
v1.

Ryder Lee (6):
  ASoC: mediatek: add some core clocks for MT2701 AFE
  ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device
  ASoC: mediatek: update MT2701 AFE documentation to adapt mfd device
  dt-bindings: clock: mediatek: add "simple-mfd" in audsys documentation
  clk: mediatek: update missing clock data for MT7622 audsys
  clk: mediatek: add audsys support for MT2701

 .../bindings/arm/mediatek/mediatek,audsys.txt  |  21 ++-
 .../devicetree/bindings/sound/mt2701-afe-pcm.txt   | 171 +++-
 drivers/clk/mediatek/Kconfig   |   6 +
 drivers/clk/mediatek/Makefile  |   1 +
 drivers/clk/mediatek/clk-mt2701-aud.c  | 174 +
 drivers/clk/mediatek/clk-mt7622-aud.c  |   3 +-
 include/dt-bindings/clock/mt7622-clk.h |   3 +-
 sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c  |  30 +++-
 sound/soc/mediatek/mt2701/mt2701-afe-common.h  |   3 +
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c |  45 +++---
 sound/soc/mediatek/mt2701/mt2701-reg.h |   1 -
 11 files changed, 345 insertions(+), 113 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-aud.c

-- 
1.9.1



[PATCH v1 2/6] ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device

2018-01-03 Thread Ryder Lee
As the new MFD parent is in place, modify MT2701 AFE driver to adapt it.

Signed-off-by: Ryder Lee 
---
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 45 +-
 sound/soc/mediatek/mt2701/mt2701-reg.h |  1 -
 2 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c 
b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
index 0edadca..f0cd08f 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1368,14 +1369,6 @@ static int mt2701_irq_fs(struct snd_pcm_substream 
*substream, unsigned int rate)
},
 };
 
-static const struct regmap_config mt2701_afe_regmap_config = {
-   .reg_bits = 32,
-   .reg_stride = 4,
-   .val_bits = 32,
-   .max_register = AFE_END_ADDR,
-   .cache_type = REGCACHE_NONE,
-};
-
 static irqreturn_t mt2701_asys_isr(int irq_id, void *dev)
 {
int id;
@@ -1414,9 +1407,9 @@ static int mt2701_afe_runtime_resume(struct device *dev)
 
 static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
 {
+   struct snd_soc_component *component;
struct mtk_base_afe *afe;
struct mt2701_afe_private *afe_priv;
-   struct resource *res;
struct device *dev;
int i, irq_id, ret;
 
@@ -1446,17 +1439,11 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
return ret;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-   afe->base_addr = devm_ioremap_resource(>dev, res);
-
-   if (IS_ERR(afe->base_addr))
-   return PTR_ERR(afe->base_addr);
-
-   afe->regmap = devm_regmap_init_mmio(>dev, afe->base_addr,
-   _afe_regmap_config);
-   if (IS_ERR(afe->regmap))
-   return PTR_ERR(afe->regmap);
+   afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
+   if (!afe->regmap) {
+   dev_err(dev, "could not get regmap from parent\n");
+   return -ENODEV;
+   }
 
mutex_init(>irq_alloc_lock);
 
@@ -1490,6 +1477,12 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
= _i2s_data[i][I2S_IN];
}
 
+   component = kzalloc(sizeof(*component), GFP_KERNEL);
+   if (!component)
+   return -ENOMEM;
+
+   component->regmap = afe->regmap;
+
afe->mtk_afe_hardware = _afe_hardware;
afe->memif_fs = mt2701_memif_fs;
afe->irq_fs = mt2701_irq_fs;
@@ -1502,7 +1495,7 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
ret = mt2701_init_clock(afe);
if (ret) {
dev_err(dev, "init clock error\n");
-   return ret;
+   goto err_init_clock;
}
 
platform_set_drvdata(pdev, afe);
@@ -1521,10 +1514,10 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
goto err_platform;
}
 
-   ret = snd_soc_register_component(>dev,
-_afe_pcm_dai_component,
-mt2701_afe_pcm_dais,
-ARRAY_SIZE(mt2701_afe_pcm_dais));
+   ret = snd_soc_add_component(dev, component,
+   _afe_pcm_dai_component,
+   mt2701_afe_pcm_dais,
+   ARRAY_SIZE(mt2701_afe_pcm_dais));
if (ret) {
dev_warn(dev, "err_dai_component\n");
goto err_dai_component;
@@ -1538,6 +1531,8 @@ static int mt2701_afe_pcm_dev_probe(struct 
platform_device *pdev)
pm_runtime_put_sync(dev);
 err_pm_disable:
pm_runtime_disable(dev);
+err_init_clock:
+   kfree(component);
 
return ret;
 }
diff --git a/sound/soc/mediatek/mt2701/mt2701-reg.h 
b/sound/soc/mediatek/mt2701/mt2701-reg.h
index f17c76f..18e6769 100644
--- a/sound/soc/mediatek/mt2701/mt2701-reg.h
+++ b/sound/soc/mediatek/mt2701/mt2701-reg.h
@@ -145,5 +145,4 @@
 #define ASYS_I2S_CON_WIDE_MODE_SET(x)  ((x) << 1)
 #define ASYS_I2S_IN_PHASE_FIX  (0x1 << 31)
 
-#define AFE_END_ADDR 0x15e0
 #endif
-- 
1.9.1



Re: [PATCH 4.9 00/39] 4.9.75-stable review

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 08:39:41AM +0100, Greg Kroah-Hartman wrote:
> On Thu, Jan 04, 2018 at 01:24:55AM +, Ben Hutchings wrote:
> > On Wed, 2018-01-03 at 21:11 +0100, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 4.9.75 release.
> > > There are 39 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > [...]
> > 
> > This seems to be missing a backport of:
> > 
> > commit 85900ea51577e31b186e523c8f4e068c79ecc7d3
> > Author: Andy Lutomirski 
> > Date:   Tue Dec 12 07:56:42 2017 -0800
> > 
> > x86/pti: Map the vsyscall page if needed
> > 
> > without which, KPTI will break some older user-space.
> 
> Ah crap, thanks, I forgot that one in all of this mess, I'll go queue it
> up now.

Oops, no, nevermind, I need to read the rest of this thread before
responding.  I'll leave this as-is for now, and wait for the real fixup.
Or, if I get done with everything else today, work on it myself
(doubtful, this is going to be an "interesting" day...)

thanks,

greg k-h


Re: [PATCH 4.9 00/39] 4.9.75-stable review

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 08:39:41AM +0100, Greg Kroah-Hartman wrote:
> On Thu, Jan 04, 2018 at 01:24:55AM +, Ben Hutchings wrote:
> > On Wed, 2018-01-03 at 21:11 +0100, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 4.9.75 release.
> > > There are 39 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > [...]
> > 
> > This seems to be missing a backport of:
> > 
> > commit 85900ea51577e31b186e523c8f4e068c79ecc7d3
> > Author: Andy Lutomirski 
> > Date:   Tue Dec 12 07:56:42 2017 -0800
> > 
> > x86/pti: Map the vsyscall page if needed
> > 
> > without which, KPTI will break some older user-space.
> 
> Ah crap, thanks, I forgot that one in all of this mess, I'll go queue it
> up now.

Oops, no, nevermind, I need to read the rest of this thread before
responding.  I'll leave this as-is for now, and wait for the real fixup.
Or, if I get done with everything else today, work on it myself
(doubtful, this is going to be an "interesting" day...)

thanks,

greg k-h


Re: [PATCH 4.9 00/39] 4.9.75-stable review

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 01:24:55AM +, Ben Hutchings wrote:
> On Wed, 2018-01-03 at 21:11 +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.9.75 release.
> > There are 39 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> [...]
> 
> This seems to be missing a backport of:
> 
> commit 85900ea51577e31b186e523c8f4e068c79ecc7d3
> Author: Andy Lutomirski 
> Date:   Tue Dec 12 07:56:42 2017 -0800
> 
> x86/pti: Map the vsyscall page if needed
> 
> without which, KPTI will break some older user-space.

Ah crap, thanks, I forgot that one in all of this mess, I'll go queue it
up now.

greg k-h


Re: [PATCH 4.9 00/39] 4.9.75-stable review

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 01:24:55AM +, Ben Hutchings wrote:
> On Wed, 2018-01-03 at 21:11 +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.9.75 release.
> > There are 39 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> [...]
> 
> This seems to be missing a backport of:
> 
> commit 85900ea51577e31b186e523c8f4e068c79ecc7d3
> Author: Andy Lutomirski 
> Date:   Tue Dec 12 07:56:42 2017 -0800
> 
> x86/pti: Map the vsyscall page if needed
> 
> without which, KPTI will break some older user-space.

Ah crap, thanks, I forgot that one in all of this mess, I'll go queue it
up now.

greg k-h


Re: [PATCH 4.9 29/39] x86/kaiser: Check boottime cmdline params

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 08:05:50AM +0100, Borislav Petkov wrote:
> On Thu, Jan 04, 2018 at 12:16:08AM +, Ben Hutchings wrote:
> > No such exception has been added upstream, so I don't think it's
> > appropriate to add it in stable.
> 
> On its way:
> 
> https://git.kernel.org/tip/694d99d40972f12e59a3696effee8a376b79d7c8

Now in Linus's tree, so I'll leave this as-is, thanks.

greg k-h


Re: [PATCH 4.9 29/39] x86/kaiser: Check boottime cmdline params

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 08:05:50AM +0100, Borislav Petkov wrote:
> On Thu, Jan 04, 2018 at 12:16:08AM +, Ben Hutchings wrote:
> > No such exception has been added upstream, so I don't think it's
> > appropriate to add it in stable.
> 
> On its way:
> 
> https://git.kernel.org/tip/694d99d40972f12e59a3696effee8a376b79d7c8

Now in Linus's tree, so I'll leave this as-is, thanks.

greg k-h


Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset

2018-01-03 Thread Himanshu Jha
Hello Martin,

On Thu, Jan 04, 2018 at 01:17:52AM -0500, Martin K. Petersen wrote:
> 
> Himanshu,
> 
> > Use dma_zalloc_coherent instead of dma_alloc_coherent followed by
> > memset 0.
> 
> Does not apply to 4.16/scsi-queue. Please resubmit. Thanks!

No problem, I will resend the patch.

scsi: qla4xxx: Use zeroing allocator rather than allocator/memset --Applied
scsi: qla2xxx: Use zeroing allocator rather than allocator/memset --Applied
scsi: qedi: Use zeroing allocator instead of allocator/memset --Resend
scsi: mvsas: Use zeroing allocator rather than allocator/memset
scsi: fnic: Use zeroing allocator rather than allocator/memset
scsi: dpt_i2o: Use zeroing allocator rather than allocator/memset
scsi: bnx2fc: Use zeroing allocator rather than allocator/memset --Resend
scsi: bfa: Use zeroing allocator rather than allocator/memset --Applied
scsi: bnx2i: Use zeroing allocator rather than allocator/memset --Applied

But do I also need to send those mentioned above, which didn't receive
any response from you ?

Also, I later sent a patch for fnic after this series which can be
applied after or before this series whichever is suitable to you.

Thanks
Himanshu Jha


Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset

2018-01-03 Thread Himanshu Jha
Hello Martin,

On Thu, Jan 04, 2018 at 01:17:52AM -0500, Martin K. Petersen wrote:
> 
> Himanshu,
> 
> > Use dma_zalloc_coherent instead of dma_alloc_coherent followed by
> > memset 0.
> 
> Does not apply to 4.16/scsi-queue. Please resubmit. Thanks!

No problem, I will resend the patch.

scsi: qla4xxx: Use zeroing allocator rather than allocator/memset --Applied
scsi: qla2xxx: Use zeroing allocator rather than allocator/memset --Applied
scsi: qedi: Use zeroing allocator instead of allocator/memset --Resend
scsi: mvsas: Use zeroing allocator rather than allocator/memset
scsi: fnic: Use zeroing allocator rather than allocator/memset
scsi: dpt_i2o: Use zeroing allocator rather than allocator/memset
scsi: bnx2fc: Use zeroing allocator rather than allocator/memset --Resend
scsi: bfa: Use zeroing allocator rather than allocator/memset --Applied
scsi: bnx2i: Use zeroing allocator rather than allocator/memset --Applied

But do I also need to send those mentioned above, which didn't receive
any response from you ?

Also, I later sent a patch for fnic after this series which can be
applied after or before this series whichever is suitable to you.

Thanks
Himanshu Jha


Re: [f2fs-dev] [PATCH 2/2 v2] f2fs: add reserved blocks for root user

2018-01-03 Thread Chao Yu
On 2018/1/4 14:51, Jaegeuk Kim wrote:
> This patch allows root to reserve some blocks via mount option.
> 
> "-o reserve_root=N" means N x 4KB-sized blocks for root only.
> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Chao Yu 

Thanks,



Re: [f2fs-dev] [PATCH 2/2 v2] f2fs: add reserved blocks for root user

2018-01-03 Thread Chao Yu
On 2018/1/4 14:51, Jaegeuk Kim wrote:
> This patch allows root to reserve some blocks via mount option.
> 
> "-o reserve_root=N" means N x 4KB-sized blocks for root only.
> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Chao Yu 

Thanks,



Re: [PATCH 1/2] jump_label: export static_key_slow_inc/dec_cpuslocked()

2018-01-03 Thread Konstantin Khlebnikov
On Thu, Jan 4, 2018 at 2:20 AM, Peter Zijlstra  wrote:
> On Wed, Jan 03, 2018 at 11:29:50PM +0300, Konstantin Khlebnikov wrote:
>> For fixing cpu_hotplug_lock recursion in tg_set_cfs_bandwidth().
>
> Why would that need module exports?

Just for symmetry with other functions.


Re: [PATCH 1/2] jump_label: export static_key_slow_inc/dec_cpuslocked()

2018-01-03 Thread Konstantin Khlebnikov
On Thu, Jan 4, 2018 at 2:20 AM, Peter Zijlstra  wrote:
> On Wed, Jan 03, 2018 at 11:29:50PM +0300, Konstantin Khlebnikov wrote:
>> For fixing cpu_hotplug_lock recursion in tg_set_cfs_bandwidth().
>
> Why would that need module exports?

Just for symmetry with other functions.


Re: [PATCH 0/6] mm, hugetlb: allocation API and migration improvements

2018-01-03 Thread Michal Hocko
On Wed 03-01-18 16:05:23, Andrew Morton wrote:
> On Wed,  3 Jan 2018 10:32:07 +0100 Michal Hocko  wrote:
> 
> > I've posted this as an RFC [1] and both Mike and Naoya seem to be OK
> > both with patches and the approach. I have rebased this on top of [2]
> > because there is a small conflict in mm/mempolicy.c. I know it is late
> > in the release cycle but similarly to [2] I would really like to see
> > this in linux-next for a longer time for a wider testing exposure.
> 
> I'm interpreting this to mean "hold for 4.17-rc1"?

Yeah, that should be good enough. There shouldn't be any reason to rush
this through. I will build more changes on top but that is not critical
either. The longer this will be in linux-next, the better.

Thanks!
-- 
Michal Hocko
SUSE Labs


Re: [PATCH 0/6] mm, hugetlb: allocation API and migration improvements

2018-01-03 Thread Michal Hocko
On Wed 03-01-18 16:05:23, Andrew Morton wrote:
> On Wed,  3 Jan 2018 10:32:07 +0100 Michal Hocko  wrote:
> 
> > I've posted this as an RFC [1] and both Mike and Naoya seem to be OK
> > both with patches and the approach. I have rebased this on top of [2]
> > because there is a small conflict in mm/mempolicy.c. I know it is late
> > in the release cycle but similarly to [2] I would really like to see
> > this in linux-next for a longer time for a wider testing exposure.
> 
> I'm interpreting this to mean "hold for 4.17-rc1"?

Yeah, that should be good enough. There shouldn't be any reason to rush
this through. I will build more changes on top but that is not critical
either. The longer this will be in linux-next, the better.

Thanks!
-- 
Michal Hocko
SUSE Labs


[PATCH 1/2] clk: imx: imx7d: add the snvs clock

2018-01-03 Thread Anson Huang
According to the i.MX7D Reference Manual,
SNVS block has a clock gate, accessing SNVS block
would need this clock gate to be enabled, add it
into clock tree so that SNVS module driver can
operate this clock gate.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx7d.c | 1 +
 include/dt-bindings/clock/imx7d-clock.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 992938b..a284c6f 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -799,6 +799,7 @@ static void __init imx7d_clocks_init(struct device_node 
*ccm_node)
clks[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = 
imx_clk_gate4("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 
0x4130, 0);
clks[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_gate4("dram_alt_root_clk", 
"dram_alt_post_div", base + 0x4130, 0);
clks[IMX7D_OCOTP_CLK] = imx_clk_gate4("ocotp_clk", "ipg_root_clk", base 
+ 0x4230, 0);
+   clks[IMX7D_SNVS_CLK] = imx_clk_gate4("snvs_clk", "ipg_root_clk", base + 
0x4250, 0);
clks[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_gate4("usb_hsic_root_clk", 
"usb_hsic_post_div", base + 0x4420, 0);
clks[IMX7D_SDMA_CORE_CLK] = imx_clk_gate4("sdma_root_clk", 
"ahb_root_clk", base + 0x4480, 0);
clks[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_gate4("pcie_ctrl_root_clk", 
"pcie_ctrl_post_div", base + 0x4600, 0);
diff --git a/include/dt-bindings/clock/imx7d-clock.h 
b/include/dt-bindings/clock/imx7d-clock.h
index e2f99ae..dc51904 100644
--- a/include/dt-bindings/clock/imx7d-clock.h
+++ b/include/dt-bindings/clock/imx7d-clock.h
@@ -452,5 +452,6 @@
 #define IMX7D_OCOTP_CLK439
 #define IMX7D_NAND_RAWNAND_CLK 440
 #define IMX7D_NAND_USDHC_BUS_RAWNAND_CLK 441
-#define IMX7D_CLK_END  442
+#define IMX7D_SNVS_CLK 442
+#define IMX7D_CLK_END  443
 #endif /* __DT_BINDINGS_CLOCK_IMX7D_H */
-- 
1.9.1



[PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock

2018-01-03 Thread Anson Huang
Add i.MX7 SNVS RTC clock.

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx7s.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index e718fd2..f9b97f3 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -534,6 +534,8 @@
offset = <0x34>;
interrupts = ,
 ;
+   clocks = < IMX7D_SNVS_CLK>;
+   clock-names = "snvs-rtc";
};
 
snvs_poweroff: snvs-poweroff {
-- 
1.9.1



[PATCH 1/2] clk: imx: imx7d: add the snvs clock

2018-01-03 Thread Anson Huang
According to the i.MX7D Reference Manual,
SNVS block has a clock gate, accessing SNVS block
would need this clock gate to be enabled, add it
into clock tree so that SNVS module driver can
operate this clock gate.

Signed-off-by: Anson Huang 
---
 drivers/clk/imx/clk-imx7d.c | 1 +
 include/dt-bindings/clock/imx7d-clock.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 992938b..a284c6f 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -799,6 +799,7 @@ static void __init imx7d_clocks_init(struct device_node 
*ccm_node)
clks[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = 
imx_clk_gate4("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 
0x4130, 0);
clks[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_gate4("dram_alt_root_clk", 
"dram_alt_post_div", base + 0x4130, 0);
clks[IMX7D_OCOTP_CLK] = imx_clk_gate4("ocotp_clk", "ipg_root_clk", base 
+ 0x4230, 0);
+   clks[IMX7D_SNVS_CLK] = imx_clk_gate4("snvs_clk", "ipg_root_clk", base + 
0x4250, 0);
clks[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_gate4("usb_hsic_root_clk", 
"usb_hsic_post_div", base + 0x4420, 0);
clks[IMX7D_SDMA_CORE_CLK] = imx_clk_gate4("sdma_root_clk", 
"ahb_root_clk", base + 0x4480, 0);
clks[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_gate4("pcie_ctrl_root_clk", 
"pcie_ctrl_post_div", base + 0x4600, 0);
diff --git a/include/dt-bindings/clock/imx7d-clock.h 
b/include/dt-bindings/clock/imx7d-clock.h
index e2f99ae..dc51904 100644
--- a/include/dt-bindings/clock/imx7d-clock.h
+++ b/include/dt-bindings/clock/imx7d-clock.h
@@ -452,5 +452,6 @@
 #define IMX7D_OCOTP_CLK439
 #define IMX7D_NAND_RAWNAND_CLK 440
 #define IMX7D_NAND_USDHC_BUS_RAWNAND_CLK 441
-#define IMX7D_CLK_END  442
+#define IMX7D_SNVS_CLK 442
+#define IMX7D_CLK_END  443
 #endif /* __DT_BINDINGS_CLOCK_IMX7D_H */
-- 
1.9.1



[PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock

2018-01-03 Thread Anson Huang
Add i.MX7 SNVS RTC clock.

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx7s.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index e718fd2..f9b97f3 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -534,6 +534,8 @@
offset = <0x34>;
interrupts = ,
 ;
+   clocks = < IMX7D_SNVS_CLK>;
+   clock-names = "snvs-rtc";
};
 
snvs_poweroff: snvs-poweroff {
-- 
1.9.1



Re: [PATCH net-next 2/2] tun: allow to attach ebpf socket filter

2018-01-03 Thread Jason Wang



On 2018年01月02日 17:19, Willem de Bruijn wrote:

More importantly, should this program just return a boolean pass or
drop. Taking a length and trimming may introduce bugs later on if the
stack parses the packet unconditionally, expecting a minimum size
to be present.

This was the reason for introducing sk_filter_trim_cap and using that
in other sk_filter sites.

A quick scan shows that tun_put_user expects a full vlan tag to exist
if skb_vlan_tag_present(skb), for instance. If trimmed to below this
length the final call to skb_copy_datagram_iter may have negative
length.

This is an issue with the existing sk_filter call as much as with the
new run_ebpf_filter call.

Good point, so consider it was used by sk_filter too, we need to fix it
anyway. Actually, I've considered the boolean return value but finally I
decide to obey the style of sk filter. Maybe the trimming has real user. e.g
high speed header recoding/analysis? Consider it's not hard to fix, how
about just keep that?

I don't see an obvious use case, but sure. We'll just need to look
at what the minimum trim length needs to be.


Try to reproduce the possible issue, but looks like we are safe since we 
may hit -EFAULT which is returned by skb_copy_datagram_iter() before. So 
in V2, I will keep the code as is except trim 4 more bytes if vlan tag 
is present.


Thanks


Re: [PATCH net-next 2/2] tun: allow to attach ebpf socket filter

2018-01-03 Thread Jason Wang



On 2018年01月02日 17:19, Willem de Bruijn wrote:

More importantly, should this program just return a boolean pass or
drop. Taking a length and trimming may introduce bugs later on if the
stack parses the packet unconditionally, expecting a minimum size
to be present.

This was the reason for introducing sk_filter_trim_cap and using that
in other sk_filter sites.

A quick scan shows that tun_put_user expects a full vlan tag to exist
if skb_vlan_tag_present(skb), for instance. If trimmed to below this
length the final call to skb_copy_datagram_iter may have negative
length.

This is an issue with the existing sk_filter call as much as with the
new run_ebpf_filter call.

Good point, so consider it was used by sk_filter too, we need to fix it
anyway. Actually, I've considered the boolean return value but finally I
decide to obey the style of sk filter. Maybe the trimming has real user. e.g
high speed header recoding/analysis? Consider it's not hard to fix, how
about just keep that?

I don't see an obvious use case, but sure. We'll just need to look
at what the minimum trim length needs to be.


Try to reproduce the possible issue, but looks like we are safe since we 
may hit -EFAULT which is returned by skb_copy_datagram_iter() before. So 
in V2, I will keep the code as is except trim 4 more bytes if vlan tag 
is present.


Thanks


Re: [PATCH v4] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Chao Yu
On 2018/1/4 15:10, Jaegeuk Kim wrote:
> On 01/04, Yunlong Song wrote:
>> In some case, the node blocks has wrong blkaddr whose segment type is
>> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
>> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
>> will cause __f2fs_replace_block change the curseg of node and do the
>> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
>> result, when recovery process write checkpoint and sync nodes, the
>> next_blkoff of curseg is used in the segment bit map, then it will
>> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
>>
>> Signed-off-by: Yunlong Song 
>> ---
>>  fs/f2fs/segment.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 890d483..50575d5 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
>> struct f2fs_summary *sum,
>>  type = se->type;
>>  
>>  down_write(_I(sbi)->curseg_lock);
>> +f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));
> 
> Let me just move this below like this and start some tests.
> 
> ...
> 
> +   f2fs_bug_on(sbi, !IS_DATASEG(type));

Better,

Reviewed-by: Chao Yu 

Thanks,

> curseg = CURSEG_I(sbi, type);
> 
>>  
>>  if (!recover_curseg) {
>>  /* for recovery flow */
>> -- 
>> 1.8.5.2
> 
> .
> 



Re: [PATCH v4] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Chao Yu
On 2018/1/4 15:10, Jaegeuk Kim wrote:
> On 01/04, Yunlong Song wrote:
>> In some case, the node blocks has wrong blkaddr whose segment type is
>> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
>> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
>> will cause __f2fs_replace_block change the curseg of node and do the
>> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
>> result, when recovery process write checkpoint and sync nodes, the
>> next_blkoff of curseg is used in the segment bit map, then it will
>> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
>>
>> Signed-off-by: Yunlong Song 
>> ---
>>  fs/f2fs/segment.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 890d483..50575d5 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
>> struct f2fs_summary *sum,
>>  type = se->type;
>>  
>>  down_write(_I(sbi)->curseg_lock);
>> +f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));
> 
> Let me just move this below like this and start some tests.
> 
> ...
> 
> +   f2fs_bug_on(sbi, !IS_DATASEG(type));

Better,

Reviewed-by: Chao Yu 

Thanks,

> curseg = CURSEG_I(sbi, type);
> 
>>  
>>  if (!recover_curseg) {
>>  /* for recovery flow */
>> -- 
>> 1.8.5.2
> 
> .
> 



[PATCH V2 3/5] drivers: regulator: leave one item to record whether regulator is enabled

2018-01-03 Thread Chunyan Zhang
The items "disabled" and "enabled" are a little redundant, since only one
of them would be set to record if the regulator device should keep on
or be switched to off in suspend states.

So in this patch, the "disabled" was removed, only leave the "enabled":
  - enabled == 1 for regulator-on-in-suspend
  - enabled == 0 for regulator-off-in-suspend
  - enabled == -1 means do nothing when entering suspend mode.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c  | 14 ++
 drivers/regulator/of_regulator.c  |  6 --
 include/linux/regulator/machine.h | 12 +---
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 97bc9f7..5ea80e9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -742,21 +742,19 @@ static int suspend_set_state(struct regulator_dev *rdev,
 * only warn if the driver implements set_suspend_voltage or
 * set_suspend_mode callback.
 */
-   if (!rstate->enabled && !rstate->disabled) {
+   if (rstate->enabled != ENABLE_IN_SUSPEND &&
+   rstate->enabled != DISABLE_IN_SUSPEND) {
if (rdev->desc->ops->set_suspend_voltage ||
rdev->desc->ops->set_suspend_mode)
rdev_warn(rdev, "No configuration\n");
return 0;
}
 
-   if (rstate->enabled && rstate->disabled) {
-   rdev_err(rdev, "invalid configuration\n");
-   return -EINVAL;
-   }
-
-   if (rstate->enabled && rdev->desc->ops->set_suspend_enable)
+   if (rstate->enabled == ENABLE_IN_SUSPEND &&
+   rdev->desc->ops->set_suspend_enable)
ret = rdev->desc->ops->set_suspend_enable(rdev);
-   else if (rstate->disabled && rdev->desc->ops->set_suspend_disable)
+   else if (rstate->enabled == DISABLE_IN_SUSPEND &&
+   rdev->desc->ops->set_suspend_disable)
ret = rdev->desc->ops->set_suspend_disable(rdev);
else /* OK if set_suspend_enable or set_suspend_disable is NULL */
ret = 0;
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 14637a0..41dad42 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -177,10 +177,12 @@ static void of_get_regulation_constraints(struct 
device_node *np,
 
if (of_property_read_bool(suspend_np,
"regulator-on-in-suspend"))
-   suspend_state->enabled = true;
+   suspend_state->enabled = ENABLE_IN_SUSPEND;
else if (of_property_read_bool(suspend_np,
"regulator-off-in-suspend"))
-   suspend_state->disabled = true;
+   suspend_state->enabled = DISABLE_IN_SUSPEND;
+   else
+   suspend_state->enabled = DO_NOTHING_IN_SUSPEND;
 
if (!of_property_read_u32(suspend_np,
"regulator-suspend-microvolt", ))
diff --git a/include/linux/regulator/machine.h 
b/include/linux/regulator/machine.h
index 9cd4fef..e50519f 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -42,6 +42,11 @@ struct regulator;
 #define REGULATOR_CHANGE_DRMS  0x10
 #define REGULATOR_CHANGE_BYPASS0x20
 
+/* operations in suspend mode */
+#define DO_NOTHING_IN_SUSPEND  (-1)
+#define DISABLE_IN_SUSPEND 0
+#define ENABLE_IN_SUSPEND  1
+
 /* Regulator active discharge flags */
 enum regulator_active_discharge {
REGULATOR_ACTIVE_DISCHARGE_DEFAULT,
@@ -58,14 +63,15 @@ enum regulator_active_discharge {
  *
  * @uV: Operating voltage during suspend.
  * @mode: Operating mode during suspend.
- * @enabled: Enabled during suspend.
- * @disabled: Disabled during suspend.
+ * @enabled: operations during suspend.
+ *  - DO_NOTHING_IN_SUSPEND
+ *  - DISABLE_IN_SUSPEND
+ *  - ENABLE_IN_SUSPEND
  */
 struct regulator_state {
int uV; /* suspend voltage */
unsigned int mode; /* suspend regulator operating mode */
int enabled; /* is regulator enabled in this suspend state */
-   int disabled; /* is the regulator disabled in this suspend state */
 };
 
 /**
-- 
2.7.4



[PATCH V2 3/5] drivers: regulator: leave one item to record whether regulator is enabled

2018-01-03 Thread Chunyan Zhang
The items "disabled" and "enabled" are a little redundant, since only one
of them would be set to record if the regulator device should keep on
or be switched to off in suspend states.

So in this patch, the "disabled" was removed, only leave the "enabled":
  - enabled == 1 for regulator-on-in-suspend
  - enabled == 0 for regulator-off-in-suspend
  - enabled == -1 means do nothing when entering suspend mode.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c  | 14 ++
 drivers/regulator/of_regulator.c  |  6 --
 include/linux/regulator/machine.h | 12 +---
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 97bc9f7..5ea80e9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -742,21 +742,19 @@ static int suspend_set_state(struct regulator_dev *rdev,
 * only warn if the driver implements set_suspend_voltage or
 * set_suspend_mode callback.
 */
-   if (!rstate->enabled && !rstate->disabled) {
+   if (rstate->enabled != ENABLE_IN_SUSPEND &&
+   rstate->enabled != DISABLE_IN_SUSPEND) {
if (rdev->desc->ops->set_suspend_voltage ||
rdev->desc->ops->set_suspend_mode)
rdev_warn(rdev, "No configuration\n");
return 0;
}
 
-   if (rstate->enabled && rstate->disabled) {
-   rdev_err(rdev, "invalid configuration\n");
-   return -EINVAL;
-   }
-
-   if (rstate->enabled && rdev->desc->ops->set_suspend_enable)
+   if (rstate->enabled == ENABLE_IN_SUSPEND &&
+   rdev->desc->ops->set_suspend_enable)
ret = rdev->desc->ops->set_suspend_enable(rdev);
-   else if (rstate->disabled && rdev->desc->ops->set_suspend_disable)
+   else if (rstate->enabled == DISABLE_IN_SUSPEND &&
+   rdev->desc->ops->set_suspend_disable)
ret = rdev->desc->ops->set_suspend_disable(rdev);
else /* OK if set_suspend_enable or set_suspend_disable is NULL */
ret = 0;
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 14637a0..41dad42 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -177,10 +177,12 @@ static void of_get_regulation_constraints(struct 
device_node *np,
 
if (of_property_read_bool(suspend_np,
"regulator-on-in-suspend"))
-   suspend_state->enabled = true;
+   suspend_state->enabled = ENABLE_IN_SUSPEND;
else if (of_property_read_bool(suspend_np,
"regulator-off-in-suspend"))
-   suspend_state->disabled = true;
+   suspend_state->enabled = DISABLE_IN_SUSPEND;
+   else
+   suspend_state->enabled = DO_NOTHING_IN_SUSPEND;
 
if (!of_property_read_u32(suspend_np,
"regulator-suspend-microvolt", ))
diff --git a/include/linux/regulator/machine.h 
b/include/linux/regulator/machine.h
index 9cd4fef..e50519f 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -42,6 +42,11 @@ struct regulator;
 #define REGULATOR_CHANGE_DRMS  0x10
 #define REGULATOR_CHANGE_BYPASS0x20
 
+/* operations in suspend mode */
+#define DO_NOTHING_IN_SUSPEND  (-1)
+#define DISABLE_IN_SUSPEND 0
+#define ENABLE_IN_SUSPEND  1
+
 /* Regulator active discharge flags */
 enum regulator_active_discharge {
REGULATOR_ACTIVE_DISCHARGE_DEFAULT,
@@ -58,14 +63,15 @@ enum regulator_active_discharge {
  *
  * @uV: Operating voltage during suspend.
  * @mode: Operating mode during suspend.
- * @enabled: Enabled during suspend.
- * @disabled: Disabled during suspend.
+ * @enabled: operations during suspend.
+ *  - DO_NOTHING_IN_SUSPEND
+ *  - DISABLE_IN_SUSPEND
+ *  - ENABLE_IN_SUSPEND
  */
 struct regulator_state {
int uV; /* suspend voltage */
unsigned int mode; /* suspend regulator operating mode */
int enabled; /* is regulator enabled in this suspend state */
-   int disabled; /* is the regulator disabled in this suspend state */
 };
 
 /**
-- 
2.7.4



Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Ingo Molnar

* Ingo Molnar  wrote:

> These will cherry-pick cleanly, so it would be nice to test them on top of of 
> the 
> -stable kernel that fails:
> 
>   for N in 450cbdd0125c 4d2dc2cc766c 1e0f25dbf246 be62a3204406 0c3292ca8025 
> 9d0b62328d34; do git cherry-pick $N; done
> 
> if this brute-force approach resolves the problem then we have a shorter list 
> of 
> fixes to look at.

As per Greg's followup this should not matter - but nevertheless for 
completeness 
these commits also need f54bb2ec02c83 as a dependency, so the full list is:

   for N in 450cbdd0125c 4d2dc2cc766c 1e0f25dbf246 be62a3204406 0c3292ca8025 
9d0b62328d34 f54bb2ec02c83; do git cherry-pick $N; done

Thanks,

Ingo


Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Ingo Molnar

* Ingo Molnar  wrote:

> These will cherry-pick cleanly, so it would be nice to test them on top of of 
> the 
> -stable kernel that fails:
> 
>   for N in 450cbdd0125c 4d2dc2cc766c 1e0f25dbf246 be62a3204406 0c3292ca8025 
> 9d0b62328d34; do git cherry-pick $N; done
> 
> if this brute-force approach resolves the problem then we have a shorter list 
> of 
> fixes to look at.

As per Greg's followup this should not matter - but nevertheless for 
completeness 
these commits also need f54bb2ec02c83 as a dependency, so the full list is:

   for N in 450cbdd0125c 4d2dc2cc766c 1e0f25dbf246 be62a3204406 0c3292ca8025 
9d0b62328d34 f54bb2ec02c83; do git cherry-pick $N; done

Thanks,

Ingo


Re: [PATCH v9 7/8] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64

2018-01-03 Thread Horia Geantă
On 1/3/2018 8:07 PM, Logan Gunthorpe wrote:
> Clean up the extra ifdefs which defined the wr_reg64 and rd_reg64
> functions in non-64bit cases in favour of the new common
> io-64-nonatomic-lo-hi header.
> 
> Signed-off-by: Logan Gunthorpe 
> Cc: Andy Shevchenko 
> Cc: Horia Geantă 
> Cc: Dan Douglass 
> Cc: Herbert Xu 
> Cc: "David S. Miller" 
> ---
>  drivers/crypto/caam/regs.h | 26 +-
>  1 file changed, 1 insertion(+), 25 deletions(-)
> 
> diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
> index fee363865d88..ec6528e5ce9d 100644
> --- a/drivers/crypto/caam/regs.h
> +++ b/drivers/crypto/caam/regs.h
> @@ -10,7 +10,7 @@
>  
>  #include 
>  #include 
> -#include 
> +#include 
Typo: lo-hi should be used instead (see previous patch versions).

Please add in the commit message the explanation (which was there in v8 but
removed in v9):
To be consistent with CAAM engine HW spec: in case of 64-bit registers,
irrespective of device endianness, the lower address should be read from
/ written to first, followed by the upper address. Indeed the I/O
accessors in CAAM driver currently don't follow the spec, however this
is a good opportunity to fix the code.

>  
>  /*
>   * Architecture-specific register access methods
> @@ -136,7 +136,6 @@ static inline void clrsetbits_32(void __iomem *reg, u32 
> clear, u32 set)
>   *base + 0x : least-significant 32 bits
>   *base + 0x0004 : most-significant 32 bits
>   */
> -#ifdef CONFIG_64BIT
>  static inline void wr_reg64(void __iomem *reg, u64 data)
>  {
>   if (caam_little_end)
Since the 2 cases (32/64-bit) are merged, caam_imx should be accounted for the
logic to stay the same.

This means for e.g. for wr_reg64 (similar for rd_reg64):
static inline void wr_reg64(void __iomem *reg, u64 data)
{
if (!caam_imx && caam_little_end)
iowrite64(data, reg);
else
iowrite64be(data, reg);
}

Thanks,
Horia

> @@ -153,29 +152,6 @@ static inline u64 rd_reg64(void __iomem *reg)
>   return ioread64be(reg);
>  }
>  
> -#else /* CONFIG_64BIT */
> -static inline void wr_reg64(void __iomem *reg, u64 data)
> -{
> - if (!caam_imx && caam_little_end) {
> - wr_reg32((u32 __iomem *)(reg) + 1, data >> 32);
> - wr_reg32((u32 __iomem *)(reg), data);
> - } else {
> - wr_reg32((u32 __iomem *)(reg), data >> 32);
> - wr_reg32((u32 __iomem *)(reg) + 1, data);
> - }
> -}
> -
> -static inline u64 rd_reg64(void __iomem *reg)
> -{
> - if (!caam_imx && caam_little_end)
> - return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 |
> - (u64)rd_reg32((u32 __iomem *)(reg)));
> -
> - return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 |
> - (u64)rd_reg32((u32 __iomem *)(reg) + 1));
> -}
> -#endif /* CONFIG_64BIT  */
> -
>  static inline u64 cpu_to_caam_dma64(dma_addr_t value)
>  {
>   if (caam_imx)
> 


Re: [PATCH v9 7/8] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64

2018-01-03 Thread Horia Geantă
On 1/3/2018 8:07 PM, Logan Gunthorpe wrote:
> Clean up the extra ifdefs which defined the wr_reg64 and rd_reg64
> functions in non-64bit cases in favour of the new common
> io-64-nonatomic-lo-hi header.
> 
> Signed-off-by: Logan Gunthorpe 
> Cc: Andy Shevchenko 
> Cc: Horia Geantă 
> Cc: Dan Douglass 
> Cc: Herbert Xu 
> Cc: "David S. Miller" 
> ---
>  drivers/crypto/caam/regs.h | 26 +-
>  1 file changed, 1 insertion(+), 25 deletions(-)
> 
> diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
> index fee363865d88..ec6528e5ce9d 100644
> --- a/drivers/crypto/caam/regs.h
> +++ b/drivers/crypto/caam/regs.h
> @@ -10,7 +10,7 @@
>  
>  #include 
>  #include 
> -#include 
> +#include 
Typo: lo-hi should be used instead (see previous patch versions).

Please add in the commit message the explanation (which was there in v8 but
removed in v9):
To be consistent with CAAM engine HW spec: in case of 64-bit registers,
irrespective of device endianness, the lower address should be read from
/ written to first, followed by the upper address. Indeed the I/O
accessors in CAAM driver currently don't follow the spec, however this
is a good opportunity to fix the code.

>  
>  /*
>   * Architecture-specific register access methods
> @@ -136,7 +136,6 @@ static inline void clrsetbits_32(void __iomem *reg, u32 
> clear, u32 set)
>   *base + 0x : least-significant 32 bits
>   *base + 0x0004 : most-significant 32 bits
>   */
> -#ifdef CONFIG_64BIT
>  static inline void wr_reg64(void __iomem *reg, u64 data)
>  {
>   if (caam_little_end)
Since the 2 cases (32/64-bit) are merged, caam_imx should be accounted for the
logic to stay the same.

This means for e.g. for wr_reg64 (similar for rd_reg64):
static inline void wr_reg64(void __iomem *reg, u64 data)
{
if (!caam_imx && caam_little_end)
iowrite64(data, reg);
else
iowrite64be(data, reg);
}

Thanks,
Horia

> @@ -153,29 +152,6 @@ static inline u64 rd_reg64(void __iomem *reg)
>   return ioread64be(reg);
>  }
>  
> -#else /* CONFIG_64BIT */
> -static inline void wr_reg64(void __iomem *reg, u64 data)
> -{
> - if (!caam_imx && caam_little_end) {
> - wr_reg32((u32 __iomem *)(reg) + 1, data >> 32);
> - wr_reg32((u32 __iomem *)(reg), data);
> - } else {
> - wr_reg32((u32 __iomem *)(reg), data >> 32);
> - wr_reg32((u32 __iomem *)(reg) + 1, data);
> - }
> -}
> -
> -static inline u64 rd_reg64(void __iomem *reg)
> -{
> - if (!caam_imx && caam_little_end)
> - return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 |
> - (u64)rd_reg32((u32 __iomem *)(reg)));
> -
> - return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 |
> - (u64)rd_reg32((u32 __iomem *)(reg) + 1));
> -}
> -#endif /* CONFIG_64BIT  */
> -
>  static inline u64 cpu_to_caam_dma64(dma_addr_t value)
>  {
>   if (caam_imx)
> 


[PATCH V2 5/5] regulator: add PM suspend and resume hooks

2018-01-03 Thread Chunyan Zhang
In this patch, consumers are allowed to set suspend voltage, and this
actually just set the "uV" in constraint::regulator_state, when the
regulator_suspend_late() was called by PM core through callback when
the system is entering into suspend, the regulator device would act
suspend activity then.

And it assumes that if any consumer set suspend voltage, the regulator
device should be enabled in the suspend state.  And if the suspend
voltage of a regulator device for all consumers was set zero, the
regulator device would be off in the suspend state.

This patch also provides a new function hook to regulator devices for
resuming from suspend states.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c  | 251 +-
 drivers/regulator/of_regulator.c  |  14 +++
 include/linux/regulator/driver.h  |   2 +
 include/linux/regulator/machine.h |  16 ++-
 4 files changed, 251 insertions(+), 32 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 080c233..3f4d3aa 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -236,6 +236,12 @@ static int regulator_check_voltage(struct regulator_dev 
*rdev,
return 0;
 }
 
+/* return 0 if the state is valid */
+static int regulator_check_states(suspend_state_t state)
+{
+   return (state > PM_SUSPEND_MAX || state == PM_SUSPEND_TO_IDLE);
+}
+
 /* Make sure we select a voltage that suits the needs of all
  * regulator consumers
  */
@@ -327,6 +333,24 @@ static int regulator_mode_constrain(struct regulator_dev 
*rdev,
return -EINVAL;
 }
 
+static inline struct regulator_state *
+regulator_get_suspend_state(struct regulator_dev *rdev, suspend_state_t state)
+{
+   if (rdev->constraints == NULL)
+   return NULL;
+
+   switch (state) {
+   case PM_SUSPEND_STANDBY:
+   return >constraints->state_standby;
+   case PM_SUSPEND_MEM:
+   return >constraints->state_mem;
+   case PM_SUSPEND_MAX:
+   return >constraints->state_disk;
+   default:
+   return NULL;
+   }
+}
+
 static ssize_t regulator_uV_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
@@ -734,9 +758,14 @@ static int drms_uA_update(struct regulator_dev *rdev)
 }
 
 static int suspend_set_state(struct regulator_dev *rdev,
-   struct regulator_state *rstate)
+   suspend_state_t state)
 {
int ret = 0;
+   struct regulator_state *rstate;
+
+   rstate = regulator_get_suspend_state(rdev, state);
+   if (rstate == NULL)
+   return -EINVAL;
 
/* If we have no suspend mode configration don't set anything;
 * only warn if the driver implements set_suspend_voltage or
@@ -779,28 +808,8 @@ static int suspend_set_state(struct regulator_dev *rdev,
return ret;
}
}
-   return ret;
-}
 
-/* locks held by caller */
-static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
-{
-   if (!rdev->constraints)
-   return -EINVAL;
-
-   switch (state) {
-   case PM_SUSPEND_STANDBY:
-   return suspend_set_state(rdev,
-   >constraints->state_standby);
-   case PM_SUSPEND_MEM:
-   return suspend_set_state(rdev,
-   >constraints->state_mem);
-   case PM_SUSPEND_MAX:
-   return suspend_set_state(rdev,
-   >constraints->state_disk);
-   default:
-   return -EINVAL;
-   }
+   return ret;
 }
 
 static void print_constraints(struct regulator_dev *rdev)
@@ -1069,7 +1078,7 @@ static int set_machine_constraints(struct regulator_dev 
*rdev,
 
/* do we need to setup our suspend state */
if (rdev->constraints->initial_state) {
-   ret = suspend_prepare(rdev, rdev->constraints->initial_state);
+   ret = suspend_set_state(rdev, rdev->constraints->initial_state);
if (ret < 0) {
rdev_err(rdev, "failed to set suspend state\n");
return ret;
@@ -2898,6 +2907,35 @@ static int _regulator_do_set_voltage(struct 
regulator_dev *rdev,
return ret;
 }
 
+static int _regulator_do_set_suspend_voltage(struct regulator_dev *rdev,
+ int min_uV, int max_uV, suspend_state_t state)
+{
+   struct regulator_state *rstate;
+   int uV, sel;
+
+   rstate = regulator_get_suspend_state(rdev, state);
+   if (rstate == NULL)
+   return -EINVAL;
+
+   if (!rstate->changeable)
+   return -EINVAL;
+
+   if (min_uV < rstate->min_uV)
+   min_uV = rstate->min_uV;
+   if (max_uV > rstate->max_uV)
+   max_uV = rstate->max_uV;
+
+   sel = regulator_map_voltage(rdev, min_uV, max_uV);
+   if (sel < 0)
+  

[PATCH V2 5/5] regulator: add PM suspend and resume hooks

2018-01-03 Thread Chunyan Zhang
In this patch, consumers are allowed to set suspend voltage, and this
actually just set the "uV" in constraint::regulator_state, when the
regulator_suspend_late() was called by PM core through callback when
the system is entering into suspend, the regulator device would act
suspend activity then.

And it assumes that if any consumer set suspend voltage, the regulator
device should be enabled in the suspend state.  And if the suspend
voltage of a regulator device for all consumers was set zero, the
regulator device would be off in the suspend state.

This patch also provides a new function hook to regulator devices for
resuming from suspend states.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c  | 251 +-
 drivers/regulator/of_regulator.c  |  14 +++
 include/linux/regulator/driver.h  |   2 +
 include/linux/regulator/machine.h |  16 ++-
 4 files changed, 251 insertions(+), 32 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 080c233..3f4d3aa 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -236,6 +236,12 @@ static int regulator_check_voltage(struct regulator_dev 
*rdev,
return 0;
 }
 
+/* return 0 if the state is valid */
+static int regulator_check_states(suspend_state_t state)
+{
+   return (state > PM_SUSPEND_MAX || state == PM_SUSPEND_TO_IDLE);
+}
+
 /* Make sure we select a voltage that suits the needs of all
  * regulator consumers
  */
@@ -327,6 +333,24 @@ static int regulator_mode_constrain(struct regulator_dev 
*rdev,
return -EINVAL;
 }
 
+static inline struct regulator_state *
+regulator_get_suspend_state(struct regulator_dev *rdev, suspend_state_t state)
+{
+   if (rdev->constraints == NULL)
+   return NULL;
+
+   switch (state) {
+   case PM_SUSPEND_STANDBY:
+   return >constraints->state_standby;
+   case PM_SUSPEND_MEM:
+   return >constraints->state_mem;
+   case PM_SUSPEND_MAX:
+   return >constraints->state_disk;
+   default:
+   return NULL;
+   }
+}
+
 static ssize_t regulator_uV_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
@@ -734,9 +758,14 @@ static int drms_uA_update(struct regulator_dev *rdev)
 }
 
 static int suspend_set_state(struct regulator_dev *rdev,
-   struct regulator_state *rstate)
+   suspend_state_t state)
 {
int ret = 0;
+   struct regulator_state *rstate;
+
+   rstate = regulator_get_suspend_state(rdev, state);
+   if (rstate == NULL)
+   return -EINVAL;
 
/* If we have no suspend mode configration don't set anything;
 * only warn if the driver implements set_suspend_voltage or
@@ -779,28 +808,8 @@ static int suspend_set_state(struct regulator_dev *rdev,
return ret;
}
}
-   return ret;
-}
 
-/* locks held by caller */
-static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
-{
-   if (!rdev->constraints)
-   return -EINVAL;
-
-   switch (state) {
-   case PM_SUSPEND_STANDBY:
-   return suspend_set_state(rdev,
-   >constraints->state_standby);
-   case PM_SUSPEND_MEM:
-   return suspend_set_state(rdev,
-   >constraints->state_mem);
-   case PM_SUSPEND_MAX:
-   return suspend_set_state(rdev,
-   >constraints->state_disk);
-   default:
-   return -EINVAL;
-   }
+   return ret;
 }
 
 static void print_constraints(struct regulator_dev *rdev)
@@ -1069,7 +1078,7 @@ static int set_machine_constraints(struct regulator_dev 
*rdev,
 
/* do we need to setup our suspend state */
if (rdev->constraints->initial_state) {
-   ret = suspend_prepare(rdev, rdev->constraints->initial_state);
+   ret = suspend_set_state(rdev, rdev->constraints->initial_state);
if (ret < 0) {
rdev_err(rdev, "failed to set suspend state\n");
return ret;
@@ -2898,6 +2907,35 @@ static int _regulator_do_set_voltage(struct 
regulator_dev *rdev,
return ret;
 }
 
+static int _regulator_do_set_suspend_voltage(struct regulator_dev *rdev,
+ int min_uV, int max_uV, suspend_state_t state)
+{
+   struct regulator_state *rstate;
+   int uV, sel;
+
+   rstate = regulator_get_suspend_state(rdev, state);
+   if (rstate == NULL)
+   return -EINVAL;
+
+   if (!rstate->changeable)
+   return -EINVAL;
+
+   if (min_uV < rstate->min_uV)
+   min_uV = rstate->min_uV;
+   if (max_uV > rstate->max_uV)
+   max_uV = rstate->max_uV;
+
+   sel = regulator_map_voltage(rdev, min_uV, max_uV);
+   if (sel < 0)
+   return sel;
+
+  

[PATCH V2 4/5] drivers: regulator: empty the old suspend functions

2018-01-03 Thread Chunyan Zhang
Regualtor suspend/resume functions should only be called by PM suspend
core via registering dev_pm_ops, and regulator devices should implement
the callback functions.  Thus, any regulator consumer shouldn't call
the regulator suspend/resume functions directly.

In order to avoid compile errors, two empty functions with the same name
still be left for the time being.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c  | 74 ---
 include/linux/regulator/machine.h |  5 ++-
 2 files changed, 2 insertions(+), 77 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5ea80e9..080c233 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4179,80 +4179,6 @@ void regulator_unregister(struct regulator_dev *rdev)
 }
 EXPORT_SYMBOL_GPL(regulator_unregister);
 
-static int _regulator_suspend_prepare(struct device *dev, void *data)
-{
-   struct regulator_dev *rdev = dev_to_rdev(dev);
-   const suspend_state_t *state = data;
-   int ret;
-
-   mutex_lock(>mutex);
-   ret = suspend_prepare(rdev, *state);
-   mutex_unlock(>mutex);
-
-   return ret;
-}
-
-/**
- * regulator_suspend_prepare - prepare regulators for system wide suspend
- * @state: system suspend state
- *
- * Configure each regulator with it's suspend operating parameters for state.
- * This will usually be called by machine suspend code prior to supending.
- */
-int regulator_suspend_prepare(suspend_state_t state)
-{
-   /* ON is handled by regulator active state */
-   if (state == PM_SUSPEND_ON)
-   return -EINVAL;
-
-   return class_for_each_device(_class, NULL, ,
-_regulator_suspend_prepare);
-}
-EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
-
-static int _regulator_suspend_finish(struct device *dev, void *data)
-{
-   struct regulator_dev *rdev = dev_to_rdev(dev);
-   int ret;
-
-   mutex_lock(>mutex);
-   if (rdev->use_count > 0  || rdev->constraints->always_on) {
-   if (!_regulator_is_enabled(rdev)) {
-   ret = _regulator_do_enable(rdev);
-   if (ret)
-   dev_err(dev,
-   "Failed to resume regulator %d\n",
-   ret);
-   }
-   } else {
-   if (!have_full_constraints())
-   goto unlock;
-   if (!_regulator_is_enabled(rdev))
-   goto unlock;
-
-   ret = _regulator_do_disable(rdev);
-   if (ret)
-   dev_err(dev, "Failed to suspend regulator %d\n", ret);
-   }
-unlock:
-   mutex_unlock(>mutex);
-
-   /* Keep processing regulators in spite of any errors */
-   return 0;
-}
-
-/**
- * regulator_suspend_finish - resume regulators from system wide suspend
- *
- * Turn on regulators that might be turned off by regulator_suspend_prepare
- * and that should be turned on according to the regulators properties.
- */
-int regulator_suspend_finish(void)
-{
-   return class_for_each_device(_class, NULL, NULL,
-_regulator_suspend_finish);
-}
-EXPORT_SYMBOL_GPL(regulator_suspend_finish);
 
 /**
  * regulator_has_full_constraints - the system has fully specified constraints
diff --git a/include/linux/regulator/machine.h 
b/include/linux/regulator/machine.h
index e50519f..b4ddb56 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -231,12 +231,12 @@ struct regulator_init_data {
 
 #ifdef CONFIG_REGULATOR
 void regulator_has_full_constraints(void);
-int regulator_suspend_prepare(suspend_state_t state);
-int regulator_suspend_finish(void);
 #else
 static inline void regulator_has_full_constraints(void)
 {
 }
+#endif
+
 static inline int regulator_suspend_prepare(suspend_state_t state)
 {
return 0;
@@ -245,6 +245,5 @@ static inline int regulator_suspend_finish(void)
 {
return 0;
 }
-#endif
 
 #endif
-- 
2.7.4



[PATCH V2 4/5] drivers: regulator: empty the old suspend functions

2018-01-03 Thread Chunyan Zhang
Regualtor suspend/resume functions should only be called by PM suspend
core via registering dev_pm_ops, and regulator devices should implement
the callback functions.  Thus, any regulator consumer shouldn't call
the regulator suspend/resume functions directly.

In order to avoid compile errors, two empty functions with the same name
still be left for the time being.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c  | 74 ---
 include/linux/regulator/machine.h |  5 ++-
 2 files changed, 2 insertions(+), 77 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5ea80e9..080c233 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4179,80 +4179,6 @@ void regulator_unregister(struct regulator_dev *rdev)
 }
 EXPORT_SYMBOL_GPL(regulator_unregister);
 
-static int _regulator_suspend_prepare(struct device *dev, void *data)
-{
-   struct regulator_dev *rdev = dev_to_rdev(dev);
-   const suspend_state_t *state = data;
-   int ret;
-
-   mutex_lock(>mutex);
-   ret = suspend_prepare(rdev, *state);
-   mutex_unlock(>mutex);
-
-   return ret;
-}
-
-/**
- * regulator_suspend_prepare - prepare regulators for system wide suspend
- * @state: system suspend state
- *
- * Configure each regulator with it's suspend operating parameters for state.
- * This will usually be called by machine suspend code prior to supending.
- */
-int regulator_suspend_prepare(suspend_state_t state)
-{
-   /* ON is handled by regulator active state */
-   if (state == PM_SUSPEND_ON)
-   return -EINVAL;
-
-   return class_for_each_device(_class, NULL, ,
-_regulator_suspend_prepare);
-}
-EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
-
-static int _regulator_suspend_finish(struct device *dev, void *data)
-{
-   struct regulator_dev *rdev = dev_to_rdev(dev);
-   int ret;
-
-   mutex_lock(>mutex);
-   if (rdev->use_count > 0  || rdev->constraints->always_on) {
-   if (!_regulator_is_enabled(rdev)) {
-   ret = _regulator_do_enable(rdev);
-   if (ret)
-   dev_err(dev,
-   "Failed to resume regulator %d\n",
-   ret);
-   }
-   } else {
-   if (!have_full_constraints())
-   goto unlock;
-   if (!_regulator_is_enabled(rdev))
-   goto unlock;
-
-   ret = _regulator_do_disable(rdev);
-   if (ret)
-   dev_err(dev, "Failed to suspend regulator %d\n", ret);
-   }
-unlock:
-   mutex_unlock(>mutex);
-
-   /* Keep processing regulators in spite of any errors */
-   return 0;
-}
-
-/**
- * regulator_suspend_finish - resume regulators from system wide suspend
- *
- * Turn on regulators that might be turned off by regulator_suspend_prepare
- * and that should be turned on according to the regulators properties.
- */
-int regulator_suspend_finish(void)
-{
-   return class_for_each_device(_class, NULL, NULL,
-_regulator_suspend_finish);
-}
-EXPORT_SYMBOL_GPL(regulator_suspend_finish);
 
 /**
  * regulator_has_full_constraints - the system has fully specified constraints
diff --git a/include/linux/regulator/machine.h 
b/include/linux/regulator/machine.h
index e50519f..b4ddb56 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -231,12 +231,12 @@ struct regulator_init_data {
 
 #ifdef CONFIG_REGULATOR
 void regulator_has_full_constraints(void);
-int regulator_suspend_prepare(suspend_state_t state);
-int regulator_suspend_finish(void);
 #else
 static inline void regulator_has_full_constraints(void)
 {
 }
+#endif
+
 static inline int regulator_suspend_prepare(suspend_state_t state)
 {
return 0;
@@ -245,6 +245,5 @@ static inline int regulator_suspend_finish(void)
 {
return 0;
 }
-#endif
 
 #endif
-- 
2.7.4



[PATCH V2 2/5] regulator: make regulator voltage be an array to support more states

2018-01-03 Thread Chunyan Zhang
Some regulator consumers would like to make the regulator device
keeping a voltage range output when the system entering into
suspend states.

Making regulator voltage be an array can allow consumers to set voltage
for normal state as well as for suspend states through the same code.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c | 63 
 drivers/regulator/internal.h | 18 +++--
 2 files changed, 51 insertions(+), 30 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b64b791..97bc9f7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -240,22 +240,25 @@ static int regulator_check_voltage(struct regulator_dev 
*rdev,
  * regulator consumers
  */
 static int regulator_check_consumers(struct regulator_dev *rdev,
-int *min_uV, int *max_uV)
+int *min_uV, int *max_uV,
+suspend_state_t state)
 {
struct regulator *regulator;
+   struct regulator_voltage *voltage;
 
list_for_each_entry(regulator, >consumer_list, list) {
+   voltage = >voltage[state];
/*
 * Assume consumers that didn't say anything are OK
 * with anything in the constraint range.
 */
-   if (!regulator->min_uV && !regulator->max_uV)
+   if (!voltage->min_uV && !voltage->max_uV)
continue;
 
-   if (*max_uV > regulator->max_uV)
-   *max_uV = regulator->max_uV;
-   if (*min_uV < regulator->min_uV)
-   *min_uV = regulator->min_uV;
+   if (*max_uV > voltage->max_uV)
+   *max_uV = voltage->max_uV;
+   if (*min_uV < voltage->min_uV)
+   *min_uV = voltage->min_uV;
}
 
if (*min_uV > *max_uV) {
@@ -1356,9 +1359,9 @@ static struct regulator *create_regulator(struct 
regulator_dev *rdev,
debugfs_create_u32("uA_load", 0444, regulator->debugfs,
   >uA_load);
debugfs_create_u32("min_uV", 0444, regulator->debugfs,
-  >min_uV);
+  >voltage[PM_SUSPEND_ON].min_uV);
debugfs_create_u32("max_uV", 0444, regulator->debugfs,
-  >max_uV);
+  >voltage[PM_SUSPEND_ON].max_uV);
debugfs_create_file("constraint_flags", 0444,
regulator->debugfs, regulator,
_flags_fops);
@@ -2898,9 +2901,11 @@ static int _regulator_do_set_voltage(struct 
regulator_dev *rdev,
 }
 
 static int regulator_set_voltage_unlocked(struct regulator *regulator,
- int min_uV, int max_uV)
+ int min_uV, int max_uV,
+ suspend_state_t state)
 {
struct regulator_dev *rdev = regulator->rdev;
+   struct regulator_voltage *voltage = >voltage[state];
int ret = 0;
int old_min_uV, old_max_uV;
int current_uV;
@@ -2911,7 +2916,7 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
 * should be a noop (some cpufreq implementations use the same
 * voltage for multiple frequencies, for example).
 */
-   if (regulator->min_uV == min_uV && regulator->max_uV == max_uV)
+   if (voltage->min_uV == min_uV && voltage->max_uV == max_uV)
goto out;
 
/* If we're trying to set a range that overlaps the current voltage,
@@ -2921,8 +2926,8 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) {
current_uV = _regulator_get_voltage(rdev);
if (min_uV <= current_uV && current_uV <= max_uV) {
-   regulator->min_uV = min_uV;
-   regulator->max_uV = max_uV;
+   voltage->min_uV = min_uV;
+   voltage->max_uV = max_uV;
goto out;
}
}
@@ -2940,12 +2945,12 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
goto out;
 
/* restore original values in case of error */
-   old_min_uV = regulator->min_uV;
-   old_max_uV = regulator->max_uV;
-   regulator->min_uV = min_uV;
-   regulator->max_uV = max_uV;
+   old_min_uV = voltage->min_uV;
+   old_max_uV = voltage->max_uV;
+   voltage->min_uV = min_uV;
+   voltage->max_uV = max_uV;
 
-   ret = regulator_check_consumers(rdev, _uV, _uV);
+   ret = regulator_check_consumers(rdev, _uV, _uV, state);
if (ret < 0)

[PATCH V2 1/5] bindings: regulator: added support for suspend states

2018-01-03 Thread Chunyan Zhang
Some systems need to set regulators to specific states when they enter
low power modes, especially around CPUs. There are many of these modes
depending on the particular runtime state.

Currently the regulator consumers are not granted permission to change
suspend state of regulator devices, the constraints are configured at
startup.  In order to allow changes in a vlotage range, we need to add
new properties for voltage range and a flag to give permission to
change the suspend voltage and suspend on/off in suspend mode.

Signed-off-by: Chunyan Zhang 
---
 Documentation/devicetree/bindings/regulator/regulator.txt | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt 
b/Documentation/devicetree/bindings/regulator/regulator.txt
index 378f6dc..532e286 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -42,8 +42,19 @@ Optional properties:
 - regulator-state-[mem/disk] node has following common properties:
- regulator-on-in-suspend: regulator should be on in suspend state.
- regulator-off-in-suspend: regulator should be off in suspend state.
-   - regulator-suspend-microvolt: regulator should be set to this voltage
- in suspend.
+   - regulator-suspend-min-microvolt: minimum voltage may be set in
+ suspend state.
+   - regulator-suspend-max-microvolt: maximum voltage may be set in
+ suspend state.
+   - regulator-suspend-microvolt: the default voltage which regulator
+ would be set in suspend. The voltage for suspend also can be
+ adjusted among {regulator-suspend-min-microvolt,
+ regulator-suspend-max-microvolt} by calling
+ regulator_set_suspend_voltage(). This property is not deprecated,
+ setting voltage for suspend mode via API the regulator driver
+ provides is recommended.
+   - regulator-changeable-in-suspend: whether the default voltage and
+ the regulator on/off in suspend can be changed in runtime.
- regulator-mode: operating mode in the given suspend state.
  The set of possible operating modes depends on the capabilities of
  every hardware so the valid modes are documented on each regulator
-- 
2.7.4



[PATCH V2 0/5] Add regulator suspend and resume support

2018-01-03 Thread Chunyan Zhang
Some systems need to set regulators to specific states when they enter low
power modes, especially around CPUs.

Currently the regulator driver, for suspend and resume features, provides
two functions which are exported for being called directly by any modules
or subsystems when they thought the regulator should be entering into
suspend states.

This patchset adds hooks to PM suspend core and provides suspend/resume
callback functions to regulator device, for those who can be switched
off or set low voltage in suspend states only need to implement the
callback functions in the driver, and set the right configurations for
suspend states via device tree and the APIs which regulator core
driver provides.

Those drivers who use the old interfaces - i.e. regulator_suspend_prepare()
and regulator_suspend_finish() should stop using that, since we leave these
two functions empty and plan to remove them one day in the future.

Any comments would be greatly appreciated.

Thanks,
Chunyan

Changes from V1: (https://lkml.org/lkml/2017/12/21/9)
* Rephrased the commit message of patch 0001;
* Declared the property 'regulator-suspend-microvolt' deperated and documented
  the way recommended;
* Revised of_regulator.c, use suspend_state::min_uV as default suspend
  voltage if the property 'regulator-suspend-microvolt' is not used.

Chunyan Zhang (5):
  bindings: regulator: added support for suspend states
  regulator: make regulator voltage be an array to support more states
  drivers: regulator: leave one item to record whether regulator is
enabled
  drivers: regulator: empty the old suspend functions
  regulator: add PM suspend and resume hooks

 .../devicetree/bindings/regulator/regulator.txt|  15 +-
 drivers/regulator/core.c   | 342 ++---
 drivers/regulator/internal.h   |  18 +-
 drivers/regulator/of_regulator.c   |  20 +-
 include/linux/regulator/driver.h   |   2 +
 include/linux/regulator/machine.h  |  31 +-
 6 files changed, 305 insertions(+), 123 deletions(-)

-- 
2.7.4



[PATCH V2 2/5] regulator: make regulator voltage be an array to support more states

2018-01-03 Thread Chunyan Zhang
Some regulator consumers would like to make the regulator device
keeping a voltage range output when the system entering into
suspend states.

Making regulator voltage be an array can allow consumers to set voltage
for normal state as well as for suspend states through the same code.

Signed-off-by: Chunyan Zhang 
---
 drivers/regulator/core.c | 63 
 drivers/regulator/internal.h | 18 +++--
 2 files changed, 51 insertions(+), 30 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b64b791..97bc9f7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -240,22 +240,25 @@ static int regulator_check_voltage(struct regulator_dev 
*rdev,
  * regulator consumers
  */
 static int regulator_check_consumers(struct regulator_dev *rdev,
-int *min_uV, int *max_uV)
+int *min_uV, int *max_uV,
+suspend_state_t state)
 {
struct regulator *regulator;
+   struct regulator_voltage *voltage;
 
list_for_each_entry(regulator, >consumer_list, list) {
+   voltage = >voltage[state];
/*
 * Assume consumers that didn't say anything are OK
 * with anything in the constraint range.
 */
-   if (!regulator->min_uV && !regulator->max_uV)
+   if (!voltage->min_uV && !voltage->max_uV)
continue;
 
-   if (*max_uV > regulator->max_uV)
-   *max_uV = regulator->max_uV;
-   if (*min_uV < regulator->min_uV)
-   *min_uV = regulator->min_uV;
+   if (*max_uV > voltage->max_uV)
+   *max_uV = voltage->max_uV;
+   if (*min_uV < voltage->min_uV)
+   *min_uV = voltage->min_uV;
}
 
if (*min_uV > *max_uV) {
@@ -1356,9 +1359,9 @@ static struct regulator *create_regulator(struct 
regulator_dev *rdev,
debugfs_create_u32("uA_load", 0444, regulator->debugfs,
   >uA_load);
debugfs_create_u32("min_uV", 0444, regulator->debugfs,
-  >min_uV);
+  >voltage[PM_SUSPEND_ON].min_uV);
debugfs_create_u32("max_uV", 0444, regulator->debugfs,
-  >max_uV);
+  >voltage[PM_SUSPEND_ON].max_uV);
debugfs_create_file("constraint_flags", 0444,
regulator->debugfs, regulator,
_flags_fops);
@@ -2898,9 +2901,11 @@ static int _regulator_do_set_voltage(struct 
regulator_dev *rdev,
 }
 
 static int regulator_set_voltage_unlocked(struct regulator *regulator,
- int min_uV, int max_uV)
+ int min_uV, int max_uV,
+ suspend_state_t state)
 {
struct regulator_dev *rdev = regulator->rdev;
+   struct regulator_voltage *voltage = >voltage[state];
int ret = 0;
int old_min_uV, old_max_uV;
int current_uV;
@@ -2911,7 +2916,7 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
 * should be a noop (some cpufreq implementations use the same
 * voltage for multiple frequencies, for example).
 */
-   if (regulator->min_uV == min_uV && regulator->max_uV == max_uV)
+   if (voltage->min_uV == min_uV && voltage->max_uV == max_uV)
goto out;
 
/* If we're trying to set a range that overlaps the current voltage,
@@ -2921,8 +2926,8 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) {
current_uV = _regulator_get_voltage(rdev);
if (min_uV <= current_uV && current_uV <= max_uV) {
-   regulator->min_uV = min_uV;
-   regulator->max_uV = max_uV;
+   voltage->min_uV = min_uV;
+   voltage->max_uV = max_uV;
goto out;
}
}
@@ -2940,12 +2945,12 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
goto out;
 
/* restore original values in case of error */
-   old_min_uV = regulator->min_uV;
-   old_max_uV = regulator->max_uV;
-   regulator->min_uV = min_uV;
-   regulator->max_uV = max_uV;
+   old_min_uV = voltage->min_uV;
+   old_max_uV = voltage->max_uV;
+   voltage->min_uV = min_uV;
+   voltage->max_uV = max_uV;
 
-   ret = regulator_check_consumers(rdev, _uV, _uV);
+   ret = regulator_check_consumers(rdev, _uV, _uV, state);
if (ret < 0)
goto out2;
 
@@ 

[PATCH V2 1/5] bindings: regulator: added support for suspend states

2018-01-03 Thread Chunyan Zhang
Some systems need to set regulators to specific states when they enter
low power modes, especially around CPUs. There are many of these modes
depending on the particular runtime state.

Currently the regulator consumers are not granted permission to change
suspend state of regulator devices, the constraints are configured at
startup.  In order to allow changes in a vlotage range, we need to add
new properties for voltage range and a flag to give permission to
change the suspend voltage and suspend on/off in suspend mode.

Signed-off-by: Chunyan Zhang 
---
 Documentation/devicetree/bindings/regulator/regulator.txt | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt 
b/Documentation/devicetree/bindings/regulator/regulator.txt
index 378f6dc..532e286 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -42,8 +42,19 @@ Optional properties:
 - regulator-state-[mem/disk] node has following common properties:
- regulator-on-in-suspend: regulator should be on in suspend state.
- regulator-off-in-suspend: regulator should be off in suspend state.
-   - regulator-suspend-microvolt: regulator should be set to this voltage
- in suspend.
+   - regulator-suspend-min-microvolt: minimum voltage may be set in
+ suspend state.
+   - regulator-suspend-max-microvolt: maximum voltage may be set in
+ suspend state.
+   - regulator-suspend-microvolt: the default voltage which regulator
+ would be set in suspend. The voltage for suspend also can be
+ adjusted among {regulator-suspend-min-microvolt,
+ regulator-suspend-max-microvolt} by calling
+ regulator_set_suspend_voltage(). This property is not deprecated,
+ setting voltage for suspend mode via API the regulator driver
+ provides is recommended.
+   - regulator-changeable-in-suspend: whether the default voltage and
+ the regulator on/off in suspend can be changed in runtime.
- regulator-mode: operating mode in the given suspend state.
  The set of possible operating modes depends on the capabilities of
  every hardware so the valid modes are documented on each regulator
-- 
2.7.4



[PATCH V2 0/5] Add regulator suspend and resume support

2018-01-03 Thread Chunyan Zhang
Some systems need to set regulators to specific states when they enter low
power modes, especially around CPUs.

Currently the regulator driver, for suspend and resume features, provides
two functions which are exported for being called directly by any modules
or subsystems when they thought the regulator should be entering into
suspend states.

This patchset adds hooks to PM suspend core and provides suspend/resume
callback functions to regulator device, for those who can be switched
off or set low voltage in suspend states only need to implement the
callback functions in the driver, and set the right configurations for
suspend states via device tree and the APIs which regulator core
driver provides.

Those drivers who use the old interfaces - i.e. regulator_suspend_prepare()
and regulator_suspend_finish() should stop using that, since we leave these
two functions empty and plan to remove them one day in the future.

Any comments would be greatly appreciated.

Thanks,
Chunyan

Changes from V1: (https://lkml.org/lkml/2017/12/21/9)
* Rephrased the commit message of patch 0001;
* Declared the property 'regulator-suspend-microvolt' deperated and documented
  the way recommended;
* Revised of_regulator.c, use suspend_state::min_uV as default suspend
  voltage if the property 'regulator-suspend-microvolt' is not used.

Chunyan Zhang (5):
  bindings: regulator: added support for suspend states
  regulator: make regulator voltage be an array to support more states
  drivers: regulator: leave one item to record whether regulator is
enabled
  drivers: regulator: empty the old suspend functions
  regulator: add PM suspend and resume hooks

 .../devicetree/bindings/regulator/regulator.txt|  15 +-
 drivers/regulator/core.c   | 342 ++---
 drivers/regulator/internal.h   |  18 +-
 drivers/regulator/of_regulator.c   |  20 +-
 include/linux/regulator/driver.h   |   2 +
 include/linux/regulator/machine.h  |  31 +-
 6 files changed, 305 insertions(+), 123 deletions(-)

-- 
2.7.4



Re: [f2fs-dev] [PATCH 1/2 v2] f2fs: show precise # of blocks that user/root can use

2018-01-03 Thread Chao Yu
On 2018/1/4 14:50, Jaegeuk Kim wrote:
> Let's show precise # of blocks that user/root can use through bavail and bfree
> respectively.
> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Chao Yu 

Thanks,




Re: [f2fs-dev] [PATCH 1/2 v2] f2fs: show precise # of blocks that user/root can use

2018-01-03 Thread Chao Yu
On 2018/1/4 14:50, Jaegeuk Kim wrote:
> Let's show precise # of blocks that user/root can use through bavail and bfree
> respectively.
> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Chao Yu 

Thanks,




Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Ingo Molnar

* Greg Kroah-Hartman  wrote:

> On Thu, Jan 04, 2018 at 08:14:21AM +0100, Ingo Molnar wrote:
> >  - (or it's something I missed to consider)
> 
> It was a operator error, the issue is also on 4.15-rc6, see another
> email in this thread :)

ah, ok :-)

Nevertheless it made sense to go through all the backport candidate commits 
again, 
nothing stuck out as a must-have for -stable! ;-)

Thanks,

Ingo


Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Ingo Molnar

* Greg Kroah-Hartman  wrote:

> On Thu, Jan 04, 2018 at 08:14:21AM +0100, Ingo Molnar wrote:
> >  - (or it's something I missed to consider)
> 
> It was a operator error, the issue is also on 4.15-rc6, see another
> email in this thread :)

ah, ok :-)

Nevertheless it made sense to go through all the backport candidate commits 
again, 
nothing stuck out as a must-have for -stable! ;-)

Thanks,

Ingo


Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 08:14:21AM +0100, Ingo Molnar wrote:
>  - (or it's something I missed to consider)

It was a operator error, the issue is also on 4.15-rc6, see another
email in this thread :)


Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Greg Kroah-Hartman
On Thu, Jan 04, 2018 at 08:14:21AM +0100, Ingo Molnar wrote:
>  - (or it's something I missed to consider)

It was a operator error, the issue is also on 4.15-rc6, see another
email in this thread :)


Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Ingo Molnar

* Thomas Gleixner  wrote:

> On Wed, 3 Jan 2018, Benjamin Gilbert wrote:
> 
> > On Wed, Jan 03, 2018 at 10:20:16AM +0100, Greg Kroah-Hartman wrote:
> > > Ick, not good, any chance you can test 4.15-rc6 to verify that the issue
> > > is also there (or not)?
> > 
> > I haven't been able to reproduce this on 4.15-rc6.
> 
> Hmm. So we need to scrutinize the subtle differences between 4.15-rc6 and 
> 4.14.11

So here's a list of candidate 'missing commits':

triton:~/tip> git log --oneline --no-merges WIP.x86/pti..linus arch/x86 | grep 
-viE 
'apic|irq|vector|probe|kvm|timer|rdt|crypto|platform|tsc|insn|xen|mpx|umip|efi|build|parav|SEV|kmemch|power|stacktrace|unwind|kmmio|dma|boot|PCI|resource|init|virt|kexec|unused|perf|5-level'
10a7e9d84915: Do not hash userspace addresses in fault handlers
f5b5fab1780c: x86/decoder: Fix and update the opcodes map
88edb57d1e0b: x86/vdso: Change time() prototype to match __vdso_time()
d553d03f7057: x86: Fix Sparse warnings about non-static functions
f4e9b7af0cd5: x86/microcode/AMD: Add support for fam17h microcode loading
e3811a3f74bd: x86/cpufeatures: Make X86_BUG_FXSAVE_LEAK detectable in CPUID on 
AMD
328b4ed93b69: x86: don't hash faulting address in oops printout
b562c171cf01: locking/refcounts: Do not force refcount_t usage as GPL-only 
export
1501899a898d: mm: fix device-dax pud write-faults triggered by get_user_pages()
55d2d0ad2fb4: x86/idt: Load idt early in start_secondary
9d0b62328d34: x86/tlb: Disable interrupts when changing CR4
0c3292ca8025: x86/tlb: Refactor CR4 setting and shadow write
12a78d43de76: x86/decoder: Add new TEST instruction pattern
30bb9811856f: x86/topology: Avoid wasting 128k for package id array
252714155f04: x86/acpi: Handle SCI interrupts above legacy space gracefully
be62a3204406: x86/mm: Limit mmap() of /dev/mem to valid physical addresses
1e0f25dbf246: x86/mm: Prevent non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW 
border
fcdaf842bd8f: mm, sparse: do not swamp log with huge vmemmap allocation failures
353b1e7b5859: x86/mm: set fields in deferred pages
7d5905dc14a8: x86 / CPU: Always show current CPU frequency in /proc/cpuinfo
4d2dc2cc766c: fcntl: don't cap l_start and l_end values for F_GETLK64 in compat 
syscall
b29c6ef7bb12: x86 / CPU: Avoid unnecessary IPIs in arch_freq_get_on_cpu()
450cbdd0125c: locking/x86: Use LOCK ADD for smp_mb() instead of MFENCE
9f08890ab906: x86/pvclock: add setter for pvclock_pvti_cpu0_va
c5e260890d5f: x86/mm: Remove unnecessary TLB flush for SME in-place encryption
4a75aeacda3c: ACPI / APEI: Remove arch_apei_flush_tlb_one()
e4dca7b7aa08: treewide: Fix function prototypes for module_param_call()
7ed4325a44ea: Drivers: hv: vmbus: Make panic reporting to be more useful
6aa7de059173: locking/atomics: COCCINELLE/treewide: Convert trivial 
ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
506458efaf15: locking/barriers: Convert users of lockless_dereference() to 
READ_ONCE()
0cfe5b5fc027: x86: Use ARRAY_SIZE
c1bd743e54cd: arch/x86: remove redundant null checks before kmem_cache_destroy
a4c1887d4c14: locking/arch: Remove dummy arch_{read,spin,write}_lock_flags() 
implementations
0160fb177d48: locking/arch: Remove dummy arch_{read,spin,write}_relax() 
implementations
19c60923010b: locking/arch, x86: Add __down_read_killable()
39208aa7ecb7: locking/refcounts, x86/asm: Enable CONFIG_ARCH_HAS_REFCOUNT
564c9cc84e2a: locking/refcounts, x86/asm: Use unique .text section for refcount 
exceptions
30c23f29d2d5: locking/x86: Use named operands in rwsem.h

Note the exclusion regex pattern which might be overly aggressive.

Taking out the commits that should have no real effect leads to this list:

f4e9b7af0cd5: x86/microcode/AMD: Add support for fam17h microcode loading
e3811a3f74bd: x86/cpufeatures: Make X86_BUG_FXSAVE_LEAK detectable in CPUID on 
AMD
1501899a898d: mm: fix device-dax pud write-faults triggered by get_user_pages()
55d2d0ad2fb4: x86/idt: Load idt early in start_secondary
9d0b62328d34: x86/tlb: Disable interrupts when changing CR4
0c3292ca8025: x86/tlb: Refactor CR4 setting and shadow write
252714155f04: x86/acpi: Handle SCI interrupts above legacy space gracefully
be62a3204406: x86/mm: Limit mmap() of /dev/mem to valid physical addresses
1e0f25dbf246: x86/mm: Prevent non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW 
border
fcdaf842bd8f: mm, sparse: do not swamp log with huge vmemmap allocation failures
353b1e7b5859: x86/mm: set fields in deferred pages
7d5905dc14a8: x86 / CPU: Always show current CPU frequency in /proc/cpuinfo
4d2dc2cc766c: fcntl: don't cap l_start and l_end values for F_GETLK64 in compat 
syscall
b29c6ef7bb12: x86 / CPU: Avoid unnecessary IPIs in arch_freq_get_on_cpu()
450cbdd0125c: locking/x86: Use LOCK ADD for smp_mb() instead of MFENCE
6aa7de059173: locking/atomics: COCCINELLE/treewide: Convert trivial 
ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
506458efaf15: locking/barriers: Convert users of lockless_dereference() to 
READ_ONCE()
a4c1887d4c14: locking/arch: 

Re: "bad pmd" errors + oops with KPTI on 4.14.11 after loading X.509 certs

2018-01-03 Thread Ingo Molnar

* Thomas Gleixner  wrote:

> On Wed, 3 Jan 2018, Benjamin Gilbert wrote:
> 
> > On Wed, Jan 03, 2018 at 10:20:16AM +0100, Greg Kroah-Hartman wrote:
> > > Ick, not good, any chance you can test 4.15-rc6 to verify that the issue
> > > is also there (or not)?
> > 
> > I haven't been able to reproduce this on 4.15-rc6.
> 
> Hmm. So we need to scrutinize the subtle differences between 4.15-rc6 and 
> 4.14.11

So here's a list of candidate 'missing commits':

triton:~/tip> git log --oneline --no-merges WIP.x86/pti..linus arch/x86 | grep 
-viE 
'apic|irq|vector|probe|kvm|timer|rdt|crypto|platform|tsc|insn|xen|mpx|umip|efi|build|parav|SEV|kmemch|power|stacktrace|unwind|kmmio|dma|boot|PCI|resource|init|virt|kexec|unused|perf|5-level'
10a7e9d84915: Do not hash userspace addresses in fault handlers
f5b5fab1780c: x86/decoder: Fix and update the opcodes map
88edb57d1e0b: x86/vdso: Change time() prototype to match __vdso_time()
d553d03f7057: x86: Fix Sparse warnings about non-static functions
f4e9b7af0cd5: x86/microcode/AMD: Add support for fam17h microcode loading
e3811a3f74bd: x86/cpufeatures: Make X86_BUG_FXSAVE_LEAK detectable in CPUID on 
AMD
328b4ed93b69: x86: don't hash faulting address in oops printout
b562c171cf01: locking/refcounts: Do not force refcount_t usage as GPL-only 
export
1501899a898d: mm: fix device-dax pud write-faults triggered by get_user_pages()
55d2d0ad2fb4: x86/idt: Load idt early in start_secondary
9d0b62328d34: x86/tlb: Disable interrupts when changing CR4
0c3292ca8025: x86/tlb: Refactor CR4 setting and shadow write
12a78d43de76: x86/decoder: Add new TEST instruction pattern
30bb9811856f: x86/topology: Avoid wasting 128k for package id array
252714155f04: x86/acpi: Handle SCI interrupts above legacy space gracefully
be62a3204406: x86/mm: Limit mmap() of /dev/mem to valid physical addresses
1e0f25dbf246: x86/mm: Prevent non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW 
border
fcdaf842bd8f: mm, sparse: do not swamp log with huge vmemmap allocation failures
353b1e7b5859: x86/mm: set fields in deferred pages
7d5905dc14a8: x86 / CPU: Always show current CPU frequency in /proc/cpuinfo
4d2dc2cc766c: fcntl: don't cap l_start and l_end values for F_GETLK64 in compat 
syscall
b29c6ef7bb12: x86 / CPU: Avoid unnecessary IPIs in arch_freq_get_on_cpu()
450cbdd0125c: locking/x86: Use LOCK ADD for smp_mb() instead of MFENCE
9f08890ab906: x86/pvclock: add setter for pvclock_pvti_cpu0_va
c5e260890d5f: x86/mm: Remove unnecessary TLB flush for SME in-place encryption
4a75aeacda3c: ACPI / APEI: Remove arch_apei_flush_tlb_one()
e4dca7b7aa08: treewide: Fix function prototypes for module_param_call()
7ed4325a44ea: Drivers: hv: vmbus: Make panic reporting to be more useful
6aa7de059173: locking/atomics: COCCINELLE/treewide: Convert trivial 
ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
506458efaf15: locking/barriers: Convert users of lockless_dereference() to 
READ_ONCE()
0cfe5b5fc027: x86: Use ARRAY_SIZE
c1bd743e54cd: arch/x86: remove redundant null checks before kmem_cache_destroy
a4c1887d4c14: locking/arch: Remove dummy arch_{read,spin,write}_lock_flags() 
implementations
0160fb177d48: locking/arch: Remove dummy arch_{read,spin,write}_relax() 
implementations
19c60923010b: locking/arch, x86: Add __down_read_killable()
39208aa7ecb7: locking/refcounts, x86/asm: Enable CONFIG_ARCH_HAS_REFCOUNT
564c9cc84e2a: locking/refcounts, x86/asm: Use unique .text section for refcount 
exceptions
30c23f29d2d5: locking/x86: Use named operands in rwsem.h

Note the exclusion regex pattern which might be overly aggressive.

Taking out the commits that should have no real effect leads to this list:

f4e9b7af0cd5: x86/microcode/AMD: Add support for fam17h microcode loading
e3811a3f74bd: x86/cpufeatures: Make X86_BUG_FXSAVE_LEAK detectable in CPUID on 
AMD
1501899a898d: mm: fix device-dax pud write-faults triggered by get_user_pages()
55d2d0ad2fb4: x86/idt: Load idt early in start_secondary
9d0b62328d34: x86/tlb: Disable interrupts when changing CR4
0c3292ca8025: x86/tlb: Refactor CR4 setting and shadow write
252714155f04: x86/acpi: Handle SCI interrupts above legacy space gracefully
be62a3204406: x86/mm: Limit mmap() of /dev/mem to valid physical addresses
1e0f25dbf246: x86/mm: Prevent non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW 
border
fcdaf842bd8f: mm, sparse: do not swamp log with huge vmemmap allocation failures
353b1e7b5859: x86/mm: set fields in deferred pages
7d5905dc14a8: x86 / CPU: Always show current CPU frequency in /proc/cpuinfo
4d2dc2cc766c: fcntl: don't cap l_start and l_end values for F_GETLK64 in compat 
syscall
b29c6ef7bb12: x86 / CPU: Avoid unnecessary IPIs in arch_freq_get_on_cpu()
450cbdd0125c: locking/x86: Use LOCK ADD for smp_mb() instead of MFENCE
6aa7de059173: locking/atomics: COCCINELLE/treewide: Convert trivial 
ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
506458efaf15: locking/barriers: Convert users of lockless_dereference() to 
READ_ONCE()
a4c1887d4c14: locking/arch: Remove dummy 

Re: [PATCH v4] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Jaegeuk Kim
On 01/04, Yunlong Song wrote:
> In some case, the node blocks has wrong blkaddr whose segment type is
> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
> will cause __f2fs_replace_block change the curseg of node and do the
> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
> result, when recovery process write checkpoint and sync nodes, the
> next_blkoff of curseg is used in the segment bit map, then it will
> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
> 
> Signed-off-by: Yunlong Song 
> ---
>  fs/f2fs/segment.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 890d483..50575d5 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
> struct f2fs_summary *sum,
>   type = se->type;
>  
>   down_write(_I(sbi)->curseg_lock);
> + f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));

Let me just move this below like this and start some tests.

...

+   f2fs_bug_on(sbi, !IS_DATASEG(type));
curseg = CURSEG_I(sbi, type);

>  
>   if (!recover_curseg) {
>   /* for recovery flow */
> -- 
> 1.8.5.2


Re: [PATCH v4] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Jaegeuk Kim
On 01/04, Yunlong Song wrote:
> In some case, the node blocks has wrong blkaddr whose segment type is
> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
> will cause __f2fs_replace_block change the curseg of node and do the
> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
> result, when recovery process write checkpoint and sync nodes, the
> next_blkoff of curseg is used in the segment bit map, then it will
> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
> 
> Signed-off-by: Yunlong Song 
> ---
>  fs/f2fs/segment.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 890d483..50575d5 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
> struct f2fs_summary *sum,
>   type = se->type;
>  
>   down_write(_I(sbi)->curseg_lock);
> + f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));

Let me just move this below like this and start some tests.

...

+   f2fs_bug_on(sbi, !IS_DATASEG(type));
curseg = CURSEG_I(sbi, type);

>  
>   if (!recover_curseg) {
>   /* for recovery flow */
> -- 
> 1.8.5.2


[RECEND PATCH V7 11/12] arm64: dts: add syscon for whale2 platform

2018-01-03 Thread Chunyan Zhang
From: Chunyan Zhang 

Some clocks on SC9860 are in the same address area with syscon
devices, the proper syscon node will be quoted under the
definitions of those clocks in DT.

Signed-off-by: Chunyan Zhang 
---
 arch/arm64/boot/dts/sprd/whale2.dtsi | 46 +++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/sprd/whale2.dtsi 
b/arch/arm64/boot/dts/sprd/whale2.dtsi
index 7c217c5..6ea3a75 100644
--- a/arch/arm64/boot/dts/sprd/whale2.dtsi
+++ b/arch/arm64/boot/dts/sprd/whale2.dtsi
@@ -17,6 +17,51 @@
#size-cells = <2>;
ranges;
 
+   ap_ahb_regs: syscon@2021 {
+   compatible = "syscon";
+   reg = <0 0x2021 0 0x1>;
+   };
+
+   pmu_regs: syscon@402b {
+   compatible = "syscon";
+   reg = <0 0x402b 0 0x1>;
+   };
+
+   aon_regs: syscon@402e {
+   compatible = "syscon";
+   reg = <0 0x402e 0 0x1>;
+   };
+
+   ana_regs: syscon@4040 {
+   compatible = "syscon";
+   reg = <0 0x4040 0 0x1>;
+   };
+
+   agcp_regs: syscon@415e {
+   compatible = "syscon";
+   reg = <0 0x415e 0 0x100>;
+   };
+
+   vsp_regs: syscon@6110 {
+   compatible = "syscon";
+   reg = <0 0x6110 0 0x1>;
+   };
+
+   cam_regs: syscon@6210 {
+   compatible = "syscon";
+   reg = <0 0x6210 0 0x1>;
+   };
+
+   disp_regs: syscon@6310 {
+   compatible = "syscon";
+   reg = <0 0x6310 0 0x1>;
+   };
+
+   ap_apb_regs: syscon@70b0 {
+   compatible = "syscon";
+   reg = <0 0x70b0 0 0x4>;
+   };
+
ap-apb {
compatible = "simple-bus";
#address-cells = <1>;
@@ -59,7 +104,6 @@
status = "disabled";
};
};
-
};
 
ext_26m: ext-26m {
-- 
2.7.4



[RECEND PATCH V7 11/12] arm64: dts: add syscon for whale2 platform

2018-01-03 Thread Chunyan Zhang
From: Chunyan Zhang 

Some clocks on SC9860 are in the same address area with syscon
devices, the proper syscon node will be quoted under the
definitions of those clocks in DT.

Signed-off-by: Chunyan Zhang 
---
 arch/arm64/boot/dts/sprd/whale2.dtsi | 46 +++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/sprd/whale2.dtsi 
b/arch/arm64/boot/dts/sprd/whale2.dtsi
index 7c217c5..6ea3a75 100644
--- a/arch/arm64/boot/dts/sprd/whale2.dtsi
+++ b/arch/arm64/boot/dts/sprd/whale2.dtsi
@@ -17,6 +17,51 @@
#size-cells = <2>;
ranges;
 
+   ap_ahb_regs: syscon@2021 {
+   compatible = "syscon";
+   reg = <0 0x2021 0 0x1>;
+   };
+
+   pmu_regs: syscon@402b {
+   compatible = "syscon";
+   reg = <0 0x402b 0 0x1>;
+   };
+
+   aon_regs: syscon@402e {
+   compatible = "syscon";
+   reg = <0 0x402e 0 0x1>;
+   };
+
+   ana_regs: syscon@4040 {
+   compatible = "syscon";
+   reg = <0 0x4040 0 0x1>;
+   };
+
+   agcp_regs: syscon@415e {
+   compatible = "syscon";
+   reg = <0 0x415e 0 0x100>;
+   };
+
+   vsp_regs: syscon@6110 {
+   compatible = "syscon";
+   reg = <0 0x6110 0 0x1>;
+   };
+
+   cam_regs: syscon@6210 {
+   compatible = "syscon";
+   reg = <0 0x6210 0 0x1>;
+   };
+
+   disp_regs: syscon@6310 {
+   compatible = "syscon";
+   reg = <0 0x6310 0 0x1>;
+   };
+
+   ap_apb_regs: syscon@70b0 {
+   compatible = "syscon";
+   reg = <0 0x70b0 0 0x4>;
+   };
+
ap-apb {
compatible = "simple-bus";
#address-cells = <1>;
@@ -59,7 +104,6 @@
status = "disabled";
};
};
-
};
 
ext_26m: ext-26m {
-- 
2.7.4



[RECEND PATCH V7 12/12] arm64: dts: add clocks for SC9860

2018-01-03 Thread Chunyan Zhang
From: Chunyan Zhang 

Some clocks on SC9860 are in the same address area with syscon devices,
those are what have a property of 'sprd,syscon' which would refer to
syscon devices, others would have a reg property indicated their address
ranges.

Signed-off-by: Chunyan Zhang 
---
 arch/arm64/boot/dts/sprd/sc9860.dtsi | 115 +++
 arch/arm64/boot/dts/sprd/whale2.dtsi |  18 +-
 2 files changed, 131 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/sprd/sc9860.dtsi 
b/arch/arm64/boot/dts/sprd/sc9860.dtsi
index 7b7d8ce..bf03da4 100644
--- a/arch/arm64/boot/dts/sprd/sc9860.dtsi
+++ b/arch/arm64/boot/dts/sprd/sc9860.dtsi
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include "whale2.dtsi"
 
 / {
@@ -183,6 +184,120 @@
};
 
soc {
+   pmu_gate: pmu-gate {
+   compatible = "sprd,sc9860-pmu-gate";
+   sprd,syscon = <_regs>; /* 0x402b */
+   clocks = <_26m>;
+   #clock-cells = <1>;
+   };
+
+   pll: pll {
+   compatible = "sprd,sc9860-pll";
+   sprd,syscon = <_regs>; /* 0x4040 */
+   clocks = <_gate 0>;
+   #clock-cells = <1>;
+   };
+
+   ap_clk: clock-controller@2000 {
+   compatible = "sprd,sc9860-ap-clk";
+   reg = <0 0x2000 0 0x400>;
+   clocks = <_26m>, < 0>,
+<_gate 0>;
+   #clock-cells = <1>;
+   };
+
+   aon_prediv: aon-prediv {
+   compatible = "sprd,sc9860-aon-prediv";
+   reg = <0 0x402d 0 0x400>;
+   clocks = <_26m>, < 0>,
+<_gate 0>;
+   #clock-cells = <1>;
+   };
+
+   apahb_gate: apahb-gate {
+   compatible = "sprd,sc9860-apahb-gate";
+   sprd,syscon = <_ahb_regs>; /* 0x2021 */
+   clocks = <_prediv 0>;
+   #clock-cells = <1>;
+   };
+
+   aon_gate: aon-gate {
+   compatible = "sprd,sc9860-aon-gate";
+   sprd,syscon = <_regs>; /* 0x402e */
+   clocks = <_prediv 0>;
+   #clock-cells = <1>;
+   };
+
+   aonsecure_clk: clock-controller@4088 {
+   compatible = "sprd,sc9860-aonsecure-clk";
+   reg = <0 0x4088 0 0x400>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   agcp_gate: agcp-gate {
+   compatible = "sprd,sc9860-agcp-gate";
+   sprd,syscon = <_regs>; /* 0x415e */
+   clocks = <_prediv 0>;
+   #clock-cells = <1>;
+   };
+
+   gpu_clk: clock-controller@6020 {
+   compatible = "sprd,sc9860-gpu-clk";
+   reg = <0 0x6020 0 0x400>;
+   clocks = < 0>;
+   #clock-cells = <1>;
+   };
+
+   vsp_clk: clock-controller@6100 {
+   compatible = "sprd,sc9860-vsp-clk";
+   reg = <0 0x6100 0 0x400>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   vsp_gate: vsp-gate {
+   compatible = "sprd,sc9860-vsp-gate";
+   sprd,syscon = <_regs>; /* 0x6110 */
+   clocks = <_clk 0>;
+   #clock-cells = <1>;
+   };
+
+   cam_clk: clock-controller@6200 {
+   compatible = "sprd,sc9860-cam-clk";
+   reg = <0 0x6200 0 0x4000>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   cam_gate: cam-gate {
+   compatible = "sprd,sc9860-cam-gate";
+   sprd,syscon = <_regs>; /* 0x6210 */
+   clocks = <_clk 0>;
+   #clock-cells = <1>;
+   };
+
+   disp_clk: clock-controller@6300 {
+   compatible = "sprd,sc9860-disp-clk";
+   reg = <0 0x6300 0 0x400>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   disp_gate: disp-gate {
+   compatible = "sprd,sc9860-disp-gate";
+   sprd,syscon = <_regs>; /* 0x6310 */
+   clocks = <_clk 0>;
+   

[RECEND PATCH V7 12/12] arm64: dts: add clocks for SC9860

2018-01-03 Thread Chunyan Zhang
From: Chunyan Zhang 

Some clocks on SC9860 are in the same address area with syscon devices,
those are what have a property of 'sprd,syscon' which would refer to
syscon devices, others would have a reg property indicated their address
ranges.

Signed-off-by: Chunyan Zhang 
---
 arch/arm64/boot/dts/sprd/sc9860.dtsi | 115 +++
 arch/arm64/boot/dts/sprd/whale2.dtsi |  18 +-
 2 files changed, 131 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/sprd/sc9860.dtsi 
b/arch/arm64/boot/dts/sprd/sc9860.dtsi
index 7b7d8ce..bf03da4 100644
--- a/arch/arm64/boot/dts/sprd/sc9860.dtsi
+++ b/arch/arm64/boot/dts/sprd/sc9860.dtsi
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include "whale2.dtsi"
 
 / {
@@ -183,6 +184,120 @@
};
 
soc {
+   pmu_gate: pmu-gate {
+   compatible = "sprd,sc9860-pmu-gate";
+   sprd,syscon = <_regs>; /* 0x402b */
+   clocks = <_26m>;
+   #clock-cells = <1>;
+   };
+
+   pll: pll {
+   compatible = "sprd,sc9860-pll";
+   sprd,syscon = <_regs>; /* 0x4040 */
+   clocks = <_gate 0>;
+   #clock-cells = <1>;
+   };
+
+   ap_clk: clock-controller@2000 {
+   compatible = "sprd,sc9860-ap-clk";
+   reg = <0 0x2000 0 0x400>;
+   clocks = <_26m>, < 0>,
+<_gate 0>;
+   #clock-cells = <1>;
+   };
+
+   aon_prediv: aon-prediv {
+   compatible = "sprd,sc9860-aon-prediv";
+   reg = <0 0x402d 0 0x400>;
+   clocks = <_26m>, < 0>,
+<_gate 0>;
+   #clock-cells = <1>;
+   };
+
+   apahb_gate: apahb-gate {
+   compatible = "sprd,sc9860-apahb-gate";
+   sprd,syscon = <_ahb_regs>; /* 0x2021 */
+   clocks = <_prediv 0>;
+   #clock-cells = <1>;
+   };
+
+   aon_gate: aon-gate {
+   compatible = "sprd,sc9860-aon-gate";
+   sprd,syscon = <_regs>; /* 0x402e */
+   clocks = <_prediv 0>;
+   #clock-cells = <1>;
+   };
+
+   aonsecure_clk: clock-controller@4088 {
+   compatible = "sprd,sc9860-aonsecure-clk";
+   reg = <0 0x4088 0 0x400>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   agcp_gate: agcp-gate {
+   compatible = "sprd,sc9860-agcp-gate";
+   sprd,syscon = <_regs>; /* 0x415e */
+   clocks = <_prediv 0>;
+   #clock-cells = <1>;
+   };
+
+   gpu_clk: clock-controller@6020 {
+   compatible = "sprd,sc9860-gpu-clk";
+   reg = <0 0x6020 0 0x400>;
+   clocks = < 0>;
+   #clock-cells = <1>;
+   };
+
+   vsp_clk: clock-controller@6100 {
+   compatible = "sprd,sc9860-vsp-clk";
+   reg = <0 0x6100 0 0x400>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   vsp_gate: vsp-gate {
+   compatible = "sprd,sc9860-vsp-gate";
+   sprd,syscon = <_regs>; /* 0x6110 */
+   clocks = <_clk 0>;
+   #clock-cells = <1>;
+   };
+
+   cam_clk: clock-controller@6200 {
+   compatible = "sprd,sc9860-cam-clk";
+   reg = <0 0x6200 0 0x4000>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   cam_gate: cam-gate {
+   compatible = "sprd,sc9860-cam-gate";
+   sprd,syscon = <_regs>; /* 0x6210 */
+   clocks = <_clk 0>;
+   #clock-cells = <1>;
+   };
+
+   disp_clk: clock-controller@6300 {
+   compatible = "sprd,sc9860-disp-clk";
+   reg = <0 0x6300 0 0x400>;
+   clocks = <_26m>, < 0>;
+   #clock-cells = <1>;
+   };
+
+   disp_gate: disp-gate {
+   compatible = "sprd,sc9860-disp-gate";
+   sprd,syscon = <_regs>; /* 0x6310 */
+   clocks = <_clk 0>;
+   #clock-cells = <1>;
+   };

Re: [PATCH 4.9 29/39] x86/kaiser: Check boottime cmdline params

2018-01-03 Thread Borislav Petkov
On Thu, Jan 04, 2018 at 12:16:08AM +, Ben Hutchings wrote:
> No such exception has been added upstream, so I don't think it's
> appropriate to add it in stable.

On its way:

https://git.kernel.org/tip/694d99d40972f12e59a3696effee8a376b79d7c8

-- 
Regards/Gruss,
Boris.

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


Re: [PATCH 4.9 29/39] x86/kaiser: Check boottime cmdline params

2018-01-03 Thread Borislav Petkov
On Thu, Jan 04, 2018 at 12:16:08AM +, Ben Hutchings wrote:
> No such exception has been added upstream, so I don't think it's
> appropriate to add it in stable.

On its way:

https://git.kernel.org/tip/694d99d40972f12e59a3696effee8a376b79d7c8

-- 
Regards/Gruss,
Boris.

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


[PATCH] thermal: Add debugfs support for cooling devices

2018-01-03 Thread Viresh Kumar
This implements the debugfs interface for thermal cooling devices and
exposes some pretty useful statistics. These statistics have proven to
be quite useful specially while doing benchmarks related to the task
scheduler, where we want to make sure that nothing has disrupted the
test, specially the cooling device which may have put constraints on the
CPUs. The information exposed here tells us to what extent the CPUs were
constrained by the thermal framework.

The read-only "transitions" file is per cooling device and it shows the
total number of cooling state transitions the device has gone through
since the time the cooling device is registered or the time when
statistics were reset last.

The read-only "time_in_state/stateN" file is per cooling state and it
shows the time spent by the device in the respective cooling state.

The write-only "reset" file is used to reset the statistics.

This is how the directory structure looks like for a single cooling
device:

$ ls -R /sys/kernel/debug/thermal/
/sys/kernel/debug/thermal/:
cooling_device0

/sys/kernel/debug/thermal/cooling_device0:
reset  time_in_state_ms  transitions

/sys/kernel/debug/thermal/cooling_device0/time_in_state_ms:
state0  state1  state2  state3

This is tested on ARM 32-bit Hisilicon hikey620 board running Ubuntu and
ARM 64-bit Hisilicon hikey960 board running Android.

Signed-off-by: Viresh Kumar 
---
 drivers/thermal/Makefile  |   1 +
 drivers/thermal/thermal_core.c|   6 ++
 drivers/thermal/thermal_core.h|  18 
 drivers/thermal/thermal_debugfs.c | 167 ++
 drivers/thermal/thermal_helpers.c |   5 +-
 drivers/thermal/thermal_sysfs.c   |   1 +
 include/linux/thermal.h   |   1 +
 7 files changed, 198 insertions(+), 1 deletion(-)
 create mode 100644 drivers/thermal/thermal_debugfs.c

diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 610344eb3e03..629f74e73871 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -6,6 +6,7 @@
 obj-$(CONFIG_THERMAL)  += thermal_sys.o
 thermal_sys-y  += thermal_core.o thermal_sysfs.o \
thermal_helpers.o
+obj-$(CONFIG_DEBUG_FS) += thermal_debugfs.o
 
 # interface to/from other layers providing sensors
 thermal_sys-$(CONFIG_THERMAL_HWMON)+= thermal_hwmon.o
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 2b1b0ba393a4..bcc34648580f 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -997,6 +997,8 @@ __thermal_cooling_device_register(struct device_node *np,
   THERMAL_EVENT_UNSPECIFIED);
mutex_unlock(_list_lock);
 
+   thermal_cooling_device_setup_debugfs(cdev);
+
return cdev;
 }
 
@@ -1104,6 +1106,7 @@ void thermal_cooling_device_unregister(struct 
thermal_cooling_device *cdev)
 
mutex_unlock(_list_lock);
 
+   thermal_cooling_device_remove_debugfs(cdev);
ida_simple_remove(_cdev_ida, cdev->id);
device_unregister(>device);
 }
@@ -1544,6 +1547,8 @@ static int __init thermal_init(void)
pr_warn("Thermal: Can not register suspend notifier, return 
%d\n",
result);
 
+   thermal_debugfs_register();
+
return 0;
 
 exit_netlink:
@@ -1563,6 +1568,7 @@ static int __init thermal_init(void)
 
 static void __exit thermal_exit(void)
 {
+   thermal_debugfs_unregister();
unregister_pm_notifier(_pm_nb);
of_thermal_destroy_zones();
genetlink_exit();
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 27e3b1df7360..3a8d50aa32dc 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -151,4 +151,22 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz)
 }
 #endif
 
+#ifdef CONFIG_DEBUG_FS
+void thermal_debugfs_register(void);
+void thermal_debugfs_unregister(void);
+void thermal_cooling_device_setup_debugfs(struct thermal_cooling_device *cdev);
+void thermal_cooling_device_remove_debugfs(struct thermal_cooling_device 
*cdev);
+void thermal_cooling_device_debugfs_update(struct thermal_cooling_device *cdev,
+  unsigned long new_state);
+#else
+static inline void thermal_debugfs_register(void) {}
+static inline void thermal_debugfs_unregister(void) {}
+static inline void
+thermal_cooling_device_setup_debugfs(struct thermal_cooling_device *cdev) {}
+static inline void
+thermal_cooling_device_remove_debugfs(struct thermal_cooling_device *cdev) {}
+static inline void
+thermal_cooling_device_debugfs_update(struct thermal_cooling_device *cdev,
+ unsigned long new_state) {}
+#endif /* debugfs */
 #endif /* __THERMAL_CORE_H__ */
diff --git a/drivers/thermal/thermal_debugfs.c 
b/drivers/thermal/thermal_debugfs.c
new file mode 100644
index 

[PATCH] thermal: Add debugfs support for cooling devices

2018-01-03 Thread Viresh Kumar
This implements the debugfs interface for thermal cooling devices and
exposes some pretty useful statistics. These statistics have proven to
be quite useful specially while doing benchmarks related to the task
scheduler, where we want to make sure that nothing has disrupted the
test, specially the cooling device which may have put constraints on the
CPUs. The information exposed here tells us to what extent the CPUs were
constrained by the thermal framework.

The read-only "transitions" file is per cooling device and it shows the
total number of cooling state transitions the device has gone through
since the time the cooling device is registered or the time when
statistics were reset last.

The read-only "time_in_state/stateN" file is per cooling state and it
shows the time spent by the device in the respective cooling state.

The write-only "reset" file is used to reset the statistics.

This is how the directory structure looks like for a single cooling
device:

$ ls -R /sys/kernel/debug/thermal/
/sys/kernel/debug/thermal/:
cooling_device0

/sys/kernel/debug/thermal/cooling_device0:
reset  time_in_state_ms  transitions

/sys/kernel/debug/thermal/cooling_device0/time_in_state_ms:
state0  state1  state2  state3

This is tested on ARM 32-bit Hisilicon hikey620 board running Ubuntu and
ARM 64-bit Hisilicon hikey960 board running Android.

Signed-off-by: Viresh Kumar 
---
 drivers/thermal/Makefile  |   1 +
 drivers/thermal/thermal_core.c|   6 ++
 drivers/thermal/thermal_core.h|  18 
 drivers/thermal/thermal_debugfs.c | 167 ++
 drivers/thermal/thermal_helpers.c |   5 +-
 drivers/thermal/thermal_sysfs.c   |   1 +
 include/linux/thermal.h   |   1 +
 7 files changed, 198 insertions(+), 1 deletion(-)
 create mode 100644 drivers/thermal/thermal_debugfs.c

diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 610344eb3e03..629f74e73871 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -6,6 +6,7 @@
 obj-$(CONFIG_THERMAL)  += thermal_sys.o
 thermal_sys-y  += thermal_core.o thermal_sysfs.o \
thermal_helpers.o
+obj-$(CONFIG_DEBUG_FS) += thermal_debugfs.o
 
 # interface to/from other layers providing sensors
 thermal_sys-$(CONFIG_THERMAL_HWMON)+= thermal_hwmon.o
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 2b1b0ba393a4..bcc34648580f 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -997,6 +997,8 @@ __thermal_cooling_device_register(struct device_node *np,
   THERMAL_EVENT_UNSPECIFIED);
mutex_unlock(_list_lock);
 
+   thermal_cooling_device_setup_debugfs(cdev);
+
return cdev;
 }
 
@@ -1104,6 +1106,7 @@ void thermal_cooling_device_unregister(struct 
thermal_cooling_device *cdev)
 
mutex_unlock(_list_lock);
 
+   thermal_cooling_device_remove_debugfs(cdev);
ida_simple_remove(_cdev_ida, cdev->id);
device_unregister(>device);
 }
@@ -1544,6 +1547,8 @@ static int __init thermal_init(void)
pr_warn("Thermal: Can not register suspend notifier, return 
%d\n",
result);
 
+   thermal_debugfs_register();
+
return 0;
 
 exit_netlink:
@@ -1563,6 +1568,7 @@ static int __init thermal_init(void)
 
 static void __exit thermal_exit(void)
 {
+   thermal_debugfs_unregister();
unregister_pm_notifier(_pm_nb);
of_thermal_destroy_zones();
genetlink_exit();
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 27e3b1df7360..3a8d50aa32dc 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -151,4 +151,22 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz)
 }
 #endif
 
+#ifdef CONFIG_DEBUG_FS
+void thermal_debugfs_register(void);
+void thermal_debugfs_unregister(void);
+void thermal_cooling_device_setup_debugfs(struct thermal_cooling_device *cdev);
+void thermal_cooling_device_remove_debugfs(struct thermal_cooling_device 
*cdev);
+void thermal_cooling_device_debugfs_update(struct thermal_cooling_device *cdev,
+  unsigned long new_state);
+#else
+static inline void thermal_debugfs_register(void) {}
+static inline void thermal_debugfs_unregister(void) {}
+static inline void
+thermal_cooling_device_setup_debugfs(struct thermal_cooling_device *cdev) {}
+static inline void
+thermal_cooling_device_remove_debugfs(struct thermal_cooling_device *cdev) {}
+static inline void
+thermal_cooling_device_debugfs_update(struct thermal_cooling_device *cdev,
+ unsigned long new_state) {}
+#endif /* debugfs */
 #endif /* __THERMAL_CORE_H__ */
diff --git a/drivers/thermal/thermal_debugfs.c 
b/drivers/thermal/thermal_debugfs.c
new file mode 100644
index ..077684197250
--- /dev/null
+++ 

[PATCH v4] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Yunlong Song
In some case, the node blocks has wrong blkaddr whose segment type is
NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
the xattr range. Since fsck.f2fs does not check the recovery nodes, this
will cause __f2fs_replace_block change the curseg of node and do the
update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
result, when recovery process write checkpoint and sync nodes, the
next_blkoff of curseg is used in the segment bit map, then it will
cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.

Signed-off-by: Yunlong Song 
---
 fs/f2fs/segment.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 890d483..50575d5 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
struct f2fs_summary *sum,
type = se->type;
 
down_write(_I(sbi)->curseg_lock);
+   f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));
 
if (!recover_curseg) {
/* for recovery flow */
-- 
1.8.5.2



[PATCH v4] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Yunlong Song
In some case, the node blocks has wrong blkaddr whose segment type is
NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
the xattr range. Since fsck.f2fs does not check the recovery nodes, this
will cause __f2fs_replace_block change the curseg of node and do the
update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
result, when recovery process write checkpoint and sync nodes, the
next_blkoff of curseg is used in the segment bit map, then it will
cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.

Signed-off-by: Yunlong Song 
---
 fs/f2fs/segment.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 890d483..50575d5 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
struct f2fs_summary *sum,
type = se->type;
 
down_write(_I(sbi)->curseg_lock);
+   f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));
 
if (!recover_curseg) {
/* for recovery flow */
-- 
1.8.5.2



Re: [PATCH 4.9 00/39] 4.9.75-stable review

2018-01-03 Thread Naresh Kamboju
On 4 January 2018 at 01:41, Greg Kroah-Hartman
 wrote:
> This is the start of the stable review cycle for the 4.9.75 release.
> There are 39 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Jan  5 19:50:44 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.75-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.9.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

Summary


kernel: 4.9.75-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: d88d440098ee3b1a6004fc6ed442e5cc6f9befca
git describe: v4.9.74-40-gd88d440098ee
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.74-40-gd88d440098ee


No regressions (compared to build v4.9.74-38-g8cb1a8d5571f)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 40, skip: 23
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 983, skip: 121
* ltp-timers-tests - pass: 12,

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 40, skip: 23
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 987, skip: 121
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 37, skip: 25
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1037, skip: 66
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 53, skip: 24
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 63,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1014, skip: 116
* ltp-timers-tests - pass: 12,

Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Tested-by: Naresh Kamboju 


Re: [PATCH 4.9 00/39] 4.9.75-stable review

2018-01-03 Thread Naresh Kamboju
On 4 January 2018 at 01:41, Greg Kroah-Hartman
 wrote:
> This is the start of the stable review cycle for the 4.9.75 release.
> There are 39 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Jan  5 19:50:44 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.75-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.9.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

Summary


kernel: 4.9.75-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: d88d440098ee3b1a6004fc6ed442e5cc6f9befca
git describe: v4.9.74-40-gd88d440098ee
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.74-40-gd88d440098ee


No regressions (compared to build v4.9.74-38-g8cb1a8d5571f)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 40, skip: 23
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 983, skip: 121
* ltp-timers-tests - pass: 12,

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 40, skip: 23
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 987, skip: 121
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 37, skip: 25
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1037, skip: 66
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 53, skip: 24
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 63,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1014, skip: 116
* ltp-timers-tests - pass: 12,

Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Tested-by: Naresh Kamboju 


Re: Crashes with KPTI and -rc6

2018-01-03 Thread Ingo Molnar

* Laura Abbott  wrote:

> Hi,
> 
> Fedora got a report via IRC of a double fault with KPTI
> https://paste.fedoraproject.org/paste/SL~of04ZExXP6AN2gcJi7A

I believe this one should be fixed by:

  d7732ba55c4b: x86/pti: Switch to kernel CR3 at early in entry_SYSCALL_compat()

> This is on -rc6 . I saw the one fix posted already which
> I'll pull in but I wanted to report this as a heads up
> in case there are other issues.
> 
> Full tree and configs are at
> https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/log/?h=rawhide

Thanks!

Linus's latest upstream:

  00a5ae218d57: Merge branch 'x86-pti-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

and later kernels includes all fixes for all regressions that were reported so 
far 
on top of -rc6:

 2fd9c41aea47: x86/process: Define cpu_tss_rw in same section as declaration
 d7732ba55c4b: x86/pti: Switch to kernel CR3 at early in entry_SYSCALL_compat()
 3ffdeb1a02be: x86/dumpstack: Print registers for first stack frame
 a9cdbe72c4e8: x86/dumpstack: Fix partial register dumps
 52994c256df3: x86/pti: Make sure the user/kernel PTEs match
 694d99d40972: x86/cpu, x86/pti: Do not enable PTI on AMD processors
 87faa0d9b43b: x86/pti: Enable PTI by default

PTI fixes can also be independently tracked and pre-merged via:

  git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/pti

Thanks,

Ingo


Re: Crashes with KPTI and -rc6

2018-01-03 Thread Ingo Molnar

* Laura Abbott  wrote:

> Hi,
> 
> Fedora got a report via IRC of a double fault with KPTI
> https://paste.fedoraproject.org/paste/SL~of04ZExXP6AN2gcJi7A

I believe this one should be fixed by:

  d7732ba55c4b: x86/pti: Switch to kernel CR3 at early in entry_SYSCALL_compat()

> This is on -rc6 . I saw the one fix posted already which
> I'll pull in but I wanted to report this as a heads up
> in case there are other issues.
> 
> Full tree and configs are at
> https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/log/?h=rawhide

Thanks!

Linus's latest upstream:

  00a5ae218d57: Merge branch 'x86-pti-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

and later kernels includes all fixes for all regressions that were reported so 
far 
on top of -rc6:

 2fd9c41aea47: x86/process: Define cpu_tss_rw in same section as declaration
 d7732ba55c4b: x86/pti: Switch to kernel CR3 at early in entry_SYSCALL_compat()
 3ffdeb1a02be: x86/dumpstack: Print registers for first stack frame
 a9cdbe72c4e8: x86/dumpstack: Fix partial register dumps
 52994c256df3: x86/pti: Make sure the user/kernel PTEs match
 694d99d40972: x86/cpu, x86/pti: Do not enable PTI on AMD processors
 87faa0d9b43b: x86/pti: Enable PTI by default

PTI fixes can also be independently tracked and pre-merged via:

  git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/pti

Thanks,

Ingo


Re: [PATCH v3] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Jaegeuk Kim
On 01/04, Yunlong Song wrote:
> In some case, the node blocks has wrong blkaddr whose segment type is
> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
> will cause __f2fs_replace_block change the curseg of node and do the
> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
> result, when recovery process write checkpoint and sync nodes, the
> next_blkoff of curseg is used in the segment bit map, then it will
> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
> 
> Signed-off-by: Yunlong Song 
> ---
>  fs/f2fs/segment.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 890d483..6c6d2dd 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2719,6 +2719,8 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
> struct f2fs_summary *sum,
>   se = get_seg_entry(sbi, segno);
>   type = se->type;
>  
> + f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));
> +

Need to cover se->valid_blocks by the below curseg_lock at least?

>   down_write(_I(sbi)->curseg_lock);
>  
>   if (!recover_curseg) {
> -- 
> 1.8.5.2


Re: [PATCH v3] f2fs: check segment type in __f2fs_replace_block

2018-01-03 Thread Jaegeuk Kim
On 01/04, Yunlong Song wrote:
> In some case, the node blocks has wrong blkaddr whose segment type is
> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
> will cause __f2fs_replace_block change the curseg of node and do the
> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
> result, when recovery process write checkpoint and sync nodes, the
> next_blkoff of curseg is used in the segment bit map, then it will
> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
> 
> Signed-off-by: Yunlong Song 
> ---
>  fs/f2fs/segment.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 890d483..6c6d2dd 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2719,6 +2719,8 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, 
> struct f2fs_summary *sum,
>   se = get_seg_entry(sbi, segno);
>   type = se->type;
>  
> + f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));
> +

Need to cover se->valid_blocks by the below curseg_lock at least?

>   down_write(_I(sbi)->curseg_lock);
>  
>   if (!recover_curseg) {
> -- 
> 1.8.5.2


Re: KASAN: use-after-free Read in __dev_queue_xmit

2018-01-03 Thread Eric Dumazet
On Wed, 2018-01-03 at 21:13 -0800, Eric Dumazet wrote:
> Note: all commands must start from beginning of the line in the email body.
> 
> I guess skb_probe_transport_header() should be hardened to reject malicious
> packets given by user space, instead of being gentle.

Although bug triggered for this particular repro is in flow dissector
:/

I will test :

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 
15ce300637650e17fcab7e378b20fe7972686d46..544bddf08e13c7f6e47aadc737244c9ba5af56b2
 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -976,8 +976,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 out_good:
ret = true;
 
-   key_control->thoff = (u16)nhoff;
 out:
+   key_control->thoff = min_t(u16, nhoff, skb ? skb->len : hlen);
key_basic->n_proto = proto;
key_basic->ip_proto = ip_proto;
 
@@ -985,7 +985,6 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 
 out_bad:
ret = false;
-   key_control->thoff = min_t(u16, nhoff, skb ? skb->len : hlen);
goto out;
 }
 EXPORT_SYMBOL(__skb_flow_dissect);



Re: KASAN: use-after-free Read in __dev_queue_xmit

2018-01-03 Thread Eric Dumazet
On Wed, 2018-01-03 at 21:13 -0800, Eric Dumazet wrote:
> Note: all commands must start from beginning of the line in the email body.
> 
> I guess skb_probe_transport_header() should be hardened to reject malicious
> packets given by user space, instead of being gentle.

Although bug triggered for this particular repro is in flow dissector
:/

I will test :

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 
15ce300637650e17fcab7e378b20fe7972686d46..544bddf08e13c7f6e47aadc737244c9ba5af56b2
 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -976,8 +976,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 out_good:
ret = true;
 
-   key_control->thoff = (u16)nhoff;
 out:
+   key_control->thoff = min_t(u16, nhoff, skb ? skb->len : hlen);
key_basic->n_proto = proto;
key_basic->ip_proto = ip_proto;
 
@@ -985,7 +985,6 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 
 out_bad:
ret = false;
-   key_control->thoff = min_t(u16, nhoff, skb ? skb->len : hlen);
goto out;
 }
 EXPORT_SYMBOL(__skb_flow_dissect);



Re: [PATCH 2/2 v2] f2fs: add reserved blocks for root user

2018-01-03 Thread Jaegeuk Kim
This patch allows root to reserve some blocks via mount option.

"-o reserve_root=N" means N x 4KB-sized blocks for root only.

Signed-off-by: Jaegeuk Kim 
---

Change log from v1:
 - handle remount case to limit reserve_root=%u

 fs/f2fs/f2fs.h  | 20 
 fs/f2fs/super.c | 34 +-
 fs/f2fs/sysfs.c |  3 ++-
 3 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index a52de99a34b9..4d255aac49bb 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -95,6 +95,7 @@ extern char *fault_name[FAULT_MAX];
 #define F2FS_MOUNT_PRJQUOTA0x0020
 #define F2FS_MOUNT_QUOTA   0x0040
 #define F2FS_MOUNT_INLINE_XATTR_SIZE   0x0080
+#define F2FS_MOUNT_RESERVE_ROOT0x0100
 
 #define clear_opt(sbi, option) ((sbi)->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)   ((sbi)->mount_opt.opt |= F2FS_MOUNT_##option)
@@ -1109,6 +1110,7 @@ struct f2fs_sb_info {
block_t last_valid_block_count; /* for recovery */
block_t reserved_blocks;/* configurable reserved blocks 
*/
block_t current_reserved_blocks;/* current reserved blocks */
+   block_t root_reserved_blocks;   /* root reserved blocks */
 
unsigned int nquota_files;  /* # of quota sysfile */
 
@@ -1590,11 +1592,17 @@ static inline int inc_valid_block_count(struct 
f2fs_sb_info *sbi,
sbi->total_valid_block_count += (block_t)(*count);
avail_user_block_count = sbi->user_block_count -
sbi->current_reserved_blocks;
+
+   if (!(test_opt(sbi, RESERVE_ROOT) && capable(CAP_SYS_RESOURCE)))
+   avail_user_block_count -= sbi->root_reserved_blocks;
+
if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) {
diff = sbi->total_valid_block_count - avail_user_block_count;
+   if (diff > *count)
+   diff = *count;
*count -= diff;
release = diff;
-   sbi->total_valid_block_count = avail_user_block_count;
+   sbi->total_valid_block_count -= diff;
if (!*count) {
spin_unlock(>stat_lock);
percpu_counter_sub(>alloc_valid_block_count, diff);
@@ -1783,9 +1791,13 @@ static inline int inc_valid_node_count(struct 
f2fs_sb_info *sbi,
 
spin_lock(>stat_lock);
 
-   valid_block_count = sbi->total_valid_block_count + 1;
-   if (unlikely(valid_block_count + sbi->current_reserved_blocks >
-   sbi->user_block_count)) {
+   valid_block_count = sbi->total_valid_block_count +
+   sbi->current_reserved_blocks + 1;
+
+   if (!(test_opt(sbi, RESERVE_ROOT) && capable(CAP_SYS_RESOURCE)))
+   valid_block_count += sbi->root_reserved_blocks;
+
+   if (unlikely(valid_block_count > sbi->user_block_count)) {
spin_unlock(>stat_lock);
goto enospc;
}
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index f1300cda6bfd..f828a3ea3c9a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -107,6 +107,7 @@ enum {
Opt_noextent_cache,
Opt_noinline_data,
Opt_data_flush,
+   Opt_reserve_root,
Opt_mode,
Opt_io_size_bits,
Opt_fault_injection,
@@ -157,6 +158,7 @@ static match_table_t f2fs_tokens = {
{Opt_noextent_cache, "noextent_cache"},
{Opt_noinline_data, "noinline_data"},
{Opt_data_flush, "data_flush"},
+   {Opt_reserve_root, "reserve_root=%u"},
{Opt_mode, "mode=%s"},
{Opt_io_size_bits, "io_bits=%u"},
{Opt_fault_injection, "fault_injection=%u"},
@@ -191,6 +193,19 @@ void f2fs_msg(struct super_block *sb, const char *level, 
const char *fmt, ...)
va_end(args);
 }
 
+static inline void limit_reserve_root(struct f2fs_sb_info *sbi)
+{
+   block_t limit = (sbi->user_block_count << 1) / 1000;
+
+   /* limit is 0.2% */
+   if (test_opt(sbi, RESERVE_ROOT) && sbi->root_reserved_blocks > limit) {
+   sbi->root_reserved_blocks = limit;
+   f2fs_msg(sbi->sb, KERN_INFO,
+   "Reduce reserved blocks for root = %u",
+   sbi->root_reserved_blocks);
+   }
+}
+
 static void init_once(void *foo)
 {
struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo;
@@ -488,6 +503,18 @@ static int parse_options(struct super_block *sb, char 
*options)
case Opt_data_flush:
set_opt(sbi, DATA_FLUSH);
break;
+   case Opt_reserve_root:
+   if (args->from && match_int(args, ))
+   return -EINVAL;
+   if (test_opt(sbi, RESERVE_ROOT)) {
+  

Re: [PATCH 2/2 v2] f2fs: add reserved blocks for root user

2018-01-03 Thread Jaegeuk Kim
This patch allows root to reserve some blocks via mount option.

"-o reserve_root=N" means N x 4KB-sized blocks for root only.

Signed-off-by: Jaegeuk Kim 
---

Change log from v1:
 - handle remount case to limit reserve_root=%u

 fs/f2fs/f2fs.h  | 20 
 fs/f2fs/super.c | 34 +-
 fs/f2fs/sysfs.c |  3 ++-
 3 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index a52de99a34b9..4d255aac49bb 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -95,6 +95,7 @@ extern char *fault_name[FAULT_MAX];
 #define F2FS_MOUNT_PRJQUOTA0x0020
 #define F2FS_MOUNT_QUOTA   0x0040
 #define F2FS_MOUNT_INLINE_XATTR_SIZE   0x0080
+#define F2FS_MOUNT_RESERVE_ROOT0x0100
 
 #define clear_opt(sbi, option) ((sbi)->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)   ((sbi)->mount_opt.opt |= F2FS_MOUNT_##option)
@@ -1109,6 +1110,7 @@ struct f2fs_sb_info {
block_t last_valid_block_count; /* for recovery */
block_t reserved_blocks;/* configurable reserved blocks 
*/
block_t current_reserved_blocks;/* current reserved blocks */
+   block_t root_reserved_blocks;   /* root reserved blocks */
 
unsigned int nquota_files;  /* # of quota sysfile */
 
@@ -1590,11 +1592,17 @@ static inline int inc_valid_block_count(struct 
f2fs_sb_info *sbi,
sbi->total_valid_block_count += (block_t)(*count);
avail_user_block_count = sbi->user_block_count -
sbi->current_reserved_blocks;
+
+   if (!(test_opt(sbi, RESERVE_ROOT) && capable(CAP_SYS_RESOURCE)))
+   avail_user_block_count -= sbi->root_reserved_blocks;
+
if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) {
diff = sbi->total_valid_block_count - avail_user_block_count;
+   if (diff > *count)
+   diff = *count;
*count -= diff;
release = diff;
-   sbi->total_valid_block_count = avail_user_block_count;
+   sbi->total_valid_block_count -= diff;
if (!*count) {
spin_unlock(>stat_lock);
percpu_counter_sub(>alloc_valid_block_count, diff);
@@ -1783,9 +1791,13 @@ static inline int inc_valid_node_count(struct 
f2fs_sb_info *sbi,
 
spin_lock(>stat_lock);
 
-   valid_block_count = sbi->total_valid_block_count + 1;
-   if (unlikely(valid_block_count + sbi->current_reserved_blocks >
-   sbi->user_block_count)) {
+   valid_block_count = sbi->total_valid_block_count +
+   sbi->current_reserved_blocks + 1;
+
+   if (!(test_opt(sbi, RESERVE_ROOT) && capable(CAP_SYS_RESOURCE)))
+   valid_block_count += sbi->root_reserved_blocks;
+
+   if (unlikely(valid_block_count > sbi->user_block_count)) {
spin_unlock(>stat_lock);
goto enospc;
}
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index f1300cda6bfd..f828a3ea3c9a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -107,6 +107,7 @@ enum {
Opt_noextent_cache,
Opt_noinline_data,
Opt_data_flush,
+   Opt_reserve_root,
Opt_mode,
Opt_io_size_bits,
Opt_fault_injection,
@@ -157,6 +158,7 @@ static match_table_t f2fs_tokens = {
{Opt_noextent_cache, "noextent_cache"},
{Opt_noinline_data, "noinline_data"},
{Opt_data_flush, "data_flush"},
+   {Opt_reserve_root, "reserve_root=%u"},
{Opt_mode, "mode=%s"},
{Opt_io_size_bits, "io_bits=%u"},
{Opt_fault_injection, "fault_injection=%u"},
@@ -191,6 +193,19 @@ void f2fs_msg(struct super_block *sb, const char *level, 
const char *fmt, ...)
va_end(args);
 }
 
+static inline void limit_reserve_root(struct f2fs_sb_info *sbi)
+{
+   block_t limit = (sbi->user_block_count << 1) / 1000;
+
+   /* limit is 0.2% */
+   if (test_opt(sbi, RESERVE_ROOT) && sbi->root_reserved_blocks > limit) {
+   sbi->root_reserved_blocks = limit;
+   f2fs_msg(sbi->sb, KERN_INFO,
+   "Reduce reserved blocks for root = %u",
+   sbi->root_reserved_blocks);
+   }
+}
+
 static void init_once(void *foo)
 {
struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo;
@@ -488,6 +503,18 @@ static int parse_options(struct super_block *sb, char 
*options)
case Opt_data_flush:
set_opt(sbi, DATA_FLUSH);
break;
+   case Opt_reserve_root:
+   if (args->from && match_int(args, ))
+   return -EINVAL;
+   if (test_opt(sbi, RESERVE_ROOT)) {
+   

Re: [PATCH 4.4 00/37] 4.4.110-stable review

2018-01-03 Thread Naresh Kamboju
On 4 January 2018 at 01:41, Greg Kroah-Hartman
<gre...@linuxfoundation.org> wrote:
> This is the start of the stable review cycle for the 4.4.110 release.
> There are 37 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Jan  5 19:50:38 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.110-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.4.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

NOTE:
Retested 20 Iterations on two devices and all 40 times test completed
successfully.
Which confirms this is an intermittent timing failure.
For the internal investigation and record the bug has been reported.
LKFT:stable-rc 4.4.110-rc1: x15: LTP poll02 FAIL: poll() slept for too
long (intermittent)
https://bugs.linaro.org/show_bug.cgi?id=3566

Summary


kernel: 4.4.110-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 99abd6cdd65e984d89c8565508a7a96ea0fce179
git describe: v4.4.109-38-g99abd6cdd65e
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.109-38-g99abd6cdd65e

No Regressions (compared to build v4.4.109)



Boards, architectures and test suites:
-

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 32, skip: 29
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 984, skip: 124
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 31, skip: 29
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - fail: 1, pass: 1034, skip: 67
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 44, skip: 32
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1013, skip: 117
* ltp-timers-tests - pass: 12,

Hikey board test results,

Summary


kernel: 4.4.110-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git tag: 4.4.110-rc1-hikey-20180103-95
git commit: 0769c4b4aafd63e5d73b6d67f6fe93abcff67cdc
git describe: 4.4.110-rc1-hikey-20180103-95
Test details: 
https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.110-rc1-hikey-20180103-95


No regressions (compared to build 4.4.110-rc1-hikey-20180103-94)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 30, skip: 31
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-mat

Re: [PATCH 4.4 00/37] 4.4.110-stable review

2018-01-03 Thread Naresh Kamboju
On 4 January 2018 at 01:41, Greg Kroah-Hartman
 wrote:
> This is the start of the stable review cycle for the 4.4.110 release.
> There are 37 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Jan  5 19:50:38 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.110-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.4.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

NOTE:
Retested 20 Iterations on two devices and all 40 times test completed
successfully.
Which confirms this is an intermittent timing failure.
For the internal investigation and record the bug has been reported.
LKFT:stable-rc 4.4.110-rc1: x15: LTP poll02 FAIL: poll() slept for too
long (intermittent)
https://bugs.linaro.org/show_bug.cgi?id=3566

Summary


kernel: 4.4.110-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 99abd6cdd65e984d89c8565508a7a96ea0fce179
git describe: v4.4.109-38-g99abd6cdd65e
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.109-38-g99abd6cdd65e

No Regressions (compared to build v4.4.109)



Boards, architectures and test suites:
-

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 32, skip: 29
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 984, skip: 124
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 31, skip: 29
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - fail: 1, pass: 1034, skip: 67
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 44, skip: 32
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1013, skip: 117
* ltp-timers-tests - pass: 12,

Hikey board test results,

Summary


kernel: 4.4.110-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git tag: 4.4.110-rc1-hikey-20180103-95
git commit: 0769c4b4aafd63e5d73b6d67f6fe93abcff67cdc
git describe: 4.4.110-rc1-hikey-20180103-95
Test details: 
https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.110-rc1-hikey-20180103-95


No regressions (compared to build 4.4.110-rc1-hikey-20180103-94)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 30, skip: 31
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-test

Re: [PATCH v3 00/20] arm64: Unmap the kernel whilst running in userspace (KPTI)

2018-01-03 Thread Greg Kroah-Hartman
On Wed, Jan 03, 2018 at 09:17:26PM -0800, Florian Fainelli wrote:
> On 12/11/2017 09:59 AM, Catalin Marinas wrote:
> > On Wed, Dec 06, 2017 at 12:35:19PM +, Will Deacon wrote:
> >> Patches are also pushed here:
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git kpti
> >>
> >> Feedback and testing welcome. At this point, I'd like to start thinking
> >> about getting this merged for 4.16.
> > 
> > For the record, the fixed up version was pushed by Will here:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git kpti
> > 
> > and I queued it for 4.16 in the arm64 for-next/core branch (same tree as
> > above).
> 
> Greg proposed the x86/KPTI patches for the stable-4.9.75 queue, is there
> a plan to get the ARM64/KPTI patches backported towards stable trees as
> well?

Stable tree patches have to get into Linus's tree first before I can do
anything :)

Anyway, once that happens, yes, there is a plan, but it's a bit
"different", and I'll talk about it once these are merged.

thanks,

greg k-h


Re: [PATCH v2 06/12] x86/retpoline/crypto: Convert xen assembler indirect jumps

2018-01-03 Thread Andi Kleen
> > diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S 
> > b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> > index 1743e6850e00..9cd8450a2050 100644
> > --- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> > +++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> > @@ -12,6 +12,7 @@
> >  
> >  #include 
> >  #include 
> > +#include 
> 
> I fail to connect this change to the patch title.
> 
> Maybe should be part of the crypto patch?

Right I moved the hunk into the wrong patch. Will fix.

-Andi


Re: [PATCH v3 00/20] arm64: Unmap the kernel whilst running in userspace (KPTI)

2018-01-03 Thread Greg Kroah-Hartman
On Wed, Jan 03, 2018 at 09:17:26PM -0800, Florian Fainelli wrote:
> On 12/11/2017 09:59 AM, Catalin Marinas wrote:
> > On Wed, Dec 06, 2017 at 12:35:19PM +, Will Deacon wrote:
> >> Patches are also pushed here:
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git kpti
> >>
> >> Feedback and testing welcome. At this point, I'd like to start thinking
> >> about getting this merged for 4.16.
> > 
> > For the record, the fixed up version was pushed by Will here:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git kpti
> > 
> > and I queued it for 4.16 in the arm64 for-next/core branch (same tree as
> > above).
> 
> Greg proposed the x86/KPTI patches for the stable-4.9.75 queue, is there
> a plan to get the ARM64/KPTI patches backported towards stable trees as
> well?

Stable tree patches have to get into Linus's tree first before I can do
anything :)

Anyway, once that happens, yes, there is a plan, but it's a bit
"different", and I'll talk about it once these are merged.

thanks,

greg k-h


Re: [PATCH v2 06/12] x86/retpoline/crypto: Convert xen assembler indirect jumps

2018-01-03 Thread Andi Kleen
> > diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S 
> > b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> > index 1743e6850e00..9cd8450a2050 100644
> > --- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> > +++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> > @@ -12,6 +12,7 @@
> >  
> >  #include 
> >  #include 
> > +#include 
> 
> I fail to connect this change to the patch title.
> 
> Maybe should be part of the crypto patch?

Right I moved the hunk into the wrong patch. Will fix.

-Andi


Re: [PATCH 1/2 v2] f2fs: show precise # of blocks that user/root can use

2018-01-03 Thread Jaegeuk Kim
Let's show precise # of blocks that user/root can use through bavail and bfree
respectively.

Signed-off-by: Jaegeuk Kim 
---

Change log from v1:
 - clean up obsolete values

 fs/f2fs/super.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0a820ba55b10..f1300cda6bfd 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -994,20 +994,19 @@ static int f2fs_statfs(struct dentry *dentry, struct 
kstatfs *buf)
struct super_block *sb = dentry->d_sb;
struct f2fs_sb_info *sbi = F2FS_SB(sb);
u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
-   block_t total_count, user_block_count, start_count, ovp_count;
+   block_t total_count, user_block_count, start_count;
u64 avail_node_count;
 
total_count = le64_to_cpu(sbi->raw_super->block_count);
user_block_count = sbi->user_block_count;
start_count = le32_to_cpu(sbi->raw_super->segment0_blkaddr);
-   ovp_count = SM_I(sbi)->ovp_segments << sbi->log_blocks_per_seg;
buf->f_type = F2FS_SUPER_MAGIC;
buf->f_bsize = sbi->blocksize;
 
buf->f_blocks = total_count - start_count;
-   buf->f_bfree = user_block_count - valid_user_blocks(sbi) + ovp_count;
-   buf->f_bavail = user_block_count - valid_user_blocks(sbi) -
+   buf->f_bfree = user_block_count - valid_user_blocks(sbi) -
sbi->current_reserved_blocks;
+   buf->f_bavail = buf->f_bfree;
 
avail_node_count = sbi->total_node_count - sbi->nquota_files -
F2FS_RESERVED_NODE_NUM;
-- 
2.15.0.531.g2ccb3012c9-goog



Re: [PATCH 1/2 v2] f2fs: show precise # of blocks that user/root can use

2018-01-03 Thread Jaegeuk Kim
Let's show precise # of blocks that user/root can use through bavail and bfree
respectively.

Signed-off-by: Jaegeuk Kim 
---

Change log from v1:
 - clean up obsolete values

 fs/f2fs/super.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0a820ba55b10..f1300cda6bfd 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -994,20 +994,19 @@ static int f2fs_statfs(struct dentry *dentry, struct 
kstatfs *buf)
struct super_block *sb = dentry->d_sb;
struct f2fs_sb_info *sbi = F2FS_SB(sb);
u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
-   block_t total_count, user_block_count, start_count, ovp_count;
+   block_t total_count, user_block_count, start_count;
u64 avail_node_count;
 
total_count = le64_to_cpu(sbi->raw_super->block_count);
user_block_count = sbi->user_block_count;
start_count = le32_to_cpu(sbi->raw_super->segment0_blkaddr);
-   ovp_count = SM_I(sbi)->ovp_segments << sbi->log_blocks_per_seg;
buf->f_type = F2FS_SUPER_MAGIC;
buf->f_bsize = sbi->blocksize;
 
buf->f_blocks = total_count - start_count;
-   buf->f_bfree = user_block_count - valid_user_blocks(sbi) + ovp_count;
-   buf->f_bavail = user_block_count - valid_user_blocks(sbi) -
+   buf->f_bfree = user_block_count - valid_user_blocks(sbi) -
sbi->current_reserved_blocks;
+   buf->f_bavail = buf->f_bfree;
 
avail_node_count = sbi->total_node_count - sbi->nquota_files -
F2FS_RESERVED_NODE_NUM;
-- 
2.15.0.531.g2ccb3012c9-goog



RE: [PATCH v5 6/9] ACPI/PPTT: Add topology parsing code

2018-01-03 Thread vkilari
Hi Jeremy

> -Original Message-
> From: linux-arm-kernel
[mailto:linux-arm-kernel-boun...@lists.infradead.org]
> On Behalf Of Jeremy Linton
> Sent: Wednesday, January 3, 2018 10:28 PM
> To: vkil...@codeaurora.org
> Cc: 'Mark Rutland' ; jonathan.zh...@cavium.com;
> jayachandran.n...@cavium.com; 'Lorenzo Pieralisi'
> ; austi...@codeaurora.org; 'Linux PM'  p...@vger.kernel.org>; jh...@codeaurora.org; 'Catalin Marinas'
> ; 'Sudeep Holla' ; 'Will
> Deacon' ; 'Linux Kernel Mailing List'  ker...@vger.kernel.org>; wangxiongfe...@huawei.com; 'ACPI Devel Maling
> List' ; 'Viresh Kumar'
;
> 'Rafael J. Wysocki' ; 'Hanjun Guo'
> ; 'Greg Kroah-Hartman'
> ; 'Rafael J. Wysocki' ; 'Al
> Stone' ; linux-arm-ker...@lists.infradead.org; 'Len
Brown'
> 
> Subject: Re: [PATCH v5 6/9] ACPI/PPTT: Add topology parsing code
> 
> Hi,
> 
> On 01/03/2018 02:49 AM, vkil...@codeaurora.org wrote:
> > Hi Jeremy,
> >
> >   Sorry, I don't have your previous patch emails to reply on right
> > patch context.
> > So commenting on top of this patch.
> >
> > AFAIU, the PPTT v5 patches still rely on CLIDR_EL1 register to know
> > the type of Caches enabled/available on the platform. With PPTT, it
> > should not rely on architecture registers. There can be platforms
> > which can report cache availability in PPTT but not in architecture
> > registers.
> >
> > The following code snippet shows usage of CLIDR_EL1
> >
> > In arch/arm64/kernel/cacheinfo.c
> >
> > static inline enum cache_type get_cache_type(int level) {
> >   u64 clidr;
> >
> >   if (level > MAX_CACHE_LEVEL)
> >   return CACHE_TYPE_NOCACHE;
> >   clidr = read_sysreg(clidr_el1);
> >   return CLIDR_CTYPE(clidr, level); }
> >
> > static int __populate_cache_leaves(unsigned int cpu) {
> >unsigned int level, idx;
> >enum cache_type type;
> >struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
> >struct cacheinfo *this_leaf = this_cpu_ci->info_list;
> >
> >for (idx = 0, level = 1; level <= this_cpu_ci->num_levels &&
> > idx < this_cpu_ci->num_leaves; idx++, level++) {
> >type = get_cache_type(level);
> >if (type == CACHE_TYPE_SEPARATE) {
> >ci_leaf_init(this_leaf++, CACHE_TYPE_DATA,
level);
> >ci_leaf_init(this_leaf++, CACHE_TYPE_INST,
level);
> >} else {
> >ci_leaf_init(this_leaf++, type, level);
> >}
> >   }
> >return 0;
> >   }
> >
> > In populate_cache_leaves() the cache type is read from CLIDR_EL1
register.
> > If CLIDR_EL1 reports CACHE_TYPE_NOCACHE for a particular level then
> > sysfs entry /sys/devices/system/cpu/cpu0/index/type is not created
> > and hence userspace tools like lstopo will not report this cache
> > level.
> 
> 
> This sounds suspiciously like one of things tweaked between v4->v5. If you
look
> at update_cache_properties() in patch 2/9, you will see that we only
> update/find NOCACHE nodes and convert them to UNIFIED when all the
> attributes in the node are supplied.
> 
> This means that if the node has an incomplete set of attributes we won't
update
> it. Can you verify that you have all those attributes set for nodes which
aren't
> being described by the hardware?

Thanks for pointing out.
Why do we need to check for set of attributes and decide it as UNIFIED
cache.?
We can get cache type from attributes bits[3:2] if cache type valid flag is
set
irrespective of other attributes. If cache type valid flag is not set then
we can assume
it as NOCACHE type as neither architecture register nor in PPTT has valid
cache type.

> 
> Thanks,
> 
> 
> >
> > Regards
> > Vijay
> >
> >> -Original Message-
> >> From: linux-arm-kernel
> > [mailto:linux-arm-kernel-boun...@lists.infradead.org]
> >> On Behalf Of Rafael J. Wysocki
> >> Sent: Thursday, December 14, 2017 4:40 AM
> >> To: Jeremy Linton 
> >> Cc: Mark Rutland ; jonathan.zh...@cavium.com;
> >> jayachandran.n...@cavium.com; Lorenzo Pieralisi
> >> ; Catalin Marinas
> >> ; Rafael J. Wysocki ;
> >> jh...@codeaurora.org; Will Deacon ; Linux PM
> ; Rafael J.
> >> Wysocki ; Greg Kroah-Hartman
> >> ; Linux Kernel Mailing List  >> ker...@vger.kernel.org>; ACPI Devel Maling List
> > ;
> >> Viresh Kumar ; Hanjun Guo
> >> ; Al Stone 

RE: [PATCH v5 6/9] ACPI/PPTT: Add topology parsing code

2018-01-03 Thread vkilari
Hi Jeremy

> -Original Message-
> From: linux-arm-kernel
[mailto:linux-arm-kernel-boun...@lists.infradead.org]
> On Behalf Of Jeremy Linton
> Sent: Wednesday, January 3, 2018 10:28 PM
> To: vkil...@codeaurora.org
> Cc: 'Mark Rutland' ; jonathan.zh...@cavium.com;
> jayachandran.n...@cavium.com; 'Lorenzo Pieralisi'
> ; austi...@codeaurora.org; 'Linux PM'  p...@vger.kernel.org>; jh...@codeaurora.org; 'Catalin Marinas'
> ; 'Sudeep Holla' ; 'Will
> Deacon' ; 'Linux Kernel Mailing List'  ker...@vger.kernel.org>; wangxiongfe...@huawei.com; 'ACPI Devel Maling
> List' ; 'Viresh Kumar'
;
> 'Rafael J. Wysocki' ; 'Hanjun Guo'
> ; 'Greg Kroah-Hartman'
> ; 'Rafael J. Wysocki' ; 'Al
> Stone' ; linux-arm-ker...@lists.infradead.org; 'Len
Brown'
> 
> Subject: Re: [PATCH v5 6/9] ACPI/PPTT: Add topology parsing code
> 
> Hi,
> 
> On 01/03/2018 02:49 AM, vkil...@codeaurora.org wrote:
> > Hi Jeremy,
> >
> >   Sorry, I don't have your previous patch emails to reply on right
> > patch context.
> > So commenting on top of this patch.
> >
> > AFAIU, the PPTT v5 patches still rely on CLIDR_EL1 register to know
> > the type of Caches enabled/available on the platform. With PPTT, it
> > should not rely on architecture registers. There can be platforms
> > which can report cache availability in PPTT but not in architecture
> > registers.
> >
> > The following code snippet shows usage of CLIDR_EL1
> >
> > In arch/arm64/kernel/cacheinfo.c
> >
> > static inline enum cache_type get_cache_type(int level) {
> >   u64 clidr;
> >
> >   if (level > MAX_CACHE_LEVEL)
> >   return CACHE_TYPE_NOCACHE;
> >   clidr = read_sysreg(clidr_el1);
> >   return CLIDR_CTYPE(clidr, level); }
> >
> > static int __populate_cache_leaves(unsigned int cpu) {
> >unsigned int level, idx;
> >enum cache_type type;
> >struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
> >struct cacheinfo *this_leaf = this_cpu_ci->info_list;
> >
> >for (idx = 0, level = 1; level <= this_cpu_ci->num_levels &&
> > idx < this_cpu_ci->num_leaves; idx++, level++) {
> >type = get_cache_type(level);
> >if (type == CACHE_TYPE_SEPARATE) {
> >ci_leaf_init(this_leaf++, CACHE_TYPE_DATA,
level);
> >ci_leaf_init(this_leaf++, CACHE_TYPE_INST,
level);
> >} else {
> >ci_leaf_init(this_leaf++, type, level);
> >}
> >   }
> >return 0;
> >   }
> >
> > In populate_cache_leaves() the cache type is read from CLIDR_EL1
register.
> > If CLIDR_EL1 reports CACHE_TYPE_NOCACHE for a particular level then
> > sysfs entry /sys/devices/system/cpu/cpu0/index/type is not created
> > and hence userspace tools like lstopo will not report this cache
> > level.
> 
> 
> This sounds suspiciously like one of things tweaked between v4->v5. If you
look
> at update_cache_properties() in patch 2/9, you will see that we only
> update/find NOCACHE nodes and convert them to UNIFIED when all the
> attributes in the node are supplied.
> 
> This means that if the node has an incomplete set of attributes we won't
update
> it. Can you verify that you have all those attributes set for nodes which
aren't
> being described by the hardware?

Thanks for pointing out.
Why do we need to check for set of attributes and decide it as UNIFIED
cache.?
We can get cache type from attributes bits[3:2] if cache type valid flag is
set
irrespective of other attributes. If cache type valid flag is not set then
we can assume
it as NOCACHE type as neither architecture register nor in PPTT has valid
cache type.

> 
> Thanks,
> 
> 
> >
> > Regards
> > Vijay
> >
> >> -Original Message-
> >> From: linux-arm-kernel
> > [mailto:linux-arm-kernel-boun...@lists.infradead.org]
> >> On Behalf Of Rafael J. Wysocki
> >> Sent: Thursday, December 14, 2017 4:40 AM
> >> To: Jeremy Linton 
> >> Cc: Mark Rutland ; jonathan.zh...@cavium.com;
> >> jayachandran.n...@cavium.com; Lorenzo Pieralisi
> >> ; Catalin Marinas
> >> ; Rafael J. Wysocki ;
> >> jh...@codeaurora.org; Will Deacon ; Linux PM
> ; Rafael J.
> >> Wysocki ; Greg Kroah-Hartman
> >> ; Linux Kernel Mailing List  >> ker...@vger.kernel.org>; ACPI Devel Maling List
> > ;
> >> Viresh Kumar ; Hanjun Guo
> >> ; Al Stone ; Sudeep Holla
> >> ; austi...@codeaurora.org;
> >> wangxiongfe...@huawei.com; linux-arm-ker...@lists.infradead.org; Len
> >> Brown 
> >> Subject: Re: [PATCH v5 6/9] ACPI/PPTT: Add topology parsing code
> >>
> >> On Thu, Dec 14, 2017 at 12:06 AM, Jeremy Linton
> >> 
> >> wrote:
> >>> Hi,
> >>>
> >>>
> >>> On 12/13/2017 04:28 PM, Rafael J. Wysocki wrote:
> 
>  On Wed, Dec 13, 2017 at 6:38 PM, Lorenzo Pieralisi
>   wrote:
> >
> > On Tue, Dec 12, 2017 at 10:13:08AM -0600, Jeremy Linton wrote:
> >>
> >> Hi,
> >>
> >> First, thanks for taking a look at 

Re: [PATCH v2 06/12] x86/retpoline/crypto: Convert xen assembler indirect jumps

2018-01-03 Thread Juergen Gross
On 04/01/18 03:00, Andi Kleen wrote:
> From: Andi Kleen 
> 
> Convert all indirect jumps in xen inline assembler code to use
> non speculative sequences.
> 
> Based on code from David Woodhouse and Tim Chen
> 
> Signed-off-by: Andi Kleen 
> ---
>  arch/x86/crypto/camellia-aesni-avx2-asm_64.S | 1 +
>  arch/x86/include/asm/xen/hypercall.h | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S 
> b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> index 1743e6850e00..9cd8450a2050 100644
> --- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> +++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> @@ -12,6 +12,7 @@
>  
>  #include 
>  #include 
> +#include 

I fail to connect this change to the patch title.

Maybe should be part of the crypto patch?

>  
>  #define CAMELLIA_TABLE_BYTE_LEN 272
>  
> diff --git a/arch/x86/include/asm/xen/hypercall.h 
> b/arch/x86/include/asm/xen/hypercall.h
> index 7cb282e9e587..91de35bcce5e 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -44,6 +44,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -217,7 +218,7 @@ privcmd_call(unsigned call,
>   __HYPERCALL_5ARG(a1, a2, a3, a4, a5);
>  
>   stac();
> - asm volatile("call *%[call]"
> + asm volatile(NOSPEC_CALL("%[call]")
>: __HYPERCALL_5PARAM
>: [call] "a" (_page[call])
>: __HYPERCALL_CLOBBER5);
> 

Acked-by: Juergen Gross 


Juergen


Re: [PATCH v2 06/12] x86/retpoline/crypto: Convert xen assembler indirect jumps

2018-01-03 Thread Juergen Gross
On 04/01/18 03:00, Andi Kleen wrote:
> From: Andi Kleen 
> 
> Convert all indirect jumps in xen inline assembler code to use
> non speculative sequences.
> 
> Based on code from David Woodhouse and Tim Chen
> 
> Signed-off-by: Andi Kleen 
> ---
>  arch/x86/crypto/camellia-aesni-avx2-asm_64.S | 1 +
>  arch/x86/include/asm/xen/hypercall.h | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S 
> b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> index 1743e6850e00..9cd8450a2050 100644
> --- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> +++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
> @@ -12,6 +12,7 @@
>  
>  #include 
>  #include 
> +#include 

I fail to connect this change to the patch title.

Maybe should be part of the crypto patch?

>  
>  #define CAMELLIA_TABLE_BYTE_LEN 272
>  
> diff --git a/arch/x86/include/asm/xen/hypercall.h 
> b/arch/x86/include/asm/xen/hypercall.h
> index 7cb282e9e587..91de35bcce5e 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -44,6 +44,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -217,7 +218,7 @@ privcmd_call(unsigned call,
>   __HYPERCALL_5ARG(a1, a2, a3, a4, a5);
>  
>   stac();
> - asm volatile("call *%[call]"
> + asm volatile(NOSPEC_CALL("%[call]")
>: __HYPERCALL_5PARAM
>: [call] "a" (_page[call])
>: __HYPERCALL_CLOBBER5);
> 

Acked-by: Juergen Gross 


Juergen


  1   2   3   4   5   6   7   8   9   10   >