Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp505747rwn; Thu, 15 Sep 2022 02:03:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ogAuqeYqwfMCl53SU9xFStGFFmpVgnVUOP6k6IEuo3ba/2VTnamrZ8vZzEAoITGbsGAn2 X-Received: by 2002:a17:902:b7c3:b0:176:b7e6:ae6c with SMTP id v3-20020a170902b7c300b00176b7e6ae6cmr3293437plz.163.1663232590930; Thu, 15 Sep 2022 02:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663232590; cv=none; d=google.com; s=arc-20160816; b=qSK283Ut2iZ/0H/1Db88eTorxZzWeQjJpDa9slL4z9p5NRzuvdznZXNa2mdrh+m1Sd 4TQi/gZ1XND5xQicea+amSyzqhree9eR/6P2VV4a4cOpVjYS0fJtXaFISpSlENZm7Vz4 rZ0PkVMpU5cW7Xo5WCRLyfN7h32rtK0p0YRb3PncUJlJ3M2Ro1GHoDq6Hrg9BthO7IN1 Eu8NmHYfNTtacZ2WyEPCTsxJQ0loJU9rVKQliDA9kRkuF3rORALkHAtVA2OxKheQaYKm e+pFfCAummpN/q/YQA12Jp414+gDYP6hPylSf/RBkX6cqr7gxzmlXJMurJbg3+KjXKq5 /OFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HtH0gZJLSphgQW8Ji1ZiABGaArzF1UFmj1/zk99fde4=; b=ds38opqKmSRWwe7xzG3l91605ArOrHbxxmJjhcIElfuQYQFL3zhrH8zHqRSEmz0UQC 8WEp2SuruOZodprsdQsfp1bo4Pp+uKtYHMDZEFUQXAGpYMMGpGuXilfoC/FaYmMoYssl 53Ai2BCtnwyESxizXpv36U78BEkdMll/xGSDJ5pOkDWTvn3siECP93xsMOrTDvort3yQ FXxL/ZP60Id2KVmKx2PpshGxxWiVD0F/lYydmAcg5DNsPNjcYUX3TlS4hX+nODkIhrKP 9ccxnKYq+pgvtl2VW6DstNSggR5cdqxCxoxeW1HIZxtj/Fx20q17kKs/BvkxXctbr4X7 T5FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C7QPFzjD; 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 i186-20020a6387c3000000b00429a31c3717si16022979pge.35.2022.09.15.02.02.59; Thu, 15 Sep 2022 02:03:10 -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=C7QPFzjD; 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 S229991AbiIOIvR (ORCPT + 99 others); Thu, 15 Sep 2022 04:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiIOIvK (ORCPT ); Thu, 15 Sep 2022 04:51:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 990FE58DD8 for ; Thu, 15 Sep 2022 01:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663231867; 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=HtH0gZJLSphgQW8Ji1ZiABGaArzF1UFmj1/zk99fde4=; b=C7QPFzjDAFfGjn19IWPJzad8N7cIKRDR4sl3f5DuraY9FoCO/o74e5i/YL89nKQIwdWYi4 nI5L+mP6FV0wO8/XM8LyzfdasYr7NOCkfsvWPuTu2DjrSH57NeoTm1MKprfa6XnPfVTWaX greIF/mkJcdF3Q0irXgJlYativn4+nA= 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-473-2EA0xIhzPxuyHetySjDqZg-1; Thu, 15 Sep 2022 04:51:03 -0400 X-MC-Unique: 2EA0xIhzPxuyHetySjDqZg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D9F785A5B6; Thu, 15 Sep 2022 08:51:03 +0000 (UTC) Received: from localhost.localdomain (ovpn-12-201.pek2.redhat.com [10.72.12.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B99A1759E; Thu, 15 Sep 2022 08:50:57 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com Cc: elic@nvidia.com, si-wei.liu@oracle.com, parav@nvidia.com, wuzongyong@linux.alibaba.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, eperezma@redhat.com, lingshan.zhu@intel.com, gdawar@xilinx.com, lulu@redhat.com, xieyongji@bytedance.com Subject: [PATCH 1/3] vdpa: device feature provisioning Date: Thu, 15 Sep 2022 16:50:46 +0800 Message-Id: <20220915085048.12840-2-jasowang@redhat.com> In-Reply-To: <20220915085048.12840-1-jasowang@redhat.com> References: <20220915085048.12840-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 This patch allows the device features to be provisioned through netlink. A new attribute is introduced to allow the userspace to pass a 64bit device features during device adding. This provides several advantages: - Allow to provision a subset of the features to ease the cross vendor live migration. - Better debug-ability for vDPA framework and parent. Signed-off-by: Jason Wang --- drivers/vdpa/vdpa.c | 5 +++++ include/linux/vdpa.h | 1 + include/uapi/linux/vdpa.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index c06c02704461..278e26bfa492 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -600,6 +600,11 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i } config.mask |= BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MAX_VQP); } + if (nl_attrs[VDPA_ATTR_DEV_FEATURES]) { + config.device_features = + nla_get_u64(nl_attrs[VDPA_ATTR_DEV_FEATURES]); + config.mask |= BIT_ULL(VDPA_ATTR_DEV_FEATURES); + } /* Skip checking capability if user didn't prefer to configure any * device networking attributes. It is likely that user might have used diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index d282f464d2f1..6d0f5e4e82c2 100644 --- a/include/linux/vdpa.h +++ b/include/linux/vdpa.h @@ -104,6 +104,7 @@ struct vdpa_iova_range { }; struct vdpa_dev_set_config { + u64 device_features; struct { u8 mac[ETH_ALEN]; u16 mtu; diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h index 25c55cab3d7c..9dc855f37c59 100644 --- a/include/uapi/linux/vdpa.h +++ b/include/uapi/linux/vdpa.h @@ -52,6 +52,8 @@ enum vdpa_attr { VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */ VDPA_ATTR_DEV_VENDOR_ATTR_VALUE, /* u64 */ + VDPA_ATTR_DEV_FEATURES, /* u64 */ + /* new attributes must be added above here */ VDPA_ATTR_MAX, }; -- 2.25.1