From nobody Mon Nov 17 12:05:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1603807047; cv=none; d=zohomail.com; s=zohoarc; b=P85S4h1vxCF98/Snq2gxvQB5TstqU3WkFiwJHqKRIUNg8iIoiVdmzeAoKDY4XVlLRhN6dqNgAZuPwmpRckhaFQmR3PVAj2QikDfel5NSiA56rMtZ+bUiHwPFddUSgbRfYLXqeFSiLcw8uIJ6/6/wVWqIKg++t+9PaIeimnRjTm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603807047; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=JEjEb5blaJCbCH8yHzb9rLLKFCJ8kP8Dq4wMBDtqfPA=; b=h0tNZjZndXtFN+rI5POnLxl9X0LMpCgurNgCk0uKz7Gkv7n07k+CxV/MtuuiYrhCPo5L3Xy/XLFA7bsWMPYVqK5oLj2srZbyk+zyz/5NMbqRR4FONy0nd9HAgFDBvTLhivMpJxQW0BWh0vViEhZAA2pzUoi4rZ7xl6pm7zsEoc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603807047421868.2631405879214; Tue, 27 Oct 2020 06:57:27 -0700 (PDT) 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-346-ul225ZHVN06wyQeEF2HuhA-1; Tue, 27 Oct 2020 09:57:23 -0400 Received: by mail-ej1-f71.google.com with SMTP id lf18so901638ejb.13 for ; Tue, 27 Oct 2020 06:57:23 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id ld2sm1090588ejb.94.2020.10.27.06.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807046; 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=JEjEb5blaJCbCH8yHzb9rLLKFCJ8kP8Dq4wMBDtqfPA=; b=QXaTIjgaY0bpynioBtUD0R7uXrbFr+mOwXxHRhl/bx/gMdktncy6db5L6PV6oIcPeMgJCc ct3kVJuS21JqrHzKyWDU0UxCur3e4dN893r+QgMRYgeCzbZ+gtrChvLoG/2J+zy8uLbvnP ArO5ZStfYOZn3t2Sjiu19ZugwIY4ig0= X-MC-Unique: ul225ZHVN06wyQeEF2HuhA-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=JEjEb5blaJCbCH8yHzb9rLLKFCJ8kP8Dq4wMBDtqfPA=; b=c0swpXDfr94PwVutLOPQU3P8zZ+zfjxn6GF81a+MceCyYJLEyDpsAFy0UgYdAqzn0M omneUQX2EonF1bITw2+vCRxJuC8/alH1cbSwWWEu+pamk6VS8yBFBLX44R+aay/sKeCo hI8gTRAtC2vQ1aCneysBOTWN7RZ36BJO9STpLS8Q680uRQZUNQ84vlpTmfNTtc2fQk9d jSVjxnyy1P0ivOLkbRNkBa9nhKyNHnDnTKjWwHvmlGRMtuMt/tBx5heH8fqrZpfcYusr q427N5B2WyFtFaUI34m05LN4tVbXelwP1qpk1AHUOzugJPpmj1MOSozPoc4B1KtenPhP dzxQ== X-Gm-Message-State: AOAM531D8NythVrvLtyjyL/a5RL0W88/wnicgTG8E7Q+d3FO6PztowTN +x2zG3mGnQfhZ2o0dQ3Kj5BY2LcflkSB6mOmRuNJNzjOTgQnCatQ1Tgpm1wWXveITGJ3P8c8NN2 9nu0YtAyl4Mye5Q== X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr2419632eds.379.1603807042128; Tue, 27 Oct 2020 06:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHzC8M0tCzJel8YX0kGF1EMexn+eDGjWUUDLUlYJfBpsXKZY4Rvx+F51v4fc4xwiZFIoshjg== X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr2419610eds.379.1603807041895; Tue, 27 Oct 2020 06:57:21 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Klaus Jensen , qemu-block@nongnu.org, Fam Zheng , Keith Busch , Eric Auger , Stefan Hajnoczi , Kevin Wolf , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 17/25] block/nvme: Simplify nvme_cmd_sync() Date: Tue, 27 Oct 2020 14:55:39 +0100 Message-Id: <20201027135547.374946-18-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-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" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) As all commands use the ADMIN queue, it is pointless to pass it as argument each time. Remove the argument. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Auger --- block/nvme.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 2d3648694b0..68f0c3f7959 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -487,9 +487,10 @@ static void nvme_cmd_sync_cb(void *opaque, int ret) aio_wait_kick(); } =20 -static int nvme_cmd_sync(BlockDriverState *bs, NVMeQueuePair *q, - NvmeCmd *cmd) +static int nvme_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd) { + BDRVNVMeState *s =3D bs->opaque; + NVMeQueuePair *q =3D s->queues[INDEX_ADMIN]; AioContext *aio_context =3D bdrv_get_aio_context(bs); NVMeRequest *req; int ret =3D -EINPROGRESS; @@ -534,7 +535,7 @@ static bool nvme_identify(BlockDriverState *bs, int nam= espace, Error **errp) =20 memset(id, 0, sizeof(*id)); cmd.dptr.prp1 =3D cpu_to_le64(iova); - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); goto out; } @@ -557,7 +558,7 @@ static bool nvme_identify(BlockDriverState *bs, int nam= espace, Error **errp) memset(id, 0, sizeof(*id)); cmd.cdw10 =3D 0; cmd.nsid =3D cpu_to_le32(namespace); - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify namespace"); goto out; } @@ -663,7 +664,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) .cdw10 =3D cpu_to_le32(((queue_size - 1) << 16) | n), .cdw11 =3D cpu_to_le32(NVME_CQ_IEN | NVME_CQ_PC), }; - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to create CQ io queue [%u]", n); goto out_error; } @@ -673,7 +674,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) .cdw10 =3D cpu_to_le32(((queue_size - 1) << 16) | n), .cdw11 =3D cpu_to_le32(NVME_SQ_PC | (n << 16)), }; - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to create SQ io queue [%u]", n); goto out_error; } @@ -889,7 +890,7 @@ static int nvme_enable_disable_write_cache(BlockDriverS= tate *bs, bool enable, .cdw11 =3D cpu_to_le32(enable ? 0x01 : 0x00), }; =20 - ret =3D nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd); + ret =3D nvme_cmd_sync(bs, &cmd); if (ret) { error_setg(errp, "Failed to configure NVMe write cache"); } --=20 2.26.2