From nobody Mon Feb 9 11:30:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599223314; cv=none; d=zohomail.com; s=zohoarc; b=JitksJQbX4quqxpQWMn87AYh94g7YYW8L/qfvEVGL/9RxI8ycmNKXkMuDfzvFrQUh8MHZmxnek7KBo89CJsYuXryfN1FRF09c4vh1EPnvuqKTz49aIi7PjVcAsSX0sR2BaC0n9DFq2Ecz0dnvFFzOCqNTfKPXxWul6E/qphqDNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599223314; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=vI7vDBHGjLnbO6/DwFRox42IeAyuzSp/xvHpN9rz7no=; b=CFvouEXOXlL/zt2QblLWrpJQv/eI3erOZb6v0bEpI0d+8OGdiascBVe4lledwgB3DfHIDZ3T1TpPERthVf6/DRptaaEtXBVuu3kOlD0NdRxWmTMpnIfHZgrqPLtkAIlpe9TBCk5bul26vHVghn4802yWZ7JBawrUh0CjOBMgCqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599223314929945.6677326753434; Fri, 4 Sep 2020 05:41:54 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-EaPgU-2AMjiPDyN3Ik5oyQ-1; Fri, 04 Sep 2020 08:41:49 -0400 Received: by mail-wm1-f70.google.com with SMTP id b14so1684386wmj.3 for ; Fri, 04 Sep 2020 05:41:49 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (50.red-83-52-54.dynamicip.rima-tde.net. [83.52.54.50]) by smtp.gmail.com with ESMTPSA id d18sm11184478wrm.10.2020.09.04.05.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 05:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599223314; 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=vI7vDBHGjLnbO6/DwFRox42IeAyuzSp/xvHpN9rz7no=; b=dXmHDVPJAjG22qMn7BL91d1Y0o4eXw4jCIhk8+er+ewZMS3MCPCkHsBlfyoyOhyr2iFt1q z93f65QsyRcBJxI34Jse8Ti69Yky01U5BNnF6VeakKi9Uu1SYr0sScpW9vaRLjxqyVjNwb Y3iwzxRc6+YzfGaoehHZBLoegcfOpQM= X-MC-Unique: EaPgU-2AMjiPDyN3Ik5oyQ-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=vI7vDBHGjLnbO6/DwFRox42IeAyuzSp/xvHpN9rz7no=; b=UzKbOWZEvETpVqNY8e3Bj+aeN+kf+SW3E8SXfFZ9eNI7v1AhPOfFa8Smmpe/44g86D kzQVyMrkP/9avrHMaJefqUvu5bGIB2L7PtHUrq7duI8eNA+jUfR/jRrOX7jGJ4/gQbF/ 3FTEYIua6J1NxrHk0dPUS1SHqH2qUV7IZWCKOhN6usccp+P5CjiZWUKhR57jxHlFMoW1 mZwndyeVSlpMsc/ZsOvsqFR+ZG2TGRfHYXJaSqE4SQMftGVwkKHFCSBkt3Loar/bykgC bxhN/sTob1jJnOJ4KJWzR2r73XYkxI636kzdBCN15nUyO9i8qoMDUmYi+ir1FPlt5jtU JT5w== X-Gm-Message-State: AOAM533xz/27fyzSOC5w3PSJfHVewvtNR9Jjnt+RAo6JyNoB4r7b5mAd mSG4ZExSOZUCDeOvBLRGDJWqVkZWWVHPChbADrzrezl6frWGjF3K+zpsF2FX+yyxX6vbVqOG/vZ NonxKBg15OD3xDQ== X-Received: by 2002:adf:f149:: with SMTP id y9mr7231681wro.93.1599223308695; Fri, 04 Sep 2020 05:41:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr2Oql+aA4tcJvUwjQLKvdfqF5/OyAsHprOOCST9QcoK61j4ErACC69/gxHO9HQERNTNQB3w== X-Received: by 2002:adf:f149:: with SMTP id y9mr7231675wro.93.1599223308554; Fri, 04 Sep 2020 05:41:48 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Klaus Jensen , qemu-block@nongnu.org, Kevin Wolf , Fam Zheng , Keith Busch , Stefan Hajnoczi , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/3] block/nvme: Pair doorbell registers Date: Fri, 4 Sep 2020 14:41:30 +0200 Message-Id: <20200904124130.583838-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200904124130.583838-1-philmd@redhat.com> References: <20200904124130.583838-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.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) For each queue doorbell registers are paired as: - Submission Queue Tail Doorbell - Completion Queue Head Doorbell Reflect that in the NVMeRegs structure, and adapt nvme_create_queue_pair() accordingly. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index a216cc407f6..f4f27b6da7d 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -84,7 +84,10 @@ typedef struct { /* Memory mapped registers */ typedef volatile struct { NvmeBar ctrl; - uint32_t doorbells[]; + struct { + uint32_t sq_tail; + uint32_t cq_head; + } doorbells[]; } NVMeRegs; =20 #define INDEX_ADMIN 0 @@ -244,14 +247,14 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMe= State *s, error_propagate(errp, local_err); goto fail; } - q->sq.doorbell =3D &s->regs->doorbells[idx * 2 * s->doorbell_scale]; + q->sq.doorbell =3D &s->regs->doorbells[idx * s->doorbell_scale].sq_tai= l; =20 nvme_init_queue(s, &q->cq, size, NVME_CQ_ENTRY_BYTES, &local_err); if (local_err) { error_propagate(errp, local_err); goto fail; } - q->cq.doorbell =3D &s->regs->doorbells[(idx * 2 + 1) * s->doorbell_sca= le]; + q->cq.doorbell =3D &s->regs->doorbells[idx * s->doorbell_scale].cq_hea= d; =20 return q; fail: --=20 2.26.2