From patchwork Mon Aug 20 20:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 144666 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4419572ljj; Mon, 20 Aug 2018 13:42:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwWosjChCVLRZ6GYlvpu2SnbqePdL3QILJhh6HCHQ/30Nv74qA2/tuSmFVT1sxYAHGb4NAQ X-Received: by 2002:aed:3fd5:: with SMTP id w21-v6mr44837506qth.226.1534797747452; Mon, 20 Aug 2018 13:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534797747; cv=none; d=google.com; s=arc-20160816; b=PX0yahLdFSAmrbxdvRdAVBG1WUcvs/qyV17N5habBr4lCjsLWvvQi/ceshD+/oIQBx T7wbgMWj5ehryZV3sV4uvbl06vBOulQH28oqHnaaXBRuIN+Otm8RUWtRtOn6Wt2ZqJHr Y2yKpxFtUXrdJQIvfs8fLd4suOG6vMaMPHFpfs1tvlRaWuIU89tEByVjmOKGk4cQ/97X RlX3Yr/4pTG40rtvvvEZfGSG8g9d6Cw4xxQbPFjQxQFssou/dMeEEMUfaQ3nFuMFuWng E2bzPn4xf7IZQYYVQ06Fhj6fkZ1Nx5cIkfDsLVNWAe2PRdrIXg6rcbWO8Eskb9NxQMJt RvOQ== 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=EEx/mTtPmqp5TcInvMTNAaRwhvCXPWgetsyrcj9Cyjk=; b=gVkpiGZiz/Gb2CH31I+GF47xkVzhq7c7EABi0XSEL2PAm4VZsSRE4pGiUCnb6TgLAn i71hMzRYWhpJ35UsY6aMxRCyPK3hR3dEDmTZanB9fF46qa4SG/R8xqp8XE8Kk0vtW4Hh w55oht8yUiOwdVchG7DPrNPDFvXQu5AGFJ3MfJhDNeUnGQIbUNRSBShSjtiwJLsWnVSj 4gCrC5qCXy/fWuI7iVwXrCMbA50Wuw4PQ7cCVWHbDdQGpdAcwXuCfMyBBNiy2vE5iSWB tSMD3zQdMK78MhOTiJw88oIH6mgPh+tiNaV71/TPEo6Vb8txiiT49dMtXfg1VC1YHvyo lGEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="J/t1JVsc"; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u24-v6si291307qkk.109.2018.08.20.13.42.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Aug 2018 13:42:27 -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="J/t1JVsc"; 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" Received: from localhost ([::1]:49218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frr0M-00075V-VQ for patch@linaro.org; Mon, 20 Aug 2018 16:42:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frqll-0003Hs-Et for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frqlY-0003ip-9w for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:27:14 -0400 Received: from mail-oi0-x232.google.com ([2607:f8b0:4003:c06::232]:34088) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frqlM-0003Jq-Du for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:59 -0400 Received: by mail-oi0-x232.google.com with SMTP id 13-v6so28172335ois.1 for ; Mon, 20 Aug 2018 13:26:56 -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=EEx/mTtPmqp5TcInvMTNAaRwhvCXPWgetsyrcj9Cyjk=; b=J/t1JVscWFrltUqfD/kGBuqfKQJIgmg+rFqBcN0vMuw+upePKw+JItyWkUMpvkMkhv SabSc2SKdUR28SWUylfJO7ryGYnvgeqV+lrxT2w9S/ezOvnfZWqq8XOmCcoEVEcVCWrP 1vnkr8IkdHC/RO9OMBIZ7dLF39K1dKMoL7TIEGxoZFdh/gzrhe3b4DLS1tEylhZRwEKC 4TCI++1nkqJcIPXkKN87P4d/flGeg0xnOvnh8MnVOvMINTUFTOkJLQlcFzNAnCsE8T75 +m7eZ4f0rLzkzy41LSSY7qllhceahTM6Gqto0H+V3y01pZg7t8hqRtu6LTgpI3wQfGa4 8N8w== 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=EEx/mTtPmqp5TcInvMTNAaRwhvCXPWgetsyrcj9Cyjk=; b=ic1XrooeFsDXHH1VSHov5V2TAuIL1vt7Z3XhCb0LWnr5iV0oM3i33k3+J9i+7+E24W wKIrC2PKXg8Oj7PqPcWS6UmvhKhbUZ2zF64SHnUWFHgDwRaAaGpEiqQKZ92I90bSioVm b9HALOgy+qpgZGm7LZBvc/ZVqiApwnchb8BzgePLBo5GV10AiMZ950QI8omv8a0z3LKD mLcs1MZTJ543KVNe6I1ejMWv4siPuX1xaBqSyvnpZEIBVyPxnrZ+uDkvAgK38ol4UQKG 30wbiX79qVPQm9nhi7HIdJz7X41N5cUfg2ctLu1DvJc9+Krw3Ekg+v4GSv+mBLz0H8U9 eXuQ== X-Gm-Message-State: AOUpUlEFzur6hYo/s46UgiaVtTWxyIx6Q4JayzKIUeSyfpaCkUhXjyKR x/bJWQ2t3+RkFx7/nSWqIQ== X-Received: by 2002:aca:100f:: with SMTP id 15-v6mr14144564oiq.110.1534796815463; Mon, 20 Aug 2018 13:26:55 -0700 (PDT) Received: from serve.minyard.net ([47.184.170.128]) by smtp.gmail.com with ESMTPSA id p132-v6sm14512255oia.31.2018.08.20.13.26.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 13:26:54 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:7d98:76b7:e7fd:495f]) by serve.minyard.net (Postfix) with ESMTPA id 49B478AE; Mon, 20 Aug 2018 15:26:23 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 60097300105; Mon, 20 Aug 2018 15:26:21 -0500 (CDT) From: minyard@acm.org To: Paolo Bonzini , qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 15:26:03 -0500 Message-Id: <1534796770-10295-4-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534796770-10295-1-git-send-email-minyard@acm.org> References: <1534796770-10295-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:4003:c06::232 Subject: [Qemu-devel] [PATCH v2 03/10] 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 --- hw/i2c/pm_smbus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.4 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: