From aa47a8ab7a072981a133073eb1d9a47e17ac78af Mon Sep 17 00:00:00 2001 From: Hai Li Date: Wed, 22 Apr 2020 12:47:55 -0400 Subject: [PATCH 01/71] ARM: dts: msm: add hgsl to sa8195 vm for GPU doorbell This change is to enable GPU doorbell feature on sa8195 Linux GVM. Change-Id: I7d9c6f63bbcc4d7507071d4a81de2f668ecf81cd Signed-off-by: Hai Li --- arch/arm64/boot/dts/qcom/sa8195-vm.dtsi | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sa8195-vm.dtsi b/arch/arm64/boot/dts/qcom/sa8195-vm.dtsi index 3dc5a946900a..61f4ec4d4aed 100644 --- a/arch/arm64/boot/dts/qcom/sa8195-vm.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8195-vm.dtsi @@ -752,6 +752,66 @@ clocks = <&clock_virt GCC_PRNG_AHB_CLK>; clock-names = "iface_clk"; }; + + tcsr_compute_signal_glb: syscon@0x1fd8000 { + compatible = "syscon"; + reg = <0x1fd8000 0x1000>; + }; + + tcsr_compute_signal_sender0: syscon@0x1fd9000 { + compatible = "syscon"; + reg = <0x1fd9000 0x1000>; + }; + + tcsr_compute_signal_sender1: syscon@0x1fdd000 { + compatible = "syscon"; + reg = <0x1fdd000 0x1000>; + }; + + tcsr_compute_signal_receiver0: syscon@0x1fdb000 { + compatible = "syscon"; + reg = <0x1fdb000 0x1000>; + }; + + tcsr_compute_signal_receiver1: syscon@0x1fdf000 { + compatible = "syscon"; + reg = <0x1fdf000 0x1000>; + }; + + hgsl_tcsr_sender0: hgsl_tcsr_sender0 { + compatible = "qcom,hgsl-tcsr-sender"; + syscon = <&tcsr_compute_signal_sender0>; + syscon-glb = <&tcsr_compute_signal_glb>; + }; + + hgsl_tcsr_sender1: hgsl_tcsr_sender1 { + compatible = "qcom,hgsl-tcsr-sender"; + syscon = <&tcsr_compute_signal_sender1>; + syscon-glb = <&tcsr_compute_signal_glb>; + }; + + hgsl_tcsr_receiver0: hgsl_tcsr_receiver0 { + compatible = "qcom,hgsl-tcsr-receiver"; + syscon = <&tcsr_compute_signal_receiver0>; + interrupts = <0 238 0>; + }; + + hgsl_tcsr_receiver1: hgsl_tcsr_receiver1 { + compatible = "qcom,hgsl-tcsr-receiver"; + syscon = <&tcsr_compute_signal_receiver1>; + interrupts = <0 239 0>; + }; + + msm_gpu_hyp: qcom,hgsl@0x2c00000 { + compatible = "qcom,hgsl"; + reg = <0x2c00000 0x8>, <0x2c8f000 0x4>; + reg-names = "hgsl_reg_hwinf", "hgsl_reg_gmucx"; + + qcom,glb-db-senders = <&hgsl_tcsr_sender0 + &hgsl_tcsr_sender1>; + qcom,glb-db-receivers = <&hgsl_tcsr_receiver0 + &hgsl_tcsr_receiver1>; + }; }; #include "sdmshrike-pinctrl.dtsi" From 64f5ee7baf0cb5f24d23189ede65a3340b0e4c60 Mon Sep 17 00:00:00 2001 From: Xiaowen Wu Date: Fri, 22 May 2020 14:26:28 -0400 Subject: [PATCH 02/71] drm/bridge: add anx7625 to drm device pm link Add anx7625 to drm device pm link to make sure anx7625 is suspended after drm device suspended, and resumed before drm device resumed. Change-Id: I306b9c1f25eec5f9d7efbfd845ed3483a4167045 Signed-off-by: Xiaowen Wu --- drivers/gpu/drm/bridge/analogix-anx7625.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix-anx7625.c b/drivers/gpu/drm/bridge/analogix-anx7625.c index 0b80128b4587..8a45ad58d3f9 100644 --- a/drivers/gpu/drm/bridge/analogix-anx7625.c +++ b/drivers/gpu/drm/bridge/analogix-anx7625.c @@ -1221,6 +1221,9 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge) return err; } + device_link_add(bridge->dev->dev, &anx7625->client->dev, + DL_FLAG_PM_RUNTIME); + return 0; } From e8c8ce5e4e96170e624661442e5724ff4bafcd81 Mon Sep 17 00:00:00 2001 From: E V Ravi Date: Mon, 13 Apr 2020 16:13:32 +0530 Subject: [PATCH 03/71] Add S2R and S2D support in KMD S2R: Implement .suspend() and .resume() S2D: Implement .thaw() and .restore(). Change-Id: Idef319f8f67895fcadb838fb72f03187799401c8 Signed-off-by: E V Ravi --- .../msm/ais/cam_req_mgr/cam_req_mgr_dev.c | 59 +++++++++++++++++++ include/uapi/media/cam_req_mgr.h | 12 +++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/msm/ais/cam_req_mgr/cam_req_mgr_dev.c b/drivers/media/platform/msm/ais/cam_req_mgr/cam_req_mgr_dev.c index ee18a574faeb..89a48d58073d 100644 --- a/drivers/media/platform/msm/ais/cam_req_mgr/cam_req_mgr_dev.c +++ b/drivers/media/platform/msm/ais/cam_req_mgr/cam_req_mgr_dev.c @@ -745,6 +745,64 @@ static const struct of_device_id cam_req_mgr_dt_match[] = { }; MODULE_DEVICE_TABLE(of, cam_dt_match); +static int cam_pm_suspend(struct device *pdev) +{ + struct v4l2_event event; + + event.id = V4L_EVENT_CAM_REQ_MGR_S2R_SUSPEND; + event.type = V4L_EVENT_CAM_REQ_MGR_EVENT; + CAM_DBG(CAM_CRM, "Queue S2R suspend event"); + v4l2_event_queue(g_dev.video, &event); + return 0; +} + +static int cam_pm_resume(struct device *pdev) +{ + struct v4l2_event event; + + event.id = V4L_EVENT_CAM_REQ_MGR_S2R_RESUME; + event.type = V4L_EVENT_CAM_REQ_MGR_EVENT; + CAM_DBG(CAM_CRM, "Queue S2R resume event"); + v4l2_event_queue(g_dev.video, &event); + return 0; +} + +static int cam_pm_freeze(struct device *pdev) +{ + CAM_DBG(CAM_CRM, "Freeze done for cam_req_mgr driver"); + return 0; +} + +static int cam_pm_restore(struct device *pdev) +{ + struct v4l2_event event; + + event.id = V4L_EVENT_CAM_REQ_MGR_HIBERNATION_RESUME; + event.type = V4L_EVENT_CAM_REQ_MGR_EVENT; + CAM_DBG(CAM_CRM, "Queue hibernation restore event"); + v4l2_event_queue(g_dev.video, &event); + return 0; +} + +static int cam_pm_thaw(struct device *pdev) +{ + struct v4l2_event event; + + event.id = V4L_EVENT_CAM_REQ_MGR_HIBERNATION_SUSPEND; + event.type = V4L_EVENT_CAM_REQ_MGR_EVENT; + CAM_DBG(CAM_CRM, "Queue hibernation thaw event"); + v4l2_event_queue(g_dev.video, &event); + return 0; +} + +static const struct dev_pm_ops cam_pm_ops = { + .suspend = &cam_pm_suspend, + .resume = &cam_pm_resume, + .freeze = &cam_pm_freeze, + .restore = &cam_pm_restore, + .thaw = &cam_pm_thaw, +}; + static struct platform_driver cam_req_mgr_driver = { .probe = cam_req_mgr_probe, .remove = cam_req_mgr_remove, @@ -753,6 +811,7 @@ static struct platform_driver cam_req_mgr_driver = { .owner = THIS_MODULE, .of_match_table = cam_req_mgr_dt_match, .suppress_bind_attrs = true, + .pm = &cam_pm_ops, }, }; diff --git a/include/uapi/media/cam_req_mgr.h b/include/uapi/media/cam_req_mgr.h index bdc1cb94c28c..55105fd903b0 100644 --- a/include/uapi/media/cam_req_mgr.h +++ b/include/uapi/media/cam_req_mgr.h @@ -43,9 +43,15 @@ #define V4L_EVENT_CAM_REQ_MGR_EVENT (V4L2_EVENT_PRIVATE_START + 0) /* Specific event ids to get notified in user space */ -#define V4L_EVENT_CAM_REQ_MGR_SOF 0 -#define V4L_EVENT_CAM_REQ_MGR_ERROR 1 -#define V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS 2 +#define V4L_EVENT_CAM_REQ_MGR_SOF 0 +#define V4L_EVENT_CAM_REQ_MGR_ERROR 1 +#define V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS 2 + +/* Suspend to RAM and Hibernation events */ +#define V4L_EVENT_CAM_REQ_MGR_S2R_SUSPEND 10 +#define V4L_EVENT_CAM_REQ_MGR_S2R_RESUME 11 +#define V4L_EVENT_CAM_REQ_MGR_HIBERNATION_SUSPEND 12 +#define V4L_EVENT_CAM_REQ_MGR_HIBERNATION_RESUME 13 /* SOF Event status */ #define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0 From 6ef0e17f0d6fbadb9043e816226f8ffbfe71dd80 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Tue, 26 May 2020 23:33:16 -0700 Subject: [PATCH 04/71] usb: dwc3: gadget: Avoid spuriously printing NO_PULLUP in log This log message can come unnecessarily particularly when the controller is operating in host mode and the xHCI HCD driver is primarily handling interrupts. As there should be no gadget specific events there should not be any value showing in the GEVNTCOUNT registers so dwc3_interrupt() should normally return silently. Only print the "NO_PULLUP" log in case there are new/pending events and the gadget is in halted state. Change-Id: I4e5040409a14f18d454833fd67d41ca5d0f13501 Signed-off-by: Jack Pham --- drivers/usb/dwc3/gadget.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 03301a2455aa..9052518ff925 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3885,20 +3885,6 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) if (dwc->err_evt_seen) return IRQ_HANDLED; - /* Controller is being halted, ignore the interrupts */ - if (!dwc->pullups_connected) { - /* - * Even with controller halted, there is a possibility - * that the interrupt line is kept asserted. - * As per the databook (3.00A - 6.3.57) read the GEVNTCOUNT - * to ensure that the interrupt line is de-asserted. - */ - count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); - count &= DWC3_GEVNTCOUNT_MASK; - dbg_event(0xFF, "NO_PULLUP", count); - return IRQ_HANDLED; - } - /* * With PCIe legacy interrupt, test shows that top-half irq handler can * be called again after HW interrupt deassertion. Check if bottom-half @@ -3913,6 +3899,13 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) if (!count) return IRQ_NONE; + /* Controller is halted; ignore new/pending events */ + if (!dwc->pullups_connected) { + dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); + dbg_event(0xFF, "NO_PULLUP", count); + return IRQ_HANDLED; + } + if (count > evt->length) { dbg_event(0xFF, "HUGE_EVCNT", count); /* From 98c140797d9f03b98445f5784c642f4b4ba3f222 Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Tue, 9 Jun 2020 18:18:27 -0700 Subject: [PATCH 05/71] msm: ipa: update MHI event id logic 1. Device side GSI event channel allocated for MHI event channel need to be sequential. 2. The device side evt_id = host_evt_id - host first_evt_idx + device side offset (ipa3_ctx->mhi_evid_limits). Change-Id: Ieab7596caa6880d2daf75c3bc45cd59375dd7589 Signed-off-by: Bojun Pan --- drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c b/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c index f715f0bf2824..c356ae76bb01 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c @@ -1669,7 +1669,8 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl) internal.start.gsi.mhi = &channel->ch_scratch.mhi; internal.start.gsi.cached_gsi_evt_ring_hdl = &channel->cached_gsi_evt_ring_hdl; - internal.start.gsi.evchid = channel->index; + internal.start.gsi.evchid = channel->ch_ctx_host.erindex - + ipa_mhi_client_ctx->first_er_idx; res = ipa_connect_mhi_pipe(&internal, clnt_hdl); if (res) { From 4354614e88b0cb7abd0869ff5e81145672794e69 Mon Sep 17 00:00:00 2001 From: Ashish Chavan Date: Wed, 10 Jun 2020 11:07:44 +0530 Subject: [PATCH 06/71] power: smb1398: Fix array index out of bounds error In smb1398_get_irq_index_byname() while accessing 'smb_irqs' we may cause array index out of bound error. Fix this by looping till ARRAY_SIZE(smb_irqs) instead of NUM_IRQS. While at it also fix usage of uninitialized variable of 'main_fcc_ua'. Change-Id: I2f726cdc23fdbff431d48699c8407744dd0ca93e Signed-off-by: Ashish Chavan --- drivers/power/supply/qcom/smb1398-charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/qcom/smb1398-charger.c b/drivers/power/supply/qcom/smb1398-charger.c index 2f3b3bf3f8b3..5f834401ab0b 100644 --- a/drivers/power/supply/qcom/smb1398-charger.c +++ b/drivers/power/supply/qcom/smb1398-charger.c @@ -1470,7 +1470,7 @@ static int smb1398_get_irq_index_byname(const char *irq_name) { int i; - for (i = 0; i < NUM_IRQS; i++) { + for (i = 0; i < ARRAY_SIZE(smb_irqs); i++) { if (smb_irqs[i].name != NULL) if (strcmp(smb_irqs[i].name, irq_name) == 0) return i; @@ -1726,7 +1726,7 @@ static void smb1398_taper_work(struct work_struct *work) struct smb1398_chip *chip = container_of(work, struct smb1398_chip, taper_work); union power_supply_propval pval = {0}; - int rc, fcc_ua, fv_uv, stepper_ua, main_fcc_ua; + int rc, fcc_ua, fv_uv, stepper_ua, main_fcc_ua = 0; bool slave_en; if (!is_psy_voter_available(chip)) From dfc16676a5073166568a3658526d374f26b22fc2 Mon Sep 17 00:00:00 2001 From: Mohammed Nayeem Ur Rahman Date: Wed, 1 Apr 2020 14:30:33 +0530 Subject: [PATCH 07/71] msm: adsprpc: Fix array index underflow problem Add check to restrict index underflow.This is to avoid that it does not access invalid index. Change-Id: Ib971033c5820ca4dab38ace3b106c7b1b42529e4 Acked-by: Gururaj Chalger Signed-off-by: Mohammed Nayeem Ur Rahman --- drivers/char/adsprpc.c | 67 +++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 4d538a830a1d..c3823ec9bf85 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -706,12 +706,23 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) { struct fastrpc_apps *me = &gfa; struct fastrpc_file *fl; - int vmid; + int vmid, cid = -1, err = 0; struct fastrpc_session_ctx *sess; if (!map) return; fl = map->fl; + if (fl && !(map->flags == ADSP_MMAP_HEAP_ADDR || + map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR)) { + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; + pr_err("adsprpc: ERROR:%s, Invalid channel id: %d, err:%d", + __func__, cid, err); + return; + } + } if (map->flags == ADSP_MMAP_HEAP_ADDR || map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) { map->refs--; @@ -783,20 +794,21 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd, struct fastrpc_apps *me = &gfa; struct fastrpc_session_ctx *sess; struct fastrpc_apps *apps = fl->apps; - int cid = fl->cid; struct fastrpc_channel_ctx *chan = NULL; struct fastrpc_mmap *map = NULL; dma_addr_t region_phys = 0; void *region_vaddr = NULL; unsigned long flags; - int err = 0, vmid, sgl_index = 0; + int err = 0, vmid, sgl_index = 0, cid = -1; struct scatterlist *sgl = NULL; - VERIFY(err, cid >= 0 && cid < NUM_CHANNELS); - if (err) + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; goto bail; + } chan = &apps->channel[cid]; - if (!fastrpc_mmap_find(fl, fd, va, len, mflags, 1, ppmap)) return 0; map = kzalloc(sizeof(*map), GFP_KERNEL); @@ -1829,8 +1841,16 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx, { struct smq_msg *msg = &ctx->msg; struct fastrpc_file *fl = ctx->fl; - struct fastrpc_channel_ctx *channel_ctx = &fl->apps->channel[fl->cid]; - int err = 0; + struct fastrpc_channel_ctx *channel_ctx = NULL; + int err = 0, cid = -1; + + channel_ctx = &fl->apps->channel[fl->cid]; + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; + goto bail; + } mutex_lock(&channel_ctx->smd_mutex); msg->pid = fl->tgid; @@ -1895,11 +1915,22 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, { struct smq_invoke_ctx *ctx = NULL; struct fastrpc_ioctl_invoke *invoke = &inv->inv; - int cid = fl->cid; - int interrupted = 0; - int err = 0; + int err = 0, cid = -1, interrupted = 0; struct timespec invoket = {0}; - int64_t *perf_counter = getperfcounter(fl, PERF_COUNT); + int64_t *perf_counter = NULL; + + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; + goto bail; + } + VERIFY(err, fl->sctx != NULL); + if (err) { + err = -EBADR; + goto bail; + } + perf_counter = getperfcounter(fl, PERF_COUNT); if (fl->profile) getnstimeofday(&invoket); @@ -1913,14 +1944,6 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, } } - VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS && fl->sctx != NULL); - if (err) { - pr_err("adsprpc: ERROR: %s: user application %s domain is not set\n", - __func__, current->comm); - err = -EBADR; - goto bail; - } - if (!kernel) { VERIFY(err, 0 == context_restore_interrupted(fl, inv, &ctx)); @@ -3238,8 +3261,7 @@ static const struct file_operations debugfs_fops = { static int fastrpc_channel_open(struct fastrpc_file *fl) { struct fastrpc_apps *me = &gfa; - int cid, err = 0; - + int cid = -1, err = 0; VERIFY(err, fl && fl->sctx && fl->cid >= 0 && fl->cid < NUM_CHANNELS); if (err) { @@ -3249,7 +3271,6 @@ static int fastrpc_channel_open(struct fastrpc_file *fl) return err; } cid = fl->cid; - mutex_lock(&me->channel[cid].rpmsg_mutex); VERIFY(err, NULL != me->channel[cid].rpdev); if (err) { From af4f77ab21337d8a8ced1d9f3011ad5d6cddbe2a Mon Sep 17 00:00:00 2001 From: Manohar Vavilapalli Date: Thu, 28 May 2020 16:38:27 +0530 Subject: [PATCH 08/71] drivers: soc: sdx_ext_ipc: Add option to change default policy Current code sets default policy to PANIC. Add option to override it from device tree. Change-Id: I0bdfdf2fc7cebfab951bd8be91ea3d8cb4f280cd Signed-off-by: Manohar Vavilapalli --- Documentation/devicetree/bindings/arm/msm/sdx-ext-ipc.txt | 2 ++ drivers/soc/qcom/sdx_ext_ipc.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/msm/sdx-ext-ipc.txt b/Documentation/devicetree/bindings/arm/msm/sdx-ext-ipc.txt index 689c5b697fa5..e98f793b66d7 100644 --- a/Documentation/devicetree/bindings/arm/msm/sdx-ext-ipc.txt +++ b/Documentation/devicetree/bindings/arm/msm/sdx-ext-ipc.txt @@ -21,6 +21,8 @@ Optional named gpio properties: - qcom,ap2mdm-status2-gpio: gpio for APQ to indicate graceful shutdown to modem. +- qcom,default-policy-nop: Set default policy from PANIC to NOP. + Example: sdx_ext_ipc: qcom,sdx_ext_ipc { compatible = "qcom,sdx-ext-ipc"; diff --git a/drivers/soc/qcom/sdx_ext_ipc.c b/drivers/soc/qcom/sdx_ext_ipc.c index 9092aa8cf8f6..0118f4a33fa6 100644 --- a/drivers/soc/qcom/sdx_ext_ipc.c +++ b/drivers/soc/qcom/sdx_ext_ipc.c @@ -232,7 +232,10 @@ static int sdx_ext_ipc_probe(struct platform_device *pdev) mutex_init(&mdm->policy_lock); mutex_init(&mdm->e911_lock); - mdm->policy = SUBSYS_NOP; + if (of_property_read_bool(pdev->dev.of_node, "qcom,default-policy-nop")) + mdm->policy = SUBSYS_NOP; + else + mdm->policy = SUBSYS_PANIC; ret = device_create_file(mdm->dev, &dev_attr_policy); if (ret) { From 857094d551c398baecb9145a712577f0ebf7808a Mon Sep 17 00:00:00 2001 From: Manohar Vavilapalli Date: Fri, 12 Jun 2020 14:03:17 +0530 Subject: [PATCH 09/71] ARM: dts: msm: Enable sdx_ext_ipc and set policy to NOP in sa515m Enable sdx_ext_ipc node and add a property to set default policy from PANIC to NOP. Change-Id: I841b84085d84fd07c671a9fa6981fef1adc36045 Signed-off-by: Manohar Vavilapalli --- arch/arm64/boot/dts/qcom/sa515m-ccard-pcie-ep.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sa515m-ccard-pcie-ep.dts b/arch/arm64/boot/dts/qcom/sa515m-ccard-pcie-ep.dts index c33e8d9f17c1..81786435e82c 100644 --- a/arch/arm64/boot/dts/qcom/sa515m-ccard-pcie-ep.dts +++ b/arch/arm64/boot/dts/qcom/sa515m-ccard-pcie-ep.dts @@ -71,3 +71,8 @@ &usb { qcom,smmu-s1-bypass; }; + +&sdx_ext_ipc { + qcom,default-policy-nop; + status = "okay"; +}; From 02d283a541c25f06333185c72f1d45b19d666001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 6 May 2020 16:25:38 -0700 Subject: [PATCH 10/71] ANDROID: net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __bpf_skb_max_len(skb) is used from: bpf_skb_adjust_room __bpf_skb_change_tail __bpf_skb_change_head but in the case of forwarding we're likely calling these functions during receive processing on ingress and bpf_redirect()'ing at a later point in time to egress on another interface, thus these mtu checks are for the wrong device (input instead of output). This is particularly problematic if we're receiving on an L3 1500 mtu cellular interface, trying to add an L2 header and forwarding to an L3 mtu 1500 mtu wifi/ethernet device (which is thus L2 1514). The mtu check prevents us from adding the 14 byte ethernet header prior to forwarding the packet. After the packet has already been redirected, we'd need to add an additional 2nd ebpf program on the target device's egress tc hook, but then we'd also see non-redirected traffic and have no easy way to tell apart normal egress with ethernet header packets from forwarded ethernet headerless packets. Link: https://patchwork.ozlabs.org/project/netdev/patch/20200507023606.111650-1-zenczykowski@gmail.com/ But note that a more thorough solution will be pursued. CRs-Fixed: 2662725 Bug: 149816401 Change-Id: If55a144d7822e23bce85f65897bca7de4e0f9b24 Cc: Alexei Starovoitov Cc: Jakub Kicinski Signed-off-by: Maciej Żenczykowski Git-commit: 69eb478ff932476b208d2e7e97137ced5665fa04 Git-repo: https://android.googlesource.com/kernel/common/ Signed-off-by: Subash Abhinov Kasiviswanathan --- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index a3646230fbee..715c56a74246 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2281,6 +2281,8 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 len_diff) static u32 __bpf_skb_max_len(const struct sk_buff *skb) { + if (skb_at_tc_ingress(skb) || !skb->dev) + return SKB_MAX_ALLOC; return skb->dev->mtu + skb->dev->hard_header_len; } From 3fb9da1b388ed31ddac9659e0a5f015fa9871827 Mon Sep 17 00:00:00 2001 From: YUE CHEN Date: Fri, 12 Jun 2020 17:30:06 +0800 Subject: [PATCH 11/71] msm: ais: fix csid fatal error issue Move retain sw reg reset after enable csi2. Change-Id: I6de52fca7719c707c081a2e9eb392e61bf06c1d2 Signed-off-by: YUE CHEN --- .../ais/ais_isp/csid_hw/ais_ife_csid_core.c | 112 +++++++++--------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/drivers/media/platform/msm/ais/ais_isp/csid_hw/ais_ife_csid_core.c b/drivers/media/platform/msm/ais/ais_isp/csid_hw/ais_ife_csid_core.c index c1603049376b..dcdf3671faf4 100644 --- a/drivers/media/platform/msm/ais/ais_isp/csid_hw/ais_ife_csid_core.c +++ b/drivers/media/platform/msm/ais/ais_isp/csid_hw/ais_ife_csid_core.c @@ -1075,6 +1075,49 @@ static int ais_ife_csid_force_reset(void *hw_priv, return rc; } +static int ais_ife_csid_reset_retain_sw_reg( + struct ais_ife_csid_hw *csid_hw) +{ + int rc = 0; + uint32_t status; + const struct ais_ife_csid_reg_offset *csid_reg = + csid_hw->csid_info->csid_reg; + struct cam_hw_soc_info *soc_info; + + soc_info = &csid_hw->hw_info->soc_info; + /* clear the top interrupt first */ + cam_io_w_mb(1, soc_info->reg_map[0].mem_base + + csid_reg->cmn_reg->csid_top_irq_clear_addr); + cam_io_w_mb(1, soc_info->reg_map[0].mem_base + + csid_reg->cmn_reg->csid_irq_cmd_addr); + + usleep_range(3000, 3010); + + cam_io_w_mb(csid_reg->cmn_reg->csid_rst_stb, + soc_info->reg_map[0].mem_base + + csid_reg->cmn_reg->csid_rst_strobes_addr); + rc = readl_poll_timeout(soc_info->reg_map[0].mem_base + + csid_reg->cmn_reg->csid_top_irq_status_addr, + status, (status & 0x1) == 0x1, + AIS_IFE_CSID_TIMEOUT_SLEEP_US, AIS_IFE_CSID_TIMEOUT_ALL_US); + if (rc < 0) { + CAM_ERR(CAM_ISP, "CSID:%d csid_reset fail rc = %d", + csid_hw->hw_intf->hw_idx, rc); + rc = -ETIMEDOUT; + } else { + CAM_DBG(CAM_ISP, "CSID:%d hw reset completed %d", + csid_hw->hw_intf->hw_idx, rc); + rc = 0; + } + cam_io_w_mb(1, soc_info->reg_map[0].mem_base + + csid_reg->cmn_reg->csid_top_irq_clear_addr); + cam_io_w_mb(1, soc_info->reg_map[0].mem_base + + csid_reg->cmn_reg->csid_irq_cmd_addr); + + return rc; +} + + static int ais_ife_csid_reserve(void *hw_priv, void *reserve_args, uint32_t arg_size) { @@ -1083,6 +1126,7 @@ static int ais_ife_csid_reserve(void *hw_priv, struct cam_hw_info *csid_hw_info; struct ais_ife_rdi_init_args *rdi_cfg; const struct ais_ife_csid_reg_offset *csid_reg; + unsigned long flags; if (!hw_priv || !reserve_args || (arg_size != sizeof(struct ais_ife_rdi_init_args))) { @@ -1120,6 +1164,19 @@ static int ais_ife_csid_reserve(void *hw_priv, if (rc) goto end; + if (csid_hw->device_enabled == 0) { + rc = ais_ife_csid_reset_retain_sw_reg(csid_hw); + if (rc < 0) { + CAM_ERR(CAM_ISP, "CSID: Failed in SW reset"); + goto disable_csi2; + } else { + CAM_DBG(CAM_ISP, "CSID: SW reset Successful"); + spin_lock_irqsave(&csid_hw->lock_state, flags); + csid_hw->device_enabled = 1; + spin_unlock_irqrestore(&csid_hw->lock_state, flags); + } + } + rc = ais_ife_csid_config_rdi_path(csid_hw, rdi_cfg); if (rc) goto disable_csi2; @@ -1185,57 +1242,12 @@ end: return rc; } - -static int ais_ife_csid_reset_retain_sw_reg( - struct ais_ife_csid_hw *csid_hw) -{ - int rc = 0; - uint32_t status; - const struct ais_ife_csid_reg_offset *csid_reg = - csid_hw->csid_info->csid_reg; - struct cam_hw_soc_info *soc_info; - - soc_info = &csid_hw->hw_info->soc_info; - /* clear the top interrupt first */ - cam_io_w_mb(1, soc_info->reg_map[0].mem_base + - csid_reg->cmn_reg->csid_top_irq_clear_addr); - cam_io_w_mb(1, soc_info->reg_map[0].mem_base + - csid_reg->cmn_reg->csid_irq_cmd_addr); - - usleep_range(3000, 3010); - - cam_io_w_mb(csid_reg->cmn_reg->csid_rst_stb, - soc_info->reg_map[0].mem_base + - csid_reg->cmn_reg->csid_rst_strobes_addr); - rc = readl_poll_timeout(soc_info->reg_map[0].mem_base + - csid_reg->cmn_reg->csid_top_irq_status_addr, - status, (status & 0x1) == 0x1, - AIS_IFE_CSID_TIMEOUT_SLEEP_US, AIS_IFE_CSID_TIMEOUT_ALL_US); - if (rc < 0) { - CAM_ERR(CAM_ISP, "CSID:%d csid_reset fail rc = %d", - csid_hw->hw_intf->hw_idx, rc); - rc = -ETIMEDOUT; - } else { - CAM_DBG(CAM_ISP, "CSID:%d hw reset completed %d", - csid_hw->hw_intf->hw_idx, rc); - rc = 0; - } - cam_io_w_mb(1, soc_info->reg_map[0].mem_base + - csid_reg->cmn_reg->csid_top_irq_clear_addr); - cam_io_w_mb(1, soc_info->reg_map[0].mem_base + - csid_reg->cmn_reg->csid_irq_cmd_addr); - - return rc; -} - - static int ais_ife_csid_init_hw(void *hw_priv, void *init_args, uint32_t arg_size) { int rc = 0; struct ais_ife_csid_hw *csid_hw; struct cam_hw_info *csid_hw_info; - unsigned long flags; if (!hw_priv || !init_args || (arg_size != sizeof(struct ais_ife_rdi_init_args))) { @@ -1251,16 +1263,6 @@ static int ais_ife_csid_init_hw(void *hw_priv, /* Initialize the csid hardware */ rc = ais_ife_csid_enable_hw(csid_hw); - if (csid_hw->device_enabled == 0) { - rc = ais_ife_csid_reset_retain_sw_reg(csid_hw); - if (rc < 0) - CAM_ERR(CAM_ISP, "CSID: Failed in SW reset"); - } - - spin_lock_irqsave(&csid_hw->lock_state, flags); - csid_hw->device_enabled = 1; - spin_unlock_irqrestore(&csid_hw->lock_state, flags); - mutex_unlock(&csid_hw->hw_info->hw_mutex); CAM_DBG(CAM_ISP, "Exit (%d)", rc); From 1e25bb79c36c15721801fbf4c9fa7d0a4690dcb7 Mon Sep 17 00:00:00 2001 From: Shankar Ravi Date: Wed, 27 May 2020 18:42:13 +0530 Subject: [PATCH 12/71] msm: camera: csiphy: Clear secure phy flags on release Issue: Phy flags are set on CONFIG_DEV and are cleared on STOP_DEV. If release is called without stop dev, next session will be opened with incorrect phy configuration based on the previous stale secure mode flags. Fix: Clear the phy secure mode flags on RELEASE_DEV. Change-Id: If47a4084c3edbf2a8fb48d22b85c5d04fe878c50 Signed-off-by: Shankar Ravi --- .../cam_csiphy/cam_csiphy_core.c | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c index bb631c722d32..a53a6399b09e 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2020, 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 @@ -51,6 +51,12 @@ static int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev, return -EINVAL; } + CAM_INFO(CAM_CSIPHY, "PHY : %d offset: %d SEC: %d Mask: %d", + csiphy_dev->soc_info.index, + offset, + protect, + csiphy_dev->csiphy_cpas_cp_reg_mask[offset]); + return 0; } @@ -837,6 +843,7 @@ int32_t cam_csiphy_core_cfg(void *phy_dev, } break; case CAM_RELEASE_DEV: { + int32_t offset; struct cam_release_dev_cmd release; if (!csiphy_dev->acquire_count) { @@ -852,6 +859,23 @@ int32_t cam_csiphy_core_cfg(void *phy_dev, goto release_mutex; } + offset = cam_csiphy_get_instance_offset(csiphy_dev, + release.dev_handle); + if (offset < 0 || offset >= CSIPHY_MAX_INSTANCES) { + CAM_ERR(CAM_CSIPHY, "Invalid offset"); + goto release_mutex; + } + + if (csiphy_dev->csiphy_info.secure_mode[offset]) + cam_csiphy_notify_secure_mode( + csiphy_dev, + CAM_SECURE_MODE_NON_SECURE, offset); + + csiphy_dev->csiphy_info.secure_mode[offset] = + CAM_SECURE_MODE_NON_SECURE; + + csiphy_dev->csiphy_cpas_cp_reg_mask[offset] = 0x0; + rc = cam_destroy_device_hdl(release.dev_handle); if (rc < 0) CAM_ERR(CAM_CSIPHY, "destroying the device hdl"); From 400bfcec65b01ed5272a65ac40bbec283658d1d3 Mon Sep 17 00:00:00 2001 From: Shravya Samala Date: Fri, 15 May 2020 14:32:56 +0530 Subject: [PATCH 13/71] msm: camera: isp: Add trace event in case of irq delay detected Added trace event and called this trace when irq delay is detected. CRs-Fixed: 2688566 Change-Id: Ifcc27fca2db3d003edada46adf4cef28f8f9efcd Signed-off-by: Shravya Samala --- .../msm/camera/cam_isp/cam_isp_context.c | 56 ++++++++++++++++--- .../platform/msm/camera/cam_utils/cam_trace.h | 30 +++++++++- 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c index d96a23da3bb8..a5d63a6e88b1 100644 --- a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +++ b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c @@ -596,8 +596,14 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = done->irq_mono_boot_time; else if (ctx_isp->fps && ((done->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at buf_done", + ctx, req->request_id, + ctx_isp->substate_activated, + (done->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = done->irq_mono_boot_time; @@ -851,8 +857,14 @@ static int __cam_isp_ctx_reg_upd_in_epoch_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", + ctx, req->request_id, + ctx_isp->substate_activated, + (rup_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; return 0; @@ -906,8 +918,14 @@ static int __cam_isp_ctx_reg_upd_in_activated_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", + ctx, req->request_id, + ctx_isp->substate_activated, + (rup_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; end: @@ -1091,8 +1109,14 @@ static int __cam_isp_ctx_sof_in_activated_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((sof_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at sof", + ctx, req->request_id, + ctx_isp->substate_activated, + (sof_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; @@ -1138,8 +1162,14 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp, if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", + ctx, req->request_id, + ctx_isp->substate_activated, + (rup_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; end: @@ -1228,8 +1258,14 @@ end: ctx_isp->irq_timestamps = epoch_hw_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((epoch_hw_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at epoch", + ctx, req->request_id, + ctx_isp->substate_activated, + (epoch_hw_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = epoch_hw_event_data->irq_mono_boot_time; @@ -1268,8 +1304,14 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp, if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((sof_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; + trace_cam_isp_irq_delay_detect("IRQ delay at sof", + ctx, 0, + ctx_isp->substate_activated, + (sof_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); + } ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; diff --git a/drivers/media/platform/msm/camera/cam_utils/cam_trace.h b/drivers/media/platform/msm/camera/cam_utils/cam_trace.h index c8b1fb00c124..5e45127baf68 100644 --- a/drivers/media/platform/msm/camera/cam_utils/cam_trace.h +++ b/drivers/media/platform/msm/camera/cam_utils/cam_trace.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2020, 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 @@ -286,6 +286,34 @@ TRACE_EVENT(cam_irq_handled, ) ); +TRACE_EVENT(cam_isp_irq_delay_detect, + TP_PROTO(const char *text, struct cam_context *ctx, + uint64_t request_id, uint32_t substate, + uint64_t timestamp), + TP_ARGS(text, ctx, request_id, substate, timestamp), + TP_STRUCT__entry( + __string(text, text) + __field(uint32_t, ctx_id) + __field(uint64_t, dev_id) + __field(uint64_t, req_id) + __field(uint32_t, substate) + __field(uint64_t, ts) + ), + TP_fast_assign( + __assign_str(text, text); + __entry->ctx_id = ctx->ctx_id; + __entry->dev_id = ctx->dev_id; + __entry->req_id = request_id; + __entry->substate = substate; + __entry->ts = timestamp; + ), + TP_printk( + "ISP: %s ctx=%u dev_id=%u req_id=%lld substate=%u event=%u delay_by=%llu", + __get_str(text), __entry->ctx_id, __entry->dev_id, + __entry->req_id, __entry->substate, __entry->ts + ) +); + TRACE_EVENT(cam_cdm_cb, TP_PROTO(const char *entity, uint32_t status), TP_ARGS(entity, status), From bdc105e6c2e9eda306f3e4d80dc1d6944854c82c Mon Sep 17 00:00:00 2001 From: Aniket Randive Date: Wed, 10 Jun 2020 20:10:07 +0530 Subject: [PATCH 14/71] USB: gadget: Add a print for Boot marker KPI Add a info print in composite_resume function. To know the exact time when the USB device is coming out from suspend mode. Change-Id: Ia18dfa6fb73db48df62eec3faa60edc7341b86ce Signed-off-by: Aniket Randive --- drivers/usb/gadget/composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 88ebb9c27f26..73f1fd35e386 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -2431,7 +2431,7 @@ void composite_resume(struct usb_gadget *gadget) /* REVISIT: should we have config level * suspend/resume callbacks? */ - DBG(cdev, "resume\n"); + INFO(cdev, "USB Resume\n"); place_marker("M - USB device is resumed"); if (cdev->driver->resume) cdev->driver->resume(cdev); From b498b562cf39a761485664bd51d59c700c5d11de Mon Sep 17 00:00:00 2001 From: Om Parkash Date: Tue, 16 Jun 2020 10:28:51 +0530 Subject: [PATCH 15/71] ARM: dts: msm: Include camera sensor DTSi file for QCS410 Include camera sensor DTSi file for QCS410 Target Change-Id: Ie2a2c5981026e12b62ea87353c7ebd591449fda2 Signed-off-by: Om Parkash --- arch/arm64/boot/dts/qcom/qcs410-iot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/qcs410-iot.dtsi b/arch/arm64/boot/dts/qcom/qcs410-iot.dtsi index 96fb1d37b317..3144838fcefc 100644 --- a/arch/arm64/boot/dts/qcom/qcs410-iot.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs410-iot.dtsi @@ -14,6 +14,7 @@ #include #include #include "qcs410.dtsi" +#include "qcs610-camera-sensor-idp.dtsi" / { model = "Qualcomm Technologies, Inc. QCS410 IOT"; From bca0946befd35f93329c899d376bf2859549102a Mon Sep 17 00:00:00 2001 From: Mahesh Voorugonda Date: Sun, 14 Jun 2020 12:23:29 +0530 Subject: [PATCH 16/71] msm: vidc: Fix in deciding power mode Added maximum HQ load per core check to avoid sessions running in HQ more than supported. Change-Id: I027325684d6523126e5e9c71b89702a4c2272045 Signed-off-by: Mahesh Voorugonda --- .../media/platform/msm/vidc/msm_vidc_clocks.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/platform/msm/vidc/msm_vidc_clocks.c b/drivers/media/platform/msm/vidc/msm_vidc_clocks.c index 9d53d7f58ada..bf6141b6870d 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_clocks.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_clocks.c @@ -1454,7 +1454,11 @@ static inline int msm_vidc_power_save_mode_enable(struct msm_vidc_inst *inst, struct hfi_device *hdev = NULL; enum hal_perf_mode venc_mode; u32 rc_mode = 0; + u32 hq_mbs_per_sec = 0; + struct msm_vidc_core *core; + struct msm_vidc_inst *instance = NULL; + core = inst->core; hdev = inst->core->device; if (inst->session_type != MSM_VIDC_ENCODER) { dprintk(VIDC_DBG, @@ -1469,6 +1473,19 @@ static inline int msm_vidc_power_save_mode_enable(struct msm_vidc_inst *inst, mbs_per_sec > inst->core->resources.max_hq_mbs_per_sec) { enable = true; } + if (!enable) { + mutex_lock(&core->lock); + list_for_each_entry(instance, &core->instances, list) { + if (instance->clk_data.core_id && + !(instance->flags & VIDC_LOW_POWER)) + hq_mbs_per_sec += + msm_comm_get_inst_load_per_core( + instance, LOAD_CALC_NO_QUIRKS); + } + mutex_unlock(&core->lock); + if (hq_mbs_per_sec > inst->core->resources.max_hq_mbs_per_sec) + enable = true; + } /* Power saving always disabled for CQ RC mode. */ rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); From d9dbcb40b707ca2925c6b26f815e8dd25648721c Mon Sep 17 00:00:00 2001 From: raghavendra ambadas Date: Mon, 15 Jun 2020 14:26:36 +0530 Subject: [PATCH 17/71] fbdev: msm: call pxl clk unprepare during suspend Pxl clock needs to be un-prepared during device goes to suspend. This will avoid byte clk warning back-trace in the logs and failure to enable the clocks. Change-Id: Iab6649af34d0135475e05d86f6d8545d20869abb Signed-off-by: Raghavendra Ambadas --- drivers/video/fbdev/msm/mdss_dsi_clk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/msm/mdss_dsi_clk.c b/drivers/video/fbdev/msm/mdss_dsi_clk.c index bd0aefa0411e..c75fd7d08340 100644 --- a/drivers/video/fbdev/msm/mdss_dsi_clk.c +++ b/drivers/video/fbdev/msm/mdss_dsi_clk.c @@ -247,6 +247,7 @@ static int dsi_link_hs_clk_unprepare( if (link_hs_clks->byte_intf_clk) clk_unprepare(link_hs_clks->byte_intf_clk); + clk_unprepare(link_hs_clks->pixel_clk); clk_unprepare(link_hs_clks->byte_clk); return rc; From 91f301e070b606f702df8b70c10022f4141b04fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 23 Mar 2020 18:10:19 -0700 Subject: [PATCH 18/71] net-ipv6-ndisc: add support for 'PREF64' dns64 prefix identifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is trivial since we already have support for the entirely identical (from the kernel's point of view) RDNSS, DNSSL, etc. that also contain opaque data that needs to be passed down to userspace for further processing. As specified in draft-ietf-6man-ra-pref64-09 (while it is still a draft, it is purely waiting on the RFC Editor for cleanups and publishing): PREF64 option contains lifetime and a (up to) 96-bit IPv6 prefix. The 8-bit identifier of the option type as assigned by the IANA is 38. Since we lack DNS64/NAT64/CLAT support in kernel at the moment, thus this option should also be passed on to userland. See: https://tools.ietf.org/html/draft-ietf-6man-ra-pref64-09 https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5 CRs-fixed: 2708232 Change-Id: I5b43d07ad34b764fff259e4f0cad30c4396c6eb8 Cc: Erik Kline Cc: Jen Linkova Cc: Lorenzo Colitti Cc: Michael Haro Signed-off-by: Maciej Żenczykowski Acked-By: Lorenzo Colitti Git-commit: I02bff2103194a8171f907e82f811d7ab66962138 Git-repo: https://android.googlesource.com/kernel/common/ Signed-off-by: Chinmay Agarwal --- include/net/ndisc.h | 1 + net/ipv6/ndisc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/net/ndisc.h b/include/net/ndisc.h index d2a016ef5c41..35d7c887a5b9 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -39,6 +39,7 @@ enum { ND_OPT_DNSSL = 31, /* RFC6106 */ ND_OPT_6CO = 34, /* RFC6775 */ ND_OPT_CAPTIVE_PORTAL = 37, /* RFC7710 */ + ND_OPT_PREF64 = 38, /* RFC-ietf-6man-ra-pref64-09 */ __ND_OPT_MAX }; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 381708112f7d..2241c5f52394 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -197,6 +197,7 @@ static inline int ndisc_is_useropt(const struct net_device *dev, return opt->nd_opt_type == ND_OPT_RDNSS || opt->nd_opt_type == ND_OPT_DNSSL || opt->nd_opt_type == ND_OPT_CAPTIVE_PORTAL || + opt->nd_opt_type == ND_OPT_PREF64 || ndisc_ops_is_useropt(dev, opt->nd_opt_type); } From ee2cf687ae1d4c14f5744bc828f13572d02f0e12 Mon Sep 17 00:00:00 2001 From: Shashi Kant Maurya Date: Wed, 10 Jun 2020 15:49:55 +0530 Subject: [PATCH 19/71] ARM: dts: msm: Enable USB type-C analog audio on SDM660 Enabling USB type-C audio on SDM660. Change-Id: Ic63f3cd31a871dd6f5b53a85f4d0ece8b1cca9d7 Signed-off-by: Shashi Kant Maurya --- arch/arm64/boot/dts/qcom/Makefile | 5 +++- .../qcom/sdm660-usbc-audio-mtp-overlay.dts | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index c9af9a76daca..1d096793c0f0 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -434,7 +434,8 @@ ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) sdm660-rcm-internal-codec-overlay.dtbo \ sda660-mtp-external-codec-overlay.dtbo \ sda660-cdp-external-codec-overlay.dtbo \ - sda660-rcm-external-codec-overlay.dtbo + sda660-rcm-external-codec-overlay.dtbo \ + sdm660-usbc-audio-mtp-overlay.dtbo sdm660-mtp-external-codec-overlay.dtbo-base := sdm660-pm660l.dtb @@ -450,6 +451,8 @@ sdm660-rcm-external-codec-overlay.dtbo-base := sdm660-pm660l.dtb sdm660-rcm-internal-codec-overlay.dtbo-base := sdm660-pm660l.dtb +sdm660-usbc-audio-mtp-overlay.dtbo-base := sdm660-pm660l.dtb + sda660-mtp-external-codec-overlay.dtbo-base := sda660-pm660l.dtb sda660-cdp-external-codec-overlay.dtbo-base := sda660-pm660l.dtb diff --git a/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts b/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts new file mode 100644 index 000000000000..72dc5c277fd7 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts @@ -0,0 +1,29 @@ +/* Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; +#include + +#include "sdm660-mtp.dtsi" +#include "sdm660-external-codec.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM 660 Ext. USBC Audio Codec MTP"; + compatible = "qcom,sdm660-mtp", "qcom,sdm660", "qcom,mtp"; + qcom,board-id = <8 2>; +}; + +&tavil_snd { + qcom,msm-mbhc-usbc-audio-supported = <1>; + qcom,msm-mbhc-moist-cfg = <0>, <0>, <3>; +}; From ef57f3ada4176ee92b8bb766d77afe42dfc0faf2 Mon Sep 17 00:00:00 2001 From: Xiaowen Wu Date: Tue, 16 Jun 2020 08:33:44 -0400 Subject: [PATCH 20/71] ARM: dts: msm: remove default SA6155 DP pinctrl Remove default SA6155 DP pinctrl for ADP platform. Change-Id: I112660636110110afef42e164953c281d91180bd Signed-off-by: Xiaowen Wu --- arch/arm64/boot/dts/qcom/sa6155-display.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sa6155-display.dtsi b/arch/arm64/boot/dts/qcom/sa6155-display.dtsi index 429e6f5989ff..4556b60ff124 100644 --- a/arch/arm64/boot/dts/qcom/sa6155-display.dtsi +++ b/arch/arm64/boot/dts/qcom/sa6155-display.dtsi @@ -49,6 +49,7 @@ vdda-1p2-supply = <&pm6155_1_l11>; vdda-0p9-supply = <&pm6155_1_l5>; /delete-property/ qcom,dp-aux-switch; + /delete-property/ pinctrl-names; qcom,mst-enable; qcom,dp-aux-bridge-sim = <&sde_dp_mst_sim>; From a18713b4292476acf126c67795dd037f80517381 Mon Sep 17 00:00:00 2001 From: Akshay Pandit Date: Wed, 17 Jun 2020 00:16:01 +0530 Subject: [PATCH 21/71] arm64: dts: msm: Add dt entry for manual fw loading Add specific dt entry to denote fw loading is done manually by writing into ipa dev node. Change-Id: I52f9d28f92d44e7ae1fabe510b87bf75053358b0 Signed-off-by: Akshay Pandit --- Documentation/devicetree/bindings/platform/msm/ipa.txt | 1 + arch/arm64/boot/dts/qcom/sa8155-vm-la.dtsi | 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/platform/msm/ipa.txt b/Documentation/devicetree/bindings/platform/msm/ipa.txt index d3884063feb0..8746789098f8 100644 --- a/Documentation/devicetree/bindings/platform/msm/ipa.txt +++ b/Documentation/devicetree/bindings/platform/msm/ipa.txt @@ -115,6 +115,7 @@ memory allocation over a PCIe bridge 1 (override scm call as though it returned true), and 2 (override scm call as though it returned false) - qcom,use-xbl-boot: Boolean to indicate XBL boot loading for IPA FW +- qcom,manual-fw-load: Manually load ipa fws by writing 1 to ipa dev node IPA pipe sub nodes (A2 static pipes configurations): diff --git a/arch/arm64/boot/dts/qcom/sa8155-vm-la.dtsi b/arch/arm64/boot/dts/qcom/sa8155-vm-la.dtsi index f15391179db0..8a4394d75675 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-vm-la.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-vm-la.dtsi @@ -107,6 +107,7 @@ qcom,smmu-fast-map; qcom,use-ipa-pm; qcom,bandwidth-vote-for-ipa; + qcom,manual-fw-load; qcom,msm-bus,name = "ipa"; qcom,msm-bus,num-cases = <5>; qcom,msm-bus,num-paths = <4>; From 2959415b24ea1bc7ec583e9ad067b785a2850345 Mon Sep 17 00:00:00 2001 From: Lipsa Rout Date: Tue, 16 Jun 2020 18:17:02 +0530 Subject: [PATCH 22/71] ARM: dts: qcom: Add support for POMS on sim-video-panel This change adds support for panel operating mode switch on sim-video-panel. Change-Id: I7b16cc15fb98309e770d30804f22242b3d95afe0 Signed-off-by: Lipsa Rout --- arch/arm64/boot/dts/qcom/atoll-idp.dtsi | 6 +++ .../boot/dts/qcom/atoll-sde-display.dtsi | 6 +++ .../boot/dts/qcom/dsi-panel-sim-video.dtsi | 45 ++++++++++++++++++- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/atoll-idp.dtsi b/arch/arm64/boot/dts/qcom/atoll-idp.dtsi index 143134f50af7..896e2082cb4f 100644 --- a/arch/arm64/boot/dts/qcom/atoll-idp.dtsi +++ b/arch/arm64/boot/dts/qcom/atoll-idp.dtsi @@ -284,6 +284,12 @@ qcom,platform-reset-gpio = <&pm6150l_gpios 3 0>; }; +&dsi_sim_vid { + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,platform-reset-gpio = <&pm6150l_gpios 3 0>; +}; + &dsi_nt36672c_video { qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb>; qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; diff --git a/arch/arm64/boot/dts/qcom/atoll-sde-display.dtsi b/arch/arm64/boot/dts/qcom/atoll-sde-display.dtsi index 0c4320bcb3a0..c170bb13af74 100644 --- a/arch/arm64/boot/dts/qcom/atoll-sde-display.dtsi +++ b/arch/arm64/boot/dts/qcom/atoll-sde-display.dtsi @@ -293,6 +293,12 @@ <2 0 1>; qcom,default-topology-index = <0>; }; + timing@1{ + qcom,mdss-dsi-panel-phy-timings = [00 1c 07 07 23 21 07 + 07 05 02 04 00]; + qcom,display-topology = <1 0 1>; + qcom,default-topology-index = <0>; + }; }; }; diff --git a/arch/arm64/boot/dts/qcom/dsi-panel-sim-video.dtsi b/arch/arm64/boot/dts/qcom/dsi-panel-sim-video.dtsi index 40bedd0e462c..90dc3bf6bc56 100644 --- a/arch/arm64/boot/dts/qcom/dsi-panel-sim-video.dtsi +++ b/arch/arm64/boot/dts/qcom/dsi-panel-sim-video.dtsi @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, 2017-2020, 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 @@ -22,6 +22,7 @@ qcom,mdss-dsi-panel-hdr-enabled; qcom,mdss-dsi-panel-hdr-color-primaries = <14500 15500 32000 17000 15500 30000 8000 3000>; + qcom,mdss-dsi-panel-mode-switch; qcom,mdss-dsi-panel-peak-brightness = <4200000>; qcom,mdss-dsi-panel-blackness-level = <3230>; qcom,mdss-dsi-traffic-mode = "non_burst_sync_event"; @@ -37,9 +38,15 @@ qcom,mdss-dsi-mdp-trigger = "none"; qcom,mdss-dsi-reset-sequence = <1 0>, <0 0>, <1 0>; qcom,panel-ack-disabled; - + qcom,mdss-dsi-te-pin-select = <1>; + qcom,mdss-dsi-wr-mem-start = <0x2c>; + qcom,mdss-dsi-wr-mem-continue = <0x3c>; + qcom,mdss-dsi-te-dcs-command = <1>; + qcom,mdss-dsi-te-check-enable; + qcom,mdss-dsi-te-using-wd; qcom,mdss-dsi-display-timings { timing@0{ + qcom,mdss-dsi-video-mode; qcom,mdss-dsi-panel-width = <640>; qcom,mdss-dsi-panel-height = <480>; qcom,mdss-dsi-h-front-porch = <8>; @@ -63,6 +70,40 @@ qcom,mdss-dsi-on-command-state = "dsi_lp_mode"; qcom,mdss-dsi-off-command-state = "dsi_lp_mode"; qcom,mdss-dsi-h-sync-pulse = <0>; + qcom,cmd-to-video-mode-post-switch-commands = [ + 32 01 00 00 00 00 02 00 00]; + qcom,cmd-to-video-mode-post-switch-commands-state = + "dsi_lp_mode"; + }; + timing@1{ + qcom,mdss-dsi-cmd-mode; + qcom,mdss-dsi-panel-width = <640>; + qcom,mdss-dsi-panel-height = <480>; + qcom,mdss-dsi-h-front-porch = <8>; + qcom,mdss-dsi-h-back-porch = <8>; + qcom,mdss-dsi-h-pulse-width = <8>; + qcom,mdss-dsi-h-sync-skew = <0>; + qcom,mdss-dsi-v-back-porch = <6>; + qcom,mdss-dsi-v-front-porch = <6>; + qcom,mdss-dsi-v-pulse-width = <2>; + qcom,mdss-dsi-h-left-border = <0>; + qcom,mdss-dsi-h-right-border = <0>; + qcom,mdss-dsi-v-top-border = <0>; + qcom,mdss-dsi-v-bottom-border = <0>; + qcom,mdss-dsi-panel-framerate = <60>; + qcom,mdss-dsi-panel-timings = + [00 00 00 00 00 00 00 00 00 00 00 00]; + qcom,mdss-dsi-on-command = + [32 01 00 00 00 00 02 00 00]; + qcom,mdss-dsi-off-command = + [22 01 00 00 00 00 02 00 00]; + qcom,mdss-dsi-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-off-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-h-sync-pulse = <0>; + qcom,video-to-cmd-mode-post-switch-commands = [ + 32 01 00 00 00 00 02 00 00]; + qcom,video-to-cmd-mode-post-switch-commands-state = + "dsi_lp_mode"; }; }; }; From 07535729c9bfd2fd8eefe6098a8e9b09a6146054 Mon Sep 17 00:00:00 2001 From: Anurag Chouhan Date: Fri, 29 May 2020 16:41:08 +0530 Subject: [PATCH 23/71] soc: qcom: socinfo: Add support for QCM6125/QCS6125 soc-id Add socinfo support for QCM6125/QCS6125 Soc and update the bindings for the same. Change-Id: Ia2a9729e6b668559393c6660deca2da97f545c67 Signed-off-by: Anurag Chouhan --- Documentation/devicetree/bindings/arm/msm/msm.txt | 8 ++++++++ drivers/soc/qcom/socinfo.c | 12 ++++++++++++ include/soc/qcom/socinfo.h | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/msm/msm.txt b/Documentation/devicetree/bindings/arm/msm/msm.txt index 4624924fa639..76026a75d0cf 100644 --- a/Documentation/devicetree/bindings/arm/msm/msm.txt +++ b/Documentation/devicetree/bindings/arm/msm/msm.txt @@ -106,6 +106,12 @@ SoCs: - SDA429W compatible = "qcom,sda429w" +- QCM6125 + compatible = "qcom,qcm6125" + +- QCS6125 + compatible = "qcom,qcs6125" + Generic board variants: - CDP device: @@ -299,3 +305,5 @@ compatible = "qcom,sda429w-wdp" compatible = "qcom,sda429-wdp" compatible = "qcom,sdm429w-wdp" compatible = "qcom,sdm429-wdp" +compatible = "qcom,qcm6125" +compatible = "qcom,qcs6125" diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index c5a629686bf8..03a4c2214fe6 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -451,6 +451,10 @@ static struct msm_soc_info cpu_of_id[] = { [416] = {MSM_CPU_SDM429W, "SDM429W"}, [437] = {MSM_CPU_SDA429W, "SDA429W"}, + /* QCM6125 IDs*/ + [467] = {MSM_CPU_QCM6125, "QCM6125"}, + [468] = {MSM_CPU_QCS6125, "QCS6125"}, + /* Uninitialized IDs are not known to run Linux. * MSM_CPU_UNKNOWN is set to 0 to ensure these IDs are * considered as unknown CPU. @@ -1463,6 +1467,14 @@ static void * __init setup_dummy_socinfo(void) dummy_socinfo.id = 437; strlcpy(dummy_socinfo.build_id, "sda429w - ", sizeof(dummy_socinfo.build_id)); + } else if (early_machine_is_qcm6125()) { + dummy_socinfo.id = 467; + strlcpy(dummy_socinfo.build_id, "qcm6125 - ", + sizeof(dummy_socinfo.build_id)); + } else if (early_machine_is_qcs6125()) { + dummy_socinfo.id = 468; + strlcpy(dummy_socinfo.build_id, "qcm6125 - ", + sizeof(dummy_socinfo.build_id)); } else strlcat(dummy_socinfo.build_id, "Dummy socinfo", sizeof(dummy_socinfo.build_id)); diff --git a/include/soc/qcom/socinfo.h b/include/soc/qcom/socinfo.h index 2e316c5bb623..55dc5e9732c9 100644 --- a/include/soc/qcom/socinfo.h +++ b/include/soc/qcom/socinfo.h @@ -117,6 +117,10 @@ of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm429w") #define early_machine_is_sda429w() \ of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda429w") +#define early_machine_is_qcm6125() \ + of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcm6125") +#define early_machine_is_qcs6125() \ + of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs6125") #else #define of_board_is_sim() 0 #define of_board_is_rumi() 0 @@ -164,6 +168,8 @@ #define early_machine_is_sda660() 0 #define early_machine_is_sdm429w() 0 #define early_machine_is_sda429w() 0 +#define early_machine_is_qcm6125() 0 +#define early_machine_is_qcs6125() 0 #endif #define PLATFORM_SUBTYPE_MDM 1 @@ -214,6 +220,8 @@ enum msm_cpu { MSM_CPU_SDA660, MSM_CPU_SDM429W, MSM_CPU_SDA429W, + MSM_CPU_QCM6125, + MSM_CPU_QCS6125, }; struct msm_soc_info { From d9d0de39ae72d4c4c77a0e09992e09d18c08fe92 Mon Sep 17 00:00:00 2001 From: Anurag Chouhan Date: Fri, 29 May 2020 16:48:22 +0530 Subject: [PATCH 24/71] ARM: dts: msm: Add initial dts support for QCM6125 Add initial device tree files to support QCM6125/QCS6125. Change-Id: I8fd1716262070c84565614c0674985a611e78088 Signed-off-by: Anurag Chouhan --- arch/arm64/boot/dts/qcom/Makefile | 10 ++++++-- .../boot/dts/qcom/qcm6125-iot-idp-overlay.dts | 25 +++++++++++++++++++ arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts | 23 +++++++++++++++++ arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi | 13 ++++++++++ arch/arm64/boot/dts/qcom/qcm6125.dts | 22 ++++++++++++++++ arch/arm64/boot/dts/qcom/qcm6125.dtsi | 21 ++++++++++++++++ .../boot/dts/qcom/qcs6125-iot-idp-overlay.dts | 25 +++++++++++++++++++ arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts | 23 +++++++++++++++++ arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi | 13 ++++++++++ arch/arm64/boot/dts/qcom/qcs6125.dts | 22 ++++++++++++++++ arch/arm64/boot/dts/qcom/qcs6125.dtsi | 21 ++++++++++++++++ 11 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts create mode 100644 arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts create mode 100644 arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi create mode 100644 arch/arm64/boot/dts/qcom/qcm6125.dts create mode 100644 arch/arm64/boot/dts/qcom/qcm6125.dtsi create mode 100644 arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts create mode 100644 arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts create mode 100644 arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi create mode 100644 arch/arm64/boot/dts/qcom/qcs6125.dts create mode 100644 arch/arm64/boot/dts/qcom/qcs6125.dtsi diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index c9af9a76daca..433fac54197d 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -319,7 +319,9 @@ ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) trinket-external-codec-idp-overlay.dtbo \ trinket-usbc-external-codec-idp-overlay.dtbo \ trinket-usbc-idp-overlay.dtbo \ - trinket-dp-idp-overlay.dtbo + trinket-dp-idp-overlay.dtbo \ + qcm6125-iot-idp-overlay.dtbo \ + qcs6125-iot-idp-overlay.dtbo trinket-rumi-overlay.dtbo-base := trinket.dtb trinket-idp-overlay.dtbo-base := trinket.dtb @@ -328,6 +330,8 @@ trinket-external-codec-idp-overlay.dtbo-base := trinket.dtb trinket-usbc-external-codec-idp-overlay.dtbo-base := trinket.dtb trinket-usbc-idp-overlay.dtbo-base := trinket.dtb trinket-dp-idp-overlay.dtbo-base := trinket.dtb +qcm6125-iot-idp-overlay.dtbo-base := qcm6125.dtb +qcs6125-iot-idp-overlay.dtbo-base := qcs6125.dtb else dtb-$(CONFIG_ARCH_TRINKET) += trinket-rumi.dtb \ trinket-idp.dtb \ @@ -335,7 +339,9 @@ dtb-$(CONFIG_ARCH_TRINKET) += trinket-rumi.dtb \ trinket-external-codec-idp.dtb \ trinket-usbc-external-codec-idp.dtb \ trinket-usbc-idp.dtb \ - trinket-dp-idp.dtb + trinket-dp-idp.dtb \ + qcm6125-iot-idp.dtb \ + qcs6125-iot-idp.dtb endif ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts new file mode 100644 index 000000000000..936473fcec4b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include "qcm6125-iot-idp.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCM6125 IOT IDP Overlay"; + compatible = "qcom,qcm6125"; + qcom,msm-id = <467 0x10000>; + qcom,board-id = <34 0>; +}; + diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts new file mode 100644 index 000000000000..37f06e2c3f46 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +#include "qcm6125.dtsi" +#include "qcm6125-iot-idp.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCM6125 IOT IDP SoC"; + compatible = "qcom,qcm6125"; + qcom,board-id = <34 0>; +}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi new file mode 100644 index 000000000000..6d198b235fbc --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include "trinket-idp.dtsi" diff --git a/arch/arm64/boot/dts/qcom/qcm6125.dts b/arch/arm64/boot/dts/qcom/qcm6125.dts new file mode 100644 index 000000000000..4e31d2849dc3 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcm6125.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +#include "qcm6125.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCM6125 IOT IDP SoC"; + compatible = "qcom,qcm6125"; + qcom,board-id = <0 0>; +}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125.dtsi b/arch/arm64/boot/dts/qcom/qcm6125.dtsi new file mode 100644 index 000000000000..dca459b90404 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcm6125.dtsi @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "trinket.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCM6125"; + compatible = "qcom,qcm6125"; + qcom,msm-id = <467 0x0>; + qcom,msm-name = "QCM6125"; +}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts new file mode 100644 index 000000000000..8b80605046e5 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include "qcs6125-iot-idp.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCS6125 IOT IDP Overlay"; + compatible = "qcom,qcs6125"; + qcom,msm-id = <468 0x10000>; + qcom,board-id = <34 0>; +}; + diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts new file mode 100644 index 000000000000..4eaa9b6ccccb --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +#include "qcs6125.dtsi" +#include "qcs6125-iot-idp.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCS6125 IOT IDP SoC"; + compatible = "qcom,qcs6125"; + qcom,board-id = <34 0>; +}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi new file mode 100644 index 000000000000..6d198b235fbc --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include "trinket-idp.dtsi" diff --git a/arch/arm64/boot/dts/qcom/qcs6125.dts b/arch/arm64/boot/dts/qcom/qcs6125.dts new file mode 100644 index 000000000000..c2ac4473ee4b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcs6125.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +#include "qcs6125.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCS6125 SoC"; + compatible = "qcom,qcs6125"; + qcom,board-id = <0 0>; +}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125.dtsi b/arch/arm64/boot/dts/qcom/qcs6125.dtsi new file mode 100644 index 000000000000..aed91a655019 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/qcs6125.dtsi @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "trinket.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. QCS6125"; + compatible = "qcom,qcs6125"; + qcom,msm-id = <468 0x0>; + qcom,msm-name = "QCS6125"; +}; From 002ee55e71c2a14c30d320482c5c9939399829d0 Mon Sep 17 00:00:00 2001 From: Om Parkash Date: Wed, 17 Jun 2020 12:55:07 +0530 Subject: [PATCH 25/71] msm: camera: Allow applying request if congestion comes Sometimes, due to DDR write delays, bufdone gets delyed. It affect applying new request. This change allow applying request if congestion comes. Change-Id: I064d88588f7de68737aec143bd5d3ea5adbc9da6 Signed-off-by: Om Parkash --- drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c index d96a23da3bb8..12386e4c7c7c 100644 --- a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +++ b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c @@ -2088,7 +2088,7 @@ static int __cam_isp_ctx_apply_req_in_activated_state( req->request_id, ctx_isp->substate_activated, ctx->ctx_id); req_isp = (struct cam_isp_ctx_req *) req->req_priv; - if (ctx_isp->active_req_cnt >= 2) { + if (ctx_isp->active_req_cnt >= 4) { CAM_ERR_RATE_LIMIT(CAM_ISP, "Reject apply request (id %lld) due to congestion(cnt = %d) ctx %u", req->request_id, From 32483be0f46c8fd310c5dddc810c35686f2555d2 Mon Sep 17 00:00:00 2001 From: Avaneesh Kumar Dwivedi Date: Mon, 4 May 2020 19:10:34 +0530 Subject: [PATCH 26/71] ARM: dts: msm: Bring all board specific changes to common file for QCS610 For supporting device tree overlay on QCS610, need to align overlay device tree with normal device tree changes, hence bringing non SoC specific changes to common file. Change-Id: I3632a6a50665e2e399a11ee65813c6d96cf44308 Signed-off-by: Avaneesh Kumar Dwivedi Signed-off-by: Anurag Chouhan --- arch/arm64/boot/dts/qcom/Makefile | 6 ++--- .../boot/dts/qcom/qcs610-iot-overlay.dts | 4 ++-- arch/arm64/boot/dts/qcom/qcs610-iot.dts | 8 ++----- arch/arm64/boot/dts/qcom/qcs610-iot.dtsi | 23 ++++++++++++++++++- .../boot/dts/qcom/qcs610-ipc-overlay.dts | 4 ++-- arch/arm64/boot/dts/qcom/qcs610-ipc.dts | 4 +++- arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi | 1 - arch/arm64/boot/dts/qcom/qcs610.dtsi | 12 +--------- 8 files changed, 35 insertions(+), 27 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index c9af9a76daca..84ce4fe46aab 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -250,9 +250,9 @@ sa6155p-v2-adp-star-overlay.dtbo-base := sa6155p.dtb sa6155-adp-air-overlay.dtbo-base := sa6155.dtb sa6155p-adp-air-overlay.dtbo-base := sa6155p.dtb sa6155p-v2-adp-air-overlay.dtbo-base := sa6155p.dtb -qcs610-iot-overlay.dtbo-base := sm6150.dtb -qcs610-ipc-overlay.dtbo-base := sm6150.dtb -qcs410-iot-overlay.dtbo-base := sm6150.dtb +qcs610-iot-overlay.dtbo-base := qcs610.dtb +qcs610-ipc-overlay.dtbo-base := qcs610.dtb +qcs410-iot-overlay.dtbo-base := qcs410.dtb else dtb-$(CONFIG_ARCH_SM6150) += sm6150-rumi.dtb \ sm6150-qrd.dtb \ diff --git a/arch/arm64/boot/dts/qcom/qcs610-iot-overlay.dts b/arch/arm64/boot/dts/qcom/qcs610-iot-overlay.dts index 0c740154ee48..33c3fcaa7fe1 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-iot-overlay.dts +++ b/arch/arm64/boot/dts/qcom/qcs610-iot-overlay.dts @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, 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 @@ -18,7 +18,7 @@ #include "qcs610-iot.dtsi" / { - model = "IOT"; + model = "Qualcomm Technologies, Inc. QCS610 IOT Overlay"; compatible = "qcom,qcs610-iot", "qcom,qcs610", "qcom,iot"; qcom,msm-id = <401 0x0>; qcom,board-id = <32 0>; diff --git a/arch/arm64/boot/dts/qcom/qcs610-iot.dts b/arch/arm64/boot/dts/qcom/qcs610-iot.dts index 76fd007b5f56..a0a6c723d172 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-iot.dts +++ b/arch/arm64/boot/dts/qcom/qcs610-iot.dts @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, 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 @@ -11,7 +11,7 @@ */ /dts-v1/; - +#include "qcs610.dtsi" #include "qcs610-iot.dtsi" #include "sm6150-audio-overlay.dtsi" @@ -20,7 +20,3 @@ compatible = "qcom,qcs610-iot", "qcom,qcs610", "qcom,iot"; qcom,board-id = <32 0>; }; - -&sm6150_snd { - /delete-property/ fsa4480-i2c-handle; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi b/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi index 63a8139732ba..6c1d8c88de2a 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi @@ -13,7 +13,14 @@ #include #include #include -#include "qcs610.dtsi" + +#include +#include +#include +#include +#include +#include + #include "sm6150-sde.dtsi" #include "sm6150-sde-pll.dtsi" #include "sm6150-sde-display.dtsi" @@ -25,6 +32,20 @@ qcom,board-id = <32 0>; }; +&soc { + qcom,rmnet-ipa { + status="disabled"; + }; +}; + +&ipa_hw { + status="disabled"; +}; + +&sm6150_snd { + /delete-property/ fsa4480-i2c-handle; +}; + &qupv3_se3_i2c { status = "ok"; #include "smb1390.dtsi" diff --git a/arch/arm64/boot/dts/qcom/qcs610-ipc-overlay.dts b/arch/arm64/boot/dts/qcom/qcs610-ipc-overlay.dts index dd232536ca97..df10995071fe 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-ipc-overlay.dts +++ b/arch/arm64/boot/dts/qcom/qcs610-ipc-overlay.dts @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, 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 @@ -18,7 +18,7 @@ #include "qcs610-ipc.dtsi" / { - model = "IOT"; + model = "Qualcomm Technologies, Inc. QCS610 IOT IPC"; compatible = "qcom,qcs610-iot", "qcom,qcs610", "qcom,iot"; qcom,msm-id = <401 0x0>; qcom,board-id = <32 1>; diff --git a/arch/arm64/boot/dts/qcom/qcs610-ipc.dts b/arch/arm64/boot/dts/qcom/qcs610-ipc.dts index f8722b0addd9..aa9b6439e0b3 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-ipc.dts +++ b/arch/arm64/boot/dts/qcom/qcs610-ipc.dts @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, 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 @@ -12,6 +12,8 @@ /dts-v1/; +#include "qcs610.dtsi" +#include "qcs610-iot.dtsi" #include "qcs610-ipc.dtsi" / { diff --git a/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi b/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi index 15cbf635b989..87c198d211ec 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi @@ -10,7 +10,6 @@ * GNU General Public License for more details. */ -#include "qcs610-iot.dtsi" #include "sm6150-audio-overlay.dtsi" #include "sm6150-camera-sensor-idp.dtsi" / { diff --git a/arch/arm64/boot/dts/qcom/qcs610.dtsi b/arch/arm64/boot/dts/qcom/qcs610.dtsi index dfdbba966d75..8d1fc6080003 100644 --- a/arch/arm64/boot/dts/qcom/qcs610.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs610.dtsi @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, 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 @@ -17,13 +17,3 @@ qcom,msm-name = "QCS610"; qcom,msm-id = <401 0>; }; - -&soc { - qcom,rmnet-ipa { - status="disabled"; - }; -}; - -&ipa_hw { - status="disabled"; -}; From 9f927c9d3dbb4a06ac326059d4fde8838fe49ee2 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Mon, 2 Sep 2019 17:17:58 -0700 Subject: [PATCH 27/71] ARM: dts: sm8150: Add measured OPP capacities to the EAS energy model Values calculated using SBanalyze (my WIP benchmark analysis script) and data gathered from an in-kernel RC4 benchmark. Performance values were averaged across 4 CPUs which were running the benchmark simultaneously. The highest difference between the automatic frequency-based capacities and our new measured capacities was found to be 1.6%. Signed-off-by: Danny Lin Signed-off-by: UtsavBalar1231 --- arch/arm64/boot/dts/qcom/sm8150-v2.dtsi | 222 ++++++++++++------------ 1 file changed, 110 insertions(+), 112 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm8150-v2.dtsi b/arch/arm64/boot/dts/qcom/sm8150-v2.dtsi index d9da79994ba1..2b15cb252c59 100644 --- a/arch/arm64/boot/dts/qcom/sm8150-v2.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150-v2.dtsi @@ -433,24 +433,24 @@ &energy_costs { CPU_COST_0: core-cost0 { busy-cost-data = < - 300000 24 - 403200 25 - 499200 27 - 576000 29 - 672000 33 - 768000 37 - 844800 42 - 940800 47 - 1036800 54 - 1113600 59 - 1209600 66 - 1305600 73 - 1382400 79 - 1478400 88 - 1555200 96 - 1632000 105 - 1708800 115 - 1785600 128 + 46 24 + 63 25 + 78 27 + 90 29 + 105 33 + 120 37 + 132 42 + 147 47 + 162 54 + 174 59 + 189 66 + 204 73 + 217 79 + 232 88 + 244 96 + 256 105 + 268 115 + 280 128 >; idle-cost-data = < 18 14 12 @@ -459,23 +459,23 @@ CPU_COST_1: core-cost1 { busy-cost-data = < - 710400 165 - 825600 195 - 940800 228 - 1056000 264 - 1171200 301 - 1286400 339 - 1401600 378 - 1497600 411 - 1612800 453 - 1708800 491 - 1804800 534 - 1920000 594 - 2016000 654 - 2131200 740 - 2227200 825 - 2323200 920 - 2419200 1022 + 252 165 + 297 195 + 338 228 + 380 264 + 422 301 + 463 339 + 505 378 + 539 411 + 581 453 + 615 491 + 650 534 + 692 594 + 726 654 + 768 740 + 802 825 + 837 920 + 872 1022 >; idle-cost-data = < 80 60 40 @@ -484,27 +484,26 @@ CPU_COST_2: core-cost2 { busy-cost-data = < - 825600 227 - 940800 262 - 1056000 302 - 1171200 348 - 1286400 398 - 1401600 451 - 1497600 498 - 1612800 556 - 1708800 606 - 1804800 655 - 1920000 716 - 2016000 766 - 2131200 826 - 2227200 878 - 2323200 933 - 2419200 992 - 2534400 1075 - 2649600 1179 - 2745600 1288 - 2841600 1427 - 2956800 1670 + 297 227 + 338 262 + 380 302 + 421 348 + 463 398 + 504 451 + 539 498 + 581 556 + 615 606 + 650 655 + 691 716 + 726 766 + 767 826 + 802 878 + 837 933 + 871 992 + 913 1075 + 954 1179 + 989 1288 + 1024 1427 >; idle-cost-data = < 110 90 70 @@ -513,24 +512,24 @@ CLUSTER_COST_0: cluster-cost0 { busy-cost-data = < - 300000 3 - 403200 4 - 499200 4 - 576000 4 - 672000 5 - 768000 5 - 844800 6 - 940800 7 - 1036800 8 - 1113600 9 - 1209600 10 - 1305600 11 - 1382400 12 - 1478400 13 - 1555200 14 - 1632000 15 - 1708800 16 - 1785600 17 + 46 3 + 63 4 + 78 4 + 90 4 + 105 5 + 120 5 + 132 6 + 147 7 + 162 8 + 174 9 + 189 10 + 204 11 + 217 12 + 232 13 + 244 14 + 256 15 + 268 16 + 280 17 >; idle-cost-data = < 3 2 1 @@ -539,23 +538,23 @@ CLUSTER_COST_1: cluster-cost1 { busy-cost-data = < - 710400 25 - 825600 26 - 940800 27 - 1056000 28 - 1171200 29 - 1286400 30 - 1401600 32 - 1497600 34 - 1612800 37 - 1708800 40 - 1804800 45 - 1920000 50 - 2016000 57 - 2131200 64 - 2227200 74 - 2323200 90 - 2419200 106 + 252 25 + 297 26 + 338 27 + 380 28 + 422 29 + 463 30 + 505 32 + 539 34 + 581 37 + 615 40 + 650 45 + 692 50 + 726 57 + 768 64 + 802 74 + 837 90 + 872 106 >; idle-cost-data = < 3 2 1 @@ -564,27 +563,26 @@ CLUSTER_COST_2: cluster-cost2 { busy-cost-data = < - 825600 30 - 940800 33 - 1056000 36 - 1171200 39 - 1286400 42 - 1401600 46 - 1497600 49 - 1612800 55 - 1708800 67 - 1804800 77 - 1920000 87 - 2016000 100 - 2131200 110 - 2227200 120 - 2323200 128 - 2419200 135 - 2534400 140 - 2649600 147 - 2745600 160 - 2841600 180 - 2956800 197 + 297 30 + 338 33 + 380 36 + 421 39 + 463 42 + 504 46 + 539 49 + 581 55 + 615 67 + 650 77 + 691 87 + 726 100 + 767 110 + 802 120 + 837 128 + 871 135 + 913 140 + 954 147 + 989 160 + 1024 180 >; idle-cost-data = < 3 2 1 From ee88128cd58a13141225bf78e2994ee622c4febd Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Tue, 17 Sep 2019 19:47:13 -0700 Subject: [PATCH 28/71] ARM: dts: sm8150: Correct off-by-one error for little CPU capacity Turns out that this calculation *shouldn't* follow normal CPU integer math characteristics (i.e. rounding down) and should instead be rounded using the usual 0.5 threshold. Fixes the following error: [ 0.695316] sched-energy: CPU0 max energy model capacity=280 != cpu_scale=279 [ 0.695331] sched-energy: CPU1 max energy model capacity=280 != cpu_scale=279 [ 0.695343] sched-energy: CPU2 max energy model capacity=280 != cpu_scale=279 [ 0.695354] sched-energy: CPU3 max energy model capacity=280 != cpu_scale=279 Signed-off-by: Danny Lin Signed-off-by: UtsavBalar1231 --- arch/arm64/boot/dts/qcom/sm8150.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi index 8036c579318f..031f35356494 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -75,7 +75,7 @@ compatible = "arm,armv8"; reg = <0x0 0x0>; enable-method = "psci"; - capacity-dmips-mhz = <445>; + capacity-dmips-mhz = <446>; next-level-cache = <&L2_0>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -111,7 +111,7 @@ compatible = "arm,armv8"; reg = <0x0 0x100>; enable-method = "psci"; - capacity-dmips-mhz = <445>; + capacity-dmips-mhz = <446>; next-level-cache = <&L2_1>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -142,7 +142,7 @@ compatible = "arm,armv8"; reg = <0x0 0x200>; enable-method = "psci"; - capacity-dmips-mhz = <445>; + capacity-dmips-mhz = <446>; next-level-cache = <&L2_2>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -173,7 +173,7 @@ compatible = "arm,armv8"; reg = <0x0 0x300>; enable-method = "psci"; - capacity-dmips-mhz = <445>; + capacity-dmips-mhz = <446>; next-level-cache = <&L2_3>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; From 3af005bd0cb9b15c5679583a60b2886c01c1fd51 Mon Sep 17 00:00:00 2001 From: grislux55 Date: Sat, 22 Feb 2020 21:54:59 +0800 Subject: [PATCH 29/71] ARM: dts: sm8150: Correct off-by-one error for big CPU capacity Turns out that this calculation *shouldn't* follow normal CPU integer math characteristics (i.e. rounding down) and should instead be rounded using the usual 0.5 threshold. Fixes the following error: [ 0.288579] sched-energy: CPU4 max energy model capacity=872 != cpu_scale=871 [ 0.288593] sched-energy: CPU5 max energy model capacity=872 != cpu_scale=871 [ 0.288603] sched-energy: CPU6 max energy model capacity=872 != cpu_scale=871 Signed-off-by: grislux55 Signed-off-by: UtsavBalar1231 --- arch/arm64/boot/dts/qcom/sm8150.dtsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi index 031f35356494..724c1dd8e2b6 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -75,7 +75,7 @@ compatible = "arm,armv8"; reg = <0x0 0x0>; enable-method = "psci"; - capacity-dmips-mhz = <446>; + capacity-dmips-mhz = <447>; next-level-cache = <&L2_0>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -111,7 +111,7 @@ compatible = "arm,armv8"; reg = <0x0 0x100>; enable-method = "psci"; - capacity-dmips-mhz = <446>; + capacity-dmips-mhz = <447>; next-level-cache = <&L2_1>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -142,7 +142,7 @@ compatible = "arm,armv8"; reg = <0x0 0x200>; enable-method = "psci"; - capacity-dmips-mhz = <446>; + capacity-dmips-mhz = <447>; next-level-cache = <&L2_2>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -173,7 +173,7 @@ compatible = "arm,armv8"; reg = <0x0 0x300>; enable-method = "psci"; - capacity-dmips-mhz = <446>; + capacity-dmips-mhz = <447>; next-level-cache = <&L2_3>; sched-energy-costs = <&CPU_COST_0 &CLUSTER_COST_0>; qcom,lmh-dcvs = <&lmh_dcvs0>; @@ -204,7 +204,7 @@ compatible = "arm,armv8"; reg = <0x0 0x400>; enable-method = "psci"; - capacity-dmips-mhz = <1024>; + capacity-dmips-mhz = <1025>; next-level-cache = <&L2_4>; sched-energy-costs = <&CPU_COST_1 &CLUSTER_COST_1>; qcom,lmh-dcvs = <&lmh_dcvs1>; @@ -244,7 +244,7 @@ compatible = "arm,armv8"; reg = <0x0 0x500>; enable-method = "psci"; - capacity-dmips-mhz = <1024>; + capacity-dmips-mhz = <1025>; next-level-cache = <&L2_5>; sched-energy-costs = <&CPU_COST_1 &CLUSTER_COST_1>; qcom,lmh-dcvs = <&lmh_dcvs1>; @@ -284,7 +284,7 @@ compatible = "arm,armv8"; reg = <0x0 0x600>; enable-method = "psci"; - capacity-dmips-mhz = <1024>; + capacity-dmips-mhz = <1025>; next-level-cache = <&L2_6>; sched-energy-costs = <&CPU_COST_1 &CLUSTER_COST_1>; qcom,lmh-dcvs = <&lmh_dcvs1>; From 26ddca32d0a107f70496732dc70b69023ab8d8ad Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Thu, 29 Aug 2019 00:23:03 -0700 Subject: [PATCH 30/71] sched/energy: Check out to Android 4.14 common kernel To fix CAF's breakage. Signed-off-by: Danny Lin Signed-off-by: UtsavBalar1231 --- kernel/sched/energy.c | 99 +++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 59 deletions(-) diff --git a/kernel/sched/energy.c b/kernel/sched/energy.c index b4764309dac4..8342de041e11 100644 --- a/kernel/sched/energy.c +++ b/kernel/sched/energy.c @@ -51,6 +51,7 @@ static void free_resources(void) } } static bool sge_ready; +static bool freq_energy_model; void check_max_cap_vs_cpu_scale(int cpu, struct sched_group_energy *sge) { @@ -62,7 +63,7 @@ void check_max_cap_vs_cpu_scale(int cpu, struct sched_group_energy *sge) if (max_cap == cpu_scale) return; - pr_debug("CPU%d max energy model capacity=%ld != cpu_scale=%ld\n", cpu, + pr_warn("CPU%d max energy model capacity=%ld != cpu_scale=%ld\n", cpu, max_cap, cpu_scale); } @@ -76,9 +77,6 @@ void init_sched_energy_costs(void) int sd_level, i, nstates, cpu; const __be32 *val; - if (!sched_is_energy_aware()) - return; - for_each_possible_cpu(cpu) { cn = of_get_cpu_node(cpu, NULL); if (!cn) { @@ -90,6 +88,9 @@ void init_sched_energy_costs(void) pr_warn("CPU device node has no sched-energy-costs\n"); return; } + /* Check if the energy model contains frequency/power values */ + if (of_find_property(cn, "freq-energy-model", NULL)) + freq_energy_model = true; for_each_possible_sd_level(sd_level) { cp = of_parse_phandle(cn, "sched-energy-costs", sd_level); @@ -104,21 +105,25 @@ void init_sched_energy_costs(void) sge = kcalloc(1, sizeof(struct sched_group_energy), GFP_NOWAIT); - if (!sge) - goto out; nstates = (prop->length / sizeof(u32)) / 2; cap_states = kcalloc(nstates, sizeof(struct capacity_state), GFP_NOWAIT); - if (!cap_states) { - kfree(sge); - goto out; - } for (i = 0, val = prop->value; i < nstates; i++) { - cap_states[i].cap = SCHED_CAPACITY_SCALE; - cap_states[i].frequency = be32_to_cpup(val++); + if (freq_energy_model) { + /* + * Capacity values will be calculated later using + * frequency reported by OPP driver and cpu_uarch_scale + * values. + */ + cap_states[i].frequency = be32_to_cpup(val++); + cap_states[i].cap = 0; + } else { + cap_states[i].frequency = 0; + cap_states[i].cap = be32_to_cpup(val++); + } cap_states[i].power = be32_to_cpup(val++); } @@ -128,8 +133,6 @@ void init_sched_energy_costs(void) prop = of_find_property(cp, "idle-cost-data", NULL); if (!prop || !prop->value) { pr_warn("No idle-cost data, skipping sched_energy init\n"); - kfree(sge); - kfree(cap_states); goto out; } @@ -137,11 +140,6 @@ void init_sched_energy_costs(void) idle_states = kcalloc(nstates, sizeof(struct idle_state), GFP_NOWAIT); - if (!idle_states) { - kfree(sge); - kfree(cap_states); - goto out; - } for (i = 0, val = prop->value; i < nstates; i++) idle_states[i].power = be32_to_cpup(val++); @@ -151,10 +149,9 @@ void init_sched_energy_costs(void) sge_array[cpu][sd_level] = sge; } - - check_max_cap_vs_cpu_scale(cpu, sge_array[cpu][SD_LEVEL0]); + if (!freq_energy_model) + check_max_cap_vs_cpu_scale(cpu, sge_array[cpu][SD_LEVEL0]); } - sge_ready = true; pr_info("Sched-energy-costs installed from DT\n"); return; @@ -165,17 +162,16 @@ out: static int sched_energy_probe(struct platform_device *pdev) { - unsigned long max_freq = 0; - int max_efficiency = INT_MIN; int cpu; unsigned long *max_frequencies = NULL; int ret; - if (!sched_is_energy_aware()) - return 0; if (!sge_ready) return -EPROBE_DEFER; + if (!energy_aware() || !freq_energy_model) + return 0; + max_frequencies = kmalloc_array(nr_cpu_ids, sizeof(unsigned long), GFP_KERNEL); if (!max_frequencies) { @@ -190,9 +186,6 @@ static int sched_energy_probe(struct platform_device *pdev) for_each_possible_cpu(cpu) { struct device *cpu_dev; struct dev_pm_opp *opp; - int efficiency = topology_get_cpu_efficiency(cpu); - - max_efficiency = max(efficiency, max_efficiency); cpu_dev = get_cpu_device(cpu); if (IS_ERR_OR_NULL(cpu_dev)) { @@ -217,19 +210,13 @@ static int sched_energy_probe(struct platform_device *pdev) /* Convert HZ to KHZ */ max_frequencies[cpu] /= 1000; - max_freq = max(max_freq, max_frequencies[cpu]); } /* update capacity in energy model */ for_each_possible_cpu(cpu) { unsigned long cpu_max_cap; struct sched_group_energy *sge_l0, *sge; - int efficiency = topology_get_cpu_efficiency(cpu); - - cpu_max_cap = DIV_ROUND_UP(SCHED_CAPACITY_SCALE * - max_frequencies[cpu], max_freq); - cpu_max_cap = DIV_ROUND_UP(cpu_max_cap * efficiency, - max_efficiency); + cpu_max_cap = topology_get_cpu_scale(NULL, cpu); /* * All the cap_states have same frequency table so use @@ -261,7 +248,6 @@ static int sched_energy_probe(struct platform_device *pdev) break; sge->cap_states[i].cap = cap; } - dev_dbg(&pdev->dev, "cpu=%d freq=%ld cap=%ld power_d0=%ld\n", cpu, freq, sge_l0->cap_states[i].cap, @@ -269,8 +255,8 @@ static int sched_energy_probe(struct platform_device *pdev) } dev_info(&pdev->dev, - "cpu=%d eff=%d [freq=%ld cap=%ld power_d0=%ld] -> [freq=%ld cap=%ld power_d0=%ld]\n", - cpu, efficiency, + "cpu=%d [freq=%ld cap=%ld power_d0=%ld] -> [freq=%ld cap=%ld power_d0=%ld]\n", + cpu, sge_l0->cap_states[0].frequency, sge_l0->cap_states[0].cap, sge_l0->cap_states[0].power, @@ -279,47 +265,42 @@ static int sched_energy_probe(struct platform_device *pdev) sge_l0->cap_states[ncapstates - 1].power ); } - - - dev_dbg(&pdev->dev, - "cpu=%d efficiency=%d max_frequency=%ld max_efficiency=%d cpu_max_capacity=%ld\n", - cpu, efficiency, max_frequencies[cpu], max_efficiency, - cpu_max_cap); - } kfree(max_frequencies); - - walt_map_freq_to_load(); - dev_info(&pdev->dev, "Sched-energy-costs capacity updated\n"); return 0; exit: if (ret != -EPROBE_DEFER) dev_err(&pdev->dev, "error=%d\n", ret); - kfree(max_frequencies); return ret; } -static const struct of_device_id of_sched_energy_dt[] = { - { - .compatible = "sched-energy", - }, - { } -}; - static struct platform_driver energy_driver = { .driver = { .name = "sched-energy", - .of_match_table = of_sched_energy_dt, }, .probe = sched_energy_probe, }; +static struct platform_device energy_device = { + .name = "sched-energy", +}; + static int __init sched_energy_init(void) { - return platform_driver_register(&energy_driver); + int ret; + + ret = platform_device_register(&energy_device); + if (ret) + pr_err("%s device_register failed:%d\n", __func__, ret); + ret = platform_driver_register(&energy_driver); + if (ret) { + pr_err("%s driver_register failed:%d\n", __func__, ret); + platform_device_unregister(&energy_device); + } + return ret; } subsys_initcall(sched_energy_init); From ac79689aa3e73b21dd1b901591da459f068c703a Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 11:29:42 +0530 Subject: [PATCH 31/71] Revert "sched/core: Ensure cpu number is valid" This reverts commit 87918fff15bcd85ef07899a94b59179a9971db7e. Signed-off-by: UtsavBalar1231 --- kernel/sched/core.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fea801bd4e6e..032ed67b9a43 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5984,7 +5984,7 @@ int sched_isolate_count(const cpumask_t *mask, bool include_offline) */ int sched_isolate_cpu(int cpu) { - struct rq *rq; + struct rq *rq = cpu_rq(cpu); cpumask_t avail_cpus; int ret_code = 0; u64 start_time = 0; @@ -5996,14 +5996,11 @@ int sched_isolate_cpu(int cpu) cpumask_andnot(&avail_cpus, cpu_online_mask, cpu_isolated_mask); - if (cpu < 0 || cpu >= nr_cpu_ids || !cpu_possible(cpu) - || !cpu_online(cpu)) { + if (!cpu_online(cpu)) { ret_code = -EINVAL; goto out; } - rq = cpu_rq(cpu); - if (++cpu_isolation_vote[cpu] > 1) goto out; @@ -6062,10 +6059,6 @@ int sched_unisolate_cpu_unlocked(int cpu) struct rq *rq = cpu_rq(cpu); u64 start_time = 0; - if (cpu < 0 || cpu >= nr_cpu_ids || !cpu_possible(cpu)) { - ret_code = -EINVAL; - goto out; - } if (trace_sched_isolate_enabled()) start_time = sched_clock(); From 89ca87d8df2ea698fab7dad1c2e98a0c62e5decf Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 11:29:54 +0530 Subject: [PATCH 32/71] Revert "Revert "sched: turn off the TTWU_QUEUE feature"" This reverts commit c4fedb53ce53255facbf744d1e6d851d33b6a14e. Signed-off-by: UtsavBalar1231 --- kernel/sched/features.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/features.h b/kernel/sched/features.h index ca2d3b0b619d..96636034bb2a 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -56,7 +56,7 @@ SCHED_FEAT(NONTASK_CAPACITY, true) * Queue remote wakeups on the target CPU and process them * using the scheduler IPI. Reduces rq->lock contention/bounces. */ -SCHED_FEAT(TTWU_QUEUE, true) +SCHED_FEAT(TTWU_QUEUE, false) /* * When doing wakeups, attempt to limit superfluous scans of the LLC domain. From 1fc6d49b98ceda592fbed973f1d47380d6ce6622 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 14:12:32 +0530 Subject: [PATCH 33/71] Revert "ipa3:msm: Added debugfs support for drop packet stats" This reverts commit 0c2047c4469987f4b954c6da639e2ac949adeea6. Signed-off-by: UtsavBalar1231 --- .../platform/msm/ipa/ipa_v3/ipa_hw_stats.c | 88 +------------------ 1 file changed, 1 insertion(+), 87 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c index c1617e7867ab..8654d4da884b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2019, 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 @@ -2051,81 +2051,6 @@ static ssize_t ipa_debugfs_print_drop_stats(struct file *file, return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, nbytes); } -static ssize_t ipa_debugfs_enable_disable_drop_stats(struct file *file, - const char __user *ubuf, size_t count, loff_t *ppos) -{ - unsigned long missing; - unsigned int pipe_num = 0; - bool enable_pipe = true; - u32 pipe_bitmask = ipa3_ctx->hw_stats.drop.init.enabled_bitmask; - char seprator = ','; - int i, j; - bool is_pipe = false; - ssize_t ret; - - mutex_lock(&ipa3_ctx->lock); - if (sizeof(dbg_buff) < count + 1) { - ret = -EFAULT; - goto bail; - } - - missing = copy_from_user(dbg_buff, ubuf, count); - if (missing) { - ret = -EFAULT; - goto bail; - } - dbg_buff[count] = '\0'; - IPADBG("data is %s", dbg_buff); - - i = 0; - while (dbg_buff[i] != ' ' && i < count) - i++; - j = i; - i++; - if (i < count) { - if (dbg_buff[i] == '0') { - enable_pipe = false; - IPADBG("Drop stats will be disabled for pipes:"); - } - } - - for (i = 0; i < j; i++) { - if (dbg_buff[i] >= '0' && dbg_buff[i] <= '9') { - pipe_num = (pipe_num * 10) + (dbg_buff[i] - '0'); - is_pipe = true; - } - if (dbg_buff[i] == seprator) { - if (pipe_num >= 0 && pipe_num < ipa3_ctx->ipa_num_pipes - && ipa3_get_client_by_pipe(pipe_num) < - IPA_CLIENT_MAX) { - IPADBG("pipe number %u\n", pipe_num); - if (enable_pipe) - pipe_bitmask = pipe_bitmask | - (1 << pipe_num); - else - pipe_bitmask = pipe_bitmask & - (~(1 << pipe_num)); - } - pipe_num = 0; - is_pipe = false; - } - } - if (is_pipe && pipe_num >= 0 && pipe_num < ipa3_ctx->ipa_num_pipes && - ipa3_get_client_by_pipe(pipe_num) < IPA_CLIENT_MAX) { - IPADBG("pipe number %u\n", pipe_num); - if (enable_pipe) - pipe_bitmask = pipe_bitmask | (1 << pipe_num); - else - pipe_bitmask = pipe_bitmask & (~(1 << pipe_num)); - } - - ipa_init_drop_stats(pipe_bitmask); - ret = count; -bail: - mutex_unlock(&ipa3_ctx->lock); - return ret; -} - static const struct file_operations ipa3_quota_ops = { .read = ipa_debugfs_print_quota_stats, .write = ipa_debugfs_reset_quota_stats, @@ -2146,14 +2071,10 @@ static const struct file_operations ipa3_drop_ops = { .write = ipa_debugfs_reset_drop_stats, }; -static const struct file_operations ipa3_enable_drop_ops = { - .write = ipa_debugfs_enable_disable_drop_stats, -}; int ipa_debugfs_init_stats(struct dentry *parent) { const mode_t read_write_mode = 0664; - const mode_t write_mode = 0220; struct dentry *file; struct dentry *dent; @@ -2180,13 +2101,6 @@ int ipa_debugfs_init_stats(struct dentry *parent) goto fail; } - file = debugfs_create_file("enable_drop_stats", write_mode, dent, NULL, - &ipa3_enable_drop_ops); - if (IS_ERR_OR_NULL(file)) { - IPAERR("fail to create file %s\n", "enable_drop_stats"); - goto fail; - } - file = debugfs_create_file("tethering", read_write_mode, dent, NULL, &ipa3_tethering_ops); if (IS_ERR_OR_NULL(file)) { From 2367d1b1b5b9907ff5686ceba8381d75970b5689 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 12 May 2020 12:00:08 -0700 Subject: [PATCH 34/71] kbuild: Increase automatic inline instruction limit to 1000 for gcc-10 GCC 10 updated its interprocedural optimizer's logic to have it make more conservative inlining decisions, resulting in worse syscall and hackbench performance compared to GCC 9. Although the max-inline-insns- auto parameter's value was not altered, increasing it from the -O3 default of 30 to 1000 instructions yields improved performance with LTO, surpassing GCC 9. Signed-off-by: Sultan Alsawaf Signed-off-by: UtsavBalar1231 --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 796ce4084445..80c7eee6f072 100644 --- a/Makefile +++ b/Makefile @@ -427,6 +427,10 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -pipe \ -Werror-implicit-function-declaration \ -Wno-format-security \ -std=gnu89 + +# Avoid gcc-10 regression +KBUILD_CFLAGS += --param=max-inline-insns-auto=1000 + KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := From c67085fd2bd319c71a2b86e1026456082ffb8065 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 14:32:02 +0530 Subject: [PATCH 35/71] sm8150: fix gcc-10.1.0 warnings Signed-off-by: UtsavBalar1231 --- drivers/nfc/nq-nci.c | 2 +- drivers/of/base.c | 4 ---- drivers/platform/msm/usb_bam.c | 4 ++-- init/do_mounts_dm.c | 2 +- techpack/audio/dsp/q6voice.c | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/nfc/nq-nci.c b/drivers/nfc/nq-nci.c index d421daec5acc..003f2ae7729e 100644 --- a/drivers/nfc/nq-nci.c +++ b/drivers/nfc/nq-nci.c @@ -183,7 +183,7 @@ static irqreturn_t nqx_dev_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } -static int is_data_available_for_read(struct nqx_dev *nqx_dev) +static __maybe_unused int is_data_available_for_read(struct nqx_dev *nqx_dev) { int ret; diff --git a/drivers/of/base.c b/drivers/of/base.c index e5eeb4590c8b..91a6002a7fae 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -141,10 +141,6 @@ out: #ifndef CONFIG_MODULES static int __init of_free_phandle_cache(void) { - const char *name; - struct kobject *parent; - struct property *pp; - int rc; unsigned long flags; if (!of_kset) diff --git a/drivers/platform/msm/usb_bam.c b/drivers/platform/msm/usb_bam.c index a2ad63a6d448..d0079e39e84d 100644 --- a/drivers/platform/msm/usb_bam.c +++ b/drivers/platform/msm/usb_bam.c @@ -1190,7 +1190,7 @@ static int usb_bam_disconnect_ipa_prod( __func__, pipe_connect->bam_type); else ctx->pipes_enabled_per_bam -= 1; - spin_unlock(&ctx->usb_bam_lock); + spin_unlock(&ctx->usb_bam_lock); } return 0; @@ -1312,7 +1312,7 @@ retry: __func__, pipe_connect->bam_type); else ctx->pipes_enabled_per_bam -= 1; - spin_unlock(&ctx->usb_bam_lock); + spin_unlock(&ctx->usb_bam_lock); } pipe_connect->ipa_clnt_hdl = -1; diff --git a/init/do_mounts_dm.c b/init/do_mounts_dm.c index 8dc51dfc5805..2fc4f4c96539 100644 --- a/init/do_mounts_dm.c +++ b/init/do_mounts_dm.c @@ -309,7 +309,7 @@ error: * You can assume the first device is /dev/dm-0, the next device is /dev/dm-1, * and so forth. */ -static int __init dm_setup(char *str) +static int __maybe_unused __init dm_setup(char *str) { struct dm_option opt; unsigned long num_devices; diff --git a/techpack/audio/dsp/q6voice.c b/techpack/audio/dsp/q6voice.c index bf51c888062b..a4da33cb6215 100644 --- a/techpack/audio/dsp/q6voice.c +++ b/techpack/audio/dsp/q6voice.c @@ -4292,7 +4292,7 @@ static int voice_send_cvp_mfc_config_cmd(struct voice_data *v) return ret; } -static int voice_get_avcs_version_per_service(uint32_t service_id) +static __maybe_unused int voice_get_avcs_version_per_service(uint32_t service_id) { int ret = 0; size_t ver_size; From 80f5fff0b7e8b781332477f298d6c834ec6dbd61 Mon Sep 17 00:00:00 2001 From: Zaw Zaw Date: Fri, 17 May 2019 14:38:25 +0530 Subject: [PATCH 36/71] Kbuild: allowing forcing ccache with shell script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to use ccache: export KERNEL_USE_CCACHE=1 Signed-off-by: Dušan Uverić Signed-off-by: UtsavBalar1231 --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 80c7eee6f072..6cc329701b75 100644 --- a/Makefile +++ b/Makefile @@ -361,8 +361,16 @@ HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null) HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null) HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) +CCACHE := $(shell which ccache) + +ifdef KERNEL_USE_CCACHE +HOSTCC = $(CCACHE) gcc +HOSTCXX = $(CCACHE) g++ +$(info # BUILDING WITH CCACHE) +else HOSTCC = gcc HOSTCXX = g++ +endif HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ -fomit-frame-pointer -std=gnu89 -pipe $(HOST_LFS_CFLAGS) HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) @@ -377,7 +385,11 @@ endif # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld +ifdef KERNEL_USE_CCACHE +CC = $(CCACHE) $(CROSS_COMPILE)gcc +else CC = $(CROSS_COMPILE)gcc +endif LDGOLD = $(CROSS_COMPILE)ld.gold LDLLD = ld.lld CPP = $(CC) -E From e510e883a1fbd9e01edebeab0840d7a8d358e245 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 15:00:02 +0530 Subject: [PATCH 37/71] Makefile: Optimize CPU setup with GCC Signed-off-by: UtsavBalar1231 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6cc329701b75..9c8d00b5116b 100644 --- a/Makefile +++ b/Makefile @@ -723,7 +723,8 @@ else KBUILD_CFLAGS += -O2 ifeq ($(cc-name),gcc) KBUILD_CFLAGS += -O3 -KBUILD_CFLAGS += -mcpu=cortex-a76.cortex-a55 -mtune=cortex-a76.cortex-a55 +KBUILD_CFLAGS += $(call cc-option, -mcpu=cortex-a76.cortex-a55+crc+crypto) +KBUILD_CFLAGS += $(call cc-option, -mtune=cortex-a76.cortex-a55) endif ifeq ($(cc-name),clang) KBUILD_CFLAGS += -O3 From 8a872967c308c43268134f0a2079cf0b4e1e8d5b Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 13 Sep 2018 21:34:57 -0700 Subject: [PATCH 38/71] ARM64: configs: raphael: remove unused governors and CONFIG_CPU_BOOST Bug: 115684360 Bug: 113594604 Test: Build Change-Id: I9141b9bac316604730f0e277ca0212e86df3a90d Signed-off-by: Wei Wang Signed-off-by: UtsavBalar1231 --- arch/arm64/configs/raphael_defconfig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/arm64/configs/raphael_defconfig b/arch/arm64/configs/raphael_defconfig index 6acb85dbcd5a..1c8ead5389f9 100644 --- a/arch/arm64/configs/raphael_defconfig +++ b/arch/arm64/configs/raphael_defconfig @@ -723,7 +723,6 @@ CONFIG_ARM_CPUIDLE=y # CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TIMES=y CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y @@ -735,10 +734,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPU_BOOST=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_CPU_BOOST is not set CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y # CONFIG_CPU_FREQ_GOV_INTERACTIVE is not set From 517d80b277b68faa3cfae37d86ae469c0b36c243 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 20 Feb 2020 17:50:12 -0800 Subject: [PATCH 39/71] ANDROID: raphael_defconfig: Disable CONFIG_RT_GROUP_SCHED Android does not use per-cgroup CPU allowance for RT tasks feature. Disable it so that RT task allowance is controlled globally using /proc/sys/kernel/sched_rt_runtime_us. Bug: 149954332 Change-Id: I9487bd113502e52f19637e43109433cb13e97a23 Suggested-by: Snild Dolkow Signed-off-by: Suren Baghdasaryan Signed-off-by: UtsavBalar1231 --- arch/arm64/configs/raphael_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/configs/raphael_defconfig b/arch/arm64/configs/raphael_defconfig index 1c8ead5389f9..e5987cf8553b 100644 --- a/arch/arm64/configs/raphael_defconfig +++ b/arch/arm64/configs/raphael_defconfig @@ -152,7 +152,7 @@ CONFIG_BLK_CGROUP=y CONFIG_CGROUP_WRITEBACK=y CONFIG_CGROUP_SCHED=y CONFIG_FAIR_GROUP_SCHED=y -CONFIG_RT_GROUP_SCHED=y +# CONFIG_RT_GROUP_SCHED is not set # CONFIG_CGROUP_PIDS is not set # CONFIG_CGROUP_RDMA is not set CONFIG_CGROUP_FREEZER=y From 42211649fa790c4e534ed3d695b8d64fde925625 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Thu, 11 Jun 2020 21:37:16 +0530 Subject: [PATCH 40/71] ARM64: configs: raphael: disable msm performance driver Signed-off-by: UtsavBalar1231 --- arch/arm64/configs/raphael_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/configs/raphael_defconfig b/arch/arm64/configs/raphael_defconfig index e5987cf8553b..8e53c6e9c71a 100644 --- a/arch/arm64/configs/raphael_defconfig +++ b/arch/arm64/configs/raphael_defconfig @@ -4128,7 +4128,7 @@ CONFIG_MEM_SHARE_QMI_SERVICE=y # CONFIG_MSM_HAB is not set # CONFIG_MSM_AGL is not set # CONFIG_QCOM_HGSL_TCSR_SIGNAL is not set -CONFIG_MSM_PERFORMANCE=y +# CONFIG_MSM_PERFORMANCE is not set CONFIG_QCOM_QHEE_ENABLE_MEM_PROTECTION=y CONFIG_QCOM_SMP2P_SLEEPSTATE=y CONFIG_QCOM_CDSP_RM=y From d83f539ff8ab8b81866ad68e180890ecca9244a8 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 17:43:34 +0530 Subject: [PATCH 41/71] README: sync with kernel Signed-off-by: UtsavBalar1231 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 011ac3991935..5ef116b07359 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# iMMENSITY KERNEL for Redmi K20pro and Mi9Tpro +# iMMENSITY KERNAL for RedmiK20pro / Mi9Tpro ![logo](https://github.com/UtsavBalar1231/xda-stuff/raw/master/immensity-new.png "logo here") > Based on the Qualcomm AUTO tag **LE.UM.4.2.1.r1-02600-QCS404.0** -> Merged AOSP kernel_common/android-4.14-stable [4.14.184] -> Current CAF tag: **LV.AU.0.1.0.r2-02000-qtiquingvm.0** +> Merged AOSP kernel_common/android-4.14-stable [4.14.185] +> Current CAF tag: **LE.UM.4.1.1.r1-00300-sa515m** From 4dbdf41bc16132b00aef42ce4906d6c8409d7ac7 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 17:44:51 +0530 Subject: [PATCH 42/71] iMMENSITY: add gcc build script Signed-off-by: UtsavBalar1231 --- .gitignore | 1 + gcc.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 gcc.sh diff --git a/.gitignore b/.gitignore index 022a3cc3c68e..f95fda219d48 100644 --- a/.gitignore +++ b/.gitignore @@ -132,5 +132,6 @@ kernel/configs/android-*.cfg Android.bp build.sh build-lto.sh +gcc.sh upload.sh out/ diff --git a/gcc.sh b/gcc.sh new file mode 100644 index 000000000000..94b69cfb59b7 --- /dev/null +++ b/gcc.sh @@ -0,0 +1,33 @@ +#!/bin/bash +OUT_DIR=out/ + +export KBUILD_BUILD_HOST=CuntsSpace +export KERNEL_USE_CCACHE=1 + +make ARCH=arm64 \ + O=${OUT_DIR} \ + raphael_defconfig \ + -j4 + +scripts/config --file ${OUT_DIR}/.config \ + -d LTO \ + -d LTO_CLANG \ + -d TOOLS_SUPPORT_RELR \ + -d LD_LLD \ + -d FORTIFY_SOURCE + +cd ${OUT_DIR} +make O=${OUT_DIR} \ + ARCH=arm64 \ + olddefconfig +cd ../ + +PATH=/home/utsavthecunt/arm64-gcc/bin:/home/utsavthecunt/arm32-gcc/bin:$PATH + +make ARCH=arm64 \ + O=out \ + CROSS_COMPILE="aarch64-elf-" \ + CROSS_COMPILE_ARM32="arm-eabi-" \ + -j4 + +rm out/.version From df8efb156bf2746891995f69ae05fd4bc2ba182e Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Mon, 5 Aug 2019 05:52:04 +0000 Subject: [PATCH 43/71] cpufreq: Kill userspace CPU boosting entirely Kernel-based CPU boosting is used now, so stop userspace from messing with it by turning scaling_min_freq into a no-op. Note that this is done instead of making scaling_min_freq read-only so that userspace doesn't spit out error messages when it can't do its boosting. Signed-off-by: Sultan Alsawaf Signed-off-by: Adam W. Willis Signed-off-by: UtsavBalar1231 --- drivers/cpufreq/cpufreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a5256e42ff7e..8f83d9063ab4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -727,6 +727,9 @@ static ssize_t store_##file_name \ int ret, temp; \ struct cpufreq_policy new_policy; \ \ + if (&policy->object == &policy->min) \ + return count; \ + \ memcpy(&new_policy, policy, sizeof(*policy)); \ new_policy.min = policy->user_policy.min; \ new_policy.max = policy->user_policy.max; \ From 0aaecd3249f512bc62a7d6b152cbba665e18f075 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Mon, 2 Sep 2019 21:32:56 -0700 Subject: [PATCH 44/71] cpufreq: Allow configuring default minimum frequencies in Kconfig This adds config options that set the default minimum frequency for the little, big, and prime CPU clusters. Signed-off-by: Danny Lin Signed-off-by: UtsavBalar1231 --- drivers/cpufreq/Kconfig | 27 +++++++++++++++++++++++++++ drivers/cpufreq/freq_table.c | 13 +++++++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 6cfaaeb2e79a..ed23aacc7258 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -250,6 +250,33 @@ config CPU_FREQ_GOV_INTERACTIVE If in doubt, say N. +config CPU_FREQ_DEFAULT_LITTLE_MIN + int "Default minimum frequency for the little cluster" + default 0 + help + This sets the default minimum frequency (in kHz) for the little CPU + cluster. + + If in doubt, say 0 to use the hardware's minimum frequency. + +config CPU_FREQ_DEFAULT_BIG_MIN + int "Default minimum frequency for the big cluster" + default 0 + help + This sets the default minimum frequency (in kHz) for the big CPU + cluster. + + If in doubt, say 0 to use the hardware's minimum frequency. + +config CPU_FREQ_DEFAULT_PRIME_MIN + int "Default minimum frequency for the prime cluster" + default 0 + help + This sets the default minimum frequency (in kHz) for the prime CPU + cluster. + + If in doubt, say 0 to use the hardware's minimum frequency. + comment "CPU frequency scaling drivers" config CPUFREQ_DT diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 7f205ec61244..b3dbd7186870 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -58,6 +58,19 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, policy->min = policy->cpuinfo.min_freq = min_freq; policy->max = policy->cpuinfo.max_freq = max_freq; +#if CONFIG_CPU_FREQ_DEFAULT_LITTLE_MIN + if (cpumask_test_cpu(policy->cpu, cpu_lp_mask)) + policy->min = CONFIG_CPU_FREQ_DEFAULT_LITTLE_MIN; +#endif +#if CONFIG_CPU_FREQ_DEFAULT_BIG_MIN + if (cpumask_test_cpu(policy->cpu, cpu_perf_mask)) + policy->min = CONFIG_CPU_FREQ_DEFAULT_BIG_MIN; +#endif +#if CONFIG_CPU_FREQ_DEFAULT_PRIME_MIN + if (cpumask_test_cpu(policy->cpu, cpu_perfp_mask)) + policy->min = CONFIG_CPU_FREQ_DEFAULT_PRIME_MIN; +#endif + if (max_freq > cpuinfo_max_freq_cached) cpuinfo_max_freq_cached = max_freq; From b14ef87611268592cc695b34b99164c4d4f37eb5 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Mon, 2 Sep 2019 21:33:39 -0700 Subject: [PATCH 45/71] ARM64: configs: raphael: Configure optimal minimum CPU frequencies for sm8150 These frequencies have been selected by weighing absolute power usage vs. efficiency (mW/perf -- the lower the better) for all the frequencies available on each cluster. Performance was measured by running an in-kernel RC4 benchmark simultaneously on all the cores in a cluster (minus one for housekeeping, except Prime where the first core of the little cluster was used for housekeeping). Power usage was measured while the benchmark was running using the integrated PMIC (PM8150B v2.0). 768000 kHz, 1056000 kHz, and 1171200 kHz have each been selected by looking for the most efficient frequency with a relatively low power usage. That is, when mW/perf and power usage (mW) are graphed together, the ideal frequency is one with very low mW/perf and mW, such that the lines are intersecting. Since this is obviously not possible in practice, we look for the frequency closest to matching this description. We aren't using the *most* efficient freqs because PM QoS abuse and high overall CPU usage causes higher drain on them by reducing deep idle time and utilizing the CPU more, which makes the frequency's high absolute power usage show. As a result of this careful selection, the new frequencies should benefit both performance *and* battery endurance in real-world scenarios. Full data with graphs: https://docs.google.com/spreadsheets/d/1gOG4MVDzOvfAtXzifL0EQm-BPHdGkZ9SHThybRpm6R8/edit Thanks to Sultan Alsawaf (kerneltoast) for creating the benchmark used in this test. Signed-off-by: Danny Lin Signed-off-by: UtsavBalar1231 --- arch/arm64/configs/raphael_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/configs/raphael_defconfig b/arch/arm64/configs/raphael_defconfig index 8e53c6e9c71a..1ca4255f1118 100644 --- a/arch/arm64/configs/raphael_defconfig +++ b/arch/arm64/configs/raphael_defconfig @@ -740,6 +740,9 @@ CONFIG_CPU_FREQ_GOV_POWERSAVE=y # CONFIG_CPU_BOOST is not set CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y # CONFIG_CPU_FREQ_GOV_INTERACTIVE is not set +CONFIG_CPU_FREQ_DEFAULT_LITTLE_MIN=768000 +CONFIG_CPU_FREQ_DEFAULT_BIG_MIN=1056000 +CONFIG_CPU_FREQ_DEFAULT_PRIME_MIN=1171200 # # CPU frequency scaling drivers From bc3dc4edf28fa0d308151cbc3bd6f5f0503cde71 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Mon, 22 Jun 2020 23:40:38 +0530 Subject: [PATCH 46/71] FIXUP: 76deb8e5d7e10eec1bfbf7a4177677a4fa67cf59: sde: fix a mismerge Signed-off-by: UtsavBalar1231 --- drivers/gpu/drm/msm/sde/sde_connector.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/msm/sde/sde_connector.c b/drivers/gpu/drm/msm/sde/sde_connector.c index 1f6158582336..8e41dbef7252 100644 --- a/drivers/gpu/drm/msm/sde/sde_connector.c +++ b/drivers/gpu/drm/msm/sde/sde_connector.c @@ -769,6 +769,12 @@ int sde_connector_update_hbm(struct sde_connector *c_conn) pr_debug("notify hbm on to displayfeature\n"); } + if (dsi_display->panel->dc_enable) { + dsi_display->panel->dc_enable = false; + pr_debug("fod set CRC OFF\n"); + dsi_display_write_panel(dsi_display, &dsi_display->panel->cur_mode->priv_info->cmd_sets[DSI_CMD_SET_DISP_CRC_OFF]); + } + if (dsi_display->panel->fod_dimlayer_bl_block) { dsi_display->panel->fod_dimlayer_bl_block = false; pr_debug("the fod_dimlayer_bl_block state is [%d]\n", dsi_display->panel->fod_dimlayer_bl_block); From 8302aa7846c08633a91bfa6c743abab56282f12a Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Fri, 24 May 2019 21:58:16 -0700 Subject: [PATCH 47/71] ACPICA: Fix failed target detection with bare-metal compiler The target environment macro checks in ACPICA fail when the compiler targets bare-metal environments (i.e. plain ELF images) instead of Linux userspace environments. The predefined __linux__ macro is not defined in such cases, but this is all ACPICA checks for. Not being able to detect the target environment causes hundreds of compile errors to be emitted due to missing definitions, because those definitions are normally in target-specific headers. Fix the issue by using the proper method of detecting whether code is being compiled as part of the kernel (__KERNEL__) in the ACPICA target environment detection header, thus resulting in the appropriate target headers being included. Signed-off-by: Danny Lin Signed-off-by: Panchajanya1999 Signed-off-by: UtsavBalar1231 --- include/acpi/platform/acenv.h | 2 +- include/acpi/platform/acenvex.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 043fd559de6e..5844f39f0d5c 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -182,7 +182,7 @@ #endif -#if defined(_LINUX) || defined(__linux__) +#if defined(_LINUX) || defined(__linux__) || defined(__KERNEL__) #include #elif defined(_APPLE) || defined(__APPLE__) diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h index 127c848a1ba7..236700e78481 100644 --- a/include/acpi/platform/acenvex.h +++ b/include/acpi/platform/acenvex.h @@ -53,7 +53,7 @@ * *****************************************************************************/ -#if defined(_LINUX) || defined(__linux__) +#if defined(_LINUX) || defined(__linux__) || defined(__KERNEL__) #include #elif defined(__DragonFly__) From f44b4829cc2137986f45306ae872d3d9a0a7003f Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 31 Mar 2015 03:45:39 -0700 Subject: [PATCH 48/71] lto: Add __noreorder and mark initcalls __noreorder gcc 5 has a new no_reorder attribute that prevents top level reordering only for that symbol. Kernels don't like any reordering of initcalls between files, as several initcalls depend on each other. LTO previously needed to use -fno-toplevel-reordering to prevent boot failures. Add a __noreorder wrapper for the no_reorder attribute and use it for initcalls. Signed-off-by: Andi Kleen Signed-off-by: Yousef Algadri Change-Id: I337cf71f7625694dacb0fc8b0a3412b02d5d4688 Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- include/linux/compiler-gcc.h | 5 +++++ include/linux/compiler.h | 4 ++++ include/linux/init.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 224c524243fe..25cd5e683299 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -362,6 +362,11 @@ #define __no_sanitize_address #endif +#if __GNUC__ >= 5 +/* Avoid reordering a top level statement */ +#define __noreorder __attribute__((no_reorder)) +#endif + /* * A trick to suppress uninitialized variable warning without generating any * code diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 6d2ef5015afd..5c4d8d766e40 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -281,6 +281,10 @@ unsigned long read_word_at_a_time(const void *addr) # define __optimize(level) #endif +#ifndef __noreorder +#define __noreorder +#endif + /* Compile time object size, -1 for unknown */ #ifndef __compiletime_object_size # define __compiletime_object_size(obj) -1 diff --git a/include/linux/init.h b/include/linux/init.h index 5344190b663c..b5cc4c7d9db1 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -190,7 +190,7 @@ extern bool initcall_debug; __lto_initcall(__COUNTER__, __LINE__, fn, id, __sec) #else #define ___define_initcall(fn, id, __sec) \ - static initcall_t __initcall_##fn##id __used \ + static initcall_t __initcall_##fn##id __used __noreorder \ __attribute__((__section__(#__sec ".init"))) = fn; #endif From afc16dfac09f201a2f8192edfbda861913e7dafe Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Wed, 11 Mar 2020 09:29:21 -0700 Subject: [PATCH 49/71] arm64: Fix section mismatch with LTO caused by ambiguous const Due to how dt_supported_cpu_ops and acpi_supported_cpu_ops are used, they can be placed in a different section by the compiler when LTO is used because it thinks that it belongs in another section. To really make it clear to GCC that these belong in the __initconst section, make the variables themselves const and refactor cpu_get_ops() accordingly to make it compile. Signed-off-by: Sultan Alsawaf Signed-off-by: Yousef Algadri Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- arch/arm64/kernel/cpu_ops.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c index e2a9d04d0517..d9a34e77cfa7 100644 --- a/arch/arm64/kernel/cpu_ops.c +++ b/arch/arm64/kernel/cpu_ops.c @@ -31,13 +31,13 @@ extern const struct cpu_operations cpu_psci_ops; const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; -static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = { +static const struct cpu_operations *const dt_supported_cpu_ops[] __initconst = { &smp_spin_table_ops, &cpu_psci_ops, NULL, }; -static const struct cpu_operations *acpi_supported_cpu_ops[] __initconst = { +static const struct cpu_operations *const acpi_supported_cpu_ops[] __initconst = { #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL &acpi_parking_protocol_ops, #endif @@ -47,15 +47,18 @@ static const struct cpu_operations *acpi_supported_cpu_ops[] __initconst = { static const struct cpu_operations * __init cpu_get_ops(const char *name) { - const struct cpu_operations **ops; + int i; - ops = acpi_disabled ? dt_supported_cpu_ops : acpi_supported_cpu_ops; - - while (*ops) { - if (!strcmp(name, (*ops)->name)) - return *ops; - - ops++; + if (acpi_disabled) { + for (i = 0; i < ARRAY_SIZE(dt_supported_cpu_ops); i++) { + if (!strcmp(name, dt_supported_cpu_ops[i]->name)) + return dt_supported_cpu_ops[i]; + } + } else { + for (i = 0; i < ARRAY_SIZE(acpi_supported_cpu_ops); i++) { + if (!strcmp(name, acpi_supported_cpu_ops[i]->name)) + return acpi_supported_cpu_ops[i]; + } } return NULL; From 5432c1e3e8a783eb21ce68dd469498e928e6ac74 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 10 Mar 2020 21:13:43 -0700 Subject: [PATCH 50/71] sys_ni: Remove duplicate cond_syscall(sys_madvise) entry This is already defined. Remove the duplicate from the less-correct location. Signed-off-by: Sultan Alsawaf Signed-off-by: Yousef Algadri Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- kernel/sys_ni.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index b5189762d275..af033b9fda63 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -163,7 +163,6 @@ cond_syscall(compat_sys_process_vm_writev); cond_syscall(sys_uselib); cond_syscall(sys_fadvise64); cond_syscall(sys_fadvise64_64); -cond_syscall(sys_madvise); cond_syscall(sys_setuid); cond_syscall(sys_setregid); cond_syscall(sys_setgid); From c8cfdec4852037e69c11acefa422113648a24944 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 10 Mar 2020 21:19:28 -0700 Subject: [PATCH 51/71] sys_ni: Fix cond_syscall() alias for LTO When using LTO, the conditional syscall aliases aren't weak, and instead override implemented syscalls rather than serve as a fallback for missing syscalls. Fix the cond_syscall() alias using an attribute so that it gets properly evaluated at link time. Signed-off-by: Sultan Alsawaf Signed-off-by: Yousef Algadri Change-Id: I3c13715855843178ae7590814bb785037ae041c0 Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- include/linux/linkage.h | 6 ++---- kernel/Makefile | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/linux/linkage.h b/include/linux/linkage.h index f68db9e450eb..553b17662930 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -23,10 +23,8 @@ #endif #ifndef cond_syscall -#define cond_syscall(x) asm( \ - ".weak " VMLINUX_SYMBOL_STR(x) "\n\t" \ - ".set " VMLINUX_SYMBOL_STR(x) "," \ - VMLINUX_SYMBOL_STR(sys_ni_syscall)) +#define cond_syscall(x) \ + long __attribute__((weak, alias("sys_ni_syscall"))) x(void); #endif #ifndef SYSCALL_ALIAS diff --git a/kernel/Makefile b/kernel/Makefile index 197cf9cc6e1f..2b8114692721 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -32,9 +32,6 @@ KCOV_INSTRUMENT_kcov.o := n KASAN_SANITIZE_kcov.o := n CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -# cond_syscall is currently not LTO compatible -CFLAGS_sys_ni.o = $(DISABLE_LTO) - # Don't instrument error handlers CFLAGS_cfi.o = $(DISABLE_CFI_CLANG) From 54822b6c66f984c8c23bf091d932c5a8bcb00b06 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Wed, 11 Mar 2020 09:25:22 -0700 Subject: [PATCH 52/71] arm64: Make __stack_chk_guard visible When LTO is used, GCC optimizes out the __stack_chk_guard variable, resulting in undefined symbol errors. Fix it by explicitly making __stack_chk_guard visible so it doesn't disappear. Signed-off-by: Sultan Alsawaf Signed-off-by: Yousef Algadri Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 423a02bf0cde..64e16bc158e9 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -64,7 +64,7 @@ #ifdef CONFIG_CC_STACKPROTECTOR #include -unsigned long __stack_chk_guard __read_mostly; +__visible unsigned long __stack_chk_guard __read_mostly; EXPORT_SYMBOL(__stack_chk_guard); #endif From 1f5a5e94a4397a46544e6fde1a8a2ba6549c8f97 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Wed, 11 Mar 2020 18:05:42 -0700 Subject: [PATCH 53/71] lto: Add Link Time Optimization support for GCC This requires a modern version of GCC and various other patches in order to work. LTO results in a smaller kernel binary with better performance. Based off of work from Andi Kleen . [Haseo97: Use -ffat-lto-objects since most drivers needed it to handle lto objects and change checks to GCC_LTO so it doesn't conflicting with Clang LTO]. Signed-off-by: Sultan Alsawaf Signed-off-by: Yousef Algadri Change-Id: I7b08fde6c645ebb0baa16c78a1a4fe8255d45b7f Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- Makefile | 12 ++++++++++++ init/Kconfig | 5 +++++ scripts/link-vmlinux.sh | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9c8d00b5116b..94b7ba57cfd9 100644 --- a/Makefile +++ b/Makefile @@ -701,6 +701,18 @@ export LLVM_AR LLVM_NM LDFLAGS += --plugin-opt=O3 endif +ifdef CONFIG_GCC_LTO +LTO_CFLAGS := -flto -flto=jobserver -ffat-lto-objects \ + -fuse-linker-plugin -fwhole-program +KBUILD_CFLAGS += $(LTO_CFLAGS) +LTO_LDFLAGS := $(LTO_CFLAGS) -Wno-lto-type-mismatch -Wno-psabi +LDFINAL := $(CONFIG_SHELL) $(srctree)/scripts/gcc-ld $(LTO_LDFLAGS) +AR := $(CROSS_COMPILE)gcc-ar +NM := $(CROSS_COMPILE)gcc-nm +DISABLE_LTO := -fno-lto +export DISABLE_LTO LDFINAL +endif + # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default # values of the respective KBUILD_* variables ARCH_CPPFLAGS := diff --git a/init/Kconfig b/init/Kconfig index 06c42b263c6c..f635e7bc67c8 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1218,6 +1218,11 @@ config CC_OPTIMIZE_FOR_SIZE endchoice +config GCC_LTO + bool "Enable Link Time Optimization" + default n + select THIN_ARCHIVES + config SYSCTL bool diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 93eb3a83329c..767ecd060e3f 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -125,7 +125,7 @@ modpost_link() info LD vmlinux.o fi - ${LD} ${LDFLAGS} -r -o ${1} $(lto_lds) ${objects} + ${LDFINAL} ${LDFLAGS} -r -o ${1} $(lto_lds) ${objects} } # If CONFIG_LTO_CLANG is selected, we postpone running recordmcount until @@ -434,7 +434,7 @@ if [ ! -z ${RTIC_MP_O} ]; then fi fi -info LD vmlinux +info LDFINAL vmlinux vmlinux_link "${kallsymso}" vmlinux if [ -n "${CONFIG_BUILDTIME_EXTABLE_SORT}" ]; then From a9818c270bd4c017c5e136e5ebfc7491f9c99daa Mon Sep 17 00:00:00 2001 From: Yousef Algadri Date: Fri, 13 Mar 2020 00:53:44 +0700 Subject: [PATCH 54/71] arm64: Add clang checks for emulations * GCC LTO conflicting with it. Signed-off-by: Yousef Algadri Change-Id: I72e68bfa9b0a096e32f7a211fbf143dc70c8d67a Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- arch/arm64/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 706e11c89935..f5237c0825d1 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -126,22 +126,26 @@ KBUILD_CPPFLAGS += -mbig-endian CHECKFLAGS += -D__AARCH64EB__ AS += -EB LD += -EB +ifeq ($(cc-name),clang) ifeq ($(ld-name),gold) LDFLAGS += -maarch64_elf64_be_vec else LDFLAGS += -maarch64elfb endif +endif UTS_MACHINE := aarch64_be else KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__AARCH64EL__ AS += -EL LD += -EL +ifeq ($(cc-name),clang) ifeq ($(ld-name),gold) LDFLAGS += -maarch64_elf64_le_vec else LDFLAGS += -maarch64elf endif +endif UTS_MACHINE := aarch64 endif From 8b229343d992104846e0b60b699aae1e5f05b57c Mon Sep 17 00:00:00 2001 From: Yousef Algadri Date: Sat, 14 Mar 2020 21:08:57 +0700 Subject: [PATCH 55/71] vmlinux: Don't use LDFINAL for clang Signed-off-by: Yousef Algadri Change-Id: Ifc529c6614300102c2eae9f106b814a109f32c2b Signed-off-by: Panchajanya Sarkar Signed-off-by: UtsavBalar1231 --- scripts/link-vmlinux.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 767ecd060e3f..208720cd9d42 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -125,7 +125,11 @@ modpost_link() info LD vmlinux.o fi - ${LDFINAL} ${LDFLAGS} -r -o ${1} $(lto_lds) ${objects} + if [ -n "${CONFIG_GCC_LTO}" ]; then + ${LDFINAL} ${LDFLAGS} -r -o ${1} $(lto_lds) ${objects} + else + ${LD} ${LDFLAGS} -r -o ${1} $(lto_lds) ${objects} + fi } # If CONFIG_LTO_CLANG is selected, we postpone running recordmcount until @@ -434,7 +438,12 @@ if [ ! -z ${RTIC_MP_O} ]; then fi fi -info LDFINAL vmlinux +if [ -n "${CONFIG_GCC_LTO}" ]; then + info LDFINAL vmlinux +else + info LD vmlinux +fi + vmlinux_link "${kallsymso}" vmlinux if [ -n "${CONFIG_BUILDTIME_EXTABLE_SORT}" ]; then From a38a1278272c2cb281865e37a8a45ca487c60820 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 10:43:27 +0530 Subject: [PATCH 56/71] build-gcc: use GCC LTO Signed-off-by: UtsavBalar1231 --- gcc.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc.sh b/gcc.sh index 94b69cfb59b7..dbc18a500a3b 100644 --- a/gcc.sh +++ b/gcc.sh @@ -14,7 +14,8 @@ scripts/config --file ${OUT_DIR}/.config \ -d LTO_CLANG \ -d TOOLS_SUPPORT_RELR \ -d LD_LLD \ - -d FORTIFY_SOURCE + -d FORTIFY_SOURCE \ + -e GCC_LTO cd ${OUT_DIR} make O=${OUT_DIR} \ @@ -28,6 +29,9 @@ make ARCH=arm64 \ O=out \ CROSS_COMPILE="aarch64-elf-" \ CROSS_COMPILE_ARM32="arm-eabi-" \ + AR="aarch64-elf-ar" \ + OBJDUMP="aarch64-elf-objdump" \ + STRIP="aarch64-elf-strip" \ -j4 rm out/.version From b60945b0aac5bd6d210fc551e29b38b0f57fbeb7 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 11 May 2020 12:43:13 +0530 Subject: [PATCH 57/71] bpf: Avoid gcc-10 stringop-overflow warning in struct bpf_prog gcc-10 warns about accesses to zero-length arrays: kernel/bpf/core.c: In function 'bpf_patch_insn_single': cc1: warning: writing 8 bytes into a region of size 0 [-Wstringop-overflow=] In file included from kernel/bpf/core.c:21: include/linux/filter.h:550:20: note: at offset 0 to object 'insnsi' with size 0 declared here 550 | struct bpf_insn insnsi[0]; | ^~~~~~ In this case, we really want to have two flexible-array members, but that is not possible. Removing the union to make insnsi a flexible-array member while leaving insns as a zero-length array fixes the warning, as nothing writes to the other one in that way. This trick only works on linux-3.18 or higher, as older versions had additional members in the union. Fixes: 60a3b22 ("net: bpf: make eBPF interpreter images read-only") Signed-off-by: Arnd Bergmann Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20200430213101.135134-6-arnd@arndb.de Signed-off-by: UtsavBalar1231 --- include/linux/filter.h | 6 ++---- include/net/bluetooth/mgmt.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index 11cf02fcbf1c..45488c2c445f 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -470,10 +470,8 @@ struct bpf_prog { unsigned int (*bpf_func)(const void *ctx, const struct bpf_insn *insn); /* Instructions for interpreter */ - union { - struct sock_filter insns[0]; - struct bpf_insn insnsi[0]; - }; + struct sock_filter insns[0]; + struct bpf_insn insnsi[0]; }; struct sk_filter { diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 72a456bbbcd5..502c0c06df8e 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h @@ -514,7 +514,7 @@ struct mgmt_cp_read_local_oob_ext_data { struct mgmt_rp_read_local_oob_ext_data { __u8 type; __le16 eir_len; - __u8 eir[0]; + __u8 eir[1]; } __packed; #define MGMT_OP_READ_EXT_INDEX_LIST 0x003C From cd3184a2e7e8eb305ede16317df55ea51427ac2c Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:47:22 +0530 Subject: [PATCH 58/71] Revert "serial: msm-geni-serial: Add support for thaw callback" This reverts commit 0c9edebb64983f8e89f2e6d224f1b97bb9484983. Signed-off-by: UtsavBalar1231 --- drivers/tty/serial/msm_geni_serial.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/serial/msm_geni_serial.c b/drivers/tty/serial/msm_geni_serial.c index cd4ce95f3021..77cb8be5664c 100644 --- a/drivers/tty/serial/msm_geni_serial.c +++ b/drivers/tty/serial/msm_geni_serial.c @@ -3282,7 +3282,6 @@ static const struct dev_pm_ops msm_geni_serial_pm_ops = { .resume_noirq = msm_geni_serial_sys_resume_noirq, .freeze = msm_geni_serial_sys_suspend_noirq, .restore = msm_geni_serial_sys_hib_resume_noirq, - .thaw = msm_geni_serial_sys_hib_resume_noirq, }; static void msm_geni_serial_ssr_down(struct device *dev) From 59aa1fecf94603f0da46b02ae5efff63c818e27c Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:47:48 +0530 Subject: [PATCH 59/71] Revert "clk: qcom: Add support for enabling the critical clocks" This reverts commit 70266ab90155c6766d8753b792c6d1e2aafb1598. Signed-off-by: UtsavBalar1231 --- drivers/clk/qcom/gcc-sm6150.c | 2 +- drivers/clk/qcom/gcc-sm8150.c | 2 +- drivers/clk/qcom/gpucc-sm6150.c | 2 +- drivers/clk/qcom/npucc-sm8150.c | 2 +- drivers/clk/qcom/videocc-sm6150.c | 2 +- drivers/clk/qcom/videocc-sm8150.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clk/qcom/gcc-sm6150.c b/drivers/clk/qcom/gcc-sm6150.c index c6f2ad3e376a..84778a5d0915 100644 --- a/drivers/clk/qcom/gcc-sm6150.c +++ b/drivers/clk/qcom/gcc-sm6150.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019, 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 diff --git a/drivers/clk/qcom/gcc-sm8150.c b/drivers/clk/qcom/gcc-sm8150.c index eb19336e9007..53600eda62f7 100644 --- a/drivers/clk/qcom/gcc-sm8150.c +++ b/drivers/clk/qcom/gcc-sm8150.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019, 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 diff --git a/drivers/clk/qcom/gpucc-sm6150.c b/drivers/clk/qcom/gpucc-sm6150.c index 31a3923f8b44..1871ae7e4328 100644 --- a/drivers/clk/qcom/gpucc-sm6150.c +++ b/drivers/clk/qcom/gpucc-sm6150.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019, 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 diff --git a/drivers/clk/qcom/npucc-sm8150.c b/drivers/clk/qcom/npucc-sm8150.c index 6c947f04c669..480357982e89 100644 --- a/drivers/clk/qcom/npucc-sm8150.c +++ b/drivers/clk/qcom/npucc-sm8150.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019, 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 diff --git a/drivers/clk/qcom/videocc-sm6150.c b/drivers/clk/qcom/videocc-sm6150.c index 6430bf7ab39d..f74a97264ae9 100644 --- a/drivers/clk/qcom/videocc-sm6150.c +++ b/drivers/clk/qcom/videocc-sm6150.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019, 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 diff --git a/drivers/clk/qcom/videocc-sm8150.c b/drivers/clk/qcom/videocc-sm8150.c index 19564ba8cbcc..63ab8acdfcba 100644 --- a/drivers/clk/qcom/videocc-sm8150.c +++ b/drivers/clk/qcom/videocc-sm8150.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019, 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 From a96bdf6f037a3f837f9fcf3b655610b6d164976c Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:48:07 +0530 Subject: [PATCH 60/71] Revert "mmc: sdhci-msm: Add hibernation callbacks" This reverts commit 104d337ca31c8d665db8c5511f531c38607b577e. Signed-off-by: UtsavBalar1231 --- drivers/mmc/host/sdhci-msm.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 6bc396cb9cf8..45945ccdf77f 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -5580,19 +5580,6 @@ static int sdhci_msm_suspend_noirq(struct device *dev) return ret; } -static int sdhci_msm_freeze(struct device *dev) -{ - struct sdhci_host *host = dev_get_drvdata(dev); - struct mmc_host *mmc = host->mmc; - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_msm_host *msm_host = pltfm_host->priv; - - if (gpio_is_valid(msm_host->pdata->status_gpio) && - (msm_host->mmc->slot.cd_irq >= 0)) - mmc_gpiod_free_cd_irq(mmc); - return 0; -} - static int sdhci_msm_restore(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); @@ -5601,8 +5588,6 @@ static int sdhci_msm_restore(struct device *dev) if (mmc->inlinecrypt_support) mmc->inlinecrypt_reset_needed = true; - mmc_gpiod_restore_cd_irq(mmc); - return 0; } @@ -5612,9 +5597,7 @@ static const struct dev_pm_ops sdhci_msm_pmops = { .runtime_suspend = sdhci_msm_runtime_suspend, .runtime_resume = sdhci_msm_runtime_resume, .suspend_noirq = sdhci_msm_suspend_noirq, - .freeze = sdhci_msm_freeze, .restore = sdhci_msm_restore, - .thaw = sdhci_msm_restore, }; #define SDHCI_MSM_PMOPS (&sdhci_msm_pmops) From 060ab52ce459719ce303284849469a4208e4829c Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:48:41 +0530 Subject: [PATCH 61/71] Revert "rtc: qpnp-rtc: Add support for thaw callback" This reverts commit b352e11f543d4cd23198300858e5d155cd2c8461. Signed-off-by: UtsavBalar1231 --- drivers/rtc/qpnp-rtc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/rtc/qpnp-rtc.c b/drivers/rtc/qpnp-rtc.c index 579877306d92..624d336a0289 100644 --- a/drivers/rtc/qpnp-rtc.c +++ b/drivers/rtc/qpnp-rtc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, 2017-2019, 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 @@ -734,7 +734,6 @@ static int qpnp_rtc_freeze(struct device *dev) static const struct dev_pm_ops qpnp_rtc_pm_ops = { .freeze = qpnp_rtc_freeze, .restore = qpnp_rtc_restore, - .thaw = qpnp_rtc_restore, }; static const struct of_device_id spmi_match_table[] = { From e96f06818e000cfbdbd513018045fea983073488 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:48:47 +0530 Subject: [PATCH 62/71] Revert "thermal: qcom-spmi-temp-alarm: Add support for thaw callback" This reverts commit 8383d489d0837fc31c4e45436b9aeac898fa2ad5. Signed-off-by: UtsavBalar1231 --- drivers/thermal/qcom-spmi-temp-alarm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c index 783f243ea93f..174c526ae06b 100644 --- a/drivers/thermal/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom-spmi-temp-alarm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015, 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2015, 2017-2019 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 @@ -445,7 +445,6 @@ static int qpnp_tm_freeze(struct device *dev) static const struct dev_pm_ops qpnp_tm_pm_ops = { .freeze = qpnp_tm_freeze, .restore = qpnp_tm_restore, - .thaw = qpnp_tm_restore, }; static const struct of_device_id qpnp_tm_match_table[] = { From e9c2d0634c002fd51366e82ba08ee262d0e95247 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:48:56 +0530 Subject: [PATCH 63/71] Revert "input: qpnp-power-on: Implementing thaw callback" This reverts commit 75025cb913204ac327d7b2cdf7a41ddb2298d964. Signed-off-by: UtsavBalar1231 --- drivers/input/misc/qpnp-power-on.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/misc/qpnp-power-on.c b/drivers/input/misc/qpnp-power-on.c index df9fa421072f..d84f3c0ae33e 100644 --- a/drivers/input/misc/qpnp-power-on.c +++ b/drivers/input/misc/qpnp-power-on.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2019, 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 @@ -2513,7 +2513,6 @@ static int qpnp_pon_freeze(struct device *dev) static const struct dev_pm_ops qpnp_pon_pm_ops = { .freeze = qpnp_pon_freeze, .restore = qpnp_pon_restore, - .thaw = qpnp_pon_restore, }; #endif From 2560482cb26eaf27407a6545c3f48181fe04eda4 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:49:02 +0530 Subject: [PATCH 64/71] Revert "iio: adc: Implementing thaw callback" This reverts commit c58da26a1ea80c2b8b90bf7229c0c84c22ccf31e. Signed-off-by: UtsavBalar1231 --- drivers/iio/adc/qcom-spmi-adc5.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c index f34c2ac8490e..f16ba898cc47 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019, 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 @@ -1140,7 +1140,6 @@ static int adc_freeze(struct device *dev) static const struct dev_pm_ops adc_pm_ops = { .freeze = adc_freeze, .restore = adc_restore, - .thaw = adc_restore, }; static struct platform_driver adc_driver = { From f046374761986e2501c52f5c34dfcab781a9a0b3 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:49:08 +0530 Subject: [PATCH 65/71] Revert "i2c: i2c-qcom-geni: Implementing thaw callback" This reverts commit b557b058afe685d2f18062ecb2410109e9ad0850. Signed-off-by: UtsavBalar1231 --- drivers/i2c/busses/i2c-qcom-geni.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 255074d7ef76..fdc76ebe32a6 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019, 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 @@ -1168,7 +1168,6 @@ static const struct dev_pm_ops geni_i2c_pm_ops = { .runtime_resume = geni_i2c_runtime_resume, .freeze = geni_i2c_suspend_noirq, .restore = geni_i2c_hib_resume_noirq, - .thaw = geni_i2c_hib_resume_noirq, }; static void ssr_i2c_force_suspend(struct device *dev) From 176e344cfe47db97e8f771a71bf4351bdda0bb89 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:49:17 +0530 Subject: [PATCH 66/71] Revert "soc: qcom: smem: Implementing thaw callback" This reverts commit 0c4ac9f6ad74f264dcdc8cd71b26596d136481e8. Signed-off-by: UtsavBalar1231 --- drivers/soc/qcom/smem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index fd350aee2675..39d26ea60342 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -1094,9 +1094,8 @@ static int qcom_smem_restore(struct device *dev) } static const struct dev_pm_ops qcom_smem_pm_ops = { - .freeze_late = qcom_smem_freeze, - .restore_early = qcom_smem_restore, - .thaw_early = qcom_smem_restore, + .freeze = qcom_smem_freeze, + .restore = qcom_smem_restore, }; static const struct of_device_id qcom_smem_of_match[] = { From 141df1ea5ff6e7ec2defe722fa468af2314915a8 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:49:23 +0530 Subject: [PATCH 67/71] Revert "soc: qcom: smp2p: Implementing thaw callback" This reverts commit bbe98cb353a3d05bcf43d8025e5a76a7ca7277b4. Signed-off-by: UtsavBalar1231 --- drivers/soc/qcom/smp2p.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index 93bd83ee6aa9..1b5e81ecf74f 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -720,7 +720,7 @@ static int qcom_smp2p_remove(struct platform_device *pdev) return 0; } -static int qcom_smp2p_restore(struct device *dev) +static int qcom_smp2p_resume(struct device *dev) { int ret = 0; struct qcom_smp2p *smp2p = dev_get_drvdata(dev); @@ -757,7 +757,6 @@ static int qcom_smp2p_restore(struct device *dev) } wakeup_source_init(&smp2p->ws, "smp2p"); - enable_irq_wake(smp2p->irq); /* Kick the outgoing edge after allocating entries */ qcom_smp2p_kick(smp2p); @@ -768,13 +767,12 @@ print_err: return ret; } -static int qcom_smp2p_freeze(struct device *dev) +static int qcom_smp2p_suspend(struct device *dev) { struct qcom_smp2p *smp2p = dev_get_drvdata(dev); struct smp2p_entry *entry; struct smp2p_entry *next_entry; - disable_irq_wake(smp2p->irq); /* Walk through the out bound list and release state and entry */ list_for_each_entry_safe(entry, next_entry, &smp2p->outbound, node) { qcom_smem_state_unregister(entry->state); @@ -796,9 +794,8 @@ static int qcom_smp2p_freeze(struct device *dev) } static const struct dev_pm_ops qcom_smp2p_pm_ops = { - .freeze = qcom_smp2p_freeze, - .restore = qcom_smp2p_restore, - .thaw = qcom_smp2p_restore, + .freeze = qcom_smp2p_suspend, + .restore = qcom_smp2p_resume, }; static const struct of_device_id qcom_smp2p_of_match[] = { From fc8ff74ab978a51dcff7d8c9b3854ba9264c58e5 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:49:45 +0530 Subject: [PATCH 68/71] Revert "firmware: qcom: Register call back functions for hibernation" This reverts commit 65480aa5173ad93242aae07ff6b4f47e4d4b74c1. Signed-off-by: UtsavBalar1231 --- drivers/firmware/qcom/tz_log.c | 37 ++-------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/drivers/firmware/qcom/tz_log.c b/drivers/firmware/qcom/tz_log.c index f8d3dd338506..4eb9295af09d 100644 --- a/drivers/firmware/qcom/tz_log.c +++ b/drivers/firmware/qcom/tz_log.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2019, 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 @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -1131,6 +1130,7 @@ err: return -ENXIO; } + static int tz_log_remove(struct platform_device *pdev) { kzfree(tzdbg.diag_buf); @@ -1141,38 +1141,6 @@ static int tz_log_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM -static int tz_log_freeze(struct device *dev) -{ - dma_free_coherent(dev, QSEE_LOG_BUF_SIZE, (void *)g_qsee_log, - coh_pmem); - - return 0; -} - -static int tz_log_restore(struct device *dev) -{ - /* Register the log bugger at TZ during hibernation resume. - * After hibernation the log buffer is with HLOS as TZ encountered - * a coldboot sequence. - */ - tzdbg_register_qsee_log_buf(to_platform_device(dev)); - - return 0; -} - -static const struct dev_pm_ops tz_log_pmops = { - .freeze = tz_log_freeze, - .restore = tz_log_restore, - .thaw = tz_log_restore, -}; - -#define TZ_LOG_PMOPS (&tz_log_pmops) - -#else -#define TZ_LOG_PMOPS NULL -#endif - static const struct of_device_id tzlog_match[] = { { .compatible = "qcom,tz-log", }, @@ -1187,7 +1155,6 @@ static struct platform_driver tz_log_driver = { .owner = THIS_MODULE, .of_match_table = tzlog_match, .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .pm = TZ_LOG_PMOPS, }, }; From f037ccbc7162a85994798b00a7705c271dd6b3ea Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:49:53 +0530 Subject: [PATCH 69/71] Revert "soc: qcom: Implement hibernation callbacks for jtag-etm" This reverts commit 3bc1b425352cf9c80375a2b4e8bb537e4f4dd156. Signed-off-by: UtsavBalar1231 --- drivers/soc/qcom/jtagv8-etm.c | 56 ++--------------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/drivers/soc/qcom/jtagv8-etm.c b/drivers/soc/qcom/jtagv8-etm.c index e118e51e624e..96004e927677 100644 --- a/drivers/soc/qcom/jtagv8-etm.c +++ b/drivers/soc/qcom/jtagv8-etm.c @@ -245,7 +245,6 @@ struct etm_ctx { static struct etm_ctx *etm[NR_CPUS]; static int cnt; -static bool hibernation_freeze; static struct clk *clock[NR_CPUS]; @@ -1438,8 +1437,7 @@ void msm_jtag_etm_save_state(void) cpu = raw_smp_processor_id(); - if (!etm[cpu] || etm[cpu]->save_restore_disabled - || hibernation_freeze) + if (!etm[cpu] || etm[cpu]->save_restore_disabled) return; if (etm[cpu]->save_restore_enabled) { @@ -1457,8 +1455,7 @@ void msm_jtag_etm_restore_state(void) cpu = raw_smp_processor_id(); - if (!etm[cpu] || etm[cpu]->save_restore_disabled - || hibernation_freeze) + if (!etm[cpu] || etm[cpu]->save_restore_disabled) return; /* @@ -1726,54 +1723,6 @@ static int jtag_mm_remove(struct platform_device *pdev) return 0; } -static void msm_jtag_etm_save_state_hib(void *unused_info) -{ - msm_jtag_etm_save_state(); -} - -static void msm_jtag_etm_restore_state_hib(void *unused_info) -{ - msm_jtag_etm_restore_state(); -} - -static int jtag_mm_freeze(struct device *dev) -{ - int cpu; - - if (hibernation_freeze) - return 0; - get_online_cpus(); - on_each_cpu(msm_jtag_etm_save_state_hib, - NULL, true); - for_each_online_cpu(cpu) - clk_disable_unprepare(clock[cpu]); - put_online_cpus(); - hibernation_freeze = true; - return 0; -} - -static int jtag_mm_restore(struct device *dev) -{ - int cpu; - - if (!hibernation_freeze) - return 0; - get_online_cpus(); - for_each_online_cpu(cpu) - clk_prepare_enable(clock[cpu]); - on_each_cpu(msm_jtag_etm_restore_state_hib, - NULL, true); - put_online_cpus(); - hibernation_freeze = false; - return 0; -} - -static const struct dev_pm_ops jtag_mm_pm_ops = { - .freeze = jtag_mm_freeze, - .restore = jtag_mm_restore, - .thaw = jtag_mm_restore, -}; - static const struct of_device_id msm_qdss_mm_match[] = { { .compatible = "qcom,jtagv8-mm"}, {} @@ -1786,7 +1735,6 @@ static struct platform_driver jtag_mm_driver = { .name = "msm-jtagv8-mm", .owner = THIS_MODULE, .of_match_table = msm_qdss_mm_match, - .pm = &jtag_mm_pm_ops, }, }; From 3629222f6f22c7c83081aa75d41ee385270f87c1 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:50:09 +0530 Subject: [PATCH 70/71] Revert "iommu: arm-smmu: Use same callback for thaw and restore" This reverts commit 40616de577fadd7283e659d0ca9126d933e984e0. Signed-off-by: UtsavBalar1231 --- drivers/iommu/arm-smmu.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 954006f81b87..41aabe1ef86d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -320,7 +320,9 @@ struct arm_smmu_device { struct arm_smmu_arch_ops *arch_ops; void *archdata; +#ifdef CONFIG_HIBERNATION bool smmu_restore; +#endif enum tz_smmu_device_id sec_id; }; @@ -1916,7 +1918,9 @@ static void arm_smmu_write_context_bank(struct arm_smmu_device *smmu, int idx, struct arm_smmu_cb *cb = &smmu->cbs[idx]; struct arm_smmu_cfg *cfg = cb->cfg; void __iomem *cb_base, *gr1_base; +#ifdef CONFIG_HIBERNATION struct arm_smmu_domain *smmu_domain; +#endif cb_base = ARM_SMMU_CB(smmu, idx); @@ -1994,10 +1998,12 @@ static void arm_smmu_write_context_bank(struct arm_smmu_device *smmu, int idx, /* Ensure bypass transactions are Non-shareable */ reg |= SCTLR_SHCFG_NSH << SCTLR_SHCFG_SHIFT; +#ifdef CONFIG_HIBERNATION if (smmu->smmu_restore) { smmu_domain = container_of(cfg, struct arm_smmu_domain, cfg); attributes = smmu_domain->attributes; } +#endif if (attributes & (1 << DOMAIN_ATTR_CB_STALL_DISABLE)) { reg &= ~SCTLR_CFCFG; reg |= SCTLR_HUPCF; @@ -5192,6 +5198,11 @@ static int __maybe_unused arm_smmu_pm_resume(struct device *dev) arm_smmu_device_reset(smmu); arm_smmu_power_off(smmu->pwr); + +#ifdef CONFIG_HIBERNATION + smmu->smmu_restore = false; +#endif + return 0; } @@ -5201,7 +5212,7 @@ static int __maybe_unused arm_smmu_pm_restore_early(struct device *dev) struct arm_smmu_domain *smmu_domain; struct io_pgtable_ops *pgtbl_ops; struct arm_smmu_cb *cb; - int idx, ret; + int idx; /* restore the secure pools */ for (idx = 0; idx < smmu->num_context_banks; idx++) { @@ -5228,10 +5239,10 @@ static int __maybe_unused arm_smmu_pm_restore_early(struct device *dev) arm_smmu_init_context_bank(smmu_domain, &smmu_domain->pgtbl_cfg); } +#ifdef CONFIG_HIBERNATION smmu->smmu_restore = true; - ret = arm_smmu_pm_resume(dev); - smmu->smmu_restore = false; - return ret; +#endif + return arm_smmu_pm_resume(dev); } static int __maybe_unused arm_smmu_pm_freeze_late(struct device *dev) @@ -5268,7 +5279,7 @@ static int __maybe_unused arm_smmu_pm_freeze_late(struct device *dev) static const struct dev_pm_ops arm_smmu_pm_ops = { .resume = arm_smmu_pm_resume, - .thaw_early = arm_smmu_pm_restore_early, + .thaw_early = arm_smmu_pm_resume, .freeze_late = arm_smmu_pm_freeze_late, .restore_early = arm_smmu_pm_restore_early, }; From 47a5dc7a8f7bab111b8797d1105ddd3fa74ad276 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Tue, 23 Jun 2020 12:57:47 +0530 Subject: [PATCH 71/71] Revert "iommu: arm-smmu: Make restore of smmu-context runtime detectable" This reverts commit 76fa02bfca51b244a26adc986247613c71699345. Signed-off-by: UtsavBalar1231 --- drivers/iommu/arm-smmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 41aabe1ef86d..e65a54656c23 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -4260,7 +4260,7 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) * invalid and all S2CRn as bypass unless overridden. */ if (!(smmu->options & ARM_SMMU_OPT_SKIP_INIT) || - (IS_ENABLED(CONFIG_HIBERNATION) && smmu->smmu_restore)) { + IS_ENABLED(CONFIG_HIBERNATION)) { for (i = 0; i < smmu->num_mapping_groups; ++i) arm_smmu_write_sme(smmu, i);