From patchwork Mon Sep 24 14:48:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147361 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp833760lji; Mon, 24 Sep 2018 08:07:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV615r3A/jskYRfnPJUplDr7wrVdSVuSsavDyDEY4jYiSqIYU+P9qhXJn1c1XazvQ/V+X3WNS X-Received: by 2002:a63:170b:: with SMTP id x11-v6mr9625400pgl.364.1537801655869; Mon, 24 Sep 2018 08:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537801655; cv=none; d=google.com; s=arc-20160816; b=nL9h3b531y9/YfHiXfmc9QK+CM8wnYTJOWqblBoql10G3pujX6BNcT/9QGcC40Fvst sYFiZz4CtigYF7udfZoU2TF9dPyL12MXGSsxR/JG3nH4Roy9MTAnmnNvJHa2Z7RgCebG YeJomfwGUs45PtigUSaBUxbu7pxI/DEckFOCxsOC4w0sxeo/Ll87XYejRwx8l2Y/62SW bBtVZvZ5B9o0GXlD/Jd8C4yL3Pz/L6ZjvVCjVMDSXuijODzLUwl8sXua98lZyp3idN6j jUuqSlmi1QbldJ6sBLB5QRPZBakehBjA7GXQBcDyRvw02LvszcSIjjy2gMV3HJdp+UCf nctw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=j+S2b0r/YkNG9gxzOHdq1cAKiOm0xn0VOoTz/2Xek1Y=; b=rI/1/duJC4doxNsot9ignHLIHiP+dP3fCMmAx+BTlKLod332UjGYNChr43YHEuMXvS y94Z2jNhJWRqm10mJ64plqjLkuzlahywMYttp/SoU/fosp1ayYabxKJvQA0D9XX6lCbh RXEsF0myUs06DDLQPwIKXbTp2VAUqK8HkMmQeZ0LYaTuymUdq8CqP2ZErRLlehxNS5/s 4wOcvny+j1DVXI4gogCpa6l38a0jmCXNFW+/oOinbrCJXs6298ZRFXwxsb7My9a/HklZ 21bet8qpRr5tg/17Byo00s+mdxCsxjxtcCn0fc1DjW5qQEq1bF366L4mreTSIcOG9PPi dPbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b="O/wj5azq"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32-v6si5935889pgm.126.2018.09.24.08.07.35; Mon, 24 Sep 2018 08:07:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@microsoft.com header.s=selector1 header.b="O/wj5azq"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731428AbeIXVKI (ORCPT + 32 others); Mon, 24 Sep 2018 17:10:08 -0400 Received: from mail-eopbgr710090.outbound.protection.outlook.com ([40.107.71.90]:26752 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733087AbeIXUvj (ORCPT ); Mon, 24 Sep 2018 16:51:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j+S2b0r/YkNG9gxzOHdq1cAKiOm0xn0VOoTz/2Xek1Y=; b=O/wj5azqXu8kSFjZ42sacQWzyBlNvZxjF87Zu+sQPeOKsTkRevAWwowsiPYS7o04FklbN2IbCn3Gn5TYryQTGOisyLBb1x+21Iu/4wNAjbn/8lXM2wzcSefhoc5d3cKI+GKNQHJqyCVK583WuAKLCTwFe4cKSTTjaj5mdJsf5hI= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0855.namprd21.prod.outlook.com (10.173.192.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.5; Mon, 24 Sep 2018 14:48:55 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1207.003; Mon, 24 Sep 2018 14:48:55 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Will Deacon , Vineet Gupta , Sasha Levin Subject: [PATCH AUTOSEL 4.18 43/76] ARC: atomics: unbork atomic_fetch_##op() Thread-Topic: [PATCH AUTOSEL 4.18 43/76] ARC: atomics: unbork atomic_fetch_##op() Thread-Index: AQHUVBWn8Jjg1tvV70SHOyQh5puObw== Date: Mon, 24 Sep 2018 14:48:28 +0000 Message-ID: <20180924144751.164410-42-alexander.levin@microsoft.com> References: <20180924144751.164410-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0855; 6:Ki/v3aKL7Npogu23eaIqkyFd9HKDqcPSGAUECQ/frZBrd18WQljjJOjr60FTFQqmJ6XuLqsTDmS4QNADRYE7PkdjcVGVRaDJFclGm5j6MgwulGxmDV7kMT3xOUZV11sazQZB3eblgMiXwdMUjmXTS4Z6WKvxFVqi4BHRKMYrbDk/TewhgN40wuyr46+zWPRjjpboxeeC6kA0JRa4MTFQXUmpLN7icQhIK2ZZbfiD4/ywL1d07X/kuAAVOl1hDbpoy2lJbHeFZiuASkUlORPbkIFqryiNwXk8ARDJMO044ap8mnSFAe9SbcpRBebTDfCSqQ2iYHeceEg8gJMESjW6LctoRs8VQq+nBkGDMvGY82tUBOGdVp9VlxAJrlbv5wlIw8l3lnBDlyqg7LCYUPVKqhsfS2pslHB8nrmCd1eOM/dT1Z4+Y+Z5slhVJSFTTSHBxePifO6xYmZFGLF/tIEdPQ==; 5:Ndf+OrcVqSiqbZ1W5n3b612h06XeD35zA1tlQWvuKta/7VBkyIS/NYsyiWFjDVBAR6dnwOupH4hoMGkKeKQGhHpO7WiwmOCag5tWGeYSiPuUae0DIcyuPjDyDjRQtwLH5vSqke6ctv4If8AVTViCiymvDe3xy1N2CyGIs5ad3Fg=; 7:GmVJIdSnadqGmzIt38r8cjgEUiMYPV3ks9/07UL5qtvUXRK8QqXRaJbSu+8FopiwCMiJmr1mGvOy0SBs8nmA4QdyCAomCtxpPZdE8iMNhmjgvUMwuy8eGqakkxsjFSvdO89EjsitNqZ7XkTxOqELjQkNMMBG7NWDh8zWnGWKXRKrPVw5T7U8O60y7ie3tAO/sxE8xs9mV3wL2dFymsxBLSM9EqZTIm7psSkAmmRwD/YFEZI9r01TmzpXAJMo3TER x-ms-office365-filtering-correlation-id: 4b963fde-d6d0-48d2-c18b-08d6222cda5c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0855; x-ms-traffictypediagnostic: CY4PR21MB0855: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(3002001)(10201501046)(6055026)(149066)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0855; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0855; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(366004)(39860400002)(199004)(189003)(54534003)(486006)(81166006)(6436002)(110136005)(54906003)(10290500003)(6666003)(86362001)(446003)(6486002)(68736007)(2900100001)(86612001)(476003)(6512007)(1076002)(2616005)(305945005)(81156014)(105586002)(10090500001)(14454004)(71200400001)(106356001)(316002)(7736002)(71190400001)(478600001)(11346002)(6116002)(8936002)(5660300001)(3846002)(72206003)(97736004)(8676002)(6506007)(25786009)(36756003)(66066001)(2906002)(5250100002)(76176011)(26005)(14444005)(217873002)(107886003)(186003)(256004)(102836004)(22452003)(2501003)(99286004)(53936002)(4326008); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0855; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: sEN1bafe4itZK1LDfxEs7vgIO2E2uskhQ/qU+hV6UtZ78sunkJd/tihT1Tbi79i1qTV7GNbXYa6QdUFRDSPlXljTG7+6ZAt9m0Fme0aKCWnamJeujNLkaFYMLWKqKqIYu2RkMRkjtDZRxIKCke6vocPxtJFslHnQ04H3eEig22IWF76wMduG25korqUXWBUeCDG34FbnZWkEYgRyG9dppAkg4lSjABjwQJkR8o3yrZPjkR+OEZFDB7/cGXo7iROfPXy5WI8rJXEkstGFCMeKvuW3JrMtudMa9B5H1ds5pvAHDC2+gqL3pdpFwttvHDYQ4nVci8MleqJXq8Uu9xA1SRRug4ASXnW1AYTs91hqNVM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b963fde-d6d0-48d2-c18b-08d6222cda5c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:48:28.3756 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0855 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon [ Upstream commit 3fcbb8260a87efb691d837e8cd24e81f65b3eb70 ] In 4.19-rc1, Eugeniy reported weird boot and IO errors on ARC HSDK | INFO: task syslogd:77 blocked for more than 10 seconds. | Not tainted 4.19.0-rc1-00007-gf213acea4e88 #40 | "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this | message. | syslogd D 0 77 76 0x00000000 | | Stack Trace: | __switch_to+0x0/0xac | __schedule+0x1b2/0x730 | io_schedule+0x5c/0xc0 | __lock_page+0x98/0xdc | find_lock_entry+0x38/0x100 | shmem_getpage_gfp.isra.3+0x82/0xbfc | shmem_fault+0x46/0x138 | handle_mm_fault+0x5bc/0x924 | do_page_fault+0x100/0x2b8 | ret_from_exception+0x0/0x8 He bisected to 84c6591103db ("locking/atomics, asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()") This commit however only unmasked the real issue introduced by commit 4aef66c8ae9 ("locking/atomic, arch/arc: Fix build") which missed the retry-if-scond-failed branch in atomic_fetch_##op() macros. The bisected commit started using atomic_fetch_##op() macros for building the rest of atomics. Fixes: 4aef66c8ae9 ("locking/atomic, arch/arc: Fix build") Reported-by: Eugeniy Paltsev Acked-by: Peter Zijlstra (Intel) Signed-off-by: Will Deacon Signed-off-by: Vineet Gupta [vgupta: wrote changelog] Signed-off-by: Sasha Levin --- arch/arc/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index 11859287c52a..c98b59ac0612 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h @@ -84,7 +84,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ "1: llock %[orig], [%[ctr]] \n" \ " " #asm_op " %[val], %[orig], %[i] \n" \ " scond %[val], [%[ctr]] \n" \ - " \n" \ + " bnz 1b \n" \ : [val] "=&r" (val), \ [orig] "=&r" (orig) \ : [ctr] "r" (&v->counter), \ From patchwork Mon Sep 24 14:48:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147360 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp833725lji; Mon, 24 Sep 2018 08:07:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV630Ee4uaiHKqNZ9ONBv04lNNX9PpXHnWdQEA8ic7OJ415hB891ueSVI+cFDqRO99LDpX/U3 X-Received: by 2002:a17:902:5ac9:: with SMTP id g9-v6mr11256190plm.311.1537801654208; Mon, 24 Sep 2018 08:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537801654; cv=none; d=google.com; s=arc-20160816; b=c5PA7M4qFhDrikgbc5tsZRz9XRpI5ahB5iuy6Y8qZ3I3cu4+r8TTGHMMrthvbhRuii oB4gJcQrz1Z2rMe5btc+YNuPCv6UInKgZhDTFRJGFtG9urIB11G5X1niDOu6wv5bvWvs rnKoDkREgeRWXvackpVSUyYD1Pc+ss6m/CFGzlXxjCRHNwgJiDNqCa9M4SH0jTHDX7+A HvQ24kcMXfdM31caIoOew2GxqT978hWWDNfxzVLeQ0fNgDleZq/oZX8T3FBecmI77jir dZexMNWlymtg1lImgAIctYMFJ3NtJ3NZCE95k+/K3p2m4gcLSuFtRP2lTMqzG/NJjiaO NI0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=4kf+Ha3ugOdzw2EJnfJRNmtqK39T66ZDJJBT0zeSPRg=; b=0AOisRI1wKK3ryaxW6HLiaAKj8rHwo2kARL96vNCBMG3HV6teAbTxdQh5l8WudgmKr rXO4zqgOjoG/6LWPRJDSxSBLEPFC5wjipF74rxaXTGK3QWtAH4j5HGlSngL6V2CR49nI HRBOFYdhEMyp0Q6FUPuEFBpE/xlH476UmtV971te6o2RCf72TvfhoN8Pdttf+Z3xq9eP cveqIYRMMdaBD/ZippTIhfCm2mF1ULotiNoTz7m1S7YIGN1tXVaJImoiIngMlAN6+pyo l8dnbG7lkOmWCc5CmnQMM4OCygdH9jyB5TCVKajixxrehD4GTQE8PZsR5PQrtC6bNOJ1 dM9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=eXgGuLXW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d68-v6si40076055pfj.311.2018.09.24.08.07.33; Mon, 24 Sep 2018 08:07:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@microsoft.com header.s=selector1 header.b=eXgGuLXW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733118AbeIXUvj (ORCPT + 32 others); Mon, 24 Sep 2018 16:51:39 -0400 Received: from mail-bn3nam01on0094.outbound.protection.outlook.com ([104.47.33.94]:39765 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732151AbeIXUvf (ORCPT ); Mon, 24 Sep 2018 16:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4kf+Ha3ugOdzw2EJnfJRNmtqK39T66ZDJJBT0zeSPRg=; b=eXgGuLXWVLsMRBQdqmU9R1CDk4HlGUAJt6sL/DseTpNAJq6iDKNvGlJ4dv0wgAOBOx73DMmrJx9Olrqr1HPz5aszIODzGkKoGjNSB0SNNtmhU9YXLlqKhH62vRkqKzYsUYPAbNACcYvd4mmFMAGpLdRBV+1pqScLU1wVZwp4GWw= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0744.namprd21.prod.outlook.com (10.173.189.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.2; Mon, 24 Sep 2018 14:49:00 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1207.003; Mon, 24 Sep 2018 14:49:00 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH AUTOSEL 4.18 53/76] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Thread-Topic: [PATCH AUTOSEL 4.18 53/76] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Thread-Index: AQHUVBWrXrThOmfoIEuLv2oEOyM3xw== Date: Mon, 24 Sep 2018 14:48:34 +0000 Message-ID: <20180924144751.164410-52-alexander.levin@microsoft.com> References: <20180924144751.164410-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0744; 6:BC1PoxrtxGcXikZiXSN8l7n9qfq0qa8PQdSu839L6mV4/4mKInd1I05QhWy8vDH+GAUUXlutYpicjQxhaVNYeKneFT2hLGqFSKW1vUVbW/kJU1svC69UuUI/N5KD5sO9jhSrJDNFe0lK2towJM/K/mrMHIwzDiOtSrSSdziDhzcjr7kiYO6P5xR5Zu6UhDcKNunQdo/+Xpa88VYHB0RxGnWs5idPHEYZlu5lq5EczbvvYWmTRyFR+hC1P/Qmf8CGFwUjtOf8wqWhYMp09iAooBpm+fZDJoOVuzsl26QWnWXxi3HTtujLPhkm9naf/B5e1Xcvq08xZxFG/DIT0UTaF0cQHZsgPUKaGSYGvyedfj87lhvb28gQKiPuLjwN+zr2d6M/Wm63mZxBFkMafbNuidV3PZPSTwvvWsNjnt/G5DCrhovMOqApE4XqpsBPEOFiIDc1JENNwnAdBpG6HpYtHQ==; 5:x+2TssD5yVz797XeN1ppVf1WEaX09TMcaVhoAyobee5paoXiNf8/DlMdGpBrmpsTci+7Vp1Q8htGJ+tDV/Zl8oAahi3TGi83VXt46wQhUkCq5/oIg7wpKHjMrqWcVjSqpzJHcOtjS8WkkDAPo3FdwH0T+Kq4DPOSdHBGWQ3UxXM=; 7:5vGBRcE0TiftK+LvEPFVF8h31XOtc/o5QmgMYPPxjtuZc8MsHFgx/QAmlvGeNz1QtxALz20rEop44HFYqbSmZLmqJwvBSwmTdq8U5LDbxgYzZ4rjPigf0j2FeDF+/RFXQ+zxLkj/ZC48T0c3hLL5N7wkEVHjAHB3FGiQtYVe5j+0QaNXgOgLzrMkYhpiBSzKTP+Jx69kr/RngnHu1pdu/OhvtyE6Up78GKHwSmnEwWPgoeAgZBVftu6tkMUZmUHr x-ms-office365-filtering-correlation-id: 70ec33a4-edd6-4485-c07f-08d6222cdd1e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0744; x-ms-traffictypediagnostic: CY4PR21MB0744: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(2018427008)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0744; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0744; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(136003)(346002)(39860400002)(376002)(366004)(189003)(199004)(11346002)(446003)(476003)(86362001)(186003)(81166006)(6506007)(8676002)(81156014)(6666003)(5660300001)(486006)(99286004)(53936002)(305945005)(6512007)(6436002)(2616005)(71200400001)(71190400001)(68736007)(6486002)(102836004)(10090500001)(7736002)(36756003)(97736004)(86612001)(316002)(3846002)(6116002)(1076002)(217873002)(256004)(54906003)(110136005)(107886003)(10290500003)(4326008)(478600001)(22452003)(15650500001)(5250100002)(26005)(8936002)(2906002)(2501003)(2900100001)(66066001)(72206003)(105586002)(14454004)(76176011)(25786009)(106356001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0744; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: gNsaYKT0wP2AysPhVELE5ai+lp9WbEkImakFa9Oiop45FwOT/GcugDL/nVWMoxlLmVCktqRfCW+SQuItK3G8xCCoNLrdAMiXhJm5xZiqFiDRhGioNZ0g5oBcKk87zqWGYZyoavbSfqFUVB7R7fxE0Cf28/HDXJG3AwCnw0tgvdo5nTmJfVIlzsMRbj0dXUouUTLJeSmAULnkt4qMxCIKpiBdOkGetKM/z8FoKTydhsiThR1H3vsy+D70SxSvNi8GtGCRhrbXTiZUEmtoMYeQ6+GU4NoCrfALTKLIrIvxce8GIFPdkf6uIDrr8DmqN3FeASvKPj1GzzJwBPxgCzURKoO1KPLZUxKzNTrcTg0Ae20= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70ec33a4-edd6-4485-c07f-08d6222cdd1e X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:48:34.1033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0744 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 38f5d8d8cbb2ffa2b54315118185332329ec891c ] This driver currently emits a STOP if the next message is not I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR ioctl, where read/write transactions are combined without STOP between. Issue STOP only when the message is the last one _or_ flagged with I2C_M_STOP. Fixes: dd6fd4a32793 ("i2c: uniphier: add UniPhier FIFO-less I2C driver") Signed-off-by: Masahiro Yamada Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-uniphier.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index bb181b088291..454f914ae66d 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c @@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap, return ret; for (msg = msgs; msg < emsg; msg++) { - /* If next message is read, skip the stop condition */ - bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); - /* but, force it if I2C_M_STOP is set */ - if (msg->flags & I2C_M_STOP) - stop = true; + /* 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_i2c_master_xfer_one(adap, msg, stop); if (ret) From patchwork Mon Sep 24 14:48:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147350 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp812378lji; Mon, 24 Sep 2018 07:49:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV62jYjBVfaoCzejhb2ebOhfntSra9k3YvKOnuBxu30yGFhURxyWt3Xl30ooikAwMKsFkU8Vz X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr11194440pln.8.1537800551828; Mon, 24 Sep 2018 07:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537800551; cv=none; d=google.com; s=arc-20160816; b=kCjC77FCL6Xw3lw8ZM0U+DyrELsp6Tpq8UpqIqrWAxG9OhUgQexgebSc64274qWVMi nfUweo2Xj1Qbzd3ODIJHoAiHFaWrv+ivdJUJYcRs6s+Zaxjq4NbILDpYA4k2J/Gt7fZJ A4lZxNTUQqReNWqbbS5BGOUY1TbukJATWOfvE1qREDxyyfonsTm4bJzc+ukbYck1I84O jM49C5T46rDc8BBfhemObqe5u2D/FkIQ4hUGhx4oGvtskyZ7vwLLEa2bdlGjN35QKd6h Osysmc4lm56lS7J3xXw0B+USNdyE1fy6X8Hy4mUBfPplrVg54v9QjVj+l3zfG7lHIL+N ZElw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=38ePBoYt0LmN1jhM9rv26rIrhCKdt3Ibrx2fumzgZUY=; b=uNPTDjXbncyz2AarRx4vGNHkh9JwRxZ2WZpZiXlfgwtmGqnyeklo5bWlc/3DbizO9u yTF4TIEhpVvcQJXH/1kzea88003TPKpTx16zn4wvFdlE1OLcS3Htd77gqe//wU5xXRHz g5XuTiv75ur19lCvv06tfQ7StJcICCnmpdWSmNtgyvMmTxKnrenn6RrmxV1kr9T40dr4 noBkVFhf1eTmlU0iEPt2VjzKvqPTk/46nHZdW/n4pcIg7T5hOWY4fYIKGe++JlNU/NMZ eJ+E1PEfKxBx/zO0H3RJ9qtzlxDJYdPdgz1rzzDQNRHaamZbdrIylhAqSVpq+UKE5rIc vBXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=QUJUSwgD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22-v6si36586989pfb.136.2018.09.24.07.49.11; Mon, 24 Sep 2018 07:49:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@microsoft.com header.s=selector1 header.b=QUJUSwgD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733175AbeIXUvj (ORCPT + 32 others); Mon, 24 Sep 2018 16:51:39 -0400 Received: from mail-eopbgr690129.outbound.protection.outlook.com ([40.107.69.129]:55616 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733009AbeIXUvh (ORCPT ); Mon, 24 Sep 2018 16:51:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=38ePBoYt0LmN1jhM9rv26rIrhCKdt3Ibrx2fumzgZUY=; b=QUJUSwgD90C3Qf4znP4gqgwp0lmBiFm9g2AmCcia07GLxMbzQkur5C313wrFAPoQrXNZeDdXOqSzmw4NUw4fpE4xZylT5F6pNEumrSVj45Ah0QCt86CtECf9ffpHWAc6SKnOndgVRWwMHjo3NDT7zr8A/4V22FMxJMm9yCp4EkI= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0744.namprd21.prod.outlook.com (10.173.189.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.2; Mon, 24 Sep 2018 14:49:00 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1207.003; Mon, 24 Sep 2018 14:49:00 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH AUTOSEL 4.18 54/76] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Thread-Topic: [PATCH AUTOSEL 4.18 54/76] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Thread-Index: AQHUVBWrJYaaelVMBE6nADoYOuhtRQ== Date: Mon, 24 Sep 2018 14:48:34 +0000 Message-ID: <20180924144751.164410-53-alexander.levin@microsoft.com> References: <20180924144751.164410-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0744; 6:M2uGOsMRJihf03R5QjzXAAeCALjs4xhVeBi3eOWX591b1BhpMAplO4gIZ/aS9hIM9inzTcJiOBSC6qt/olpAL6CpBvzOpQLKhbNki67pdxEyJEFUeGRnL5ulThpTIDSTmSga+ZoTZ9HX4p3ozz4ArD6Yv1ZE5jh+i7Gwf2iHxNI1/bVWDXGl3lQPqqnlpX8MWImDlc8w6SboLU0tMSs8tY7/QdMKrx2Asqp/mbFHf2ULDQOKyUI9c1i6YmfO9f4EeRSSdklbVYfFXBy6plLHgQjfFYzj4jOHtbAf6mHcX3gVqepVXPyHYNYWB9NplzDQ3a7x9/VzEjwzZje+dilXtr/bCH8vwU7FzbhCeTwQKjV0VYsNBOJGsKUpoCo4HZr5tKChb9uw2YSFGIaxOAcMwdWVS9lh7lcMk2aG5Z/Nrp1X/FsKOJI6kv9fwJHRaFswgOr43qOxH6pOXnQ+3zhL2Q==; 5:RfMG8Cmrq1WkPJ3+X4oVn03o9/P/BEDRKoCr/YIspevtBYZOKPlKl+9ZfoAgkn6zYyef9TGLhzvdkhz+oDY3ybY+qHjMbuUEK7CIhm5ckRaqjW2SbNHeMpTPjeRRUn20q32th5leH8LiDJy9+k37O1wLvLqXb6clV3sryndCCFM=; 7:sE4V9LsrPRSCNh8ol8cPVJ7uCxX3+wdkmAMkqPMtttxyz7UpSCJm1rGxQ4J8wZ/7R6cxba2tLy73abEAe1JpPNFe4NocK5dwlIe6DYyXA0EebE+opMUF+3gqUoBXKD/LWyoGOyNuz9gsEPdXgYikLaPAisnkwG84dszejyowPlN8KDv9k6mYL1xsQ/+/yd2ekP4woW59QIpE7CFNUf7j20trcV+bqG5Zjyfc6N8gc2D6se1BnogNNVwECK2qpIL4 x-ms-office365-filtering-correlation-id: ad711d66-3f7d-4fc5-59a9-08d6222cdd5f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0744; x-ms-traffictypediagnostic: CY4PR21MB0744: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(2018427008)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0744; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0744; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(136003)(346002)(39860400002)(376002)(366004)(189003)(199004)(11346002)(446003)(476003)(86362001)(575784001)(186003)(81166006)(6506007)(8676002)(81156014)(6666003)(5660300001)(486006)(99286004)(53936002)(305945005)(6512007)(6436002)(2616005)(71200400001)(71190400001)(68736007)(6486002)(102836004)(10090500001)(7736002)(36756003)(97736004)(86612001)(316002)(3846002)(6116002)(1076002)(217873002)(256004)(54906003)(110136005)(107886003)(10290500003)(4326008)(478600001)(22452003)(15650500001)(5250100002)(26005)(8936002)(2906002)(2501003)(2900100001)(66066001)(72206003)(105586002)(14454004)(76176011)(25786009)(106356001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0744; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: NjVwxmfDgFKvlBSdp1lcG6+2KeLxTarf1WYdROoPgXgMDqOyYWFFybo2pgogvBYAPVG8EAvbmUKk6n7UlppYFOIRgV3sHRuX7c+L/EdDuS8UmPAw7dX4n3DiYHeBlpfY2K+dLHFwvf7KByv8HiamIfZDzs3c7U1Fsj0oGM9lDSxsyqttACdnNv5RynlPYRadXugpEuViBlVIV8MladTZbTN1XkTaqWeGiSjkdYzlPKEiLRIr1nlSehZ+edkNnpI3nIxr7nPDwh1ucc3b8idWYK1HbtAcCzz12id0HNMvQuZhLZIGxaj8aV1F6428YVsZiCK+xsxgQJOf0unyF+raMRU1YGv+Kg8WmQNnnAjimFU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad711d66-3f7d-4fc5-59a9-08d6222cdd5f X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:48:34.6017 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0744 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 4c85609b08c4761eca0a40fd7beb06bc650f252d ] This driver currently emits a STOP if the next message is not I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR ioctl, where read/write transactions are combined without STOP between. Issue STOP only when the message is the last one _or_ flagged with I2C_M_STOP. 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 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 9918bdd81619..a403e8579b65 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, return ret; for (msg = msgs; msg < emsg; msg++) { - /* If next message is read, skip the stop condition */ - bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); - /* but, force it if I2C_M_STOP is set */ - if (msg->flags & I2C_M_STOP) - stop = true; + /* 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); if (ret) From patchwork Mon Sep 24 14:48:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147359 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp823515lji; Mon, 24 Sep 2018 07:59:57 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda4q8T3hAFzBdmaPN3NGL8tFCjeE7UyUy/aZH4FL/vX0FSp1dVeJMm+sy7EHw1V0yR85A9C X-Received: by 2002:a62:b286:: with SMTP id z6-v6mr1467746pfl.79.1537801197388; Mon, 24 Sep 2018 07:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537801197; cv=none; d=google.com; s=arc-20160816; b=D+yH0i6NTO9wOvcrSUUtH4twQhwX9Pl3iWSTVJmtn4Fvd79vdSqUhTjhs0d3IQsxkB KfSoWHGhXpyBN88HYJfmq5gxNNH0+v3rM+obbrPRNH1u7hJdMJzvSAFObaPIAY/h5YUR 8+4ARI8jpLin2uGkGBQgdlfLPyyIpUclhDNFVb4WeeFPu2apX110/qnRAo+lsA0J4cAb kGwvBKtqrHg/L2P920aaQxd19yDg+l1Y+g+sn8JYOLtCSt+6ECyVdvutUmfceehJaTop Om5BBR5/aiEsKQAx7NzqtQ/5K4KVAUjO/TmQw5B65Ruqkl6OC6rv6YnxzyXXabQYfpP7 MB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=YwGVrh9qkuBmbK6FyFW4h2qTIBpxg/dQ/LWYRFqFhVU=; b=Me1yH3GurTe40EHf8JaalgD5joxRfRTeLhkcJAFB9BRNMR9VAmzVRuCTNu//w9wLkg hJ0cP2CMX4ugdwS/Py1ye33lXcuf6gNRJ3IvUzKoLkufUm45uY829Ylb+rnNaEeiopmi aGOwziQZI8iM3vKjR+tnUKen4FTLXVbzUMGCGpqWrCTKubhWxgjZmRI8SdEWDWBpvF0V t52YE49/p06lmbtX22AXy3OG4OnUIfBwMkCJA7xDode26WXvKCEKRLiOVsT3bzbH9uzP PlBDeAQdknlnYhWqkHVboQxyNcPRgWscRl10GVakHxm2JLda1VsTAEwuhfTpkgkpMXGO pGog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=EhL+LTkR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18-v6si34607844plq.104.2018.09.24.07.59.57; Mon, 24 Sep 2018 07:59:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@microsoft.com header.s=selector1 header.b=EhL+LTkR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731534AbeIXVC2 (ORCPT + 32 others); Mon, 24 Sep 2018 17:02:28 -0400 Received: from mail-bl2nam02on0139.outbound.protection.outlook.com ([104.47.38.139]:31232 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729831AbeIXUwR (ORCPT ); Mon, 24 Sep 2018 16:52:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YwGVrh9qkuBmbK6FyFW4h2qTIBpxg/dQ/LWYRFqFhVU=; b=EhL+LTkRoexeigoNOdNWLYQXZFCpLdiROkYedQ1337evqTxq2Z+RqKB/lwT5rX/RYeq7z9dwjljmYwz5nSFenTKNRwexmjD3K+7/b0zs6ONUAAxW0I4mdPT2Eb9CaFBaXMakOqNo+4oiJd9eH497ayPYz/8+wB3A+YTWUw81t4k= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0470.namprd21.prod.outlook.com (10.172.121.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.3; Mon, 24 Sep 2018 14:49:38 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1207.003; Mon, 24 Sep 2018 14:49:38 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Sudeep Holla , Olof Johansson , Sasha Levin Subject: [PATCH AUTOSEL 4.18 75/76] firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero Thread-Topic: [PATCH AUTOSEL 4.18 75/76] firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero Thread-Index: AQHUVBWxxj/1Tc0wbUqAvH40eMEv/A== Date: Mon, 24 Sep 2018 14:48:45 +0000 Message-ID: <20180924144751.164410-74-alexander.levin@microsoft.com> References: <20180924144751.164410-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0470; 6:ZOFNTguzKhG/oDq6kFkx921lBvnKnL0Rou04x62lVAkK0gKG0TwHqQbsGf3EJ5IxCxNy8c/X7X38t26ngtsERsbYBRifYAQJA0uwzIePc/JU4M32dT5bwBqkukQSc1nNi4d6b+1pYi/TZwCFobBi8HVqU/i3ZgLQXIeWR9D2H1MnPjzmyb/yHu2wKu1BZZAXcvVkGEo7f2ee1MpKu+AB4FlS++asIeofk3z54n0aqQlnFseJAXuEXQPdse7kc7+OHFgs2N+8QJJhzRrX0XTV3Kv76JUVV8uKK/7zhRx1YwwIWEOatR7XOoEwge3ciDWQhVCohYWtgeH/Xu2r8Zc8HOdDzReFyHF9IXNd23VJtq/l97QtJRYpUkAGSGAY3cYqIM1UZ4Ac+EhWrPj1bWUNitA8SRATQ0oMnL+HzclJwN/sW3BbHhgEyNf9bEiZN1I4S2DKFBqafE6nUu/IgUn5eg==; 5:ab1JGpMLnxjR6hgUQY4MiqZQ/NTGplc7Fc8uWHFruLgvMmWVlVk1s4BghxXZJncvv33UZpcgQwpjl8UKCDAOqtB1T3lsWh3taEvjv6N6EXGWWyuh2veF8L9TSGLRqEE2pmOedyxyHIV3PDjRWMklK3vQelpeL4BXU6ZK/nxcxz4=; 7:jIofWPs42bcFIfiKWZMOFXAzvKcF1a7zJGT0O7YMCTGkNDhlkXxDQmkqzGNKo8i3m2ZeYCZG6ITKx33p2suajuYNFGiOi66q1bMNY7GjR+ZVk3v9XZUDFaDw5odiRgn1a05vlKNRTVFaLVZd2P8OObKCJqHdq9nZORMECqhlCO8E2q1zmadSCSxLt4tTDxd+jlzyEXlxSdEnlH4DqcRrMmG4mmq6e8cEjg0XxFKmuM3SsFa4lEyqYpz0VJ9lV7rR x-ms-office365-filtering-correlation-id: 534cc8b2-90ad-4f74-ad32-08d6222cf3ee x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0470; x-ms-traffictypediagnostic: CY4PR21MB0470: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(269456686620040)(180628864354917)(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(6055026)(149066)(150027)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0470; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0470; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(396003)(39860400002)(346002)(366004)(136003)(189003)(199004)(26005)(97736004)(53936002)(14444005)(25786009)(1076002)(76176011)(99286004)(102836004)(186003)(6666003)(4326008)(3846002)(110136005)(107886003)(86362001)(5660300001)(6116002)(72206003)(575784001)(54906003)(478600001)(8676002)(217873002)(86612001)(256004)(14454004)(10290500003)(316002)(6486002)(6436002)(106356001)(486006)(105586002)(446003)(6506007)(11346002)(476003)(10090500001)(2616005)(2501003)(5250100002)(71190400001)(68736007)(66066001)(81156014)(71200400001)(22452003)(7736002)(305945005)(2900100001)(8936002)(6512007)(81166006)(36756003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0470; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: IObgCkzcHYVzAxLpIvWfsQaeNK+3x2BdZ3SPhfrPFEWVR1jN4Nc82YSFr5vF+3qsRdL+qxzE0jRy4pOY7PWDFu18fauzsuE/pDiSXfor8H+Nngo+tMjJLJSjftoQxpW3Ky6zCtGQ1coNftFxSF+XGXzvnPeocaPVgyarpyCPv1mK8Bplhjc2V70/2y2oelR5jAJ5zZ4lC+Fudb7yXFUTyOghJzBAoZXhd1L2JLufUx09H6i90ca2Iakf6B7eN3xo3sQ1timzt3+TuhZpN9hOfT40Kbu5/kO0tWSq5YCRWSZcty5EOeSZF904TT7gEXEP55DSEm/eisB/gAlTHCV4TWEZ0Y2ANJK74DJZRU7cKQM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 534cc8b2-90ad-4f74-ad32-08d6222cf3ee X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:48:45.3005 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0470 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla [ Upstream commit 96d529bac562574600eda85726fcfa3eef6dde8e ] Firmware can provide zero as values for sustained performance level and corresponding sustained frequency in kHz in order to hide the actual frequencies and provide only abstract values. It may endup with divide by zero scenario resulting in kernel panic. Let's set the multiplication factor to one if either one or both of them (sustained_perf_level and sustained_freq) are set to zero. Fixes: a9e3fbfaa0ff ("firmware: arm_scmi: add initial support for performance protocol") Reported-by: Ionela Voinescu Signed-off-by: Sudeep Holla Signed-off-by: Olof Johansson Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/perf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 2a219b1261b1..49cb74f54a10 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -166,7 +166,13 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain, le32_to_cpu(attr->sustained_freq_khz); dom_info->sustained_perf_level = le32_to_cpu(attr->sustained_perf_level); - dom_info->mult_factor = (dom_info->sustained_freq_khz * 1000) / + if (!dom_info->sustained_freq_khz || + !dom_info->sustained_perf_level) + /* CPUFreq converts to kHz, hence default 1000 */ + dom_info->mult_factor = 1000; + else + dom_info->mult_factor = + (dom_info->sustained_freq_khz * 1000) / dom_info->sustained_perf_level; memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE); }