Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2283978rwb; Fri, 11 Nov 2022 07:24:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf59JSpjPYvuO+0wt254xrck5Sgh6qg//Sp0idFMd1rgFvurYrduJWi2StIaZLwaT0WO/BPb X-Received: by 2002:a50:ef0b:0:b0:461:9b6c:a415 with SMTP id m11-20020a50ef0b000000b004619b6ca415mr1919156eds.261.1668180280463; Fri, 11 Nov 2022 07:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668180280; cv=none; d=google.com; s=arc-20160816; b=T96dECPE5uA6LJI5GkFkz2melLWQIxQ6a1tqPmBWXsolKEDyExFqY3ZzEsTCF2k+/c yJTOyqOpPlQLNCV/192gBGdLx3i5WjZUVHc9Za2NOwFIIg/L+r8w592WakUu2H/ij/t+ cAnxxDOedxOQRS+7NjSu2hSPIinsIPvkVd4aKGoxsnhKxlIxC/ZODPjnjQ1nuhAXzBLb jGVt+/ZkdRVW3oPonc9GyNfWuGhzrEu4c6HtQfpx76QpVItpmpgfNVp5DPqEGoDRFQzs OEs/tQuCxlLTkYji2RRmGBRZL4Sx018sCUZg5tUb7W72ga8PzKxTwCDagM/htdoxmm9i 1R8Q== 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 :message-id:date:subject:cc:to:from; bh=tuppcrhBPe1EhMgwS3MP9nl2RWEBVsyluEKSPoJulHc=; b=sbNRUsbA8ynjtOittWbs1E+hP+kuCkbo7tyWQbTEA+DKUZBHM1rb6JDb2K6BUpSGXU 1zFhOnhrjrivqPb8cyqCVPot3A9Mc3ScOTwNfP7aZPEQ6/8cSrBGe7tgwck2Vb/6VlFR p7MS/ufkWVAiY2jgqGRhas4HZcBsH6BI+g0InwWyWq39BMn8lpl3wtrrNeSWH2WT/Zkj 8QODhmBvBnbJgej+wX0R/s0m0KucDT9iOrjr1YDlMDBLoURgqiePPjLbwkeuf4PzbYWW YqVvteuRZj3ol6gZm8GRxMzW9ncjYrPTL2BJE92F0Jp3WW8iSmbNKa9Xev7fydb8HWis 6nfQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020aa7cdd3000000b00461ebe2a168si2188331edw.447.2022.11.11.07.24.18; Fri, 11 Nov 2022 07:24:40 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234041AbiKKO1f (ORCPT + 91 others); Fri, 11 Nov 2022 09:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbiKKO1a (ORCPT ); Fri, 11 Nov 2022 09:27:30 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1DA8C1; Fri, 11 Nov 2022 06:27:28 -0800 (PST) Received: from kwepemi100025.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N81Cg3gHNzbnfm; Fri, 11 Nov 2022 22:23:43 +0800 (CST) Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by kwepemi100025.china.huawei.com (7.221.188.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 11 Nov 2022 22:27:25 +0800 From: "Longpeng(Mike)" To: CC: , , , , , , , , Longpeng Subject: [RFC 0/4] pci/sriov: support VFs dynamic addition Date: Fri, 11 Nov 2022 22:27:18 +0800 Message-ID: <20221111142722.1172-1-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi100025.china.huawei.com (7.221.188.158) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 From: Longpeng We can enable SRIOV and add VFs by /sys/bus/pci/devices/..../sriov_numvfs, but this operation needs to spend lots of time if there has a large amount of VFs. For example, if the machine has 10 PFs and 250 VFs per-PF, enable all the VFs concurrently would cost about 200-250ms. However most of them are not need to be used at the moment, so we can enable SRIOV first but add VFs on demand. This series introduces two interfaces: 1. sriov_numvfs_no_scan: enable SRIOV without add the VFs. 2. sriov_scan_vf_id: add a specific VF. Longpeng (4): pci/sriov: extract sriov_numvfs common helper pci/sriov: add vf_bitmap to mark the vf id allocation pci/sriov: add sriov_numfs_no_scan interface pci/sriov: add sriov_scan_vf_id interface drivers/pci/iov.c | 162 +++++++++++++++++++++++++++++++++++++++++----- drivers/pci/pci.h | 1 + 2 files changed, 148 insertions(+), 15 deletions(-) -- 2.23.0