From patchwork Mon Feb 8 17:02:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8252451 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4929E9F1C1 for ; Mon, 8 Feb 2016 17:07:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D801203E3 for ; Mon, 8 Feb 2016 17:07:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE036203B8 for ; Mon, 8 Feb 2016 17:07:46 +0000 (UTC) Received: from localhost ([::1]:46872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSpHt-0001kA-Hy for patchwork-qemu-devel@patchwork.kernel.org; Mon, 08 Feb 2016 12:07:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSpDm-000347-BQ for qemu-devel@nongnu.org; Mon, 08 Feb 2016 12:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSpDl-0006fO-6W for qemu-devel@nongnu.org; Mon, 08 Feb 2016 12:03:30 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:37307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSpDk-0006f4-SZ for qemu-devel@nongnu.org; Mon, 08 Feb 2016 12:03:29 -0500 Received: by mail-wm0-x233.google.com with SMTP id g62so125501437wme.0 for ; Mon, 08 Feb 2016 09:03:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=xfAl4uIyLqVmS1OQS2Kgl2Vjbkg7lA09wX9Q8ePxIJs=; b=Ta2vslu1kXT8FkT3jQh4n0S1A4xkkBMV15nTvTRHuVHtxpM86EpVHTwqlPJveW6Y3o z5SzpaXP6FzubR635ouR/kn54EK9H0PVndVnBXKibCOdu2ki/pyuBFD5w/A7GLZKuF63 jX2RRaB3xH4FLXgeuZFsV04qBEqyT7TekWGurCtTtMtI6YNAvQCwDAOoN2yG7omti885 RMpFPuly6ClUXSw4bhcW/4r7VlESq78xAd4QHOvnBoPj2tmpeDoqcX8jgmw0SalwTAMZ ZYsfJN9kqQpVtHhndpulk+lZxCFcTr7kOcAK4iugiF3rVz9aLOLznuiOctHve8kFpgRE fgag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=xfAl4uIyLqVmS1OQS2Kgl2Vjbkg7lA09wX9Q8ePxIJs=; b=RRu9lJ8G5fMZjNPfgTE6aVTBf7uPfcvosi+rW31aTFvC49WI5rJI3DmrKT3iKC3BaU VSEKTJE2pyYJmaquaGmCMhr3xfeni738yjqwUu2ZKEYNLL7EaT05KVBNLuHIV0+PXZqM BYYtMZK2Wa0M1G2gOC1oRSVgs4XeTaWb+1xzm/5kYTDkTYE2GkcxUU5ZBsYh0goQ//f4 EFtotW/Y1AAXyXzMviWLbSNzt4Vbs58epZa4MbBVzQN+iZIu/lr0Bm9NvoWCtIMB3zBJ ZoYU50tGibwZXjjg7auKR4+xGyZxUbXyDvUoLfUV7As+PTReAD3d+/cX5S+GKxdguEZs b0Hw== X-Gm-Message-State: AG10YORdq8lDWjuw87Sipy955pJrQLZCgmVRJ98etzo1J/hQFGkDHCxDEyzSBPPAWLfvQw== X-Received: by 10.28.104.87 with SMTP id d84mr33346702wmc.56.1454951008242; Mon, 08 Feb 2016 09:03:28 -0800 (PST) Received: from 640k.lan (94-39-141-130.adsl-ull.clienti.tiscali.it. [94.39.141.130]) by smtp.gmail.com with ESMTPSA id b1sm30651442wjy.0.2016.02.08.09.03.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Feb 2016 09:03:27 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 8 Feb 2016 18:02:57 +0100 Message-Id: <1454950999-64128-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1454950999-64128-1-git-send-email-pbonzini@redhat.com> References: <1454950999-64128-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::233 Subject: [Qemu-devel] [PULL 06/28] scsi: push WWN fields up to SCSIDevice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SAS adapters need to access them in order to publish the SAS addresses of the end devices connected to them. Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 22 ++++++++++------------ include/hw/scsi/scsi.h | 2 ++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index dc79dc0..fd12fbb 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -77,8 +77,6 @@ struct SCSIDiskState bool media_changed; bool media_event; bool eject_request; - uint64_t wwn; - uint64_t port_wwn; uint16_t port_index; uint64_t max_unmap_size; uint64_t max_io_size; @@ -633,21 +631,21 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) memcpy(outbuf+buflen, str, id_len); buflen += id_len; - if (s->wwn) { + if (s->qdev.wwn) { outbuf[buflen++] = 0x1; // Binary outbuf[buflen++] = 0x3; // NAA outbuf[buflen++] = 0; // reserved outbuf[buflen++] = 8; - stq_be_p(&outbuf[buflen], s->wwn); + stq_be_p(&outbuf[buflen], s->qdev.wwn); buflen += 8; } - if (s->port_wwn) { + if (s->qdev.port_wwn) { outbuf[buflen++] = 0x61; // SAS / Binary outbuf[buflen++] = 0x93; // PIV / Target port / NAA outbuf[buflen++] = 0; // reserved outbuf[buflen++] = 8; - stq_be_p(&outbuf[buflen], s->port_wwn); + stq_be_p(&outbuf[buflen], s->qdev.port_wwn); buflen += 8; } @@ -2668,8 +2666,8 @@ static Property scsi_hd_properties[] = { SCSI_DISK_F_REMOVABLE, false), DEFINE_PROP_BIT("dpofua", SCSIDiskState, features, SCSI_DISK_F_DPOFUA, false), - DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0), - DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, port_wwn, 0), + DEFINE_PROP_UINT64("wwn", SCSIDiskState, qdev.wwn, 0), + DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, qdev.port_wwn, 0), DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0), DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size, DEFAULT_MAX_UNMAP_SIZE), @@ -2718,8 +2716,8 @@ static const TypeInfo scsi_hd_info = { static Property scsi_cd_properties[] = { DEFINE_SCSI_DISK_PROPERTIES(), - DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0), - DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, port_wwn, 0), + DEFINE_PROP_UINT64("wwn", SCSIDiskState, qdev.wwn, 0), + DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, qdev.port_wwn, 0), DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0), DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size, DEFAULT_MAX_IO_SIZE), @@ -2783,8 +2781,8 @@ static Property scsi_disk_properties[] = { SCSI_DISK_F_REMOVABLE, false), DEFINE_PROP_BIT("dpofua", SCSIDiskState, features, SCSI_DISK_F_DPOFUA, false), - DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0), - DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, port_wwn, 0), + DEFINE_PROP_UINT64("wwn", SCSIDiskState, qdev.wwn, 0), + DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, qdev.port_wwn, 0), DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0), DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size, DEFAULT_MAX_UNMAP_SIZE), diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 1915a73..bbabba2 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -108,6 +108,8 @@ struct SCSIDevice int blocksize; int type; uint64_t max_lba; + uint64_t wwn; + uint64_t port_wwn; }; extern const VMStateDescription vmstate_scsi_device;