From nobody Thu Nov 13 21:51:50 2025 Delivered-To: importer@patchew.org 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; 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=1583397192; cv=none; d=zohomail.com; s=zohoarc; b=BieHhblxXHwVYDwAXGRT8Iz3Oq2L/FzM/XCqKbxj7h7YRDyBBEthlVAK07H1PVPga9mHo+8zeUd2YDG+/r5gKEL5YmooPttZj0sj4oIeCNa3ZTWQVLMM0Umet60oCG8l03nbFc2a0PyyXSj37xl+IPxG5zTGTO75Z8d5PcTdabo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583397192; 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=/CqOKh2nsu51+3jeV93r1IoLT3LJ49Li6Fmw2d1sglg=; b=Uuqct9R+3qtUqsJ15SuJw/zAj5fECTY2ycvvsD0vFU1IaqR3Fa0oRSWXa6u/vbd/FbfRcnr+/NE2KWIok4ySZ9Gn9taZL2vYtpW2ZbgEd4m/HXfMonEOep7Zkm80dOvCSafbx8r/7dOnbo6kLthApPpPibV0Y74rUOHeWVafnPw= 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 1583397192466226.64216988138799; Thu, 5 Mar 2020 00:33:12 -0800 (PST) Received: from localhost ([::1]:44944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lwM-00016B-UF for importer@patchew.org; Thu, 05 Mar 2020 03:33:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46853) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lv1-0007qr-Mj for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9lv0-0007mk-Ql for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49469 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9lv0-0007mT-No for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:46 -0500 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-284-D-hsxyMLNSOTSAapx0WFGQ-1; Thu, 05 Mar 2020 03:31:44 -0500 Received: by mail-wm1-f69.google.com with SMTP id e26so277531wmk.8 for ; Thu, 05 Mar 2020 00:31:44 -0800 (PST) Received: from localhost.localdomain (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id n11sm10014317wrw.11.2020.03.05.00.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397106; 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=/CqOKh2nsu51+3jeV93r1IoLT3LJ49Li6Fmw2d1sglg=; b=HD5qqFi/kWQzFk/VyLx/sHEp8HF00xnkGf9m4k4J/P7dNqIizJ58YkPeKNhIiQeNFdz4PC FJTJImE588fzbgUfJqaiLwQ1Yfnl6xuNEaOGklp7N7vEBhzEvsZDoAHpeS5bnWWE6H9V9n tMHpmAUNHOf+u/IixdL96V0JOFH1+jE= X-MC-Unique: D-hsxyMLNSOTSAapx0WFGQ-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=rYWPPUhlgOAaxjmcsT5crz3KE7S90eMUEZWRQyjBPTY=; b=t+fzunAV5OuzRe1xG7mx37DYiFbqhFL3cbRg49G0loNxznxELpZypYpdHQ8xjoXBla jxd+011tdFr7WNtIPY+B0v8qEDEJysJtXRZmSAXJTW6yDML3uBql0MhOovLufdHjwirw pAYiI9O4zAT1UCwMsvoqUFI8TnlMUnEZr/sfgaxkH1wXV5BlTyvnB1aUObgNGofspOd7 yDcpNuxArzEyakh2WIYfn9ETuSpsuGGpxjnwZqYVsIJWSLHRl3GHyn6JFBTSZy6KCsPd 1s2RYaPKLWK7uMzbxH+MOneFI5+UtNQoMRfsYIGSicMt8NFc4lPomchU0PmW1OxqeoR6 P0Cg== X-Gm-Message-State: ANhLgQ2jN1IwftHUlwvRF02JVvoom/ZuLVDrcIgxSA516RdeOEsHxs5H TXY60bLo/NsaB//d6zzVJrFuIXQOSNA+aHNy2DRi0cOe5R8W4oZnS+WOjmCAXOLelG+SEz3lTkl mdlu6gxbPMlro/vo= X-Received: by 2002:adf:a355:: with SMTP id d21mr3896827wrb.233.1583397103462; Thu, 05 Mar 2020 00:31:43 -0800 (PST) X-Google-Smtp-Source: ADFU+vvQFpXbzxh30cSfnGYrTEt/OrYpoBYN35i2prm384PAXn5DY5zjR3N6gkbldHvjYA1U1bg2Mg== X-Received: by 2002:adf:a355:: with SMTP id d21mr3896811wrb.233.1583397103231; Thu, 05 Mar 2020 00:31:43 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [MERGED PATCH v2 1/5] hw/scsi/viosrp: Add missing 'hw/scsi/srp.h' include Date: Thu, 5 Mar 2020 09:31:31 +0100 Message-Id: <20200305083135.8270-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305083135.8270-1-philmd@redhat.com> References: <20200305083135.8270-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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: Fam Zheng , qemu-ppc@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" This header use the srp_* structures declared in "hw/scsi/srp.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Patch already applied to ppc-for-5.0. hw/scsi/viosrp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/scsi/viosrp.h b/hw/scsi/viosrp.h index d8e365db1e..25676c2383 100644 --- a/hw/scsi/viosrp.h +++ b/hw/scsi/viosrp.h @@ -34,6 +34,8 @@ #ifndef PPC_VIOSRP_H #define PPC_VIOSRP_H =20 +#include "hw/scsi/srp.h" + #define SRP_VERSION "16.a" #define SRP_MAX_IU_LEN 256 #define SRP_MAX_LOC_LEN 32 --=20 2.21.1 From nobody Thu Nov 13 21:51:50 2025 Delivered-To: importer@patchew.org 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; 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=1583397208; cv=none; d=zohomail.com; s=zohoarc; b=cySgxq8AQSWBnxvxvsvJHfEej3GoO4CXMA7hzdAmq08ky2NXqVGs+CkVcwo84QDcMbhCHFKuIHXhtDDEQHKaKIhsSx9/qWrg1H4lBuB5QfCNhqH/ZcME4eFarD1c/o+MPycZGO7SfynJAmYTiO8eEXT8DAaEvJhyd7vdxTQApCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583397208; 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=yA3uLqLrMH4DadSPYrDFTonaKu32GW1DkxhKKfxoUes=; b=f95STu/4EF+Qt/mkhJttcrwu2Gq3vLdUarctPstZVwD3RbjhOer3zuqy7fXrXNkx8kmuGXHSfZ3smnCp6qQvF2U1qVdF5R1wlPeMcEkJ+7lsMuwyyEFjjCmZ9MitbOdTGQcJ8ybfLiTpAgmx4ruPifZ9kzWyz9WvmLsCuG+8RaI= 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 1583397208556485.0601640558357; Thu, 5 Mar 2020 00:33:28 -0800 (PST) Received: from localhost ([::1]:44946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lwc-0001QC-Gz for importer@patchew.org; Thu, 05 Mar 2020 03:33:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lv7-0007yQ-D4 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9lv6-0007q1-BQ for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38589 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9lv6-0007pl-8L for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:52 -0500 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-304-tZR1ehWUMb-1QCPgkLo5ng-1; Thu, 05 Mar 2020 03:31:50 -0500 Received: by mail-wm1-f71.google.com with SMTP id y18so2604297wmi.1 for ; Thu, 05 Mar 2020 00:31:50 -0800 (PST) Received: from localhost.localdomain (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id f15sm26583920wru.83.2020.03.05.00.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397111; 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=yA3uLqLrMH4DadSPYrDFTonaKu32GW1DkxhKKfxoUes=; b=T+tDiZn4dn/Kr2VcWnOV53WFf8pVOxDc/8vyQHUcVyOZoHAMK+JWAdN/1Bc4onwhHNuS7k TtJKer0gZ4HBshcI4zffUzNmGfpgHns3jGBSnw8/WPogkwVr/7YgyhkL5av4n2XP8oHWZI 5nAWfTRVI4Yq2qXhBoAK7H8ZEbYEZYI= X-MC-Unique: tZR1ehWUMb-1QCPgkLo5ng-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=VKQxZm6oD2b2bzfClTv2OE2sVH6+fKk9xz2Zrpce/2w=; b=BUHNMaDDEmvEubH28IHVxVrnU2/gZpzpEsVXxpZkwe6NadpgN/H2hd0EfbNnz04VLL JuxcPeHz8AUqH1K4Rwkg1PGFkfM8N2sDbhnxMdxp0pT0lWd1rzPRBD7J8X6Mj0rO1oCU hS5s1zh3h1B0MHZcDuQlJT2UhXVR/Ft4JsnBg0fxeFZMr4e2mfilO6Q4SlohLb2d5ytW uOmToP+C8nzrFMHQNC7mxBDpS3F6nq0VVHIrhlCIfDxxRWQt+sQTX1Vv+5Mfs6kv/JDC Ne1XmQllm7etTaLDqAcVELHBFxibi/ElGN2jnmR3Be64As3Mr/+XpfbsyB9iY1tRQMWN 57MA== X-Gm-Message-State: ANhLgQ0ORBJQlT5vc64sWfGX8A6QgySwFqnssh03rwVpgCKsxAAuz/3w AOedMpz3iYQZu1e2FBbz4NnV3XO0mtMQcXpMSuSTN1BQUglrYU7xLnmrwVDUu1hYeiuHtX0bX9G ufDKnZ7n/06lN6ic= X-Received: by 2002:adf:e9c9:: with SMTP id l9mr8947638wrn.356.1583397108646; Thu, 05 Mar 2020 00:31:48 -0800 (PST) X-Google-Smtp-Source: ADFU+vsUsw5R1leZm5aRmP0ydzwOEndB9/plL1G0/5f4GqJJXebWrX+QpOUC63nFFMSf57K1JhLMgw== X-Received: by 2002:adf:e9c9:: with SMTP id l9mr8947623wrn.356.1583397108475; Thu, 05 Mar 2020 00:31:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [MERGED PATCH v2 2/5] hw/scsi/spapr_vscsi: Use SRP_MAX_IU_LEN instead of sizeof flexible array Date: Thu, 5 Mar 2020 09:31:32 +0100 Message-Id: <20200305083135.8270-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305083135.8270-1-philmd@redhat.com> References: <20200305083135.8270-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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: Fam Zheng , qemu-ppc@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Replace sizeof() flexible arrays union srp_iu/viosrp_iu by the SRP_MAX_IU_LEN definition, which is what this code actually meant to use. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Patch already applied to ppc-for-5.0. hw/scsi/spapr_vscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 7d584e7732..7e397ed797 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -671,8 +671,8 @@ static void vscsi_process_login(VSCSIState *s, vscsi_re= q *req) */ rsp->req_lim_delta =3D cpu_to_be32(VSCSI_REQ_LIMIT-2); rsp->tag =3D tag; - rsp->max_it_iu_len =3D cpu_to_be32(sizeof(union srp_iu)); - rsp->max_ti_iu_len =3D cpu_to_be32(sizeof(union srp_iu)); + rsp->max_it_iu_len =3D cpu_to_be32(SRP_MAX_IU_LEN); + rsp->max_ti_iu_len =3D cpu_to_be32(SRP_MAX_IU_LEN); /* direct and indirect */ rsp->buf_fmt =3D cpu_to_be16(SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_IN= DIRECT); =20 @@ -1088,7 +1088,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_cr= q *crq) * in our 256 bytes IUs. If not we'll have to increase the size * of the structure. */ - if (crq->s.IU_length > sizeof(union viosrp_iu)) { + if (crq->s.IU_length > SRP_MAX_IU_LEN) { fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n", crq->s.IU_length); vscsi_put_req(req); --=20 2.21.1 From nobody Thu Nov 13 21:51:50 2025 Delivered-To: importer@patchew.org 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; 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=1583397273; cv=none; d=zohomail.com; s=zohoarc; b=QtV359Sryrow2gVNXeZIjyRbhKs//RTo/7bpc+vU1CnZwwJ0+P3BXb2vZXSi7KeghHk7lTrdHvn/lzQiCppYrz6qE6D+2sKfkQ4mm5FIzNgLNu11rjSznuoDIlFvohIfKq1t3qRk1LHH6dZeHRAV78vb3aYti/lvLW0BE0yB8CA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583397273; 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=im9FKb6/7VxBNBG6RzscUZZ3f5mRdei8ZDLvabjVaI0=; b=AvhwWRv+bv2Xnh0YVLs75eeruh/c+keMuMhQ1G3ejafPMKFaJIhwe3T8SKckggVP4D4B6F2LPt3sqX3Wup9CDAIGKqFLSEj76pyhEbBkHOke7qIjs3DhpZq3Wu6VT2rTBozHgjlVsiFTtH6GkawCMNTRCH4XAtG3XNiNfTXSPso= 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 1583397273060551.8517982414221; Thu, 5 Mar 2020 00:34:33 -0800 (PST) Received: from localhost ([::1]:44968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lxf-00049e-97 for importer@patchew.org; Thu, 05 Mar 2020 03:34:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46919) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lvE-00088V-Ar for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9lvD-0007tS-7L for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39187 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9lvD-0007t7-3B for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:59 -0500 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-446-yVP4-0rWOrycuNqlYJ_c6g-1; Thu, 05 Mar 2020 03:31:55 -0500 Received: by mail-wm1-f71.google.com with SMTP id t2so1289234wmj.2 for ; Thu, 05 Mar 2020 00:31:55 -0800 (PST) Received: from localhost.localdomain (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id p17sm40713617wre.89.2020.03.05.00.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:31:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397118; 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=im9FKb6/7VxBNBG6RzscUZZ3f5mRdei8ZDLvabjVaI0=; b=IKFPYTTIzYYkgDTiQ3lJpOalgFV0qz7OwjxiToZm1Fx/y8K2Xz31hqFRuRXJISUKdApkrx Sj5EWFAurbH/cl8r4chToDx2a8ip0i1O/xFWj9z0ZWR2cME1AazUbiB3znlAO0oCzi52zC 5K469pSMbcnvOUeQCO6JfBsO9GuI5lQ= X-MC-Unique: yVP4-0rWOrycuNqlYJ_c6g-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=0iGeS84THZ+OQAErS0AboPyoiOZizq7Y6Bk3c2GM1TU=; b=d07tIo5yOFU+IeCDLzQGjBQCHxercrKvApYZM/tZ9rcM4DaMNL9aJBXSB6fPiRmspx yEdUOy+ueWBb4GWmf5GfgoChP+UYRdkTqZxZHPU5XH21ugB6lJ1J/esYeTCVlr6D6kn9 ZoUxWHWCKW5tZESuUDzvD6RbE0QhQ6lP6phKjCeYTZx+JOIgg3PMN6VZSaiHRtJm7BB3 XkKU+69p/waZKKQASZNNkPxM6HnqSuewASmXQqpWgRbrXZ9Fm9kefRX0LePLxFUaozK/ 5KbQVBi7A67JbeNj8lHGVg5W8/SoRX/sS622KKaq8wX44cvETlS7Jhch80OtFmwS9FtC +VjQ== X-Gm-Message-State: ANhLgQ0DqZEJADnnpAxW8qJZTkFaMca3wYmvmgl26LdpsZQss88VWQ4W XDbfxM5+gxoR2YyjmbdfnkL4d6cFhRMw5csUoTQRn/DABAhkRNgXE6omQE+W6rGUDHyEEM7UeN8 QBp5WEdVCEh3clEE= X-Received: by 2002:a7b:c1cf:: with SMTP id a15mr8241201wmj.85.1583397113942; Thu, 05 Mar 2020 00:31:53 -0800 (PST) X-Google-Smtp-Source: ADFU+vun5m0hDfIXFfVLUDRM42t0j64w0gvvlHRv+PiRoPIxglId8JyyXbHh1UPf5JXu8d7n2dRH2Q== X-Received: by 2002:a7b:c1cf:: with SMTP id a15mr8241182wmj.85.1583397113767; Thu, 05 Mar 2020 00:31:53 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [MERGED PATCH v2 3/5] hw/scsi/spapr_vscsi: Simplify a bit Date: Thu, 5 Mar 2020 09:31:33 +0100 Message-Id: <20200305083135.8270-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305083135.8270-1-philmd@redhat.com> References: <20200305083135.8270-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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: Fam Zheng , qemu-ppc@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" We already have a ui pointer, use it (to simplify the next commit). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Patch already applied to ppc-for-5.0. hw/scsi/spapr_vscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 7e397ed797..3cb5a38181 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -261,9 +261,9 @@ static int vscsi_send_rsp(VSCSIState *s, vscsi_req *req, if (status) { iu->srp.rsp.sol_not =3D (sol_not & 0x04) >> 2; if (req->senselen) { - req->iu.srp.rsp.flags |=3D SRP_RSP_FLAG_SNSVALID; - req->iu.srp.rsp.sense_data_len =3D cpu_to_be32(req->senselen); - memcpy(req->iu.srp.rsp.data, req->sense, req->senselen); + iu->srp.rsp.flags |=3D SRP_RSP_FLAG_SNSVALID; + iu->srp.rsp.sense_data_len =3D cpu_to_be32(req->senselen); + memcpy(iu->srp.rsp.data, req->sense, req->senselen); total_len +=3D req->senselen; } } else { --=20 2.21.1 From nobody Thu Nov 13 21:51:50 2025 Delivered-To: importer@patchew.org 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; 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=1583397244; cv=none; d=zohomail.com; s=zohoarc; b=bx+1nP7IsV851I1uOln6ucaZkJyTlN2h1wpQXc93iL3ru8c31FVJJzvknwGo91rt1hnQwyNOhorv5cJLEUNtcH7JaHsfPpjyos3e05N2nFYO0iEwzLU/ck7Q4iJrt4RNE1Ri97IrZ8fDD0N9/PuInzPL4i+N7hEmAwVr+fdZFls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583397244; 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=qmYl/AQK2JY3bpXha9+hiwogRCKB+fBOIoJpW+iscUQ=; b=KgCk4aZ2OyP6KGljLwsBnrLC93HVTCq3vkeZhRGgXAyOnLZIAdd8TKdCXYVJ8G9BFrKXuwJ0Plz1glrkz6NSkwanqUBZ/Gy3KbnSAW4PsvAcxqEitQeRMDgmGP7+1ODRF6+MvZI0KtQ4dmT+HRDuk+AzEkae/RxJ9g7wIci//7c= 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 1583397244647938.4573689811568; Thu, 5 Mar 2020 00:34:04 -0800 (PST) Received: from localhost ([::1]:44948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lwl-0001s5-3I for importer@patchew.org; Thu, 05 Mar 2020 03:33:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46943) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lvI-0008ED-Ab for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9lvG-0007uo-Oh for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:04 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48355 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9lvG-0007uh-Kn for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:02 -0500 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-206-eVlsilMjO3qoVn4z7MUpzQ-1; Thu, 05 Mar 2020 03:32:00 -0500 Received: by mail-wm1-f71.google.com with SMTP id c5so1790336wmd.8 for ; Thu, 05 Mar 2020 00:32:00 -0800 (PST) Received: from localhost.localdomain (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id s15sm18868827wrr.45.2020.03.05.00.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:31:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397122; 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=qmYl/AQK2JY3bpXha9+hiwogRCKB+fBOIoJpW+iscUQ=; b=Fm00lx81Fab8uuMrbi5T2N9NNRdWPpJrjuQ1+3FrUG+GV1GRPQksU/Wqe8sjv0dgciqwrF gwxyI5um6zC4I+W3Dgb7x8gPPmnqSivh/2Jfzr2sy/+g4NYhuIJDT7EJQ7Tm1AqUrS5gLW 0mIN8GwGBBHBK3aXG8xrgLRkG9RqDZM= X-MC-Unique: eVlsilMjO3qoVn4z7MUpzQ-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=RFIOMEb8wQyUpCH5c4Kh/BXqGMza1oWS+WdSlgnyzm0=; b=Q7fh2ngaAbGmWx5eFoqxFX7SabMxnKJ/FTVdkRdVdIncfDLyZkCPxgMpdFcQwrz1c1 AyoKYmaBjacXVsP7ZSuhB7T6ZR8LYRd3yEKpVHt3j0M6qsHiCPH6cPJHU9dVA18qxBva W/IOBn+duEoJkE18Jl85USdlKvQUmtoyjUUwgMlRksQnyT1D9dYNE+6cSWReROhSEUVr bmC7+WTilzjLpEuAi+C+7VdJfxReJMeumlyoRH6OIoXIAKqQeDI370jLPSKK4jj/kIl0 eR43t1JN3jcj96Av+u/LKLHyOlDHAir8+GGgFES9Y5k8H8A2tcNPwba189VHMgK6EbxE hOSQ== X-Gm-Message-State: ANhLgQ1sVUmzKaC4sY5vgcHTX87H3SzVehvH0fIWYvsemz/ndFdtPSg9 cX5mt3xZjRcHE/pnD5Dc1Ui+sobPirsrrKNo7i73CzepGw8DKJWcAbEEE3XKph9bjNqV0iD1LWE JW5B5MDXF8cFHWig= X-Received: by 2002:a1c:25c5:: with SMTP id l188mr8634807wml.105.1583397119264; Thu, 05 Mar 2020 00:31:59 -0800 (PST) X-Google-Smtp-Source: ADFU+vtrlEyi32hLhcUOXo8Gw0nEREUDn24KKnEV+Lw1Yy0i78DMK1Gx76LnQhMGWRRGhGOqzEKDNA== X-Received: by 2002:a1c:25c5:: with SMTP id l188mr8634773wml.105.1583397118954; Thu, 05 Mar 2020 00:31:58 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/5] hw/scsi/spapr_vscsi: Introduce req_iu() helper Date: Thu, 5 Mar 2020 09:31:34 +0100 Message-Id: <20200305083135.8270-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305083135.8270-1-philmd@redhat.com> References: <20200305083135.8270-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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: Fam Zheng , qemu-ppc@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Introduce the req_iu() helper which returns a pointer to the viosrp_iu union held in the vscsi_req structure. This simplifies the next patch. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Simplify req_iu, rename 'ui -> iu' in commit description (dgibson) hw/scsi/spapr_vscsi.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 3cb5a38181..70547f98ac 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -97,6 +97,11 @@ typedef struct { vscsi_req reqs[VSCSI_REQ_LIMIT]; } VSCSIState; =20 +static union viosrp_iu *req_iu(vscsi_req *req) +{ + return &req->iu; +} + static struct vscsi_req *vscsi_get_req(VSCSIState *s) { vscsi_req *req; @@ -121,7 +126,7 @@ static struct vscsi_req *vscsi_find_req(VSCSIState *s, = uint64_t srp_tag) =20 for (i =3D 0; i < VSCSI_REQ_LIMIT; i++) { req =3D &s->reqs[i]; - if (req->iu.srp.cmd.tag =3D=3D srp_tag) { + if (req_iu(req)->srp.cmd.tag =3D=3D srp_tag) { return req; } } @@ -188,7 +193,7 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req, req->crq.s.reserved =3D 0x00; req->crq.s.timeout =3D cpu_to_be16(0x0000); req->crq.s.IU_length =3D cpu_to_be16(length); - req->crq.s.IU_data_ptr =3D req->iu.srp.rsp.tag; /* right byte order */ + req->crq.s.IU_data_ptr =3D req_iu(req)->srp.rsp.tag; /* right byte ord= er */ =20 if (rc =3D=3D 0) { req->crq.s.status =3D VIOSRP_OK; @@ -224,7 +229,7 @@ static void vscsi_makeup_sense(VSCSIState *s, vscsi_req= *req, static int vscsi_send_rsp(VSCSIState *s, vscsi_req *req, uint8_t status, int32_t res_in, int32_t res_out) { - union viosrp_iu *iu =3D &req->iu; + union viosrp_iu *iu =3D req_iu(req); uint64_t tag =3D iu->srp.rsp.tag; int total_len =3D sizeof(iu->srp.rsp); uint8_t sol_not =3D iu->srp.cmd.sol_not; @@ -285,7 +290,7 @@ static int vscsi_fetch_desc(VSCSIState *s, struct vscsi= _req *req, unsigned n, unsigned buf_offset, struct srp_direct_buf *ret) { - struct srp_cmd *cmd =3D &req->iu.srp.cmd; + struct srp_cmd *cmd =3D &req_iu(req)->srp.cmd; =20 switch (req->dma_fmt) { case SRP_NO_DATA_DESC: { @@ -473,7 +478,7 @@ static int data_out_desc_size(struct srp_cmd *cmd) =20 static int vscsi_preprocess_desc(vscsi_req *req) { - struct srp_cmd *cmd =3D &req->iu.srp.cmd; + struct srp_cmd *cmd =3D &req_iu(req)->srp.cmd; =20 req->cdb_offset =3D cmd->add_cdb_len & ~3; =20 @@ -655,7 +660,7 @@ static void *vscsi_load_request(QEMUFile *f, SCSIReques= t *sreq) =20 static void vscsi_process_login(VSCSIState *s, vscsi_req *req) { - union viosrp_iu *iu =3D &req->iu; + union viosrp_iu *iu =3D req_iu(req); struct srp_login_rsp *rsp =3D &iu->srp.login_rsp; uint64_t tag =3D iu->srp.rsp.tag; =20 @@ -681,7 +686,7 @@ static void vscsi_process_login(VSCSIState *s, vscsi_re= q *req) =20 static void vscsi_inquiry_no_target(VSCSIState *s, vscsi_req *req) { - uint8_t *cdb =3D req->iu.srp.cmd.cdb; + uint8_t *cdb =3D req_iu(req)->srp.cmd.cdb; uint8_t resp_data[36]; int rc, len, alen; =20 @@ -770,7 +775,7 @@ static void vscsi_report_luns(VSCSIState *s, vscsi_req = *req) =20 static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req) { - union srp_iu *srp =3D &req->iu.srp; + union srp_iu *srp =3D &req_iu(req)->srp; SCSIDevice *sdev; int n, lun; =20 @@ -821,7 +826,7 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *re= q) =20 static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_req *req) { - union viosrp_iu *iu =3D &req->iu; + union viosrp_iu *iu =3D req_iu(req); vscsi_req *tmpreq; int i, lun =3D 0, resp =3D SRP_TSK_MGMT_COMPLETE; SCSIDevice *d; @@ -831,7 +836,8 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_= req *req) fprintf(stderr, "vscsi_process_tsk_mgmt %02x\n", iu->srp.tsk_mgmt.tsk_mgmt_func); =20 - d =3D vscsi_device_find(&s->bus, be64_to_cpu(req->iu.srp.tsk_mgmt.lun)= , &lun); + d =3D vscsi_device_find(&s->bus, + be64_to_cpu(req_iu(req)->srp.tsk_mgmt.lun), &lun= ); if (!d) { resp =3D SRP_TSK_MGMT_FIELDS_INVALID; } else { @@ -842,7 +848,7 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_= req *req) break; } =20 - tmpreq =3D vscsi_find_req(s, req->iu.srp.tsk_mgmt.task_tag); + tmpreq =3D vscsi_find_req(s, req_iu(req)->srp.tsk_mgmt.task_ta= g); if (tmpreq && tmpreq->sreq) { assert(tmpreq->sreq->hba_private); scsi_req_cancel(tmpreq->sreq); @@ -867,7 +873,8 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_= req *req) =20 for (i =3D 0; i < VSCSI_REQ_LIMIT; i++) { tmpreq =3D &s->reqs[i]; - if (tmpreq->iu.srp.cmd.lun !=3D req->iu.srp.tsk_mgmt.lun) { + if (req_iu(tmpreq)->srp.cmd.lun + !=3D req_iu(req)->srp.tsk_mgmt.lun) { continue; } if (!tmpreq->active || !tmpreq->sreq) { @@ -911,7 +918,7 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_= req *req) =20 static int vscsi_handle_srp_req(VSCSIState *s, vscsi_req *req) { - union srp_iu *srp =3D &req->iu.srp; + union srp_iu *srp =3D &req_iu(req)->srp; int done =3D 1; uint8_t opcode =3D srp->rsp.opcode; =20 @@ -948,7 +955,7 @@ static int vscsi_send_adapter_info(VSCSIState *s, vscsi= _req *req) struct mad_adapter_info_data info; int rc; =20 - sinfo =3D &req->iu.mad.adapter_info; + sinfo =3D &req_iu(req)->mad.adapter_info; =20 #if 0 /* What for ? */ rc =3D spapr_vio_dma_read(&s->vdev, be64_to_cpu(sinfo->buffer), @@ -984,7 +991,7 @@ static int vscsi_send_capabilities(VSCSIState *s, vscsi= _req *req) uint64_t buffer; int rc; =20 - vcap =3D &req->iu.mad.capabilities; + vcap =3D &req_iu(req)->mad.capabilities; req_len =3D len =3D be16_to_cpu(vcap->common.length); buffer =3D be64_to_cpu(vcap->buffer); if (len > sizeof(cap)) { @@ -1029,7 +1036,7 @@ static int vscsi_send_capabilities(VSCSIState *s, vsc= si_req *req) =20 static int vscsi_handle_mad_req(VSCSIState *s, vscsi_req *req) { - union mad_iu *mad =3D &req->iu.mad; + union mad_iu *mad =3D &req_iu(req)->mad; bool request_handled =3D false; uint64_t retlen =3D 0; =20 --=20 2.21.1 From nobody Thu Nov 13 21:51:50 2025 Delivered-To: importer@patchew.org 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; 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=1583397291; cv=none; d=zohomail.com; s=zohoarc; b=Q/d2qzWkwSv+T5qjbxStvFYpDW/ag5bSlO2w13vh5FcUYQWDWoswO8IuCzzcEYesdziMZn2XXgFPDHlrw7kUslA0AHJj9x7tGekolhRF7JyhvisWUVdkMICSvw7b9G4vleOPW4twlNcUxXXJ3jVRPgS3TjUqdSetn9Z1K7KtQRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583397291; 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=r0bmDBDPFoTvSkhNSJzybouAoWVHY8olJiJkirrUp6g=; b=h337lq5jAIwM9TD2UV9tYrTxYf0637GGR1uuj7qG7wcOLuR5LB/QrlaIn6wdA2UvT33Wqoi0eZWodBncuLbvJS5V/zNArtgbNyEJew9MIm2yqoihPPgiyKW/ZGPzM3ZkCw/nRMBDJVWR8cR8DGQVIONG3CGuiq4+4WRpKZ6v1RQ= 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 158339729179484.25115193439296; Thu, 5 Mar 2020 00:34:51 -0800 (PST) Received: from localhost ([::1]:44970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lxx-0004bu-RU for importer@patchew.org; Thu, 05 Mar 2020 03:34:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46978) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lvN-0008PP-4g for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9lvL-0007ya-Tr for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:09 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:32409 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9lvL-0007yC-Q2 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:32:07 -0500 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-27-rRB7jTMoMU-XkEvhcIQBpg-1; Thu, 05 Mar 2020 03:32:05 -0500 Received: by mail-wr1-f70.google.com with SMTP id b12so2031983wro.4 for ; Thu, 05 Mar 2020 00:32:05 -0800 (PST) Received: from localhost.localdomain (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id u20sm7698158wmj.14.2020.03.05.00.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397127; 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=r0bmDBDPFoTvSkhNSJzybouAoWVHY8olJiJkirrUp6g=; b=JFk1jNaExbzYLqCGYczYxIZkFF8eEPaZ+IPGnT/kV6sHYtU/ewKpd/BQ+Xu2egV6+B5xZi sT9dKUiQNxWN2PGSvETwn5BH29drjvVEPI3+z9wFTIzpba39WlRMqGb3v7ayGJ5rHWs1LK hzTkjVDztEe8takCHsSaDubryo/hvVM= X-MC-Unique: rRB7jTMoMU-XkEvhcIQBpg-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=CeCFgKi/6lzEJDfMDMZ1O5Vx3FuqOcjKrlxywn/DvYg=; b=XN3Ax7362+aME33Zm7vJBI+zkdoY5XNngTvOV6RHjQXFeKuUUiM+pKfafzcCyF8/gk IqO19HDJppDa7x/bAY5TcocxsZfEcTjjqiEzKhe2VMRJAZ8s/I111af4DTwHr4zu6zV9 XzqEv4NYdFAL853tS6lqwjhFrXmtPzsitYf1EGdQFDw8XGCGHOhBcR5edtqsKprAkfUf 4u3wgzXaWTn5tWzPoFCny69IRfYKeOjkx0/WdCO64i3N/kYrjE+ZyuXUOXDegBcIo2Mi Zy1G1IIFf1ahRcA6s/BvNhWOKchY/iWvRZ7zINSsaoFrYi3uZiSju6VdoBd/Vt27wsYk x6cw== X-Gm-Message-State: ANhLgQ2YRmGbjaWi92pGcbN7Obyl4gkDTIUb9/lksE78ijTKgb+KO1g6 4Dl6V+A1MmuWcYZUuece3FdA3GDJOGWX7W2rXSYiBUf6xYHpMxbjjyjql8KrGneTfSZcXEWrQB4 bUV7OjcAMeeSU+pE= X-Received: by 2002:a1c:5684:: with SMTP id k126mr8342207wmb.181.1583397124304; Thu, 05 Mar 2020 00:32:04 -0800 (PST) X-Google-Smtp-Source: ADFU+vtqggX8IZnDOMAeOqTsguTuAZMrz8Ixt7FkA14MByYOLu1ECW7sT6wddjSyoH2+RWnMJ/VM9w== X-Received: by 2002:a1c:5684:: with SMTP id k126mr8342186wmb.181.1583397124107; Thu, 05 Mar 2020 00:32:04 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 5/5] hw/scsi/spapr_vscsi: Do not mix SRP IU size with DMA buffer size Date: Thu, 5 Mar 2020 09:31:35 +0100 Message-Id: <20200305083135.8270-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305083135.8270-1-philmd@redhat.com> References: <20200305083135.8270-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Fam Zheng , qemu-ppc@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The 'union srp_iu' is meant as a pointer to any SRP Information Unit type, it is not related to the size of a VIO DMA buffer. Use a plain buffer for the VIO DMA read/write calls. We can remove the reserved buffer from the 'union srp_iu'. This issue was noticed when replacing the zero-length arrays from hw/scsi/srp.h with flexible array member, 'clang -fsanitize=3Dundefined' reported: hw/scsi/spapr_vscsi.c:69:29: error: field 'iu' with variable sized type '= union viosrp_iu' not at the end of a struct or class is a GNU extension [-W= error,-Wgnu-variable-sized-type-not-at-end] union viosrp_iu iu; ^ Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Removed unuseful _Static_assert (dgibson) hw/scsi/viosrp.h | 1 - hw/scsi/spapr_vscsi.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/scsi/viosrp.h b/hw/scsi/viosrp.h index 25676c2383..e5f9768e8f 100644 --- a/hw/scsi/viosrp.h +++ b/hw/scsi/viosrp.h @@ -49,7 +49,6 @@ union srp_iu { struct srp_tsk_mgmt tsk_mgmt; struct srp_cmd cmd; struct srp_rsp rsp; - uint8_t reserved[SRP_MAX_IU_LEN]; }; =20 enum viosrp_crq_formats { diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 70547f98ac..acf9bb50bc 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -66,7 +66,7 @@ typedef union vscsi_crq { =20 typedef struct vscsi_req { vscsi_crq crq; - union viosrp_iu iu; + uint8_t viosrp_iu_buf[SRP_MAX_IU_LEN]; =20 /* SCSI request tracking */ SCSIRequest *sreq; @@ -99,7 +99,7 @@ typedef struct { =20 static union viosrp_iu *req_iu(vscsi_req *req) { - return &req->iu; + return (union viosrp_iu *)req->viosrp_iu_buf; } =20 static struct vscsi_req *vscsi_get_req(VSCSIState *s) @@ -183,7 +183,7 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req, =20 /* First copy the SRP */ rc =3D spapr_vio_dma_write(&s->vdev, req->crq.s.IU_data_ptr, - &req->iu, length); + &req->viosrp_iu_buf, length); if (rc) { fprintf(stderr, "vscsi_send_iu: DMA write failure !\n"); } @@ -602,7 +602,7 @@ static const VMStateDescription vmstate_spapr_vscsi_req= =3D { .minimum_version_id =3D 1, .fields =3D (VMStateField[]) { VMSTATE_BUFFER(crq.raw, vscsi_req), - VMSTATE_BUFFER(iu.srp.reserved, vscsi_req), + VMSTATE_BUFFER(viosrp_iu_buf, vscsi_req), VMSTATE_UINT32(qtag, vscsi_req), VMSTATE_BOOL(active, vscsi_req), VMSTATE_UINT32(data_len, vscsi_req), @@ -1103,7 +1103,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_cr= q *crq) } =20 /* XXX Handle failure differently ? */ - if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu, + if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->viosrp_iu_b= uf, crq->s.IU_length)) { fprintf(stderr, "vscsi_got_payload: DMA read failure !\n"); vscsi_put_req(req); --=20 2.21.1