Re: [Qemu-block] [Qemu-devel] [RFC v4 08/13] ide: enumerate_slots implementation

2017-08-21 Thread John Snow


On 08/18/2017 12:57 PM, Eduardo Habkost wrote:
> On Wed, Aug 16, 2017 at 05:46:18PM -0400, John Snow wrote:
>>
>>
>> On 08/14/2017 05:57 PM, Eduardo Habkost wrote:
>>> Example output when using "-machine q35":
>>>
>>>   {
>>> "available": true,
>>> "count": 1,
>>> "device-types": [
>>>   "ide-device"
>>> ],
>>> "hotpluggable": false,
>>> "opts": [
>>>   { "option": "unit", "values": 0 },
>>>   { "option": "bus", "values": "ide.2" }
>>> ],
>>> "opts-complete": true
>>>   }
>>>   {
>>> "available": false,
>>> "count": 1,
>>> "device": "/machine/unattached/device[19]",
>>> "device-types": [
>>>   "ide-device"
>>> ],
>>> "hotpluggable": false,
>>> "opts": [
>>>   { "option": "unit", "values": 1 },
>>>   { "option": "bus", "values": "ide.2" } ],
>>> "opts-complete": true
>>>   }
>>>   {
>>> "available": true,
>>> "count": 10,
>>> "device-types": [
>>>   "ide-device"
>>> ],
>>> "hotpluggable": false,
>>> "opts": [
>>>   { "option": "unit", "values": [ [ 0, 1 ] ] },
>>
>> Hm, these unit values aren't really correct -- we do not support
>> primary/secondary semantics for IDE buses on the AHCI device. I guess
>> they technically exist, but you cannot use them for anything.
>>
>> Should I do something to "disable" or otherwise hide the unusable
>> secondary unit slots for AHCI devices?
> 
> If the device is already rejecting -device ...,unit=1, then the
> bug is in my implementation of enumerate_devices.  Maybe it
> should just look at IDEBus::max_units to find that out?
> 

jhuston@probe (master) ~/s/q/b/git>
./x86_64-softmmu/qemu-system-x86_64 \
-M q35 \
-nodefaults \
-device ich9-ahci,id=ahci0 \
-drive id=bar,file=/media/ext/img/f25.qcow2,if=none \
-device ide-hd,id=foo,bus=ahci0.0,drive=bar,unit=1 \
-vga std

qemu-system-x86_64: -device ide-hd,id=foo,bus=ahci0.0,drive=bar,unit=1:
Can't create IDE unit 1, bus supports only 1 units
qemu-system-x86_64: -device ide-hd,id=foo,bus=ahci0.0,drive=bar,unit=1:
Device initialization failed.

based on;

IDEBus.max_units

as seen in:

hw/ide/qdev.c line 93.


Seems a bit like a hack on IDE's end -- but if your enumerate devices
code has a call-in inside of the IDE layer, please do check the
IDEBus::max_units property.

--js



Re: [Qemu-block] [Qemu-devel] [RFC v4 08/13] ide: enumerate_slots implementation

2017-08-17 Thread John Snow


On 08/17/2017 12:54 AM, Markus Armbruster wrote:
> John Snow  writes:
> 
>> On 08/14/2017 05:57 PM, Eduardo Habkost wrote:
>>> Example output when using "-machine q35":
>>>
>>>   {
>>> "available": true,
>>> "count": 1,
>>> "device-types": [
>>>   "ide-device"
>>> ],
>>> "hotpluggable": false,
>>> "opts": [
>>>   { "option": "unit", "values": 0 },
>>>   { "option": "bus", "values": "ide.2" }
>>> ],
>>> "opts-complete": true
>>>   }
>>>   {
>>> "available": false,
>>> "count": 1,
>>> "device": "/machine/unattached/device[19]",
>>> "device-types": [
>>>   "ide-device"
>>> ],
>>> "hotpluggable": false,
>>> "opts": [
>>>   { "option": "unit", "values": 1 },
>>>   { "option": "bus", "values": "ide.2" } ],
>>> "opts-complete": true
>>>   }
>>>   {
>>> "available": true,
>>> "count": 10,
>>> "device-types": [
>>>   "ide-device"
>>> ],
>>> "hotpluggable": false,
>>> "opts": [
>>>   { "option": "unit", "values": [ [ 0, 1 ] ] },
>>
>> Hm, these unit values aren't really correct -- we do not support
>> primary/secondary semantics for IDE buses on the AHCI device. I guess
>> they technically exist, but you cannot use them for anything.
>>
>> Should I do something to "disable" or otherwise hide the unusable
>> secondary unit slots for AHCI devices?
> 
> I think that would make this introspection more useful.
> 

OK, let me look into how to meaningfully disable them. I didn't think
they were addressable in any tangible way currently, you certainly can't
put devices on them. I'm not sure where these values are coming from --
I'll play with the patches.

The only reason they even technically exist is because IDEBus comes
indelibly with two IDEStates baked in -- it can't be changed currently,
because everything's all wonky in IDE land.

I really ought to just rip off the bandaid and do an aggressive
refactoring .. :|




Re: [Qemu-block] [Qemu-devel] [RFC v4 08/13] ide: enumerate_slots implementation

2017-08-16 Thread Markus Armbruster
John Snow  writes:

> On 08/14/2017 05:57 PM, Eduardo Habkost wrote:
>> Example output when using "-machine q35":
>> 
>>   {
>> "available": true,
>> "count": 1,
>> "device-types": [
>>   "ide-device"
>> ],
>> "hotpluggable": false,
>> "opts": [
>>   { "option": "unit", "values": 0 },
>>   { "option": "bus", "values": "ide.2" }
>> ],
>> "opts-complete": true
>>   }
>>   {
>> "available": false,
>> "count": 1,
>> "device": "/machine/unattached/device[19]",
>> "device-types": [
>>   "ide-device"
>> ],
>> "hotpluggable": false,
>> "opts": [
>>   { "option": "unit", "values": 1 },
>>   { "option": "bus", "values": "ide.2" } ],
>> "opts-complete": true
>>   }
>>   {
>> "available": true,
>> "count": 10,
>> "device-types": [
>>   "ide-device"
>> ],
>> "hotpluggable": false,
>> "opts": [
>>   { "option": "unit", "values": [ [ 0, 1 ] ] },
>
> Hm, these unit values aren't really correct -- we do not support
> primary/secondary semantics for IDE buses on the AHCI device. I guess
> they technically exist, but you cannot use them for anything.
>
> Should I do something to "disable" or otherwise hide the unusable
> secondary unit slots for AHCI devices?

I think that would make this introspection more useful.