From nobody Sun Feb 8 17:13:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636645562; cv=none; d=zohomail.com; s=zohoarc; b=YXYqeImOA7CVU3p/7pOpc5t3siekNXrBInVf/4SL2S0PZ91jqe0uhfwWD/3pi++g2t1Q6DXgR4NBoJNq373/g0Heopiudwr5Thze4jhC+k6fp3DZTQoS04jDYUEtYWIO0ZhnhrWUFO6d7C16YTT7Uy1hPaerPawSPf4W8Km3wB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636645562; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Ufp9/KuAUrGSuDryICkcm/rvLOo65pXuj1/Jiaem2tU=; b=CExBdDokv/O3hCKtUciIwpikIzg7aVRLVps8Gdhnp/WB0m8YRGO5ckksy5W5Ri9meYmeadab3TvL6MPfWPSD9l96RcIecn6xUbzD9p0YIhDJdBx2bNo/k5GASYjGi7Rxs0mWQEteadYFF+Pl/Ho+OKxXag2TzsNGXE57hWzvaPU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636645562441460.6536801567063; Thu, 11 Nov 2021 07:46:02 -0800 (PST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-828idtL7Ok-I36jAgEQ5wA-1; Thu, 11 Nov 2021 10:46:00 -0500 Received: by mail-wr1-f72.google.com with SMTP id v18-20020a5d5912000000b001815910d2c0so1081148wrd.1 for ; Thu, 11 Nov 2021 07:46:00 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: 828idtL7Ok-I36jAgEQ5wA-1 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=eqT6Ae13qfxc7ZUCnu2QGGhegBpzO6obe3cI5HZBHqZD9Eq1eNAhJiTHs2Wk5zFNsy He0f84HTDUOAxX7MMazvjo4bzaaeBw3kMCkyzeChwwrMt/mMvz7F9PECjt9mRmehS31X bHBmq969986OrRPBZo1FVtvA3QxQSWS1SZXtyaSELwhy8Y+CQz8qQSm8/gvjbnAcsuD4 GL0UmFSHpAte8UM52bFo7aQiZmiHmu7xklDepT9V+1b/dPQa7K2Lpn3iLPgmECXttuH3 8q6GhyFQ0fJqpJP7durx10ijPbgyIJg3A7g6N9x8JNMw+Ke71o7zsMAggDBixx2zcqK7 4wbA== X-Gm-Message-State: AOAM530talpBT8MJim+jIXZzAPvfxcV52W8Te7E5d0yMM5EB9peNYhF9 X/4xwiFjS0lTNDA62GLAS7Y3VWZB+gtAkJY/Tny1X0IZvZA/9IKm3VZteauCYEnAp/FoGOv+AQV qzdqjJhBisJ305w== X-Received: by 2002:adf:dec9:: with SMTP id i9mr10023615wrn.18.1636645559093; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636645563187100001 The 'buf' argument is not modified, so better pass it as const type. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Klaus Jensen --- 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, voi= d *buf, int size) return pci_dma_read(&n->parent_obj, addr, buf, size); } =20 -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 =3D addr + size - 1; if (hi < addr) { --=20 2.31.1 From nobody Sun Feb 8 17:13:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636645567; cv=none; d=zohomail.com; s=zohoarc; b=Pq/992fwBgQ8GejTbUsMwJqYUVfhnK2p4WANX03FrME/NH5cLbkL60Ba7zBQ33UvPPiOUafPRvGGXa7tBnHLg+5TZEXeJKG/Dlp4q88YGsRSAzR3n4I56tzysFMPZctB/6i4NxjtZS36PzGkwUEMzULKG3DDCs4m1tN23uDVowY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636645567; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=qg1GXXFWmSDcEemSye0eTm+kWbLuLN+y4psRhU/uNI4=; b=VRKBn5u6fL6FMJ1LjWzgCcm58Wa5TiMS8S62nASwbG9zc3RWyDJG3of9K8elr7pKHS1KgKp75Qp3yFk3evk4WQk2WWNqd6c9MhfTuXO4TeuCif8keFLk+3TnnkHOeYdsr8cGhsoQEEiCgEh8d2A+UZfR1z9V97fReQTGitZeefw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636645567547618.0273635048258; Thu, 11 Nov 2021 07:46:07 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-OdPkFJU6MVmI71ocYGiv6Q-1; Thu, 11 Nov 2021 10:46:05 -0500 Received: by mail-wm1-f69.google.com with SMTP id 69-20020a1c0148000000b0033214e5b021so2908666wmb.3 for ; Thu, 11 Nov 2021 07:46:05 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: OdPkFJU6MVmI71ocYGiv6Q-1 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=Zg6K1glHSBfPcvjb9Jx/NhqRcyj7ipBjsqgKMJbOBOBMrUIj8NB733MPzYSIT6WXj/ MUzgmjT3/A7r8gyTvzvPDk9v6azuPbsBVMJn2FIdoxIJhqaq2I4YMn6mpUg0zU9ROCFc aUhp1mpYwQv0BiezLjBd5ZT85zZ+OfbfhXLRNoxUsGCGuIjiTg0+Wxn2iEbZCuZoA8PK rS9Vfv3Pb6xl/1S4eQM2XzKaJk29EBwgMIZsdrO3QJJVcG6XLnL82KTbmDkWSxaD6r0A egIj8YneCBz0FX3reyaaoVQvokJvETyRV8A5Bz8yMqcHDyVXSpBzqKwF3N/jQEgiUuRY HRqw== X-Gm-Message-State: AOAM533SrA06BNCmXXupO6EpiuiPMAUyc1K3ByTrl1DdcMyKM7ruQz0v CFwEIPb6MmyFS+lHztmJYHTS8mzhDT81nnZLK+uVqZiT3yuyhIGwFMoNEZujaAO8ZYWNSSijMlL Xjr3nVJbQKv2iKQ== X-Received: by 2002:a5d:64c4:: with SMTP id f4mr10101746wri.6.1636645563754; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636645569180100001 These buffers can be anything, not an array of chars, so use the 'void *' type for them. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Klaus Jensen --- 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) } =20 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, Nvme= Sg *sg, uint8_t *ptr, return NVME_SUCCESS; } =20 -static uint16_t nvme_tx(NvmeCtrl *n, NvmeSg *sg, uint8_t *ptr, uint32_t le= n, +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, uint= 8_t *ptr, uint32_t len, return NVME_SUCCESS; } =20 -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); } =20 -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); } =20 -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 =3D 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); } =20 -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 =3D req->ns; --=20 2.31.1