From patchwork Mon Nov 20 04:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 745349 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1100170wrt; Sun, 19 Nov 2023 20:38:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcoVQ5jQajOyUjwstQw6pdORxMgauXy4pWFAYQ3CgR6iSLZwzz8lCBUv2C63/R3Hj5mjQg X-Received: by 2002:a05:6214:2a:b0:66d:66cd:a351 with SMTP id b10-20020a056214002a00b0066d66cda351mr17320480qvr.18.1700455120153; Sun, 19 Nov 2023 20:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700455120; cv=none; d=google.com; s=arc-20160816; b=SciQkyQMDIGZZ5rS21c9NvVQV8y6v54g3rQzMlG7ncTEud69rgqwXq67l4rC2RhuxW XSG9QG7Y/SrG93lq9CfmpPPzctwyU6r03ebLus4LbrT6dD3b/jLvxM0+1UvkfM6NrVV3 VslCG8aV5gNgewkLrtnYGD3w1J0JMGsd2UOE6mqR2CYD2l6PvII8ouR7Zywk3p2DSGtE AFmXm9QgVFNQGvuNELDUFAt4E+W9onmDe9ePdVMH7uA6/KJYT2nnL3Y7/pTSshY/Q5a3 mKAVJKf4WEzheCpBm9FdHcwR1yQ5jMrl4kPY1E5ftuYWjivsPy/itXCoju4zrVaUCqDP v3WA== 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=WBpKSrlAkKXf6rultbFnaIQsV4HRFQIvdhScRurtvXE=; fh=j5N4gOp3ka1Xsisgn/3FSSHjf2kwoyjMvxSEx5jWFCk=; b=XLIKixUgb+AOE7izvZ9RiPFJx9HTWzRaEaZX+cPHDWv9xDjLi/bM1vOzcN78/e1Hkr nXWY3jHCTscSuFVrolKiyhlTGF7I+6Ial6X5uTimFnWFIOapqtVgxgLfIi5klbbLcyVN Dgm+/ii4RI92NMAZ2GuX4JwjbcdDZWwQ07jEyHhvUeMw4R4pDc+PVVHfHfcv4HejFtIQ /KM6FDcWvdT8YeWuBzwKqwIIqeOJiAPQ+lLV3pxOvvOLfhspsu+zw2OFMnfGxYNPdrGX 39dEt7huGY381YnZfycFRlALRQeEs101ixnoMbjse7YY0WwXgPAcZat1iqOFlxMquYsZ BRmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tG+peU1g; 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 z17-20020ad44151000000b0066d15c73fc0si6634601qvp.120.2023.11.19.20.38.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 Nov 2023 20:38:40 -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=tG+peU1g; 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 1r4w2V-0000Ce-KL; Sun, 19 Nov 2023 23:37:39 -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 1r4w2U-0000CP-26 for qemu-devel@nongnu.org; Sun, 19 Nov 2023 23:37:38 -0500 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4w2S-00039U-Gj for qemu-devel@nongnu.org; Sun, 19 Nov 2023 23:37:37 -0500 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6bf03b98b9bso3538354b3a.1 for ; Sun, 19 Nov 2023 20:37:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700455055; x=1701059855; 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=WBpKSrlAkKXf6rultbFnaIQsV4HRFQIvdhScRurtvXE=; b=tG+peU1gAYKohDfr3AczmxcmznhUpxaBzDn0UkBYwW6uh6VJdyEIEqIwyCzg2ot3XS fJF3LxeBx01fHFhrHchH3xlTaroii/z3pBrda9JRpXePMpG/jKTihjWlFZXtscfPbeZj 7grZFBLVxfh13nU5Vpt/x1plRYbzqBS1Upis6sKE91bOH3AG8b2+nRoinf4xd8MBar9Q fVP9PxZBG9C27ubbdB5iJ3nTWiMGnBc2fkkbJovVL4vGnI1D6NH85YkuihyNY1PAtWAW Kzop/jWav0KrFMPP8XVFYy5hUbfNojDUcItSoxJpsaNfpP45D6o3WICS2L7mvok+Cv0U FX+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700455055; x=1701059855; 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=WBpKSrlAkKXf6rultbFnaIQsV4HRFQIvdhScRurtvXE=; b=XJvLEwC/Kn23l11KyRJzTTQuGu+KN+xIw3QHynbTXiGV7RQP/YL8+ql60ktInSFlFO V8ejFT//tPjLBTqSGnR/wb86k/ooizDKj+kK3TvElHDym1J7ESn6apgvTJQUkP/2HyE/ nFPD53Cgr2PTDmBjq1AnzLPlwQmFdI5Fk5nwHCPDlBoDy7BCYP0YfP1WCTjuEo8sm3Cu 02SuHWD2GOdz6kHXk3NXNBpKIihyKPCXcpu+tDico8h94n+0/CFbn6eBHrRH5BkRprAX bC6qKhxFWKSroj4CJ2NT4kCZyUh9LbVFuxhiSJ3UGu+3RPKZUREPsMnHRfOdELwwrvnu omiQ== X-Gm-Message-State: AOJu0YzSPm7WvWzLYFAmJg10Ou+TQbqwMcoPnfSYLXI0ayUubsn/fyf2 HeXoDLKR8pfKIqSSzF3LzUu7T8L8OMtBPMrW3EgXfeApW62IdQ== X-Received: by 2002:a05:6a20:938e:b0:15d:b407:b0a0 with SMTP id x14-20020a056a20938e00b0015db407b0a0mr8477856pzh.26.1700455055031; Sun, 19 Nov 2023 20:37:35 -0800 (PST) Received: from leoy-yangtze.lan (211-75-219-202.hinet-ip.hinet.net. [211.75.219.202]) by smtp.gmail.com with ESMTPSA id s41-20020a056a0017a900b006926d199fdcsm5035991pfg.190.2023.11.19.20.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 20:37:34 -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 v3 1/4] hw/virtio: Support set_config() callback in vhost-user-base Date: Mon, 20 Nov 2023 12:37:18 +0800 Message-Id: <20231120043721.50555-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120043721.50555-1-leo.yan@linaro.org> References: <20231120043721.50555-1-leo.yan@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=leo.yan@linaro.org; helo=mail-pf1-x430.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; }