该文是通过对virtio-1.2官方文档翻译生成的,文档的下载地址为: http://docs.oasis-open.org/virtio/virtio/v1.2/
The driver MUST follow this sequence to initialize a device:
驱动程序必须按照以下顺序来初始化一个设备:
Legacy devices did not support the FEATURES_OK status bit, and thus did not have a graceful way for the device to indicate unsupported feature combinations. They also did not provide a clear mechanism to end feature negotiation, which meant that devices finalized features on first-use, and no features could be introduced which radically changed the initial operation of the device.
遗留设备不支持FEATURES_OK状态位,因此该设备没有一种优雅的方式来指示不受支持的功能组合。它们也没有提供一个明确的机制来结束功能协商,这意味着设备在首次使用时最终确定了功能,也没有引入任何从根本上改变设备最初操作的功能。
Legacy driver implementations often used the device before setting the DRIVER_OK bit, and sometimes even before writing the feature bits to the device.
传统的驱动程序实现通常在设置DRIVER_OK位之前使用该设备,有时甚至在将特性位写入设备之前也会使用该设备。
The result was the steps 5 and 6 were omitted, and steps 4, 7 and 8 were conflated.
结果是省略了步骤5和步骤6,并将步骤4、步骤7和步骤8合并。
Therefore, when using the legacy interface:
因此,在使用遗留接口时:
• The transitional driver MUST execute the initialization sequence as described in 3.1 but omitting the steps 5 and 6.
过渡驱动程序必须执行3.1中描述的初始化序列,但省略了步骤5和步骤6。
• The transitional device MUST support the driver writing device configuration fields before the step 4.
过渡设备必须支持在步骤4之前的驱动程序写入设备配置字段。
• The transitional device MUST support the driver using the device before the step 8.
过渡设备必须在步骤8之前支持使用该设备的驱动程序。
When operating the device, each field in the device configuration space can be changed by either the driver or the device.
在操作设备时,驱动程序或设备都可以更改设备配置空间中的每个字段。
Whenever such a configuration change is triggered by the device, driver is notified. This makes it possible for drivers to cache device configuration, avoiding expensive configuration reads unless notified.
每当设备触发这样的配置更改时,就会通知驱动程序。这使得驱动程序可以缓存设备配置,避免了昂贵的配置读取,除非得到通知。
For devices where the device-specific configuration information can be changed, a configuration change notification is sent when a device-specific configuration change occurs.
对于可以更改特定于设备的配置信息的设备,当设备特定的配置更改发生时,会发送配置更改通知。
In addition, this notification is triggered by the device setting DEVICE_NEEDS_RESET (see 2.1.2).
此外,此通知将由设备设置DEVICE_NEEDS_RESET触发(参见2.1.2)。
Once the driver has set the DRIVER_OK status bit, all the configured virtqueue of the device are considered live. None of the virtqueues of a device are live once the device has been reset.
一旦驱动程序设置了DRIVER_OK状态位,设备的所有配置的virtqueue 都被认为是可用的。一旦设备被重置,设备的virtqueues都不再可用。
A driver MUST NOT alter virtqueue entries for exposed buffers, i.e., buffers which have been made available to the device (and not been used by the device) of a live virtqueue.
驱动程序不能更改暴露的缓冲区的virtqueue 条目,即已提供给实时virtqueue 的设备(但未被设备使用)的缓冲区。
Thus a driver MUST ensure a virtqueue isn’t live (by device reset) before removing exposed buffers.
因此,在删除暴露的缓冲区之前,驱动程序必须确保virtqueue 不活动(通过设备重置)。