From nobody Sat Nov 23 23:00:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730754561; cv=none; d=zohomail.com; s=zohoarc; b=f1GbGBaei3tzpvI69BCATthMeYE3xjpnO3w5wr44VFgl2fDf3CLtVfJ/h970fdd7u0cP+33RfRNYX4saRXpdH/3kVW/yXD7jPhr2A1P191viaxBbbpDsqPMmHROIHDu3CM8eidr5LIlaW2mPqCctB+/hU3fVAFFbdzmAf0uJsV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730754561; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Slo8inP3wfhQ8BQeJ7PzLcu289R4kk15rIf298sgC9c=; b=E7X2suE8CUsNHbzrTknDtaOmoYKnEqSOHzVRwWz7u5/8KUucLt0BFXOVquWMlj4cVMY5eqUQUjA665IuH7XnyV5W63AYzoS2oiHQHU/2YSa9XIKCjWVH7Rs1LtPrCJwChd/jkVxmVlBOUxE+7zTJYmDEVfzEqvAxwm/wcGKVv38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730754561562301.8113117390682; Mon, 4 Nov 2024 13:09:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t84I8-00073r-Hr; Mon, 04 Nov 2024 16:07:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t84Hy-0006hg-88 for qemu-devel@nongnu.org; Mon, 04 Nov 2024 16:07:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t84Hv-0005MV-UW for qemu-devel@nongnu.org; Mon, 04 Nov 2024 16:07:06 -0500 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-490-_VuhjJMEMZqvJSPfUNnqEQ-1; Mon, 04 Nov 2024 16:07:02 -0500 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-37d5a3afa84so2327174f8f.3 for ; Mon, 04 Nov 2024 13:07:02 -0800 (PST) Received: from redhat.com ([2.52.14.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1167f20sm14109508f8f.90.2024.11.04.13.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730754423; 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: in-reply-to:in-reply-to:references:references; bh=Slo8inP3wfhQ8BQeJ7PzLcu289R4kk15rIf298sgC9c=; b=PlBrkgp8u/kP15xQP3nI4y8Dsnl7DPmqz90KH6bti/JzZdcim18UXINk6kDyyMEiydUlqH ZxirTl69nmbG86RAh07Jdcseb+Se1zbs/UI3cymoh1JiWLvqGKn9L8GA6LE9oamaQDIOrO Z1RfUcRij3rnsizbgs0533OP2RXS8Lk= X-MC-Unique: _VuhjJMEMZqvJSPfUNnqEQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754421; x=1731359221; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Slo8inP3wfhQ8BQeJ7PzLcu289R4kk15rIf298sgC9c=; b=Rl9mhcYVVY+rpGM32xwOrSEoqXFSadt/iLrStSlQdakif4tYPI+9XrtUVGs9gs0vJS MJScP4EimfZHckyTgi5mwSsspRumMCb84Wdvf+zATvrt7idhd9EVymKJAArGrOqb+ilO fH4TjnIM0ynGuH0bkiINyqxAGzJuUBr2K2NCJ9/ezNvcN/5XsFIy6toW0iG3SfxU06ey 5L5/wcSVASfNy/UapakuCQsrFHozPCFH6i/93z4np8AOy3xAwc/M9UuxqS74vuskPqGQ /z8FOBwJJq0tKHOrNDt8V3ln9H2wBayY2Jvo5U2vlzf0VuM9N/ZSqscUWZjuDj29pmYD WXjA== X-Gm-Message-State: AOJu0YyYblLELsoQ4v/HlUoqmi3Z1zdK7Y3Z8wVEk2iUmcexdy/a9B+M TEMbsH6jLU65jRD/9AOLQ4iEZgmzGrru1grUBLGFZCh57BkwUkqGgib6foq3WsfsxF/ZTgy1S/6 avBk9Jx2nOuIIbktmuNwYiluQvxppQIw6eSzmUPQV9uNNwkJ1lvV8K5tFz7LoP5xTTyZMHqSpAW pVrx6tyf6/jfRxJftF/luNKMy2gjD0Jg== X-Received: by 2002:a5d:584b:0:b0:37d:4a2d:6948 with SMTP id ffacd0b85a97d-381c7a5f380mr10897305f8f.33.1730754420705; Mon, 04 Nov 2024 13:07:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFc02Gp0IfB70ewwAjdeWFTiRunun32RxFC9DdX3HW1N8jOmhnYvR7tfcMzjXL5ahqZKw2S7A== X-Received: by 2002:a5d:584b:0:b0:37d:4a2d:6948 with SMTP id ffacd0b85a97d-381c7a5f380mr10897288f8f.33.1730754420212; Mon, 04 Nov 2024 13:07:00 -0800 (PST) Date: Mon, 4 Nov 2024 16:06:56 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Vladimir Sementsov-Ogievskiy , Raphael Norwitz , Stefano Garzarella , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org Subject: [PULL 22/65] vhost-user-blk: split vhost_user_blk_sync_config() Message-ID: <4dfa12731439c4a3cbfd9d1767acddfbf79549fd.1730754238.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.34, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1730754563773116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Split vhost_user_blk_sync_config() out from vhost_user_blk_handle_config_change(), to be reused in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Raphael Norwitz Message-Id: <20240920094936.450987-3-vsementsov@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella --- hw/block/vhost-user-blk.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 5b7f46bbb0..48b3dabb8d 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -90,27 +90,39 @@ static void vhost_user_blk_set_config(VirtIODevice *vde= v, const uint8_t *config) s->blkcfg.wce =3D blkcfg->wce; } =20 +static int vhost_user_blk_sync_config(DeviceState *dev, Error **errp) +{ + int ret; + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserBlk *s =3D VHOST_USER_BLK(vdev); + + ret =3D vhost_dev_get_config(&s->dev, (uint8_t *)&s->blkcfg, + vdev->config_len, errp); + if (ret < 0) { + return ret; + } + + memcpy(vdev->config, &s->blkcfg, vdev->config_len); + virtio_notify_config(vdev); + + return 0; +} + static int vhost_user_blk_handle_config_change(struct vhost_dev *dev) { int ret; - VirtIODevice *vdev =3D dev->vdev; - VHostUserBlk *s =3D VHOST_USER_BLK(dev->vdev); Error *local_err =3D NULL; =20 if (!dev->started) { return 0; } =20 - ret =3D vhost_dev_get_config(dev, (uint8_t *)&s->blkcfg, - vdev->config_len, &local_err); + ret =3D vhost_user_blk_sync_config(DEVICE(dev->vdev), &local_err); if (ret < 0) { error_report_err(local_err); return ret; } =20 - memcpy(dev->vdev->config, &s->blkcfg, vdev->config_len); - virtio_notify_config(dev->vdev); - return 0; } =20 --=20 MST