当前位置:网站首页>IOMMU (VII) -vfio and mdev
IOMMU (VII) -vfio and mdev
2022-06-24 12:35:00 【Huiwei】
Have a look first vifo and mdev What modules does the kernel have , Then analyze the relationship between modules .
vfio It is an interface between user mode and kernel mode , Be similar to vhost and vhost-user, The specific usage is vfio.ko adopt /dev/vfio In the kernel, the user mode is provided with api,qemu perhaps dpdk use api Interact with kernel modules .
vfio-pci Is a kernel driver , Network card and NVME Disk and other devices can use this driver , Use vfio-pci Will be called to vfio-pci Of probe.vfio-pci For standard pci equipment , If multiple virtual machines want to use this pci The device is turned on pci The equipment sr-iov function , This pci The device becomes multiple standard pci equipment , One for each virtual machine .sr-iov It is a segmentation method of hardware resources , Not only DMA queue Such data slicing ,pci config space And so on , The hardware implementation is too complex ,GPU and NVME It is difficult for these devices to realize the segmentation of the control surface , But there are other ways to segment the data plane , Different virtual machines can share data plane functions and ensure isolation , Call this device mdev equipment , It's strict mediated Devices that can be virtualized .mdev.ko Provide users with interfaces to create virtual mdev equipment , Make virtual mdev And reality mdev relation , Put the real mdev It is called the parent device , At the same time, the virtual mdev And drive vfio-mdev matching ,vfio-mdev Begin probe.
vfio-pci and mdev-vfio Of probe All call vfio_add_group_dev Add your own ops, Generate a dev,qemu adopt /dev/vfio Access to this dev, Operate this again dev Is called to vfio-pci and vfio-mdev Of ops function ,vfio-pci work ,vfio-mdev Basically nothing , Call the parent device as soon as you change hands ops work , It is equivalent to calling GPU perhaps NVME The driver .sr-iov yes pci Standard device virtualization solutions ,mdev For the device virtualization solution privately owned by the manufacturer , The driver is implemented by the manufacturer , Hardware is also made by manufacturers , The combination of driver and hardware can achieve the effect of virtualization .
[[email protected] 81]# ll /sys/class/vfio/81/dev -r--r--r--. 1 root root 4096 May 28 10:31 /sys/class/vfio/81/dev
vfio group Not a concept created out of thin air ,vfio group and IOMMU The hardware group Closely related , therefore vfio Another important function is vfio_register_iommu_driver,vfio_iommu_type1.ko Just call this function to vfio Action registered IOMMU Of ops, One device DMA Use of pagetable You can go through this ops Configuration to IOMMU in .
qemu call memory_region_init_io register vfio-pci The equipment config space, Drive write in virtual machine config space,qemu Intercept and simulate .
pci_host_data_write->pci_data_write->pci_host_config_write_common->vfio_pci_write_config->vfio_msi_enable
qemu Call kernel vfio,irqbypass Used for holding vfio and kvm Connect .
vfio_msi_enable->vfio_enable_vectors(qemu Code )->vfio_pci_set_irqs_ioctl( kernel vfio Code )->vfio_pci_set_msi_trigger->vfio_msi_set_block->vfio_msi_set_vector_signal->irq_bypass_register_producer->pi_update_irte
qemu Call to the kernel at the same time kvm.
vfio_msi_enable->vfio_add_kvm_msi_virq->kvm_irqchip_add_irqfd_notifier_gsi->kvm_irqchip_assign_irqfd(qemu Code )->kvm_vm_ioctl(kvm Code )->kvm_irqfd->kvm_irqfd_assign->irq_bypass_register_consumer
The peripheral interrupt is coming ,vfio Handle ,signal kvm,kvm Then inject the virtual interrupt into the virtual machine .
vfio_msihandler->eventfd_signal wakeup 了 irqfd_wakeup->schedule_work
irqfd_inject->kvm_set_irq Interrupt to register
边栏推荐
- Is GF Securities reliable? Is it safe to open a securities account?
- GTEST from getting started to getting started
- pipeline groovy
- Discussion on redis communication protocol
- Clickhouse uses distributed join of pose series
- Based on am335x development board arm cortex-a8 -- acontis EtherCAT master station development case
- ArrayList # sublist these four holes, you get caught accidentally
- Data stack technology sharing: open source · data stack - extend flinksql to realize the join of flow and dimension tables
- 9+! Predicting lymph node status from histology of colorectal cancer by deep learning
- Continuous testing | key to efficient testing in Devops Era
猜你喜欢

GLOG from getting started to getting started

GTEST from getting started to getting started

Opencv learning notes -- Separation of color channels and multi-channel mixing

How stupid of me to hire a bunch of programmers who can only "Google"!

Opencv learning notes - regions of interest (ROI) and image blending

How is the e-commerce red envelope realized? For interview (typical high concurrency)

Opencv learning notes - Discrete Fourier transform
[mysql_16] variables, process control and cursors

QT -- the qtabwidget supports dragging tabbar items

解析nc格式文件,GRB格式文件的依赖包edu.ucar.netcdfAll的api 学习
随机推荐
Pipeline post instruction
巧妙构思-铁死亡调节因子分型预后发6+
MySQL 外键影响
Single gene pan cancer + simple experiment can be published 7 points+
单基因泛癌+简单实验就能发表7分+
[5 minutes to play lighthouse] create an immersive markdown writing environment
[mysql_16] variables, process control and cursors
深度学习~11+高分疾病相关miRNA研究新视角
How to apply for new bonds is it safe to open an account
mLife Forum | 微生物组和数据挖掘
一文讲透植物内生菌研究怎么做 | 微生物专题
Istio practical skills: using prism to construct multi version test services
Node cache vs browser cache
Based on am335x development board arm cortex-a8 -- acontis EtherCAT master station development case
Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!
JS和TS中常用特殊字符
Google hacking search engine attack and Prevention
How to purchase new bonds is it safe to open an account
Tsingsee green rhino video "cloud side end" +ai intelligent security system is integrated into the mainstream development trend
Difference between X12 830 and 862 messages