From nobody Wed Sep 23 04:45:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1780585721; cv=none; d=zohomail.com; s=zohoarc; b=FcDJQQt45OQqDl3n4bRIn4a9OO8FHiXAb/quoDvHhFtVrE63RVdcLE+bJl8bYGzzhS0JpwBFd7i9ycCbK39oaUTmGTp7s/hi9t/KpVw8P4QOe+N9ghn0neNyS+mbFGPmPf8KNBGnyl3l6UENmiWWJVXNohb3dc+E/khKqxK9/ao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780585721; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4avmxi/DteAkFA5/0YsT4Z/7bVnyoihvSIvhh9yQxIo=; b=i+aSmrIJIsIiJE+f2Yv90gd+/8TDdbhGaiPXViodL3peCpgUEvFVLDbs5OdHAe8+XuWliqZlXqhhGUjNxpYnKammLMDaBoXoIP8D8qdOtmi34Mz4BOOW5qmOOIUkUGEozntBHv21EbiHao2QqUWyFeUfB2UkiwutkhYRT6Tdv5o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1780585721861341.5706998236444; Thu, 4 Jun 2026 08:08:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1328024.1592700 (Exim 4.92) (envelope-from ) id 1wV9gB-0005FL-BE; Thu, 04 Jun 2026 15:08:19 +0000 Received: by outflank-mailman (output) from mailman id 1328024.1592700; Thu, 04 Jun 2026 15:08:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wV9gB-0005C8-65; Thu, 04 Jun 2026 15:08:19 +0000 Received: by outflank-mailman (input) for mailman id 1328024; Thu, 04 Jun 2026 15:02:05 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wV9a9-00044l-Ki for xen-devel@lists.xenproject.org; Thu, 04 Jun 2026 15:02:05 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wV9a9-006uM5-17 for xen-devel@lists.xenproject.org; Thu, 04 Jun 2026 17:02:05 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a219363-e002-0a2a0a5209dd-0a2a4506817e-36 for ; Thu, 04 Jun 2026 17:02:04 +0200 Received: from [209.85.214.172] (helo=mail-pl1-f172.google.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a21936b-7371-0a2a45060019-d155d6acf1c7-3 for ; Thu, 04 Jun 2026 17:02:04 +0200 Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2bf20f6be6bso6277965ad.3 for ; Thu, 04 Jun 2026 08:02:04 -0700 (PDT) Received: from localhost ([2a03:2880:7ff:55::]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c164f6e2adsm67111415ad.5.2026.06.04.08.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 08:02:00 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780585323; x=1781190123; darn=lists.xenproject.org; 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=4avmxi/DteAkFA5/0YsT4Z/7bVnyoihvSIvhh9yQxIo=; b=cE6Bedm2o6seYAG5XfrBq3hH2snEQqxY5cfDfRjqIxyrPSLqLgmKjcEUy/x9sLUqAM LsWaXQ6cDb+TF9yyWzNPd/MI9S4seCHOAt+8T4z3g8PWoHTZekfFwGKT3W+wW9pQNbnu 4ByelU2pisFovSvX22e/h1vkQJxE5aGhOCfBsrO+M3g/e7mHUYK0ywKNXBYQpzISZ489 rCfXkSE7030eRHZrTXbvDe0lFrpv1whRtu81ycaO7nDsSWJhyFhW4vsNCW+VOjjnNGB7 AzMCrr7mOXu2oP0xwvNuxPOdjMB614DpRrYBRgxFXsHX0etwy3zo9g7ZBFSB1gCtQDcF C7jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780585323; x=1781190123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4avmxi/DteAkFA5/0YsT4Z/7bVnyoihvSIvhh9yQxIo=; b=ZmteGknRbopsMuOFpF3wutaMh45HiZmk6wZq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2b4:59bf:5728 with SMTP id d9443c01a7336-2c1644ca7bfmr89624145ad.25.1780585321320; Thu, 04 Jun 2026 08:02:01 -0700 (PDT) From: Dimitri Daskalakis To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Mahesh J Salgaonkar , Oliver O'Halloran , Niklas Schnelle , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alex Williamson , Jason Gunthorpe , Kevin Tian , Ankit Agrawal , Leon Romanovsky , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Keith Busch , Alexander Duyck , Jakub Kicinski , Dimitri Daskalakis , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [RFC 04/12] PCI: Convert arch/powerpc to pci_is_sriov_* helpers Date: Thu, 4 Jun 2026 08:01:45 -0700 Message-ID: <20260604150153.3619662-5-dimitri.daskalakis1@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com> References: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-16d1c6/1780585324-8D584D75-705C585F/0/0 X-purgate-type: clean X-purgate-size: 7215 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1780585723081154100 Content-Type: text/plain; charset="utf-8" From: Dimitri Daskalakis Convert SR-IOV-specific is_physfn / is_virtfn reads in the PowerPC PCI code to use pci_is_sriov_physfn() / pci_is_sriov_virtfn(). These call sites are all SR-IOV-specific: they guard SR-IOV state dereferences, VF PE management, or sit inside #ifdef CONFIG_PCI_IOV blocks. Converting them keeps SR-IOV semantics intact once is_physfn and is_virtfn widen to cover any virtualization type. Files touched: arch/powerpc/kernel/pci_dn.c arch/powerpc/platforms/powernv/pci-ioda.c arch/powerpc/platforms/powernv/pci-sriov.c arch/powerpc/platforms/pseries/eeh_pseries.c arch/powerpc/platforms/pseries/setup.c No functional changes. Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Dimitri Daskalakis --- arch/powerpc/kernel/pci_dn.c | 4 ++-- arch/powerpc/platforms/powernv/pci-ioda.c | 6 +++--- arch/powerpc/platforms/powernv/pci-sriov.c | 10 +++++----- arch/powerpc/platforms/pseries/eeh_pseries.c | 8 ++++---- arch/powerpc/platforms/pseries/setup.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index a7b664befed2..cf44ec368a36 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -176,7 +176,7 @@ struct pci_dn *add_sriov_vf_pdns(struct pci_dev *pdev) int i; =20 /* Only support IOV for now */ - if (WARN_ON(!pdev->is_physfn)) + if (WARN_ON(!pci_is_sriov_physfn(pdev))) return NULL; =20 /* Check if VFs have been populated */ @@ -221,7 +221,7 @@ void remove_sriov_vf_pdns(struct pci_dev *pdev) int i; =20 /* Only support IOV PF for now */ - if (WARN_ON(!pdev->is_physfn)) + if (WARN_ON(!pci_is_sriov_physfn(pdev))) return; =20 /* Check if VFs have been populated */ diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platf= orms/powernv/pci-ioda.c index 32ecbc46e74b..63eacc8001fe 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -987,7 +987,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pci_dev *= pdev) pe =3D pnv_pci_bdfn_to_pe(phb, pci_dev_id(pdev)); if (!pe) { /* VF PEs should be pre-configured in pnv_pci_sriov_enable() */ - if (WARN_ON(pdev->is_virtfn)) + if (WARN_ON(pci_is_sriov_virtfn(pdev))) return; =20 pnv_pci_configure_bus(pdev->bus); @@ -2379,7 +2379,7 @@ static void pnv_pci_release_device(struct pci_dev *pd= ev) struct pnv_ioda_pe *pe; =20 /* The VF PE state is torn down when sriov_disable() is called */ - if (pdev->is_virtfn) + if (pci_is_sriov_virtfn(pdev)) return; =20 if (!pdn || pdn->pe_number =3D=3D IODA_INVALID_PE) @@ -2391,7 +2391,7 @@ static void pnv_pci_release_device(struct pci_dev *pd= ev) * the iov state at probe time since we need to fiddle with the IOV * resources. */ - if (pdev->is_physfn) + if (pci_is_sriov_physfn(pdev)) kfree(pdev->dev.archdata.iov_data); #endif =20 diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/plat= forms/powernv/pci-sriov.c index 7105a573aec4..1113488f4372 100644 --- a/arch/powerpc/platforms/powernv/pci-sriov.c +++ b/arch/powerpc/platforms/powernv/pci-sriov.c @@ -225,7 +225,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci= _dev *pdev) =20 void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev) { - if (pdev->is_virtfn) { + if (pci_is_sriov_virtfn(pdev)) { struct pnv_ioda_pe *pe =3D pnv_ioda_get_pe(pdev); =20 /* @@ -235,7 +235,7 @@ void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev) */ pe->pdev =3D pdev; WARN_ON(!(pe->flags & PNV_IODA_PE_VF)); - } else if (pdev->is_physfn) { + } else if (pci_is_sriov_physfn(pdev)) { /* * For PFs adjust their allocated IOV resources to match what * the PHB can support using its M64 BAR table. @@ -479,7 +479,7 @@ static void pnv_ioda_release_vf_PE(struct pci_dev *pdev) =20 phb =3D pci_bus_to_pnvhb(pdev->bus); =20 - if (!pdev->is_physfn) + if (!pci_is_sriov_physfn(pdev)) return; =20 /* FIXME: Use pnv_ioda_release_pe()? */ @@ -508,7 +508,7 @@ static int pnv_pci_vf_resource_shift(struct pci_dev *de= v, int offset) u16 num_vfs; int i; =20 - if (!dev->is_physfn) + if (!pci_is_sriov_physfn(dev)) return -EINVAL; iov =3D pnv_iov_get(dev); =20 @@ -620,7 +620,7 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, = u16 num_vfs) struct pnv_iov_data *iov; struct pci_dn *pdn; =20 - if (!pdev->is_physfn) + if (!pci_is_sriov_physfn(pdev)) return; =20 phb =3D pci_bus_to_pnvhb(pdev->bus); diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/pl= atforms/pseries/eeh_pseries.c index b12ef382fec7..32030ac9be51 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -54,7 +54,7 @@ static void pseries_pcibios_bus_add_device(struct pci_dev= *pdev) =20 dev_dbg(&pdev->dev, "EEH: Setting up device\n"); #ifdef CONFIG_PCI_IOV - if (pdev->is_virtfn) { + if (pci_is_sriov_virtfn(pdev)) { pdn->device_id =3D pdev->device; pdn->vendor_id =3D pdev->vendor; pdn->class_code =3D pdev->class; @@ -68,7 +68,7 @@ static void pseries_pcibios_bus_add_device(struct pci_dev= *pdev) #endif pseries_eeh_init_edev(pdn); #ifdef CONFIG_PCI_IOV - if (pdev->is_virtfn) { + if (pci_is_sriov_virtfn(pdev)) { /* * FIXME: This really should be handled by choosing the right * parent PE in pseries_eeh_init_edev(). @@ -731,7 +731,7 @@ static int pseries_call_allow_unfreeze(struct eeh_dev *= edev) if (!vf_pe_array) return -ENOMEM; if (pci_num_vf(edev->physfn ? edev->physfn : edev->pdev)) { - if (edev->pdev->is_physfn) { + if (pci_is_sriov_physfn(edev->pdev)) { cur_vfs =3D pci_num_vf(edev->pdev); pdn =3D eeh_dev_to_pdn(edev); parent =3D pdn->parent; @@ -779,7 +779,7 @@ static int pseries_notify_resume(struct eeh_dev *edev) if (rtas_function_token(RTAS_FN_IBM_OPEN_SRIOV_ALLOW_UNFREEZE) =3D=3D RTA= S_UNKNOWN_SERVICE) return -EINVAL; =20 - if (edev->pdev->is_physfn || edev->pdev->is_virtfn) + if (pci_is_sriov_physfn(edev->pdev) || pci_is_sriov_virtfn(edev->pdev)) return pseries_call_allow_unfreeze(edev); =20 return 0; diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platform= s/pseries/setup.c index 50b26ed8432d..8165ae9adbd6 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -778,7 +778,7 @@ static void pseries_pci_fixup_iov_resources(struct pci_= dev *pdev) const int *indexes; struct device_node *dn =3D pci_device_to_OF_node(pdev); =20 - if (!pdev->is_physfn) + if (!pci_is_sriov_physfn(pdev)) return; /*Firmware must support open sriov otherwise don't configure*/ indexes =3D of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL); @@ -799,7 +799,7 @@ static resource_size_t pseries_pci_iov_resource_alignme= nt(struct pci_dev *pdev, if (!reg) return pci_iov_resource_size(pdev, resno); =20 - if (!pdev->is_physfn) + if (!pci_is_sriov_physfn(pdev)) return 0; return pseries_get_iov_fw_value(pdev, resno - PCI_IOV_RESOURCES, --=20 2.52.0