Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18551608rwd; Tue, 27 Jun 2023 19:46:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7JXDCduLjNW0Aw4zvbLupv9TvRO8EYxQP3YB7/3cqD0R+N9iyZIRZ8AQmJKGpoaPzPNWsM X-Received: by 2002:a17:907:1c9c:b0:969:f433:9b54 with SMTP id nb28-20020a1709071c9c00b00969f4339b54mr25073276ejc.39.1687920379283; Tue, 27 Jun 2023 19:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687920379; cv=none; d=google.com; s=arc-20160816; b=pxbM9UIVUCqJLvXr9t7hb2g/Rn0ZeqJxPVNFIPQxmud2Htov4WXg+1AHG+hwCSfbQj hh4mWwNB7oiG3d+hdiKgByhP75rbjQ9aunlluqo+eTENCiCROm8sQrwaOLroYWMB2OPo UWhgWthN5hxg4z6t9bP6IGrmequnZJw4xQtVZ59AwRQbaD1C/KmF/ZcngLdqCjY41Fu9 I1gZYzvcdC6F2aJfELj8djEZpJu2pHi5nT4STB05G/QRZ97/3OWWkxrqZ9Vsn2xayI9+ lGBGGBps65wgwIz1YzBJh51KKg3+0AuN32Gn+7bmHLvqPaPZ52t6Sh88zyIuPtxsCn6h yb/A== 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=dCxVeK5h/dORUE2gYkmTMAY5Skn7U71Hm0WtRWaHEYk=; fh=ReNSx9YqGepyNrsypNBdDjSXzAMuKTpsxX/BnEOah/0=; b=nehgSmatHM2k+QbdVtVrhJYkFjBe1Q0JFvtv7yYFnwdUasER2ehRjIAAIGNOQO8i4u 5+6JD5kZG2FM34Uqiba1ucCWmQOQ0VLn31krgRSddOYM8bVFTddspIZl7IiHd9Phs+Z3 lp66L1cvSF8j3T1ZjZ28NAuVub2RRunUghZ7Hp6tveTFFStxxDwEwT8Zff57v6XoOwY5 72iBvCX4zYAg3tVLeIj5+FqpHIxnjogvtxyH1rJfERbN7nRwH/OZjQ9aMYXsxDvy+dV4 /7l1iOvLIiFcfaMcVZSQRA8PvUQ6MDPl0/mVvBnaCaf/0cQZpx+CXrt2x3CKMYO3iBfq gEUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FyJRXVld; 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 a24-20020a170906685800b00991ece4c965si2291450ejs.524.2023.06.27.19.45.55; Tue, 27 Jun 2023 19:46:19 -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=FyJRXVld; 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 S231175AbjF1Cfl (ORCPT + 99 others); Tue, 27 Jun 2023 22:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230324AbjF1Cfk (ORCPT ); Tue, 27 Jun 2023 22:35:40 -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 164B211D for ; Tue, 27 Jun 2023 19:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687919693; 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=dCxVeK5h/dORUE2gYkmTMAY5Skn7U71Hm0WtRWaHEYk=; b=FyJRXVld5I5+uXYoEtLfG6DQORu8CrVXHXoB57U0/drYN7uKv6surbh7pTMZRnhndGmf57 qTQQbhJX2UUia0Pcr7SfpnRX0Y57gK+64arj90ztI2DczQIvLulNpgR6cYTfs+hSpF8BZg BhakAyWVSoSKiabZucWPIu5o01EKkPQ= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-12-b_T6q1koOx2oQGg7YpDlHQ-1; Tue, 27 Jun 2023 22:34:51 -0400 X-MC-Unique: b_T6q1koOx2oQGg7YpDlHQ-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4fb7d06a7e6so2165230e87.2 for ; Tue, 27 Jun 2023 19:34:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687919690; x=1690511690; 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=dCxVeK5h/dORUE2gYkmTMAY5Skn7U71Hm0WtRWaHEYk=; b=J2IAzwBvd8cu0UMG30VPQkWXBdPqBOMWqDpn8f1L5ISgRWexXgK3L3tKC1SaZM0MBv qpgEY3uvH4EJTchWHWq5XSLy5DU2gJj+B7YWDxKk1SIHFqCWwMgizHXc0OhVb6Cl+mk1 S+bMkP0vWSwwDITNodpEt0aXJJksQVeCuQ1r0A25a+fVPiqN0Co5lN4QE0EBiwSkqFVy Li+qwjYfo7pq4naRf5lXr9bhc3mK6ww9+H/6N8U9V8WoUQUvQPBnZwBhhozvXJPjjldA +eopGj34V81x5TwEc4ifpmygGgPP0acEjw2ilD0XAv0eSYDiOi7EPtZf77GDOt1eH9oA u8yA== X-Gm-Message-State: AC+VfDyUmoqW4BVs0vwKeExNbteCVR52hTvWwusq5Y0QxuUomfH9IAih kg1qQ17Y/HQ6M1hiWiZCN72AcPF0n+qhNl/LIbwYzrT1rTujP7we0hAEGO1D3bXXJn+Ng/8SZrK JTESC8qBFEbTLL9zWLA8BWERVBn9nGs9ijwpTX/xIcmpS+y9X9a4pbg== X-Received: by 2002:a19:2d54:0:b0:4f8:5e5f:b368 with SMTP id t20-20020a192d54000000b004f85e5fb368mr17437563lft.21.1687919689997; Tue, 27 Jun 2023 19:34:49 -0700 (PDT) X-Received: by 2002:a19:2d54:0:b0:4f8:5e5f:b368 with SMTP id t20-20020a192d54000000b004f85e5fb368mr17437556lft.21.1687919689714; Tue, 27 Jun 2023 19:34:49 -0700 (PDT) MIME-Version: 1.0 References: <20230627113652.65283-1-maxime.coquelin@redhat.com> <20230627113652.65283-2-maxime.coquelin@redhat.com> In-Reply-To: <20230627113652.65283-2-maxime.coquelin@redhat.com> From: Jason Wang Date: Wed, 28 Jun 2023 10:34:38 +0800 Message-ID: Subject: Re: [PATCH v1 1/2] vduse: validate block features only with block devices 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=ham 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 is preliminary work to enable network device > type support to VDUSE. > > As VIRTIO_BLK_F_CONFIG_WCE shares the same value as > VIRTIO_NET_F_HOST_TSO4, we need to restrict its check > to Virtio-blk device type. > > Signed-off-by: Maxime Coquelin Acked-by: Jason Wang Thanks > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/= vduse_dev.c > index 5f5c21674fdc..c1c2f4c711ae 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -1658,13 +1658,14 @@ static bool device_is_allowed(u32 device_id) > return false; > } > > -static bool features_is_valid(u64 features) > +static bool features_is_valid(struct vduse_dev_config *config) > { > - if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) > + if (!(config->features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) > return false; > > /* Now we only support read-only configuration space */ > - if (features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE)) > + if ((config->device_id =3D=3D VIRTIO_ID_BLOCK) && > + (config->features & (1ULL << VIRTIO_BLK_F_CONFIG_= WCE))) > return false; > > return true; > @@ -1691,7 +1692,7 @@ static bool vduse_validate_config(struct vduse_dev_= config *config) > if (!device_is_allowed(config->device_id)) > return false; > > - if (!features_is_valid(config->features)) > + if (!features_is_valid(config)) > return false; > > return true; > -- > 2.41.0 >