From patchwork Wed Feb 14 11:13:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 772661 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp243316wre; Wed, 14 Feb 2024 03:14:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVL4mCzCS+BoimRhiHcOgejZHVBfaE9WjVJ55GbhNsqqxD4w/Cu7H/DCYQJlF47vveJ3vqDsOsunnBelpptSvDx X-Google-Smtp-Source: AGHT+IEoKaro5kY0R1JpzB4DornxuoU1rmQvZaHHYja15Et379HsgioIFTtXvU3WXXqCMed+HC3F X-Received: by 2002:a05:622a:7:b0:42b:fac1:840f with SMTP id x7-20020a05622a000700b0042bfac1840fmr2433590qtw.34.1707909259578; Wed, 14 Feb 2024 03:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707909259; cv=none; d=google.com; s=arc-20160816; b=DxusCMW7bAvcSqhLMR4Aq50cnsxDJewo5zkBzOe0Z0fcxVpR8pS188U8fDsb7qkmgS CJoa2YUaMrZNa0BeUAmrBlCCJSG6QV68YuKQvf10cIZGA9E+s8wY1IKmy5eovqxEHNj6 yIOHsg59gmTbhwEFFzegFXSnCqop0rYehxTn3OzL9K3hgpNKlYR4vmrqwbzbFpy+11ub 3mHHvbTbT1e+9cOsdYLmOOTkjNIq83Caci6ilv4k3BOyV98IZrfZasS183kA+79+kKRJ 57DNbfNIBlvoXy4RAiNOPyFYowDsLOc1Vf//WXZ6gDn8lYuguSU7OsCEUU2Uzmz07B/Q elYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aMCWbZMbJsUeDBMcr0PznqZivp4BA1aEeZXrL0J0rpk=; fh=JHcpJQl8ogqO+P8QDjLDvlHvsaO/uuJFa5IkOKyVtQM=; b=GCZBqjNUvwOQmVylsNUpPB0rzhfrS4vKnjorDVLlVuUqzRINrWlJhoc4bHTYJoqBjZ fjt8x8Q3U0ITBRJRTHKCZ1RuDlmxtlPM900ZlSp5uqL1tKsoLux6wsoGJAtikDPBSGxQ StVZU6LuoDdcDyhVau/euCXaiXEE2177wp2m2Ix3y/MSQoevaGZxgzIITNaqVeM6J6A8 14GY1rJfgd8xIG0sq0L2/2Sm1DUMSTxShuuWc1n735kUx853YRAhEtXU1qEVzPSbblGC w4VkUiYn5B/bO0xNkxSBZRjPzqu3HW8a8ta4jq39lSstVVocgcb0/xpFVLuqlGNeDNi/ fplg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fBDegLE/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCU9oE7Wd2Q2Sbuz8SQFeFWrFc+u5qeJjpjDgVrdmuJOnKLxmLUzZTNU5cVmuuakkES/TmEZ/eo1mWoTBV+Rm1KS Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h15-20020a05620a13ef00b00785d7692a94si6724263qkl.323.2024.02.14.03.14.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2024 03:14:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fBDegLE/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raDDB-0008TL-EN; Wed, 14 Feb 2024 06:13:57 -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 1raDD2-0008Ku-Cw for qemu-devel@nongnu.org; Wed, 14 Feb 2024 06:13:50 -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 1raDCz-0006jJ-Mg for qemu-devel@nongnu.org; Wed, 14 Feb 2024 06:13:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707909225; 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=aMCWbZMbJsUeDBMcr0PznqZivp4BA1aEeZXrL0J0rpk=; b=fBDegLE/eGV3aZ0V0cur1zXSP5/yQmDzQ90OAI7Z8J11UrtQwRfvgNsC27IKSjm/bG2owI bhxH0cHhE6Fg4B+kE9z2WEV+k87G8wT+Hn49xL6KfkxQcFVE6PX34YKnheieFl4mnNXlKM jXoZXYJ1qd1oNpsEIPdPX8z+XShbj30= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-t9W0Ej0UNEq64xZ6IZ859g-1; Wed, 14 Feb 2024 06:13:43 -0500 X-MC-Unique: t9W0Ej0UNEq64xZ6IZ859g-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-51151b8de86so5087003e87.1 for ; Wed, 14 Feb 2024 03:13:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707909220; x=1708514020; h=in-reply-to:content-transfer-encoding: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=aMCWbZMbJsUeDBMcr0PznqZivp4BA1aEeZXrL0J0rpk=; b=AePr8Z2BdROTfXxjen227ItDp/xskZZUdbzPVmJih4kID9gY7McbaSeockjPwuEKB1 qlMNXjBu/3JQvsarWHPPKb4AzWZuRV7zMFQy0FEfiUgzaZQHa16Fmb/VCGr9fGYYf7j+ n+3O+lfE/Y7P92ubAqLOt2w9c9PRcXj0MnkHVTB4O78leXbC8tN/iWgG4WefMGSv90Y4 1EwogK/2pdavgFv7dJc2rvUaTuCIuwRkjIEFiPk4VnL0jYdwMd+T2FWnXhGP86B3mU0U xeM0JCKSsrQ7Uhz84isyXEXXeYC7L8f4Bxg1ksmO9jbbAw0FFbSQo+yyvrjC73ThAHp/ JP0A== X-Gm-Message-State: AOJu0YwLKo457HPbLNWncad4Hh2/EqJLfVglWcO81ukYqp0EuPlfXEtQ xnGBVfy6oXH52yJ+DXUTGsXulUfTmXp+k3PG6psXnPLgcPr35uUPGbZFp3+JgvFyOyDJUtZGymL hdWsa1RSkmGLISDvDy/cZIGkAIH5hRswS1wV5GJ4dodU8s8foDe9Hx1J5kXLWn7pcMu3JTEjGfd 2+/Al8RzjqJRNVSUVF6pC8/i8+TBuB0g== X-Received: by 2002:ac2:4c81:0:b0:511:8d37:4b60 with SMTP id d1-20020ac24c81000000b005118d374b60mr1591085lfl.6.1707909220703; Wed, 14 Feb 2024 03:13:40 -0800 (PST) X-Received: by 2002:ac2:4c81:0:b0:511:8d37:4b60 with SMTP id d1-20020ac24c81000000b005118d374b60mr1591071lfl.6.1707909220438; Wed, 14 Feb 2024 03:13:40 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV5gMbGpldpCBiTkSEZMuJhDuOPsH0HWn0WWLfmTrIDv7zIfo6NQA9MCwvbYvGB7JneBEcVMYqvQSDz6GExaTDtotnNWDuCN1T0s4vAylyzt26YLyIUngJJyDKlNkN9ukEV8W7DvgQ+9gUj7w2nfngTEaksIRdxxQ== Received: from redhat.com ([2.52.26.67]) by smtp.gmail.com with ESMTPSA id y21-20020a170906559500b00a34d0a865ecsm2169280ejp.163.2024.02.14.03.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:13:39 -0800 (PST) Date: Wed, 14 Feb 2024 06:13:37 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Leo Yan , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 08/60] hw/virtio: Support set_config() callback in vhost-user-base Message-ID: 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.504, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Leo Yan The Virtio input device invokes set_config() callback for retrieving the event configuration info, but the callback is not supported in vhost-user-base. This patch adds support set_config() callback in vhost-user-base. Signed-off-by: Leo Yan Reviewed-by: Marc-André Lureau Message-Id: <20231120043721.50555-2-leo.yan@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240104210945.1223134-9-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user-base.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index 78cfa9a5bb..a83167191e 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -140,6 +140,22 @@ static void vub_get_config(VirtIODevice *vdev, uint8_t *config) } } +static void vub_set_config(VirtIODevice *vdev, const uint8_t *config_data) +{ + VHostUserBase *vub = VHOST_USER_BASE(vdev); + int ret; + + g_assert(vub->config_size && vub->vhost_user.supports_config == true); + + ret = vhost_dev_set_config(&vub->vhost_dev, config_data, + 0, vub->config_size, + VHOST_SET_CONFIG_TYPE_FRONTEND); + if (ret) { + error_report("vhost guest set device config space failed: %d", ret); + return; + } +} + /* * When the daemon signals an update to the config we just need to * signal the guest as we re-read the config on demand above. @@ -337,6 +353,7 @@ static void vub_class_init(ObjectClass *klass, void *data) vdc->unrealize = vub_device_unrealize; vdc->get_features = vub_get_features; vdc->get_config = vub_get_config; + vdc->set_config = vub_set_config; vdc->set_status = vub_set_status; }