当前位置: 首页 > news >正文

Basic Facilities of a Virtio Device (二)

Basic Facilities of a Virtio Device (二)

  • 9 Driver Notifications
  • 2.10 Shared Memory Regions
    • 10.1 Addressing within regions
    • 10.2 Device Requirements: Shared Memory Regions
  • 11 Exporting Objects

该文是通过对virtio-1.2官方文档翻译生成的,文档的卸载地址为: http://docs.oasis-open.org/virtio/virtio/v1.2/

9 Driver Notifications

The driver is sometimes required to send an available buffer notification to the device.
驱动程序有时需要向该设备发送一个可用的缓冲区通知。
When VIRTIO_F_NOTIFICATION_DATA has not been negotiated, this notification involves sending the virtqueue number to the device (method depending on the transport).
当VIRTIO_F_NOTIFICATION_DATA尚未协商时,此通知涉及将半虚拟队列virtqueue 队列号发送到设备(方法取决于传输)。
However, some devices benefit from the ability to find out the amount of available data in the queue without accessing the virtqueue in memory: for efficiency or as a debugging aid.
然而,一些设备受益于能够在不访问内存中的半虚拟队列virtqueue 的情况下查找队列中的可用数据量:为了提高效率或作为调试辅助工具。
To help with these optimizations, when VIRTIO_F_NOTIFICATION_DATA has been negotiated, driver notifications to the device include the following information:
为了帮助这些优化,当VIRTIO_F_NOTIFICATION_DATA已经协商后,驱动程序给设备的通知包括以下信息:
vqn VQ number to be notified.
vqn 要通知的VQ号。
next_off Offset within the ring where the next available ring entry will be written. When VIRTIO_F_RING_PACKED has not been negotiated this refers to the 15 least significant bits of the available index. When VIRTIO_F_RING_PACKED has been negotiated this refers to the offset (in units of descriptor entries) within the descriptor ring where the next available descriptor will be written.
next_off 在环内书下一个可用环项入口的偏移。当VIRTIO_F_RING_PACKED 还没有被协商时,这是指可用索引的15个最低有效位。当VIRTIO_F_RING_PACKED被协商时,这指的是描述符环内的偏移量(以描述符条目为单位)下一个可用的描述符将被写入其中。
next_wrap Wrap Counter. With VIRTIO_F_RING_PACKED this is the wrap counter referring to the next available descriptor. Without VIRTIO_F_RING_PACKED this is the most significant bit (bit 15) of the available index.
next_wrap 包装计数器。对于VIRTIO_F_RING_PACKED,这是引用下一个可用描述符的包装计数器。如果没有VIRTIO_F_RING_PACKED,这是可用索引中最高有效位(第15位)。
Note that the driver can send multiple notifications even without making any more buffers available. When VIRTIO_F_NOTIFICATION_DATA has been negotiated, these notifications would then have identical next_off and next_wrap values.
需要注意的是,驱动程序即使不提供任何更多的缓冲区,也可以发送多个通知。当VIRTIO_F_NOTIFICATION_DATA协商后,这些通知将具有相同的next_off和nexat_wrap值。

2.10 Shared Memory Regions

Shared memory regions are an additional facility available to devices that need a region of memory that’s continuously shared between the device and the driver, rather than passed between them in the way virtqueue elements are.
共享内存区域对于设备是一个额外的设施,需要在设备和驱动程序之间持续共享的内存区域,而不是像virtqueue元素那样在它们之间传递。
Example uses include shared caches and version pools for versioned data structures.
示例使用包括版本化数据结构的共享缓存和版本池。
The memory region is allocated by the device and presented to the driver. Where the device is implemented in software on a host, this arrangement allows the memory region to be allocated by a library on the host, which the device may not have full control over.
内存区域由设备申请分配并呈现给驱动程序。当设备在主机上的软件中实现时,这种安排允许由主机上的库分配内存区域,而设备可能无法完全控制该区域。
A device may have multiple shared memory regions associated with it. Each region has a shmid to identify it, the meaning of which is device-specific.
一个设备可能具有与之关联的多个共享内存区域。每个区域都有一个shmid来识别它,其含义是特定于设备的。
Enumeration and location of shared memory regions is performed in a transport-specific way.
共享内存区域的枚举和位置以特定于传输的方式执行
Memory consistency rules vary depending on the region and the device and they will be specified as required by each device.
内存一致性规则根据区域和设备的不同而有所不同,它们将根据每个设备的要求进行指定。

10.1 Addressing within regions

References into shared memory regions are represented as offsets from the beginning of the region instead of absolute memory addresses. Offsets are used both for references between structures stored within shared memory and for requests placed in virtqueues that refer to shared memory. The shmid may be explicit or may be inferred from the context of the reference.
对共享内存区域的引用被表示为从区域开始的偏移量,而不是绝对内存地址。偏移量既用于存储在共享内存中的结构之间的引用,也用于引用共享内存的virtqueues中的请求。shmid可以是明确的,也可以从参考文献的上下文中推断出来。

10.2 Device Requirements: Shared Memory Regions

Shared memory regions MUST NOT expose shared memory regions which are used to control the operation of the device, nor to stream data.
共享内存区域不能公开用于控制设备操作的共享内存区域,也不能流化数据。

11 Exporting Objects

When an object created by one virtio device needs to be shared with a seperate virtio device, the first device can export the object by generating a UUID which can then be passed to the second device to identify the object.
当一个virtio设备创建的对象需要与一个单独的virtio设备共享时,第一个设备可以通过生成UUID来导出该对象,然后将UUID传递给第二个设备来识别该对象。
What constitutes an object, how to export objects, and how to import objects are defined by the individual device types. It is RECOMMENDED that devices generate version 4 UUIDs as specified by [RFC4122].
一个对象有什么组成、如何导出对象以及如何导入对象都由各个设备类型定义。建议通过[RFC4122]标准去生成设备指定的版本4 uuid。

相关文章:

  • redis五种数据类型对应的底层数据结构
  • Linux 必会基础语句 软硬连接区别 Linux文件类型
  • 【PAT甲级】1141 PAT Ranking of Institutions
  • JAVA基础(三十二)——反射之创建对象
  • java优秀毕业生推荐系统ssm
  • Group DETR
  • 设计模式 工厂方法模式
  • 自动控制原理7.3---z变换理论
  • 基于ISO14229协议的安全访问系列_1
  • 自动控制原理7.4---离散系统的数学模型
  • 【ELFK】之zookeeper
  • ALTERA FPGA IPCORE核之FIFO详细教程
  • 【ELK】日志分析系统概述及部署
  • MyBatis一对多查询,MyBatis中resultMap的使用,MyBatis中collection注意事项,MyBatis的级联搜索
  • STC15单片机-RS-485通信
  • 11111111
  • Angular数据绑定机制
  • conda常用的命令
  • CoolViewPager:即刻刷新,自定义边缘效果颜色,双向自动循环,内置垂直切换效果,想要的都在这里...
  • Java反射-动态类加载和重新加载
  • java小心机(3)| 浅析finalize()
  • vue-cli在webpack的配置文件探究
  • vue的全局变量和全局拦截请求器
  • Webpack入门之遇到的那些坑,系列示例Demo
  • 安卓应用性能调试和优化经验分享
  • 动态规划入门(以爬楼梯为例)
  • 对JS继承的一点思考
  • 适配iPhoneX、iPhoneXs、iPhoneXs Max、iPhoneXr 屏幕尺寸及安全区域
  • 详解NodeJs流之一
  • 一份游戏开发学习路线
  • #[Composer学习笔记]Part1:安装composer并通过composer创建一个项目
  • $GOPATH/go.mod exists but should not goland
  • (function(){})()的分步解析
  • (ISPRS,2023)深度语义-视觉对齐用于zero-shot遥感图像场景分类
  • (pytorch进阶之路)CLIP模型 实现图像多模态检索任务
  • (Redis使用系列) Springboot 使用redis实现接口幂等性拦截 十一
  • (待修改)PyG安装步骤
  • (附程序)AD采集中的10种经典软件滤波程序优缺点分析
  • (附源码)springboot工单管理系统 毕业设计 964158
  • (力扣题库)跳跃游戏II(c++)
  • (七)MySQL是如何将LRU链表的使用性能优化到极致的?
  • (循环依赖问题)学习spring的第九天
  • (转载)(官方)UE4--图像编程----着色器开发
  • (最简单,详细,直接上手)uniapp/vue中英文多语言切换
  • .NET 8 中引入新的 IHostedLifecycleService 接口 实现定时任务
  • .NetCore实践篇:分布式监控Zipkin持久化之殇
  • .Net的DataSet直接与SQL2005交互
  • .NET国产化改造探索(一)、VMware安装银河麒麟
  • .NET和.COM和.CN域名区别
  • .net和jar包windows服务部署
  • .Net中ListT 泛型转成DataTable、DataSet
  • .Net中间语言BeforeFieldInit
  • .NET中两种OCR方式对比
  • .NET中使用Protobuffer 实现序列化和反序列化
  • .pyc文件还原.py文件_Python什么情况下会生成pyc文件?