From nobody Sat Feb 7 08:28:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511981738846912.5354398144253; Wed, 29 Nov 2017 10:55:38 -0800 (PST) Received: from localhost ([::1]:44726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK7W9-0004cx-3L for importer@patchew.org; Wed, 29 Nov 2017 13:55:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK7Rk-0001BW-Or for qemu-devel@nongnu.org; Wed, 29 Nov 2017 13:51:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eK7Rh-0001X8-O0 for qemu-devel@nongnu.org; Wed, 29 Nov 2017 13:51:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39416) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eK7Rh-0001Wj-HX for qemu-devel@nongnu.org; Wed, 29 Nov 2017 13:50:57 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9AB99C01B3F9 for ; Wed, 29 Nov 2017 18:50:56 +0000 (UTC) Received: from dgilbert-t530.redhat.com (unknown [10.36.118.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DB2860600; Wed, 29 Nov 2017 18:50:48 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, imammedo@redhat.com Date: Wed, 29 Nov 2017 18:50:25 +0000 Message-Id: <20171129185026.23632-7-dgilbert@redhat.com> In-Reply-To: <20171129185026.23632-1-dgilbert@redhat.com> References: <20171129185026.23632-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 29 Nov 2017 18:50:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 6/7] vhost: Copy updated region data into device state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maxime.coquelin@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Copy the temporary region data we calculated into the device state. Signed-off-by: Dr. David Alan Gilbert --- hw/virtio/vhost.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index ae3d57df1d..34011f9acb 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -787,7 +787,21 @@ static int vhost_update_mem(struct vhost_dev *dev) trace_vhost_update_mem_comparison(need_update, (uint64_t)change_start, (uint64_t)change_end); - /* TODO */ + if (need_update) { + /* Update the main regions list from our tmp */ + size_t mem_size =3D offsetof(struct vhost_memory, regions) + + (vtmp.nregions + 1) * sizeof dev->mem->regions[0]; + + dev->mem =3D g_realloc(dev->mem, mem_size); + dev->mem->nregions =3D vtmp.nregions; + memcpy(dev->mem->regions, vtmp.regions, + vtmp.nregions * sizeof dev->mem->regions[0]); + used_memslots =3D vtmp.nregions; + + dev->mem_changed_start_addr =3D change_start; + dev->mem_changed_end_addr =3D change_end; + } + out: g_free(vtmp.regions); return res; --=20 2.14.3