{"id":807621,"url":"http://patchwork.ozlabs.org/api/patches/807621/?format=json","web_url":"http://patchwork.ozlabs.org/project/skiboot/patch/20170830123606.8490-1-oohall@gmail.com/","project":{"id":44,"url":"http://patchwork.ozlabs.org/api/projects/44/?format=json","name":"skiboot firmware development","link_name":"skiboot","list_id":"skiboot.lists.ozlabs.org","list_email":"skiboot@lists.ozlabs.org","web_url":"http://github.com/open-power/skiboot","scm_url":"http://github.com/open-power/skiboot","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170830123606.8490-1-oohall@gmail.com>","list_archive_url":null,"date":"2017-08-30T12:36:06","name":"p8-i2c: Fix random data corruption","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d29e58d52d3ac6ec8684774bb6560244f3199cc3","submitter":{"id":68108,"url":"http://patchwork.ozlabs.org/api/people/68108/?format=json","name":"Oliver O'Halloran","email":"oohall@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/skiboot/patch/20170830123606.8490-1-oohall@gmail.com/mbox/","series":[{"id":605,"url":"http://patchwork.ozlabs.org/api/series/605/?format=json","web_url":"http://patchwork.ozlabs.org/project/skiboot/list/?series=605","date":"2017-08-30T12:36:06","name":"p8-i2c: Fix random data corruption","version":1,"mbox":"http://patchwork.ozlabs.org/series/605/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807621/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807621/checks/","tags":{},"related":[],"headers":{"Return-Path":"<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","skiboot@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","skiboot@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj4kV0Trdz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 22:36:34 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xj4kT6GtZzDqXk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 22:36:33 +1000 (AEST)","from mail-pf0-x244.google.com (mail-pf0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c00::244])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xj4kH3bMdzDqMc\n\tfor <skiboot@lists.ozlabs.org>; Wed, 30 Aug 2017 22:36:23 +1000 (AEST)","by mail-pf0-x244.google.com with SMTP id p69so4236469pfk.1\n\tfor <skiboot@lists.ozlabs.org>; Wed, 30 Aug 2017 05:36:23 -0700 (PDT)","from flat-canetoad.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\tt125sm9529192pgc.49.2017.08.30.05.36.19\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 30 Aug 2017 05:36:20 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"vSR0MPk0\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"vSR0MPk0\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"vSR0MPk0\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=Ye5hFwvUn090RKTH1AqsMrxt6+qg9lKBvqpsDvLUkDE=;\n\tb=vSR0MPk0Hhusfnh4WOBjcTxqICnuFJxFyyI/T6RAeyYoLsBcu7DzpHMvsfi3pO+Mer\n\tYHkBfcxzgDzCivSFTsnNqHLQoWmStcIggz0c8TsFhQFdyFhNozTPqbRC7GTQyjYX7gyP\n\t7Yzh6dHdNTDr/1NZoO+s67pjHG0aSxALVAmW493nTxVBnF24pb9mv+MvU0/AoZDYf8X/\n\tH9vWzTsBR5nnCXzz0w0H3AIfuZdMyMQyYj9gN9/mPYj1qCYWkq1OGgWr/WHdtR4lQNVP\n\tQdoCSEnj7KsxCpG0phKas1SdldowWqkDN7VQryz886qu2XnZeygFzpv2Zgmcp7i98SOU\n\tKBlA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=Ye5hFwvUn090RKTH1AqsMrxt6+qg9lKBvqpsDvLUkDE=;\n\tb=nJSJ7r1MWkHRykinuefIvh+lPufT3NRwChR7ferroptu0brIfdUo7yqBzq20xY8QI1\n\tPU/kD9MfvmrQRTd/DVYpFnrXE/MfXFUORORgqVzfTJlyjG9E+Y/xmmDeoRxKwmMmhu3c\n\t9OOACoimkazAKeXaXM3veegTSNXRuL0lW+Ccfqkpv86V0jd9nhW+yvC7zk6z06ULHRxr\n\tHNPXIo6o1ai2NPPvlOsPJ65DwT2er1aOIpIKE2C+RnyNN0XjztwToUS/G+wE6PH6mgBB\n\tn1TUWZjcW5aL2ddL89e7NTP87qnErub8qI9v++oCMEt/WF66cLhaFp1mtf6Emv1b4PEz\n\tTwDA==","X-Gm-Message-State":"AHYfb5hqyjURgShPRn44lEV2/9BPe8ZnnpVa/TcMdr0px8x7TdgyNfUu\n\tCaKcrKG9ARSz/S7O","X-Received":"by 10.84.160.226 with SMTP id v31mr1784293plg.35.1504096581486; \n\tWed, 30 Aug 2017 05:36:21 -0700 (PDT)","From":"Oliver O'Halloran <oohall@gmail.com>","To":"skiboot@lists.ozlabs.org","Date":"Wed, 30 Aug 2017 22:36:06 +1000","Message-Id":"<20170830123606.8490-1-oohall@gmail.com>","X-Mailer":"git-send-email 2.9.5","Subject":"[Skiboot] [PATCH] p8-i2c: Fix random data corruption","X-BeenThere":"skiboot@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Mailing list for skiboot development <skiboot.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/skiboot/>","List-Post":"<mailto:skiboot@lists.ozlabs.org>","List-Help":"<mailto:skiboot-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"},"content":"While waiting for the OCC to signal that it has finished using the I2C\nmaster we put the master into the, poorly named, occache_dis state.\nWhile in this state the transaction hasn't been started, but\np8_i2c_check_status() will only skip it's checks when the master is in\nthe idle state. Any action that checks that cranks the I2C state machine\n(interrupt, poll, etc) will call p8_i2c_check_status() and since the\nmaster is not idle, it will check the status register, see the\ntransaction complete flag set and complete the i2c request without\nactually doing anything.\n\nIf the transaction was a I2C read, the resulting output will be a\nzeroed data buffer.\n\nSigned-off-by: Oliver O'Halloran <oohall@gmail.com>\n---\n hw/p8-i2c.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c\nindex a6274171debb..9cc016fe98a5 100644\n--- a/hw/p8-i2c.c\n+++ b/hw/p8-i2c.c\n@@ -892,7 +892,7 @@ static void  p8_i2c_check_status(struct p8_i2c_master *master)\n \t/* If we are idle, just return, we'll catch error conditions\n \t * when we next try to enqueue a request\n \t */\n-\tif (master->state == state_idle)\n+\tif (master->state == state_idle || master->state == state_occache_dis)\n \t\treturn;\n \n \t/* Read status register */\n","prefixes":[]}