Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Anthony Liguori
2009-06-15T13:45:30Z

Avi Kivity wrote:
> On 06/15/2009 04:20 PM, Anthony Liguori wrote:
>> It's not at all that simple. SCSI has a hierarchical address
>> mechanism with 0-7 targets but then potentially multiple LUNs per
>> target. Today, we always emulate a single LUN per target but if we
>> ever wanted to support more than 7 disks on a SCSI controller, we
>> would have to add multiple LUN support too. So the current linear
>> unit= parameter is actually pretty broken for SCSI.
>
> Well, another level in the hierarchy, but I don't think it materially
> changes things.

Depends on whether you expect to say index=0,lun=3 or index=3. If you
mean the later, then it's quite conceivable that each target supports
less than the maximum number of LUNs. This makes things pretty
confusing to the user because they have to know that in the current
implementation, index=0 is valid, index=1 isn't, but index=8 is.

>> No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious
>> what it should do to you that's because it isn't at all obvious :-)
>> It ends up skipping a predefined number of locations in the drive
>> table. This is pretty broken fundamentally because it assumes
>> controllers always support a fixed number of devices. Nothing really
>> respects bus_id though so in practice, I assume it's almost
>> universally broken.
>
> Isn't the drive table something totally internal? And how does bus=
> relate to it?

The reality of unit=X,bus=Y,if=Z is that they expand to:

drive_table_index=Y*max_devs[Z] + X

Whereas max_devs = {"ide":4, "scsi": 7, *:0}

How drive_table_index is interpreted is "if" specific. For if=scsi,
each lsi device gets a base drive table index that starts at bus_index *
7. For virtio, the first empty spot in drive_table results in no more
drives being created.

It's broken by design.

Regards,

Anthony Liguori