Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6693911ybc; Thu, 28 Nov 2019 03:57:39 -0800 (PST) X-Google-Smtp-Source: APXvYqwTwuo++dFNQcPAlBVTVgCBjtzkyVCeihBfJwcFmo4YdH7QCop4HrLtuVJ8tJchjJkCd5gH X-Received: by 2002:a05:6402:50a:: with SMTP id m10mr32356909edv.47.1574942259698; Thu, 28 Nov 2019 03:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574942259; cv=none; d=google.com; s=arc-20160816; b=vrOVyNQs5YLCPX8ujLkh/+9SwzenqzIFMaU6Ib02NetjLP8niVaJb3zkKGtMTub0Fm wNNKDiqxVUXWwGDm2029dTdP8PamzUbB0LfBcjYIKDo0HN6toKCgmA+OqzNsrLFzdcbi 1yt7ULZBAXuH76QDRm+v0KkdmEC4jyhOxPk5pHfX76gTMBRUKjuzLEzBTp5y2HaUCfNy TOmirdakFVQFneg6Q/n5Fsbdyn2LeWvBMIohmiWzjPJWcfYNOkcoRhgxI84tz6YnkPrA MDWhXfp0Iutq1f+PceK9D86fADxYU9IdXtj584l9a8BBEzalBvCWhPXZ1Rkv5tmKmPAQ utdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fJ1qEAjftKv4KFT+qYxhcQRrloDrH252fRzp4v2mOIA=; b=yjJfYY+jit5Tt/bweTShOinRlqrIz2a+ydBznIRxQQoMWG2G+dmmw9mLP3RAFY+UO/ i4QBIdF/zVFAy+d9fr6IHd8VYWXa82mljj5kF09a2D7CrX/0AWvQVDWp5Beak+D1zYRF gmhQxbMoPOMmraqRKKrYCzoAfAKCAe3rfxGznBjjP9RfvhBOKbOxldkaiV2PCTGuXrQB 8DU7h4d0Z6yh73+VzMdcy64fq9jIexeskLWATcylfRb7Z8vBqZ9yEq+Pds9dXKYAL3Im EjrLp6dM/FyNXyZGOliSJKXrvD0yB726YITNQHrFIrc1mbN50E/Ci1pJAuUjmO2m3WaK XvOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HWQcb5fI; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si14309202edd.86.2019.11.28.03.57.14; Thu, 28 Nov 2019 03:57:39 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=HWQcb5fI; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbfK1Lyq (ORCPT + 99 others); Thu, 28 Nov 2019 06:54:46 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38646 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbfK1Lyq (ORCPT ); Thu, 28 Nov 2019 06:54:46 -0500 Received: by mail-ed1-f66.google.com with SMTP id s10so22514963edi.5; Thu, 28 Nov 2019 03:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fJ1qEAjftKv4KFT+qYxhcQRrloDrH252fRzp4v2mOIA=; b=HWQcb5fISvzc7dzW/LwSkYoYP72pXvepeXpeq0QChIvEEvJQZMv/9tsCBDDRZIS35Q zL3ZMkuWSYUO/EyFXpermAZ9RZWZSkvu0pQto62bpXxuU6PIyE00l3ozUeZ7nIw7zgAB g1Ro4CfkyjLTjaRQflNljm5GdxYLQMtvxlIt9yMX98x0ScmyqVc7n1lMfeaoWRLL1DJS IhLbu5FosIRb1jQ7RwtCZMAqqJV4tR6TCGaIKnafsf8EmkQYedojHJxSp2XzaaBBgNLs YCfHQ5o36094vUyplRqwjbwGQ/JHETvxtHkY5r4y+p084JRDCDIYJSQ0od55wJjU6nuv Vafg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fJ1qEAjftKv4KFT+qYxhcQRrloDrH252fRzp4v2mOIA=; b=mOM8v95NmHoi9doUgX8vK0Fe77y7EbawzY4W5234PLp6W6bpZSGl/JSYISTI698+LL gV+azUgqGQenl0TaIbLLOOt2V8JUHw/pVkIUSEBhk0PZ0OUF8l1/yxC7ilC45W5v8Oiy tUcDnUUrFGeYSV9MZcrACgvTDX81hfXhS0qdZWtYOVrCXnFEs/2IS789b9zdvGpT5qdp u/Rj11LXzgYGmbCnOn6gB4Lhky2Wp4LYkQvOrM+b/L0drac2/TvfOM5s2kfgxtD9FaZU fgqNETZCG7WSxFBE6EQfQ1p/oMo7M94MzrRhdU0ISQRCcpP+/u44muPvUsIUXBp4J+WP FVnQ== X-Gm-Message-State: APjAAAXHNH+PV8zIQna/eFbkXwuKGBc/ikrO4dkLa8QKkYzBCTdoGagM mU6yuFjNtG6+hNLrEokToOX9tpyaZrLxAs3Ec3s= X-Received: by 2002:a05:6402:3cf:: with SMTP id t15mr37391787edw.21.1574942084243; Thu, 28 Nov 2019 03:54:44 -0800 (PST) MIME-Version: 1.0 References: <20190131213957.11568-1-alex.williams@ettus.com> In-Reply-To: From: Shubhrajyoti Datta Date: Thu, 28 Nov 2019 17:24:32 +0530 Message-ID: Subject: Re: [PATCH] i2c: cadence: Handle transfer_size rollover To: Alex Williams Cc: mical.simek@xilinx.com, linux-arm-kernel , linux-i2c , linux-kernel , Alex Williams Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi , Apologies for teh late reply, Somehow replied only to Alex. On Fri, Feb 15, 2019 at 8:59 PM Alex Williams wrote: > > On Fri, Feb 15, 2019 at 2:53 AM Shubhrajyoti Datta > wrote: > > > > HI Alex, > > > > Thanks for the patch. > > > > On Fri, Feb 1, 2019 at 4:22 AM wrote: > > > > > > From: Alex Williams > > > > > > Under certain conditions, Cadence's I2C controller's transfer_size > > > > Any help in reproducing the conditions would be appreciated > > > > > > > register will roll over and generate invalid read transactions. Before > > > this change, the ISR relied solely on the RXDV bit to determine when to > > > write more data to the user's buffer. The invalid read data would cause > > > overruns, smashing stacks and worse. > > > > > > This change stops the buffer writes to the requested boundary and > > > reports the error. The controller will be reset so normal transactions > > > may resume. > > > > > > Signed-off-by: Alex Williams > > > One possible related errata is here: > https://www.xilinx.com/support/answers/61664.html > > In our case, we only needed to hammer on i2c to reproduce in a few > minutes, with a script like this: > while true > do date > cat /sys/class/gpio/gpio882/direction > /dev/null > cat /sys/class/gpio/gpio883/direction > /dev/null > cat /sys/class/gpio/gpio884/direction > /dev/null > cat /sys/class/gpio/gpio885/direction > /dev/null > cat /sys/class/gpio/gpio886/direction > /dev/null > cat /sys/class/gpio/gpio887/direction > /dev/null > cat /sys/class/gpio/gpio888/direction > /dev/null > cat /sys/class/gpio/gpio889/direction > /dev/null > cat /sys/class/gpio/gpio890/direction > /dev/null > cat /sys/class/gpio/gpio891/direction > /dev/null > cat /sys/class/gpio/gpio892/direction > /dev/null > > cat /sys/class/gpio/gpio894/direction > /dev/null > cat /sys/class/gpio/gpio895/direction > /dev/null > cat /sys/class/gpio/gpio896/direction > /dev/null > cat /sys/class/gpio/gpio897/direction > /dev/null > cat /sys/class/gpio/gpio898/direction > /dev/null > cat /sys/class/gpio/gpio899/direction > /dev/null > cat /sys/class/gpio/gpio900/direction > /dev/null > cat /sys/class/gpio/gpio901/direction > /dev/null > cat /sys/class/gpio/gpio902/direction > /dev/null > cat /sys/class/gpio/gpio903/direction > /dev/null > cat /sys/class/gpio/gpio904/direction > /dev/null > cat /sys/class/gpio/gpio905/direction > /dev/null > done > > In normal usage, we have code that sets up a number of i2c GPIO > expanders and pokes them for values as it initializes devices. > Occasionally, the transfer size register will roll over, and the ISR > will cause memory corruption, since it doesn't stop writing at the > requested boundary. Reviewed-by: Shubhrajyoti Datta