[SLOF] [PATCH] Correctly set ibm,my-drc-index

Thomas Huth thuth at redhat.com
Mon Sep 14 23:54:28 AEST 2015

On 14/09/15 13:36, David Gibson wrote:
> On Mon, Sep 14, 2015 at 08:07:33AM +0200, Thomas Huth wrote:
>> On 14/09/15 05:57, David Gibson wrote:
>>> On Sun, 13 Sep 2015 21:25:17 -0500
>>> Michael Roth <mdroth at linux.vnet.ibm.com> wrote:
>>>> Quoting David Gibson (2015-09-13 18:45:00)
>>>>> On Fri, 11 Sep 2015 18:48:19 +0200
>>>>> Laurent Vivier <lvivier at redhat.com> wrote:
>>>>>> The current calculation of DRC index for PCI card doesn't take
>>>>>> into account the PHB bridge index, so with several bridges we
>>>>>> can have several devices with the same DRC index.
>>>>>> This is a problem when we want to unplug a PCI card with
>>>>>> drmgr which is based on the DRC index.
>>>>>> Signed-off-by: Laurent Vivier <lvivier at redhat.com>
>>>>> Actually, I think the safer fix is just for SLOF not to touch the
>>>>> ibm,my-drc-index property if it's already present.  QEMU is already
>>>>> setting it correctly, and SLOF is overwriting it  :(.
>>>> This patch makes sense and fixes a real bug, but my understanding is that
>>>> SLOF only fills in properties missing from device node rather than
>>>> overwriting ones provided by QEMU. On my end, on the second PHB, I see
>>>> this for a hotplugged device in slot 1 (where prop comes from QEMU via
>>>> RTAS):
>>>> mdroth at ubuntu:/proc/device-tree/pci at 800000020000001/pci at 2$ od -x
>>>> ibm,my-drc-index
>>>> 0000000 0140 1000
>>>> 0000004
>>>> And after reboot (where prop comes from QEMU via SLOF):
>>>> mdroth at ubuntu:/proc/device-tree/pci at 800000020000001/ethernet at 2$ od -x
>>>> ibm,my-drc-index
>>>> 0000000 0140 1000
>>>> 0000004
>>>> If you're getting the buggy values (0040 1000, i.e. 40000010 be32 value)
>>>> it makes me think you're not using the QEMU-generated DTs for device
>>>> nodes. Older SLOF that doesn't have Nikunj's updates possibly? I think
>>>> in that case values might get overwritten/thrown out.
>>> Ah.  Good point, yes, the downstream qemu doesn't have the code to set
>>> my-drc-index.
>>> So the question is, do we fix this in SLOF, or do we pull down the qemu
>>> changes to move more device node creation into qemu, making it moot.
>> If the code in SLOF is wrong, I'd say the fix should be include in SLOF
>> anyway. slof/fs/pci-properties.fs is the "common" PCI setup code, so
>> this fix might come in handy for board-js2x (or maybe any future other
>> board) as well.
> Except that the DRC indexes are PAPR specific, so they certainly won't
> be relevant on js2x and very unlikely they'd be relevant for anything
> else in future.

Ok, in that case the code should likely rather be removed instead if it
is not used anymore.


More information about the SLOF mailing list