2019-10-22 16:51:39 +08:00
|
|
|
.. _ahci-hld:
|
|
|
|
|
|
|
|
AHCI Virtualization in Device Model
|
|
|
|
###################################
|
|
|
|
|
2019-11-08 07:24:31 +08:00
|
|
|
AHCI (Advanced Host Controller Interface) is a hardware mechanism
|
2021-05-13 07:30:45 +08:00
|
|
|
that enables software to communicate with Serial ATA devices. AHCI HBA
|
2019-10-22 16:51:39 +08:00
|
|
|
(host bus adapters) is a PCI class device that acts as a data movement
|
|
|
|
engine between system memory and Serial ATA devices. The ACPI HBA in
|
2019-11-08 07:24:31 +08:00
|
|
|
ACRN supports both ATA and ATAPI devices. The architecture is shown in
|
2021-05-13 07:30:45 +08:00
|
|
|
the diagram below:
|
2019-10-22 16:51:39 +08:00
|
|
|
|
|
|
|
.. figure:: images/ahci-image1.png
|
|
|
|
:align: center
|
|
|
|
:width: 750px
|
|
|
|
:name: achi-device
|
|
|
|
|
2019-11-08 07:24:31 +08:00
|
|
|
HBA is registered to the PCI system with device id 0x2821 and vendor id
|
2021-05-13 07:30:45 +08:00
|
|
|
0x8086. Its memory registers are mapped in BAR 5. It supports only six
|
|
|
|
ports (refer to ICH8 AHCI). The AHCI driver in the User VM can access HBA in
|
|
|
|
DM through the PCI BAR, and HBA can inject MSI interrupts through the PCI
|
2019-10-22 16:51:39 +08:00
|
|
|
framework.
|
|
|
|
|
2020-04-11 01:44:30 +08:00
|
|
|
When the application in the User VM reads data from /dev/sda, the request will
|
2021-05-13 07:30:45 +08:00
|
|
|
be sent through the AHCI driver and then the PCI driver. The Hypervisor will
|
|
|
|
trap the request from the User VM and dispatch it to the DM. According to the
|
|
|
|
offset in the BAR, the request will be dispatched to the port control handler.
|
|
|
|
Then the request is parsed to a block I/O request which can be processed by
|
|
|
|
the Block backend model.
|
2019-10-22 16:51:39 +08:00
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
***-s <slot>,ahci,<type:><filepath>***
|
|
|
|
|
2020-04-14 06:29:10 +08:00
|
|
|
Type: 'hd' and 'cd' are available.
|
2019-10-22 16:51:39 +08:00
|
|
|
|
2021-05-13 07:30:45 +08:00
|
|
|
Filepath: the path for the backend file; could be a partition or a
|
2019-10-22 16:51:39 +08:00
|
|
|
regular file.
|
|
|
|
|
2020-04-14 06:29:10 +08:00
|
|
|
For example,
|
2019-10-22 16:51:39 +08:00
|
|
|
|
2020-04-11 01:44:30 +08:00
|
|
|
System VM: -s 20,ahci,\ `hd:/dev/mmcblk0p1 <http://hd/dev/mmcblk0p1>`__
|
2019-10-22 16:51:39 +08:00
|
|
|
|
2020-04-11 01:44:30 +08:00
|
|
|
User VM: /dev/sda
|