From patchwork Mon Nov 13 19:02:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 743484 Delivered-To: patch@linaro.org Received: by 2002:a5d:67cf:0:b0:32d:baff:b0ca with SMTP id n15csp1793172wrw; Mon, 13 Nov 2023 11:03:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBVXRjF2JgqPMbLPYmLP0+1uqJqnOmbPX90pUZJFYV60OJzosPVLwyn49MtP97/QmQcv/6 X-Received: by 2002:a05:6122:1689:b0:4ac:593b:e9f4 with SMTP id 9-20020a056122168900b004ac593be9f4mr7493591vkl.9.1699902191435; Mon, 13 Nov 2023 11:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699902191; cv=none; d=google.com; s=arc-20160816; b=WM9bW8J1FQrt10xKQ+4SmPwE0MQa/Qsm3kbdHvOrxT0K1AMxiiG3DurmvN1VLP6lj3 h813/XlTTiZy+fuYdyxp52AylSI74v+/i2YGDPeLH2ExyhcUiYH+Zq2AURQgTYhTOPTa Au/aGooVCGWKAfbN0bjqRYoY1IxOkNZ75+NQ/dVBjiI175j55N5qmw2I8NIKYA6gheFW XDfMhdVs459Ri3iW3GQX4IEX8m4HQCEnxiD2FK1TqsR3vwZdmjMAQMVgyqE1rlfOhKtb U2PJ4RNDfnaSLHNlgnpqvi5oLWECKO+5g3AhrljDkSiv95iza+Samer3PHHOnDiV+/mE Q/kA== 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=j5N4gOp3ka1Xsisgn/3FSSHjf2kwoyjMvxSEx5jWFCk=; b=znKXbNxmIlX4jPKKr1bS6KJULZ2L41sc033LqJElxK8dEI+wV4YdCIhB4yZbkYrIN/ 8AXY+P+hZKWSmgbwMrOXCzyl+jJb1iq5j3hxXOf+98sQRoA47eEb1QMAt7eSgZzeq+C6 yrixDTTEPu/YQb9ZVjhojAt4ikEmvo8grr50Shwb/U+bcPGn8VAGWWuKIgrXyq3Mgb/y aJ+n2x7VGazmvpg5Pk2bkzGksuYC8K43PuRtUmdZthDGFoG6cX34YGdP85vaCTmXJgYr awCnghSKP3zPxh8+7xm3gWxa76Zba++ETrMoxyIFj8o7Za4tHKtKJGccnreq1VuoG4cM 9wNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M2ajJyqk; 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 k25-20020a05612212f900b0049d0f89a36asi648793vkp.226.2023.11.13.11.03.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Nov 2023 11:03: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=M2ajJyqk; 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 1r2cCi-0002dL-LV; Mon, 13 Nov 2023 14:02:37 -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 1r2cCf-0002d4-Ut for qemu-devel@nongnu.org; Mon, 13 Nov 2023 14:02:34 -0500 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2cCd-0000Ki-5K for qemu-devel@nongnu.org; Mon, 13 Nov 2023 14:02:32 -0500 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-41b7ec4cceeso27832551cf.1 for ; Mon, 13 Nov 2023 11:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699902150; x=1700506950; 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=M2ajJyqkCwRwWifWXQDJKrticpN6AaK1rVJmE7ZLew2NefgoQr7IjqMMmhSBfp/8+H aCkQaB+x+5jIHF4FjjYFluMN/bxdeOuUuGRkxDagCGekar7RZRuvYrq5DQbF2C86nnkJ +iF7FF6rPmmOXbi6oo+3nD2lcsr1ihsYSRIuqbIugPh+WnTRe3NehfDU7T0csdx/2RLO mwMi2HvsxmhUQBUBF8AsQy2CbNBCOF83m13HkSe6wrP4xnVXH5Rg+77nR4Jw2sVOZSkV R8wbr3jPjY4meLunUspjaV+WInbxrasRVbc1xXlRfr+KQIJqxyt0keMpHlAwwgPVdoJs dAZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699902150; x=1700506950; 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=kbDYjoPTwTgR8SHyfqGxKHNHilCWHODM0jfgO9610ZtnmmYh0+fN+PpQBqhBfA3G+r 7JfEOUJ0mYivxZFzZiC4oKe//9ksRYkYUk8MrfgP8t3BdILSSgV5DT0O0IBr781PLV0b cji40AEepKrrsblTKrb+5evgQ3Yv8FwzSLunEGXslMjsKt+RJcydCTdoL1CGZyaxm8s+ c1d52pGmwsyUGjd9JWlcZ96PF1PpcsoY7sEZDwassNMc3oklLsK1g7xiazk5rVyFGkdN +DlvzjOtn8HSODpCci3ksuP0nZe613cyy5/P9UVQkqOPlGoIAyQPgqT1Iwg+iuJL9YfI yfWw== X-Gm-Message-State: AOJu0YxWvRyqgJn99Y22Hedtr/jTfARDV2KYNXti5Kdg7VU7oXoarW9J EFooQjdwfT9DTYaAdrzYTw0wdQt+Vsh2R/5JqzbJ8GyfwBA= X-Received: by 2002:ac8:5a83:0:b0:418:194a:f9fe with SMTP id c3-20020ac85a83000000b00418194af9femr9009254qtc.62.1699902149795; Mon, 13 Nov 2023 11:02:29 -0800 (PST) Received: from localhost.localdomain ([12.186.190.1]) by smtp.gmail.com with ESMTPSA id kq4-20020ac86184000000b004181c32dcc3sm2124834qtb.16.2023.11.13.11.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 11:02:29 -0800 (PST) From: Leo Yan To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Gerd Hoffmann , "Michael S . Tsirkin" , Manos Pitsidianakis , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Leo Yan Subject: [PATCH v2 1/4] hw/virtio: Support set_config() callback in vhost-user-base Date: Tue, 14 Nov 2023 03:02:08 +0800 Message-Id: <20231113190211.92412-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113190211.92412-1-leo.yan@linaro.org> References: <20231113190211.92412-1-leo.yan@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82e; envelope-from=leo.yan@linaro.org; helo=mail-qt1-x82e.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 Reviewed-by: Marc-André Lureau --- 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; }