From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352623; cv=none; d=zohomail.com; s=zohoarc; b=AQkw2BrX3hP4GoT2F4dP2g96qu+JR/e+inu+aMwcf7gMkZe35fLxWfDok3QAVUvKedrZh1tsw5zsFNPnpT1B0D0nKbE/CzLLiGTcQBO4ycQpBLJ3LmnripYhYnCXlBhI4hI82j6KgBCTfnmI5P+D2djGsRyzRuKRc14JXohedKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=styZe25JXYPNj6ZLjRZ2KyeoWgaRA9nMMleh8tvZmSE=; b=hv2ydnDPvAcUtBR/mqqxmhuGHACTi8+qTMsTpyLPwUVLK10MGuu2r51lS/43SgTxpdhJmHEvwpzX0WJTuH9o7aKrdVrgjLizoIxyMCsiubp5mj/fcoxRky5j0odlFkuU1NBMuPslW5sP0+lPMfyjCbMeanlu9bgKY1eTBVnsNB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352623429174.46236175315903; Fri, 5 Jun 2020 03:23:43 -0700 (PDT) Received: from localhost ([::1]:57446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9Vm-0004Sv-2P for importer@patchew.org; Fri, 05 Jun 2020 06:23:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9Uo-0002om-KO for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:42 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:33422 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9Un-0006KI-Rw for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:42 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-60-vy1kAYY0NoWbrkdpZ8OUHw-1; Fri, 05 Jun 2020 06:22:39 -0400 Received: by mail-wr1-f72.google.com with SMTP id a4so3594911wrp.5 for ; Fri, 05 Jun 2020 03:22:39 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id k13sm10220723wmj.40.2020.06.05.03.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=styZe25JXYPNj6ZLjRZ2KyeoWgaRA9nMMleh8tvZmSE=; b=gLMCZfyrbnIppyQMddLMXkWVItZoC+InrTyssjUBtLMQO0wdkioDogzPDINPNRd/hyHc8c Ppi+YV3b3GykzEvSwshl7Nt0OEj2MyzqWiQhpjWPlbBNbeI83ylHCvH0AZZZkiP30uPOj1 YwCXmJaemgGo2A/GriohKKy0hLCD21U= X-MC-Unique: vy1kAYY0NoWbrkdpZ8OUHw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=styZe25JXYPNj6ZLjRZ2KyeoWgaRA9nMMleh8tvZmSE=; b=nRWC0eH3dD+5gLqryFFWp1SX9mx4KzDnb0QapGPnelZQQfmvSUMDkzA4ZPcM/3463B TGqUxjErfEf1Nxv+5dLS5CIMy6ghlr9cVDjAqg7LuBBZuOn+IWnUenJBavfg9NONSqTk NZmNvf3zYR8PoLgdGFaRxPbfzMtEVsowR74+igwD5Ve9Win5cFTcZp0zm9fQpy1uNiRk Ap27s9JvmzJmVhpFxtEo5vmuTKH8+ze1L6/liKV03gBl9yrwXF0M3gnyU2b04Hdd/vhe rhdpuQwAGcIljmVZQPpHUsGpFZiiblw+Hp66YHXg5hxCV2sd6UT2QUufFQsa6YHp/CpX owZw== X-Gm-Message-State: AOAM5331t05/sUNM/p4QymGcNYk4WSLsVaKXX92n7fgghemxJ+WX6b7r r2N/StwQw3KChpF8QEyREADVgXpWVuqY0Ugi0QxTZiV0aKee3XamIrLkN5GNdoztRbqjjals57a K33akRTMyKr7Oix8= X-Received: by 2002:adf:dfcf:: with SMTP id q15mr8667453wrn.373.1591352558069; Fri, 05 Jun 2020 03:22:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc8rs/qgwznm0TyPhroBDC3DMBk+GG1qZ2hOwJ/pyEZe4xEBBHEO05tWIq9al5FddkYmtBRg== X-Received: by 2002:adf:dfcf:: with SMTP id q15mr8667434wrn.373.1591352557843; Fri, 05 Jun 2020 03:22:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 01/11] MAINTAINERS: Cc qemu-block mailing list Date: Fri, 5 Jun 2020 12:22:20 +0200 Message-Id: <20200605102230.21493-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We forgot to include the qemu-block mailing list while adding this section in commit 076a0fc32a7. Fix this. Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3e7d9cb0a5..20b3a68d00 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1599,6 +1599,7 @@ F: hw/ssi/xilinx_* =20 SD (Secure Card) M: Philippe Mathieu-Daud=C3=A9 +L: qemu-block@nongnu.org S: Odd Fixes F: include/hw/sd/sd* F: hw/sd/core.c --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352704; cv=none; d=zohomail.com; s=zohoarc; b=LkyJffEvIrbznKL8WrgxOc9bi2UDS9Dkp8H5RGD5mJLtxiP2koIhWSw81z98hBDlN4FJ+jwMktfN12ZoPu/tcUYKd7Kte8JPHZOe7MHQQqCLdmHhLC0/CzqWAlNwATDunhvXH2NQelWOeMZ0drO8YbKI2kSmJjEYikpQ73/hvpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352704; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nkwDt+W9ESNwveTOK/yAiRKQET7DW0sm3/z0Mc8iCTQ=; b=Z2GGpN7r/qZVkHJBLz4O0T1f2Yq61l8N/t0USv0FnawWDb8rhsVkzyBveo2NdjQxTeVKmdfOO0agl0oTg/DX5EyjPrKAj0/5tuhky8T7ye1SXZqQJdzkaad4/UOWOoSF/sD+aJGVnAOdTh1HdyjgLfXSidIokofEFmLdVFAMVR8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352703993550.8900303581324; Fri, 5 Jun 2020 03:25:03 -0700 (PDT) Received: from localhost ([::1]:37158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9X4-0007fK-6s for importer@patchew.org; Fri, 05 Jun 2020 06:25:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9Ut-0002z0-73 for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:47 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49005 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9Us-0006Kw-BD for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:46 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-hjhjUNQrNHCAKDLdy4znxA-1; Fri, 05 Jun 2020 06:22:44 -0400 Received: by mail-wm1-f70.google.com with SMTP id s15so2842908wmc.8 for ; Fri, 05 Jun 2020 03:22:43 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id y19sm10506015wmi.6.2020.06.05.03.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nkwDt+W9ESNwveTOK/yAiRKQET7DW0sm3/z0Mc8iCTQ=; b=Ni1QFrYbS+5m4W5XoyOC1i9kxRLyQBom4FdOIRAOzmz+tGf4RKvYgWD+Eo559nxdYOiBIm QahqRq+6NT7+Fw5tKlDRksMiFFhYOTVRWNCAqqVf4FZw9WwIm5y3ph9Kkp5V44/AMxdvEv PKiUtyaF9fH+CnERpq89q0CQfoiH/yI= X-MC-Unique: hjhjUNQrNHCAKDLdy4znxA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nkwDt+W9ESNwveTOK/yAiRKQET7DW0sm3/z0Mc8iCTQ=; b=Umxg9TuXPXwtyfCFNtHeTuP3uHCu/wQ+BrUFQlO1mw4norA+thkv7gA8JLatzg8ICZ mJl5qANe/b4y7HnoCC4iLz8ySqj5TeVshP4m1WFFxBgHvTMStR66y1ge0YrN4apNteDJ x2k0T+Y8nrbdbP+EzWDsERSxHfzA82oqOZhvIb1eML2KRv7gxjRAZmWPEy0MUMp/x4dB 3pZbrhO1NHWB3v0J1w3/8CCkSiPlqi6PI6j3D8ZwnxDqyGkFm3OSinuTZCVDYotQ9i2O Qap1d7+VCajN8irmqwWGRUkXabA8hfkXxAvVH4Jp6ly8ReyoDlNxxXEoPZxBBG2jmGFR 7Nqw== X-Gm-Message-State: AOAM531vTZu4/5DYHKrFxfytdcqx1VdEE46sNMGc1fho36IMF4GV30+G QnUWRTlGwDSB6vr1ET82stQhR2su/vVGfy9p2ShtT2tpPZ6mXWlSSREXv03SCQJ5TfMTe8kTxxF sweQhFsk1PDCe/OQ= X-Received: by 2002:a7b:c393:: with SMTP id s19mr1981672wmj.92.1591352562570; Fri, 05 Jun 2020 03:22:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBf7Go/dbLXjGX+96h3/hmrHkVp9arWSr0CaxX1xQCTQ1b6imj9M/DZ8dDixF87Ac7Dhb0SQ== X-Received: by 2002:a7b:c393:: with SMTP id s19mr1981658wmj.92.1591352562405; Fri, 05 Jun 2020 03:22:42 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 02/11] hw/sd/sdcard: Update coding style to make checkpatch.pl happy Date: Fri, 5 Jun 2020 12:22:21 +0200 Message-Id: <20200605102230.21493-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) To make the next commit easier to review, clean this code first. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 3c06a0ac6d..f1b12b49db 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1154,8 +1154,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) sd->data_start =3D addr; sd->data_offset =3D 0; =20 - if (sd->data_start + sd->blk_len > sd->size) + if (sd->data_start + sd->blk_len > sd->size) { sd->card_status |=3D ADDRESS_ERROR; + } return sd_r1; =20 default: @@ -1170,8 +1171,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) sd->data_start =3D addr; sd->data_offset =3D 0; =20 - if (sd->data_start + sd->blk_len > sd->size) + if (sd->data_start + sd->blk_len > sd->size) { sd->card_status |=3D ADDRESS_ERROR; + } return sd_r1; =20 default: @@ -1216,12 +1218,15 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) sd->data_offset =3D 0; sd->blk_written =3D 0; =20 - if (sd->data_start + sd->blk_len > sd->size) + if (sd->data_start + sd->blk_len > sd->size) { sd->card_status |=3D ADDRESS_ERROR; - if (sd_wp_addr(sd, sd->data_start)) + } + if (sd_wp_addr(sd, sd->data_start)) { sd->card_status |=3D WP_VIOLATION; - if (sd->csd[14] & 0x30) + } + if (sd->csd[14] & 0x30) { sd->card_status |=3D WP_VIOLATION; + } return sd_r1; =20 default: @@ -1240,12 +1245,15 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) sd->data_offset =3D 0; sd->blk_written =3D 0; =20 - if (sd->data_start + sd->blk_len > sd->size) + if (sd->data_start + sd->blk_len > sd->size) { sd->card_status |=3D ADDRESS_ERROR; - if (sd_wp_addr(sd, sd->data_start)) + } + if (sd_wp_addr(sd, sd->data_start)) { sd->card_status |=3D WP_VIOLATION; - if (sd->csd[14] & 0x30) + } + if (sd->csd[14] & 0x30) { sd->card_status |=3D WP_VIOLATION; + } return sd_r1; =20 default: --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352734; cv=none; d=zohomail.com; s=zohoarc; b=Wv3MZuE5qbjsReFK3kMV9BcQjIcYlJt0PASNWEE11LEh4Tiv26HCRFk/vu2KlCUqXHlwEwUPJ0VWO+tzhisUwXK6j41kFMoYIsyPolTrTQpIXXsKVX2YZWrgvDqVT7Pa+H74e5bHojwgIiheZ4Jf8+Fy+tDDZ90UqS5uK59ynUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352734; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cRYsrlcMJ+je+ABJIYEYDBzMrp4zayKgKqABdV4YMxU=; b=PsNGyGCpRTvbUFXvvmNcp5eun6FHI5nXMjR0axVLiJkgDwCrfFDv7qef3PsU3KUfF/LBeJqIXXCB7aR5RR4Tc7Xy6Z8f7tci7NMzMcddYuCSxX1rH+aP51XDfcRTjYRKprRnA8RymxMUE3+J1OjZPoCdxr6+g3JONQ4R1CR+/Jk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352734482692.3221055517539; Fri, 5 Jun 2020 03:25:34 -0700 (PDT) Received: from localhost ([::1]:39060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9XZ-0008Ri-5G for importer@patchew.org; Fri, 05 Jun 2020 06:25:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9V0-0003Bv-2M for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:20940 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9Uz-0006MI-4W for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:53 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-0TdILqnZPNCgn9a0Y5tM2A-1; Fri, 05 Jun 2020 06:22:48 -0400 Received: by mail-wr1-f70.google.com with SMTP id e1so3612158wrm.3 for ; Fri, 05 Jun 2020 03:22:48 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id 5sm10953453wmd.19.2020.06.05.03.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cRYsrlcMJ+je+ABJIYEYDBzMrp4zayKgKqABdV4YMxU=; b=AzdQMNbswDE50oqk2Y3c1LUIYmCjo0rqC7qlC2bV9xNfCoQfL8cnYRQAp4ImNisY+oaQwm wc2Jgggr7KSoBEzrT6S5AuP1uDO6xqpisfekWhEvQ23Ckzwdkf9bLTI3Oxj/8r+AL0wBcw mUDSmvS4H5jiEvRdlTjR/8fVhT5EfOI= X-MC-Unique: 0TdILqnZPNCgn9a0Y5tM2A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cRYsrlcMJ+je+ABJIYEYDBzMrp4zayKgKqABdV4YMxU=; b=TWcg5Pj3LPo3TBHBgLY6pvsPPkMhziRUgTTDoI6w4qnQpstM6VwYhFIb7MJZy63Nyt 0iPAdjqW774N/Ptoq82XFLr2Nk72bFvYagO8zVSrBDmBDpjhIVQJmN8Br6jxvk9rzp20 ZPenWjbdO3M7D7mEhnshFw50Wn88tV4dpiUy4VUBGRU8wf8ILb1zxc57AP5l60DWcdNV uT+7lEb2p0blbJGpNwTbidmJdn5f1trfT7d+SuM81HWAeLaOrhIN/IWgdp1ZAxJ4XNvl uO7yUik91063Fs7XoaW/BwF+GjRddMVRxkOvubx5arxVHkbAZ7z7KwqGS1VLFsIaYzHR IDSQ== X-Gm-Message-State: AOAM532njREEoNN2vY1HlTzwGqaaMic5zPghq3p7iUGh3kE3UM9qO+Lx hIeACo+gUU4s59Q9lisXu4TeD6HHp2uAZ+kra6IAiYCylUNMSHuwxK1X1N6Q2KWzbVhZVKzmL57 LlucCq42BDp269eA= X-Received: by 2002:a5d:4e87:: with SMTP id e7mr8438670wru.427.1591352567295; Fri, 05 Jun 2020 03:22:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+JLK9/ntgQbZo38cdkK2hTaX6oy5bAz5lch6x0izVj6+m863pEHDAQYaFM3i917menv3kvQ== X-Received: by 2002:a5d:4e87:: with SMTP id e7mr8438653wru.427.1591352567016; Fri, 05 Jun 2020 03:22:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 03/11] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid Date: Fri, 5 Jun 2020 12:22:22 +0200 Message-Id: <20200605102230.21493-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Only move the state machine to ReceivingData if there is no pending error. This avoids later OOB access while processing commands queued. "SD Specifications Part 1 Physical Layer Simplified Spec. v3.01" 4.3.3 Data Read Read command is rejected if BLOCK_LEN_ERROR or ADDRESS_ERROR occurred and no data transfer is performed. 4.3.4 Data Write Write command is rejected if BLOCK_LEN_ERROR or ADDRESS_ERROR occurred and no data transfer is performed. Fixes: CVE-2020-13253 Cc: Prasad J Pandit Reported-by: Alexander Bulekov Buglink: https://bugs.launchpad.net/qemu/+bug/1880822 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 64 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index f1b12b49db..90d5ff6209 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1150,13 +1150,15 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) case 17: /* CMD17: READ_SINGLE_BLOCK */ switch (sd->state) { case sd_transfer_state: - sd->state =3D sd_sendingdata_state; - sd->data_start =3D addr; - sd->data_offset =3D 0; =20 if (sd->data_start + sd->blk_len > sd->size) { sd->card_status |=3D ADDRESS_ERROR; + return sd_r1; } + + sd->state =3D sd_sendingdata_state; + sd->data_start =3D addr; + sd->data_offset =3D 0; return sd_r1; =20 default: @@ -1167,13 +1169,15 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) case 18: /* CMD18: READ_MULTIPLE_BLOCK */ switch (sd->state) { case sd_transfer_state: - sd->state =3D sd_sendingdata_state; - sd->data_start =3D addr; - sd->data_offset =3D 0; =20 if (sd->data_start + sd->blk_len > sd->size) { sd->card_status |=3D ADDRESS_ERROR; + return sd_r1; } + + sd->state =3D sd_sendingdata_state; + sd->data_start =3D addr; + sd->data_offset =3D 0; return sd_r1; =20 default: @@ -1213,20 +1217,24 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) /* Writing in SPI mode not implemented. */ if (sd->spi) break; + + if (sd->data_start + sd->blk_len > sd->size) { + sd->card_status |=3D ADDRESS_ERROR; + return sd_r1; + } + if (sd_wp_addr(sd, sd->data_start)) { + sd->card_status |=3D WP_VIOLATION; + return sd_r1; + } + if (sd->csd[14] & 0x30) { + sd->card_status |=3D WP_VIOLATION; + return sd_r1; + } + sd->state =3D sd_receivingdata_state; sd->data_start =3D addr; sd->data_offset =3D 0; sd->blk_written =3D 0; - - if (sd->data_start + sd->blk_len > sd->size) { - sd->card_status |=3D ADDRESS_ERROR; - } - if (sd_wp_addr(sd, sd->data_start)) { - sd->card_status |=3D WP_VIOLATION; - } - if (sd->csd[14] & 0x30) { - sd->card_status |=3D WP_VIOLATION; - } return sd_r1; =20 default: @@ -1240,20 +1248,24 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) /* Writing in SPI mode not implemented. */ if (sd->spi) break; + + if (sd->data_start + sd->blk_len > sd->size) { + sd->card_status |=3D ADDRESS_ERROR; + return sd_r1; + } + if (sd_wp_addr(sd, sd->data_start)) { + sd->card_status |=3D WP_VIOLATION; + return sd_r1; + } + if (sd->csd[14] & 0x30) { + sd->card_status |=3D WP_VIOLATION; + return sd_r1; + } + sd->state =3D sd_receivingdata_state; sd->data_start =3D addr; sd->data_offset =3D 0; sd->blk_written =3D 0; - - if (sd->data_start + sd->blk_len > sd->size) { - sd->card_status |=3D ADDRESS_ERROR; - } - if (sd_wp_addr(sd, sd->data_start)) { - sd->card_status |=3D WP_VIOLATION; - } - if (sd->csd[14] & 0x30) { - sd->card_status |=3D WP_VIOLATION; - } return sd_r1; =20 default: --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352633; cv=none; d=zohomail.com; s=zohoarc; b=IXeT3vWGDtJy+W0b1XUXIB8jkQWtz8wMSwhz6WNTxTyFKmD2sD1ZW9Wd4PvFZBSwsbQ6qJMTOSmv5em0ECZ5OgxVKIU0l4ZQkdrH1cUY4x5XawmwsogoODBqMVcTew5PU8yip0wBnu/TvDlp61K4BcsBLnuf5iwDFGtrJaLvV30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352633; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GcNyt5JpibNbYHzcDu4M3J79WDrEHAq/FGF7Nlj7rRk=; b=g3+NkxqwdYgtnev0iRKC5vcwKAGiL81tT7zeZE39I+hmd4NVog29ZuEMWHkodpitgYSiOdyFYUCAKAXU1tCCcC5IP0p2cVICyFOA3jGQ+BDzKEvxrwmEE4OCfqZCBaEwUVug0U4BCrTs4B8G2d4PaSiTe1xXBxhI9FLKKhNQlsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352633393936.5157856269706; Fri, 5 Jun 2020 03:23:53 -0700 (PDT) Received: from localhost ([::1]:58606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9Vw-0004wq-4u for importer@patchew.org; Fri, 05 Jun 2020 06:23:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9V2-0003GD-AR for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38954 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9V1-0006Mv-Lq for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:22:55 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-i7j2F2BfN4iZJQ4pXXiVMQ-1; Fri, 05 Jun 2020 06:22:53 -0400 Received: by mail-wr1-f71.google.com with SMTP id s17so3576780wrt.7 for ; Fri, 05 Jun 2020 03:22:53 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id k17sm12097520wrl.54.2020.06.05.03.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GcNyt5JpibNbYHzcDu4M3J79WDrEHAq/FGF7Nlj7rRk=; b=ieW7mYPukfw5G2soD3iLoa3X4r1kQuIeBgjCJk3iC050kOMYmumFKpKZQQRTlMSQcbPQ69 AUO5wabh54WT0Ips4JHu39uZRxL/5RzYoY1Wa9NgDj4D03GsMkWT0VPXGYEfuh6WgTveJW wM7EB0ydbgi9lmTupyWEPhNbRihCea4= X-MC-Unique: i7j2F2BfN4iZJQ4pXXiVMQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GcNyt5JpibNbYHzcDu4M3J79WDrEHAq/FGF7Nlj7rRk=; b=QraHeyno5LhC4LaPwgwCmw/DhjOmmfmXOIKFVzu39xaO4w2Jc8VtGrwHZ35IdnVNGo PsRQ64qAGkduvbYT6JC3QeY8yHb2OvpHPy5N2ivHL1Q9oR7GIupsHRF5eWnpGVDUltw1 Ggem4e0EJpB2NZO3PaZXtTrQoN6CCRj/xdyMo2MghNH8LsaWOVoQSiaYhabGTbUgXrUD S0Uq2tTjD87ruGSAk/QW04eWdzmyIIh05MUeyckHj6C2/XARZlz3GuYHGZCQwycC36MP x76G1RvbMd9ujpNIUaicy3UDuNckkQG//AM8lvnuejPb8aNxaA6W/IgOKi874f6ThMfd aSEQ== X-Gm-Message-State: AOAM531Cpngvaxy1jd6TM2uifIqrxfXcXL4X5mOj2I2/nldkQraIrdJU 4pR0K0h6E099BMfrWzj5LorSeLQvMRYol9Iu0j65uc2ZaxPpu2KuCZ4B+T/7y6eRlV9asA7c5Af eBfB56PFOBOEakMw= X-Received: by 2002:a1c:ed0e:: with SMTP id l14mr1991202wmh.8.1591352571940; Fri, 05 Jun 2020 03:22:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJlq3ObrJT2DK4tzsfx3QJMTMoBN7zINfc7byjcsmQXhc9b8x32poqWAkxg/B5n0PtfS3IZg== X-Received: by 2002:a1c:ed0e:: with SMTP id l14mr1991186wmh.8.1591352571689; Fri, 05 Jun 2020 03:22:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 04/11] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards Date: Fri, 5 Jun 2020 12:22:23 +0200 Message-Id: <20200605102230.21493-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Only SCSD cards support Class 6 (Block Oriented Write Protection) commands. "SD Specifications Part 1 Physical Layer Simplified Spec. v3.01" 4.3.14 Command Functional Difference in Card Capacity Types * Write Protected Group SDHC and SDXC do not support write-protected groups. Issuing CMD28, CMD29 and CMD30 generates the ILLEGAL_COMMAND error. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 90d5ff6209..4cc1ecf9f9 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -905,6 +905,11 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SD= Request req) sd->multi_blk_cnt =3D 0; } =20 + if (sd_cmd_class[req.cmd] =3D=3D 6 && FIELD_EX32(sd->ocr, OCR, CARD_CA= PACITY)) { + /* Only Standard Capacity cards support class 6 commands */ + return sd_illegal; + } + switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ case 0: /* CMD0: GO_IDLE_STATE */ --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352639; cv=none; d=zohomail.com; s=zohoarc; b=PDdnGWoXF1u85fztNNeInQf9dZAgYWg0vFbDIsYHXQUG8UXkCby7Rfj4S/Jl7R3ZWL28Il8aF4lUdjLmnQQQNQb4uprQmPBRzKcuhA2ARdHflnqvFiYP691cw2tB5Yy6ptUbPbF1Mrt5U/htqw3aq61eQnLuVo4AsPEbf96lgII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352639; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DeVz5TjKOT0p1ZFW/1IBT7jKGkXxB4CDp7QQNIm666M=; b=CUXZy+T2uCJsa+N8+tePERZB1MYJfFLbQiwhH4yyMGizFOdxltQVL12Bv8RKjJ2gbldHlbx21zaMux9U2Q0tfAcLh8gU9upVXD2TQ4K+N++Z0nZe0C4HrpfcU2YcFVTE2vI4vtfOUvWpwmfQf7e7jFuCuVktK3PIQF4411VL9GU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352639296804.4912999891253; Fri, 5 Jun 2020 03:23:59 -0700 (PDT) Received: from localhost ([::1]:59190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9W2-0005B4-29 for importer@patchew.org; Fri, 05 Jun 2020 06:23:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9V7-0003RF-9W for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:01 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:44877 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9V6-0006OK-Fv for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:00 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-118-eWR5RYyBOKmLulT-kPVckg-1; Fri, 05 Jun 2020 06:22:58 -0400 Received: by mail-wr1-f72.google.com with SMTP id c14so3573641wrw.11 for ; Fri, 05 Jun 2020 03:22:58 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id h27sm13726018wrb.18.2020.06.05.03.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DeVz5TjKOT0p1ZFW/1IBT7jKGkXxB4CDp7QQNIm666M=; b=HLy4Oa17h2tXnzH+OkpvMJaM/MP2JfZRlFOKQ8Td/k6o23feKL+l7rgdX68W1hzOEoVeBC TgV7edLAAXiETNxzfXUKw3qa2E6xiTBmVJ3A3DtooNCdsl3WwUC69B4WZM5z0E2HHAErdK AnDJYPgMyCX8PXpSFFYthttREpsDvJY= X-MC-Unique: eWR5RYyBOKmLulT-kPVckg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DeVz5TjKOT0p1ZFW/1IBT7jKGkXxB4CDp7QQNIm666M=; b=oyMwLpVlXcIRuDbVOUS6Vw6EvYtcuW7WeI0bEyDhUavNNs7q0XqG41vMhDHXENa7A1 6dV5NGEP6VKOb/PSSoYBmdIzbI0sEPLKA7JWx1D8xbcm/HHVHTMwqgDLSr4cKSMF7f9K z3PYsxmcStDRd4H0UQw5AyS77Z2b00lKRPPxC4wl69VLCVIzIBUUy67O8NN09MZ9aRHl MI+wF13uhq77jRA+8sk9jrTlMXkXL54J7e95wJ35ot9OwNLv4SGOPLH71oL/YCy2DMiB ukHjUslvBtJfNUwvAEBtuph0AJDqqlcmHsAd8ELPjJvrN1kxzmponChFOXOVo/8Yntng O1AA== X-Gm-Message-State: AOAM53149wS+oahxPzrzbV+LSpgkY008l//CVdONAjWa62MN3RjCxHQd K5XKwzQ5rf2Spsq8zQzxmKy70Ujj7iFdIjbPmzf1Foe3doWVTHoCCOqijA0UjFqg54qK/bOczk6 6TkWS5EkPPIZ5+Ko= X-Received: by 2002:a05:6000:18c:: with SMTP id p12mr9311391wrx.66.1591352576822; Fri, 05 Jun 2020 03:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrQiGjAj+NyAbVIPKTVgxw4iqRdgUoSbvheMGP576Mae2prfljWl2HDLT5wuBcRyZlT0s1ww== X-Received: by 2002:a05:6000:18c:: with SMTP id p12mr9311373wrx.66.1591352576663; Fri, 05 Jun 2020 03:22:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 05/11] hw/sd/sdcard: Update the SDState documentation Date: Fri, 5 Jun 2020 12:22:24 +0200 Message-Id: <20200605102230.21493-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Add more descriptive comments to keep a clear separation between static property vs runtime changeable. Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 4cc1ecf9f9..9bfd65ac34 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -92,11 +92,14 @@ struct SDState { uint32_t card_status; uint8_t sd_status[64]; =20 - /* Configurable properties */ + /* Static properties */ + uint8_t spec_version; BlockBackend *blk; bool spi; =20 + /* Runtime changeables */ + uint32_t mode; /* current card mode, one of SDCardModes */ int32_t state; /* current card state, one of SDCardStates */ uint32_t vhs; --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352863; cv=none; d=zohomail.com; s=zohoarc; b=bKanWNgzQbgXP5ysV3Abxy9nKSVYUsvxZ0DDwP5Ww79DWKFBgu1YhRTtqk7CEvQ4s7veMCjpoNV0a3wWCzGjVWrNOcnqLJZMGljRihbdLz+SgJfTrauffPjUXHegnCpB2aCkeuRAcos2FianTPj5wkAhy7c9rW+9Hih7WY+gO24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352863; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cCwuEoJ2Oz59P52pgmfXcQkO9n1Xvg5SPqRDxLaXzRI=; b=iZcLv2LrI6soUO7SlU+2wmvj2GDKYH1zfo8vpTWatZcxPbKzkO88cWYW6F+7QpcWfAV+z4KIhBQv3a0VHAeTMcQJ3cpyimO1OorCussOUBlhSdWdi2gFXhFGKV30ddMtqj/33x6BIDPy1ey9XfI/Hz/bJa19IruJJ2ov7Ppbids= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159135286319027.03025196948886; Fri, 5 Jun 2020 03:27:43 -0700 (PDT) Received: from localhost ([::1]:47656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9Zd-0003jE-U6 for importer@patchew.org; Fri, 05 Jun 2020 06:27:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9VB-0003ak-So for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:05 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:25426 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9VB-0006PC-0M for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:05 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-GphZWswwNCavn6W070fOXA-1; Fri, 05 Jun 2020 06:23:02 -0400 Received: by mail-wr1-f72.google.com with SMTP id w16so3583056wru.18 for ; Fri, 05 Jun 2020 03:23:02 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id s2sm10350288wmh.11.2020.06.05.03.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cCwuEoJ2Oz59P52pgmfXcQkO9n1Xvg5SPqRDxLaXzRI=; b=hkCs9a4re8KJ4Nl4t845mLN+0NTYNr0is0jmDNaLrNAGQ9n+RMJeKJy8jPbCgA0gxvo9jq lqvXCTNmmshhVeuRfyIRJlZCBSNs9FEk4IRGukp1R2qLkoiGOxgJR6oQRky6E2lwDW6/Pf gPuSYbS5g7Mcsn1cy7QBkF02m508oYU= X-MC-Unique: GphZWswwNCavn6W070fOXA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cCwuEoJ2Oz59P52pgmfXcQkO9n1Xvg5SPqRDxLaXzRI=; b=NxiVMqelgycbHBLpEyqXlF3rjNCBgvzoQxzltisaWuSJp8s8ErzVsXxMt2ffYHy3qN B9Tielb0dvp4hrSuzg+l6U/deg9E5jUdBNj+aV723tWNMoWv4SjYo1r5GluxcLYIAw0N 61yYYojr+ZpSQdMtmDtaJ7o8camAyVcjkz35DMijUMD0qbg4HzI6oBNamh19dfH65mVi E7WX2d4ZLSymir1rNin4lQRMnUsu3v4xQ497oJiU1CIpq2TffdMEsbErsQTDT9Mhi2f4 r5ulw83FshN+vfACt/zL/ZIfsIz0UfykYcaxaOey78tHjVuyrwfX7NM9xfH07p8MlE3Q c8XQ== X-Gm-Message-State: AOAM530faQUoNu8baANk1G94p6xAeVMsaMpIrWKe4NtzktTFzEfIckqF +KZoF5bEe6kqoOBrF6umn5/Bw2eSLeVAtT83UCsVrXKXnEGKDaP8HOq8Na8bP1Zs77G3bLh4juD Yss0i6PUByYZ9Faw= X-Received: by 2002:a5d:610f:: with SMTP id v15mr8827762wrt.52.1591352581350; Fri, 05 Jun 2020 03:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkIyf5cb1hyyHLYtN7d0yIbePCKHjNDYfY5+3Uq3Tl67IiC2rMM5qr+C7UTvnqDP1iU0xGCg== X-Received: by 2002:a5d:610f:: with SMTP id v15mr8827746wrt.52.1591352581183; Fri, 05 Jun 2020 03:23:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 06/11] hw/sd/sdcard: Simplify cmd_valid_while_locked() Date: Fri, 5 Jun 2020 12:22:25 +0200 Message-Id: <20200605102230.21493-7-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 cmd_valid_while_locked() only needs to read SDRequest->cmd, pass it directly and make it const. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9bfd65ac34..7799a3c621 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1647,7 +1647,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, return sd_illegal; } =20 -static int cmd_valid_while_locked(SDState *sd, SDRequest *req) +static int cmd_valid_while_locked(SDState *sd, const uint8_t cmd) { /* Valid commands in locked state: * basic class (0) @@ -1658,13 +1658,12 @@ static int cmd_valid_while_locked(SDState *sd, SDRe= quest *req) * Anything else provokes an "illegal command" response. */ if (sd->expecting_acmd) { - return req->cmd =3D=3D 41 || req->cmd =3D=3D 42; + return cmd =3D=3D 41 || cmd =3D=3D 42; } - if (req->cmd =3D=3D 16 || req->cmd =3D=3D 55) { + if (cmd =3D=3D 16 || cmd =3D=3D 55) { return 1; } - return sd_cmd_class[req->cmd] =3D=3D 0 - || sd_cmd_class[req->cmd] =3D=3D 7; + return sd_cmd_class[cmd] =3D=3D 0 || sd_cmd_class[cmd] =3D=3D 7; } =20 int sd_do_command(SDState *sd, SDRequest *req, @@ -1690,7 +1689,7 @@ int sd_do_command(SDState *sd, SDRequest *req, } =20 if (sd->card_status & CARD_IS_LOCKED) { - if (!cmd_valid_while_locked(sd, req)) { + if (!cmd_valid_while_locked(sd, req->cmd)) { sd->card_status |=3D ILLEGAL_COMMAND; sd->expecting_acmd =3D false; qemu_log_mask(LOG_GUEST_ERROR, "SD: Card is locked\n"); --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352955; cv=none; d=zohomail.com; s=zohoarc; b=G290uhJcfAzQZTF7z1j0imJFT+gPDeNFa/SnPhLyWxmXLUOWVKgNGiBqAKYdlqTJ0+3ZKr/KpgXZQPXnN+nm9uTqraePoEKaZOLFcPP/mWmE8y3NFiv5zJpJsio1vBHWd+DlmGuUvmUt7qPEURCzdb5jk6smdGZ3WoirW/xZwZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352955; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6lSSjLejiscLCvJVDaLCtQGkkV0h02Ah/YQj2aVjpKQ=; b=TXf2ycT1eF7xKlYb+bMtUe2//tsZENluSiy28NKoBpNK88yuYiPaedoeQPkWoQfFa/k0LonzlkeT9ps72q6SAs+Vp1x9mbvX1ePbTvU01fC0d/jk16XYNaqac61WBsr+sa0aFb3TMIZ+/ELjsYHzA1iUjenDDUWjvcSUr8I60yo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352955540567.9398721378863; Fri, 5 Jun 2020 03:29:15 -0700 (PDT) Received: from localhost ([::1]:54504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9b8-0006eM-E2 for importer@patchew.org; Fri, 05 Jun 2020 06:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9VG-0003oE-Uo for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27616 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9VG-0006R3-2D for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:10 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-90-v8jD5gH4N42edEMQUh-FsA-1; Fri, 05 Jun 2020 06:23:07 -0400 Received: by mail-wm1-f72.google.com with SMTP id u11so2843268wmc.7 for ; Fri, 05 Jun 2020 03:23:07 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id a3sm11303685wrp.91.2020.06.05.03.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6lSSjLejiscLCvJVDaLCtQGkkV0h02Ah/YQj2aVjpKQ=; b=SWaTlEx7Pf1VQs+2iQSAsQENxhMTV8g4zla8yJmhkP8wHXRpTJ80kcDIpDVxxuSMhuwXs1 AlB280qoZIdwhDWROi5iSnLC14W6ZTMf/0XX7ZtCJG4C0eu4DIAW1JbTpyiAdXXM1/9fue HhngMtcy37faIaLkh0xEU1YwLabvoT8= X-MC-Unique: v8jD5gH4N42edEMQUh-FsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6lSSjLejiscLCvJVDaLCtQGkkV0h02Ah/YQj2aVjpKQ=; b=KjFMWTq/U+FTZfWQx5xwrbXNBCF+bLWF8CEfXc6mgPR2llkXOJSnjjcEdCUL2EhOst lAKd10IFgAIT3rCc1NMIFu71Chl14QShAYIdJ/dqDaSJWDyLuMwNAvwr3nTcXsx89Vsh z2BwQGj+fTXufh00G4JGaAJaFTG/k38ZYgn9WwR0GQy9PoNLIh2JrmGrjIMLPsYOc1ni 5gM7dp4YLgUf6NkfyYITnnQ1rDvr5SWq7Fxuhf1ow+T1auZfPCYJ06SdBaRR/kkjkhao wvwx9PudUvRNIfnbCPP9kNAr0ZgEEBhNC1J3+GuzIdRnzinTdC4ymP2epHFKbHXge++f Dg1g== X-Gm-Message-State: AOAM531TM5WhzIcroJehXLXcPnjoCmWWex2xDDw4quxykKZGAqxFHyJZ cCa106fKEyR4QVjmmg5QLS3LzjMnybV8fC64aSp3FN1W8AeIhswaPJxNMzuNWfazpghtln1LMvn stQ6CKRDbv2fu6x0= X-Received: by 2002:adf:ed4f:: with SMTP id u15mr8655713wro.126.1591352586305; Fri, 05 Jun 2020 03:23:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1/gm5RqSpGyRv3/h4o+yYzMBujqn1ZUWppyGY4JpNXUGRCiqMhWW2IMqzpAfhq0ntaLOWAA== X-Received: by 2002:adf:ed4f:: with SMTP id u15mr8655698wro.126.1591352586101; Fri, 05 Jun 2020 03:23:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 07/11] hw/sd/sdcard: Constify sd_crc*()'s message argument Date: Fri, 5 Jun 2020 12:22:26 +0200 Message-Id: <20200605102230.21493-8-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:27:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 CRC functions don't modify the buffer argument, make it const. Reviewed-by: Alistair Francis Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7799a3c621..9d51138b11 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -242,11 +242,11 @@ static const int sd_cmd_class[SDMMC_CMD_MAX] =3D { 7, 7, 10, 7, 9, 9, 9, 8, 8, 10, 8, 8, 8, 8, 8, 8, }; =20 -static uint8_t sd_crc7(void *message, size_t width) +static uint8_t sd_crc7(const void *message, size_t width) { int i, bit; uint8_t shift_reg =3D 0x00; - uint8_t *msg =3D (uint8_t *) message; + const uint8_t *msg =3D (const uint8_t *)message; =20 for (i =3D 0; i < width; i ++, msg ++) for (bit =3D 7; bit >=3D 0; bit --) { @@ -258,11 +258,11 @@ static uint8_t sd_crc7(void *message, size_t width) return shift_reg; } =20 -static uint16_t sd_crc16(void *message, size_t width) +static uint16_t sd_crc16(const void *message, size_t width) { int i, bit; uint16_t shift_reg =3D 0x0000; - uint16_t *msg =3D (uint16_t *) message; + const uint16_t *msg =3D (const uint16_t *)message; width <<=3D 1; =20 for (i =3D 0; i < width; i ++, msg ++) --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352848; cv=none; d=zohomail.com; s=zohoarc; b=nTGokAGcN/g4Yukx6AdQ+MTy8PPzGHv7/8tDQXxufsA4f/sjpdSou+fLGGcAc4vDtriGKshtoK32jYbdsqbajgjOZ0chVQw8nqgfw7W1mIq4CNrfizI2kNQfTEMWBCq2Wfw0jopHkJMfJ4ZJl9+dk3jkxMsasNLl7jPjlXdhMMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352848; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c55q0J7grSSjYGaEHTw0pM5dKeE6x+GNtQxLVwkoJJw=; b=DPP4aHa3zN50Z6GCpxREoSl+gkuVZJCYLDPIQK1ZsaBN36F3nw2vLjU9HHWDuN5rkyi9gBKt6hsj/DnBDv0sjfWqdoW3iy+Qb4YXbmdEMFr0CjDPwT7Atu1KUB0oyQxGbaCd+D3H6SlWX2/MgmczoUIPrUae+ffNSZxAp1UaC4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159135284859433.741574269473745; Fri, 5 Jun 2020 03:27:28 -0700 (PDT) Received: from localhost ([::1]:46402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9ZP-0003CB-0H for importer@patchew.org; Fri, 05 Jun 2020 06:27:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9VL-00040G-G5 for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:15 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25287 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9VK-0006VE-F5 for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:15 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-buBY_I74OVuixVgsvDJs0w-1; Fri, 05 Jun 2020 06:23:12 -0400 Received: by mail-wm1-f69.google.com with SMTP id h25so3689783wmb.0 for ; Fri, 05 Jun 2020 03:23:12 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id e10sm11529733wrn.11.2020.06.05.03.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c55q0J7grSSjYGaEHTw0pM5dKeE6x+GNtQxLVwkoJJw=; b=UyAjKhtcJh+W9Dvmsjd0nSIOe/xHWBFrsabukkeYhQgZoTfToY3FMZZD3X7mwQjUHgbC3i VlXgJEzaK558jMPOUoPwZ5epYpiKAgUMXE4bBJPqiKzhXNLVFeF77rcZ2YTFxqKgCmCtFW jGfZxLogtCXCXo/6baMI3J/7sIyGHSE= X-MC-Unique: buBY_I74OVuixVgsvDJs0w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c55q0J7grSSjYGaEHTw0pM5dKeE6x+GNtQxLVwkoJJw=; b=ASWB+sS+rnNi5ImT8wavz597x/gY0ux7dkA2ceZxlQ9x7LpUeFUOFyI5s45D+tvRUF EEFFz6ajoyy3c50aN3XJxO7gTgk8qCNnYqwmo8luW9Zuec7B66SXaKrfdrg4KS9fHa5H f9CZNpWF5em31n4FRNbe7lq6Bf0za2A1kuaQnGga1qD/OcS5daU7iPlgLlxQoBXKbcmF TpcEYUHNjCO4cdIkWzvowcosTUsGn91PJPaWh2DauZaE0YoaZdIjHEVmGzSPN3BRnQBj E4lZLRRVS4qkQTi+7CVA2uAvqw7zG50+cUyBseXHPl9IFANQZ27MkOrxaRjyH2yTAUgd sLfg== X-Gm-Message-State: AOAM532D17eIWEXFQioKXsLYVzd3S2O+jyF8r2xIVui+8c0Yt6QbQOrh xPnjBJv4egE/KZ0eFhLjNnpttxsubSoLqgjVEsxdMZ4SuUeqx+8UmkTKtxzGObVrrGAgPw6IKuB me+Wiw0WLKzwh3Xs= X-Received: by 2002:a5d:4cc4:: with SMTP id c4mr8668453wrt.159.1591352590899; Fri, 05 Jun 2020 03:23:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh0sdz05XiyWXEeqfM/DhSPFCg7uEnMuDCDKKe3XoASfRX39gCw+7Ne3Mm5rX7jWKGaijSjw== X-Received: by 2002:a5d:4cc4:: with SMTP id c4mr8668434wrt.159.1591352590693; Fri, 05 Jun 2020 03:23:10 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 08/11] hw/sd/sdcard: Make iolen unsigned Date: Fri, 5 Jun 2020 12:22:27 +0200 Message-Id: <20200605102230.21493-9-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:27:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) I/O request length can not be negative. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 2 +- hw/sd/trace-events | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9d51138b11..952be36399 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1950,7 +1950,7 @@ uint8_t sd_read_data(SDState *sd) { /* TODO: Append CRCs */ uint8_t ret; - int io_len; + size_t io_len; =20 if (!sd->blk || !blk_is_inserted(sd->blk) || !sd->enable) return 0x00; diff --git a/hw/sd/trace-events b/hw/sd/trace-events index 5f09d32eb2..f892c05867 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -52,7 +52,7 @@ sdcard_unlock(void) "" sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x= %x" sdcard_write_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0= x%x" sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, ui= nt8_t value) "%s %20s/ CMD%02d value 0x%02x" -sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, int= length) "%s %20s/ CMD%02d len %d" +sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, siz= e_t length) "%s %20s/ CMD%02d len %zu" sdcard_set_voltage(uint16_t millivolts) "%u mV" =20 # milkymist-memcard.c --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352738; cv=none; d=zohomail.com; s=zohoarc; b=ao1iLphdnjMRRtPw/WdSUEgVjm8cp58qxU2OGwv+6pr5rlD5P/xlU+OinZmStbN6jwTRXWukZtGFxIPV2AbEtmdPeDpWp6dlPABBidkttgApkfjedTlt+gpY4hVQdZs5aLxI6K4lNTpWkRr77xBeA0ux0yRJyvZMxw8lXt6cIjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352738; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5fRA1bjw8PFajFz66cmd9KYwjFOeduTwYTWjhF6GRIY=; b=YkoWfZez5p0V24Y8sh1kHEE24aO911V7q4IqPSZvoAAXKD95WDl8tKJE8KkbLYkUTV+c/Cluh8m4EHVhK/nO4z+XUA26y88sgwMhUaG/iHn/DgVy3d1bGxDZpfWskMvOSg92AxlO5uWl+YtccAaHoCQf/yK1HzHZJVAFwruZL3E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352738649229.79978443594962; Fri, 5 Jun 2020 03:25:38 -0700 (PDT) Received: from localhost ([::1]:39468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9Xd-0000Ar-Bv for importer@patchew.org; Fri, 05 Jun 2020 06:25:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9VQ-0004F0-Ld for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:20 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46132 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9VP-0006YK-RG for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:20 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-bTR4r4r8MUS1S4zGLBxWaQ-1; Fri, 05 Jun 2020 06:23:17 -0400 Received: by mail-wm1-f71.google.com with SMTP id h6so2588386wmb.7 for ; Fri, 05 Jun 2020 03:23:16 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id u13sm10448725wmm.6.2020.06.05.03.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5fRA1bjw8PFajFz66cmd9KYwjFOeduTwYTWjhF6GRIY=; b=K+pPUVQ3gYslBeMpdw9S+cvH+SyzHkv6hQuTT+/5rLISdTgcYfNNcqp/LF9bb32ktU3Bgf WwJSPwoTGD2oiq6uWs/nims9HvrO11M+hEC4VJBbJVkPjf676FbevX3BBA8/D80gN6THrw iACMT5BF7GazFDe9JrJNkSLldU9h9SU= X-MC-Unique: bTR4r4r8MUS1S4zGLBxWaQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5fRA1bjw8PFajFz66cmd9KYwjFOeduTwYTWjhF6GRIY=; b=fQvgQcp6N/JwGNArH6J/XU3Jh16dP3KinKvuB/MXdwpxqLWMN8hXsRtDUNubCQG+8N 0/26cizrbhkvSxJAE1MEoxLPlw0SAksWB093QlS3TnybvFW8y/e+V9/6/PclGp2zMXKI 45ALet8ls7KP7I/ZUSjjY45o/DOylLJRaZFLie1z8WdBkLqA5PMRI25tKN6bG2gltfDE serpb2zldxdd9OszFkl74K4yG6pvWIuf6iyXs8v13xyf4h9X0C8i69LecuTzjd58x3KH FRyKYDUIiqsp7tJJMTAOfiwJB3jLYzqxLP5oQbKJINsYzoMyozWIAzkZ8/0IlM1NMCde x6sA== X-Gm-Message-State: AOAM5312aoFYc9x+LgJCSFvjVl+7RVgqyv6dzIJhjfB1c+gsPrcySePY 5l/z0eZZ7r0fXENSwefxFXEz/w3YA/H4GnZsqfF3JKSRrE24+clbeKH1FdslUptljVoHQbyDVpR 0bgiDrtnqdvo2SrM= X-Received: by 2002:a05:600c:1146:: with SMTP id z6mr1952046wmz.179.1591352595600; Fri, 05 Jun 2020 03:23:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTvOX7zZ5aOQm+r3CsNFj/JftKxFSEgZXZuaWbz4IsMxvnaRSlKKK/5s1lygd1+oa56bENWg== X-Received: by 2002:a05:600c:1146:: with SMTP id z6mr1952023wmz.179.1591352595316; Fri, 05 Jun 2020 03:23:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 09/11] hw/sd/sdcard: Correctly display the command name in trace events Date: Fri, 5 Jun 2020 12:22:28 +0200 Message-Id: <20200605102230.21493-10-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Some ACMD were incorrectly displayed. Fix by remembering if we are processing a ACMD (with current_cmd_is_acmd) and add the sd_current_cmd_name() helper, which display to correct name regardless it is a CMD or ACMD. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 952be36399..fad34ab184 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -114,6 +114,7 @@ struct SDState { uint8_t pwd[16]; uint32_t pwd_len; uint8_t function_group[6]; + bool current_cmd_is_acmd; uint8_t current_cmd; /* True if we will handle the next command as an ACMD. Note that this = does * *not* track the APP_CMD status bit! @@ -1687,6 +1688,8 @@ int sd_do_command(SDState *sd, SDRequest *req, req->cmd); req->cmd &=3D 0x3f; } + sd->current_cmd =3D req->cmd; + sd->current_cmd_is_acmd =3D sd->expecting_acmd; =20 if (sd->card_status & CARD_IS_LOCKED) { if (!cmd_valid_while_locked(sd, req->cmd)) { @@ -1714,7 +1717,6 @@ int sd_do_command(SDState *sd, SDRequest *req, /* Valid command, we can update the 'state before command' bits. * (Do this now so they appear in r1 responses.) */ - sd->current_cmd =3D req->cmd; sd->card_status &=3D ~CURRENT_STATE; sd->card_status |=3D (last_state << 9); } @@ -1775,6 +1777,15 @@ send_response: return rsplen; } =20 +static const char *sd_current_cmd_name(SDState *sd) +{ + if (sd->current_cmd_is_acmd) { + return sd_acmd_name(sd->current_cmd); + } else { + return sd_cmd_name(sd->current_cmd); + } +} + static void sd_blk_read(SDState *sd, uint64_t addr, uint32_t len) { trace_sdcard_read_block(addr, len); @@ -1813,7 +1824,7 @@ void sd_write_data(SDState *sd, uint8_t value) return; =20 trace_sdcard_write_data(sd->proto_name, - sd_acmd_name(sd->current_cmd), + sd_current_cmd_name(sd), sd->current_cmd, value); switch (sd->current_cmd) { case 24: /* CMD24: WRITE_SINGLE_BLOCK */ @@ -1967,7 +1978,7 @@ uint8_t sd_read_data(SDState *sd) io_len =3D (sd->ocr & (1 << 30)) ? 512 : sd->blk_len; =20 trace_sdcard_read_data(sd->proto_name, - sd_acmd_name(sd->current_cmd), + sd_current_cmd_name(sd), sd->current_cmd, io_len); switch (sd->current_cmd) { case 6: /* CMD6: SWITCH_FUNCTION */ --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591353130; cv=none; d=zohomail.com; s=zohoarc; b=SGt0VpXY42hs7oFtEtdE7CbIcXpgr2LrxsVO02/JnQeqH+QdCtrHBs0cxC35uSfclr0ZVjvJgN9SKFEBqYBPGX5e6kCnNkImTZvkresP0v3ruyjZtu5b5o76CXR7GC3yZXzWkdN3vFmrfDGayGidoSQYU8AdgZlck7LvbLu018o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591353130; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Gw1xw+LMpEmzRwp28aIuZw9IW5+ls2uZgRvm0cZFybM=; b=gtsS4KWPTc4l/v1p9im7cXb6Je+PS4PVyBDYM7v4fmaduErCa5ENMykI5qIXMiIrn8PUvOiKWBrL0t+8SMygotLIU4R7fpo4jm9VE+AWCeU82yXJvCzfwPgxg8xfSunsDGFza+SiutE4tv8N8XUuIXFmvUMiJmVjtCrxp5nSHX8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591353130856961.7170206758448; Fri, 5 Jun 2020 03:32:10 -0700 (PDT) Received: from localhost ([::1]:59834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9dx-0000eF-Cf for importer@patchew.org; Fri, 05 Jun 2020 06:32:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9VW-0004Tf-0g for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44248 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9VT-0006ZZ-Th for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:23:25 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-xe56vpd0ONW8d0jHvz_18w-1; Fri, 05 Jun 2020 06:23:21 -0400 Received: by mail-wr1-f70.google.com with SMTP id j16so3564878wre.22 for ; Fri, 05 Jun 2020 03:23:21 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id 138sm11300924wma.23.2020.06.05.03.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gw1xw+LMpEmzRwp28aIuZw9IW5+ls2uZgRvm0cZFybM=; b=frcI9FZwI+VQieHx7pWpMN+K9IrE3s9rTCHVTnXwNHtw5bw2Y9iSAWnc5DfCJvu8bULvme 7+03SpK3IxQ4EABzJ8MdUEsNXY6r0ORPzVTdDCyYTRfQujeoqEepAbZAT35IX05hTz1/XP oVx3WUp1hrXXy0dJf70JWNu1e07wkzw= X-MC-Unique: xe56vpd0ONW8d0jHvz_18w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gw1xw+LMpEmzRwp28aIuZw9IW5+ls2uZgRvm0cZFybM=; b=Gk9PTY+UR+y+fzGznDUfQenHVdlteOnUHwXaKhAZN3j214Rn6B7qEbjyemidoz5ktE Rh99EoKkk7J7FoGc3uMXyDWywXKtLAj73kSRYNNN0tMTdn64SCTilZr9StrZ9hanrSWY +2nGsz+/wbjXNow75WeMWd5YnlwOWaiCxq4AyEAnKeAgvni3k2GRJ62iWovkWL9Y2mo1 xvkmGNY5bn+jjU3pZVoqQk/npXD09Vxy+aFR5ntDrq3gye3+dMVtv/heot/KSSYmjD9z zvAcQZ0wJUkphDMNfHGf8zsUDqs0jDp/fCMSn3kpn06fGqZk4J5k1eSky0/Trfyd8N+C t6iQ== X-Gm-Message-State: AOAM532fivpTjwy5zzUVDV47UiRzTXkTnbmySZADKQm8g78RrdB6brSd VLgNMrsJLt+ffCND14uQ/a1ItbQXc9LltgziYM4bEJZ5GFcX1X7c5GPhBBjsfvgPw8mVNgaxkql Pa2gyS7tQECyfj9Y= X-Received: by 2002:a5d:4245:: with SMTP id s5mr8916871wrr.6.1591352600292; Fri, 05 Jun 2020 03:23:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHl4l4ZA1cP1cNZ19vVlA/aHSUlfwTwzKv0NYQRaZ9rTd/r32G0Q6YN8HBj8LQEbgJuaMZ5g== X-Received: by 2002:a5d:4245:: with SMTP id s5mr8916856wrr.6.1591352600113; Fri, 05 Jun 2020 03:23:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 10/11] hw/sd/sdcard: Display offset in read/write_data() trace events Date: Fri, 5 Jun 2020 12:22:29 +0200 Message-Id: <20200605102230.21493-11-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:27:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Having 'base address' and 'relative offset' displayed separately is more helpful than the absolute address. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 8 ++++---- hw/sd/trace-events | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index fad34ab184..a1b25ed36f 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1824,8 +1824,8 @@ void sd_write_data(SDState *sd, uint8_t value) return; =20 trace_sdcard_write_data(sd->proto_name, - sd_current_cmd_name(sd), - sd->current_cmd, value); + sd_current_cmd_name(sd), sd->current_cmd, + sd->data_start, sd->data_offset, value); switch (sd->current_cmd) { case 24: /* CMD24: WRITE_SINGLE_BLOCK */ sd->data[sd->data_offset ++] =3D value; @@ -1978,8 +1978,8 @@ uint8_t sd_read_data(SDState *sd) io_len =3D (sd->ocr & (1 << 30)) ? 512 : sd->blk_len; =20 trace_sdcard_read_data(sd->proto_name, - sd_current_cmd_name(sd), - sd->current_cmd, io_len); + sd_current_cmd_name(sd), sd->current_cmd, + sd->data_start, sd->data_offset, io_len); switch (sd->current_cmd) { case 6: /* CMD6: SWITCH_FUNCTION */ ret =3D sd->data[sd->data_offset ++]; diff --git a/hw/sd/trace-events b/hw/sd/trace-events index f892c05867..1529ad4c6d 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -51,8 +51,8 @@ sdcard_lock(void) "" sdcard_unlock(void) "" sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x= %x" sdcard_write_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0= x%x" -sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, ui= nt8_t value) "%s %20s/ CMD%02d value 0x%02x" -sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, siz= e_t length) "%s %20s/ CMD%02d len %zu" +sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, ui= nt64_t address, uint32_t offset, uint8_t value) "%s %20s/ CMD%02d addr 0x%"= PRIx64 " ofs 0x%" PRIx32 " val 0x%02x" +sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, uin= t64_t address, uint32_t offset, size_t length) "%s %20s/ CMD%02d addr 0x%" = PRIx64 " ofs 0x%" PRIx32 " len %zu" sdcard_set_voltage(uint16_t millivolts) "%u mV" =20 # milkymist-memcard.c --=20 2.21.3 From nobody Sat May 18 15:08:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591352913; cv=none; d=zohomail.com; s=zohoarc; b=R7BewNUFxXUIBZqHDt3fi7wVHERhbAiIDEwSrsO1AmVEK0+N8jCUuQ53YvYYTqKeG28Hya8Iga/ZCKBMi27JeWDpGoke1cNpRtvZCZNXtTkRfY+AL2QlZkWC4VYMZkXXc5co+SUCSsRLB/gSXxJYR6IuB4uy03W8gh6aaIxGcpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591352913; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/743Z1QyCRowFD2sBc8yC4KQi0Lmbj/XYRlJsfWAxhE=; b=il4tg25DBczfFHxlosZOZgSNMA1cy8nR+y3fAjR8IxrS2u/VDcJ/26IktWOV6/KJQwbuhL4qzpkTkfqfLq4DMQZuDhf4xLKrFveUCUUwYuEtKf2I0i9XsaggSaUV6uulPpeB12+H4dJK2T8QFtbZLR5/sbxphIYA17uZWLErdic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591352913856400.73494848461496; Fri, 5 Jun 2020 03:28:33 -0700 (PDT) Received: from localhost ([::1]:51010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh9aS-0005De-LZ for importer@patchew.org; Fri, 05 Jun 2020 06:28:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh9WX-0007HX-BI for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:24:29 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:37680 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jh9WW-0006ia-K2 for qemu-devel@nongnu.org; Fri, 05 Jun 2020 06:24:28 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-3gbEtARkP0-fNPjxZYTYdA-1; Fri, 05 Jun 2020 06:24:26 -0400 Received: by mail-wm1-f70.google.com with SMTP id u11so2843583wmc.7 for ; Fri, 05 Jun 2020 03:24:26 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id y17sm11833422wrn.12.2020.06.05.03.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 03:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591352667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/743Z1QyCRowFD2sBc8yC4KQi0Lmbj/XYRlJsfWAxhE=; b=IayJJ0n/luS5Sq2w1vWMSBHF9FI3IeunXnyRkCWbZIcQXWDdgWTy8cwokhrwG4a8bsFhqy zv/nB+XlgAItPLolyDxfolNYbGcAtZyKpfLfdtNQRD0+d7jFgDdNGpCcgDM78a5fHm72eb H/ovLTsYtGlnHQbfpbPie2EVToqGQOE= X-MC-Unique: 3gbEtARkP0-fNPjxZYTYdA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/743Z1QyCRowFD2sBc8yC4KQi0Lmbj/XYRlJsfWAxhE=; b=tYokkK6ZF8OinUdpN062vJi3Gi2LIU9o6YMJzbXwEe3f/XaLMYtHHGiQnfCdDF9nJ0 EvSeVH2/LBKbN8S/dCOF+oEjY7iCMXfnBwCTna+FjqMyNYDf/Scs6vLa67q13QkNtV+x Vs+nF4+iXb0JE/WMxmGL6tmSuG1IrL0zEKYMKzXuUoh+gU8aL01N2HPW8e5JjLLvIfSY WXuefyRqX6P8PUy/8846VHCRfpn6Ug8B3i8A58Kwv1BqS93cRo62Gusumo42EonhRbmX i2MCQtu6VCm9Pea8/ozKH8qpSrU+doWxeOiGvoPJN2eJ1QmL8XOn6Zy1+71TORjPerxR 1cng== X-Gm-Message-State: AOAM530TXt9z73AYoY/eg4VI5ulaIvEx1B1e9jUHKPQP2LBMkVRjwafu eQeE5m9Nz8Lz7IUEmpDQuYS1h+B64a2CNC1yM8gvVgK4RvQFYlyN1nX1cNEXMZmoLXza8QahK9z MtCbQVrC9E1VdpeI= X-Received: by 2002:a7b:c1ce:: with SMTP id a14mr372867wmj.144.1591352605071; Fri, 05 Jun 2020 03:23:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAovcUB3nYBZFOQy3cP29FUa8Tar7jITLsTOdjGHAtir/ecZFqj56zF0bezkJyYqEZGsQ0GQ== X-Received: by 2002:a7b:c1ce:: with SMTP id a14mr372848wmj.144.1591352604869; Fri, 05 Jun 2020 03:23:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 11/11] hw/sd/sdcard: Simplify realize() a bit Date: Fri, 5 Jun 2020 12:22:30 +0200 Message-Id: <20200605102230.21493-12-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200605102230.21493-1-philmd@redhat.com> References: <20200605102230.21493-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/05 03:35:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 We don't need to check if sd->blk is set twice. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a1b25ed36f..060ca9d993 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2123,12 +2123,12 @@ static void sd_realize(DeviceState *dev, Error **er= rp) return; } =20 - if (sd->blk && blk_is_read_only(sd->blk)) { - error_setg(errp, "Cannot use read-only drive as SD card"); - return; - } - if (sd->blk) { + if (blk_is_read_only(sd->blk)) { + error_setg(errp, "Cannot use read-only drive as SD card"); + return; + } + ret =3D blk_set_perm(sd->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_= WRITE, BLK_PERM_ALL, errp); if (ret < 0) { --=20 2.21.3