From nobody Tue May 13 17:33:20 2025 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673518500; cv=none; d=zohomail.com; s=zohoarc; b=GWWDZqO5yDu3Yk2hSo2pRDX4++TuQz71lRmsKjdQIqhX98vZbClK5tUMmpZr9I9yArj9+7sZikBAfRY0r8WwDjD187ZkjjNbQd8nBvzd1O+F3YEyBIVqdfHoPr7zYUDMQV0o7LkDtB9dmhvpLCh+IdhPcEAmlS8R5e8Zbsb+aCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673518500; h=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; bh=jr40F9vIhXN24Z2eK9R5w/EFRpttBsVu/dvj/G/e+nM=; b=LZi6ByIF/ZAL0Hnf+KTJQEwWkKQgI/Uj8OWKtvFWYKcJT9KJgCKLcz+miV+I+pe8d9xTFIrcwNerHnIL1NHE+El4JNJ3j7VvPlaQ2uaQKbP4JzyVOfHhgfsenxaOpzbjF/Z5RPz3JqPSeQwh5PLWuIcvEk2OTRlsIXamkwAtfJw= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1673518500943770.7607717347138; Thu, 12 Jan 2023 02:15:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFuN0-000475-Sz; Thu, 12 Jan 2023 04:59:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFuMz-00045e-5h for qemu-devel@nongnu.org; Thu, 12 Jan 2023 04:59:37 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFuMx-0004U5-Lp for qemu-devel@nongnu.org; Thu, 12 Jan 2023 04:59:36 -0500 Received: by mail-pl1-x634.google.com with SMTP id y1so19737445plb.2 for ; Thu, 12 Jan 2023 01:59:35 -0800 (PST) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:4457:c267:5e09:481b]) by smtp.gmail.com with ESMTPSA id k13-20020a17090a3ccd00b00219025945dcsm12095450pjd.19.2023.01.12.01.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 01:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jr40F9vIhXN24Z2eK9R5w/EFRpttBsVu/dvj/G/e+nM=; b=gW6fsIw0t2Lmfo5amLL02QFfbO8ug4GxaNlL5ZA61/CNMj9UacCRf+HnOgyKovS9B3 cyemZzyGzOn59lzir+G5FxCPsaPABfM0Jm+msiy4433SaQPNe3DDzy47rn1PCbsWRLVQ +doFL1oUMWfblz/qOURQLwA6Wqt3cddCAycw73XAO1AeVUv7u/c+xJwHXtRGeizv77uX PxAov3EuOep0clKy0HzPBQV56trrW2Eqx5T9q4xHI8vwCUQYo0AlDjTqUnDWFY0FGl7C PDlPo9YIppa9Vb6R9YvDAZGcpL5inaRKWxe1/7p4PBevXMrShONNNf9m+Y15Gwgg9KTz oAVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jr40F9vIhXN24Z2eK9R5w/EFRpttBsVu/dvj/G/e+nM=; b=V5pOmqRRPIwddx0EIpKCFbnKWll72Uof4Y41JY64h4K+65mQzEUJ12GqeiveAD6esI TZoU+VtLwA2NlR+aeQ2SeLJN9xEroGjXDwkSXrPFP2nkQN1Zioq1G0sjql4j2ThosWHN CB+iNC+Ww1R/joKTxe7dSbnUYGFJZMLGqQSB7D1F3sdWMiqOkuZ5tAUy6rYf0yIR8PKW uYON3z0owuW6EtpcaEZ8hHylZ8sxGU5LEp3K5G5eKEtMnNUgJZIz//nNcCmXuKItwg/r QUWAp3z5tXxmh9H8oZcDzQwUT/Djk6zilYnGUdfJnKWIEVFgyI85E0CMNCQY4M9M06tl CZDQ== X-Gm-Message-State: AFqh2koNhHsrk4LPPGrAfwYjjjcUZmN5hcrbSJAWQNfgr7nQ4flL2KlQ 7GKQP/4WZ4IHojy0GX5TdcMYfA== X-Google-Smtp-Source: AMrXdXvWokvDhThSR8hMIA5+ghSnhLg0II823WrXtCxO40CIZSX0V8WYK+uXgS4g01y+n+bVoa2Www== X-Received: by 2002:a17:90a:dd90:b0:228:e263:f873 with SMTP id l16-20020a17090add9000b00228e263f873mr6124698pjv.44.1673517575053; Thu, 12 Jan 2023 01:59:35 -0800 (PST) From: Akihiko Odaki To: Cc: Akihiko Odaki , Jason Wang , Dmitry Fleytman , "Michael S. Tsirkin" , Marcel Apfelbaum , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , Alexander Bulekov , Bandan Das , Stefan Hajnoczi , Darren Kenny , Qiuhao Li , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, devel@daynix.com, Yan Vugenfirer , Yuri Benditovich , Sriram Yagnaraman , Gal Hammer Subject: [PATCH 20/31] pcie: Introduce pcie_sriov_num_vfs Date: Thu, 12 Jan 2023 18:57:32 +0900 Message-Id: <20230112095743.20123-21-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112095743.20123-1-akihiko.odaki@daynix.com> References: <20230112095743.20123-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::634; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1673518502628100001 Content-Type: text/plain; charset="utf-8" igb can use this function to change its behavior depending on the number of virtual functions currently enabled. Signed-off-by: Gal Hammer Signed-off-by: Marcel Apfelbaum Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci/pcie_sriov.c | 5 +++++ include/hw/pci/pcie_sriov.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 8e3faf1f59..5796654b98 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -300,3 +300,8 @@ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, i= nt n) } return NULL; } + +uint16_t pcie_sriov_num_vfs(PCIDevice *dev) +{ + return dev->exp.sriov_pf.num_vfs; +} diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 80f5c84e75..072a583405 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -74,4 +74,7 @@ PCIDevice *pcie_sriov_get_pf(PCIDevice *dev); */ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n); =20 +/* Returns the current number of virtual functions. */ +uint16_t pcie_sriov_num_vfs(PCIDevice *dev); + #endif /* QEMU_PCIE_SRIOV_H */ --=20 2.39.0