From patchwork Wed Nov 27 20:29:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180319 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6634012ilf; Wed, 27 Nov 2019 12:46:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzsoBxu4+4j+uMuGCkv5mWXAlDYifp4YuyOoWqudLvk6unBxDLqGYP9TPwaNlbAUw4/e1zp X-Received: by 2002:a17:906:7042:: with SMTP id r2mr50894410ejj.166.1574887610412; Wed, 27 Nov 2019 12:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887610; cv=none; d=google.com; s=arc-20160816; b=EMGx8cbUS/V64OWmPy9eB0EX1Yy1SH/KMry2dDUuc5H+dfccWNU4xkKwlxtV7l7u8v upxh9jNIW8cGH/hGGNz2oLvNR93RyqZv8XdvpQRxwe1wXXYMxpTKb89X/tzvGY6CkOcq tOMbdpMSng7dipaxiUnHNqhppEh+5eybyjsNyRFMFrV1XD2c3EMRg3OqaVSkLgn6hlTV eeNfMOnbGEW//71lVL06UnhvR6SokydH4TW4z1DndFiBBoIVQZqSUGZrOVu5twQJaaL7 CtuztcB49lyCj6N8qchs96Veu18Pe4bZLR7R2kK1755FlY4b0QcgmwoiDuZcBLi76ZLj 7cAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j0+XpGUl85AmWfCLGChj7p0GJ/+ihJ0pcxovZFH6syE=; b=igzRNzWFDy8IiCqwKtqRy6qJz5TZu/mEhz9ULy3l33gXP08RMZ4R5oB+Xrdo94gfMf bPFP2kHBMo9xAkJECnN3FbaOFcW156JQS1Dn412ihUGOwNnfo0R6vkU5W7Op+GjJde8b n9+0+vMmH/IbAXt7JfF53LdtdK6q/FNWOJmczKrLrViaFgMclQsprdGq1UXic0kdHNov qHuiAg0IKyvTt/CMuKyK1gruPr7Mn8wruv1RQdLft0hJzOndDuPIS8LvMAsBaE4Isfrg uhX4WQsVr/tO5SwPuKO99GLJKINJC7RL0Zx1mBBsSXiqG5WG/rG3LURwnDfIN8OwoplD uJKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vw5ThjjI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si10016340eju.310.2019.11.27.12.46.50; Wed, 27 Nov 2019 12:46:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vw5ThjjI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729926AbfK0Uqr (ORCPT + 15 others); Wed, 27 Nov 2019 15:46:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:58988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729923AbfK0Uqr (ORCPT ); Wed, 27 Nov 2019 15:46:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26D95217C3; Wed, 27 Nov 2019 20:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887606; bh=gLtelvidJmu/jlsBQOJ2hGDX/2Qcy3X0HMoFKf8YEr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vw5ThjjIZCkm4o24DgdUgBQWi2a7PfmX3E2thgwKxwRiT5v1Ey8OYdqGt71fp6a1e Lt7drgQd93rs0IAXQWXxd+WETg0RWeeX9U9cfBW7uadlWCsRpXfztUjTO2ryrMBfJE ZN92voH/zILAcr+ukG9LwTn+n7rtrKWP9XuKUfNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 024/211] powerpc/boot: Disable vector instructions Date: Wed, 27 Nov 2019 21:29:17 +0100 Message-Id: <20191127203053.361932149@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Joel Stanley [ Upstream commit e8e132e6885962582784b6fa16a80d07ea739c0f ] This will avoid auto-vectorisation when building with higher optimisation levels. We don't know if the machine can support VSX and even if it's present it's probably not going to be enabled at this point in boot. These flag were both added prior to GCC 4.6 which is the minimum compiler version supported by upstream, thanks to Segher for the details. Signed-off-by: Joel Stanley Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/boot/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index e2a5a932c24a8..5807c9d8e56d5 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -24,8 +24,8 @@ compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -Os -msoft-float -pipe \ - -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ + -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \ + -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ -D$(compress-y) BOOTCC := $(CC) From patchwork Wed Nov 27 20:29:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180320 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6635453ilf; Wed, 27 Nov 2019 12:48:22 -0800 (PST) X-Google-Smtp-Source: APXvYqy1B6nUtY63X/Psgh9FGHaFhGz3IqkuSLw89dSRSSEevCU0/T3AgKq9lJ1/vURJ7pD98lBM X-Received: by 2002:a17:906:a457:: with SMTP id cb23mr50905014ejb.191.1574887702001; Wed, 27 Nov 2019 12:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887701; cv=none; d=google.com; s=arc-20160816; b=F8JohwNRuFcvwHOvhzplWrvLYBId9yvzkiBNimxyK47tWF0yxPhBcMF2vHQ/CJY+R5 /y8nbvfuoQAuuVa5Lp8phjYPFlE/pQYU/gnjz1slqANYw6n6aem6iTwae3WfDzVHM6iz GJc/n6s0nWF64LgorRotY8vy/7oszJLk6shAkqkmExJkQFubWfgQBGlLPgofxEEHUjle KA1xXY40NCr8/RxRD4+FO1fweBPw12CavKQfrBrDG5gRvSjjO6KdzrxmKIN6G0lB3SRS gpYllZgM0DBEgr9fQFvQWHiHIVcnM/aROX3DvMduXp1o92EzrkHSQHSUTsSa1/0RcrJE MhXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+NSFEQL7aum7FHbrN08mebVoRD02Xh7prCTJHYNM1+k=; b=MfY0Z0Po61NMjK+PUOTrK5Jt1d7nOR4LLY9ToZSo78Z6aLFX1TeeUGemt4oV93KkoZ wHLWpgMXDUP/sMDyDcSxGE1sFuprRw//pftNLAHTrU8Oe2QU/b8B/lku84/pjVHQIa31 rdvmZhecuG8j+ogyiY1y93qn8JvWgiTcTk+WRP+MB+/y66buIMu+WMzr3kLERJNnwubn 3epydCxoEsabiXFq5rodGh6JCHEuuI+o+hMEswr1RH8Ym07vES94Q9ZaLOvVyas2Ai18 n2Pf/PGpo8hcxRK5dcEypjVy7e6OjX3vgRuN+WXY1pmZ6gi+yzw+7ME7ocQGx6CUAGW8 M1Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VDBMgyvI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si4729410edr.229.2019.11.27.12.48.21; Wed, 27 Nov 2019 12:48:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VDBMgyvI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730116AbfK0UsU (ORCPT + 15 others); Wed, 27 Nov 2019 15:48:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:33506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbfK0UsT (ORCPT ); Wed, 27 Nov 2019 15:48:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BBC4921826; Wed, 27 Nov 2019 20:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887699; bh=J1to47OMKRkj9YZVUv1UjENY/JLzYU8gnUrjNEuIuok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDBMgyvIcnQsuHF+rQaVoOPEf+Nau0RdHYRg8P2I/x/28RL0fLuAUl4gzTSZSwJTr huJlAKLU6UrvrCrb7t/oZvfxkMZp1lGqF9/P1KosRk68bSgVNScZ5apIAjSiGKHhtt 1mAbftU5yFee1J4NiFBMNKKUMVpSdalizAWDQDRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , Lina Iyer , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 061/211] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 27 Nov 2019 21:29:54 +0100 Message-Id: <20191127203059.762982903@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ Upstream commit 2c9b7f8772033cc8bafbd4eefe2ca605bf3eb094 ] A caller of pm_genpd_init() that provides some states for the genpd via the ->states pointer in the struct generic_pm_domain, should also provide a governor. This because it's the job of the governor to pick a state that satisfies the constraints. Therefore, let's print a warning to inform the user about such bogus configuration and avoid to bail out, by instead picking the shallowest state before genpd invokes the ->power_off() callback. Signed-off-by: Ulf Hansson Reviewed-by: Lina Iyer Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c276ba1c0a19e..e811f24148897 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -369,6 +369,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, return -EAGAIN; } + /* Default to shallowest state. */ + if (!genpd->gov) + genpd->state_idx = 0; + if (genpd->power_off) { int ret; @@ -1598,6 +1602,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, ret = genpd_set_default_power_state(genpd); if (ret) return ret; + } else if (!gov) { + pr_warn("%s : no governor for states\n", genpd->name); } mutex_lock(&gpd_list_lock); From patchwork Wed Nov 27 20:30:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180351 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6683270ilf; Wed, 27 Nov 2019 13:35:34 -0800 (PST) X-Google-Smtp-Source: APXvYqygXZQD4bW+AeMU+lRRDTb/yedbdn5mcVF0vZ1IR9jVfudC/6OjWVE7s1S1e7EIJdNisQGZ X-Received: by 2002:a17:906:d9c4:: with SMTP id qk4mr49857211ejb.214.1574890534651; Wed, 27 Nov 2019 13:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890534; cv=none; d=google.com; s=arc-20160816; b=zEkx1FYS61QrCKIuKCMq9UXlK16eQz7H2xblYCu0nLg+PMOLAaKHHaftPICoi0WYHD Hm8wuVbNC6Qeiy8LQhqljJ++RE4kV99NVJvDdQ/Tcvc66h5VRnSy0nq7m5KTFthn9zxQ 9ZMqRqSsgjEllBnXiuK+AfvFCLRNLtB67ISmfSgCeN4ORPEAIKLRc5tyom4hRhVLvRuI x3MIg0ZcJsZm7wgPcIp67ttH0tGaD2GR4cds2CZZapSYPX1sMGHL4WWhujdQVLM20x6S 60BQk3nyMgV4OvvRDXZw3BmxFgx0sB8jU2LQHr1SJJ39WuGYWa45yJ6EpNilWrnwCqDO NHSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7VNXWGWCtE8Fm8Zz5q2L5LPZ1Mt6kOsnGIcD9S9rjhY=; b=VBAGCJx4KbajPtXDDKYzy69juCcHu8uxW1dR+Rl09ttalH/1GCsVSs80AowhMKfcAD Ly+Tn6unoidlLF2EmfGU/VHejGCqVCRE6fC/ILaRSf9sYHXFiuLT89FKC9WHQcYoPthB aoKR4ZnIPnLaric0RmI9HcBY8Q0pDv9Ti8iHrtuleQIMMcvi2SUAjmZpl93f5JBrRiT/ q4+//D8a5OC5ZM0FlFoGyG7u+/VMbjSYNrayq/v/+7xsCDXRK2FKYz6aDmsjQcSHV1kA Pwze/H4S3ErMRla/N9LkbrF26slXFxVbYn2gGS2D3bro09h2espek5rjEoarLOiYsxGh pl/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="MVTC/UOL"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12si11917334eda.402.2019.11.27.13.35.34; Wed, 27 Nov 2019 13:35:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="MVTC/UOL"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727179AbfK0Vfd (ORCPT + 15 others); Wed, 27 Nov 2019 16:35:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:35016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729013AbfK0UtY (ORCPT ); Wed, 27 Nov 2019 15:49:24 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9842021843; Wed, 27 Nov 2019 20:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887764; bh=dG+zSrw7iEHZfFQEuCJ+9sfjj9LTzYBKGyDmPJzLAbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVTC/UOL/3Eya1pokbYrC0NL+ByApCKY0ov3q/BUL6Gk5AvIdNRqZGrxESNF7A3J+ h1F+NG74mOLhW9NZjrwGbMRpgVOPRO4hH5a34pJSfYYCbBrhAEoVZK827QMgUPXF3K 7eGWAvUtZZJTc3f6HgJ1muN8vT+FSklWSWtx7DWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Krzysztof Kozlowski , Lee Jones , Sasha Levin Subject: [PATCH 4.14 084/211] mfd: max8997: Enale irq-wakeup unconditionally Date: Wed, 27 Nov 2019 21:30:17 +0100 Message-Id: <20191127203101.717047848@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marek Szyprowski [ Upstream commit efddff27c886e729a7f84a7205bd84d7d4af7336 ] IRQ wake up support for MAX8997 driver was initially configured by respective property in pdata. However, after the driver conversion to device-tree, setting it was left as 'todo'. Nowadays most of other PMIC MFD drivers initialized from device-tree assume that they can be an irq wakeup source, so enable it also for MAX8997. This fixes support for wakeup from MAX8997 RTC alarm. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/max8997.c | 8 +------- include/linux/mfd/max8997.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) -- 2.20.1 diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 2d6e2c3927862..4a2fc59d59016 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c @@ -155,12 +155,6 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( pd->ono = irq_of_parse_and_map(dev->of_node, 1); - /* - * ToDo: the 'wakeup' member in the platform data is more of a linux - * specfic information. Hence, there is no binding for that yet and - * not parsed here. - */ - return pd; } @@ -248,7 +242,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c, */ /* MAX8997 has a power button input. */ - device_init_wakeup(max8997->dev, pdata->wakeup); + device_init_wakeup(max8997->dev, true); return ret; diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h index cf815577bd686..3ae1fe743bc34 100644 --- a/include/linux/mfd/max8997.h +++ b/include/linux/mfd/max8997.h @@ -178,7 +178,6 @@ struct max8997_led_platform_data { struct max8997_platform_data { /* IRQ */ int ono; - int wakeup; /* ---- PMIC ---- */ struct max8997_regulator_data *regulators; From patchwork Wed Nov 27 20:30:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180326 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6638272ilf; Wed, 27 Nov 2019 12:51:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyEbVlhgISF5bRv2CIt37ah2BVVikX73AGc5+wRXOjZEViWxbW3jg4vu0wbnhUIzD0OzQ6i X-Received: by 2002:a17:906:3459:: with SMTP id d25mr9669438ejb.248.1574887910026; Wed, 27 Nov 2019 12:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887910; cv=none; d=google.com; s=arc-20160816; b=gH9+nAqZACtqQTlEg9wYfrarxilBfCOTRZclbUrstHFVjU+5gsVdqv3Mh4T1qwZEyy +m1E+6Cqo7SG3OT08egLy+XWDSc1X2ySdqwryxXAAszBWI2+3UZ5cmpgkuJtgqcx4id1 kenVN5PUx7OFamhgtRcNw1icWfouL8aGHQOIikwq3vU5E/4xuuVDxOlWb2jqaUvhlnVu mM4nxJ7CwZWhJmvmMdCyuVfFlpkyEgAKU3nt1+NLTNq3S7FcRyobYtsrqBtHf/0LjYry 17NdWUaSQuKrmUp7MriSvUdZcRWEINsLyeFWXbtNFBb5pEgWFRshNY215b3FEpdPVDDa Nrwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gx8GNryAqMhcp9rQxWJ7Dr2v9lOzGytuizQybMF5Juk=; b=MBSXFBWwyIEiWJAdVy3oU/CUqsOawjYH5xZgAckq0uWJ7HIEOJRO/uuR79pZbfDOnU 3TAEfFuiq0zdg/vPboRFR8IfkBEEp6cry8PzkOFUvlPFAB/fwLRnHjPMGqKsoUvNYHYq kd87pKo/aWz9gaslwgOt8aMexkEEUwLFXzldqugyfnXKFtlpc8eB1kLEe5JhTj90R/LE OieMDD2V/nlHjOOaV22GG6AqRsOTpYgDy8mlrT7EnDVaPwrczLwK87OnA1h4ubDu6f6U bHzyjIgOxUR4m/2n8CgKmUh+5aoOMU2QvFUCbcUbN+Aguz/zRNFJJi/QiXwrKgZtnDNf cgaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xn6bxmr7; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si3932684edp.343.2019.11.27.12.51.49; Wed, 27 Nov 2019 12:51:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xn6bxmr7; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729067AbfK0Uvt (ORCPT + 15 others); Wed, 27 Nov 2019 15:51:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:38760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730533AbfK0Uvs (ORCPT ); Wed, 27 Nov 2019 15:51:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B155A218AE; Wed, 27 Nov 2019 20:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887906; bh=aTkknpA7PYRoAKFfak6Ht2aOudN4LbMl57GR686Cthc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xn6bxmr7pv15X0gJ/4WKRpfLIJejXQhmOUx8L7K2YdQBNVHuyu6S1QkCmr2kRJe4y AzjQAZwsoKmpL6e1U1rEta0hRKEyrZvtzRT3otWxwmang7yHvZ8P6cQGYG05vLvwxj kDDSzjQcEWrhhyeHT8uR6yDLni3PnfDT2LjicspM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 099/211] i2c: uniphier-f: fix occasional timeout error Date: Wed, 27 Nov 2019 21:30:32 +0100 Message-Id: <20191127203103.046030866@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada [ Upstream commit 39226aaa85f002d695e3cafade3309e12ffdaecd ] Currently, a timeout error could happen at a repeated START condition. For a (non-repeated) START condition, the controller starts sending data when the UNIPHIER_FI2C_CR_STA bit is set. However, for a repeated START condition, the hardware starts running when the slave address is written to the TX FIFO - the write to the UNIPHIER_FI2C_CR register is actually unneeded. Because the hardware is already running before the IRQ is enabled for a repeated START, the driver may miss the IRQ event. In most cases, this problem does not show up since modern CPUs are much faster than the I2C transfer. However, it is still possible that a context switch happens after the controller starts, but before the IRQ register is set up. To fix this, - Do not write UNIPHIER_FI2C_CR for repeated START conditions. - Enable IRQ *before* writing the slave address to the TX FIFO. - Disable IRQ for the current CPU while queuing up the TX FIFO; If the CPU is interrupted by some task, the interrupt handler might be invoked due to the empty TX FIFO before completing the setup. Fixes: 6a62974b667f ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver") Signed-off-by: Masahiro Yamada Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-uniphier-f.c | 33 ++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index b9a0690b4fd73..bbd5b137aa216 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -260,6 +260,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) static void uniphier_fi2c_tx_init(struct uniphier_fi2c_priv *priv, u16 addr) { priv->enabled_irqs |= UNIPHIER_FI2C_INT_TE; + uniphier_fi2c_set_irqs(priv); + /* do not use TX byte counter */ writel(0, priv->membase + UNIPHIER_FI2C_TBC); /* set slave address */ @@ -292,6 +294,8 @@ static void uniphier_fi2c_rx_init(struct uniphier_fi2c_priv *priv, u16 addr) priv->enabled_irqs |= UNIPHIER_FI2C_INT_RF; } + uniphier_fi2c_set_irqs(priv); + /* set slave address with RD bit */ writel(UNIPHIER_FI2C_DTTX_CMD | UNIPHIER_FI2C_DTTX_RD | addr << 1, priv->membase + UNIPHIER_FI2C_DTTX); @@ -315,14 +319,16 @@ static void uniphier_fi2c_recover(struct uniphier_fi2c_priv *priv) } static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, - struct i2c_msg *msg, bool stop) + struct i2c_msg *msg, bool repeat, + bool stop) { struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); bool is_read = msg->flags & I2C_M_RD; unsigned long time_left, flags; - dev_dbg(&adap->dev, "%s: addr=0x%02x, len=%d, stop=%d\n", - is_read ? "receive" : "transmit", msg->addr, msg->len, stop); + dev_dbg(&adap->dev, "%s: addr=0x%02x, len=%d, repeat=%d, stop=%d\n", + is_read ? "receive" : "transmit", msg->addr, msg->len, + repeat, stop); priv->len = msg->len; priv->buf = msg->buf; @@ -338,16 +344,24 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, writel(UNIPHIER_FI2C_RST_TBRST | UNIPHIER_FI2C_RST_RBRST, priv->membase + UNIPHIER_FI2C_RST); /* reset TX/RX FIFO */ + spin_lock_irqsave(&priv->lock, flags); + if (is_read) uniphier_fi2c_rx_init(priv, msg->addr); else uniphier_fi2c_tx_init(priv, msg->addr); - uniphier_fi2c_set_irqs(priv); - dev_dbg(&adap->dev, "start condition\n"); - writel(UNIPHIER_FI2C_CR_MST | UNIPHIER_FI2C_CR_STA, - priv->membase + UNIPHIER_FI2C_CR); + /* + * For a repeated START condition, writing a slave address to the FIFO + * kicks the controller. So, the UNIPHIER_FI2C_CR register should be + * written only for a non-repeated START condition. + */ + if (!repeat) + writel(UNIPHIER_FI2C_CR_MST | UNIPHIER_FI2C_CR_STA, + priv->membase + UNIPHIER_FI2C_CR); + + spin_unlock_irqrestore(&priv->lock, flags); time_left = wait_for_completion_timeout(&priv->comp, adap->timeout); @@ -408,6 +422,7 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { struct i2c_msg *msg, *emsg = msgs + num; + bool repeat = false; int ret; ret = uniphier_fi2c_check_bus_busy(adap); @@ -418,9 +433,11 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, /* Emit STOP if it is the last message or I2C_M_STOP is set. */ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); - ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); + ret = uniphier_fi2c_master_xfer_one(adap, msg, repeat, stop); if (ret) return ret; + + repeat = !stop; } return num; From patchwork Wed Nov 27 20:30:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180321 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6636889ilf; Wed, 27 Nov 2019 12:50:10 -0800 (PST) X-Google-Smtp-Source: APXvYqw7xZK5u6omn7esxayR1pvpD7SUSgJE7hZu0XX16hiNeqDF/lZsP40QiW28O4IzA6KrNkul X-Received: by 2002:a17:906:2e41:: with SMTP id r1mr27761684eji.127.1574887810494; Wed, 27 Nov 2019 12:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887810; cv=none; d=google.com; s=arc-20160816; b=rCQbMR43DmK7C0EviKNy3t+bguvipJ0rNMTs+rVcGwyFTu3cstuJpJIhVajBoQd2PT ApHKgW8m3k9xUMS1/vvGW2b9avZ2oFOL1exlQwn2uto8Glydt7bwOPHW1EP0LbFcfvBk 79DP2iauA5k2x2XClUyvlm/oDwmg86Npcx4/zk/fqfMv0rnrSsK5tPNWZavlboWK1tio Gc82tXMkHDYElMcf5WN5ALkkVsL84Or9HL+5+RAJ8YG/X970BosgXMK8ohfeU8Ev6sup /nzeiLGuy/T9200N7zBaLwVWQHi7A4dr/MvcEuHk9BgjUT7RK6gw+nErHncjjz9sRrt+ MQ7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s+VhaTKhfHVXegKpLkB98dmOqEYz5tuvqSY2VBqXnRM=; b=gFfuiLxnKiJsIFCUpfc0cDkyRneMthLB1JxFfoCN+HuX3ia8d4jpHO10n/NycvMMz2 GDEpCrqBY7F6O38bGQ84VmogjWwoYit7u1KpYJZ/T1WoCX/gsSixErbyuZ6AiCJ2Zxe/ 9h23sMsTI8OSZDuQeFJvf+336OvrTUSiOMOek9kVbv9/God8RWy/hzN+G/zWnUijWW3/ 65QtkTE02gcQ+vkrJgRa+aCs4KC+iPDTYlqpWloCjn24gP4A6zh1p3J1GuhZ3wVigDE0 7aXshBBs7KMZP/+es2DPjxbv5wxZWsNheLBdpkOe2C5diPraWKZuUuX87Kg4DJRpyeUr BIyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n8geMdfp; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si10856631edd.351.2019.11.27.12.50.10; Wed, 27 Nov 2019 12:50:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n8geMdfp; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730321AbfK0UuI (ORCPT + 15 others); Wed, 27 Nov 2019 15:50:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730317AbfK0UuH (ORCPT ); Wed, 27 Nov 2019 15:50:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E20EC21774; Wed, 27 Nov 2019 20:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887807; bh=pal9hfN4N0D5eIJxzhWWfFKR/tR1Zz4LVav7/9eRo0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8geMdfpwD+ue8EMM6c3rk6xfwbpM69KA6b938hvsVdC9UCeK4jTYEnd3m5musFJG icVhlhY+RpItRBa2D0XWIf/VgPC8YgAfLorjjg5N03pBmHkiAYH9UJw4u/ohgmj2fw 2+vlXFRs0ajOk2ZFWfrT08Qfg0WFdIDjx4thXhYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 103/211] powerpc/xmon: Relax frame size for clang Date: Wed, 27 Nov 2019 21:30:36 +0100 Message-Id: <20191127203103.434216230@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Joel Stanley [ Upstream commit 9c87156cce5a63735d1218f0096a65c50a7a32aa ] When building with clang (8 trunk, 7.0 release) the frame size limit is hit: arch/powerpc/xmon/xmon.c:452:12: warning: stack frame size of 2576 bytes in function 'xmon_core' [-Wframe-larger-than=] Some investigation by Naveen indicates this is due to clang saving the addresses to printf format strings on the stack. While this issue is investigated, bump up the frame size limit for xmon when building with clang. Link: https://github.com/ClangBuiltLinux/linux/issues/252 Signed-off-by: Joel Stanley Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/xmon/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile index 549e99e71112b..ac5ee067aa512 100644 --- a/arch/powerpc/xmon/Makefile +++ b/arch/powerpc/xmon/Makefile @@ -13,6 +13,12 @@ UBSAN_SANITIZE := n ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -mno-sched-epilog,,$(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))) +ifdef CONFIG_CC_IS_CLANG +# clang stores addresses on the stack causing the frame size to blow +# out. See https://github.com/ClangBuiltLinux/linux/issues/252 +KBUILD_CFLAGS += -Wframe-larger-than=4096 +endif + ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) obj-y += xmon.o nonstdio.o spr_access.o From patchwork Wed Nov 27 20:31:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180328 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6638904ilf; Wed, 27 Nov 2019 12:52:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyvtKnEn7+Ys8ioNwK9crl3UNDlM7Emt0crlB2EZRzwf8C/rVRSmvOijh5FN1SBY6ikbGlW X-Received: by 2002:a05:6402:1a50:: with SMTP id bf16mr34299150edb.116.1574887956127; Wed, 27 Nov 2019 12:52:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887956; cv=none; d=google.com; s=arc-20160816; b=y5I11ETjBLWN+PcR2QTy/A/aAa81FyNCfFoewwRQufcgrdPc7IV+YLhj/vj2lj6Z2K wC/ePGQz+RgZ1766R9JCAbqphThRTTO2Mz5U584WsSOG63wJx4nJmUNqfVGSRQNfbRGw o/4qEVcpZY7kPxYzn15Wbl7cwlqM2T5jXmDhseohLwMOOw6EtQDSXbu5Rip964yjqFyT IBCp/lc8Xh6epfe5USUGAjfYnhVn85fqnRsH/46MtntDDibsIflNbYvvN86s0d99ugKV Xx5VfMyyTNzWkFOhxXhnuIq1ZmRhkfvLx6wIeJwmxHBz36MLUXLHZyqy1ZMONfh5wV74 FN4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MUBtXYK86nyPhPwdGg7yEovYLfbJvjLQdVQ+2TovXts=; b=PpSsBfQ2lepHDAvciU0qPp/2k2/+DbAqMaKV0FBtxFegkkMVEI/tCnAkpnvZPGa6dT l2ctposIXeOnlOwTWGb9rdyvXNCCrWn7HcpNWmAlqS/FhmIwQrYiN7/AJO57D/k6urFI LNEd3Rdqiig4BK68nEyi3l2ZIlkh0JohFAbgKyRzGRRxw4T5ZZpa7+CXMF/KVzA3GSDA xlEQ/12j6/PeZhlyCacw4x3Ia/UtlabzHlrfNMDX12CFSCfOdSq1dvq8syacoezAgejT TtdrwB/9zAu+02tSBYwbh5fThmbXX15q/GKc+ldlSyzY/8LBM7bAEwOitV0bf8POneOA myDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U+V7X/td"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12si1143020eja.194.2019.11.27.12.52.35; Wed, 27 Nov 2019 12:52:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U+V7X/td"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729483AbfK0Uwf (ORCPT + 15 others); Wed, 27 Nov 2019 15:52:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:40176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729471AbfK0Uwe (ORCPT ); Wed, 27 Nov 2019 15:52:34 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B61AB21847; Wed, 27 Nov 2019 20:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887952; bh=hZs1P9plDIJ8W2ENJ7RonhFFJIGU5K6ekGDrHHqkUQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+V7X/td3v90QbR1GRkpSG5oZLMyusQORKuKRbSEq5lUxNuyOKD7YNrP+5vToQ7D4 j+Us0cJ8VjnTaEza/yaJbG4T3KwEf/QOox1PpCplbyr3mYEF7lM0gjsf+pmBUmdjbs 0ws7jkCfizatSlE8n43RRvVVU6AaUhH6xs7DuwgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kishon Vijay Abraham I , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 4.14 158/211] PCI: keystone: Use quirk to limit MRRS for K2G Date: Wed, 27 Nov 2019 21:31:31 +0100 Message-Id: <20191127203108.891006511@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kishon Vijay Abraham I [ Upstream commit 148e340c0696369fadbbddc8f4bef801ed247d71 ] PCI controller in K2G also has a limitation that memory read request size (MRRS) must not exceed 256 bytes. Use the quirk to limit MRRS (added for K2HK, K2L and K2E) for K2G as well. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/dwc/pci-keystone.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/drivers/pci/dwc/pci-keystone.c b/drivers/pci/dwc/pci-keystone.c index 9bc52e4cf52a0..3ea8288c16053 100644 --- a/drivers/pci/dwc/pci-keystone.c +++ b/drivers/pci/dwc/pci-keystone.c @@ -39,6 +39,7 @@ #define PCIE_RC_K2HK 0xb008 #define PCIE_RC_K2E 0xb009 #define PCIE_RC_K2L 0xb00a +#define PCIE_RC_K2G 0xb00b #define to_keystone_pcie(x) dev_get_drvdata((x)->dev) @@ -53,6 +54,8 @@ static void quirk_limit_mrrs(struct pci_dev *dev) .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2L), .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2G), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, { 0, }, }; From patchwork Wed Nov 27 20:31:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180350 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6680754ilf; Wed, 27 Nov 2019 13:33:02 -0800 (PST) X-Google-Smtp-Source: APXvYqw7d3RMm0aie2GAJxJo3MrSQunnp5cMDmYCG3zWrOCtVeXRF90kEEcac/p01HrC8P//3ceI X-Received: by 2002:aa7:d9cf:: with SMTP id v15mr8526863eds.182.1574890382756; Wed, 27 Nov 2019 13:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890382; cv=none; d=google.com; s=arc-20160816; b=JP429eFL3FwnHABPMeOngb3d/vi4yUDS2wEncTB2QjpdqbKV9MX/v+mdIQaM0zYZDx haWCdnzJZFn/WZPMQBtKWwdG50JK0zffQKt/pu4pttiv/I43JJJ9QWJBB4FxM+pTaet4 Dzr/nt5Z/GSt0VP3eyUJHc6UPvh2BXGFfXpi0Plvn3BQjau/oNRzi7OOPJx/Yh4xPuMt pu4kjA+p+3DT+o3xDcE2cDRC3Jn+5MsJbPsZgAV2qLD4L5uISbZkuBcq9BpVjK3gTVAV XxPXzOL3TU5ZU5Yw7ySF4KFwepaMjVMWreEsj2RjqxqcuB9RnbUIN1kd7Aol+FubN22w 5egw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v05T8Yfkuc5Ze2QCTQxn82KYSE8WQXq6zr0YLbmohBM=; b=0FhxYrS2JS2TMmNBf1I7Goiq1loux+YEGagUup5ikzXvu3sl3b/PjAmO0ts8bEC7gh IFy/g0ZrufpcpsohdJpWUQRmjOgSfU6lC86rjiQdcaAYhf9pMn4QojnMTRyraSr4tTN4 mK0PIBOaysAABWGfRJRWT8EQpZawsrfFEnGILPSn/F1LZi34z2iriupHNee5N9yU/iKQ KSKBEgNd87imtzLqI3s86hFAESWFiE5cXazPUmlxjpSGP3sZdrCXzxdTcvRsfaf2E+Gg 2TBFAPQmE8EE2UXO6NFxFUZrCfJGcYzvI8D17upiWgvL28XEwEPPNthQnGhqOy/DBzH9 LhZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VlgwWCjp; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l64si12655455edl.306.2019.11.27.13.33.02; Wed, 27 Nov 2019 13:33:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VlgwWCjp; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727856AbfK0VdB (ORCPT + 15 others); Wed, 27 Nov 2019 16:33:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:40358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730628AbfK0Uwi (ORCPT ); Wed, 27 Nov 2019 15:52:38 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 437FD21847; Wed, 27 Nov 2019 20:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887957; bh=vBFYOrfj1IE1io4Th6lrRDVblv4ioYm1LhZ/3QjbwXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VlgwWCjp8lma0ax/cS5Ue9Z4/kqdnplZHvYchvlqBy8pQKRubOQJS0uu74wIf9HQK MSA/Utyt8/uUjD6LT3z6+uXcptCiGfBNBXZP/y7Nk58DyViOQbiHhzexykRiZDU6PG nx19k5BmuHp2DNpPNwxMqkRETRrxKvS0/nMK3uoM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 160/211] i2c: uniphier-f: fix timeout error after reading 8 bytes Date: Wed, 27 Nov 2019 21:31:33 +0100 Message-Id: <20191127203109.055859220@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada [ Upstream commit c2a653deaa81f5a750c0dfcbaf9f8e5195cbe4a5 ] I was totally screwed up in commit eaba68785c2d ("i2c: uniphier-f: fix race condition when IRQ is cleared"). Since that commit, if the number of read bytes is multiple of the FIFO size (8, 16, 24... bytes), the STOP condition could be issued twice, depending on the timing. If this happens, the controller will go wrong, resulting in the timeout error. It was more than 3 years ago when I wrote this driver, so my memory about this hardware was vague. Please let me correct the description in the commit log of eaba68785c2d. Clearing the IRQ status on exiting the IRQ handler is absolutely fine. This controller makes a pause while any IRQ status is asserted. If the IRQ status is cleared first, the hardware may start the next transaction before the IRQ handler finishes what it supposed to do. This partially reverts the bad commit with clear comments so that I will never repeat this mistake. I also investigated what is happening at the last moment of the read mode. The UNIPHIER_FI2C_INT_RF interrupt is asserted a bit earlier (by half a period of the clock cycle) than UNIPHIER_FI2C_INT_RB. I consulted a hardware engineer, and I got the following information: UNIPHIER_FI2C_INT_RF asserted at the falling edge of SCL at the 8th bit. UNIPHIER_FI2C_INT_RB asserted at the rising edge of SCL at the 9th (ACK) bit. In order to avoid calling uniphier_fi2c_stop() twice, check the latter interrupt. I also commented this because it is obscure hardware internal. Fixes: eaba68785c2d ("i2c: uniphier-f: fix race condition when IRQ is cleared") Signed-off-by: Masahiro Yamada Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-uniphier-f.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 928ea9930d17e..dd0687e36a47b 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -173,8 +173,6 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) "interrupt: enabled_irqs=%04x, irq_status=%04x\n", priv->enabled_irqs, irq_status); - uniphier_fi2c_clear_irqs(priv, irq_status); - if (irq_status & UNIPHIER_FI2C_INT_STOP) goto complete; @@ -214,7 +212,13 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) if (irq_status & (UNIPHIER_FI2C_INT_RF | UNIPHIER_FI2C_INT_RB)) { uniphier_fi2c_drain_rxfifo(priv); - if (!priv->len) + /* + * If the number of bytes to read is multiple of the FIFO size + * (msg->len == 8, 16, 24, ...), the INT_RF bit is set a little + * earlier than INT_RB. We wait for INT_RB to confirm the + * completion of the current message. + */ + if (!priv->len && (irq_status & UNIPHIER_FI2C_INT_RB)) goto data_done; if (unlikely(priv->flags & UNIPHIER_FI2C_MANUAL_NACK)) { @@ -253,6 +257,13 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) } handled: + /* + * This controller makes a pause while any bit of the IRQ status is + * asserted. Clear the asserted bit to kick the controller just before + * exiting the handler. + */ + uniphier_fi2c_clear_irqs(priv, irq_status); + spin_unlock(&priv->lock); return IRQ_HANDLED;