sbefifo userspace api

Brad Bishop bradleyb at fuzziesquirrel.com
Tue Feb 21 03:52:02 AEDT 2017


Thx Alistair!

> On Feb 20, 2017, at 10:34 AM, Alistair Popple <alistair at popple.id.au> wrote:
> 
> On Mon, 20 Feb 2017 07:20:25 AM Brad Bishop wrote:
>> Hi Venkatesh
>> 
>> If we put all the chip ops in the kernel then I would agree with you.
>> 
>> However, a number of others have expressed concern with putting the chip ops in the kernel.
>> 
>> Joel/Alistair - can you elaborate on your concerns with this approach of putting the chip-ops in the kernel?
> 
> The main concern I had was that putting the chip-ops in the kernel
> makes it more complicated to update/add chip-ops. Having them in the
> kernel would require a userspace API for each chip-op that would not
> be able to change, or at least could only change in a way that does
> not break backwards compatibility. Putting them in userpsace would
> allow you to build a library and manage any API changes between the
> users of that library.

Fair point.  What makes sbescom a special exception to this?  Are we OK with a real, fixed UAPI for sbescom, but the others are implemented in a library?  That feels inconsistent to me.

> 
> I would also be interested in the answer to the inverse - why put them
> in the kernel?

Fair question.  I’m hoping Venkatesh responds with some things I may have overlooked.

The only case I have for this is the consistency argument I made above.  I would rather see all or none in the kernel.  I’d be fine with none, but I can’t see a way to implement occ-hwmon that way.  So I fall back to all.  

Of course we can implement just the get/put scom chip ops in kernel and the others in user space.  I just want to make sure everyone understands exactly what we’d be doing there and would be OK with that approach.

> There's the OCC hwmon driver - what chip-ops does that
> need? Just get/putscom?

Correct, just get/putscom.  But sbe scom, not direct scom.

> If that's the case I thought we were already
> exposing scom chip-op operations via an OpenFSI master?

I have the same consistency question here.  Why is it preferable to have a UAPI for these chip-ops but not the others?

> 
> Regards,
> 
> Alistair
> 
>> thx - brad
>> 
>> 
>> 
>>> On Feb 20, 2017, at 12:05 AM, Venkatesh Sainath <vsainath at linux.vnet.ibm.com> wrote:
>>> 
>>> Hi Brad,
>>> 
>>> I am not sure why we need a user-space api for SBE FIFO driver. Even the pdbg and cronus apps have to go through the SBEI protocol driver in order to construct the packets according to the SBEI interface spec which is done by the SBEI protocol driver only. I think only an in-kernel api is sufficient for the SBE FIFO driver.
>>> 
>>> However, for the SBEI protocol driver, we would need both in-kernel ( for use by OCC hwmon ) and user-space api ( for use by pdbg, cronus and rest apis ).
>>> 
>>> Thanks
>>> 
>>> With regards
>>> Venkatesh
>>> 
>>> On 20/02/17 8:17 AM, Brad Bishop wrote:
>>>> Thanks Jeremy for the reply.  I’ve added participants from this thread:
>>>> 
>>>> https://lists.ozlabs.org/pipermail/openbmc/2017-February/006563.html
>>>> 
>>>> in an attempt to consolidate the whole sbefifo design discussion to a single thread.
>>>> 
>>>>> Hi Brad,
>>>>> 
>>>>>> Looking to start a discussion around possible user space and kernel
>>>>>> APIs for the POWER9 sbefifo driver.
>>>>>> 
>>>>>> There exists today an “alternate" sbefifo driver :-) that provides a
>>>>>> single submit ioctl.  Applications submit a request and get a reply in
>>>>>> single system call.
>>>>>> 
>>>>>> Is something like that the best approach for an upstream driver?  Or
>>>>>> should we try something more "pipe like" with read/write interfaces?
>>>>> It probably depends on the functionality there; ioctl() is useful in
>>>>> that (as you say) we can handle request and response in a single
>>>>> syscall, read() / write() may be more appropriate if ordering can be
>>>>> handled in userspace.
>>>>> 
>>>>> Can you add a little description about the functionality we're exposing?
>>>>> That may suggest a particular API.
>>>> In terms of hardware its pretty simple.  sbefifo is just two 8-word queues for sending/receiving messages to/from the SBE.  Each queue entry has a single ‘end of transfer’ flag to let the other side know the message is done.
>>>> 
>>>> In terms of data flowing through it, there is an SBEI protocol that covers encoding operations (like getscom, getmem, etc.. aka chip-ops) and the SBE response.
>>>> 
>>>> For users there seems to be two classes:
>>>> 
>>>> 1 - user space wanting to do chip-ops (pdbg, cronus).
>>>> 2 - device drivers wanting to do chip-ops (occ-hwmon).
>>>> 
>>>> If it weren’t for occ-hwmon, it doesn’t seem like there would be any need for the kernel to have any knowledge of the data flowing through the fifo (at the moment anyway).  An sbe-scom driver has been suggested but I wonder what the point of that driver would be, if userspace could simply encode a get/putscom chip-op and use the fifo directly.
>>>> 
>>>>>> Would the in-kernel API be the same as the user space API?
>>>>> Probably not :)
>>>> I realize they wouldn’t be _exactly_ the same if thats why I got the smiley face :-) ...
>>>> 
>>>> But I would have figured they’d at least be similar - meaning if we were go the ‘submit’ route for a UAPI..the kernel
>>>> would probably not have a split read/write API or vise versa.
>>>> 
>>>> So to rephrase the question - would the chardev fops implementation simply be something like this:
>>>> 
>>>> sbe-uapi-fops(chardev)
>>>>   data = copy to/from user space;
>>>>   sbedev = from_chardev(chardev);
>>>>   kernel-api(sbedev, data);
>>>> 
>>>> Or are the other things to consider here?
>>>> 
>>>> -thx
>>>> 
>>>> brad
>>>> 
>>>>> Cheers,
>>>>> 
>>>>> 
>>>>> Jeremy


More information about the openbmc mailing list