From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666263346; cv=none; d=zohomail.com; s=zohoarc; b=SywNQDy6WP3sSpZ57qwALP+G66KjP0DtSo82Gi5UvnksRinA9sU/TsWcmFzv9aiJIm6ewKEI8gTcAVMbKmk6qUn2Yqx4yw0r0ykIkSdpHHryPrXB6hbxcgKSswvsEq1DE+RTfUFpvuXqWI89/kzz4CVgFdKKs5YOmyE/U/ccfKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666263346; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z/oID2r1HOl68aZjFogSgENBhTevfLmh42VnzzuDeiA=; b=TAz3fXVbaUFiDgMSZXbf06Kgm62scZx3RC3E5isBAizrp7ZGqloTrEeJbtrlxxUIhvUTMSRGwOmNTPPWjycVcMcokaqR8Zsocrq8IbOXvrM1Q9l6Ec9/BR+sa/Dl8a7+W1rCHdp3emPuOeYJoXOo22vX2myRTpAYKPZOsgthX/0= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666263346353824.673348770775; Thu, 20 Oct 2022 03:55:46 -0700 (PDT) Received: from localhost ([::1]:57816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTDE-0003cy-T1 for importer@patchew.org; Thu, 20 Oct 2022 06:55:45 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTC0-0007go-1q for importer@patchew.org; Thu, 20 Oct 2022 06:54:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsw-00049E-Bu for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsr-0001I5-5g for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:42 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-c2chNdCCN-yVb2NZuusK3w-1; Thu, 20 Oct 2022 06:34:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C70E9101036A; Thu, 20 Oct 2022 10:34:36 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A3ADC15BA5; Thu, 20 Oct 2022 10:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262080; 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=Z/oID2r1HOl68aZjFogSgENBhTevfLmh42VnzzuDeiA=; b=EdmoD1kfFETznowROeWYPoUP/JyKxbFD6iiuux1gK51RvMF+n0Neri/u8FufBN2rIGnAia hIrFoeu/nDnt1gnTnVobCRoKGv2NkemC5bC54ukXg61q0SHYPTdzQVqkJosg1BNkM7ScPF SXNGxAYSA3tNfA8JKsYQXQiKlw8/KBg= X-MC-Unique: c2chNdCCN-yVb2NZuusK3w-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 1/7] vdpa: Save emulated features list in vhost_vdpa Date: Thu, 20 Oct 2022 12:34:23 +0200 Message-Id: <20221020103429.347525-2-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666263348131100001 At this moment only _F_LOG is added there. However future patches add features that depend on the kind of device. In particular, only net devices can add VIRTIO_F_GUEST_ANNOUNCE. So let's allow vhost_vdpa creator to set custom emulated device features. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/vhost-vdpa.c | 8 ++++---- net/vhost-vdpa.c | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 1111d85643..50083e1e3b 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -31,6 +31,8 @@ typedef struct vhost_vdpa { bool iotlb_batch_begin_sent; MemoryListener listener; struct vhost_vdpa_iova_range iova_range; + /* VirtIO device features that can be emulated by qemu */ + uint64_t added_features; uint64_t acked_features; bool shadow_vqs_enabled; /* IOVA mapping used by the Shadow Virtqueue */ diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 7468e44b87..ddb5e29288 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -660,8 +660,8 @@ static int vhost_vdpa_set_features(struct vhost_dev *de= v, =20 v->acked_features =3D features; =20 - /* We must not ack _F_LOG if SVQ is enabled */ - features &=3D ~BIT_ULL(VHOST_F_LOG_ALL); + /* Do not ack features emulated by qemu */ + features &=3D ~v->added_features; } =20 trace_vhost_vdpa_set_features(dev, features); @@ -1244,8 +1244,8 @@ static int vhost_vdpa_get_features(struct vhost_dev *= dev, int ret =3D vhost_vdpa_get_dev_features(dev, features); =20 if (ret =3D=3D 0 && v->shadow_vqs_enabled) { - /* Add SVQ logging capabilities */ - *features |=3D BIT_ULL(VHOST_F_LOG_ALL); + /* Add emulated capabilities */ + *features |=3D v->added_features; } =20 return ret; diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 6d64000202..e7db40b7cd 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -551,6 +551,10 @@ static NetClientState *net_vhost_vdpa_init(NetClientSt= ate *peer, s->vhost_vdpa.index =3D queue_pair_index; s->vhost_vdpa.shadow_vqs_enabled =3D svq; s->vhost_vdpa.iova_tree =3D iova_tree; + if (svq) { + /* Add SVQ logging capabilities */ + s->vhost_vdpa.added_features |=3D BIT_ULL(VHOST_F_LOG_ALL); + } if (!is_datapath) { s->cvq_cmd_out_buffer =3D qemu_memalign(qemu_real_host_page_size(), vhost_vdpa_net_cvq_cmd_page_le= n()); --=20 2.31.1 From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666263302; cv=none; d=zohomail.com; s=zohoarc; b=VQmw61yO6ZEZcDEwdDoJiPPsQ5tNJEw14jHxGsKip46IDzLIv7a6oOpysTsPdQH3kqb/vJONEv2REYV5ZrfUeUsgPKv0mbE6vqz3TWC9Y+LGg2PXKwR+v6blrCG9a7JfMuRL48W9nL51S1pWXw6EeAVhFzBIzot0dUrlyGxxhpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666263302; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xLtreQwHsO0YrDlU6q0qDajqfSzKbrfe72ZcC5xn614=; b=SbM3wfsw7mVA7gt6Bu3KBtwaF3ABtx6Pi+sLioLwjDCEYUSrMJiCDBwIF0W/cnLYtovCocn/ywzK+cq12beKZ0UfQaZosJC40wwBDbOZxdcHxspjHnNBN2UG3fPqTefM81KZlch5CvuAYXOgTyQh+nELvTxf18IhcTKsoldUrmU= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666263302578329.94957360630804; Thu, 20 Oct 2022 03:55:02 -0700 (PDT) Received: from localhost ([::1]:60972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTCW-0001aX-QX for importer@patchew.org; Thu, 20 Oct 2022 06:55:00 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTAI-0007a4-FG for importer@patchew.org; Thu, 20 Oct 2022 06:52:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsx-00049x-PN for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsw-0001Io-5r for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-191-33SrZLKFOnCgMS2FhKaLyg-1; Thu, 20 Oct 2022 06:34:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B0031010366; Thu, 20 Oct 2022 10:34:39 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1886EC15BA5; Thu, 20 Oct 2022 10:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262083; 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=xLtreQwHsO0YrDlU6q0qDajqfSzKbrfe72ZcC5xn614=; b=Cs6M103mGwlFIQthhmMl5MkAjiXigBTANShK/KQyPjiYhTKVTkFb5CyhZ5CN3OVFzP7hcc 9Hd1IT9OYpzNFiX+UmfdCVcDm0u4BL5T4FqztlEU7dx6JqMi5jHDZcFyV3JyyUhcYZLVFT 7HOMLHIGnSPTNEdh1/Y3ub2WLozATBI= X-MC-Unique: 33SrZLKFOnCgMS2FhKaLyg-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 2/7] virtio_net: Modify virtio_net_get_config to early return Date: Thu, 20 Oct 2022 12:34:24 +0200 Message-Id: <20221020103429.347525-3-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666263304013100001 Next patches introduce more code on vhost-vdpa branch, with already have too much indentation. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index e9f696b4cf..56ff219196 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -158,20 +158,22 @@ static void virtio_net_get_config(VirtIODevice *vdev,= uint8_t *config) if (nc->peer && nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VD= PA) { ret =3D vhost_net_get_config(get_vhost_net(nc->peer), (uint8_t *)&= netcfg, n->config_size); - if (ret !=3D -1) { - /* - * Some NIC/kernel combinations present 0 as the mac address. = As - * that is not a legal address, try to proceed with the - * address from the QEMU command line in the hope that the - * address has been configured correctly elsewhere - just not - * reported by the device. - */ - if (memcmp(&netcfg.mac, &zero, sizeof(zero)) =3D=3D 0) { - info_report("Zero hardware mac address detected. Ignoring.= "); - memcpy(netcfg.mac, n->mac, ETH_ALEN); - } - memcpy(config, &netcfg, n->config_size); + if (ret =3D=3D -1) { + return; } + + /* + * Some NIC/kernel combinations present 0 as the mac address. As = that + * is not a legal address, try to proceed with the address from the + * QEMU command line in the hope that the address has been configu= red + * correctly elsewhere - just not reported by the device. + */ + if (memcmp(&netcfg.mac, &zero, sizeof(zero)) =3D=3D 0) { + info_report("Zero hardware mac address detected. Ignoring."); + memcpy(netcfg.mac, n->mac, ETH_ALEN); + } + + memcpy(config, &netcfg, n->config_size); } } =20 --=20 2.31.1 From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666264019; cv=none; d=zohomail.com; s=zohoarc; b=eZGer9VLZrr+YtN2qKhzFxu49OD4RxTcAuR9FNODlxwUiQmJq8jUg5mUb1AusrrWNAA5PD1IpHGdO3UadYEbhw8c+DLDvf8WSejFfDDA/mrOFt93ZaIzHUvYXLozaOoRVlfLCSVi7VEMOTLWjCneo4O9a0iquIyQdLLL5VziUnA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666264019; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dM50qZSz5YOn5XfKOojvSPIRNzO1U+fgcdQDCEx+Zu4=; b=XsP9CysD+EbESUBzbfnohEk2yqXdSUYvZObVfMYA0kBA+eAv6mrmdCqjZ/B1de8C/gVm8DBf5ejsiWUiCakrCqDGFB2o8ePBgh1d51hRvfegNkIfg0gyFsbSpAPYo7qsBQ699orqbI9n7row9x6/FSFCXYqaQiDu9PU7nTicDaA= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666264019238604.6732691807509; Thu, 20 Oct 2022 04:06:59 -0700 (PDT) Received: from localhost ([::1]:50680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTO5-0006UQ-HF for importer@patchew.org; Thu, 20 Oct 2022 07:06:57 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTBO-0007cV-1z for importer@patchew.org; Thu, 20 Oct 2022 06:53:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsx-00049y-Ox for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsw-0001Iu-9Q for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-00jURQmHNBSU5UVyrRPyXg-1; Thu, 20 Oct 2022 06:34:42 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD166811E84; Thu, 20 Oct 2022 10:34:41 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1EA6C15BA5; Thu, 20 Oct 2022 10:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262085; 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=dM50qZSz5YOn5XfKOojvSPIRNzO1U+fgcdQDCEx+Zu4=; b=E3v7ev38/fBuW+PuJa8J0dVOxIPoJMRslQCPqr/6MYyVbcg9SilfCV9v6g2h/L26gNQsEP zWlOu4IT5SZXddy0HDDcQhiuFNjWzmQszYbQurjT9ibswOhdspcvtk6f711HDA5FLGmdCw kKacXagf4L3yV7QtpPDpW8xno/z62oM= X-MC-Unique: 00jURQmHNBSU5UVyrRPyXg-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 3/7] virtio_net: Handle _F_STATUS emulation in virtio_net_get_config Date: Thu, 20 Oct 2022 12:34:25 +0200 Message-Id: <20221020103429.347525-4-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666264020109100001 At this moment this code path is not reached, but vdpa devices can offer VIRTIO_NET_F_STATUS unconditionally. While the guest must assume that link is always up by the standard, qemu will set the status bit to 1 always in this case. This makes little use by itself, but VIRTIO_NET_F_STATUS is needed for the guest to read status bit VIRTIO_NET_F_GUEST_ANNOUNCE, used by feature VIRTIO_NET_F_GUEST_ANNOUNCE. So qemu must emulate status feature in case it needs to emulate the guest announce feature. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 56ff219196..51fe6d5c1a 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -156,8 +156,9 @@ static void virtio_net_get_config(VirtIODevice *vdev, u= int8_t *config) * disconnect/reconnect a VDPA peer. */ if (nc->peer && nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VD= PA) { - ret =3D vhost_net_get_config(get_vhost_net(nc->peer), (uint8_t *)&= netcfg, - n->config_size); + struct vhost_net *net =3D get_vhost_net(nc->peer); + + ret =3D vhost_net_get_config(net, (uint8_t *)&netcfg, n->config_si= ze); if (ret =3D=3D -1) { return; } @@ -173,6 +174,12 @@ static void virtio_net_get_config(VirtIODevice *vdev, = uint8_t *config) memcpy(netcfg.mac, n->mac, ETH_ALEN); } =20 + if (vdev->guest_features & BIT_ULL(VIRTIO_NET_F_STATUS) && + !(net->dev.features & BIT_ULL(VIRTIO_NET_F_STATUS))) { + /* Emulating link up in qemu */ + netcfg.status |=3D VIRTIO_NET_S_LINK_UP; + } + memcpy(config, &netcfg, n->config_size); } } --=20 2.31.1 From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666267511; cv=none; d=zohomail.com; s=zohoarc; b=DjONHrIUPP7mjsRVCiFZElCnFvgFGaAxHPMYMjAsGcjdA6C9Qgn0eUsR5vpC6TbGYMCdIIxFC1sJyoKLM6TNJTBJncoqU4EpzrZLPtrozEuuPt1ERdreb8PHrtYMWolhwy8ASCltT54cFsbwAb5yHo5IJ/nZ0bcVl6Xs2Vy5Yz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666267511; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vBE5nMCvAVr1Mr3dLhXlNIjAdoIHkpEAl2B19ue2xxc=; b=YXbmzkXf1NpjjzFFmKQIH2Fh/cX6saoAcrmVR6oRBhu8IMxNd0tj9mCyVJtt0ZSD5pws5QkDMgs97HMxIXTObSxMniTuUvS2D4SO2WKopm0nhILkuUQ+YUZ0r+lbLYLaOjTAhe52hHLHrryHPWjfiGpY6Gldkr5vvZTpH++BrFc= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666267511224648.4576258930732; Thu, 20 Oct 2022 05:05:11 -0700 (PDT) Received: from localhost ([::1]:55966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olUIO-0008DX-Fy for importer@patchew.org; Thu, 20 Oct 2022 08:05:09 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTfk-0003HW-Id for importer@patchew.org; Thu, 20 Oct 2022 07:25:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSt0-0004B9-Fh for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20178) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSsz-0001Ja-1d for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-499-2OO1UMTGNlCHnUcSKBmfog-1; Thu, 20 Oct 2022 06:34:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70150811E75; Thu, 20 Oct 2022 10:34:44 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DF34C15BBC; Thu, 20 Oct 2022 10:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262088; 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=vBE5nMCvAVr1Mr3dLhXlNIjAdoIHkpEAl2B19ue2xxc=; b=FOCn8+aygYVyLPHgXGMMB0m3D2jHnbsgsDO+VDKmsl9B10bP5gGZNh64bEZqpSPSLhZPu4 YCyreIkIZ34X8tUY4AI+sm1v+PekkaC//AsaJH0SMeg/0mHOfnKqJkmBhZxuw2YTDYTPqV xMgRpS0iPwjVHdF6ZgHgaCZd/a2go88= X-MC-Unique: 2OO1UMTGNlCHnUcSKBmfog-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 4/7] vdpa: Expose VIRTIO_NET_F_STATUS unconditionally Date: Thu, 20 Oct 2022 12:34:26 +0200 Message-Id: <20221020103429.347525-5-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666267511630100001 Now that qemu can handle and emulate it if the vdpa backend does not support it we can offer it always. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index e7db40b7cd..3374c21b4d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -554,6 +554,9 @@ static NetClientState *net_vhost_vdpa_init(NetClientSta= te *peer, if (svq) { /* Add SVQ logging capabilities */ s->vhost_vdpa.added_features |=3D BIT_ULL(VHOST_F_LOG_ALL); + + /* VIRTIO_NET_F_STATUS is mandatory for _F_GUEST_ANNOUNCE. */ + s->vhost_vdpa.added_features |=3D BIT_ULL(VIRTIO_NET_F_STATUS); } if (!is_datapath) { s->cvq_cmd_out_buffer =3D qemu_memalign(qemu_real_host_page_size(), --=20 2.31.1 From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666263566; cv=none; d=zohomail.com; s=zohoarc; b=RbAcKkwX5tnRYeP/hYE9ZVWbwTMg7RTU+jLrWbxryYn6qH2AjdT1aJuSJgBtO57IEKV0jau7etZj7NEZXnAnMh3nt/+ahsw9fCksvbftA9So7419eGWrWrEVc/ZNAlwbt+CkDYEs681A6f3Byq0ASjUhqboj814tuoKNOqaoJMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666263566; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TVL69tt3U4Sp+yF4eyxZwls4Hc0ZvfnFa/OTrYDffMU=; b=CyyQF6t9qHI/70hX3SqDAjLBjjB5fHaVCxp8sHuFZTtWwIUS2POLOb552mQps1pyqZ0aFsr0Z1/x3Il8ZEJyO7S5wzN3GOM0GSiAGc/2LLRb6v22NYXgrq7QX0jetzUqjioLQxyoP862h5X/iF0m6FRvJnI9qUGHM8/fgx2kdS4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166626356682524.723567137527994; Thu, 20 Oct 2022 03:59:26 -0700 (PDT) Received: from localhost ([::1]:53692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTGm-0003Av-R1 for importer@patchew.org; Thu, 20 Oct 2022 06:59:24 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTBQ-0007br-VB for importer@patchew.org; Thu, 20 Oct 2022 06:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSt6-0004Cg-UR for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSt2-0001K1-FF for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:53 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-497-_tF4mCDVM6iWMGieDGFo9w-1; Thu, 20 Oct 2022 06:34:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08F0638012D2; Thu, 20 Oct 2022 10:34:47 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7984C15BA5; Thu, 20 Oct 2022 10:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262091; 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=TVL69tt3U4Sp+yF4eyxZwls4Hc0ZvfnFa/OTrYDffMU=; b=bS9LXbWrF4S8ytETrkUncl2msuUyDSILAn4HOEKvz1eXmFCYBvBq5wzAF5tE+jPT19f7JI s+0sGOev1XkfTEFFyq6MoLBKX9iYjoIt0wdPa0G66jKWfTtYGQSKNYWVnDRN8yJSpabdF1 7g9laYs8atAUOeqhTaYM63Bc9OKvGG4= X-MC-Unique: _tF4mCDVM6iWMGieDGFo9w-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 5/7] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Date: Thu, 20 Oct 2022 12:34:27 +0200 Message-Id: <20221020103429.347525-6-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666263568196100001 Since this capability is emulated by qemu shadowed CVQ cannot forward it to the device. Process all that command within qemu. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3374c21b4d..5fda405a66 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -488,9 +488,18 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShado= wVirtqueue *svq, out.iov_len =3D iov_to_buf(elem->out_sg, elem->out_num, 0, s->cvq_cmd_out_buffer, vhost_vdpa_net_cvq_cmd_len()); - dev_written =3D vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status)); - if (unlikely(dev_written < 0)) { - goto out; + if (*(uint8_t *)s->cvq_cmd_out_buffer =3D=3D VIRTIO_NET_CTRL_ANNOUNCE)= { + /* + * Guest announce capability is emulated by qemu, so dont forward = to + * the device. + */ + dev_written =3D sizeof(status); + *s->status =3D VIRTIO_NET_OK; + } else { + dev_written =3D vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(stat= us)); + if (unlikely(dev_written < 0)) { + goto out; + } } =20 if (unlikely(dev_written < sizeof(status))) { --=20 2.31.1 From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666263477; cv=none; d=zohomail.com; s=zohoarc; b=CZKVOHMR7GrBu2uVYIkhqZ9C+p7GGD9iYGrGEeTH2z6hy5IkRNrRJK8l79XwFBu7IbAfqkQyb/YagcceJgD0ODhmEFID6CJ2QSExFJEYyHw4B1fsOQLttVWpiFRwXL7ArvArwlAtPrnkNG9zgiI2qSW1VH+eI/9Je8rjynlEHdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666263477; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Lq9PmOW1bmOoh8YADhBhNQUcNg2ahS9g2LKpGj28U4E=; b=hkPOocNkhem+XgtKDIrwjBLNSVnbhpjuW9dKpq6veAxSJ65WuTUH8Q6fa+/YN8vIoAopM108BFVUbb8UHiNzhzEgwKvgIYj6JRbuoX8fjdp2pPvGNxlcQy/HAqsy/mn+iCIAZmq8tZiciQnGElr3e5ZnJhOUXPvJI7M3B+40NZw= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16662634779591010.4209223524765; Thu, 20 Oct 2022 03:57:57 -0700 (PDT) Received: from localhost ([::1]:58086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTFM-0000UB-RA for importer@patchew.org; Thu, 20 Oct 2022 06:57:56 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTBP-0007gm-LB for importer@patchew.org; Thu, 20 Oct 2022 06:53:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSt8-0004Im-7f for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSt6-0001KC-Ne for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:57 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-13-nR4Xh9KdOnyV8Rf25gvwjA-1; Thu, 20 Oct 2022 06:34:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B53CE101A52A; Thu, 20 Oct 2022 10:34:49 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DBB3C15BA5; Thu, 20 Oct 2022 10:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262093; 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=Lq9PmOW1bmOoh8YADhBhNQUcNg2ahS9g2LKpGj28U4E=; b=HSqaA0M8ZXDd/trC3Arjmn6cYXyIrb0up/VEyo/h17uWmUSYhfeDjts6OAPWTC4yV/t2Bv VMEgHcPVSupmZHO0aNYFAxLSKeuBQZhmu+XF4JMm4yB4mGLHVpuXQXW+43RwCVRPv/RbT4 yShc7reFdI46WQDqAWPQCPKW4QCNAlU= X-MC-Unique: nR4Xh9KdOnyV8Rf25gvwjA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 6/7] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Date: Thu, 20 Oct 2022 12:34:28 +0200 Message-Id: <20221020103429.347525-7-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666263479543100001 Status part of the emulated feature. It will follow device model, so we must copy it as long as NIC device model has it set. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 51fe6d5c1a..49674dcf32 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -180,6 +180,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, u= int8_t *config) netcfg.status |=3D VIRTIO_NET_S_LINK_UP; } =20 + netcfg.status |=3D (n->status & VIRTIO_NET_S_ANNOUNCE); memcpy(config, &netcfg, n->config_size); } } --=20 2.31.1 From nobody Sun Feb 8 12:52:45 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666263341; cv=none; d=zohomail.com; s=zohoarc; b=V2WOtFMSamoDwFM/FNKjQrBfX6/AvQvIwDCORPpYfSXjZyVD6WM16XpwVEaf606QWCSZ0sPW8/o0SnQJwP2tTDA/xdgrMREIpAXdMSmqV8fAZ5Jys7V0OiL40g8rJ4eNnssqDSfETn7FAjBPBLGVnbbjI+7YK5Lp604ycM3HX3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666263341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F5A6Wz4vTjMQXnGigxrbVFmdXH778LWcKk1IV3D0UUo=; b=El1B7VW8rjQCAQG/aZ46TPqBRDGadWsvBVOsctGf74djdkA52wnGtqEafCyj4nVNI4D8xPUlf+I27gWZYKAH0bDgVz4tr3YL4ZnSQwcEcyK8X6Psw0k6LvcweeGWrbFaGDV0JomFljpl/y9LJ3xR83RrGHD7E2nfrTKKKLE495E= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666263341626762.8446486663095; Thu, 20 Oct 2022 03:55:41 -0700 (PDT) Received: from localhost ([::1]:55420 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTD9-0002xK-Hh for importer@patchew.org; Thu, 20 Oct 2022 06:55:39 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTBr-0007gv-HE for importer@patchew.org; Thu, 20 Oct 2022 06:54:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olStA-0004Sz-3h for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:35:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olSt8-0001L3-JD for qemu-devel@nongnu.org; Thu, 20 Oct 2022 06:34:59 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-120-txaBdR4kN--lilMfUGh2Ww-1; Thu, 20 Oct 2022 06:34:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5291C3C6EAA9; Thu, 20 Oct 2022 10:34:52 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09288C15BA5; Thu, 20 Oct 2022 10:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666262098; 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=F5A6Wz4vTjMQXnGigxrbVFmdXH778LWcKk1IV3D0UUo=; b=JhBFPXxjvIBQzlEMYvscn0K7euorl1gLqDxS+h8LBccF5gHbijXyDGLHSD+R7NVPid9iUS 1Q1rl5TpP9KrFIFImcML10Z16OTvz2so5vXq37fyJGMX0yZbFyHcshuSR+oQpSddVYNgEE upRQnBkHy7pEIiizIa3cyRyAHVmEZWg= X-MC-Unique: txaBdR4kN--lilMfUGh2Ww-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Zhu Lingshan , "Michael S. Tsirkin" , Eli Cohen , Cindy Lu , Stefano Garzarella , Gautam Dawar , Si-Wei Liu , Harpreet Singh Anand , Jason Wang , Liuxiangdong , Parav Pandit , Laurent Vivier Subject: [PATCH 7/7] vdpa: Offer VIRTIO_NET_F_GUEST_ANNOUNCE feature if SVQ is enabled Date: Thu, 20 Oct 2022 12:34:29 +0200 Message-Id: <20221020103429.347525-8-eperezma@redhat.com> In-Reply-To: <20221020103429.347525-1-eperezma@redhat.com> References: <20221020103429.347525-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666263342117100001 So qemu emulates it in case the device does not support it. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 5fda405a66..64442e8455 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -566,6 +566,9 @@ static NetClientState *net_vhost_vdpa_init(NetClientSta= te *peer, =20 /* VIRTIO_NET_F_STATUS is mandatory for _F_GUEST_ANNOUNCE. */ s->vhost_vdpa.added_features |=3D BIT_ULL(VIRTIO_NET_F_STATUS); + + /* We can emulate guest announce shadowing CVQ */ + s->vhost_vdpa.added_features |=3D BIT_ULL(VIRTIO_NET_F_GUEST_ANNOU= NCE); } if (!is_datapath) { s->cvq_cmd_out_buffer =3D qemu_memalign(qemu_real_host_page_size(), --=20 2.31.1