CN102722458A - I/ O (input/output) remapping method and device for plurality of shared systems - Google Patents
I/ O (input/output) remapping method and device for plurality of shared systems Download PDFInfo
- Publication number
- CN102722458A CN102722458A CN2012101728445A CN201210172844A CN102722458A CN 102722458 A CN102722458 A CN 102722458A CN 2012101728445 A CN2012101728445 A CN 2012101728445A CN 201210172844 A CN201210172844 A CN 201210172844A CN 102722458 A CN102722458 A CN 102722458A
- Authority
- CN
- China
- Prior art keywords
- address
- root node
- base address
- transaction packet
- function
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000013507 mapping Methods 0.000 claims abstract description 72
- 230000006870 function Effects 0.000 claims description 297
- 239000000284 extract Substances 0.000 claims description 28
- 238000000605 extraction Methods 0.000 claims description 25
- 230000000977 initiatory effect Effects 0.000 claims description 17
- 238000006243 chemical reaction Methods 0.000 claims description 16
- 238000013519 translation Methods 0.000 claims description 3
- 125000000524 functional group Chemical group 0.000 claims 26
- 230000008878 coupling Effects 0.000 claims 14
- 238000010168 coupling process Methods 0.000 claims 14
- 238000005859 coupling reaction Methods 0.000 claims 14
- 238000002386 leaching Methods 0.000 claims 4
- 238000010586 diagram Methods 0.000 description 10
- 230000006854 communication Effects 0.000 description 5
- 238000011144 upstream manufacturing Methods 0.000 description 5
- GNFTZDOKVXKIBK-UHFFFAOYSA-N 3-(2-methoxyethoxy)benzohydrazide Chemical compound COCCOC1=CC=CC(C(=O)NN)=C1 GNFTZDOKVXKIBK-UHFFFAOYSA-N 0.000 description 4
- FGUUSXIOTUKUDN-IBGZPJMESA-N C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 Chemical compound C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 FGUUSXIOTUKUDN-IBGZPJMESA-N 0.000 description 4
- 238000004891 communication Methods 0.000 description 4
- 238000013468 resource allocation Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Landscapes
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明公开一种用于多根I/O虚拟化共享系统的直接I/O重映射方法,该方法包括:步骤1,I/O设备功能基地址定义提取,记录基地址寄存器序号与其定义的地址窗口对应的基地址序号之间的映射关系;步骤2,主控制根节点PCIe域中功能基地址写存储,建立功能基地址序号到主控制根节点PCIe域的基地址的映射;步骤3,设备功能ID映射关系写存储,建立设备功能在主控制根节点PCIe域和从属根节点PCIe域中的ID号之间的映射;步骤4,从属根节点PCIe域中的功能基地址写存储,建立从属根节点PCIe域的基地址到其对应的功能基地址序号的映射;步骤5,直接I/O重映射,对从属根节点和I/O设备间事务包进行重映射操作。
The invention discloses a direct I/O remapping method for a multi-root I/O virtualization sharing system. The method includes: step 1, extracting the definition of the base address of the I/O device function, recording the serial number of the base address register and its defined The mapping relationship between the base address serial numbers corresponding to the address window; Step 2, write and store the functional base address in the main control root node PCIe domain, and establish the mapping from the functional base address serial number to the base address of the main control root node PCIe domain; Step 3, The device function ID mapping relationship is written and stored, and the mapping between the device function between the ID numbers in the master control root node PCIe domain and the slave root node PCIe domain is established; step 4, the function base address in the slave root node PCIe domain is written and stored, and established Mapping from the base address of the PCIe domain of the slave root node to its corresponding functional base address serial number; step 5, direct I/O remapping, remapping the transaction packet between the slave root node and the I/O device.
Description
技术领域 technical field
本发明涉及I/O虚拟化技术,特别是涉及多根I/O虚拟化共享系统的I/O重映射方法和装置。The invention relates to I/O virtualization technology, in particular to an I/O remapping method and device of a multi-root I/O virtualization sharing system.
背景技术 Background technique
PCIe(Peripheral Component Interface Express)设备功能在系统中的标识通常都用一个由总线号(BUS)/设备号(Device)/功能号(Function)组成的ID号(B/D/F)来指示。系统上电后,系统初始化软件首先根据ID路由对系统中所有的I/O设备进行枚举发现和初始化配置,同时也为设备功能分配了其在PCIe域中的ID号和其所映射的地址窗口等。设备初始化完成后,系统软件和驱动程序等上层软件可以通过ID或者地址路由定向到设备。在多根I/O虚拟化共享系统中,为了避免系统竞争和冲突,I/O设备能被多个根节点使用,但是只能由一个根节点控制。系统上电时,I/O设备功能首先被主控制根节点初始化配置其在主控制根节点PCIe域中的ID号和地址窗口。当设备功能被分配给从属根节点使用时,使用一个虚拟的设备功能作为从属根节点PCIe域的设备占位符,并接受从属根节点分配的本地PCIe域中的ID号和地址窗口。因此,对于从属根节点使用本地PCIe域的ID号和地址对设备功能进行的访问,需要进行重映射,才能实现从属根节点直接访问I/O设备。The identification of PCIe (Peripheral Component Interface Express) device functions in the system is usually indicated by an ID number (B/D/F) composed of bus number (BUS)/device number (Device)/function number (Function). After the system is powered on, the system initialization software first enumerates, discovers and initializes all the I/O devices in the system according to the ID route, and at the same time assigns its ID number in the PCIe domain and its mapped address to the device function window etc. After the device is initialized, upper-layer software such as system software and drivers can be directed to the device through ID or address routing. In a multi-root I/O virtualization sharing system, in order to avoid system competition and conflict, I/O devices can be used by multiple root nodes, but can only be controlled by one root node. When the system is powered on, the I/O device function is first initialized by the main control root node to configure its ID number and address window in the PCIe domain of the main control root node. When the device function is assigned to the slave root node, use a virtual device function as the device placeholder of the PCIe domain of the slave root node, and accept the ID number and address window in the local PCIe domain assigned by the slave root node. Therefore, for the slave root node to use the ID number and address of the local PCIe domain to access the device function, remapping is required to realize the slave root node directly accessing the I/O device.
发明内容 Contents of the invention
为解决上述问题,本发明提供了一种用于多根I/O虚拟化共享系统的直接I/O重映射方法,包括:In order to solve the above problems, the present invention provides a direct I/O remapping method for a multi-root I/O virtualization sharing system, comprising:
步骤1,I/O设备功能基地址定义提取,并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号之间的映射关系;Step 1, the I/O device function base address definition is extracted, and the mapping relationship between each base address register serial number and the base address serial number corresponding to the defined address window is recorded;
步骤2,主控制根节点PCIe域中的功能基地址写存储,建立功能基地址序号到其在主控制根节点PCIe域的基地址的映射;Step 2, write and store the function base address in the main control root node PCIe domain, and establish the mapping of the function base address serial number to its base address in the main control root node PCIe domain;
步骤3,设备功能ID映射关系写存储,建立设备功能在主控制根节点PCIe域和从属根节点PCIe域中的ID号之间的映射;Step 3, the device function ID mapping relationship is written and stored, and the mapping between the device function between the ID numbers in the master control root node PCIe domain and the slave root node PCIe domain is established;
步骤4,从属根节点PCIe域中的功能基地址写存储,建立从属根节点PCIe域的基地址到其对应的功能基地址序号的映射;Step 4, writing and storing the function base address in the PCIe domain of the slave root node, and establishing a mapping from the base address of the PCIe domain of the slave root node to its corresponding function base address serial number;
步骤5,直接I/O重映射,对从属根节点和I/O设备间的事务包进行重映射操作。Step 5, direct I/O remapping, remapping the transaction packets between the slave root node and the I/O device.
所述用于多根I/O虚拟化共享系统的直接I/O重映射方法,步骤1还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, step 1 also includes:
所述基地址定义提取是在主控制根节点系统发现阶段,获取I/O设备功能配置空间中通过各基地址寄存器(Base Address Register,BAR)定义的地址窗口类型,并提取各地址窗口对应的基地址掩码;The base address definition extraction is to obtain the address window type defined by each base address register (Base Address Register, BAR) in the I/O device function configuration space in the main control root node system discovery stage, and extract the address window type corresponding to each address window. base address mask;
所述基地址掩码,用于指定系统配置的地址窗口中地址的哪些位是固定位,通过所述基地址掩码可以提取访存地址对应的基地址;The base address mask is used to specify which bits of the address in the address window of the system configuration are fixed bits, and the base address corresponding to the memory access address can be extracted through the base address mask;
所述基地址序号,用于表示设备的功能向系统申请的地址窗口数按照BAR寄存器号顺序排列的序列号,一个I/O设备中同类型的各功能向系统申请的地址窗口类型和数目相同。The base address serial number is used to represent the serial number of the number of address windows that the function of the device applies to the system according to the order of the BAR register number. The type and number of address windows that each function of the same type in an I/O device applies to the system are the same .
所述的用于多根I/O虚拟化共享系统的直接I/O重映射方法,所述步骤2还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, the step 2 also includes:
所述主控制根节点PCIe域中的功能基地址写存储是在主控制根节点系统初始化配置阶段,通过解析配置事务包,提取事务包中指示的功能基地址序号作为地址索引,写存储所述功能基地址序号对应的基地址。The function base address write storage in the master control root node PCIe domain is in the master control root node system initialization configuration stage, by parsing the configuration transaction package, extracting the function base address serial number indicated in the transaction package as an address index, and writing and storing the The base address corresponding to the sequence number of the function base address.
所述功能基地址序号,由基地址序号k和主控制根节点PCIe域中的设备功能号p组合而成,功能基地址序号(k,p)指示的基地址是系统为设备中功能号为p分配的第n个基地址。The function base address number is composed of the base address number k and the device function number p in the PCIe domain of the main control root node. The base address indicated by the function base address number (k, p) is the function number of the device in the system The nth base address allocated by p.
所述用于多根I/O虚拟化共享系统的直接I/O重映射方法,步骤3还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, step 3 also includes:
所述设备功能ID映射关系写存储是在主控制根节点进行设备I/O资源分配阶段,通过解析设备分配事务包,提取事务包中指示的设备功能在主控制根节点PCIe域的功能号作为地址索引,写存储由所述功能所属的根节点标识ID以及所述功能在所属根节点PCIe域中的功能号组成的数据项,建立设备功能在主控制根节点PCIe域中的ID号和其在从属根节点PCIe域中的ID号之间的映射。The writing and storage of the device function ID mapping relationship is performed at the stage of device I/O resource allocation by the master control root node, by parsing the device allocation transaction package, and extracting the function number of the device function indicated in the transaction package in the PCIe domain of the master control root node as Address index, write and store a data item consisting of the root node identification ID to which the function belongs and the function number of the function in the PCIe domain of the root node to which the function belongs, and establish the ID number and its ID number of the device function in the PCIe domain of the main control root node Mapping between ID numbers in slave root node PCIe domains.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射方法,所述步骤4还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, the step 4 also includes:
所述从属根节点PCIe域中的功能基地址写存储是在从属根节点系统PCIe重扫描阶段,通过解析配置事务包,提取事务包中指示的功能基地址序号作为地址索引,写存储所述功能基地址序号对应的基地址。The function base address write storage in the PCIe domain of the subordinate root node is in the PCIe rescanning stage of the subordinate root node system, by parsing and configuring the transaction package, extracting the function base address sequence number indicated in the transaction package as an address index, and writing and storing the function The base address corresponding to the base address serial number.
所述用于多根I/O虚拟化共享系统的直接I/O重映射方法,步骤5还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, step 5 also includes:
所述直接I/O重映射是在从属根节点与I/O设备进行通信的过程中,对从属根节点发起的基于ID路由的下行事务包进行下行ID重映射,对从属根节点发起的基于地址路由的下行事务包进行地址重映射,对设备功能发起的事务包进行上行ID重映射。The direct I/O remapping is to perform downlink ID remapping on the downlink transaction packet based on ID routing initiated by the subordinate root node during the communication process between the subordinate root node and the I/O device, and to perform downlink ID remapping on the downlink transaction packet initiated by the subordinate root node based on Address remapping is performed on downlink transaction packets of address routing, and uplink ID remapping is performed on transaction packets initiated by device functions.
所述用于多根I/O虚拟化共享系统的直接I/O重映射方法,步骤1还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, step 1 also includes:
步骤71,系统上电,初始化BAR寄存器偏移指针的起始地址,初始化基地址序号,初始化64位地址申请标识符,转向步骤72;Step 71, power on the system, initialize the start address of the BAR register offset pointer, initialize the base address serial number, initialize the 64-bit address application identifier, and turn to step 72;
步骤72,接收从主控制根节点发来的事务包;如果接收到主控制根节点发来的事务包,转向步骤73;Step 72, receiving the transaction packet sent from the master control root node; if receiving the transaction packet sent by the master control root node, turn to step 73;
步骤73,事务包判定;解析接收到的事务包,如果该事务包是向BAR寄存器偏移指针指定的寄存器写全1的配置写请求包,转向步骤74;否则转步骤72;Step 73, determine the transaction packet; parse the received transaction packet, if the transaction packet is a configuration write request packet that writes all 1s to the register specified by the BAR register offset pointer, turn to step 74; otherwise turn to step 72;
步骤74,接收I/O设备发来的带数据的完成包;如果接收到从I/O设备发来的带数据的完成包,转向步骤75;Step 74, receiving the completion packet with data sent by the I/O device; if receiving the completion packet with data sent from the I/O device, turn to step 75;
步骤75,地址申请类型判断;解析完成包的数据段,对该BAR定义的地址申请类型进行判断;如果该BAR未用于地址申请,则转向步骤78;如果该BAR定义的是64位地址,则转向步骤76;否则,转向步骤77;Step 75, judging the address application type; analyzing the data segment of the completed package, judging the address application type defined by the BAR; if the BAR is not used for address application, then turn to step 78; if the BAR defines a 64-bit address, Then turn to step 76; otherwise, turn to step 77;
步骤76,将数据段内容记录到基地址序号对应的基地址掩码的低L位,使能64位地址申请标识符,并记录当前BAR寄存器偏移指针及其指示的BAR定义的地址窗口位宽类型与基地址序号的映射关系,转向步骤78;Step 76, record the content of the data segment to the low L bit of the base address mask corresponding to the base address serial number, enable the 64-bit address application identifier, and record the current BAR register offset pointer and the address window bit defined by the BAR indicated by it For the mapping relationship between the wide type and the base address serial number, turn to step 78;
步骤77,记录数据段,更新基地址序号及64位地址申请标识符;如果当前的64位申请标识符未使能,指示数据段内容为32位基地址的掩码,则将数据段内容的高L位记录到基地址序号对应的基地址掩码的低L位;否则,数据段内容为基地址序号对应的64位基地址的掩码的高32位,则将数据段记录到基地址序号对应的基地址掩码的高32位;记录当前BAR寄存器偏移指针及其指示的BAR定义的地址窗口位宽类型与基地址序号的映射关系,然后更新基地址序号加1,并复位64位地址申请标识符,转向步骤78;Step 77, record the data segment, update the base address sequence number and 64-bit address application identifier; if the current 64-bit application identifier is not enabled, indicating that the content of the data segment is the mask of the 32-bit base address, then the content of the data segment The high L bits are recorded to the low L bits of the base address mask corresponding to the base address serial number; otherwise, the data segment content is the upper 32 bits of the 64-bit base address mask corresponding to the base address serial number, then the data segment is recorded to the base address The upper 32 bits of the base address mask corresponding to the serial number; record the mapping relationship between the current BAR register offset pointer and the address window bit width type defined by the BAR indicated by the BAR and the base address serial number, then update the base address serial number and add 1, and reset 64 Bit address application identifier, turn to step 78;
步骤78,更新BAR寄存器偏移指针指向下一个BAR寄存器,转向步骤79;Step 78, update the BAR register offset pointer to point to the next BAR register, and turn to step 79;
步骤79,BAR寄存器偏移指针有效性判定;判定当前BAR寄存器偏移指针指向的寄存器是否依然为配置空间中的BAR,如果是,则转向步骤72;否则转向步骤710;Step 79, BAR register offset pointer validity determination; determine whether the register pointed to by the current BAR register offset pointer is still a BAR in the configuration space, if yes, then turn to step 72; otherwise turn to step 710;
步骤710,结束,标识已经完成基地址定义提取过程。Step 710, end, indicating that the process of extracting the base address definition has been completed.
所述用于多根I/O虚拟化共享系统的直接I/O重映射方法,步骤2还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, step 2 also includes:
步骤81,接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为主控制根节点,转向步骤82;Step 81, receiving the transaction packet sent from the root node, analyzing and judging the ID of the root node initiating the transaction packet, if the originating root node indicated by the transaction packet is the main control root node, turn to step 82;
步骤82,下行事务包判定;解析接收到的由主控制根节点发来的事务包,如果该事务包是配置事务包,转向步骤83;Step 82, determine the downlink transaction packet; analyze the received transaction packet sent by the main control root node, if the transaction packet is a configuration transaction packet, turn to step 83;
步骤83,获取并解析配置事务包中向BAR寄存器写非全1的配置写包,提取事务包中的目标设备功能号、要配置的BAR寄存器偏移以及数据段内容所述数据段内容为系统配置的基地址,转向步骤84;Step 83, obtain and analyze the configuration writing packet that writes non-all 1s to the BAR register in the configuration transaction packet, extract the target device function number in the transaction packet, the BAR register offset to be configured, and the content of the data segment described in the data segment are system Configured base address, turn to step 84;
步骤84,根据基地址定义提取过程获得的映射关系,获取BAR寄存器偏移对应的基地址序号和地址窗口位宽类型,转向步骤85;Step 84, according to the mapping relationship obtained in the base address definition extraction process, obtain the base address sequence number and address window bit width type corresponding to the BAR register offset, and turn to step 85;
步骤85,地址窗口位宽类型判定;判定步骤84获取的地址窗口位宽类型,如果指示该BAR定义的为64位地址的低32位,则寄存提取的基地址,然后转向步骤81;如果指示的是32为地址或者64位地址的高32位,则转向步骤86;Step 85, the address window bit width type judgment; the address window bit width type obtained in judging step 84, if indicating that the BAR is defined as the lower 32 bits of the 64-bit address, then register the base address extracted, and then turn to step 81; if indicated 32 is the address or the upper 32 bits of the 64-bit address, then turn to step 86;
步骤86,写存储基地址;如果是32位地址,则将提取的数据段存储到由功能号和基地址序号指定的存储单元中;如果是64位地址,则将步骤105寄存的基地址和步骤83提取的数据段高低位组合,存储到由功能号和基地址序号指定的存储单元中;转向步骤81。Step 86, write and store the base address; if it is a 32-bit address, store the extracted data segment in the storage unit specified by the function number and the base address sequence number; if it is a 64-bit address, then store the base address and The combination of high and low bits of the data segment extracted in step 83 is stored in the storage unit specified by the function number and the base address sequence number; turn to step 81.
所述用于多根I/O虚拟化共享系统的直接I/O重映射方法,步骤4还包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, step 4 also includes:
步骤91,接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为从属根节点,转向步骤92;Step 91, receiving the transaction packet sent from the root node, analyzing and determining the ID of the root node initiating the transaction packet, if the originating root node indicated by the transaction packet is a subordinate root node, turn to step 92;
步骤92,下行事务包判定;解析接收到的由从属根节点发来的事务包,如果该事务包是基于ID事务包,转向步骤93;Step 92, determine the downlink transaction packet; analyze the received transaction packet sent by the slave root node, if the transaction packet is based on the ID transaction packet, turn to step 93;
步骤93,下行ID重映射;将基于ID路由的事务包中的ID号转换为其对应在主控制根节点PCIe域中的ID号,转向步骤94;Step 93, downlink ID remapping; convert the ID number in the transaction packet based on ID routing to the ID number corresponding to the PCIe domain of the main control root node, and turn to step 94;
步骤94,获取并解析配置事务包中向BAR寄存器写非全1的配置写包,提取事务包中的目标设备功能号、要配置的BAR寄存器偏移以及数据段内容指示的基地址,转向步骤95;Step 94, obtain and analyze the configuration write packet that writes non-all 1s to the BAR register in the configuration transaction packet, extract the target device function number in the transaction packet, the offset of the BAR register to be configured, and the base address indicated by the data segment content, and turn to the step 95;
步骤95,根据基地址定义提取过程获得的映射关系,获取BAR寄存器偏移对应的基地址序号和地址窗口位宽类型,转向步骤96;Step 95, according to the mapping relationship obtained in the base address definition extraction process, obtain the base address sequence number and address window bit width type corresponding to the BAR register offset, and turn to step 96;
步骤96,地址窗口位宽类型判定;判定步骤95获取的地址窗口位宽类型,如果指示该BAR定义的为64位地址的低32位,则寄存提取的基地址,然后转向步骤91;如果指示的是32为地址或者64位地址的高32位,则转向步骤97;Step 96, the address window bit width type judgment; the address window bit width type obtained in judging step 95, if indicating that the BAR is defined as the lower 32 bits of the 64-bit address, then register the base address extracted, and then turn to step 91; if indicated 32 is the address or the upper 32 bits of the 64-bit address, then turn to step 97;
步骤97,写存储基地址;如果是32位地址,则将提取的数据段存储到由功能号和基地址序号指定的存储单元中;如果是64位地址,则将步骤96寄存的基地址和步骤94提取的数据段高低位组合,存储到由功能号和基地址序号指定的存储单元中;转向步骤91。Step 97, write storage base address; If it is a 32-bit address, then store the data segment extracted in the storage unit specified by the function number and the base address sequence number; The combination of high and low bits of the data segment extracted in step 94 is stored in the storage unit specified by the function number and the base address sequence number; turn to step 91.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射方法,所述步骤5包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, the step 5 includes:
所述下行ID重映射,指I/O设备功能在从属根节点PCIe域的ID号到其在主控制根节点PCIe域的ID号的匹配转换;The downlink ID remapping refers to the matching conversion of the I/O device function from the ID number of the slave root node PCIe domain to the ID number of the main control root node PCIe domain;
所述地址重映射,指从属根节点发出的目标访问地址到其对应在主控制根节点PCIe域中的地址的匹配转换;The address remapping refers to the matching conversion from the target access address sent by the slave root node to the address corresponding to the PCIe domain of the main control root node;
所述上行ID重映射,指I/O设备功能在主控制根节点PCIe域的ID号到其在从属根节点PCIe域的ID号的匹配转换。The uplink ID remapping refers to the matching transformation from the ID number of the I/O device function in the PCIe domain of the master control root node to its ID number in the PCIe domain of the slave root node.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射方法,所述下行ID重映射包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, the downlink ID remapping includes:
步骤111,接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为从属根节点,转向步骤112;Step 111, receiving the transaction packet sent from the root node, analyzing and determining the ID of the root node initiating the transaction packet, if the originating root node indicated by the transaction packet is a subordinate root node, turn to step 112;
步骤112,事务包类型判定,如果是基于ID路由的事务包,转向步骤113;Step 112, determine the type of transaction packet, if it is a transaction packet based on ID routing, turn to step 113;
步骤113,提取事务包中指示的发起根节点ID以及要访问的设备功能号,并将其组合作为要比较的数据内容,精确匹配查找,获取该设备功能在主控制根节点PCIe域中功能号,如果存在匹配项,转向步骤114;否则转步骤115;Step 113, extract the initiating root node ID indicated in the transaction package and the device function number to be accessed, and combine them as the data content to be compared, accurately match and search, and obtain the function number of the device function in the main control root node PCIe domain , if there is a matching item, turn to step 114; otherwise, turn to step 115;
步骤114,改写事务包中设备功能ID号,使用CAM匹配输出的地址,即指示的主控制根节点PCIe中的功能号,改写事务包中设备功能ID号,操作完后转向步骤111;Step 114, rewrite the device function ID number in the transaction package, use the CAM to match the output address, that is, the function number in the indicated main control root node PCIe, rewrite the device function ID number in the transaction package, and turn to step 111 after the operation;
步骤115,向事务包指示的根节点返回不支持的事务包,操作完后转步骤111。Step 115, return an unsupported transaction package to the root node indicated by the transaction package, and go to step 111 after the operation.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射方法,所述地址重映射包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, the address remapping includes:
步骤121,接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为从属根节点,转向步骤122;Step 121, receiving the transaction packet sent from the root node, analyzing and determining the ID of the root node initiating the transaction packet, if the originating root node indicated by the transaction packet is a subordinate root node, turn to step 122;
步骤122,下行事务包判定;解析接收到的由从属根节点发来的事务包,如果该事务包是基于地址事务包,转向步骤123;Step 122, determine the downlink transaction packet; analyze the received transaction packet sent by the slave root node, if the transaction packet is based on the address transaction packet, turn to step 123;
步骤123,解析接收到的基于地址路由的事务包,提取事务包中指示的目标访问地址,转向步骤124;Step 123, analyzing the received transaction packet based on address routing, extracting the target access address indicated in the transaction packet, and turning to step 124;
步骤124,获取基地址;将目标访问地址与基地址定义提取过程中记录的所有K个基地址掩码进行与操作,获取K个基地址,转向步骤125;Step 124, obtain the base address; perform an AND operation on the target access address and all K base address masks recorded in the base address definition extraction process to obtain K base addresses, and turn to step 125;
步骤125,功能基地址序号匹配查找;将步骤124获取的K个BAR基地址作为比较数据,进行并行的精确匹配查找,获取目标访问地址匹配的功能基地址序号;如果存在匹配项,转向步骤126,否则转向步骤,129;Step 125, function base address sequence number matching search; use the K BAR base addresses obtained in step 124 as comparison data, perform parallel exact matching search, and obtain the function base address sequence number matched by the target access address; if there is a match, turn to step 126 , otherwise turn to step 129;
步骤126,基地址及基地址掩码匹配查找;使用匹配输出的功能基地址序号,获取所述功能基地址序号对应在主控制根节点PCIe域中的匹配基地址以及基地址序号匹配的基地址掩码,转向步骤127;Step 126, base address and base address mask matching search; use the function base address sequence number output by matching to obtain the matching base address corresponding to the function base address sequence number in the main control root node PCIe domain and the base address of the base address sequence number match mask, turn to step 127;
步骤127,匹配的目标访问地址输出译码;根据获取的匹配基地址、匹配基地址掩码,连同步骤123提取的目标访问地址,获取从属根节点PCIe域中的目标访问地址映射到主控制根节点PCIe域中的匹配目标访问地址;操作完后转向步骤128;Step 127, the matching target access address output decoding; according to the obtained matching base address, matching base address mask, together with the target access address extracted in step 123, obtain the target access address in the PCIe domain of the slave root node and map it to the main control root The matching target access address in the node PCIe domain; turn to step 128 after the operation;
步骤129,使用步骤127获的的匹配目标访问地址,改写事务包中目标访问地址;操作完后转向步骤121;Step 129, use the matching target access address obtained in step 127 to rewrite the target access address in the transaction package; turn to step 121 after the operation;
步骤129,向事务包指示的根节点返回一个不支持的事务包,操作完成后转向步骤121。Step 129, return an unsupported transaction package to the root node indicated by the transaction package, and turn to step 121 after the operation is completed.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射方法,所述上行ID重映射包括:In the direct I/O remapping method for a multi-root I/O virtualization sharing system, the uplink ID remapping includes:
步骤131,接收从I/O设备功能发事务包,如接收到事务包,转向步骤132;Step 131, receiving the transaction packet sent from the I/O device function, if the transaction packet is received, turn to step 132;
步骤132,提取事务包指示的I/O设备功能ID号;如果事务包为请求包,提取请求事务包中指示的请求设者ID号;如果是如果事务包是完成包,提取完成事务包中指示的完成者ID号,转向步骤133;Step 132, extracting the I/O device function ID number indicated by the transaction package; if the transaction package is a request package, extract the request setter ID number indicated in the request transaction package; if it is if the transaction package is a complete package, extract the complete transaction package Indicated completer ID number, turn to step 133;
步骤133,使用提取的I/O设备功能ID号中的功能号作为地址索引,获取对应的根节点标识ID及功能号;如果获得的根节点标识ID非主控制根节点ID,转向步骤134;否则,说明事务包所属的根节点为主控制根节点,不需要进行ID转换,转向步骤135;Step 133, using the function number in the extracted I/O device function ID number as an address index to obtain the corresponding root node identification ID and function number; if the obtained root node identification ID is not the main control root node ID, turn to step 134; Otherwise, it means that the root node to which the transaction package belongs is the main control root node, and no ID conversion is required, and the process turns to step 135;
步骤134,使用获得的根节点标识ID记录到事务包中;如果事务包为请求包,则使用获得的功能号修改事务包中请求者ID号;如果事务包为完成包,则使用使用获得的功能号修改事务包中完成者ID号,操作完后转向步骤131;Step 134, use the obtained root node identification ID to record in the transaction package; if the transaction package is a request package, then use the obtained function number to modify the ID number of the requester in the transaction package; if the transaction package is a complete package, use the obtained The function number modifies the completer ID number in the transaction package, and turns to step 131 after the operation is completed;
步骤135,使用主控制根节点标识ID改写事务包;将主控制根节点的标识ID记录到事务包中,操作完后转向步骤131。Step 135, rewrite the transaction package using the ID of the main control root node; record the ID of the main control root node into the transaction package, and turn to step 131 after the operation.
本发明公开一种用于多根I/O虚拟化共享系统的直接I/O重映射装置,包括:The invention discloses a direct I/O remapping device for a multi-root I/O virtualization sharing system, comprising:
ID重映射模块,所述ID重映射模块包含内容寻址存储CAM和简单双端口RAM,通过CAM的精确匹配查找实现I/O设备功能在从属根节点PCIe域中的ID号到其在主控制根节点PCIe域中的ID号的映射,通过写读RAM存储元件实现I/O设备功能在主控制根节点PCIe域中的ID号到其在从属根节点PCIe域中的ID号的映射;ID remapping module, the ID remapping module includes content addressable storage CAM and simple dual-port RAM, realizes the ID number of I/O device function in slave root node PCIe domain to its ID number in master control through the precise matching search of CAM The mapping of the ID number in the PCIe domain of the root node realizes the mapping from the ID number of the I/O device function in the PCIe domain of the master control root node to its ID number in the PCIe domain of the slave root node by writing and reading the RAM storage element;
地址重映射模块,所述地址重映射模块用于实现I/O设备功能在从属根节点PCIe域的I/O映射地址窗口到其主控制根节点PCIe域I/O映射地址窗口转换;Address remapping module, described address remapping module is used for realizing I/O device function conversion from the I/O mapping address window of root node PCIe domain to its main control root node PCIe domain I/O mapping address window;
其中,ID号包括总线号、设备号、功能号。Wherein, the ID number includes a bus number, a device number, and a function number.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射装置,所述ID重映射模块中的CAM和RAM包括:In the direct I/O remapping device for a multi-root I/O virtualization sharing system, the CAM and RAM in the ID remapping module include:
以I/O设备功能的功能号作为地址索引,存储单元存储的数据项包括两部分:一部分是该设备功能所属的根节点标识ID,一部分是该设备功能在其所属的根节点PCIe域的功能号。Using the function number of the I/O device function as the address index, the data item stored in the storage unit includes two parts: one part is the ID of the root node to which the device function belongs, and the other part is the function of the device function in the PCIe domain of the root node to which it belongs Number.
所述用于多根I/O虚拟化共享系统的I/O重映射装置,地址重映射模块包括:The I/O remapping device for a multi-root I/O virtualization sharing system, the address remapping module includes:
基地址定义提取模块,所述基地址掩码通过解析配置设备功能的基地址寄存器(Base Address Register,BAR)的事务包,获取I/O设备功能通过各BAR定义的地址窗口类型,提取各地址窗口对应的基地址掩码,并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号之间的映射关系;The base address definition extraction module, the base address mask obtains the address window type defined by each BAR for the I/O device function by parsing the transaction packet of the base address register (BAR) that configures the device function, and extracts each address The base address mask corresponding to the window, and record the mapping relationship between each base address register number and the base address number corresponding to the defined address window;
功能基地址序号匹配模块,所述功能基地址序号匹配模块包含N个深度为P的CAM组成的CAM存储阵列和匹配输出选择模块,每个CAM存储同一I/O设备中所有功能中相同基地址序列号对应的基地址BAR,实现从属根节点PCIe域中的基地址与其所对应的功能基地址序号的映射;Functional base address serial number matching module, the functional base address serial number matching module includes a CAM storage array composed of N CAMs with a depth of P and a matching output selection module, each CAM stores the same base address in all functions in the same I/O device The base address BAR corresponding to the serial number realizes the mapping between the base address in the PCIe domain of the slave root node and its corresponding functional base address serial number;
基地址查找模块,所述基地址查找模块包含深度为Q的简单双端口RAM,通过写读RAM存储元件,实现功能基地址序号到其在主控制根节点PCIe域中的基地址的映射;Base address search module, said base address search module includes a depth of Q simple dual-port RAM, by writing and reading the RAM storage element, realizes the mapping of the function base address sequence number to its base address in the main control root node PCIe domain;
输出译码模块,所述输出译码模块根据匹配查找出的主控制根节点PCIe域中基地址及其对应的基地址掩码,将从属根节点PCIe域中的目标访问地址翻译成主控制根节点PCIe域中的目标访问地址;Output decoding module, said output decoding module translates the target access address in the slave root node PCIe domain into the master control root Target access address in the node PCIe domain;
其中,N(N<=6)表示设备功能申请的地址窗口数目,P表示设备中功能的数目,Q表示系统分配给设备中所有功能的地址窗口的基地址的数目。Among them, N (N<=6) represents the number of address windows applied for by the device function, P represents the number of functions in the device, and Q represents the number of base addresses of the address windows allocated by the system to all functions in the device.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射装置,所述功能基地址序号匹配模块包括:In the direct I/O remapping device for a multi-root I/O virtualization sharing system, the function base address serial number matching module includes:
所述CAM存储阵列,是以功能基地址序号为地址索引,存储的数据项包括两部分:一部分是I/O设备功能所属的从属根节点ID,一部分是从属根节点分配的基地址,其中,功能基地址序号中的基地址序号选择要存储的CAM,功能基地址序号中的功能号选择要存储的CAM存储单元,所述CAM存储阵列有N个比较数据输入端口,每一个CAM对应一个,所述CAM阵列在数据匹配阶段,输入由从属根节点的目标访问地址通过N个不同的基地址掩码提取获得的N个不同的比较数据项,并行地进行匹配查找,输出N个对应的匹配结果;The CAM storage array is based on the function base address serial number as the address index, and the stored data items include two parts: one part is the subordinate root node ID to which the I/O device function belongs, and one part is the base address allocated by the subordinate root node, wherein, The base address sequence number in the function base address sequence number selects the CAM to be stored, and the function number in the function base address sequence number selects the CAM storage unit to be stored. The CAM storage array has N comparison data input ports, and each CAM corresponds to one. In the data matching stage, the CAM array inputs N different comparison data items obtained by extracting the target access address of the subordinate root node through N different base address masks, performs matching search in parallel, and outputs N corresponding matching data items. result;
所述匹配输出选择模块,如果CAM存储阵列输出的N个匹配结果存在(仅存在一个)匹配项,则选择输出由存在匹配项的CAM的输出匹配地址(即功能号p以及其对应的基地址序号n组成的功能基地址序号,同时将匹配标识置1;否则,将匹配标识置0。The matching output selection module, if there is (only one) matching item in the N matching results output by the CAM storage array, then select and output the output matching address (that is, the function number p and its corresponding base address) of the CAM that has the matching item The sequence number of the function base address composed of sequence number n, and set the matching flag to 1; otherwise, set the matching flag to 0.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射装置,所述基地址查找模块中的RAM包括:In the direct I/O remapping device for a multi-root I/O virtualization sharing system, the RAM in the base address search module includes:
以功能基地址序号为地址索引,存储的数据项是主控制根节点分配的基地址。The function base address serial number is used as the address index, and the stored data item is the base address assigned by the main control root node.
本发明的有益效果为,一种用于多根I/O虚拟化共享系统的直接I/O重映射方法和装置。这种直接I/O重映射方法和装置,通过硬件重映射的方式,实现了设备功能在从属根节点PCIe域中ID号和地址窗口到其在主控制根节点PCIe域中对应的ID号和地址窗口的映射,进而实现了根节点对其分配到的设备功能资源进行直接访问和操作,同时为各根节点在访问操作共享的物理I/O设备时提供了隔离和保护,根节点不能访问操作所分配到的I/O资源之外的其他I/O资源。The beneficial effects of the present invention are a direct I/O remapping method and device for a multi-root I/O virtualization sharing system. This direct I/O remapping method and device realizes the device function from the ID number and address window in the slave root node PCIe domain to its corresponding ID number and address window in the master control root node PCIe domain through hardware remapping. The mapping of the address window enables the root node to directly access and operate the device function resources allocated to it, and at the same time provides isolation and protection for each root node when accessing and operating shared physical I/O devices, and the root node cannot access Operate other I/O resources than the allocated I/O resources.
附图说明 Description of drawings
图1是多根I/O虚拟化共享系统的结构示意图;FIG. 1 is a schematic structural diagram of a multi-root I/O virtualization sharing system;
图2是根节点和I/O设备通信的示意图;Fig. 2 is a schematic diagram of the communication between the root node and the I/O device;
图3是ID重映射模块的结构示意图;Fig. 3 is a schematic structural diagram of an ID remapping module;
图4是下行ID重映射过程流程图;FIG. 4 is a flow chart of the downlink ID remapping process;
图5是上行ID重映射过程流程图;FIG. 5 is a flowchart of an uplink ID remapping process;
图6是地址重映射模块的结构示意图;Fig. 6 is a schematic structural diagram of an address remapping module;
图7是基地址定义提取过程的流程图;Fig. 7 is a flow chart of the base address definition extraction process;
图8是主控制根节点PCIe域的功能基地址的写存储过程的流程图;Fig. 8 is a flow chart of the write storage process of the function base address of the main control root node PCIe domain;
图9是从属根节点PCIe域的功能基地址的写存储过程的流程图;Fig. 9 is a flow chart of the write storage process of the functional base address from the root node PCIe domain;
图10是地址重映射过程的流程图;Fig. 10 is a flowchart of the address remapping process;
图11是针对SR-IOV设备的地址重映射模块的结构示意图;FIG. 11 is a schematic structural diagram of an address remapping module for an SR-IOV device;
图12是直接I/O重映射方法的流程图。FIG. 12 is a flowchart of a direct I/O remapping method.
具体实施方式 Detailed ways
下面给出本发明的具体实施方式,结合附图对本发明做出了详细描述。Specific embodiments of the present invention are given below, and the present invention is described in detail in conjunction with the accompanying drawings.
为了实现多根I/O虚拟化共享系统中各从属根节点对其分配到的I/O设备功能进行直接访问和操作,以获取接近本机的I/O性能,本发明提出了一种直接I/O重映射方法和装置。所述直接I/O重映射方法和装置,通过硬件重映射的方式,实现了设备功能在从属根节点与主控制根节点PCIe域中对应的ID号和映射I/O的地址窗口的映射。所述直接I/O重映射方法,如图12所示,包括以下步骤:In order to realize that each subordinate root node in the multi-root I/O virtualization sharing system directly accesses and operates the function of the I/O device assigned to it, so as to obtain the I/O performance close to the local machine, the present invention proposes a direct I/O remapping method and device. The direct I/O remapping method and device realizes the mapping of the corresponding ID number and the address window of the mapped I/O of the device function in the PCIe domain of the slave root node and the master control root node through hardware remapping. The direct I/O remapping method, as shown in Figure 12, comprises the following steps:
a)I/O设备功能的基地址定义提取,指在主控制根节点系统发现阶段,获取I/O设备功能通过各基地址寄存器(Base Address Register,BAR)定义的地址窗口类型,提取各地址窗口对应的基地址掩码,并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号之间的映射关系;其中,所述基地址掩码用于指示系统配置的地址窗口中地址的哪些位是固定位,根节点和I/O设备功能通信使用的地址是由基地址BAR加上偏移构成的具体访问地址,通过记录的基地址掩码可以提取访问地址对应的基地址BAR,所述基地址序号用于表示设备功能向系统申请的地址窗口数按照BAR寄存器号顺序排列的序列号,一个I/O设备中同类型的各功能向系统申请的地址窗口类型和数目相同;a) Base address definition extraction of I/O device functions refers to obtaining the address window type defined by each base address register (BAR) for I/O device functions during the discovery stage of the main control root node system, and extracting each address The base address mask corresponding to the window, and record the mapping relationship between each base address register serial number and the base address serial number corresponding to the address window defined by it; wherein, the base address mask is used to indicate the address in the address window configured by the system Which bits are fixed bits, the address used by the root node and the I/O device function communication is a specific access address composed of the base address BAR plus an offset, and the base address BAR corresponding to the access address can be extracted through the recorded base address mask. The base address serial number is used to represent the serial number of the number of address windows applied by the device function to the system according to the sequence of the BAR register number, and the type and number of address windows applied to the system by each function of the same type in an I/O device are the same;
b)主控制根节点PCIe域中的功能基地址写存储,所述主控制根节点PCIe域中的功能基地址存储指在主控制根节点系统初始化配置阶段,通过解析配置事务包,提取事务包中指示的功能基地址序号作为地址索引,写存储所述功能基地址序号对应的基地址,其中,所述功能基地址序号,由基地址序号k和主控制根节点PCIe域中的设备功能号p组合而成,功能基地址序号(k,p)指示的基地址是系统为设备中功能号为p分配的第n个基地址。;b) Write and store the functional base address in the PCIe domain of the main control root node. The storage of the functional base address in the PCIe domain of the main control root node refers to extracting the transaction package by parsing the configuration transaction package during the system initialization configuration stage of the main control root node The function base address serial number indicated in is used as an address index, and the base address corresponding to the functional base address serial number is written and stored, wherein the functional base address serial number is composed of the base address serial number k and the device function number in the PCIe domain of the main control root node It is composed of p, and the base address indicated by the function base address number (k, p) is the nth base address allocated by the system for the function number p in the device. ;
c)设备功能ID映射关系写存储,所述设备功能ID映射关系写存储指在主控制根节点进行设备I/O资源分配阶段,通过解析设备分配事务包,提取事务包中指示的设备功能在主控制根节点PCIe域的功能号作为地址索引,写存储所述功能所属的根节点标识ID以及所述功能在所属根节点PCIe域中的功能号,建立设备功能在主控制根节点PCIe域中的ID号和其在从属根节点PCIe域中的ID号之间的映射;c) Write and store the device function ID mapping relationship. The device function ID mapping relationship write and store refers to the stage of device I/O resource allocation at the main control root node. By parsing the device allocation transaction package, the device function indicated in the transaction package is extracted. The function number of the main control root node PCIe domain is used as an address index, write and store the root node identification ID to which the function belongs and the function number of the function in the root node PCIe domain to which the function belongs, and establish the device function in the main control root node PCIe domain The mapping between the ID number and its ID number in the slave root node PCIe domain;
d)从属根节点PCIe域中的功能基地址写存储,所述从属根节点PCIe域中的功能基地址写存储指在从属根节点系统PCIe重扫描阶段,通过解析配置事务包,提取事务包中指示的功能基地址序号作为地址索引,写存储所述功能基地址序号对应的基地址;d) Write storage of the functional base address in the PCIe domain of the subordinate root node. The write storage of the functional base address in the PCIe domain of the subordinate root node refers to extracting the transaction package by parsing the configuration transaction package during the PCIe rescanning phase of the subordinate root node system. The indicated function base address number is used as an address index, and the base address corresponding to the function base address number is written and stored;
e)直接I/O重映射,所述直接I/O重映射指当从属根节点对I/O设备进行发现和使用过程中,对从属根节点发起的基于ID路由的下行事务包进行下行ID重映射,对从属根节点发起的基于地址路由的下行事务包进行地址重映射,对设备功能发起的事务包进行上行ID重映射。e) Direct I/O remapping. The direct I/O remapping means that when the subordinate root node discovers and uses the I/O device, the downlink ID of the downlink transaction packet based on ID routing initiated by the subordinate root node is Remapping, address remapping is performed on downlink transaction packets based on address routing initiated by the slave root node, and uplink ID remapping is performed on transaction packets initiated by device functions.
图1描绘了多根I/O虚拟化共享系统的结构示意图。多根I/O虚拟化共享系统主要包括三个部分:根节点子系统、I/O设备子系统和多根I/O虚拟化共享控制器。多根I/O虚拟化共享控制器通过PCIe接口协议将根节点子系统和I/O设备子系统耦合在一起,实现I/O设备资源被多个根节点直接共享。FIG. 1 depicts a schematic structural diagram of a multi-root I/O virtualization sharing system. The multi-root I/O virtualization sharing system mainly includes three parts: the root node subsystem, the I/O device subsystem and the multi-root I/O virtualization sharing controller. The multi-root I/O virtualization sharing controller couples the root node subsystem and the I/O device subsystem through the PCIe interface protocol, so that the I/O device resources are directly shared by multiple root nodes.
多根I/O虚拟化共享系统中的根节点子系统包含多个根节点,每个根节点每个根节点是一个单根PCIe环境,它由根联合体(Root Complex,RC)及其连接的CPU组(CPU set)和内存(Mem)组成。其中,运行有PCIe管理相关软件的根节点称之为主控制根节点(Master Root Node,mRN),主控制根节点只有一个(下文使用mRN0标识),管理和分配系统中的所有I/O设备资源;其他根节点称为从属根节点(Slave Root Node,sRN),从属根节点可以有多个(下文使用sRN1,sRN2,…,sRNn标识),并根据主控制根节点的分配,拥有一定I/O资源的独立使用权。根节点上可以运行多个同构或者异构虚拟机(VirtualMachine,VM),虚拟机管理程序(Virtual Machine Manager,VMM)负责调度所分配得到的I/O资源为各VM所用。The root node subsystem in the multi-root I/O virtualization sharing system includes multiple root nodes, and each root node is a single-root PCIe environment, which consists of a root complex (Root Complex, RC) and its connection CPU group (CPU set) and memory (Mem). Among them, the root node running PCIe management-related software is called the master control root node (Master Root Node, mRN), and there is only one master control root node (identified by mRN0 below), which manages and distributes all I/O devices in the system resources; other root nodes are called slave root nodes (Slave Root Node, sRN), and there can be multiple slave root nodes (identified by sRN1, sRN2, ..., sRNn below), and according to the distribution of the main control root node, have a certain I /O Independent usage rights for resources. Multiple homogeneous or heterogeneous virtual machines (Virtual Machines, VMs) can run on the root node, and the virtual machine management program (Virtual Machine Manager, VMM) is responsible for scheduling the allocated I/O resources for use by each VM.
多根I/O虚拟化共享系统中的I/O设备子系统包含多个I/O设备,各I/O设备具备同时为多个虚拟机提供服务的能力,可以是包含一个物理功能(Physical Function,PF)及其对应的多个虚拟功能(Virtual Function,VF)的SR-IOV设备或者包含多个PF及其对应的多个VF的SR-IOV设备,也可以是多功能I/O设备等。I/O设备子系统是属于主控制根节点这一单根PCIe环境。The I/O device subsystem in the multi-root I/O virtualization sharing system includes multiple I/O devices, and each I/O device has the ability to provide services for multiple virtual machines at the same time, and may contain a physical function (Physical Function, PF) and its corresponding multiple virtual functions (Virtual Function, VF) SR-IOV devices or SR-IOV devices containing multiple PFs and their corresponding multiple VFs, or multi-function I/O devices wait. The I/O device subsystem is a single root PCIe environment belonging to the main control root node.
多根I/O虚拟化共享系统中的多根I/O虚拟化共享控制器由若干个PCIe上游端口(PCIe Upstream Port)、PCIe多根交换机和若干个PCIe下游端口(PCIeDownstream Port)三个部分组成。其中,多根I/O虚拟化共享控制器通过PCIe上游端口连接了多个根节点,它处在一个多根PCIe环境中;PCIe多根交换机,实质是由多个PCI桥建立的N+M个端口的交换机,通过为每个根节点建立一个1+M端口的虚拟PCIe交换机,实现各根节点与M个I/O设备的逻辑连接;PCIe下游端口,包含符合PCI-Express基本规范中的PCIe端口类型定义的PCIe控制器和直接I/O虚拟化接口设备两个功能部分,负责与I/O设备子系统的互连,实现各根节点直接访问物理I/O设备功能。The multi-root I/O virtualization sharing controller in the multi-root I/O virtualization sharing system consists of three parts: several PCIe upstream ports (PCIe Upstream Port), PCIe multi-root switch and several PCIe downstream ports (PCIe Downstream Port) composition. Among them, the multi-root I/O virtualization shared controller is connected to multiple root nodes through the PCIe upstream port, and it is in a multi-root PCIe environment; the PCIe multi-root switch is essentially an N+M network established by multiple PCI bridges. A switch with multiple ports, by establishing a virtual PCIe switch with 1+M ports for each root node, realizes the logical connection between each root node and M I/O devices; The PCIe controller and the direct I/O virtualization interface device defined by the PCIe port type are two functional parts, which are responsible for the interconnection with the I/O device subsystem and realize the direct access of each root node to the physical I/O device function.
图2描述了根节点和I/O设备通信的示意图,根节点和I/O设备通信不外乎三种方式:I/O寄存器读写,DMA(Direct Memory Access)数据搬移,中断事件通知。所述I/O寄存器主要分为两类,一类是仅限系统初始化软件和错误处理软件用来进行设备配置、初始化和故障性错误处理的配置空间寄存器,一类是其他操作软件如驱动程序用来开启操作设备的设备控制状态寄存器。Figure 2 depicts a schematic diagram of the communication between the root node and the I/O device. There are three ways to communicate between the root node and the I/O device: I/O register read and write, DMA (Direct Memory Access) data movement, and interrupt event notification. The I/O registers are mainly divided into two categories, one is the configuration space registers used only by system initialization software and error handling software for device configuration, initialization and faulty error handling, and the other is other operating software such as driver programs The device control status register used to enable operation of the device.
根节点对于I/O设备的配置空间寄存器的读写访问往往通过I/O设备在PCIe树拓扑中的位置来定向,如通过由总线号、设备号和功能号组成的ID来访问。根节点对于I/O设备的控制状态寄存器的访问可以通过MMIO(MemoryMapped I/O,内存映射I/O)的方式。在系统初始化时,系统根据I/O设备功能的配置空间头中BAR寄存器(BAR,Base Address Register)定义的需求分配内存地址窗口,并将该内存地址窗口的基地址(以下简称内存基地址)写回到BAR寄存器。根节点通过该基地址加上要访问的寄存器偏移即可定向到该设备功能相应的控制状态寄存器。The read and write access of the root node to the configuration space register of the I/O device is often directed by the position of the I/O device in the PCIe tree topology, such as access by the ID composed of the bus number, device number and function number. The root node can access the control status register of the I/O device through MMIO (MemoryMapped I/O, memory mapped I/O). When the system is initialized, the system allocates the memory address window according to the requirements defined by the BAR register (BAR, Base Address Register) in the configuration space header of the I/O device function, and sets the base address of the memory address window (hereinafter referred to as the memory base address) Write back to the BAR register. The root node can be directed to the corresponding control status register of the device function through the base address plus the offset of the register to be accessed.
所述DMA数据搬移分为两种情况:一种是根节点将数据写到内存中,然后通知I/O设备到指定的内存地址取数据;一种是I/O设备将数据存到根节点指定内存中,完成之后设备发起一个中断事件通知根节点有数据到达,根节点收到中断通知后再做相应处理。DMA数据搬移实质是内存读写操作,而中断事件实质也是一个内存写操作,而所操作的内存地址是由根节点通过寄存器读写方式写到了I/O设备相应的控制状态寄存器中。The DMA data movement is divided into two situations: one is that the root node writes data into the memory, and then notifies the I/O device to fetch data at a specified memory address; the other is that the I/O device stores the data in the root node In the specified memory, after the completion, the device initiates an interrupt event to notify the root node that data has arrived, and the root node performs corresponding processing after receiving the interrupt notification. DMA data movement is essentially a memory read and write operation, and an interrupt event is essentially a memory write operation, and the operated memory address is written by the root node to the corresponding control status register of the I/O device through register read and write.
在多根I/O虚拟化共享系统中,系统上电时,所有根节点都试图枚举发现I/O设备中所有功能并初始化配置其在各自PCIe域中的ID号以及其申请映射地址窗口的基址寄存器BAR。这将引起系统竞争,导致I/O设备不能够正常工作,更无法实现I/O设备在多个根节点之间的共享。为解决该问题,提出了使用一种直接I/O虚拟化接口设备来辅助实现I/O设备多根共享的方法。其中,物理I/O设备由主控制根节点初始化配置及分配管理;当I/O设备功能分配各从属根节点时,使用对应的直接I/O虚拟化接口设备中逻辑虚拟功能镜像LVF作为从属根节点的设备占位符,接收和存储从属根节点的初始化配置。关于该方法的说明在与本发明相关的另一篇发明申请(多根I/O虚拟化共享系统和方法)中有详细描述。In a multi-root I/O virtualization sharing system, when the system is powered on, all root nodes attempt to enumerate and discover all functions in the I/O device and initialize and configure their ID numbers in their respective PCIe domains and their application mapping address windows The base address register BAR. This will cause system competition, causing the I/O device to not work normally, let alone sharing the I/O device between multiple root nodes. To solve this problem, a method of using a direct I/O virtualization interface device to assist in realizing multi-root sharing of I/O devices is proposed. Among them, the physical I/O device is initialized, configured, assigned and managed by the main control root node; when the I/O device function is allocated to each slave root node, the logical virtual function image LVF in the corresponding direct I/O virtualization interface device is used as the slave The device placeholder of the root node, which receives and stores the initial configuration of the slave root node. The description of the method is described in detail in another invention application (multi-root I/O virtualization sharing system and method) related to the present invention.
然而,在从属根节点访问设备时使用的是本地PCIe域中的ID号和地址,直接I/O虚拟化接口设备需要进行I/O设备功能在从属根节点PCIe域和主控制根节点PCIe域之间的ID号和映射地址的转换,才能将从属根节点的访问传送至对应的物理I/O设备功能,实现从属根节点直接访问I/O设备的目的。所述ID和地址转换包括三种情况:下行事务中从属根节点PCIe域的ID号到主控制根节点PCIe域的ID号转换,称之为下行ID重映射;上行事务中主控制根节点PCIe域的ID号到从属根节点PCIe域的ID号转换;称之为上行ID重映射;下行事务中从属根节点PCIe域的I/O映射地址窗口到主控制根节点PCIe域的I/O映射地址窗口转换,称之为地址重映射。而对于上行使用地址路由的事务,如DMA和中断事件通知,由于他们操作的地址是其从属根节点分配的,本来就是从属根节点可以识别的本地的内存地址,因此不需要做地址翻译。However, when the slave root node accesses the device, the ID number and address in the local PCIe domain are used, and the direct I/O virtualization interface device needs to perform I/O device functions in the slave root node PCIe domain and the master control root node PCIe domain. The conversion of the ID number and the mapping address between them can transfer the access of the slave root node to the corresponding physical I/O device function, and realize the purpose of the slave root node directly accessing the I/O device. Described ID and address conversion include three kinds of situations: the ID number conversion of subordinate root node PCIe field to the ID number of master control root node PCIe domain in downlink transaction, is called downlink ID remapping; Master control root node PCIe in uplink transaction The ID number of the domain is converted to the ID number of the PCIe domain of the slave root node; it is called uplink ID remapping; in the downlink transaction, the I/O mapping address window of the PCIe domain of the slave root node is mapped to the I/O mapping of the master control root node PCIe domain Address window translation is called address remapping. For upstream transactions that use address routing, such as DMA and interrupt event notification, since the addresses they operate are allocated by their subordinate root nodes, they are originally local memory addresses that can be recognized by the subordinate root nodes, so address translation is not required.
图3描述了ID重映射模块的结构示意图。ID重映射模块包括内容寻址存储阵列(Content Addressable Memory,CAM)和简单双端口RAM。其中,ID重映射模块通过CAM的精确匹配查找实现I/O设备功能在从属根节点PCIe域中的ID号到其在主控制根节点PCIe域中的ID号的映射,通过写读RAM存储元件实现I/O设备功能在主控制根节点PCIe域中的ID号到其在从属根节点PCIe域中的ID号的映射。Fig. 3 depicts a schematic structural diagram of the ID remapping module. The ID remapping module includes a content addressable memory array (Content Addressable Memory, CAM) and a simple dual-port RAM. Among them, the ID remapping module realizes the mapping from the ID number of the I/O device function in the PCIe domain of the slave root node to its ID number in the PCIe domain of the main control root node through the exact matching search of the CAM, and writes and reads the RAM storage element Realize the mapping from the ID number of the I/O device function in the primary control root node PCIe domain to its ID number in the slave root node PCIe domain.
ID重映射模块中的CAM,利用I/O设备功能的功能号(FunNo_m)在主控制节点PCIe域的连续性,将其作为写存储地址索引(CAM_WrAddr),存储由该功能所属的从属根节点ID(RNID_s)以及其在从属根节点PCIe域中的功能号(FunNo_s)组成的数据项(CAM_Din),进而实现(RNID_s,FunNo_s)到FunNo_m的映射。在主控制根节点进行设备I/O资源分配阶段,通过解析设备分配事务包,提取事务包中指示的设备功能在主控制根节点PCIe域的功能号(FunNo_m)作为地址索引(CAM_WrAddr),写存储所述功能所属的根节点标识ID(RNID_s)以及所述功能在所属根节点PCIe域中的功能号(FunNo_s),建立设备功能在主控制根节点PCIe域中的ID号到其在从属根节点PCIe域中的ID号的映射;当接收到从属根节点发来的使用ID路由的下行事务包时,通过对其进行事务包解析,提取事务包中指示的发起事务的从属根节点ID(RNID_s)以及要访问的目标设备功能的功能号(FunNo_s)作为要比较数据项输入(CMP_Din),对CAM的存储内容进行精确的查找匹配。如果存在匹配项,CAM输出匹配标识符(Match_flag)以及该匹配项存储的地址(CAM_Dout),即目标设备功能在主控制根节点PCIe域的功能号(FunNo_m),进而实现下行ID重映射。The CAM in the ID remapping module uses the continuity of the function number (FunNo_m) of the I/O device function in the PCIe domain of the main control node, and uses it as the write storage address index (CAM_WrAddr) to store the slave root node to which the function belongs The data item (CAM_Din) composed of the ID (RNID_s) and its function number (FunNo_s) in the PCIe domain of the slave root node, thereby realizing the mapping from (RNID_s, FunNo_s) to FunNo_m. In the stage of device I/O resource allocation by the master control root node, by parsing the device allocation transaction packet, the function number (FunNo_m) of the device function indicated in the transaction packet in the PCIe domain of the master control root node is extracted as the address index (CAM_WrAddr), and written Store the root node identification ID (RNID_s) to which the function belongs and the function number (FunNo_s) of the function in the PCIe domain of the root node to which the function belongs, and establish the ID number of the device function in the PCIe domain of the master control root node to its slave root The mapping of the ID number in the node PCIe domain; when receiving the downlink transaction packet using the ID route sent from the subordinate root node, by performing transaction packet analysis to it, extracting the subordinate root node ID of the transaction indicated in the transaction packet ( RNID_s) and the function number (FunNo_s) of the target device function to be accessed are input as the data item to be compared (CMP_Din), and the storage content of the CAM is precisely searched and matched. If there is a match, the CAM outputs the matching identifier (Match_flag) and the address (CAM_Dout) where the match is stored, that is, the function number (FunNo_m) of the target device function in the main control root node PCIe domain, and then realizes downlink ID remapping.
上行ID重映射表RAM,利用设备功能的功能号(FunNo_m)在主控制节点PCIe域的连续性,将其作为RAM的写地址(RAM_WrAddr),存储由该功能号所属的从属根节点ID(RNID_s)以及其在从属根节点PCIe域中的功能号(FunNo_s)组成的数据项(RAM_Din),进而实现FunNo_m到(RNID_s,FunNo_s)的映射。在主控制根节点进行设备I/O资源分配阶段,通过解析设备分配事务包,提取事务包中指示的设备功能在主控制根节点PCIe域的功能号(FunNo_m)作为地址索引(RAM_WrAddr),写存储所述功能所属的根节点标识ID(RNID_s)以及所述功能在所属根节点PCIe域中的功能号(FunNo_s),建立设备功能在从属根节点PCIe域中的ID号到其在主控制根节点PCIe域中的ID号的映射;当接收到从I/O设备发来的上行事务包时,通过对其进行事务包解析,提取其中指示发起事务的设备功能的功能号(FunNo_m),并以此为RAM的读地址(RAM_RdAddr)读取RAM存储表,根据RAM输出(RAM_Dout),即设备功能所属的从属根节点ID(RNID_s)及其在从属根节点PCIe域中的功能号(FunNo_s),进而实现上行ID重映射。The uplink ID remapping table RAM uses the continuity of the function number (FunNo_m) of the device function in the PCIe domain of the master control node, and uses it as the write address (RAM_WrAddr) of the RAM to store the slave root node ID (RNID_s) to which the function number belongs. ) and the data item (RAM_Din) composed of its function number (FunNo_s) in the slave root node PCIe domain, and then realize the mapping from FunNo_m to (RNID_s, FunNo_s). In the stage of device I/O resource allocation by the main control root node, by analyzing the device allocation transaction package, the function number (FunNo_m) of the device function indicated in the transaction package in the PCIe domain of the main control root node is extracted as the address index (RAM_WrAddr), and written Store the root node identification ID (RNID_s) to which the function belongs and the function number (FunNo_s) of the function in the PCIe domain of the root node to which the function belongs, and establish the ID number of the device function in the PCIe domain of the slave root node to its master control root The mapping of the ID number in the node PCIe domain; when receiving the uplink transaction packet sent from the I/O device, by performing transaction packet analysis to it, extracting the function number (FunNo_m) indicating the device function that initiates the transaction wherein, and Use this as the read address of the RAM (RAM_RdAddr) to read the RAM storage table, and according to the RAM output (RAM_Dout), that is, the slave root node ID (RNID_s) to which the device function belongs and its function number (FunNo_s) in the PCIe domain of the slave root node , so as to realize uplink ID remapping.
图4描述了下行ID重映射过程,具体步骤如下:Figure 4 describes the downlink ID remapping process, the specific steps are as follows:
a)接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为从属根节点,转向步骤b);a) Receive the transaction packet sent from the root node, analyze and judge the ID of the root node that initiated the transaction packet, if the originating root node indicated by the transaction packet is a subordinate root node, go to step b);
b)事务包类型判定,如果是基于ID路由的事务包,转向步骤c);b) Determine the type of transaction packet, if it is a transaction packet based on ID routing, turn to step c);
c)查询下行ID重映射表CAM,提取事务包中指示的发起根节点ID以及其要访问的设备功能号,并将其组合作为要比较的数据内容,输入下行ID重映射表CAM进行精确匹配查找,如果存在匹配项,转向步骤d);否则转向步骤e);c) Query the downlink ID remapping table CAM, extract the originating root node ID indicated in the transaction packet and the function number of the device to be accessed, and combine them as the data content to be compared, input the downlink ID remapping table CAM for exact matching Find, if there is a match, go to step d); otherwise go to step e);
d)改写事务包中设备功能ID号,使用CAM匹配输出的地址,即指示的主控制根节点PCIe中的功能号,改写事务包中设备功能ID号,操作完后转向步骤a);d) Rewrite the device function ID number in the transaction package, use the CAM to match the output address, that is, the function number in the indicated main control root node PCIe, rewrite the device function ID number in the transaction package, and turn to step a) after the operation;
e)向事务包指示的根节点返回一个不支持的事务包,操作完成后转向步骤a)。e) Return an unsupported transaction package to the root node indicated by the transaction package, and turn to step a) after the operation is completed.
图6描述了上行ID重映射过程,具体步骤如下:Figure 6 describes the uplink ID remapping process, the specific steps are as follows:
a)接收从I/O设备功能发来的事务包,如果接收到事务包,转向步骤b);a) Receive the transaction packet sent from the I/O device function, if the transaction packet is received, go to step b);
b)提取事务包指示的I/O设备功能ID号。如果事务包为请求包,提取请求事务包中指示的请求设者ID号;如果是如果事务包是完成包,提取完成事务包中指示的完成者ID号,转向步骤c);b) Extract the function ID number of the I/O device indicated by the transaction packet. If the transaction package is a request package, extract the request setter ID number indicated in the request transaction package; if it is if the transaction package is a completion package, extract the completer ID number indicated in the transaction package, and turn to step c);
c)查询上行ID重映射表RAM,使用提取的I/O设备功能ID号中的功能号为读地址索引,读取RAM输出根节点标识ID及功能号组合而成的数据项。如果RAM输出的根节点标识ID非主控制根节点ID,转向步骤d);否则,说明事务包所属的根节点为主控制根节点,不需要进行ID转换,转向步骤e);c) Query the upstream ID remapping table RAM, use the function number in the extracted I/O device function ID number as the read address index, and read the data item composed of the root node identification ID and the function number of the RAM output. If the ID of the root node output by the RAM is not the ID of the main control root node, go to step d); otherwise, it means that the root node to which the transaction package belongs is the main control root node, no ID conversion is required, and go to step e);
d)使用RAM输出的内容改写事务包。将RAM输出的根节点标识ID记录到事务包中;如果事务包为请求包,则使用RAM输出的功能号,修改事务包中请求者ID号;如果事务包为完成包,则使用RAM输出的功能号,修改事务包中完成者ID号,操作完后转向步骤a);d) Rewrite the transaction packet with the contents of the RAM output. Record the ID of the root node output by the RAM into the transaction package; if the transaction package is a request package, use the function number output by the RAM to modify the ID number of the requester in the transaction package; if the transaction package is a completion package, use the function number output by the RAM Function number, modify the ID number of the completer in the transaction package, and turn to step a) after the operation;
e)使用主控制根节点标识ID改写事务包。将主控制根节点的标识ID记录到事务包中,操作完后转向步骤a)。e) Use the main control root node ID to rewrite the transaction package. Record the identification ID of the main control root node into the transaction package, and turn to step a) after the operation.
如上文所述,设备功能配置空间中的BAR寄存器定义并记录申请的内存地址窗口的基地址,根节点通过分配给设备功能的内存地址访问设备功能的控制状态寄存器,进而实现与设备功能的通信。每个设备功能的配置空间包含6个32位的BAR寄存器,可申请获得最多6个32的地址空间或者3个64位的地址空间,或者少于6个的32位BAR地址和64位地址空间的组合。对于同一个I/O设备中的所有功能,其BAR需求配置是相同的,即需要申请的地址窗口数目,各地址窗口的大小是一样的;只是在同一PCIe域中,设备功能中各BAR地址记录的所分配到的地址窗口的基地址不一样。如使用FunNo来表示一个设备的功能数,每个功能需要申请的地址窗口数目使用BAR_id来指示,那么整个设备将被主控制根节点配置获得BAR_id*FuncNo个不同的BAR地址。同理,当设备中的功能配置给从属根节点时,从属根节点分配BAR_id个BAR地址,且不同的从属根节点给同一个设备功能中的不同的功能分配的BAR地址有可能是一样的。为了实现从属根节点能够通过地址直接访问设备功能,需要进行地址重映射,即设备中各功能在从属根节点PCIe域的地址窗口到其在主控制根节点PCIe域的地址窗口的转换。As mentioned above, the BAR register in the device function configuration space defines and records the base address of the applied memory address window, and the root node accesses the control status register of the device function through the memory address assigned to the device function, thereby realizing communication with the device function . The configuration space of each device function contains 6 32-bit BAR registers, and can apply for up to 6 32-bit address spaces or 3 64-bit address spaces, or less than 6 32-bit BAR addresses and 64-bit address spaces The combination. For all functions in the same I/O device, its BAR requirement configuration is the same, that is, the number of address windows that need to be applied for, and the size of each address window is the same; only in the same PCIe domain, the BAR address of each device function The base addresses of the allocated address windows recorded are different. If FunNo is used to indicate the number of functions of a device, and the number of address windows that each function needs to apply for is indicated by BAR_id, then the entire device will be configured by the main control root node to obtain BAR_id*FuncNo different BAR addresses. Similarly, when the functions in the device are assigned to the slave root nodes, the slave root nodes allocate BAR_id BAR addresses, and different slave root nodes may assign the same BAR addresses to different functions in the same device function. In order to realize that the slave root node can directly access the device function through the address, address remapping is required, that is, the conversion of each function in the device from the address window of the slave root node PCIe domain to its address window in the master control root node PCIe domain.
图8描述了利用CAM和RAM实现地址重映射模块的结构示意图。所述地址重映射结构主要包括四个部分:一是基地址定义提取模块,通过解析配置设备功能的基地址寄存器(Base Address Register,BAR)的事务包,获取I/O设备功能通过各BAR定义的地址窗口类型,提取各地址窗口对应的基地址掩码(BAR_mask),并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号(BAR_id)之间的映射关系;二是功能基地址序号匹配模块,包含BAR_id个深度为FuncNo_m的CAM的CAM存储阵列和匹配输出选择子模块,每个CAM存储同一I/O设备中所有功能FuncNo_m相同基地址序列号BAR_id对应的基地址BAR,实现从属根节点PCIe域中的基地址(BAR_s)与其所属功能基地址序号(BAR_id,FuncNo_m)的映射;三是基地址查找模块,包含深度为BAR_id*FuncNo_m的RAM存储单元,通过写读RAM存储元件,实现功能号为FuncNo_m,基地址序号为BAR_id在主控制根节点PCIe域中的基地址(BAR_m)的查找;四是输出译码模块,根据匹配查找出的基地址BAR_m及其对应匹配基地址掩码Match_BAR_mask,将从属根节点PCIe域中的目标访问地址(DstAddr_s)翻译成主控制根节点PCIe域中的目标访问地址(DstAddr_m)。通过该四个模块的接力合作,完成了从属根节点PCIe域中目标访问地址到其映射在主控制根节点PCIe域的转换,最终实现从属根节点通过地址路由对设备功能的直接访问。Fig. 8 has described the structural diagram of realizing the address remapping module by using CAM and RAM. The address remapping structure mainly includes four parts: one is the base address definition extraction module, which obtains the I/O device function defined by each BAR by parsing the transaction package of the base address register (BAR) that configures the device function. address window type, extract the base address mask (BAR_mask) corresponding to each address window, and record the mapping relationship between each base address register number and the base address number (BAR_id) corresponding to the defined address window; the second is the function base address The serial number matching module includes a CAM storage array of BAR_id CAMs with a depth of FuncNo_m and a matching output selection submodule. Each CAM stores the base address BAR corresponding to the serial number BAR_id of the same base address of all functions FuncNo_m in the same I/O device, and realizes the slave The mapping between the base address (BAR_s) in the PCIe domain of the root node and the base address serial number (BAR_id, FuncNo_m) to which it belongs; the third is the base address search module, which includes a RAM storage unit with a depth of BAR_id*FuncNo_m. By writing and reading the RAM storage element, Realize the search of the base address (BAR_m) whose function number is FuncNo_m and whose base address serial number is BAR_id in the PCIe domain of the main control root node; the fourth is to output the decoding module, and find out the base address BAR_m according to the match and its corresponding matching base address mask The code Match_BAR_mask translates the target access address (DstAddr_s) in the PCIe domain of the slave root node into the target access address (DstAddr_m) in the PCIe domain of the master control root node. Through the relay cooperation of these four modules, the conversion of the target access address in the PCIe domain of the slave root node to its mapping in the PCIe domain of the master control root node is completed, and finally the slave root node directly accesses device functions through address routing.
基地址定义提取模块,在主控制根节点系统初始化配置阶段,通过解析配置事务包,检查各BAR是否定义了地址窗口,如果定义了地址窗口,解析其所定义的地址窗口的位宽、大小等类型,提取所有BAR定义的地址窗口数目(BAR_id)以及各地址窗口的基地址掩码(BAR0_mask,…,BARn_mask),并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号(BAR_id)之间的映射关系。由于一个64位宽的地址窗口是由两个BAR定义并记录系统分配的基地址,通过基地址寄存器号及其定义的地址窗口位宽类型与基地址序号(BAR_id)的对应关系,可以按基地址序号记录相应地址窗口的完整基地址。图9描述了基地址定义提取过程,包括以下步骤:The base address definition extraction module, in the initial configuration stage of the main control root node system, checks whether each BAR defines an address window by analyzing the configuration transaction package, and if an address window is defined, parses the bit width and size of the address window defined by it Type, extract the number of address windows defined by all BARs (BAR_id) and the base address mask of each address window (BAR0_mask, ..., BARn_mask), and record the base address serial number (BAR_id) corresponding to the serial number of each base address register and the address window defined mapping relationship between them. Since a 64-bit wide address window is defined by two BARs and records the base address allocated by the system, through the corresponding relationship between the base address register number and the defined address window bit width type and the base address serial number (BAR_id), you can The address sequence number records the complete base address of the corresponding address window. Figure 9 describes the base address definition extraction process, including the following steps:
a)系统上电,初始化BAR寄存器偏移指针的起始地址,初始化基地址序号,初始化64位地址申请标识符,转向步骤b)。a) Power on the system, initialize the start address of the BAR register offset pointer, initialize the base address serial number, initialize the 64-bit address application identifier, and turn to step b).
b)接收从主控制根节点发来的事务包。如果接收到主控制根节点发来的事务包,转向步骤c)。b) Receive the transaction package sent from the main control root node. If the transaction packet sent by the main control root node is received, go to step c).
c)事务包判定。解析接收到的事务包,如果该事务包是向BAR寄存器偏移指针指定的寄存器写全1的配置写请求包,转向步骤d);否则转向步骤b)。c) Transaction package determination. Parse the received transaction packet, if the transaction packet is a configuration write request packet that writes all 1s to the register specified by the offset pointer of the BAR register, turn to step d); otherwise, turn to step b).
d)接收I/O设备发来的带数据的完成包。如果接收到从I/O设备发来的带数据的完成包,转向步骤e)。d) Receive the completion packet with data from the I/O device. If a completion packet with data is received from the I/O device, go to step e).
e)地址申请类型判断。解析完成包的数据段,对该BAR定义的地址申请类型进行判断。如果该BAR未用于地址申请,则转向步骤h);如果该BAR定义的是64位地址,则转向步骤f);否则,转向步骤g)。e) Address application type judgment. The data segment of the completed packet is parsed, and the address application type defined by the BAR is judged. If the BAR is not used for address application, go to step h); if the BAR defines a 64-bit address, go to step f); otherwise, go to step g).
f)将数据段内容记录到基地址序号对应的基地址掩码的低L位,使能64位地址申请标识符,并记录当前BAR寄存器偏移指针及其指示的BAR定义的地址窗口位宽类型与基地址序号的映射关系。转向步骤h)。f) Record the content of the data segment to the low L bit of the base address mask corresponding to the base address number, enable the 64-bit address application identifier, and record the current BAR register offset pointer and the address window bit width defined by the BAR indicated by it The mapping relationship between type and base address number. Go to step h).
g)记录数据段,更新基地址申请序号及64位地址申请标识。如果当前的64位申请标识符未使能,指示数据段内容为32位基地址的掩码,则将数据段内容的高L位记录到基地址序号对应的基地址掩码的低L位;否则,数据段内容为基地址序号对应的64位基地址的编码的高32位,则将数据段记录到基地址序号对应的基地址掩码的高32位。记录当前BAR寄存器偏移指针及其指示的BAR定义的地址窗口位宽类型与基地址序号的映射关系,然后更新基地址序号加1,并复位64位地址申请标识符,转向步骤h)。g) Record the data segment, update the base address application serial number and the 64-bit address application identification. If the current 64-bit application identifier is not enabled, indicating that the content of the data segment is a mask of a 32-bit base address, the high L bits of the content of the data segment are recorded in the low L bits of the base address mask corresponding to the base address sequence number; Otherwise, the content of the data segment is the upper 32 bits of the encoding of the 64-bit base address corresponding to the base address serial number, and then the data segment is recorded in the upper 32 bits of the base address mask corresponding to the base address serial number. Record the mapping relationship between the current BAR register offset pointer and the address window bit width type defined by the BAR indicated by the BAR and the base address number, then update the base address number and add 1, and reset the 64-bit address application identifier, and turn to step h).
h)更新BAR寄存器偏移指针指向下一个BAR寄存器,转向步骤i);h) Update the BAR register offset pointer to point to the next BAR register, turn to step i);
i)BAR寄存器偏移指针有效性判定。判定当前BAR寄存器偏移指针指向的寄存器是否依然为配置空间中的BAR,如果是,则转向b);否则转向j)。i) Validity determination of BAR register offset pointer. Determine whether the register pointed to by the current BAR register offset pointer is still the BAR in the configuration space, if so, turn to b); otherwise, turn to j).
j)结束。标识已经完成基地址定义提取过程。j) end. Indicates that the base address definition extraction process has been completed.
图8所示的功能基地址序号匹配模块中的CAM阵列,以功能基地址序号(BAR_id,FunNo_m)为地址索引(CAM_WrAddr),存储的数据项(CAM_Din)包括两部分:一部分是I/O设备功能所属的从属根节点ID(RNID_s),一部分是从属根节点分配的基地址(BAR_s)。其中,功能基地址序号中的基地址序号(BAR_id)选择要存储的CAM,功能基地址序号中的功能号(FunNo_m)选择要存储的CAM存储单元。所述CAM存储阵列有N个比较数据输入端口(CMP_Din0,CMP_Din1,…,CMP_Dinn),每一个CAM对应一个。当接收到从属根节点发来的基于地址路由的事务包时,通过对其进行数据包解析,提取事务包要访问的目标访问地址。然后将其通过基地址定义提取模块获得BAR_id个BAR基地址(BAR0_s,BAR1_s,…,BARn_s),并将其作为比较的数据输入(CMP_Din)分别输入CAM中进行精确的匹配查找,获得N个匹配输出结果,包括匹配标识(Match_flag0,…,Match_flagn)和匹配地址(Match_Addr0,…,Match_Addrn)。如果CAM存储阵列的N个匹配输出结果存在(仅存在一个)匹配项,则由功能基地址序号匹配模块中匹配输出选择子模块选择该CAM的输出地址作为匹配输出(即所述目标访问地址的基地址对应的由功能号MatchedFunNo_m以及其对应的基地址序号MatchedBAR_id组成的功能基地址序号,同时将匹配标识Match_flag置1;否则,将匹配标识Match_flag置0。The CAM array in the function base address serial number matching module shown in Figure 8 uses the functional base address serial number (BAR_id, FunNo_m) as the address index (CAM_WrAddr), and the stored data item (CAM_Din) includes two parts: one part is the I/O device The subordinate root node ID (RNID_s) to which the function belongs, and a part is the base address (BAR_s) assigned by the subordinate root node. Wherein, the base address number (BAR_id) in the function base address number selects the CAM to be stored, and the function number (FunNo_m) in the function base address number selects the CAM storage unit to be stored. The CAM storage array has N comparison data input ports (CMP_Din0, CMP_Din1, . . . , CMP_Dinn), one for each CAM. When receiving the transaction packet based on address routing sent from the slave root node, the target access address to be accessed by the transaction packet is extracted by analyzing the data packet. Then use it to obtain BAR_id BAR base addresses (BAR0_s, BAR1_s,..., BARn_s) through the base address definition extraction module, and input them as the data input (CMP_Din) for comparison into the CAM for precise matching search, and obtain N matches Output results, including matching flags (Match_flag0, ..., Match_flagn) and matching addresses (Match_Addr0, ..., Match_Addrn). If there is (only one) matching item in the N matching output results of the CAM storage array, then the output address of the CAM is selected by the matching output selection submodule in the function base address serial number matching module as the matching output (that is, the target access address The base address corresponds to the function base address sequence number composed of the function number MatchedFunNo_m and its corresponding base address sequence number MatchedBAR_id, and the matching flag Match_flag is set to 1; otherwise, the matching flag Match_flag is set to 0.
图10描述了功能基地址序号匹配模块写存储主控制根节点PCIe域中的功能基地址的过程,包括如下步骤:Fig. 10 has described the process that the functional base address serial number matching module writes and stores the functional base address in the primary control root node PCIe domain, including the following steps:
a接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为从属根节点,转向步骤b);a Receive the transaction packet sent from the root node, analyze and judge the root node ID of the initiating transaction packet, if the initiating root node indicated by the transaction packet is a subordinate root node, turn to step b);
b下行事务包判定。解析接收到的由从属根节点发来的事务包,如果该事务包是基于ID事务包,转向步骤c);b Downlink transaction packet determination. Parse the received transaction packet sent by the slave root node, if the transaction packet is based on the ID transaction packet, turn to step c);
c下行ID重映射。将基于ID路由的事务包中的ID号转换为其对应在主控制根节点PCIe域中的ID号,转向步骤d)。c Downlink ID remapping. Convert the ID number in the ID-based routing transaction packet to the corresponding ID number in the PCIe domain of the main control root node, and turn to step d).
d获取并解析配置事务包中向BAR寄存器写非全1的配置写包,提取事务包中的目标设备功能号、要配置的BAR寄存器偏移以及数据段内容(即系统配置的基地址),转向步骤e);d Obtain and analyze the configuration write packet that writes non-all 1s to the BAR register in the configuration transaction packet, extract the target device function number, the offset of the BAR register to be configured, and the content of the data segment (that is, the base address of the system configuration) in the transaction packet, Go to step e);
e根据基地址定义提取模块,获取BAR寄存器偏移对应的基地址序号和地址窗口位宽类型,转向步骤f);e Define the extraction module according to the base address, obtain the base address serial number and address window bit width type corresponding to the BAR register offset, and turn to step f);
f地址窗口位宽类型判定。判定步骤e)获取的地址窗口位宽类型,如果指示该BAR定义的为64位地址的低32位,则寄存提取的基地址,然后转向步骤a);如果指示的是32为地址或者64位地址的高32位,则转向步骤g);f Address window bit width type determination. Determine the address window bit width type obtained in step e), if it indicates that the lower 32 bits of the 64-bit address defined by the BAR, register the extracted base address, and then turn to step a); if the indicated is 32-bit address or 64-bit The upper 32 bits of the address, then turn to step g);
g写存储基地址。如果是32位地址,则将提取的数据段存储到由功能号和基地址序号指定的CAM单元中;如果是64位地址,则将步骤f)寄存的基地址和步骤d)提取的数据段高低位组合,存储到由功能号和基地址序号指定的CAM单元中;转向步骤a)。g write storage base address. If it is a 32-bit address, store the extracted data segment in the CAM unit specified by the function number and base address number; if it is a 64-bit address, store the base address registered in step f) and the extracted data segment in step d) The combination of high and low bits is stored in the CAM unit specified by the function number and base address number; turn to step a).
图8所示的基地址查找模块中的RAM,以功能基地址序号(BAR_id,FunNo_m)为地址索引(RAM_WrAddr),存储的数据项(RAM_Din)是主控制根节点分配的基地址(BAR_m)。当目标访问地址的基地址通过基地址序号匹配模块获得匹配的功能基地址序号(BAR_id,FuncNo_m),输入RAM的读地址(RAM_RdAddr),对应获得RAM输出(RAM_Dout)即是目标访问地址的基地址对应在主控制根节点PCIe域的基地址(BAR_m)。The RAM in the base address search module shown in Figure 8 uses the function base address serial number (BAR_id, FunNo_m) as the address index (RAM_WrAddr), and the stored data item (RAM_Din) is the base address (BAR_m) allocated by the main control root node. When the base address of the target access address obtains the matching function base address number (BAR_id, FuncNo_m) through the base address number matching module, input the read address of the RAM (RAM_RdAddr), and the corresponding RAM output (RAM_Dout) is the base address of the target access address Corresponds to the base address (BAR_m) of the main control root node PCIe domain.
图11描述了基地址查找模块写存储从属根节点PCIe域中的功能基地址的过程,包括如下步骤:Fig. 11 has described the process that the base address lookup module writes and stores the functional base address in the slave root node PCIe domain, including the following steps:
a接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为主控制根节点,转向步骤b);a Receive the transaction packet sent from the root node, analyze and judge the ID of the root node that initiated the transaction packet, if the originating root node indicated by the transaction packet is the main control root node, turn to step b);
b下行事务包判定。解析接收到的由主控制根节点发来的事务包,如果该事务包是配置事务包,转向步骤c);b Downlink transaction packet determination. Parse the received transaction packet sent by the main control root node, if the transaction packet is a configuration transaction packet, go to step c);
c获取并解析配置事务包中向BAR寄存器写非全1的配置写包,提取事务包中的目标设备功能号、要配置的BAR寄存器偏移以及数据段内容(即系统配置的基地址),转向步骤d);c Obtain and parse the configuration write packet that writes non-all 1s to the BAR register in the configuration transaction packet, extract the target device function number, the offset of the BAR register to be configured, and the content of the data segment (that is, the base address of the system configuration) in the transaction packet, Go to step d);
d根据基地址定义提取模块,获取BAR寄存器偏移对应的基地址序号和地址窗口位宽类型,转向步骤e);d Define the extraction module according to the base address, obtain the base address serial number and address window bit width type corresponding to the BAR register offset, and turn to step e);
e地址窗口位宽类型判定。判定步骤d)获取的地址窗口位宽类型,如果指示该BAR定义的为64位地址的低32位,则寄存提取的基地址,然后转向步骤81;如果指示的是32为地址或者64位地址的高32位,则转向步骤86;e Address window bit width type determination. Determine the type of address window bit width obtained in step d), if it indicates that the lower 32 bits of the 64-bit address defined by the BAR, register the extracted base address, and then turn to step 81; if it indicates a 32-bit address or a 64-bit address The upper 32 bits, then turn to step 86;
f写存储基地址。如果是32位地址,则将提取的数据段存储到由功能号和基地址序号指定的RAM单元中;如果是64位地址,则将步骤85寄存的基地址和步骤83提取的数据段高低位组合,存储到由功能号和基地址序号指定的RAM单元中;转向步骤a)。f Write storage base address. If it is a 32-bit address, store the extracted data segment in the RAM unit specified by the function number and the base address sequence number; if it is a 64-bit address, then store the base address in step 85 and the high and low bits of the data segment extracted in step 83 Combined, stored in the RAM unit specified by the function number and the base address number; turn to step a).
图12描述了从属根节点PCIe域中的目标访问地址到主控制根节点PCIe域的地址重映射过程,包括以下步骤:Figure 12 describes the address remapping process from the target access address in the slave root node PCIe domain to the master control root node PCIe domain, including the following steps:
a接收从根节点发来的事务包,对发起事务包的根节点ID进行解析判定,如果事务包指示的发起根节点为从属根节点,转向步骤b);a Receive the transaction packet sent from the root node, analyze and judge the root node ID of the initiating transaction packet, if the initiating root node indicated by the transaction packet is a subordinate root node, turn to step b);
b下行事务包判定。解析接收到的由从属根节点发来的事务包,如果该事务包是基于地址事务包,转向步骤c);b Downlink transaction packet determination. Parse the received transaction packet sent by the slave root node, if the transaction packet is an address-based transaction packet, go to step c);
c解析接收到的基于地址路由的事务包,提取事务包中指示的目标访问地址,转向步骤d);c parses the received transaction packet based on address routing, extracts the target access address indicated in the transaction packet, and turns to step d);
d获取基地址。将目标访问地址与基地址定义提取模块中记录的所有N个基地址掩码进行与操作,获取N个基地址,转向步骤e);d Get the base address. Perform an AND operation on the target access address and all N base address masks recorded in the base address definition extraction module to obtain N base addresses, and turn to step e);
e功能基地址序号匹配查找。将步骤d)获取的N个BAR基地址作为比较数据,输入CAM阵列中的各CAM进行并行的精确匹配查找,获取匹配的功能基地址序号。如果存在匹配项,转向步骤f),否则转向步骤i);e function base address serial number matching lookup. Use the N BAR base addresses obtained in step d) as comparison data, and input them to each CAM in the CAM array to perform parallel exact matching search, and obtain the matching function base address serial number. If there is a match, go to step f), otherwise go to step i);
f基地址及基地址掩码匹配查找。使用匹配输出的功能基地址序号,读取RAM,获取所述功能基地址序号对应在主控制根节点PCIe域中的匹配基地址;同时根据基地址定义提取模块记录的信息,获取所述基地址序号匹配的基地址掩码,转向步骤g);f base address and base address mask matching lookup. Use the function base address serial number of matching output, read RAM, obtain described function base address serial number corresponding to the matching base address in main control root node PCIe domain; Simultaneously according to the information of base address definition extraction module record, obtain described base address The base address mask that the sequence number matches, go to step g);
g匹配的目标访问地址输出译码。将获取的匹配基地址、匹配基地址掩码,连同步骤c)提取的目标访问地址,通过输出译码,即可获得从属根节点PCIe域中的目标访问地址映射到主控制根节点PCIe域中的匹配目标访问地址。操作完后转向步骤h);g matches the target access address output decoding. By outputting the obtained matching base address, matching base address mask, and the target access address extracted in step c), the target access address in the slave root node PCIe domain can be mapped to the master control root node PCIe domain through output decoding The matching target access address. After the operation, turn to step h);
h使用步骤g)获的的匹配目标访问地址,改写事务包中目标访问地址。操作完后转向步骤a);h Use the matching target access address obtained in step g) to rewrite the target access address in the transaction packet. After the operation, turn to step a);
i向事务包指示的根节点返回一个不支持的事务包,操作完成后转向步骤a)。i returns an unsupported transaction package to the root node indicated by the transaction package, and turns to step a) after the operation is completed.
特别地,对于SR-IOV设备,图8描述的地址重映射模块结构可以相应的简化。SR-IOV设备的VF本身不具备申请内存地址的能力,VF配置空间头中的6个BAR没有作用,而它所需要的地址由其对应的PF配置空间中SR-IOV扩展功能定义并申请。与普通设备类似,SR-IOV扩展功能寄存器中也有6个定义并记录系统分配的地址窗口基地址的32位BAR寄存器VF BARb(b=0,1…,5)。与普通设备不同的是,针对VF BARb定义的地址窗口的大小,系统将分配一大块连续的内存地址供所有的VF使用,并将其基地址写到SR-IOV扩展功能寄存器中的VF BARb中。换句话说,对于有VFunNo个虚功能,每个VF需要的地址窗口数为VFBAR_id的SR-IOV,系统只分配VFBAR_id个基地址写入到配置空间中SR-IOV扩展功能寄存器的VF_BARb寄存器中,而不是分配BAR_id*VFunNo个基地址分别写到每个VF配置空间头对应的BAR寄存器中。VF BARb记录的是VF0的第b个BAR地址的基地址,而其他VFv(v=1,2,…,VFunNo-1)的起始地址BARb通过公式VF BARb+(v-1)*(VF BARb范围大小)计算获得。In particular, for SR-IOV devices, the structure of the address remapping module described in FIG. 8 can be simplified accordingly. The VF of the SR-IOV device itself does not have the ability to apply for memory addresses. The 6 BARs in the VF configuration space header have no effect, and the addresses it needs are defined and applied for by the SR-IOV extension function in the corresponding PF configuration space. Similar to ordinary devices, there are also 6 32-bit BAR registers VF BARb (b=0,1...,5) that define and record the base address of the address window allocated by the system in the SR-IOV extended function register. Different from ordinary devices, for the size of the address window defined by VF BARb, the system will allocate a large continuous memory address for all VFs, and write its base address to VF BARb in the SR-IOV extended function register middle. In other words, for SR-IOV with VFunNo virtual functions and the number of address windows required by each VF is VFBAR_id, the system only allocates VFBAR_id base addresses to write into the VF_BARb register of the SR-IOV extended function register in the configuration space. Instead of assigning BAR_id*VFunNo base addresses, write them to the BAR register corresponding to each VF configuration space header. VF BARb records the base address of the bth BAR address of VF0, and the starting address BARb of other VFv (v=1,2,...,VFunNo-1) is passed through the formula VF BARb+(v-1)*(VF BARb Range size) is calculated.
图9描述了利用CAM和RAM实现SR-IOV设备功能地址重映射的结构示意图,这里只考虑SR-IOV设备只有一个PF和多个VF。该地址重映射结构主要包括四个部分:一是基地址定义提取模块,通过解析配置设备功能的基地址寄存器(Base Address Register,BAR)的事务包,获取设备中VF通过各BAR定义的地址窗口类型,提取各地址窗口对应的基地址掩码(VFBAR_mask),并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号(VFBAR_id)之间的映射关系;二是功能基地址序号匹配模块,包含BAR_id个深度为FunNo_m的CAM的CAM存储阵列和匹配输出选择子模块,每个CAM存储同一I/O设备中所有功能FuncNo_m相同基地址序列号BAR_id对应的基地址BAR,实现从属根节点PCIe域中的基地址(BAR_s)与其所属功能基地址序号(BAR_id,FuncNo_m)的映射;三是基地址查找模块,包含深度为VFBAR_id的RAM存储单元,通过写读RAM存储元件,实现基地址序号为VFBAR_id在主控制根节点PCIe域中的基地址(BAR_m)的查找;四是输出译码模块,根据匹配查找出的功能号(MatchedFunNo_m)、基地址BAR_m及其对应掩码MatchedVFBAR_mask,将从属根节点PCIe域中的目标访问地址(DstAddr_s)翻译成主控制根节点PCIe域中的目标访问地址(DstAddr_m)。FIG. 9 depicts a structural schematic diagram of realizing functional address remapping of SR-IOV devices by using CAM and RAM. Here, only one PF and multiple VFs of SR-IOV devices are considered. The address remapping structure mainly includes four parts: one is the base address definition extraction module, which obtains the address window defined by the VF in the device through each BAR by parsing the transaction package of the base address register (BAR) that configures the device function Type, extract the base address mask (VFBAR_mask) corresponding to each address window, and record the mapping relationship between each base address register number and the base address number (VFBAR_id) corresponding to the defined address window; the second is the function base address number matching module , including the CAM storage array of BAR_id CAMs with a depth of FunNo_m and the matching output selection submodule, each CAM stores the base address BAR corresponding to the same base address serial number BAR_id of all functions FuncNo_m in the same I/O device, and implements the slave root node PCIe The mapping between the base address (BAR_s) in the domain and its functional base address serial number (BAR_id, FuncNo_m); the third is the base address search module, which includes a RAM storage unit with a depth of VFBAR_id. By writing and reading the RAM storage element, the base address serial number is Search for the base address (BAR_m) of VFBAR_id in the PCIe domain of the main control root node; the fourth is to output the decoding module, according to the function number (MatchedFunNo_m) found by matching, the base address BAR_m and its corresponding mask MatchedVFBAR_mask, the slave root node The target access address (DstAddr_s) in the PCIe domain is translated into the target access address (DstAddr_m) in the main control root node PCIe domain.
本发明公开一种用于多根I/O虚拟化共享系统的直接I/O重映射装置,包括:The invention discloses a direct I/O remapping device for a multi-root I/O virtualization sharing system, comprising:
ID重映射模块,所述ID重映射模块包含内容寻址存储CAM和简单双端口RAM,通过CAM的精确匹配查找实现I/O设备功能在从属根节点PCIe域中的ID号到其在主控制根节点PCIe域中的ID号的映射,通过写读RAM存储元件实现I/O设备功能在主控制根节点PCIe域中的ID号到其在从属根节点PCIe域中的ID号的映射;ID remapping module, the ID remapping module includes content addressable storage CAM and simple dual-port RAM, realizes the ID number of I/O device function in slave root node PCIe domain to its ID number in master control through the precise matching search of CAM The mapping of the ID number in the PCIe domain of the root node realizes the mapping from the ID number of the I/O device function in the PCIe domain of the master control root node to its ID number in the PCIe domain of the slave root node by writing and reading the RAM storage element;
地址重映射模块,所述地址重映射模块用于实现I/O设备功能在从属根节点PCIe域的I/O映射地址窗口到其在主控制根节点PCIe域的I/O映射地址窗口的转换;Address remapping module, the address remapping module is used to realize the conversion of the I/O device function in the I/O mapping address window of the subordinate root node PCIe domain to its I/O mapping address window in the main control root node PCIe domain ;
其中,ID号包括总线号、设备号、功能号。Wherein, the ID number includes a bus number, a device number, and a function number.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射装置,所述ID重映射模块中的CAM和RAM包括:In the direct I/O remapping device for a multi-root I/O virtualization sharing system, the CAM and RAM in the ID remapping module include:
以I/O设备功能的功能号作为地址索引,存储单元存储的数据项包括两部分:一部分是该设备功能所属的根节点标识ID,一部分是该设备功能在其所属的根节点PCIe域的功能号。Using the function number of the I/O device function as the address index, the data item stored in the storage unit includes two parts: one part is the ID of the root node to which the device function belongs, and the other part is the function of the device function in the PCIe domain of the root node to which it belongs Number.
所述的用于多根I/O虚拟化共享系统的I/O重映射装置,所述地址重映射模块包括:In the I/O remapping device for a multi-root I/O virtualization sharing system, the address remapping module includes:
基地址定义提取模块,所述基地址掩码通过解析配置设备功能的基地址寄存器(Base Address Register,BAR)的事务包,获取I/O设备功能通过各BAR定义的地址窗口类型,提取各地址窗口对应的基地址掩码,并记录各基地址寄存器序号与其定义的地址窗口对应的基地址序号之间的映射关系;The base address definition extraction module, the base address mask obtains the address window type defined by each BAR for the I/O device function by parsing the transaction packet of the base address register (BAR) that configures the device function, and extracts each address The base address mask corresponding to the window, and record the mapping relationship between each base address register number and the base address number corresponding to the defined address window;
功能基地址序号匹配模块,所述功能基地址序号匹配模块包含N个深度为P的CAM组成的CAM存储阵列和匹配输出选择模块,每个CAM存储同一I/O设备中所有功能中相同基地址序列号对应的基地址BAR,实现从属根节点PCIe域中的基地址与其所对应的功能基地址序号的映射;Functional base address serial number matching module, the functional base address serial number matching module includes a CAM storage array composed of N CAMs with a depth of P and a matching output selection module, each CAM stores the same base address in all functions in the same I/O device The base address BAR corresponding to the serial number realizes the mapping between the base address in the PCIe domain of the slave root node and its corresponding functional base address serial number;
基地址查找模块,所述基地址查找模块包含深度为Q的简单双端口RAM,通过写读RAM存储元件,实现功能基地址序号到其在主控制根节点PCIe域中的基地址的映射;Base address search module, said base address search module includes a depth of Q simple dual-port RAM, by writing and reading the RAM storage element, realizes the mapping of the function base address sequence number to its base address in the main control root node PCIe domain;
输出译码模块,所述输出译码模块根据匹配查找出的主控制根节点PCIe域中基地址及其对应的基地址掩码,将从属根节点PCIe域中的目标访问地址翻译成主控制根节点PCIe域中的目标访问地址;Output decoding module, said output decoding module translates the target access address in the slave root node PCIe domain into the master control root Target access address in the node PCIe domain;
其中,N(N<=6)表示设备功能申请的地址窗口数目,P表示设备中功能的数目,Q表示系统分配给设备中所有功能的地址窗口的基地址的数目。Among them, N (N<=6) represents the number of address windows applied for by the device function, P represents the number of functions in the device, and Q represents the number of base addresses of the address windows allocated by the system to all functions in the device.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射装置,所述功能基地址序号匹配模块包括:In the direct I/O remapping device for a multi-root I/O virtualization sharing system, the function base address serial number matching module includes:
所述CAM存储阵列,是以功能基地址序号为地址索引,存储的数据项包括两部分:一部分是I/O设备功能所属的从属根节点ID,一部分是从属根节点分配的基地址,其中,功能基地址序号中的基地址序号选择要存储的CAM,功能基地址序号中的功能号选择要存储的CAM存储单元,所述CAM存储阵列有N个比较数据输入端口,每一个CAM对应一个,所述CAM阵列在数据匹配阶段,输入由从属根节点的目标访问地址通过N个不同的基地址掩码提取获得的N个不同的比较数据项,并行地进行匹配查找,输出N个对应的匹配结果;The CAM storage array is based on the function base address serial number as the address index, and the stored data items include two parts: one part is the subordinate root node ID to which the I/O device function belongs, and one part is the base address allocated by the subordinate root node, wherein, The base address sequence number in the function base address sequence number selects the CAM to be stored, and the function number in the function base address sequence number selects the CAM storage unit to be stored. The CAM storage array has N comparison data input ports, and each CAM corresponds to one. In the data matching stage, the CAM array inputs N different comparison data items obtained by extracting the target access address of the subordinate root node through N different base address masks, performs matching search in parallel, and outputs N corresponding matching data items. result;
所述匹配输出选择模块,如果CAM存储阵列输出的N个匹配结果存在(仅存在一个)匹配项,则选择输出由存在匹配项的CAM的输出匹配地址(即功能号p以及其对应的基地址序号n组成的功能基地址序号,同时将匹配标识置1;否则,将匹配标识置0。The matching output selection module, if there is (only one) matching item in the N matching results output by the CAM storage array, then select and output the output matching address (that is, the function number p and its corresponding base address) of the CAM that has the matching item The sequence number of the function base address composed of sequence number n, and set the matching flag to 1; otherwise, set the matching flag to 0.
所述的用于多根I/O虚拟化共享系统的直接I/O重映射装置,所述基地址查找模块中的RAM包括:In the direct I/O remapping device for a multi-root I/O virtualization sharing system, the RAM in the base address search module includes:
以功能基地址序号为地址索引,存储的数据项是主控制根节点分配的基地址。The function base address serial number is used as the address index, and the stored data item is the base address assigned by the main control root node.
本领域的技术人员在不脱离权利要求书确定的本发明的精神和范围的条件下,还可以对以上内容进行各种各样的修改。因此本发明的范围并不仅限于以上的说明,而是由权利要求书的范围来确定的。Various modifications can be made to the above contents by those skilled in the art without departing from the spirit and scope of the present invention defined by the claims. Therefore, the scope of the present invention is not limited to the above description, but is determined by the scope of the claims.
Claims (18)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210172844.5A CN102722458B (en) | 2012-05-29 | 2012-05-29 | I/ O (input/output) remapping method and device for plurality of shared systems |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210172844.5A CN102722458B (en) | 2012-05-29 | 2012-05-29 | I/ O (input/output) remapping method and device for plurality of shared systems |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102722458A true CN102722458A (en) | 2012-10-10 |
CN102722458B CN102722458B (en) | 2015-01-07 |
Family
ID=46948230
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210172844.5A Active CN102722458B (en) | 2012-05-29 | 2012-05-29 | I/ O (input/output) remapping method and device for plurality of shared systems |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102722458B (en) |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103246626A (en) * | 2013-05-07 | 2013-08-14 | 中国人民解放军国防科学技术大学 | Non-prefetching accessing and storing space expanding method of PCI (peripheral component interconnect) bridge of large-scale I/O (input/output) sharing system |
CN103353861A (en) * | 2013-06-18 | 2013-10-16 | 中国科学院计算技术研究所 | Method and device for realizing pooling of distributed I/O (Input/Output) resources |
CN103778018A (en) * | 2014-01-16 | 2014-05-07 | 江苏华丽网络工程有限公司 | Method for PCIE (Peripheral Component Interface Express) virtualized management |
CN105554540A (en) * | 2015-12-31 | 2016-05-04 | 深圳国微技术有限公司 | Method and device for achieving network interface in conditional access module |
CN105868000A (en) * | 2016-06-14 | 2016-08-17 | 上海交通大学 | Method for parallelly processing data in extensible manner for network I/O (input/output) virtualization |
CN106027423A (en) * | 2016-05-20 | 2016-10-12 | 北京百度网讯科技有限公司 | Shared network of PCIe (Peripheral Component Interconnect-Express) device and data transmission method thereof |
TWI556174B (en) * | 2014-03-05 | 2016-11-01 | 威盛電子股份有限公司 | System and method for assigning virtual functions and management host thereof |
CN108292267A (en) * | 2015-12-26 | 2018-07-17 | 英特尔公司 | Bus-device-the predictive of functional address space is enumerated |
CN109324899A (en) * | 2018-09-10 | 2019-02-12 | 中国电子科技集团公司电子科学研究院 | Addressing method, device and main controlled node based on the pond PCIe hardware resource |
CN110688328A (en) * | 2019-09-27 | 2020-01-14 | 山东华芯半导体有限公司 | Configurable remapping implementation method of AXI bus sub-host mapping set |
CN110990318A (en) * | 2019-11-11 | 2020-04-10 | 福州瑞芯微电子股份有限公司 | PCIe bus address expansion method, device, equipment and medium |
CN113296884A (en) * | 2021-02-26 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Virtualization method, virtualization device, electronic equipment, virtualization medium and resource virtualization system |
CN113704142A (en) * | 2021-09-02 | 2021-11-26 | 海飞科(南京)信息技术有限公司 | On-chip storage address remapping circuit |
CN115098426A (en) * | 2022-06-22 | 2022-09-23 | 深圳云豹智能有限公司 | PCIE (peripheral component interface express) equipment management method, interface management module, PCIE system, equipment and medium |
CN117076409A (en) * | 2023-10-18 | 2023-11-17 | 苏州元脑智能科技有限公司 | File sharing method, device, system, electronic equipment and storage medium |
CN117743243A (en) * | 2023-12-01 | 2024-03-22 | 无锡众星微系统技术有限公司 | PCIe device hardware virtualization address mapping method and device |
CN117806997A (en) * | 2023-12-12 | 2024-04-02 | 中科驭数(北京)科技有限公司 | DMA operation queue management method, apparatus, device and readable storage medium |
CN118409982A (en) * | 2024-06-21 | 2024-07-30 | 北京壁仞科技开发有限公司 | Method, device and medium for accessing base address register space of device |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI616759B (en) * | 2016-08-10 | 2018-03-01 | 創義達科技股份有限公司 | Device allocation controller and device allocation method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101206623A (en) * | 2006-12-19 | 2008-06-25 | 国际商业机器公司 | System and method for migration of a virtual endpoint from one virtual plane to another |
US20090089464A1 (en) * | 2007-09-27 | 2009-04-02 | Sun Microsystems, Inc. | Modular i/o virtualization for blade servers |
CN101609235A (en) * | 2008-06-16 | 2009-12-23 | 三星电子株式会社 | LCD Monitor |
-
2012
- 2012-05-29 CN CN201210172844.5A patent/CN102722458B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101206623A (en) * | 2006-12-19 | 2008-06-25 | 国际商业机器公司 | System and method for migration of a virtual endpoint from one virtual plane to another |
US20090089464A1 (en) * | 2007-09-27 | 2009-04-02 | Sun Microsystems, Inc. | Modular i/o virtualization for blade servers |
CN101609235A (en) * | 2008-06-16 | 2009-12-23 | 三星电子株式会社 | LCD Monitor |
Cited By (30)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103246626A (en) * | 2013-05-07 | 2013-08-14 | 中国人民解放军国防科学技术大学 | Non-prefetching accessing and storing space expanding method of PCI (peripheral component interconnect) bridge of large-scale I/O (input/output) sharing system |
CN103353861A (en) * | 2013-06-18 | 2013-10-16 | 中国科学院计算技术研究所 | Method and device for realizing pooling of distributed I/O (Input/Output) resources |
CN103353861B (en) * | 2013-06-18 | 2016-06-29 | 中国科学院计算技术研究所 | Realize method and the device of distributed I/O resource pool |
CN103778018B (en) * | 2014-01-16 | 2018-05-04 | 深圳艾迪宝智能系统有限公司 | A kind of method for PCIE virtual managements |
CN103778018A (en) * | 2014-01-16 | 2014-05-07 | 江苏华丽网络工程有限公司 | Method for PCIE (Peripheral Component Interface Express) virtualized management |
US9684530B2 (en) | 2014-03-05 | 2017-06-20 | Via Technologies, Inc. | System and method for assigning virtual functions and management host thereof |
TWI556174B (en) * | 2014-03-05 | 2016-11-01 | 威盛電子股份有限公司 | System and method for assigning virtual functions and management host thereof |
CN108292267A (en) * | 2015-12-26 | 2018-07-17 | 英特尔公司 | Bus-device-the predictive of functional address space is enumerated |
CN108292267B (en) * | 2015-12-26 | 2023-11-03 | 英特尔公司 | Method, system and apparatus for configuring a device |
CN105554540A (en) * | 2015-12-31 | 2016-05-04 | 深圳国微技术有限公司 | Method and device for achieving network interface in conditional access module |
CN106027423A (en) * | 2016-05-20 | 2016-10-12 | 北京百度网讯科技有限公司 | Shared network of PCIe (Peripheral Component Interconnect-Express) device and data transmission method thereof |
CN105868000A (en) * | 2016-06-14 | 2016-08-17 | 上海交通大学 | Method for parallelly processing data in extensible manner for network I/O (input/output) virtualization |
CN105868000B (en) * | 2016-06-14 | 2019-02-19 | 上海交通大学 | A parallel and scalable data processing method for network I/O virtualization |
CN109324899B (en) * | 2018-09-10 | 2022-05-20 | 中国电子科技集团公司电子科学研究院 | Addressing method and device based on PCIe (peripheral component interface express) pooled hardware resources and master control node |
CN109324899A (en) * | 2018-09-10 | 2019-02-12 | 中国电子科技集团公司电子科学研究院 | Addressing method, device and main controlled node based on the pond PCIe hardware resource |
CN110688328A (en) * | 2019-09-27 | 2020-01-14 | 山东华芯半导体有限公司 | Configurable remapping implementation method of AXI bus sub-host mapping set |
CN110990318A (en) * | 2019-11-11 | 2020-04-10 | 福州瑞芯微电子股份有限公司 | PCIe bus address expansion method, device, equipment and medium |
CN113296884B (en) * | 2021-02-26 | 2022-04-22 | 阿里巴巴集团控股有限公司 | Virtualization method, virtualization device, electronic equipment, virtualization medium and resource virtualization system |
CN113296884A (en) * | 2021-02-26 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Virtualization method, virtualization device, electronic equipment, virtualization medium and resource virtualization system |
CN113704142A (en) * | 2021-09-02 | 2021-11-26 | 海飞科(南京)信息技术有限公司 | On-chip storage address remapping circuit |
CN113704142B (en) * | 2021-09-02 | 2022-06-14 | 海飞科(南京)信息技术有限公司 | On-chip storage address remapping circuit |
CN115098426A (en) * | 2022-06-22 | 2022-09-23 | 深圳云豹智能有限公司 | PCIE (peripheral component interface express) equipment management method, interface management module, PCIE system, equipment and medium |
CN115098426B (en) * | 2022-06-22 | 2023-09-12 | 深圳云豹智能有限公司 | PCIE equipment management method, interface management module, PCIE system, equipment and medium |
CN117076409A (en) * | 2023-10-18 | 2023-11-17 | 苏州元脑智能科技有限公司 | File sharing method, device, system, electronic equipment and storage medium |
CN117076409B (en) * | 2023-10-18 | 2024-02-02 | 苏州元脑智能科技有限公司 | File sharing method, device, system, electronic equipment and storage medium |
CN117743243A (en) * | 2023-12-01 | 2024-03-22 | 无锡众星微系统技术有限公司 | PCIe device hardware virtualization address mapping method and device |
CN117743243B (en) * | 2023-12-01 | 2024-07-09 | 无锡众星微系统技术有限公司 | PCIe device hardware virtualization address mapping method and device |
CN117806997A (en) * | 2023-12-12 | 2024-04-02 | 中科驭数(北京)科技有限公司 | DMA operation queue management method, apparatus, device and readable storage medium |
CN118409982A (en) * | 2024-06-21 | 2024-07-30 | 北京壁仞科技开发有限公司 | Method, device and medium for accessing base address register space of device |
CN118409982B (en) * | 2024-06-21 | 2024-09-24 | 北京壁仞科技开发有限公司 | Method, device and medium for accessing base address register space of device |
Also Published As
Publication number | Publication date |
---|---|
CN102722458B (en) | 2015-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102722458B (en) | I/ O (input/output) remapping method and device for plurality of shared systems | |
CN102819447B (en) | Direct I/O virtualization method and device used for multi-root sharing system | |
JP5477707B2 (en) | I / O system and I / O control method | |
EP4092540B1 (en) | Method and apparatus for extending pcie domain | |
CN102707991B (en) | The many virtual shared method and systems of I/O | |
CN108268412B (en) | System and method for extending peripheral component interconnect express fabric | |
US8103810B2 (en) | Native and non-native I/O virtualization in a single adapter | |
CN105993009B (en) | The method and apparatus that MSI-X is interrupted are transmitted by computing resource of the non-transparent bridge into PCIe cluster | |
US9875208B2 (en) | Method to use PCIe device resources by using unmodified PCIe device drivers on CPUs in a PCIe fabric with commodity PCI switches | |
US7913024B2 (en) | Differentiating traffic types in a multi-root PCI express environment | |
US10114764B2 (en) | Multi-level paging and address translation in a network environment | |
CN105320628B (en) | Enable single I/O equipment more shared adaptive devices, system and methods | |
US20130151750A1 (en) | Multi-root input output virtualization aware switch | |
CN103117929A (en) | Communication method and system based on PCIe (peripheral component interconnect express) data exchange | |
US10467179B2 (en) | Method and device for sharing PCIe I/O device, and interconnection system | |
CN105630727B (en) | Access method, device and system between more SoC nodes | |
JP6070732B2 (en) | INPUT / OUTPUT CONTROL DEVICE, INPUT / OUTPUT CONTROL SYSTEM, INPUT / OUTPUT CONTROL METHOD, AND PROGRAM | |
TW201824016A (en) | Resource allocation system, device allocation controller, and device identification method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |