On Fri, 6 Jul 2018 10:35:06 -0400 "Jason J. Herne" <jjhe...@linux.ibm.com> wrote:
> On 07/06/2018 04:03 AM, Cornelia Huck wrote: > > On Thu, 5 Jul 2018 13:25:38 -0400 > > "Jason J. Herne" <jjhe...@linux.ibm.com> wrote: > >> + senseIdCcw.count = sizeof(senseData); > >> + > >> + if (do_cio(schid, ptr2u32(&senseIdCcw), CCW_FMT1)) { > >> + panic("Failed to run SenseID CCw\n"); > >> + } > >> + > >> + return senseData.cu_type; > >> +} > >> + > >> +static bool irb_error(Irb *irb) > >> +{ > >> + /* We have to ignore Incorrect Length (cstat == 0x40) indicators > >> because > >> + * real devices expect a 24 byte SenseID buffer, and virtio devices > >> expect > >> + * a much larger buffer. Neither device type can tolerate a buffer > >> size > >> + * different from what they expect so they set this indicator. > > > > Hm... do you have details? Is that basic vs. extended SenseID > > information? > > > > (If the code in QEMU is making incorrect assumptions, I'd like to fix > > that.) > > I really have no idea and was hoping someone who knows virtio ccw better > than myself would have some ideas. This comment simply documents what I > discovered in testing. I can look into it more if no one else has any > information on this. FWIW, it has been working without issue in my testing. OK, I've looked at this a bit more. It seems that we always get at least the basic information; the command, however, provides for a variable length (the CIWs). The Linux kernel always tries to get the maximum length (basic sense id information + maximum number possible number of CIWs), but sets SLI as it may get less of that. I'm not sure what I should return in QEMU for emulated devices, the documentation of SenseID I could find is a bit light on details (as the data can be of variable length). I think you should simply always use SLI, as you don't know the length of the SenseID data you can get beforehand. (BTW, is there a newer public version of SA22-7204-01 - Common I/O Device Commands - available? That one is a bit dated.)