From patchwork Tue Oct 27 13:55:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C74DBC55178 for ; Tue, 27 Oct 2020 14:15:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 680122222C for ; Tue, 27 Oct 2020 14:15:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jb0FSSkz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 680122222C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPkh-0006ZJ-DN for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:15:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSF-0002gM-8n for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSD-0004Co-FM for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806960; 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=kHDg5TLpZChWqON6ng1k59lvL09+LS2LIxOnQI0wvdw=; b=Jb0FSSkzvv66RV48Xp5qQw6MaUYb2pwI9gcjz5tq1deSx0P5MKpUGJ5Mm1RvP3S/tVntiN pUQV/Max8O1wp8RSapaR4oph0rQ0HxZVu4brRbEZ1/JyErp/SITshAJTG6WDBh43lh/5bE 0RS039hGHN1gJCFZNhhw7T4FBMbNsPM= 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-61-jWakotsxNj2WOQhYlitD6w-1; Tue, 27 Oct 2020 09:55:57 -0400 X-MC-Unique: jWakotsxNj2WOQhYlitD6w-1 Received: by mail-ej1-f69.google.com with SMTP id lf18so899790ejb.13 for ; Tue, 27 Oct 2020 06:55:57 -0700 (PDT) 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=kHDg5TLpZChWqON6ng1k59lvL09+LS2LIxOnQI0wvdw=; b=NO1PfvXfGrYptN3L7dtfVm1EYYk+CPLJ3O+oI07eTmbRvR8R0fG2sr3fzJS/VQtzKH fR0XU9A3hq4UVVVAsnI0QF0/y76Ah668g8jjEIzJ/gzjgWFFGF5Y6dia747Z3cyhMAXP Smq7ZZIOV+6gzhXJ4uHZDvtKYV2N279d7U6u9bea0cNMibh+V+7KVIz1YJfBeSo1cVb4 EyzaMX+ZuHNBrlJjPoTChPvMcqSGguaPrarjINU3jfaHWfb+ZayItyEnrJl8iiFDwYVi CMtX73sOr4xZOY5RrkMqBVeu6DkjPNsbVXvOGj2vwlOSNSVJLJeDsAM5h7VlT6k5emw9 X+3Q== X-Gm-Message-State: AOAM530xDHcMmAYwFzFdggqbuo/sckXF76Fdt/ugmo5hnCENB+QoHuKq vb8el+n0rdJJkEn7VslA7HEUGGtnfeZgXghwV4V1GbAGdck4V0xU1rojGW+T6H5QInHD5I+bIdF J9091vV2dzv+/Ym8= X-Received: by 2002:a17:906:640d:: with SMTP id d13mr2421977ejm.223.1603806955970; Tue, 27 Oct 2020 06:55:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzm+Sl0xVtt5k1/E4kvlxHQw7ySGnLPNQx9gg/R1TcWwzq2Qq5fjEGpc4SmSIpFAXuWjm9txw== X-Received: by 2002:a17:906:640d:: with SMTP id d13mr2421945ejm.223.1603806955659; Tue, 27 Oct 2020 06:55:55 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id bw25sm1111452ejb.119.2020.10.27.06.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:55:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 01/25] MAINTAINERS: Cover 'block/nvme.h' file Date: Tue, 27 Oct 2020 14:55:23 +0100 Message-Id: <20201027135547.374946-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Klaus Jensen , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ef6f5c73998..9366a1b2b3a 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 @@ -2953,6 +2954,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 Bootdevice From patchwork Tue Oct 27 13:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49DABC55178 for ; Tue, 27 Oct 2020 14:02:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF1E222258 for ; Tue, 27 Oct 2020 14:02:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="J19eMQCO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF1E222258 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPYp-00017r-Nb for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:02:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSJ-0002p8-4B for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSH-0004DZ-Bj for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806964; 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=faAds+I3T/QXPAYkC+t4lGLvv4Dkjc5SBZjt6RcJJiw=; b=J19eMQCOODSJ+LPgOBasVzhKYKZgy0hWSUQkDMAlM1IX9Xsu4oXzJdEubHvCl/aiks4CQF hDkXXewno+dCV3cfdxH7ZrWZNtTHz5JUnr2t8e0ETqGq6l0i6b1Tf8OIO5QSaPBKrcBkxo hJpuYkJpwIx+A3IKUkRV3JgEDhM9TjQ= 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-213-jytlUp0uO2aYVaq06FdxYg-1; Tue, 27 Oct 2020 09:56:02 -0400 X-MC-Unique: jytlUp0uO2aYVaq06FdxYg-1 Received: by mail-ej1-f71.google.com with SMTP id z8so939921ejw.3 for ; Tue, 27 Oct 2020 06:56:02 -0700 (PDT) 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=faAds+I3T/QXPAYkC+t4lGLvv4Dkjc5SBZjt6RcJJiw=; b=pvmqaYZIBrpQAffocS7dKbr5obhL/zJNsplyzKNEjmRCndGeoXAZNqs6nN+Og3lRHa Vdv8f+iabXgGYdwEWp4rIZ6NIiIls1VJBiqbGblVrI0jG5VlKuxBgaknXQ0DC6FXVltW aGero57to5CNOoEUL8wOqrZmYT5t2jZUpggZXjmyKcBAv3MwktuuxYBRgqDa41U1RnY7 wl1XRj61eGTYuEj29fgovWd8BVZaV9KL91QXduP6Eet284Kpa6xAeKTKLcZRlfkryQd6 LWelZXucvKBSBDOfIsehNcUa2KRuTn88IjGbXQ/SwegImEHdcZtHfy027K7UOiA4j9Sc MEkA== X-Gm-Message-State: AOAM531u9f582QjA56bmIXjDsRiy7+HxNFQmf2nj4/3FpCr3lSGKjXTJ RIAd9DcHLavk/SjvrtzPO+cJYKH2NVfv4VPCYOUx0Cv7lCNdbquso6Wl8aZbqWGgI0Nodkmgw2J sp29JZZGP1Y6tR0A= X-Received: by 2002:aa7:c84b:: with SMTP id g11mr2282892edt.86.1603806961310; Tue, 27 Oct 2020 06:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0FF6H+9NW/CpsE27BDUdX+VEQ9qNYcDYjbD83uhjrsFxaVSQUtGW42sbTbKdvm6WVr5HfDA== X-Received: by 2002:aa7:c84b:: with SMTP id g11mr2282868edt.86.1603806961082; Tue, 27 Oct 2020 06:56:01 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id hb6sm1109168ejb.65.2020.10.27.06.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 02/25] block/nvme: Use hex format to display offset in trace events Date: Tue, 27 Oct 2020 14:55:24 +0100 Message-Id: <20201027135547.374946-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use the same format used for the hw/vfio/ trace events. Suggested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- 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, int 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, int flags, int niov) "s %p is_write %d offset %"PRId64" bytes %"PRId64" flags %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, int flags, int niov) "s %p is_write %d offset 0x%"PRIx64" bytes %"PRId64" flags %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 ret) "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 offset %"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 ret) "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 offset 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" From patchwork Tue Oct 27 13:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F591C55178 for ; Tue, 27 Oct 2020 13:59:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 064E4218AC for ; Tue, 27 Oct 2020 13:59:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SUTGu0VU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 064E4218AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPVf-0005Tv-Rx for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 09:59:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSO-0002zp-UJ for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSM-0004Ef-N8 for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806970; 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=hJ2JSVFibEBuSdrDhyhun8v6dNN9NfBaGi/52/sdax4=; b=SUTGu0VUM1HHflHXu1F0Xf4jSgqg2BFxpdB6/mYGdLacV69JE2FKHVrHf53vMUoJitmJss d6wD383Gvy2yWv0LRp3rHZ5UU0B7VRgzzJOONthJaVaRYigzzqei1dVKLrycvJKDsGEHVp Qb19xPtIRqMAtyHSNoRD+k+/I8DD3ak= 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-373-3ZgIFAhaNyCzX7GnW28XRA-1; Tue, 27 Oct 2020 09:56:08 -0400 X-MC-Unique: 3ZgIFAhaNyCzX7GnW28XRA-1 Received: by mail-ed1-f70.google.com with SMTP id cb27so708107edb.11 for ; Tue, 27 Oct 2020 06:56:08 -0700 (PDT) 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=hJ2JSVFibEBuSdrDhyhun8v6dNN9NfBaGi/52/sdax4=; b=qXCgIsdjRrCZhf8YipLP6fJfyhsQYyXrYMY91HixmkhRlMBUVJHvIf0MuHMgaSOSgt d1W6wkZR+kjIKhQmUkv7g1GZpmOO1cY5XGEGbaT06wAGuWtiR2bPqKwetD0nlDbqiV0O snGM6m4l3vWAw6BNJFH89UB4TSV+AIfGOaTtFTvV5Pf94s1qdtYKQcHmxCgWbpdizP2X HOwgAqRJ0GYnn5wiC71qKBXmE7M/vk1yHlpj+ZaRFouZ0y0dX+cpVZOqlVYpTO+n8ESO ZJ768/80YOM5PxMMrbg3rU/eAjrDn801VW0SLwtyZ0ByfBL65O08/5Tzgna3pInuY/R5 OwBw== X-Gm-Message-State: AOAM531m90p4KDk3PO2NUB1RNfweYXxIG5sy6rTfURjnMCbDTcX1pu+0 oSLzwldCMZ0/leadVZIo8vG5xWKNIkdBT/n/W9B8UShUeiGcJdDBIs6AENgzq4B220UVUFvhqLq WJcstez5ZJ+P8pCE= X-Received: by 2002:a17:906:444:: with SMTP id e4mr2716816eja.218.1603806966727; Tue, 27 Oct 2020 06:56:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBws8uIONsfcGYcdCt+x1vB07twQn0gDSXUmcWfHyfPueaX4Z30qZk5k0Xz7UVX14DKpAalQ== X-Received: by 2002:a17:906:444:: with SMTP id e4mr2716792eja.218.1603806966504; Tue, 27 Oct 2020 06:56:06 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id ck19sm1076488ejb.99.2020.10.27.06.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 03/25] block/nvme: Report warning with warn_report() Date: Tue, 27 Oct 2020 14:55:25 +0100 Message-Id: <20201027135547.374946-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Instead of displaying warning on stderr, use warn_report() which also displays it on the monitor. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- 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 = le16_to_cpu(c->cid); if (cid == 0 || cid > NVME_QUEUE_SIZE) { - fprintf(stderr, "Unexpected CID in completion queue: %" PRIu32 "\n", - cid); + warn_report("NVMe: Unexpected CID in completion queue: %"PRIu32", " + "queue size: %u", cid, NVME_QUEUE_SIZE); continue; } trace_nvme_complete_command(s, q->index, cid); From patchwork Tue Oct 27 13:55:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301838 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FEB0C55178 for ; Tue, 27 Oct 2020 14:19:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8A05206D4 for ; Tue, 27 Oct 2020 14:19:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="D9USzSOz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8A05206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPp1-0003X1-Kg for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:19:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSX-00031k-KV for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSV-0004FY-VD for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806975; 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=a7fBCIQ/1BkfqoPLON3TqQaNLgboMKILqf/ROXQloYA=; b=D9USzSOzyANn/jANOYByR8mkYpdg7EYcD8+Vq09yBA4cEkOFsDkZRjdh6hqLzJldH3J/yv C638030DA4JCfRxTjgzJ2YN4seG13Rqk6sQhROMXi+7ROV1CzEiw6nwrGutjSGMZ4B9MKA 9YnsuGwwtxo4mk3ZIi6oeilncd+KS8U= 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-4ln7PhDBOZa0A2fZ_bjsxA-1; Tue, 27 Oct 2020 09:56:13 -0400 X-MC-Unique: 4ln7PhDBOZa0A2fZ_bjsxA-1 Received: by mail-ed1-f70.google.com with SMTP id n16so695236edw.19 for ; Tue, 27 Oct 2020 06:56:13 -0700 (PDT) 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=a7fBCIQ/1BkfqoPLON3TqQaNLgboMKILqf/ROXQloYA=; b=a/+zQpOAI7jrdHcFcOXNCb7ZZvcv3Ci+vMxti0elu3NQ0UeqJjcDBnF6u3uMGjYcSX eyra+opjYGDppqL+X7+8BNKrp7AyIY4ymDm5lG/t1j0oepLVLlVAigPcWvs3vBeDOz/S Fxy23zWkonMSBllT8MRnxu6zNLKw3QNeusk9P8arw5LAJTn/MuIG4NDpBGBzRoSWa+3/ 4h/rlAO/Rqsye1w6/h1OkFJS6DXTr55bt6EImG6g7OncGLdskQKkgmiW2b/SlSzoTOg5 frMby0tKDPRGk/CoKPJS++3ggv37gWUKSQSJt7cFQwT9b+4426/3deoShHpOlqQHRp/H L3pg== X-Gm-Message-State: AOAM532UyN1Ipk+EuLu6rOW1VGqoANa9tiw05kyN+pcjHX6BjFKqRBHg Wq/5L3TxYhUn5IZ+z1xw2zeeExM6HuGJGYZcJjxj2X332ui8/ljFqiXHI2J02nq1XOYP8P65PC1 FDmcIAdWIYJ0Ha+Q= X-Received: by 2002:a17:906:1804:: with SMTP id v4mr2593852eje.201.1603806972001; Tue, 27 Oct 2020 06:56:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZgJ0Yhl0g+IaSqdnBKcqOlMQmDkgQVickfFpeBkLGikNBaXcoPQA5gqttgXSEN0pAPYoMDg== X-Received: by 2002:a17:906:1804:: with SMTP id v4mr2593829eje.201.1603806971794; Tue, 27 Oct 2020 06:56:11 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id qq10sm1126501ejb.31.2020.10.27.06.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 04/25] block/nvme: Trace controller capabilities Date: Tue, 27 Oct 2020 14:55:26 +0100 Message-Id: <20201027135547.374946-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Controllers have different capabilities and report them in the CAP register. We are particularly interested by the page size limits. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Eric Auger --- 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". */ cap = 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 = -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 start, size_t len, uint64_t qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu" # 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" From patchwork Tue Oct 27 13:55:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D48CC55178 for ; Tue, 27 Oct 2020 14:22:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0AE5206FA for ; Tue, 27 Oct 2020 14:22:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Nwi5zr1A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0AE5206FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPs9-0007JL-Nj for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:22:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSa-00034r-6W for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSX-0004GA-5Y for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806980; 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=W4p23PAiAshE1wqHPJXxubFhGilm8TUfsmi+fLR5mFU=; b=Nwi5zr1A5iyt7/8lizFgAOeJxTElYeZAVmwRTzbDMQyQ/zrOzqEYoQYV/WRfgc0fcucp2X b0UsPrScF2zKtMxeEIbhKz1O0+wMW3h4clsN1ojY4gBetm44F1SAhRczwkRQgbo+4tR0IY hUWNMIizRwogiwlsXpwMfvZRvjc6UBg= 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-519-FtNe1-IAMFyHwIZf3LdxtQ-1; Tue, 27 Oct 2020 09:56:18 -0400 X-MC-Unique: FtNe1-IAMFyHwIZf3LdxtQ-1 Received: by mail-ej1-f70.google.com with SMTP id c10so892977ejm.15 for ; Tue, 27 Oct 2020 06:56:18 -0700 (PDT) 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=W4p23PAiAshE1wqHPJXxubFhGilm8TUfsmi+fLR5mFU=; b=pN4uRoI3YgEMH1Gu0RAoEM7Hm6eooUFN5EE+dSAJcb/zMdRzf5kh37af7anbXNTQWf 29MqlJgkkmMUXldhIpmvnJsQ9EBaL1HS/GhNEvinfq0AXkpCGV/ehBpiarxe4Qv95c66 IcTls5s4NMRBnGnmPx5YZ3QkrSR1Tfd9UkHfinV3Ty/KVFk+Wip09DJXPt8Mv8IXIu2c Ho7FHa2kx7dbmdkeiQO2RUZZ5g8aGGXvyDiUDav1XVffkDkQmSjyeArfVOxofB6AE0tc bWexu5H7VFmQUWfKB5n28zBPJhJLXt5hY+rXWx44dgi4rfGv4fi3kKSTm5StA8gO8K6j 3/iw== X-Gm-Message-State: AOAM533hEqJ7r8CCYFzMGXg/8rQ+42ikNhCRu6qzLgy4JtYxgWHrOhPE lyyYOjkGSzc9Q9b1Lvv+nWZ3mkJM5l5HPOIAtu6nWkelSlGo0ZzuJYZOyZMXoirOD6UlvWVq5O2 yx1FYtBI59r4P1Lw= X-Received: by 2002:a05:6402:1597:: with SMTP id c23mr2333562edv.155.1603806977127; Tue, 27 Oct 2020 06:56:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCRg3m9AjyyZc8sVf3hr531fxX8NHAcXcVOzmNdPiFosGkCCMbuKs3qZZhGAqy2IGvrMhbIw== X-Received: by 2002:a05:6402:1597:: with SMTP id c23mr2333537edv.155.1603806976927; Tue, 27 Oct 2020 06:56:16 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id ce15sm1179509ejc.39.2020.10.27.06.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 05/25] block/nvme: Trace nvme_poll_queue() per queue Date: Tue, 27 Oct 2020 14:55:27 +0100 Message-Id: <20201027135547.374946-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- 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 = q->cq.head * NVME_CQ_ENTRY_BYTES; NvmeCqe *cqe = (NvmeCqe *)&q->cq.queue[cqe_offset]; + 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 = container_of(e, BDRVNVMeState, irq_notifier[MSIX_SHARED_IRQ_IDX]); - trace_nvme_poll_cb(s); return nvme_poll_queues(s); } 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, int 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, int flags, int niov) "s %p is_write %d offset 0x%"PRIx64" bytes %"PRId64" flags %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" From patchwork Tue Oct 27 13:55:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E482C5517A for ; Tue, 27 Oct 2020 14:24:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 098CF2072D for ; Tue, 27 Oct 2020 14:24:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VRVbNQKu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 098CF2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPuA-0002Jd-Tr for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:24:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSk-0003BU-0b for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSe-0004IV-Bw for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806987; 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=WBWP7KBMIQI6YRPnFGQwZbxBBXEh8CIfDLyp5hJxrI0=; b=VRVbNQKuJJWBjmJ96IPkNvmBeYQW1qHE2ndaa47a2YlZ9+uZSG8EKe72X3ltONpU7jULOt 3zMW3kUEu4Glvfbi8fSOtIi4bLC3Q3U3f5ijjIPxHvsOZ1SjiYIOIDUTOzq9KH18lG0X+0 iRcwxvfKRSA3oSIzZ2RZ+aJ2CfB/PVo= 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-559-p_Pz2hkeMmW3O3ByINQU0w-1; Tue, 27 Oct 2020 09:56:24 -0400 X-MC-Unique: p_Pz2hkeMmW3O3ByINQU0w-1 Received: by mail-ed1-f71.google.com with SMTP id y8so730445edj.5 for ; Tue, 27 Oct 2020 06:56:23 -0700 (PDT) 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=WBWP7KBMIQI6YRPnFGQwZbxBBXEh8CIfDLyp5hJxrI0=; b=V/Y+BIP8C7iIX9DZJ4ovJjk/5SvGnPq6Y4aIlTr6H3P+EkDm1oQC6qotB9J64ZfSkE NhSjSG4f6t5Vbp5j8P4lRpAXbUEYBpW5+FbUBT4OaTBLNDMVPwx80atRoOC+I3nALp0U yNkX5wewNFl9pknWE3MvSlP46Mrtjk6l5K9mpE7xDiZJhZ2e9Ygu8JpfecYAOcEXLZoD 7ppDgAwMPhAM+knd+GUldThdfxsLC6Fmy2ywoSP7OmdGZ3n2fFEnmKYr6pJ8l14mKSvE a/u2w3HV8QH6FMwOS2wCh8IQEAyhvoGDQgTksS9/7R9nTfB4Iqt+AnloxJz+8+Bx+JPI g/wQ== X-Gm-Message-State: AOAM530nxIkmzeNRh0vCSJrZzFaDPQ1tNsIVF1C9EbbghXhI2mjmx3mG IdqjyxDTSYbUo8U8oIJR65QqnSPM0zoovQv1HwPCdHEe4bd6zL006XH0cFKjfj0GUZqS+cnfgvk AsHPMKF9w8N+v528= X-Received: by 2002:a17:906:5594:: with SMTP id y20mr2650653ejp.196.1603806982302; Tue, 27 Oct 2020 06:56:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQSZcVQU+o3Hk7rvmzMGq3IlquhDlUEgCoHtlKGQdLsCnzA4YKsJOo+FZo8KxtT0R5NaJ0lA== X-Received: by 2002:a17:906:5594:: with SMTP id y20mr2650638ejp.196.1603806982089; Tue, 27 Oct 2020 06:56:22 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id h15sm1088318ejf.50.2020.10.27.06.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 06/25] block/nvme: Improve nvme_free_req_queue_wait() trace information Date: Tue, 27 Oct 2020 14:55:28 +0100 Message-Id: <20201027135547.374946-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" What we want to trace is the block driver state and the queue index. Suggested-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- 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) while (q->free_req_head == -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, uint64_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 offset 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" From patchwork Tue Oct 27 13:55:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51424C388F9 for ; Tue, 27 Oct 2020 13:59:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0DE621D42 for ; Tue, 27 Oct 2020 13:59:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Yx4K5jG+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0DE621D42 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPVl-0005ka-Vv for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 09:59:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSm-0003D3-CB for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSj-0004Is-LO for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806992; 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=WTNKxaQwF4QN5Qm5IVyY35OwN1rDPq29NQ3lg6jSg14=; b=Yx4K5jG+RMU1t8vONfY2eiBvulIVGXVHI7/Ip7oH4RPfbmG4f2WojyY5yBT8CP3sCPO0Tq inpFzmyYZHFQJ5lbV47t488s3fsX0nt8/L1mDuT43NsyApSbP2HcAf5j0QiLEhPuPkWAzF EP7xK7tf4H7ZVH7lPn/LADBrvp4xcsI= 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-426-C604_w8kMzil-TUDQC79ww-1; Tue, 27 Oct 2020 09:56:30 -0400 X-MC-Unique: C604_w8kMzil-TUDQC79ww-1 Received: by mail-ed1-f72.google.com with SMTP id 28so718023edv.9 for ; Tue, 27 Oct 2020 06:56:30 -0700 (PDT) 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=WTNKxaQwF4QN5Qm5IVyY35OwN1rDPq29NQ3lg6jSg14=; b=Cx2egbSijMdDn3L03k+t7xytGpMMbiTMKbcn0ewxHUdzEX0JJ8hXdJmTsQbKnsYSwE emPPEn2IOwO87yJKsRPuDjXIsmOPdRJyeXMygx6W6AZSd89alAZZ1rNc/VsK3gQsPbnI Udi49hddSofm1Eq5cR/fCofE2z3AYL+HttvPBy4JfNa+jHBiJjazgKi3gjWs0YFQmA+G C356YbRXwBA13HwlVBGNZ2JGTqe9bJaEwge0Lhqz32lYLoeBX5gDxLudwkIPeXtwSqEy gOQ8hlswmhlYrDmfM0m7odbZ7dkyTh6uXOaNG54hzybvqUuRgFQF+dD/Z7tMetb/DZMg QJGg== X-Gm-Message-State: AOAM531aH/xuuIizmGz1bGXiamVO73oRrGa3peJwDyeiAx7ghQ+uGRgp 94JFEONEyhgOSO6ZzPsX40cRwAX3Hk0dNi7vy4c/fOedLvx4/wTvJo15qu1r7JiL9f/KTGrhbt2 Dr0NHofNuz7ox5bY= X-Received: by 2002:a17:906:383:: with SMTP id b3mr2438569eja.351.1603806988534; Tue, 27 Oct 2020 06:56:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1GxBVUWTaaRofwrnmQgxs4Lw24I6NgzGnpAE7MCbszHDz/c7vUniMMGK4M9jVN3Z39g/66A== X-Received: by 2002:a17:906:383:: with SMTP id b3mr2438554eja.351.1603806988329; Tue, 27 Oct 2020 06:56:28 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id v18sm1154105ejj.10.2020.10.27.06.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 07/25] block/nvme: Trace queue pair creation/deletion Date: Tue, 27 Oct 2020 14:55:29 +0100 Message-Id: <20201027135547.374946-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- 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, 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(BDRVNVMeState *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 = 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 offset 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" From patchwork Tue Oct 27 13:55:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACCCDC55179 for ; Tue, 27 Oct 2020 14:07:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D69A22263 for ; Tue, 27 Oct 2020 14:07:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fqJEUmTF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D69A22263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPdB-0005Oa-4A for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:07:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPT3-0003Gq-S4 for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSv-0004Jt-CF for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603806997; 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=H+ZJ92q9c8sHM7tIK104/2szOIvYpUY13gacvPM2KaM=; b=fqJEUmTF5RetYB704NJwudyDuCaZ8KYaHVwABTtMog4kowKqfqDcWHcLFCP7FbwQ+mKn6r 6wrfRQQ/M03z1Jbilq2yq4QbPGgzPEkfGBJqGFrmjx5dX4f7Ql/cY6rykcwUZiVWjKP5CY faDKqmxOdv1CyTx1UHPu5xhv6AsNRQY= 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-347-e_RJLRwyMiO1DeYQQUqdAA-1; Tue, 27 Oct 2020 09:56:36 -0400 X-MC-Unique: e_RJLRwyMiO1DeYQQUqdAA-1 Received: by mail-ed1-f70.google.com with SMTP id cb27so708703edb.11 for ; Tue, 27 Oct 2020 06:56:34 -0700 (PDT) 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=H+ZJ92q9c8sHM7tIK104/2szOIvYpUY13gacvPM2KaM=; b=NlogwzKUb+82llUUug5liD8i724jN10kD5XC1zeDB8YQ++pJ8ndBu7JMn54KPwChco /Gnp5KIX26PGweAJdC3wstDSB+Kz1xShDZ4EuhFYKz7nsXaEH929FWl9Y9HMjIwO5Qp0 NPz90+eyQluAFmjx16mWFBkC5L9zOFCYYTA6lH3IF90Zk3tMz4ccv8otnqfAQAIgd+sU tZDXuovDwsf6csOqosROpY/Prb+diugN49KQUU/UsYy2+87Qe8oWewA/pmzTdNs7ks4F nCu/idiHt4ptMLTUF3OC0KfqJ1Qa3EmB2jpTg1awyz1Iq/WjfzxJBzaPl7sV2vrw6QQG xZ5g== X-Gm-Message-State: AOAM530PY+l8S5zWqSdAhglvn+z18qLWrKoTquce52E4S+J8Bx33yDFw 9jRaWefc2y+bUwvYF6elWb3fD5BKPvjlpYsjlYpZclAuiioo4DZVseoeBaAZHDxb+NXsin3wFey 2Nh4CHmSYWWbJnfk= X-Received: by 2002:a50:b023:: with SMTP id i32mr2279432edd.377.1603806993704; Tue, 27 Oct 2020 06:56:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBHskYR7MdFyujMfh7jJZtXEwL7Sga5wgF1zNKHEZcbBSH0cK23mgenucEppfPBb6oRjPsaw== X-Received: by 2002:a50:b023:: with SMTP id i32mr2279410edd.377.1603806993546; Tue, 27 Oct 2020 06:56:33 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id r1sm1094650eju.40.2020.10.27.06.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 08/25] block/nvme: Simplify device reset Date: Tue, 27 Oct 2020 14:55:30 +0100 Message-Id: <20201027135547.374946-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Avoid multiple endianess conversion by using device endianess. Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index e95d59d3126..be14350f959 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -755,7 +755,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, timeout_ms = MIN(500 * NVME_CAP_TO(cap), 30000); /* Reset device to get a clean state. */ - regs->cc = cpu_to_le32(le32_to_cpu(regs->cc) & 0xFE); + regs->cc &= const_le32(0xFE); /* Wait for CSTS.RDY = 0. */ deadline = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + timeout_ms * SCALE_MS; while (NVME_CSTS_RDY(le32_to_cpu(regs->csts))) { From patchwork Tue Oct 27 13:55:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 450BDC55178 for ; Tue, 27 Oct 2020 14:03:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DEF1022258 for ; Tue, 27 Oct 2020 14:03:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PgGt4xAf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEF1022258 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPZ8-0001Fn-R1 for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:03:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPSy-0003GP-Gb for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSv-0004K3-Ce for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807001; 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=bCeDQAW3OylaJlAm+u7tQregjbauJK7WkWlW+Me7/c4=; b=PgGt4xAfWFYAvfTBl7BrcVNI1V4SQAxXx7eoWdGOi9D3PfuVqwjc1DQHOf1GXjD0yoEIxM kzX6if4iHGc89B9Ve8zxdSKpPfTQZT+mRZDy/vES3lbxBe8RKh/baS28UYzbb7HxtzQLq1 TfHc98gDj/CXHLZg0fTHnpFQ7144QIY= 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-547-ouQ4QRCYOqaVuOA0OO7P2A-1; Tue, 27 Oct 2020 09:56:40 -0400 X-MC-Unique: ouQ4QRCYOqaVuOA0OO7P2A-1 Received: by mail-ed1-f72.google.com with SMTP id dc23so708492edb.13 for ; Tue, 27 Oct 2020 06:56:40 -0700 (PDT) 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=bCeDQAW3OylaJlAm+u7tQregjbauJK7WkWlW+Me7/c4=; b=JvsocXTR+IdZSKRLYVlH/WJQQB0foAJ5C9iOHQl6PxWJxqipKGMkijHhrWikqG3LMd ZfsYiqnxBPV9UYwHSEPQWCQHjlQpx/uK4/la+toC6CQ7gPWmZJwEB/Ud1EmBlnTnWaKv oMVu7hNG2zDZYSpSx8Hfl8rcv2CgOR3y/3z3Tp/zRObfJKnBGOul59gAekmFWTOnh8T1 7RQxBZLLAcG5jkLKOnI3znVFtTlXbJhDXKkHNxJ1EhKtSJKIdAcL2/90ePnJYSDFgr6t WLsR3Z1cDNcSa4bVsx80yMmfB8FvmybXIPcpaQkxsUjPATizRrgcFDy5LumB9TOKTB2Z /JiA== X-Gm-Message-State: AOAM531PnkTk4wphb2XBKj1tAqrTCwkgxkTzx4Tdod7BuLjByqX3dmBo J79XFVmdZUu2uV0QlspOMBlNZHvBjf9O0W9fziVydjrCIZyMuGQVlK+1B+pSE27cSxO/p+O3VcM lThzUYLym2dYSOZQ= X-Received: by 2002:a50:d59c:: with SMTP id v28mr2274723edi.241.1603806998790; Tue, 27 Oct 2020 06:56:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAwSF4f4rrTMI+a8ODIG6OfZI5BURK+UmdQXTYcav9Cc/jo9sLKzMajOd2or3BiMUZZ/WwkA== X-Received: by 2002:a50:d59c:: with SMTP id v28mr2274697edi.241.1603806998620; Tue, 27 Oct 2020 06:56:38 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id i14sm1028621edu.40.2020.10.27.06.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 09/25] block/nvme: Move definitions before structure declarations Date: Tue, 27 Oct 2020 14:55:31 +0100 Message-Id: <20201027135547.374946-10-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To be able to use some definitions in structure declarations, move them earlier. No logical change. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger 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 be14350f959..30075e230ca 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -41,6 +41,16 @@ typedef struct BDRVNVMeState BDRVNVMeState; +/* 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 = 0, + MSIX_IRQ_COUNT = 1 +}; + typedef struct { int32_t head, tail; uint8_t *queue; @@ -81,15 +91,6 @@ typedef struct { QEMUBH *completion_bh; } NVMeQueuePair; -#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 = 0, - MSIX_IRQ_COUNT = 1 -}; - struct BDRVNVMeState { AioContext *aio_context; QEMUVFIOState *vfio; From patchwork Tue Oct 27 13:55:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F939C55178 for ; Tue, 27 Oct 2020 14:07:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE83922264 for ; Tue, 27 Oct 2020 14:07:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fkoiN60/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE83922264 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPcp-0004uM-SL for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:06:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTA-0003Iv-18 for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPSy-0004Kq-5X for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:56:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807007; 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=YRHflBytAvKOEPighLIKwiOsYqMDgywNA3AUBcmPj5o=; b=fkoiN60/k62X8n4I4/I956X1wL37PsrOnQzzB2uMPc5cgMwQgUKb+rT4ispKSuFMIgwNlK ANiR4XUyx+DsOz/I96zZ0vIPP4ILmqKOKi4UY3MQmGiuMFVDBcv9nqRl5H1Lc1aumwXzhm 7zdvcPP35t4F4y2KndmRHoOuF4eAROg= 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-413-H0hSWUS5Ph6MmH3Z-xuZ2A-1; Tue, 27 Oct 2020 09:56:45 -0400 X-MC-Unique: H0hSWUS5Ph6MmH3Z-xuZ2A-1 Received: by mail-ed1-f70.google.com with SMTP id a15so706013eda.15 for ; Tue, 27 Oct 2020 06:56:45 -0700 (PDT) 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=YRHflBytAvKOEPighLIKwiOsYqMDgywNA3AUBcmPj5o=; b=jeAXZnUl4mLXVN07EMeYyctXsE7hO6TIdy72SS4JwxQPHFF/LGG3QfCUMYJ0bE8SP6 kNDB+NOpqGGMHYEkCAmpDGHSVZ0wTBhSBW4mEzGPbkWhnGy101Hp+NEKFe9rIcIXi3r8 O546dOTTlQ3sj8orJQVLTlpmb5ltciU3nXrSPKbvCSZHwAWxokkwPumJtMo6tj2gJcWZ XMV1lJ/16RS533dBoZGh849NLp7ike2Lq7erfWesau9vggfKhk8+bw4b3Makm7xgFbQ2 HHyOmYahZpN3jyMHN2Tg1oH61p2rhza1omQgKLHQ5/7emmhBlTAZ76SO5rcGTgbzTccQ 9JwQ== X-Gm-Message-State: AOAM5301lqzY+GTbpLwmX41k8ee37T/fhI2aOtQte+sEYzbZWj0Ov9HO dWXKE/n4ZB+J+Kz3/MePVrG1UDutnJjnYyeQ1Dyy5wPX922v3/+qPtNt1kRvHtJ7NX/gq4yT4/K XNwiop+TzFc9pqU0= X-Received: by 2002:a50:9f03:: with SMTP id b3mr2284398edf.268.1603807004100; Tue, 27 Oct 2020 06:56:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLKiojXcmb2GVg4IwMH6G/vgitauYTwsK2dW7aRAEXasjzgL7BxPDzcyHc7vnnOIFVcv3ylQ== X-Received: by 2002:a50:9f03:: with SMTP id b3mr2284374edf.268.1603807003858; Tue, 27 Oct 2020 06:56:43 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id 11sm1082584ejy.19.2020.10.27.06.56.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 10/25] block/nvme: Use unsigned integer for queue counter/size Date: Tue, 27 Oct 2020 14:55:32 +0100 Message-Id: <20201027135547.374946-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We can not have negative queue count/size/index, use unsigned type. Rename 'nr_queues' as 'queue_count' to match the spec naming. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- 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 30075e230ca..8b0fd59c6ea 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 = { }; 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) 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 = false; int i; - for (i = 0; i < s->nr_queues; i++) { + for (i = 0; i < s->queue_count; i++) { if (nvme_poll_queue(s->queues[i])) { progress = true; } @@ -644,10 +644,10 @@ static void nvme_handle_event(EventNotifier *n) static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) { BDRVNVMeState *s = bs->opaque; - int n = s->nr_queues; + unsigned n = s->queue_count; NVMeQueuePair *q; NvmeCmd cmd; - int queue_size = NVME_QUEUE_SIZE; + unsigned queue_size = NVME_QUEUE_SIZE; q = 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, Error **errp) .cdw11 = 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 = (NvmeCmd) { @@ -671,12 +671,12 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) .cdw11 = 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 = g_renew(NVMeQueuePair *, s->queues, n + 1); s->queues[n] = 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 = -EINVAL; goto out; } - s->nr_queues = 1; + s->queue_count = 1; QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000); regs->aqa = 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(BlockDriverState *bs, bool enable, static void nvme_close(BlockDriverState *bs) { - int i; BDRVNVMeState *s = bs->opaque; - for (i = 0; i < s->nr_queues; ++i) { + for (unsigned i = 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(BlockDriverState *bs, }; trace_nvme_prw_aligned(s, is_write, offset, bytes, flags, qiov->niov); - assert(s->nr_queues > 1); + assert(s->queue_count > 1); req = nvme_get_free_req(ioq); assert(req); @@ -1233,7 +1232,7 @@ static coroutine_fn int nvme_co_flush(BlockDriverState *bs) .ret = -EINPROGRESS, }; - assert(s->nr_queues > 1); + assert(s->queue_count > 1); req = 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(BlockDriverState *bs, cmd.cdw12 = cpu_to_le32(cdw12); trace_nvme_write_zeroes(s, offset, bytes, flags); - assert(s->nr_queues > 1); + assert(s->queue_count > 1); req = nvme_get_free_req(ioq); assert(req); @@ -1328,7 +1327,7 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs, return -ENOTSUP; } - assert(s->nr_queues > 1); + assert(s->queue_count > 1); buf = 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 = bs->opaque; - for (int i = 0; i < s->nr_queues; i++) { + for (unsigned i = 0; i < s->queue_count; i++) { NVMeQueuePair *q = s->queues[i]; 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_IDX], false, nvme_handle_event, nvme_poll_cb); - for (int i = 0; i < s->nr_queues; i++) { + for (unsigned i = 0; i < s->queue_count; i++) { NVMeQueuePair *q = s->queues[i]; q->completion_bh = @@ -1446,11 +1445,10 @@ static void nvme_aio_plug(BlockDriverState *bs) static void nvme_aio_unplug(BlockDriverState *bs) { - int i; BDRVNVMeState *s = bs->opaque; assert(s->plugged); s->plugged = false; - for (i = INDEX_IO(0); i < s->nr_queues; i++) { + for (unsigned i = INDEX_IO(0); i < s->queue_count; i++) { NVMeQueuePair *q = 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, uint64_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 inflight %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, int 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" From patchwork Tue Oct 27 13:55:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6C63C388F9 for ; Tue, 27 Oct 2020 14:10:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54285218AC for ; Tue, 27 Oct 2020 14:10:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YxXHZAy1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54285218AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPgH-0000jq-Do for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:10:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTA-0003LB-S4 for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPT3-0004LR-JR for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807012; 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=SjDF8zsFaATkfEDLVjf49WgfMXHjaeRfhZvCWiwXv1Y=; b=YxXHZAy1iDD+ksAKCf4OLceq28nXiYKIOr5KCekldnJ4JPrehos0aBpH5uDGQVkkzJqGFM LCRHwwM2lwAIUR8tjV5YaN5/W6W0E8frABhFQjywZntovG1Dbx5IDoaR0KKDqBSUXhKmiY 4BU5ZYdzy90xKNi8CqujvW3vd5dKQQc= 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-20-jPezFaNvNDWvMvBjPQGuqw-1; Tue, 27 Oct 2020 09:56:50 -0400 X-MC-Unique: jPezFaNvNDWvMvBjPQGuqw-1 Received: by mail-ej1-f69.google.com with SMTP id z25so945724ejd.2 for ; Tue, 27 Oct 2020 06:56:50 -0700 (PDT) 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=SjDF8zsFaATkfEDLVjf49WgfMXHjaeRfhZvCWiwXv1Y=; b=LgM8kW/vcwG7X3xdDuZL/3XBU9Xfvf1hE4nW1Oytk0fqYg4IRALTHk6DiH5kr5fCdL zAvSRF02hYD1ykKf1wc3t9fe/2m7ws3o5vO4dlg3ADyFbxDFaN8Z9WP4sjU6HZk6Bito ggpgpCKdqhT3yJXVyUWvd75/pV01TClOheABKIjJkMxjmJzhi0FdAcAIWg6gnE+hQvab jnMrThjKM1TKLQhkzJqTj7nMZRR9QS/FWQoju39CHRpq+uXUZGBCHf4BzyWy2EmWLpar /eiK0ih5yb+PmU535mj93JEal3gBp9Nqe+iKlvJOWMhIx2czfEfD3TVPL8m4rq65MXNw NhCw== X-Gm-Message-State: AOAM533ehB3oG7OGTs1Cbygv3lI4djlR/il/UXg1JuggqUwqT1HYf5co 2nJBr2d8i4OiuqxPWYM4FjPTIgNnq000mhNHoPHdO3iKa6cw60lj2CPELGCdEGdHWsGaO1759yc JMnSNabmBtT26xaM= X-Received: by 2002:a50:e61a:: with SMTP id y26mr2436500edm.71.1603807009221; Tue, 27 Oct 2020 06:56:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+DR27WfkIA/GMYrmcTzta+rl+JsgFtdbD+cG83mgOnEso1y5WyQnYYkv6j5zpOEQvUrRoBQ== X-Received: by 2002:a50:e61a:: with SMTP id y26mr2436470edm.71.1603807009043; Tue, 27 Oct 2020 06:56:49 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id i14sm1028890edu.40.2020.10.27.06.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 11/25] block/nvme: Make nvme_identify() return boolean indicating error Date: Tue, 27 Oct 2020 14:55:33 +0100 Message-Id: <20201027135547.374946-12-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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. Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 8b0fd59c6ea..74994c442e5 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -506,9 +506,11 @@ static int nvme_cmd_sync(BlockDriverState *bs, NVMeQueuePair *q, return ret; } -static void nvme_identify(BlockDriverState *bs, int namespace, Error **errp) +/* Returns true on success, false on failure. */ +static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp) { BDRVNVMeState *s = bs->opaque; + bool ret = false; union { NvmeIdCtrl ctrl; NvmeIdNs ns; @@ -585,10 +587,13 @@ static void nvme_identify(BlockDriverState *bs, int namespace, Error **errp) goto out; } + ret = true; s->blkshift = lbaf->ds; out: qemu_vfio_dma_unmap(s->vfio, id); qemu_vfree(id); + + return ret; } static bool nvme_poll_queue(NVMeQueuePair *q) From patchwork Tue Oct 27 13:55:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 586BBC55178 for ; Tue, 27 Oct 2020 14:12:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E975922265 for ; Tue, 27 Oct 2020 14:12:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Z0Yqr9he" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E975922265 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPic-0004Ij-2F for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:12:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTC-0003Pi-PL for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPT9-0004MF-JV for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807017; 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=5UNrRYGfWn9M8qfpcFzDzOyggHy+DoEp25W1xSNXQns=; b=Z0Yqr9he0hGartmW0UQiTM59H3oJahK10kw01rQ9ilL/qKVtR8sl5kPErOmEti99R3/NuK GLg6+lWq43byGVZpdSu1oTRY3chUetJXViYryFnZT9g8QjtaVxGxeAU4RQ/5fJVIqhdzTV XUTlK42iETBGiKGbUbdTWKG0ghANLiE= 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-187-NVA_UoT7O165KWQe9EN8xA-1; Tue, 27 Oct 2020 09:56:55 -0400 X-MC-Unique: NVA_UoT7O165KWQe9EN8xA-1 Received: by mail-ej1-f71.google.com with SMTP id f11so858280eja.23 for ; Tue, 27 Oct 2020 06:56:55 -0700 (PDT) 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=5UNrRYGfWn9M8qfpcFzDzOyggHy+DoEp25W1xSNXQns=; b=ijcCwOIrXo16ETyG/KEkSHjJA1nutDuE/1hFuz/eV0vp4HpMJT9FM4u2g4vuxdfM5c 3jLZcq0tj8vQ/S5WpA5m2yribzLMAfYlzgcc4I0IGVdgtj87NkrtaTG7utw3JnCp3rPm ARmWwijS7r7/lxUHg/wVYQCHNK/AXUwbc2CMGweFmND/VOS7bp7jcPDlYfs8XAOsfT4+ p2a5JZDXvMAKz0w+Td/N8ME3lJVyuGFz3V1Q8FmCL3OL1dliNxGuLMeGgguLjAshHMPJ R6uW8XNNc8sQYfGNjWIGzhAcEfgv37k0u2M0VKkTHzFqhcRf8DpUlTLrjG9vD7+IfC26 pazA== X-Gm-Message-State: AOAM533ftU6mADkXv40RDTP3WP3uCNHrgjNuogoHMT1uPJuc8o5NilTC GGyq5adxVfFWA3Pzd+5xskRNkj/+9t+U+1PpqOvgpS5Oogwvp/CPe4AaEJqJAIdT+rWfO+Go768 44y/t13jtvYQZaQs= X-Received: by 2002:a17:906:1cca:: with SMTP id i10mr2568903ejh.487.1603807014413; Tue, 27 Oct 2020 06:56:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfu8uTTNbTc5SUgHNwN75/s0cC36p9ImYoAKcTKZOBsnKGav5H8mbnFW+m90c+b40ULMAJrQ== X-Received: by 2002:a17:906:1cca:: with SMTP id i10mr2568885ejh.487.1603807014202; Tue, 27 Oct 2020 06:56:54 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id b15sm945058edz.97.2020.10.27.06.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:56:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 12/25] block/nvme: Make nvme_init_queue() return boolean indicating error Date: Tue, 27 Oct 2020 14:55:34 +0100 Message-Id: <20201027135547.374946-13-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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. This simplifies a bit nvme_create_queue_pair(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 74994c442e5..9324f0bfdc4 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -160,7 +160,8 @@ static QemuOptsList runtime_opts = { }, }; -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,14 @@ static void nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q, q->queue = 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 = qemu_vfio_dma_map(s->vfio, q->queue, bytes, false, &q->iova); if (r) { error_setg(errp, "Cannot map queue"); } + return r == 0; } static void nvme_free_queue_pair(NVMeQueuePair *q) @@ -210,7 +212,6 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, Error **errp) { int i, r; - Error *local_err = NULL; NVMeQueuePair *q; uint64_t prp_list_iova; @@ -247,16 +248,12 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, req->prp_list_iova = prp_list_iova + i * s->page_size; } - 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 = &s->doorbells[idx * s->doorbell_scale].sq_tail; - 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 = &s->doorbells[idx * s->doorbell_scale].cq_head; From patchwork Tue Oct 27 13:55:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3D79C388F9 for ; Tue, 27 Oct 2020 14:03:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4194922281 for ; Tue, 27 Oct 2020 14:03:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="avSS2UCn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4194922281 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPZM-0001Oa-43 for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:03:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTH-0003Wf-Tq for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTE-0004O1-VT for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807024; 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=IaWnoSHk3gYww0GtxO3QwPtbarT6V9nMm5FHP0y80Lw=; b=avSS2UCnXm3puE6iZmetkuvMc9FyW85VErU6SE6jkF7wJzvZR2VfZ5+ULuvBreH8PkleML bQkqqaa4H3+501ql3Y3uZVs16HR6M0F+AlvbiwrqXIpNEiBptY3H9heJQltSqj1Crjvsl8 qGldgLBADBX0Wt0JASqe+4HOM+ynArI= 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-87-eO0I1uMgMMSoA4boqhK7mA-1; Tue, 27 Oct 2020 09:57:02 -0400 X-MC-Unique: eO0I1uMgMMSoA4boqhK7mA-1 Received: by mail-ed1-f69.google.com with SMTP id a19so691365edb.18 for ; Tue, 27 Oct 2020 06:57:02 -0700 (PDT) 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=IaWnoSHk3gYww0GtxO3QwPtbarT6V9nMm5FHP0y80Lw=; b=dTKeWYVHXZhHbNSWm1rYQKrkPQvjKabUDexMOB7DOibtV+Urf90xDzcFMlVXQL9kyH 96X8O1mlJ4kR5IFS0AIi8LNjuAaOz7bxt0a03+p3hYTbiJhWWsqOdNyIm2bwndQ+vPiG il4LvYh9VEurvCiQMycUSa8rVyy7vadEpRCtL+JNY0jnaR3N7rT2wlTuwLFbjZZzlnGS PtA7MPbBibKSZL/kUNhtA5/PNQmRr1uSFxUeXp+1LaqgM47udJouzgv3eTez7fFP2qAK M34Fsk+wokeMOLqsbvG+EvldaJtssb2s60O9jJI0V4sQAYMxfjyWktWU4/H6uT9ko8Ch jffA== X-Gm-Message-State: AOAM530J+uPjIScgpCtn4ClntG1TWIPIuS5rIK+qkIkg1rjcG8CN5i+f upaGlJwxRMgEoj43TCf0Q31eL4ZCq8aKlFD5zvAMfc2ZCZv6A4drgn1Yi1/PrH2nk6ziIbF+rF7 5oTWBtgrJ0uH7fW4= X-Received: by 2002:a05:6402:1d2c:: with SMTP id dh12mr2313204edb.256.1603807020754; Tue, 27 Oct 2020 06:57:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoLJkGL1xFej60+Spi56zjOKlnHehmNr1rH2CxGuiQXJAq8qk1Q5eG2ah0lToIYRm3Uzzh1A== X-Received: by 2002:a05:6402:1d2c:: with SMTP id dh12mr2313189edb.256.1603807020597; Tue, 27 Oct 2020 06:57:00 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id t8sm1113943ejc.45.2020.10.27.06.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 13/25] block/nvme: Introduce Completion Queue definitions Date: Tue, 27 Oct 2020 14:55:35 +0100 Message-Id: <20201027135547.374946-14-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Rename Submission Queue flags with 'Sq' and introduce Completion Queue flag definitions. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger --- include/block/nvme.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 65e68a82c89..079f884a2d3 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) +enum NvmeFlagsCq { + NVME_CQ_PC = 1, + NVME_CQ_IEN = 2, +}; + typedef struct QEMU_PACKED NvmeCreateSq { uint8_t opcode; uint8_t flags; @@ -508,12 +513,12 @@ 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) -enum NvmeQueueFlags { - NVME_Q_PC = 1, - NVME_Q_PRIO_URGENT = 0, - NVME_Q_PRIO_HIGH = 1, - NVME_Q_PRIO_NORMAL = 2, - NVME_Q_PRIO_LOW = 3, +enum NvmeFlagsSq { + NVME_SQ_PC = 1, + NVME_SQ_PRIO_URGENT = 0, + NVME_SQ_PRIO_HIGH = 1, + NVME_SQ_PRIO_NORMAL = 2, + NVME_SQ_PRIO_LOW = 3, }; typedef struct QEMU_PACKED NvmeIdentify { From patchwork Tue Oct 27 13:55:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08355C55179 for ; Tue, 27 Oct 2020 14:07:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7709E22258 for ; Tue, 27 Oct 2020 14:07:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YwWfLw9p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7709E22258 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPct-00051R-9w for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:07:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTW-0003Yv-6j for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTL-0004OX-MJ for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807029; 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=wZTuWnB45c6bHWmlLJk/6WmCKmM3xNLscyekei4DbYk=; b=YwWfLw9pSto5zrViQ9k5FBYVgsUxuWRASkeYHqx/VVi1/4tzI+JH9hRB4UGbkVQwm+DP0e B+ch3MzLbej8OE2Dh3i88LIbEE+R8fp+wFcLbDe9ENUU1h5q0aLWXXJnpcBsK/wPkI4SGV H5Q+1f4GO5VzJFftq3ssI/OuY5+uubY= 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-30-NNRt9nR_OM29DTT88jKZnA-1; Tue, 27 Oct 2020 09:57:07 -0400 X-MC-Unique: NNRt9nR_OM29DTT88jKZnA-1 Received: by mail-ed1-f70.google.com with SMTP id w24so734413edl.3 for ; Tue, 27 Oct 2020 06:57:07 -0700 (PDT) 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=wZTuWnB45c6bHWmlLJk/6WmCKmM3xNLscyekei4DbYk=; b=nfCDLTeQCQuj9dQ+ubMlO6LoS7R/9HH+r20j8yE5PlihLj5zcjJVE3w/dEXPFfSNfz IYr0HKRXinBKfMlDX7nJK+cjYewF7IyiqTEnwRoO7OPhxYG8twPHh9nOTz8VW/Q1y9ex k4ReXTs1IKy9ap3rUpJcL2EEtLbW96vS7bl6vVWqX/q5cgTwrM0YhIfoiYtSBWhNtzIQ L1PUBKFHykUXtWO+UVwsL7LEy9L7phuZ5+8w7nVZoOyGA+sOkA489JFpSN9wwLm0m81V S4guotAm3DOH60qlK9X69EYa34Tm4ow3Xd0BufAYjD6cH0fsm/y0qGkEw5KrkPnuAf7o 4ivQ== X-Gm-Message-State: AOAM532ojXngT7hxKHh2y3HCeEtm3RndG8yo1wWsb8T2FqzbDfoXmM6d 2DsY60wLlBHD3KIPX/7Rc02Jt7JhqEpFJUFDVIHQp0R9sUr51TE5pr8HMz+X2cE4ZXGaJ3FZOqv P1D5WmG0FssGJREM= X-Received: by 2002:a17:906:7e0e:: with SMTP id e14mr2491171ejr.238.1603807026171; Tue, 27 Oct 2020 06:57:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1wYqlaQlG8sxRdujiq3rO5sh9mL8zesoXuQ6cAyg+E4ABW83HnXdcg42awns1qsnWrdInCg== X-Received: by 2002:a17:906:7e0e:: with SMTP id e14mr2491151ejr.238.1603807025948; Tue, 27 Oct 2020 06:57:05 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id d11sm1020685eds.83.2020.10.27.06.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 14/25] block/nvme: Use definitions instead of magic values in add_io_queue() Date: Tue, 27 Oct 2020 14:55:36 +0100 Message-Id: <20201027135547.374946-15-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Replace magic values by definitions, and simplifiy since the number of queues will never reach 64K. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 9324f0bfdc4..2dfcf8c41d7 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -651,6 +651,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) NvmeCmd cmd; unsigned queue_size = NVME_QUEUE_SIZE; + assert(n <= UINT16_MAX); q = nvme_create_queue_pair(s, bdrv_get_aio_context(bs), n, queue_size, errp); if (!q) { @@ -659,8 +660,8 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) cmd = (NvmeCmd) { .opcode = NVME_ADM_CMD_CREATE_CQ, .dptr.prp1 = cpu_to_le64(q->cq.iova), - .cdw10 = cpu_to_le32(((queue_size - 1) << 16) | (n & 0xFFFF)), - .cdw11 = cpu_to_le32(0x3), + .cdw10 = cpu_to_le32(((queue_size - 1) << 16) | n), + .cdw11 = 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); @@ -669,8 +670,8 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) cmd = (NvmeCmd) { .opcode = NVME_ADM_CMD_CREATE_SQ, .dptr.prp1 = cpu_to_le64(q->sq.iova), - .cdw10 = cpu_to_le32(((queue_size - 1) << 16) | (n & 0xFFFF)), - .cdw11 = cpu_to_le32(0x1 | (n << 16)), + .cdw10 = cpu_to_le32(((queue_size - 1) << 16) | n), + .cdw11 = 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); From patchwork Tue Oct 27 13:55:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 771DEC388F9 for ; Tue, 27 Oct 2020 14:10:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01CEB22263 for ; Tue, 27 Oct 2020 14:10:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HpW8flWR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01CEB22263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPg6-0000Rw-UA for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:10:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTh-0003dj-0A for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32093) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTW-0004PH-Tn for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807041; 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=/EHBGSZvo5pKndYIooWnkiWED77TLxl9oiYOVAV+Eso=; b=HpW8flWRfpoa9u2o7KX4URX4PtS5g0VA76eXhrYYseyc36uzW2C2Dixjsck6QB/v4LkFjD rjZgoNZlQFS2FY/cjijmg3Zp5/Fr8LR26qmzy5KLcUAlZyuUdlt6G9nelKuRsfN0UZ4riZ lFSfjd+k4pgD2p6VbAM+D72PvozmWOk= 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-527-lf8vuzYHOpWTLR-H5vH-_Q-1; Tue, 27 Oct 2020 09:57:18 -0400 X-MC-Unique: lf8vuzYHOpWTLR-H5vH-_Q-1 Received: by mail-ej1-f72.google.com with SMTP id lf18so901529ejb.13 for ; Tue, 27 Oct 2020 06:57:18 -0700 (PDT) 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=/EHBGSZvo5pKndYIooWnkiWED77TLxl9oiYOVAV+Eso=; b=WkzQJ6q/WTBPqHYKaPPRjXGO9+IGZHKfW/cDcxo5wXpdV2qH+MsPzfGNVUYC1K+EaS X4J2YZP6y7lMnR6HshX4lQDsjEdsdDsVVtYcByIKtjotWgyihNlbHTq+TfYOzFIlGS0/ OyrUCgDrc3XiT944s2JoSt2zDcvxMY+JN1DuMiYPJPxd3DqjgpASSO+HpLofNRoOdtbY wSbmEzjDYH1WhbJksKIaeJ3+C7L/s7Q41O83MffSLlbwRQpOzkAHUJPZ4efP+tpFgrLA 9jx2Igztf3FH//GTW6ErLmv7mpGyqmcCO8e/+9AeLZgR2hZ+4+JNHIWkSKVodAHVv2Wy M1Zw== X-Gm-Message-State: AOAM533DUnJtsfJBCiSW2ujau5pasYJlX8U0BFmhq5hZRC4dlbJltDJW HbM0OZqnrEhcVuZ+r6trxflatBuQl7LsaCiGCRTYHGPgY8lz5B8gFzISMeG7ruDejkzLnHp0dPP xW9/yFww/ymjZz5o= X-Received: by 2002:a17:906:5488:: with SMTP id r8mr2433103ejo.483.1603807036882; Tue, 27 Oct 2020 06:57:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznhdT7kCjIKpYOx1f/kNIFvxHnb34e5y9kXY9ny+ANQXmIn4CXj22Z8oighEJrD2uIwAenyA== X-Received: by 2002:a17:906:5488:: with SMTP id r8mr2433086ejo.483.1603807036689; Tue, 27 Oct 2020 06:57:16 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id p20sm1129638ejd.78.2020.10.27.06.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 16/25] block/nvme: Simplify ADMIN queue access Date: Tue, 27 Oct 2020 14:55:38 +0100 Message-Id: <20201027135547.374946-17-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We don't need to dereference from BDRVNVMeState each time. Use a NVMeQueuePair pointer to the admin queue and use it. The nvme_init() becomes easier to review, matching the style of nvme_add_io_queue(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index d5df30ec074..2d3648694b0 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -699,6 +699,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, Error **errp) { BDRVNVMeState *s = bs->opaque; + NVMeQueuePair *q; AioContext *aio_context = 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, /* Set up admin queue. */ s->queues = g_new(NVMeQueuePair *, 1); - s->queues[INDEX_ADMIN] = nvme_create_queue_pair(s, aio_context, 0, - NVME_QUEUE_SIZE, - errp); - if (!s->queues[INDEX_ADMIN]) { + q = nvme_create_queue_pair(s, aio_context, 0, NVME_QUEUE_SIZE, errp); + if (!q) { ret = -EINVAL; goto out; } + s->queues[INDEX_ADMIN] = q; s->queue_count = 1; QEMU_BUILD_BUG_ON((NVME_QUEUE_SIZE - 1) & 0xF000); regs->aqa = cpu_to_le32(((NVME_QUEUE_SIZE - 1) << AQA_ACQS_SHIFT) | ((NVME_QUEUE_SIZE - 1) << AQA_ASQS_SHIFT)); - regs->asq = cpu_to_le64(s->queues[INDEX_ADMIN]->sq.iova); - regs->acq = cpu_to_le64(s->queues[INDEX_ADMIN]->cq.iova); + regs->asq = cpu_to_le64(q->sq.iova); + regs->acq = cpu_to_le64(q->cq.iova); /* After setting up all control registers we can enable device now. */ regs->cc = cpu_to_le32((ctz32(NVME_CQ_ENTRY_BYTES) << CC_IOCQES_SHIFT) | From patchwork Tue Oct 27 13:55:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45A3AC388F9 for ; Tue, 27 Oct 2020 14:12:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCA41218AC for ; Tue, 27 Oct 2020 14:12:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P0AP6k8i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCA41218AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPiU-00042G-PX for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:12:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTh-0003fL-Jn for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTc-0004Q8-6B for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JEjEb5blaJCbCH8yHzb9rLLKFCJ8kP8Dq4wMBDtqfPA=; b=P0AP6k8iEswjrjoT1amWfSTTI8OQp7uqS+df8WA7ugprslNgPKC139GWhO5+b5lzsYVVk5 5t/fnDipq/Yr72XcBaSGfcZrtM6z5r5ok2ZyJiRbYwR5VNWZo35Q4DOMHTf+m8ZAmRFlHe /0B5r1fvCCXFew+CG+Jua7QJcFMQbNA= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-olnpzhPvOliE7thc2Pe0MA-1; Tue, 27 Oct 2020 09:57:23 -0400 X-MC-Unique: olnpzhPvOliE7thc2Pe0MA-1 Received: by mail-ej1-f71.google.com with SMTP id gh22so914102ejb.8 for ; Tue, 27 Oct 2020 06:57:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JEjEb5blaJCbCH8yHzb9rLLKFCJ8kP8Dq4wMBDtqfPA=; b=KMEaTSU+XHv3OORzikWaHdMK1egR9YTKqYTNtqqzK0wLXVzOwHjyagX3VTHbLK/Vbv VUmlB8zYFeqANrzrbaoL/l5Ve0eWbE8BUkI6sMOSDFTImedNTR+s+Yz9TnZCF4Mqo/gr x2dcHjXjw5Tdeecrc68BBQrd8RR1vvEMBftF8I3h26zYkz8PdD0Zh3kMIZBnIrwxUYuW k6XztQY3Q3mWDQrVjluQwQj/HWsrm4qMCTKkTQ08skRxq3NfozIEFIebGWiUTCMlxqWy xz6JbIOFei8NteYfCpq3hNCvtZPIHv+yCD0N142YkeTe9EI+Qkw9uFPCrGILQAcqisHi FLmQ== X-Gm-Message-State: AOAM533Zf6iiOa3tqoIoKKpQckUAvHu7fwzjE6IDXKiy9GT31yZJFtfk HRtNv/DoiQGRLDbTlsZ6HTGpTRelsow+2vkResBC68otqCZ0yBKGU2NdQDhyaSf0TAUFUNRq14e 5j8jQNc4WSsKNMqM= X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr2419633eds.379.1603807042129; Tue, 27 Oct 2020 06:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHzC8M0tCzJel8YX0kGF1EMexn+eDGjWUUDLUlYJfBpsXKZY4Rvx+F51v4fc4xwiZFIoshjg== X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr2419610eds.379.1603807041895; Tue, 27 Oct 2020 06:57:21 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id ld2sm1090588ejb.94.2020.10.27.06.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 17/25] block/nvme: Simplify nvme_cmd_sync() Date: Tue, 27 Oct 2020 14:55:39 +0100 Message-Id: <20201027135547.374946-18-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" As all commands use the ADMIN queue, it is pointless to pass it as argument each time. Remove the argument. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger --- block/nvme.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 2d3648694b0..68f0c3f7959 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -487,9 +487,10 @@ static void nvme_cmd_sync_cb(void *opaque, int ret) aio_wait_kick(); } -static int nvme_cmd_sync(BlockDriverState *bs, NVMeQueuePair *q, - NvmeCmd *cmd) +static int nvme_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd) { + BDRVNVMeState *s = bs->opaque; + NVMeQueuePair *q = s->queues[INDEX_ADMIN]; AioContext *aio_context = bdrv_get_aio_context(bs); NVMeRequest *req; int ret = -EINPROGRESS; @@ -534,7 +535,7 @@ static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp) memset(id, 0, sizeof(*id)); cmd.dptr.prp1 = cpu_to_le64(iova); - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); goto out; } @@ -557,7 +558,7 @@ static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp) memset(id, 0, sizeof(*id)); cmd.cdw10 = 0; cmd.nsid = cpu_to_le32(namespace); - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify namespace"); goto out; } @@ -663,7 +664,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) .cdw10 = cpu_to_le32(((queue_size - 1) << 16) | n), .cdw11 = cpu_to_le32(NVME_CQ_IEN | NVME_CQ_PC), }; - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to create CQ io queue [%u]", n); goto out_error; } @@ -673,7 +674,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) .cdw10 = cpu_to_le32(((queue_size - 1) << 16) | n), .cdw11 = cpu_to_le32(NVME_SQ_PC | (n << 16)), }; - if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { + if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to create SQ io queue [%u]", n); goto out_error; } @@ -889,7 +890,7 @@ static int nvme_enable_disable_write_cache(BlockDriverState *bs, bool enable, .cdw11 = cpu_to_le32(enable ? 0x01 : 0x00), }; - ret = nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd); + ret = nvme_cmd_sync(bs, &cmd); if (ret) { error_setg(errp, "Failed to configure NVMe write cache"); } From patchwork Tue Oct 27 13:55:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98301C5517A for ; Tue, 27 Oct 2020 14:28:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2554C20780 for ; Tue, 27 Oct 2020 14:28:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MjWp7+x1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2554C20780 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPxf-0006vr-5j for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:28:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTj-0003jD-93 for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTg-0004RY-KO for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807050; 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=oGK/umoqvEVmk3LcqzdY5SU63Dd+Fo+4ZtG1Gj+fyHI=; b=MjWp7+x11wSvEcErzoIDnRcHEf2PhiExa1KxynIcwAIo1ohheR4fgnFwqAOgMREEjWZSza TytHfJH1msXIB3tRz3rSZDT21K9zG+QcDnrQ5hO8F1QjviZM6NVaHVC6Wn/AdMxEf3eim3 MVPSa/Wm4D4pUYRSjLJdnIIPo94Gsaw= 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-438-bdVmj3FXMnSBtHYSveEvVg-1; Tue, 27 Oct 2020 09:57:29 -0400 X-MC-Unique: bdVmj3FXMnSBtHYSveEvVg-1 Received: by mail-ej1-f72.google.com with SMTP id k13so887590ejv.16 for ; Tue, 27 Oct 2020 06:57:28 -0700 (PDT) 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=oGK/umoqvEVmk3LcqzdY5SU63Dd+Fo+4ZtG1Gj+fyHI=; b=hulVUJYCAwksTyWiBokXtnY7Ke4BURPTVDMid/8/G8Ho8cQq8lG3hsVoix9XoklhM6 oPM5qWBM332W+jAEao0+/AfzqUUs2oA1KPUuY5rjo0qiWrIln6kI+YHQHWCS3pTswy1S jMw07Kq6SWClfx38e9L27r4ZLQHy5gfe8LctpGYqTZTV1J8gjNacgLZA49fFA2Iti/Nk dvuidMnlEbNgCUpr0YUndOIpkeniL489gRjj6Bmkx+1yhu3c81+XGQa8dKht0lVe1J2u CJZEksWzyKJhQBdrUX+MhszAGbHNK2/zLGLUJBQ4xJhUlmRFgyF3bSEw/zALL8Krhvxa 3/+g== X-Gm-Message-State: AOAM530uXM9fbRw466VgMgk+pIIuGRvVo6qndXACO0kLrO4oEM4o7yt0 L1IL5scIkqdTSgvZDStgFvj+XVxyG+qFuJrj6Ne7bFgeTPGkfrM/XI/oGY22sQhWwzajk9QU39N uclFiQ56sOn06JHU= X-Received: by 2002:a17:906:3ada:: with SMTP id z26mr2461486ejd.151.1603807047369; Tue, 27 Oct 2020 06:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV+jsEMmmEP/BWFkxrP+/T2dCU1LikRGHKy/1nEwyG2qg7rEFxcSyZDKqJQ4+aSv8SKq5i9w== X-Received: by 2002:a17:906:3ada:: with SMTP id z26mr2461463ejd.151.1603807047135; Tue, 27 Oct 2020 06:57:27 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id n10sm1015864edo.55.2020.10.27.06.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 18/25] block/nvme: Pass AioContext argument to nvme_add_io_queue() Date: Tue, 27 Oct 2020 14:55:40 +0100 Message-Id: <20201027135547.374946-19-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We want to get ride of the BlockDriverState pointer at some point, so pass aio_context along. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 68f0c3f7959..a0871fc2a81 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -644,7 +644,9 @@ static void nvme_handle_event(EventNotifier *n) nvme_poll_queues(s); } -static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) +/* Returns true on success, false on failure. */ +static bool nvme_add_io_queue(BlockDriverState *bs, + AioContext *aio_context, Error **errp) { BDRVNVMeState *s = bs->opaque; unsigned n = s->queue_count; @@ -653,8 +655,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp) unsigned queue_size = NVME_QUEUE_SIZE; assert(n <= UINT16_MAX); - q = nvme_create_queue_pair(s, bdrv_get_aio_context(bs), - n, queue_size, errp); + q = nvme_create_queue_pair(s, aio_context, n, queue_size, errp); if (!q) { return false; } @@ -830,7 +831,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, } /* Set up command queues. */ - if (!nvme_add_io_queue(bs, errp)) { + if (!nvme_add_io_queue(bs, aio_context, errp)) { ret = -EIO; } out: From patchwork Tue Oct 27 13:55:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0187C388F9 for ; Tue, 27 Oct 2020 14:16:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54E5D22202 for ; Tue, 27 Oct 2020 14:16:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="J1vlpA+D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54E5D22202 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPlv-0007pC-EH for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:16:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTv-0003qy-4D for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTl-0004Td-Oe for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807057; 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=RJk75AmI6iZBxAGRnOfhQsAkiS0PriXiInR+pfpFLCQ=; b=J1vlpA+DLL3yErJ4c5SMBLzASdHE9wL/WCUp8BC/l46fKaVL7oFS43YKKlKQh0d4HeGNBx IsuamGzYM3eNunlrMeMZGQProzQ5eCdmsMt1cjs6s0UzGU2C1JDNXtPaTO1Unm3m6FTnWI GHLtwcmcIWTCV8u+8wZc+ExB97MUzow= 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-157-ooxUwXx3Pa-0DkSdxLc4bw-1; Tue, 27 Oct 2020 09:57:35 -0400 X-MC-Unique: ooxUwXx3Pa-0DkSdxLc4bw-1 Received: by mail-ed1-f69.google.com with SMTP id 28so719570edv.9 for ; Tue, 27 Oct 2020 06:57:34 -0700 (PDT) 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=RJk75AmI6iZBxAGRnOfhQsAkiS0PriXiInR+pfpFLCQ=; b=s3HRIfL2QLZUxUpo0DrHFqiljotDnkdyI4gYtknJGxVtjojJxbNxPGgn/EFQi4qrY3 C6G4fJ4zwsktR2mCQ8OfcB0or7FeiHEbNP56LYWU11F4hTUOcG0Ea+8V+PhU4R0apvSs p4Mf6RUaLqo7L4Keaf49UAwheXypLnK/6Y2b8WheDWehRKBzq437k3rv9w3HfxOzrDRd mGX7kzqlJGUFFaFKhsC6szQMc2Ws88BluDO/FyPbY2BbATsW9khjCqKFz3KuMNqgHudP 43V+uTU0TaCts1ArOs71xcFPwIXDNV85nvTs8U0Bd7JToZM742JZZMOO+iZN0Z1XDzNe LYfA== X-Gm-Message-State: AOAM530nsoV0PXjk7kkKY1n+/m83FW5eTfU0sgUOtnSEMAeLgnyFcxpg h/dHf4Z4irA8K7fVCLh7U7lyDQ321O1D49dHf/41AgBe+hyEySrNvSOCo04JjHUJvoqMgwJnSGb xD9PisyX498Ze9eY= X-Received: by 2002:a17:906:3a1a:: with SMTP id z26mr2434455eje.519.1603807053077; Tue, 27 Oct 2020 06:57:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCxeBepJouLr4JjCDbEz6RpAdJu0yoFSQNNFmO/lwqirty5H/MDmwxCDZyYzpFfwQLbILEhA== X-Received: by 2002:a17:906:3a1a:: with SMTP id z26mr2434430eje.519.1603807052865; Tue, 27 Oct 2020 06:57:32 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id e14sm1103100ejc.15.2020.10.27.06.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 19/25] block/nvme: Set request_alignment at initialization Date: Tue, 27 Oct 2020 14:55:41 +0100 Message-Id: <20201027135547.374946-20-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/nvme.c b/block/nvme.c index a0871fc2a81..682946ad840 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -759,6 +759,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, s->page_size = MAX(4096, 1 << NVME_CAP_MPSMIN(cap)); s->doorbell_scale = (4 << NVME_CAP_DSTRD(cap)) / sizeof(uint32_t); bs->bl.opt_mem_alignment = s->page_size; + bs->bl.request_alignment = s->page_size; timeout_ms = MIN(500 * NVME_CAP_TO(cap), 30000); /* Reset device to get a clean state. */ From patchwork Tue Oct 27 13:55:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56BD7C55179 for ; Tue, 27 Oct 2020 14:19:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4C5B206D4 for ; Tue, 27 Oct 2020 14:19:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="K3xsFcYl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4C5B206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPov-0003HA-Ic for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:19:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTw-0003r5-HH for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTu-0004UB-2D for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807061; 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=rsADHQhtdYEPnOhTT91bO7gVSjhtNIdy1KjQXQ/oHWM=; b=K3xsFcYlUVm8MTqiLCCb4znQfkF+dmMWN4WY9dhG+Woc7PuqDjirQ/tm+GidOTHGR+Bkub CK85IfxFjd+TWTMc6N11HyE6gMZlphx+57WI6E6wlX17sdVMNnuZ0BH88L3pDJ9yIa93XG Uno2J4Cgt781hjGVrfBxp8eSaj/H6og= 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-185-fKCki7y_Ng-ffzAdNbNKow-1; Tue, 27 Oct 2020 09:57:39 -0400 X-MC-Unique: fKCki7y_Ng-ffzAdNbNKow-1 Received: by mail-ej1-f72.google.com with SMTP id f11so859121eja.23 for ; Tue, 27 Oct 2020 06:57:39 -0700 (PDT) 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=rsADHQhtdYEPnOhTT91bO7gVSjhtNIdy1KjQXQ/oHWM=; b=JihVVOYb0fFBbREO2pyp/SRQMCEJLsK4+JjSl4o5xPp0pRUL740lk9kDFAMdiomITj NXubVpUnV0BNl64pCQ/6pkN8F3fIoq0Koovv73zDJFKBAW4TRzXjFTMRo7HnqZPMHjzV fIdPyLB1oQRC3SRF5sEbV4z7b3qJyCit6PTO1nhDP+UFlrqjCKWShTFYG4/74Sqxw53b Lx1uIjlzQTuaGd/qXqzwamulJEb20zi0BU/15X9QL4SE1doDdku+ubhS+jnfcYk2yzp2 6Fq9xGHTEbwpxHjmhyuw9LQompT4k73lNFX0jMnW6/aeMh5hUnx/gSijthek5lga4J7C 2QjQ== X-Gm-Message-State: AOAM532LG2ADjN4ikEbxnMlvCeNKvl32f7qePdp97uDA+DouM5Mi/2bp w9IRslJUF6ZWrcowvjs8bO+63Nd2+65bQVgst5h93g7hfS71Yppa9IRyijQX+agGH+ymE+g+DfU oTJRt5HIBQaZTgLo= X-Received: by 2002:a17:906:1804:: with SMTP id v4mr2599343eje.201.1603807058348; Tue, 27 Oct 2020 06:57:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQg64kvfwxBTN6dBbJosJW+jhiXkzsWkbQRbAwazI6wMTkUszv724DkBTtGmnHEKM0pFdGdA== X-Received: by 2002:a17:906:1804:: with SMTP id v4mr2599331eje.201.1603807058175; Tue, 27 Oct 2020 06:57:38 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id o15sm1094135ejm.38.2020.10.27.06.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 20/25] block/nvme: Correct minimum device page size Date: Tue, 27 Oct 2020 14:55:42 +0100 Message-Id: <20201027135547.374946-21-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 682946ad840..d2d57a287cc 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -756,7 +756,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, goto out; } - s->page_size = MAX(4096, 1 << NVME_CAP_MPSMIN(cap)); + s->page_size = 1u << (12 + NVME_CAP_MPSMIN(cap)); s->doorbell_scale = (4 << NVME_CAP_DSTRD(cap)) / sizeof(uint32_t); bs->bl.opt_mem_alignment = s->page_size; bs->bl.request_alignment = s->page_size; From patchwork Tue Oct 27 13:55:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 301830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 695F6C388F9 for ; Tue, 27 Oct 2020 14:33:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D75B02225E for ; Tue, 27 Oct 2020 14:33:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GYidfso0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D75B02225E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXQ2c-0003KQ-SA for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:33:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPTy-0003ue-7j for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPTw-0004Uu-8F for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:57:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807066; 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=0Utic1r2QfB0RLxuIXWbW8/BZ/+Cux5YDi1b1KSr+AQ=; b=GYidfso0Fs6V8pu9jz7RkdSWfsLRBpXnqezJqJw86p2TUuOBDDXfefSeLMwEb/a+Fx+sZ3 mqHhfWlg2l636Wbe3feta8828EQVQWbfJO/7MPj8dv4GKQsT1Z2Vn6GlU6A2kviMpmI5jw N9pvxSbLzeNgWNQwgR1hvB7lRlYzGXM= 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-396-vlUElww6NwivCcISXKAjYg-1; Tue, 27 Oct 2020 09:57:45 -0400 X-MC-Unique: vlUElww6NwivCcISXKAjYg-1 Received: by mail-ej1-f72.google.com with SMTP id k13so887897ejv.16 for ; Tue, 27 Oct 2020 06:57:44 -0700 (PDT) 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=0Utic1r2QfB0RLxuIXWbW8/BZ/+Cux5YDi1b1KSr+AQ=; b=A2WAmwY9vasCidxEUFPjTWjxlHZOIPukoe+Cn5CMbvGi9YFyX6tpEoLHjDVSWD0A4M jRRzYvjmjjYacMV9oH2vIv9vOx1PKX8sll5LoBPbcYYLnl86ekZkrT60V3tAINridnOk YvSo939kCpFbAtewnVRpbIYD86Ee0Fck8gkPj4fWjy3X1vIOb/wO3uNz81xvSOAKenU1 Aj5FtQa2+BzmKrri0k2vBwh/gopdZ9y8V8UaBQ455zUtfn7Y4ka9TAsQz25AEk3p+cDV ribT6XbFtlGnXrvMPh3QwqQuvRsKw/uxsW059OAqV6aTBJ55efc/w9uUlukKbucYMR5e Rrrw== X-Gm-Message-State: AOAM531LY/ymEmljwmNFI1GIcuLScUZ4CDLwgFng6Q2Uc8RJuR4o9wU8 +vwbBkuacx+8igBCgXvvX3grkBHLz0IhsVX9dPdibYjX0OQ272EC4wCiKFxONEBtr5yCSWvZVuj wfOM1pWfkj5hINWM= X-Received: by 2002:a50:ab07:: with SMTP id s7mr2344433edc.287.1603807063641; Tue, 27 Oct 2020 06:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx52vu3HB69weFD17jCoA/z36Gtt2WNjlxz29VyUmlUG8o8YtK1ekcFZufUNtFYGFjTe0IueQ== X-Received: by 2002:a50:ab07:: with SMTP id s7mr2344420edc.287.1603807063451; Tue, 27 Oct 2020 06:57:43 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id m25sm1014991edp.36.2020.10.27.06.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 21/25] block/nvme: Change size and alignment of IDENTIFY response buffer Date: Tue, 27 Oct 2020 14:55:43 +0100 Message-Id: <20201027135547.374946-22-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index d2d57a287cc..ad70303c5c1 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -521,19 +521,20 @@ static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp) .opcode = NVME_ADM_CMD_IDENTIFY, .cdw10 = cpu_to_le32(0x1), }; + size_t id_size = QEMU_ALIGN_UP(sizeof(*id), qemu_real_host_page_size); - id = qemu_try_memalign(s->page_size, sizeof(*id)); + id = qemu_try_memalign(qemu_real_host_page_size, id_size); if (!id) { error_setg(errp, "Cannot allocate buffer for identify response"); goto out; } - r = qemu_vfio_dma_map(s->vfio, id, sizeof(*id), true, &iova); + r = qemu_vfio_dma_map(s->vfio, id, id_size, true, &iova); if (r) { error_setg(errp, "Cannot map buffer for DMA"); goto out; } - memset(id, 0, sizeof(*id)); + memset(id, 0, id_size); cmd.dptr.prp1 = cpu_to_le64(iova); if (nvme_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); @@ -555,7 +556,7 @@ static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp) s->supports_write_zeroes = !!(oncs & NVME_ONCS_WRITE_ZEROES); s->supports_discard = !!(oncs & NVME_ONCS_DSM); - memset(id, 0, sizeof(*id)); + memset(id, 0, id_size); cmd.cdw10 = 0; cmd.nsid = cpu_to_le32(namespace); if (nvme_cmd_sync(bs, &cmd)) { From patchwork Tue Oct 27 13:55:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311614 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525AEC55179 for ; Tue, 27 Oct 2020 14:22:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D49422072D for ; Tue, 27 Oct 2020 14:22:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QfFjLa+B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D49422072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPrd-0006n0-I3 for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:22:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPU8-00040n-RI for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:55669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPU7-0004Wu-0G for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807072; 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=aGgz+XLiFf+ohpuvMEd9wbrelu41fy1wd5IWGvE3gyY=; b=QfFjLa+BDYFeYswrPwoP+C4BQNq7BzneUSqyUXjrun99cfNbNWJFABws4tGTfa3FuWxBa4 VvOxPK1iqSZ++QAkyPg4YNn2si89A+I7Us9HClF8Oswzjv+vuB9LFCynAkelxlOkDpBavX RHRr2/Ml3Rrx83U9HOPjKdKdcIXemzY= 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-548-C1KhB-5eMGilDXN6WXT5wQ-1; Tue, 27 Oct 2020 09:57:50 -0400 X-MC-Unique: C1KhB-5eMGilDXN6WXT5wQ-1 Received: by mail-ed1-f72.google.com with SMTP id y8so732412edj.5 for ; Tue, 27 Oct 2020 06:57:50 -0700 (PDT) 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=aGgz+XLiFf+ohpuvMEd9wbrelu41fy1wd5IWGvE3gyY=; b=WkwSGC6EWM2CQb7ln/rkzIb/bci+E8HebbEZB1L0/11XsBsDRv9w+2/d0i0M6AmhuK PXxSTOtikQ0rz1aFnadGwaFcWX8u32P2B7pr8WqwwbFyyII+5YQziqAgtz5odPzj0Sd3 rJHiDu50anelLn6cl8gahdATHiNQkC00mPz8byZwTO3HrhPaA7jRREUQCK+5om8xfh2+ 6dpP6TeX5AxI0TLLd8BxP6oO8/sedTSkICp/1x3bpizYqM4WDAuSZEEpAs5jGlOegpS+ WEzUmfiiq0Pnz/5D5VmeG2yp2HfynBOIoC/pv8WGb9ycSNCi+Zqpr6I/cc+C8OSGyyEx 7jtA== X-Gm-Message-State: AOAM531cWnxJn5N0+UHrW7z0r7u5mPql0pHVRU6Ly6U+9l0Y84D5yP9l ggIAhed/qyvBXbmkeRPyE+Y9dN4Fsm+STk9TQrVjcVheKI2GHIq2PEVQMvyCuTMIJWl8SzHOF24 Kjxt24+ebblGeyTE= X-Received: by 2002:a17:906:6a94:: with SMTP id p20mr2404745ejr.499.1603807068874; Tue, 27 Oct 2020 06:57:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwOUz6H00BT4J8Of8oTGNZFsFpvU1WqANY1FB+xfxYbL26MBj/7nMSy4BYnPJXl69yqxaYDQ== X-Received: by 2002:a17:906:6a94:: with SMTP id p20mr2404735ejr.499.1603807068718; Tue, 27 Oct 2020 06:57:48 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id h22sm1129238ejc.80.2020.10.27.06.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 22/25] block/nvme: Change size and alignment of queue Date: Tue, 27 Oct 2020 14:55:44 +0100 Message-Id: <20201027135547.374946-23-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index ad70303c5c1..941f96b4c92 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; - bytes = ROUND_UP(nentries * entry_bytes, s->page_size); + bytes = ROUND_UP(nentries * entry_bytes, qemu_real_host_page_size); q->head = q->tail = 0; - q->queue = qemu_try_memalign(s->page_size, bytes); + q->queue = qemu_try_memalign(qemu_real_host_page_size, bytes); if (!q->queue) { error_setg(errp, "Cannot allocate queue"); return false; From patchwork Tue Oct 27 13:55:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6756C55178 for ; Tue, 27 Oct 2020 14:20:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41F14206D4 for ; Tue, 27 Oct 2020 14:20:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C1op0+tG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41F14206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPqC-0004wG-4t for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:20:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPUB-00046N-59 for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPU7-0004XC-2c for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807077; 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=NAlvgmTt63VVhwmPwsffm7y53PiDjihV7pQ2MmamgE4=; b=C1op0+tGH1Ki4Z5YcRgXi8B3tJVZEoxB4pmPt2vIluFsRsGYDe4sRnXIYqWW8Iqs9jFYdU DFMnS5Qjh4jPZhNnypzybRzgk80leIhPgwzrwqiOSr9udEcqID2mmiMIqCEqWYTo3YI8+x /cFWYZei6/0/4kD+8v07+Hox4SrMwCU= 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-540-ULHAFdV0NTGt1oKlHOo_0Q-1; Tue, 27 Oct 2020 09:57:55 -0400 X-MC-Unique: ULHAFdV0NTGt1oKlHOo_0Q-1 Received: by mail-ej1-f69.google.com with SMTP id i21so936480ejb.5 for ; Tue, 27 Oct 2020 06:57:55 -0700 (PDT) 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=NAlvgmTt63VVhwmPwsffm7y53PiDjihV7pQ2MmamgE4=; b=tli7CPzZD6Yc0rtvQILVdxPDBJzXas501ibNeeqMBiI60VllgTadkFx+cID+PJJ936 QpzHA68VY1ojN4Sxey0sDSqPG/Sp2P+r2yCr/TPtBHHf7LR0DlLUgPKNvkb6rcSbEz3q f14OuP4zMPlUdlyehfMx9sAO9tt+S4QlyzHns5Osor+WwoFQ8abtAGPEbw14zn+oyzXM X+3BAmQN6H3g/3FfZrTbva52QAMuQK8zJQRAgVvC+cvg7lsec450RX57nqFQM9WSCOsL 2U72ZJ1p3hye1UaIj0LPFjiOtLsT53zIz3h1fGp0ZPSOosD0/aadeZHm9I2NXXrRxEFi ePSg== X-Gm-Message-State: AOAM530b2NJedTnD4sEEnI49G+RO0A389Oc7Z59l5EK+COVvLOGN9rxA R7NgD3fdy2AUDtnm/Op759j82i3XTxXo/IH4y5PeR/cZqVFA8DHhATxyeNERWYQObLFwMjrx/a/ lXRs3t/LeNzVfBgk= X-Received: by 2002:a17:906:b0d7:: with SMTP id bk23mr2685810ejb.103.1603807074332; Tue, 27 Oct 2020 06:57:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyINoOPF8wNVWokkj+IKWIMIktCGQC5/gJ7yK7HdRpYJqPJ0+waXXQhdA3r2TV4/fs/s5Gn6A== X-Received: by 2002:a17:906:b0d7:: with SMTP id bk23mr2685783ejb.103.1603807074086; Tue, 27 Oct 2020 06:57:54 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id i5sm1086357ejs.121.2020.10.27.06.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 23/25] block/nvme: Change size and alignment of prp_list_pages Date: Tue, 27 Oct 2020 14:55:45 +0100 Message-Id: <20201027135547.374946-24-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Signed-off-by: Eric Auger Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 941f96b4c92..e3626045565 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -214,6 +214,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, int i, r; NVMeQueuePair *q; uint64_t prp_list_iova; + size_t bytes; q = g_try_new0(NVMeQueuePair, 1); if (!q) { @@ -221,19 +222,19 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, } trace_nvme_create_queue_pair(idx, q, size, aio_context, event_notifier_get_fd(s->irq_notifier)); - q->prp_list_pages = qemu_try_memalign(s->page_size, - s->page_size * NVME_NUM_REQS); + bytes = QEMU_ALIGN_UP(s->page_size * NVME_NUM_REQS, + qemu_real_host_page_size); + q->prp_list_pages = qemu_try_memalign(qemu_real_host_page_size, bytes); 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 = s; q->index = idx; qemu_co_queue_init(&q->free_req_queue); q->completion_bh = aio_bh_new(aio_context, nvme_process_completion_bh, q); - r = qemu_vfio_dma_map(s->vfio, q->prp_list_pages, - s->page_size * NVME_NUM_REQS, + r = qemu_vfio_dma_map(s->vfio, q->prp_list_pages, bytes, false, &prp_list_iova); if (r) { goto fail; From patchwork Tue Oct 27 13:55:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E05EC55179 for ; Tue, 27 Oct 2020 14:37:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A93B622264 for ; Tue, 27 Oct 2020 14:37:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OeKM1+nq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A93B622264 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXQ64-0007Xq-Dw for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:37:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPUE-0004Eh-EO for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPUC-0004YD-Ks for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807083; 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=xm7DOhBe3iyYOLIHKljm0VOmYGJ+D2G+GQFpjtxbZOQ=; b=OeKM1+nqEkXHzq9XnLfViWsIrbUzNNfSJGmPQfswKOFILRN3ZpXUFKVjSdkvmm+usxKh3i lpGVcn7vtQ9mwq3xRO/SmiH01GbSEKeeLUPymiXhv0ovtFen+3qGN5pWI8IwBXjHyTJY7X qursqU6kV3E+b4zEdIWHqR7HA49Uk/M= 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-225-Yn09YSNgN3yxCmQUL7MaOA-1; Tue, 27 Oct 2020 09:58:01 -0400 X-MC-Unique: Yn09YSNgN3yxCmQUL7MaOA-1 Received: by mail-ej1-f72.google.com with SMTP id d12so880966ejr.19 for ; Tue, 27 Oct 2020 06:58:00 -0700 (PDT) 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=xm7DOhBe3iyYOLIHKljm0VOmYGJ+D2G+GQFpjtxbZOQ=; b=RQirgzKnk1bKLsk8sU5ojnZTI45Cvm0GAOynY2uBMydhhs9giCF9/hc3PSO24M+cit r3jtlpiknQ2F+vLdxsumv4qP00eCkzMzDhdrHkYcm/Gls3zMblQrZR4za2dkCM0vT6Hi WkvcsG8QjhmNW0RKszt9zwUf2e8ZHjqgSYTi507CPZCvfMt9RVOIlrshCxuOLEROc0Vs nNxSAOXcIx4bvzhWX/S/iOQLMXvylW9TTUwz54PFhVImr+8sSTr+8NZvQUwkjoNZYXjS vjDm4g1O08TGX3hY5R823C59ZOL2yNwLDDwMHInYgQNORUBa+KzIbAuJKBPE4ghV2rOl USDQ== X-Gm-Message-State: AOAM532NOZXXtcA/AGW+ve0mB93qDMcHRLrJgwfPDIBBDVTOCc7kKgrT MfBinu/JzNUWosA2FIfsTvkQde9TRLw54jBLq7wvhBAf0tNDmTQ9fcu6L/sAN5cCCCbf1fXkSgp Vm7zboUjW8//h+uQ= X-Received: by 2002:a17:906:2dc7:: with SMTP id h7mr2638991eji.546.1603807079522; Tue, 27 Oct 2020 06:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWKxF53GuI7DB3LBnIlx/SCjKP14ed38wRlih8sAJZ/8YOthHVUwVuFSqQQTeiaC3xnaIDFw== X-Received: by 2002:a17:906:2dc7:: with SMTP id h7mr2638968eji.546.1603807079354; Tue, 27 Oct 2020 06:57:59 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id e2sm1095439ejd.81.2020.10.27.06.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 24/25] block/nvme: Align iov's va and size on host page size Date: Tue, 27 Oct 2020 14:55:46 +0100 Message-Id: <20201027135547.374946-25-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index e3626045565..c1c52bae44f 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1018,11 +1018,12 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd, for (i = 0; i < qiov->niov; ++i) { bool retry = true; uint64_t iova; + size_t len = QEMU_ALIGN_UP(qiov->iov[i].iov_len, + qemu_real_host_page_size); try_map: r = qemu_vfio_dma_map(s->vfio, qiov->iov[i].iov_base, - qiov->iov[i].iov_len, - true, &iova); + len, true, &iova); if (r == -ENOMEM && retry) { retry = false; trace_nvme_dma_flush_queue_wait(s); @@ -1166,8 +1167,9 @@ static inline bool nvme_qiov_aligned(BlockDriverState *bs, BDRVNVMeState *s = bs->opaque; for (i = 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_size)) { trace_nvme_qiov_unaligned(qiov, i, qiov->iov[i].iov_base, qiov->iov[i].iov_len, s->page_size); return false; @@ -1183,7 +1185,7 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t offset, uint64_t bytes, int r; uint8_t *buf = NULL; QEMUIOVector local_qiov; - + size_t len = 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 <= s->max_transfer); @@ -1193,7 +1195,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 = qemu_try_memalign(s->page_size, bytes); + buf = qemu_try_memalign(qemu_real_host_page_size, len); if (!buf) { return -ENOMEM; From patchwork Tue Oct 27 13:55:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 311613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA0E5C55179 for ; Tue, 27 Oct 2020 14:23:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1858520780 for ; Tue, 27 Oct 2020 14:23:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i09TGiX4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1858520780 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPsh-0008Uc-57 for qemu-devel@archiver.kernel.org; Tue, 27 Oct 2020 10:23:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXPUI-0004Ok-Sg for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXPUG-0004Yf-Ux for qemu-devel@nongnu.org; Tue, 27 Oct 2020 09:58:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807088; 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=MB1ipRfRNkXChQukvt9rriPJxQdgZRtBkWvpvX32y+s=; b=i09TGiX4NSbuJUVVPjg2N5LRP0nOJDJBET+6K/eAYx1NnYddhbnG6PQfz9enKf5PQ+fLxR sFBE1h9C5rk66G6C1fMKmRW7io+BWnhRNjGov/qUlrGZtov2B0ENzMrLClaFjW9WbZpMti 4VJdKlqEMFcsvRAjCkZrNlWjXtiPK8c= 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-507-iDl1o-UCPiCMwBQYZ9o06A-1; Tue, 27 Oct 2020 09:58:06 -0400 X-MC-Unique: iDl1o-UCPiCMwBQYZ9o06A-1 Received: by mail-ed1-f70.google.com with SMTP id t7so743222edt.0 for ; Tue, 27 Oct 2020 06:58:06 -0700 (PDT) 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=MB1ipRfRNkXChQukvt9rriPJxQdgZRtBkWvpvX32y+s=; b=mrLcJul10dTVfLCP6/NkjvkG2OI8Nls/BEffFQm5nWhpIDtocM1NuBuQ5E35QcDd32 IEOyKR1oDeqZE0/vtD/gCFzs9Kbix8IA+B6sGWR0CjxZVS2QZ+QS9p43mptWNdr9K8Ow RdTHnf6iOIRGvCKDXojEPSYDq6rUZpjdMItIxLQzZfIZFQR1WlAgk18XgzEmJsaP1qtW tpkrrSZ8UFKq4ION9I7S72/kGGzxun0oMZPyqGYnvM6Q8Zb57gL4qHJA+BjJCGHo03ZM ff2/+LNoWAeKNrtA+U2mu1yInzHNImHzayUDuSAlH7JgjSXEJfgnuu+AV6USqzWLolJG fvFQ== X-Gm-Message-State: AOAM530IXBgNYZ8M1K6DOLK+0cf3zLgeVN2jSwlF43dC4oFkw4UTiQ0f 6/BqygaWE3qPN265s7LS0QExLJuQVf/IGTHSsrTefP2Wq6g1LFqj2tURWKTe1/vmoWtHbPOeawP klBMO9dnQGRaEMqc= X-Received: by 2002:a17:906:d89:: with SMTP id m9mr2683050eji.18.1603807084941; Tue, 27 Oct 2020 06:58:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymVc4dVnOkyLbfsI+Fr2X1rcFLIDMM9dqqTlvJbktlhH+2ZQuRpkw8vcWq5D7Ppx2VxD6+VA== X-Received: by 2002:a17:906:d89:: with SMTP id m9mr2683032eji.18.1603807084740; Tue, 27 Oct 2020 06:58:04 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id 11sm1084734ejy.19.2020.10.27.06.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:58:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 25/25] block/nvme: Fix use of write-only doorbells page on Aarch64 arch Date: Tue, 27 Oct 2020 14:55:47 +0100 Message-Id: <20201027135547.374946-26-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Eric Auger , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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=4K. Fixes: f68453237b9 ("block/nvme: Map doorbells pages write-only") Reported-by: Eric Auger Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Auger --- block/nvme.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index c1c52bae44f..ff645eefe6a 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; @@ -778,8 +779,10 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, } } - s->doorbells = qemu_vfio_pci_map_bar(s->vfio, 0, sizeof(NvmeBar), - NVME_DOORBELL_SIZE, PROT_WRITE, errp); + s->bar0_wo_map = qemu_vfio_pci_map_bar(s->vfio, 0, 0, + sizeof(NvmeBar) + NVME_DOORBELL_SIZE, + PROT_WRITE, errp); + s->doorbells = (void *)((uintptr_t)s->bar0_wo_map + sizeof(NvmeBar)); if (!s->doorbells) { ret = -EINVAL; goto out; @@ -913,8 +916,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); g_free(s->device);