From nobody Sun Jun 7 22:19:00 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1780526864; cv=none; d=zohomail.com; s=zohoarc; b=Zugo8zjrh8NdMViO9t31EUqQC18iJip1k7BFh2KO9RoABQT2uOGh/afxTo9HGgYykDS42/0/t9Y0gqhBAnxsaymbnyfNGvfkNL0AKwAmUJmYJ298BCIWw+HKurZQ+JAuWIpxo7pZjyAICy5fn3F/EJJJfrU/V6KKDc0lw2Q1HO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780526864; h=Content-Transfer-Encoding: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=Y4hH/Thy1WXYsnNwkP96gh2PbXzlmRplzMWu7Xzp3fk=; b=T65IqkqYxNQCUHAkNXqdqqZZZk9KqjYDygz1AFUqzhuX9VQFYFiVJkuB5avgL6tv7CN8yyL/xEN2q70EU2WPk7F9diZ15/rnlreQjzBy3cULUlwXz7i9eafIFgVdNpsSaqCMfMTfx7TfTa0NgMbzXeOPIX3gYBXEea8BdSJiFk8= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17805268641411001.3351904878034; Wed, 3 Jun 2026 15:47:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wUuMX-0002MG-7v; Wed, 03 Jun 2026 18:47:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wUuAt-0000Gk-TT for qemu-devel@nongnu.org; Wed, 03 Jun 2026 18:34:59 -0400 Received: from mail-dl1-x1233.google.com ([2607:f8b0:4864:20::1233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wUuAr-00077O-SK for qemu-devel@nongnu.org; Wed, 03 Jun 2026 18:34:59 -0400 Received: by mail-dl1-x1233.google.com with SMTP id a92af1059eb24-1370417c01cso71308c88.1 for ; Wed, 03 Jun 2026 15:34:57 -0700 (PDT) Received: from MacLin.attlocal.net ([2600:1700:e140:14d0:fad:648b:d3db:b403]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3074df349d8sm3492027eec.22.2026.06.03.15.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 15:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780526096; x=1781130896; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y4hH/Thy1WXYsnNwkP96gh2PbXzlmRplzMWu7Xzp3fk=; b=nN9h7IVXtlWoPx1USav/VPMKDK1lGTTEOj9VSVwCWL6XatXMeQEYCAN5hu/jmwFJfI WgauWzYWEF4wNxKnf8nFKXqTNgUtHvXtYSUSPAgHzvR9GjhzwLtcoSxX5Z5B8jp3lX04 B9ul+6yYjKlCCDt8/AnScjIdaRhFLmp6cjWD/PGN5Xl8Q/d9V9q61uizwj3VVBJUQver 2s0djhUIrm18UBZCb8cHxey/SzGs7MgEWjN4/wR9NWG86nmT9gIBajQmxWuP7l2X3AJx 8LshwI0nsNYCKpQ6WYZagFaWnQhu6UyDNuaj+QAW2FXmoXEGZScs1z/6kARhxyMm3x8f ZpQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780526096; x=1781130896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Y4hH/Thy1WXYsnNwkP96gh2PbXzlmRplzMWu7Xzp3fk=; b=Y9wd8f9HohYRQz5Wk6Z6kthqZQp1rQ2sTGsAVFHgKWuhZHIks0JQ4va9K9ngcZBTRc G30WEzeGAtF1yRG+cXnqJTS16Z/mLC2vCk+OrosTQIDKnOIV08BH6DlIrqtsc6JJX1cR nC/RdzMAMTWzyIlwiWz8Gm7JaWv/4H/GNOVw7KZQZDgQ9AE2qsbjB1A9VOvlSm6AaJ1z fkQ0myXzyTGVZJTzTl5PdmTYZFAbXNx45sh8681gf9qof0lNy8wQRFX0/wUbm0TTl1G2 2NpEYnIoBkYNdw+v97Mj2IvIP8KQ1E4vx1uRr7UuLMOiFRCi6SIbRgyIZJUX7k0cCdZy mNkg== X-Gm-Message-State: AOJu0YyBQevsJUsQ7dYincOQePaWEzWcZpwgbAm7vtMwfigDf+jlyhEZ XKSWUFk/+2GrelTGp8JSp19lMJdA1wfu6yUUSRyiW1P/t99A6jUKeINumqpq3ojv X-Gm-Gg: Acq92OF3uqLokyOtagUzwIGQU+FucEX51LFVi4vuEAYlDOztPxIAMvXzUwWsWgKQXkB kBBjXlY8yDWKrr5iqYAzeX1L72tLLUFimSWDBVkZuAdecjCuSSKVMoaRmgmDEZD1avD7x5gGKGV kjXTAMfAhbXcT+3JDpUgNSeXdEMZjWeBen7DwvQdqKOcRh4AjVfAurXKfRiDEqs+9i/UA4KmCHl p45DYG5V9d17lX7gYQJCCyKokwgJgvtDZ3PzlQNb1eO2EEdWjyHFMyERD9QoQqMewU1VSsw3BFQ rp24vhpGF8tI5H74wexHxF16wHIHmv2YeeJlBK7ErdDkhNLXMSi2rXJ7s13B3xdWqlsIR8kQ2fx GGdZI9lFJ6UK4IDCcfZ2i22MZIf42DPZdBb/EIesTb5m3T8lt2L0APfzG2VmruiDHP/fhWYWjCU WWwHSNcET+05FYeFW8ua43BBwBMno7qcqFb2HM+yLQUIDz6ozbt4ofMi9igT0= X-Received: by 2002:a05:7301:4592:b0:304:d788:ac5 with SMTP id 5a478bee46e88-3074fcb2470mr2864813eec.35.1780526096089; Wed, 03 Jun 2026 15:34:56 -0700 (PDT) From: ConKite To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, hreitz@redhat.com, ConKite Subject: [PATCH 1/2] vhost-user: Consolidate chardev property definitions Date: Wed, 3 Jun 2026 15:33:54 -0700 Message-ID: <20260603223430.3311916-2-connorkite@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260603223430.3311916-1-connorkite@gmail.com> References: <20260603223430.3311916-1-connorkite@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1233; envelope-from=connorkite@gmail.com; helo=mail-dl1-x1233.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 03 Jun 2026 18:47:00 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1780526866770158500 Content-Type: text/plain; charset="utf-8" Move chardev qdev property definitions from children into VHostUserBase. This reduces code duplication and allows children to simply inherit the property during initialization. Signed-off-by: Connor Kite Reviewed-by: Stefan Hajnoczi --- hw/virtio/vhost-user-base.c | 9 +++++++++ hw/virtio/vhost-user-gpio.c | 4 ---- hw/virtio/vhost-user-i2c.c | 5 ----- hw/virtio/vhost-user-input.c | 5 ----- hw/virtio/vhost-user-rng.c | 5 ----- hw/virtio/vhost-user-rtc.c | 4 ---- hw/virtio/vhost-user-snd.c | 1 - hw/virtio/vhost-user-spi.c | 5 ----- hw/virtio/vhost-user-test-device.c | 1 - 9 files changed, 9 insertions(+), 30 deletions(-) diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index 01ab9ca56b..a3d5a9cd99 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -353,9 +353,16 @@ static void vub_device_unrealize(DeviceState *dev) do_vhost_user_cleanup(vdev, vub); } =20 +/*Define common qdev properties. Inherited by all children*/ +static const Property vub_properties[] =3D { + DEFINE_PROP_CHR("chardev", VHostUserBase, chardev) +}; + + static void vub_class_init(ObjectClass *klass, const void *data) { VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); =20 vdc->realize =3D vub_device_realize; vdc->unrealize =3D vub_device_unrealize; @@ -363,6 +370,8 @@ static void vub_class_init(ObjectClass *klass, const vo= id *data) vdc->get_config =3D vub_get_config; vdc->set_config =3D vub_set_config; vdc->set_status =3D vub_set_status; + + device_class_set_props(dc, vub_properties); } =20 static const TypeInfo vub_types[] =3D { diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c index d473f87077..33b8752282 100644 --- a/hw/virtio/vhost-user-gpio.c +++ b/hw/virtio/vhost-user-gpio.c @@ -14,9 +14,6 @@ #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_gpio.h" =20 -static const Property vgpio_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), -}; =20 static void vgpio_realize(DeviceState *dev, Error **errp) { @@ -42,7 +39,6 @@ static void vu_gpio_class_init(ObjectClass *klass, const = void *data) VHostUserBaseClass *vubc =3D VHOST_USER_BASE_CLASS(klass); =20 dc->vmsd =3D &vu_gpio_vmstate; - device_class_set_props(dc, vgpio_properties); device_class_set_parent_realize(dc, vgpio_realize, &vubc->parent_realize); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c index 152b1f6740..3f5427b5b2 100644 --- a/hw/virtio/vhost-user-i2c.c +++ b/hw/virtio/vhost-user-i2c.c @@ -14,10 +14,6 @@ #include "qemu/error-report.h" #include "standard-headers/linux/virtio_ids.h" =20 -static const Property vi2c_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), -}; - static void vi2c_realize(DeviceState *dev, Error **errp) { VHostUserBase *vub =3D VHOST_USER_BASE(dev); @@ -42,7 +38,6 @@ static void vu_i2c_class_init(ObjectClass *klass, const v= oid *data) VHostUserBaseClass *vubc =3D VHOST_USER_BASE_CLASS(klass); =20 dc->vmsd =3D &vu_i2c_vmstate; - device_class_set_props(dc, vi2c_properties); device_class_set_parent_realize(dc, vi2c_realize, &vubc->parent_realize); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); diff --git a/hw/virtio/vhost-user-input.c b/hw/virtio/vhost-user-input.c index 5cfc5bbb56..8fe6349ffc 100644 --- a/hw/virtio/vhost-user-input.c +++ b/hw/virtio/vhost-user-input.c @@ -7,10 +7,6 @@ #include "qemu/osdep.h" #include "hw/virtio/virtio-input.h" =20 -static const Property vinput_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), -}; - static void vinput_realize(DeviceState *dev, Error **errp) { VHostUserBase *vub =3D VHOST_USER_BASE(dev); @@ -36,7 +32,6 @@ static void vhost_input_class_init(ObjectClass *klass, co= nst void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->vmsd =3D &vmstate_vhost_input; - device_class_set_props(dc, vinput_properties); device_class_set_parent_realize(dc, vinput_realize, &vubc->parent_realize); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c index 106c8f211a..664aee403d 100644 --- a/hw/virtio/vhost-user-rng.c +++ b/hw/virtio/vhost-user-rng.c @@ -20,10 +20,6 @@ static const VMStateDescription vu_rng_vmstate =3D { .unmigratable =3D 1, }; =20 -static const Property vrng_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), -}; - static void vu_rng_base_realize(DeviceState *dev, Error **errp) { VHostUserBase *vub =3D VHOST_USER_BASE(dev); @@ -43,7 +39,6 @@ static void vu_rng_class_init(ObjectClass *klass, const v= oid *data) VHostUserBaseClass *vubc =3D VHOST_USER_BASE_CLASS(klass); =20 dc->vmsd =3D &vu_rng_vmstate; - device_class_set_props(dc, vrng_properties); device_class_set_parent_realize(dc, vu_rng_base_realize, &vubc->parent_realize); =20 diff --git a/hw/virtio/vhost-user-rtc.c b/hw/virtio/vhost-user-rtc.c index 88b0c70b90..6d80cb6263 100644 --- a/hw/virtio/vhost-user-rtc.c +++ b/hw/virtio/vhost-user-rtc.c @@ -19,9 +19,6 @@ static const VMStateDescription vu_rtc_vmstate =3D { .unmigratable =3D 1, }; =20 -static const Property vrtc_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), -}; =20 static void vu_rtc_base_realize(DeviceState *dev, Error **errp) { @@ -42,7 +39,6 @@ static void vu_rtc_class_init(ObjectClass *klass, const v= oid *data) VHostUserBaseClass *vubc =3D VHOST_USER_BASE_CLASS(klass); =20 dc->vmsd =3D &vu_rtc_vmstate; - device_class_set_props(dc, vrtc_properties); device_class_set_parent_realize(dc, vu_rtc_base_realize, &vubc->parent_realize); =20 diff --git a/hw/virtio/vhost-user-snd.c b/hw/virtio/vhost-user-snd.c index 7129b77d9c..3663450aed 100644 --- a/hw/virtio/vhost-user-snd.c +++ b/hw/virtio/vhost-user-snd.c @@ -34,7 +34,6 @@ static const VMStateDescription vu_snd_vmstate =3D { }; =20 static const Property vsnd_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), DEFINE_PROP_BIT64("controls", VHostUserBase, parent_obj.host_features, VIRTIO_SND_F_CTLS, false), }; diff --git a/hw/virtio/vhost-user-spi.c b/hw/virtio/vhost-user-spi.c index 707f96c250..fb6168d391 100644 --- a/hw/virtio/vhost-user-spi.c +++ b/hw/virtio/vhost-user-spi.c @@ -15,10 +15,6 @@ #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_spi.h" =20 -static const Property vspi_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), -}; - static void vspi_realize(DeviceState *dev, Error **errp) { VHostUserBase *vub =3D VHOST_USER_BASE(dev); @@ -44,7 +40,6 @@ static void vu_spi_class_init(ObjectClass *klass, const v= oid *data) VHostUserBaseClass *vubc =3D VHOST_USER_BASE_CLASS(klass); =20 dc->vmsd =3D &vu_spi_vmstate; - device_class_set_props(dc, vspi_properties); device_class_set_parent_realize(dc, vspi_realize, &vubc->parent_realize); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); diff --git a/hw/virtio/vhost-user-test-device.c b/hw/virtio/vhost-user-test= -device.c index a2f963fdf6..91e23bf07a 100644 --- a/hw/virtio/vhost-user-test-device.c +++ b/hw/virtio/vhost-user-test-device.c @@ -30,7 +30,6 @@ static const VMStateDescription vud_vmstate =3D { }; =20 static const Property vud_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), DEFINE_PROP_UINT16("virtio-id", VHostUserBase, virtio_id, 0), DEFINE_PROP_UINT32("vq_size", VHostUserBase, vq_size, 64), DEFINE_PROP_UINT32("num_vqs", VHostUserBase, num_vqs, 1), --=20 2.43.0 From nobody Sun Jun 7 22:19:00 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1780526864; cv=none; d=zohomail.com; s=zohoarc; b=OZ8CS2LnFNMpWgM53omjoHlCWjn5XwGiqLnXW0gBmsSa5/QwLtJggGylrKQjrqZdM2nEQ5DWMJi+u2rhtqkth18viHs+lPQP+tpJIgQDcltk7qI9beHQkYd69wttCFJiRp0rOdLMHRqnendTvZwK052Tn0zIwrCokFktftKqaAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780526864; h=Content-Transfer-Encoding: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=ppZdqHcMgO+vgKbMmRf29BPISaSE+2k5F2+cTFDgyoY=; b=UGgjalA8fkEPyvMikCAdp6HSQ0HmL5DLVZlaQLxuWN+q9uaWaF8SHGS2o/wuG8x56LgHPBfoSwuUvGlbFYbuyomhMo/OIrMfsycx7I1G8FaV4iYHK5v/Fy5yXv/I+1Ivq4uTiKrbTvxjjdFxVuzFVt71z+FEm2JXqFU96Zqee34= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780526864228216.65747940657786; Wed, 3 Jun 2026 15:47:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wUuMY-0002MH-R9; Wed, 03 Jun 2026 18:47:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wUuAy-0000Iy-Dq for qemu-devel@nongnu.org; Wed, 03 Jun 2026 18:35:04 -0400 Received: from mail-dl1-x1236.google.com ([2607:f8b0:4864:20::1236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wUuAw-00078j-Br for qemu-devel@nongnu.org; Wed, 03 Jun 2026 18:35:04 -0400 Received: by mail-dl1-x1236.google.com with SMTP id a92af1059eb24-137eb0d76beso691405c88.0 for ; Wed, 03 Jun 2026 15:35:01 -0700 (PDT) Received: from MacLin.attlocal.net ([2600:1700:e140:14d0:fad:648b:d3db:b403]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3074df349d8sm3492027eec.22.2026.06.03.15.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 15:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780526101; x=1781130901; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ppZdqHcMgO+vgKbMmRf29BPISaSE+2k5F2+cTFDgyoY=; b=KHbneqlTN3VPiyYU6vcGDocXRkgqMnXsBMx6Y+G8zctwUhnJVErcWs/0V44Y3qflI+ C8AC8LZmD5GdZKiZQUs3dMMB5DI0L4YhZnPfCZA6Cl/3yuEO1yQ8adJBOxh3txwV6dwk vCqRYq9zPojAIlKtsZRMyOFVWj4U1MDNpnbqlvRxtDcZXqMMWhBOV7otS+/Pc9CP34Vl nUeZ4mYx5x14b563ophtCPTTnNa1vKRKExmH2nuTf25yOu2HHo4ziWZWxTZxQThXB5pI Xg5L7cE4hRc+61ty0Bols5j1LrDWaQXw7zBpDQT81Zji3pATzqTXUl3v7xK+NscM4Q0W D7Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780526101; x=1781130901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ppZdqHcMgO+vgKbMmRf29BPISaSE+2k5F2+cTFDgyoY=; b=JdEtqXp04WXOQ1ILrmBibd7SlIrnuSv7OhMeDnswTuBFqGX0Ple+AbLvArLAr0e512 tmW2hgvfPkwHzRfH+Wahvob/dEdM94FO0JewqW/32GPc/bg/kZMfOxXf4qAPChjJGWqC BaQlruKXoOYoQ5vAPK/n5E7lxyZC9dhPFYA2DeSc6IDSOmBz3219QLecjtLN+BrrUk9/ 7H0s9ZbEwyE9SglTRVuHLEjUBWHiQfux+9OfwAUJnJnQo23SucZcxY/PpaV28yPIS5vA zBP9KQgXv0oq5BtlEXsVIR8ZUW+SEU23MqThCajuG09YcTR0GZRFDrH0x2hUc+nsWSz9 mXjw== X-Gm-Message-State: AOJu0Yxk+1puN2HqIZyWciuVPWGuObzccETOpOYYio3WI+qrWIT5TPja 8PNSxKLHIJL2X/UYIAgCBWB4lfeM64ALmCQw2O+6VoI75erurtXCV6RJdHHC7tql X-Gm-Gg: Acq92OFyaOGtsINNSIEAqhiNQNtogTytqaACgQs8sVoj70XkFnwewA3lxEQ2feooLD4 SLxaRUXv6WbqGdxFhzd85WnwHn0Gt9GBNx2qi7/PqXrjUFMKTf3/DwpH4KYWfTk8Efww3VNzBL8 5PmVtSejBxCuHuyr82sH65ERcNIy5bjDwFTZLDfIcHCrUEIk+B7qejWANT7pi9whVhNS4nfInMJ I9aItGCbQqJDcTgJ6v5u/eQJ+wRkkHoD5hNVWxeivQ14VGi3twHtwXCHuLhQORb2jFDIz1xk1Om PmRokOJhhWpNN2zoNKn8A1j6wNnYK8igncW5tljigIevxYRZqzdJFRe7cTOQY3rxD1wNULO7MRp YOfqnboqC7hSDhHxaktFqdVSQbvzV7tN+6xqA3iGzMMalNq7JAhYxlTI+DC0BibqZFUoxyB+Mq3 ocvKSY+ac000pWOAD+zMtjY4pyTINRtLcisLsRpAw3MUoSlzLO X-Received: by 2002:a05:7022:ff42:b0:136:4bbe:9523 with SMTP id a92af1059eb24-137fdef3661mr599645c88.8.1780526100669; Wed, 03 Jun 2026 15:35:00 -0700 (PDT) From: ConKite To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, hreitz@redhat.com, ConKite Subject: [PATCH 2/2] vhost-user: Add memory-isolation qdev property Date: Wed, 3 Jun 2026 15:33:55 -0700 Message-ID: <20260603223430.3311916-3-connorkite@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260603223430.3311916-1-connorkite@gmail.com> References: <20260603223430.3311916-1-connorkite@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1236; envelope-from=connorkite@gmail.com; helo=mail-dl1-x1236.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 03 Jun 2026 18:47:00 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1780526867769154100 Content-Type: text/plain; charset="utf-8" In support of future work to add a memory isolation mode to vhost-user devi= ces, a qdev property, "memory-isolation", is added to all vhost-user devices. This= is simply a bool representing whether the mode is active or not. Signed-of-by: Connor Kite Reviewed-by: Stefan Hajnoczi --- hw/block/vhost-user-blk.c | 1 + hw/display/vhost-user-gpu.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/virtio/vhost-user-base.c | 3 ++- hw/virtio/vhost-user-fs.c | 1 + hw/virtio/vhost-user-scmi.c | 1 + hw/virtio/vhost-user-vsock.c | 1 + include/hw/virtio/vhost-user-base.h | 1 + include/hw/virtio/vhost-user-blk.h | 1 + include/hw/virtio/vhost-user-fs.h | 1 + include/hw/virtio/vhost-user-scmi.h | 1 + include/hw/virtio/vhost-user-vsock.h | 1 + include/hw/virtio/virtio-gpu.h | 1 + include/hw/virtio/virtio-scsi.h | 1 + 14 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index c151e83677..80a0572030 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -605,6 +605,7 @@ static const VMStateDescription vmstate_vhost_user_blk = =3D { =20 static const Property vhost_user_blk_properties[] =3D { DEFINE_PROP_CHR("chardev", VHostUserBlk, chardev), + DEFINE_PROP_BOOL("memory-isolation", VHostUserBlk, memory_isolation, f= alse), DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues, VHOST_USER_BLK_AUTO_NUM_QUEUES), DEFINE_PROP_UINT32("queue-size", VHostUserBlk, queue_size, 128), diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 6e5e6540a4..e52d16dd45 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -664,6 +664,7 @@ static struct vhost_dev *vhost_user_gpu_get_vhost(VirtI= ODevice *vdev) =20 static const Property vhost_user_gpu_properties[] =3D { VIRTIO_GPU_BASE_PROPERTIES(VhostUserGPU, parent_obj.conf), + DEFINE_PROP_BOOL("memory-isolation", VhostUserGPU, memory_isolation, f= alse), }; =20 static void diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 3612897d4b..bdf6d3fdde 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -347,6 +347,7 @@ static void vhost_user_scsi_unrealize(DeviceState *dev) =20 static const Property vhost_user_scsi_properties[] =3D { DEFINE_PROP_CHR("chardev", VirtIOSCSICommon, conf.chardev), + DEFINE_PROP_BOOL("memory-isolation", VirtIOSCSICommon, conf.memory_iso= lation, false), DEFINE_PROP_UINT32("boot_tpgt", VirtIOSCSICommon, conf.boot_tpgt, 0), DEFINE_PROP_UINT32("num_queues", VirtIOSCSICommon, conf.num_queues, VIRTIO_SCSI_AUTO_NUM_QUEUES), diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index a3d5a9cd99..dff6d76365 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -355,7 +355,8 @@ static void vub_device_unrealize(DeviceState *dev) =20 /*Define common qdev properties. Inherited by all children*/ static const Property vub_properties[] =3D { - DEFINE_PROP_CHR("chardev", VHostUserBase, chardev) + DEFINE_PROP_CHR("chardev", VHostUserBase, chardev), + DEFINE_PROP_BOOL("memory-isolation", VHostUserBase, memory_isolation, = false) }; =20 =20 diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index ad6fcacf06..f13a8b985c 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -409,6 +409,7 @@ static const VMStateDescription vuf_backend_vmstate =3D= { =20 static const Property vuf_properties[] =3D { DEFINE_PROP_CHR("chardev", VHostUserFS, conf.chardev), + DEFINE_PROP_BOOL("memory-isolation", VHostUserFS, conf.memory_isolatio= n, false), DEFINE_PROP_STRING("tag", VHostUserFS, conf.tag), DEFINE_PROP_UINT16("num-request-queues", VHostUserFS, conf.num_request_queues, 1), diff --git a/hw/virtio/vhost-user-scmi.c b/hw/virtio/vhost-user-scmi.c index f9264c4374..4595261f03 100644 --- a/hw/virtio/vhost-user-scmi.c +++ b/hw/virtio/vhost-user-scmi.c @@ -282,6 +282,7 @@ static const VMStateDescription vu_scmi_vmstate =3D { =20 static const Property vu_scmi_properties[] =3D { DEFINE_PROP_CHR("chardev", VHostUserSCMI, chardev), + DEFINE_PROP_BOOL("memory-isolation", VHostUserSCMI, memory_isolation, = false), }; =20 static void vu_scmi_class_init(ObjectClass *klass, const void *data) diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c index c2cd376e73..89aa789e22 100644 --- a/hw/virtio/vhost-user-vsock.c +++ b/hw/virtio/vhost-user-vsock.c @@ -154,6 +154,7 @@ static void vuv_device_unrealize(DeviceState *dev) =20 static const Property vuv_properties[] =3D { DEFINE_PROP_CHR("chardev", VHostUserVSock, conf.chardev), + DEFINE_PROP_BOOL("memory-isolation", VHostUserVSock, conf.memory_isola= tion, false), }; =20 static void vuv_class_init(ObjectClass *klass, const void *data) diff --git a/include/hw/virtio/vhost-user-base.h b/include/hw/virtio/vhost-= user-base.h index d5d2f081ae..29bc40736c 100644 --- a/include/hw/virtio/vhost-user-base.h +++ b/include/hw/virtio/vhost-user-base.h @@ -25,6 +25,7 @@ struct VHostUserBase { uint32_t num_vqs; uint32_t vq_size; /* can't exceed VIRTIO_QUEUE_MAX */ uint32_t config_size; + bool memory_isolation; /* State tracking */ VhostUserState vhost_user; struct vhost_virtqueue *vhost_vq; diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-u= ser-blk.h index 1e41a2bcdf..42c21ab1c8 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -30,6 +30,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserBlk, VHOST_USER_BLK) struct VHostUserBlk { VirtIODevice parent_obj; CharFrontend chardev; + bool memory_isolation; int32_t bootindex; struct virtio_blk_config blkcfg; uint16_t num_queues; diff --git a/include/hw/virtio/vhost-user-fs.h b/include/hw/virtio/vhost-us= er-fs.h index 5699ea03a1..bf71990b9c 100644 --- a/include/hw/virtio/vhost-user-fs.h +++ b/include/hw/virtio/vhost-user-fs.h @@ -28,6 +28,7 @@ typedef struct { char *tag; uint16_t num_request_queues; uint16_t queue_size; + bool memory_isolation; } VHostUserFSConf; =20 struct VHostUserFS { diff --git a/include/hw/virtio/vhost-user-scmi.h b/include/hw/virtio/vhost-= user-scmi.h index 30ab0d7ab7..d346b42ed8 100644 --- a/include/hw/virtio/vhost-user-scmi.h +++ b/include/hw/virtio/vhost-user-scmi.h @@ -19,6 +19,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserSCMI, VHOST_USER_SCMI= ); struct VHostUserSCMI { VirtIODevice parent; CharFrontend chardev; + bool memory_isolation; struct vhost_virtqueue *vhost_vqs; struct vhost_dev vhost_dev; VhostUserState vhost_user; diff --git a/include/hw/virtio/vhost-user-vsock.h b/include/hw/virtio/vhost= -user-vsock.h index 5db6938b8b..6288b26fa4 100644 --- a/include/hw/virtio/vhost-user-vsock.h +++ b/include/hw/virtio/vhost-user-vsock.h @@ -21,6 +21,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserVSock, VHOST_USER_VSO= CK) =20 typedef struct { CharFrontend chardev; + bool memory_isolation; } VHostUserVSockConf; =20 struct VHostUserVSock { diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index f69fc19462..98af73cd2b 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -276,6 +276,7 @@ struct VhostUserGPU { CharFrontend vhost_chr; QemuDmaBuf *dmabuf[VIRTIO_GPU_MAX_SCANOUTS]; bool backend_blocked; + bool memory_isolation; }; =20 #define MAX_SLOTS 4096 diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index b6028bb5cd..47fdc3785c 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -59,6 +59,7 @@ struct VirtIOSCSIConf { char *vhostfd; char *wwpn; CharFrontend chardev; + bool memory_isolation; uint32_t boot_tpgt; IOThread *iothread; IOThreadVirtQueueMappingList *iothread_vq_mapping_list; --=20 2.43.0