All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] How to modify QEMU source to read the bus for SATA directly?
@ 2015-04-16 13:25 Peter Teoh
  2015-04-16 13:43 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Teoh @ 2015-04-16 13:25 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

My objective is not to emulate the SATA disk in anyway, but to passthrough
all command the guest OS (either Windows or Linux) issued directly to the
underlying harddisk.

Will the following parameters achieved that goal?

./x86_64-softmmu/qemu-system-x86_64 \
    -drive file=...,if=none,id=mydisk \
    -device ich9-ahci,id=ahci \
    -device ide-drive,drive=mydisk,bus=ahci.0

In one PC (Intel-based) I found the "ich9-ahci" in the hardware description
output (using "lshw").

But in another PC (AMD-based) the "lshw" output is as follows:

        *-storage
             description: SATA controller
             product: FCH SATA Controller [AHCI mode]
             vendor: Advanced Micro Devices, Inc. [AMD]
             physical id: 11
             bus info: pci@0000:00:11.0
             version: 40
             width: 32 bits
             clock: 66MHz
             capabilities: storage msi ahci_1.0 bus_master cap_list
             configuration: driver=ahci latency=32
             resources: irq:83 ioport:f140(size=8) ioport:f130(size=4)
ioport:f120(size=8) ioport:f110(size=4) ioport:f100(size=16)
memory:feb70000-feb707ff

Now my question is:   Is it possible to modify the QEMU source code, or
pass in the correct parameters in the command line, so as provide direct
I/O access from the QEMU guest all the way to the underlying host's AHCI
sata bus (based on my AMD's hardware configuration as above)?


-- 
Regards,
Peter Teoh

[-- Attachment #2: Type: text/html, Size: 1872 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] How to modify QEMU source to read the bus for SATA directly?
  2015-04-16 13:25 [Qemu-devel] How to modify QEMU source to read the bus for SATA directly? Peter Teoh
@ 2015-04-16 13:43 ` Paolo Bonzini
  2015-04-16 14:26   ` Peter Teoh
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2015-04-16 13:43 UTC (permalink / raw)
  To: Peter Teoh, qemu-devel



On 16/04/2015 15:25, Peter Teoh wrote:
> 
> Now my question is:   Is it possible to modify the QEMU source code, or
> pass in the correct parameters in the command line, so as provide direct
> I/O access from the QEMU guest all the way to the underlying host's AHCI
> sata bus (based on my AMD's hardware configuration as above)?

You can use PCI passthrough and let the guest use the whole SATA bus, if
you have another way to access other disks on the same bus (e.g. boot
from a USB stick or access the filesystems on NFS).

Or you can use SCSI passthrough and pass the /dev/sdX device to the
guest, e.g.

    -device virtio-scsi-pci
    -drive if=none,file=/dev/sdb,id=sdb,cache=none,format=raw
    -device scsi-block,drive=sdb

The guest then will talk to the host's ATA->SCSI translation layer, and
will be able to send raw ATA commands via the ATA PASSTHROUGH command.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] How to modify QEMU source to read the bus for SATA directly?
  2015-04-16 13:43 ` Paolo Bonzini
@ 2015-04-16 14:26   ` Peter Teoh
  2015-04-16 14:39     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Teoh @ 2015-04-16 14:26 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

On Thu, Apr 16, 2015 at 9:43 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:

>
>
> On 16/04/2015 15:25, Peter Teoh wrote:
> >
> > Now my question is:   Is it possible to modify the QEMU source code, or
> > pass in the correct parameters in the command line, so as provide direct
> > I/O access from the QEMU guest all the way to the underlying host's AHCI
> > sata bus (based on my AMD's hardware configuration as above)?
>
> You can use PCI passthrough and let the guest use the whole SATA bus, if
> you have another way to access other disks on the same bus (e.g. boot
> from a USB stick or access the filesystems on NFS).
>
> Or you can use SCSI passthrough and pass the /dev/sdX device to the
> guest, e.g.
>
>     -device virtio-scsi-pci
>     -drive if=none,file=/dev/sdb,id=sdb,cache=none,format=raw
>     -device scsi-block,drive=sdb
>
> The guest then will talk to the host's ATA->SCSI translation layer, and
> will be able to send raw ATA commands via the ATA PASSTHROUGH command.
>
> Paolo
>

Thank you very much, that answer saved me many hours of search/trial and
errors.   And seems to work for now...need more testing.

Thanks again Paolo :-).


-- 
Regards,
Peter Teoh

[-- Attachment #2: Type: text/html, Size: 1842 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] How to modify QEMU source to read the bus for SATA directly?
  2015-04-16 14:26   ` Peter Teoh
@ 2015-04-16 14:39     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-04-16 14:39 UTC (permalink / raw)
  To: Peter Teoh; +Cc: qemu-devel



On 16/04/2015 16:26, Peter Teoh wrote:
> 
>     You can use PCI passthrough and let the guest use the whole SATA bus, if
>     you have another way to access other disks on the same bus (e.g. boot
>     from a USB stick or access the filesystems on NFS).
> 
>     Or you can use SCSI passthrough and pass the /dev/sdX device to the
>     guest, e.g.
> 
>         -device virtio-scsi-pci
>         -drive if=none,file=/dev/sdb,id=sdb,cache=none,format=raw
>         -device scsi-block,drive=sdb
> 
>     The guest then will talk to the host's ATA->SCSI translation layer, and
>     will be able to send raw ATA commands via the ATA PASSTHROUGH command.
> 
> Thank you very much, that answer saved me many hours of search/trial and
> errors.   And seems to work for now...need more testing.

FWIW, which one did you use and what kind of command did you need?

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-16 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 13:25 [Qemu-devel] How to modify QEMU source to read the bus for SATA directly? Peter Teoh
2015-04-16 13:43 ` Paolo Bonzini
2015-04-16 14:26   ` Peter Teoh
2015-04-16 14:39     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.