From nobody Sat May 18 21:15:57 2024 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=1603964002; cv=none; d=zohomail.com; s=zohoarc; b=LMg3PzyvwVOGdCxOzgtM3//ylJWobs3vJOl57RgcUo7peshWo+IgqTCFiKzex7HZC51JW6aXPgajh6P9wsqRpE16I63El4XMYHjzO16kFLXm3zcbYcwH8lueRk86suGpsUY3yUgknAv1wfvPfoTmnmnzEUt54IlFZYJVAGq5Kws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964002; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=HzihUm8NymkiDBlfQBSISyvHHXOYy17rVLFGNCZADrc=; b=PZcd435rkKlqs1Q3xDT3XAjIvUtRCG6Uh5kioQeG9C9EVOABufB+xP/3k2CmiHW1bX/rWcShbj7XoX+URv3vdrE5LVorLUC+uS93nE/zGjUa+0jm0swIN1mkcCv0L2S9pY9KVGIBYau0IFPndPn2G3HGySj6AbgbT0wBZa+SerY= 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 1603964002458646.1999735517285; Thu, 29 Oct 2020 02:33:22 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-d5H-VX50OKCMfXcmYXaeWw-1; Thu, 29 Oct 2020 05:33:16 -0400 Received: by mail-ej1-f69.google.com with SMTP id z25so951920ejd.2 for ; Thu, 29 Oct 2020 02:33:16 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id y1sm1158610edj.76.2020.10.29.02.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964001; 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=HzihUm8NymkiDBlfQBSISyvHHXOYy17rVLFGNCZADrc=; b=aOpmvm06w1MceA2E0a+0b+Q7VFCO81dVwZT0oQsoG+pS5rJ1ScTDRWltykPn106kPykSXp xlsb6V0VQ5KZfOZSFs9JzzGISpQlyOoPu31eRnRXcsgv8EDE4RBgR0FZaj2NmcfyWHJsJY OlwaHgUNOVitoLyndRb187mqRvZJnFM= X-MC-Unique: d5H-VX50OKCMfXcmYXaeWw-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=HzihUm8NymkiDBlfQBSISyvHHXOYy17rVLFGNCZADrc=; b=bIdFilv7ye6l4pky+BafitkJmKqlythyJXI8D8AmzqcQ5Zl+KlSUQEYQ0aqWlC1lgL oMIUWH/nBCynpxGu/HCUDiW4+2kZ/hO6Jm++SpMjpX7aBZb1yt6RFmmk61WCjXGDA12a 5Ktuab57ZTyySlEwr1jgzfV1092lC6Xh1u/NRzUpwhEa81H1OGeQS51NDRwq3CeJvND0 xWNT13v6I57J+et15Tk9oSgJXa1Ql07ZWovmFxRe0KtXFsfS/B8xDqI8leXvULoo3XE1 EEG+ydEXTVvmHMXqWfaLQR7Gn1bxnjD8URABl1pk+uXI+Y83js3LfOla+XPp1j7Iqc2W dOmg== X-Gm-Message-State: AOAM533lpm9nxebQ2XCTBz/kUoWFvt86Gj5XH+NUJQbDoxEw08wjGtgI OMJInbmB/8gGsLUFOt4Kni9JuyleF/Sibp6QZHsO742wzGokwXakH+zmw9meu3GiwlgDHWHe/sJ ntgUt21KXlDR0dQ== X-Received: by 2002:aa7:c358:: with SMTP id j24mr3017551edr.265.1603963995215; Thu, 29 Oct 2020 02:33:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwXX6GI99gsy25MlesbEa8ZEq08SVfPqsuh/Pi4oyFh5uEmuxTK2+US3kHFJhWYla4MKGuKg== X-Received: by 2002:aa7:c358:: with SMTP id j24mr3017533edr.265.1603963995059; Thu, 29 Oct 2020 02:33:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Klaus Jensen Subject: [PATCH-for-5.2 v2 01/25] MAINTAINERS: Cover 'block/nvme.h' file Date: Thu, 29 Oct 2020 10:32:42 +0100 Message-Id: <20201029093306.1063879-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) The "block/nvme.h" header is shared by both the NVMe block driver and the NVMe emulated device. Add the 'F:' entry on both sections, so all maintainers/reviewers are notified when it is changed. Reviewed-by: Klaus Jensen Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7e442b52472..1289bccc972 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1876,6 +1876,7 @@ M: Klaus Jensen L: qemu-block@nongnu.org S: Supported F: hw/block/nvme* +F: include/block/nvme.h F: tests/qtest/nvme-test.c T: git git://git.infradead.org/qemu-nvme.git nvme-next =20 @@ -2959,6 +2960,7 @@ R: Fam Zheng L: qemu-block@nongnu.org S: Supported F: block/nvme* +F: include/block/nvme.h T: git https://github.com/stefanha/qemu.git block =20 Bootdevice --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964004; cv=none; d=zohomail.com; s=zohoarc; b=OLalLNPSRS8GEIkJWipldYS/LfxAmZ0K1EBSBCXuNWqkOZmyss3QxMgH+ZtaTW4SBHcBW6xZHw/vvscXjEhtxpvKC/agn7F09MWLHRKebAUhjRmfk+yUpQCUzxrKYT6t4aArnCwkiRXPi6SzFo/R3N8giDKgXBlI4hNdb7M8ACY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964004; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/iwpBUyVm11cIWEap1iOuTMpnwVQgkzK5ulnL1uzeS8=; b=Cdglo8oBKGCvLnIwNm0ZDnfr6EUOpAifg+bbLmTfpeCutcBI4s+gq2gillYnry6SABQWkKXSgaHlndtl8GRHyTnvpvXFOuwkd8w+/baVCx1GtQKPLje9pbMDV9dcxGzE2boB5y1fi/nhpNneS8EQ2RVtqBRhmcAE5o+uQ4CQgB0= 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 160396400480693.59264280272328; Thu, 29 Oct 2020 02:33:24 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-Fc15GyYzNReUSdyBsCUfIA-1; Thu, 29 Oct 2020 05:33:21 -0400 Received: by mail-ej1-f70.google.com with SMTP id z9so936534ejg.10 for ; Thu, 29 Oct 2020 02:33:21 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id e14sm1170048ejc.15.2020.10.29.02.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964003; 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=/iwpBUyVm11cIWEap1iOuTMpnwVQgkzK5ulnL1uzeS8=; b=N2uK52qpJDGHHvNNfQAfmv1Ke0N3IG9Ecu98CwZamatgsw2w/O4nDP8t0yfVjIZU0X5IAV S/6GKDmzk31hlOAp2DmHZ8bQAqkuVKTsXGAZO6wG4aGhykh31pS0sCTE63dUUM0vaqHorF dk+bwj7642k251QUiN97X0FrS7GcDEY= X-MC-Unique: Fc15GyYzNReUSdyBsCUfIA-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=/iwpBUyVm11cIWEap1iOuTMpnwVQgkzK5ulnL1uzeS8=; b=JnBgQtSt3EOVnlfITUKODbcvmKqBaxpi+HlxCI/iOVP6WPf48y/McsQxSowEAYVvdy LWzLPmQpy/Lv/aMeQSSkc+6ajoeshjGJNbO2K1zxt+fq1Wv6ZGX34gl6AeyNMsCjlsa1 ZEDNO/UsM6EFNW+h2FkachhgvAMFk4P9iEEo+EjTYYoKSL/jyx7lcI18Dc03KZ5UDici z2aRc7H8XaE7FPA9p2HsV7C4rX8DQ9VdC4iEQ3/2R5S+ubmtiiJhqv8oLBKtDiVm1xDV TgbQiez8O/D5UMElm/LBjCZQh0koGT5MpNmlaHrf/TOZjgSbteQf8ie1oulLinoQPy/c KG/Q== X-Gm-Message-State: AOAM532rwlldG7WdCxu9ocXr+UFXdDtvQGMRpIG1P+i5gtOREgWxI7F+ mCioek0d4OVqhvV927kUTbNbIuByjN4yTX4yGj/Gvw/koKJZcagSrcHWoLwJJWdCFc1uF21Bn4i wThlDA62/C1/7yQ== X-Received: by 2002:aa7:c68b:: with SMTP id n11mr2903231edq.340.1603964000425; Thu, 29 Oct 2020 02:33:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd9Y8hKZV4slTVUtEz8KDCwuGq5dGIoeff9nHapDqnvlJpaa0B5kAJ5yY0eat74Q20PwHb9A== X-Received: by 2002:aa7:c68b:: with SMTP id n11mr2903216edq.340.1603964000288; Thu, 29 Oct 2020 02:33:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 02/25] block/nvme: Use hex format to display offset in trace events Date: Thu, 29 Oct 2020 10:32:43 +0100 Message-Id: <20201029093306.1063879-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Use the same format used for the hw/vfio/ trace events. Suggested-by: Eric Auger Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/trace-events | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/trace-events b/block/trace-events index 0e351c3fa3d..0955c85c783 100644 --- a/block/trace-events +++ b/block/trace-events @@ -144,13 +144,13 @@ nvme_submit_command(void *s, int index, int cid) "s %= p queue %d cid %d" nvme_submit_command_raw(int c0, int c1, int c2, int c3, int c4, int c5, in= t c6, int c7) "%02x %02x %02x %02x %02x %02x %02x %02x" nvme_handle_event(void *s) "s %p" nvme_poll_cb(void *s) "s %p" -nvme_prw_aligned(void *s, int is_write, uint64_t offset, uint64_t bytes, i= nt flags, int niov) "s %p is_write %d offset %"PRId64" bytes %"PRId64" flag= s %d niov %d" -nvme_write_zeroes(void *s, uint64_t offset, uint64_t bytes, int flags) "s = %p offset %"PRId64" bytes %"PRId64" flags %d" +nvme_prw_aligned(void *s, int is_write, uint64_t offset, uint64_t bytes, i= nt flags, int niov) "s %p is_write %d offset 0x%"PRIx64" bytes %"PRId64" fl= ags %d niov %d" +nvme_write_zeroes(void *s, uint64_t offset, uint64_t bytes, int flags) "s = %p offset 0x%"PRIx64" bytes %"PRId64" flags %d" nvme_qiov_unaligned(const void *qiov, int n, void *base, size_t size, int = align) "qiov %p n %d base %p size 0x%zx align 0x%x" -nvme_prw_buffered(void *s, uint64_t offset, uint64_t bytes, int niov, int = is_write) "s %p offset %"PRId64" bytes %"PRId64" niov %d is_write %d" -nvme_rw_done(void *s, int is_write, uint64_t offset, uint64_t bytes, int r= et) "s %p is_write %d offset %"PRId64" bytes %"PRId64" ret %d" -nvme_dsm(void *s, uint64_t offset, uint64_t bytes) "s %p offset %"PRId64" = bytes %"PRId64"" -nvme_dsm_done(void *s, uint64_t offset, uint64_t bytes, int ret) "s %p off= set %"PRId64" bytes %"PRId64" ret %d" +nvme_prw_buffered(void *s, uint64_t offset, uint64_t bytes, int niov, int = is_write) "s %p offset 0x%"PRIx64" bytes %"PRId64" niov %d is_write %d" +nvme_rw_done(void *s, int is_write, uint64_t offset, uint64_t bytes, int r= et) "s %p is_write %d offset 0x%"PRIx64" bytes %"PRId64" ret %d" +nvme_dsm(void *s, uint64_t offset, uint64_t bytes) "s %p offset 0x%"PRIx64= " bytes %"PRId64"" +nvme_dsm_done(void *s, uint64_t offset, uint64_t bytes, int ret) "s %p off= set 0x%"PRIx64" bytes %"PRId64" ret %d" nvme_dma_map_flush(void *s) "s %p" nvme_free_req_queue_wait(void *q) "q %p" nvme_cmd_map_qiov(void *s, void *cmd, void *req, void *qiov, int entries) = "s %p cmd %p req %p qiov %p entries %d" --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964009; cv=none; d=zohomail.com; s=zohoarc; b=cC3CVdnxyp4cELYPcR+6uJGxMOhuKOXEohCXulMM5WK8IYYeIU+DToTLeY91jOUgqwuy6ClCIPKWKJg3i9xVdVZrov6ryxGIYcHlOdfHsDLSMw52JE+CAJaqRw7Ba+v1/jSVMp5RZtCc7zo9Rjg1u9DOFL0WueaJpAcc6xtJ3A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964009; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=hraDvgDvE6lqUS9SKN8n1vi9r/o4Ua52Hm0UVRZeM1o=; b=XGctz+NlfnTtjHjA4x+yLxqUiouZcZ/ARRjDwP2ayK9mvkSCyP0oh1DIz8wrz/9zrUZeLpmtd4cdH+6irG30bvJtR4LRLvKvld1aW5+oHfxCA/rSXXMRNLrEBhPNdwCIH77CSpMKwEmnkqBv8rhU7kc3mv6xkNtTlCE23KwINoY= 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 160396400982458.39175426330553; Thu, 29 Oct 2020 02:33:29 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-588-eyJJdw2WP1KeEvg99ZDsMA-1; Thu, 29 Oct 2020 05:33:27 -0400 Received: by mail-ej1-f69.google.com with SMTP id z8so948141ejw.3 for ; Thu, 29 Oct 2020 02:33:26 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id os11sm1126198ejb.104.2020.10.29.02.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964008; 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=hraDvgDvE6lqUS9SKN8n1vi9r/o4Ua52Hm0UVRZeM1o=; b=iJ2dyWzFTjVEQgiS1FiRm1E2T30op/zRGDz17DjilV6r1Klbq7kQA8bPSNuXMekd782m9q zw9yKNlBhpikrvQZln17inMC+Iu3ccv2CxxDWPtJiylMaQWR4LcKdOy82cobvbLihLNwR5 u8yfkeNvr1AyI716IVlwVeY9HtVKEDU= X-MC-Unique: eyJJdw2WP1KeEvg99ZDsMA-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=hraDvgDvE6lqUS9SKN8n1vi9r/o4Ua52Hm0UVRZeM1o=; b=hQTmvI9Te9VBoP4wsMBcgl2GmNyntLp/A/Kz80CsNVF5AcOTOnl67TZjc9gNfEdm5H S7VN2yiRHQCUV9OpDffSlz9yUN76e1oR30YBmbsBFebvo8Ebcs9SiA2GBNnDEnKwE2KN /C30ATjlhJp4YuKecz84R10J4fPjA417kGfUo8GjohlCINl7GnG7rKj64wBd2KQwgHKM y7jBF1LbA/xCvS4UWpO2gVBqppZtYC3YWiUUkk0mSs2eCn80tkt5VFTqWCm702gGVfhJ QSVBMyZmz+FE/jbE3HgJW8GQ6gEo0qnlwnl4+pg4j31d2d7R8mFK2v8qh3GTPOF0c4D+ q6Sw== X-Gm-Message-State: AOAM533X/38GY8POKwJlr1UN1S5mHhDnzcGmpWDC4jVOGNh0b6jAeO7v 5pwTJOprpccMlHbHEvlILhx50IvJLM+4KqyReLtu2gkPUelOlXbCcRIooNVZxqLwR5wR2KldpQ4 Lg8ca/oXQugYYeg== X-Received: by 2002:a17:906:68cd:: with SMTP id y13mr2995399ejr.230.1603964005694; Thu, 29 Oct 2020 02:33:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL1Mrs2QuCn8mg3yOsAVD6nuPyNXSDBC6f2UKIVtsts6WHymgLL6DoCvIlNkMGzbLsgAAvtA== X-Received: by 2002:a17:906:68cd:: with SMTP id y13mr2995386ejr.230.1603964005494; Thu, 29 Oct 2020 02:33:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 03/25] block/nvme: Report warning with warn_report() Date: Thu, 29 Oct 2020 10:32:44 +0100 Message-Id: <20201029093306.1063879-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Instead of displaying warning on stderr, use warn_report() which also displays it on the monitor. Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 739a0a700cb..6f1d7f9b2a1 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -399,8 +399,8 @@ static bool nvme_process_completion(NVMeQueuePair *q) } cid =3D le16_to_cpu(c->cid); if (cid =3D=3D 0 || cid > NVME_QUEUE_SIZE) { - fprintf(stderr, "Unexpected CID in completion queue: %" PRIu32= "\n", - cid); + warn_report("NVMe: Unexpected CID in completion queue: %"PRIu3= 2", " + "queue size: %u", cid, NVME_QUEUE_SIZE); continue; } trace_nvme_complete_command(s, q->index, cid); --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964015; cv=none; d=zohomail.com; s=zohoarc; b=QFWTGPs5yiv0Nrdg2Hn+n33y3afW3p9pF0dQ64Q+Eq/Vd5g3nUSA8HgALbNnJ6MbnVUzU9cnSEC/Qa4+gagqj2bAuLsBmxCV4BlaAZyEHMGdKZ/pedjrGNgs2VisZLeQt+3TgyHqlMCXHY960ETBcnYHd4y2pEGpeenK9mU/Dgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964015; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=8OTYCQauWLqy/pYJjIYbS2aJ8PCndAOeGCZKOtfKeEs=; b=gI0Y95L8F5AOGvWbMB5j3JEsEPrTthHcO5MJIELFwfwK/pxFoOSK0kXnwmXqdJCvHD7syCFhfTB7XFXr3hyDNN+4n2tAD3k9x1/7DYEkA1IBtgzWSWmngsjJsv2QBTXY/WUwbmEP6YmX2ixN7rNxZHmDcQKWUNlqiWyJessqzGU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964015215870.833666147126; Thu, 29 Oct 2020 02:33:35 -0700 (PDT) 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-135-oqbarvp0Ms-ZD_D2AntAzg-1; Thu, 29 Oct 2020 05:33:32 -0400 Received: by mail-ed1-f70.google.com with SMTP id dk5so930506edb.20 for ; Thu, 29 Oct 2020 02:33:32 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id z18sm378105ejf.41.2020.10.29.02.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964014; 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=8OTYCQauWLqy/pYJjIYbS2aJ8PCndAOeGCZKOtfKeEs=; b=NckW2u9gF93EyL1uU1v/mM2XCbeOBCCggA51Vlz+GIVKcoR3SQ77DdL4q1CxVST+49kLgp lC+4DKmZJqjIolc6g7J6+TGX0YkMdLjgJHkRRAvIndAfYabfJkhRFsXnkLVKlo1nkJvv80 XvxDTYCXIgeVe+4umNLyyx3kIfH1oIk= X-MC-Unique: oqbarvp0Ms-ZD_D2AntAzg-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=8OTYCQauWLqy/pYJjIYbS2aJ8PCndAOeGCZKOtfKeEs=; b=HIpFI0D7LR1hT6RqeTUY4k89oJfoMi2uAqeQRPXCo7I4BWLBpCmmY6VklVORRGEJpT FmuY+P5SFLBlkpjZYvA402tgAANTrZssCDZI/qTJcIPvuQGuarVNDNTJ69aVLrBYfEAe uCct0mCg4V75i5gXwkY9GBKBLVGgNT7/YA3rO5hVFrHfLJEBI1r5S2CSeIHoOx2ckyNQ NvddQU9SDyiYTHwZqKLSnI+tIM2IlfoYvrK/RMSnlXwb9G3PE661A4bbKBEC6x5rrCoh nvOFX4BGQ224cchLPsG2bMq9E9tIV6nMORI/N111DSwNSPEG/EbyKl2eba+DwplQ2z9l ZP2Q== X-Gm-Message-State: AOAM533ok9442nTICtYWzLZZuoB999ZLv8E/L5g9P94NIq8YKzuS5vRY MzcPOV/GY/9Yqi6jq3c6lqFv48K/FgTV7yFZiZiTnh3+Y7gtI4tS+/zkBsy2WPK3veVGQ0m9Ly5 qrRptPgpXSAYBGg== X-Received: by 2002:a05:6402:3056:: with SMTP id bu22mr2970997edb.252.1603964011017; Thu, 29 Oct 2020 02:33:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNGB271VNY8YtLI//fo52gK1aTdhRzFjRvhd88T54f99mHfTTD3TOoj5UU1sgoncKt2f7mlQ== X-Received: by 2002:a05:6402:3056:: with SMTP id bu22mr2970984edb.252.1603964010863; Thu, 29 Oct 2020 02:33:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 04/25] block/nvme: Trace controller capabilities Date: Thu, 29 Oct 2020 10:32:45 +0100 Message-Id: <20201029093306.1063879-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Controllers have different capabilities and report them in the CAP register. We are particularly interested by the page size limits. Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 13 +++++++++++++ block/trace-events | 2 ++ 2 files changed, 15 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 6f1d7f9b2a1..361b5772b7a 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -727,6 +727,19 @@ static int nvme_init(BlockDriverState *bs, const char = *device, int namespace, * Initialization". */ =20 cap =3D le64_to_cpu(regs->cap); + trace_nvme_controller_capability_raw(cap); + trace_nvme_controller_capability("Maximum Queue Entries Supported", + 1 + NVME_CAP_MQES(cap)); + trace_nvme_controller_capability("Contiguous Queues Required", + NVME_CAP_CQR(cap)); + trace_nvme_controller_capability("Doorbell Stride", + 2 << (2 + NVME_CAP_DSTRD(cap))); + trace_nvme_controller_capability("Subsystem Reset Supported", + NVME_CAP_NSSRS(cap)); + trace_nvme_controller_capability("Memory Page Size Minimum", + 1 << (12 + NVME_CAP_MPSMIN(cap))); + trace_nvme_controller_capability("Memory Page Size Maximum", + 1 << (12 + NVME_CAP_MPSMAX(cap))); if (!NVME_CAP_CSS(cap)) { error_setg(errp, "Device doesn't support NVMe command set"); ret =3D -EINVAL; diff --git a/block/trace-events b/block/trace-events index 0955c85c783..b90b07b15fa 100644 --- a/block/trace-events +++ b/block/trace-events @@ -134,6 +134,8 @@ qed_aio_write_postfill(void *s, void *acb, uint64_t sta= rt, size_t len, uint64_t qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t le= n) "s %p acb %p ret %d offset %"PRIu64" len %zu" =20 # nvme.c +nvme_controller_capability_raw(uint64_t value) "0x%08"PRIx64 +nvme_controller_capability(const char *desc, uint64_t value) "%s: %"PRIu64 nvme_kick(void *s, int queue) "s %p queue %d" nvme_dma_flush_queue_wait(void *s) "s %p" nvme_error(int cmd_specific, int sq_head, int sqid, int cid, int status) "= cmd_specific %d sq_head %d sqid %d cid %d status 0x%x" --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964022; cv=none; d=zohomail.com; s=zohoarc; b=cBk2NpPkf1+Ydu75KjZxxH7d5xlWlv1ufWSylcUnqFZFhdClUXuxVp6LcwJy9bIco7/xYCrZGPgUi5KsjegMfJyebF7eFL88CfoRoys33NjKIUgxPUiy18j5Ls38PP3MsBCahZC8pQOCmt8kdRLDQA/tOAzNXSyzwi7EsnWn8TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964022; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=cs1C0obG4nToPrEZSg1uNXVjaS/D+BwTncjleFbCDLw=; b=KmLrQ16ab+pL5UvOMX8DxOnhlrWZQdk9Z5rd6ZwdiDOXSxAqIQKe8cB9dH7FpO46emxBTSy87Art2QB/yP0aaGEC3H/KO4qsVqJq7f8wXbnh5MASWBJe1JfviqZjZ9A4Ug5Jxb4G6Lpsbub8ydhKxH6CbgAed/HLClmY4zxZlZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964022801384.6464088348664; Thu, 29 Oct 2020 02:33:42 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-nl-jHuBwO7aZ123vaGqDWw-1; Thu, 29 Oct 2020 05:33:37 -0400 Received: by mail-ej1-f72.google.com with SMTP id b17so929292ejb.20 for ; Thu, 29 Oct 2020 02:33:37 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id d24sm1163692edq.34.2020.10.29.02.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964021; 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=cs1C0obG4nToPrEZSg1uNXVjaS/D+BwTncjleFbCDLw=; b=bPa57C0/jDxvyyRIZnFb5WmL3M48Ize6sVvdGl3irDLek8o8FpE2iawWbsLE4q9RGq1zMk gkrfv+NR9QbP2w3G1Y5JJbAnTc3CdKOhPaRK8r9abtbIr+unMROforwz+4xfW4tyBxEEL1 m6OsEwi4idvBp5n0fFHx7g0TKzv1XKI= X-MC-Unique: nl-jHuBwO7aZ123vaGqDWw-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=cs1C0obG4nToPrEZSg1uNXVjaS/D+BwTncjleFbCDLw=; b=Gmii8b1775YbmkFY2dYif4+/ZrpCBhwuUWRI4prPJtx2fkcosi0HowT/L/uKLpZkh9 X3ZwCuMSngIU3Q5vZrn9giPfROvOYdxV+x1QtXPNQ50PpiI2OmmRJNoVls7gJ1NTwDnT wU1F49lGv5r/WZeXEgOrWxVI+OMvE/M3j2OceQeTHfZ2Myp1gf3dV42FOhTmXgzY7SpX IAmb6+sehH4i9pJ8wL8SEDkqJGCgdBI+8wmAKlMdXHOXUeS8JB33Y4Z0Zs77120z0+sF tu3ve9QzznNGMVdmVrGWHji/RYdgkrVSJza6lezrvgiuMY/kOcwc8YPY9Y2Skkd7Ozrm 4vfQ== X-Gm-Message-State: AOAM530jFEeU60oQK/4svFO46JRnrHxBhwvzc6Nyp/74AbSF+WbLdjk/ Whg2xrdcfGKhyc5cBIQelvL7bid7QmsMjd8GNVGx7m3fWQbOWt1J1GHEH/uPCBzIuzNKuZC7NFL G4+pGnEtfjEaGRg== X-Received: by 2002:a17:906:1989:: with SMTP id g9mr1528544ejd.62.1603964016494; Thu, 29 Oct 2020 02:33:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBI0FYASgwJnrVETq5oEFCOqMrX+j4zrUx/mZmzqhHhAAQ31wYwUzNeRp/NjdnFvFxuh3Xjg== X-Received: by 2002:a17:906:1989:: with SMTP id g9mr1528523ejd.62.1603964016282; Thu, 29 Oct 2020 02:33:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 05/25] block/nvme: Trace nvme_poll_queue() per queue Date: Thu, 29 Oct 2020 10:32:46 +0100 Message-Id: <20201029093306.1063879-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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 we want to enable multiple queues, report the event in each nvme_poll_queue() call, rather than once in the callback calling nvme_poll_queues(). Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 2 +- block/trace-events | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 361b5772b7a..8d74401ae7a 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -594,6 +594,7 @@ static bool nvme_poll_queue(NVMeQueuePair *q) const size_t cqe_offset =3D q->cq.head * NVME_CQ_ENTRY_BYTES; NvmeCqe *cqe =3D (NvmeCqe *)&q->cq.queue[cqe_offset]; =20 + trace_nvme_poll_queue(q->s, q->index); /* * Do an early check for completions. q->lock isn't needed because * nvme_process_completion() only runs in the event loop thread and @@ -684,7 +685,6 @@ static bool nvme_poll_cb(void *opaque) BDRVNVMeState *s =3D container_of(e, BDRVNVMeState, irq_notifier[MSIX_SHARED_IRQ_IDX]); =20 - trace_nvme_poll_cb(s); return nvme_poll_queues(s); } =20 diff --git a/block/trace-events b/block/trace-events index b90b07b15fa..86292f3312b 100644 --- a/block/trace-events +++ b/block/trace-events @@ -145,7 +145,7 @@ nvme_complete_command(void *s, int index, int cid) "s %= p queue %d cid %d" nvme_submit_command(void *s, int index, int cid) "s %p queue %d cid %d" nvme_submit_command_raw(int c0, int c1, int c2, int c3, int c4, int c5, in= t c6, int c7) "%02x %02x %02x %02x %02x %02x %02x %02x" nvme_handle_event(void *s) "s %p" -nvme_poll_cb(void *s) "s %p" +nvme_poll_queue(void *s, unsigned q_index) "s %p q #%u" nvme_prw_aligned(void *s, int is_write, uint64_t offset, uint64_t bytes, i= nt flags, int niov) "s %p is_write %d offset 0x%"PRIx64" bytes %"PRId64" fl= ags %d niov %d" nvme_write_zeroes(void *s, uint64_t offset, uint64_t bytes, int flags) "s = %p offset 0x%"PRIx64" bytes %"PRId64" flags %d" nvme_qiov_unaligned(const void *qiov, int n, void *base, size_t size, int = align) "qiov %p n %d base %p size 0x%zx align 0x%x" --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964026; cv=none; d=zohomail.com; s=zohoarc; b=SjzLZUlz9D5AtY4xi02UJyIGa2pk7zIKWpawehfxmkeayeMmDnsWIlj1NJXTBaua/IZHh+r7ADprA0t2ZBH+MPArvYKIUfEdLMfevWwFOTClCeD0ku5Zsb5DY8LlrpU450xO93DtyRgKmdn2kAfd9M50OZZwO0pXiaTn/NhVvSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964026; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/V2bopfrgs5z9fXdSqKgAQr3mfETDBQSgYOoqY9Jixw=; b=mp6/zSBNvGa8oHPHd7qed6EFjvoZtisJWMb2kOU3IuOPWYdSJp6GIZilS5u4omZ8S++ZnyN2rrEMFuJGt/cM/j2QL12lwHZ3apiPF+9Devx/hfDUtA7Js/1G/6HPTsEZGH4YSRLSuu7KYZYvbrTw8E6sgrYGg308sl8RnbgNDvE= 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 1603964026723488.41990246476564; Thu, 29 Oct 2020 02:33:46 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-gfMvf3CKMsuKGSFMQFa7hw-1; Thu, 29 Oct 2020 05:33:43 -0400 Received: by mail-ej1-f72.google.com with SMTP id x12so918613eju.22 for ; Thu, 29 Oct 2020 02:33:42 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id x2sm1176316edr.65.2020.10.29.02.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964025; 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=/V2bopfrgs5z9fXdSqKgAQr3mfETDBQSgYOoqY9Jixw=; b=HMJwztie6yqZ2oBGfIcEZbwyQyVq8RjijRhiet9pLHhLnDb/5fxdFTP8NhBFTB7ZNXcfWO LmnZxUBcnX2CFfo9Dhq01xXIupKB401DrB/yadVX24aqgLk45WTVkDeQm2EIW60Jwyn4sY +LW+ExVOi65vm1VofLpBGf8Kgecuw5g= X-MC-Unique: gfMvf3CKMsuKGSFMQFa7hw-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=/V2bopfrgs5z9fXdSqKgAQr3mfETDBQSgYOoqY9Jixw=; b=V/lM647rWn66t244Pce71B4PQLDuDL0/vQ2UcrhvcTHlMFjI7y2oU2Qb4Q+rxxOk3I ePr8AlKhjRWUoJyR2ox6PBhyuXSvg0BfGHj3GlO21pWOXZ+dyh/l3mcSyumCKxbtcAXq 2m2/XxR2dnBbLzl5iRS1+wNfK6OKDE4f/b7BGK2HvUjbg41pZ6rKni+AB3xcuTcBZ7Z3 T28dh25JNnTttlwdUxASbKPO3QLzlU6jkLuWQpeTqYhLr4OJDCvZDEzUkRQAoQmgejyT PTdUnxNrRFikZb4mFWcTup/l7YZRADUGtBj4iEizmE8+RoaHA7GmgiIiVdPl1DgUlsQt QeVg== X-Gm-Message-State: AOAM532tcf/CayN3tzzNsSfHIJ5FfWGJHgebtEaoW6aoPFI9gxW3SuqR Qj6+qDtKYX/yizGLpAGqY5PMDwM3+SUPp/0uv9EvPvb+eYNG5tsfs1cjFZjHk3VuVWgQpmbx/4B nrSbZIiqADLr4JA== X-Received: by 2002:aa7:c792:: with SMTP id n18mr2975746eds.209.1603964021762; Thu, 29 Oct 2020 02:33:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYpESBUBbOB5lW/BGGS4fuMQ3uYbb/gclHdzF0P/kIYuQNRO6rAfDaJcaq0s9OfNJKAYveQQ== X-Received: by 2002:aa7:c792:: with SMTP id n18mr2975728eds.209.1603964021606; Thu, 29 Oct 2020 02:33:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 06/25] block/nvme: Improve nvme_free_req_queue_wait() trace information Date: Thu, 29 Oct 2020 10:32:47 +0100 Message-Id: <20201029093306.1063879-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) What we want to trace is the block driver state and the queue index. Suggested-by: Stefan Hajnoczi Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 2 +- block/trace-events | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 8d74401ae7a..29d2541b911 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -292,7 +292,7 @@ static NVMeRequest *nvme_get_free_req(NVMeQueuePair *q) =20 while (q->free_req_head =3D=3D -1) { if (qemu_in_coroutine()) { - trace_nvme_free_req_queue_wait(q); + trace_nvme_free_req_queue_wait(q->s, q->index); qemu_co_queue_wait(&q->free_req_queue, &q->lock); } else { qemu_mutex_unlock(&q->lock); diff --git a/block/trace-events b/block/trace-events index 86292f3312b..cc5e2b55cb5 100644 --- a/block/trace-events +++ b/block/trace-events @@ -154,7 +154,7 @@ nvme_rw_done(void *s, int is_write, uint64_t offset, ui= nt64_t bytes, int ret) "s nvme_dsm(void *s, uint64_t offset, uint64_t bytes) "s %p offset 0x%"PRIx64= " bytes %"PRId64"" nvme_dsm_done(void *s, uint64_t offset, uint64_t bytes, int ret) "s %p off= set 0x%"PRIx64" bytes %"PRId64" ret %d" nvme_dma_map_flush(void *s) "s %p" -nvme_free_req_queue_wait(void *q) "q %p" +nvme_free_req_queue_wait(void *s, unsigned q_index) "s %p q #%u" nvme_cmd_map_qiov(void *s, void *cmd, void *req, void *qiov, int entries) = "s %p cmd %p req %p qiov %p entries %d" nvme_cmd_map_qiov_pages(void *s, int i, uint64_t page) "s %p page[%d] 0x%"= PRIx64 nvme_cmd_map_qiov_iov(void *s, int i, void *page, int pages) "s %p iov[%d]= %p pages %d" --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964031; cv=none; d=zohomail.com; s=zohoarc; b=Ihr3swFJ2rzl/cwyRoktOpixx/2g7wH4eE3HFB7fNf926OHE6Ef3vH2TwMoggorD+r/1mHuioZzYI4JCMeFUy9kZ8rsqrlDZT4pz+hMzzJXOD7Xxj1LE1qRQC1mF3KZXrgaiQSzbxjmzSajWLGMoLF6URLHpJcs5IDXncuuqn1c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964031; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=EBb5GrRIOVLLA2GDg9frMwfzobl3y/7Xq37zU2+GEk8=; b=hFlhcMjoM/oWGCzQJerCJ22T0EJnXudDwcR7sGDTmDfuq2OICK73ABHdGcL9izimJgJbm1cU+DPuWEnnwX8s2NA88tQ0EarkgpO7aJE0IqLkwY3YbBteY2g2Bst4BaQ9pPVOGZ78geJpusGvQpiAcLToyDbZbEIIHhbgipNidOU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964031043737.3832321217565; Thu, 29 Oct 2020 02:33:51 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-307-0yLjxToUPImDddy3Q_H0gA-1; Thu, 29 Oct 2020 05:33:48 -0400 Received: by mail-ej1-f70.google.com with SMTP id t1so923028ejb.21 for ; Thu, 29 Oct 2020 02:33:47 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id j20sm1184367edt.4.2020.10.29.02.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964030; 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=EBb5GrRIOVLLA2GDg9frMwfzobl3y/7Xq37zU2+GEk8=; b=fK6t4ldTLnsIUojM9BdKo85YWSRKbkkEqtS1Ub/OXA9wXkaF+RpRphGgXAwqbB+1Zpxwb/ m2mhiIOV+3dAHrRkFy4x2Gj5cgg9IqcLOO/ygbjMaeynF9e3cLnlzMIxktut8pKRtHwoVE 09pxQBzTDb6tqXC6IkvGMD/wrnEPyAc= X-MC-Unique: 0yLjxToUPImDddy3Q_H0gA-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=EBb5GrRIOVLLA2GDg9frMwfzobl3y/7Xq37zU2+GEk8=; b=HxtuW5S6K6GlqzoRkhdTQPhpBgiDM713fa2bhn+5xz0EcI6KQRSw4aAW1QslTcuGpI NCeQGpVXcpkkCLEwB8lwCoa2WbXW5xJMpdPKL8FFqRJ4REXjxvHP4B2IWsIui/ZuhbzU TV0VF7gf6cAt0wmIcPJN5aTw0RF/zOYubsmFsvSWr7AjXnPBlMYlfgnIJL5oKKzGEXje 2wCzi1zXIEHDSiIfR3XHaSfE+pPyu+nLKTrdW8UcLckFObovrkKBOYDdVnAPRAowTZVD OeMYV5PaXNi+1UMPCZl9mfRYfXfICXQ9iDpSgi9qa3XviRSyOhsaVb57id5YAD7oeInq w33w== X-Gm-Message-State: AOAM533Kc5LvkIHf5hUXkf49XFiiWZEMzpfqmvo/VQeYFML/NQUV6oDl CdvzlQRrU7hRHjg1F95h1jliraml3QTAA93t4SOYV1FMG6bQERjL4l09+eeyARAWDIC8CXGwAtx VJg7IBWDH5vzSJg== X-Received: by 2002:a17:906:7210:: with SMTP id m16mr3319989ejk.490.1603964026928; Thu, 29 Oct 2020 02:33:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwimITMNtQ8O1OpBtiouA1FKrkJa7uHuXVtHe9G82z1AC8mSDLoBSF94Qk2MLwKAL7koIYlpw== X-Received: by 2002:a17:906:7210:: with SMTP id m16mr3319980ejk.490.1603964026799; Thu, 29 Oct 2020 02:33:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 07/25] block/nvme: Trace queue pair creation/deletion Date: Thu, 29 Oct 2020 10:32:48 +0100 Message-Id: <20201029093306.1063879-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 29d2541b911..e95d59d3126 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -181,6 +181,7 @@ static void nvme_init_queue(BDRVNVMeState *s, NVMeQueue= *q, =20 static void nvme_free_queue_pair(NVMeQueuePair *q) { + trace_nvme_free_queue_pair(q->index, q); if (q->completion_bh) { qemu_bh_delete(q->completion_bh); } @@ -216,6 +217,8 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, if (!q) { return NULL; } + trace_nvme_create_queue_pair(idx, q, size, aio_context, + event_notifier_get_fd(s->irq_notifier)); q->prp_list_pages =3D qemu_try_memalign(s->page_size, s->page_size * NVME_NUM_REQS); if (!q->prp_list_pages) { diff --git a/block/trace-events b/block/trace-events index cc5e2b55cb5..f6a0f99df1a 100644 --- a/block/trace-events +++ b/block/trace-events @@ -155,6 +155,8 @@ nvme_dsm(void *s, uint64_t offset, uint64_t bytes) "s %= p offset 0x%"PRIx64" byte nvme_dsm_done(void *s, uint64_t offset, uint64_t bytes, int ret) "s %p off= set 0x%"PRIx64" bytes %"PRId64" ret %d" nvme_dma_map_flush(void *s) "s %p" nvme_free_req_queue_wait(void *s, unsigned q_index) "s %p q #%u" +nvme_create_queue_pair(unsigned q_index, void *q, unsigned size, void *aio= _context, int fd) "index %u q %p size %u aioctx %p fd %d" +nvme_free_queue_pair(unsigned q_index, void *q) "index %u q %p" nvme_cmd_map_qiov(void *s, void *cmd, void *req, void *qiov, int entries) = "s %p cmd %p req %p qiov %p entries %d" nvme_cmd_map_qiov_pages(void *s, int i, uint64_t page) "s %p page[%d] 0x%"= PRIx64 nvme_cmd_map_qiov_iov(void *s, int i, void *page, int pages) "s %p iov[%d]= %p pages %d" --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964037; cv=none; d=zohomail.com; s=zohoarc; b=hJvI9IuAjYslClw4Xxr1QaW5Z1ck2IJ0ls+yCHxzBA0XTLJOtqbpi2QdOnPagsoqnLtKXopjup4r1oOVaOkM5++plhPAPHEEobOmZbxoRz7xMvu9hcMIogTvXU7sHfYNYSDcsV/bafUohhkomYf1ahJy0c24cS5xqR1hTVn51eA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964037; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=LNTJ5igNyyXKkWieXTvLU2UcanJIdRIlRwN2Ir3xgfg=; b=mezrV8mbnNkpxIzO9qo2VU1OD137PVtpze/hF0ppF97Z/QGVfh6w3HMtRbuZlkDuczJESi8DCRaVWeW0fsyrl8qIg/KwD0Vnglx1PsZ09HYJLw2Mb9/T2st0YU/P5b53gXu4QHPmnk3PRrBgZZ19FkuuJs+T7Uh1FRfgYazwkrs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964037150897.9911348347805; Thu, 29 Oct 2020 02:33:57 -0700 (PDT) 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-203-TcysfZalMw-5_yp3CfAtsQ-1; Thu, 29 Oct 2020 05:33:53 -0400 Received: by mail-ed1-f71.google.com with SMTP id dm20so954597edb.2 for ; Thu, 29 Oct 2020 02:33:53 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id b24sm398626edt.68.2020.10.29.02.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964035; 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=LNTJ5igNyyXKkWieXTvLU2UcanJIdRIlRwN2Ir3xgfg=; b=W+k5ly2z5WEO6YzbzhoViamrwRB2FeBaH4EZg0U0XXefZP8rnrVeft52Yz/gWf0/kyv80B 1TMGPtT1Td3MgbudDtQjbXK42zZ6A/9kmXlBwke1nSYEgaOlSOO5c/GKkDq72nQhIYOg2k /BEKy5Ls0Ry6EfJI4kY84BmSJXwYMnQ= X-MC-Unique: TcysfZalMw-5_yp3CfAtsQ-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=LNTJ5igNyyXKkWieXTvLU2UcanJIdRIlRwN2Ir3xgfg=; b=p6PGnfgVywonzWGSpITxvjNoJQeAdgZkoRP/mxdc0ZwrfDcBe6LBYsjqyE0sy5ghX/ 2JYNMlwV5eRuW1Clj/3qXgLBIzRppRCqnbnp4gegXfnRnynni/LnXJxlaXBTkPLrMoej uWl5ml7klyzoiIkpwuRpgORLPYD9cHEIzFdMsjb2SqDEUhZZZfE2hJ03qU5X6y+mIcov 7P4F3spkwB5qoWgBKMjSJc5lzwAy6cEP857bge6kKGTSZblpKNXh6nTMSf2HQwgEFyZY 8X4ENPnzh7PTRWO70NP/6r6WH/Ga185+7an4KjLjqVzLZbR/ACsXHIrMx68K2ZZYYuxM vTvA== X-Gm-Message-State: AOAM5325W2pHTn4YhIbh5nW9oNPgu0x9c7kWO6T0ZQf/B0hCdRfetu39 rPMxGaAw7h0hUuxWGmPa5/x0AZQrqftzgte/PXXBKGpqhw+f2h3rNugqHgzLq62hU1SrXDLAhr6 +e7jxUvcVpBhbAw== X-Received: by 2002:a17:906:f148:: with SMTP id gw8mr518345ejb.192.1603964032301; Thu, 29 Oct 2020 02:33:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztTl+bsWy4FrmaMCFpQbfLGLKKcnQIg2bTntM3tBGkLjyLF1s0qLKsE7iZ9jsaLp8s9OC3/A== X-Received: by 2002:a17:906:f148:: with SMTP id gw8mr518331ejb.192.1603964032094; Thu, 29 Oct 2020 02:33:52 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 08/25] block/nvme: Move definitions before structure declarations Date: Thu, 29 Oct 2020 10:32:49 +0100 Message-Id: <20201029093306.1063879-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) To be able to use some definitions in structure declarations, move them earlier. No logical change. Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index e95d59d3126..b0629f5de80 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -41,6 +41,16 @@ =20 typedef struct BDRVNVMeState BDRVNVMeState; =20 +/* Same index is used for queues and IRQs */ +#define INDEX_ADMIN 0 +#define INDEX_IO(n) (1 + n) + +/* This driver shares a single MSIX IRQ for the admin and I/O queues */ +enum { + MSIX_SHARED_IRQ_IDX =3D 0, + MSIX_IRQ_COUNT =3D 1 +}; + typedef struct { int32_t head, tail; uint8_t *queue; @@ -81,15 +91,6 @@ typedef struct { QEMUBH *completion_bh; } NVMeQueuePair; =20 -#define INDEX_ADMIN 0 -#define INDEX_IO(n) (1 + n) - -/* This driver shares a single MSIX IRQ for the admin and I/O queues */ -enum { - MSIX_SHARED_IRQ_IDX =3D 0, - MSIX_IRQ_COUNT =3D 1 -}; - struct BDRVNVMeState { AioContext *aio_context; QEMUVFIOState *vfio; --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964043; cv=none; d=zohomail.com; s=zohoarc; b=P6WdDgTtJ0DUvSZIc6HcGSWLoBt6dLMIn/g53rYwKfiydZHBzfFj6nRPvFHymXZ8AgBO84W8Etx3vlFqW3tDKIyYDtT7rG1dpYjRtSVXYv9S/TIqynRXUXTqVwWsktQG/iri6trbe5ATX7tTO7RdI4dMk4pYxQTugUqnEs+kefo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964043; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=JbCLCh2QwnhtqrPps05dA+PCf5WKH0hmY19HFhGchDk=; b=ByCWwJCAU03SyKxWp60YQcailvsyp4IU0F7MG1l5LOwxNkKBB9YXRJ2MJYdx+wM78Ug4X6RRYIGCCPRBtEWTuDotJV9h+pCHt75FcAFL/VHh3y/EjVWVTyX0qEynpBfKTNlwPwzAZaABmoAt3TS838vVcRmVRVrR9bBh1YSTb5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964043995600.7420018279863; Thu, 29 Oct 2020 02:34:03 -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-431-v0v5TktFNXaUuGpLmgjNdA-1; Thu, 29 Oct 2020 05:33:59 -0400 Received: by mail-ej1-f71.google.com with SMTP id x12so918832eju.22 for ; Thu, 29 Oct 2020 02:33:58 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id m20sm1180120edq.16.2020.10.29.02.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964043; 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=JbCLCh2QwnhtqrPps05dA+PCf5WKH0hmY19HFhGchDk=; b=SGGxCyJPis96ojbmEHt08cD1Vm2hNHEQxJoF3vXc3twwHNBIqUjAAU0ILzYg6XtUXoA0NO 7oWbm3iX1rISr7cJtb7XUtBBJsjNcMF/fIbjHsPfqLdJi1/g6zVsah4HBxQot6ocSHPNLy AfXWMthi/U1v3h2hyH6RPf9+t3O2jWQ= X-MC-Unique: v0v5TktFNXaUuGpLmgjNdA-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=JbCLCh2QwnhtqrPps05dA+PCf5WKH0hmY19HFhGchDk=; b=SRXnUHTWpiP8OnC9GGlTPjXq55X0wyjAnklNtzca3iN3O2VRihKQ4YdZp9usgrZrMg sy3ll+IFQt4JapGStdqtN9deqSX1p9bA1q9ckyIZ6Eo3fKeM0VmKXIImmpCqpK9NHbec H0DnKJZijnbpkfn306v3qLY+HEc9nb7Gt29UFyaEVhYks69Cqql0U4Ve/dRAaWTky/vR I9iQZTqy4hR5cCdQnzdVoliNQcwm9PQUIVQLEJtCBmPaO2bkQPJVrt883hNBnR5QryQD T46y7f+vOVA+E4CUwQrmFHAkE77VHIq73Ibu363gm24L//WJ9qFy3LeOKw0riW38sZik kiKg== X-Gm-Message-State: AOAM531rwIvVHByQxfCEFgKr0gn5dzEic7YdE2tjJvoUxI23C/PUZ09F nXPFKzRN7QqvMTiM2XK1nfeSDmolUPZKRE/0DnrkKUrekQPoAE/WiJbqcbq/P0Eq8plQ9PTKN/b q9n+ga7wUuDIX8g== X-Received: by 2002:aa7:d495:: with SMTP id b21mr2864649edr.231.1603964037658; Thu, 29 Oct 2020 02:33:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8RI/W8+eeUHv6rqdvFaXOPRMeMIt5JGcuoO5gG28fNCEiftgVjHEV70j9TsCew5xH5p1tkQ== X-Received: by 2002:aa7:d495:: with SMTP id b21mr2864629edr.231.1603964037415; Thu, 29 Oct 2020 02:33:57 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 09/25] block/nvme: Use unsigned integer for queue counter/size Date: Thu, 29 Oct 2020 10:32:50 +0100 Message-Id: <20201029093306.1063879-10-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) We can not have negative queue count/size/index, use unsigned type. Rename 'nr_queues' as 'queue_count' to match the spec naming. Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 38 ++++++++++++++++++-------------------- block/trace-events | 10 +++++----- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index b0629f5de80..c450499111e 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -104,7 +104,7 @@ struct BDRVNVMeState { * [1..]: io queues. */ NVMeQueuePair **queues; - int nr_queues; + unsigned queue_count; size_t page_size; /* How many uint32_t elements does each doorbell entry take. */ size_t doorbell_scale; @@ -161,7 +161,7 @@ static QemuOptsList runtime_opts =3D { }; =20 static void nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q, - int nentries, int entry_bytes, Error **errp) + unsigned nentries, size_t entry_bytes, Error *= *errp) { size_t bytes; int r; @@ -206,7 +206,7 @@ static void nvme_free_req_queue_cb(void *opaque) =20 static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, AioContext *aio_context, - int idx, int size, + unsigned idx, size_t size, Error **errp) { int i, r; @@ -623,7 +623,7 @@ static bool nvme_poll_queues(BDRVNVMeState *s) bool progress =3D false; int i; =20 - for (i =3D 0; i < s->nr_queues; i++) { + for (i =3D 0; i < s->queue_count; i++) { if (nvme_poll_queue(s->queues[i])) { progress =3D true; } @@ -644,10 +644,10 @@ static void nvme_handle_event(EventNotifier *n) static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) { BDRVNVMeState *s =3D bs->opaque; - int n =3D s->nr_queues; + unsigned n =3D s->queue_count; NVMeQueuePair *q; NvmeCmd cmd; - int queue_size =3D NVME_QUEUE_SIZE; + unsigned queue_size =3D NVME_QUEUE_SIZE; =20 q =3D nvme_create_queue_pair(s, bdrv_get_aio_context(bs), n, queue_size, errp); @@ -661,7 +661,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) .cdw11 =3D cpu_to_le32(0x3), }; if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { - error_setg(errp, "Failed to create CQ io queue [%d]", n); + error_setg(errp, "Failed to create CQ io queue [%u]", n); goto out_error; } cmd =3D (NvmeCmd) { @@ -671,12 +671,12 @@ static bool nvme_add_io_queue(BlockDriverState *bs, E= rror **errp) .cdw11 =3D cpu_to_le32(0x1 | (n << 16)), }; if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { - error_setg(errp, "Failed to create SQ io queue [%d]", n); + error_setg(errp, "Failed to create SQ io queue [%u]", n); goto out_error; } s->queues =3D g_renew(NVMeQueuePair *, s->queues, n + 1); s->queues[n] =3D q; - s->nr_queues++; + s->queue_count++; return true; out_error: nvme_free_queue_pair(q); @@ -785,7 +785,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, ret =3D -EINVAL; goto out; } - s->nr_queues =3D 1; + s->queue_count =3D 1; QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000); regs->aqa =3D cpu_to_le32((NVME_QUEUE_SIZE << AQA_ACQS_SHIFT) | (NVME_QUEUE_SIZE << AQA_ASQS_SHIFT)); @@ -895,10 +895,9 @@ static int nvme_enable_disable_write_cache(BlockDriver= State *bs, bool enable, =20 static void nvme_close(BlockDriverState *bs) { - int i; BDRVNVMeState *s =3D bs->opaque; =20 - for (i =3D 0; i < s->nr_queues; ++i) { + for (unsigned i =3D 0; i < s->queue_count; ++i) { nvme_free_queue_pair(s->queues[i]); } g_free(s->queues); @@ -1123,7 +1122,7 @@ static coroutine_fn int nvme_co_prw_aligned(BlockDriv= erState *bs, }; =20 trace_nvme_prw_aligned(s, is_write, offset, bytes, flags, qiov->niov); - assert(s->nr_queues > 1); + assert(s->queue_count > 1); req =3D nvme_get_free_req(ioq); assert(req); =20 @@ -1233,7 +1232,7 @@ static coroutine_fn int nvme_co_flush(BlockDriverStat= e *bs) .ret =3D -EINPROGRESS, }; =20 - assert(s->nr_queues > 1); + assert(s->queue_count > 1); req =3D nvme_get_free_req(ioq); assert(req); nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data); @@ -1285,7 +1284,7 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockDr= iverState *bs, cmd.cdw12 =3D cpu_to_le32(cdw12); =20 trace_nvme_write_zeroes(s, offset, bytes, flags); - assert(s->nr_queues > 1); + assert(s->queue_count > 1); req =3D nvme_get_free_req(ioq); assert(req); =20 @@ -1328,7 +1327,7 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverS= tate *bs, return -ENOTSUP; } =20 - assert(s->nr_queues > 1); + assert(s->queue_count > 1); =20 buf =3D qemu_try_memalign(s->page_size, s->page_size); if (!buf) { @@ -1408,7 +1407,7 @@ static void nvme_detach_aio_context(BlockDriverState = *bs) { BDRVNVMeState *s =3D bs->opaque; =20 - for (int i =3D 0; i < s->nr_queues; i++) { + for (unsigned i =3D 0; i < s->queue_count; i++) { NVMeQueuePair *q =3D s->queues[i]; =20 qemu_bh_delete(q->completion_bh); @@ -1429,7 +1428,7 @@ static void nvme_attach_aio_context(BlockDriverState = *bs, aio_set_event_notifier(new_context, &s->irq_notifier[MSIX_SHARED_IRQ_I= DX], false, nvme_handle_event, nvme_poll_cb); =20 - for (int i =3D 0; i < s->nr_queues; i++) { + for (unsigned i =3D 0; i < s->queue_count; i++) { NVMeQueuePair *q =3D s->queues[i]; =20 q->completion_bh =3D @@ -1446,11 +1445,10 @@ static void nvme_aio_plug(BlockDriverState *bs) =20 static void nvme_aio_unplug(BlockDriverState *bs) { - int i; BDRVNVMeState *s =3D bs->opaque; assert(s->plugged); s->plugged =3D false; - for (i =3D INDEX_IO(0); i < s->nr_queues; i++) { + for (unsigned i =3D INDEX_IO(0); i < s->queue_count; i++) { NVMeQueuePair *q =3D s->queues[i]; qemu_mutex_lock(&q->lock); nvme_kick(q); diff --git a/block/trace-events b/block/trace-events index f6a0f99df1a..8368f4acb0b 100644 --- a/block/trace-events +++ b/block/trace-events @@ -136,13 +136,13 @@ qed_aio_write_main(void *s, void *acb, int ret, uint6= 4_t offset, size_t len) "s # nvme.c nvme_controller_capability_raw(uint64_t value) "0x%08"PRIx64 nvme_controller_capability(const char *desc, uint64_t value) "%s: %"PRIu64 -nvme_kick(void *s, int queue) "s %p queue %d" +nvme_kick(void *s, unsigned q_index) "s %p q #%u" nvme_dma_flush_queue_wait(void *s) "s %p" nvme_error(int cmd_specific, int sq_head, int sqid, int cid, int status) "= cmd_specific %d sq_head %d sqid %d cid %d status 0x%x" -nvme_process_completion(void *s, int index, int inflight) "s %p queue %d i= nflight %d" -nvme_process_completion_queue_plugged(void *s, int index) "s %p queue %d" -nvme_complete_command(void *s, int index, int cid) "s %p queue %d cid %d" -nvme_submit_command(void *s, int index, int cid) "s %p queue %d cid %d" +nvme_process_completion(void *s, unsigned q_index, int inflight) "s %p q #= %u inflight %d" +nvme_process_completion_queue_plugged(void *s, unsigned q_index) "s %p q #= %u" +nvme_complete_command(void *s, unsigned q_index, int cid) "s %p q #%u cid = %d" +nvme_submit_command(void *s, unsigned q_index, int cid) "s %p q #%u cid %d" nvme_submit_command_raw(int c0, int c1, int c2, int c3, int c4, int c5, in= t c6, int c7) "%02x %02x %02x %02x %02x %02x %02x %02x" nvme_handle_event(void *s) "s %p" nvme_poll_queue(void *s, unsigned q_index) "s %p q #%u" --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964049; cv=none; d=zohomail.com; s=zohoarc; b=Bi0e+S16JiK8UGqgvbrRgapx4HJ43QDvFR1HiyHkr+XE3RLla8KNcQT06RpZj6mVCdN0trRXpeQniREkmniP5ZUQvsmaUSY/8VpbVVAjwA6bGGGZ2C08GUTo3rLwetgwKwioMbaqbha6+H+jtU707C+20NniPBnfeOgwx/vEj4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964049; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=C+MwM4zuNe+rNYGXGpfeK41VSib34xtRzDIP8WoYZOs=; b=XarmvSX0mPOHtAQcnlu3U9vP3Vdj53DPStiwspJbbpf/Bu4Gn/x51lzS6i3uEnbA3aLWhpsjUl1RtygDjGWhMJVl8r3JFiE366bN4VumYyZtr0JwNecYjJkLry8mz9iA1BF5k7uhZFNjCruIFdzayMvpQ0LyqoFtMG4F0Qv0zqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964049365476.57380442311273; Thu, 29 Oct 2020 02:34:09 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-fVGFlS2VNamqlQN4rj19RQ-1; Thu, 29 Oct 2020 05:34:04 -0400 Received: by mail-ej1-f69.google.com with SMTP id f11so918159eja.23 for ; Thu, 29 Oct 2020 02:34:04 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id k26sm1166658edf.85.2020.10.29.02.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964048; 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=C+MwM4zuNe+rNYGXGpfeK41VSib34xtRzDIP8WoYZOs=; b=T0LxP+Hub2oDOqnuMNCLj/y3U5tGd+VHmOwPLw3pA/isG8JMMX397FfqWqrFL/95xzDidZ tKNM1wyw3GUU0DrCe411YclmD28dOu61w+1qEreBIwe62PKQgw4etzHrtrCY+9BJHmGQCB M4E4IxRprO7W/jtWclu5qDi8iB7v/V8= X-MC-Unique: fVGFlS2VNamqlQN4rj19RQ-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=C+MwM4zuNe+rNYGXGpfeK41VSib34xtRzDIP8WoYZOs=; b=INDnXYrHrk2pxVmS4HAj4ULl9dn5o1Hhs7hj25/LnO1llx6bfqGcipTdjMU8KP4uJU 1+8sGJx4iUnPOadLIUD0R81ZgkV/d5QisOMHbD711FyCtZiOm5pR+eFvJJwouMa2aVKD MDIX8QKK/PsSK8U4XKkZWxpeIo0xmFLyp15vlcFS6eP40a6kDoBS1KZYmayCC53r5jPo m2LmP3of10OVHNB5VmfPx48JKyEEbJuGac38L9V+B7NHWGnkSf9brDkphO1S5F8aOkHr cuUBbOe/jyBX/D+Jj5JE9a0ySpzYWHtFuLmLi0EkXxWvbop3t8wELPxnTOQ+PBYXAeF3 MxQw== X-Gm-Message-State: AOAM531fauxSOndRh0O2DuZ0xQ6vQGYYZx0jNXVodtYsZVrW7wVdIFUB zcqgSOJr2PDvIAAayvKCu7hYiGJ0mwrFBQK+UXRKfqrIkOgxliQJADRDCO6G401t9jGKHB3TXij XR3LfHnpUnAedIg== X-Received: by 2002:a50:8125:: with SMTP id 34mr3152139edc.39.1603964043060; Thu, 29 Oct 2020 02:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF4kkM/D9J7bCjTQpyvr3ZD4e+DAev94YnVBvQHSdQCIOAaI9hOoQR1Cw/w4IUExJsIfzPKQ== X-Received: by 2002:a50:8125:: with SMTP id 34mr3152120edc.39.1603964042834; Thu, 29 Oct 2020 02:34:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 10/25] block/nvme: Make nvme_identify() return boolean indicating error Date: Thu, 29 Oct 2020 10:32:51 +0100 Message-Id: <20201029093306.1063879-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Just for consistency, following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), return a boolean value indicating an error is set or not. Directly pass errp as the local_err is not requested in our case. Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index c450499111e..98335012457 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -506,9 +506,11 @@ static int nvme_cmd_sync(BlockDriverState *bs, NVMeQue= uePair *q, return ret; } =20 -static void nvme_identify(BlockDriverState *bs, int namespace, Error **err= p) +/* Returns true on success, false on failure. */ +static bool nvme_identify(BlockDriverState *bs, int namespace, Error **err= p) { BDRVNVMeState *s =3D bs->opaque; + bool ret =3D false; union { NvmeIdCtrl ctrl; NvmeIdNs ns; @@ -585,10 +587,13 @@ static void nvme_identify(BlockDriverState *bs, int n= amespace, Error **errp) goto out; } =20 + ret =3D true; s->blkshift =3D lbaf->ds; out: qemu_vfio_dma_unmap(s->vfio, id); qemu_vfree(id); + + return ret; } =20 static bool nvme_poll_queue(NVMeQueuePair *q) @@ -701,7 +706,6 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, uint64_t cap; uint64_t timeout_ms; uint64_t deadline, now; - Error *local_err =3D NULL; volatile NvmeBar *regs =3D NULL; =20 qemu_co_mutex_init(&s->dma_map_lock); @@ -818,9 +822,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, &s->irq_notifier[MSIX_SHARED_IRQ_IDX], false, nvme_handle_event, nvme_poll_cb); =20 - nvme_identify(bs, namespace, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!nvme_identify(bs, namespace, errp)) { ret =3D -EIO; goto out; } --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964052; cv=none; d=zohomail.com; s=zohoarc; b=fYVdXsCeBQ4/7Bw+jqyvHJaME78pg27zfinPIvz6QbaW79dU0WrtxrxkHmAAaYVpEcEV7OUyDuXBxC1f6Cp4Hzg9wEpcqUud+wYrzWOwXoxrFgwk+0kFTpuefxAtwbHBvCXFQlC1W+UW2X3tXPIsKFoJNKkPwMuSFeX+hp00gUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964052; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=kaU4zZuJB4tESn4H6GCPctUQ4pXRnoC4EnBxMdQNjsg=; b=G86O5Psr4Sn7Du4Cxx45gmDY5RP6UDEK4bROQ5D0j81VYP4WQTpmTsGa74lZ0JuCpy6+we6HCd38VqUXwPImOHOPgCTyDJYZlPeeXPNI2dS3KUrmTosDhAJEoVh3G0YZUJIbeUpZYjxHs1PdRrY0SerHIXI8nqrV75rbE7AFt30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964052798817.2062349503032; Thu, 29 Oct 2020 02:34:12 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-6ajdRTbFMOGCHYggcYKfzw-1; Thu, 29 Oct 2020 05:34:09 -0400 Received: by mail-ej1-f72.google.com with SMTP id lf18so934804ejb.13 for ; Thu, 29 Oct 2020 02:34:09 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id v2sm1134551ejh.57.2020.10.29.02.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964051; 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=kaU4zZuJB4tESn4H6GCPctUQ4pXRnoC4EnBxMdQNjsg=; b=Cg5uRFWqOQAwrfYSnxEX26TGHaNuCV0osUcgeFtPPjcJ2o/lXkhqF/hQnABjcnXgb43eEM mrHhJn3zO14ojJ3KilXOIc/scm5TzCVcIkrPpcZZCP6hILg8FlQmGxclyzIbAI2Vq5RBHr R+VfHpcuh11K2XX42hZ0Boo/VKpy82c= X-MC-Unique: 6ajdRTbFMOGCHYggcYKfzw-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=kaU4zZuJB4tESn4H6GCPctUQ4pXRnoC4EnBxMdQNjsg=; b=lt1QJ2gslpCSH8nhm3wvipwpk17xVx96FvESyNyoGLDip0qDuWBeFBsHpBmX0O6SQ8 I1zj5nmQLXRZKw9cqQtwPIucc2WHrgLAdc8MVJ2UTDqRZj7fZ1VdSE/1UqLjU6w61Cn8 uTltmx1qaIDJa/dIPKpETm+3HtZvNUDNTPvWaEd/ve84hU5Z7GbQ0KskO2/aQRRQTyL8 iQXlL1cuCME/dcfpkxFxDLoCAiViR/pv3xV9FmO+2ShV1wNOEl13Na0JwuVhhPL3q9WN 6H7Si2grE6QAbbEcbqFMavhxSUPqeqFtVAu/q4QIJgKIstc9eg3Spa4syH0auZVz9Fxu MeNQ== X-Gm-Message-State: AOAM5302Yl/j8qml0CAU2Wjk0m0Ar9ZVLXm7QYwm5F27o3sVk8ZTSnv3 EmyYD7rZV3JQjXyZYsB/H68P2KEhnnki7lnsBQnhEEETkuo7D35F/whiIpANI9pt4NCEEoDzoaf 3gJGS62RgGseQZQ== X-Received: by 2002:a05:6402:141:: with SMTP id s1mr2884123edu.87.1603964048409; Thu, 29 Oct 2020 02:34:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjcgH2rmz4jkf1kCqXySw/RvA8JU3syM6Ue6HVP6EL2HofhsUzs21j0aQXfQ0C/Q3T4kMnhQ== X-Received: by 2002:a05:6402:141:: with SMTP id s1mr2884116edu.87.1603964048257; Thu, 29 Oct 2020 02:34:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 11/25] block/nvme: Make nvme_init_queue() return boolean indicating error Date: Thu, 29 Oct 2020 10:32:52 +0100 Message-Id: <20201029093306.1063879-12-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Just for consistency, following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), return a boolean value indicating an error is set or not. Directly pass errp as the local_err is not requested in our case. This simplifies a bit nvme_create_queue_pair(). Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 98335012457..6eaba4e7039 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -160,7 +160,8 @@ static QemuOptsList runtime_opts =3D { }, }; =20 -static void nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q, +/* Returns true on success, false on failure. */ +static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q, unsigned nentries, size_t entry_bytes, Error *= *errp) { size_t bytes; @@ -171,13 +172,15 @@ static void nvme_init_queue(BDRVNVMeState *s, NVMeQue= ue *q, q->queue =3D qemu_try_memalign(s->page_size, bytes); if (!q->queue) { error_setg(errp, "Cannot allocate queue"); - return; + return false; } memset(q->queue, 0, bytes); r =3D qemu_vfio_dma_map(s->vfio, q->queue, bytes, false, &q->iova); if (r) { error_setg(errp, "Cannot map queue"); + return false; } + return true; } =20 static void nvme_free_queue_pair(NVMeQueuePair *q) @@ -210,7 +213,6 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, Error **errp) { int i, r; - Error *local_err =3D NULL; NVMeQueuePair *q; uint64_t prp_list_iova; =20 @@ -247,16 +249,12 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMe= State *s, req->prp_list_iova =3D prp_list_iova + i * s->page_size; } =20 - nvme_init_queue(s, &q->sq, size, NVME_SQ_ENTRY_BYTES, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!nvme_init_queue(s, &q->sq, size, NVME_SQ_ENTRY_BYTES, errp)) { goto fail; } q->sq.doorbell =3D &s->doorbells[idx * s->doorbell_scale].sq_tail; =20 - nvme_init_queue(s, &q->cq, size, NVME_CQ_ENTRY_BYTES, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!nvme_init_queue(s, &q->cq, size, NVME_CQ_ENTRY_BYTES, errp)) { goto fail; } q->cq.doorbell =3D &s->doorbells[idx * s->doorbell_scale].cq_head; --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964058; cv=none; d=zohomail.com; s=zohoarc; b=kJpPOBhp5pQpEjNvZxgCp3fbboCYM81EqKKxVXZijLTeqQQocDq6+Joftmb6w+ywXAJXDEyZppM+KKpFl3YvFpFvkV1YqE91f74EoY54vtXCtkpZdVG1T0WNkFRgXII9iHFM6qkQC1/8Wv4F2XBLLKWAgXvHR8KBBnKq/FyYPRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964058; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rby//ZoQW9S03FtYoV9vfiisbCFRimYXfnLqhWXSPDA=; b=Ln9E9JU0xL6NKYIawLVfqU9GN4r/v7rABAGR4bPcvxCB325U3yTsNdzofzzBihgTC0+d1dUQdBfZg4ZXfqcIz3V7/SYD/7UwIT+Fe0k9BJm47fmCwKyTd8eX1lUWtInSkPD9l3Yzg8OV0glyP1NvNOjdRhfNnfFbWBJakatWzNM= 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 1603964058046781.8370650588136; Thu, 29 Oct 2020 02:34:18 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-UezqtZOsO-SIGZlHaj9wmA-1; Thu, 29 Oct 2020 05:34:15 -0400 Received: by mail-ed1-f72.google.com with SMTP id i9so937399edx.10 for ; Thu, 29 Oct 2020 02:34:14 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id j3sm1186945edh.25.2020.10.29.02.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964056; 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=rby//ZoQW9S03FtYoV9vfiisbCFRimYXfnLqhWXSPDA=; b=e6zLPEAdS4e42d82abAtakjM33jqWn15gtFw55HLOroXSzUks1SwHebzYBCIW0vo3rwG0m zzHx0+eduQPX0K78w3DWxaiW9P5SoDcyGkEZuej/g+L19LYT4lsDSowSTblQaMtqzm58l7 vXHqgBCKasugVXk4VMaq7JnKeYmskIU= X-MC-Unique: UezqtZOsO-SIGZlHaj9wmA-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=rby//ZoQW9S03FtYoV9vfiisbCFRimYXfnLqhWXSPDA=; b=BO+LmpSEuS56dpz4udOn+dw+bjgA0tbQ+1pU1fh5wp66kjl5j2x0R+ffCcPDBzVcJj yEEkhVshLrnTy054/RP6P8QHIriz9QrorumggsIuzKQ1Pw4YMG5PkVW8C29TzgkGXNME sHrb2W8ItbmsYT3FIt+VI6amH8gBAjLNLkaeSlluZPpNZMp3kOPcdla4QY6rWF2FBcVw 7OM5kTNj1etOTqUj5yfv1ysAOvbEo/WGJIzEFusYQC9PNqQys3GcAU1nyuymC/Q3NbCj JqJLLp5bh0PT23Twkb0NZmxVaMEoW8GaMLN6y73TJALn/EAM2AkrPxaE8LwKrJVbUQKM 9RMg== X-Gm-Message-State: AOAM531zqfcXL6uNoJlsn7iBo4Fdf9tLxTWeUlgv5d6weEBEA2nVMUtd tCADEI33jXa+QokdQ0tceqzKm0Y2ohL6XhX6DVpYErPT0AaqgpNpGCdYfZC7Ea505ZmGUUD+SKR vw+GNGldP1IeXDw== X-Received: by 2002:aa7:db07:: with SMTP id t7mr3066318eds.161.1603964053891; Thu, 29 Oct 2020 02:34:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ0kdNF1Qc1dmy/i0wEBvojqnfi6haarp1JXLZ5a3wlyMNBoVkGSKDdNY5Kfbi2K2Yo5WUEw== X-Received: by 2002:aa7:db07:: with SMTP id t7mr3066301eds.161.1603964053749; Thu, 29 Oct 2020 02:34:13 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 12/25] block/nvme: Introduce Completion Queue definitions Date: Thu, 29 Oct 2020 10:32:53 +0100 Message-Id: <20201029093306.1063879-13-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Rename Submission Queue flags with 'Sq' to differentiate submission queue flags from command queue flags, and introduce Completion Queue flag definitions. Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- include/block/nvme.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 65e68a82c89..c7ab9449125 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -491,6 +491,11 @@ typedef struct QEMU_PACKED NvmeCreateCq { #define NVME_CQ_FLAGS_PC(cq_flags) (cq_flags & 0x1) #define NVME_CQ_FLAGS_IEN(cq_flags) ((cq_flags >> 1) & 0x1) =20 +enum NvmeFlagsCq { + NVME_CQ_PC =3D 1, + NVME_CQ_IEN =3D 2, +}; + typedef struct QEMU_PACKED NvmeCreateSq { uint8_t opcode; uint8_t flags; @@ -508,12 +513,13 @@ typedef struct QEMU_PACKED NvmeCreateSq { #define NVME_SQ_FLAGS_PC(sq_flags) (sq_flags & 0x1) #define NVME_SQ_FLAGS_QPRIO(sq_flags) ((sq_flags >> 1) & 0x3) =20 -enum NvmeQueueFlags { - NVME_Q_PC =3D 1, - NVME_Q_PRIO_URGENT =3D 0, - NVME_Q_PRIO_HIGH =3D 1, - NVME_Q_PRIO_NORMAL =3D 2, - NVME_Q_PRIO_LOW =3D 3, +enum NvmeFlagsSq { + NVME_SQ_PC =3D 1, + + NVME_SQ_PRIO_URGENT =3D 0, + NVME_SQ_PRIO_HIGH =3D 1, + NVME_SQ_PRIO_NORMAL =3D 2, + NVME_SQ_PRIO_LOW =3D 3, }; =20 typedef struct QEMU_PACKED NvmeIdentify { --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964064; cv=none; d=zohomail.com; s=zohoarc; b=SDHHgeu/cp9ngrUAorvjqbAu2yHtvPEUBO6MN3ARoUfAcjvugy2jTOUkal9mISflnO5iiA7O0h+E9kjqgPsp6TeGMSenkTDlF8Rn1R8EeTZmSsOTIoweAi7cm00E6um38cTq0TqE9B7PZq/L6npvtBkV7lVbRfaJ9gub7m9H0B0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964064; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=PNbQLcT2YAtJ+9yj7XsSRTYSXNgUiMYhENGCKNffe1M=; b=aufZkFGRtFCiVw+TkvZjI98Tl2jZtqWdQ7osRbH1WKOezDl8Xd5Wbolckc83mJAMUFTPg86pox67UJHAWmdIHagWaPe09GPOfcAz3OcM0YwXyjtpnpjE2zsl+jFf9COgVSDAHBZO3tIJ+Yf7omRbH2dyVwYOxmhqdMa6T574Nx4= 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 1603964064435246.1376816599742; Thu, 29 Oct 2020 02:34:24 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-574-Wr6GYnxvNC-zV79dRbfw3Q-1; Thu, 29 Oct 2020 05:34:20 -0400 Received: by mail-ej1-f70.google.com with SMTP id t1so923473ejb.21 for ; Thu, 29 Oct 2020 02:34:20 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id w22sm1143778edu.15.2020.10.29.02.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964063; 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=PNbQLcT2YAtJ+9yj7XsSRTYSXNgUiMYhENGCKNffe1M=; b=Wak2FnW67FLZ466Y3duCJpO+YSsmJuq238NXBMLaIg2Bn9W5LMDFRb1XlSuIqzeBW+90/m zLQdUT1UTquUBJmWDg0hckDHLH85trrzt6NkBpPqlRAs40fN+luBGENxnGSuWL/wNSW7Vr zgMwDBkvMpzGrRV2KcWnF+PtwVKA2bM= X-MC-Unique: Wr6GYnxvNC-zV79dRbfw3Q-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=PNbQLcT2YAtJ+9yj7XsSRTYSXNgUiMYhENGCKNffe1M=; b=tjD2eXDy+lLGKpmaT7m4UkJUeRkqgWCw69zcuMohDCIGyyMe9H20dDvfBAzu4e+5Rd PZ54XCfxwkMU127cRhNxU0bYXYv0ZBiheZ8D0OTXdmfhQpbVgS0UQ3jN9a5oMsiw1hbW CEAxRZGPVh+JM7CeNmBB2ZX0r9j3k/i+iSs8zdUYPVLMQmY9h5C6bZKyIWs/uC30Xe87 OAiDBr4Z4A+Ty7Qzw8992fldVAuqeznbnQydW0n6lfohXRx02Uk+QOx+Nl+pZSsyGN1j KopHRrgioerI0duBlWxkySRHwySLMbFVG/A/jXgqHSdoPFAUY3sOdo2rmO8CUB6qAIZd KESg== X-Gm-Message-State: AOAM5323T2F3cnAhw5u+JRNIZhPorYCMQpynRTBf+BinL5BrEnoYMrl7 zDW6ZrQUx4AS0Q9498jJEtD7qOBcyugfW1jsVJXkw6exFZ2vqODr3LcaFYlDOro9vuOC/uVYwWF Oaq+GO21NjJypYQ== X-Received: by 2002:a17:906:8812:: with SMTP id zh18mr2051844ejb.361.1603964059318; Thu, 29 Oct 2020 02:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylYXJSyM7Qt+84sBHsnm4K50hjTWnBMggbpI3PBnzvC4zqNWBBz+oNBhmZhvPC27GOKQDA1A== X-Received: by 2002:a17:906:8812:: with SMTP id zh18mr2051828ejb.361.1603964059155; Thu, 29 Oct 2020 02:34:19 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 13/25] block/nvme: Use definitions instead of magic values in add_io_queue() Date: Thu, 29 Oct 2020 10:32:54 +0100 Message-Id: <20201029093306.1063879-14-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Replace magic values by definitions, and simplifiy since the number of queues will never reach 64K. Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 6eaba4e7039..7285bd2e271 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -652,6 +652,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) NvmeCmd cmd; unsigned queue_size =3D NVME_QUEUE_SIZE; =20 + assert(n <=3D UINT16_MAX); q =3D nvme_create_queue_pair(s, bdrv_get_aio_context(bs), n, queue_size, errp); if (!q) { @@ -660,8 +661,8 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) cmd =3D (NvmeCmd) { .opcode =3D NVME_ADM_CMD_CREATE_CQ, .dptr.prp1 =3D cpu_to_le64(q->cq.iova), - .cdw10 =3D cpu_to_le32(((queue_size - 1) << 16) | (n & 0xFFFF)), - .cdw11 =3D cpu_to_le32(0x3), + .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)) { error_setg(errp, "Failed to create CQ io queue [%u]", n); @@ -670,8 +671,8 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) cmd =3D (NvmeCmd) { .opcode =3D NVME_ADM_CMD_CREATE_SQ, .dptr.prp1 =3D cpu_to_le64(q->sq.iova), - .cdw10 =3D cpu_to_le32(((queue_size - 1) << 16) | (n & 0xFFFF)), - .cdw11 =3D cpu_to_le32(0x1 | (n << 16)), + .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)) { error_setg(errp, "Failed to create SQ io queue [%u]", n); --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964069; cv=none; d=zohomail.com; s=zohoarc; b=W/5RTjfwIuVB30qZSvRZBOa7MiH4sOtKPos0C6ujjWgN1DkYZYgkvVlC2ScgJPruSQn9B/JrjIRPWh468yTGOK76kHuvJQkpwzsXU2W62iHoylnSY7gxe+OdzBwESAEg95w6NPAqIA30ZHiCp8J26qplSmWFFekq2wcup8K06fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964069; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=d/cFTVW+ke5uZg7BAFOkxbRZHK6mRcrvyD+HcJ4ykuI=; b=oBZYeXootX61csIT7FPbsD7sUsA34DDN3GX+amSudktvHGFt6bfPzqaCHVTtf9YuA+F4tXYQgbKDd3PV0AmwGv/rV2drV70m3QUXDNAJmJxmk51UeGQWef9PA+F/NhvkCTNycUHDLq/2St+9TCUoXO1Y1v4yz6WOYlgFbZvA5h4= 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 1603964069150343.631385609758; Thu, 29 Oct 2020 02:34:29 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-322-y4VnJonpPgi4QS480LOgxw-1; Thu, 29 Oct 2020 05:34:26 -0400 Received: by mail-ed1-f72.google.com with SMTP id y99so633294ede.3 for ; Thu, 29 Oct 2020 02:34:26 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id p9sm1137861ejo.75.2020.10.29.02.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964068; 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=d/cFTVW+ke5uZg7BAFOkxbRZHK6mRcrvyD+HcJ4ykuI=; b=LSI0zM+Za+b/B64/fJKebthAR4IZ367/v5t/2JvIiNN4UbJMi0Ujj742ThV4PanJbm5GgH HoMauAH/F7d8caUy7weQgjd7IzUPqOJinLjjlW49HsGroUVyFS6gQvMJxY8oMiWVDOt5GN /RrJCeMCGc7NK8S4hI2XbVKAr6ctsik= X-MC-Unique: y4VnJonpPgi4QS480LOgxw-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=d/cFTVW+ke5uZg7BAFOkxbRZHK6mRcrvyD+HcJ4ykuI=; b=KgO8uBMxrWsxNKkQwoeYskp+X9TCbnQDb2KxvX+d69BQt4vfF4fOIZ/S2VNqJ+uSj3 Gh976390odH9JzXix/GN/TNG8lhx+hZDdkeh9BKMbT0OV2JnpJ2xo2CJClqKjfdayZvO 1BHZPROHRkC2/umPU3fZ/I27tW7pzm8cuBHZSJyiMVUwbXCsrqSOT5/a6PT9cAY96OKx nXXukWORG5jNcy9z9dMsPCkM6WV6UlT0D0WymMvG+qJgr61pnemUR17exa3GgLgVaItA bl2TapUAxxIELX8ku5rU33t/GWsRiBBvonrPMreOE1jP/+aMgDhkfZ74qsKxLOQy+Ykj nYDA== X-Gm-Message-State: AOAM532Ft73S4nn+tSaGusEm51RPl4iT82yMTXS3KZBinHqo02kgY1uQ WaeiRMW0Nm/ymDJKXekpFtdgmXj6WWVtqO1JMd0XCOVWBZY8OlEHUsNzpPFkZceKMw0l8ptHTHl sWTmmelrppLX/OA== X-Received: by 2002:a17:907:72cd:: with SMTP id du13mr2973283ejc.398.1603964064631; Thu, 29 Oct 2020 02:34:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVSu+lYk6jMn2irOn3PJRKjNzw+BrS0+xizRLdjzcZjOzFzUQEKieP9hh/pnhDXNiADjs22g== X-Received: by 2002:a17:907:72cd:: with SMTP id du13mr2973272ejc.398.1603964064456; Thu, 29 Oct 2020 02:34:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 14/25] block/nvme: Correctly initialize Admin Queue Attributes Date: Thu, 29 Oct 2020 10:32:55 +0100 Message-Id: <20201029093306.1063879-15-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) From the specification chapter 3.1.8 "AQA - Admin Queue Attributes" the Admin Submission Queue Size field is a 0=E2=80=99s based value: Admin Submission Queue Size (ASQS): Defines the size of the Admin Submission Queue in entries. Enabling a controller while this field is cleared to 00h produces undefined results. The minimum size of the Admin Submission Queue is two entries. The maximum size of the Admin Submission Queue is 4096 entries. This is a 0=E2=80=99s based value. This bug has never been hit because the device initialization uses a single command synchronously :) Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 7285bd2e271..0902aa55428 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -789,9 +789,9 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, goto out; } s->queue_count =3D 1; - QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000); - regs->aqa =3D cpu_to_le32((NVME_QUEUE_SIZE << AQA_ACQS_SHIFT) | - (NVME_QUEUE_SIZE << AQA_ASQS_SHIFT)); + QEMU_BUILD_BUG_ON((NVME_QUEUE_SIZE - 1) & 0xF000); + regs->aqa =3D cpu_to_le32(((NVME_QUEUE_SIZE - 1) << AQA_ACQS_SHIFT) | + ((NVME_QUEUE_SIZE - 1) << AQA_ASQS_SHIFT)); regs->asq =3D cpu_to_le64(s->queues[INDEX_ADMIN]->sq.iova); regs->acq =3D cpu_to_le64(s->queues[INDEX_ADMIN]->cq.iova); =20 --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964074; cv=none; d=zohomail.com; s=zohoarc; b=cGOCnXa9r7UcHV7lOyLWTtW65xRa/BtRkvHse+bJFF4M4HoP6FDpmDEvPdqLWd19Li8fEo8I14JkBG9uSpH1vOR1N2wgfdgaFx6mrIHmUgVy3Vx3wDbzOSYD1g45UV6ZBoFg5Vk30uafHCirU6akq+es9byWSgen3D3WGK2m2JU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964074; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=aD6wOmxyFdCPV49Ruw6nu+GcSa7FrFcv+dDSPChtcUc=; b=G/VLOO+BYG+chmIdp858hvkF8FsGbvUGI9e2YFqXUWCMR11lDJJPA7Zg3DE4nIq4dPalxIzWz9+U6lAkdiGkZVcmkzSCxS65qGp2tjjQyvrfDqrhb9vHDPJDt+K+KXqOjd2GJADOKcdmeV5viE88p8gGyA7vPpW4b/su7h61Sjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964074186983.3793090833943; Thu, 29 Oct 2020 02:34:34 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-255-2CoiReC3PmiagMPqWse9lQ-1; Thu, 29 Oct 2020 05:34:31 -0400 Received: by mail-ej1-f69.google.com with SMTP id c10so936580ejm.15 for ; Thu, 29 Oct 2020 02:34:30 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id f13sm1144515ejf.42.2020.10.29.02.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964073; 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=aD6wOmxyFdCPV49Ruw6nu+GcSa7FrFcv+dDSPChtcUc=; b=E7cDZZdEqBtdvmhxy/0xngaGQghmmL6PBsSI0DXuh8gJe+wYlabvtTyTaEt2XSvFROFb43 cdVgIv/sun03VLKnzwSnLJIWoS1+RlWwdlgjlrk3NDNWMuZVkO3R/OK22r37XkcJL7V+BR 93GndoWN+ywTiN4T0EiS8xqjCAInj7c= X-MC-Unique: 2CoiReC3PmiagMPqWse9lQ-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=aD6wOmxyFdCPV49Ruw6nu+GcSa7FrFcv+dDSPChtcUc=; b=o4GSe2FqHCQdQ645e40pPeriCo7dOp68G1pm3p0I8+Bwi+CrQoLWwvFXUkwIQUzEF9 Cww3g4gW55leXJ+uI3uG0jPZWX3xfLSeOJXG/t+4w8II3t5W95lqhGeJRnI7lKXnjmmC 4HqR/Qp3TJxm5j2fB1yRxo2/NzIu/IUQLGannzEuusehcNFcfnikAVd7YeZPLjU4EHvK mw9T8HsT8EnBMP1xgyocRkyYh56heVjd+KiyGJxSxgC3fWzyA8x6jr5J+sGZgYHSm0E9 bpCs2+WzY2R7lBhgXCpCzBSH4vTRajNMmFkFVpSdZDhxOtnn10aZfWOX95sPQ/aC6x+V FMDw== X-Gm-Message-State: AOAM532sgSflF8HmSb9hUKUE3YlYvhvfchDtXYHguv3R+N/9OfBMpz2G LUV/gFbb2/CnxX7l9j9ZFX7DQS/Cq+Wf/VbC4dWxetk+fMj5qeSrc+UHjjcushieq8UO3o7wvPf e68MT1EaAvqr6bA== X-Received: by 2002:aa7:d690:: with SMTP id d16mr58171edr.329.1603964069873; Thu, 29 Oct 2020 02:34:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3DhRtBm+GvI0yKAKWEkk39Y/cLInIsq1r9fw+4b+rgY9MXGQl6MTc6JoOv5dc7NmbuD9zgQ== X-Received: by 2002:aa7:d690:: with SMTP id d16mr58160edr.329.1603964069720; Thu, 29 Oct 2020 02:34:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 15/25] block/nvme: Simplify ADMIN queue access Date: Thu, 29 Oct 2020 10:32:56 +0100 Message-Id: <20201029093306.1063879-16-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) We don't need to dereference from BDRVNVMeState each time. Use a NVMeQueuePair pointer on the admin queue. The nvme_init() becomes easier to review, matching the style of nvme_add_io_queue(). Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 0902aa55428..eed12f4933c 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -700,6 +700,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, Error **errp) { BDRVNVMeState *s =3D bs->opaque; + NVMeQueuePair *q; AioContext *aio_context =3D bdrv_get_aio_context(bs); int ret; uint64_t cap; @@ -781,19 +782,18 @@ static int nvme_init(BlockDriverState *bs, const char= *device, int namespace, =20 /* Set up admin queue. */ s->queues =3D g_new(NVMeQueuePair *, 1); - s->queues[INDEX_ADMIN] =3D nvme_create_queue_pair(s, aio_context, 0, - NVME_QUEUE_SIZE, - errp); - if (!s->queues[INDEX_ADMIN]) { + q =3D nvme_create_queue_pair(s, aio_context, 0, NVME_QUEUE_SIZE, errp); + if (!q) { ret =3D -EINVAL; goto out; } + s->queues[INDEX_ADMIN] =3D q; s->queue_count =3D 1; QEMU_BUILD_BUG_ON((NVME_QUEUE_SIZE - 1) & 0xF000); regs->aqa =3D cpu_to_le32(((NVME_QUEUE_SIZE - 1) << AQA_ACQS_SHIFT) | ((NVME_QUEUE_SIZE - 1) << AQA_ASQS_SHIFT)); - regs->asq =3D cpu_to_le64(s->queues[INDEX_ADMIN]->sq.iova); - regs->acq =3D cpu_to_le64(s->queues[INDEX_ADMIN]->cq.iova); + regs->asq =3D cpu_to_le64(q->sq.iova); + regs->acq =3D cpu_to_le64(q->cq.iova); =20 /* After setting up all control registers we can enable device now. */ regs->cc =3D cpu_to_le32((ctz32(NVME_CQ_ENTRY_BYTES) << CC_IOCQES_SHIF= T) | --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964081; cv=none; d=zohomail.com; s=zohoarc; b=ZrjhZADvQFHFPNJZFtv0/JfihJX8nJ8nZcFlcb5Idv9zzPkmbqkAufv6za9njkTOBY31NpIkJsGnPraiRwIloKy3zI/afjklExYIcV1qJ/JLbWOgIOaRnTL0UfEuBOLnGk+8YF9I0gN9+A1CZyA4U7rc+USSeqWTGc7Sk0ST4yQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964081; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=uk13P8LCKUO2+gTBuoYZIar/VXLSwVbHDVchagy2v9g=; b=Z4VFQKPOgMV0YiRtwjY8laJfgs75D3cXj0E+EAZDMAkZ82Toe54YX8I7/QmCaleMHIsQYnRKJnV3T2XX4/I5L8Pljwd75npAEgBtql+PgHVsVupLjlk5fNXXq/qaJ1J7qPKA4RaxTxow79B0IflXNXjiXk6UPKYFBtk78L8AJ8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964081807531.7611338474567; Thu, 29 Oct 2020 02:34:41 -0700 (PDT) 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-59-hYP-EGvBPD-9ou9LMjpBcw-1; Thu, 29 Oct 2020 05:34:36 -0400 Received: by mail-ed1-f70.google.com with SMTP id ay19so918754edb.23 for ; Thu, 29 Oct 2020 02:34:36 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id oz18sm1151838ejb.55.2020.10.29.02.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964080; 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=uk13P8LCKUO2+gTBuoYZIar/VXLSwVbHDVchagy2v9g=; b=ivCzXpNbqgSW7w7QKTVLPHOVJDFYv7zW+qmDBPWA0tpcn139hbAUtWN0yBHWfx6QrAhwWd KhewwC4T7GEOEalUaIPEIg7gpP/iaSnZoiz72mqqw2U/QF8mUW/t0H3ZObYaKeVcFiUPyj DCMRFw5siABgRKSYIeTPQSo4epdAzdo= X-MC-Unique: hYP-EGvBPD-9ou9LMjpBcw-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=uk13P8LCKUO2+gTBuoYZIar/VXLSwVbHDVchagy2v9g=; b=qNRHOG5/epCRBHQVwT8PXHQgC8qnvd2gVerI8mfEmGmeEjkjxxit/NGHdxF4E9cLVK 2C0vea4RM5E6kmrq14Znjh9bPouGUEI+n7VgzVas5ZN/sJ65SclUPfwsC9IzxRmhx4t3 hTtvdI7sE9AvUAFfC1HGMyplrF1U/rZpXy02+aZ8e9TdJzLmGVL74GNExjJGCapw5nvg FU+hhzmdUHe5NcscMaXx3K1Cdk+ioEEzNode6Y0X54wffJvutWXu0Zuzf8jF+k7xCW9s fR86J15fKOO+gxfFREaBQ3WP8lZne8LuZwxG5zRJ1AUJr//xTmyuQhreqjAYwsNV/Dpr h7pw== X-Gm-Message-State: AOAM532HvP6xbj90uo5VM9yPUoOvWxLzlpwtiZYalejn+lOiu2FSVqYG 8LUr0K0+plFvc9Rmyo/hPa8KFxaFf/Dku0D8ELV0u/qkNw0uR6x6YaRNhFdEPzrBU2ryTXpdmyk /2Ur7VY8fC5wRag== X-Received: by 2002:a17:906:3092:: with SMTP id 18mr3151803ejv.43.1603964075357; Thu, 29 Oct 2020 02:34:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbjM2Fpj5bt3pLxqZcx9djWaztai0dnd9QsR+pjSkJnrj3nhT6Umio4zz7kcYBYWoYzyDdsw== X-Received: by 2002:a17:906:3092:: with SMTP id 18mr3151781ejv.43.1603964075144; Thu, 29 Oct 2020 02:34:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 16/25] block/nvme: Simplify nvme_cmd_sync() Date: Thu, 29 Oct 2020 10:32:57 +0100 Message-Id: <20201029093306.1063879-17-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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, and rename the function as nvme_admin_cmd_sync() to make this new behavior clearer. Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index eed12f4933c..cd875555caf 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -481,16 +481,17 @@ static void nvme_submit_command(NVMeQueuePair *q, NVM= eRequest *req, qemu_mutex_unlock(&q->lock); } =20 -static void nvme_cmd_sync_cb(void *opaque, int ret) +static void nvme_admin_cmd_sync_cb(void *opaque, int ret) { int *pret =3D opaque; *pret =3D ret; aio_wait_kick(); } =20 -static int nvme_cmd_sync(BlockDriverState *bs, NVMeQueuePair *q, - NvmeCmd *cmd) +static int nvme_admin_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; @@ -498,7 +499,7 @@ static int nvme_cmd_sync(BlockDriverState *bs, NVMeQueu= ePair *q, if (!req) { return -EBUSY; } - nvme_submit_command(q, req, cmd, nvme_cmd_sync_cb, &ret); + nvme_submit_command(q, req, cmd, nvme_admin_cmd_sync_cb, &ret); =20 AIO_WAIT_WHILE(aio_context, ret =3D=3D -EINPROGRESS); return ret; @@ -535,7 +536,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_admin_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); goto out; } @@ -558,7 +559,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_admin_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify namespace"); goto out; } @@ -664,7 +665,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_admin_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to create CQ io queue [%u]", n); goto out_error; } @@ -674,7 +675,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_admin_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to create SQ io queue [%u]", n); goto out_error; } @@ -887,7 +888,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_admin_cmd_sync(bs, &cmd); if (ret) { error_setg(errp, "Failed to configure NVMe write cache"); } --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964084; cv=none; d=zohomail.com; s=zohoarc; b=b2PpbxmsRDY9+EnqnY/7qqn+4Q5HNk08K1UQqmCjs3vwiY+efiiLZpUesuTKHn8hfEriAdmobuQHp3WZmRvbsPGltwS+z3+vzaTc7vY7b9dv3DkNEQgtbctxy7PR6JBvlwLiAW+FFV5gxCwNShMgZQL1SCxwV/SsY+fTT6pQGYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964084; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=JSY478yiFOxfyipIIVIRTU0bevcPEjwiKUZ7hzso9Eo=; b=J73BYV063Yh4cs9QUyK2ZVm/I5EWY66ELmV813gnmEFfMRW1VzXs2/oLxvDlmwQwvncK9TSGWRBzKBEeYKSyerhbC74q9hfmSPM+kHeUzvItMbQVBxTqmmcAdRMyzZzElazTkR64vylxoQU/L5BTag5CmkwMJt9uuacKFKOBvBo= 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 1603964084789183.36386867853628; Thu, 29 Oct 2020 02:34:44 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-WBzmK-DuNymZxgqb0SeuKw-1; Thu, 29 Oct 2020 05:34:42 -0400 Received: by mail-ed1-f72.google.com with SMTP id dn20so939692edb.14 for ; Thu, 29 Oct 2020 02:34:41 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id m19sm1145059eda.72.2020.10.29.02.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964083; 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=JSY478yiFOxfyipIIVIRTU0bevcPEjwiKUZ7hzso9Eo=; b=NNBYfHeUJYyE5Yh5bUFB4D44RqCEXlNAkRKNTxRy4UJuRAHspxQ6PJhDBIZ3tC5pvKM0kS twmm2LBkYoUaFdV4TOs8pjUVZ2Bw2dQ0Pxh3mNt/Qx0oEV27tgUoF6IPrATezwDGMGaooi 9IUo10TzTeNryOLSj8MpUqa7mzAjzsg= X-MC-Unique: WBzmK-DuNymZxgqb0SeuKw-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=JSY478yiFOxfyipIIVIRTU0bevcPEjwiKUZ7hzso9Eo=; b=GbwrUdql/rkJw9Wl1Y+lpRpad2980BNFxy3zWnRyHo7DNTv2uXSVqw00iVGBxVJT6z Y5bBbeYwvZIotlRbx2S0XlsERw9a9Da19A3PUeioxGZIXIXHM6ndx13hRkHIvkhYx0e0 9QVAbTGqtA+T+xpJrFgTtKPhyjJGvNiZrfktjTaR9iTO/rN+vXOHnOnuYpwZj2mG/ODe Ku0lMwwddq4SDIH/sykg4wJni3S1QsDsTWOlVWJD+WWI2XRxZjnK43E/Wk1GjFbz2pyn ueAPwDER421zbWWbRwmhv5O0shijbsFDQKY9cQhVO7hyqazbhKS0B4yv2k8BdMlOFcyE snPg== X-Gm-Message-State: AOAM533zptDKpT6z4Ju7UVMpeLtxBBdB4X70b+HFmxaO7BQEOKX42OSI E5/qPUkt9O+qyiwIE6wUWs18esV72xZEfPRHcv4gAVhUjgfLVszdVnDmrOPVHONNq2Q5Zge1QM+ XaLPNuY5clvaPxg== X-Received: by 2002:a05:6402:392:: with SMTP id o18mr3052705edv.283.1603964080702; Thu, 29 Oct 2020 02:34:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeYmxKt1Lq9v3GLSodnup8MdE9OlKJ3EwKtZI4k15vDKyB6ksdiQ9fU22CdMTavYoOecYPXg== X-Received: by 2002:a05:6402:392:: with SMTP id o18mr3052691edv.283.1603964080561; Thu, 29 Oct 2020 02:34:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 17/25] block/nvme: Set request_alignment at initialization Date: Thu, 29 Oct 2020 10:32:58 +0100 Message-Id: <20201029093306.1063879-18-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) Commit bdd6a90a9e5 ("block: Add VFIO based NVMe driver") sets the request_alignment in nvme_refresh_limits(). For consistency, also set it during initialization. Reported-by: Stefan Hajnoczi Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/nvme.c b/block/nvme.c index cd875555caf..bb75448a09f 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -758,6 +758,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, s->page_size =3D MAX(4096, 1 << NVME_CAP_MPSMIN(cap)); s->doorbell_scale =3D (4 << NVME_CAP_DSTRD(cap)) / sizeof(uint32_t); bs->bl.opt_mem_alignment =3D s->page_size; + bs->bl.request_alignment =3D s->page_size; timeout_ms =3D MIN(500 * NVME_CAP_TO(cap), 30000); =20 /* Reset device to get a clean state. */ --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964090; cv=none; d=zohomail.com; s=zohoarc; b=kLyYDm1fpLRdjVQP//BTHWggycXqRKB3KTzqxnW2GbytOJxe/qzW7gTCQVQULLJDhgzj/MBAPp8TZ3cagQ1UkeuVWtMLVOik4zmNYpmFj+1rw/8IPtgSCrRnbnqjVxeWqQ67Ocy/KCz/5PlBfKZhQOyDAsdBC9H59a8/0XRfb4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964090; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=cY+deayBxNQZ5fZVujrukclTBWuP/LZ1eYsnj5g50jE=; b=Pyrqneukq1KNztzr0rg3ivBeDtFlYf35pnnn+3s9qnDyFgEPpnAisIB2XWyiSPLfCwCtNLTrvZDhjW0dEJGWUlyTRomDWaEkQLOM3BZTft+ocQVITTg7b0Hk5OspKieVxYF6Gvpw4TldI/RymHtgtrG2cvNbxVMOdPQ3RuPeBs4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964090367471.7529842260632; Thu, 29 Oct 2020 02:34:50 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-w0pF1fCxP9WS6k_7eiX0Tg-1; Thu, 29 Oct 2020 05:34:47 -0400 Received: by mail-ed1-f69.google.com with SMTP id o2so955972edw.1 for ; Thu, 29 Oct 2020 02:34:47 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id h4sm1160619edj.1.2020.10.29.02.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964089; 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=cY+deayBxNQZ5fZVujrukclTBWuP/LZ1eYsnj5g50jE=; b=XYHuVfNT/CgbwUL85wStzzbjChTIPeKTWdORHCdpzzDnbvAzxI8SGc5An52Tr6Liov/iyt Egr6T1uIOwYpKPjF+RN4uTCyToUOtqpt+YcwU+9HpydmAsoOubAqoL8lQtTq/6aiQaKg1E WrpTB4mMB9EKQEN/ClndU/1s2PRWShQ= X-MC-Unique: w0pF1fCxP9WS6k_7eiX0Tg-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=cY+deayBxNQZ5fZVujrukclTBWuP/LZ1eYsnj5g50jE=; b=F+hDfeFi63oBc4C9oD6h5kx8WDuW6NbwE3AhzfYalps5Bb7Y9ia1O+jluy+Dl1V7he LCfPbhYUAk0tzYzmhvAo4r1YITCqu//5x7NE8Beyxrm140QZlzutRCBlbk2gC/4xyNIg g8HhSIhSMGTt1MKd5ca0SP9mpzuqSCYQV2EBZqgePqb5rUUIM95KDFIjMeIOapvn5Vbx u3KU9302FWRDUXY3I7yT15oc1A0G/Mi8Z5wEJayjd3KlGGV+WTwF0X9hKj3JxB/tnLSw Ew5hgjUIEAbQFRzhq3CUa7dZU2tap58q4fVq3UuCaeAB4p0QA6lH8dwIKmcOgrItWE8P 3c8g== X-Gm-Message-State: AOAM531AYA85IYFbqb3AhKDBobDl4KTj4sGBdD1KT+JVEa3qbKnU9ee6 H/+652ex1lsoll/c/d4ou9Z8Zh48i6woVoLLdz9xawJaSC4e9LDZ0rdZYucGKlnqBB1TB9eNjW7 WRk1Q+78o4FKpfg== X-Received: by 2002:a17:906:b216:: with SMTP id p22mr3200834ejz.228.1603964086028; Thu, 29 Oct 2020 02:34:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPLTTLbOHI19ZgEFF+IVkmv117xie8yC+hrbe79Wkp3q3/8uNxXAwNzCsAZpTAzqdAUa2Bow== X-Received: by 2002:a17:906:b216:: with SMTP id p22mr3200816ejz.228.1603964085862; Thu, 29 Oct 2020 02:34:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 18/25] block/nvme: Correct minimum device page size Date: Thu, 29 Oct 2020 10:32:59 +0100 Message-Id: <20201029093306.1063879-19-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) While trying to simplify the code using a macro, we forgot the 12-bit shift... Correct that. Fixes: fad1eb68862 ("block/nvme: Use register definitions from 'block/nvme.= h'") Reported-by: Eric Auger Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index bb75448a09f..bd3860ac4ef 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -755,7 +755,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, goto out; } =20 - s->page_size =3D MAX(4096, 1 << NVME_CAP_MPSMIN(cap)); + s->page_size =3D 1u << (12 + NVME_CAP_MPSMIN(cap)); s->doorbell_scale =3D (4 << NVME_CAP_DSTRD(cap)) / sizeof(uint32_t); bs->bl.opt_mem_alignment =3D s->page_size; bs->bl.request_alignment =3D s->page_size; --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964096; cv=none; d=zohomail.com; s=zohoarc; b=LXdJPZkeWp9BrhIoKoRLJPGkW+9mdMLnQ/UdEisJYCDobm0zQ19HUmhyHGabse+d/hdQPcXusHnzAnMO5B0U3feFu9ZDw8tycsUd+G/9BrRJqIPVSbTJCYlMrh7gPv+dTkt4BtbBuFAFXdcNYa74tQHFwltoeo6CE+BBNBHFkQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964096; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rWiNSG2LUOKYVBwx8cuVrYTSHgZcY9BMn/MdeeoAo/g=; b=CBQ8Cnjjw1v0aZLvXchzXf7p8CxvDRMCReyvdpYdLtz7tKInc0EnR0178i42UWFdJ43h5ZHc+w1eVAbezee+4hyfYhIY3KJkYkAB9BpvcRLc6TXytYPqG/2EDamO3XZZmfnnWQJFd1TRgfEGt8EtghcS2tD3hK+zJCWaZ/SpoZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964096596803.6206432380054; Thu, 29 Oct 2020 02:34:56 -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-567-m-Uks3AhMvaMsHooHReuwA-1; Thu, 29 Oct 2020 05:34:52 -0400 Received: by mail-ej1-f71.google.com with SMTP id z18so955134eji.1 for ; Thu, 29 Oct 2020 02:34:52 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id qp17sm1125194ejb.111.2020.10.29.02.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964094; 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=rWiNSG2LUOKYVBwx8cuVrYTSHgZcY9BMn/MdeeoAo/g=; b=X8n1Lwbk7az2OE3tML/C1l7Ccj19DhsgWfXMEOEyG+tSLPs8xXHNXbsoJzmhcl7sRYkzIX tjUShEgsSzW5tgojxDbTsbBmCfty68fkuoAk+Id5D/Va3iHp1AupPdva4y9tBWQkv0lAOM CRylvibtIYLfkNVmyuujEbJuTFTk10M= X-MC-Unique: m-Uks3AhMvaMsHooHReuwA-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=rWiNSG2LUOKYVBwx8cuVrYTSHgZcY9BMn/MdeeoAo/g=; b=j27RB0IR33BFNSChldodFsjU57YDo0a9XAmcst1lt5dBPQg1FF065fXYsgKpxjCV5D 061IdaJbDTQrEbmymoHPrz6seQYdA2TTUOl0nIhAzZZRQGnYZSvxFNssqhcmmiGhmZxl zOW23QagvU4batXBaro2G3Yw87eKqMJ9ZgXl+ElMmvg5zyGsHz676W+Fq5hsCQJ77fMw qIVrxPIK/fCm7mg8lIMd0KtaahVnsVojh6qOFxsxVHTIwpWEXWDkOBhdS4CmoXJbfB79 g96RLK1cbjDgIh9Ne+7kkAitd2kD2t3rIytGb4hcwYDOCKKR5Wpx5qNgNmA3kk5rDtX+ CvEQ== X-Gm-Message-State: AOAM5307bj0XZtHvm35qY+SOQLGiqBNM1bfaEkWsGpIl00QqpOwBeGAx ST0Wohob/xhyE9e13oJg1ls1KIMfK5AG+8lw71nsSLJKtH7ptcmhRXd7BveBl+UYkITWBG6mOvy NREeffRdx8PV5pA== X-Received: by 2002:a17:906:268c:: with SMTP id t12mr2980898ejc.377.1603964091267; Thu, 29 Oct 2020 02:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2fplAeCmn4KjQvLFwcFetSv60We+HjuDBR+g03i54KhnKmwag5CQRx/3lJomd4K8fucH/4w== X-Received: by 2002:a17:906:268c:: with SMTP id t12mr2980881ejc.377.1603964091126; Thu, 29 Oct 2020 02:34:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 19/25] block/nvme: Change size and alignment of IDENTIFY response buffer Date: Thu, 29 Oct 2020 10:33:00 +0100 Message-Id: <20201029093306.1063879-20-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) From: Eric Auger In preparation of 64kB host page support, let's change the size and alignment of the IDENTIFY command response buffer so that the VFIO DMA MAP succeeds. We align on the host page size. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index bd3860ac4ef..7628623c05a 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -522,19 +522,20 @@ static bool nvme_identify(BlockDriverState *bs, int n= amespace, Error **errp) .opcode =3D NVME_ADM_CMD_IDENTIFY, .cdw10 =3D cpu_to_le32(0x1), }; + size_t id_size =3D QEMU_ALIGN_UP(sizeof(*id), qemu_real_host_page_size= ); =20 - id =3D qemu_try_memalign(s->page_size, sizeof(*id)); + id =3D qemu_try_memalign(qemu_real_host_page_size, id_size); if (!id) { error_setg(errp, "Cannot allocate buffer for identify response"); goto out; } - r =3D qemu_vfio_dma_map(s->vfio, id, sizeof(*id), true, &iova); + r =3D qemu_vfio_dma_map(s->vfio, id, id_size, true, &iova); if (r) { error_setg(errp, "Cannot map buffer for DMA"); goto out; } =20 - memset(id, 0, sizeof(*id)); + memset(id, 0, id_size); cmd.dptr.prp1 =3D cpu_to_le64(iova); if (nvme_admin_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); @@ -556,7 +557,7 @@ static bool nvme_identify(BlockDriverState *bs, int nam= espace, Error **errp) s->supports_write_zeroes =3D !!(oncs & NVME_ONCS_WRITE_ZEROES); s->supports_discard =3D !!(oncs & NVME_ONCS_DSM); =20 - memset(id, 0, sizeof(*id)); + memset(id, 0, id_size); cmd.cdw10 =3D 0; cmd.nsid =3D cpu_to_le32(namespace); if (nvme_admin_cmd_sync(bs, &cmd)) { --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964100; cv=none; d=zohomail.com; s=zohoarc; b=WpHmXmTZH4u7inf8alSUKAcJk46Qrh8yUJ01/qFi3mGCqqEdDt8D9K1sVv/BeftDphYWTqwoo5CH/ukpDhmVepcVM4yP8jWM5/JwoYthClep93LcFWeksJFaH/oNwDDJcW+9hOeXgbcNRUrOnyrf5irT0mkQVO12Wf7TkQgqBCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964100; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=JwHFa3n4K0MRNvY+MTlxR5FZfku0vELlzpKB46QufT0=; b=QmRv9jWSmCeAYMTHTA7QaBTlD462wWB2W4QKAV1J5VhqTY3ZWDY3GmRYjvlUQ0dWWa7+gLCHD+jtDuh7UXFYMh4qevDWZilnG3JWMZ9bIzyfOiBYAW7+ODnp7IAfmDOJapEcprS7ct/8MyUutdXWulN6LLOPHW7ELJfSQpKIufU= 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 160396410087367.47209308979927; Thu, 29 Oct 2020 02:35:00 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-14-lOd8Yt7KONe3oGv0KB0e5Q-1; Thu, 29 Oct 2020 05:34:57 -0400 Received: by mail-ed1-f69.google.com with SMTP id dm20so955549edb.2 for ; Thu, 29 Oct 2020 02:34:57 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id m16sm1185758edj.37.2020.10.29.02.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964099; 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=JwHFa3n4K0MRNvY+MTlxR5FZfku0vELlzpKB46QufT0=; b=CGdjoOVvk45T575AtrqRUaaIrH4D+Ztze4wTPpF4UIdBfgLQxB7HqScvOUBTngRuj52Lj7 iaCYEcB4z4LrtfZA1QV87J/iVhcwwRUplXMX0u30eoUpMH1Wxl/3uDBOOb4XWSOHE6alYH +coDBZDipem7xEXLQzRl5cunue0uEQk= X-MC-Unique: lOd8Yt7KONe3oGv0KB0e5Q-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=JwHFa3n4K0MRNvY+MTlxR5FZfku0vELlzpKB46QufT0=; b=tezeVFR0ZKqwr2KWxyrprHcSoVdfrQsuU/ruYq6397Pj4AV2ncH0AJ8W+WzqAsjpCd MxkIgl7L4d9G4rvl3eTehm1BuMoIeqACJgnUoj0JxDLXIPdF+xshNjETuN94XTeZt7HS 2CT9SsYUy7KfGxBAHQbdINxYc6hpAZJnWDgjG1skVfgEGLckDGr8gCo+fpwKwCIIk8iq TaeqnQQH2ioKJtrI0Bx+i+mIq7KEI//mqBly6J+aky43EOa7D/He+CUcQDaUjcx/pGxb Rgo8boJW8tXsqn/Iw6RyKyCf3AQWzBJ8oehaB6ypK9yYuwUIDvS9wN3RXdX6dgLR7QgM w5oQ== X-Gm-Message-State: AOAM532BLgyyw5e+euk/QZX3+dHqUFmbXR3Xe25Tcjm9UuTe87Xa7PF6 8VWqHmdCd4RuPOraWWO3PQcla7JW4GYXJWZE6Lt71pmMwhdT9uTuDjsIye64aTKZl7I5Vm2fxws bl/CpY4pG79FdRg== X-Received: by 2002:a05:6402:141:: with SMTP id s1mr2886708edu.87.1603964096569; Thu, 29 Oct 2020 02:34:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7QAuuOGe2dK1cCwBgfqi+eBk4CBwAgMYE63Wgmr/SVWtbmU6rBBDo3gwwXt1muWGhPX8cjA== X-Received: by 2002:a05:6402:141:: with SMTP id s1mr2886692edu.87.1603964096391; Thu, 29 Oct 2020 02:34:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 20/25] block/nvme: Change size and alignment of queue Date: Thu, 29 Oct 2020 10:33:01 +0100 Message-Id: <20201029093306.1063879-21-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) From: Eric Auger In preparation of 64kB host page support, let's change the size and alignment of the queue so that the VFIO DMA MAP succeeds. We align on the host page size. Signed-off-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 7628623c05a..4a8589d2d29 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -167,9 +167,9 @@ static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue= *q, size_t bytes; int r; =20 - bytes =3D ROUND_UP(nentries * entry_bytes, s->page_size); + bytes =3D ROUND_UP(nentries * entry_bytes, qemu_real_host_page_size); q->head =3D q->tail =3D 0; - q->queue =3D qemu_try_memalign(s->page_size, bytes); + q->queue =3D qemu_try_memalign(qemu_real_host_page_size, bytes); if (!q->queue) { error_setg(errp, "Cannot allocate queue"); return false; --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964106; cv=none; d=zohomail.com; s=zohoarc; b=VjwlOZWg4A+f0ii8KMAxZv14EZ/h9r0d64GwGVbN2Ug7jKGCZjtoirgfbI8scBWaCpdG9+lOjWzKapSNfjMe4TJrrGSvSD1x1l+Uc3qHY2CvdHFMwg7MEMuELlilq7ZfU8B+dmtCbmPtC1OHqqPDj6Qa+LZTMvAUmir6sAkboWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964106; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ubWiemzbTn6vqYXI00YAYHXkMl8cmZxlbdS4QE+huSY=; b=Qw2dKbdaVriQR+O7RQfP0pJo3SyT5pfaafqP3H/dPQEE0lo5MgplSZ23gooko8ZJWJWkSsPZDheUhRv2DDpvlCzEwSDbmM0TckfcSg4Ta9g6lkx4af7cYr/STUiqsb4vbqcI4tYDb5N6RW/RMG8SllvYbgRp4ov7Cv9P70VLSvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 160396410618932.17905413495089; Thu, 29 Oct 2020 02:35:06 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-kAFlxuDEMwuKXifTZ2H6Lg-1; Thu, 29 Oct 2020 05:35:03 -0400 Received: by mail-ej1-f72.google.com with SMTP id x12so919787eju.22 for ; Thu, 29 Oct 2020 02:35:03 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id f13sm1145307ejf.42.2020.10.29.02.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964105; 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=ubWiemzbTn6vqYXI00YAYHXkMl8cmZxlbdS4QE+huSY=; b=N/QtvrlERwoLZ5nrtTQzX3FUfs6LlYu8bGVLfKEUFNB+X4ROKcl1kBCzbo4PgKW42dw0mt 0LOz0QoonNrMDGEP0hezE0aV74/hrQGD7b0zDLCh2YCnVQdJ1sP2Yb21wgL2Lsbq/ceJ5B SUROrybT1558h4HvsS+qwMStijBv4a0= X-MC-Unique: kAFlxuDEMwuKXifTZ2H6Lg-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=ubWiemzbTn6vqYXI00YAYHXkMl8cmZxlbdS4QE+huSY=; b=tBxwlBg1TPOyGQDiyW+MJCyKxncVmKG+Wj2wnl9VgA5+9M8Jjxya+B3l4rNW09Yxao hP7SpJOeBbDiFEFrMxkTH3iJCKAvyxgNra6+7nEb1VH1/kQKQ1aNMvRnePmrNxJKL1TM H1jhgoZHluGr9vjkVejRGBdthKQqrd7fNV8JJzKfMYRsE8F+t1PdcHrHM9JKeryoviEY CaTyRDac7QJqSwjNSBF7+D4MqrpmvOERJI/zooJT3iSsoau8nzbbsa9zyw+TKg8AYZJN GJZN9ci0j9vVqlgYCQTmO7wr+NOQBHB5KcgBGEmMzo97cQZnnQZ2FrjLg6JuPfi5Sq6C D0tQ== X-Gm-Message-State: AOAM532EBZyEpwnrrkDUHi38lpucIOwzjKz0yxYd2JLCi0+lRzCjRLSZ Pb9PDbY988E86Iy4D0DmgyRdyd7amXgJv1VFq7dFL/gdut9eUb9ji6SSqWmReJVH5snnT7bjpl8 yVGj3S1cKS/kmSw== X-Received: by 2002:a50:e705:: with SMTP id a5mr3025237edn.29.1603964101964; Thu, 29 Oct 2020 02:35:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj7AU9r302XYl0o0JrbIYdM6n4Tgtrrcvc5eHp/Ce/n3dgfajSbx0/WUJb1zx5rdqTrrQNUw== X-Received: by 2002:a50:e705:: with SMTP id a5mr3025225edn.29.1603964101828; Thu, 29 Oct 2020 02:35:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 21/25] block/nvme: Change size and alignment of prp_list_pages Date: Thu, 29 Oct 2020 10:33:02 +0100 Message-Id: <20201029093306.1063879-22-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) From: Eric Auger In preparation of 64kB host page support, let's change the size and alignment of the prp_list_pages so that the VFIO DMA MAP succeeds with 64kB host page size. We align on the host page size. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 4a8589d2d29..e807dd56dfe 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -215,6 +215,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, int i, r; NVMeQueuePair *q; uint64_t prp_list_iova; + size_t bytes; =20 q =3D g_try_new0(NVMeQueuePair, 1); if (!q) { @@ -222,19 +223,19 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMe= State *s, } trace_nvme_create_queue_pair(idx, q, size, aio_context, event_notifier_get_fd(s->irq_notifier)); - q->prp_list_pages =3D qemu_try_memalign(s->page_size, - s->page_size * NVME_NUM_REQS); + bytes =3D QEMU_ALIGN_UP(s->page_size * NVME_NUM_REQS, + qemu_real_host_page_size); + q->prp_list_pages =3D qemu_try_memalign(qemu_real_host_page_size, byte= s); if (!q->prp_list_pages) { goto fail; } - memset(q->prp_list_pages, 0, s->page_size * NVME_NUM_REQS); + memset(q->prp_list_pages, 0, bytes); qemu_mutex_init(&q->lock); q->s =3D s; q->index =3D idx; qemu_co_queue_init(&q->free_req_queue); q->completion_bh =3D aio_bh_new(aio_context, nvme_process_completion_b= h, q); - r =3D qemu_vfio_dma_map(s->vfio, q->prp_list_pages, - s->page_size * NVME_NUM_REQS, + r =3D qemu_vfio_dma_map(s->vfio, q->prp_list_pages, bytes, false, &prp_list_iova); if (r) { goto fail; --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964113; cv=none; d=zohomail.com; s=zohoarc; b=l5pKQD07g6tNLMr+XWBKtWCIolGbmPA88FxrwORjT4dbfIepA14ehGP6E5FKqaSFvZwp13rMp3m2jBbWs/uDU9txUVTJy21esSaJrCiTSqxyJTJIGRnBn1vDTikemK1GSAYRF8xcWe3uPKTXrRgHvl8kIP506Q29EBj/xmG1uFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964113; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=8ebpGRl8V/SQHWtFmQyZ24PuNhlns0+asaugWNkot24=; b=mSovl1B/3TUDX8qc6snKK0FxJRFNuXt85B3HaXKjUAOtdsjbu3qW0Iu9LW/3iu66XKPVGPD8OpvlmFof70LJAElmdC1HmY2yD42oOot+2EYvgbgMuSK64AKYIJXb/PcFxbFiAN5rZ3Xr+f6ahLCOFUsIcbzVUdYqZ3LvBvkYbl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964113250606.3024915816235; Thu, 29 Oct 2020 02:35:13 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-HXKRTteoM3OMqP-vhgkRfQ-1; Thu, 29 Oct 2020 05:35:08 -0400 Received: by mail-ej1-f70.google.com with SMTP id c10so937143ejm.15 for ; Thu, 29 Oct 2020 02:35:08 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id ds7sm1162895ejc.83.2020.10.29.02.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964112; 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=8ebpGRl8V/SQHWtFmQyZ24PuNhlns0+asaugWNkot24=; b=Kgkf2rfK3sFV/OjpH2KyNz1+Ukr4V/3xx6aHUsRAB9O1fItjcuWC0Z274Gg/IyqIsdXmOf Z95ehdqmDKVq8kk5smu/PONmX2rnIn2zYgciKv0bsE/0xr9G/d4kIsfKaMrWeeoySPAE0P lbJ0QY2RmbXJ6BcadBzz7KTMh0/SxdA= X-MC-Unique: HXKRTteoM3OMqP-vhgkRfQ-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=8ebpGRl8V/SQHWtFmQyZ24PuNhlns0+asaugWNkot24=; b=SIeKpYH8uzUIqAeeA9WFPvkrlT/ML7eaw3uS7yLctSI4oXa5yjMB9n5iQ4U8ozzlHN JrHL7JrrZDEU0nCb8NmgTWfRlhFh6of7b3B8gsAgUNajQfKzHWIaqzJ4F/qu8cclWVb9 D55Vdssu9yPA+iGX9YKBAtoWdMCJ/glPCCar9aTCb68PPAFeFSYwuAUYk01k1+ybCtti 7dAAweS/uOFBeY5pAYp6/KAtZYMDYRXHLkRfGkW/z0XU2s3uXQ+P/rRjllegrBap0fsu GH/DjAKlBSZ6m1lQPsqWGcL/KV7QT9tN3J3Pm2AFWHz6ucncE1pSi5zSBkQ8QWttgM0x mc4A== X-Gm-Message-State: AOAM533hyQN2iyLF4NIiVayWH7VX7frmrcvuD6dLvCv0hNvUafCeV/KJ Gf+x0y2ZzOe8YRYHiffOWKv27zLGBPtimgKBxK5HI3w6hz3odidOcO4aeuDHMfa3KR4Nx+YV80y fBuaY0ShrMH2Fpg== X-Received: by 2002:a05:6402:1004:: with SMTP id c4mr3001091edu.149.1603964107186; Thu, 29 Oct 2020 02:35:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydv1/hzCveV0yJGEQIelPM8p1TF/vx6Lv0Ya7VjwzOzBrXzGv+iGdES7KEf2jLrzvvLRSAlA== X-Received: by 2002:a05:6402:1004:: with SMTP id c4mr3001077edu.149.1603964107030; Thu, 29 Oct 2020 02:35:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 22/25] block/nvme: Align iov's va and size on host page size Date: Thu, 29 Oct 2020 10:33:03 +0100 Message-Id: <20201029093306.1063879-23-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) From: Eric Auger Make sure iov's va and size are properly aligned on the host page size. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index e807dd56dfe..f1e2fd34cdf 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1015,11 +1015,12 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriv= erState *bs, NvmeCmd *cmd, for (i =3D 0; i < qiov->niov; ++i) { bool retry =3D true; uint64_t iova; + size_t len =3D QEMU_ALIGN_UP(qiov->iov[i].iov_len, + qemu_real_host_page_size); try_map: r =3D qemu_vfio_dma_map(s->vfio, qiov->iov[i].iov_base, - qiov->iov[i].iov_len, - true, &iova); + len, true, &iova); if (r =3D=3D -ENOMEM && retry) { retry =3D false; trace_nvme_dma_flush_queue_wait(s); @@ -1163,8 +1164,9 @@ static inline bool nvme_qiov_aligned(BlockDriverState= *bs, BDRVNVMeState *s =3D bs->opaque; =20 for (i =3D 0; i < qiov->niov; ++i) { - if (!QEMU_PTR_IS_ALIGNED(qiov->iov[i].iov_base, s->page_size) || - !QEMU_IS_ALIGNED(qiov->iov[i].iov_len, s->page_size)) { + if (!QEMU_PTR_IS_ALIGNED(qiov->iov[i].iov_base, + qemu_real_host_page_size) || + !QEMU_IS_ALIGNED(qiov->iov[i].iov_len, qemu_real_host_page_siz= e)) { trace_nvme_qiov_unaligned(qiov, i, qiov->iov[i].iov_base, qiov->iov[i].iov_len, s->page_size); return false; @@ -1180,7 +1182,7 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t= offset, uint64_t bytes, int r; uint8_t *buf =3D NULL; QEMUIOVector local_qiov; - + size_t len =3D QEMU_ALIGN_UP(bytes, qemu_real_host_page_size); assert(QEMU_IS_ALIGNED(offset, s->page_size)); assert(QEMU_IS_ALIGNED(bytes, s->page_size)); assert(bytes <=3D s->max_transfer); @@ -1190,7 +1192,7 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t= offset, uint64_t bytes, } s->stats.unaligned_accesses++; trace_nvme_prw_buffered(s, offset, bytes, qiov->niov, is_write); - buf =3D qemu_try_memalign(s->page_size, bytes); + buf =3D qemu_try_memalign(qemu_real_host_page_size, len); =20 if (!buf) { return -ENOMEM; --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964117; cv=none; d=zohomail.com; s=zohoarc; b=fF5VI6moHS81bS3vyccmPSlRmg277jRDeoUKNyzmp/Jb/3tdUkPOIQ6HsDnshiqkrcPh5odhgZ7aoBqAKS9rlQZtwP2HCbbBdSm6Mv8XyPvpyVzXRjp+mUU7htHD7jrMmxXfTPkEUyXwxGGshvFeu8Uww9zhD51iceXuejBos+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964117; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=98878GiMo+xjdVFdoB+TjeRF3YgJ60igYiOFDXm/QLU=; b=EkmnoBF0L5l+kttAtwAup0ESDpY6p5vZfaKkNbiA5KvTA9KliIHcfDc1RZQ8bXVrKh7tcpSdDcAP7P6/OBWjojwRHhP7DxgJipo0m5f+0uByHDC/X/liypAEd/zEazBiY6AKeirswBj9CWqmwmsYfy9o0JMYo7iXovbARYCcBFU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964117477414.99611626855574; Thu, 29 Oct 2020 02:35:17 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-zMKD9F4hOk-Dlxs5lD40ag-1; Thu, 29 Oct 2020 05:35:13 -0400 Received: by mail-ed1-f69.google.com with SMTP id t4so939230edv.7 for ; Thu, 29 Oct 2020 02:35:13 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id m25sm1158234edp.36.2020.10.29.02.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964116; 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=98878GiMo+xjdVFdoB+TjeRF3YgJ60igYiOFDXm/QLU=; b=FK402G4q4V0lSa6P7Nj9SBoSB90UQJVYgP5TTgmLYO6BNRcgJWMHB63TeYDz2u4A2F7ZN0 kq5rTaolK39d5dG0x+hHN/Ax4S7uIdmaKulMB2xcM3KvMrd6vhWDld6OkBLTHFegCYxX++ aZ5dWkgMq62QpUouP1t/PL0F8MhqIyY= X-MC-Unique: zMKD9F4hOk-Dlxs5lD40ag-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=98878GiMo+xjdVFdoB+TjeRF3YgJ60igYiOFDXm/QLU=; b=LV6+OP9RK4Rn2RwOFa6lDrSOBLYNmyQPk9faUXgxNOjQgztZov5XmyUiTujVKfUb2a 0JHpYmbcFeH1cNxI5y8IVnWlBfP9aovJSLj9szUh8YNsM9T3XnzNt9AfQcrPNImErvWx 6mKdS++5eCl7TIx9UFo5WGl3pPKtFcylWi5/8jIKCvDn82LOJYazusTfCAr5bYvEEA63 Pp0Ycve/R3HTdYUDXZY3+She0IGQdyg+61x2rT75IogqJ3OdLQCjzgLJDm1V8DD22XAi XZyg7cu3RbTY/V6U4vd7iy0TfZjX9ASVyhaHm1HXh7fRg7OwXkomvAFtiMy9DN2TfuqI 9yGQ== X-Gm-Message-State: AOAM530IXOZUKuqXcNaugX86foVlxVsdp1Ni7l39xEJvNG1TR11Poo+9 psLgSADXOss/pXF0uFijnczz2hfEhnCny8agBgtEWSfxpVzIUX5Ccbf+EgpxrShSfcpnQel+fbv Us6TCCSAMRI2UaA== X-Received: by 2002:a17:906:400f:: with SMTP id v15mr3072906ejj.378.1603964112374; Thu, 29 Oct 2020 02:35:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFJ+q1BWMaXOzvorAV1c/Ju86MCTBCYBhdj5L58nZSQnc5XWJk9FPRccn1+tIjdzqhZmBbug== X-Received: by 2002:a17:906:400f:: with SMTP id v15mr3072892ejj.378.1603964112216; Thu, 29 Oct 2020 02:35:12 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 23/25] block/nvme: Fix use of write-only doorbells page on Aarch64 arch Date: Thu, 29 Oct 2020 10:33:04 +0100 Message-Id: <20201029093306.1063879-24-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) qemu_vfio_pci_map_bar() calls mmap(), and mmap(2) states: 'offset' must be a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE). In commit f68453237b9 we started to use an offset of 4K which broke this contract on Aarch64 arch. Fix by mapping at offset 0, and and accessing doorbells at offset=3D4K. Fixes: f68453237b9 ("block/nvme: Map doorbells pages write-only") Reported-by: Eric Auger Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index f1e2fd34cdf..c8ef69cbb28 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -94,6 +94,7 @@ typedef struct { struct BDRVNVMeState { AioContext *aio_context; QEMUVFIOState *vfio; + void *bar0_wo_map; /* Memory mapped registers */ volatile struct { uint32_t sq_tail; @@ -777,8 +778,10 @@ static int nvme_init(BlockDriverState *bs, const char = *device, int namespace, } } =20 - s->doorbells =3D qemu_vfio_pci_map_bar(s->vfio, 0, sizeof(NvmeBar), - NVME_DOORBELL_SIZE, PROT_WRITE, e= rrp); + s->bar0_wo_map =3D qemu_vfio_pci_map_bar(s->vfio, 0, 0, + sizeof(NvmeBar) + NVME_DOORBELL= _SIZE, + PROT_WRITE, errp); + s->doorbells =3D (void *)((uintptr_t)s->bar0_wo_map + sizeof(NvmeBar)); if (!s->doorbells) { ret =3D -EINVAL; goto out; @@ -910,8 +913,8 @@ static void nvme_close(BlockDriverState *bs) &s->irq_notifier[MSIX_SHARED_IRQ_IDX], false, NULL, NULL); event_notifier_cleanup(&s->irq_notifier[MSIX_SHARED_IRQ_IDX]); - qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->doorbells, - sizeof(NvmeBar), NVME_DOORBELL_SIZE); + qemu_vfio_pci_unmap_bar(s->vfio, 0, s->bar0_wo_map, + 0, sizeof(NvmeBar) + NVME_DOORBELL_SIZE); qemu_vfio_close(s->vfio); =20 g_free(s->device); --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964122; cv=none; d=zohomail.com; s=zohoarc; b=PwkIHOHDCAuWJUoosyIRW6sSjz5KR1J8XGrYhu88Do7Zkq0pLIe0LycKXfA6fLtFi55PkvhGVZsuP0E5NwlkSN7csFWI9saIKdZSSIIBBPt72BpIOj5KLZwcACjfLZcKEdX/OUovu/6OTzbeBzR+xo2vzBQg1bMLWGlWH9tqagc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964122; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=E7ARdMdjChejWzNOv4rbThOcf14/Pp3Q0pevnTZmOLU=; b=jQdVLyA0HVgiMvXs6yUcdivebDmIqTIYpGDHtX3oQERGC43gQ2t5JXXrR4rD8JqpHctOHCn+xuTbk4Ik+P6O9269sAi0j/Dz6LJMMgl4rBO0zU3A2EAKhngEKremwzG89GyUdTn4msnkao8WkIEXjglYgMg8XteKylc9gABjdbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964122546980.7880337320003; Thu, 29 Oct 2020 02:35:22 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-U3-ibXnONcC6GIjxz_YA9w-1; Thu, 29 Oct 2020 05:35:19 -0400 Received: by mail-ej1-f72.google.com with SMTP id z8so949782ejw.3 for ; Thu, 29 Oct 2020 02:35:19 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id ao17sm1179118ejc.18.2020.10.29.02.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964121; 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=E7ARdMdjChejWzNOv4rbThOcf14/Pp3Q0pevnTZmOLU=; b=TPsWIhM6wYF/Tx4fggUt3W5J4it8vdN2i4LkqQV51cdPqpUJUcDUQPsOHAboc4bPg4smDE WD4dPcQoM2JGu+XrApSYsmTsoyz6quA6sushrdrZ6d98xE8cbOOnSHaH0vFvL3YB+a/JBQ mzCRXRsMsSMTZotSgceYBqULYLpW38I= X-MC-Unique: U3-ibXnONcC6GIjxz_YA9w-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=E7ARdMdjChejWzNOv4rbThOcf14/Pp3Q0pevnTZmOLU=; b=XXTgzjJlR1g5riYLaupCQjZAnVmQsrDY6X0zUMzIStXwi7BOubvqZ39QN9CQS1Tz2v Ry0fOfUnopwA1qlZDYZTvZv0+1aHgzY7BP0RlUFRHotD0i6PXabIVsXZkKI9dVvpBljB aqZwvmzGJ3oenIjbnLh1g4ojITrEHF3HSsc0W4w1B4uItIeeLMfQIw+Vsl+jodzttvoK ZfrpEv9/02MGUxzP3lTWtxic7zSrgKrvxuzExBbhe6uy9yqbCRajXawg3/QPPe+U7jyd wGoasJPzE+IIoD0Lv6CMMM8804gQ/me4T4AqmKzJ2ken6+XtDP9tO+kUfu1OTiLtIyvl Z70g== X-Gm-Message-State: AOAM530dPuyvdy7Wur2sbgYqne8VQIwrw2EfHuw81xHHGlw76OGp+agJ LJInomf7aRWTSOQZ52v/eSARW8UfdmiParK/EVCcpYMQML8qqcKJs1+vEoeXELjTxVTRpHE/Rdu syFxwRhIX6D8Ykw== X-Received: by 2002:aa7:d843:: with SMTP id f3mr3132444eds.354.1603964117843; Thu, 29 Oct 2020 02:35:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAay3pmJYlLgbH6MPTB2Q0PEhx1HhlZ8YZ0CFL2D+WbqyLxHWDudhWsgUz+4hKpE6k5jM12w== X-Received: by 2002:aa7:d843:: with SMTP id f3mr3132424eds.354.1603964117514; Thu, 29 Oct 2020 02:35:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 24/25] block/nvme: Fix nvme_submit_command() on big-endian host Date: Thu, 29 Oct 2020 10:33:05 +0100 Message-Id: <20201029093306.1063879-25-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) The Completion Queue Command Identifier is a 16-bit value, so nvme_submit_command() is unlikely to work on big-endian hosts, as the relevant bits are truncated. Fix by using the correct byte-swap function. Fixes: bdd6a90a9e5 ("block: Add VFIO based NVMe driver") Reported-by: Keith Busch Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index c8ef69cbb28..a06a188d530 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -469,7 +469,7 @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeR= equest *req, assert(!req->cb); req->cb =3D cb; req->opaque =3D opaque; - cmd->cid =3D cpu_to_le32(req->cid); + cmd->cid =3D cpu_to_le16(req->cid); =20 trace_nvme_submit_command(q->s, q->index, req->cid); nvme_trace_command(cmd); --=20 2.26.2 From nobody Sat May 18 21:15:57 2024 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=1603964129; cv=none; d=zohomail.com; s=zohoarc; b=T5WSV7zJLzqPZcG/bPOrvJbEy2ScT02i3zLoeafepPyjNUaWfnd4FFiO2DFnCjAha3F5ZIjW6KAA4zViHRVjiSE6R0z75Hk4+DYo9mcv1ghxlzoN8Xf+5RaokDTO6NsLMe5jhXhBoSTMoIuPOUUpMGWD3Kf/kvKWohEV5rBJwRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964129; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=6CxG9NMayv7lNoH0p7bnq04QWgTt0XfGriSybRVHEeM=; b=KAhC9SN4ZCnUD7rORWYxDJDFPj98bm77Oug38uzm6g0ao4w6C/mK8ZHe99NCpgXAuzGB1+OSIYdffUJFojZwf4J7J9OKUXrRhGJvCE7pnOawkaFumhmIy2W/UQX/XRRdsD4O8lHrqj2COTGxs90S/XybxrBn/KgZw3ItbJf9efk= 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 1603964129439812.3891562754873; Thu, 29 Oct 2020 02:35:29 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-108-CTKMWCqQMpCOFVhZ_0vFMA-1; Thu, 29 Oct 2020 05:35:24 -0400 Received: by mail-ej1-f72.google.com with SMTP id pk23so952371ejb.4 for ; Thu, 29 Oct 2020 02:35:24 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id z26sm1132422ejr.95.2020.10.29.02.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964128; 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=6CxG9NMayv7lNoH0p7bnq04QWgTt0XfGriSybRVHEeM=; b=Etfi/mPX82niyZKjhuGWX9be4bpwhh9KHenQbGmHyj/jkjPa0d+6frBxN5IzMxR6JDBoSF 1BtoUj5xVgm435kWTaYi49bPmXkxHjaSQ7jgiN8bbZxTeDTt2m5PLAfohiRnT5rAOGR8US pXMzRTuuA/H+EPKHbVsrkXOGoOoS3D4= X-MC-Unique: CTKMWCqQMpCOFVhZ_0vFMA-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=6CxG9NMayv7lNoH0p7bnq04QWgTt0XfGriSybRVHEeM=; b=c3mLeEG75uhsQuWB7185svQz3rMdubt44BpVOaDc2rEiKGatDpS6hDG+LCMSNYWY+3 HEzmRzHrGHXTFvKKxrHl7/R8feiTe1Ph/ocOzh1fkXDRmM9Q0RmUnhFp4KgiUYTPnAkt Qj1D4D0/c+0GQy1HxUiowcKWY/ATzB6eHth/596FG/hex3eZ1FzzA7PJ7xiCp7Ylo29T b/nvZ/LlR+rBYud8/1SoaxHjU608yZKo9hPP7IFEfj1BZBgjiumuT5g/jJy3sZEItMfy iAbuHf1hNNYJHiRTsnlV6RgyvBC9UNREPe4NXgdV2x1rih9IQW1/3gdzaAHwC2Co6hxr ikbg== X-Gm-Message-State: AOAM531seXfq5/nOPPxV65WefI0RE3GxPQFyT49PMIz9lzwHrH1d3dUj wpU2UcxaxQPD++DsDXg84Czax9USTqbW7GHyG+2YNDSLICRUysExjkbgTlJWY0rDHjaXQTVXHVg tNVQ1D4Rwe9gH+A== X-Received: by 2002:a17:906:ad8:: with SMTP id z24mr3088362ejf.222.1603964123088; Thu, 29 Oct 2020 02:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC+IWVYnxsFiNYMeoq8eRoPda2VfeSkfVEOq2EjdCKwWfduPOmGFFbe830j93S6av6NEoJ0A== X-Received: by 2002:a17:906:ad8:: with SMTP id z24mr3088349ejf.222.1603964122892; Thu, 29 Oct 2020 02:35:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.0 v2 25/25] block/nvme: Simplify Completion Queue Command Identifier field use Date: Thu, 29 Oct 2020 10:33:06 +0100 Message-Id: <20201029093306.1063879-26-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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) The "Completion Queue Entry: DW 2" describes it as: This identifier is assigned by host software when the command is submitted to the Submission As the is just an opaque cookie, it is pointless to byte-swap it. Suggested-by: Keith Busch Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index a06a188d530..e7723c42a6d 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -344,7 +344,7 @@ static inline int nvme_translate_error(const NvmeCqe *c) trace_nvme_error(le32_to_cpu(c->result), le16_to_cpu(c->sq_head), le16_to_cpu(c->sq_id), - le16_to_cpu(c->cid), + c->cid, le16_to_cpu(status)); } switch (status) { @@ -401,7 +401,7 @@ static bool nvme_process_completion(NVMeQueuePair *q) if (!q->cq.head) { q->cq_phase =3D !q->cq_phase; } - cid =3D le16_to_cpu(c->cid); + cid =3D c->cid; if (cid =3D=3D 0 || cid > NVME_QUEUE_SIZE) { warn_report("NVMe: Unexpected CID in completion queue: %"PRIu3= 2", " "queue size: %u", cid, NVME_QUEUE_SIZE); @@ -469,7 +469,7 @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeR= equest *req, assert(!req->cb); req->cb =3D cb; req->opaque =3D opaque; - cmd->cid =3D cpu_to_le16(req->cid); + cmd->cid =3D req->cid; =20 trace_nvme_submit_command(q->s, q->index, req->cid); nvme_trace_command(cmd); --=20 2.26.2