From nobody Tue May 13 20:49: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=1675225629; cv=none; d=zohomail.com; s=zohoarc; b=csStKKo63e1pcmPaM/qsEsACa035anbzXRNbo/iFdy8jk2yrnvaKAuM5A+EEuFsnX5X6lMegyP1IvadftpHwlBBr0RFCPaW0oTijyXQLD8ttRRD19etuwXkkFZY/f/E4B5dXCAbGAunVd/OUmWD5qvDAVEHEP0F34C3/b16X93A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675225629; h=Content-Type: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=01IaAKVWRL/Qzj7PsK1Wm+ssRudRuXKs5C9WWrNwR/o=; b=RglzKcl3Dhf9zQJqEGS/RYfW55cgBiTUGlh/j22tGEicDDpZqFmXPRQFD9GKr400jm7ytNCPO+euXUHGUILQeB/ZPzQkvlpbzW5aXfkc3YPsc7oSgtsyT661PyNSoPMAD4CHjS3v7Lq1HRpFD9MVrlJIiIn6Ev/Bfavd15Ou3gE= 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 SMTPS id 1675225629954927.6056907572505; Tue, 31 Jan 2023 20:27:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pN4hh-0003am-5w; Tue, 31 Jan 2023 23:26:37 -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 1pN4hg-0003aJ-64 for qemu-devel@nongnu.org; Tue, 31 Jan 2023 23:26:36 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pN4he-0003Kn-NS for qemu-devel@nongnu.org; Tue, 31 Jan 2023 23:26:35 -0500 Received: by mail-pl1-x635.google.com with SMTP id b5so10010475plz.5 for ; Tue, 31 Jan 2023 20:26:34 -0800 (PST) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:4457:c267:5e09:481b]) by smtp.gmail.com with ESMTPSA id c62-20020a624e41000000b0058bb0fb6295sm9235316pfb.26.2023.01.31.20.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 20:26:33 -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=01IaAKVWRL/Qzj7PsK1Wm+ssRudRuXKs5C9WWrNwR/o=; b=FeucdJls4j9YeuF/yAJO1lONgGNyvJBszC4X/s0c9+w+tzo1OmVdv/QsSIlrAbgfTI E9n0cIRInUhUSEYKJVgPCMakaj7nI2hSzLYC5zDpDm9oGYsjhKHMG3C1MB1vsF1dDCer SGLbwkNPwWeC2vS6qzx7P0wa0fLTwv1eKZwm1AUM5SYLNYn307HYJx+7aCDa2wBAaOM5 Q69Yq1yiIKld96bVLiT/IM0n8e6Q3TPPP3bl2z2i4D74GThIvEjUdFHFXVzEirXPThmd RLbEs2W0OIhWyfTc7p2aUm2HLr4Fbua8QxnyIbuyJfbSxCEcz8iQieHdmLgyZCW/TL6+ PgnQ== 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=01IaAKVWRL/Qzj7PsK1Wm+ssRudRuXKs5C9WWrNwR/o=; b=mKbp5fjtgltZ0NTFWWfY0Qmgeb1ti7r9xalmHtNA1/nGgvccSWzp+vYpXiD+A8z8Sv WvjAY6C49lII9pfx9/NuGikXi5wZ52dmM2XTTqN6of2sXnKWsYCTREcqy1uWh9AkpejH XqH6+zKq+nFpcyK/X5HGUPklj0LfxLjIb99p9T8LBIBQZDIFVuMyW7om/mwjZ2CXSKOo dvsHNleE1Czsf0PC90Xw7xA2rHNq/i1tczO0A+3fjpLT8l16Cx9BJwq3u+Xu3ViRhzuZ 52daMRo5/gFTfgehdpE6VQFi/vwn7WxKbgx0vi8BKAqzS9p5QZsgwpo9f7M9/0JGYy96 OlvQ== X-Gm-Message-State: AO0yUKVzsYt1mObK236SZNxJ2fbb28juB/BwIckOaI+8ZZBIlsSFlmOc RTPuvCpBYjyt3DH+XH9vp+fXfQ== X-Google-Smtp-Source: AK7set9D9KLwEA73e+L6rwJwhaWUdeaLKu1UHi/gJm9r6fhcoSlmtLOePMT1crGxpexlZuAx56RyCA== X-Received: by 2002:a17:902:cf51:b0:198:9e29:cc64 with SMTP id e17-20020a170902cf5100b001989e29cc64mr990480plg.66.1675225593430; Tue, 31 Jan 2023 20:26:33 -0800 (PST) From: Akihiko Odaki To: Cc: 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 , Akihiko Odaki Subject: [PATCH v7 2/9] pcie: Introduce pcie_sriov_num_vfs Date: Wed, 1 Feb 2023 13:26:08 +0900 Message-Id: <20230201042615.34706-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201042615.34706-1-akihiko.odaki@daynix.com> References: <20230201042615.34706-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.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: 1675225631738100007 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 f0bd72e069..aa5a757b11 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 96cc743309..095fb0c9ed 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -76,4 +76,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.1