From patchwork Thu Dec 7 21:46:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10101147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C076C60329 for ; Thu, 7 Dec 2017 21:52:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1111284B9 for ; Thu, 7 Dec 2017 21:52:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3BC128734; Thu, 7 Dec 2017 21:52:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3121A284B9 for ; Thu, 7 Dec 2017 21:52:16 +0000 (UTC) Received: from localhost ([::1]:34525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN45X-0000cY-7l for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Dec 2017 16:52:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN3zz-000404-PM for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eN3zw-0006JK-Lh for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:31 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:36362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eN3zw-0006Im-FJ for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:28 -0500 Received: by mail-pf0-x242.google.com with SMTP id p84so5683094pfd.3 for ; Thu, 07 Dec 2017 13:46:28 -0800 (PST) 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=LbXGo01FGRf4/MoNZZjc4oYZ1YnM6tEfV05xWgFZQLM=; b=aPsKYV5JHxTjjgCtp8AdUYPRzUaRUvdNrtdEzsMGvkbhOJlqU0jV+FQVDK53mV4E+H C/MMbRgAVbUM7szGiIPrKu2bQMr4QEItcEpKe/ieTJNYPxxc9J+MlPmCOO79kGr5LlHU 7X6S4b80A+5yfuc5bafSzqvUSvLr2hg6Ld45aaVWsWp52I55rlG6t1w41eKKjbZjvr1e l+0pBuRlR60lj4KUIFBm90l60DQHECYCrQiuR2qU43P9Q4MLI1jyA4muD1iBmbRkU+QQ tzGkg8r3B2UOKxl7iYNJ1hzse+/sD8SP2kTSB5M4EnNasPyOdvaqt4OCkQugErM2U1Xq BKkw== 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=LbXGo01FGRf4/MoNZZjc4oYZ1YnM6tEfV05xWgFZQLM=; b=OQZ2/KWPfJZo9s3Y7o3HM5G2UAzbiaEVaDA3NdS8ixIqNrYzuHH910htp1sGuKWfls NIAWUfiDCimbuT6Lrw81kSctPEJz+svMSc/i02gW9+YBRu3oLKBt/nrEemvUrfDO6KQY Q4t8JgA1twduuULMGEjHfIvhcgM55IRcwpMoozK/9dtVMSQXy5Uafmge6zoqkH6mT/9A Kpcr9Iw8xBiYAutHmVgaElBQqZuUNhLRG8ng4ulaOu+KrVM0SKjEDMw9RNLSCzk0YANl Uzmd4Vh4AeYxaPoEGMnlLGRek11KhdqRukVtMw4v3oqJqQjnAK388jPTtNpcsFKZca1I 4GOQ== X-Gm-Message-State: AJaThX4xu6gwou4XMDe9q4eDWzXlAgN1+k0thvxyMrA1FMFSlaoM8XcR lniQslierCTpbZJ0u94+hgGK0qA= X-Google-Smtp-Source: AGs4zMaOpaicdpktLILLV6WlqJw6X/yzYpYn/dnr3uH0a7tTYtZOcsMytnw05pvmtys33QbeI2oWwQ== X-Received: by 10.84.132.35 with SMTP id 32mr27019329ple.225.1512683187387; Thu, 07 Dec 2017 13:46:27 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id t75sm9830781pgc.12.2017.12.07.13.46.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 13:46:26 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 72E73B76; Thu, 7 Dec 2017 15:46:24 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 0B61730008F; Thu, 7 Dec 2017 15:46:23 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 7 Dec 2017 15:46:10 -0600 Message-Id: <1512683181-8420-4-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512683181-8420-1-git-send-email-minyard@acm.org> References: <1512683181-8420-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH 03/14] 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 , Paolo Bonzini , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- hw/i2c/pm_smbus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c index 679edbc..e7a8e92 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -56,7 +56,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*/ @@ -113,7 +113,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)) { @@ -123,9 +123,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: