[go: up one dir, main page]

CN113904938B - A system and method for dynamically configuring PCIe terminal equipment - Google Patents

A system and method for dynamically configuring PCIe terminal equipment Download PDF

Info

Publication number
CN113904938B
CN113904938B CN202111140694.5A CN202111140694A CN113904938B CN 113904938 B CN113904938 B CN 113904938B CN 202111140694 A CN202111140694 A CN 202111140694A CN 113904938 B CN113904938 B CN 113904938B
Authority
CN
China
Prior art keywords
pcie
configuration
message
module
request
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.)
Active
Application number
CN202111140694.5A
Other languages
Chinese (zh)
Other versions
CN113904938A (en
Inventor
王昕溥
王伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dayu Zhixin Technology Co ltd
Original Assignee
Beijing Dayu Zhixin Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Dayu Zhixin Technology Co ltd filed Critical Beijing Dayu Zhixin Technology Co ltd
Priority to CN202111140694.5A priority Critical patent/CN113904938B/en
Publication of CN113904938A publication Critical patent/CN113904938A/en
Application granted granted Critical
Publication of CN113904938B publication Critical patent/CN113904938B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/0246Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/145Network analysis or design involving simulating, designing, planning or modelling of a network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明提供了一种动态配置PCIe终端设备的系统和方法,所述系统包括:PCIe虚拟化模块、外部调试器和嵌入式处理器,通过模拟PCIe交换机设备,进一步模拟其下游端口连接的多个终端设备,并提供外部可调试、内部可编程的开发支持,通过对PCIe交换机的模拟实现PCIe终端设备的的动态配置以及统一管理;由外部调试接口、内部嵌入式处理器和可编程状态机,采用分阶段、分任务联合控制的方法,有效地满足了调试、应用、更新、异常情况下的全面、灵活、实时响应和处理PCIe事务层报文的需求;在PCIe虚拟化模块中的IO处理模块中进行相应的功能设计支持设备IO和主机IO两种IO操作方式,提高了IO操作的效率。

Figure 202111140694

The present invention provides a system and method for dynamically configuring PCIe terminal equipment. The system includes: a PCIe virtualization module, an external debugger and an embedded processor. By simulating a PCIe switch device, it further simulates multiple downstream ports connected to it. terminal equipment, and provide external debuggable and internal programmable development support, realize the dynamic configuration and unified management of PCIe terminal equipment through the simulation of PCIe switch; external debugging interface, internal embedded processor and programmable state machine, The method of joint control by stages and tasks effectively meets the needs of comprehensive, flexible, real-time response and processing of PCIe transaction layer messages under debugging, application, update, and abnormal conditions; IO processing in the PCIe virtualization module The corresponding function design in the module supports two IO operation modes of device IO and host IO, which improves the efficiency of IO operation.

Figure 202111140694

Description

一种动态配置PCIe终端设备的系统和方法A system and method for dynamically configuring PCIe terminal equipment

技术领域technical field

本发明涉及云计算领域,特别涉及一种动态配置PCIe终端设备的系统和方法。The invention relates to the field of cloud computing, in particular to a system and method for dynamically configuring PCIe terminal equipment.

背景技术Background technique

在目前的数据中心应用场景中,弹性裸金属服务器逐步占据更多的比重,用户会以类似云服务的弹性方式租用物理服务器。与传统的服务器租赁模式不同,弹性裸金属服务器在提供完整的IO资源的同时,还具备云服务的灵活性和可配置性。用户对网络设备、存储设备、计算加速设备等IO资源的动态配置,都会即时生效体现在租用的弹性裸金属服务器上。In the current data center application scenarios, elastic bare metal servers gradually occupy a larger proportion, and users rent physical servers in an elastic manner similar to cloud services. Different from the traditional server leasing model, elastic bare metal servers not only provide complete IO resources, but also have the flexibility and configurability of cloud services. The user's dynamic configuration of IO resources such as network devices, storage devices, and computing acceleration devices will take effect immediately on the leased elastic bare metal server.

PCIe终端设备的复用多采用SR-IOV(Single Root I/O Virtualization)方式,以一个PF(Physical Functions,物理功能)为模板虚拟出多个VF(Virtual Functions,虚拟功能),从终端设备的角度提供了虚拟化支持,具有硬件实现的高效性。由于其从硬件角度出发,缺少虚拟化管理对终端设备属性和数量动态灵活配置的要求。其设备的数量、属性都是静态设置,无法在线修改,如果对VF进行修改,会影响到同一PF下的所有VF,无法满足弹性裸金属服务器对PCIe设备的的动态配置即时生效的要求。此外,对基于弹性裸金属服务器的数据中心应用场景中对PCIe设备的的动态配置提供支持时,如何提高IO处理的高效性也是亟需解决的问题。The multiplexing of PCIe terminal devices mostly adopts the SR-IOV (Single Root I/O Virtualization) method, and uses a PF (Physical Functions, physical function) as a template to virtualize multiple VFs (Virtual Functions, virtual functions), from the terminal device. Angular provides virtualization support with the efficiency of hardware implementation. Since it starts from the hardware point of view, it lacks the requirements for dynamic and flexible configuration of terminal device attributes and quantity in virtualization management. The number and attributes of its devices are set statically and cannot be modified online. If a VF is modified, it will affect all VFs under the same PF, and cannot meet the requirement that the dynamic configuration of PCIe devices of the elastic bare metal server takes effect immediately. In addition, when supporting the dynamic configuration of PCIe devices in data center application scenarios based on elastic bare metal servers, how to improve the efficiency of IO processing is also an urgent problem to be solved.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例的目的在于提供一种医学文本实体标注方法和系统,具体包括:In view of this, the purpose of the embodiments of the present invention is to provide a medical text entity labeling method and system, specifically including:

第一方面,本发明实施例提供了一种动态配置PCIe终端设备的系统,所述系统包括:In a first aspect, an embodiment of the present invention provides a system for dynamically configuring PCIe terminal devices, where the system includes:

PCIe虚拟化模块,用于在主机扫描所述系统下游的PCIe终端设备时接收所述主机发送的PCIe配置请求报文,并对所述配置请求报文回复配置应答报文;并用于接收所述主机发送的PCIe IO请求报文,并对所述配置请求报文回复IO应答报文;其中,PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求;The PCIe virtualization module is configured to receive a PCIe configuration request message sent by the host when the host scans PCIe terminal devices downstream of the system, and reply a configuration response message to the configuration request message; and is used to receive the PCIe configuration request message. PCIe IO request message sent by the host, and reply IO response message to the configuration request message; wherein, the PCIe IO request message includes the BAR address space memory read and write request corresponding to the downstream PCIe terminal device;

外部调试器,通过所述PCIe虚拟化模块提供的调试接口与所述PCIe虚拟化模块连接,用于在启动时通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;并用于在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序;An external debugger, connected to the PCIe virtualization module through the debug interface provided by the PCIe virtualization module, and used to replace the PCIe virtualization module with the debug interface provided by the PCIe virtualization module during startup to perform PCIe Debugging of configuration and IO call; and for modifying the program for supporting the PCIe terminal device of the target type in the PCIe virtualization module after the debugging of the PCIe terminal device of the target type is completed;

嵌入式处理器,用于与外部配置管理服务器协商生成所述配置应答报文,并确定多个所述配置应答报文的生成顺序。The embedded processor is configured to negotiate with an external configuration management server to generate the configuration response message, and determine the generation sequence of a plurality of the configuration response messages.

可选地,所述PCIe虚拟化模块包括:Optionally, the PCIe virtualization module includes:

PCIe事务层报文分发器,用于解析从PCIe链路层接收到的PCIe事务层报文,并根据所述PCIe事务层报文的报文头部信息所指示的PCIe配置事务请求报文或PCIe IO事务请求报文,将所述PCIe配置事务请求报文或PCIe IO事务请求报文分别发送给对应的配置处理模块或IO处理模块;并用于将从配置处理模块或IO处理模块接收到的PCIe事务层报文,分发给PCIe链路层;The PCIe transaction layer message distributor is used to parse the PCIe transaction layer message received from the PCIe link layer, and configure the transaction request message according to the PCIe configuration transaction request message or according to the message header information of the PCIe transaction layer message. PCIe IO transaction request message, send the PCIe configuration transaction request message or PCIe IO transaction request message to the corresponding configuration processing module or IO processing module respectively; PCIe transaction layer messages are distributed to the PCIe link layer;

调试接口,与所述外部调试器连接,用于当外部调试器启动时代替所述PCIe事务层报文分发器进行PCIe事务层报文的发送和接收;a debugging interface, connected with the external debugger, for sending and receiving PCIe transaction layer messages instead of the PCIe transaction layer message distributor when the external debugger is started;

配置处理模块,用于接收配置报文,并根据所述配置报文完成PCIe终端设备的更新;a configuration processing module, configured to receive a configuration message, and complete the update of the PCIe terminal device according to the configuration message;

IO处理模块,用于接收PCIe IO请求报文,并根据所述PCIe IO请求报文控制所述PCIe虚拟化模块和/或至少一个PCIe终端设备进行控制状态寄存器访问以及直接内存访问。An IO processing module, configured to receive a PCIe IO request message, and control the PCIe virtualization module and/or at least one PCIe terminal device to perform control status register access and direct memory access according to the PCIe IO request message.

可选地,所述配置处理模块包括:Optionally, the configuration processing module includes:

配置报文收发接口,用于接收PCIe事务层报文分发器分发的PCIe配置事务请求报文,并发送从可编程硬件状态机或CPU配置处理接口接收到的的配置事务应答报文;The configuration packet sending and receiving interface is used to receive the PCIe configuration transaction request packet distributed by the PCIe transaction layer packet distributor, and send the configuration transaction response packet received from the programmable hardware state machine or the CPU configuration processing interface;

CPU配置处理接口,用于接收配置报文收发接口转发的PCIe配置事务请求报文,并发送从所述嵌入式处理器接收的的配置事务应答报文;The CPU configuration processing interface is used to receive the PCIe configuration transaction request message forwarded by the configuration message transceiver interface, and send the configuration transaction response message received from the embedded processor;

可编程硬件状态机,用于接收并解析配置报文收发接口转发的PCIe配置事务请求报文,并根据解析内容发送预先编程的配置事务应答报文;The programmable hardware state machine is used to receive and parse the PCIe configuration transaction request message forwarded by the configuration message transceiver interface, and send a pre-programmed configuration transaction response message according to the parsed content;

状态机微序列程序存储单元,用于存储可编程硬件状态机的指令和数据,所述指令和数据从所述CPU配置处理接口写入或读出。The state machine micro-sequence program storage unit is used to store the instructions and data of the programmable hardware state machine, and the instructions and data are written in or read out from the CPU configuration processing interface.

可选地,所述IO处理模块包括:Optionally, the IO processing module includes:

目标IO报文收发接口,用于接收PCIe事务层报文分发器转发的PCIe IO事务请求报文,并解析为BAR地址空间存储器读写请求;并用于把CSR模块返回的存储器读写应答封装成IO事务应答报文,发送给PCIe事务层报文分发器;The target IO message sending and receiving interface is used to receive the PCIe IO transaction request message forwarded by the PCIe transaction layer message distributor, and parse it into a BAR address space memory read and write request; and used to encapsulate the memory read and write response returned by the CSR module into The IO transaction response message is sent to the PCIe transaction layer message distributor;

CSR模块,用于接收目标IO报文收发接口发送的BAR地址空间存储器读写请求,根据所述BAR地址空间存储器读写请求获取对应的读写请求内容发送给目标IO报文收发接口。The CSR module is configured to receive the read and write request of the BAR address space memory sent by the target IO message sending and receiving interface, obtain the corresponding read and write request content according to the BAR address space memory read and write request, and send it to the target IO message sending and receiving interface.

可选地,所述CSR模块包括:Optionally, the CSR module includes:

BAR地址空间映射管理接口,用于在接收到BAR地址空间存储器读写请求后,提供对应的PCIe终端设备的目标功能对应的BAR地址;The BAR address space mapping management interface is used to provide the BAR address corresponding to the target function of the corresponding PCIe terminal device after receiving the read and write request of the BAR address space memory;

BAR地址空间存储器,用于保存和提供BAR地址空间的内容。The BAR address space memory is used to save and provide the contents of the BAR address space.

可选地,所述CSR模块还包括BAR特定地址访问触发器,用于当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及DMA请求程序;Optionally, the CSR module also includes a BAR specific address access trigger, for when the target BAR address is accessed, triggering the programmable state machine of the IO processing module to run the BAR address space memory update program and the DMA request program;

相应地,所述IO处理模块还包括:Correspondingly, the IO processing module further includes:

可编程状态机,用于响应BAR特定地址访问触发器发送的BAR特定地址访问触发信号,并向CSR模块发送BAR的地址空间存储器更新信息;还用于向DMA模块发送DMA请求,接收DMA模块的完成响应;The programmable state machine is used to respond to the BAR specific address access trigger signal sent by the BAR specific address access trigger, and send the BAR address space memory update information to the CSR module; it is also used to send a DMA request to the DMA module and receive the DMA module's complete response;

起始IO报文收发接口,用于接收DMA模块发送的主机内存地址空间存储器读写请求,并将所述主机内存地址空间存储器读写请求封装成IO事务请求报文,发送给PCIe事务层报文分发器;并用于把PCIe事务层报文分发器返回的IO事务应答报文解析为主机内存地址空间存储器读写应答发送给DMA模块;The initial IO message sending and receiving interface is used to receive the host memory address space memory read and write requests sent by the DMA module, and encapsulate the host memory address space memory read and write requests into IO transaction request messages, and send them to the PCIe transaction layer to report It is used to parse the IO transaction response message returned by the PCIe transaction layer message distributor into the host memory address space memory read and write response and send it to the DMA module;

DMA模块,用于响应可编程状态机的DMA请求,发起命令获取DMA或数据传输DMA操作,向起始IO报文收发接口发送主机内存地址空间存储器读写请求;把从起始IO报文收发接口接收到的主机内存地址空间存储器读写应答内容写入命令缓存或数据缓存。The DMA module is used to respond to the DMA request of the programmable state machine, initiate command acquisition DMA or data transfer DMA operations, and send host memory address space memory read and write requests to the initial IO message transceiver interface; The host memory address space memory read and write response content received by the interface is written to the command buffer or data buffer.

第二方面,本发明实施例提供了一种动态配置PCIe终端设备的方法,应用于第一方面所述的系统,其特征在于,所述方法包括:In a second aspect, an embodiment of the present invention provides a method for dynamically configuring a PCIe terminal device, which is applied to the system described in the first aspect, wherein the method includes:

所述系统的PCIe虚拟化模块在主机扫描所述系统下游的PCIe终端设备时接收所述主机发送的PCIe配置请求报文;The PCIe virtualization module of the system receives the PCIe configuration request message sent by the host when the host scans the PCIe terminal equipment downstream of the system;

所述PCIe虚拟化模块的配置处理模块对所述PCIe配置请求报文回复PCIe配置应答报文,其中,所述配置应答报文由所述系统的嵌入式处理器与外部配置管理服务器协商生成,多个所述配置应答报文的生成顺序由嵌入式处理器确定;The configuration processing module of the PCIe virtualization module replies with a PCIe configuration response message to the PCIe configuration request message, wherein the configuration response message is generated by negotiation between the embedded processor of the system and an external configuration management server, The generation sequence of a plurality of the configuration response messages is determined by the embedded processor;

所述系统的PCIe虚拟化模块接收所述主机发送的PCIe IO请求报文,其中所述PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求;The PCIe virtualization module of the system receives a PCIe IO request message sent by the host, wherein the PCIe IO request message includes a BAR address space memory read and write request corresponding to a downstream PCIe terminal device;

所述PCIe虚拟化模块的IO处理模块对所述PCIe IO请求报文回复IO应答报文,其中所述IO应答报文包括BAR地址空间存储器存储的内容。The IO processing module of the PCIe virtualization module replies with an IO response message to the PCIe IO request message, where the IO response message includes the content stored in the BAR address space memory.

可选地,所述方法还包括:Optionally, the method further includes:

当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及DMA请求程序。When the target BAR address is accessed, the programmable state machine of the IO processing module is triggered to run the BAR address space memory update procedure and the DMA request procedure.

可选地,所述方法还包括:Optionally, the method further includes:

启动所述系统的外部调试器;start an external debugger for the system;

所述外部调试器通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;The external debugger performs the debugging of PCIe configuration and IO call in place of the PCIe virtualization module through the debugging interface provided by the PCIe virtualization module;

在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序。After the debugging of the PCIe terminal device of the target type is completed, modify the program in the PCIe virtualization module for supporting the PCIe terminal device of the target type.

可选地,所述方法还包括:Optionally, the method further includes:

由所述PCIe虚拟化模块的配置处理模块的可编程状态机,代替所述嵌入式处理器与外部配置管理服务器的协商过程,生成所述配置应答报文;The configuration response message is generated by the programmable state machine of the configuration processing module of the PCIe virtualization module, instead of the negotiation process between the embedded processor and the external configuration management server;

若所述PCIe配置请求报文为未定义类型,则根据所述嵌入式处理器与外部配置管理服务器的协商,代替所述可编程状态机生成所述配置应答报文。If the PCIe configuration request message is of an undefined type, the configuration response message is generated instead of the programmable state machine according to the negotiation between the embedded processor and the external configuration management server.

本发明实施例提供的动态配置PCIe终端设备的系统和方法,通过模拟PCIe交换机设备,进一步模拟其下游端口连接的多个终端设备,并提供外部可调试、内部可编程的开发支持,通过对PCIe交换机的模拟实现PCIe终端设备的的动态配置以及统一管理;由外部调试接口、内部嵌入式处理器和可编程状态机,采用分阶段、分任务联合控制的方法,有效地满足了调试、应用、更新、异常情况下的全面、灵活、实时响应和处理PCIe事务层报文的需求;在PCIe虚拟化模块中的IO处理模块中进行相应的功能设计支持设备IO和主机IO两种IO操作方式,提高了IO操作的效率。The system and method for dynamically configuring PCIe terminal devices provided by the embodiments of the present invention further simulate multiple terminal devices connected to downstream ports by simulating PCIe switch devices, and provide externally debuggable and internally programmable development support. The simulation of the switch realizes the dynamic configuration and unified management of the PCIe terminal equipment; the external debugging interface, the internal embedded processor and the programmable state machine adopt the method of joint control by stages and tasks, which effectively meets the requirements of debugging, application, Update, comprehensive, flexible, real-time response and processing requirements of PCIe transaction layer messages under abnormal conditions; corresponding functional design is carried out in the IO processing module in the PCIe virtualization module to support two IO operation modes of device IO and host IO, Improves the efficiency of IO operations.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳务的前提下,还可以根据这些附图获得其他的附图。通过附图所示,本申请的上述及其它目的、特征和优势将更加清晰。在全部附图中相同的附图标记指示相同的部分。并未刻意按实际尺寸等比例缩放绘制附图,重点在于示出本申请的主旨。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the accompanying drawings required in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some of the present application. In the embodiment, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without paying creative services. The above and other objects, features and advantages of the present application will be more apparent from the accompanying drawings. The same reference numerals refer to the same parts throughout the drawings. The drawings are not intentionally scaled to actual size, and the emphasis is on illustrating the subject matter of the present application.

图1示出了本发明实施例提供的动态配置PCIe终端设备的系统的结构示意图。FIG. 1 shows a schematic structural diagram of a system for dynamically configuring a PCIe terminal device according to an embodiment of the present invention.

图2示出了本发明实施例提供的PCIe虚拟化模块的结构示意图。FIG. 2 shows a schematic structural diagram of a PCIe virtualization module provided by an embodiment of the present invention.

图3示出了本发明实施例提供的配置处理模块的结构示意图。FIG. 3 shows a schematic structural diagram of a configuration processing module provided by an embodiment of the present invention.

图4示出了本发明实施例提供的IO处理模块的结构示意图。FIG. 4 shows a schematic structural diagram of an IO processing module provided by an embodiment of the present invention.

图5示出了本发明实施例提供的动态配置PCIe终端设备的系统的完整结构示意图。FIG. 5 shows a schematic diagram of a complete structure of a system for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention.

图6示出了本发明实施例提供的动态配置PCIe终端设备的方法的流程示意图。FIG. 6 shows a schematic flowchart of a method for dynamically configuring a PCIe terminal device according to an embodiment of the present invention.

图7示出了本发明实施例提供的动态配置PCIe终端设备的方法的完整流程示意图所示。FIG. 7 shows a schematic diagram of a complete flow of a method for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention.

图8示出了本发明实施例提供的PCIe终端设备的调试方法的流程示意图。FIG. 8 shows a schematic flowchart of a debugging method for a PCIe terminal device provided by an embodiment of the present invention.

图9示出了本发明实施例提供的动态配置PCIe终端设备的异常处理方法的流程示意图。FIG. 9 shows a schematic flowchart of an exception processing method for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention.

具体实施方式Detailed ways

以下,将参照附图来描述本发明实施例。但是应该理解,这些描述只是示例性的,而并非要限制本发明的范围。此外,在以下说明中,省略了对公知结构和技术的描述,以避免不必要地混淆本发明的概念。Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. It should be understood, however, that these descriptions are exemplary only, and are not intended to limit the scope of the present invention. Also, in the following description, descriptions of well-known structures and techniques are omitted to avoid unnecessarily obscuring the concepts of the present invention.

在此使用的术语仅仅是为了描述具体实施例,而并非意在限制本公开。这里使用的词语“一”、“一个(种)”和“该”等也应包括“多个”、“多种”的意思,除非上下文另外明确指出。此外,在此使用的术语“包括”、“包含”等表明了所述特征、步骤、操作和/或部件的存在,但是并不排除存在或添加一个或多个其他特征、步骤、操作或部件。The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the present disclosure. As used herein, the words "a," "an," and "the" and the like shall also include the meanings of "plurality," "plurality," unless the context clearly dictates otherwise. Furthermore, the terms "comprising", "comprising" and the like used herein indicate the presence of stated features, steps, operations and/or components, but do not preclude the presence or addition of one or more other features, steps, operations or components .

在此使用的所有术语(包括技术和科学术语)具有本领域技术人员通常所理解的含义,除非另外定义。应注意,这里使用的术语应解释为具有与本说明书的上下文相一致的含义,而不应以理想化或过于刻板的方式来解释。All terms (including technical and scientific terms) used herein have the meaning as commonly understood by one of ordinary skill in the art, unless otherwise defined. It should be noted that terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly rigid manner.

在目前的数据中心应用场景中,弹性裸金属服务器逐步占据更多的比重,用户会以类似云服务的弹性方式租用物理服务器。与传统的服务器租赁模式不同,弹性裸金属服务器在提供完整的IO资源的同时,还具备云服务的灵活性和可配置性。用户对网络设备、存储设备、计算加速设备等IO资源的动态配置,都会即时生效体现在租用的弹性裸金属服务器上。In the current data center application scenarios, elastic bare metal servers gradually occupy a larger proportion, and users rent physical servers in an elastic manner similar to cloud services. Different from the traditional server leasing model, elastic bare metal servers not only provide complete IO resources, but also have the flexibility and configurability of cloud services. The user's dynamic configuration of IO resources such as network devices, storage devices, and computing acceleration devices will take effect immediately on the leased elastic bare metal server.

PCIe终端设备的复用多采用SR-IOV(Single Root I/O Virtualization)方式,以一个PF(Physical Functions,物理功能)为模板虚拟出多个VF(Virtual Functions,虚拟功能),从终端设备的角度提供了虚拟化支持,具有硬件实现的高效性。由于其从硬件角度出发,缺少虚拟化管理对终端设备属性和数量动态灵活配置的要求。其设备的数量、属性都是静态设置,无法在线修改,如果对VF进行修改,会影响到同一PF下的所有VF,无法满足弹性裸金属服务器对PCIe设备的的动态配置即时生效的要求。此外,对基于弹性裸金属服务器的数据中心应用场景中对PCIe设备的的动态配置提供支持时,如何提高IO处理的高效性也是亟需解决的问题。The multiplexing of PCIe terminal devices mostly adopts the SR-IOV (Single Root I/O Virtualization) method, and uses a PF (Physical Functions, physical function) as a template to virtualize multiple VFs (Virtual Functions, virtual functions), from the terminal device. Angular provides virtualization support with the efficiency of hardware implementation. Since it starts from the hardware point of view, it lacks the requirements for dynamic and flexible configuration of terminal device attributes and quantity in virtualization management. The number and attributes of its devices are set statically and cannot be modified online. If a VF is modified, it will affect all VFs under the same PF, and cannot meet the requirement that the dynamic configuration of PCIe devices of the elastic bare metal server takes effect immediately. In addition, when supporting the dynamic configuration of PCIe devices in data center application scenarios based on elastic bare metal servers, how to improve the efficiency of IO processing is also an urgent problem to be solved.

有鉴于此,本发明实施例的目的在于提供一种动态配置PCIe终端设备的系统和方法,以下结合附图详细描述本发明实施例公开的内容。In view of this, the purpose of the embodiments of the present invention is to provide a system and method for dynamically configuring a PCIe terminal device, and the contents disclosed in the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

附图1示出了本发明实施例提供的动态配置PCIe终端设备的系统的结构示意图,具体内容如下。FIG. 1 shows a schematic structural diagram of a system for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention, and the specific content is as follows.

PCIe虚拟化模块110,用于在主机扫描所述系统下游的PCIe终端设备时接收所述主机发送的PCIe配置请求报文,并对所述配置请求报文回复配置应答报文;并用于接收所述主机发送的PCIe IO请求报文,并对所述配置请求报文回复IO应答报文;其中,PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求。The PCIe virtualization module 110 is configured to receive a PCIe configuration request message sent by the host when the host scans the PCIe terminal devices downstream of the system, and reply a configuration response message to the configuration request message; The PCIe IO request message sent by the host is sent, and an IO response message is replied to the configuration request message; wherein, the PCIe IO request message includes a read and write request of the BAR address space memory corresponding to the downstream PCIe terminal device.

由于现有技术中的基于弹性裸金属服务器数据中心应用场景,从硬件角度为PCIe终端设备的复用提供虚拟化支持的技术,针对其存在的虚拟化管理对终端设备属性和数量动态灵活配置无法支持的问题,本发明实施例中的动态配置PCIe终端设备的系统为设置在其所述设备上的软件功能系统。Due to the existing technology based on the elastic bare metal server data center application scenario, the technology that provides virtualization support for the multiplexing of PCIe terminal devices from the perspective of hardware, the existing virtualization management cannot dynamically and flexibly configure the attributes and number of terminal devices. As for the problem of support, the system for dynamically configuring PCIe terminal devices in this embodiment of the present invention is a software function system set on the device.

动态配置PCIe终端设备的系统由PCIe虚拟化模块110、外部调试器120、嵌入式处理器130三个主要模块组成。其中,PCIe虚拟化模块110不仅可以从软件上模拟PCIe交换机设备的功能,还能够进一步模拟其下游端口连接的多个终端设备。The system for dynamically configuring PCIe terminal equipment is composed of three main modules, a PCIe virtualization module 110 , an external debugger 120 and an embedded processor 130 . The PCIe virtualization module 110 can not only simulate the function of the PCIe switch device in software, but also can further simulate multiple terminal devices connected to its downstream ports.

当主机启动时,在PCIe枚举阶段会扫描下游PCIe设备的拓扑结构。当扫描到本系统所在设备时,PCIe虚拟化模块会应答为PCIe交换机;主机进一步扫描本设备下游的PCIe设备,PCIe虚拟化模块会代替虚拟的下游PCIe设备应答,其表现为逻辑上的PCIe交换机和下游的多个、多种逻辑上的PCIe终端设备。在主机完成上电启动和PCIe设备扫描后,主机进入运行阶段,本系统所在设备可以发起PCIe热插拔请求,动态删除或增加多个、多种逻辑上的PCIe终端设备。本系统所在设备下游的逻辑PCIe终端设备的数量和属性可以灵活配置,配置内容在本设备启动时或运行时由配置管理服务器与本设备的嵌入式处理器协商确定。在基于弹性裸金属服务器数据中心应用场景中,下游的逻辑PCIe终端设备可以是PCI插槽上部署的任意设备类型,例如声卡、网卡、内置Modem等。When the host boots up, the topology of downstream PCIe devices is scanned during the PCIe enumeration phase. When the device where the system is located, the PCIe virtualization module will respond as a PCIe switch; the host further scans the PCIe devices downstream of the device, and the PCIe virtualization module will respond instead of the virtual downstream PCIe device, which appears as a logical PCIe switch and downstream multiple and multiple logical PCIe terminal devices. After the host completes power-on and PCIe device scanning, the host enters the running phase, and the device where the system is located can initiate a PCIe hot-plug request to dynamically delete or add multiple or multiple logical PCIe terminal devices. The number and attributes of logical PCIe terminal devices downstream of the device where the system is located can be flexibly configured, and the configuration content is determined by the configuration management server and the embedded processor of the device through negotiation when the device starts or runs. In the data center application scenario based on elastic bare metal server, the downstream logical PCIe terminal device can be any device type deployed on the PCI slot, such as sound card, network card, built-in modem, etc.

具体地,在主机配置阶段,主机会扫描系统内下游的PCIe终端设备并进行相应的配置工作,本发明实施例由PCIe虚拟化模块110代替PCIe终端设备,接收所述主机发送的PCIe配置请求报文,并对所述配置请求报文回复配置应答报文。也就是说,主机在扫描PCIe终端设备并对其进行配置时,是通过PCIe虚拟化模块110实现的。PCIe配置请求报文和配置应答报文均是PCIe协议中用于配置PCIe终端设备时用于设备信息交互的报文类型。Specifically, in the host configuration stage, the host scans the downstream PCIe terminal devices in the system and performs corresponding configuration work. In this embodiment of the present invention, the PCIe virtualization module 110 replaces the PCIe terminal device, and receives the PCIe configuration request report sent by the host. message, and reply a configuration response message to the configuration request message. That is to say, when the host scans and configures PCIe terminal devices, it is implemented through the PCIe virtualization module 110 . The PCIe configuration request message and the configuration response message are both message types used in the PCIe protocol for device information exchange when configuring a PCIe terminal device.

此外,在设备IO操作阶段,主机会请求访问配置好的PCIe终端设备对应的IO资源。此时,本发明实施例还是通过PCIe虚拟化模块110负责接收所述主机发送的PCIe IO请求报文,并对所述配置请求报文回复IO应答报文。PCIe IO请求报文和IO应答报文均是PCIe协议中用于访问PCIe终端设备资源时用于设备信息交互的报文类型。其中,PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求。BAR地址空间由表征多个PCIE终端设备的多个功能对应的多个BAR地址构成,BAR地址空间存储器中存储的数据是表示PCIE终端设备在PCIE地址空间中的基地址。因此,通过包含BAR地址空间存储器读写请求的PCIe IO请求报文,主机可以请求访问该地址对应的IO资源以及对应的功能。In addition, in the device IO operation stage, the host will request to access the IO resources corresponding to the configured PCIe terminal device. At this time, in this embodiment of the present invention, the PCIe virtualization module 110 is still responsible for receiving the PCIe IO request message sent by the host, and replying an IO response message to the configuration request message. Both PCIe IO request packets and IO response packets are packet types used for device information exchange when accessing PCIe terminal device resources in the PCIe protocol. The PCIe IO request packet includes a read and write request of the BAR address space memory corresponding to the downstream PCIe terminal device. The BAR address space is composed of multiple BAR addresses representing multiple functions of multiple PCIE terminal devices, and the data stored in the BAR address space memory is the base address representing the PCIE terminal device in the PCIE address space. Therefore, through the PCIe IO request message including the read and write request of the BAR address space memory, the host can request to access the IO resource corresponding to the address and the corresponding function.

根据上述对PCIe虚拟化模块110功能的描述内容,可以看出本发明实施例中的PCIe虚拟化模块110无论在主机配置阶段还是设备IO操作阶段,通过与主机间进行配置/IO的报文交互,实现了模拟PCIe交换机设备并进一步模拟其下游端口连接的多个终端设备的功能。According to the above description of the functions of the PCIe virtualization module 110, it can be seen that the PCIe virtualization module 110 in the embodiment of the present invention performs configuration/IO message interaction with the host regardless of the host configuration stage or the device IO operation stage. , which implements the function of simulating a PCIe switch device and further simulating multiple terminal devices connected to its downstream ports.

外部调试器120,通过所述PCIe虚拟化模块提供的调试接口与所述PCIe虚拟化模块连接,用于在启动时通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;并用于在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序。The external debugger 120 is connected to the PCIe virtualization module through the debug interface provided by the PCIe virtualization module, and is used to replace the PCIe virtualization module with the debug interface provided by the PCIe virtualization module during startup. Debugging of PCIe configuration and IO calls; and used to modify the program in the PCIe virtualization module for supporting the PCIe terminal device of the target type after the debugging of the PCIe terminal device of the target type is completed.

本发明实施例提供的动态配置PCIe终端设备的系统通过外部调试器120与PCIe虚拟化模块110的设置,还具有可编程和动态在线更新能力,可以支持虚拟实现现有类型的PCIe设备和未来可能出现的新的类型的PCIe设备。对不同类型PCIe设备的支持是通过增加或修改本系统所在设备的程序存储内容来实现的,本系统可以同时支持多种不同类型的PCIe设备,支持设备的种类受程序存储容量限制。针对本系统尚未实现的新的类型的PCIe设备,本系统提供外部调试器120,并在PCIe虚拟化模块110中设置对应的调试接口与外部调试器120连接,在运行调试功能时可以由外部调试器120接管PCIe虚拟化模块110处理配置/IO报文的功能,进而实现由外部调试器主机代替PCIe虚拟化模块110完成PCIe交换机和下游PCIe终端设备的功能模拟。当新类型的PCIe终端设备在外部主机调试模式下完成所有功能后,可以修改PCIe虚拟化模块110中相应的程序存储内容,更新对新类型PCIe终端设备的支持。The system for dynamically configuring PCIe terminal devices provided by the embodiments of the present invention also has programmable and dynamic online update capabilities through the settings of the external debugger 120 and the PCIe virtualization module 110, and can support the virtual realization of existing types of PCIe devices and future possibilities. The emergence of new types of PCIe devices. The support for different types of PCIe devices is achieved by adding or modifying the program storage content of the device where the system is located. The system can support multiple different types of PCIe devices at the same time, and the types of supported devices are limited by the program storage capacity. For new types of PCIe devices that have not been implemented in the system, the system provides an external debugger 120, and sets a corresponding debug interface in the PCIe virtualization module 110 to connect to the external debugger 120. When running the debugging function, the external debugger can be debugged. The debugger 120 takes over the function of the PCIe virtualization module 110 for processing configuration/IO packets, thereby realizing that the external debugger host replaces the PCIe virtualization module 110 to complete the function simulation of the PCIe switch and downstream PCIe terminal devices. After the new type of PCIe terminal device completes all functions in the external host debug mode, the corresponding program storage content in the PCIe virtualization module 110 can be modified to update support for the new type of PCIe terminal device.

本系统中由于外部调试器120具有最高的优先级,因此当本系统所在设备上电后,可以判断外部调试器是否连接。如果连接,则本系统进入调试状态。当外部调试器启动即进行调试状态时,外部调试器通过PCIe虚拟化模块提供的调试接口,可以代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试,实现现有类型的PCIe设备的修改和新的类型的PCIe设备的更新。当调试完成后,通过可编程的方式修改PCIe虚拟化模块110中相应的程序存储内容,从而实现了对新类型PCIe终端设备的支持。In this system, since the external debugger 120 has the highest priority, when the device where the system is located is powered on, it can be determined whether the external debugger is connected. If connected, the system enters the debugging state. When the external debugger is in the debugging state when it is started, the external debugger can use the debugging interface provided by the PCIe virtualization module to replace the PCIe virtualization module to debug the PCIe configuration and IO calls, so as to realize the modification of the existing type of PCIe device. And new types of PCIe device updates. After the debugging is completed, the corresponding program storage content in the PCIe virtualization module 110 is modified in a programmable manner, thereby realizing the support for the new type of PCIe terminal device.

通过上述过程,本系统实现了PCIe终端设备的数量或属性的动态更新。当需要对PCIe终端设备进行更新时,启动外部调试器进行介入,即可对PCIe终端设备进行动态配置,同时也避免了传统的SR-IOV方法在进行PCIe终端设备的复用时配置灵活性较差的问题。Through the above process, the system realizes the dynamic update of the quantity or attributes of PCIe terminal devices. When the PCIe terminal device needs to be updated, the external debugger can be started to intervene, and the PCIe terminal device can be dynamically configured. At the same time, it also avoids the traditional SR-IOV method, which is more flexible in configuration when multiplexing PCIe terminal devices. Bad question.

嵌入式处理器130,用于与外部配置管理服务器协商生成所述配置应答报文,并确定多个所述配置应答报文的生成顺序。The embedded processor 130 is configured to negotiate with an external configuration management server to generate the configuration response message, and determine the generation sequence of a plurality of the configuration response message.

本发明实施例提供的嵌入式处理器130负责与外部的配置管理服务器(图中未示出)交互,响应配置更新请求并更新配置内容,以实现灵活地模拟多个、多种PCIe终端设备,并且可以在主机运行期间动态增加删除多个、多种PCIe终端设备的功能。嵌入式处理器可以通过以太网接口与配置管理服务器连接。嵌入式处理器可以单独实现PCIe终端设备的模拟,也可以与配置处理模块和IO处理模块配合工作实现PCIe终端设备的模拟。The embedded processor 130 provided in this embodiment of the present invention is responsible for interacting with an external configuration management server (not shown in the figure), responding to a configuration update request and updating the configuration content, so as to flexibly simulate multiple or multiple PCIe terminal devices, And the function of deleting multiple or multiple PCIe terminal devices can be dynamically added and deleted during the running of the host. The embedded processor can be connected to the configuration management server through the Ethernet interface. The embedded processor can realize the simulation of the PCIe terminal device alone, or can work together with the configuration processing module and the IO processing module to realize the simulation of the PCIe terminal device.

具体地,上述内容介绍到正常流程中的PCIe虚拟化模块110和调试流程中的外部调试器120,分别具有分发PCIe配置请求报文和配置应答报文的功能。但其中配置应答报文的生成是由嵌入式处理器130与外部配置管理服务器协商生成的。此外,嵌入式处理器130还存储有内部程序,用于确定多个所述配置应答报文的生成顺序,适用于针对多个PCIe配置请求形成的PCIe配置请求队列,根据嵌入式处理器130存储的内部程序中预设的处理逻辑来确定多个对应的配置应答报文的生成顺序。嵌入式处理器130存储的内部程序中预设的处理逻辑可以时根据PCIe配置请求报文到达的时间顺序来确定配置应答报文的生成顺序,也可以根据所请求的PCIe终端设备的重要性来确定配置应答报文的生成顺序,本发明实施例不做具体限定。外部配置管理服务器可以存储有PCIe配置信息的外部服务器设备,通过与该服务器通信可以获取最新的PCIe配置信息,该配置管理服务器可以是由第三方硬件厂商提供的。Specifically, the PCIe virtualization module 110 in the normal process and the external debugger 120 in the debugging process described above have the functions of distributing PCIe configuration request packets and configuration response packets, respectively. However, the generation of the configuration response message is generated by the embedded processor 130 negotiating with the external configuration management server. In addition, the embedded processor 130 also stores an internal program for determining the generation sequence of a plurality of the configuration response messages, which is suitable for a PCIe configuration request queue formed for a plurality of PCIe configuration requests. The processing logic preset in the internal program of the device determines the generation sequence of multiple corresponding configuration response packets. The processing logic preset in the internal program stored in the embedded processor 130 may determine the generation sequence of the configuration response message according to the time sequence of the arrival of the PCIe configuration request message, or may be determined according to the importance of the requested PCIe terminal device. The generation sequence of the configuration response message is determined, which is not specifically limited in this embodiment of the present invention. The external configuration management server may be an external server device storing PCIe configuration information, and may obtain the latest PCIe configuration information by communicating with the server, and the configuration management server may be provided by a third-party hardware manufacturer.

由此可见,嵌入式处理器130在本系统中提供类似CPU的功能,通过与外部配置管理服务器的通信,实现配置应答过程中的报文内容本身的生成以及报文生成顺序的确定。当外部配置管理服务器更新了配置信息后,嵌入式处理器130通过与外部配置管理服务器协商获取最新的配置信息,并基于最新的配置信息实现报文内容本身的生成以及报文生成顺序的确定。It can be seen that the embedded processor 130 provides functions similar to CPU in this system, and realizes the generation of the message content itself and the determination of the message generation sequence in the configuration response process through communication with the external configuration management server. When the configuration information is updated by the external configuration management server, the embedded processor 130 obtains the latest configuration information by negotiating with the external configuration management server, and realizes the generation of the message content itself and the determination of the message generation sequence based on the latest configuration information.

PCIe虚拟化模块110、外部调试器120、嵌入式处理器130三个模块之间的关系为:PCIe虚拟化模块110上电后立即启动,在常规流程中作为模拟交换机的角色控制PCIe终端设备的配置和IO处理工作。外部调试器120对应的功能具有最高优先级,可以监控和关闭其他两个接口,仅在调试状态时启用,代替PCIe虚拟化模块110进行PCIe终端设备的配置和IO处理的调试工作。嵌入式处理器130工作后,可以根据外部配置管理服务器的最新配置,通过例如切换可编程硬件状态机的跳转地址等手段,生成所述配置应答报文,并确定多个所述配置应答报文的生成顺序。外部调试器可以本系统所在设备同一块电路板上的处理器,也可以是电路板外的处理器(比如调试用PC)。嵌入式处理器是本系统所在设备同一块电路板上的专用处理器。The relationship between the PCIe virtualization module 110 , the external debugger 120 and the embedded processor 130 is as follows: the PCIe virtualization module 110 starts immediately after being powered on, and acts as a simulated switch in the conventional process to control the operation of the PCIe terminal device. Configuration and IO handling work. The function corresponding to the external debugger 120 has the highest priority, can monitor and close the other two interfaces, and is only enabled in the debugging state, instead of the PCIe virtualization module 110 to perform the configuration of the PCIe terminal device and the debugging of the IO processing. After the embedded processor 130 works, it can generate the configuration response message according to the latest configuration of the external configuration management server, for example, by switching the jump address of the programmable hardware state machine, etc., and determine a plurality of configuration response messages. The order in which the text is generated. The external debugger can be a processor on the same circuit board as the device where the system is located, or a processor outside the circuit board (such as a PC for debugging). An embedded processor is a dedicated processor on the same circuit board as the device where the system is located.

本发明实施例提供的动态配置PCIe终端设备的系统,通过PCIe虚拟化模块模拟PCIe交换机设备,并进一步模拟其下游端口连接的多个终端设备,同时通过嵌入式处理器负责实际的配置报文生成和生成确定,还通过外部调试器的设置实现了外部可调试、内部可编程的开发支持,进而通过系统的整体设计有效地满足了应用、调试、更新等情况下的灵活配置和应用PCIe终端设备的需求。The system for dynamically configuring PCIe terminal devices provided by the embodiments of the present invention simulates a PCIe switch device through a PCIe virtualization module, further simulates multiple terminal devices connected to its downstream ports, and is responsible for the actual generation of configuration packets through an embedded processor. It also realizes external debuggable and internal programmable development support through the settings of the external debugger, and then effectively meets the flexible configuration and application of PCIe terminal equipment in the case of application, debugging, and updating through the overall design of the system. demand.

基于上述实施例,附图2示出了本发明实施例提供的PCIe虚拟化模块的结构示意图,具体内容如下。Based on the foregoing embodiment, FIG. 2 shows a schematic structural diagram of a PCIe virtualization module provided by an embodiment of the present invention, and the specific content is as follows.

PCIe事务层报文分发器101,用于解析从PCIe链路层接收到的PCIe事务层报文,并根据所述PCIe事务层报文的报文头部信息所指示的PCIe配置事务请求报文或PCIe IO事务请求报文,将所述PCIe配置事务请求报文或PCIe IO事务请求报文分别发送给对应的配置处理模块或IO处理模块;并用于将从配置处理模块或IO处理模块接收到的PCIe事务层报文,分发给PCIe链路层。The PCIe transaction layer packet distributor 101 is configured to parse the PCIe transaction layer packet received from the PCIe link layer, and configure the transaction request packet according to the PCIe configuration indicated by the packet header information of the PCIe transaction layer packet Or PCIe IO transaction request message, the PCIe configuration transaction request message or PCIe IO transaction request message is respectively sent to the corresponding configuration processing module or IO processing module; and used to receive from the configuration processing module or IO processing module The PCIe transaction layer packets are distributed to the PCIe link layer.

本发明实施例提供的PCIe虚拟化模块由附图2中的PCIe事务层报文分发器101、调试接口102、配置处理模块103和IO处理模块104等主要模块构成。此外,PCIe虚拟化模块还包括常规的PCIe物理层(图中未示出),负责处理物理信号并与PCIe链路层进行数据交换;PCIe链路层(图中未示出),负责数据链路层包的创建、解码和校检。PCIe物理层和PCIe链路层均符合PCIe协议规范,本发明实施例不做赘述。The PCIe virtualization module provided by the embodiment of the present invention is composed of main modules such as a PCIe transaction layer packet distributor 101, a debugging interface 102, a configuration processing module 103, and an IO processing module 104 in FIG. 2. In addition, the PCIe virtualization module also includes a conventional PCIe physical layer (not shown in the figure), which is responsible for processing physical signals and exchanging data with the PCIe link layer; the PCIe link layer (not shown in the figure), responsible for the data link Road layer packet creation, decoding and verification. Both the PCIe physical layer and the PCIe link layer conform to the PCIe protocol specification, and details are not described in this embodiment of the present invention.

PCIe链路层处理后的PCIe事务层报文会发送给PCIe事务层报文分发器101进行接收。PCIe事务层报文分发器接收到PCIe链路层的PCIe事务层报文后,只解析报文头部,根据报文头部的信息区分报文为PCIe配置事务请求报文或PCIe IO事务请求报文。如果是PCIe配置事务请求报文,则转发给配置处理模块103处理;如果是PCIe IO事务请求报文,则转发给IO处理模块104处理。相应地,配置处理模块103和IO处理模块104发送的应答报文也会经PCIe事务层报文分发器发送给PCIe链路层。由于本发明实施例中的PCIe虚拟化模块起到了PCIe交换机的作用,因此在其PCIe虚拟化模块中需要设置PCIe事务层报文分发器,根据PCIe协议中不同类型报文的报头格式,来区分其接收到的报文属于PCIe配置事务请求报文还是PCIe IO事务请求报文,从而实现对下游PCIe终端设备的统一管理。The PCIe transaction layer packet processed by the PCIe link layer will be sent to the PCIe transaction layer packet distributor 101 for reception. After the PCIe transaction layer packet distributor receives the PCIe transaction layer packet of the PCIe link layer, it only parses the packet header, and distinguishes the packet as a PCIe configuration transaction request packet or a PCIe IO transaction request according to the information in the packet header. message. If it is a PCIe configuration transaction request message, it is forwarded to the configuration processing module 103 for processing; if it is a PCIe IO transaction request message, it is forwarded to the IO processing module 104 for processing. Correspondingly, the response packets sent by the configuration processing module 103 and the IO processing module 104 are also sent to the PCIe link layer through the PCIe transaction layer packet distributor. Since the PCIe virtualization module in the embodiment of the present invention functions as a PCIe switch, a PCIe transaction layer packet distributor needs to be set in the PCIe virtualization module to distinguish different types of packets according to the header format of the PCIe protocol. Whether the received message is a PCIe configuration transaction request message or a PCIe IO transaction request message, so as to realize unified management of downstream PCIe terminal devices.

调试接口102,与所述外部调试器连接,用于当外部调试器启动时代替所述PCIe事务层报文分发器进行PCIe事务层报文的发送和接收。The debug interface 102 is connected to the external debugger, and is used for sending and receiving PCIe transaction layer packets instead of the PCIe transaction layer packet distributor when the external debugger is started.

前述实施例中涉及了由外部调试器接管PCIe虚拟化模块处理配置/IO报文的功能,进而实现由外部调试器主机代替PCIe虚拟化模块110完成PCIe交换机和下游PCIe终端设备的功能模拟。具体地,在调试状态下,外部调试器实际与PCIe虚拟化模块中的调试接口102进行通信,外部调试器通过调试接口102主动接管PCIe事务层报文分发器的报文发送和接收,或被动捕获和转发PCIe事务层报文分发器与配置处理模块和IO处理模块交互的所有事务层报文。The foregoing embodiments involve an external debugger taking over the function of the PCIe virtualization module to process configuration/IO packets, thereby realizing that the external debugger host replaces the PCIe virtualization module 110 to complete the functional simulation of the PCIe switch and downstream PCIe terminal devices. Specifically, in the debug state, the external debugger actually communicates with the debug interface 102 in the PCIe virtualization module. Capture and forward all transaction layer packets that the PCIe transaction layer packet distributor interacts with the configuration processing module and the IO processing module.

上述主动接管或被动捕获的方式由本系统定义的调试流程确定,调试接口可以直接与PCIe链路层进行报文传输,也可以自动捕获经过PCIe事务层报文分发器的报文。调试接口处理PCIe事务层报文分发器的报文发送和接收的工作由外部调试器进行控制。The above-mentioned active takeover or passive capture method is determined by the debugging process defined by the system. The debugging interface can directly transmit packets with the PCIe link layer, or can automatically capture the packets passing through the PCIe transaction layer packet distributor. The work of the debug interface dealing with the sending and receiving of messages from the PCIe transaction layer message dispatcher is controlled by an external debugger.

配置处理模块103,用于接收配置报文,并根据所述配置报文完成PCIe终端设备的更新。The configuration processing module 103 is configured to receive a configuration message, and complete the update of the PCIe terminal device according to the configuration message.

本发明实施例中的配置处理模块用于PCIe虚拟化模块所模拟的PCIe交换机负责的PCIe设备动态配置功能,具体包括:接收并发送PCIe协议中定义的PCIe配置事务请求报文,响应主机的上电PCIe枚举过程,发起热插拔操作并完成PCIe终端设备数量和属性更新。通过响应PCIe配置事务请求报文,本发明实施例提供的PCIe虚拟化模块可以通过软件功能模拟表现为一个PCIe终端设备、一个PCIe交换机设备、或一个PCIe交换机设备及其下游连接的多个PCIe终端设备。The configuration processing module in the embodiment of the present invention is used for the PCIe device dynamic configuration function in charge of the PCIe switch simulated by the PCIe virtualization module, and specifically includes: receiving and sending a PCIe configuration transaction request message defined in the PCIe protocol, responding to the host's upper During the electrical PCIe enumeration process, a hot-plug operation is initiated and the number and attributes of PCIe terminal devices are updated. By responding to the PCIe configuration transaction request message, the PCIe virtualization module provided by the embodiment of the present invention can simulate a PCIe terminal device, a PCIe switch device, or a PCIe switch device and multiple PCIe terminals connected downstream through software functions. equipment.

配置处理模块103的更详细的结构和功能在后续实施例中再做进一步说明。The more detailed structure and function of the configuration processing module 103 will be further described in subsequent embodiments.

IO处理模块104,用于接收PCIe IO请求报文,并根据所述PCIe IO请求报文控制所述PCIe虚拟化模块和/或至少一个PCIe终端设备进行控制状态寄存器访问以及直接内存访问。The IO processing module 104 is configured to receive a PCIe IO request message, and control the PCIe virtualization module and/or at least one PCIe terminal device to perform control status register access and direct memory access according to the PCIe IO request message.

本发明实施例提供的IO处理模块104,用于根据配置处理模块完成PCIe设备动态配置功能后,负责在IO处理阶段完成IO终端设备访问的功能,具体包括:接收并发送PCIe协议中定义的PCIe IO请求报文,响应主机驱动程序的控制状态寄存器访问,发起设备端直接内存访问(Direct Memory Access,DMA)。本系统可以根据主机配置协商结果,实现一个PCIe虚拟化模块和/或多个PCIe终端设备的独立的控制状态寄存器;此外,对于其中特定的访问对象,本系统还可以从一个PCIe虚拟化模块和/或多个PCIe终端设备独立发起直接内存访问操作。The IO processing module 104 provided in the embodiment of the present invention is used for completing the function of accessing the IO terminal device in the IO processing stage after the configuration processing module completes the dynamic configuration function of the PCIe device, and specifically includes: receiving and sending the PCIe device defined in the PCIe protocol. The IO request message responds to the control status register access of the host driver, and initiates a device-side direct memory access (Direct Memory Access, DMA). The system can implement a PCIe virtualization module and/or independent control status registers of multiple PCIe terminal devices according to the host configuration negotiation result; in addition, for a specific access object, the system can also obtain a PCIe virtualization module from a PCIe virtualization module and/or multiple PCIe terminal devices. /or multiple PCIe end devices independently initiate direct memory access operations.

IO处理模块104的更详细的结构和功能在后续实施例中再做进一步说明。The more detailed structure and function of the IO processing module 104 will be further described in subsequent embodiments.

基于上述任一实施例,附图3示出了本发明实施例提供的配置处理模块的结构示意图,具体内容如下。Based on any of the foregoing embodiments, FIG. 3 shows a schematic structural diagram of a configuration processing module provided by an embodiment of the present invention, and the specific content is as follows.

配置报文收发接口,用于接收PCIe事务层报文分发器分发的PCIe配置事务请求报文,并发送从可编程硬件状态机或CPU配置处理接口接收到的的配置事务应答报文。The configuration packet sending and receiving interface is used to receive the PCIe configuration transaction request packet distributed by the PCIe transaction layer packet distributor, and send the configuration transaction response packet received from the programmable hardware state machine or the CPU configuration processing interface.

本发明实施例中的PCIe事务层报文分发器分发的报文类型为PCIe配置事务请求报文时,会将该报文发送至配置处理模块,而配置处理模块是通过配置报文收发接口接收该报文的。同样地,在本发明实施例中的方案处于调试状态下时配置处理模块是通过配置报文收发接口接收调试接口分发的PCIe配置事务请求报文。When the packet type distributed by the PCIe transaction layer packet distributor in the embodiment of the present invention is a PCIe configuration transaction request packet, the packet is sent to the configuration processing module, and the configuration processing module receives the packet through the configuration packet sending and receiving interface. of the message. Similarly, when the solution in the embodiment of the present invention is in the debugging state, the configuration processing module receives the PCIe configuration transaction request message distributed by the debugging interface through the configuration message sending and receiving interface.

配置报文收发接口除了接收PCIe配置事务请求报文,还需要发送相应的配置事务应答报文。本发明实施例中的配置应答报文可以是可编程硬件状态机生成后发送给配置报文收发接口的,也可以是嵌入式处理器生成后通过CPU配置处理接口发送给配置报文收发接口的。In addition to receiving PCIe configuration transaction request packets, the configuration packet transceiver interface also needs to send corresponding configuration transaction response packets. The configuration response message in the embodiment of the present invention may be generated by a programmable hardware state machine and sent to the configuration message sending and receiving interface, or may be generated by an embedded processor and sent to the configuration message sending and receiving interface through the CPU configuration processing interface. .

CPU配置处理接口,用于接收配置报文收发接口转发的PCIe配置事务请求报文,并发送从所述嵌入式处理器接收的的配置事务应答报文。The CPU configuration processing interface is configured to receive the PCIe configuration transaction request message forwarded by the configuration message transceiver interface, and send the configuration transaction response message received from the embedded processor.

本发明实施例中的CPU配置处理接口主要功能是用于使PCIe虚拟化模块与嵌入式处理器进行通信的接口。根据嵌入式处理器在本系统中主要负责生成配置应答报文,因此CPU配置处理接口主要用于将PCIe配置事务请求报文转发给嵌入式处理器进行处理,在嵌入式处理器处理完毕生成好配置事务应答报文后,从嵌入式处理器处接收该应答报文。The main function of the CPU configuration processing interface in the embodiment of the present invention is an interface for enabling the PCIe virtualization module to communicate with the embedded processor. According to the embedded processor is mainly responsible for generating the configuration response message in this system, the CPU configuration processing interface is mainly used to forward the PCIe configuration transaction request message to the embedded processor for processing. After the transaction response message is configured, the response message is received from the embedded processor.

可编程硬件状态机,用于接收并解析配置报文收发接口转发的PCIe配置事务请求报文,并根据解析内容发送预先编程的配置事务应答报文;The programmable hardware state machine is used to receive and parse the PCIe configuration transaction request message forwarded by the configuration message transceiver interface, and send a pre-programmed configuration transaction response message according to the parsed content;

本发明实施例中的配置处理模块的可编程硬件状态机,也具备处理PCIe配置事务请求报文的功能。可编程硬件状态机在上电后即可开始工作,会根据预先编程的配置事务应答报文来对PCIe配置事务请求报文进行解析,并进行应答最基本的PCIe协议、控制住PCIe协议的应答、暂停PCIe协议交互等工作。同时,可编程硬件状态机可以在CPU配置处理接口上电后开始工作后与CPU配置处理接口配合工作。The programmable hardware state machine of the configuration processing module in the embodiment of the present invention also has the function of processing a PCIe configuration transaction request message. The programmable hardware state machine can start to work after power-on. It will parse the PCIe configuration transaction request message according to the pre-programmed configuration transaction response message, and respond to the most basic PCIe protocol and control the response of the PCIe protocol. , Pause PCIe protocol interaction and other work. At the same time, the programmable hardware state machine can work in cooperation with the CPU configuration processing interface after the CPU configuration processing interface is powered on and starts to work.

具体地,本发明实施例中配置报文可以由CPU配置处理接口或可编程硬件状态机单独收发,也可以由二者配合完成。一种可能的配合方式是:可编程硬件状态机上电后立即启动,当收到上游端口的配置读写请求后,发送预先编程的报文,直到CPU完成上电初始化,由CPU接替可编程状态机完成后续的配置读写请求响应。另一种可能的配合方式是:可编程状态机完成预先设定好的所有配置读写请求响应,当遇到预先设定情况外的异常情况时,触发嵌入式处理器接管处理,处理完成后,仍由可编程状态机完成请求响应。Specifically, in the embodiment of the present invention, the configuration message may be sent and received independently by the CPU configuration processing interface or the programmable hardware state machine, or may be completed by the cooperation of the two. A possible cooperation method is: the programmable hardware state machine starts immediately after power-on. After receiving the configuration read and write request from the upstream port, it sends a pre-programmed message until the CPU completes power-on initialization, and the CPU takes over the programmable state. The machine completes the subsequent configuration read and write request response. Another possible cooperation method is: the programmable state machine completes all pre-set configuration read and write request responses, and when it encounters an abnormal situation other than the pre-set situation, the embedded processor is triggered to take over the processing, and after the processing is completed , the request response is still completed by the programmable state machine.

状态机微序列程序存储单元,用于存储可编程硬件状态机的指令和数据,所述指令和数据从所述CPU配置处理接口写入或读出。该模块可以理解为可编程硬件状态机的数据存储单元,CPU配置处理接口写入在对其中数据进行写入时,可以通过切换可编程硬件状态机中预先编程的应答报文中的跳转地址。The state machine micro-sequence program storage unit is used to store the instructions and data of the programmable hardware state machine, and the instructions and data are written in or read out from the CPU configuration processing interface. This module can be understood as the data storage unit of the programmable hardware state machine. When writing the data in the CPU configuration processing interface, it can switch the jump address in the pre-programmed response message in the programmable hardware state machine. .

本发明实施例提供的配置处理模块,通过所设置的可编程状态机与外部的嵌入式处理器进行配合,采用分阶段、分任务联合控制的方法,为PCIe设备的的动态配置即时生效提供的支持,有效地满足了PCIe配置事务的灵活处理的需求,实现了配置处理模块所在的PCIe虚拟化模块模拟PCIe交换机设备对本机和下游PCIe终端设备的统一管理。The configuration processing module provided by the embodiment of the present invention cooperates with an external embedded processor through the set programmable state machine, and adopts the method of joint control by stages and tasks, so as to provide the dynamic configuration of the PCIe device with immediate effect. Support, effectively meet the needs of flexible processing of PCIe configuration transactions, and realize the unified management of the local and downstream PCIe terminal devices by the PCIe virtualization module where the configuration processing module is located by simulating the PCIe switch device.

基于上述任一实施例,附图4示出了本发明实施例提供的IO处理模块的结构示意图,具体内容如下。Based on any of the foregoing embodiments, FIG. 4 shows a schematic structural diagram of an IO processing module provided by an embodiment of the present invention, and the specific content is as follows.

目标IO报文收发接口,用于接收PCIe事务层报文分发器转发的PCIe IO事务请求报文,并解析为BAR地址空间存储器读写请求;并用于把CSR模块返回的存储器读写应答封装成IO事务应答报文,发送给PCIe事务层报文分发器。The target IO message sending and receiving interface is used to receive the PCIe IO transaction request message forwarded by the PCIe transaction layer message distributor, and parse it into a BAR address space memory read and write request; and used to encapsulate the memory read and write response returned by the CSR module into The IO transaction response message is sent to the PCIe transaction layer message distributor.

CSR模块,用于接收目标IO报文收发接口发送的BAR地址空间存储器读写请求,根据所述BAR地址空间存储器读写请求获取对应的读写请求内容发送给目标IO报文收发接口。The CSR module is configured to receive the read and write request of the BAR address space memory sent by the target IO message sending and receiving interface, obtain the corresponding read and write request content according to the BAR address space memory read and write request, and send it to the target IO message sending and receiving interface.

本发明实施例提供的IO处理模块中的目标IO报文收发接口和CSR模块两个模块用于常规情况下PCIe IO事务请求的操作,即主机IO阶段事务。其中目标IO报文收发接口主要用于IO报文的收发,CSR模块用于IO读写事务的处理。In the IO processing module provided by the embodiment of the present invention, two modules, the target IO message sending and receiving interface and the CSR module, are used for the operation of PCIe IO transaction request under normal circumstances, that is, the host IO stage transaction. The target IO message sending and receiving interface is mainly used for sending and receiving IO messages, and the CSR module is used for processing IO read and write transactions.

当本发明实施例中的PCIe事务层报文分发器分发的是PCIe IO事务请求报文时,该报文会发送到IO处理模块,具体为IO处理模块中的目标IO报文收发接口,由目标IO报文收发接口进一步将报文解析为BAR地址空间存储器读写请求后,分发给CSR模块处理具体IO读写事务。When the PCIe transaction layer message distributor in the embodiment of the present invention distributes a PCIe IO transaction request message, the message is sent to the IO processing module, which is specifically the target IO message sending and receiving interface in the IO processing module, which is composed of The target IO message sending and receiving interface further parses the message into a BAR address space memory read and write request, and distributes it to the CSR module to process specific IO read and write transactions.

当CSR模块返回了存储器读写应答后,目标IO报文收发接口会将该应答内容封装成IO事务应答报文,再发送给PCIe事务层报文分发器,完成IO请求的响应过程。After the CSR module returns a memory read/write response, the target IO message transceiver interface will encapsulate the response content into an IO transaction response message, and then send it to the PCIe transaction layer message distributor to complete the IO request response process.

CSR模块的具体结构又包括:The specific structure of the CSR module includes:

BAR地址空间映射管理接口,用于在接收到BAR地址空间存储器读写请求后,提供对应的PCIe终端设备的目标功能对应的BAR地址。The BAR address space mapping management interface is used to provide the BAR address corresponding to the target function of the corresponding PCIe terminal device after receiving the read and write request of the BAR address space memory.

BAR地址空间存储器,用于保存和提供BAR地址空间的内容。The BAR address space memory is used to save and provide the contents of the BAR address space.

BAR特定地址访问触发器,用于当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及DMA请求程序。The BAR specific address access trigger is used to trigger the programmable state machine of the IO processing module to run the BAR address space memory update program and the DMA request program when the target BAR address is accessed.

本发明实施例中CSR模块用于常规情况下IO事务的具体操作。首先由BAR地址空间映射管理接口根据目标IO报文收发接口解析得到的BAR地址空间存储器读写请求,提供对应的PCIe终端设备的目标功能对应的BAR地址,本领域技术人员可以理解的是,PCIe终端设备管理时可以以BAR地址的形式、并通过地址映射的方式来具体调用该PCIe终端设备的特定功能,一旦BAR地址的值确定,其指定范围内的PCIe终端设备中的内部存储空间就可以被访问,当PCIe终端设备确认某一个IO请求中的地址在自己的BAR的范围内,便可以接受该请求实现IO操作。BAR地址空间存储器所表征的地址与PCIe终端设备的特定功能之间的映射关系,可以预先保存在BAR地址空间存储器中,在进行IO操作时提供给BAR地址空间映射管理接口使用。In the embodiment of the present invention, the CSR module is used for specific operations of IO transactions under normal circumstances. First, the BAR address space mapping management interface provides the BAR address corresponding to the target function of the corresponding PCIe terminal device according to the BAR address space memory read/write request parsed by the target IO message sending and receiving interface. Those skilled in the art can understand that PCIe When managing the terminal device, the specific function of the PCIe terminal device can be specifically called in the form of BAR address and through address mapping. Once the value of the BAR address is determined, the internal storage space in the PCIe terminal device within the specified range can be used. Accessed, when the PCIe terminal device confirms that the address in an IO request is within the range of its own BAR, it can accept the request to implement the IO operation. The mapping relationship between the addresses represented by the BAR address space memory and the specific functions of the PCIe terminal device can be stored in the BAR address space memory in advance and provided to the BAR address space mapping management interface for use during IO operations.

BAR特定地址访问触发器,用于当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及DMA请求程序,即实现从常规情况下的主机IO阶段切换到特殊BAR地址相关的设备IO阶段,进而通过DMA操作的方式实现特定BAR地址对应的高效IO操作。接下来会说明设备IO阶段具体实现过程涉及的相关模块及其具体功能。The BAR specific address access trigger is used to trigger the programmable state machine of the IO processing module to run the BAR address space memory update program and the DMA request program when the target BAR address is accessed, that is, to switch from the host IO stage under normal conditions to The IO stage of the device related to the special BAR address, and then realize the efficient IO operation corresponding to the specific BAR address through the DMA operation. Next, the relevant modules involved in the specific implementation process of the device IO stage and their specific functions will be described.

可编程状态机,用于响应BAR特定地址访问触发器发送的BAR特定地址访问触发信号,并向CSR模块发送BAR的地址空间存储器更新信息;还用于向DMA模块发送DMA请求,接收DMA模块的完成响应;The programmable state machine is used to respond to the BAR specific address access trigger signal sent by the BAR specific address access trigger, and send the BAR address space memory update information to the CSR module; it is also used to send a DMA request to the DMA module and receive the DMA module's complete response;

起始IO报文收发接口,用于接收DMA模块发送的主机内存地址空间存储器读写请求,并将所述主机内存地址空间存储器读写请求封装成IO事务请求报文,发送给PCIe事务层报文分发器;并用于把PCIe事务层报文分发器返回的IO事务应答报文解析为主机内存地址空间存储器读写应答发送给DMA模块;The initial IO message sending and receiving interface is used to receive the host memory address space memory read and write requests sent by the DMA module, and encapsulate the host memory address space memory read and write requests into IO transaction request messages, and send them to the PCIe transaction layer to report It is used to parse the IO transaction response message returned by the PCIe transaction layer message distributor into the host memory address space memory read and write response and send it to the DMA module;

DMA模块,用于响应可编程状态机的DMA请求,发起命令获取DMA或数据传输DMA操作,向起始IO报文收发接口发送主机内存地址空间存储器读写请求;把从起始IO报文收发接口接收到的主机内存地址空间存储器读写应答内容写入命令缓存或数据缓存。The DMA module is used to respond to the DMA request of the programmable state machine, initiate command acquisition DMA or data transfer DMA operations, and send host memory address space memory read and write requests to the initial IO message transceiver interface; The host memory address space memory read and write response content received by the interface is written to the command buffer or data buffer.

本发明实施例提供的IO处理模块中的可编程状态机、起始IO报文收发接口和DMA模块三个模块用于处理当BAR特定地址访问触发信号触发时需要进行DMA操作的设备IO阶段事务。在本发明实施例提供的系统中,除了实现PCIe终端设备的灵活配置外,PCIe虚拟化模块在模拟PCIe交换机、实现对PCIe终端设备进行统一管理时,还需要考虑IO处理的高效性。因此,在设计IO处理模块进行IO处理时,除了目标IO报文收发接口和CSR模块两个模块用于常规情况下PCIe IO事务请求的操作之外,还设计了可编程状态机、起始IO报文收发接口和DMA模块三个模块用于特殊情况下触发的设备IO处理,两种IO处理机制彼此配合实现IO的高效处理。The programmable state machine, the initial IO message sending and receiving interface, and the DMA module in the IO processing module provided by the embodiment of the present invention are used to process the device IO stage transaction that needs to perform DMA operation when the BAR specific address access trigger signal is triggered . In the system provided by the embodiment of the present invention, in addition to realizing flexible configuration of PCIe terminal devices, the PCIe virtualization module also needs to consider the efficiency of IO processing when simulating PCIe switches and implementing unified management of PCIe terminal devices. Therefore, when designing the IO processing module for IO processing, in addition to the target IO message transceiver interface and the CSR module, which are used for the operation of PCIe IO transaction requests under normal circumstances, a programmable state machine, an initial IO module are also designed. The three modules of the message sending and receiving interface and the DMA module are used for the IO processing of the device triggered under special circumstances. The two IO processing mechanisms cooperate with each other to realize the efficient processing of IO.

本发明实施例中可编程状态机用于设备IO处理的触发,具体用于响应CSR模块中的BAR特定地址访问触发器发送的BAR特定地址访问触发信号,并向CSR模块发送BAR的地址空间存储器更新信息。然后,可编程状态机向DMA模块发送DMA请求,完成DMA操作的触发过程,并在DMA模块完成DMA操作后接收DMA模块的完成响应。In the embodiment of the present invention, the programmable state machine is used for triggering the IO processing of the device, and is specifically used to respond to the BAR specific address access trigger signal sent by the BAR specific address access trigger in the CSR module, and send the address space memory of the BAR to the CSR module Update information. Then, the programmable state machine sends a DMA request to the DMA module, completes the triggering process of the DMA operation, and receives a completion response from the DMA module after the DMA module completes the DMA operation.

具体地,可编程状态机根据预先编写好的存储在状态机微序列程序存储单元中的微序列程序,可编程状态机工作在查询等待状态,按照一定的顺序和优先级依次查询BAR特定地址访问触发信号和DMA模块的完成响应信号。在接收到BAR特定地址访问触发信号后,触发执行相应的微序列程序;在接收到DMA模块的完成响应信号后,触发执行相应的微序列程序。Specifically, according to the pre-written micro-sequence program stored in the micro-sequence program storage unit of the state machine, the programmable state machine works in the query waiting state, and sequentially queries the BAR specific address access according to a certain order and priority. Trigger signal and completion response signal of DMA module. After receiving the BAR specific address access trigger signal, trigger the execution of the corresponding micro-sequence program; after receiving the completion response signal of the DMA module, trigger and execute the corresponding micro-sequence program.

起始IO报文收发接口的功能与目标IO报文收发接口相似,但主要用于设备IO事务的报文收发。具体地,在接收到DMA模块发送的主机内存地址空间存储器读写请求后,将所述主机内存地址空间存储器读写请求封装成IO事务请求报文,发送给PCIe事务层报文分发器;此外,在PCIe事务层报文分发器返回的IO事务应答报文发送给起始IO报文收发接口后,起始IO报文收发接口将应答报文解析为主机内存地址空间存储器读写应答发送给DMA模块,从而实现DMA读写操作。The function of the starting IO packet sending and receiving interface is similar to that of the target IO packet sending and receiving interface, but it is mainly used for sending and receiving packets of device IO transactions. Specifically, after receiving the host memory address space memory read and write request sent by the DMA module, encapsulate the host memory address space memory read and write request into an IO transaction request message, and send it to the PCIe transaction layer message distributor; in addition; After the IO transaction response packet returned by the PCIe transaction layer packet distributor is sent to the initial IO packet transceiver interface, the initial IO packet transceiver interface parses the response packet into the host memory address space memory read and write response and sends it to DMA module, so as to realize DMA read and write operations.

DMA模块用于响应可编程状态机的请求,发起命令获取DMA或数据传输DMA操作,向起始IO报文收发接口发送主机内存地址空间存储器读写请求;把从起始IO报文收发接口接收到的主机内存地址空间存储器读写应答内容写入命令缓存或数据缓存。其中,DMA模块中又包括命令获取DMA模块和数据传输DMA模块,受到可编程状态机的控制,分别用于从可编程状态机中获取对应的命令或数据,且在DMA模块中分别为命令获取DMA模块和数据传输DMA模块分别对应设置有命令缓存和数据缓存,用于缓存DMA操作中获取的DMA命令和DMA数据。The DMA module is used to respond to the request of the programmable state machine, initiate command acquisition DMA or data transfer DMA operations, and send host memory address space memory read and write requests to the initial IO message transceiver interface; To the host memory address space memory read and write response content is written to the command cache or data cache. Among them, the DMA module also includes a command acquisition DMA module and a data transmission DMA module, which are controlled by the programmable state machine and are respectively used to acquire corresponding commands or data from the programmable state machine, and in the DMA module are command acquisitions respectively. The DMA module and the data transmission DMA module are respectively provided with a command buffer and a data buffer for buffering the DMA commands and DMA data acquired in the DMA operation.

本发明实施例提供的IO处理模块,在PCIe虚拟化模块对下游PCIe设备进行统一管理时,分别通过CSR模块和DMA模块相关功能的设计实现主机IO和设备IO的功能,具体根据BAR地址对应的不同PCIe终端设备及其功能选择进行主机IO操作还是设备IO操作,确保了不同用户需求下IO操作的高效性。In the IO processing module provided by the embodiment of the present invention, when the PCIe virtualization module performs unified management on the downstream PCIe devices, the functions of the host IO and the device IO are respectively realized through the design of the related functions of the CSR module and the DMA module. Specifically, according to the corresponding BAR address Different PCIe terminal devices and their functions choose to perform host IO operations or device IO operations, ensuring the efficiency of IO operations under different user needs.

基于上述任一实施例,附图5示出了本发明实施例提供的动态配置PCIe终端设备的系统的完整结构示意图,具体内容如下。Based on any of the foregoing embodiments, FIG. 5 shows a schematic diagram of a complete structure of a system for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention, and the specific content is as follows.

动态配置PCIe终端设备的系统包括PCIe虚拟化模块、外部调试器和嵌入式处理器。The system for dynamically configuring PCIe end devices includes PCIe virtualization modules, external debuggers, and embedded processors.

其中,PCIe虚拟化模块又包括PCIe物理层、PCIe链路层、PCIe事务层报文分发器、调试接口、配置处理模块和IO处理模块。The PCIe virtualization module further includes a PCIe physical layer, a PCIe link layer, a PCIe transaction layer packet distributor, a debugging interface, a configuration processing module, and an IO processing module.

配置处理模块又包括配置报文收发接口、CPU配置处理接口、可编程硬件状态机和状态机微序列程序存储单元。The configuration processing module further includes a configuration message sending and receiving interface, a CPU configuration processing interface, a programmable hardware state machine and a state machine micro-sequence program storage unit.

IO处理模块又包括目标IO报文收发接口、CSR模块、可编程状态机、状态机微序列程序存储单元、DMA模块和起始IO报文收发接口。The IO processing module also includes a target IO message sending and receiving interface, a CSR module, a programmable state machine, a state machine micro-sequence program storage unit, a DMA module and an initial IO message sending and receiving interface.

CSR模块又包括BAR地址空间映射管理接口、BAR地址空间存储器和BAR特定地址访问触发器。The CSR module further includes a BAR address space mapping management interface, a BAR address space memory and a BAR specific address access trigger.

DMA模块又包括命令获取DMA、数据传输DMA、命令缓存、数据缓存;数据缓存还连接有外部数据接口进行DMA数据的写入。The DMA module also includes command acquisition DMA, data transmission DMA, command cache, and data cache; the data cache is also connected to an external data interface for writing DMA data.

上述动态配置PCIe终端设备的系统中的各功能模块在前述实施例中均有说明,此处不做赘述。本发明实施例提供的动态配置PCIe终端设备的系统实现的主要功能有:通过对PCIe交换机的模拟实现PCIe终端设备的的动态配置以及统一管理;由外部调试接口、内部嵌入式处理器和可编程状态机,采用分阶段、分任务联合控制的方法,有效地满足了调试、应用、更新、异常情况下的全面、灵活、实时响应和处理PCIe事务层报文的需求;在PCIe虚拟化模块中的IO处理模块中进行相应的功能设计支持设备IO和主机IO两种IO操作方式,提高了IO操作的效率。Each functional module in the system for dynamically configuring PCIe terminal devices is described in the foregoing embodiments, and details are not described here. The main functions implemented by the system for dynamically configuring PCIe terminal equipment provided by the embodiments of the present invention include: realizing dynamic configuration and unified management of PCIe terminal equipment by simulating PCIe switches; The state machine adopts the method of joint control by stages and tasks, which effectively meets the needs of comprehensive, flexible, real-time response and processing of PCIe transaction layer messages under debugging, application, update, and abnormal conditions; in the PCIe virtualization module Corresponding functional design is carried out in the IO processing module of the device to support two IO operation modes of device IO and host IO, which improves the efficiency of IO operation.

基于上述任一实施例,附图6示出了本发明实施例提供的动态配置PCIe终端设备的方法的流程示意图,具体内容如下。Based on any of the foregoing embodiments, FIG. 6 shows a schematic flowchart of a method for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention, and the specific content is as follows.

步骤S610,所述系统的PCIe虚拟化模块在主机扫描所述系统下游的PCIe终端设备时接收所述主机发送的PCIe配置请求报文。Step S610, the PCIe virtualization module of the system receives the PCIe configuration request message sent by the host when the host scans the PCIe terminal devices downstream of the system.

当主机启动时,在PCIe枚举阶段会扫描下游PCIe设备的拓扑结构。当扫描到本系统所在设备时,PCIe虚拟化模块会应答为PCIe交换机;主机进一步扫描本设备下游的PCIe设备,PCIe虚拟化模块会代替虚拟的下游PCIe设备应答,其表现为逻辑上的PCIe交换机和下游的多个、多种逻辑上的PCIe终端设备。在主机完成上电启动和PCIe设备扫描后,主机进入运行阶段,本系统所在设备可以发起PCIe热插拔请求,动态删除或增加多个、多种逻辑上的PCIe终端设备。本系统所在设备下游的逻辑PCIe终端设备的数量和属性可以灵活配置,配置内容在本设备启动时或运行时由配置管理服务器与本设备的嵌入式处理器协商确定。在基于弹性裸金属服务器数据中心应用场景中,下游的逻辑PCIe终端设备可以是PCI插槽上部署的任意设备类型,例如声卡、网卡、内置Modem等。When the host boots up, the topology of downstream PCIe devices is scanned during the PCIe enumeration phase. When scanning the device where the system is located, the PCIe virtualization module will respond as a PCIe switch; the host further scans the PCIe devices downstream of the device, and the PCIe virtualization module will respond instead of the virtual downstream PCIe device, which behaves as a logical PCIe switch and downstream multiple and multiple logical PCIe terminal devices. After the host completes power-on and PCIe device scanning, the host enters the running phase, and the device where the system is located can initiate a PCIe hot-plug request to dynamically delete or add multiple or multiple logical PCIe terminal devices. The number and attributes of logical PCIe terminal devices downstream of the device where the system is located can be flexibly configured, and the configuration content is determined by the configuration management server and the embedded processor of the device through negotiation when the device starts or runs. In the data center application scenario based on elastic bare metal server, the downstream logical PCIe terminal device can be any device type deployed on the PCI slot, such as sound card, network card, built-in modem, etc.

步骤S620,所述PCIe虚拟化模块的配置处理模块对所述PCIe配置请求报文回复PCIe配置应答报文,其中,所述配置应答报文由所述系统的嵌入式处理器与外部配置管理服务器协商生成,多个所述配置应答报文的生成顺序由嵌入式处理器确定。Step S620, the configuration processing module of the PCIe virtualization module replies a PCIe configuration response message to the PCIe configuration request message, wherein the configuration response message is sent by the embedded processor of the system and an external configuration management server. After negotiation and generation, the generation sequence of the plurality of configuration response messages is determined by the embedded processor.

具体地,在主机配置阶段,主机会扫描系统内下游的PCIe终端设备并进行相应的配置工作,本发明实施例由PCIe虚拟化模块代替PCIe终端设备,接收所述主机发送的PCIe配置请求报文,并对所述配置请求报文回复配置应答报文。也就是说,主机在扫描PCIe终端设备并对其进行配置时,是通过PCIe虚拟化模块实现的。PCIe配置请求报文和配置应答报文均是PCIe协议中用于配置PCIe终端设备时用于设备信息交互的报文类型。Specifically, in the host configuration stage, the host scans the downstream PCIe terminal devices in the system and performs corresponding configuration work. In this embodiment of the present invention, a PCIe virtualization module replaces the PCIe terminal device, and receives a PCIe configuration request message sent by the host. , and reply a configuration response message to the configuration request message. That is to say, when the host scans and configures PCIe terminal devices, it does so through the PCIe virtualization module. The PCIe configuration request message and the configuration response message are both message types used in the PCIe protocol for device information exchange when configuring a PCIe terminal device.

步骤S630,所述系统的PCIe虚拟化模块接收所述主机发送的PCIe IO请求报文,其中所述PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求。Step S630, the PCIe virtualization module of the system receives a PCIe IO request message sent by the host, wherein the PCIe IO request message includes a read and write request of a BAR address space memory corresponding to a downstream PCIe terminal device.

步骤S640,所述PCIe虚拟化模块的IO处理模块对所述PCIe IO请求报文回复IO应答报文,其中所述IO应答报文包括BAR地址空间存储器存储的内容。Step S640, the IO processing module of the PCIe virtualization module replies with an IO response message to the PCIe IO request message, wherein the IO response message includes the content stored in the BAR address space memory.

在设备IO操作阶段,主机会请求访问配置好的PCIe终端设备对应的IO资源。此时,本发明实施例还是通过PCIe虚拟化模块负责接收所述主机发送的PCIe IO请求报文,并对所述配置请求报文回复IO应答报文。PCIe IO请求报文和IO应答报文均是PCIe协议中用于访问PCIe终端设备资源时用于设备信息交互的报文类型。其中,PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求。BAR地址空间由表征多个PCIE终端设备的多个功能对应的多个BAR地址构成,BAR地址空间存储器中存储的数据是表示PCIE终端设备在PCIE地址空间中的基地址。因此,通过包含BAR地址空间存储器读写请求的PCIe IO请求报文,主机可以请求访问该地址对应的IO资源以及对应的功能。In the device IO operation stage, the host will request to access the IO resources corresponding to the configured PCIe terminal device. At this time, in this embodiment of the present invention, the PCIe virtualization module is still responsible for receiving the PCIe IO request message sent by the host, and replies with an IO response message to the configuration request message. Both PCIe IO request packets and IO response packets are packet types used for device information exchange when accessing PCIe terminal device resources in the PCIe protocol. The PCIe IO request packet includes a read and write request of the BAR address space memory corresponding to the downstream PCIe terminal device. The BAR address space is composed of multiple BAR addresses representing multiple functions of multiple PCIE terminal devices, and the data stored in the BAR address space memory is the base address representing the PCIE terminal device in the PCIE address space. Therefore, through the PCIe IO request message including the read and write request of the BAR address space memory, the host can request to access the IO resource corresponding to the address and the corresponding function.

S650,当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及DMA请求程序。S650, when the target BAR address is accessed, the programmable state machine of the IO processing module is triggered to run the BAR address space memory update program and the DMA request program.

本发明实施例体现了本系统执行动态配置PCIe终端设备的方法的应用流程。一种可能的具体实施方式内容如下:The embodiment of the present invention embodies the application process of the system executing the method for dynamically configuring PCIe terminal equipment. A possible specific implementation is as follows:

主机配置阶段:主机配置阶段由主机上电启动后开始扫描PCIe终端设备;终端设备收到READY查询指令后等待嵌入式处理器上电;嵌入式处理器上电准备好后,等待可编程状态机返回READY信号;本系统所在设备收到配置读取请求时,嵌入式处理器返回该设备的类型为PCIe交换机,然后该设备收到下游PCIe终端设备的读取请求,本系统所在设备与嵌入式处理器通信后返回多个下游设备中一个设备的配置信息,完成主机扫描阶段的任务。Host configuration stage: The host configuration stage starts to scan for PCIe terminal devices after the host is powered on; the terminal device waits for the embedded processor to power on after receiving the READY query command; after the embedded processor is ready for power on, it waits for the programmable state machine Returns the READY signal; when the device where the system is located receives the configuration read request, the embedded processor returns the type of the device as PCIe switch, and then the device receives the read request from the downstream PCIe terminal device, the device where the system is located and the embedded processor After the processor communicates, it returns the configuration information of one of the multiple downstream devices to complete the task of the host scanning phase.

主机IO阶段:嵌入式处理器配置所述PCIe虚拟化中的CSR模块设置每个下游设备的BAR地址信息。然后就可以进行IO操作阶段,本系统所在设备收到IO读取请求,CSR模块可以返回特定下游设备的CSR内容。当主机访问特定BAR地址时,BAR特定地址访问触发器发送触发信号给可编程状态机。Host IO stage: the embedded processor configures the CSR module in the PCIe virtualization to set the BAR address information of each downstream device. Then the IO operation phase can be performed. The device where the system is located receives the IO read request, and the CSR module can return the CSR content of the specific downstream device. When the host accesses a specific BAR address, the BAR specific address access flip-flop sends a trigger signal to the programmable state machine.

设备IO阶段:在触发了设备IO阶段的流程后,可编程状态机启动命令获取DMA,命令获取DMA发送主机内存读取指令,主机返回应答内容于命令缓存,可编程状态机读取命令缓存解析命令,启动数据传输DMA,数据传输DMA发送主机内存读写指令,主机返回的内存内容于数据缓存,完成设备IO阶段的主要操作。上述提供的一种完整的实施方式可以参考附图7提供的动态配置PCIe终端设备的方法的完整流程示意图所示。Device IO stage: After triggering the process of the device IO stage, the programmable state machine starts the command to obtain DMA, the command to obtain DMA sends the host memory read command, the host returns the response content to the command cache, and the programmable state machine reads the command cache and parses Command, start the data transfer DMA, the data transfer DMA sends the host memory read and write instructions, the host returns the memory content in the data cache, and completes the main operations in the IO stage of the device. For a complete implementation manner provided above, reference may be made to the complete schematic flowchart of the method for dynamically configuring a PCIe terminal device provided in FIG. 7 .

基于上述任一实施例,附图8示出了本发明实施例提供的PCIe终端设备的调试方法的流程示意图,具体内容如下。Based on any of the foregoing embodiments, FIG. 8 shows a schematic flowchart of a debugging method for a PCIe terminal device provided by an embodiment of the present invention, and the specific content is as follows.

步骤S810,启动所述系统的外部调试器;Step S810, start the external debugger of the system;

步骤S820,所述外部调试器通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;Step S820, the external debugger performs the debugging of PCIe configuration and IO call instead of the PCIe virtualization module through the debugging interface provided by the PCIe virtualization module;

步骤S830,在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序。Step S830, after the debugging of the PCIe terminal device of the target type is completed, modify the program in the PCIe virtualization module for supporting the PCIe terminal device of the target type.

本发明实施例体现了本系统执行动态配置PCIe终端设备的方法的调试流程。本发明实施例提供的动态配置PCIe终端设备的系统通过所述PCIe虚拟化模块提供的调试接口与所述PCIe虚拟化模块连接,用于在启动时通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;并用于在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序。The embodiment of the present invention embodies the debugging process of the system executing the method for dynamically configuring PCIe terminal equipment. The system for dynamically configuring a PCIe terminal device provided by the embodiment of the present invention is connected to the PCIe virtualization module through a debugging interface provided by the PCIe virtualization module, and is used for using the debugging interface provided by the PCIe virtualization module during startup, Debugging of PCIe configuration and IO call in place of the PCIe virtualization module; and for modifying the program for supporting the PCIe terminal device of the target type in the PCIe virtualization module after the debugging of the PCIe terminal device of the target type is completed .

本发明实施例提供的动态配置PCIe终端设备的系统通过外部调试器与PCIe虚拟化模块的设置,还具有可编程和动态在线更新能力,可以支持虚拟实现现有类型的PCIe设备和未来可能出现的新的类型的PCIe设备。对不同类型PCIe设备的支持是通过增加或修改本系统所在设备的程序存储内容来实现的,本系统可以同时支持多种不同类型的PCIe设备,支持设备的种类受程序存储容量限制。针对本系统尚未实现的新的类型的PCIe设备,本系统提供外部调试器,并在PCIe虚拟化模块中设置对应的调试接口与外部调试器120连接,在运行调试功能时可以由外部调试器接管PCIe虚拟化模块处理配置/IO报文的功能,进而实现由外部调试器主机代替PCIe虚拟化模块完成PCIe交换机和下游PCIe终端设备的功能模拟。当新类型的PCIe终端设备在外部主机调试模式下完成所有功能后,可以修改PCIe虚拟化模块中相应的程序存储内容,更新对新类型PCIe终端设备的支持。The system for dynamically configuring PCIe terminal devices provided by the embodiments of the present invention also has programmable and dynamic online update capabilities through the settings of an external debugger and a PCIe virtualization module, and can support the virtual realization of existing types of PCIe devices and possible future ones. New type of PCIe device. The support for different types of PCIe devices is achieved by adding or modifying the program storage content of the device where the system is located. The system can support multiple different types of PCIe devices at the same time, and the types of supported devices are limited by the program storage capacity. For new types of PCIe devices that have not been implemented in the system, the system provides an external debugger, and sets a corresponding debug interface in the PCIe virtualization module to connect with the external debugger 120, which can be taken over by the external debugger when running the debugging function The PCIe virtualization module processes the configuration/IO message function, and then realizes that the external debugger host replaces the PCIe virtualization module to complete the functional simulation of the PCIe switch and downstream PCIe terminal devices. After the new type of PCIe terminal device completes all functions in the external host debug mode, the corresponding program storage content in the PCIe virtualization module can be modified to update support for the new type of PCIe terminal device.

本系统中由于外部调试器具有最高的优先级,因此当本系统所在设备上电后,可以判断外部调试器是否连接。如果连接,则本系统进入调试状态。当外部调试器启动即进行调试状态时,外部调试器通过PCIe虚拟化模块提供的调试接口,可以代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试,实现现有类型的PCIe设备的修改和新的类型的PCIe设备的更新。当调试完成后,通过可编程的方式修改PCIe虚拟化模块中相应的程序存储内容,从而实现了对新类型PCIe终端设备的支持。Since the external debugger has the highest priority in this system, it can be judged whether the external debugger is connected when the device where the system is located is powered on. If connected, the system enters the debugging state. When the external debugger is in the debug state when it is started, the external debugger can use the debug interface provided by the PCIe virtualization module to replace the PCIe virtualization module to debug PCIe configuration and IO calls, so as to realize the modification of existing types of PCIe devices. And new types of PCIe device updates. After the debugging is completed, the corresponding program storage content in the PCIe virtualization module is modified in a programmable manner, thereby realizing support for new types of PCIe terminal devices.

通过上述过程,本系统实现了PCIe终端设备的数量或属性的动态更新。当需要对PCIe终端设备进行更新时,启动外部调试器进行介入,即可对PCIe终端设备进行动态配置,同时也避免了传统的SR-IOV方法在进行PCIe终端设备的复用时配置灵活性较差的问题。Through the above process, the system realizes the dynamic update of the quantity or attributes of PCIe terminal devices. When the PCIe terminal device needs to be updated, the external debugger can be started to intervene, and the PCIe terminal device can be dynamically configured. At the same time, it also avoids the traditional SR-IOV method, which is more flexible in configuration when multiplexing PCIe terminal devices. Bad question.

基于上述任一实施例,附图9示出了本发明实施例提供的动态配置PCIe终端设备的异常处理方法的流程示意图,具体内容如下。Based on any of the foregoing embodiments, FIG. 9 shows a schematic flowchart of an exception processing method for dynamically configuring a PCIe terminal device provided by an embodiment of the present invention, and the specific content is as follows.

步骤S910,由所述PCIe虚拟化模块的配置处理模块的可编程状态机,代替所述嵌入式处理器与外部配置管理服务器的协商过程,生成所述配置应答报文;Step S910, the configuration response message is generated by the programmable state machine of the configuration processing module of the PCIe virtualization module, instead of the negotiation process between the embedded processor and the external configuration management server;

步骤S920,若所述PCIe配置请求报文为未定义类型,则根据所述嵌入式处理器与外部配置管理服务器的协商,代替所述可编程状态机生成所述配置应答报文。Step S920, if the PCIe configuration request message is of an undefined type, the configuration response message is generated instead of the programmable state machine according to the negotiation between the embedded processor and the external configuration management server.

本发明实施例体现了本系统执行动态配置PCIe终端设备的方法的异常处理流程。本发明实施例中的配置处理模块的可编程硬件状态机,也具备处理PCIe配置事务请求报文的功能。可编程硬件状态机在上电后即可开始工作,会根据预先编程的配置事务应答报文来对PCIe配置事务请求报文进行解析,并进行应答最基本的PCIe协议、控制住PCIe协议的应答、暂停PCIe协议交互等工作。同时,可编程硬件状态机可以在CPU配置处理接口上电后开始工作后与CPU配置处理接口配合工作。The embodiment of the present invention embodies the abnormal processing flow of the system executing the method for dynamically configuring PCIe terminal equipment. The programmable hardware state machine of the configuration processing module in the embodiment of the present invention also has the function of processing a PCIe configuration transaction request message. The programmable hardware state machine can start to work after power-on. It will parse the PCIe configuration transaction request message according to the pre-programmed configuration transaction response message, and respond to the most basic PCIe protocol and control the response of the PCIe protocol. , Pause PCIe protocol interaction and other work. At the same time, the programmable hardware state machine can work in cooperation with the CPU configuration processing interface after the CPU configuration processing interface is powered on and starts to work.

具体地,本发明实施例中配置报文可以由CPU配置处理接口或可编程硬件状态机单独收发,也可以由二者配合完成。一种可能的配合方式是:可编程硬件状态机上电后立即启动,当收到上游端口的配置读写请求后,发送预先编程的报文,直到CPU完成上电初始化,由CPU接替可编程状态机完成后续的配置读写请求响应。另一种可能的配合方式是:可编程状态机完成预先设定好的所有配置读写请求响应,当遇到预先设定情况外的异常情况时,触发嵌入式处理器接管处理,处理完成后,仍由可编程状态机完成请求响应。Specifically, in the embodiment of the present invention, the configuration message may be sent and received independently by the CPU configuration processing interface or the programmable hardware state machine, or may be completed by the cooperation of the two. A possible cooperation method is: the programmable hardware state machine starts immediately after power-on. After receiving the configuration read and write request from the upstream port, it sends a pre-programmed message until the CPU completes power-on initialization, and the CPU takes over the programmable state. The machine completes the subsequent configuration read and write request response. Another possible cooperation method is: the programmable state machine completes all pre-set configuration read and write request responses, and when it encounters an abnormal situation other than the pre-set situation, the embedded processor is triggered to take over the processing, and after the processing is completed , the request response is still completed by the programmable state machine.

最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1.一种动态配置PCIe终端设备的系统,其特征在于,所述系统包括:1. a system of dynamically configuring PCIe terminal equipment, is characterized in that, described system comprises: PCIe虚拟化模块,用于在主机扫描所述系统下游的PCIe终端设备时接收所述主机发送的PCIe配置请求报文,并对所述PCIe配置请求报文回复配置应答报文;并用于接收所述主机发送的PCIe IO请求报文,并对所述PCIe IO请求报文回复IO应答报文;其中,PCIe IO请求报文包含下游的PCIe终端设备对应的基地址寄存器BAR地址空间存储器读写请求;The PCIe virtualization module is configured to receive a PCIe configuration request message sent by the host when the host scans the PCIe terminal devices downstream of the system, and reply a configuration response message to the PCIe configuration request message; and is used to receive all the PCIe configuration request messages. Describe the PCIe IO request message sent by the host, and reply the IO response message to the PCIe IO request message; wherein, the PCIe IO request message includes the base address register BAR address space memory read and write request corresponding to the downstream PCIe terminal device ; 外部调试器,通过所述PCIe虚拟化模块提供的调试接口与所述PCIe虚拟化模块连接,用于在启动时通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;并用于在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序;An external debugger, connected to the PCIe virtualization module through the debug interface provided by the PCIe virtualization module, and used to replace the PCIe virtualization module with the debug interface provided by the PCIe virtualization module during startup to perform PCIe Debugging of configuration and IO call; and for modifying the program for supporting the PCIe terminal device of the target type in the PCIe virtualization module after the debugging of the PCIe terminal device of the target type is completed; 嵌入式处理器,用于与外部配置管理服务器协商生成所述配置应答报文,并确定多个所述配置应答报文的生成顺序。The embedded processor is configured to negotiate with an external configuration management server to generate the configuration response message, and determine the generation sequence of a plurality of the configuration response messages. 2.根据权利要求1所述的动态配置PCIe终端设备的系统,其特征在于,所述PCIe虚拟化模块包括:2. The system for dynamically configuring PCIe terminal equipment according to claim 1, wherein the PCIe virtualization module comprises: PCIe事务层报文分发器,用于解析从PCIe链路层接收到的PCIe事务层报文,并根据所述PCIe事务层报文的报文头部信息所指示的PCIe配置请求报文或PCIe IO请求报文,将所述PCIe配置请求报文或PCIe IO请求报文分别发送给对应的配置处理模块或IO处理模块;并用于将从配置处理模块或IO处理模块接收到的PCIe事务层报文,分发给PCIe链路层;The PCIe transaction layer message distributor is used to parse the PCIe transaction layer message received from the PCIe link layer, and according to the PCIe configuration request message or PCIe configuration request message indicated by the message header information of the PCIe transaction layer message IO request message, sending the PCIe configuration request message or PCIe IO request message to the corresponding configuration processing module or IO processing module respectively; and used to report the PCIe transaction layer received from the configuration processing module or the IO processing module document, distributed to the PCIe link layer; 调试接口,与所述外部调试器连接,用于当外部调试器启动时代替所述PCIe事务层报文分发器进行PCIe事务层报文的发送和接收;a debugging interface, connected with the external debugger, for sending and receiving PCIe transaction layer messages instead of the PCIe transaction layer message distributor when the external debugger is started; 配置处理模块,用于接收PCIe配置请求报文,并根据所述PCIe配置请求报文完成PCIe终端设备的更新;a configuration processing module, configured to receive the PCIe configuration request message, and complete the update of the PCIe terminal device according to the PCIe configuration request message; IO处理模块,用于接收PCIe IO请求报文,并根据所述PCIe IO请求报文控制所述PCIe虚拟化模块和/或至少一个PCIe终端设备进行控制状态寄存器访问以及直接内存访问。An IO processing module, configured to receive a PCIe IO request message, and control the PCIe virtualization module and/or at least one PCIe terminal device to perform control status register access and direct memory access according to the PCIe IO request message. 3.根据权利要求2所述的动态配置PCIe终端设备的系统,其特征在于,所述配置处理模块包括:3. The system for dynamically configuring PCIe terminal equipment according to claim 2, wherein the configuration processing module comprises: 配置报文收发接口,用于接收PCIe事务层报文分发器分发的PCIe配置请求报文,并发送从可编程硬件状态机或CPU配置处理接口接收到的配置应答报文;The configuration packet sending and receiving interface is used to receive the PCIe configuration request packet distributed by the PCIe transaction layer packet distributor, and send the configuration response packet received from the programmable hardware state machine or the CPU configuration processing interface; CPU配置处理接口,用于接收配置报文收发接口转发的PCIe配置请求报文,并发送从所述嵌入式处理器接收的配置应答报文;The CPU configuration processing interface is used to receive the PCIe configuration request message forwarded by the configuration message transceiver interface, and send the configuration response message received from the embedded processor; 可编程硬件状态机,用于接收并解析配置报文收发接口转发的PCIe配置请求报文,并根据解析内容发送预先编程的配置应答报文;The programmable hardware state machine is used to receive and parse the PCIe configuration request message forwarded by the configuration message transceiver interface, and send a pre-programmed configuration response message according to the parsed content; 状态机微序列程序存储单元,用于存储可编程硬件状态机的指令和数据,所述指令和数据从所述CPU配置处理接口写入或读出。The state machine micro-sequence program storage unit is used to store the instructions and data of the programmable hardware state machine, and the instructions and data are written in or read out from the CPU configuration processing interface. 4.根据权利要求2所述的动态配置PCIe终端设备的系统,其特征在于,所述IO处理模块包括:4. The system for dynamically configuring PCIe terminal equipment according to claim 2, wherein the IO processing module comprises: 目标IO报文收发接口,用于接收PCIe事务层报文分发器转发的PCIe IO请求报文,并解析为BAR地址空间存储器读写请求;并用于把控制与状态寄存器CSR模块返回的存储器读写应答封装成IO应答报文,发送给PCIe事务层报文分发器;The target IO message transceiver interface is used to receive the PCIe IO request message forwarded by the PCIe transaction layer message distributor, and parse it into a BAR address space memory read and write request; and used to read and write the memory returned by the control and status register CSR module. The response is encapsulated into an IO response message and sent to the PCIe transaction layer message distributor; CSR模块,用于接收目标IO报文收发接口发送的BAR地址空间存储器读写请求,根据所述BAR地址空间存储器读写请求获取对应的读写请求内容发送给目标IO报文收发接口。The CSR module is configured to receive the read and write request of the BAR address space memory sent by the target IO message sending and receiving interface, obtain the corresponding read and write request content according to the BAR address space memory read and write request, and send it to the target IO message sending and receiving interface. 5.根据权利要求4所述的动态配置PCIe终端设备的系统,其特征在于,所述CSR模块包括:5. The system for dynamically configuring PCIe terminal equipment according to claim 4, wherein the CSR module comprises: BAR地址空间映射管理接口,用于在接收到BAR地址空间存储器读写请求后,提供对应的PCIe终端设备的目标功能对应的BAR地址;The BAR address space mapping management interface is used to provide the BAR address corresponding to the target function of the corresponding PCIe terminal device after receiving the read and write request of the BAR address space memory; BAR地址空间存储器,用于保存和提供BAR地址空间的内容。The BAR address space memory is used to save and provide the contents of the BAR address space. 6.根据权利要求5所述的动态配置PCIe终端设备的系统,其特征在于,所述CSR模块还包括BAR特定地址访问触发器,用于当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及直接寄存器访问DMA请求程序;6. the system of dynamically configuring PCIe terminal equipment according to claim 5, is characterized in that, described CSR module also comprises BAR specific address access trigger, is used for when target BAR address is visited, triggers the possibility of IO processing module. The programming state machine runs the BAR address space memory update routine and the direct register access DMA request routine; 相应地,所述IO处理模块还包括:Correspondingly, the IO processing module further includes: 可编程状态机,用于响应BAR特定地址访问触发器发送的BAR特定地址访问触发信号,并向CSR模块发送BAR的地址空间存储器更新信息;还用于向DMA模块发送DMA请求,接收DMA模块的完成响应;The programmable state machine is used to respond to the BAR specific address access trigger signal sent by the BAR specific address access trigger, and send the BAR address space memory update information to the CSR module; it is also used to send a DMA request to the DMA module and receive the DMA module's complete response; 起始IO报文收发接口,用于接收DMA模块发送的主机内存地址空间存储器读写请求,并将所述主机内存地址空间存储器读写请求封装成PCIe IO请求报文,发送给PCIe事务层报文分发器;并用于把PCIe事务层报文分发器返回的IO应答报文解析为主机内存地址空间存储器读写应答发送给DMA模块;The initial IO message sending and receiving interface is used to receive the host memory address space memory read and write request sent by the DMA module, and encapsulate the host memory address space memory read and write request into a PCIe IO request message, and send it to the PCIe transaction layer to report It is used to parse the IO response message returned by the PCIe transaction layer message distributor into the host memory address space memory read and write response and send it to the DMA module; DMA模块,用于响应可编程状态机的DMA请求,发起命令获取DMA或数据传输DMA操作,向起始IO报文收发接口发送主机内存地址空间存储器读写请求;把从起始IO报文收发接口接收到的主机内存地址空间存储器读写应答内容写入命令缓存或数据缓存。The DMA module is used to respond to the DMA request of the programmable state machine, initiate command acquisition DMA or data transfer DMA operations, and send host memory address space memory read and write requests to the initial IO message transceiver interface; The host memory address space memory read and write response content received by the interface is written to the command buffer or data buffer. 7.一种动态配置PCIe终端设备的方法,应用于权利要求1-6任一项所述的系统,其特征在于,所述方法包括:7. A method for dynamically configuring PCIe terminal equipment, applied to the system according to any one of claims 1-6, wherein the method comprises: 所述系统的PCIe虚拟化模块在主机扫描所述系统下游的PCIe终端设备时接收所述主机发送的PCIe配置请求报文;The PCIe virtualization module of the system receives the PCIe configuration request message sent by the host when the host scans the PCIe terminal equipment downstream of the system; 所述PCIe虚拟化模块的配置处理模块对所述PCIe配置请求报文回复PCIe配置应答报文,其中,所述配置应答报文由所述系统的嵌入式处理器与外部配置管理服务器协商生成,多个所述配置应答报文的生成顺序由嵌入式处理器确定;The configuration processing module of the PCIe virtualization module replies with a PCIe configuration response message to the PCIe configuration request message, wherein the configuration response message is generated by negotiation between the embedded processor of the system and an external configuration management server, The generation sequence of a plurality of the configuration response messages is determined by the embedded processor; 所述系统的PCIe虚拟化模块接收所述主机发送的PCIe IO请求报文,其中所述PCIe IO请求报文包含下游的PCIe终端设备对应的BAR地址空间存储器读写请求;The PCIe virtualization module of the system receives a PCIe IO request message sent by the host, wherein the PCIe IO request message includes a BAR address space memory read and write request corresponding to a downstream PCIe terminal device; 所述PCIe虚拟化模块的IO处理模块对所述PCIe IO请求报文回复IO应答报文,其中所述IO应答报文包括BAR地址空间存储器存储的内容。The IO processing module of the PCIe virtualization module replies with an IO response message to the PCIe IO request message, where the IO response message includes the content stored in the BAR address space memory. 8.根据权利要求7所述的动态配置PCIe终端设备的方法,其特征在于,所述方法还包括:8. The method for dynamically configuring a PCIe terminal device according to claim 7, wherein the method further comprises: 当目标BAR地址被访问时,触发IO处理模块的可编程状态机运行BAR地址空间存储器更新程序以及DMA请求程序。When the target BAR address is accessed, the programmable state machine of the IO processing module is triggered to run the BAR address space memory update procedure and the DMA request procedure. 9.根据权利要求7所述的动态配置PCIe终端设备的方法,其特征在于,所述方法还包括:9. The method for dynamically configuring a PCIe terminal device according to claim 7, wherein the method further comprises: 启动所述系统的外部调试器;start an external debugger for the system; 所述外部调试器通过所述PCIe虚拟化模块提供的调试接口,代替所述PCIe虚拟化模块进行PCIe配置和IO调用的调试;The external debugger performs the debugging of PCIe configuration and IO call in place of the PCIe virtualization module through the debugging interface provided by the PCIe virtualization module; 在目标类型的PCIe终端设备调试完成后,修改所述PCIe虚拟化模块中用于支持所述目标类型的PCIe终端设备的程序。After the debugging of the PCIe terminal device of the target type is completed, modify the program in the PCIe virtualization module for supporting the PCIe terminal device of the target type. 10.根据权利要求7所述的动态配置PCIe终端设备的方法,其特征在于,所述方法还包括:10. The method for dynamically configuring a PCIe terminal device according to claim 7, wherein the method further comprises: 由所述PCIe虚拟化模块的配置处理模块的可编程硬件状态机,代替所述嵌入式处理器与外部配置管理服务器的协商过程,生成所述配置应答报文;The configuration response message is generated by the programmable hardware state machine of the configuration processing module of the PCIe virtualization module, instead of the negotiation process between the embedded processor and the external configuration management server; 若所述PCIe配置请求报文为未定义类型,则根据所述嵌入式处理器与外部配置管理服务器的协商,代替所述可编程状态机生成所述配置应答报文。If the PCIe configuration request message is of an undefined type, the configuration response message is generated instead of the programmable state machine according to the negotiation between the embedded processor and the external configuration management server.
CN202111140694.5A 2021-09-28 2021-09-28 A system and method for dynamically configuring PCIe terminal equipment Active CN113904938B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111140694.5A CN113904938B (en) 2021-09-28 2021-09-28 A system and method for dynamically configuring PCIe terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111140694.5A CN113904938B (en) 2021-09-28 2021-09-28 A system and method for dynamically configuring PCIe terminal equipment

Publications (2)

Publication Number Publication Date
CN113904938A CN113904938A (en) 2022-01-07
CN113904938B true CN113904938B (en) 2022-04-29

Family

ID=79029721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111140694.5A Active CN113904938B (en) 2021-09-28 2021-09-28 A system and method for dynamically configuring PCIe terminal equipment

Country Status (1)

Country Link
CN (1) CN113904938B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114444030A (en) * 2022-01-13 2022-05-06 南京芯驰半导体科技有限公司 PCIe interconnection-based heterogeneous virtualization system and method
CN115632976A (en) * 2022-10-25 2023-01-20 深圳市楠菲微电子有限公司 PCIE transaction layer message generation method, device and storage medium
CN115529275B (en) * 2022-11-28 2023-04-07 中国人民解放军国防科技大学 Message processing system and method
CN116208536B (en) * 2023-01-12 2024-07-02 中国人民解放军国防科技大学 A lightweight in-band telemetry device and method for high-speed interconnection network
CN115857995B (en) * 2023-02-08 2023-05-16 珠海星云智联科技有限公司 Method, medium and computing device for upgrading interconnection device
CN115904520B (en) * 2023-03-13 2023-06-06 珠海星云智联科技有限公司 Configuration preservation method based on PCIE topology state change and related equipment
CN116521596B (en) * 2023-06-29 2023-09-22 北京大禹智芯科技有限公司 PCIe Switch simulator realization method and device based on Qemu virtual environment
CN116501666B (en) * 2023-06-29 2023-09-01 北京大禹智芯科技有限公司 Implementation method of PCIe Switch simulator
CN117743212B (en) * 2024-02-19 2024-09-17 北京光润通科技发展有限公司 PCIe IP card verification method and system for PCIe device with multiple physical functions based on FPGA
CN118093481B (en) * 2024-04-17 2024-08-13 芯潮流(珠海)科技有限公司 Method and device for realizing computer interface expansion switching
CN118400415B (en) * 2024-04-17 2025-02-18 中国电子信息产业集团有限公司第六研究所 A PCIE node reverse management processing system and method
CN120994602A (en) * 2025-08-08 2025-11-21 上海光羽芯辰科技有限公司 PCIe Switch System and PCIe Switch

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9996484B1 (en) * 2014-09-17 2018-06-12 Amazon Technologies, Inc. Hardware acceleration for software emulation of PCI express compliant devices
CN110489365A (en) * 2016-01-13 2019-11-22 华为技术有限公司 Switching equipment, peripheral component interconnection high-speed system and initialization method thereof
CN110659245A (en) * 2018-06-29 2020-01-07 英特尔公司 System with programmable multi-context accelerator circuitry
CN112559120A (en) * 2019-09-26 2021-03-26 无锡江南计算技术研究所 Customized PCIE bus IO virtualization supporting method
US11106616B1 (en) * 2019-11-21 2021-08-31 Xilinx, Inc. Virtualized peripheral component interconnect express (PCIe) device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102707991B (en) * 2012-05-17 2016-03-30 中国科学院计算技术研究所 The many virtual shared method and systems of I/O
EP3654620B1 (en) * 2016-11-09 2022-03-09 Huawei Technologies Co., Ltd. Packet processing method in cloud computing system, host, and system
CN113312143B (en) * 2021-03-03 2024-01-23 阿里巴巴新加坡控股有限公司 Cloud computing system, command processing method and virtualization simulation device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9996484B1 (en) * 2014-09-17 2018-06-12 Amazon Technologies, Inc. Hardware acceleration for software emulation of PCI express compliant devices
CN110489365A (en) * 2016-01-13 2019-11-22 华为技术有限公司 Switching equipment, peripheral component interconnection high-speed system and initialization method thereof
CN110659245A (en) * 2018-06-29 2020-01-07 英特尔公司 System with programmable multi-context accelerator circuitry
CN112559120A (en) * 2019-09-26 2021-03-26 无锡江南计算技术研究所 Customized PCIE bus IO virtualization supporting method
US11106616B1 (en) * 2019-11-21 2021-08-31 Xilinx, Inc. Virtualized peripheral component interconnect express (PCIe) device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于PCIe的多路传输系统的DMA控制器设计;李胜蓝等;《计算机应用》;20170310(第03期);参见全文 *

Also Published As

Publication number Publication date
CN113904938A (en) 2022-01-07

Similar Documents

Publication Publication Date Title
CN113904938B (en) A system and method for dynamically configuring PCIe terminal equipment
US11829309B2 (en) Data forwarding chip and server
JP3601955B2 (en) Data transfer method and computer system suitable for it
CN114020655A (en) Memory expansion method, device, equipment and storage medium
CN114546913B (en) Method and device for high-speed data interaction between multiple hosts based on PCIE interface
CN103198042A (en) PCI (programmable communications interface) aviation serial bus board and dynamic data loading processing method
JP6498844B2 (en) Computer device and method for reading / writing data by computer device
WO2025077279A1 (en) Server management method, device and apparatus, non-volatile readable storage medium, and electronic device
CN116521324B (en) Interrupt virtualization processing method and device and electronic equipment
CN118606079B (en) A communication method and system based on socket interface
CN110362274A (en) A kind of NVMe controller, networked storage devices and system
CN106534178A (en) Realization system and method of RapidIO network universal socket
CN108287804B (en) I2C controller driving method and system
WO2024082944A1 (en) Method and apparatus for data exchange between multiple processors, device, and storage medium
CN117971748A (en) A communication method, conversion circuit and computer equipment
CN115421795A (en) Software and hardware cooperative multi-port storage acceleration system
CN118838858A (en) Data processing system, data processing method, computer device, and storage medium
CN117971743A (en) Embedded platform synchronous communication system and method based on bus structure
CN116594951B (en) FPGA-based data transmission system and method
CN112817899B (en) PCIE-based data transmission method and device, storage medium and electronic equipment
CN114519068A (en) Embedded software control behavior verification platform and method based on interrupt driven model
CN118409712A (en) A RAID card management system, method, device, product and medium
JP6965943B2 (en) Configuration management device, configuration management system, configuration management method, and configuration management program
CN118626424A (en) Logical port management method, device, equipment and medium
CN117519955B (en) Control method, system and device of acceleration equipment and acceleration equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant