From patchwork Wed Jan 27 14:10:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8134271 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 588D09F1CC for ; Wed, 27 Jan 2016 14:11:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74852201C0 for ; Wed, 27 Jan 2016 14:11:26 +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 5EA8020145 for ; Wed, 27 Jan 2016 14:11:25 +0000 (UTC) Received: from localhost ([::1]:50774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOQob-00059d-L6 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 27 Jan 2016 09:11:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOQoL-00056O-HC for qemu-devel@nongnu.org; Wed, 27 Jan 2016 09:11:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOQoF-0006Eq-2D for qemu-devel@nongnu.org; Wed, 27 Jan 2016 09:11:05 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOQoE-0006EY-Ol for qemu-devel@nongnu.org; Wed, 27 Jan 2016 09:10:59 -0500 Received: by mail-wm0-x241.google.com with SMTP id l65so3581264wmf.3 for ; Wed, 27 Jan 2016 06:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=k2P1iLdpSDevALe0GRsCGVEUd8yvarUALPAuNB4rwCA=; b=C+cq8x+7ql6EsVoYYb6PdU45ZyIYQCG6Fmnxa0z8wFfoLsZUJmSw5qsK8WmFKNQz1H 8IIfliNzqkZ3cH0UwOYMxvGupdK2bhECdLEi8JWpvAgVf7ANpvKF9ravVQ/1+7VXBSOk k3ImDzqD6RbNu1tAx4RV5pLaG4q2WB8xTHp8fjL3lxXHo3tu0CKgAl6YWwKCUwIoJF0e l6KvrWOzk0Vn/UaLVR+FWn4hsV+760uRt4oGVL17HeMaXS7gaFvVNtCraDIkZ9uGz3Wz qgV1NXv1/6jCG2vbOkVFwNdE72y7soohb0hzpjVVL2fLuEVcIiRWhlu1OJfGPDnEknvK V5XA== 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:cc:subject:date:message-id :in-reply-to:references; bh=k2P1iLdpSDevALe0GRsCGVEUd8yvarUALPAuNB4rwCA=; b=lstFLDE0H5arcKYhAY41awg2P5rLoId+Hf3vhr2JpEbjWd9asOjBnGhZ8PAVnLti56 yCcNPJ7qSVR+QPEk8kYPn3dH4iiSgC4i1IJEpPDvkKAEXOhuNW4cUCbQpbOeAaUFoaiZ ATiOY6hsO35tLQXhIdwxeiMs+/zK6UndeUzafq+F1ICLCtJnCqVNe4J49VyyjnbjXLzN m9x30idhgZHfwvOsmBFyPWnaG4FHAIt1otN5QxouZHeeLen91/F49Qb/SWh6h91rdVX0 kYNUEuKyklJL133d7ky1LzBkOHamjr0JcInyeEUI1ks2hDiGzAB7eTu5NDqUJ3JbsPa/ febg== X-Gm-Message-State: AG10YOSdsXdh9NiAo0fA9kyuUSV+taEXb+9e35pUzfDZxsj3IW1zJA8B7RBY0+5TE4nQAg== X-Received: by 10.194.116.197 with SMTP id jy5mr24079412wjb.43.1453903858150; Wed, 27 Jan 2016 06:10:58 -0800 (PST) Received: from 640k.lan (94-39-161-9.adsl-ull.clienti.tiscali.it. [94.39.161.9]) by smtp.gmail.com with ESMTPSA id lc1sm6430552wjc.5.2016.01.27.06.10.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jan 2016 06:10:57 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 27 Jan 2016 15:10:50 +0100 Message-Id: <1453903852-136641-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1453903852-136641-1-git-send-email-pbonzini@redhat.com> References: <1453903852-136641-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::241 Cc: don.slutz@gmail.com Subject: [Qemu-devel] [PATCH 1/3] 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 4797d83..9c1d520 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -76,8 +76,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; @@ -632,21 +630,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; } @@ -2667,8 +2665,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), @@ -2717,8 +2715,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), @@ -2782,8 +2780,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;