From patchwork Thu Mar 5 12:12:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0504C138D for ; Thu, 5 Mar 2020 12:14:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD0C720658 for ; Thu, 5 Mar 2020 12:14:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FqkyEv7f" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD0C720658 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pOp-0008WB-Ug for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:14:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35480) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNB-0005jg-LQ for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNA-0000JH-OD for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:05 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29809 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 1j9pNA-0000J9-KU for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410384; 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=biiTpzltwU1sZnuHfx0nIZ3HPWdcfFfqBiK+XWGwsSg=; b=FqkyEv7fh6XQmLIwAFyNpxdNdxH9Hm19oUU6KjxPXpmBe84cMekOvZB2ZfAuWP58V4R9Yw Bnz7gUY+dfVdmJ+YBywfcFgfFffqxLmrkrZb0B325mRlVS9bL0Ql5iYA8SXiFhDKM2pVy2 QY4yr/6lzOBI2qP8hn1whwsZgpXIhIo= 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-242-fNCr9ntDNy-PdqQoOPCwLQ-1; Thu, 05 Mar 2020 07:13:02 -0500 X-MC-Unique: fNCr9ntDNy-PdqQoOPCwLQ-1 Received: by mail-wm1-f71.google.com with SMTP id b23so2009628wmj.3 for ; Thu, 05 Mar 2020 04:13:02 -0800 (PST) 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=/S7pAhQdbWIOFjZggLKf3SMhfw5UacO71zzf9J+ONfw=; b=LCNPGzBn952UrIiqEQM1gncPyy3bpBC6Vvo/bWte47FQoYdEb6+YEVe1WJEIWzEm6s o/7yWRTH2qOm+E49+pdB+Wl89Ob5NlKV35p0GhrsO60Jc5qkZI/95RHdkPM8bHrxm/3M H2hmVgGf7WeVNR8BizRPYuVy2gut5ztUZ4sQIcXjFSAPWW8CWQ6VgrNrdiROuKrjG/gP Z1Nnjg0z5JVbNTf1L6DkFXW865ZCE4o6ccIRjDYf6t4+krCsNDISCzr2KM3IlnkyG90y wl63vDTnByKLuJHRIVf2QyUqI2wbO2qrpz7VWnmBGx57sQakGWxVLgl8SE6TYaXSHvjX NsWQ== X-Gm-Message-State: ANhLgQ3vdorlK2jAfmrWujx+1tzFVS/6cbV684D/w9DRWy/er1GRf8Ob ZHJFLp5wMg0v8ZfCiAEDsZot3ezRkSlrXvZ2N1q7n+VHJ4iYuV+5j/OqWSuJuQApmCj80C93v54 v66F/K0EETWuOnvY= X-Received: by 2002:a7b:cc69:: with SMTP id n9mr9674718wmj.175.1583410381262; Thu, 05 Mar 2020 04:13:01 -0800 (PST) X-Google-Smtp-Source: ADFU+vth+6calAOVZz2Cyvlkq7snsT+nQmo+Q0iFdPDQwSWqAa0yB2+ceW1MpbH3tGHogbQFXs4Hxw== X-Received: by 2002:a7b:cc69:: with SMTP id n9mr9674693wmj.175.1583410381056; Thu, 05 Mar 2020 04:13:01 -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 q1sm2518037wrx.19.2020.03.05.04.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 1/7] hw/scsi/viosrp: Add missing 'hw/scsi/srp.h' include Date: Thu, 5 Mar 2020 13:12:47 +0100 Message-Id: <20200305121253.19078-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This header use the srp_* structures declared in "hw/scsi/srp.h". Signed-off-by: Philippe Mathieu-Daudé --- 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 +#include "hw/scsi/srp.h" + #define SRP_VERSION "16.a" #define SRP_MAX_IU_LEN 256 #define SRP_MAX_LOC_LEN 32 From patchwork Thu Mar 5 12:12:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53172174A for ; Thu, 5 Mar 2020 12:14:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26E452146E for ; Thu, 5 Mar 2020 12:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U/SkwcYf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26E452146E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pOi-0008Kg-71 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:14:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35521) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNI-0005qJ-0o for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNH-0000NG-1b for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:11 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39846 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 1j9pNG-0000MN-Uq for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410389; 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=VSi8icYpglVwPM4o7Q8ZGmXm/EAEO/DibdkCD45Z2Kw=; b=U/SkwcYfTtdBNrlLFG5cb2aEZTcu6cUyW8G5bIyqZuC97NeV0SPRTGOjCaDcQDQDCh+m37 t59DrnngyUuJDXzPJbo+vMk+yyGKw/YwNv4emfTOtzPLNSV32FAomXhvRF7q8t9tI0w9eA kTD69Cda4J+NCLGsglTSw4Fi4UyWkw4= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-329-VWElRjn9PdqrQocgFidG7A-1; Thu, 05 Mar 2020 07:13:08 -0500 X-MC-Unique: VWElRjn9PdqrQocgFidG7A-1 Received: by mail-ed1-f71.google.com with SMTP id d12so4206922edq.16 for ; Thu, 05 Mar 2020 04:13:07 -0800 (PST) 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=KkhqIVIgOTcLzuFywQWIieMxU39HVlXEuJIdDpMq2pg=; b=Tp28etSYXUtu4Ilg1WYIKG3M0NzrBBp3REmR1jWMURUG8TJxrwWja/aFjKa/RfgrRu sWYVGz9XzpnwZu/ozJ/zb06KiCkPBN0D4d9bUDvtXgesSOyInE4Duuc4byAhmUUgKBJ3 WwAGcxXmk4tgRBXKWAbKdm3xWBRJcBoqwlFR36ORkUG/c7EKvEKerVRNXcUDRS2/eEsx xQKBLFzJ5TEIAUBkB9ZXBlmDt6BSmPes1MQjibzzUcBGblmTjpp+jf4DAPAG6trl/mI9 XaWTBIRAHRNvlc9Fof8oM3bUhlHLElB3sVvfX/H7VqmuduqNQTYDGMsoaNSweXIMix4L DctQ== X-Gm-Message-State: ANhLgQ1EG8zpQ3ZPWo4GSSKQVmPBMv4wPFbtJecqfzDJBqS4eU7eaKAQ 9H4fN7be0ML8NlVr1isElMRQf4/PCa+wjdrbA8wCuQCMhRB2HSQ5U7XZFV7HNBTzPsriGVkJp+9 hh4xBkJxHCHITykU= X-Received: by 2002:a05:6402:206e:: with SMTP id bd14mr8092363edb.4.1583410386715; Thu, 05 Mar 2020 04:13:06 -0800 (PST) X-Google-Smtp-Source: ADFU+vtRnGuyzgI9xhlRwYcVpcuWEsVz+Bwc42U1dshtYQOQEhas40IZWOdGhBfYwr9bPJhdIvErGA== X-Received: by 2002:a05:6402:206e:: with SMTP id bd14mr8092333edb.4.1583410386464; Thu, 05 Mar 2020 04:13:06 -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 y12sm446746ejj.48.2020.03.05.04.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 2/7] hw/scsi/spapr_vscsi: Use SRP_MAX_IU_LEN instead of sizeof flexible array Date: Thu, 5 Mar 2020 13:12:48 +0100 Message-Id: <20200305121253.19078-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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_req *req) */ rsp->req_lim_delta = cpu_to_be32(VSCSI_REQ_LIMIT-2); rsp->tag = tag; - rsp->max_it_iu_len = cpu_to_be32(sizeof(union srp_iu)); - rsp->max_ti_iu_len = cpu_to_be32(sizeof(union srp_iu)); + rsp->max_it_iu_len = cpu_to_be32(SRP_MAX_IU_LEN); + rsp->max_ti_iu_len = cpu_to_be32(SRP_MAX_IU_LEN); /* direct and indirect */ rsp->buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT); @@ -1088,7 +1088,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *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); From patchwork Thu Mar 5 12:12:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421677 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04DB2138D for ; Thu, 5 Mar 2020 12:14:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEE4420658 for ; Thu, 5 Mar 2020 12:14:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WL14pG/t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEE4420658 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pOt-0000Df-S7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:14:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35550) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNO-00065W-IH for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNN-0000Td-Ke for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57978 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 1j9pNN-0000T2-Hj for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410397; 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=rG8Y7O79Oza1E4EtHnotT9wEc0MgFuHlwA25y0EWOjc=; b=WL14pG/t5R4uTiTVSICpXme9tdR9+1G2kAGM1OVKqd800uHzYWbSwnRFq1zCRZjt6q4wO1 yyfCWcCE3cIanBZ8qKeMMHQp2ufyeRPVdhwZfAUCcdYIkQkQRKr0MG6f4m016FKYcoaH8E Pwf0c7qUjlszBQtcPqNflyKtjt4xpIY= 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-488-ulghJ_k6NA60OLHJgfyDbQ-1; Thu, 05 Mar 2020 07:13:13 -0500 X-MC-Unique: ulghJ_k6NA60OLHJgfyDbQ-1 Received: by mail-wm1-f71.google.com with SMTP id e26so493241wmk.8 for ; Thu, 05 Mar 2020 04:13:13 -0800 (PST) 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=rYF0P2Wybp24BR2c5EPUo6wbbWoDVqZzcDGxlMTgfhI=; b=UgosUTYh0Kmjt+F32CG04Qc12JIidJPYqDTfnshtaI4MBqCPgd934eBNLUKKCremCy qsNnu5PaefNdynraGoMtsYuTIDz+GYtVq0objpJEX33QPdsfYenjnDl9F0QrQXDSfZ7U E27k8TpnSxgez9SJCgZuhnmn3fkjQYWYcQIsH/CNK+HjAihTJArqWmGh8MpM91ci2Zdm hVf5bQl7ncfvxrU03Okz/9eNNRzerbw0I/A/wWSgYT9u/uLU5miosAtVqNzoKAPhRQ+I 1zS+ndPwWSD8/eoXqzlx8v3/nbIvArUXzgkDofL/oYwwBXC0gZ4KiSmztE56fhB/Ylfl 55tQ== X-Gm-Message-State: ANhLgQ1PAQezLyF6lVSEq0siQKN16Wc66EjqBhIr+nkCe0qX6v4o/2O8 gViycg+lZk5oA8XqqfVwc/gzqmnQc2SlhM9fRYrRTu9rTBznZqppDeWGydZK4RZiKkTY/3VLMU8 Ytk8d18OpIvc/les= X-Received: by 2002:adf:e74e:: with SMTP id c14mr10335545wrn.128.1583410392074; Thu, 05 Mar 2020 04:13:12 -0800 (PST) X-Google-Smtp-Source: ADFU+vs79/ix+uVENHHbayrZfX7scKVeWpGzajfjWZwLa4XAuEUhfb73W+x3PbI+m2gAR4r8WEorYA== X-Received: by 2002:adf:e74e:: with SMTP id c14mr10335519wrn.128.1583410391879; Thu, 05 Mar 2020 04:13:11 -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 u17sm8180841wmj.47.2020.03.05.04.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 3/7] hw/scsi/spapr_vscsi: Simplify a bit Date: Thu, 5 Mar 2020 13:12:49 +0100 Message-Id: <20200305121253.19078-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We already have a 'iu' pointer, use it (this simplifies the next commit). Signed-off-by: Philippe Mathieu-Daudé --- since v2: fixed typo in description (Greg Kurz) --- 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 = (sol_not & 0x04) >> 2; if (req->senselen) { - req->iu.srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID; - req->iu.srp.rsp.sense_data_len = cpu_to_be32(req->senselen); - memcpy(req->iu.srp.rsp.data, req->sense, req->senselen); + iu->srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID; + iu->srp.rsp.sense_data_len = cpu_to_be32(req->senselen); + memcpy(iu->srp.rsp.data, req->sense, req->senselen); total_len += req->senselen; } } else { From patchwork Thu Mar 5 12:12:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421717 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C0F9924 for ; Thu, 5 Mar 2020 12:17:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F543208CD for ; Thu, 5 Mar 2020 12:17:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZPZ6bvG/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F543208CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pR0-0003D2-16 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:17:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35582) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNS-0006JM-Rs for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNR-0000Vn-EU for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:22 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:37245 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 1j9pNR-0000Us-Ac for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410401; 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=r6Sx0cwXVuykXvpYNur/vnF7jjL1OxOMqSn3Kqv2EMg=; b=ZPZ6bvG/Fczc6L5IqxF2DWsaJoQfyIWp6HDmTEno2+cf9985EId0UuVciqbK7D59X49U8c sEcFNIaVMf9S3IRm2H8qmNg13nbDKPep3drWbnUO+47iD8HFRetMIp4lCI8C+Bp0r1nqZK P/N/cf10Kez3kiSBFUDL3IwNJA9qQes= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-4yA6nUrEPCqCizdyXLPHIA-1; Thu, 05 Mar 2020 07:13:19 -0500 X-MC-Unique: 4yA6nUrEPCqCizdyXLPHIA-1 Received: by mail-ed1-f72.google.com with SMTP id g11so4210944edu.10 for ; Thu, 05 Mar 2020 04:13:19 -0800 (PST) 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=1mYU2d7qsUAj66HBG23kLp4SEg8TOaDUQdFj9CdxtyA=; b=gCeLGyTbe3HvXRUm7F1d9BlmabLPhpEP4XaYA658K0Za7nLj2svu0fA5Hpw3ee81tr CFs5egJeV6pwsRHgNDljSC6zfpzWzmR72nQWwjrLYAeQGKUtbI2YXuSuMamOQfC2tEBg atoODDtJqTAxV3TMzvgZXyvPUgBqMKwssH486Q2dpDN4JJUAVnAL4FZqH0R8KhcbcmE8 HELqq5z+xmxPQ6dj63HqhWf8kEBz2Bp/Pa0T3Ah8SJaFhg6VYPs4U49bVA+eQVdWHDFJ phJ/C/bYqD+ieQp6kYko+ttoWdA7NqffDMVVkgJzTyf2ondAucGZxoATaZF9nrHFbDH8 G9gQ== X-Gm-Message-State: ANhLgQ3uZdf41Q5/hFvQ/bguBRieq6sukOV6ozkb1taW/jkgD4OVmv+3 5UVmhcl8fG3Kyoysaq1UOOp08ebuGYvh0Ha3d2zYlNl52LaAUH7Fv1hxmuytKxXIy6Wpn6bMUIr bkbZRqK0vy9cisVY= X-Received: by 2002:a17:906:69b:: with SMTP id u27mr7386898ejb.88.1583410397752; Thu, 05 Mar 2020 04:13:17 -0800 (PST) X-Google-Smtp-Source: ADFU+vsaoI8fpFgnlG7roWuweRDsdTYpTNx2d3ipErVFSZ+Fl4xFzyrAXdNxfQ5e6cYxgxEdvsdReQ== X-Received: by 2002:a17:906:69b:: with SMTP id u27mr7386870ejb.88.1583410397503; Thu, 05 Mar 2020 04:13:17 -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 a22sm864817edx.25.2020.03.05.04.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 4/7] hw/scsi/spapr_vscsi: Introduce req_iu() helper Date: Thu, 5 Mar 2020 13:12:50 +0100 Message-Id: <20200305121253.19078-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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; +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) for (i = 0; i < VSCSI_REQ_LIMIT; i++) { req = &s->reqs[i]; - if (req->iu.srp.cmd.tag == srp_tag) { + if (req_iu(req)->srp.cmd.tag == srp_tag) { return req; } } @@ -188,7 +193,7 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req, req->crq.s.reserved = 0x00; req->crq.s.timeout = cpu_to_be16(0x0000); req->crq.s.IU_length = cpu_to_be16(length); - req->crq.s.IU_data_ptr = req->iu.srp.rsp.tag; /* right byte order */ + req->crq.s.IU_data_ptr = req_iu(req)->srp.rsp.tag; /* right byte order */ if (rc == 0) { req->crq.s.status = 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 = &req->iu; + union viosrp_iu *iu = req_iu(req); uint64_t tag = iu->srp.rsp.tag; int total_len = sizeof(iu->srp.rsp); uint8_t sol_not = 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 = &req->iu.srp.cmd; + struct srp_cmd *cmd = &req_iu(req)->srp.cmd; switch (req->dma_fmt) { case SRP_NO_DATA_DESC: { @@ -473,7 +478,7 @@ static int data_out_desc_size(struct srp_cmd *cmd) static int vscsi_preprocess_desc(vscsi_req *req) { - struct srp_cmd *cmd = &req->iu.srp.cmd; + struct srp_cmd *cmd = &req_iu(req)->srp.cmd; req->cdb_offset = cmd->add_cdb_len & ~3; @@ -655,7 +660,7 @@ static void *vscsi_load_request(QEMUFile *f, SCSIRequest *sreq) static void vscsi_process_login(VSCSIState *s, vscsi_req *req) { - union viosrp_iu *iu = &req->iu; + union viosrp_iu *iu = req_iu(req); struct srp_login_rsp *rsp = &iu->srp.login_rsp; uint64_t tag = iu->srp.rsp.tag; @@ -681,7 +686,7 @@ static void vscsi_process_login(VSCSIState *s, vscsi_req *req) static void vscsi_inquiry_no_target(VSCSIState *s, vscsi_req *req) { - uint8_t *cdb = req->iu.srp.cmd.cdb; + uint8_t *cdb = req_iu(req)->srp.cmd.cdb; uint8_t resp_data[36]; int rc, len, alen; @@ -770,7 +775,7 @@ static void vscsi_report_luns(VSCSIState *s, vscsi_req *req) static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req) { - union srp_iu *srp = &req->iu.srp; + union srp_iu *srp = &req_iu(req)->srp; SCSIDevice *sdev; int n, lun; @@ -821,7 +826,7 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req) static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_req *req) { - union viosrp_iu *iu = &req->iu; + union viosrp_iu *iu = req_iu(req); vscsi_req *tmpreq; int i, lun = 0, resp = 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); - d = vscsi_device_find(&s->bus, be64_to_cpu(req->iu.srp.tsk_mgmt.lun), &lun); + d = vscsi_device_find(&s->bus, + be64_to_cpu(req_iu(req)->srp.tsk_mgmt.lun), &lun); if (!d) { resp = SRP_TSK_MGMT_FIELDS_INVALID; } else { @@ -842,7 +848,7 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_req *req) break; } - tmpreq = vscsi_find_req(s, req->iu.srp.tsk_mgmt.task_tag); + tmpreq = vscsi_find_req(s, req_iu(req)->srp.tsk_mgmt.task_tag); 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) for (i = 0; i < VSCSI_REQ_LIMIT; i++) { tmpreq = &s->reqs[i]; - if (tmpreq->iu.srp.cmd.lun != req->iu.srp.tsk_mgmt.lun) { + if (req_iu(tmpreq)->srp.cmd.lun + != 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) static int vscsi_handle_srp_req(VSCSIState *s, vscsi_req *req) { - union srp_iu *srp = &req->iu.srp; + union srp_iu *srp = &req_iu(req)->srp; int done = 1; uint8_t opcode = srp->rsp.opcode; @@ -948,7 +955,7 @@ static int vscsi_send_adapter_info(VSCSIState *s, vscsi_req *req) struct mad_adapter_info_data info; int rc; - sinfo = &req->iu.mad.adapter_info; + sinfo = &req_iu(req)->mad.adapter_info; #if 0 /* What for ? */ rc = 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; - vcap = &req->iu.mad.capabilities; + vcap = &req_iu(req)->mad.capabilities; req_len = len = be16_to_cpu(vcap->common.length); buffer = be64_to_cpu(vcap->buffer); if (len > sizeof(cap)) { @@ -1029,7 +1036,7 @@ static int vscsi_send_capabilities(VSCSIState *s, vscsi_req *req) static int vscsi_handle_mad_req(VSCSIState *s, vscsi_req *req) { - union mad_iu *mad = &req->iu.mad; + union mad_iu *mad = &req_iu(req)->mad; bool request_handled = false; uint64_t retlen = 0; From patchwork Thu Mar 5 12:12:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421721 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20DB517EF for ; Thu, 5 Mar 2020 12:19:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCDC8208CD for ; Thu, 5 Mar 2020 12:19:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fnl6zG/Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCDC8208CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pT4-0006ne-0U for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:19:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35621) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNc-0006fk-MK for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNW-0000ZI-CD for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:28 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34368 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 1j9pNW-0000Z1-93 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410406; 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=2sgBvEl+jyE9C+iCwWb8YP4xhIVb5G0+M5zi3OeMCiY=; b=fnl6zG/ZRmsm7LJg+Kdj6gS8p9GtQF2u/JN6N/oWDIL1usrPz+L1U3FJKB0OXdhVUje9XR aHPo+iJ9PFXgDkIop50upY9wBNLOZvxkq0RiHZfvjWAZbAdXd4bK1ED0hzdOx4kWJVnsNI Ya9GAjWj40oU3WIzLjXk2SL0BC7NpmQ= 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-185-TQTl6SzuMjSIEYwmU9YioA-1; Thu, 05 Mar 2020 07:13:24 -0500 X-MC-Unique: TQTl6SzuMjSIEYwmU9YioA-1 Received: by mail-wm1-f71.google.com with SMTP id p4so2804278wmp.0 for ; Thu, 05 Mar 2020 04:13:24 -0800 (PST) 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=zCxk3Zde/q44N7tBo+VCD7daM7l+u+3ZJi6pI1CFBvk=; b=XBEEoE57KjhszqlrJPZRO4pSn7955axidwyNj1jp9X4jQNe31HhabfoPF9EtYh0dY+ rKKBXmh0pFoVXkhgyEq3ZwF81m3ZxT9n3sifFUZOhR3pSQcYKseIZj+ldB2saIHh+Hh/ vyHRcFdZqhuwNKpKZ+Q2UyBg8Jdg2lvfd1rXzakbsravhmh1YRoWhjT+Z5OprnMl7PXZ evJTEP6/3sHQkjdVf0g3KR3POGTdHtfOkI7399dK8wANAC5quowuQMKpy/RfsVqvhlvm FLkBboflTN5VMigksUoVSiXWbxqx2dvX2KYEJ4OfMkw6CLWrMo6PXDRBBI5IXgoj0Rjk nQFQ== X-Gm-Message-State: ANhLgQ377+V22Y/RCnTlfYisSEkWVOIaz5iPO6TaWwDTmDn2s84JiEr/ q39EH73/sDId2D1og9bbPKE3Mh1Ifgh+HPtBpcn2h5pLazO1OaIWmYxB99gQOII/K1XTqIDkfrx llJkAEs9aQqvC1gs= X-Received: by 2002:a1c:7512:: with SMTP id o18mr9237472wmc.110.1583410402942; Thu, 05 Mar 2020 04:13:22 -0800 (PST) X-Google-Smtp-Source: ADFU+vsyv14cLQAJgWrkpyBv8heTFTsU17i81cdnCyRW54J7QltDIZb5EMzm+eTTlyEz5Ghsr6m0YA== X-Received: by 2002:a1c:7512:: with SMTP id o18mr9237449wmc.110.1583410402688; Thu, 05 Mar 2020 04:13:22 -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 a1sm4091094wru.75.2020.03.05.04.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 5/7] hw/scsi/spapr_vscsi: Do not mix SRP IU size with DMA buffer size Date: Thu, 5 Mar 2020 13:12:51 +0100 Message-Id: <20200305121253.19078-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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=undefined' 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 [-Werror,-Wgnu-variable-sized-type-not-at-end] union viosrp_iu iu; ^ Signed-off-by: Philippe Mathieu-Daudé --- 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]; }; 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 { typedef struct vscsi_req { vscsi_crq crq; - union viosrp_iu iu; + uint8_t viosrp_iu_buf[SRP_MAX_IU_LEN]; /* SCSI request tracking */ SCSIRequest *sreq; @@ -99,7 +99,7 @@ typedef struct { static union viosrp_iu *req_iu(vscsi_req *req) { - return &req->iu; + return (union viosrp_iu *)req->viosrp_iu_buf; } static struct vscsi_req *vscsi_get_req(VSCSIState *s) @@ -183,7 +183,7 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req, /* First copy the SRP */ rc = 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 = { .minimum_version_id = 1, .fields = (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_crq *crq) } /* 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_buf, crq->s.IU_length)) { fprintf(stderr, "vscsi_got_payload: DMA read failure !\n"); vscsi_put_req(req); From patchwork Thu Mar 5 12:12:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421719 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 310AA924 for ; Thu, 5 Mar 2020 12:17:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07C56208CD for ; Thu, 5 Mar 2020 12:17:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Enw6AUFb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07C56208CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pR3-0003KA-2z for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:17:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35657) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNg-0006lZ-CY for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNd-0000cd-Dt for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:35 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45632 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 1j9pNd-0000c8-AW for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410411; 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=IeMYYJM4rZHjEQE/kaChO98H7SkxnIdxqobYmNOE1qU=; b=Enw6AUFbZN5cQPVi803fj2RzEbcC2VPozduVlI2Aw2FO9JQQEQEo8gx5+k2w9d8u/L9jfj M8ZJnSSwTagHz/EJn8/c6CD+iYTLgIDZiZqUpBYs/PBF4KxDYuZTLH1LFC8CzlZTXwDub6 JQ7EFQBhVwxLB704XYNnLgmzf7mR0pw= 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-400-71PN0rMTPj-Y847AkHZUfg-1; Thu, 05 Mar 2020 07:13:30 -0500 X-MC-Unique: 71PN0rMTPj-Y847AkHZUfg-1 Received: by mail-wr1-f70.google.com with SMTP id q18so2228387wrw.5 for ; Thu, 05 Mar 2020 04:13:30 -0800 (PST) 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=km1ZrpW4qZf4ZJfWNb4+tgog9PwiHithuRYIeTrt3yA=; b=TnK5Zw/Ytkn/MXbxiU9AqNxNyyx090XcUNiGnQe7TuMM9b12+KhujYyy/ALKI+DxAY CE6GB3wnV6qDeeAidmjryMv48sUOisW1E/94TZsQRF/6qkRi24h9hvmOoB9zWyKWNeX3 ToOHV9HWOm1EuhOukYr4upVDpC+UXIsWOoli3meaGfyLQNmvx10kLOir8uslXLG0TmH+ 7ouy1DhJFQll5bT3Uh2vs8MsalgdZ8GK9g3FrbqWsYqbz4p6e9K5sNnBgQSCHbuM7X3a pkkOl8gY/435mhoQoMrw+LTvpXNXI/PXrf4edv/YxnsBVLmS9A8ZaVPqfpbkchOsYtWi BUDw== X-Gm-Message-State: ANhLgQ0ijm2YHK6SolXcV7xS1pLA3Id8yaxWUm/VuVyYtCe5f3tc2uFQ IEmfTH3cLLd949emFo6+GUgXWB05oFv3LrpojgS7TZT2hxX3m9u7wfMZye8C9d/UseBodY4Vhc3 Zxa3rveLOLANTfZo= X-Received: by 2002:a5d:4805:: with SMTP id l5mr9196701wrq.11.1583410408632; Thu, 05 Mar 2020 04:13:28 -0800 (PST) X-Google-Smtp-Source: ADFU+vuzE27IqO/AvypAGce+Zas6OjQogDbhR1DrzPAhyML7+07Wz285lX7xs+jUujuvpOO3ixXzmg== X-Received: by 2002:a5d:4805:: with SMTP id l5mr9196683wrq.11.1583410408463; Thu, 05 Mar 2020 04:13:28 -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 j66sm9149600wmb.21.2020.03.05.04.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 6/7] hw/scsi/spapr_vscsi: Prevent buffer overflow Date: Thu, 5 Mar 2020 13:12:52 +0100 Message-Id: <20200305121253.19078-7-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Depending on the length of sense data, vscsi_send_rsp() can overrun the buffer size. Do not copy more than SRP_MAX_IU_DATA_LEN bytes, and assert that vscsi_send_iu() is always called with a size in range. Reported-by: Paolo Bonzini Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/spapr_vscsi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index acf9bb50bc..c4c4f31170 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -55,6 +55,8 @@ #define VSCSI_MAX_SECTORS 4096 #define VSCSI_REQ_LIMIT 24 +/* Maximum size of a IU payload */ +#define SRP_MAX_IU_DATA_LEN (SRP_MAX_IU_LEN - sizeof(union srp_iu)) #define SRP_RSP_SENSE_DATA_LEN 18 #define SRP_REPORT_LUNS_WLUN 0xc10100000000000ULL @@ -181,6 +183,8 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req, { long rc, rc1; + assert(length <= SRP_MAX_IU_LEN); + /* First copy the SRP */ rc = spapr_vio_dma_write(&s->vdev, req->crq.s.IU_data_ptr, &req->viosrp_iu_buf, length); @@ -266,10 +270,12 @@ static int vscsi_send_rsp(VSCSIState *s, vscsi_req *req, if (status) { iu->srp.rsp.sol_not = (sol_not & 0x04) >> 2; if (req->senselen) { + int sense_data_len = MIN(req->senselen, SRP_MAX_IU_DATA_LEN); + iu->srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID; - iu->srp.rsp.sense_data_len = cpu_to_be32(req->senselen); - memcpy(iu->srp.rsp.data, req->sense, req->senselen); - total_len += req->senselen; + iu->srp.rsp.sense_data_len = cpu_to_be32(sense_data_len); + memcpy(iu->srp.rsp.data, req->sense, sense_data_len); + total_len += sense_data_len; } } else { iu->srp.rsp.sol_not = (sol_not & 0x02) >> 1; @@ -896,6 +902,7 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_req *req) } /* Compose the response here as */ + QEMU_BUILD_BUG_ON(SRP_MAX_IU_DATA_LEN < 4); memset(iu, 0, sizeof(struct srp_rsp) + 4); iu->srp.rsp.opcode = SRP_RSP; iu->srp.rsp.req_lim_delta = cpu_to_be32(1); From patchwork Thu Mar 5 12:12:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11421723 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B59D924 for ; Thu, 5 Mar 2020 12:19:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4223C208CD for ; Thu, 5 Mar 2020 12:19:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MAjkm0NL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4223C208CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pTD-0006xH-Du for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Mar 2020 07:19:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35671) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9pNi-0006rz-5D for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9pNh-0000eu-63 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45464 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 1j9pNh-0000e2-1y for qemu-devel@nongnu.org; Thu, 05 Mar 2020 07:13:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583410416; 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=4+tJ2pAChccRpSCGY8McY0DCHX6xcYqkqDoJDya3e04=; b=MAjkm0NLUM7VXVUiQWpWSIFoWvp9xMY0bCXkYGRfmuAtsoilkdL8yRWOXjgtPh1jITZbMK ALyttArASawvl+ix9oFE0DkUv7KaTkP8o+nwewfobPzcA53IqHA7UUy8ZEhjEFksUvhdof BIT3UqO+2qo9Gym2KKfiMOnUDtGjzMs= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-10-OEPuXOBKNRKiMLh1mj2iFQ-1; Thu, 05 Mar 2020 07:13:35 -0500 X-MC-Unique: OEPuXOBKNRKiMLh1mj2iFQ-1 Received: by mail-ed1-f72.google.com with SMTP id p21so4173862edr.22 for ; Thu, 05 Mar 2020 04:13:35 -0800 (PST) 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=1o5amSDbbIwKv6IaW3jUQVmu4OaybVeXGyKvmbAGQJk=; b=psgxrzvhdlK5affS7RhSAkxD1qH4coBVL4vEJhz15O3LFZoy4+UcXwECMqopYhh2lp MxVjjaw5Rpcl1ooOPE/mMDP2462VPCbHZ9D6kHINqWLLK5sbS4x0P1z6mlGhVVNg+kF4 3olcViHVwI3CASBRuRNKEQlyzBv9G5PqaqMnIQ+ldK6tu57p3x8++LdySa7WONeMqYPw Lov7bSgjo8vrVxmVBmNLRAoqiKOFEg9pjqnfXLxYVcWBZ1qNqkUZVBNL7P5r5xBXUcbB HyJf9nD7w6ha8S/J7vgWuy9F/i82w8JHjz22WEHg7Tjfy0UAKiVkfWcMfAWJP4yVvuik TcxQ== X-Gm-Message-State: ANhLgQ2Y0EYJxdkqYd/zhK1ctaPrSVw3p6/n8F2HIXRbuKY/dufTmNLd UaGva5ykHJmZt06yeF+VmZPAAjY3/MBD6m5oc2hPu13lcnqNvT88gtgFLt0X8Q585Q8rRP8QsaI hFfMoI9Q3sbWQf0Q= X-Received: by 2002:aa7:d785:: with SMTP id s5mr8232921edq.101.1583410413888; Thu, 05 Mar 2020 04:13:33 -0800 (PST) X-Google-Smtp-Source: ADFU+vteoAB98Dw3uCkJ1rFtwGx3XOkH3Ch0deCXYUipvDk0oUVTQ8U6x07xvPi4QVszaEcsn03Q7A== X-Received: by 2002:aa7:d785:: with SMTP id s5mr8232903edq.101.1583410413732; Thu, 05 Mar 2020 04:13:33 -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 s19sm437873edi.93.2020.03.05.04.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:13:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 7/7] hw/scsi/spapr_vscsi: Convert debug fprintf() to trace event Date: Thu, 5 Mar 2020 13:12:53 +0100 Message-Id: <20200305121253.19078-8-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305121253.19078-1-philmd@redhat.com> References: <20200305121253.19078-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 , Greg Kurz , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/spapr_vscsi.c | 4 +--- hw/scsi/trace-events | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index c4c4f31170..923488beb2 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -839,9 +839,7 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_req *req) uint64_t tag = iu->srp.rsp.tag; uint8_t sol_not = iu->srp.cmd.sol_not; - fprintf(stderr, "vscsi_process_tsk_mgmt %02x\n", - iu->srp.tsk_mgmt.tsk_mgmt_func); - + trace_spapr_vscsi_process_tsk_mgmt(iu->srp.tsk_mgmt.tsk_mgmt_func); d = vscsi_device_find(&s->bus, be64_to_cpu(req_iu(req)->srp.tsk_mgmt.lun), &lun); if (!d) { diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index b0820052f8..9a4a60ca63 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -227,6 +227,7 @@ spapr_vscsi_command_complete_status(uint32_t status) "Command complete err=%"PRI spapr_vscsi_save_request(uint32_t qtag, unsigned desc, unsigned offset) "saving tag=%"PRIu32", current desc#%u, offset=0x%x" spapr_vscsi_load_request(uint32_t qtag, unsigned desc, unsigned offset) "restoring tag=%"PRIu32", current desc#%u, offset=0x%x" spapr_vscsi_process_login(void) "Got login, sending response !" +spapr_vscsi_process_tsk_mgmt(uint8_t func) "tsk_mgmt_func 0x%02x" spapr_vscsi_queue_cmd_no_drive(uint64_t lun) "Command for lun 0x%08" PRIx64 " with no drive" spapr_vscsi_queue_cmd(uint32_t qtag, unsigned cdb, const char *cmd, int lun, int ret) "Queued command tag 0x%"PRIx32" CMD 0x%x=%s LUN %d ret: %d" spapr_vscsi_do_crq(unsigned c0, unsigned c1) "crq: %02x %02x ..."