summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/DMA-attributes.txt19
-rw-r--r--arch/arm/boot/dts/qcom/msm-pm660l-rpm-regulator.dtsi6
-rw-r--r--arch/arm/boot/dts/qcom/msm8998-interposer-pm660.dtsi12
-rw-r--r--arch/arm/boot/dts/qcom/msm8998-v2.dtsi36
-rw-r--r--arch/arm/boot/dts/qcom/sdm660-qrd.dtsi4
-rw-r--r--arch/arm/boot/dts/qcom/sdm660-vidc.dtsi1
-rw-r--r--drivers/clk/qcom/gcc-sdm660.c286
-rw-r--r--drivers/clk/qcom/mmcc-sdm660.c29
-rw-r--r--drivers/gpu/msm/kgsl_iommu.c20
-rw-r--r--drivers/hwtracing/coresight/coresight-etm4x.c2
-rw-r--r--drivers/iommu/arm-smmu.c20
-rw-r--r--drivers/iommu/io-pgtable-arm.c78
-rw-r--r--drivers/iommu/io-pgtable.h3
-rw-r--r--drivers/iommu/iommu.c7
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp48.c57
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp48.h4
-rw-r--r--drivers/platform/msm/sps/sps.c9
-rw-r--r--drivers/power/qcom-charger/qpnp-qnovo.c25
-rw-r--r--drivers/thermal/msm-tsens.c12
-rw-r--r--drivers/usb/gadget/function/f_gsi.c3
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi.c7
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi.h1
-rw-r--r--drivers/video/fbdev/msm/msm_mdss_io_8974.c16
-rw-r--r--include/dt-bindings/clock/qcom,mmcc-sdm660.h3
-rw-r--r--include/linux/dma-attrs.h2
-rw-r--r--include/linux/iommu.h9
-rw-r--r--include/linux/security.h6
-rw-r--r--include/trace/events/sched.h9
-rw-r--r--kernel/sched/hmp.c1
-rw-r--r--kernel/time/hrtimer.c20
-rw-r--r--kernel/time/timer.c41
-rw-r--r--security/pfe/Kconfig1
-rw-r--r--security/pfe/pfk_ecryptfs.c50
-rw-r--r--security/pfe/pft.c7
-rw-r--r--security/security.c5
-rw-r--r--security/selinux/hooks.c57
-rw-r--r--sound/soc/msm/Kconfig2
37 files changed, 551 insertions, 319 deletions
diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt
index 64a4f9bb62c4..6eadd564a247 100644
--- a/Documentation/DMA-attributes.txt
+++ b/Documentation/DMA-attributes.txt
@@ -126,3 +126,22 @@ DMA_ATTR_EXEC_MAPPING
By default, the DMA mappings are non-executable. Some use cases might require
an executable mapping. This attribute can be used to indicate to the DMA
subsystem to create an executable mappings for the buffer.
+
+DMA_ATTR_FORCE_COHERENT
+-----------------------
+
+When passed to a DMA map call the DMA_ATTR_FORCE_COHERENT DMA
+attribute can be used to force a buffer to be mapped as IO coherent.
+This DMA attribute is only currently supported for arm64 stage 1 IOMMU
+mappings.
+
+DMA_ATTR_FORCE_NON_COHERENT
+---------------------------
+When passed to a DMA map call the DMA_ATTR_FORCE_NON_COHERENT DMA
+attribute can be used to force a buffer to not be mapped as IO
+coherent.
+The DMA_ATTR_FORCE_NON_COHERENT DMA attribute overrides the buffer IO
+coherency configuration set by making the device IO coherent.
+
+This DMA attribute is only currently supported for arm64 stage 1 IOMMU
+mappings.
diff --git a/arch/arm/boot/dts/qcom/msm-pm660l-rpm-regulator.dtsi b/arch/arm/boot/dts/qcom/msm-pm660l-rpm-regulator.dtsi
index b10f8e559090..83235317fa02 100644
--- a/arch/arm/boot/dts/qcom/msm-pm660l-rpm-regulator.dtsi
+++ b/arch/arm/boot/dts/qcom/msm-pm660l-rpm-regulator.dtsi
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -193,7 +193,7 @@
rpm-regulator-ldob9 {
compatible = "qcom,rpm-smd-regulator-resource";
- qcom,resource-name = "rwsc";
+ qcom,resource-name = "rwlc";
qcom,resource-id = <0>;
qcom,regulator-type = <0>;
status = "disabled";
@@ -208,7 +208,7 @@
rpm-regulator-ldob10 {
compatible = "qcom,rpm-smd-regulator-resource";
- qcom,resource-name = "rwsm";
+ qcom,resource-name = "rwlm";
qcom,resource-id = <0>;
qcom,regulator-type = <0>;
status = "disabled";
diff --git a/arch/arm/boot/dts/qcom/msm8998-interposer-pm660.dtsi b/arch/arm/boot/dts/qcom/msm8998-interposer-pm660.dtsi
index a13475085e58..c9522154ae7d 100644
--- a/arch/arm/boot/dts/qcom/msm8998-interposer-pm660.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8998-interposer-pm660.dtsi
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -245,3 +245,13 @@
/delete-node/cpr4-ctrl@05061000;
/delete-node/regulator@01fcf004;
};
+
+&rpm_bus {
+ rpm-regulator-ldob9 {
+ qcom,resource-name = "rwsc";
+ };
+
+ rpm-regulator-ldob10 {
+ qcom,resource-name = "rwsm";
+ };
+};
diff --git a/arch/arm/boot/dts/qcom/msm8998-v2.dtsi b/arch/arm/boot/dts/qcom/msm8998-v2.dtsi
index fa7cdd5194a3..2408ad515b61 100644
--- a/arch/arm/boot/dts/qcom/msm8998-v2.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8998-v2.dtsi
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1195,7 +1195,7 @@
&msm_gpu {
/* Updated chip ID */
qcom,chipid = <0x05040001>;
- qcom,initial-pwrlevel = <5>;
+ qcom,initial-pwrlevel = <6>;
qcom,gpu-pwrlevels {
#address-cells = <1>;
@@ -1205,23 +1205,23 @@
qcom,gpu-pwrlevel@0 {
reg = <0>;
- qcom,gpu-freq = <670000000>;
+ qcom,gpu-freq = <710000000>;
qcom,bus-freq = <12>;
- qcom,bus-min = <11>;
+ qcom,bus-min = <12>;
qcom,bus-max = <12>;
};
qcom,gpu-pwrlevel@1 {
reg = <1>;
- qcom,gpu-freq = <596000000>;
- qcom,bus-freq = <11>;
- qcom,bus-min = <9>;
+ qcom,gpu-freq = <670000000>;
+ qcom,bus-freq = <12>;
+ qcom,bus-min = <11>;
qcom,bus-max = <12>;
};
qcom,gpu-pwrlevel@2 {
reg = <2>;
- qcom,gpu-freq = <515000000>;
+ qcom,gpu-freq = <596000000>;
qcom,bus-freq = <11>;
qcom,bus-min = <9>;
qcom,bus-max = <12>;
@@ -1229,30 +1229,38 @@
qcom,gpu-pwrlevel@3 {
reg = <3>;
+ qcom,gpu-freq = <515000000>;
+ qcom,bus-freq = <11>;
+ qcom,bus-min = <9>;
+ qcom,bus-max = <12>;
+ };
+
+ qcom,gpu-pwrlevel@4 {
+ reg = <4>;
qcom,gpu-freq = <414000000>;
qcom,bus-freq = <9>;
qcom,bus-min = <8>;
qcom,bus-max = <11>;
};
- qcom,gpu-pwrlevel@4 {
- reg = <4>;
+ qcom,gpu-pwrlevel@5 {
+ reg = <5>;
qcom,gpu-freq = <342000000>;
qcom,bus-freq = <8>;
qcom,bus-min = <5>;
qcom,bus-max = <9>;
};
- qcom,gpu-pwrlevel@5 {
- reg = <5>;
+ qcom,gpu-pwrlevel@6 {
+ reg = <6>;
qcom,gpu-freq = <257000000>;
qcom,bus-freq = <5>;
qcom,bus-min = <3>;
qcom,bus-max = <8>;
};
- qcom,gpu-pwrlevel@6 {
- reg = <6>;
+ qcom,gpu-pwrlevel@7 {
+ reg = <7>;
qcom,gpu-freq = <27000000>;
qcom,bus-freq = <0>;
qcom,bus-min = <0>;
diff --git a/arch/arm/boot/dts/qcom/sdm660-qrd.dtsi b/arch/arm/boot/dts/qcom/sdm660-qrd.dtsi
index d3d6bf6ca10e..f3908ce512af 100644
--- a/arch/arm/boot/dts/qcom/sdm660-qrd.dtsi
+++ b/arch/arm/boot/dts/qcom/sdm660-qrd.dtsi
@@ -15,6 +15,10 @@
/ {
};
+&blsp2_uart1_hs {
+ status = "ok";
+};
+
&uartblsp1dm1 {
status = "ok";
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/qcom/sdm660-vidc.dtsi b/arch/arm/boot/dts/qcom/sdm660-vidc.dtsi
index 10cf4de2a8e0..ae3f1949115a 100644
--- a/arch/arm/boot/dts/qcom/sdm660-vidc.dtsi
+++ b/arch/arm/boot/dts/qcom/sdm660-vidc.dtsi
@@ -26,6 +26,7 @@
qcom,hfi = "venus";
qcom,hfi-version = "3xx";
qcom,firmware-name = "venus";
+ qcom,never-unload-fw;
qcom,sw-power-collapse;
qcom,reg-presets =
<0x80010 0x001f001f>,
diff --git a/drivers/clk/qcom/gcc-sdm660.c b/drivers/clk/qcom/gcc-sdm660.c
index 1ae71a6ee93b..5b118f297238 100644
--- a/drivers/clk/qcom/gcc-sdm660.c
+++ b/drivers/clk/qcom/gcc-sdm660.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1832,7 +1832,7 @@ static struct clk_branch gcc_hmss_ahb_clk = {
"hmss_ahb_clk_src",
},
.num_parents = 1,
- .flags = CLK_SET_RATE_PARENT,
+ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
.ops = &clk_branch2_ops,
},
},
@@ -1847,6 +1847,7 @@ static struct clk_branch gcc_hmss_dvm_bus_clk = {
.hw.init = &(struct clk_init_data){
.name = "gcc_hmss_dvm_bus_clk",
.ops = &clk_branch2_ops,
+ .flags = CLK_IGNORE_UNUSED,
},
},
};
@@ -2054,7 +2055,7 @@ static struct clk_branch gcc_qspi_ser_clk = {
static struct clk_branch gcc_rx0_usb2_clkref_clk = {
.halt_reg = 0x88018,
- .halt_check = BRANCH_HALT,
+ .halt_check = BRANCH_HALT_VOTED,
.clkr = {
.enable_reg = 0x88018,
.enable_mask = BIT(0),
@@ -2067,7 +2068,7 @@ static struct clk_branch gcc_rx0_usb2_clkref_clk = {
static struct clk_branch gcc_rx1_usb2_clkref_clk = {
.halt_reg = 0x88014,
- .halt_check = BRANCH_HALT,
+ .halt_check = BRANCH_HALT_VOTED,
.clkr = {
.enable_reg = 0x88014,
.enable_mask = BIT(0),
@@ -2080,7 +2081,7 @@ static struct clk_branch gcc_rx1_usb2_clkref_clk = {
static struct clk_branch gcc_rx2_qlink_clkref_clk = {
.halt_reg = 0x88034,
- .halt_check = BRANCH_HALT,
+ .halt_check = BRANCH_HALT_VOTED,
.clkr = {
.enable_reg = 0x88034,
.enable_mask = BIT(0),
@@ -2570,6 +2571,7 @@ static struct clk_fixed_factor gcc_ce1_ahb_m_clk = {
.hw.init = &(struct clk_init_data){
.name = "gcc_ce1_ahb_m_clk",
.ops = &clk_dummy_ops,
+ .flags = CLK_IGNORE_UNUSED,
},
};
@@ -2577,6 +2579,7 @@ static struct clk_fixed_factor gcc_ce1_axi_m_clk = {
.hw.init = &(struct clk_init_data){
.name = "gcc_ce1_axi_m_clk",
.ops = &clk_dummy_ops,
+ .flags = CLK_IGNORE_UNUSED,
},
};
@@ -3107,98 +3110,185 @@ static struct clk_debug_mux gcc_debug_mux = {
{ "gcc_ufs_rx_symbol_1_clk", 0x162 },
{ "gcc_ufs_tx_symbol_0_clk", 0x0EC },
{ "gcc_usb3_phy_pipe_clk", 0x040 },
- { "mmssnoc_axi_clk", 0x22, MMCC, 0x004 },
- { "mmss_bimc_smmu_ahb_clk", 0x22, MMCC, 0x00C },
- { "mmss_bimc_smmu_axi_clk", 0x22, MMCC, 0x00D },
- { "mmss_camss_ahb_clk", 0x22, MMCC, 0x037 },
- { "mmss_camss_cci_ahb_clk", 0x22, MMCC, 0x02E },
- { "mmss_camss_cci_clk", 0x22, MMCC, 0x02D },
- { "mmss_camss_cphy_csid0_clk", 0x22, MMCC, 0x08D },
- { "mmss_camss_cphy_csid1_clk", 0x22, MMCC, 0x08E },
- { "mmss_camss_cphy_csid2_clk", 0x22, MMCC, 0x08F },
- { "mmss_camss_cphy_csid3_clk", 0x22, MMCC, 0x090 },
- { "mmss_camss_cpp_ahb_clk", 0x22, MMCC, 0x03B },
- { "mmss_camss_cpp_axi_clk", 0x22, MMCC, 0x07A },
- { "mmss_camss_cpp_clk", 0x22, MMCC, 0x03A },
- { "mmss_camss_cpp_vbif_ahb_clk", 0x22, MMCC, 0x073 },
- { "mmss_camss_csi0_ahb_clk", 0x22, MMCC, 0x042 },
- { "mmss_camss_csi0_clk", 0x22, MMCC, 0x041 },
- { "mmss_camss_csi0phytimer_clk", 0x22, MMCC, 0x02F },
- { "mmss_camss_csi0pix_clk", 0x22, MMCC, 0x045 },
- { "mmss_camss_csi0rdi_clk", 0x22, MMCC, 0x044 },
- { "mmss_camss_csi1_ahb_clk", 0x22, MMCC, 0x047 },
- { "mmss_camss_csi1_clk", 0x22, MMCC, 0x046 },
- { "mmss_camss_csi1phytimer_clk", 0x22, MMCC, 0x030 },
- { "mmss_camss_csi1pix_clk", 0x22, MMCC, 0x04A },
- { "mmss_camss_csi1rdi_clk", 0x22, MMCC, 0x049 },
- { "mmss_camss_csi2_ahb_clk", 0x22, MMCC, 0x04C },
- { "mmss_camss_csi2_clk", 0x22, MMCC, 0x04B },
- { "mmss_camss_csi2phytimer_clk", 0x22, MMCC, 0x031 },
- { "mmss_camss_csi2pix_clk", 0x22, MMCC, 0x04F },
- { "mmss_camss_csi2rdi_clk", 0x22, MMCC, 0x04E },
- { "mmss_camss_csi3_ahb_clk", 0x22, MMCC, 0x051 },
- { "mmss_camss_csi3_clk", 0x22, MMCC, 0x050 },
- { "mmss_camss_csi3pix_clk", 0x22, MMCC, 0x054 },
- { "mmss_camss_csi3rdi_clk", 0x22, MMCC, 0x053 },
- { "mmss_camss_csi_vfe0_clk", 0x22, MMCC, 0x03F },
- { "mmss_camss_csi_vfe1_clk", 0x22, MMCC, 0x040 },
- { "mmss_camss_csiphy0_clk", 0x22, MMCC, 0x043 },
- { "mmss_camss_csiphy1_clk", 0x22, MMCC, 0x085 },
- { "mmss_camss_csiphy2_clk", 0x22, MMCC, 0x088 },
- { "mmss_camss_gp0_clk", 0x22, MMCC, 0x027 },
- { "mmss_camss_gp1_clk", 0x22, MMCC, 0x028 },
- { "mmss_camss_ispif_ahb_clk", 0x22, MMCC, 0x033 },
- { "mmss_camss_jpeg0_clk", 0x22, MMCC, 0x032 },
- { "mmss_camss_jpeg_ahb_clk", 0x22, MMCC, 0x035 },
- { "mmss_camss_jpeg_axi_clk", 0x22, MMCC, 0x036 },
- { "mmss_camss_mclk0_clk", 0x22, MMCC, 0x029 },
- { "mmss_camss_mclk1_clk", 0x22, MMCC, 0x02A },
- { "mmss_camss_mclk2_clk", 0x22, MMCC, 0x02B },
- { "mmss_camss_mclk3_clk", 0x22, MMCC, 0x02C },
- { "mmss_camss_micro_ahb_clk", 0x22, MMCC, 0x026 },
- { "mmss_camss_top_ahb_clk", 0x22, MMCC, 0x025 },
- { "mmss_camss_vfe0_ahb_clk", 0x22, MMCC, 0x086 },
- { "mmss_camss_vfe0_clk", 0x22, MMCC, 0x038 },
- { "mmss_camss_vfe0_stream_clk", 0x22, MMCC, 0x071 },
- { "mmss_camss_vfe1_ahb_clk", 0x22, MMCC, 0x087 },
- { "mmss_camss_vfe1_clk", 0x22, MMCC, 0x039 },
- { "mmss_camss_vfe1_stream_clk", 0x22, MMCC, 0x072 },
- { "mmss_camss_vfe_vbif_ahb_clk", 0x22, MMCC, 0x03C },
- { "mmss_camss_vfe_vbif_axi_clk", 0x22, MMCC, 0x03D },
- { "mmss_csiphy_ahb2crif_clk", 0x22, MMCC, 0x0B8 },
- { "mmss_mdss_ahb_clk", 0x22, MMCC, 0x022 },
- { "mmss_mdss_axi_clk", 0x22, MMCC, 0x024 },
- { "mmss_mdss_byte0_clk", 0x22, MMCC, 0x01E },
- { "mmss_mdss_byte0_intf_clk", 0x22, MMCC, 0x0AD },
- { "mmss_mdss_byte1_clk", 0x22, MMCC, 0x01F },
- { "mmss_mdss_byte1_intf_clk", 0x22, MMCC, 0x0B6 },
- { "mmss_mdss_dp_aux_clk", 0x22, MMCC, 0x09C },
- { "mmss_mdss_dp_crypto_clk", 0x22, MMCC, 0x09A },
- { "mmss_mdss_dp_gtc_clk", 0x22, MMCC, 0x09D },
- { "mmss_mdss_dp_link_clk", 0x22, MMCC, 0x098 },
- { "mmss_mdss_dp_link_intf_clk", 0x22, MMCC, 0x099 },
- { "mmss_mdss_dp_pixel_clk", 0x22, MMCC, 0x09B },
- { "mmss_mdss_esc0_clk", 0x22, MMCC, 0x020 },
- { "mmss_mdss_esc1_clk", 0x22, MMCC, 0x021 },
- { "mmss_mdss_hdmi_dp_ahb_clk", 0x22, MMCC, 0x023 },
- { "mmss_mdss_mdp_clk", 0x22, MMCC, 0x014 },
- { "mmss_mdss_pclk0_clk", 0x22, MMCC, 0x016 },
- { "mmss_mdss_pclk1_clk", 0x22, MMCC, 0x017 },
- { "mmss_mdss_rot_clk", 0x22, MMCC, 0x012 },
- { "mmss_mdss_vsync_clk", 0x22, MMCC, 0x01C },
- { "mmss_misc_ahb_clk", 0x22, MMCC, 0x003 },
- { "mmss_misc_cxo_clk", 0x22, MMCC, 0x077 },
- { "mmss_mnoc_ahb_clk", 0x22, MMCC, 0x001 },
- { "mmss_snoc_dvm_axi_clk", 0x22, MMCC, 0x013 },
- { "mmss_video_ahb_clk", 0x22, MMCC, 0x011 },
- { "mmss_video_axi_clk", 0x22, MMCC, 0x00F },
- { "mmss_video_core_clk", 0x22, MMCC, 0x00E },
- { "mmss_video_subcore0_clk", 0x22, MMCC, 0x01A },
- { "gpucc_gfx3d_clk", 0x13d, GPU, 0x008 },
- { "gpucc_rbbmtimer_clk", 0x13d, GPU, 0x005 },
- { "gpucc_rbcpr_clk", 0x13d, GPU, 0x003 },
- { "pwrcl_clk", 0x0c0, CPU, 0x000, 0x3, 8, 0x0FF },
- { "perfcl_clk", 0x0c0, CPU, 0x100, 0x3, 8, 0x0FF },
+ { "mmssnoc_axi_clk", 0x22, MMCC,
+ 0x004, 0, 0, 0x1000 },
+ { "mmss_bimc_smmu_ahb_clk", 0x22, MMCC,
+ 0x00C, 0, 0, 0x1000 },
+ { "mmss_bimc_smmu_axi_clk", 0x22, MMCC,
+ 0x00D, 0, 0, 0x1000 },
+ { "mmss_camss_ahb_clk", 0x22, MMCC,
+ 0x037, 0, 0, 0x1000 },
+ { "mmss_camss_cci_ahb_clk", 0x22, MMCC,
+ 0x02E, 0, 0, 0x1000 },
+ { "mmss_camss_cci_clk", 0x22, MMCC,
+ 0x02D, 0, 0, 0x1000 },
+ { "mmss_camss_cphy_csid0_clk", 0x22, MMCC,
+ 0x08D, 0, 0, 0x1000 },
+ { "mmss_camss_cphy_csid1_clk", 0x22, MMCC,
+ 0x08E, 0, 0, 0x1000 },
+ { "mmss_camss_cphy_csid2_clk", 0x22, MMCC,
+ 0x08F, 0, 0, 0x1000 },
+ { "mmss_camss_cphy_csid3_clk", 0x22, MMCC,
+ 0x090, 0, 0, 0x1000 },
+ { "mmss_camss_cpp_ahb_clk", 0x22, MMCC,
+ 0x03B, 0, 0, 0x1000 },
+ { "mmss_camss_cpp_axi_clk", 0x22, MMCC,
+ 0x07A, 0, 0, 0x1000 },
+ { "mmss_camss_cpp_clk", 0x22, MMCC,
+ 0x03A, 0, 0, 0x1000 },
+ { "mmss_camss_cpp_vbif_ahb_clk", 0x22, MMCC,
+ 0x073, 0, 0, 0x1000 },
+ { "mmss_camss_csi0_ahb_clk", 0x22, MMCC,
+ 0x042, 0, 0, 0x1000 },
+ { "mmss_camss_csi0_clk", 0x22, MMCC,
+ 0x041, 0, 0, 0x1000 },
+ { "mmss_camss_csi0phytimer_clk", 0x22, MMCC,
+ 0x02F, 0, 0, 0x1000 },
+ { "mmss_camss_csi0pix_clk", 0x22, MMCC,
+ 0x045, 0, 0, 0x1000 },
+ { "mmss_camss_csi0rdi_clk", 0x22, MMCC,
+ 0x044, 0, 0, 0x1000 },
+ { "mmss_camss_csi1_ahb_clk", 0x22, MMCC,
+ 0x047, 0, 0, 0x1000 },
+ { "mmss_camss_csi1_clk", 0x22, MMCC,
+ 0x046, 0, 0, 0x1000 },
+ { "mmss_camss_csi1phytimer_clk", 0x22, MMCC,
+ 0x030, 0, 0, 0x1000 },
+ { "mmss_camss_csi1pix_clk", 0x22, MMCC,
+ 0x04A, 0, 0, 0x1000 },
+ { "mmss_camss_csi1rdi_clk", 0x22, MMCC,
+ 0x049, 0, 0, 0x1000 },
+ { "mmss_camss_csi2_ahb_clk", 0x22, MMCC,
+ 0x04C, 0, 0, 0x1000 },
+ { "mmss_camss_csi2_clk", 0x22, MMCC,
+ 0x04B, 0, 0, 0x1000 },
+ { "mmss_camss_csi2phytimer_clk", 0x22, MMCC,
+ 0x031, 0, 0, 0x1000 },
+ { "mmss_camss_csi2pix_clk", 0x22, MMCC,
+ 0x04F, 0, 0, 0x1000 },
+ { "mmss_camss_csi2rdi_clk", 0x22, MMCC,
+ 0x04E, 0, 0, 0x1000 },
+ { "mmss_camss_csi3_ahb_clk", 0x22, MMCC,
+ 0x051, 0, 0, 0x1000 },
+ { "mmss_camss_csi3_clk", 0x22, MMCC,
+ 0x050, 0, 0, 0x1000 },
+ { "mmss_camss_csi3pix_clk", 0x22, MMCC,
+ 0x054, 0, 0, 0x1000 },
+ { "mmss_camss_csi3rdi_clk", 0x22, MMCC,
+ 0x053, 0, 0, 0x1000 },
+ { "mmss_camss_csi_vfe0_clk", 0x22, MMCC,
+ 0x03F, 0, 0, 0x1000 },
+ { "mmss_camss_csi_vfe1_clk", 0x22, MMCC,
+ 0x040, 0, 0, 0x1000 },
+ { "mmss_camss_csiphy0_clk", 0x22, MMCC,
+ 0x043, 0, 0, 0x1000 },
+ { "mmss_camss_csiphy1_clk", 0x22, MMCC,
+ 0x085, 0, 0, 0x1000 },
+ { "mmss_camss_csiphy2_clk", 0x22, MMCC,
+ 0x088, 0, 0, 0x1000 },
+ { "mmss_camss_gp0_clk", 0x22, MMCC,
+ 0x027, 0, 0, 0x1000 },
+ { "mmss_camss_gp1_clk", 0x22, MMCC,
+ 0x028, 0, 0, 0x1000 },
+ { "mmss_camss_ispif_ahb_clk", 0x22, MMCC,
+ 0x033, 0, 0, 0x1000 },
+ { "mmss_camss_jpeg0_clk", 0x22, MMCC,
+ 0x032, 0, 0, 0x1000 },
+ { "mmss_camss_jpeg_ahb_clk", 0x22, MMCC,
+ 0x035, 0, 0, 0x1000 },
+ { "mmss_camss_jpeg_axi_clk", 0x22, MMCC,
+ 0x036, 0, 0, 0x1000 },
+ { "mmss_camss_mclk0_clk", 0x22, MMCC,
+ 0x029, 0, 0, 0x1000 },
+ { "mmss_camss_mclk1_clk", 0x22, MMCC,
+ 0x02A, 0, 0, 0x1000 },
+ { "mmss_camss_mclk2_clk", 0x22, MMCC,
+ 0x02B, 0, 0, 0x1000 },
+ { "mmss_camss_mclk3_clk", 0x22, MMCC,
+ 0x02C, 0, 0, 0x1000 },
+ { "mmss_camss_micro_ahb_clk", 0x22, MMCC,
+ 0x026, 0, 0, 0x1000 },
+ { "mmss_camss_top_ahb_clk", 0x22, MMCC,
+ 0x025, 0, 0, 0x1000 },
+ { "mmss_camss_vfe0_ahb_clk", 0x22, MMCC,
+ 0x086, 0, 0, 0x1000 },
+ { "mmss_camss_vfe0_clk", 0x22, MMCC,
+ 0x038, 0, 0, 0x1000 },
+ { "mmss_camss_vfe0_stream_clk", 0x22, MMCC,
+ 0x071, 0, 0, 0x1000 },
+ { "mmss_camss_vfe1_ahb_clk", 0x22, MMCC,
+ 0x087, 0, 0, 0x1000 },
+ { "mmss_camss_vfe1_clk", 0x22, MMCC,
+ 0x039, 0, 0, 0x1000 },
+ { "mmss_camss_vfe1_stream_clk", 0x22, MMCC,
+ 0x072, 0, 0, 0x1000 },
+ { "mmss_camss_vfe_vbif_ahb_clk", 0x22, MMCC,
+ 0x03C, 0, 0, 0x1000 },
+ { "mmss_camss_vfe_vbif_axi_clk", 0x22, MMCC,
+ 0x03D, 0, 0, 0x1000 },
+ { "mmss_csiphy_ahb2crif_clk", 0x22, MMCC,
+ 0x0B8, 0, 0, 0x1000 },
+ { "mmss_mdss_ahb_clk", 0x22, MMCC,
+ 0x022, 0, 0, 0x1000 },
+ { "mmss_mdss_axi_clk", 0x22, MMCC,
+ 0x024, 0, 0, 0x1000 },
+ { "mmss_mdss_byte0_clk", 0x22, MMCC,
+ 0x01E, 0, 0, 0x1000 },
+ { "mmss_mdss_byte0_intf_clk", 0x22, MMCC,
+ 0x0AD, 0, 0, 0x1000 },
+ { "mmss_mdss_byte1_clk", 0x22, MMCC,
+ 0x01F, 0, 0, 0x1000 },
+ { "mmss_mdss_byte1_intf_clk", 0x22, MMCC,
+ 0x0B6, 0, 0, 0x1000 },
+ { "mmss_mdss_dp_aux_clk", 0x22, MMCC,
+ 0x09C, 0, 0, 0x1000 },
+ { "mmss_mdss_dp_crypto_clk", 0x22, MMCC,
+ 0x09A, 0, 0, 0x1000 },
+ { "mmss_mdss_dp_gtc_clk", 0x22, MMCC,
+ 0x09D, 0, 0, 0x1000 },
+ { "mmss_mdss_dp_link_clk", 0x22, MMCC,
+ 0x098, 0, 0, 0x1000 },
+ { "mmss_mdss_dp_link_intf_clk", 0x22, MMCC,
+ 0x099, 0, 0, 0x1000 },
+ { "mmss_mdss_dp_pixel_clk", 0x22, MMCC,
+ 0x09B, 0, 0, 0x1000 },
+ { "mmss_mdss_esc0_clk", 0x22, MMCC,
+ 0x020, 0, 0, 0x1000 },
+ { "mmss_mdss_esc1_clk", 0x22, MMCC,
+ 0x021, 0, 0, 0x1000 },
+ { "mmss_mdss_hdmi_dp_ahb_clk", 0x22, MMCC,
+ 0x023, 0, 0, 0x1000 },
+ { "mmss_mdss_mdp_clk", 0x22, MMCC,
+ 0x014, 0, 0, 0x1000 },
+ { "mmss_mdss_pclk0_clk", 0x22, MMCC,
+ 0x016, 0, 0, 0x1000 },
+ { "mmss_mdss_pclk1_clk", 0x22, MMCC,
+ 0x017, 0, 0, 0x1000 },
+ { "mmss_mdss_rot_clk", 0x22, MMCC,
+ 0x012, 0, 0, 0x1000 },
+ { "mmss_mdss_vsync_clk", 0x22, MMCC,
+ 0x01C, 0, 0, 0x1000 },
+ { "mmss_misc_ahb_clk", 0x22, MMCC,
+ 0x003, 0, 0, 0x1000 },
+ { "mmss_misc_cxo_clk", 0x22, MMCC,
+ 0x077, 0, 0, 0x1000 },
+ { "mmss_mnoc_ahb_clk", 0x22, MMCC,
+ 0x001, 0, 0, 0x1000 },
+ { "mmss_snoc_dvm_axi_clk", 0x22, MMCC,
+ 0x013, 0, 0, 0x1000 },
+ { "mmss_video_ahb_clk", 0x22, MMCC,
+ 0x011, 0, 0, 0x1000 },
+ { "mmss_video_axi_clk", 0x22, MMCC,
+ 0x00F, 0, 0, 0x1000 },
+ { "mmss_video_core_clk", 0x22, MMCC,
+ 0x00E, 0, 0, 0x1000 },
+ { "mmss_video_subcore0_clk", 0x22, MMCC,
+ 0x01A, 0, 0, 0x1000 },
+ { "gpucc_gfx3d_clk", 0x13d, GPU, 0x008 },
+ { "gpucc_rbbmtimer_clk", 0x13d, GPU, 0x005 },
+ { "gpucc_rbcpr_clk", 0x13d, GPU, 0x003 },
+ { "pwrcl_clk", 0x0c0, CPU, 0x000, 0x3, 8, 0x0FF },
+ { "perfcl_clk", 0x0c0, CPU, 0x100, 0x3, 8, 0x0FF },
),
.hw.init = &(struct clk_init_data){
.name = "gcc_debug_mux",
@@ -3280,7 +3370,7 @@ static int clk_debug_660_probe(struct platform_device *pdev)
/* Clear the DBG_CLK_DIV bits of the MMSS debug register */
regmap_update_bits(gcc_debug_mux.regmap[MMCC], 0x0,
- 0x60000, 0x0);
+ 0x15400, 0x0);
}
if (of_get_property(pdev->dev.of_node, "qcom,gpu", NULL)) {
diff --git a/drivers/clk/qcom/mmcc-sdm660.c b/drivers/clk/qcom/mmcc-sdm660.c
index daece455454c..0226bf49b3b0 100644
--- a/drivers/clk/qcom/mmcc-sdm660.c
+++ b/drivers/clk/qcom/mmcc-sdm660.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2372,7 +2372,7 @@ static struct clk_branch mmss_mdss_byte0_intf_clk = {
"mmss_mdss_byte0_intf_div_clk",
},
.num_parents = 1,
- .flags = CLK_SET_RATE_PARENT,
+ .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
.ops = &clk_branch2_ops,
},
},
@@ -2426,14 +2426,36 @@ static struct clk_branch mmss_mdss_byte1_intf_clk = {
.hw.init = &(struct clk_init_data){
.name = "mmss_mdss_byte1_intf_clk",
.parent_names = (const char *[]){
- "byte1_clk_src",
+ "mmss_mdss_byte1_intf_div_clk",
},
.num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
.ops = &clk_branch2_ops,
},
},
};
+static struct clk_regmap_div mmss_mdss_byte1_intf_div_clk = {
+ .reg = 0x2380,
+ .shift = 0,
+ .width = 2,
+ /*
+ * NOTE: Op does not work for div-3. Current assumption is that div-3
+ * is not a recommended setting for this divider.
+ */
+ .clkr = {
+ .hw.init = &(struct clk_init_data){
+ .name = "mmss_mdss_byte1_intf_div_clk",
+ .parent_names = (const char *[]){
+ "byte1_clk_src",
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
+ },
+ },
+};
+
static struct clk_branch mmss_mdss_dp_aux_clk = {
.halt_reg = 0x2364,
.halt_check = BRANCH_HALT,
@@ -2952,6 +2974,7 @@ static struct clk_regmap *mmcc_660_clocks[] = {
[VFE1_CLK_SRC] = &vfe1_clk_src.clkr,
[VIDEO_CORE_CLK_SRC] = &video_core_clk_src.clkr,
[VSYNC_CLK_SRC] = &vsync_clk_src.clkr,
+ [MMSS_MDSS_BYTE1_INTF_DIV_CLK] = &mmss_mdss_byte1_intf_div_clk.clkr,
};
static const struct qcom_reset_map mmcc_660_resets[] = {
diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c
index bc681057250d..d997cdd2cc7e 100644
--- a/drivers/gpu/msm/kgsl_iommu.c
+++ b/drivers/gpu/msm/kgsl_iommu.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -134,7 +134,7 @@ static void kgsl_iommu_unmap_globals(struct kgsl_pagetable *pagetable)
}
}
-static void kgsl_iommu_map_globals(struct kgsl_pagetable *pagetable)
+static int kgsl_iommu_map_globals(struct kgsl_pagetable *pagetable)
{
unsigned int i;
@@ -143,9 +143,11 @@ static void kgsl_iommu_map_globals(struct kgsl_pagetable *pagetable)
int ret = kgsl_mmu_map(pagetable,
global_pt_entries[i].memdesc);
- BUG_ON(ret);
+ if (ret)
+ return ret;
}
}
+ return 0;
}
static void kgsl_iommu_unmap_global_secure_pt_entry(struct kgsl_pagetable
@@ -158,16 +160,16 @@ static void kgsl_iommu_unmap_global_secure_pt_entry(struct kgsl_pagetable
}
-static void kgsl_map_global_secure_pt_entry(struct kgsl_pagetable *pagetable)
+static int kgsl_map_global_secure_pt_entry(struct kgsl_pagetable *pagetable)
{
- int ret;
+ int ret = 0;
struct kgsl_memdesc *entry = kgsl_global_secure_pt_entry;
if (entry != NULL) {
entry->pagetable = pagetable;
ret = kgsl_mmu_map(pagetable, entry);
- BUG_ON(ret);
}
+ return ret;
}
static void kgsl_iommu_remove_global(struct kgsl_mmu *mmu,
@@ -1171,7 +1173,7 @@ static int _init_global_pt(struct kgsl_mmu *mmu, struct kgsl_pagetable *pt)
goto done;
}
- kgsl_iommu_map_globals(pt);
+ ret = kgsl_iommu_map_globals(pt);
done:
if (ret)
@@ -1227,7 +1229,7 @@ static int _init_secure_pt(struct kgsl_mmu *mmu, struct kgsl_pagetable *pt)
ctx->regbase = iommu->regbase + KGSL_IOMMU_CB0_OFFSET
+ (cb_num << KGSL_IOMMU_CB_SHIFT);
- kgsl_map_global_secure_pt_entry(pt);
+ ret = kgsl_map_global_secure_pt_entry(pt);
done:
if (ret)
@@ -1288,7 +1290,7 @@ static int _init_per_process_pt(struct kgsl_mmu *mmu, struct kgsl_pagetable *pt)
goto done;
}
- kgsl_iommu_map_globals(pt);
+ ret = kgsl_iommu_map_globals(pt);
done:
if (ret)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index a37b5ce9a6b2..287d839f98d0 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -2824,6 +2824,8 @@ err_late_init:
unregister_hotcpu_notifier(&etm4_cpu_notifier);
unregister_hotcpu_notifier(&etm4_cpu_dying_notifier);
}
+ etmdrvdata[drvdata->cpu] = NULL;
+ dev_set_drvdata(dev, NULL);
return ret;
}
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 791f2fe70236..582261d5aa17 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -530,6 +530,8 @@ static bool arm_smmu_is_master_side_secure(struct arm_smmu_domain *smmu_domain);
static bool arm_smmu_is_static_cb(struct arm_smmu_device *smmu);
static bool arm_smmu_is_slave_side_secure(struct arm_smmu_domain *smmu_domain);
static bool arm_smmu_has_secure_vmid(struct arm_smmu_domain *smmu_domain);
+static bool arm_smmu_is_iova_coherent(struct iommu_domain *domain,
+ dma_addr_t iova);
static int arm_smmu_enable_s1_translations(struct arm_smmu_domain *smmu_domain);
@@ -2664,6 +2666,23 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
return ret;
}
+static bool arm_smmu_is_iova_coherent(struct iommu_domain *domain,
+ dma_addr_t iova)
+{
+ bool ret;
+ unsigned long flags;
+ struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
+ struct io_pgtable_ops *ops = smmu_domain->pgtbl_ops;
+
+ if (!ops)
+ return false;
+
+ flags = arm_smmu_pgtbl_lock(smmu_domain);
+ ret = ops->is_iova_coherent(ops, iova);
+ arm_smmu_pgtbl_unlock(smmu_domain, flags);
+ return ret;
+}
+
static int arm_smmu_wait_for_halt(struct arm_smmu_device *smmu)
{
void __iomem *impl_def1_base = ARM_SMMU_IMPL_DEF1(smmu);
@@ -3311,6 +3330,7 @@ static struct iommu_ops arm_smmu_ops = {
.tlbi_domain = arm_smmu_tlbi_domain,
.enable_config_clocks = arm_smmu_enable_config_clocks,
.disable_config_clocks = arm_smmu_disable_config_clocks,
+ .is_iova_coherent = arm_smmu_is_iova_coherent,
};
static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 1cd1a18dd037..3f9825a9addb 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -109,6 +109,7 @@
#define ARM_LPAE_PTE_AP_RW (((arm_lpae_iopte)1) << 6)
#define ARM_LPAE_PTE_AP_PRIV_RO (((arm_lpae_iopte)2) << 6)
#define ARM_LPAE_PTE_AP_RO (((arm_lpae_iopte)3) << 6)
+#define ARM_LPAE_PTE_ATTRINDX_MASK 0x7
#define ARM_LPAE_PTE_ATTRINDX_SHIFT 2
#define ARM_LPAE_PTE_nG (((arm_lpae_iopte)1) << 11)
@@ -813,39 +814,91 @@ static size_t arm_lpae_unmap(struct io_pgtable_ops *ops, unsigned long iova,
return unmapped;
}
-static phys_addr_t arm_lpae_iova_to_phys(struct io_pgtable_ops *ops,
- unsigned long iova)
+static int arm_lpae_iova_to_pte(struct arm_lpae_io_pgtable *data,
+ unsigned long iova, int *plvl_ret,
+ arm_lpae_iopte *ptep_ret)
{
- struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
arm_lpae_iopte pte, *ptep = data->pgd;
- int lvl = ARM_LPAE_START_LVL(data);
+ *plvl_ret = ARM_LPAE_START_LVL(data);
+ *ptep_ret = 0;
do {
/* Valid IOPTE pointer? */
if (!ptep)
- return 0;
+ return -EINVAL;
/* Grab the IOPTE we're interested in */
- pte = *(ptep + ARM_LPAE_LVL_IDX(iova, lvl, data));
+ pte = *(ptep + ARM_LPAE_LVL_IDX(iova, *plvl_ret, data));
/* Valid entry? */
if (!pte)
- return 0;
+ return -EINVAL;
/* Leaf entry? */
- if (iopte_leaf(pte,lvl))
+ if (iopte_leaf(pte, *plvl_ret))
goto found_translation;
/* Take it to the next level */
ptep = iopte_deref(pte, data);
- } while (++lvl < ARM_LPAE_MAX_LEVELS);
+ } while (++(*plvl_ret) < ARM_LPAE_MAX_LEVELS);
/* Ran out of page tables to walk */
- return 0;
+ return -EINVAL;
found_translation:
- iova &= ((1 << ARM_LPAE_LVL_SHIFT(lvl, data)) - 1);
- return ((phys_addr_t)iopte_to_pfn(pte,data) << data->pg_shift) | iova;
+ *ptep_ret = pte;
+ return 0;
+}
+
+static phys_addr_t arm_lpae_iova_to_phys(struct io_pgtable_ops *ops,
+ unsigned long iova)
+{
+ struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
+ arm_lpae_iopte pte;
+ int lvl;
+ phys_addr_t phys = 0;
+
+ if (!arm_lpae_iova_to_pte(data, iova, &lvl, &pte)) {
+ iova &= ((1 << ARM_LPAE_LVL_SHIFT(lvl, data)) - 1);
+ phys = ((phys_addr_t)iopte_to_pfn(pte, data)
+ << data->pg_shift) | iova;
+ }
+
+ return phys;
+}
+
+static bool __arm_lpae_is_iova_coherent(struct arm_lpae_io_pgtable *data,
+ arm_lpae_iopte *ptep)
+{
+ if (data->iop.fmt == ARM_64_LPAE_S1 ||
+ data->iop.fmt == ARM_32_LPAE_S1) {
+ int attr_idx = (*ptep & (ARM_LPAE_PTE_ATTRINDX_MASK <<
+ ARM_LPAE_PTE_ATTRINDX_SHIFT)) >>
+ ARM_LPAE_PTE_ATTRINDX_SHIFT;
+ if ((attr_idx == ARM_LPAE_MAIR_ATTR_IDX_CACHE) &&
+ ((*ptep & ARM_LPAE_PTE_SH_IS) ||
+ (*ptep & ARM_LPAE_PTE_SH_OS)))
+ return true;
+ } else {
+ if (*ptep & ARM_LPAE_PTE_MEMATTR_OIWB)
+ return true;
+ }
+
+ return false;
+}
+
+static bool arm_lpae_is_iova_coherent(struct io_pgtable_ops *ops,
+ unsigned long iova)
+{
+ struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
+ arm_lpae_iopte pte;
+ int lvl;
+ bool ret = false;
+
+ if (!arm_lpae_iova_to_pte(data, iova, &lvl, &pte))
+ ret = __arm_lpae_is_iova_coherent(data, &pte);
+
+ return ret;
}
static void arm_lpae_restrict_pgsizes(struct io_pgtable_cfg *cfg)
@@ -925,6 +978,7 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg)
.map_sg = arm_lpae_map_sg,
.unmap = arm_lpae_unmap,
.iova_to_phys = arm_lpae_iova_to_phys,
+ .is_iova_coherent = arm_lpae_is_iova_coherent,
};
return data;
diff --git a/drivers/iommu/io-pgtable.h b/drivers/iommu/io-pgtable.h
index 1d92edbd5ed1..32ae3c59fe7c 100644
--- a/drivers/iommu/io-pgtable.h
+++ b/drivers/iommu/io-pgtable.h
@@ -114,6 +114,9 @@ struct io_pgtable_ops {
size_t size);
phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
unsigned long iova);
+ bool (*is_iova_coherent)(struct io_pgtable_ops *ops,
+ unsigned long iova);
+
};
/**
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 8ab502d80270..a77a45088b9d 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1336,6 +1336,13 @@ phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
return domain->ops->iova_to_phys_hard(domain, iova);
}
+bool iommu_is_iova_coherent(struct iommu_domain *domain, dma_addr_t iova)
+{
+ if (unlikely(domain->ops->is_iova_coherent == NULL))
+ return 0;
+
+ return domain->ops->is_iova_coherent(domain, iova);
+}
static unsigned long iommu_get_pgsize_bitmap(struct iommu_domain *domain)
{
if (domain->ops->get_pgsize_bitmap)
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp48.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp48.c
index 916f30049bf0..1f2db9683cd0 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp48.c
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp48.c
@@ -26,6 +26,25 @@
#include "cam_soc_api.h"
#define MSM_VFE48_BUS_CLIENT_INIT 0xABAB
+#define VFE48_STATS_BURST_LEN 3
+#define VFE48_UB_SIZE_VFE 2048 /* 2048 * 256 bits = 64KB */
+#define VFE48_UB_STATS_SIZE 144
+#define MSM_ISP48_TOTAL_IMAGE_UB_VFE (VFE48_UB_SIZE_VFE - VFE48_UB_STATS_SIZE)
+
+
+static uint32_t stats_base_addr[] = {
+ 0x1D4, /* HDR_BE */
+ 0x254, /* BG(AWB_BG) */
+ 0x214, /* BF */
+ 0x1F4, /* HDR_BHIST */
+ 0x294, /* RS */
+ 0x2B4, /* CS */
+ 0x2D4, /* IHIST */
+ 0x274, /* BHIST (SKIN_BHIST) */
+ 0x234, /* AEC_BG */
+};
+
+#define VFE48_STATS_BASE(idx) (stats_base_addr[idx])
static struct msm_vfe_axi_hardware_info msm_vfe48_axi_hw_info = {
.num_wm = 7,
@@ -260,6 +279,40 @@ static void msm_vfe48_set_bus_err_ign_mask(struct vfe_device *vfe_dev,
vfe_dev->bus_err_ign_mask &= ~(1 << wm);
}
+void msm_vfe48_stats_cfg_ub(struct vfe_device *vfe_dev)
+{
+ int i;
+ uint32_t ub_offset = 0, stats_burst_len;
+ uint32_t ub_size[VFE47_NUM_STATS_TYPE] = {
+ 16, /* MSM_ISP_STATS_HDR_BE */
+ 16, /* MSM_ISP_STATS_BG */
+ 16, /* MSM_ISP_STATS_BF */
+ 16, /* MSM_ISP_STATS_HDR_BHIST */
+ 16, /* MSM_ISP_STATS_RS */
+ 16, /* MSM_ISP_STATS_CS */
+ 16, /* MSM_ISP_STATS_IHIST */
+ 16, /* MSM_ISP_STATS_BHIST */
+ 16, /* MSM_ISP_STATS_AEC_BG */
+ };
+
+ stats_burst_len = VFE48_STATS_BURST_LEN;
+ ub_offset = VFE48_UB_SIZE_VFE;
+
+ for (i = 0; i < VFE47_NUM_STATS_TYPE; i++) {
+ ub_offset -= ub_size[i];
+ msm_camera_io_w(stats_burst_len << 30 |
+ ub_offset << 16 | (ub_size[i] - 1),
+ vfe_dev->vfe_base + VFE48_STATS_BASE(i) + 0x14);
+ }
+}
+
+uint32_t msm_vfe48_get_ub_size(struct vfe_device *vfe_dev)
+{
+ return MSM_ISP48_TOTAL_IMAGE_UB_VFE;
+}
+
+
+
struct msm_vfe_hardware_info vfe48_hw_info = {
.num_iommu_ctx = 1,
.num_iommu_secure_ctx = 0,
@@ -309,7 +362,7 @@ struct msm_vfe_hardware_info vfe48_hw_info = {
.update_cgc_override =
msm_vfe47_axi_update_cgc_override,
.ub_reg_offset = msm_vfe47_ub_reg_offset,
- .get_ub_size = msm_vfe47_get_ub_size,
+ .get_ub_size = msm_vfe48_get_ub_size,
},
.core_ops = {
.reg_update = msm_vfe47_reg_update,
@@ -347,7 +400,7 @@ struct msm_vfe_hardware_info vfe48_hw_info = {
.clear_wm_irq_mask = msm_vfe47_stats_clear_wm_irq_mask,
.cfg_wm_reg = msm_vfe47_stats_cfg_wm_reg,
.clear_wm_reg = msm_vfe47_stats_clear_wm_reg,
- .cfg_ub = msm_vfe47_stats_cfg_ub,
+ .cfg_ub = msm_vfe48_stats_cfg_ub,
.enable_module = msm_vfe47_stats_enable_module,
.update_ping_pong_addr =
msm_vfe47_stats_update_ping_pong_addr,
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp48.h b/drivers/media/platform/msm/camera_v2/isp/msm_isp48.h
index ccca2010105f..3cf819fb1174 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp48.h
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp48.h
@@ -32,4 +32,8 @@ static inline int msm_vfe_is_vfe48(struct vfe_device *vfe_dev)
MSM_VFE48_HW_VERSION_MASK) == MSM_VFE48_HW_VERSION);
}
+void msm_vfe48_stats_cfg_ub(struct vfe_device *vfe_dev);
+uint32_t msm_vfe48_get_ub_size(struct vfe_device *vfe_dev);
+
+
#endif /* __MSM_ISP48_H__ */
diff --git a/drivers/platform/msm/sps/sps.c b/drivers/platform/msm/sps/sps.c
index eab0e47e7cd2..2f11c6dd7e05 100644
--- a/drivers/platform/msm/sps/sps.c
+++ b/drivers/platform/msm/sps/sps.c
@@ -131,9 +131,10 @@ static ssize_t sps_set_info(struct file *file, const char __user *buf,
int i;
u32 buf_size_kb = 0;
u32 new_buf_size;
+ u32 size = sizeof(str) < count ? sizeof(str) : count;
memset(str, 0, sizeof(str));
- missing = copy_from_user(str, buf, sizeof(str));
+ missing = copy_from_user(str, buf, size);
if (missing)
return -EFAULT;
@@ -221,9 +222,10 @@ static ssize_t sps_set_logging_option(struct file *file, const char __user *buf,
char str[MAX_MSG_LEN];
int i;
u8 option = 0;
+ u32 size = sizeof(str) < count ? sizeof(str) : count;
memset(str, 0, sizeof(str));
- missing = copy_from_user(str, buf, sizeof(str));
+ missing = copy_from_user(str, buf, size);
if (missing)
return -EFAULT;
@@ -270,9 +272,10 @@ static ssize_t sps_set_bam_addr(struct file *file, const char __user *buf,
struct sps_bam *bam;
u32 num_pipes = 0;
void *vir_addr;
+ u32 size = sizeof(str) < count ? sizeof(str) : count;
memset(str, 0, sizeof(str));
- missing = copy_from_user(str, buf, sizeof(str));
+ missing = copy_from_user(str, buf, size);
if (missing)
return -EFAULT;
diff --git a/drivers/power/qcom-charger/qpnp-qnovo.c b/drivers/power/qcom-charger/qpnp-qnovo.c
index ac1c900f4771..7bc90fbf2929 100644
--- a/drivers/power/qcom-charger/qpnp-qnovo.c
+++ b/drivers/power/qcom-charger/qpnp-qnovo.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -99,8 +99,6 @@
#define VADC_LSB_NA 1220700
#define GAIN_LSB_FACTOR 976560
-#define MIN_EN_UA 1000000
-
#define USER_VOTER "user_voter"
#define OK_TO_QNOVO_VOTER "ok_to_qnovo_voter"
@@ -119,9 +117,7 @@ enum {
struct chg_props {
bool charging;
bool usb_online;
- int usb_input_uA;
bool dc_online;
- int dc_input_uA;
};
struct chg_status {
@@ -1092,7 +1088,6 @@ static void get_chg_props(struct qnovo *chip, struct chg_props *cp)
}
cp->usb_online = false;
- cp->usb_input_uA = 0;
if (!chip->usb_psy)
chip->usb_psy = power_supply_get_by_name("usb");
if (chip->usb_psy) {
@@ -1102,17 +1097,9 @@ static void get_chg_props(struct qnovo *chip, struct chg_props *cp)
pr_err("Couldn't read usb online rc = %d\n", rc);
else
cp->usb_online = (bool)pval.intval;
-
- rc = power_supply_get_property(chip->usb_psy,
- POWER_SUPPLY_PROP_CURRENT_MAX, &pval);
- if (rc < 0)
- pr_err("Couldn't read usb current max rc = %d\n", rc);
- else
- cp->usb_input_uA = pval.intval;
}
cp->dc_online = false;
- cp->dc_input_uA = 0;
if (!chip->dc_psy)
chip->dc_psy = power_supply_get_by_name("dc");
if (chip->dc_psy) {
@@ -1122,13 +1109,6 @@ static void get_chg_props(struct qnovo *chip, struct chg_props *cp)
pr_err("Couldn't read dc online rc = %d\n", rc);
else
cp->dc_online = (bool)pval.intval;
-
- rc = power_supply_get_property(chip->dc_psy,
- POWER_SUPPLY_PROP_CURRENT_MAX, &pval);
- if (rc < 0)
- pr_err("Couldn't read dc current max rc = %d\n", rc);
- else
- cp->dc_input_uA = pval.intval;
}
}
@@ -1138,8 +1118,7 @@ static void get_chg_status(struct qnovo *chip, const struct chg_props *cp,
cs->ok_to_qnovo = false;
if (cp->charging &&
- ((cp->usb_online && cp->usb_input_uA >= MIN_EN_UA)
- || (cp->dc_online && cp->dc_input_uA >= MIN_EN_UA)))
+ (cp->usb_online || cp->dc_online))
cs->ok_to_qnovo = true;
}
diff --git a/drivers/thermal/msm-tsens.c b/drivers/thermal/msm-tsens.c
index 4585313772ff..b7733e90fc8b 100644
--- a/drivers/thermal/msm-tsens.c
+++ b/drivers/thermal/msm-tsens.c
@@ -170,10 +170,8 @@
#define TSENS_DEBUG_OFFSET_WORD3 0xc
#define TSENS_DEBUG_OFFSET_ROW 0x10
#define TSENS_DEBUG_DECIDEGC -950
-#define TSENS_DEBUG_MIN_CYCLE 63000
-#define TSENS_DEBUG_MAX_CYCLE 64000
-#define TSENS_DEBUG_POLL_MIN 200000
-#define TSENS_DEBUG_POLL_MAX 210000
+#define TSENS_DEBUG_CYCLE_MS 64
+#define TSENS_DEBUG_POLL_MS 200
#define TSENS_DEBUG_BUS_ID2_MIN_CYCLE 50
#define TSENS_DEBUG_BUS_ID2_MAX_CYCLE 51
#define TSENS_DEBUG_ID_MASK_1_4 0xffffffe1
@@ -1412,8 +1410,7 @@ static void tsens_poll(struct work_struct *work)
spin_unlock_irqrestore(&tmdev->tsens_crit_lock, flags);
if (tmdev->tsens_critical_poll) {
- usleep_range(TSENS_DEBUG_POLL_MIN,
- TSENS_DEBUG_POLL_MAX);
+ msleep(TSENS_DEBUG_POLL_MS);
sensor_status_addr = TSENS_TM_SN_STATUS(tmdev->tsens_addr);
spin_lock_irqsave(&tmdev->tsens_crit_lock, flags);
@@ -1567,8 +1564,7 @@ debug_start:
offset += TSENS_DEBUG_OFFSET_ROW;
}
loop++;
- usleep_range(TSENS_DEBUG_MIN_CYCLE,
- TSENS_DEBUG_MAX_CYCLE);
+ msleep(TSENS_DEBUG_CYCLE_MS);
}
BUG();
}
diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c
index 47e077d180ec..b3d223a76f07 100644
--- a/drivers/usb/gadget/function/f_gsi.c
+++ b/drivers/usb/gadget/function/f_gsi.c
@@ -3007,6 +3007,9 @@ static void gsi_free_inst(struct usb_function_instance *f)
{
struct gsi_opts *opts = container_of(f, struct gsi_opts, func_inst);
+ if (!opts->gsi)
+ return;
+
if (opts->gsi->c_port.ctrl_device.fops)
misc_deregister(&opts->gsi->c_port.ctrl_device);
diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c
index 423a15d82679..f2c2287d7d8c 100644
--- a/drivers/video/fbdev/msm/mdss_dsi.c
+++ b/drivers/video/fbdev/msm/mdss_dsi.c
@@ -2090,6 +2090,13 @@ static int __mdss_dsi_dfps_update_clks(struct mdss_panel_data *pdata,
MIPI_OUTP((sctrl_pdata->ctrl_base) + DSI_DYNAMIC_REFRESH_CTRL,
0x00);
+ rc = mdss_dsi_phy_pll_reset_status(ctrl_pdata);
+ if (rc) {
+ pr_err("%s: pll cannot be locked reset core ready failed %d\n",
+ __func__, rc);
+ goto dfps_timeout;
+ }
+
__mdss_dsi_mask_dfps_errors(ctrl_pdata, false);
if (sctrl_pdata)
__mdss_dsi_mask_dfps_errors(sctrl_pdata, false);
diff --git a/drivers/video/fbdev/msm/mdss_dsi.h b/drivers/video/fbdev/msm/mdss_dsi.h
index 6c840c8459ae..1743a5f23b5d 100644
--- a/drivers/video/fbdev/msm/mdss_dsi.h
+++ b/drivers/video/fbdev/msm/mdss_dsi.h
@@ -694,6 +694,7 @@ void mdss_dsi_dfps_config_8996(struct mdss_dsi_ctrl_pdata *ctrl);
void mdss_dsi_set_burst_mode(struct mdss_dsi_ctrl_pdata *ctrl);
void mdss_dsi_set_reg(struct mdss_dsi_ctrl_pdata *ctrl, int off,
u32 mask, u32 val);
+int mdss_dsi_phy_pll_reset_status(struct mdss_dsi_ctrl_pdata *ctrl);
static inline const char *__mdss_dsi_pm_name(enum dsi_pm_type module)
{
diff --git a/drivers/video/fbdev/msm/msm_mdss_io_8974.c b/drivers/video/fbdev/msm/msm_mdss_io_8974.c
index fdd888edc2fb..3dc2e952b5dd 100644
--- a/drivers/video/fbdev/msm/msm_mdss_io_8974.c
+++ b/drivers/video/fbdev/msm/msm_mdss_io_8974.c
@@ -16,6 +16,8 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clk/msm-clk.h>
+#include <linux/iopoll.h>
+#include <linux/kthread.h>
#include "mdss_dsi.h"
#include "mdss_dp.h"
@@ -427,6 +429,20 @@ static void mdss_dsi_ctrl_phy_reset(struct mdss_dsi_ctrl_pdata *ctrl)
wmb(); /* maek sure reset cleared */
}
+int mdss_dsi_phy_pll_reset_status(struct mdss_dsi_ctrl_pdata *ctrl)
+{
+ int rc;
+ u32 val;
+ u32 const sleep_us = 10, timeout_us = 100;
+
+ pr_debug("%s: polling for RESETSM_READY_STATUS.CORE_READY\n",
+ __func__);
+ rc = readl_poll_timeout(ctrl->phy_io.base + 0x4cc, val,
+ (val & 0x1), sleep_us, timeout_us);
+
+ return rc;
+}
+
static void mdss_dsi_phy_sw_reset_sub(struct mdss_dsi_ctrl_pdata *ctrl)
{
struct mdss_dsi_ctrl_pdata *sctrl = NULL;
diff --git a/include/dt-bindings/clock/qcom,mmcc-sdm660.h b/include/dt-bindings/clock/qcom,mmcc-sdm660.h
index cc7c0033d6ea..68657c5d9761 100644
--- a/include/dt-bindings/clock/qcom,mmcc-sdm660.h
+++ b/include/dt-bindings/clock/qcom,mmcc-sdm660.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -203,6 +203,7 @@
#define VFE1_CLK_SRC 188
#define VIDEO_CORE_CLK_SRC 189
#define VSYNC_CLK_SRC 190
+#define MMSS_MDSS_BYTE1_INTF_DIV_CLK 191
#define BIMC_SMMU_GDSC 0
#define CAMSS_CPP_GDSC 1
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index 9799594ce09d..4c86e4483e0d 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -22,6 +22,8 @@ enum dma_attr {
DMA_ATTR_SKIP_ZEROING,
DMA_ATTR_NO_DELAYED_UNMAP,
DMA_ATTR_EXEC_MAPPING,
+ DMA_ATTR_FORCE_COHERENT,
+ DMA_ATTR_FORCE_NON_COHERENT,
DMA_ATTR_MAX,
};
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index d33e10784b23..d7db6b2eeb52 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -237,6 +237,7 @@ struct iommu_ops {
#endif
unsigned long (*get_pgsize_bitmap)(struct iommu_domain *domain);
+ bool (*is_iova_coherent)(struct iommu_domain *domain, dma_addr_t iova);
unsigned long pgsize_bitmap;
void *priv;
};
@@ -273,6 +274,8 @@ extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long io
extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
extern phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
dma_addr_t iova);
+extern bool iommu_is_iova_coherent(struct iommu_domain *domain,
+ dma_addr_t iova);
extern void iommu_set_fault_handler(struct iommu_domain *domain,
iommu_fault_handler_t handler, void *token);
extern void iommu_trigger_fault(struct iommu_domain *domain,
@@ -505,6 +508,12 @@ static inline phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
return 0;
}
+static inline bool iommu_is_iova_coherent(struct iommu_domain *domain,
+ dma_addr_t iova)
+{
+ return 0;
+}
+
static inline void iommu_set_fault_handler(struct iommu_domain *domain,
iommu_fault_handler_t handler, void *token)
{
diff --git a/include/linux/security.h b/include/linux/security.h
index e3b5efc0eb4b..7caf520e6233 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -292,7 +292,6 @@ int security_file_send_sigiotask(struct task_struct *tsk,
struct fown_struct *fown, int sig);
int security_file_receive(struct file *file);
int security_file_open(struct file *file, const struct cred *cred);
-int security_file_close(struct file *file);
int security_task_create(unsigned long clone_flags);
void security_task_free(struct task_struct *task);
int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
@@ -820,11 +819,6 @@ static inline int security_file_open(struct file *file,
return 0;
}
-static inline int security_file_close(struct file *file)
-{
- return 0;
-}
-
static inline int security_task_create(unsigned long clone_flags)
{
return 0;
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 0a59832e0515..9d58d703527c 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -398,6 +398,7 @@ TRACE_EVENT(sched_get_task_cpu_cycles,
__field(u64, exec_time )
__field(u32, freq )
__field(u32, legacy_freq )
+ __field(u32, max_freq)
),
TP_fast_assign(
@@ -407,11 +408,13 @@ TRACE_EVENT(sched_get_task_cpu_cycles,
__entry->exec_time = exec_time;
__entry->freq = cpu_cycles_to_freq(cycles, exec_time);
__entry->legacy_freq = cpu_cur_freq(cpu);
+ __entry->max_freq = cpu_max_freq(cpu);
),
- TP_printk("cpu=%d event=%d cycles=%llu exec_time=%llu freq=%u legacy_freq=%u",
- __entry->cpu, __entry->event, __entry->cycles,
- __entry->exec_time, __entry->freq, __entry->legacy_freq)
+ TP_printk("cpu=%d event=%d cycles=%llu exec_time=%llu freq=%u legacy_freq=%u max_freq=%u",
+ __entry->cpu, __entry->event, __entry->cycles,
+ __entry->exec_time, __entry->freq, __entry->legacy_freq,
+ __entry->max_freq)
);
TRACE_EVENT(sched_update_history,
diff --git a/kernel/sched/hmp.c b/kernel/sched/hmp.c
index d3547391b937..180e2fcf785b 100644
--- a/kernel/sched/hmp.c
+++ b/kernel/sched/hmp.c
@@ -3340,6 +3340,7 @@ skip_early:
busy[i].prev_load = div64_u64(sched_ravg_window,
NSEC_PER_USEC);
busy[i].new_task_load = 0;
+ busy[i].predicted_load = 0;
goto exit_early;
}
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 271d83e30d19..bf7fc4989e5c 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1850,15 +1850,19 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,
* You can set the task state as follows -
*
* %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to
- * pass before the routine returns.
+ * pass before the routine returns unless the current task is explicitly
+ * woken up, (e.g. by wake_up_process()).
*
* %TASK_INTERRUPTIBLE - the routine may return early if a signal is
- * delivered to the current task.
+ * delivered to the current task or the current task is explicitly woken
+ * up.
*
* The current task state is guaranteed to be TASK_RUNNING when this
* routine returns.
*
- * Returns 0 when the timer has expired otherwise -EINTR
+ * Returns 0 when the timer has expired. If the task was woken before the
+ * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
+ * by an explicit wakeup, it returns -EINTR.
*/
int __sched schedule_hrtimeout_range(ktime_t *expires, u64 delta,
const enum hrtimer_mode mode)
@@ -1880,15 +1884,19 @@ EXPORT_SYMBOL_GPL(schedule_hrtimeout_range);
* You can set the task state as follows -
*
* %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to
- * pass before the routine returns.
+ * pass before the routine returns unless the current task is explicitly
+ * woken up, (e.g. by wake_up_process()).
*
* %TASK_INTERRUPTIBLE - the routine may return early if a signal is
- * delivered to the current task.
+ * delivered to the current task or the current task is explicitly woken
+ * up.
*
* The current task state is guaranteed to be TASK_RUNNING when this
* routine returns.
*
- * Returns 0 when the timer has expired otherwise -EINTR
+ * Returns 0 when the timer has expired. If the task was woken before the
+ * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
+ * by an explicit wakeup, it returns -EINTR.
*/
int __sched schedule_hrtimeout(ktime_t *expires,
const enum hrtimer_mode mode)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 5ebefc7cfa4f..2bde2c2b1cb3 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -811,8 +811,15 @@ static struct tvec_base *lock_timer_base(struct timer_list *timer,
__acquires(timer->base->lock)
{
for (;;) {
- u32 tf = timer->flags;
struct tvec_base *base;
+ u32 tf;
+
+ /*
+ * We need to use READ_ONCE() here, otherwise the compiler
+ * might re-read @tf between the check for TIMER_MIGRATING
+ * and spin_lock().
+ */
+ tf = READ_ONCE(timer->flags);
if (!(tf & TIMER_MIGRATING)) {
base = get_timer_base(tf);
@@ -1529,11 +1536,12 @@ static void process_timeout(unsigned long __data)
* You can set the task state as follows -
*
* %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
- * pass before the routine returns. The routine will return 0
+ * pass before the routine returns unless the current task is explicitly
+ * woken up, (e.g. by wake_up_process())".
*
* %TASK_INTERRUPTIBLE - the routine may return early if a signal is
- * delivered to the current task. In this case the remaining time
- * in jiffies will be returned, or 0 if the timer expired in time
+ * delivered to the current task or the current task is explicitly woken
+ * up.
*
* The current task state is guaranteed to be TASK_RUNNING when this
* routine returns.
@@ -1542,7 +1550,9 @@ static void process_timeout(unsigned long __data)
* the CPU away without a bound on the timeout. In this case the return
* value will be %MAX_SCHEDULE_TIMEOUT.
*
- * In all cases the return value is guaranteed to be non-negative.
+ * Returns 0 when the timer has expired otherwise the remaining time in
+ * jiffies will be returned. In all cases the return value is guaranteed
+ * to be non-negative.
*/
signed long __sched schedule_timeout(signed long timeout)
{
@@ -1777,16 +1787,6 @@ unsigned long msleep_interruptible(unsigned int msecs)
EXPORT_SYMBOL(msleep_interruptible);
-static void __sched do_usleep_range(unsigned long min, unsigned long max)
-{
- ktime_t kmin;
- u64 delta;
-
- kmin = ktime_set(0, min * NSEC_PER_USEC);
- delta = (u64)(max - min) * NSEC_PER_USEC;
- schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL);
-}
-
/**
* usleep_range - Drop in replacement for udelay where wakeup is flexible
* @min: Minimum time in usecs to sleep
@@ -1794,7 +1794,14 @@ static void __sched do_usleep_range(unsigned long min, unsigned long max)
*/
void __sched usleep_range(unsigned long min, unsigned long max)
{
- __set_current_state(TASK_UNINTERRUPTIBLE);
- do_usleep_range(min, max);
+ ktime_t exp = ktime_add_us(ktime_get(), min);
+ u64 delta = (u64)(max - min) * NSEC_PER_USEC;
+
+ for (;;) {
+ __set_current_state(TASK_UNINTERRUPTIBLE);
+ /* Do not return before the requested sleep time has elapsed */
+ if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS))
+ break;
+ }
}
EXPORT_SYMBOL(usleep_range);
diff --git a/security/pfe/Kconfig b/security/pfe/Kconfig
index 207be713f800..0cd9e81a4952 100644
--- a/security/pfe/Kconfig
+++ b/security/pfe/Kconfig
@@ -15,6 +15,7 @@ config PFT
config PFK
bool "Per-File-Key driver"
depends on SECURITY
+ depends on SECURITY_SELINUX
default n
help
This driver is used for storing eCryptfs information
diff --git a/security/pfe/pfk_ecryptfs.c b/security/pfe/pfk_ecryptfs.c
index 1d6a2eeaf6fc..f98d85ab4841 100644
--- a/security/pfe/pfk_ecryptfs.c
+++ b/security/pfe/pfk_ecryptfs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -92,56 +92,18 @@ bool pfk_is_ecryptfs_type(const struct inode *inode)
return true;
}
-static int pfk_ecryptfs_inode_alloc_security(struct inode *inode)
-{
- struct inode_security_struct *i_sec = NULL;
-
- if (inode == NULL)
- return -EINVAL;
-
- i_sec = kzalloc(sizeof(*i_sec), GFP_KERNEL);
-
- if (i_sec == NULL)
- return -ENOMEM;
-
- inode->i_security = i_sec;
-
- return 0;
-}
-
-static void pfk_ecryptfs_inode_free_security(struct inode *inode)
-{
- if (inode == NULL)
- return;
-
- kzfree(inode->i_security);
-}
-
-static struct security_hook_list pfk_ecryptfs_hooks[] = {
- LSM_HOOK_INIT(inode_alloc_security, pfk_ecryptfs_inode_alloc_security),
- LSM_HOOK_INIT(inode_free_security, pfk_ecryptfs_inode_free_security),
-};
-
/*
- * pfk_ecryptfs_lsm_init() - makes sure either se-linux or pfk_ecryptfs are
- * registered as security module.
+ * pfk_ecryptfs_lsm_init() - makes sure either se-linux is
+ * registered as security module as it is required by pfk_ecryptfs.
*
* This is required because ecryptfs uses a field inside security struct in
* inode to store its info
*/
static int __init pfk_ecryptfs_lsm_init(void)
{
- /* Check if PFK is the chosen lsm via security_module_enable() */
- if (security_module_enable("pfk_ecryptfs")) {
- security_add_hooks(pfk_ecryptfs_hooks,
- ARRAY_SIZE(pfk_ecryptfs_hooks));
- pr_debug("pfk_ecryptfs is the chosen lsm, registered successfully !\n");
- } else {
- pr_debug("pfk_ecryptfs is not the chosen lsm.\n");
- if (!selinux_is_enabled()) {
- pr_err("se linux is not enabled.\n");
- return -ENODEV;
- }
+ if (!selinux_is_enabled()) {
+ pr_err("PFE eCryptfs requires se linux to be enabled\n");
+ return -ENODEV;
}
return 0;
diff --git a/security/pfe/pft.c b/security/pfe/pft.c
index 74433c4fe0ff..0c49fbdd4f28 100644
--- a/security/pfe/pft.c
+++ b/security/pfe/pft.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -199,8 +199,6 @@ static struct security_hook_list pft_hooks[] = {
LSM_HOOK_INIT(file_open, pft_file_open),
LSM_HOOK_INIT(file_permission, pft_file_permission),
LSM_HOOK_INIT(file_close, pft_file_close),
-
- LSM_HOOK_INIT(allow_merge_bio, pft_allow_merge_bio),
};
static int __init pft_lsm_init(struct pft_device *dev)
@@ -211,7 +209,8 @@ static int __init pft_lsm_init(struct pft_device *dev)
dev->is_chosen_lsm = true;
pr_debug("pft is the chosen lsm, registered successfully !\n");
} else {
- pr_debug("pft is not the chosen lsm.\n");
+ pr_err("pft is not the chosen lsm\n");
+ return -ENODEV;
}
return 0;
diff --git a/security/security.c b/security/security.c
index 7d1de1f6299f..8eece6cd01da 100644
--- a/security/security.c
+++ b/security/security.c
@@ -852,11 +852,6 @@ int security_file_open(struct file *file, const struct cred *cred)
return fsnotify_perm(file, MAY_OPEN);
}
-int security_file_close(struct file *file)
-{
- return call_int_hook(file_close, 0, file);
-}
-
int security_task_create(unsigned long clone_flags)
{
return call_int_hook(task_create, 0, clone_flags);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index bbfdfee59b38..96b2e3d521a6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -83,8 +83,6 @@
#include <linux/export.h>
#include <linux/msg.h>
#include <linux/shm.h>
-#include <linux/pft.h>
-#include <linux/pfk.h>
#include "avc.h"
#include "objsec.h"
@@ -1773,15 +1771,9 @@ static int may_create(struct inode *dir,
if (rc)
return rc;
- rc = avc_has_perm(newsid, sbsec->sid,
+ return avc_has_perm(newsid, sbsec->sid,
SECCLASS_FILESYSTEM,
FILESYSTEM__ASSOCIATE, &ad);
- if (rc)
- return rc;
-
- rc = pft_inode_mknod(dir, dentry, 0, 0);
-
- return rc;
}
/* Check whether a task can create a key. */
@@ -1837,14 +1829,7 @@ static int may_link(struct inode *dir,
return 0;
}
- rc = avc_has_perm(sid, isec->sid, isec->sclass, av, &ad);
- if (rc)
- return rc;
-
- if (kind == MAY_UNLINK)
- rc = pft_inode_unlink(dir, dentry);
-
- return rc;
+ return avc_has_perm(sid, isec->sid, isec->sclass, av, &ad);
}
static inline int may_rename(struct inode *old_dir,
@@ -2814,21 +2799,9 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir,
static int selinux_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode)
{
- int ret;
-
- ret = pft_inode_create(dir, dentry, mode);
- if (ret < 0)
- return ret;
-
return may_create(dir, dentry, SECCLASS_FILE);
}
-static int selinux_inode_post_create(struct inode *dir, struct dentry *dentry,
- umode_t mode)
-{
- return pft_inode_post_create(dir, dentry, mode);
-}
-
static int selinux_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
{
return may_link(dir, old_dentry, MAY_LINK);
@@ -2862,12 +2835,6 @@ static int selinux_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t
static int selinux_inode_rename(struct inode *old_inode, struct dentry *old_dentry,
struct inode *new_inode, struct dentry *new_dentry)
{
- int rc;
-
- rc = pft_inode_rename(old_inode, old_dentry, new_inode, new_dentry);
- if (rc)
- return rc;
-
return may_rename(old_inode, old_dentry, new_inode, new_dentry);
}
@@ -2992,9 +2959,6 @@ static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name)
{
const struct cred *cred = current_cred();
- if (pft_inode_set_xattr(dentry, name, NULL, 0, 0) < 0)
- return -EACCES;
-
if (!strncmp(name, XATTR_SECURITY_PREFIX,
sizeof XATTR_SECURITY_PREFIX - 1)) {
if (!strcmp(name, XATTR_NAME_CAPS)) {
@@ -3245,16 +3209,11 @@ static int selinux_file_permission(struct file *file, int mask)
struct file_security_struct *fsec = file->f_security;
struct inode_security_struct *isec = inode->i_security;
u32 sid = current_sid();
- int ret;
if (!mask)
/* No permission to check. Existence test. */
return 0;
- ret = pft_file_permission(file, mask);
- if (ret < 0)
- return ret;
-
if (sid == fsec->sid && fsec->isid == isec->sid &&
fsec->pseqno == avc_policy_seqno())
/* No change since file_open check. */
@@ -3545,11 +3504,6 @@ static int selinux_file_open(struct file *file, const struct cred *cred)
{
struct file_security_struct *fsec;
struct inode_security_struct *isec;
- int ret;
-
- ret = pft_file_open(file, cred);
- if (ret < 0)
- return ret;
fsec = file->f_security;
isec = file_inode(file)->i_security;
@@ -3573,11 +3527,6 @@ static int selinux_file_open(struct file *file, const struct cred *cred)
return file_path_has_perm(cred, file, open_file_to_av(file));
}
-static int selinux_file_close(struct file *file)
-{
- return pft_file_close(file);
-}
-
/* task security operations */
static int selinux_task_create(unsigned long clone_flags)
@@ -5981,7 +5930,6 @@ static struct security_hook_list selinux_hooks[] = {
LSM_HOOK_INIT(inode_free_security, selinux_inode_free_security),
LSM_HOOK_INIT(inode_init_security, selinux_inode_init_security),
LSM_HOOK_INIT(inode_create, selinux_inode_create),
- LSM_HOOK_INIT(inode_post_create, selinux_inode_post_create),
LSM_HOOK_INIT(inode_link, selinux_inode_link),
LSM_HOOK_INIT(inode_unlink, selinux_inode_unlink),
LSM_HOOK_INIT(inode_symlink, selinux_inode_symlink),
@@ -6018,7 +5966,6 @@ static struct security_hook_list selinux_hooks[] = {
LSM_HOOK_INIT(file_receive, selinux_file_receive),
LSM_HOOK_INIT(file_open, selinux_file_open),
- LSM_HOOK_INIT(file_close, selinux_file_close),
LSM_HOOK_INIT(task_create, selinux_task_create),
LSM_HOOK_INIT(cred_alloc_blank, selinux_cred_alloc_blank),
diff --git a/sound/soc/msm/Kconfig b/sound/soc/msm/Kconfig
index 835022b76b78..6ecd300a18ac 100644
--- a/sound/soc/msm/Kconfig
+++ b/sound/soc/msm/Kconfig
@@ -124,7 +124,6 @@ config SND_SOC_INT_CODEC
select SND_SOC_SDM660_CDC
select QTI_PP
select DTS_SRS_TM
- select DOLBY_DAP
select DOLBY_DS2
select SND_HWDEP
select MSM_ULTRASOUND
@@ -157,7 +156,6 @@ config SND_SOC_EXT_CODEC
select MFD_CORE
select QTI_PP
select DTS_SRS_TM
- select DOLBY_DAP
select DOLBY_DS2
select SND_SOC_CPE
select SND_SOC_WCD_CPE