From patchwork Thu Nov 11 15:45:51 2021 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: 12615285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D94CC433EF for ; Thu, 11 Nov 2021 16:06: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 D4E5861252 for ; Thu, 11 Nov 2021 16:06:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D4E5861252 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlCav-0006F7-2i for qemu-devel@archiver.kernel.org; Thu, 11 Nov 2021 11:06:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlCH6-0000ew-3h for qemu-devel@nongnu.org; Thu, 11 Nov 2021 10:46:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlCH4-0006JX-22 for qemu-devel@nongnu.org; Thu, 11 Nov 2021 10:46:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636645561; 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=Ufp9/KuAUrGSuDryICkcm/rvLOo65pXuj1/Jiaem2tU=; b=WovfbtQFX9iAIgj/itU/mV1UQDA2FPpWF7paDdivyNESy/0W9N6j7dfqlDNPtFxzYuiqwF wqT3ctzDzuRKUEafM/sFocj1CTyaLKmJCbr3H+KWBSBhwASP8eadTIomEchLkyFsdffgKd c8zdQc0pfkmMgC/dHU9/MH11k17HxA8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-p0qTb2Q2MFiMw-cAHZm8mA-1; Thu, 11 Nov 2021 10:46:00 -0500 X-MC-Unique: p0qTb2Q2MFiMw-cAHZm8mA-1 Received: by mail-wm1-f72.google.com with SMTP id l187-20020a1c25c4000000b0030da46b76daso4955077wml.9 for ; Thu, 11 Nov 2021 07:46:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ufp9/KuAUrGSuDryICkcm/rvLOo65pXuj1/Jiaem2tU=; b=BNAG/L2HsvsoFES5s4WNgxSI2BbiLIeeoEHonLBaHwx0LdbH3YHAbjv8wO2l3dr2rw vjCWRQOwETd0Q63TYvEZ+Ex0q9Xdnz5S6Xvvq/1rnblzs0b/DqOzrwc1M2ZsfQEhZ6C6 e2tf2y4fCm/AxZVbl4MWIAK4ATbh0Y7jDg311yGnen1Jd7wy8JWULtFasg4q5o8Hifrq So0tgW520ebUHtcYobmM6MWesHgXMJknjRkE5FUhGRdEzCziusK0F0p3MFeyzFxUW4km bSC1CzVQTnlxp9oAf/Jsejdrv2WFbZygw/Xj2lLW8L1U4XMvTqpkLs+K9IJVEUfSSgTF D9og== X-Gm-Message-State: AOAM531hvC2WElGQrMchsSgkx9DWGdVCX085iRhfXBFAJHXvvK9uXTXI Hw+QwnPn1tteERQvCoIuypxsl2Ckw+rUY5L7TRpBCrQvLrzkKJfPtsXSSPvQaVMGnn3fEICZTTJ WOj/Urv+2Y0vPTHhcW8Say/GMBVHSROGfiDXvGQdEIPovxiI4YMXat96dmvjgUhQ6 X-Received: by 2002:adf:dec9:: with SMTP id i9mr10023633wrn.18.1636645559199; Thu, 11 Nov 2021 07:45:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlucSH3XNcTexDTWhwwNeLQC0LqJjzbGZFLLEsb9uLdk/G9V/NSaSaAjAfZmXbkOjO44bFQw== X-Received: by 2002:adf:dec9:: with SMTP id i9mr10023593wrn.18.1636645558909; Thu, 11 Nov 2021 07:45:58 -0800 (PST) Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id z6sm4216155wmp.1.2021.11.11.07.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 07:45:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 1/2] hw/nvme/ctrl: Have nvme_addr_write() take const buffer Date: Thu, 11 Nov 2021 16:45:51 +0100 Message-Id: <20211111154552.2263410-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111154552.2263410-1-philmd@redhat.com> References: <20211111154552.2263410-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=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The 'buf' argument is not modified, so better pass it as const type. Signed-off-by: Philippe Mathieu-Daudé --- hw/nvme/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 634b290e069..c7cce63372a 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -377,7 +377,7 @@ static int nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size) return pci_dma_read(&n->parent_obj, addr, buf, size); } -static int nvme_addr_write(NvmeCtrl *n, hwaddr addr, void *buf, int size) +static int nvme_addr_write(NvmeCtrl *n, hwaddr addr, const void *buf, int size) { hwaddr hi = addr + size - 1; if (hi < addr) { From patchwork Thu Nov 11 15:45:52 2021 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: 12615223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E623C433F5 for ; Thu, 11 Nov 2021 15:49: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 1EDEA61179 for ; Thu, 11 Nov 2021 15:49:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1EDEA61179 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlCKQ-0005x3-5c for qemu-devel@archiver.kernel.org; Thu, 11 Nov 2021 10:49:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlCHB-0000qa-8Z for qemu-devel@nongnu.org; Thu, 11 Nov 2021 10:46:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlCH8-0006Ki-Q7 for qemu-devel@nongnu.org; Thu, 11 Nov 2021 10:46:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636645566; 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=qg1GXXFWmSDcEemSye0eTm+kWbLuLN+y4psRhU/uNI4=; b=GtCJSQNTOT5x+6niF+ax4ya8BQW3Ejc98qxR60Mf53Ncs0wdDF5uFev/k92DfiG0cXZ8g7 /WsYL4qrO9RhFVu59rSH/FrA1OiKCOJwnM/v7Ahr82R/FIj4d1o12NEZGsqX4RtK/99i7f uAeYsmxr6+REYDMSKupZtgD2DNpw/Os= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-45nZbo9SNqudGpfon1LI6A-1; Thu, 11 Nov 2021 10:46:05 -0500 X-MC-Unique: 45nZbo9SNqudGpfon1LI6A-1 Received: by mail-wr1-f70.google.com with SMTP id c4-20020adfed84000000b00185ca4eba36so1069354wro.21 for ; Thu, 11 Nov 2021 07:46:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qg1GXXFWmSDcEemSye0eTm+kWbLuLN+y4psRhU/uNI4=; b=g+6Oec4Pj4iSHKvp1UHvBmalPb4sS1ytigd32WXaos7XFANOqQ4uHdTlysEKHoEnR/ F4LpcSyKvXossSxXqE7PFO2GVe/UNt0++6wSd494q1jtFNs70Mrbul5NNiL+sKaoBk2k 9c++V81zh904RMpqs0z9OiiXlsSP1zYhpcWMuWJcYvK5w7eHGovG3iO0LgR64dGNtOFi njRE5Ti8/NymovN2XA8d+UF4xGiIrel2RppMz1SyrN3KWC6grjCJFDj433fHdiB1h0o3 svgxiSeqZw92QzqlGMIJCjKASPaH64euql7j40lp0VyVqPT+xm+AwTbYyzxhBannycuj BYCQ== X-Gm-Message-State: AOAM5338BbNH7vf5szqzNdFWg0Kaqg3sXVzhPSdGXrt8QRl5YCBFSGci h0vJi8e5Y3al/afvBRz/o2orOaJBi+eGTFkc9E1KWAR4O380FN2CUFRNwd0zE7z1cyd7oKY30rn 5CgsPrMRhZASKrd3PkO6ewOG3l7V45efWdvRlu2nrpUXGWHlcWaIIEdIV8MC+OPV8 X-Received: by 2002:a5d:64c4:: with SMTP id f4mr10101753wri.6.1636645563790; Thu, 11 Nov 2021 07:46:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxh8Br+4KE98xdyxkc2md5NniXedu5Ini8Z3gjTF0VwvQ8qxqhrB7d2A1ank+jBGemjgXHApw== X-Received: by 2002:a5d:64c4:: with SMTP id f4mr10101717wri.6.1636645563607; Thu, 11 Nov 2021 07:46:03 -0800 (PST) Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id t8sm3219528wrv.30.2021.11.11.07.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 07:46:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 2/2] hw/nvme/ctrl: Pass buffers as 'void *' types Date: Thu, 11 Nov 2021 16:45:52 +0100 Message-Id: <20211111154552.2263410-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111154552.2263410-1-philmd@redhat.com> References: <20211111154552.2263410-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-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" These buffers can be anything, not an array of chars, so use the 'void *' type for them. Signed-off-by: Philippe Mathieu-Daudé --- hw/nvme/nvme.h | 4 ++-- hw/nvme/ctrl.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 83ffabade4c..38f3ebf7f6c 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -495,9 +495,9 @@ static inline uint16_t nvme_cid(NvmeRequest *req) } void nvme_attach_ns(NvmeCtrl *n, NvmeNamespace *ns); -uint16_t nvme_bounce_data(NvmeCtrl *n, uint8_t *ptr, uint32_t len, +uint16_t nvme_bounce_data(NvmeCtrl *n, void *ptr, uint32_t len, NvmeTxDirection dir, NvmeRequest *req); -uint16_t nvme_bounce_mdata(NvmeCtrl *n, uint8_t *ptr, uint32_t len, +uint16_t nvme_bounce_mdata(NvmeCtrl *n, void *ptr, uint32_t len, NvmeTxDirection dir, NvmeRequest *req); void nvme_rw_complete_cb(void *opaque, int ret); uint16_t nvme_map_dptr(NvmeCtrl *n, NvmeSg *sg, size_t len, diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index c7cce63372a..8feefde9d19 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -1140,7 +1140,7 @@ static uint16_t nvme_tx_interleaved(NvmeCtrl *n, NvmeSg *sg, uint8_t *ptr, return NVME_SUCCESS; } -static uint16_t nvme_tx(NvmeCtrl *n, NvmeSg *sg, uint8_t *ptr, uint32_t len, +static uint16_t nvme_tx(NvmeCtrl *n, NvmeSg *sg, void *ptr, uint32_t len, NvmeTxDirection dir) { assert(sg->flags & NVME_SG_ALLOC); @@ -1176,7 +1176,7 @@ static uint16_t nvme_tx(NvmeCtrl *n, NvmeSg *sg, uint8_t *ptr, uint32_t len, return NVME_SUCCESS; } -static inline uint16_t nvme_c2h(NvmeCtrl *n, uint8_t *ptr, uint32_t len, +static inline uint16_t nvme_c2h(NvmeCtrl *n, void *ptr, uint32_t len, NvmeRequest *req) { uint16_t status; @@ -1189,7 +1189,7 @@ static inline uint16_t nvme_c2h(NvmeCtrl *n, uint8_t *ptr, uint32_t len, return nvme_tx(n, &req->sg, ptr, len, NVME_TX_DIRECTION_FROM_DEVICE); } -static inline uint16_t nvme_h2c(NvmeCtrl *n, uint8_t *ptr, uint32_t len, +static inline uint16_t nvme_h2c(NvmeCtrl *n, void *ptr, uint32_t len, NvmeRequest *req) { uint16_t status; @@ -1202,7 +1202,7 @@ static inline uint16_t nvme_h2c(NvmeCtrl *n, uint8_t *ptr, uint32_t len, return nvme_tx(n, &req->sg, ptr, len, NVME_TX_DIRECTION_TO_DEVICE); } -uint16_t nvme_bounce_data(NvmeCtrl *n, uint8_t *ptr, uint32_t len, +uint16_t nvme_bounce_data(NvmeCtrl *n, void *ptr, uint32_t len, NvmeTxDirection dir, NvmeRequest *req) { NvmeNamespace *ns = req->ns; @@ -1218,7 +1218,7 @@ uint16_t nvme_bounce_data(NvmeCtrl *n, uint8_t *ptr, uint32_t len, return nvme_tx(n, &req->sg, ptr, len, dir); } -uint16_t nvme_bounce_mdata(NvmeCtrl *n, uint8_t *ptr, uint32_t len, +uint16_t nvme_bounce_mdata(NvmeCtrl *n, void *ptr, uint32_t len, NvmeTxDirection dir, NvmeRequest *req) { NvmeNamespace *ns = req->ns;