From patchwork Thu Apr 23 20:39:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29899C54FD0 for ; Thu, 23 Apr 2020 20:40:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0788A2073A for ; Thu, 23 Apr 2020 20:40:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jKwFagkG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726431AbgDWUkU (ORCPT ); Thu, 23 Apr 2020 16:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUkU (ORCPT ); Thu, 23 Apr 2020 16:40:20 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB8CC09B042 for ; Thu, 23 Apr 2020 13:40:20 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id j1so8247074wrt.1 for ; Thu, 23 Apr 2020 13:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7zz7r9V0x/QZvtIG3hUTtMT9sO8PLDBN9RVONCQN7gs=; b=jKwFagkGaWpIhbziUC7IlwxHjo58qJKGbFCF/LDIFZs5euPlIuyWR3iEokS1j9tYgt u//xIAQid1eovRiS5iw79v1SVVGUxPb7adHzydLY67+Vot8Nf10sh7hQRz/D4KwdBlIO p0ngDmgRVTdWVnHQwQUdWP0NXa55NuUBIoV3DRUu+Y94yXtjoRDNIBycmr4gd68SoMre WGy9UUfTiHIIkwUPygghPHA4cuTyzdY+IvPj4KILXOJoIFCcaGPW8iUjZHjPM9uPlVgD r+8FQlHjzv88vO2dKtfz/0uR5hDHWtnoV3Cx2Byjr2cbJaoxgqQAsl3SP5NePVU1IaLW p8CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7zz7r9V0x/QZvtIG3hUTtMT9sO8PLDBN9RVONCQN7gs=; b=D8MfQNAAw5LW8EneVVzc1Fcg6ObIvKtWy7q8HNOze1U6BBKQ7AmOPOSGZ86kRvVAfL eJPTxuCjgeGptHi3o61Ap98PzfPJnEc7FWRUng+Horfdall8XRzfHbV8Fl66IRKzOzPs zojGbNcgEuKWLZ72Ab86WX7r5NSwv3m73mH+G54XsWVuAF8E6H3iynbScWLXIvDDdvAH fkP2+wcKg8Xnky6upHNEk0/YCXo9cx/A5rXPlOcIb6fHVyLkTRjzs5HoqaZXjTsQl//3 LMnWPFm2tX5xwxPLwZ5tGtGqT6RaUWAmfAspVe9tHkfMXN7Z7njqUuIOoPYMzpV7RtEj np5Q== X-Gm-Message-State: AGi0PuZ/No6cF4JzgxYJLCVdRJSG07o9Onc9OS9vcDV46H/Wbv8v+xaO YM8qScmUBMyWXOwvzBU/fXLskRAYhV0= X-Google-Smtp-Source: APiQypL6oQ6wx+ZOZIzqXQRngqj2fPHjVsLOIhhbNF/ef4Yn5dJ5OwbQgwpoa++T3Wyf4quTD7lSzw== X-Received: by 2002:adf:fecd:: with SMTP id q13mr7375968wrs.12.1587674418434; Thu, 23 Apr 2020 13:40:18 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:17 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Rob Clark , Stephen Boyd , Stephen Boyd , Jordan Crouse , Sean Paul , Lee Jones Subject: [PATCH 4.4 01/16] drm/msm: stop abusing dma_map/unmap for cache Date: Thu, 23 Apr 2020 21:39:59 +0100 Message-Id: <20200423204014.784944-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rob Clark [ Upstream commit 0036bc73ccbe7e600a3468bf8e8879b122252274 ] Recently splats like this started showing up: WARNING: CPU: 4 PID: 251 at drivers/iommu/dma-iommu.c:451 __iommu_dma_unmap+0xb8/0xc0 Modules linked in: ath10k_snoc ath10k_core fuse msm ath mac80211 uvcvideo cfg80211 videobuf2_vmalloc videobuf2_memops vide CPU: 4 PID: 251 Comm: kworker/u16:4 Tainted: G W 5.2.0-rc5-next-20190619+ #2317 Hardware name: LENOVO 81JL/LNVNB161216, BIOS 9UCN23WW(V1.06) 10/25/2018 Workqueue: msm msm_gem_free_work [msm] pstate: 80c00005 (Nzcv daif +PAN +UAO) pc : __iommu_dma_unmap+0xb8/0xc0 lr : __iommu_dma_unmap+0x54/0xc0 sp : ffff0000119abce0 x29: ffff0000119abce0 x28: 0000000000000000 x27: ffff8001f9946648 x26: ffff8001ec271068 x25: 0000000000000000 x24: ffff8001ea3580a8 x23: ffff8001f95ba010 x22: ffff80018e83ba88 x21: ffff8001e548f000 x20: fffffffffffff000 x19: 0000000000001000 x18: 00000000c00001fe x17: 0000000000000000 x16: 0000000000000000 x15: ffff000015b70068 x14: 0000000000000005 x13: 0003142cc1be1768 x12: 0000000000000001 x11: ffff8001f6de9100 x10: 0000000000000009 x9 : ffff000015b78000 x8 : 0000000000000000 x7 : 0000000000000001 x6 : fffffffffffff000 x5 : 0000000000000fff x4 : ffff00001065dbc8 x3 : 000000000000000d x2 : 0000000000001000 x1 : fffffffffffff000 x0 : 0000000000000000 Call trace: __iommu_dma_unmap+0xb8/0xc0 iommu_dma_unmap_sg+0x98/0xb8 put_pages+0x5c/0xf0 [msm] msm_gem_free_work+0x10c/0x150 [msm] process_one_work+0x1e0/0x330 worker_thread+0x40/0x438 kthread+0x12c/0x130 ret_from_fork+0x10/0x18 ---[ end trace afc0dc5ab81a06bf ]--- Not quite sure what triggered that, but we really shouldn't be abusing dma_{map,unmap}_sg() for cache maint. Cc: Stephen Boyd Tested-by: Stephen Boyd Reviewed-by: Jordan Crouse Signed-off-by: Rob Clark Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190630124735.27786-1-robdclark@gmail.com Signed-off-by: Lee Jones --- drivers/gpu/drm/msm/msm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 644faf3ae93a3..055859095cf01 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -104,7 +104,7 @@ static struct page **get_pages(struct drm_gem_object *obj) * because display controller, GPU, etc. are not coherent: */ if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) - dma_map_sg(dev->dev, msm_obj->sgt->sgl, + dma_sync_sg_for_device(dev->dev, msm_obj->sgt->sgl, msm_obj->sgt->nents, DMA_BIDIRECTIONAL); } @@ -120,7 +120,7 @@ static void put_pages(struct drm_gem_object *obj) * because display controller, GPU, etc. are not coherent: */ if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) - dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl, + dma_sync_sg_for_cpu(obj->dev->dev, msm_obj->sgt->sgl, msm_obj->sgt->nents, DMA_BIDIRECTIONAL); if (msm_obj->sgt) From patchwork Thu Apr 23 20:40:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8A0AC54FCB for ; Thu, 23 Apr 2020 20:40:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85E7420781 for ; Thu, 23 Apr 2020 20:40:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WzDYhDFQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbgDWUkX (ORCPT ); Thu, 23 Apr 2020 16:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUkW (ORCPT ); Thu, 23 Apr 2020 16:40:22 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C196C09B042 for ; Thu, 23 Apr 2020 13:40:22 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id d15so6627527wrx.3 for ; Thu, 23 Apr 2020 13:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=66ViJN+ZbAv/wx0SyJm9vds07oz/mQTCqp+w3CnCjhk=; b=WzDYhDFQM/2pjutTBgryIaO1DpIKReI0rISqK3Jqok7kpFSj1eagDSr5ywq2WRyBNW eukh90hKQfwuKx8LpDrlhC1NPRlGPay9ANIrLEhRS/nMKx+S8dZCgxs5rc96UJM6ZYCe 2OAnVLe7aDR/fOHJWY74441+b5FKiOk127YIeVMIjYbTLXB4BPoVqs81EpGpF1utAwLK Jv5RIxojmhx8Zn3OtgCdzSLyHt3AK+/WL2+YKHML7RA+mFczS/D8SoA52yOhi8AMmY1s KAS9kmCGfRcZL9sKEPWzwW7OEaKFc0FW+ks7klEwlOsfijWZFcPGqDqpsRKCe952HHsQ woYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=66ViJN+ZbAv/wx0SyJm9vds07oz/mQTCqp+w3CnCjhk=; b=h7cGNKGnOf0CaaMfVoQksKfLhYPdXavc5mVRBAafi/dcDb0dtf/lb45Y7WAEDIlx2e slqucmDaJM+qI9RBHlX+QdXPBpw/54PLKdWwhozE+LRdvWc1KqIge3JqO5IPh5UzefLo 7HapExaGW/xQEY4shFmMnSWuPzhLnk6lgWtQywSI0dEXzCdWOQW2ou+npdixFuXROtmL T7cpZ09j+ufIfuEuSV0wFiX1Wn5rIMulsklhBjcOEpjU9aOSBX7z2xY/cNGP0UZiUVai Y0vBfoVh/XRj+UvVxux1cEIRsMuUKgO7zlW8gBZYDv5VjzQ+2TMQQV6VpZi3sOrXsfyP WPuQ== X-Gm-Message-State: AGi0PuZqQlcDHmYZSz8cGiwFk8ENXS5ET+pGTIRWvCrotPe/cz6O7B/m 5Fng4YE8NGh4Osm1yurapzz13Z3HWJ0= X-Google-Smtp-Source: APiQypI0ovxnSnLxg4sonbzSoaCoggnNvGwbnayVuFhFszPHXdDB8xcLJKhFvQWxMr94hs1LH2dhlg== X-Received: by 2002:adf:e681:: with SMTP id r1mr7492314wrm.213.1587674420911; Thu, 23 Apr 2020 13:40:20 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:20 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Alexey Brodkin , Alexey Brodkin , Greg Kroah-Hartman , Geert Uytterhoeven , David Laight , Peter Zijlstra , Thomas Gleixner , Vineet Gupta , Will Deacon , Greg KH , Lee Jones Subject: [PATCH 4.4 03/16] devres: Align data[] to ARCH_KMALLOC_MINALIGN Date: Thu, 23 Apr 2020 21:40:01 +0100 Message-Id: <20200423204014.784944-4-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexey Brodkin [ Upstream commit a66d972465d15b1d89281258805eb8b47d66bd36 ] Initially we bumped into problem with 32-bit aligned atomic64_t on ARC, see [1]. And then during quite lengthly discussion Peter Z. mentioned ARCH_KMALLOC_MINALIGN which IMHO makes perfect sense. If allocation is done by plain kmalloc() obtained buffer will be ARCH_KMALLOC_MINALIGN aligned and then why buffer obtained via devm_kmalloc() should have any other alignment? This way we at least get the same behavior for both types of allocation. [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004009.html [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004036.html Signed-off-by: Alexey Brodkin Cc: Greg Kroah-Hartman Cc: Geert Uytterhoeven Cc: David Laight Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vineet Gupta Cc: Will Deacon Cc: Greg KH Cc: # 4.8+ Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lee Jones --- drivers/base/devres.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/base/devres.c b/drivers/base/devres.c index 8fc654f0807bf..9763325a9c944 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -24,8 +24,14 @@ struct devres_node { struct devres { struct devres_node node; - /* -- 3 pointers */ - unsigned long long data[]; /* guarantee ull alignment */ + /* + * Some archs want to perform DMA into kmalloc caches + * and need a guaranteed alignment larger than + * the alignment of a 64-bit integer. + * Thus we use ARCH_KMALLOC_MINALIGN here and get exactly the same + * buffer alignment as if it was allocated by plain kmalloc(). + */ + u8 __aligned(ARCH_KMALLOC_MINALIGN) data[]; }; struct devres_group { From patchwork Thu Apr 23 20:40:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99FF1C54FCB for ; Thu, 23 Apr 2020 20:40:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78C662073A for ; Thu, 23 Apr 2020 20:40:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gP3/LICI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726363AbgDWUk0 (ORCPT ); Thu, 23 Apr 2020 16:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUkZ (ORCPT ); Thu, 23 Apr 2020 16:40:25 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACFBC09B042 for ; Thu, 23 Apr 2020 13:40:25 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id g13so8229606wrb.8 for ; Thu, 23 Apr 2020 13:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ew2Jpv/icPL2fFBz/NSetkxvuqhRbbQqlWSu01ZZe7k=; b=gP3/LICIST+uyZSXUIWtRp76JpME4XsSbcRzo2YA+RpJnJhXiVLbKxlJIBnSQ+wHNM QvsoE5yPiNJgPFMahU1V+HtjQlshcD2dxYXDmePfCAXQxhjnsbYlYa2RuM0yAIFmVtkL b0fDwJREk9StpiLFYHm2tPMmwLtazP5cfKIid7HvANCawPlHOBD6xgWt+ARRzfdWrx9x pKp/tOJRLnqxY8T1H6an6/3DzhlTby8EeoMRYovxS4Jg9dM+LV8K4hcoPxmr4ufFHDAW osdUTDbXK/dHRehou//4f0xywlVQGhfzh2vTMiPEQArmqMj4IEuGMH1kCnalSHNhVk48 U+Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ew2Jpv/icPL2fFBz/NSetkxvuqhRbbQqlWSu01ZZe7k=; b=UGeN1zepLjNdZuV58nat4m//uEPTtVAjurwHH+mD6SS2wNlpIg24nDbEJQizhOz6dM Ax7PI3F63Q2Yst2+4TN4rDYqwH/Mc+NSBYVs9NlJSeLLW4Vhd1JLwzxjCOiHRKhZsG83 WJFAJSTtvj3PtKoq+ucVukmSS4gy1PXdPb4q74Je0wHZj9eyIfsgMstBULHpgrFqbhc8 VfbSHB0HgmxBxNe/dD79BwE7x9WaaUqQ07dH44isgGQ8krm0dWe13Ab2dy8gkBEsHpTi QXnB6853nUUjtdp960llATje9nWGrFI1IVvIZ0uI/kV/e1AizVkRoc1lt0ZbI9cgvNQL peJQ== X-Gm-Message-State: AGi0PuYTgOveicUMMYdP1hqPEdSvtUVLlNwkv32YmYwlMQZ2qpny0Tr7 12r4yHb9K1WhSKq4OmZrF3i2abkV6OA= X-Google-Smtp-Source: APiQypLzTUOypQ2yuVImV2sNpTdc2VAuClxn9BmdVyromIMQQ+fxm1Gz5aOheFx3O3KYZkekfvwH0w== X-Received: by 2002:adf:dbce:: with SMTP id e14mr6432260wrj.337.1587674423909; Thu, 23 Apr 2020 13:40:23 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:22 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Joe Moriarty , Steven Sistare , Daniel Vetter , Lee Jones Subject: [PATCH 4.4 05/16] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem Date: Thu, 23 Apr 2020 21:40:03 +0100 Message-Id: <20200423204014.784944-6-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Joe Moriarty [ Upstream commit 22a07038c0eaf4d1315a493ce66dcd255accba19 ] The Parfait (version 2.1.0) static code analysis tool found the following NULL pointer derefernce problem. - drivers/gpu/drm/drm_dp_mst_topology.c The call to drm_dp_calculate_rad() in function drm_dp_port_setup_pdt() could result in a NULL pointer being returned to port->mstb due to a failure to allocate memory for port->mstb. Signed-off-by: Joe Moriarty Reviewed-by: Steven Sistare Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180212195144.98323-3-joe.moriarty@oracle.com Signed-off-by: Lee Jones --- drivers/gpu/drm/drm_dp_mst_topology.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index f5229b083f8ea..abf5bd09de33b 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1036,10 +1036,12 @@ static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port) lct = drm_dp_calculate_rad(port, rad); port->mstb = drm_dp_add_mst_branch_device(lct, rad); - port->mstb->mgr = port->mgr; - port->mstb->port_parent = port; + if (port->mstb) { + port->mstb->mgr = port->mgr; + port->mstb->port_parent = port; - send_link = true; + send_link = true; + } break; } return send_link; From patchwork Thu Apr 23 20:40:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 569EBC54FCB for ; Thu, 23 Apr 2020 20:40:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EE8D2073A for ; Thu, 23 Apr 2020 20:40:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YImBtfcq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726081AbgDWUk2 (ORCPT ); Thu, 23 Apr 2020 16:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUk2 (ORCPT ); Thu, 23 Apr 2020 16:40:28 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3F69C09B043 for ; Thu, 23 Apr 2020 13:40:27 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id e26so8085998wmk.5 for ; Thu, 23 Apr 2020 13:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vKfw9AfAdJ2YHMBV1ZmU+GPWL5F8lIGFXz5D5eCrsvU=; b=YImBtfcq0PAlko0Ad+nVxYzGVzAQD93VK+6nmduYv7zlR1SlswTlkBIGcbi/Fw2QXc z+mpWS3G3o6CRfc+ru2DwQKCJr4XSa+KN91dXle8U+BN7PBpR0AywcnD2vEKFasPpZqy x4EyBrI37hUQQGJEtuICf+diUF6Q151TJ8sftao5f3d0w0+ioi0P9QPI+NV0QtDu+RZ1 uMPZ6m83WaVTv/pKtqH+0QE3xgZPvw49nKPI3iC92WA30we/m4+WmPmFKR+G7d1249Hu 3UHlBPsLWQVJKx9QBX72M+DLE9UPhYS0s1h+hZTDIj66XkOHsj+hCQxui0pnVH2Kri2W c7xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vKfw9AfAdJ2YHMBV1ZmU+GPWL5F8lIGFXz5D5eCrsvU=; b=kPcwXqvHrqeDM9ntC8t+hWS9Vw9KpqdEXumN4DX7BStP4k/RAYdqiNmN0SReVkf6Fa WjNkYJINYPFXvv5rkElCf3XXrFDj44WhsW6xZxCSp1kk+ud3A+kWDU0QgJw3042o0R/2 9dP9c4zhfAqeL3k/3jTwzxXckDEJO2FNTeWqBpcbnPhdCWafixrrAXNaExTkgcns4g8t /V5V5x9RT8sew3Na0ZCg7EsV1zDS1iaFhfklI1XLwnm+acVFQULZumGlE93D+CRNmz0M BjKkdEGH9t8E0W/BWE8j+mVRZLtrOmKdSaIseUjsRFM6Qdxs/kTQC25+L7l5itQjOZg0 efAg== X-Gm-Message-State: AGi0PuYuYTxepMottBtoB1J4OG+8wYb2aVYKgpHA3D+SFspWPKt1IgOK KyjGV9KQDZcejRTrxKPUsbtOHvY+RzQ= X-Google-Smtp-Source: APiQypIBEOg3BxJe/eLukyBq6aW5bCup8jimw68sZgm3rk72K6y3xbD/TSGNuKcZnTBS6A45sW/jEA== X-Received: by 2002:a1c:9a81:: with SMTP id c123mr5774079wme.115.1587674426197; Thu, 23 Apr 2020 13:40:26 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:25 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Will Deacon , Laura Abbott , Lee Jones Subject: [PATCH 4.4 07/16] arm64: traps: Don't print stack or raw PC/LR values in backtraces Date: Thu, 23 Apr 2020 21:40:05 +0100 Message-Id: <20200423204014.784944-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon [ Upstream commit a25ffd3a6302a67814280274d8f1aa4ae2ea4b59 ] Printing raw pointer values in backtraces has potential security implications and are of questionable value anyway. This patch follows x86's lead and removes the "Exception stack:" dump from kernel backtraces, as well as converting PC/LR values to symbols such as "sysrq_handle_crash+0x20/0x30". Tested-by: Laura Abbott Signed-off-by: Will Deacon Signed-off-by: Lee Jones --- arch/arm64/kernel/process.c | 9 +++-- arch/arm64/kernel/traps.c | 72 ++----------------------------------- 2 files changed, 7 insertions(+), 74 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 10d6627673cbf..2733b04900d1c 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -180,11 +180,10 @@ void __show_regs(struct pt_regs *regs) } show_regs_print_info(KERN_DEFAULT); - print_symbol("PC is at %s\n", instruction_pointer(regs)); - print_symbol("LR is at %s\n", lr); - printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", - regs->pc, lr, regs->pstate); - printk("sp : %016llx\n", sp); + print_symbol("pc : %s\n", regs->pc); + print_symbol("lr : %s\n", lr); + printk("sp : %016llx pstate : %08llx\n", sp, regs->pstate); + for (i = top_reg; i >= 0; i--) { printk("x%-2d: %016llx ", i, regs->regs[i]); if (i % 2 == 0) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 02710f99c1374..0cc78d60dac33 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -51,63 +51,9 @@ static const char *handler[]= { int show_unhandled_signals = 0; -/* - * Dump out the contents of some memory nicely... - */ -static void dump_mem(const char *lvl, const char *str, unsigned long bottom, - unsigned long top, bool compat) -{ - unsigned long first; - mm_segment_t fs; - int i; - unsigned int width = compat ? 4 : 8; - - /* - * We need to switch to kernel mode so that we can use __get_user - * to safely read from kernel space. - */ - fs = get_fs(); - set_fs(KERNEL_DS); - - printk("%s%s(0x%016lx to 0x%016lx)\n", lvl, str, bottom, top); - - for (first = bottom & ~31; first < top; first += 32) { - unsigned long p; - char str[sizeof(" 12345678") * 8 + 1]; - - memset(str, ' ', sizeof(str)); - str[sizeof(str) - 1] = '\0'; - - for (p = first, i = 0; i < (32 / width) - && p < top; i++, p += width) { - if (p >= bottom && p < top) { - unsigned long val; - - if (width == 8) { - if (__get_user(val, (unsigned long *)p) == 0) - sprintf(str + i * 17, " %016lx", val); - else - sprintf(str + i * 17, " ????????????????"); - } else { - if (__get_user(val, (unsigned int *)p) == 0) - sprintf(str + i * 9, " %08lx", val); - else - sprintf(str + i * 9, " ????????"); - } - } - } - printk("%s%04lx:%s\n", lvl, first & 0xffff, str); - } - - set_fs(fs); -} - static void dump_backtrace_entry(unsigned long where) { - /* - * Note that 'where' can have a physical address, but it's not handled. - */ - print_ip_sym(where); + printk(" %pS\n", (void *)where); } static void __dump_instr(const char *lvl, struct pt_regs *regs) @@ -170,20 +116,11 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) } pr_emerg("Call trace:\n"); - while (1) { + do { unsigned long where = frame.pc; - unsigned long stack; - int ret; dump_backtrace_entry(where); - ret = unwind_frame(&frame); - if (ret < 0) - break; - stack = frame.sp; - if (in_exception_text(where)) - dump_mem("", "Exception stack", stack, - stack + sizeof(struct pt_regs), false); - } + } while (!unwind_frame(&frame)); } void show_stack(struct task_struct *tsk, unsigned long *sp) @@ -220,9 +157,6 @@ static int __die(const char *str, int err, struct thread_info *thread, TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1); if (!user_mode(regs) || in_interrupt()) { - dump_mem(KERN_EMERG, "Stack: ", regs->sp, - THREAD_SIZE + (unsigned long)task_stack_page(tsk), - compat_user_mode(regs)); dump_backtrace(regs, tsk); dump_instr(KERN_EMERG, regs); } From patchwork Thu Apr 23 20:40:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51743C54FD0 for ; Thu, 23 Apr 2020 20:40:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FE1420781 for ; Thu, 23 Apr 2020 20:40:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qzoOo3I8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726840AbgDWUka (ORCPT ); Thu, 23 Apr 2020 16:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUka (ORCPT ); Thu, 23 Apr 2020 16:40:30 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADB6C09B042 for ; Thu, 23 Apr 2020 13:40:30 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id x17so7492628wrt.5 for ; Thu, 23 Apr 2020 13:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2pZHt+hAsIb+Y7qJYHv626ADWtS8jmmdGfuI//hKgVk=; b=qzoOo3I8cRfX6MkdFJqq6RfvQNTBNZpPZezGm0Z9Q48HYA5S8TgKbjZ72D7+H7HZ0B HbomgluFtve7s8MNbFZnVLMzUlZaSfWN8N9KP7CPtvmxNpvER3cRN72pab2BTmSzSgp9 l3uULjj0sYtZZgDcyYIW8CI3hJwPkooYNI7P64SKzPqtgishpp7gxHR596IU6zuuj8YZ Rj/C0OEwDHxdXbkxb/ElCVE3MgcEPNuufDS7XbFRPfm8tpOmVhsGVhyySyXS2+lAQjQh F+jv0bEOI5DgrLGwrsaeeOq1UXWZbj1mSaZfb5wDgm4RRpznz6XOTr72Vj+FUwIu9kPe Ot3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2pZHt+hAsIb+Y7qJYHv626ADWtS8jmmdGfuI//hKgVk=; b=k2QFj9OQu7S/T1Y7zbS7+vgqNQ5PdEwE0NzD6yUrXLESkQoT5htG9orE0tpsTLiDrT CthbZBDhEineIuxcKrjp3D3s1Edas07JFKT3Bk/5t24MWS5AtJrBMGss0dNPfqcs/tQ2 uGSVq2BVUU7nPNAIuZcerGof13Gy/GMR3V6lN7GnsHyUDON42jiMh6scYw6MgcALLAUr loplcJcbcLM940LAPVePdbopIu4SMkV6++U8MX8oAyBQ4xslrFveUum2DTe47ey5bB9y 7GaosIIqFxPhklGqfTjxa91z6LQwVZywMXgrVPERRm0oJXJCDU4uozbjQqaWzeMzGxK4 NLGg== X-Gm-Message-State: AGi0PuYkgOzqffcNHC0NL2EhlOfli+gMVOjcJNbUzvwY1fvkvk+K0rro Y/NW1ZAuSUw4tzaWRHfa0EjbOvvCBHg= X-Google-Smtp-Source: APiQypIDRhLgw4MqKyYW9y98lRjr3X48PX1AA28NrNsAN/Hw0p0TJpPP7LZ9Ls6tGiVyxGbKRKfTSQ== X-Received: by 2002:adf:e986:: with SMTP id h6mr6915217wrm.256.1587674428816; Thu, 23 Apr 2020 13:40:28 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:28 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Hamad Kadmany , Maya Erez , Kalle Valo , Lee Jones Subject: [PATCH 4.4 09/16] wil6210: increase firmware ready timeout Date: Thu, 23 Apr 2020 21:40:07 +0100 Message-Id: <20200423204014.784944-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hamad Kadmany [ Upstream commit 6ccae584014ef7074359eb4151086beef66ecfa9 ] Firmware ready event may take longer than current timeout in some scenarios, for example with multiple RFs connected where each requires an initial calibration. Increase the timeout to support these scenarios. Signed-off-by: Hamad Kadmany Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index f09fafaaaf1a3..c377937aae1c4 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -741,7 +741,7 @@ static void wil_bl_crash_info(struct wil6210_priv *wil, bool is_err) static int wil_wait_for_fw_ready(struct wil6210_priv *wil) { - ulong to = msecs_to_jiffies(1000); + ulong to = msecs_to_jiffies(2000); ulong left = wait_for_completion_timeout(&wil->wmi_ready, to); if (0 == left) { From patchwork Thu Apr 23 20:40:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 205AEC55191 for ; Thu, 23 Apr 2020 20:40:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F120720781 for ; Thu, 23 Apr 2020 20:40:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mKEgLkWF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbgDWUkd (ORCPT ); Thu, 23 Apr 2020 16:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUkd (ORCPT ); Thu, 23 Apr 2020 16:40:33 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E284DC09B042 for ; Thu, 23 Apr 2020 13:40:32 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id f13so8188266wrm.13 for ; Thu, 23 Apr 2020 13:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zrPB6cAFd5XV8pyviHVkoiOoCpAxetUL1P7L3ieH4sE=; b=mKEgLkWFHibVnCee1zXAPg6qOvKFjI16ZjiwSuHjiiukRj5eDBgsm+OpYKvRLijjj/ RJ7T13jM2+NsmuEMUCyQBhAk/6Ke6/akT4xqoLDtSlHlzatpBEquAg/6bAkXepMpjS4a rJcT9M+1bho17Yqx8jVyAalXg/snCxC6CSvyaneFzpaNfJTAEGOQ4GFoiBZTYsEWJquZ Y04CnjNml614rIazT6K5jqRY90rHTYRFwBA/NAKAD0Z8M9iWp1pNAmPi7/Q+YbVIu15Y IbGLDk/FET3uqAVcw98gzrb0KU2OfmmKhEtkzt7wQJM5sqE3HtWFOYTh+3+lP3y8zwpp KfAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zrPB6cAFd5XV8pyviHVkoiOoCpAxetUL1P7L3ieH4sE=; b=ThMblvp3KhrAr8USVZV2hn/vXoEDuMak0mX9vpEPg/QAq3VEcHW3nTOXSNYaeMVuZ7 L78pkqXvdk3+rXHYCc8hAvnQAGFSKM3WUdKphmu0Lxz4um3RxQ3CKG8Z197M5vQkSIxi xQJmXju3BOl0beq+cJGU3cwG9KITyipZfSvsEdojBvZ8xiyHYm8Ckox3I3+h5+dw8CbW 5TFSEuSQNdSL/g6HYUcCOhTp+io1DH5cnidC/O2sHOSEyITQ+Tbj7winHa5i2ukiSxXS hpPmnaAJWqJKDIlxpsovUWLYyUgqC3kfg41sAVTZButqCiOFbP+aERH/Thz5JZGAbRuo O54w== X-Gm-Message-State: AGi0PuZQ747s/jxGYv+jQdG/SCjVH+Eser17AObJYX5yRIuWm90QsSoh eAj9Uot+Ckk7zR54ED0P1jq03I4hN/8= X-Google-Smtp-Source: APiQypLVTNtCD4LDWDjDp/3SJ3J75cU3ItiV3sbah5fvZD+aiiBPARhtn1MajZecs4RwqrSlg74vcw== X-Received: by 2002:a5d:438c:: with SMTP id i12mr6946976wrq.14.1587674431402; Thu, 23 Apr 2020 13:40:31 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:30 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Subhash Jadavani , Asutosh Das , "Martin K . Petersen" , Lee Jones Subject: [PATCH 4.4 11/16] scsi: ufs: ufs-qcom: remove broken hci version quirk Date: Thu, 23 Apr 2020 21:40:09 +0100 Message-Id: <20200423204014.784944-12-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Subhash Jadavani [ Upstream commit 69a6fff068567469c0ef1156ae5ac8d3d71701f0 ] UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION is only applicable for QCOM UFS host controller version 2.x.y and this has been fixed from version 3.x.y onwards, hence this change removes this quirk for version 3.x.y onwards. [mkp: applied by hand] Signed-off-by: Subhash Jadavani Signed-off-by: Asutosh Das Signed-off-by: Martin K. Petersen Signed-off-by: Lee Jones --- drivers/scsi/ufs/ufs-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 4b82c3765e013..2b779a55f6999 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1032,7 +1032,7 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) hba->quirks |= UFSHCD_QUIRK_BROKEN_LCC; } - if (host->hw_ver.major >= 0x2) { + if (host->hw_ver.major == 0x2) { hba->quirks |= UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION; if (!ufs_qcom_cap_qunipro(host)) From patchwork Thu Apr 23 20:40:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C2B1C55191 for ; Thu, 23 Apr 2020 20:40:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EE8F2073A for ; Thu, 23 Apr 2020 20:40:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cbT+j4Eo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbgDWUkf (ORCPT ); Thu, 23 Apr 2020 16:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUkf (ORCPT ); Thu, 23 Apr 2020 16:40:35 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55994C09B042 for ; Thu, 23 Apr 2020 13:40:35 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id j1so8247868wrt.1 for ; Thu, 23 Apr 2020 13:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S0aruERS6sfoWL0NP6GQHXbCNqWez73bZgk7AnMorZI=; b=cbT+j4EogdVvIDwApO617ClMrE0gK4OjD6TtBEyH6NOuzv+8Um+GRr6K7txdnefJgr VZbW+wFRs1ugxl7IoTxm9AyQBjh13UCQkinyzRaohON1UGb1Ur5kqeBFbBQmJwMzWlEb 9vqIUJtusWhmKTnPbo4BRP1kapddfhRCzDtsB2rYu9QQp56FdWuC4NrOgp5Gy1nVhLcj v4Pgdo//bn7xmwaOIWzhKJgySkifVbMHCwPu7SknH0aBIbHL/w6lIv+6T/XFi2koDWfx TfcWy6Fi/AYQKw9VVLoQ6W26ByJUzo4LspP1Lrd465YN0uV5DFWUaJHvh5RZ/vxBB2d8 wbxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S0aruERS6sfoWL0NP6GQHXbCNqWez73bZgk7AnMorZI=; b=l3Cs3Yfr4B2NhgYVokuADT0tS255lAq1Sor3z/DRnW0Vr4vVaZgTTny+oTywVkAi7F tVHCUhdBycaeP4O26vNjTp0BeiekZocXpnOwiJrqr/T0nh4qPL2guWdgipdLIFlK2v5G nsqJle3QdBnrtNsIHSHUZ1w6brNDu8mgkdtITJ+MtwGHiYzlUnGf9F3qPYDixIhxRHlt kx3etcfo/mt2c9rlg1eyU3sH15jkv2eeHj+LTlyADhteX5tfpTJgTzBWcimmwzvl+11Y xxs/s+FSLloxEY5YPvY6KRlGlHHJPZ7+STQDNoP8F6hu3a5lahKnrGfzY8h0eRJuMSyN 1yyw== X-Gm-Message-State: AGi0Puay5ZcocJnETRMDZYKH6OrLboQogxPu0ZvB0k9SPHhTPf9hghLd XaIlfMc3ctrMPFTqeTU+8h7jdfi4pxc= X-Google-Smtp-Source: APiQypLxwkvJykct0rLxI+zZ4xb4PTKh7DMv/jo+YOW58uwF1GNtJEcW+FD5b2JX0kaJI9weW7yM+A== X-Received: by 2002:adf:fc4f:: with SMTP id e15mr6967472wrs.415.1587674433774; Thu, 23 Apr 2020 13:40:33 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:32 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Mohit Aggarwal , Alexandre Belloni , Lee Jones Subject: [PATCH 4.4 13/16] rtc: pm8xxx: Fix issue in RTC write path Date: Thu, 23 Apr 2020 21:40:11 +0100 Message-Id: <20200423204014.784944-14-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mohit Aggarwal [ Upstream commit 83220bf38b77a830f8e62ab1a0d0408304f9b966 ] In order to set time in rtc, need to disable rtc hw before writing into rtc registers. Also fixes disabling of alarm while setting rtc time. Signed-off-by: Mohit Aggarwal Signed-off-by: Alexandre Belloni Signed-off-by: Lee Jones --- drivers/rtc/rtc-pm8xxx.c | 49 +++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index a0dae6271ff64..cd4434cca877c 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -74,16 +74,18 @@ struct pm8xxx_rtc { /* * Steps to write the RTC registers. * 1. Disable alarm if enabled. - * 2. Write 0x00 to LSB. - * 3. Write Byte[1], Byte[2], Byte[3] then Byte[0]. - * 4. Enable alarm if disabled in step 1. + * 2. Disable rtc if enabled. + * 3. Write 0x00 to LSB. + * 4. Write Byte[1], Byte[2], Byte[3] then Byte[0]. + * 5. Enable rtc if disabled in step 2. + * 6. Enable alarm if disabled in step 1. */ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) { int rc, i; unsigned long secs, irq_flags; - u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0; - unsigned int ctrl_reg; + u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, rtc_disabled = 0; + unsigned int ctrl_reg, rtc_ctrl_reg; struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; @@ -92,23 +94,38 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) rtc_tm_to_time(tm, &secs); + dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); + for (i = 0; i < NUM_8_BIT_RTC_REGS; i++) { value[i] = secs & 0xFF; secs >>= 8; } - dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); - spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); - rc = regmap_read(rtc_dd->regmap, regs->ctrl, &ctrl_reg); + rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); if (rc) goto rtc_rw_fail; if (ctrl_reg & regs->alarm_en) { alarm_enabled = 1; ctrl_reg &= ~regs->alarm_en; - rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); + rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); + if (rc) { + dev_err(dev, "Write to RTC Alarm control register failed\n"); + goto rtc_rw_fail; + } + } + + /* Disable RTC H/w before writing on RTC register */ + rc = regmap_read(rtc_dd->regmap, regs->ctrl, &rtc_ctrl_reg); + if (rc) + goto rtc_rw_fail; + + if (rtc_ctrl_reg & PM8xxx_RTC_ENABLE) { + rtc_disabled = 1; + rtc_ctrl_reg &= ~PM8xxx_RTC_ENABLE; + rc = regmap_write(rtc_dd->regmap, regs->ctrl, rtc_ctrl_reg); if (rc) { dev_err(dev, "Write to RTC control register failed\n"); goto rtc_rw_fail; @@ -137,11 +154,21 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) goto rtc_rw_fail; } + /* Enable RTC H/w after writing on RTC register */ + if (rtc_disabled) { + rtc_ctrl_reg |= PM8xxx_RTC_ENABLE; + rc = regmap_write(rtc_dd->regmap, regs->ctrl, rtc_ctrl_reg); + if (rc) { + dev_err(dev, "Write to RTC control register failed\n"); + goto rtc_rw_fail; + } + } + if (alarm_enabled) { ctrl_reg |= regs->alarm_en; - rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); + rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); if (rc) { - dev_err(dev, "Write to RTC control register failed\n"); + dev_err(dev, "Write to RTC Alarm control register failed\n"); goto rtc_rw_fail; } } From patchwork Thu Apr 23 20:40:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 226974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5999CC55191 for ; Thu, 23 Apr 2020 20:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 390132073A for ; Thu, 23 Apr 2020 20:40:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gvZqUvhv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726878AbgDWUki (ORCPT ); Thu, 23 Apr 2020 16:40:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgDWUki (ORCPT ); Thu, 23 Apr 2020 16:40:38 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C967C09B042 for ; Thu, 23 Apr 2020 13:40:38 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id s10so8268250wrr.0 for ; Thu, 23 Apr 2020 13:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5ViWoK06xQspHTq5fSoOq1VehibGSMcOWc3+p1ggF7w=; b=gvZqUvhvfqz9yGJKJnVOeNgS9ry0T3tqkZJFzm909zIfrnMTd3BMkh+F9Q+ZYHyW6Q Oq3PKxfhz4PtgaLnVRcPsvhBzXh08ynlKgUL2Jhx8OqTvOdH/KeeVkZ8kJ1LtKuG+FNh 4u3JhCcDkY7ZNZf1N+riIYEOoTjxXt6BBDW4H7aFglk7UbG3S1362+ksRdB0bwRN9fZq kd0QDJfIVjoOl58g7CcaZrmvpCL/yaP1XA0kAzsU+riKA1CzmBE322caxthr2C0c1eab QJ9bhYyO/Q//pPqXcPavkU8c2wFE8zHm4vh61XVfZHyd9Uys4rlxdOG6kTNUehARSD50 qrNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5ViWoK06xQspHTq5fSoOq1VehibGSMcOWc3+p1ggF7w=; b=JeQqch0P06EujHzKSkwbaf5d5f6rxmwFx1pU4X6HpeIfS4TriuVEUN+XweOManKbA0 5rQf/rkrUeNJqD79D183HmnlE0sfx7yR1xIHVUKaflrxSg1pgitspJS9+DSi2lm3uOj7 8/dCFP3UGL0pE3eSG8KJ0dqUfmNGs0tOvLuxOxpYUr1q54EO7cBuiXud543BkLSUbHY5 9HSqxHOOgSInLwnGOLD2CmVjhcyLcQliexgKbc6iAiT9sXFX1GSf1Z0qkBa3woTefOC/ 4V3UWOrw9wf8CMAOc6CqV4ms7kQSaJ3skNadPgAItB9Wp2fbRznwKkBiX3+9LepYnF4V uaVA== X-Gm-Message-State: AGi0PuaxtGmyOObh2NU/jkGwbW3D727egU5V4LBCv9N0Qw/Z96tRrt38 s5helF4dxfAad5haW74zHIDan75Xd3g= X-Google-Smtp-Source: APiQypL+hxtqfxZVXTq6JAXtXRNErg9Blyw9cAHdqojYvyTItHwNUfjXa6Kxh607TQBl5kVOzM/jRQ== X-Received: by 2002:adf:f604:: with SMTP id t4mr7024438wrp.399.1587674436753; Thu, 23 Apr 2020 13:40:36 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id u17sm5933726wra.63.2020.04.23.13.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:40:36 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Rob Herring , Nicolas Pitre , Frank Rowand , Grant Likely , Lee Jones Subject: [PATCH 4.4 15/16] of: fix missing kobject init for !SYSFS && OF_DYNAMIC config Date: Thu, 23 Apr 2020 21:40:13 +0100 Message-Id: <20200423204014.784944-16-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423204014.784944-1-lee.jones@linaro.org> References: <20200423204014.784944-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rob Herring [ Upstream commit bd82bbf38cbe27f2c65660da801900d71bcc5cc8 ] The ref counting is broken for OF_DYNAMIC when sysfs is disabled because the kobject initialization is skipped. Only the properties add/remove/update should be skipped for !SYSFS config. Tested-by: Nicolas Pitre Reviewed-by: Frank Rowand Acked-by: Grant Likely Signed-off-by: Rob Herring Signed-off-by: Lee Jones --- drivers/of/base.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 27783223ca5cd..8adffecd710b8 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -167,9 +167,6 @@ int __of_attach_node_sysfs(struct device_node *np) struct property *pp; int rc; - if (!IS_ENABLED(CONFIG_SYSFS)) - return 0; - if (!of_kset) return 0;