From patchwork Mon Nov 13 01:16:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 743443 Delivered-To: patch@linaro.org Received: by 2002:a5d:67cf:0:b0:32d:baff:b0ca with SMTP id n15csp1403879wrw; Sun, 12 Nov 2023 17:18:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5EdUyWM9IAhUXqm2fREjVDVZHkq6tSnyxSxzoIuTiwgV2HoJSob7PvjkTvkw9gXVvRVAZ X-Received: by 2002:a05:6102:1481:b0:45d:9cb0:28fc with SMTP id d1-20020a056102148100b0045d9cb028fcmr6662890vsv.9.1699838291224; Sun, 12 Nov 2023 17:18:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699838291; cv=none; d=google.com; s=arc-20160816; b=vWXNR1LPjgnMZstvoaA03CbIAzPz4tOw/QgEu5nXfykkmzR/N0ex4fByM30jUdjW9/ C3UbeeNJOeHl8Mc1YmDpeF2IEz+txU6fmbkIjT0xFJ/yOvagzpMJhsnLfMRLW3T97TtY 8NOgXTXUmPIXzC1lW1R8L4rQIUkA9pNLuOC1g8oCYyGDgMMqmLqdlRpPIaf6jGSif6oG fFBVARWabKFZMTC5jxmhkSkeZ+xpfqtJMf8oB9UUjJtlQSxRTVONYBVkv1GOdcnAYzWT dTn3nCLE2xgDGVGsgEM2LLXEW+F1qLioCYrcjwI+K5g2Fnm3grGzwZ+iPkXqlc4cmXUk 2AtQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T9oQMwnfds7gwheh540NHUto9x6gbHU1X9JBynkAdpY=; fh=wuGuGNzRUBT5nBQhy+zJrmr0MipRLMv40xtKcfwYGIM=; b=dlHy+DhGjJ22iqGMOidm0030VhxtfJDGtypMm6lggEeBYLi8X7Zo1zmnGTcU3DSXQr fHIdh2PfmpqKNnrQiJwv351mnXKEwb08VYCSw9O+I6bV7sLPuwQk7BJAIH2xve14FHWY 2tY64nN4tpbpKkX74UyL17iFndnoNURlgQEcLF2Tf3M85rA/Ox9SYeXHlOKWiYFsmR3G Vol4UJdeocZUZLQo2OjccvEg+Qk1F2atz+bLqrqMQ0f5g0Z8gRRGv0gGUFVsxkQwkT3r o8ZlberczMOYHseuXrFmXVvHgY25Xgra1olnBLlJjsBn2/y4YYGVoyCwmhYO2OZwG67Y BOVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ev7Aoz0R; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id de37-20020a05620a372500b0077583599c4esi3647395qkb.239.2023.11.12.17.18.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Nov 2023 17:18:11 -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=@linaro.org header.s=google header.b=ev7Aoz0R; 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=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2LZt-0000Wh-7X; Sun, 12 Nov 2023 20:17:25 -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 1r2LZs-0000WY-35 for qemu-devel@nongnu.org; Sun, 12 Nov 2023 20:17:24 -0500 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2LZq-0003oA-Gk for qemu-devel@nongnu.org; Sun, 12 Nov 2023 20:17:23 -0500 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-35961c61ffaso14541415ab.3 for ; Sun, 12 Nov 2023 17:17:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699838241; x=1700443041; 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=T9oQMwnfds7gwheh540NHUto9x6gbHU1X9JBynkAdpY=; b=ev7Aoz0RQQXg4pPjoOFp2SwBvsQxtqYpYRSnGfXD+GiusY4A41crdiqodOZCI/biCh 4ya+743tVbSlPZYRz3oShYY3odmWeOaenhWJyrjfq0SfiQh/A4UAyvtvvKsw8csb79in +a4agFyPaRmAT3Ss34kclFTPwK6HzV9cD3grjKoDRc03ZF2oIC1AEWZWJnAaBFa7eT1J KQlXJYYnZmwXHj9eYbkkYBYB2rVfIFOTKoLu/jHe1SsAQIBaqNUHeVEqc/yJ2jRRWYCT +JblokgVih09wfKy1KvU/ZyR1dlr6AJ2cw9d/O6a7uvJEShs0joYVfX751+fszSKyfDi V2UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699838241; x=1700443041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T9oQMwnfds7gwheh540NHUto9x6gbHU1X9JBynkAdpY=; b=JZARux/8IIh0UPer9tiLR0pTjve6pWlwK3E3gi1WbJE6U9EsU3nrUWBLev6H9Nuw1W 7KkBK4vA8dhmIcMTSvOMfi7FcuK/95t0WcOE3/Zh+uk+X696KL3FNI1koN0p0c8T0p2J OjWUkDi9UVhRDAMSnLehD6+/MEqqRQLpUFluZ0e/CAuL6KPGXKFqqYUjhmvAQ4c1cNYT Y8MZkfDEKEgHZ0Cvl5nE1glAJfpOmdFn6gV7MFZEoRIu9hYZgelnSGL5UPbEEcbwJtaq 5hmiQM9HFVlqfpzmbDTn43lIWDSeZLgbIBnoOINgS7iCUszwBBd/hplVq9CHcqyUz3yA 1Jcw== X-Gm-Message-State: AOJu0Ywclfs3jrW9cvK+RiBDEfccK6kwEGn/hsyaXRzhfyauqsDgecNg 49N+LhRFXdQVLsfqNOJgNzaq+8OJIXX85tPOy2qFQBS33iw= X-Received: by 2002:a05:6e02:1a65:b0:359:d425:618c with SMTP id w5-20020a056e021a6500b00359d425618cmr7979912ilv.19.1699838241202; Sun, 12 Nov 2023 17:17:21 -0800 (PST) Received: from localhost.localdomain ([128.1.74.235]) by smtp.gmail.com with ESMTPSA id r6-20020aa78b86000000b0064f76992905sm2918511pfd.202.2023.11.12.17.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Nov 2023 17:17:20 -0800 (PST) From: Leo Yan To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S . Tsirkin" , Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Manos Pitsidianakis , Leo Yan Subject: [PATCH v1 1/4] hw/virtio: Support set_config() callback in vhost-user-base Date: Mon, 13 Nov 2023 09:16:39 +0800 Message-Id: <20231113011642.48176-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113011642.48176-1-leo.yan@linaro.org> References: <20231113011642.48176-1-leo.yan@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12a; envelope-from=leo.yan@linaro.org; helo=mail-il1-x12a.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 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 --- 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; }