qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] IF_AHCI RFC (Was Re: Are -cdrom/-hda (or -drive if=ide) sup


From: John Snow
Subject: [Qemu-devel] IF_AHCI RFC (Was Re: Are -cdrom/-hda (or -drive if=ide) supposed to work in q35?)
Date: Thu, 14 Aug 2014 16:09:51 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0



On 06/12/2014 05:03 AM, Markus Armbruster wrote:
    I've always argued for SATA, because for me if=ide does *not* imply a
    specific kind of HBA any more than if=scsi does, and the "natural"
    HBA for Q35 is AHCI in SATA mode.

    Kevin (cc'ed) has argued for a way to make it connect in legacy PATA
    mode.  I'd be fine with that, as long as it's off by default.

    Patches welcome.


I have a design question for fixing this issue.

I wired up the Q35 board to search for and add drives for bus=0 to bus=MAX_SATA_PORTS with unit=0 as seen in the blockdev.c dinfo list, as queried by using drive_get or drive_get_by_index.

This part works just fine, and -hda and -cdrom work well.

However, from the frontend, -hd[a-d] and -cdrom assume a particular index number which is later converted into a bus,unit pairing under drive_new via the functions drive_index_to_bus_id and drive_index_to_unit_id. The math performed here is a function of the IF type we use which is by default IF_IDE. IF_IDE specifies there are two units available per bus.

The math for IF_IDE doesn't work for AHCI connected devices, though, which do not allow for master/slave configurations -- meaning that we actually may wind up only picking up -hda, -hdc and -cdrom, and -hdb and -hdd would go unnoticed because we don't have or look for slaves.

I have two immediate thoughts for how to correct this:

(1) The disgusting way that will make you hate me:
Let drive_new do its bad math, but in the q35 initialization, look for drives with a unit != 0 and "fix" them in the drive info entries by adjusting their bus and unit numbers to be compliant with an AHCI setup. This has the least impact, but it looks gross, and could cause problems if anybody ever tries to do any other kind of initialization between initial option parsing and when we do our chipset initialization.

(2) Add IF_SATA or IF_AHCI where we can specify that the number of units per bus is 1, and adjust the code accordingly so things get entered into the drive list properly from the start, and picking them up from the Q35 board initialization is trivial.

The option I want is #2, but I am not familiar enough with the depth or breadth of the code to confidently say this is the right choice, so I am requesting some feedback on how people feel about this decision.

As an added bonus for #2, this does give us another avenue to distinguish between legacy and AHCI interfaces on the Q35 board, and it would allow us to specify for Q35 that the default interface is IF_AHCI/IF_SATA to make the -hd[a-d], -cdrom shorthands more explicit about what they're going to try to do on our board.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]