From nobody Sat May 18 08:35:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588585871; cv=none; d=zohomail.com; s=zohoarc; b=TjqcgIQYQwjzvV1NqStVcq58NB1+EOrlJKwpId0P4/ddB19j0bA32ocfyO27XOA577walq2ITYMhu44/MdTfMQMu4+u+PETAWkGa54hZsjolOvzz6nUtB6dp3EYefttOjlu40o2zv60nk6QOpTpsSDz+3pLn5HT8vDFxpEnJwiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588585871; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KhOlEPdV1MPRa1bhWdiFiaKD4sTZExgyZBrWdNh/d4I=; b=fLABYA1j/1PR32sBW0BFf2raOU2kb+USDEd6ub6M3fTsNbMadtGuOLcTTSRK8WKoHE6+HgnCa6UdAaY1wtopj4KWpThz3SJMBquM63o/mnYtXfuiFrYzMKwPKnbISc5iuPEWYcCWF5TqiopXIU9RPFIuaMBxwuwydCiXEh5f4lg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588585871491781.0060458465829; Mon, 4 May 2020 02:51:11 -0700 (PDT) Received: from localhost ([::1]:47390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXkk-0002LF-7s for importer@patchew.org; Mon, 04 May 2020 05:51:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXgb-0004rG-IR for qemu-devel@nongnu.org; Mon, 04 May 2020 05:46:53 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22363 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVXgZ-00044C-Ud for qemu-devel@nongnu.org; Mon, 04 May 2020 05:46:53 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-PKpxtiWPOCC29jxLKp6yRQ-1; Mon, 04 May 2020 05:46:50 -0400 Received: by mail-wm1-f71.google.com with SMTP id b203so3212760wmd.6 for ; Mon, 04 May 2020 02:46:49 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id q4sm11501353wrx.9.2020.05.04.02.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588585611; 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=KhOlEPdV1MPRa1bhWdiFiaKD4sTZExgyZBrWdNh/d4I=; b=NEkiEZCNWrxelnDujwEvNL+zpD9zUy8jqNZt8iKL1PshQ5I3subJPw1D6A8kFxhCm0nPk+ KZFHunVtFfYhbLEaB278D0hGkTIsD4A1uo+d8zUVw77Twm4bBvUTDeK+46CldwcTI6NxmV DhWa5YJhniRj3lB717uVcr+uK7daBBk= X-MC-Unique: PKpxtiWPOCC29jxLKp6yRQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fe9XuSKHStEMPdZ3hwHFEgn1Ge5bLQXbUaYotgjFj4E=; b=KKBDczEK2dNGaqNM49J+v/GZ3r9KHDWnZbaUmx/owa+hJWPkP+X9CI8v2ygB+Gb/K/ seFj3PZ8EyPQUAi3v72sEpeIQ8vRqs21cgAk5kCydyxHfrNRHxuFKx0LcQ6VB4D6GK1E UtLzR9SxWcgFWoF0K1ABxlHPBsmuxQoQ7ZrZN7v3KoLtDi7uN9GXrNc7u0YdUNR4VC16 y+/yHhclypYfeuZGXgJs/dZ8m1uOL8/rS7mL65YaI3u0xGlI855S/7JSRs2jCeW9IEgI Ghbh2p7ADPiwmhxgR2giuxcRdWIj8IiHenBS4W0Zwmno7NBQ/RHKXXM+1/Istk7sy0+b cGDg== X-Gm-Message-State: AGi0PuY1+0zwz65bz2HwmrnjB4pmku9VNPnrHid8MWv25IEWxJeb///a 747ZjVANQ2IRcAALPWs+p8F8p2NK2egdntb6+6GiomlDEcs/Y1j4VcadecEsEto1EScTeqTLyWs R4myBVXnJBXP5pIA= X-Received: by 2002:a1c:dfc2:: with SMTP id w185mr13126525wmg.1.1588585608433; Mon, 04 May 2020 02:46:48 -0700 (PDT) X-Google-Smtp-Source: APiQypL1J0dxwdFdpgEDg8RfuSauWRqWbXCT2JLum/eK1/uv9/8nuQGi696XSk/esqWqO1+WztmEdw== X-Received: by 2002:a1c:dfc2:: with SMTP id w185mr13126493wmg.1.1588585608190; Mon, 04 May 2020 02:46:48 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/6] qemu/osdep: Document qemu_memalign() and friends Date: Mon, 4 May 2020 11:46:36 +0200 Message-Id: <20200504094641.4963-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504094641.4963-1-philmd@redhat.com> References: <20200504094641.4963-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:21:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Maxim Levitsky , Keith Busch , Stefan Hajnoczi , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Document allocator functions that require a specific de-allocator call. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- include/block/block.h | 4 ++++ include/qemu/osdep.h | 3 +++ include/sysemu/block-backend.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index 8b62429aa4..c57fdecf9a 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -526,9 +526,13 @@ void bdrv_img_create(const char *filename, const char = *fmt, size_t bdrv_min_mem_align(BlockDriverState *bs); /* Returns optimal alignment in bytes for bounce buffer */ size_t bdrv_opt_mem_align(BlockDriverState *bs); +/* callers must free the returned pointer with qemu_vfree() */ void *qemu_blockalign(BlockDriverState *bs, size_t size); +/* callers must free the returned pointer with qemu_vfree() */ void *qemu_blockalign0(BlockDriverState *bs, size_t size); +/* callers must free the returned pointer with qemu_vfree() */ void *qemu_try_blockalign(BlockDriverState *bs, size_t size); +/* callers must free the returned pointer with qemu_vfree() */ void *qemu_try_blockalign0(BlockDriverState *bs, size_t size); bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov); =20 diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 20f5c5f197..778c459c22 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -294,8 +294,11 @@ extern int daemon(int, int); #endif =20 int qemu_daemon(int nochdir, int noclose); +/* callers must free the returned pointer with qemu_vfree() */ void *qemu_try_memalign(size_t alignment, size_t size); +/* callers must free the returned pointer with qemu_vfree() */ void *qemu_memalign(size_t alignment, size_t size); +/* callers must free the returned pointer with qemu_anon_ram_free() */ void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared); void qemu_vfree(void *ptr); void qemu_anon_ram_free(void *ptr, size_t size); diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 34de7faa81..f2dcf63ae3 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -203,7 +203,9 @@ uint32_t blk_get_request_alignment(BlockBackend *blk); uint32_t blk_get_max_transfer(BlockBackend *blk); int blk_get_max_iov(BlockBackend *blk); void blk_set_guest_block_size(BlockBackend *blk, int align); +/* callers must free the returned pointer with qemu_vfree() */ void *blk_try_blockalign(BlockBackend *blk, size_t size); +/* callers must free the returned pointer with qemu_vfree() */ void *blk_blockalign(BlockBackend *blk, size_t size); bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp); void blk_op_unblock(BlockBackend *blk, BlockOpType op, Error *reason); --=20 2.21.3 From nobody Sat May 18 08:35:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588585737; cv=none; d=zohomail.com; s=zohoarc; b=eCC96nzKkejN8RWiqMHnw9lYMCjSALqq/CVGiKAzp8+gBTzXxUYXspOLLz5ACstc/2jAwYRYDVrcDTbOfwkYsaz2QPsXqx/t6YUfxTXLqbcY7df6eS+yPJcjE+PcF6bS31onm1Ify6TTBmYYSmaapGdbzaQ7JXkDEkAjYUMnHrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588585737; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2JQqRaa3lceQY2Cox9GrAmR4rq6Pv9q/z7ys+NUFBVQ=; b=NjYECaU1HOl8aVNIF3tTyDKe8hr6aM6iH/vM2kmd/CdYw7ytBqYFexr6kerBLmlFyLNGiQmP7BroHfCBJYaPF1UX8lyDFcLGeX+irbWFRMH+rJaw/AkQjSwPrPcEjoxvNmGjTJj1PwhZlu4lwXQ2ud/I1Kk24pB2xrKWaxDa1Jg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588585737024365.34218408916274; Mon, 4 May 2020 02:48:57 -0700 (PDT) Received: from localhost ([::1]:38896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXiX-00079m-JQ for importer@patchew.org; Mon, 04 May 2020 05:48:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXgg-0004vr-OH for qemu-devel@nongnu.org; Mon, 04 May 2020 05:46:58 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:20283 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVXge-0004CY-SN for qemu-devel@nongnu.org; Mon, 04 May 2020 05:46:57 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-W-TUwdPGMxKHv8v_6qHizw-1; Mon, 04 May 2020 05:46:54 -0400 Received: by mail-wm1-f70.google.com with SMTP id l21so4600008wmh.2 for ; Mon, 04 May 2020 02:46:54 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id a13sm10529403wrv.67.2020.05.04.02.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588585616; 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=2JQqRaa3lceQY2Cox9GrAmR4rq6Pv9q/z7ys+NUFBVQ=; b=Pk2ccTEw5vglIQX4FMDEaCj2Vpzn0D6a61XCJ61mTt/EZ/zMH9TyNmUpXoX1LPHcl1gyyb DaY7YwUAbOShA35CSigWuTsibJYiR3CFNH/o7tqm8Zv+7o22OyG+otfrH58/gdnCcuKGNS besZCVmWXkKpSWrAx01O8Rs0/wwbPnw= X-MC-Unique: W-TUwdPGMxKHv8v_6qHizw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sohTl/XQVWV8gUG5aVpQRD87OojC6hP3gHhZB8wVux0=; b=Sbu4+UDJ9XglKa2pixdrI9EtMtVpQGV4C378ccdx0HyAsvXGdy0bt1KManiFgcqb5W JpKX83uoPCNL1Q7MPJQD1DLhVshdUblTpPe3HnAiJMhk36i/gdiJumEkSC1/XaunAqbJ T6slDnKMK5X9NXehjETN4cRdERx6M+5qmckwKtkUuxQLH/1Qsw7xd+7DsXeqVFW3f0Dm pub/MjSXymUbJ+b07fRJX+Qt9RmO2FXUC2MexZdXb/MwP3Hjp+LltLo4ykHqISbaUqFO 4pcwqZ5fG0XYIzHTwFuE3ZVU1ZzEFqKixx+pOkbNdxHiriA1YKV28ZgQ8S/AoEy3HxXg hf2A== X-Gm-Message-State: AGi0PuZ1ZfdsPd8F8Lf4DRE29fBHX/EkjAro81hrog//5XiMxGsxFanJ vZNFPgnJfPxrJEe7zo4o/7gH2rNZMwu3y3RNZyV+i9AArcYcannnLgqDA4wGyIYBGw03vTUqZi7 szJik5g/GqMmfK8c= X-Received: by 2002:adf:d091:: with SMTP id y17mr17521117wrh.418.1588585613141; Mon, 04 May 2020 02:46:53 -0700 (PDT) X-Google-Smtp-Source: APiQypJVL4aNUKKB/YhYWDA8wYUmMElDApF8Fu0tx/nu9Hq5Z1bMOWXo/YUJSWq09CfP89GA25ffiw== X-Received: by 2002:adf:d091:: with SMTP id y17mr17521101wrh.418.1588585612938; Mon, 04 May 2020 02:46:52 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/6] qemu/bitmap: Document bitmap_new() returned pointer Date: Mon, 4 May 2020 11:46:37 +0200 Message-Id: <20200504094641.4963-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504094641.4963-1-philmd@redhat.com> References: <20200504094641.4963-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:14:00 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, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Maxim Levitsky , Keith Busch , Stefan Hajnoczi , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- include/qemu/bitmap.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 82a1d2f41f..0b390ff576 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -90,12 +90,14 @@ int slow_bitmap_intersects(const unsigned long *bitmap1, const unsigned long *bitmap2, long bits); long slow_bitmap_count_one(const unsigned long *bitmap, long nbits); =20 +/* callers must free the returned pointer with g_free() */ static inline unsigned long *bitmap_try_new(long nbits) { long len =3D BITS_TO_LONGS(nbits) * sizeof(unsigned long); return g_try_malloc0(len); } =20 +/* callers must free the returned pointer with g_free() */ static inline unsigned long *bitmap_new(long nbits) { unsigned long *ptr =3D bitmap_try_new(nbits); --=20 2.21.3 From nobody Sat May 18 08:35:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588585895; cv=none; d=zohomail.com; s=zohoarc; b=j/EREuI2X/fwapA/c6pHCHymWV0+frPYj99/5GYKJfxGnmapEzUvxiJQrWc/VMlq97IL4WDSQ2LcN2Tysv8Sq2hEVVKN+2jfQJQm+kkrWFqecGlRYb4R4OfVncJRCRZ+TKeQaeOmdMdrmdtkyW5I8Ov3vsAGu09WBW/DVZ2HRVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588585895; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iOoRSFUD32uShqGqJeGiHJdxg36QvfSMrGROhUVpi4c=; b=Ibwm1Bos/5SvWyIP4XqXssgwfsA8Tl20OHSX0hnAlB8h6b8lUE1URiFfv4REXZ/QClB6ozmLx48DnSJ1vHfDE2McvVDuZHV6iB0UqaHj0WZ/bPdF6OB15NnzR2r4fdbGYbINg9QYn0pBW57Hy4RlSaXF/Dgzlmq3vnTB2aFkRr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588585895841186.3263056977794; Mon, 4 May 2020 02:51:35 -0700 (PDT) Received: from localhost ([::1]:49864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXl8-0003M6-KP for importer@patchew.org; Mon, 04 May 2020 05:51:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXgl-0004zk-Be for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56347 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVXgk-0004EJ-DB for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:03 -0400 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-244-ILmlFRz8OEC1lzIdiiSMQw-1; Mon, 04 May 2020 05:46:59 -0400 Received: by mail-wr1-f72.google.com with SMTP id g7so10433283wrw.18 for ; Mon, 04 May 2020 02:46:59 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id k6sm12762713wma.19.2020.05.04.02.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588585620; 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=iOoRSFUD32uShqGqJeGiHJdxg36QvfSMrGROhUVpi4c=; b=AgCChtIZvXKH8Gjd9bILDXyiiBlShzXtr+axBojLPQdVDrWKGoTvMuX5/FiO+f2fMGuJTf /fQXypO/plNge+thD5QJFE/Em/H7cz+PkejH25y+u5/cUKyDq+eo3s+s3XGXrqF1xnSuCe 4zn80ArqLWe9KgJeQCeuE3zLrlkvO3U= X-MC-Unique: ILmlFRz8OEC1lzIdiiSMQw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jqr2MbWG5qDVE72NJQlyIDzc23rCOzvleinSwfktvqM=; b=VYbcdPeGDqHEmzSszY51R1DfobfY6sydDG/gmRC7sP9m49bHEEKAxFCLm3+XQYXzr6 5pULtL/a1iouQ5CgfCNzxJdJFXLyxs4ctEk2KTtHCicyUnZjz4ef67xxOdZ+BpNRGHPQ gBObK6CkmyvTMAo1CcWhxAd1zkwJn8xsS88MeDIegTZWm04LJm965KfdgO6xRCEpst90 yFMG4x4t+N+5eL9xBrCsC3nzrhrgPxDk8jnapPYAULa/Jy+h2LtoKJuMrY8tCMSC1/aD l1DBxu9vXUf7qDkXHLjPzWYTdylBsFm0OWFX8DIfFytVPFjerQowjVUDqI+S3qnAYJd/ D3vw== X-Gm-Message-State: AGi0PuZpDUotRKEj0tIOCm2OOFuMlZ6tNH4Y3bKCTub7oRiF4HmIwkVW u7jXb+v0etfvLshkOt9mKOgh04574wB+lCgjLDsNtc2o2yc+KYOIePdvmGQ3dAdb/96HoGXTokB otmDZIr3y6wXFtYI= X-Received: by 2002:a5d:5703:: with SMTP id a3mr17393242wrv.53.1588585617718; Mon, 04 May 2020 02:46:57 -0700 (PDT) X-Google-Smtp-Source: APiQypKRlXQhcOWnVxbUEExVA4635H7zp8oLcYLgcINZAFRoGyP+yAZN0t2Ty8e+2GE6VLyEZwspmQ== X-Received: by 2002:a5d:5703:: with SMTP id a3mr17393220wrv.53.1588585617497; Mon, 04 May 2020 02:46:57 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/6] sysemu/block-backend: Document blk_read()/blk_pwrite() Date: Mon, 4 May 2020 11:46:38 +0200 Message-Id: <20200504094641.4963-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504094641.4963-1-philmd@redhat.com> References: <20200504094641.4963-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 04:24:57 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Maxim Levitsky , Keith Busch , Stefan Hajnoczi , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The blk_read()/blk_pwrite() return value is not obvious, document it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/block-backend.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index f2dcf63ae3..823b8e94a7 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -153,7 +153,31 @@ BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, i= nt64_t offset, int bytes, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags); + +/** + * blk_pread: + * + * @blk - the block backend where the buffer content is going to be read f= rom + * @offset: position in bytes to read at + * @buf: the data buffer + * @bytes: number of bytes to read + * + * Returns: the number of bytes read on success, or a negative errno other= wise. + */ int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int bytes); + +/** + * blk_pwrite: + * + * @blk - the block backend where the buffer content is going to be writte= n to + * @offset: position in bytes to write at + * @buf: the data buffer + * @bytes: number of bytes of @buf to write + * @flags: request flags + * + * Returns: the number of bytes consumed on success, + * or a negative errno otherwise. + */ int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int byt= es, BdrvRequestFlags flags); int64_t blk_getlength(BlockBackend *blk); --=20 2.21.3 From nobody Sat May 18 08:35:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588585879; cv=none; d=zohomail.com; s=zohoarc; b=hMvXGxbaRLerw3t3hIFZM9RHGgmLyJJxbhDyBUPhYjo7oqOJIIU5FQaSrCXLHQwyWlWH8lvtNq+lZNgGPZ8SsZGjLHiejuOJcgGlJ+/367mzUBBs7UxwWn4ZWhl0uXfOqSA5dbfGJlR8pV7wtS51dJxsnNRC2kb6zW7qdiBQtbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588585879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AvIOGdjqIkzytmiWyY1qnAlUnGlQqd6ywNbmnMw49Uo=; b=mLP6ocWMM5cyFuJZMIJnqhwrXbl9fN55urCf5MpczPiA/D318QNYn6ReJ5Pxl5ecD4RJACi6xNP7mKpsDMC4tfaJHICS5CWX+ZCswrBrwvk2xXnxAGb7xDvpPlAYR0H90o9RjWUg6OAtfLSap1oqtR11W7QQXDBRpNKRDB9mxE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588585879284707.1824924515082; Mon, 4 May 2020 02:51:19 -0700 (PDT) Received: from localhost ([::1]:48112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXkr-0002dX-Pt for importer@patchew.org; Mon, 04 May 2020 05:51:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXgr-000581-AK for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:09 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:55164 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVXgq-0004GV-LG for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:08 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-guUDtxNfNXWAsaEhdgcH1A-1; Mon, 04 May 2020 05:47:03 -0400 Received: by mail-wm1-f71.google.com with SMTP id o26so3224175wmh.1 for ; Mon, 04 May 2020 02:47:03 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id g186sm12685573wme.7.2020.05.04.02.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588585627; 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=AvIOGdjqIkzytmiWyY1qnAlUnGlQqd6ywNbmnMw49Uo=; b=Le9ii+5FqkeWhPlxgjxzGfhdbxKHVYTDdhOrStSx1NO7eSTff1vOxS2MyLeKgj15X+vafj XwEOBfsJadCbGrA1RsS7ygTaSn9DVREQE7efd+DpKbo58f0m+2SKLs/KKhcy2TxHXCctvP XpMEH7gxDbdK8skcJVMdhuJzlY2awBc= X-MC-Unique: guUDtxNfNXWAsaEhdgcH1A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0cHqmvxZVKll/YDWdGdgBQsGWJ3nu/ONs4V6i1R5aFg=; b=HGKBFL92evv6ME03PBPn0oWEtLVQIck93yqF+CUL38jhi8JqSvmdGV+DKWfI2hHuuY +Z/kbpvPjc9UPDFJgSu6Au2RT1ieU4g2nubW4+p/9uzV6G+xNsvc0skRVAjmFuLjCcxC 6+23HY+Ka+Y3xUX6exYNYQaoCXYbEIJed+E6Qw6LcisD/aB1hpctSjr9Oe57iRHroJAr qVBp0qYvCJdrqW0cRzH2cIibqU7XUniwaqCOTNK4ci2HozWjiEXdvfHnA2YP/OZLvhGt nOIVaHxLOfTEyJr8pck0w5s6AmNk9aZHk6QUFPRpSzBeL2u7R/mydJ8YIqTp4p4/f58Q BBew== X-Gm-Message-State: AGi0PuYDD0BFj86tVNnay81bWR+hwZs4auZtsu4c0ywKtnltXYUEXCsp OAKEjOmLhsaRWMJi+ld5D6xtwtWF6gD5spb+jDAIM4OJ8g8NLyHrXbH2Wd9N2kc6FtddXd/y1J+ E/l8sQX1TTN/fkSw= X-Received: by 2002:a5d:6850:: with SMTP id o16mr17620779wrw.309.1588585622338; Mon, 04 May 2020 02:47:02 -0700 (PDT) X-Google-Smtp-Source: APiQypIDtNONPhZkTPwQdW6eLEOwCIYTz7AhsLlWKZ71vdMIAmvOq1vzhv8BNDUtr9Ma0tZ8UWbh8g== X-Received: by 2002:a5d:6850:: with SMTP id o16mr17620766wrw.309.1588585622200; Mon, 04 May 2020 02:47:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/6] block/block: Document BlockSizes fields Date: Mon, 4 May 2020 11:46:39 +0200 Message-Id: <20200504094641.4963-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504094641.4963-1-philmd@redhat.com> References: <20200504094641.4963-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:21:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Maxim Levitsky , Keith Busch , Stefan Hajnoczi , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" As it is not obvious for a block neophyte what means the 'log' value, document it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- include/block/block.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index c57fdecf9a..94517c92b6 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -86,8 +86,8 @@ typedef enum { } BdrvRequestFlags; =20 typedef struct BlockSizes { - uint32_t phys; - uint32_t log; + uint32_t phys; /* physical block size */ + uint32_t log; /* logical block size */ } BlockSizes; =20 typedef struct HDGeometry { --=20 2.21.3 From nobody Sat May 18 08:35:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588585878; cv=none; d=zohomail.com; s=zohoarc; b=aGJGj4gJLx+afIfZ+gOP8MzUI6Xa4j88GDCOf9qNejMBzQ365IlddXkljn042ahHmcnkkmJ2tST6ue+Pglk+fwwltmYiJvGky9p/1uRGC+nMPRWwQMHNKUUM4yExMSiJEffzS8F8O6oO34qjV4pE8y4KjTI66P4RVZO9bBbAano= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588585878; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/BjE+qPatMIH8JRaVlHLK+nrshlFKwJmEw5HEwgChSI=; b=JGLOw8R9SFqMcpSUqwv2GgtIOtc5W17RtqG8tzbTgfgaG1xDlrC0QPpwtf/QXrKz2yjGBjINfvo2pBaNGSfN8UccRsCCLuIXpXhFef2ESoj4efsUolI/lUU4lEmYTp1J6m5uwEw6sKFQhChdhN0bySxNFWod3IZBnyS2xUNjGcI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588585878470750.9872669169389; Mon, 4 May 2020 02:51:18 -0700 (PDT) Received: from localhost ([::1]:48044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXkr-0002bw-6V for importer@patchew.org; Mon, 04 May 2020 05:51:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXgv-0005I0-1V for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:13 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40619 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVXgu-0004I0-6B for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:12 -0400 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-102-2qJW49hpNzahHZASnQJy5g-1; Mon, 04 May 2020 05:47:08 -0400 Received: by mail-wm1-f72.google.com with SMTP id j5so4579299wmi.4 for ; Mon, 04 May 2020 02:47:08 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id r20sm12184725wmh.26.2020.05.04.02.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588585631; 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=/BjE+qPatMIH8JRaVlHLK+nrshlFKwJmEw5HEwgChSI=; b=TxnpYM5h8PkaBF6Q2aNL1bRfwsLRi/gKOakM16p/49ivchG4mKxR8/Je/Fx0o5pzsFQEtp 298nEHaz8piTWZbHoq8Wa4tm/wVSXkCLuL/LTeR8Qq62MLhnX+UQMDzUsaRqULPleYNK4h lOlpisbotH68NCPDHrjlE6oN6ZwEX4E= X-MC-Unique: 2qJW49hpNzahHZASnQJy5g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+xH2/obfEES+FKWIXC5ZKjL0sJeWRGwNhoW0/uWIJ1w=; b=gibpyiOJjOn7f+RobOPa0JWqu0R/3KTK6isaWL4M7xSZipaTbWEBhbMJoNeGdQ8vXp aJHf7KvM0xESGmI+MDJl7/LhOneNZrdEkEJkC4/3nh1KPZNqv0vYRc/PgymEd6DLh33F DerNsT+0DklQjVk4z6dolv0KtQLP57p8NnLkWNpeQfyGlFbjRpv5VWnuBO4UKjPmhgGg 3PdIBJLExgybiREyGHMpftXJR2A/90gd9eIB74CkdhDTPMnO4t3UJ+Uu77UYf7THkgpO UU/9IlGxscSYfEmkek7imqetgHgZw0m4Y00BLIluGqeAcQDMQ5RKg2Hi9cxZq3LOOjrz y1zQ== X-Gm-Message-State: AGi0Pua+qWzuO6Q8W7bmEf5moM7EFZeMDBw144//eKZ/bi/WcMUpSHhJ rSZz+fSdWCP4hfFIFR6cl/KRgUCQ18At1FTeSHBVYkaDVZYOYqf+JWi+lBV2MAZKH/5BakXQITO 4L5ACtAw8js6uUhA= X-Received: by 2002:a1c:e187:: with SMTP id y129mr14733609wmg.133.1588585627097; Mon, 04 May 2020 02:47:07 -0700 (PDT) X-Google-Smtp-Source: APiQypKduCzSN8JET1vXC5kL0rPakq69kLfHpWqFMvifkhX1yvkqSymuByrgkGqnBdcDs4YhcdavnQ== X-Received: by 2002:a1c:e187:: with SMTP id y129mr14733587wmg.133.1588585626925; Mon, 04 May 2020 02:47:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 5/6] block/nvme: Align block pages queue to host page size Date: Mon, 4 May 2020 11:46:40 +0200 Message-Id: <20200504094641.4963-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504094641.4963-1-philmd@redhat.com> References: <20200504094641.4963-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:21:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Laurent Vivier , Maxim Levitsky , Keith Busch , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Stefan Hajnoczi , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" In nvme_create_queue_pair() we create a page list using qemu_blockalign(), then map it with qemu_vfio_dma_map(): q->prp_list_pages =3D qemu_blockalign0(bs, s->page_size * NVME_QUEUE_SIZE= ); r =3D qemu_vfio_dma_map(s->vfio, q->prp_list_pages, s->page_size * NVME_QUEUE_SIZE, ...); With: s->page_size =3D MAX(4096, 1 << (12 + ((cap >> 48) & 0xF))); The qemu_vfio_dma_map() documentation says "The caller need to make sure the area is aligned to page size". While we use multiple s->page_size as alignment, it might be not sufficient on some hosts. Use the qemu_real_host_page_size value to be sure the host alignment is respected. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Gibson --- Cc: C=C3=A9dric Le Goater Cc: David Gibson Cc: Laurent Vivier --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 7b7c0cc5d6..bde0d28b39 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -627,7 +627,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, =20 s->page_size =3D MAX(4096, 1 << (12 + ((cap >> 48) & 0xF))); s->doorbell_scale =3D (4 << (((cap >> 32) & 0xF))) / sizeof(uint32_t); - bs->bl.opt_mem_alignment =3D s->page_size; + bs->bl.opt_mem_alignment =3D MAX(qemu_real_host_page_size, s->page_siz= e); timeout_ms =3D MIN(500 * ((cap >> 24) & 0xFF), 30000); =20 /* Reset device to get a clean state. */ --=20 2.21.3 From nobody Sat May 18 08:35:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588585990; cv=none; d=zohomail.com; s=zohoarc; b=eNe37OCpIIjL2W4L1TNYN6RyFaxUMGpkEnk/QzzspWIm8uJNMESDNDYC46rSRURR+hPuPs7RhoYBIbjN9q2Sm/EDwKDf+u1CSj6p8DKIsOu/AYbb1kos9Wv5yZ0dFvFVp6rHaZSkxCffAQM2CJxHej67ygph1Lyks+X/xemHMUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588585990; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TjRnLX9M7bUl75vfzRMtWTmWeSyX9kHOv2IRdhv8Iws=; b=n9p+RI3C4lOD2A1fJ4y81PTfMZf32j9RvsnFmVkS55Vv5IeG0dNoWozSYyY9wAip8dm+m5AIBp8jb/emFJPunZI38IMC+n6ii6fLw3QirRCsxS9A57l2RsBr/1x9g4QNFnnD18ezzzUL9etTTqMQg0nCBf/p82Bh/ICr6INdsEE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588585990170440.16614433845587; Mon, 4 May 2020 02:53:10 -0700 (PDT) Received: from localhost ([::1]:56764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXme-00068U-Po for importer@patchew.org; Mon, 04 May 2020 05:53:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXgy-0005Ql-Ke for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:16 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54043 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVXgx-0004QJ-PS for qemu-devel@nongnu.org; Mon, 04 May 2020 05:47:16 -0400 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-505-gJSRrdtFNXCWb5EESIl58g-1; Mon, 04 May 2020 05:47:13 -0400 Received: by mail-wm1-f72.google.com with SMTP id f128so4584505wmf.8 for ; Mon, 04 May 2020 02:47:13 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id t16sm18099065wrm.26.2020.05.04.02.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588585635; 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=TjRnLX9M7bUl75vfzRMtWTmWeSyX9kHOv2IRdhv8Iws=; b=QjxGzc3SXeVLTtFSs8Zki5vKFJoGA/ZmeJxWAOUIn6OTaxQ3F8vzpMA2OeWyYiBpsNMzeZ srJOvZVl5Au+D3/BreSnwWPGYg+FmrXuNLsqGvw2dPyuQ4NR94/FDulWkzhMgvY3PlgyeJ tSN6h66ZRuUaO2xq9cVuUUuM1xZk3Zk= X-MC-Unique: gJSRrdtFNXCWb5EESIl58g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/2PMb8bKNoIe3zdK975EoqjSZA5Q1oobp2Wmj1tp7JI=; b=ZC+QRtuR9HqN2W7bHv9aBEpZedTwhZm2cFFi2LVSDcuDd45kM7dLXdK2Kn2o5UbBsI biYj/8MjXv8nlgy3d+zKS+9qPuNAjVth849Xfl5BB1RlDh4UUSc6LDn7gp9xPSLiO1pE jcJfCLChCey1AfS9n439lleXQk0QW3TuZe4ymzv2EjZL5/OgK/8jP/Ryv44Y4AgWz74W WmuVHd+JCY4f1QY7MNcFrl8egeZMh+ueaEQVnVcRVvTdHz64RTYRIEUgxrPuxMSv6d0C hU29+jX2BVh0kefKEbyE4wu39vnHlhQngZAHF9SFn4RJy5bU4n/watsZD/Vp14nHrXHx ujHg== X-Gm-Message-State: AGi0Pua8XAlQzFfwWSa7hEQPysDGAyEGQI/c5fyJ1Kv74tomQAt+XYBy 2Q3GpwCnR9knJbfJhBgOtB/wzxqDdOmisxeAcNjnHvotjHve0U1LITiBCRJoC0N49V4VKMEPLOn bDiFn6r4yHH9afxg= X-Received: by 2002:a5d:6851:: with SMTP id o17mr17705309wrw.267.1588585632041; Mon, 04 May 2020 02:47:12 -0700 (PDT) X-Google-Smtp-Source: APiQypI+2oU2RG7lr6h2JSNsnUiHUj64/fYdRmk23Z5JZlApNNlOXer7RKtCYAwL9x6Ruy1ebZS7QQ== X-Received: by 2002:a5d:6851:: with SMTP id o17mr17705294wrw.267.1588585631878; Mon, 04 May 2020 02:47:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 6/6] hw/block/nvme: Make device target agnostic Date: Mon, 4 May 2020 11:46:41 +0200 Message-Id: <20200504094641.4963-7-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504094641.4963-1-philmd@redhat.com> References: <20200504094641.4963-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:14:00 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, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Fam Zheng , Beata Michalska , qemu-block@nongnu.org, Maxim Levitsky , Keith Busch , Stefan Hajnoczi , Paolo Bonzini , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The NVMe device should not use target specific API. Use memory_region_do_writeback() (which was introduced in commit 61c490e25e0, after the NVMe emulated device was added) to replace qemu_ram_writeback(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- RFC because I have no clue how dirty_log_mask works. Cc: Paolo Bonzini Cc: Beata Michalska --- hw/block/nvme.c | 4 +--- hw/block/Makefile.objs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 9b453423cf..9b0ac0ea2a 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -46,7 +46,6 @@ #include "qapi/visitor.h" #include "sysemu/hostmem.h" #include "sysemu/block-backend.h" -#include "exec/ram_addr.h" =20 #include "qemu/log.h" #include "qemu/module.h" @@ -1207,8 +1206,7 @@ static uint64_t nvme_mmio_read(void *opaque, hwaddr a= ddr, unsigned size) */ if (addr =3D=3D 0xE08 && (NVME_PMRCAP_PMRWBM(n->bar.pmrcap) & 0x02)) { - qemu_ram_writeback(n->pmrdev->mr.ram_block, - 0, n->pmrdev->size); + memory_region_do_writeback(&n->pmrdev->mr, 0, n->pmrdev->size); } memcpy(&val, ptr + addr, size); } else { diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs index 47960b5f0d..8855c22656 100644 --- a/hw/block/Makefile.objs +++ b/hw/block/Makefile.objs @@ -13,6 +13,6 @@ common-obj-$(CONFIG_SH4) +=3D tc58128.o =20 obj-$(CONFIG_VIRTIO_BLK) +=3D virtio-blk.o obj-$(CONFIG_VHOST_USER_BLK) +=3D vhost-user-blk.o -obj-$(CONFIG_NVME_PCI) +=3D nvme.o +common-obj-$(CONFIG_NVME_PCI) +=3D nvme.o =20 obj-y +=3D dataplane/ --=20 2.21.3