Skip to content

Commit 133889d

Browse files
committed
Merge: Updates for DLPAR DRC index
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7102 Description: Updates for DLPAR DRC index JIRA: https://issues.redhat.com/browse/RHEL-90597 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=68185783 Tested: Verified Brew build test kernel RPMs Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> commit 41a1452 Author: Haren Myneni <haren@linux.ibm.com> Date: Sat May 31 16:50:02 2025 -0700 powerpc/pseries/dlpar: Search DRC index from ibm,drc-indexes for IO add IO hotplug add event is handled in the user space with drmgr tool. After the device is enabled, the user space uses /sys/kernel/dlpar interface with “dt add index <drc_index>” to update the device tree. The kernel interface (dlpar_hp_dt_add()) finds the parent node for the specified ‘drc_index’ from ibm,drc-info property. The recent FW provides this property from 2017 onwards. But KVM guest code in some releases is still using the older SLOF firmware which has ibm,drc-indexes property instead of ibm,drc-info. If the ibm,drc-info is not available, this patch adds changes to search ‘drc_index’ from the indexes array in ibm,drc-indexes property to support old FW. Fixes: 02b98ff ("powerpc/pseries/dlpar: Add device tree nodes for DLPAR IO add") Reported-by: Kowshik Jois <kowsjois@linux.ibm.com> Signed-off-by: Haren Myneni <haren@linux.ibm.com> Tested-by: Amit Machhiwal <amachhiw@linux.ibm.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20250531235002.239213-1-haren@linux.ibm.com Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 883d933 + e006701 commit 133889d

File tree

1 file changed

+50
-2
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+50
-2
lines changed

arch/powerpc/platforms/pseries/dlpar.c

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,45 @@ get_device_node_with_drc_info(u32 index)
417417
return NULL;
418418
}
419419

420+
static struct device_node *
421+
get_device_node_with_drc_indexes(u32 drc_index)
422+
{
423+
struct device_node *np = NULL;
424+
u32 nr_indexes, index;
425+
int i, rc;
426+
427+
for_each_node_with_property(np, "ibm,drc-indexes") {
428+
/*
429+
* First element in the array is the total number of
430+
* DRC indexes returned.
431+
*/
432+
rc = of_property_read_u32_index(np, "ibm,drc-indexes",
433+
0, &nr_indexes);
434+
if (rc)
435+
goto out_put_np;
436+
437+
/*
438+
* Retrieve DRC index from the list and return the
439+
* device node if matched with the specified index.
440+
*/
441+
for (i = 0; i < nr_indexes; i++) {
442+
rc = of_property_read_u32_index(np, "ibm,drc-indexes",
443+
i+1, &index);
444+
if (rc)
445+
goto out_put_np;
446+
447+
if (drc_index == index)
448+
return np;
449+
}
450+
}
451+
452+
return NULL;
453+
454+
out_put_np:
455+
of_node_put(np);
456+
return NULL;
457+
}
458+
420459
static int dlpar_hp_dt_add(u32 index)
421460
{
422461
struct device_node *np, *nodes;
@@ -436,10 +475,19 @@ static int dlpar_hp_dt_add(u32 index)
436475
goto out;
437476
}
438477

478+
/*
479+
* Recent FW provides ibm,drc-info property. So search
480+
* for the user specified DRC index from ibm,drc-info
481+
* property. If this property is not available, search
482+
* in the indexes array from ibm,drc-indexes property.
483+
*/
439484
np = get_device_node_with_drc_info(index);
440485

441-
if (!np)
442-
return -EIO;
486+
if (!np) {
487+
np = get_device_node_with_drc_indexes(index);
488+
if (!np)
489+
return -EIO;
490+
}
443491

444492
/* Next, configure the connector. */
445493
nodes = dlpar_configure_connector(cpu_to_be32(index), np);

0 commit comments

Comments
 (0)