[virtio-dev] Re: clarifying the handling of responses for virtio-rpmb

From
Harald Mommer <>
Date
2020-09-11T15:50:45+00:00
ID
Thread
[virtio-dev] Re: clarifying the handling of responses for virtio-rpmb
Hello,

I had my hands in a virtio RPMB device implementation the last few
weeks. During the development process I had to apply some patches to the
virtio RPMB driver:

 * Change the device id from 0xFFFF to 28

 * (Add some debug facilities. Needed to see the frames. Got first no
   request frames on the device side, nothing.)

 * Fix descriptor directions. For the outgoing frames num_in was
   incremented instead of num_out.

The frames in the for-loop may be outgoing or intended for incoming
data. Decided on the RPMB_F_WRITE flag what to do with those frames:

  for (i = 0; i < ncmds; i++) {
        ...

        if (cmds[i].flags & RPMB_F_WRITE)
            sgs[num_out++ + num_in] = &frame[i];
        else
            sgs[num_out + num_in++] = &frame[i];
    }

 * Got now too much data comparing to the virtio spec. Removed those
   additional frames in the beginning disabling some pieces of code in
   the virtio RPMB driver.

You are probably puzzled by something which I think is a bug in the
virtio RPMB driver regarding the descriptor directions. Could be that
some device implementations do not really care about provided descriptor
directions, in this case this may go unnoticed for a while.


Am 10.09.20 um 15:08 schrieb Alex BennÃe: