From patchwork Tue Aug 21 17:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 144769 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5552391ljj; Tue, 21 Aug 2018 10:36:02 -0700 (PDT) X-Google-Smtp-Source: AA+uWPylN78lzbHgcUiNAQf7cWWQLGT2rh2vYZxwpOzuBGfebB1zMLF+4AlZgGkjrQQinhjDxTvi X-Received: by 2002:aed:3c8c:: with SMTP id d12-v6mr50620793qtf.203.1534872962541; Tue, 21 Aug 2018 10:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534872962; cv=none; d=google.com; s=arc-20160816; b=uQ+4AzRvbvGCXvCwP9mao70bQ14toaXfsDTc2kcQF0XbLAs/SJe3b1tEtyLfnhz8or zoI7SwjgQWeBWyH1ru0hZVpJuXTQG0jfiotFruGY7oh1LUovo7yNDuN8x2FZE5qhs29S 2WstOjyWlqXroS3OvFljwY+h3XOz2FP///cWqzrh53x3t5K8pZybi0JNtNRxwAX2Nc1N 4bzPtkQRaMIJDRZEIeE/XsRDT7pUzTRWFMSJFbk29WgnBK7jWA37oOX37b+88a0EqzcX w0lun9F+Wupv5uXbEhpzECgwhJzszY2JuHhFsapbSggjcmpTtSES7wXFlrpIu8god6s2 L+VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=aCddtj7wtbHQ/2Fiq8Bm9lwizmGrolG52+XZv7pR4Xs=; b=xMn/pfHGGa7S1/Rq1eHSgz1uzvInKrUOKTIb5+u2u0JrjEG5lsrJiY9OCQWWMJIXHz PEnk8u/nVNMyQH+vyqyWgg7jBbJiDAu1thq8CrGjECnUm8wiBBjdw0YNepPh2Olklqk+ FnSFNFQ5aSDz2Lkr2I4eR1loJlrgnXEx4Wb36Ueg8WgKSbuovGi/MT+T5IQg/R9ctYBs RJWmxl4S5usnnAAolU/On74klerygK4M6+kdfdUUEZ88vxB9JEAbryW3kM/CsOEucF4+ lV6q/qA25zZ5wDJae6VtrGC/o2/9B2I2jIjPQE/+m+ScJel0xGpwRt3vP/RSAtm+sNjG fVrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="C7eqro/7"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id m189-v6si6916507qkd.19.2018.08.21.10.36.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 21 Aug 2018 10:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="C7eqro/7"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:55113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsAZV-0000BV-Vd for patch@linaro.org; Tue, 21 Aug 2018 13:36:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsA57-0002a8-03 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:04:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsA4o-0007C0-4D for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:04:31 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:37168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsA4m-000743-QZ for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:04:17 -0400 Received: by mail-wr1-x429.google.com with SMTP id u12-v6so16463124wrr.4 for ; Tue, 21 Aug 2018 10:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=aCddtj7wtbHQ/2Fiq8Bm9lwizmGrolG52+XZv7pR4Xs=; b=C7eqro/7XaBEQ/tTrtUj8a++vomUduRSGs2+iqxutmYRO2KwrGe9Kc+NwYaQRo51fs vYWBDXiXdx4OHNKmdpaNY4ZgLDOW6lz9E4JuVT2HYiKLs77MpCb2IZP4ziu+1x4hmiIx 6F0Q010PtFQ977C1lIaiCKIaBgYNCgAtLKs3paUfwiZT9xjFfolb9IsBqhvmwX8N10CZ hOQjXUw+CaRb5RZC0KbrnPPirjY/HnUY4XkqEyn6gp3xHycPLHTo9DYNz5wbmTgLp44m NcQYRSIgWQYkR676/D1Xl+ysz4hThYKu+ZPavcXd63H2WCtHGybxTMuBsdSb52lPbxGA WDMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=aCddtj7wtbHQ/2Fiq8Bm9lwizmGrolG52+XZv7pR4Xs=; b=gFTHFnXhzMx7taCN9zVc8F/fidaLdoCH9m7HLTW8z9TBv8vCFA9RPeBjUsdVpY8eZ9 J5PIE59vuVh1TxmWMVS6tN6b/3tNMe00Jd9NK8iglRJ84LKzsjNI8rD/7sfPzm4bGWjj OhWvPKEowmIA1+m4ZPqzt6+AivvoTSzqsGRUa4IyhYRq/TzWzxNzTw9oULDk+Be/zDhH UL+uzTMMr05mPy/o/7wG5kjX+Mb7I6BkJNm6SkmBQAqw9Ncv8ebU8R70OvnypHd37gmQ 2QRakdOv9ZsbOki/AftmPdiGIJ7HhFz7C8S8uYO2gD14pgtzVJwFwVO7UWYRO/dAUb1y +dlQ== X-Gm-Message-State: APzg51A7XG0WtuiBjF74i5c1JDbYL12rI6v7bQkkr9JHRxwPYFaJ6cFg BCeKslVOW2wmYJY466nFUO0h9grx X-Received: by 2002:adf:ed04:: with SMTP id a4-v6mr4833350wro.262.1534871051095; Tue, 21 Aug 2018 10:04:11 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id v6-v6sm2608955wmc.43.2018.08.21.10.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 10:04:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 19:02:36 +0200 Message-Id: <1534870966-9287-65-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> References: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 Subject: [Qemu-devel] [PULL 64/74] i2c: pm_smbus: Make the I2C block read command read-only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard It did have write capability, but the manual says the behavior with write enabled is undefined. So just set an error in this case. Signed-off-by: Corey Minyard Cc: Michael S. Tsirkin Cc: Paolo Bonzini Message-Id: <1534796770-10295-4-git-send-email-minyard@acm.org> Signed-off-by: Paolo Bonzini --- hw/i2c/pm_smbus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 1.8.3.1 diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c index f1fe889..dc61f2c 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -55,7 +55,7 @@ #define PROT_WORD_DATA 3 #define PROT_PROC_CALL 4 #define PROT_BLOCK_DATA 5 -#define PROT_I2C_BLOCK_DATA 6 +#define PROT_I2C_BLOCK_READ 6 /*#define DEBUG*/ @@ -115,7 +115,7 @@ static void smb_transaction(PMSMBus *s) goto done; } break; - case PROT_I2C_BLOCK_DATA: + case PROT_I2C_BLOCK_READ: if (read) { int xfersize = s->smb_data0; if (xfersize > sizeof(s->smb_data)) { @@ -125,9 +125,8 @@ static void smb_transaction(PMSMBus *s) xfersize, false, true); goto data8; } else { - ret = smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0, - false); - goto done; + /* The manual says the behavior is undefined, just set DEV_ERR. */ + goto error; } break; default: