* Re: [PATCH 20/23] usb: chipidea: use platform_device_set_of_node_from_dev()
From: Andy Shevchenko @ 2026-06-05 7:31 UTC (permalink / raw)
To: Peter Chen (CIX)
Cc: Bartosz Golaszewski, Lee Jones, Mark Brown, Thierry Reding,
Sebastian Hesselbarth, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Srinivas Kandagatla,
Greg Kroah-Hartman, Vinod Koul, Rafael J. Wysocki,
Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Joerg Roedel,
Will Deacon, Robin Murphy, Doug Berger, Florian Fainelli,
Broadcom internal kernel review list, Ulf Hansson, Frank Li,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Matthew Brost, Thomas Hellström, Rodrigo Vivi, David Airlie,
Simona Vetter, Paul Cercueil, Bin Liu, Philipp Zabel,
Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt, linux-kernel, netdev,
linux-arm-msm, linux-sound, driver-core, devicetree, linuxppc-dev,
linux-i2c, iommu, linux-pm, imx, linux-arm-kernel, intel-xe,
dri-devel, linux-usb, linux-mips, platform-driver-x86,
Bartosz Golaszewski
In-Reply-To: <aiJz6Ys4gE998ULp@nchen-desktop>
On Fri, Jun 05, 2026 at 02:59:53PM +0800, Peter Chen (CIX) wrote:
> On 26-06-04 08:34:16, Bartosz Golaszewski wrote:
> > On Tue, 2 Jun 2026 23:49:29 +0200, Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> said:
> > > On Thu, May 21, 2026 at 10:36:43AM +0200, Bartosz Golaszewski wrote:
...
> > >> pdev->dev.parent = dev;
> > >> - device_set_of_node_from_dev(&pdev->dev, dev);
> > >> + platform_device_set_of_node_from_dev(pdev, dev);
> > >
> > > Why do they even do that? Do they have a USB connected pin control?
> >
> > I don't know. I can't test it so I don't want to break it. If they don't need
> > it, the person who can test it, can remove it later.
>
> It was introduced by below commits:
>
> commit 0f153a1b8193ce768be4df0400aeb2c8f2a3b3da
> Author: Rob Herring <robh@kernel.org>
> Date: Wed Dec 15 16:56:46 2021 -0600
>
> usb: chipidea: Set the DT node on the child device
>
> The ChipIdea glue drivers just copy the glue resources to the "ci_hdrc"
> child device. Instead, set the child device's DT node pointer to the
> parent device's node so that platform_get_irq() can find the IRQ
> resources in the DT. This removes the need for statically populating the
> IRQ resources from the DT which has been deprecated for some time.
This doesn't explain why the node marked as reused. device_set_node() fits
the above description. Rob?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v3 1/6] scsi: core: Remove remaining reference to the pktcdvd driver
From: Geert Uytterhoeven @ 2026-06-05 7:30 UTC (permalink / raw)
To: Bart Van Assche
Cc: Catalin Iacob, Thomas Bogendoerfer, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Rich Felker, John Paul Adrian Glaubitz, David S. Miller,
Andreas Larsson, James E.J. Bottomley, Martin K. Petersen,
Jens Axboe, Yoshinori Sato, linux-mips, linux-kernel,
linuxppc-dev, linux-sh, sparclinux, linux-scsi
In-Reply-To: <88d9bb41-e51d-4b71-a6d9-f1b79eccd496@acm.org>
Hoi Bart,
On Thu, 4 Jun 2026 at 18:01, Bart Van Assche <bvanassche@acm.org> wrote:
> On 6/4/26 6:20 AM, Catalin Iacob wrote:
> > Commit 1cea5180f2f8 ("block: remove pktcdvd driver") left behind an
> > export that is now dead code. Remove it.
> The subject should say something like "Unexport
> scsi_device_from_queue()".
<pedantic>
But that is not what it does: the symbol is never exported, as
CONFIG_CDROM_PKTCDVD_MODULE can never be set?
</pedantic>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode
From: Vaibhav Jain @ 2026-06-05 7:30 UTC (permalink / raw)
To: Amit Machhiwal, linuxppc-dev, Madhavan Srinivasan
Cc: Amit Machhiwal, Harsh Prateek Bora, Ritesh Harjani,
Anushree Mathur, Nicholas Piggin, Michael Ellerman,
Christophe Leroy (CS GROUP), kvm, stable, linux-kernel
In-Reply-To: <20260603141539.47620-1-amachhiw@linux.ibm.com>
Amit Machhiwal <amachhiw@linux.ibm.com> writes:
> On IBM POWER systems, newer processor generations can operate in
> compatibility modes corresponding to earlier generations. This becomes
> relevant for nested virtualization, where nested KVM guests may need to
> run with a specific processor compatibility level.
>
> Currently, when running a nested KVM guest (L2) inside a Power11 pSeries
> logical partition (L1) booted in Power10 compatibility mode, the guest
> fails to boot while setting 'arch_compat'. This happens because the CPU
> class is derived from the hardware PVR (via mfspr()), which reflects the
> physical processor generation (Power11), rather than the effective
> compatibility mode (Power10).
>
> As a result, userspace may request a Power11 arch_compat for the L2
> guest. However, the L1 partition, running in Power10 compatibility, has
> only negotiated support up to Power10 with the Power Hypervisor (L0).
> When H_GUEST_SET_STATE is invoked with a Power11 Logical PVR, the
> hypervisor rejects the request, leading to a late guest boot failure:
>
> KVM-NESTEDv2: couldn't set guest wide elements
> [..KVM reg dump..]
>
> This situation should be detected earlier. Rejecting unsupported
> 'arch_compat' values in 'kvmppc_set_arch_compat()' avoids issuing an
> invalid H_GUEST_SET_STATE hcall and provides a clearer failure mode.
>
> Add a check to reject Power11 'arch_compat' requests when the host is
> running in Power10 compatibility mode, returning -EINVAL early instead
> of deferring the failure to the hypervisor.
>
> Suggested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>
> Cc: <stable@vger.kernel.org> # v6.13+
> Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Thanks, this LGTM
Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
--
Cheers
~ Vaibhav
^ permalink raw reply
* Re: [PATCH] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode
From: Vaibhav Jain @ 2026-06-05 7:25 UTC (permalink / raw)
To: Gautam Menghani, Amit Machhiwal
Cc: linuxppc-dev, Madhavan Srinivasan, Harsh Prateek Bora,
Ritesh Harjani, Anushree Mathur, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP), kvm, stable,
linux-kernel
In-Reply-To: <aiGJvUqgjUo6M5et@mac.bl1-in.ibm.com>
Hi Gautam,
Thanks for testing this patch. Few questions:
Gautam Menghani <gautam@linux.ibm.com> writes:
> On Wed, Jun 03, 2026 at 07:45:39PM +0530, Amit Machhiwal wrote:
>> On IBM POWER systems, newer processor generations can operate in
>> compatibility modes corresponding to earlier generations. This becomes
>> relevant for nested virtualization, where nested KVM guests may need to
>> run with a specific processor compatibility level.
>>
<snip>
>
> I booted a KVM guest on LPAR with this patch in the following scenarios:
<snip>
> 3. P11 guest on P11 host booted in P10 compat mode: No error observed
This should have resulted in an error since booting a P11 guest on P10
compat mode host is not allowed with/without this patch. Can you please
check your test env and share the boot results.
>
> Tested-by: Gautam Menghani <gautam@linux.ibm.com>
--
Cheers
~ Vaibhav
^ permalink raw reply
* [PATCH] perf scripts: Add configurable sorting option to powerpc-hcalls
From: Shivani Nittor @ 2026-06-05 6:27 UTC (permalink / raw)
To: acme, jolsa, adrian.hunter, mpetlan, tmricht, maddy, irogers,
namhyung, ravi.bangoria
Cc: linux-perf-users, linuxppc-dev, atrajeev, hbathini, Tejas.Manhas1,
Tanushree.Shah, shivani
The powerpc-hcalls.py script currently prints hypercall
statistics in a fixed sort order based on the number of
hcall occurrences, making it difficult to analyze hcalls
from different execution characteristics.
Add support for runtime-configurable sorting so users
can order hypercall statistics by count, minimum
latency, maximum latency, or average latency using
a --sort option.
Parse arguments through sys.argv to support perf script
argument passing semantics.
Example:
perf record -a -e powerpc* sleep 10
perf script -s ./powerpc-hcalls.py -i ./perf.data -- --sort=max
SORT KEY = max
hcall count min(ns) max(ns) avg(ns)
H_SEND_LOGICAL_LAN 47 7380 40148 8739
H_VIO_SIGNAL 706 880 17454 1911
H_RANDOM 1 15176 15176 15176
H_PUT_TCE_INDIRECT 4 3032 10444 4956
H_ADD_LOGICAL_LAN_BUFFER 363 1250 8716 1534
H_SEND_CRQ 8 2086 6846 3044
H_PUT_TCE 9 1284 4932 2646
H_STUFF_TCE 13 1620 3962 2358
This makes it easier to identify frequently occurring
or high-latency hypercalls depending on the analysis
being performed.
Signed-off-by: Shivani Nittor <shivani@linux.ibm.com>
---
tools/perf/scripts/python/powerpc-hcalls.py | 35 ++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/tools/perf/scripts/python/powerpc-hcalls.py b/tools/perf/scripts/python/powerpc-hcalls.py
index 8b78dc790adb..df7b83ab0b6e 100644
--- a/tools/perf/scripts/python/powerpc-hcalls.py
+++ b/tools/perf/scripts/python/powerpc-hcalls.py
@@ -25,6 +25,7 @@ from Util import *
# } ...
# }
output = {}
+sort_key = 'count'
# d_enter: {
# cpu: {
@@ -158,10 +159,42 @@ def hcall_table_lookup(opcode):
print_ptrn = '%-28s%10s%10s%10s%10s'
+def sort_output(opcode):
+ stats = output[opcode]
+
+ if sort_key == 'min':
+ return stats['min']
+ if sort_key == 'max':
+ return stats['max']
+ if sort_key == 'avg':
+ return stats['time'] // stats['cnt']
+
+ return stats['cnt']
+
+def trace_begin():
+ global sort_key
+
+ i = 1
+ while i < len(sys.argv):
+ arg = sys.argv[i]
+
+ if arg == '-s' or arg == '--sort':
+ sort_key = sys.argv[i + 1]
+ i += 2
+ continue
+
+ if arg.startswith('--sort='):
+ sort_key = arg.split('=', 1)[1]
+
+ i += 1
+
+ print("SORT KEY =", sort_key)
+
def trace_end():
print(print_ptrn % ('hcall', 'count', 'min(ns)', 'max(ns)', 'avg(ns)'))
print('-' * 68)
- for opcode in output:
+ for opcode in sorted(output, key = sort_output,
+ reverse=True):
h_name = hcall_table_lookup(opcode)
time = output[opcode]['time']
cnt = output[opcode]['cnt']
--
2.53.0
^ permalink raw reply related
* Re: [PATCH v2 1/2] perf script powerpc: Update the hcall list with new hcalls
From: Shivani Nittor @ 2026-06-05 6:06 UTC (permalink / raw)
To: Gautam Menghani
Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, james.clark, atrajeev,
Gautam Menghani, linux-perf-users, linux-kernel, linuxppc-dev
In-Reply-To: <20260602115644.8133-1-Gautam.Menghani@ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4866 bytes --]
> On 2 Jun 2026, at 17:26, Gautam Menghani <Gautam.Menghani@ibm.com> wrote:
>
> From: Gautam Menghani <gautam@linux.ibm.com>
>
> Update the hcall list with the newer hcalls in PPC.
>
> [1]: github.com/torvalds/linux/blob/master/arch/powerpc/include/asm/hvcall.h
>
> Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
> ---
> v1 -> v2:
> 1. Add some of the missing hcalls. (Tejas)
> 2. Separate out the typo fix for H_DISABLE_AND_GET in another patch.
Changes looks fine to me. I have checked the names and hcall numbers in hvcall.h header file.
Reviewed-by: Shivani Nittor <shivani@linux.ibm.com <mailto:shivani@linux.ibm.com>>
> tools/perf/scripts/python/powerpc-hcalls.py | 89 +++++++++++++++++++++
> 1 file changed, 89 insertions(+)
>
> diff --git a/tools/perf/scripts/python/powerpc-hcalls.py b/tools/perf/scripts/python/powerpc-hcalls.py
> index 8b78dc790adb..f897d6a5e051 100644
> --- a/tools/perf/scripts/python/powerpc-hcalls.py
> +++ b/tools/perf/scripts/python/powerpc-hcalls.py
> @@ -117,10 +117,12 @@ hcall_table = {
> 440: 'H_GET_HCA_INFO',
> 444: 'H_GET_PERF_COUNT',
> 448: 'H_MANAGE_TRACE',
> + 456: 'H_GET_CPU_CHARACTERISTICS',
> 468: 'H_FREE_LOGICAL_LAN_BUFFER',
> 472: 'H_POLL_PENDING',
> 484: 'H_QUERY_INT_STATE',
> 580: 'H_ILLAN_ATTRIBUTES',
> + 584: 'H_ADD_LOGICAL_LAN_BUFFERS',
> 592: 'H_MODIFY_HEA_QP',
> 596: 'H_QUERY_HEA_QP',
> 600: 'H_QUERY_HEA',
> @@ -135,11 +137,17 @@ hcall_table = {
> 644: 'H_ADD_CONN',
> 648: 'H_DEL_CONN',
> 664: 'H_JOIN',
> + 672: 'H_VASI_SIGNAL',
> 676: 'H_VASI_STATE',
> + 680: 'H_VIOCTL',
> 688: 'H_ENABLE_CRQ',
> 696: 'H_GET_EM_PARMS',
> 720: 'H_SET_MPP',
> 724: 'H_GET_MPP',
> + 732: 'H_REG_SUB_CRQ',
> + 736: 'H_FREE_SUB_CRQ',
> + 740: 'H_SEND_SUB_CRQ',
> + 744: 'H_SEND_SUB_CRQ_INDIRECT',
> 748: 'H_HOME_NODE_ASSOCIATIVITY',
> 756: 'H_BEST_ENERGY',
> 764: 'H_XIRR_X',
> @@ -147,7 +155,88 @@ hcall_table = {
> 772: 'H_COP',
> 788: 'H_GET_MPP_X',
> 796: 'H_SET_MODE',
> + 808: 'H_BLOCK_REMOVE',
> + 856: 'H_CLEAR_HPT',
> + 864: 'H_REQUEST_VMC',
> + 876: 'H_RESIZE_HPT_PREPARE',
> + 880: 'H_RESIZE_HPT_COMMIT',
> + 892: 'H_REGISTER_PROC_TBL',
> + 896: 'H_SIGNAL_SYS_RESET',
> + 904: 'H_ALLOCATE_VAS_WINDOW',
> + 908: 'H_MODIFY_VAS_WINDOW',
> + 912: 'H_DEALLOCATE_VAS_WINDOW',
> + 916: 'H_QUERY_VAS_WINDOW',
> + 920: 'H_QUERY_VAS_CAPABILITIES',
> + 924: 'H_QUERY_NX_CAPABILITIES',
> + 928: 'H_GET_NX_FAULT',
> + 936: 'H_INT_GET_SOURCE_INFO',
> + 940: 'H_INT_SET_SOURCE_CONFIG',
> + 944: 'H_INT_GET_SOURCE_CONFIG',
> + 948: 'H_INT_GET_QUEUE_INFO',
> + 952: 'H_INT_SET_QUEUE_CONFIG',
> + 956: 'H_INT_GET_QUEUE_CONFIG',
> + 960: 'H_INT_SET_OS_REPORTING_LINE',
> + 964: 'H_INT_GET_OS_REPORTING_LINE',
> + 968: 'H_INT_ESB',
> + 972: 'H_INT_SYNC',
> + 976: 'H_INT_RESET',
> + 996: 'H_SCM_READ_METADATA',
> + 1000: 'H_SCM_WRITE_METADATA',
> + 1004: 'H_SCM_BIND_MEM',
> + 1008: 'H_SCM_UNBIND_MEM',
> + 1012: 'H_SCM_QUERY_BLOCK_MEM_BINDING',
> + 1016: 'H_SCM_QUERY_LOGICAL_MEM_BINDING',
> + 1020: 'H_SCM_UNBIND_ALL',
> + 1024: 'H_SCM_HEALTH',
> + 1048: 'H_SCM_PERFORMANCE_STATS',
> + 1052: 'H_PKS_GET_CONFIG',
> + 1056: 'H_PKS_SET_PASSWORD',
> + 1060: 'H_PKS_GEN_PASSWORD',
> + 1068: 'H_PKS_WRITE_OBJECT',
> + 1072: 'H_PKS_GEN_KEY',
> + 1076: 'H_PKS_READ_OBJECT',
> + 1080: 'H_PKS_REMOVE_OBJECT',
> + 1084: 'H_PKS_CONFIRM_OBJECT_FLUSHED',
> + 1096: 'H_RPT_INVALIDATE',
> + 1100: 'H_SCM_FLUSH',
> + 1104: 'H_GET_ENERGY_SCALE_INFO',
> + 1108: 'H_PKS_SIGNED_UPDATE',
> + 1112: 'H_HTM',
> + 1116: 'H_WATCHDOG',
> + # Platform specific hcalls used by KVM on PowerVM
> + 1120: 'H_GUEST_GET_CAPABILITIES',
> + 1124: 'H_GUEST_SET_CAPABILITIES',
> + 1136: 'H_GUEST_CREATE',
> + 1140: 'H_GUEST_CREATE_VCPU',
> + 1144: 'H_GUEST_GET_STATE',
> + 1148: 'H_GUEST_SET_STATE',
> + 1152: 'H_GUEST_RUN_VCPU',
> + 1156: 'H_GUEST_COPY_MEMORY',
> + 1160: 'H_GUEST_DELETE',
> + # Key wrapping hcalls
> + 1168: 'H_PKS_WRAP_OBJECT',
> + 1172: 'H_PKS_UNWRAP_OBJECT',
> + # Platform-specific hcalls used by the Ultravisor
> + 61184: 'H_SVM_PAGE_IN',
> + 61188: 'H_SVM_PAGE_OUT',
> + 61192: 'H_SVM_INIT_START',
> + 61196: 'H_SVM_INIT_DONE',
> + 61204: 'H_SVM_INIT_ABORT',
> + # Platform specific hcalls used by KVM
> 61440: 'H_RTAS',
> + # Platform specific hcalls used by QEMU/SLOF
> + 61441: 'H_LOGICAL_MEMOP',
> + 61442: 'H_CAS',
> + 61443: 'H_UPDATE_DT',
> + # Platform specific hcalls provided by PHYP
> + 61560: 'H_GET_24X7_CATALOG_PAGE',
> + 61564: 'H_GET_24X7_DATA',
> + 61568: 'H_GET_PERF_COUNTER_INFO',
> + # Platform-specific hcalls used for nested HV KVM
> + 63488: 'H_SET_PARTITION_TABLE',
> + 63492: 'H_ENTER_NESTED',
> + 63496: 'H_TLB_INVALIDATE',
> + 63500: 'H_COPY_TOFROM_GUEST',
> }
>
> def hcall_table_lookup(opcode):
> --
> 2.53.0
>
>
[-- Attachment #2: Type: text/html, Size: 12265 bytes --]
^ permalink raw reply
* [PATCH v2 3/3] powerpc/numa: Support coregroup on PowerNV
From: Srikar Dronamraju @ 2026-06-05 5:52 UTC (permalink / raw)
To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Naveen N Rao
Cc: skiboot, arbab, mahesh, chleroy, Srikar Dronamraju, linux-kernel
In-Reply-To: <20260605055242.1757485-5-srikar@linux.ibm.com>
Coregroup support on powerpc has so far been limited to PowerVM LPARs.
However, PowerNV can also support coregroups when firmware exposes the
required coregroup information through the associativity hierarchy.
Detect coregroup support by checking whether primary_domain_index is the
penultimate domain in the CPU node's ibm,associativity property. On
PowerNV, a non-penultimate primary_domain_index indicates that firmware
provides an additional level for coregroup information.
This keeps the logic compatible with PowerVM systems, where
primary_domain_index is likewise not the penultimate associativity
domain.
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v1: https://lkml.kernel.org/r/20260524010017.140408-1-srikar@linux.ibm.com
- Handle comments from Christophe Leroy; make code more flat
arch/powerpc/mm/numa.c | 56 ++++++++++++++++++++++++++++++++++--------
1 file changed, 46 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 9aa71eb7e96b..e97b624203ea 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -889,12 +889,32 @@ static int __init numa_setup_drmem_lmb(struct drmem_lmb *lmb,
return 0;
}
+/*
+ * If hierarchy extends beyond primary_domain_index + 1, then next
+ * level corresponds to coregroup.
+ */
+static int detect_and_enable_coregroup(const __be32 *associativity, int index)
+{
+ if (!associativity || index == -1)
+ goto out;
+
+ index = of_read_number(associativity, 1);
+
+ if (index > primary_domain_index + 1) {
+ coregroup_enabled = 1;
+ return index;
+ }
+out:
+ coregroup_enabled = 0;
+ return -1;
+}
+
static int __init parse_numa_properties(void)
{
struct device_node *memory, *pci;
- int default_nid = 0;
- unsigned long i;
+ int default_nid = 0, index = 0;
const __be32 *associativity;
+ unsigned long i;
if (numa_enabled == 0) {
pr_warn("disabled by user\n");
@@ -927,7 +947,6 @@ static int __init parse_numa_properties(void)
*/
for_each_present_cpu(i) {
__be32 vphn_assoc[VPHN_ASSOC_BUFSIZE];
- struct device_node *cpu;
int nid = NUMA_NO_NODE;
memset(vphn_assoc, 0, VPHN_ASSOC_BUFSIZE * sizeof(__be32));
@@ -935,7 +954,9 @@ static int __init parse_numa_properties(void)
if (__vphn_get_associativity(i, vphn_assoc) == 0) {
nid = associativity_to_nid(vphn_assoc);
initialize_form1_numa_distance(vphn_assoc);
+ index = detect_and_enable_coregroup(vphn_assoc, index);
} else {
+ struct device_node *cpu;
/*
* Don't fall back to default_nid yet -- we will plug
@@ -948,6 +969,7 @@ static int __init parse_numa_properties(void)
associativity = of_get_associativity(cpu);
if (associativity) {
nid = associativity_to_nid(associativity);
+ index = detect_and_enable_coregroup(associativity, index);
initialize_form1_numa_distance(associativity);
}
of_node_put(cpu);
@@ -1445,7 +1467,9 @@ static long vphn_get_associativity(unsigned long cpu,
int cpu_to_coregroup_id(int cpu)
{
- __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
+ int coregroup_id = cpu_to_core_id(cpu);
+ struct device_node *cpunode = NULL;
+ const __be32 *associativity;
int index;
if (cpu < 0 || cpu > nr_cpu_ids)
@@ -1454,19 +1478,31 @@ int cpu_to_coregroup_id(int cpu)
if (!coregroup_enabled)
goto out;
- if (!firmware_has_feature(FW_FEATURE_VPHN))
- goto out;
+ if (firmware_has_feature(FW_FEATURE_VPHN)) {
+ __be32 tmp[VPHN_ASSOC_BUFSIZE] = {0};
- if (vphn_get_associativity(cpu, associativity))
+ if (vphn_get_associativity(cpu, tmp))
+ goto out;
+
+ associativity = tmp;
+
+ } else {
+ cpunode = of_get_cpu_node(cpu, NULL);
+ if (!cpunode)
+ goto out;
+
+ associativity = of_get_associativity(cpunode);
+ }
+ if (!associativity)
goto out;
index = of_read_number(associativity, 1);
if (index > primary_domain_index + 1)
- return of_read_number(&associativity[index - 1], 1);
+ coregroup_id = of_read_number(&associativity[index - 1], 1);
out:
- return cpu_to_core_id(cpu);
-}
+ if (cpunode)
+ of_node_put(cpunode);
return coregroup_id;
}
--
2.43.0
^ permalink raw reply related
* [PATCH v2 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR
From: Srikar Dronamraju @ 2026-06-05 5:52 UTC (permalink / raw)
To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Naveen N Rao
Cc: skiboot, arbab, mahesh, chleroy, Srikar Dronamraju, linux-kernel
In-Reply-To: <20260605055242.1757485-5-srikar@linux.ibm.com>
Make cpu_to_coregroup_id() available outside PPC_SPLPAR so it can be
used by platforms that do not rely on the SPLPAR-specific VPHN path.
Keep the existing fallback behavior by returning the core ID when
coregroup information is unavailable.
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v1:
- Handle comments from Christophe Leroy; Remove extern key word in
declaration
arch/powerpc/include/asm/topology.h | 15 +++++++--------
arch/powerpc/mm/numa.c | 22 ++++++++++++++++------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 66ed5fe1b718..385715f1ad56 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -71,6 +71,7 @@ extern void map_cpu_to_node(int cpu, int node);
extern void unmap_cpu_from_node(unsigned long cpu);
#endif /* CONFIG_HOTPLUG_CPU */
+int cpu_to_coregroup_id(int cpu);
#else
static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -107,14 +108,6 @@ static inline void map_cpu_to_node(int cpu, int node) {}
static inline void unmap_cpu_from_node(unsigned long cpu) {}
#endif /* CONFIG_HOTPLUG_CPU */
#endif /* CONFIG_SMP */
-
-#endif /* CONFIG_NUMA */
-
-#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
-void find_and_update_cpu_nid(int cpu);
-extern int cpu_to_coregroup_id(int cpu);
-#else
-static inline void find_and_update_cpu_nid(int cpu) {}
static inline int cpu_to_coregroup_id(int cpu)
{
#ifdef CONFIG_SMP
@@ -124,6 +117,12 @@ static inline int cpu_to_coregroup_id(int cpu)
#endif
}
+#endif /* CONFIG_NUMA */
+
+#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
+void find_and_update_cpu_nid(int cpu);
+#else
+static inline void find_and_update_cpu_nid(int cpu) {}
#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
#include <asm-generic/topology.h>
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index c44a80d8fc11..9aa71eb7e96b 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1428,6 +1428,21 @@ void find_and_update_cpu_nid(int cpu)
pr_debug("%s:%d cpu %d nid %d\n", __func__, __LINE__, cpu, new_nid);
}
+static int topology_update_init(void)
+{
+ topology_inited = 1;
+ return 0;
+}
+device_initcall(topology_update_init);
+
+#else
+static long vphn_get_associativity(unsigned long cpu,
+ __be32 *associativity)
+{
+ return -1;
+}
+#endif /* CONFIG_PPC_SPLPAR */
+
int cpu_to_coregroup_id(int cpu)
{
__be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
@@ -1453,10 +1468,5 @@ int cpu_to_coregroup_id(int cpu)
return cpu_to_core_id(cpu);
}
-static int topology_update_init(void)
-{
- topology_inited = 1;
- return 0;
+ return coregroup_id;
}
-device_initcall(topology_update_init);
-#endif /* CONFIG_PPC_SPLPAR */
--
2.43.0
^ permalink raw reply related
* [PATCH v2 1/3] powerpc/numa: Simplify find_primary_domain_index
From: Srikar Dronamraju @ 2026-06-05 5:52 UTC (permalink / raw)
To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Naveen N Rao
Cc: skiboot, arbab, mahesh, chleroy, Srikar Dronamraju, linux-kernel
In-Reply-To: <20260605055242.1757485-5-srikar@linux.ibm.com>
Initialize the return value once and use a single exit path in
find_primary_domain_index().
This is a small cleanup that keeps the existing behavior unchanged while
making the control flow easier to follow.
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v1:
- Handle comments from Christophe Leroy
arch/powerpc/mm/numa.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f4cf3ae036de..c44a80d8fc11 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -432,7 +432,7 @@ static void __init initialize_form2_numa_distance_lookup_table(void)
static int __init find_primary_domain_index(void)
{
- int index;
+ int index = -1;
struct device_node *root;
/*
@@ -502,12 +502,9 @@ static int __init find_primary_domain_index(void)
distance_ref_points_depth = MAX_DISTANCE_REF_POINTS;
}
- of_node_put(root);
- return index;
-
err:
of_node_put(root);
- return -1;
+ return index;
}
static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
--
2.43.0
^ permalink raw reply related
* [PATCH v2 0/3] powerpc/numa: Enable coregroup support on PowerNV
From: Srikar Dronamraju @ 2026-06-05 5:52 UTC (permalink / raw)
To: linuxppc-dev
Cc: Michael Ellerman, Madhavan Srinivasan, skiboot, arbab, mahesh,
chleroy, Srikar Dronamraju
This series prepares cpu_to_coregroup_id() for broader use and enables
coregroup support on PowerNV when firmware exposes the required
associativity information.
The first patch cleans up find_primary_domain_index(). The second makes
cpu_to_coregroup_id() available outside PPC_SPLPAR while preserving the
existing fallback behavior. The final patch detects coregroup support
from the associativity hierarchy and uses it on PowerNV systems.
Changelog from v1: https://lkml.kernel.org/r/20260524010017.140408-1-srikar@linux.ibm.com
- Split into 3 patches
- Handle comments from Christophe Leroy
Srikar Dronamraju (3):
powerpc/numa: Simplify find_primary_domain_index
powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR
powerpc/numa: Support coregroup on PowerNV
arch/powerpc/include/asm/topology.h | 15 +++--
arch/powerpc/mm/numa.c | 85 ++++++++++++++++++++++-------
2 files changed, 71 insertions(+), 29 deletions(-)
--
2.43.0
^ permalink raw reply
* Re: [PATCH] powerpc/vtime: Initialize starttime at boot for native accounting
From: Christophe Leroy (CS GROUP) @ 2026-06-05 5:32 UTC (permalink / raw)
To: Shrikanth Hegde, maddy, linuxppc-dev; +Cc: frederic
In-Reply-To: <d56bebd8-bd0e-4e3d-b44f-6c2ca27ab5a9@linux.ibm.com>
Hi Shrikanth,
Le 05/06/2026 à 05:03, Shrikanth Hegde a écrit :
> Hi Christophe. Thanks for taking a look and review.
>
> On 6/4/26 8:42 PM, Christophe Leroy (CS GROUP) wrote:
>>
>
>>>> Also, does this warrant Fixes tag? I found these two likely candidates.
>>>> Likely this issues exists since beginning.
>>>> c223c90386bc powerpc32: provide VIRT_CPU_ACCOUNTING
>>>
>>> You say system has 240 CPU so I suppose this is not ppc32. That
>>> commit wsa not supposed to change anything for ppc64, did you
>>> identify anything special in that commit related to ppc64 ?
>
> Yes. this was ppc64.
>
>>>
>>>> b38a181c11d0 powerpc/time: isolate scaled cputime accounting in
>>>> dedicated functions.
>>>
>>> This one is also pure code re-organisation, unless you've been able
>>> to spot a particular issue ?
>>
>> Maybe commit cf9efce0ce31 ("powerpc: Account time using timebase
>> rather than PURR")
>>
>> It removed snapshot_timebases() and I can't see anything to replace it.
>>
>
> Yes. But this patch is dependent on Frederic's series.
> backporting that is going to be difficult. So i am thinking to avoid
> putting Fixes tag.
Even if automatic backport will fail, it shouldn't be difficult to
perform a manual backport by just adding the missing vtime_reset().
So I would put the Fixes tag to make people award.
>
>
>>
>>>
>>>>
>>>> arch/powerpc/kernel/time.c | 4 +++-
>>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
>>>> index 3460d1a5a97c..11145c40183d 100644
>>>> --- a/arch/powerpc/kernel/time.c
>>>> +++ b/arch/powerpc/kernel/time.c
>>>> @@ -377,7 +377,6 @@ void vtime_task_switch(struct task_struct *prev)
>>>> }
>>>> }
>>>> -#ifdef CONFIG_NO_HZ_COMMON
>>>> /**
>>>> * vtime_reset - Fast forward vtime entry clocks
>>>> *
>>>> @@ -394,6 +393,7 @@ void vtime_reset(void)
>>>> #endif
>>>> }
>>>> +#ifdef CONFIG_NO_HZ_COMMON
>>>> /**
>>>> * vtime_dyntick_start - Inform vtime about entry to idle-dynticks
>>>> *
>>>> @@ -933,6 +933,7 @@ static void __init set_decrementer_max(void)
>>>> static void __init init_decrementer_clockevent(void)
>>>> {
>>>> register_decrementer_clockevent(smp_processor_id());
>>>> + vtime_reset();
>>>> }
>>>> void secondary_cpu_time_init(void)
>>>> @@ -948,6 +949,7 @@ void secondary_cpu_time_init(void)
>>>> /* FIME: Should make unrelated change to move snapshot_timebase
>>>> * call here ! */
>>>> register_decrementer_clockevent(smp_processor_id());
>>>> + vtime_reset();
>>>> }
>>>> /*
>>>
>>
>
> Sorry i should have put this earlier, But this applies on top of tip/
> timers/nohz
> at 6199f9999a9b (origin/timers/nohz) sched/cputime: Handle dyntick-idle
> steal time correctly
> (In case anyone tried applying on powerpc tree, it would fail)
Yep, I first looked vtime_reset() into linus tree, then found it in
linux-next.
Christophe
^ permalink raw reply
* Re: [PATCH 1/2] kunit: Add ability to skip entire test suites
From: David Gow @ 2026-06-05 5:09 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev, kvm, kvm-ppc, linux-kselftest,
kunit-dev, linux-kernel
Cc: Madhavan Srinivasan, Michael Ellerman, Brendan Higgins, Rae Moar
In-Reply-To: <20260604162805.556135-2-vaibhav@linux.ibm.com>
Le 05/06/2026 à 12:28 AM, Vaibhav Jain a écrit :
> Currently, KUnit provides mechanisms to skip individual test cases, but
> there is no way to skip an entire test suite based on runtime conditions
> checked during suite initialization. This limitation forces test suites
> to either fail or skip tests individually when certain prerequisites are
> not available.
>
> To address this limitation, the patch adds a 'status' field to struct
> kunit_suite that allows suite_init callbacks to mark the entire suite as
> KUNIT_SKIPPED. When a suite is marked as skipped, all test cases within
> that suite are bypassed without execution.
>
> The patch proposes changes to kunit_suite_has_succeeded() to check suite
> status before evaluating individual test case results. Also
> kunit_run_tests() is updated to skip suite execution if 'kunit_suite.status'
> is set to KUNIT_SKIPPED, thats either set before suite_init or by the
> suite_init callback itself.
>
> This enables test suites to perform runtime capability checks in their
> 'suite_init' callback and gracefully skip all tests when prerequisites are
> not met, rather than reporting failures or requiring each test case to
> perform redundant checks.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
Thanks — this is great! There are a few cases it's not handling
properly, though, particularly with respect to the debugfs support.
I think we need to:
- Reset suite->status to KUNIT_SUCCESS in kunit_init_suite(), so that a
suite which is re-run via debugfs isn't automatically skipped again.
- Fix the result handling in debugfs to handle skipped suites.
- (Optional) Maybe we could get rid of kunit_suite::suite_init_err now
that there's a specific status value. That'd have to be done carefully
to preserve all of the semantics, though.
Here's a quick (and slightly hacky) patch to fix the first couple of issues:
---
diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c
index 9c326f1837bd..23d34bfdba95 100644
--- a/lib/kunit/debugfs.c
+++ b/lib/kunit/debugfs.c
@@ -58,6 +58,22 @@ static void debugfs_print_result(struct seq_file
*seq, struct string_stream *log
spin_unlock(&log->lock);
}
+/* Print the result line for a suite. */
+static void debugfs_print_ok_not_ok(struct seq_file *seq,
+ enum kunit_status status,
+ size_t test_number,
+ const char *description,
+ const char *directive)
+{
+ const char *directive_header = (status == KUNIT_SKIPPED) ? " # SKIP "
: "";
+ const char *directive_body = (status == KUNIT_SKIPPED) ? directive : "";
+
+ seq_printf(seq, "%s %zd %s%s%s\n",
+ kunit_status_to_ok_not_ok(status),
+ test_number, description, directive_header,
+ directive_body);
+}
+
/*
* /sys/kernel/debug/kunit/<testsuite>/results shows all results for
testsuite.
*/
@@ -77,17 +93,17 @@ static int debugfs_print_results(struct seq_file
*seq, void *v)
seq_puts(seq, "1..1\n");
/* Print suite header because it is not stored in the test logs. */
- seq_puts(seq, KUNIT_SUBTEST_INDENT "KTAP version 1\n");
- seq_printf(seq, KUNIT_SUBTEST_INDENT "# Subtest: %s\n", suite->name);
- seq_printf(seq, KUNIT_SUBTEST_INDENT "1..%zd\n",
kunit_suite_num_test_cases(suite));
-
- kunit_suite_for_each_test_case(suite, test_case)
- debugfs_print_result(seq, test_case->log);
+ if (suite->status != KUNIT_SKIPPED) {
+ seq_puts(seq, KUNIT_SUBTEST_INDENT "KTAP version 1\n");
+ seq_printf(seq, KUNIT_SUBTEST_INDENT "# Subtest: %s\n", suite->name);
+ seq_printf(seq, KUNIT_SUBTEST_INDENT "1..%zd\n",
kunit_suite_num_test_cases(suite));
+ kunit_suite_for_each_test_case(suite, test_case)
+ debugfs_print_result(seq, test_case->log);
+ }
debugfs_print_result(seq, suite->log);
- seq_printf(seq, "%s %d %s\n",
- kunit_status_to_ok_not_ok(success), 1, suite->name);
+ debugfs_print_ok_not_ok(seq, success, 1, suite->name,
suite->status_comment);
return 0;
}
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index c0ae45a22b2c..2ff145796450 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -798,9 +798,6 @@ int kunit_run_tests(struct kunit_suite *suite)
/* Taint the kernel so we know we've run tests. */
add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
- if (suite->status == KUNIT_SKIPPED)
- goto suite_end;
-
if (suite->suite_init) {
suite->suite_init_err = suite->suite_init(suite);
if (suite->suite_init_err) {
@@ -836,6 +833,7 @@ static void kunit_init_suite(struct kunit_suite *suite)
kunit_debugfs_create_suite(suite);
suite->status_comment[0] = '\0';
suite->suite_init_err = 0;
+ suite->status = KUNIT_SUCCESS;
if (suite->log)
string_stream_clear(suite->log);
---
> include/kunit/test.h | 1 +
> lib/kunit/test.c | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/include/kunit/test.h b/include/kunit/test.h
> index ce0573e196ce..395221d623f7 100644
> --- a/include/kunit/test.h
> +++ b/include/kunit/test.h
> @@ -285,6 +285,7 @@ struct kunit_suite {
> struct string_stream *log;
> int suite_init_err;
> bool is_init;
> + enum kunit_status status;
> };
>
> /* Stores an array of suites, end points one past the end */
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index 99773e000e1b..989acc770265 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
> @@ -214,6 +214,9 @@ enum kunit_status kunit_suite_has_succeeded(struct kunit_suite *suite)
> const struct kunit_case *test_case;
> enum kunit_status status = KUNIT_SKIPPED;
>
> + if (suite->status == KUNIT_SKIPPED)
> + return KUNIT_SKIPPED;
> +
> if (suite->suite_init_err)
> return KUNIT_FAILURE;
>
> @@ -795,12 +798,20 @@ int kunit_run_tests(struct kunit_suite *suite)
> /* Taint the kernel so we know we've run tests. */
> add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
>
> + if (suite->status == KUNIT_SKIPPED)
> + goto suite_end;
> +
Do we want this? If a test is run more than once, we probably want to
re-run suite_init so that we can tell if we should still skip it.
While I don't think it's likely that a test which was previously skipped
will suddenly become available, it's not impossible with, e.g., CPU hotplug.
> if (suite->suite_init) {
> suite->suite_init_err = suite->suite_init(suite);
> if (suite->suite_init_err) {
> + suite->status = KUNIT_FAILURE;
> kunit_err(suite, KUNIT_SUBTEST_INDENT
> "# failed to initialize (%d)", suite->suite_init_err);
> goto suite_end;
> +
> + } else if (suite->status == KUNIT_SKIPPED) {
> + /* Skip this kunit suite */
> + goto suite_end;
> }
> }
>
Cheers,
-- David
^ permalink raw reply related
* Re: [PATCH 2/2] kunit: Add example of test suite that can be skipped at runtime
From: David Gow @ 2026-06-05 5:10 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev, kvm, kvm-ppc, linux-kselftest,
kunit-dev, linux-kernel
Cc: Madhavan Srinivasan, Michael Ellerman, Brendan Higgins, Rae Moar
In-Reply-To: <20260604162805.556135-3-vaibhav@linux.ibm.com>
Le 05/06/2026 à 12:28 AM, Vaibhav Jain a écrit :
> Add an example test suite name 'example_test_skip_suite' to
> 'kunit-example-test.c' that shows how to skip an entire test suite based on
> runtime conditions.
>
> The example suite 'example_skip_suite' provides a 'suite_init' callback
> named example_skip_suite_init() which marks the entire suite as skipped
> using kunit_mark_skipped().
>
> This demonstrates a way for conditionally skipping test suites when any
> prerequisites for kunit_suite execution are not met. The 'suite_init'
> callback can perform any necessary checks and mark the suite as skipped,
> preventing all test cases from executing while also indicating why the
> suite was skipped.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
Thanks!
Reviewed-by: David Gow <david@davidgow.net>
Cheers,
-- David
> lib/kunit/kunit-example-test.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/lib/kunit/kunit-example-test.c b/lib/kunit/kunit-example-test.c
> index 0bae7b7ca0b0..b8ded54fa46d 100644
> --- a/lib/kunit/kunit-example-test.c
> +++ b/lib/kunit/kunit-example-test.c
> @@ -591,5 +591,34 @@ static struct kunit_suite example_init_test_suite = {
> */
> kunit_test_init_section_suites(&example_init_test_suite);
>
> +/*
> + * This test should always be skipped.
> + */
> +static void example_skip_suite_test(struct kunit *test)
> +{
> + /* This line should never be seen */
> + KUNIT_FAIL(test, "You should not see a this.");
> +}
> +
> +static struct kunit_case example_skip_suite_test_cases[] = {
> + KUNIT_CASE(example_skip_suite_test),
> + {}
> +};
> +
> +static int example_skip_suite_init(struct kunit_suite *suite)
> +{
> + kunit_mark_skipped(suite, "Test suite expected to be skipped");
> + return 0;
> +}
> +
> +static struct kunit_suite example_test_skip_suite = {
> + .name = "example_skip_suite",
> + .suite_init = example_skip_suite_init,
> + .test_cases = example_skip_suite_test_cases,
> +};
> +
> +/* This registers a test suite that will be skipped */
> +kunit_test_suite(example_test_skip_suite);
> +
> MODULE_DESCRIPTION("Example KUnit test suite");
> MODULE_LICENSE("GPL v2");
^ permalink raw reply
* Re: [RFC 00/12] PCI: Add support for Scalable I/O Virtualization
From: Christoph Hellwig @ 2026-06-05 4:14 UTC (permalink / raw)
To: Dimitri Daskalakis
Cc: Bjorn Helgaas, linux-pci, 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, linux-s390, kvm, xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
On Thu, Jun 04, 2026 at 08:01:41AM -0700, Dimitri Daskalakis wrote:
> From: Dimitri Daskalakis <daskald@meta.com>
>
> Scalable I/O Virtualization (SIOV) is the next-generation alternative
> to SR-IOV.
It's not. It is a yet another very different technology.
^ permalink raw reply
* Re: [PATCH] powerpc/vtime: Initialize starttime at boot for native accounting
From: Shrikanth Hegde @ 2026-06-05 3:03 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP), maddy, linuxppc-dev; +Cc: frederic
In-Reply-To: <644eed72-fe6b-4639-88d3-dcbba1f8209b@kernel.org>
Hi Christophe. Thanks for taking a look and review.
On 6/4/26 8:42 PM, Christophe Leroy (CS GROUP) wrote:
>
>>> Also, does this warrant Fixes tag? I found these two likely candidates.
>>> Likely this issues exists since beginning.
>>> c223c90386bc powerpc32: provide VIRT_CPU_ACCOUNTING
>>
>> You say system has 240 CPU so I suppose this is not ppc32. That commit
>> wsa not supposed to change anything for ppc64, did you identify
>> anything special in that commit related to ppc64 ?
Yes. this was ppc64.
>>
>>> b38a181c11d0 powerpc/time: isolate scaled cputime accounting in
>>> dedicated functions.
>>
>> This one is also pure code re-organisation, unless you've been able to
>> spot a particular issue ?
>
> Maybe commit cf9efce0ce31 ("powerpc: Account time using timebase rather
> than PURR")
>
> It removed snapshot_timebases() and I can't see anything to replace it.
>
Yes. But this patch is dependent on Frederic's series.
backporting that is going to be difficult. So i am thinking to avoid putting Fixes tag.
>
>>
>>>
>>> arch/powerpc/kernel/time.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
>>> index 3460d1a5a97c..11145c40183d 100644
>>> --- a/arch/powerpc/kernel/time.c
>>> +++ b/arch/powerpc/kernel/time.c
>>> @@ -377,7 +377,6 @@ void vtime_task_switch(struct task_struct *prev)
>>> }
>>> }
>>> -#ifdef CONFIG_NO_HZ_COMMON
>>> /**
>>> * vtime_reset - Fast forward vtime entry clocks
>>> *
>>> @@ -394,6 +393,7 @@ void vtime_reset(void)
>>> #endif
>>> }
>>> +#ifdef CONFIG_NO_HZ_COMMON
>>> /**
>>> * vtime_dyntick_start - Inform vtime about entry to idle-dynticks
>>> *
>>> @@ -933,6 +933,7 @@ static void __init set_decrementer_max(void)
>>> static void __init init_decrementer_clockevent(void)
>>> {
>>> register_decrementer_clockevent(smp_processor_id());
>>> + vtime_reset();
>>> }
>>> void secondary_cpu_time_init(void)
>>> @@ -948,6 +949,7 @@ void secondary_cpu_time_init(void)
>>> /* FIME: Should make unrelated change to move snapshot_timebase
>>> * call here ! */
>>> register_decrementer_clockevent(smp_processor_id());
>>> + vtime_reset();
>>> }
>>> /*
>>
>
Sorry i should have put this earlier, But this applies on top of tip/timers/nohz
at 6199f9999a9b (origin/timers/nohz) sched/cputime: Handle dyntick-idle steal time correctly
(In case anyone tried applying on powerpc tree, it would fail)
^ permalink raw reply
* Re: [RFC 00/12] PCI: Add support for Scalable I/O Virtualization
From: Dimitri Daskalakis @ 2026-06-04 23:49 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Bjorn Helgaas, linux-pci, 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, Kevin Tian,
Ankit Agrawal, Leon Romanovsky, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Keith Busch, Alexander Duyck,
Jakub Kicinski, Dimitri Daskalakis, linuxppc-dev, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604182031.GB2487554@ziepe.ca>
On 6/4/26 11:20 AM, Jason Gunthorpe wrote:
> On Thu, Jun 04, 2026 at 08:01:41AM -0700, Dimitri Daskalakis wrote:
>> With this patchset core enumarates the SIOV capability and can identify
>> SIOV PFs. But there is no central mechanism to allocate/manage SIOV VFs.
>> To support device pass through, devices will need to add a vfio-mdev
>> driver with IOMMUFD support (or something similar).
>
> There is an enormous amount of missing work to do something useful
> with the SIOVr2 stuff. IIRC there is even supposed to be BIOS
> components in this plan and there are some missing PCI SIG topics too
> IIRC.
>
> So, I'm not sure how much value there is in merging just the cap
> discovery without a roadmap for the missing parts..
>
> Also, I'm quite surprised to see this out of the blue, there is an OCP
> workstream that was building out a standard that outlines how all the
> different components have to act to successfully implement it. What
> is in PCI SIG was just some minor foundational adjustments without any
> context on how to form them into a solution.
>
> I think it is extremely premature to merge anything related to SIOV to
> the kernel. Join the OCP work stream if you are interested. I think
> the general feeling was there is not sufficient interest in the
> industry to do this and it has gone quiet.
>
> Jason
Hey Jason, thanks for the feedback. We (at Meta) are definitely
interested in SIOV-like capabilities for device passthrough to containers.
For those scenarios, having PCIe transactions per RID plus IOMMU
isolation is enough, but I can imagine hypervisors/VMs requiring more
platform support.
I hear you on the broader support story being premature. But on the
other hand, this series unblocks experimentation at the driver level
for basic data path validation.
^ permalink raw reply
* [RFC 12/12] PCI: Reserve bus range for SIOV devices
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
SDI routing IDs are computed from the PF's devfn plus an offset and
stride, exactly like SR-IOV VFs. When the stride pushes routing IDs
past the current bus number, additional bus numbers must be reserved
during PCI bus scanning to ensure the SDIs can be enumerated.
Add pci_siov_bus_range(), which walks all SIOV-capable PFs on a bus
and returns the maximum number of additional buses required. This
parallels pci_iov_bus_range() for SR-IOV.
The bus range is pre-computed during siov_init() by computing the bus
number of the last valid SDI.
Note: The PCIe 7.0 spec outlines an alternative RID assignment
algorithm for SDIs. The spec states a Virtualization Intermediary
(likely a hypervisor) after boot can compute the set of RIDs that are
valid for SDIs. There is a six step algorithm to compute this
RID allowlist. To keep things simple, we are only adding support for
strided RID assignments.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/pci/probe.c | 4 ++--
drivers/pci/siov.c | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bebc32c8d374..9ef6827ab345 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -3100,8 +3100,8 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
for (devnr = 0; devnr < PCI_MAX_NR_DEVS; devnr++)
pci_scan_slot(bus, PCI_DEVFN(devnr, 0));
- /* Reserve buses for SR-IOV capability */
- used_buses = pci_iov_bus_range(bus);
+ /* Reserve buses for SR-IOV and SIOV capability */
+ used_buses = max(pci_iov_bus_range(bus), pci_siov_bus_range(bus));
max += used_buses;
/*
diff --git a/drivers/pci/siov.c b/drivers/pci/siov.c
index 7372ce95714b..6405a8830052 100644
--- a/drivers/pci/siov.c
+++ b/drivers/pci/siov.c
@@ -111,3 +111,24 @@ void pci_siov_release(struct pci_dev *dev)
if (dev->siov)
siov_release(dev);
}
+
+/**
+ * pci_siov_bus_range - find the max bus number consumed by SDIs
+ * @bus: the PCI bus
+ *
+ * Returns max additional buses consumed across all SIOV PFs on this bus.
+ */
+int pci_siov_bus_range(struct pci_bus *bus)
+{
+ int max = 0;
+ struct pci_dev *dev;
+
+ list_for_each_entry(dev, &bus->devices, bus_list) {
+ if (!dev->siov)
+ continue;
+ if (dev->siov->max_SDI_buses > max)
+ max = dev->siov->max_SDI_buses;
+ }
+
+ return max ? max - bus->number : 0;
+}
--
2.52.0
^ permalink raw reply related
* [RFC 11/12] PCI: Initialize and release SIOV capability
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
Modify pci_init_capabilities() to discover the SIOV extended capability
(cap ID 0x38). When present, allocate struct pci_siov that records the
capability position, total SDI count, routing ID offset and stride, and
the maximum bus range the SDIs can span.
The init path mirrors sriov_init(): read the capability registers,
compute the worst-case bus consumption from total_SDIs, and stash the
result in the PF's pci_dev. Release frees the structure on teardown.
If is_physfn was already set (by sriov_init), it will not be cleared if
siov_init() fails. This prevents clobbering the flag for devices that
enable both virtualization types.
The SR-IOV code does not unset the is_physfn bit of a pci device
when disabled, and the SIOV code follows that pattern.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/pci/Makefile | 1 +
drivers/pci/pci.h | 16 ++++++
drivers/pci/probe.c | 2 +
drivers/pci/siov.c | 113 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 132 insertions(+)
create mode 100644 drivers/pci/siov.c
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 41ebc3b9a518..a584cd1bf08a 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_PCI_QUIRKS) += quirks.o
obj-$(CONFIG_HOTPLUG_PCI) += hotplug/
obj-$(CONFIG_PCI_ATS) += ats.o
obj-$(CONFIG_PCI_IOV) += iov.o
+obj-$(CONFIG_PCI_SIOV) += siov.o
obj-$(CONFIG_PCI_BRIDGE_EMUL) += pci-bridge-emul.o
obj-$(CONFIG_PCI_LABEL) += pci-label.o
obj-$(CONFIG_X86_INTEL_MID) += pci-mid.o
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index fd7c04e26c16..a516db996aab 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1042,6 +1042,22 @@ static inline u16 pci_virtfn_routing_id(struct pci_dev *pf, u16 offset,
}
#endif
+#ifdef CONFIG_PCI_SIOV
+int pci_siov_init(struct pci_dev *dev);
+void pci_siov_release(struct pci_dev *dev);
+int pci_siov_bus_range(struct pci_bus *bus);
+#else
+static inline int pci_siov_init(struct pci_dev *dev)
+{
+ return -ENODEV;
+}
+static inline void pci_siov_release(struct pci_dev *dev) { }
+static inline int pci_siov_bus_range(struct pci_bus *bus)
+{
+ return 0;
+}
+#endif
+
#ifdef CONFIG_PCIE_TPH
void pci_restore_tph_state(struct pci_dev *dev);
void pci_save_tph_state(struct pci_dev *dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b63cd0c310bc..bebc32c8d374 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2473,6 +2473,7 @@ static void pci_release_capabilities(struct pci_dev *dev)
pci_aer_exit(dev);
pci_rcec_exit(dev);
pci_iov_release(dev);
+ pci_siov_release(dev);
pci_free_cap_save_buffers(dev);
}
@@ -2666,6 +2667,7 @@ static void pci_init_capabilities(struct pci_dev *dev)
pci_vpd_init(dev); /* Vital Product Data */
pci_configure_ari(dev); /* Alternative Routing-ID Forwarding */
pci_iov_init(dev); /* Single Root I/O Virtualization */
+ pci_siov_init(dev); /* Scalable I/O Virtualization */
pci_ats_init(dev); /* Address Translation Services */
pci_pri_init(dev); /* Page Request Interface */
pci_pasid_init(dev); /* Process Address Space ID */
diff --git a/drivers/pci/siov.c b/drivers/pci/siov.c
new file mode 100644
index 000000000000..7372ce95714b
--- /dev/null
+++ b/drivers/pci/siov.c
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PCI Express Scalable I/O Virtualization (SIOV) support
+ */
+
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/export.h>
+#include "pci.h"
+
+static int pci_siov_sdi_bus(struct pci_dev *dev, int sdi_id)
+{
+ if (!dev->siov)
+ return -EINVAL;
+ return pci_virtfn_routing_id(dev, dev->siov->offset,
+ dev->siov->stride, sdi_id) >> 8;
+}
+
+static int compute_max_sdi_buses(struct pci_dev *dev)
+{
+ struct pci_siov *siov = dev->siov;
+
+ if (!siov->offset || (siov->total_SDIs > 1 && !siov->stride))
+ return -EIO;
+
+ siov->max_SDI_buses = pci_siov_sdi_bus(dev, siov->total_SDIs - 1);
+ return 0;
+}
+
+static int siov_init(struct pci_dev *dev, int pos)
+{
+ struct pci_siov *siov;
+ bool was_physfn;
+ u16 total;
+ u8 status;
+ int rc;
+
+ pci_read_config_byte(dev, pos + PCI_SIOV_STATUS, &status);
+ if (status & PCI_SIOV_STATUS_ENABLED)
+ pci_warn(dev, "SIOV: SDIs active at init, FLR may be required\n");
+
+ pci_read_config_word(dev, pos + PCI_SIOV_TOTAL_SDI, &total);
+ if (!total)
+ return 0;
+
+ siov = kzalloc_obj(*siov);
+ if (!siov)
+ return -ENOMEM;
+
+ siov->pos = pos;
+ siov->total_SDIs = total;
+ siov->driver_max_SDIs = total;
+ siov->self = dev;
+ pci_read_config_dword(dev, pos + PCI_SIOV_CAP, &siov->cap);
+ pci_read_config_word(dev, pos + PCI_SIOV_SDI_OFFSET, &siov->offset);
+ pci_read_config_word(dev, pos + PCI_SIOV_SDI_STRIDE, &siov->stride);
+
+ was_physfn = dev->is_physfn;
+
+ dev->siov = siov;
+ dev->is_physfn = 1;
+ dev->is_siov = 1;
+ rc = compute_max_sdi_buses(dev);
+ if (rc) {
+ dev->siov = NULL;
+ dev->is_siov = 0;
+ if (!was_physfn)
+ dev->is_physfn = 0;
+ kfree(siov);
+ return rc;
+ }
+
+ return 0;
+}
+
+static void siov_release(struct pci_dev *dev)
+{
+ WARN_ON_ONCE(dev->siov->num_SDIs);
+
+ kfree(dev->siov);
+ dev->siov = NULL;
+ dev->is_siov = 0;
+}
+
+/**
+ * pci_siov_init - initialize the Scalable IOV capability
+ * @dev: the PCI device
+ *
+ * Returns 0 on success, or negative on failure.
+ */
+int pci_siov_init(struct pci_dev *dev)
+{
+ int pos;
+
+ if (!pci_is_pcie(dev))
+ return -ENODEV;
+
+ pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SIOV);
+ if (pos)
+ return siov_init(dev, pos);
+
+ return -ENODEV;
+}
+
+/**
+ * pci_siov_release - release resources used by the SIOV capability
+ * @dev: the PCI device
+ */
+void pci_siov_release(struct pci_dev *dev)
+{
+ if (dev->siov)
+ siov_release(dev);
+}
--
2.52.0
^ permalink raw reply related
* [RFC 10/12] PCI: Add Scalable I/O Virtualization data structure definitions
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
Define the PCIe SIOV extended capability registers per the PCIe 7.0
spec, and introduce the kernel-internal data structures needed to track
SIOV state on a Physical Function. PCI-SIG members can access the spec
here https://members.pcisig.com/wg/PCI-SIG/document/previewpdf/22464.
The PCI_SIOV kconfig selects PCI_ATS rather than attempting to decouple
the sriov/physfn union within struct pci_dev from CONFIG_PCI_ATS. If
desired this can be done in the future, since ATS is optional
for SR-IOV and SIOV.
Inspired by struct pci_sriov, struct pci_siov records the
capability position, total SDI count, routing ID offset/stride, and
driver-configurable limits.
Add an is_siov bit to struct pci_dev along with helpers to identify
SIOV PFs/VFs.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/pci/Kconfig | 11 +++++++++++
drivers/pci/pci.h | 13 +++++++++++++
include/linux/pci.h | 16 +++++++++++++++-
include/uapi/linux/pci_regs.h | 12 +++++++++++-
4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 33c88432b728..930231835c40 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -164,6 +164,17 @@ config PCI_IOV
If unsure, say N.
+config PCI_SIOV
+ bool "PCI Scalable IOV support"
+ select PCI_ATS
+ help
+ Scalable I/O Virtualization is a PCIe feature that allows devices
+ to expose lightweight Scalable Device Interfaces (SDIs). Unlike
+ SR-IOV Virtual Functions, SDIs have no config space or BARs and
+ rely on software to compose the control path.
+
+ If unsure, say N.
+
config PCI_NPEM
bool "Native PCIe Enclosure Management"
depends on LEDS_CLASS=y
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 45411960fd2e..fd7c04e26c16 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -683,6 +683,19 @@ struct pci_sriov {
bool drivers_autoprobe; /* Auto probing of VFs by driver */
};
+/* Scalable I/O Virtualization */
+struct pci_siov {
+ struct pci_dev *self; /* This PF */
+ u32 cap; /* SIOV Capabilities */
+ u16 pos; /* Capability position */
+ u16 total_SDIs; /* Total SDIs associated with the PF */
+ u16 num_SDIs; /* Number of SDIs currently enabled */
+ u16 offset; /* First SDI Routing ID offset */
+ u16 stride; /* Following SDI stride */
+ u16 driver_max_SDIs;/* Max num SDIs driver supports */
+ u8 max_SDI_buses; /* Max buses consumed by SDIs */
+};
+
#ifdef CONFIG_PCI_DOE
void pci_doe_init(struct pci_dev *pdev);
void pci_doe_destroy(struct pci_dev *pdev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ca84f66425b2..eba562474017 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -480,6 +480,7 @@ struct pci_dev {
unsigned int is_physfn:1;
unsigned int is_virtfn:1;
unsigned int is_sriov:1; /* SR-IOV is enabled on this device (PF or VF) */
+ unsigned int is_siov:1; /* SIOV is enabled on this device (PF or VF/SDI) */
unsigned int is_hotplug_bridge:1;
unsigned int is_pciehp:1;
unsigned int shpc_managed:1; /* SHPC owned by shpchp */
@@ -549,6 +550,9 @@ struct pci_dev {
u16 ats_cap; /* ATS Capability offset */
u8 ats_stu; /* ATS Smallest Translation Unit */
#endif
+#ifdef CONFIG_PCI_SIOV
+ struct pci_siov *siov; /* PF: Scalable IOV info */
+#endif
#ifdef CONFIG_PCI_PRI
u16 pri_cap; /* PRI Capability offset */
u32 pri_reqs_alloc; /* Number of PRI requests allocated */
@@ -598,7 +602,7 @@ struct pci_dev {
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
{
-#ifdef CONFIG_PCI_IOV
+#if defined(CONFIG_PCI_IOV) || defined(CONFIG_PCI_SIOV)
if (dev->is_virtfn)
dev = dev->physfn;
#endif
@@ -615,6 +619,16 @@ static inline bool pci_is_sriov_virtfn(const struct pci_dev *dev)
return dev->is_virtfn && dev->is_sriov;
}
+static inline bool pci_is_siov_physfn(const struct pci_dev *dev)
+{
+ return dev->is_physfn && dev->is_siov;
+}
+
+static inline bool pci_is_siov_virtfn(const struct pci_dev *dev)
+{
+ return dev->is_virtfn && dev->is_siov;
+}
+
struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 14f634ab9350..0f81c8c72b05 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -763,7 +763,8 @@
#define PCI_EXT_CAP_ID_DEV3 0x2F /* Device 3 Capability/Control/Status */
#define PCI_EXT_CAP_ID_IDE 0x30 /* Integrity and Data Encryption */
#define PCI_EXT_CAP_ID_PL_64GT 0x31 /* Physical Layer 64.0 GT/s */
-#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_64GT
+#define PCI_EXT_CAP_ID_SIOV 0x38 /* Scalable I/O Virtualization */
+#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_SIOV
#define PCI_EXT_CAP_DSN_SIZEOF 12
#define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
@@ -1005,6 +1006,15 @@
#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
#define PCI_EXT_CAP_SRIOV_SIZEOF 0x40
+/* Scalable I/O Virtualization */
+#define PCI_SIOV_CAP 0x04 /* SIOV Capabilities */
+#define PCI_SIOV_TOTAL_SDI 0x08 /* Total SDIs */
+#define PCI_SIOV_STATUS 0x0B /* SIOV Status */
+#define PCI_SIOV_STATUS_ENABLED 0x01 /* At least one SDI is enabled */
+#define PCI_SIOV_SDI_OFFSET 0x0C /* First SDI Offset */
+#define PCI_SIOV_SDI_STRIDE 0x0E /* SDI Stride */
+#define PCI_EXT_CAP_SIOV_SIZEOF 0x10
+
#define PCI_LTR_MAX_SNOOP_LAT 0x4
#define PCI_LTR_MAX_NOSNOOP_LAT 0x6
#define PCI_LTR_VALUE_MASK 0x000003ff
--
2.52.0
^ permalink raw reply related
* [RFC 09/12] PCI: Add helper to compute VF Routing ID to pci.h
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
The VF RID computation is identical for SR-IOV and SIOV. Add a common
helper so we can share the logic across both.
No functional changes.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/pci/iov.c | 8 ++++----
drivers/pci/pci.h | 12 ++++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 4aed4f6a42c3..5d65413ce98d 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -25,16 +25,16 @@ int pci_iov_virtfn_bus(struct pci_dev *dev, int vf_id)
{
if (!pci_is_sriov_physfn(dev))
return -EINVAL;
- return dev->bus->number + ((dev->devfn + dev->sriov->offset +
- dev->sriov->stride * vf_id) >> 8);
+ return pci_virtfn_routing_id(dev, dev->sriov->offset,
+ dev->sriov->stride, vf_id) >> 8;
}
int pci_iov_virtfn_devfn(struct pci_dev *dev, int vf_id)
{
if (!pci_is_sriov_physfn(dev))
return -EINVAL;
- return (dev->devfn + dev->sriov->offset +
- dev->sriov->stride * vf_id) & 0xff;
+ return pci_virtfn_routing_id(dev, dev->sriov->offset,
+ dev->sriov->stride, vf_id) & 0xff;
}
EXPORT_SYMBOL_GPL(pci_iov_virtfn_devfn);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 73b913bcb87a..45411960fd2e 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1017,6 +1017,18 @@ static inline int pci_resource_num_to_vf_bar(int resno)
}
#endif /* CONFIG_PCI_IOV */
+#if defined(CONFIG_PCI_IOV) || defined(CONFIG_PCI_SIOV)
+/*
+ * Compute the Routing ID (bus/devfn) for a VF or SDI under @pf, given the
+ * capability's offset and stride.
+ */
+static inline u16 pci_virtfn_routing_id(struct pci_dev *pf, u16 offset,
+ u16 stride, int id)
+{
+ return (pf->bus->number << 8) + pf->devfn + offset + stride * id;
+}
+#endif
+
#ifdef CONFIG_PCIE_TPH
void pci_restore_tph_state(struct pci_dev *dev);
void pci_save_tph_state(struct pci_dev *dev);
--
2.52.0
^ permalink raw reply related
* [RFC 08/12] PCI: Add is_sriov bit to struct pci_dev
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
We need a way to disambiguate the virtualization type of a PF/VF.
PFs may support multiple types of virtualization, while a VF should
only support one.
Tighten pci_is_sriov_physfn() / pci_is_sriov_virtfn() to ensure the
is_sriov bit is set. This allows the existing is_physfn/is_virtfn
bits to be agnostic of virtualization type.
No functional changes for SR-IOV.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
arch/s390/pci/pci_iov.c | 1 +
drivers/pci/iov.c | 4 ++++
include/linux/pci.h | 5 +++--
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/s390/pci/pci_iov.c b/arch/s390/pci/pci_iov.c
index 13050ce5c3e9..82e9ef1f132f 100644
--- a/arch/s390/pci/pci_iov.c
+++ b/arch/s390/pci/pci_iov.c
@@ -53,6 +53,7 @@ static int zpci_iov_link_virtfn(struct pci_dev *pdev, struct pci_dev *virtfn, in
return rc;
virtfn->is_virtfn = 1;
+ virtfn->is_sriov = 1;
virtfn->multifunction = 0;
virtfn->physfn = pci_dev_get(pdev);
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 5de26057b99a..4aed4f6a42c3 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -326,6 +326,7 @@ static struct pci_dev *pci_iov_scan_device(struct pci_dev *dev, int id,
virtfn->vendor = dev->vendor;
virtfn->device = iov->vf_device;
virtfn->is_virtfn = 1;
+ virtfn->is_sriov = 1;
virtfn->physfn = pci_dev_get(dev);
virtfn->no_command_memory = 1;
@@ -897,6 +898,7 @@ static int sriov_init(struct pci_dev *dev, int pos)
iov->dev = dev;
dev->sriov = iov;
+ dev->is_sriov = 1;
dev->is_physfn = 1;
rc = compute_max_vf_buses(dev);
if (rc)
@@ -906,6 +908,7 @@ static int sriov_init(struct pci_dev *dev, int pos)
fail_max_buses:
dev->sriov = NULL;
+ dev->is_sriov = 0;
dev->is_physfn = 0;
failed:
for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
@@ -926,6 +929,7 @@ static void sriov_release(struct pci_dev *dev)
kfree(dev->sriov);
dev->sriov = NULL;
+ dev->is_sriov = 0;
}
static void sriov_restore_vf_rebar_state(struct pci_dev *dev)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 28892243f49f..ca84f66425b2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -479,6 +479,7 @@ struct pci_dev {
unsigned int state_saved:1;
unsigned int is_physfn:1;
unsigned int is_virtfn:1;
+ unsigned int is_sriov:1; /* SR-IOV is enabled on this device (PF or VF) */
unsigned int is_hotplug_bridge:1;
unsigned int is_pciehp:1;
unsigned int shpc_managed:1; /* SHPC owned by shpchp */
@@ -606,12 +607,12 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
static inline bool pci_is_sriov_physfn(const struct pci_dev *dev)
{
- return dev->is_physfn;
+ return dev->is_physfn && dev->is_sriov;
}
static inline bool pci_is_sriov_virtfn(const struct pci_dev *dev)
{
- return dev->is_virtfn;
+ return dev->is_virtfn && dev->is_sriov;
}
struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
--
2.52.0
^ permalink raw reply related
* [RFC 07/12] PCI: Convert xen-pciback and pci-driver to pci_is_sriov_* helpers
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
No functional changes.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/pci/pci-driver.c | 4 ++--
drivers/xen/xen-pciback/pci_stub.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d10ece0889f0..926f80bccd70 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -357,7 +357,7 @@ static void local_pci_probe_callback(struct work_struct *work)
static bool pci_physfn_is_probed(struct pci_dev *dev)
{
#ifdef CONFIG_PCI_IOV
- return dev->is_virtfn && dev->physfn->is_probed;
+ return pci_is_sriov_virtfn(dev) && dev->physfn->is_probed;
#else
return false;
#endif
@@ -453,7 +453,7 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
#ifdef CONFIG_PCI_IOV
static inline bool pci_device_can_probe(struct pci_dev *pdev)
{
- return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe ||
+ return (!pci_is_sriov_virtfn(pdev) || pdev->physfn->sriov->drivers_autoprobe ||
device_has_driver_override(&pdev->dev));
}
#else
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 79a2b5dfd694..fd5a13f79fcf 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -1695,7 +1695,7 @@ static int pci_stub_notifier(struct notifier_block *nb,
if (action != BUS_NOTIFY_UNBIND_DRIVER)
return NOTIFY_DONE;
- if (!pdev->is_physfn)
+ if (!pci_is_sriov_physfn(pdev))
return NOTIFY_DONE;
for (;;) {
--
2.52.0
^ permalink raw reply related
* [RFC 06/12] PCI: Convert vfio_pci_core.c to pci_is_sriov_* helpers
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
No functional changes.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/vfio/pci/vfio_pci_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 3f8d093aacf8..ad8069612cb2 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1856,7 +1856,7 @@ int vfio_pci_core_match_token_uuid(struct vfio_device *core_vdev,
*
* If the VF token is provided but unused, an error is generated.
*/
- if (vdev->pdev->is_virtfn) {
+ if (pci_is_sriov_virtfn(vdev->pdev)) {
struct vfio_pci_core_device *pf_vdev = vdev->sriov_pf_core_dev;
bool match;
@@ -1979,13 +1979,13 @@ static int vfio_pci_bus_notifier(struct notifier_block *nb,
struct pci_dev *physfn = pci_physfn(pdev);
if (action == BUS_NOTIFY_ADD_DEVICE &&
- pdev->is_virtfn && physfn == vdev->pdev) {
+ pci_is_sriov_virtfn(pdev) && physfn == vdev->pdev) {
pci_info(vdev->pdev, "Captured SR-IOV VF %s driver_override\n",
pci_name(pdev));
WARN_ON(device_set_driver_override(&pdev->dev,
vdev->vdev.ops->name));
} else if (action == BUS_NOTIFY_BOUND_DRIVER &&
- pdev->is_virtfn && physfn == vdev->pdev) {
+ pci_is_sriov_virtfn(pdev) && physfn == vdev->pdev) {
struct pci_driver *drv = pci_dev_driver(pdev);
if (drv && drv != pci_dev_driver(vdev->pdev))
@@ -2005,7 +2005,7 @@ static int vfio_pci_vf_init(struct vfio_pci_core_device *vdev)
struct pci_dev *physfn;
int ret;
- if (pdev->is_virtfn) {
+ if (pci_is_sriov_virtfn(pdev)) {
/*
* If this VF was created by our vfio_pci_core_sriov_configure()
* then we can find the PF vfio_pci_core_device now, and due to
@@ -2025,7 +2025,7 @@ static int vfio_pci_vf_init(struct vfio_pci_core_device *vdev)
}
/* Not a SRIOV PF */
- if (!pdev->is_physfn)
+ if (!pci_is_sriov_physfn(pdev))
return 0;
vdev->vf_token = kzalloc_obj(*vdev->vf_token);
@@ -2166,7 +2166,7 @@ int vfio_pci_core_register_device(struct vfio_pci_core_device *vdev)
return -EBUSY;
}
- if (pci_is_root_bus(pdev->bus) || pdev->is_virtfn) {
+ if (pci_is_root_bus(pdev->bus) || pci_is_sriov_virtfn(pdev)) {
ret = vfio_assign_device_set(&vdev->vdev, vdev);
} else if (!pci_probe_reset_slot(pdev->slot)) {
ret = vfio_assign_device_set(&vdev->vdev, pdev->slot);
--
2.52.0
^ permalink raw reply related
* [RFC 05/12] PCI: Convert s390/pci/pci.c to pci_is_sriov_* helpers
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
No functional changes.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
arch/s390/pci/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 39bd2adfc240..5e6f600bf60b 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -611,7 +611,7 @@ int pcibios_device_add(struct pci_dev *pdev)
/* The pdev has a reference to the zdev via its bus */
zpci_zdev_get(zdev);
- if (pdev->is_physfn)
+ if (pci_is_sriov_physfn(pdev))
pdev->no_vf_scan = 1;
zpci_map_resources(pdev);
--
2.52.0
^ permalink raw reply related
* [RFC 04/12] PCI: Convert arch/powerpc to pci_is_sriov_* helpers
From: Dimitri Daskalakis @ 2026-06-04 15:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, 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, linux-s390, kvm,
xen-devel
In-Reply-To: <20260604150153.3619662-1-dimitri.daskalakis1@gmail.com>
From: Dimitri Daskalakis <daskald@meta.com>
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 <daskald@meta.com>
---
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;
/* Only support IOV for now */
- if (WARN_ON(!pdev->is_physfn))
+ if (WARN_ON(!pci_is_sriov_physfn(pdev)))
return NULL;
/* Check if VFs have been populated */
@@ -221,7 +221,7 @@ void remove_sriov_vf_pdns(struct pci_dev *pdev)
int i;
/* Only support IOV PF for now */
- if (WARN_ON(!pdev->is_physfn))
+ if (WARN_ON(!pci_is_sriov_physfn(pdev)))
return;
/* Check if VFs have been populated */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/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 = 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;
pnv_pci_configure_bus(pdev->bus);
@@ -2379,7 +2379,7 @@ static void pnv_pci_release_device(struct pci_dev *pdev)
struct pnv_ioda_pe *pe;
/* The VF PE state is torn down when sriov_disable() is called */
- if (pdev->is_virtfn)
+ if (pci_is_sriov_virtfn(pdev))
return;
if (!pdn || pdn->pe_number == IODA_INVALID_PE)
@@ -2391,7 +2391,7 @@ static void pnv_pci_release_device(struct pci_dev *pdev)
* 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
diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/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)
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 = pnv_ioda_get_pe(pdev);
/*
@@ -235,7 +235,7 @@ void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev)
*/
pe->pdev = 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)
phb = pci_bus_to_pnvhb(pdev->bus);
- if (!pdev->is_physfn)
+ if (!pci_is_sriov_physfn(pdev))
return;
/* FIXME: Use pnv_ioda_release_pe()? */
@@ -508,7 +508,7 @@ static int pnv_pci_vf_resource_shift(struct pci_dev *dev, int offset)
u16 num_vfs;
int i;
- if (!dev->is_physfn)
+ if (!pci_is_sriov_physfn(dev))
return -EINVAL;
iov = pnv_iov_get(dev);
@@ -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;
- if (!pdev->is_physfn)
+ if (!pci_is_sriov_physfn(pdev))
return;
phb = pci_bus_to_pnvhb(pdev->bus);
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/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)
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 = pdev->device;
pdn->vendor_id = pdev->vendor;
pdn->class_code = 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 = pci_num_vf(edev->pdev);
pdn = eeh_dev_to_pdn(edev);
parent = 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) == RTAS_UNKNOWN_SERVICE)
return -EINVAL;
- 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);
return 0;
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/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 = pci_device_to_OF_node(pdev);
- if (!pdev->is_physfn)
+ if (!pci_is_sriov_physfn(pdev))
return;
/*Firmware must support open sriov otherwise don't configure*/
indexes = of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL);
@@ -799,7 +799,7 @@ static resource_size_t pseries_pci_iov_resource_alignment(struct pci_dev *pdev,
if (!reg)
return pci_iov_resource_size(pdev, resno);
- if (!pdev->is_physfn)
+ if (!pci_is_sriov_physfn(pdev))
return 0;
return pseries_get_iov_fw_value(pdev,
resno - PCI_IOV_RESOURCES,
--
2.52.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox