Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18575035rwd; Tue, 27 Jun 2023 20:13:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7JbWJKVakYei8BL9wyTai4uTNvvmwfV5GqIK4VKkCuBqO92gwK/ZKFAgxPd/+o/7Obo/nF X-Received: by 2002:a05:6a00:14d2:b0:67b:77e7:f467 with SMTP id w18-20020a056a0014d200b0067b77e7f467mr116407pfu.16.1687921995208; Tue, 27 Jun 2023 20:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687921995; cv=none; d=google.com; s=arc-20160816; b=MLNTHmkAYcYFtH5nBYM7XqyCymplvhUruFtaNEn5knpDGbEazmnz7PKSnFv7Yim2Po vfFU7SOQUs6WOgCjpvI287DeuBno2PeTalb88ZYZgQKhx43YhMApnCpsyBXXFqqVPMNN VTfKBbOZ8jb67orWn3ghkeppXErh6FTN1xByAutEfpwl4URa28uDYvg5Qb3a2kvYMMtk niuAppCxsUKannpD8pM83fx3yQc7kCvtvzPpEPLOoVwmnEJhHsWs1+cqZTwjVd7l0O63 U+LaUmX/WJuK7yoVqCwY9ygO85xkZ7Ng/XNsAaA4FLow9G7U3eYPCkgKrgIhPC3/pdPq xLiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dRFSqjQ8goVbgezkdLbcR17PF9Y4JZ+FcQZ0y0X5sGQ=; fh=ReNSx9YqGepyNrsypNBdDjSXzAMuKTpsxX/BnEOah/0=; b=qm9GXABNabS/0W+uvAqd8KkD36wdVdYSg+ItW7yr2MXgun0niZH46ju/IpV4yoeiZv f3xgpzgqn5r2gmgEAasrSnrhfr7OeyLIC3QpcUYGBLKlaXyalY48S4PX3aQhqMqg4TlO ri+k3NK2uckca5I93LTKlBtOQ2VF+w/oTVYMVgodw9t2zWqvKT5iPADmsRuUWCyExFbe 2mtkYq/HLsQv/EWPgO0TK1AD4jQpFXFLGjYzCyJZ/jCJs/CNEYvPzmLq2NJ/BkxWaS5J ybQObR3+xT1G03xvNrgGdAKfSz4nUMvoEUC2+BDpGSiuAGf6WIGLThO3w6yqUUjOt/Yx eEpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UU/q/H2V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u71-20020a63854a000000b0055786245b37si8659433pgd.377.2023.06.27.20.13.01; Tue, 27 Jun 2023 20:13:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UU/q/H2V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231182AbjF1Cf6 (ORCPT + 99 others); Tue, 27 Jun 2023 22:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbjF1Cf4 (ORCPT ); Tue, 27 Jun 2023 22:35:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7317B129 for ; Tue, 27 Jun 2023 19:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687919710; 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=dRFSqjQ8goVbgezkdLbcR17PF9Y4JZ+FcQZ0y0X5sGQ=; b=UU/q/H2VC/4SgJi41WmXlouT1og/lrf+jpjWfUtkCr6VCEFoawa4j3815XP3VW53j0fLt5 ZqJA6MGdrKWxCynwf6Qy79pFoKq+A3EOX7CItoRZgbMEMz+fD4Q4D/gNRiV9bliTqwPf4S wIW5Q5bsnNsFI1CWZSYHUSSyitrP7vY= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-y5A-FAOCOCS78EsH7hFkgw-1; Tue, 27 Jun 2023 22:35:09 -0400 X-MC-Unique: y5A-FAOCOCS78EsH7hFkgw-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4fb913e8cddso118624e87.0 for ; Tue, 27 Jun 2023 19:35:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687919707; x=1690511707; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dRFSqjQ8goVbgezkdLbcR17PF9Y4JZ+FcQZ0y0X5sGQ=; b=RaW/yiZAcVVhPtFZfMLdEv8cNArKzTcs8ZegrcWs/xS0bgyI6oaspPCxWuXM90/knU /Ta/rFPWMl9YmFmGUUQE3lyWGevCqkfB3CBi2mOSFqlLSqDFPRspE19id2A1ExOKXRJq yGBcrfjeyYZjWLQsGo//h/zoLK8AZ+GxulkMGAYX4zrN69zU5N1HBaDrrw87q48FS3HJ bRJImUP2iwftnu76CKgQdSPUvKNqbn6OJrFrFQseBFLHsI7j5GpHzb6vTOff3Aba0RkM eUqf1GIfvITrum5ymX8BmPa0Be2ytcHo+XX/Yk/cpP20wzYldAq1EGYGC+XMe8vt8Fhl Xixg== X-Gm-Message-State: AC+VfDziHH61bVyiOa4baNOcyafc8Vqchz50HuyLlaRM7dqHNjb5A0I6 CG6PRDr9fI0ecsFggJF52/UsRY+MfVSkkYLREyTKzMK/sr3M7nA4ykF45LQg23u5Z5Fi1D8mv+Q WShcpGzuDMBKxpJdfLAP8LQiWeEri2i0eczFUXUqw X-Received: by 2002:a05:6512:1284:b0:4f9:5ca0:9334 with SMTP id u4-20020a056512128400b004f95ca09334mr13621876lfs.34.1687919706915; Tue, 27 Jun 2023 19:35:06 -0700 (PDT) X-Received: by 2002:a05:6512:1284:b0:4f9:5ca0:9334 with SMTP id u4-20020a056512128400b004f95ca09334mr13621868lfs.34.1687919706658; Tue, 27 Jun 2023 19:35:06 -0700 (PDT) MIME-Version: 1.0 References: <20230627113652.65283-1-maxime.coquelin@redhat.com> <20230627113652.65283-3-maxime.coquelin@redhat.com> In-Reply-To: <20230627113652.65283-3-maxime.coquelin@redhat.com> From: Jason Wang Date: Wed, 28 Jun 2023 10:34:55 +0800 Message-ID: Subject: Re: [PATCH v1 2/2] vduse: enable Virtio-net device type To: Maxime Coquelin Cc: xieyongji@bytedance.com, mst@redhat.com, david.marchand@redhat.com, lulu@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, xuanzhuo@linux.alibaba.com, eperezma@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 27, 2023 at 7:37=E2=80=AFPM Maxime Coquelin wrote: > > This patch adds Virtio-net device type to the supported > devices types. Initialization fails if the device does > not support VIRTIO_F_VERSION_1 feature, in order to > guarantee the configuration space is read-only. > > Signed-off-by: Maxime Coquelin Acked-by: Jason Wang Thanks > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/= vduse_dev.c > index c1c2f4c711ae..89088fa27026 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -142,6 +142,7 @@ static struct workqueue_struct *vduse_irq_bound_wq; > > static u32 allowed_device_id[] =3D { > VIRTIO_ID_BLOCK, > + VIRTIO_ID_NET, > }; > > static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa) > @@ -1668,6 +1669,10 @@ static bool features_is_valid(struct vduse_dev_con= fig *config) > (config->features & (1ULL << VIRTIO_BLK_F_CONFIG_= WCE))) > return false; > > + if ((config->device_id =3D=3D VIRTIO_ID_NET) && > + !(config->features & (1ULL << VIRTIO_F_VERSION_1)= )) > + return false; > + > return true; > } > > @@ -2023,6 +2028,7 @@ static const struct vdpa_mgmtdev_ops vdpa_dev_mgmtd= ev_ops =3D { > > static struct virtio_device_id id_table[] =3D { > { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, > + { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID }, > { 0 }, > }; > > -- > 2.41.0 >