From nobody Fri Apr 26 18:03:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1593513650; cv=none; d=zohomail.com; s=zohoarc; b=O6htNmybclx8haqxImlcPN+391A2AmlHkZswSCtjRVLGzR2OeJBiFe2Pi3YYC3MdLH/mPhnKGm+x0lOffuvwd9pVOhWBX4IWZiDmv5hGHFk2v7H+I3+ZLcYasKUqt7dgG8AqKPAwVoYf5JcrXWxgCTTqfSQe/Nzjm36v4L7ZCK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593513650; 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=Odgb6jy8EO1qmpvwH8AySvxbGpHXkOS/Y+ZFSjxPPU0=; b=VTm09bVMr3LAm7j3uDzq72SfM8s0KaD19V8rFDgQ7myp1xzP5uiFrCZci8nlLtB1UL9NufrNrLovoWtKzNtNqgFagEJsHKELsyvVeVedgTo/Sn98EYV/RMPN6WHLAi/Zf6gCCYRpPhIZ5q45BWlSxETNDNNIVHC6csYSXnJqZ5E= 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 1593513650150420.4145888217448; Tue, 30 Jun 2020 03:40:50 -0700 (PDT) Received: from localhost ([::1]:39152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqDh2-0003GP-Qj for importer@patchew.org; Tue, 30 Jun 2020 06:40:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqDea-0007R1-Vg for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:38:17 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:30888 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jqDeY-0002Jq-V7 for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:38:16 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-92-VA7IZMMAPj6wzEBnE8F3rw-1; Tue, 30 Jun 2020 06:37:47 -0400 Received: by mail-ej1-f71.google.com with SMTP id b24so12723758ejb.8 for ; Tue, 30 Jun 2020 03:37:47 -0700 (PDT) Received: from x1w.redhat.com (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id q7sm1758631ejo.22.2020.06.30.03.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 03:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593513494; 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=Odgb6jy8EO1qmpvwH8AySvxbGpHXkOS/Y+ZFSjxPPU0=; b=KfsM8zq/mx2ks2CQYLq5cvQJhgXtQPVNmao+S28qcwlVrfrpctICGHDm7/iwKN+L38tu3I VR5EeEt+oXCUoAzVVmA2rhjVs4ayrd4CcZz3zTTLcFxdslP24IyJxnp1zMUccafwIeAKco KeDslcQUASqaCak+YAvsovwLhjISMa0= X-MC-Unique: VA7IZMMAPj6wzEBnE8F3rw-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=Odgb6jy8EO1qmpvwH8AySvxbGpHXkOS/Y+ZFSjxPPU0=; b=J/5ARnG0eVEpqFAuWzppVAqorWlqiEb/xZvdHI90wKt8WPBbS6oWjqAdHo0EgstXwD axk10sTyzsLPBlDWNNufumcVYGNG15UYDQm/dqEq4Gmh+dFR4VXWoiwtcbOurVvS3ySe hubkvhLvpzwfTve0GTbxMYp5eu0vhHsCWNZoT0lVLj8FQj5CQHCbSbwXf9AwyWiKK6ne ZWu/aZOhMKnD/wUnVA/EqAVmsZ5yYEzXs8jAUGnz9wzd4zSwIsLiyLke2TPNrxKnW5vR ehqTUDQMl+q4of9KT6RhIXcIdyb+k2GebD2o3V2hQX+rU9Lr+fUo8XN8x2uIw+wgF3H2 zCdw== X-Gm-Message-State: AOAM532tmJzaujpOMBii3gRUFc0xUl4SvZyTIwZyZwvN8qg5T9qTPK4R 99eaWc3gB8CVdwtv5SK6BS2/UKLVm6/2swPhLu1w8ZhKkgeQCsv4l27QgZuB2bPD3NgcnTFs4nZ 4siUk9hnYm8gPrU8= X-Received: by 2002:aa7:db4f:: with SMTP id n15mr6554065edt.193.1593513466355; Tue, 30 Jun 2020 03:37:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4OeINd9qe3Ow2fnBCa0tZ4tZ14NwLhsn3B6UWZvgfWqeCees84DHK5XqGuTRMgxEyUlqjOA== X-Received: by 2002:aa7:db4f:: with SMTP id n15mr6554053edt.193.1593513466210; Tue, 30 Jun 2020 03:37:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/4] hw/block/nvme: Update specification URL Date: Tue, 30 Jun 2020 12:37:36 +0200 Message-Id: <20200630103739.9715-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630103739.9715-1-philmd@redhat.com> References: <20200630103739.9715-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 01:11:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Maxim Levitsky , Keith Busch , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) At some point the URL changed, update it to avoid other developers to search for it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Klaus Jensen --- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 1aee042d4c..6628d0a4ba 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -11,7 +11,7 @@ /** * Reference Specs: http://www.nvmexpress.org, 1.2, 1.1, 1.0e * - * http://www.nvmexpress.org/resources/ + * https://nvmexpress.org/developers/nvme-specification/ */ =20 /** --=20 2.21.3 From nobody Fri Apr 26 18:03:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1593513602; cv=none; d=zohomail.com; s=zohoarc; b=NZiZ7EFECkmNV3yC+/toRhJd9EQJihe82gKL+5HCLNP4hZnuPGlP11tkNwzfmSm69P4vBnLu+WQppMObs8UKh9mxz1iXtETJaIscaQNcQoZ5nSdYhWNRKnHNveLeolLplNVHNTsKgLSVphp0xMcc4gsbQRfNjWXeCulT6Dh0h5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593513602; 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=fkTG7IRqJeN6JuoPScOrScaWci+d/p8pBXmsF88s47c=; b=X+N8wc8lztS7/vAX11eb1sfOlEDp2vIVUl347Y2eukX3Gyqtz5BkegSwj/fTkZHKlsysHo37gzWu8iKO37zF+UDXG4CyHF08xfMBfM8gAqVHzaAeP5pV7vesWQCwpn5kvwAAGkZyrjaDy0AFHWFqy0SZQL88ucf3bRz2hZjR2UA= 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 1593513602313689.2322343633758; Tue, 30 Jun 2020 03:40:02 -0700 (PDT) Received: from localhost ([::1]:36484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqDgH-00023M-0T for importer@patchew.org; Tue, 30 Jun 2020 06:40:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqDeG-0006dW-N6 for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:37:56 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:31256 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jqDeE-0002Gu-Tf for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:37:56 -0400 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-178-JiAy2ysDNgemFlI7voqe2A-1; Tue, 30 Jun 2020 06:37:52 -0400 Received: by mail-ed1-f71.google.com with SMTP id cn4so12307570edb.9 for ; Tue, 30 Jun 2020 03:37:52 -0700 (PDT) Received: from x1w.redhat.com (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id o21sm1681416eja.37.2020.06.30.03.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 03:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593513474; 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=fkTG7IRqJeN6JuoPScOrScaWci+d/p8pBXmsF88s47c=; b=FKNovLgdyGK/Mhm4xJDYHjvvXEoOqxrwsPT1u/hZZEQUUpE5ZvFaxQM/+qoXhW0EsDwJ9F pzndnU2Top/DHf56gLhX4YRDldB6oKlw4hPVbJhSQutwpr9viPJogPh9VcwRet57fmRg+8 aiTLwHwBmtJROlr5kFn7NVKJtCdtvYE= X-MC-Unique: JiAy2ysDNgemFlI7voqe2A-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=fkTG7IRqJeN6JuoPScOrScaWci+d/p8pBXmsF88s47c=; b=VPDF3VB9k7rnjZLLtss5jtPeeYR2DyFBOXwFuIdAuXvSF5OPjzr8Aj7iCWWNDG2605 umljhYoLulGH6TSvKlyCJVXTS1RAZ26mtChflukMvxzIlPnxdfUTVKKbydpG7K29jwPA jeubZOo3ve38GRF3zeHtKMrN0PnIGJBCWk1sEJCEEe/yEfsqMG1cVo+jqexcx5qcxMEv 3sTBXkFApwLpKFTAlactpTtr1wZSZi1chMGyw+79IkghfTon9SxsSMxjOSYXyfPEXuZt 210RHWaWwzOtYrHRENskZ7DcrJSg0UUZSv58O+vfook2EXGRmTTWFs0wHaO1HaPA/I4Z XD2Q== X-Gm-Message-State: AOAM5333htgodO9ir07LkXAx4lAomdAOSDa/sXNC7xH54kDefRCoa1Sp kG+UWO/WNIXZvJ+mmHJN9eXgad83/ccayJuUk6M2PsIvgfm0x8OumgcCRj5Tbq7CwSMpM2yhs+L QYSmueYavPh/ETpE= X-Received: by 2002:a05:6402:1246:: with SMTP id l6mr14572446edw.224.1593513471311; Tue, 30 Jun 2020 03:37:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMFIl2pDOGNN0g4EqTFUBNGH3wWqnwgJIJqtGgwOTn3uK4kVwV164AbFpzoxBwFuokz3Cwsg== X-Received: by 2002:a05:6402:1246:: with SMTP id l6mr14572430edw.224.1593513471162; Tue, 30 Jun 2020 03:37:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] hw/block/nvme: Use QEMU_PACKED on hardware/packet structures Date: Tue, 30 Jun 2020 12:37:37 +0200 Message-Id: <20200630103739.9715-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630103739.9715-1-philmd@redhat.com> References: <20200630103739.9715-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 01:11:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Maxim Levitsky , Keith Busch , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These structures either describe hardware registers, or commands ('packets') to send to the hardware. To forbid the compiler to optimize and change fields alignment, mark the structures as packed. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Klaus Jensen --- include/block/nvme.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 1720ee1d51..71c5681912 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1,7 +1,7 @@ #ifndef BLOCK_NVME_H #define BLOCK_NVME_H =20 -typedef struct NvmeBar { +typedef struct QEMU_PACKED NvmeBar { uint64_t cap; uint32_t vs; uint32_t intms; @@ -377,7 +377,7 @@ enum NvmePmrmscMask { #define NVME_PMRMSC_SET_CBA(pmrmsc, val) \ (pmrmsc |=3D (uint64_t)(val & PMRMSC_CBA_MASK) << PMRMSC_CBA_SHIFT) =20 -typedef struct NvmeCmd { +typedef struct QEMU_PACKED NvmeCmd { uint8_t opcode; uint8_t fuse; uint16_t cid; @@ -422,7 +422,7 @@ enum NvmeIoCommands { NVME_CMD_DSM =3D 0x09, }; =20 -typedef struct NvmeDeleteQ { +typedef struct QEMU_PACKED NvmeDeleteQ { uint8_t opcode; uint8_t flags; uint16_t cid; @@ -432,7 +432,7 @@ typedef struct NvmeDeleteQ { uint32_t rsvd11[5]; } NvmeDeleteQ; =20 -typedef struct NvmeCreateCq { +typedef struct QEMU_PACKED NvmeCreateCq { uint8_t opcode; uint8_t flags; uint16_t cid; @@ -449,7 +449,7 @@ typedef struct NvmeCreateCq { #define NVME_CQ_FLAGS_PC(cq_flags) (cq_flags & 0x1) #define NVME_CQ_FLAGS_IEN(cq_flags) ((cq_flags >> 1) & 0x1) =20 -typedef struct NvmeCreateSq { +typedef struct QEMU_PACKED NvmeCreateSq { uint8_t opcode; uint8_t flags; uint16_t cid; @@ -474,7 +474,7 @@ enum NvmeQueueFlags { NVME_Q_PRIO_LOW =3D 3, }; =20 -typedef struct NvmeIdentify { +typedef struct QEMU_PACKED NvmeIdentify { uint8_t opcode; uint8_t flags; uint16_t cid; @@ -486,7 +486,7 @@ typedef struct NvmeIdentify { uint32_t rsvd11[5]; } NvmeIdentify; =20 -typedef struct NvmeRwCmd { +typedef struct QEMU_PACKED NvmeRwCmd { uint8_t opcode; uint8_t flags; uint16_t cid; @@ -528,7 +528,7 @@ enum { NVME_RW_PRINFO_PRCHK_REF =3D 1 << 10, }; =20 -typedef struct NvmeDsmCmd { +typedef struct QEMU_PACKED NvmeDsmCmd { uint8_t opcode; uint8_t flags; uint16_t cid; @@ -547,7 +547,7 @@ enum { NVME_DSMGMT_AD =3D 1 << 2, }; =20 -typedef struct NvmeDsmRange { +typedef struct QEMU_PACKED NvmeDsmRange { uint32_t cattr; uint32_t nlb; uint64_t slba; @@ -569,14 +569,14 @@ enum NvmeAsyncEventRequest { NVME_AER_INFO_SMART_SPARE_THRESH =3D 2, }; =20 -typedef struct NvmeAerResult { +typedef struct QEMU_PACKED NvmeAerResult { uint8_t event_type; uint8_t event_info; uint8_t log_page; uint8_t resv; } NvmeAerResult; =20 -typedef struct NvmeCqe { +typedef struct QEMU_PACKED NvmeCqe { uint32_t result; uint32_t rsvd; uint16_t sq_head; @@ -634,7 +634,7 @@ enum NvmeStatusCodes { NVME_NO_COMPLETE =3D 0xffff, }; =20 -typedef struct NvmeFwSlotInfoLog { +typedef struct QEMU_PACKED NvmeFwSlotInfoLog { uint8_t afi; uint8_t reserved1[7]; uint8_t frs1[8]; @@ -647,7 +647,7 @@ typedef struct NvmeFwSlotInfoLog { uint8_t reserved2[448]; } NvmeFwSlotInfoLog; =20 -typedef struct NvmeErrorLog { +typedef struct QEMU_PACKED NvmeErrorLog { uint64_t error_count; uint16_t sqid; uint16_t cid; @@ -659,7 +659,7 @@ typedef struct NvmeErrorLog { uint8_t resv[35]; } NvmeErrorLog; =20 -typedef struct NvmeSmartLog { +typedef struct QEMU_PACKED NvmeSmartLog { uint8_t critical_warning; uint8_t temperature[2]; uint8_t available_spare; @@ -693,7 +693,7 @@ enum LogIdentifier { NVME_LOG_FW_SLOT_INFO =3D 0x03, }; =20 -typedef struct NvmePSD { +typedef struct QEMU_PACKED NvmePSD { uint16_t mp; uint16_t reserved; uint32_t enlat; @@ -713,7 +713,7 @@ enum { NVME_ID_CNS_NS_ACTIVE_LIST =3D 0x2, }; =20 -typedef struct NvmeIdCtrl { +typedef struct QEMU_PACKED NvmeIdCtrl { uint16_t vid; uint16_t ssvid; uint8_t sn[20]; @@ -807,7 +807,7 @@ enum NvmeFeatureIds { NVME_SOFTWARE_PROGRESS_MARKER =3D 0x80 }; =20 -typedef struct NvmeRangeType { +typedef struct QEMU_PACKED NvmeRangeType { uint8_t type; uint8_t attributes; uint8_t rsvd2[14]; @@ -817,13 +817,13 @@ typedef struct NvmeRangeType { uint8_t rsvd48[16]; } NvmeRangeType; =20 -typedef struct NvmeLBAF { +typedef struct QEMU_PACKED NvmeLBAF { uint16_t ms; uint8_t ds; uint8_t rp; } NvmeLBAF; =20 -typedef struct NvmeIdNs { +typedef struct QEMU_PACKED NvmeIdNs { uint64_t nsze; uint64_t ncap; uint64_t nuse; --=20 2.21.3 From nobody Fri Apr 26 18:03:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1593513546; cv=none; d=zohomail.com; s=zohoarc; b=dLKPKHwM7PPmkSzz0MUx9mOMOz4D8U7z9CP+bzPVjgkR6CFtNcJiSuySHD9pr9i7GHAjIf35dUVipwOENn5Zacz9+f22MnpF9yO4rk0gh+oBiiYP9UZ/jzWnwB+hrBWyh+DN+oR1NvYD4mchu8W3icmUUrNPXzW6S4ZxNluco7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593513546; 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=07ct4LP1waPEbEUp/nBsoiz2BrOfaHiWs7K68B/S55o=; b=VgVKgkuPPU9tQjUoT1W5AA2oelLxKv9GySUgaqf9JEdPkZf7jz3yT2aQJINvDok8hRlPaUfUlFtqinyVOc3plp9NYlMJMuneDcpzcLi07iCQB+AB5KHZ7KF/q+4DtnoifQIdJA1Y9l/w/r8UtwLpw7foNiCUXggDaIDAvNiNWJ0= 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 15935135468905.047725889493904; Tue, 30 Jun 2020 03:39:06 -0700 (PDT) Received: from localhost ([::1]:60050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqDfN-0008WH-LF for importer@patchew.org; Tue, 30 Jun 2020 06:39:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqDeL-0006pE-Du for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:38:01 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:55052 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jqDeK-0002IO-0g for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:38:01 -0400 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-491-LOvzEYUZNN-xBlMHzlVbCA-1; Tue, 30 Jun 2020 06:37:57 -0400 Received: by mail-ed1-f71.google.com with SMTP id d3so2875477edq.14 for ; Tue, 30 Jun 2020 03:37:57 -0700 (PDT) Received: from x1w.redhat.com (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id lj18sm1676744ejb.43.2020.06.30.03.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 03:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593513479; 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=07ct4LP1waPEbEUp/nBsoiz2BrOfaHiWs7K68B/S55o=; b=A4WrfqLEo0zxy/BVcb4BAAeduO/KQpYMT6CGRg31iae7j/qprk12D4ZJ0EBhg0MjP/K2Z1 02CLWxl3SnxKimzKoq8njeIN2JdFfAxMSSY4CR/6ZAkElDuDFuFhtg6Oc+EnFm50SNmaSE 8yYvfXNydJ0kkZT254rGs4fUexD17n4= X-MC-Unique: LOvzEYUZNN-xBlMHzlVbCA-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=07ct4LP1waPEbEUp/nBsoiz2BrOfaHiWs7K68B/S55o=; b=uOrQkbW8bzhviB0I4VMfO2PG/fHDYyppKCZKN/Y+hFD6Cgbom8K5VYs2rBbsD5p79R z+cugJ9virrQ4s/8VHThGnY6Vb/aIfqBeKiTuxks+DHak0LLzHxu7PzKxLRkPc+5H7g6 RKqNKcLDGPR+VEQXzTMZPYoOdWBdfN+wHugCmXHVC7eErb06kyuTu59ypPakbcqhbMUx Jc4ryk6TfYmnFHxD2HR7ozyPLs+Es42oDskA3SqPqYgYGCzVH0YS/W/DBrDVwYwx9gUR nefrzmeU+Us4DSQcdzt2WwXg4b1n+SN+6shz/5VawGVek41TMmBsd8HDo+SKVkcLmu4l aO5Q== X-Gm-Message-State: AOAM530NXpWJayPNVeIiD3aY3SQ8vUfl6ir+8LCyMBD32YCfrIf7JXHB M0YkzLvxGcVouUbgxGFTNgajavxk5BOSrC5dExp4LhvjbzikYOukuwdP3O0As8X1MEiysmI5zqH +Kuc3oNTi5XjwUcI= X-Received: by 2002:a50:f08c:: with SMTP id v12mr21817174edl.119.1593513476389; Tue, 30 Jun 2020 03:37:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRkx0DAQKnDdDHqoeNpSfMkF+Ch6VdicM4WS42wesTeAvNpntDA9EgVIswaL5NEQPKHS4CvQ== X-Received: by 2002:a50:f08c:: with SMTP id v12mr21817165edl.119.1593513476262; Tue, 30 Jun 2020 03:37:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 3/4] hw/block/nvme: Fix pmrmsc register size Date: Tue, 30 Jun 2020 12:37:38 +0200 Message-Id: <20200630103739.9715-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630103739.9715-1-philmd@redhat.com> References: <20200630103739.9715-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 02:00:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Maxim Levitsky , Klaus Jensen , Andrzej Jakowski , Keith Busch , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The Persistent Memory Region Controller Memory Space Control register is 64-bit wide. See 'Figure 68: Register Definition' of the 'NVM Express Base Specification Revision 1.4'. Fixes: 6cf9413229 ("introduce PMR support from NVMe 1.4 spec") Reported-by: Klaus Jensen Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Klaus Jensen --- Cc: Andrzej Jakowski Cc: Keith Busch --- include/block/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 71c5681912..82c384614a 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -21,7 +21,7 @@ typedef struct QEMU_PACKED NvmeBar { uint32_t pmrsts; uint32_t pmrebs; uint32_t pmrswtp; - uint32_t pmrmsc; + uint64_t pmrmsc; } NvmeBar; =20 enum NvmeCapShift { --=20 2.21.3 From nobody Fri Apr 26 18:03:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1593513715; cv=none; d=zohomail.com; s=zohoarc; b=CLAUYLCuG9cTkFWHeys4gaxCKzWck3hDroQJIjB98ZnLL/aYovFIbqUiXpwLxGE419k+9fjxzr3K1IFZ20pd7Ueec+rveQYVc/UNJSkAPTRvQomTMNMrylQhvKhNxoTOK8iQVY76DiOpbCyoJlLsfU2zGb0TTKsTkiRi1lRZibQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593513715; 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=KgE+8CKv6/Z+MnfgzHWSN8+i1Bas9SZKWAfL4wzjfr8=; b=Xx+/9MTLHGHcBfx2sZz+qHriAU5+SB4gqJDR0sritM9JlpMOioGJnc31NJcE/so0IR07iCPnadj10HVn+cHqox8sDIKhET9XSmA7LkfWD0isrSX3ENnW4WVbFtsaDdDCFphWP1QI9AvDyltyGVPRcY3Oz6o9+F+W0ycQxygEBKA= 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 159351371483438.618517944126665; Tue, 30 Jun 2020 03:41:54 -0700 (PDT) Received: from localhost ([::1]:41814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqDi5-0004PY-Jj for importer@patchew.org; Tue, 30 Jun 2020 06:41:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqDeR-00073X-8I for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:38:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35398 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jqDeP-0002Iz-C6 for qemu-devel@nongnu.org; Tue, 30 Jun 2020 06:38:06 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-0mQj0Sr6MNSNnRDR9ff6oQ-1; Tue, 30 Jun 2020 06:38:02 -0400 Received: by mail-ed1-f70.google.com with SMTP id v8so9794906edj.4 for ; Tue, 30 Jun 2020 03:38:02 -0700 (PDT) Received: from x1w.redhat.com (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id dh16sm2502594edb.3.2020.06.30.03.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 03:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593513484; 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=KgE+8CKv6/Z+MnfgzHWSN8+i1Bas9SZKWAfL4wzjfr8=; b=ho4ecY/zh7d/alrW/N2GkdozO2YhywosmXXrQPVIhME5nFJbUHZkhRMXg6CsHtUHE5rg8u uMvaZPLUegs2jAD1yeoPpkdco3JdaDNv1l97RzLrS+VuBgTrStXB+MWbb3Z9OIcBwz/yPU FNaDbv10C90sZcMk2mTAx1y6Lq31KHQ= X-MC-Unique: 0mQj0Sr6MNSNnRDR9ff6oQ-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=KgE+8CKv6/Z+MnfgzHWSN8+i1Bas9SZKWAfL4wzjfr8=; b=FNqL5QZGD26zNOzLTLHYPzz+TYT7dWpZ3KMsNQb05SIB6qeGi+VeAWkD5d+kUBKUSc 5oIDuYuat1UuHNTTvCOmzmp54HjgLjS8nMeiAIDvZ/LZe7DGUhxzJ3fC3k5OEixsAAlD 6Fvo+eegBykHyQlosnpGtmS94RiWnwMkjkvZTqDuxRvKiyM3dSlkM9BqF2jh7rk6MNvo zCapL8/oi/6NuNLGtAXOG9xHJWd99tRlaFTnXAcx+jE+t5abtObyMjRFkH1oDU0Ky1+S pt9aKWXcPQ2JDN2ZENLK4mbiXVxHb1lUFNkm70/pAvAhhOxoiDToUg7MyVOmXfshShUH g6sw== X-Gm-Message-State: AOAM530bQOP+5VfqI+f5qjCDu4J8US70lFmPi3T2s6LlniXP5hKlS+eP TZTKFTcwYeCSNOafglPm5injIVvzlSVra5nNbr7dUnZJF1bwPQnOkzRoNq12EsgHAiysBF+5I0X 1qexduku8ETwhDtI= X-Received: by 2002:a05:6402:c83:: with SMTP id cm3mr22989140edb.307.1593513481400; Tue, 30 Jun 2020 03:38:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9Gjnla44WQKSl8hAi+5QOLJIZe+8bMY69KPhOyBWZpg2+s2E51X17m/nWXutXHZi86V6A5A== X-Received: by 2002:a05:6402:c83:: with SMTP id cm3mr22989134edb.307.1593513481272; Tue, 30 Jun 2020 03:38:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/4] hw/block/nvme: Align I/O BAR to 4 KiB Date: Tue, 30 Jun 2020 12:37:39 +0200 Message-Id: <20200630103739.9715-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630103739.9715-1-philmd@redhat.com> References: <20200630103739.9715-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 03:55:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Maxim Levitsky , Keith Busch , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Simplify the NVMe emulated device by aligning the I/O BAR to 4 KiB. Reviewed-by: Klaus Jensen Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Do not include 'cmd_set_specfic' (Klaus) --- include/block/nvme.h | 2 ++ hw/block/nvme.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 82c384614a..4e1cea576a 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -22,6 +22,7 @@ typedef struct QEMU_PACKED NvmeBar { uint32_t pmrebs; uint32_t pmrswtp; uint64_t pmrmsc; + uint8_t reserved[484]; } NvmeBar; =20 enum NvmeCapShift { @@ -879,6 +880,7 @@ enum NvmeIdNsDps { =20 static inline void _nvme_check_size(void) { + QEMU_BUILD_BUG_ON(sizeof(NvmeBar) !=3D 4096); QEMU_BUILD_BUG_ON(sizeof(NvmeAerResult) !=3D 4); QEMU_BUILD_BUG_ON(sizeof(NvmeCqe) !=3D 16); QEMU_BUILD_BUG_ON(sizeof(NvmeDsmRange) !=3D 16); diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 6628d0a4ba..2aa54bc20e 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -55,7 +55,6 @@ #include "nvme.h" =20 #define NVME_MAX_IOQPAIRS 0xffff -#define NVME_REG_SIZE 0x1000 #define NVME_DB_SIZE 4 #define NVME_CMB_BIR 2 #define NVME_PMR_BIR 2 @@ -1322,7 +1321,7 @@ static void nvme_mmio_write(void *opaque, hwaddr addr= , uint64_t data, NvmeCtrl *n =3D (NvmeCtrl *)opaque; if (addr < sizeof(n->bar)) { nvme_write_bar(n, addr, data, size); - } else if (addr >=3D 0x1000) { + } else { nvme_process_db(n, addr, data); } } @@ -1416,7 +1415,7 @@ static void nvme_init_state(NvmeCtrl *n) { n->num_namespaces =3D 1; /* add one to max_ioqpairs to account for the admin queue pair */ - n->reg_size =3D pow2ceil(NVME_REG_SIZE + + n->reg_size =3D pow2ceil(sizeof(NvmeBar) + 2 * (n->params.max_ioqpairs + 1) * NVME_DB_SIZE= ); n->namespaces =3D g_new0(NvmeNamespace, n->num_namespaces); n->sq =3D g_new0(NvmeSQueue *, n->params.max_ioqpairs + 1); --=20 2.21.3