CN116069453A - a simulation system - Google Patents
a simulation system Download PDFInfo
- Publication number
- CN116069453A CN116069453A CN202310351183.0A CN202310351183A CN116069453A CN 116069453 A CN116069453 A CN 116069453A CN 202310351183 A CN202310351183 A CN 202310351183A CN 116069453 A CN116069453 A CN 116069453A
- Authority
- CN
- China
- Prior art keywords
- module
- unit
- simulation
- storage medium
- management
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/40—Bus structure
- G06F13/4004—Coupling between buses
- G06F13/4022—Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F5/00—Methods or arrangements for data conversion without changing the order or content of the data handled
- G06F5/06—Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor
- G06F5/065—Partitioned buffers, e.g. allowing multiple independent queues, bidirectional FIFO's
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0026—PCI express
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computer Hardware Design (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域technical field
本申请涉及仿真领域,具体涉及一种仿真系统。The present application relates to the field of simulation, and in particular to a simulation system.
背景技术Background technique
如图1所示,现有方案在进行NVMe设备仿真时,通常是使用KVM进行CPU单元的仿真,构建可执行环境(可执行环境一般包括可以执行指令的CPU,内存,cache,总线设备),Qemu进行外设仿真,在Host OS的基础上,创建虚拟化环境,运行Guest OS,需要使用仿真NVMe设备的用户程序和NVMe驱动运行在Guest OS中,NVMe控制器模拟器运行在Host OS的Qemu进程中。As shown in Figure 1, when performing NVMe device simulation, the existing solutions usually use KVM to simulate the CPU unit and build an executable environment (the executable environment generally includes CPU, memory, cache, and bus devices that can execute instructions). Qemu performs peripheral emulation, creates a virtualized environment on the basis of the Host OS, and runs the Guest OS. It needs to use the user program and NVMe driver of the simulated NVMe device to run in the Guest OS, and the NVMe controller emulator runs in Qemu of the Host OS. in progress.
但是对于Guest OS的NVMe驱动来说,NVMe控制器模拟器是一种模拟设备。而真实的NVMe设备包括PCIE-EP接口,带有处理器、内存、Cache、总线的NVMe控制器,存储介质以及内存,该控制器用于提供一个用来执行NVMe控制器内部固件程序的可执行环境。对于NVMe控制器芯片内部的固件程序在进行仿真测试时,由于NVMe控制器模拟器内部没有提供能够支持NVMe设备控制器固件运行需要的独立软件可执行环境,是无法做到对控制器固件进行仿真调试验证。But for the NVMe driver of the Guest OS, the NVMe controller emulator is a simulated device. The real NVMe device includes a PCIE-EP interface, an NVMe controller with a processor, memory, Cache, bus, storage media, and memory. The controller is used to provide an executable environment for executing the internal firmware program of the NVMe controller. . For the firmware program inside the NVMe controller chip, when performing simulation tests, since the NVMe controller simulator does not provide an independent software executable environment that can support the operation of the NVMe device controller firmware, it is impossible to simulate the controller firmware. Debug verification.
发明内容Contents of the invention
有鉴于此,为了克服上述问题的至少一个方面,本申请实施例提出一种仿真系统,所述仿真系统用于NVME设备仿真,包括:In view of this, in order to overcome at least one aspect of the above problems, an embodiment of the present application proposes a simulation system, which is used for NVME device simulation, including:
虚拟主机;virtual host;
控制器仿真模型,包括用于运行待仿真的固件的可执行单元和若干个功能单元,所述可执行单元包括中断管理模块、软件引擎模块、总线仿真模块、缓存仿真模块以及内存仿真模块,其中,所述总线仿真模块用于实现所述可执行单元与每一个所述功能单元的互联;The controller simulation model includes an executable unit and several functional units for running the firmware to be simulated, and the executable unit includes an interrupt management module, a software engine module, a bus simulation module, a cache simulation module and a memory simulation module, wherein , the bus emulation module is used to realize the interconnection between the executable unit and each of the functional units;
消息转发模块,用于连接所述虚拟主机与所述控制器仿真模型。A message forwarding module, configured to connect the virtual host and the controller simulation model.
其中,所述控制器仿真模型还用于基于所述待仿真的固件对所述虚拟主机发送的消息进行处理以对所述待仿真的固件进行仿真。Wherein, the controller simulation model is further used to process a message sent by the virtual host based on the firmware to be simulated to simulate the firmware to be simulated.
在一些实施例中,消息转发模块包括代理模块和接入模块;In some embodiments, the message forwarding module includes a proxy module and an access module;
所述代理模块用于封装所述虚拟主机发送的消息并发送到所述接入模块,以及接收并解析所述接入模块发送的消息后发送到所述虚拟主机;The agent module is used for encapsulating the message sent by the virtual host and sending it to the access module, and receiving and parsing the message sent by the access module and sending it to the virtual host;
所述接入模块用于接收并解析所述代理模块发送的消息后发送到所述控制器仿真模型,以及封装所述控制器仿真模型的发送的消息并发送到所述代理模块。The access module is used for receiving and analyzing the message sent by the agent module and sending it to the controller simulation model, and encapsulating the message sent by the controller simulation model and sending it to the agent module.
在一些实施例中,所述代理模块和所述虚拟主机运行在第一进程。In some embodiments, the proxy module and the virtual host run in a first process.
在一些实施例中,所述接入模块和所述控制器仿真模型运行在第二进程。In some embodiments, the access module and the controller simulation model run in a second process.
在一些实施例中,所述仿真系统还包括:In some embodiments, the simulation system also includes:
存储介质仿真模型,包括属性获取操作接口、设置操作接口、读取操作接口、写入操作接口。Storage medium simulation model, including attribute acquisition operation interface, setting operation interface, reading operation interface, and writing operation interface.
在一些实施例中,所述属性获取操作接口和所述设置操作接口供所述待仿真的固件调用,所述读取操作接口和写入操作接口供所述控制器仿真模型做数据读写使用。In some embodiments, the attribute acquisition operation interface and the setting operation interface are used by the firmware to be simulated, and the read operation interface and write operation interface are used by the controller simulation model for data reading and writing. .
在一些实施例中,所述功能单元包括PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元,所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元和所述可执行单元之间互联;In some embodiments, the functional unit includes a PCIE interface unit, an NVMe core unit, a storage medium unit, and a commissioning and tracking unit, the PCIE interface unit, the NVMe core unit, the storage medium unit, the commissioning interconnection between the tracking unit and the executable unit;
其中,所述PCIe接口单元与所述消息转发模块连接,用于模拟PCIe总线、模拟读写PCIe配置空间、传输总线数据以及处理消息信号中断或扩展的消息信号中断;Wherein, the PCIe interface unit is connected to the message forwarding module for simulating the PCIe bus, simulating reading and writing of the PCIe configuration space, transmitting bus data, and processing message signal interruption or extended message signal interruption;
所述NVMe核心单元用于处理配置寄存器的读写、将管理命令转发给所述可执行单元、处理IO命令、处理门铃、搬移DMA数据;The NVMe core unit is used to process the reading and writing of configuration registers, forward management commands to the executable unit, process IO commands, process doorbells, and move DMA data;
所述存储介质单元还与所述存储介质仿真模型连接,用于向所述核心单元提供控制管理接口和IO数据接口以对所述存储介质仿真模型进行访问;The storage medium unit is also connected to the storage medium simulation model for providing a control management interface and an IO data interface to the core unit to access the storage medium simulation model;
所述调测跟踪单元为所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元和所述可执行单元提供打印和日志控制管理和输出功能。The commissioning and tracking unit provides print and log control management and output functions for the PCIE interface unit, the NVMe core unit, the storage medium unit and the executable unit.
在一些实施例中,所述中断管理模块用于提供中断功能;In some embodiments, the interrupt management module is used to provide an interrupt function;
所述软件引擎模块提供所述运行环境并执行所述待仿真的固件;The software engine module provides the operating environment and executes the firmware to be simulated;
所述总线仿真模块用于实现所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元和所述可执行单元之间的互联;The bus emulation module is used to realize the interconnection between the PCIE interface unit, the NVMe core unit, the storage medium unit, the commissioning and tracking unit and the executable unit;
所述缓存仿真模块用于向所述软件引擎模块提供缓存功能;The cache emulation module is used to provide a cache function to the software engine module;
所述内存仿真模块用于向所述软件引擎模块提供内存功能。The memory emulation module is used to provide memory functions to the software engine module.
在一些实施例中,所述软件引擎模块用于接收所述管理命令,将所述管理命令保存到基于所述待仿真的固件配置的缓存位置并触发中断以通知所述待仿真的固件处理。In some embodiments, the software engine module is configured to receive the management command, save the management command to a cache location configured based on the firmware to be simulated, and trigger an interrupt to notify the firmware to be simulated to process.
在一些实施例中,所述待仿真的固件收到所述中断后,读取并处理所述缓存位置中的管理命令,其中所述管理命令包括创建或删除用于数据输入输出的递交队列的命令、创建或删除用于数据输入输出的完成队列的命令、获取命名空间信息的命令、获取特性的命令、设置特性的命令。In some embodiments, after the firmware to be emulated receives the interrupt, it reads and processes the management command in the cache location, wherein the management command includes creating or deleting a submission queue for data input and output commands, commands to create or delete completion queues for data input and output, commands to get namespace information, commands to get properties, and commands to set properties.
在一些实施例中,所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元分别向所述总线仿真模块注册发起方接口的套接字和目标方接口的套接字,以实现各个单元之间的互联访问。In some embodiments, the PCIE interface unit, the NVMe core unit, the storage medium unit, and the commissioning and tracking unit register the socket of the initiator interface and the socket of the target interface with the bus emulation module respectively. Sockets to realize the interconnection access between each unit.
在一些实施例中,所述PCIE接口单元还包括PCIe接口模块和PCIe寄存器模块。In some embodiments, the PCIE interface unit further includes a PCIe interface module and a PCIe register module.
在一些实施例中,所述PCIe接口模块用于模拟PCIe总线的模拟和传输总线数据,以将所述虚拟主机发送的消息传递给所述NVMe核心单元以及将所述NVMe核心单元发送的消息传递给所述虚拟主机。In some embodiments, the PCIe interface module is used to simulate the simulation of the PCIe bus and transmit bus data, so as to pass the message sent by the virtual host to the NVMe core unit and the message sent by the NVMe core unit to the virtual host.
在一些实施例中,所述PCIe寄存器模块用于模拟读写PCIe配置空间、保存所述虚拟主机对消息信号中断或扩展的消息信号中断的配置信息。In some embodiments, the PCIe register module is used for simulating reading and writing of the PCIe configuration space, and saving the configuration information of the virtual host for the message signal interrupt or the extended message signal interrupt.
在一些实施例中,所述NVMe核心单元包括NVMe寄存器模块、用于管理的递交队列模块、用于管理的完成队列模块、用于数据输入输出的递交队列模块、用于数据输入输出的完成队列模块、存储模块、门铃触发模块、中断触发模块、DMA数据传输模块。In some embodiments, the NVMe core unit includes an NVMe register module, a submission queue module for management, a completion queue module for management, a submission queue module for data input and output, and a completion queue for data input and output module, storage module, doorbell trigger module, interrupt trigger module, DMA data transmission module.
在一些实施例中,所述NVMe寄存器模块用于处理NVMe配置寄存器的读写。In some embodiments, the NVMe register module is used to handle reading and writing of NVMe configuration registers.
在一些实施例中,所述门铃触发模块用于接收来自所述主机的门铃操作,并根据所述门铃操作对应的队列,通知用于管理的递交队列模块或用于数据输入输出的递交队列模块进行处理。In some embodiments, the doorbell trigger module is used to receive the doorbell operation from the host, and notify the delivery queue module for management or the delivery queue module for data input and output according to the queue corresponding to the doorbell operation to process.
在一些实施例中,所述用于管理的递交队列模块用于将管理的递交队列的入口对应的管理命令封装为总线级事务请求并发送给所述可执行单元处理;In some embodiments, the management delivery queue module is configured to package the management command corresponding to the entry of the management delivery queue into a bus-level transaction request and send it to the executable unit for processing;
所述用于管理的完成队列模块用于将所述可执行单元对所述管理的递交队列的入口对应的管理命令的处理结果放入用于管理的完成队列的入口,并调用所述中断触发模块通知所述虚拟主机。The completion queue module for management is used to put the execution unit's processing result of the management command corresponding to the entry of the delivery queue for management into the entry of the completion queue for management, and call the interrupt trigger module notifies the virtual host.
在一些实施例中,所述DMA数据传输模块用于根据所述门铃触发模块进行数据搬移或将所述用于管理的完成队列的入口的处理结果搬移到所述虚拟主机。In some embodiments, the DMA data transmission module is configured to perform data transfer according to the doorbell trigger module or transfer the processing result of the entry of the completed queue for management to the virtual host.
在一些实施例中,所述用于数据输入输出的递交队列模块用于处理用于数据输入输出的递交队列的入口对应的IO命令;In some embodiments, the submission queue module for data input and output is used to process the IO command corresponding to the entry of the submission queue for data input and output;
所述用于数据输入输出的完成队列模块用于处理用于数据输入输出的递交队列的入口对应的IO命令的处理结果,并放入用于数据输入输出的完成队列的入口,并调用所述中断触发模块通知所述虚拟主机;The completion queue module for data input and output is used to process the processing result of the IO command corresponding to the entry of the submission queue for data input and output, and put it into the entry of the completion queue for data input and output, and call the The interrupt trigger module notifies the virtual host;
所述存储模块用于创建存储空间,并基于所述IO命令向所述存储空间写入数据和/或从所述存储空间读取数据。The storage module is used for creating a storage space, and writing data into and/or reading data from the storage space based on the IO command.
在一些实施例中,所述存储介质单元包括存储介质模型框架模块,存储介质控制模块和存储介质I/O模块。In some embodiments, the storage medium unit includes a storage medium model framework module, a storage medium control module and a storage medium I/O module.
在一些实施例中,所述存储介质模型框架模块提供控制管理接口和IO数据接口以对所述存储介质仿真模型进行访问;In some embodiments, the storage medium model framework module provides a control management interface and an IO data interface to access the storage medium simulation model;
所述存储介质控制模块用于提供存储介质控制信息;The storage medium control module is used to provide storage medium control information;
所述存储介质I/O模块用于提供存储介质数据IO操作。The storage medium I/O module is used for providing storage medium data IO operations.
在一些实施例中,所述调测跟踪单元包括寄存器操作模块,打印和日志控制模块以及单元测试管理模块。In some embodiments, the commissioning and tracking unit includes a register operation module, a printing and log control module, and a unit test management module.
在一些实施例中,所述寄存器操作模块对所述可执行单元、所述PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元中的寄存器发起读写访问;In some embodiments, the register operation module initiates read and write access to registers in the executable unit, the PCIE interface unit, the NVMe core unit, the storage medium unit, and the commissioning and tracking unit;
所述打印和日志控制模块用于提供打印控制和日志控制;The print and log control module is used to provide print control and log control;
所述单元测试模块用于提供所述可执行单元、所述PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元的测试入口,并用于处理单元测试命令。The unit test module is used to provide test entries of the executable unit, the PCIE interface unit, the NVMe core unit, the storage medium unit and the commissioning and tracking unit, and is used to process unit test commands.
本申请具有以下有益技术效果之一:本申请提出的方案在控制器仿真模型中设置用于运行待仿真的固件的可执行单元,可执行单元包括中断管理模块、软件引擎模块、总线仿真模块、缓存仿真模块以及内存仿真模块,其中,总线仿真模块用于实现可执行单元与每一个功能单元的互联。这样通过可执行单元提供能够支持NVMe设备控制器固件运行需要的独立软件可执行环境,从而能够独立设计开发调测控制器内部固件。The present application has one of the following beneficial technical effects: the scheme proposed by the present application sets an executable unit for running the firmware to be simulated in the controller simulation model, and the executable unit includes an interrupt management module, a software engine module, a bus simulation module, A cache emulation module and a memory emulation module, wherein the bus emulation module is used to realize the interconnection between the executable unit and each functional unit. In this way, the executable unit provides an independent software executable environment that can support the running needs of the NVMe device controller firmware, so that the internal firmware of the commissioning controller can be independently designed and developed.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present application, and those skilled in the art can obtain other embodiments according to these drawings without creative efforts.
图1为现有技术中的仿真系统的框图;Fig. 1 is the block diagram of the simulation system in the prior art;
图2为本申请的一些实施例提供的仿真系统的框图;FIG. 2 is a block diagram of a simulation system provided by some embodiments of the present application;
图3为本申请的一些实施例提供的仿真系统在操作系统中的示意图;Fig. 3 is a schematic diagram of the simulation system provided by some embodiments of the present application in the operating system;
图4为本申请的一些实施例提供的控制器仿真模型的示意图;4 is a schematic diagram of a controller simulation model provided by some embodiments of the present application;
图5为本申请的一些实施例提供的可执行单元的示意图;Fig. 5 is a schematic diagram of executable units provided by some embodiments of the present application;
图6为本申请的一些实施例提供的PCIE接口单元的示意图;Fig. 6 is the schematic diagram of the PCIE interface unit that some embodiments of the present application provide;
图7为本申请的一些实施例提供的NVME核心单元的示意图;Fig. 7 is a schematic diagram of the NVME core unit provided by some embodiments of the present application;
图8为本申请的一些实施例提供的存储介质单元的示意图;FIG. 8 is a schematic diagram of a storage medium unit provided by some embodiments of the present application;
图9为本申请的一些实施例提供的调测跟踪单元的示意图;FIG. 9 is a schematic diagram of a commissioning and tracking unit provided by some embodiments of the present application;
图10为本申请的一些实施例提供的仿真系统运行示意图。Fig. 10 is a schematic diagram of the operation of the simulation system provided by some embodiments of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本申请的一些实施例进一步详细说明。In order to make the purpose, technical solutions and advantages of the present application clearer, some embodiments of the present application will be further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
需要说明的是,本申请的一些实施例中所有使用“第一”和“第二”的表述均是为了区分两个相同名称非相同的实体或者非相同的参量,可见“第一”“第二”仅为了表述的方便,不应理解为对本申请实施例的限定,后续实施例对此不再一一说明。It should be noted that in some embodiments of the present application, all the expressions of "first" and "second" are used to distinguish two entities with the same name but different parameters or different parameters. It can be seen that "first" and "second" "two" is only for the convenience of expression, and should not be understood as a limitation on the embodiment of the present application, and the subsequent embodiments will not explain it one by one.
在本申请的一些实施例中出现的英文缩写具有如下定义:English abbreviations appearing in some embodiments of the present application have the following definitions:
Admin CQ:用于管理的完成队列,常用ACQ表示;Admin CQ: The completion queue used for management, commonly expressed as ACQ;
Admin SQ:用于管理的递交队列,常用ASQ表示;Admin SQ: Submission queue for management, often expressed as ASQ;
BAR:Base Address Register基地址寄存器,PCIe协议中保存窗口基地址的寄存器;BAR: Base Address Register base address register, the register that saves the window base address in the PCIe protocol;
Cache:高速缓存;Cache: cache;
CPU:中央处理器,作为计算机系统的运算和控制核心,是信息处理、程序运行的最终执行单元;CPU: Central processing unit, as the computing and control core of the computer system, is the final execution unit of information processing and program operation;
CQ:Completion Queue 完成队列;CQ: Completion Queue completion queue;
CQE:Completion Queue Entry 完成队列入口;CQE: Completion Queue Entry completes the queue entry;
DB:Doorbell,门铃;DB: Doorbell, doorbell;
DMA:Direct Memory Access直接内存访问;DMA: Direct Memory Access direct memory access;
FIFO:First In/First Out先入先出队列;FIFO: First In/First Out queue;
FW: Firmware 固件,一种芯片内部工作的程序,因为固化在芯片内部,通常称为固件;FW: Firmware firmware, a program that works inside a chip, because it is solidified inside the chip, it is usually called firmware;
Get Feature命令:NVMe协议定义的一种命令,用来获取NVMe控制器的特定属性信息;Get Feature command: A command defined by the NVMe protocol to obtain specific attribute information of the NVMe controller;
Guest OS:通常指基于主机操作系统运行的虚拟机的操作系统;Guest OS: usually refers to the operating system of the virtual machine based on the host operating system;
Host:一般指主机或宿主机;Host: generally refers to the host or host;
Host OS:主机操作系统;Host OS: host operating system;
Identify 命令:NVMe协议定义的一种命令,用来获取NVMe控制器的一些信息;Identify command: A command defined by the NVMe protocol to obtain some information about the NVMe controller;
IO: Input /Output ,通常指数据输入输出;IO: Input /Output, usually refers to data input and output;
IO SQ:用于数据输入输出的递交队列;IO SQ: Submission queue for data input and output;
IO CQ:用于数据输入输出的完成队列;IO CQ: Completion queue for data input and output;
KVM:一种虚拟化CPU技术;KVM: a virtualization CPU technology;
LBA: Logical Block Address 逻辑区块地址;LBA: Logical Block Address Logical block address;
Memory:内存;Memory: memory;
MSI: Message Signaled Interrupt 消息信号中断;MSI: Message Signaled Interrupt message signal interrupt;
MSI-X: 扩展的消息信号中断;MSI-X: extended message signal interrupt;
NVMe:Non Volatile Memory Express,非易失性内存接口规范,是一个逻辑设备接口规范,基于设备逻辑接口的总线传输协议规范(相当于通讯协议中的应用层);NVMe: Non Volatile Memory Express, non-volatile memory interface specification, is a logical device interface specification, a bus transmission protocol specification based on the device logic interface (equivalent to the application layer in the communication protocol);
PCIe:Peripheral Component Interconnect Express是一种高速串行计算机扩展总线标准;PCIe: Peripheral Component Interconnect Express is a high-speed serial computer expansion bus standard;
PCIe-EP:PCIe EndPoint,PCIe端节点;PCIe-EP: PCIe EndPoint, PCIe end node;
PCIe-RC:PCIe RootComplex,PCIe根节点;PCIe-RC: PCIe RootComplex, PCIe root node;
PRP:Physical Region Page,在NVMe协议中用来保存数据的内存页面;PRP: Physical Region Page, the memory page used to save data in the NVMe protocol;
Qemu:QuickEmulator 纯软件实现的虚拟化模拟器,可以模拟硬件设备sc_event:SystemC库中定义的一种事件模型;Qemu: QuickEmulator is a pure software virtualization simulator that can simulate hardware devices sc_event: an event model defined in the SystemC library;
sc_fifo:SystemC库中定义的一种FIFO模型;sc_fifo: A FIFO model defined in the SystemC library;
sc_thread:SystemC库中定义的一种线程模型;sc_thread: A threading model defined in the SystemC library;
Set Feature命令:NVMe协议定义的一种命令,用来设置NVMe控制器的特定属性信息;Set Feature command: A command defined by the NVMe protocol, used to set specific attribute information of the NVMe controller;
SGL:Scatter/Gather List 分散/汇聚列表,本文中指在NVMe协议中用来保存数据的内存页面的组织格式;SGL: Scatter/Gather List Scatter/gather list, in this article refers to the organizational format of memory pages used to save data in the NVMe protocol;
SQ:Submission Queue 递交队列;SQ: Submission Queue submission queue;
SQE:Submission Queue Entry 递交队列的入口;SQE: Submission Queue Entry Submission queue entry;
SQID:Submission Queue ID号递交队列标识;SQID: Submission Queue ID number submission queue identifier;
SystemC:一种C++语言编写的库,常用于仿真建模;SystemC: A library written in C++ language, often used for simulation modeling;
TLM: Transaction-Level Modeling 事务级建模。TLM: Transaction-Level Modeling transaction-level modeling.
根据本申请的一个方面,本申请的实施例提出一种仿真系统,所述仿真系统用于NVME设备仿真,如图2所示,所述仿真系统包括:According to one aspect of the present application, an embodiment of the present application proposes a simulation system, the simulation system is used for NVME device simulation, as shown in Figure 2, the simulation system includes:
虚拟主机;virtual host;
控制器仿真模型,包括用于运行待仿真的固件的可执行单元和若干个功能单元,所述可执行单元包括中断管理模块、软件引擎模块、总线仿真模块、缓存仿真模块以及内存仿真模块,其中,所述总线仿真模块用于实现所述可执行单元与每一个所述功能单元的互联;The controller simulation model includes an executable unit and several functional units for running the firmware to be simulated, and the executable unit includes an interrupt management module, a software engine module, a bus simulation module, a cache simulation module and a memory simulation module, wherein , the bus emulation module is used to realize the interconnection between the executable unit and each of the functional units;
消息转发模块,用于连接所述虚拟主机与所述控制器仿真模型。A message forwarding module, configured to connect the virtual host and the controller simulation model.
其中,所述控制器仿真模型还用于基于所述待仿真的固件对所述虚拟主机发送的消息进行处理以对所述待仿真的固件进行仿真。Wherein, the controller simulation model is further used to process a message sent by the virtual host based on the firmware to be simulated to simulate the firmware to be simulated.
本申请提出的方案在控制器仿真模型中设置用于运行待仿真的固件的可执行单元,通过可执行单元提供能够支持NVMe设备控制器固件运行需要的独立软件可执行环境,从而能够独立设计开发调测控制器内部固件。The scheme proposed in this application sets an executable unit for running the firmware to be simulated in the controller simulation model, and provides an independent software executable environment that can support the operation needs of the NVMe device controller firmware through the executable unit, so that it can be independently designed and developed Debug the internal firmware of the controller.
在一些实施例中,消息转发模块包括代理模块和接入模块;In some embodiments, the message forwarding module includes a proxy module and an access module;
所述代理模块用于封装所述虚拟主机发送的消息并发送到所述接入模块,以及接收并解析所述接入模块发送的消息后发送到所述虚拟主机;The agent module is used for encapsulating the message sent by the virtual host and sending it to the access module, and receiving and parsing the message sent by the access module and sending it to the virtual host;
所述接入模块用于接收并解析所述代理模块发送的消息后发送到所述控制器仿真模型,以及封装所述控制器仿真模型的发送的消息并发送到所述代理模块。The access module is used for receiving and analyzing the message sent by the agent module and sending it to the controller simulation model, and encapsulating the message sent by the controller simulation model and sending it to the agent module.
在一些实施例中,所述代理模块和所述虚拟主机运行在第一进程。In some embodiments, the proxy module and the virtual host run in a first process.
在一些实施例中,所述接入模块和所述控制器仿真模型运行在第二进程。In some embodiments, the access module and the controller simulation model run in a second process.
具体的,如图3所示,虚拟主机运行在Qemu进程(第一进程),虚拟主机的操作系统(Guest OS)上具有NVME设备接口并具有KVM虚拟化可执行环境(包括虚拟化CPU、内存、cache、总线),并运行有用户应用,通过Qemu虚拟化接口与代理模块通信,代理模块通过进程间通信与运行在NVME控制器模拟器进程(第二进程)的代理模块实现互联。Specifically, as shown in Figure 3, the virtual host runs on the Qemu process (the first process), and the operating system (Guest OS) of the virtual host has an NVME device interface and a KVM virtualized executable environment (including virtualized CPU, memory , cache, bus), and run user applications, communicate with the agent module through the Qemu virtualization interface, and the agent module is interconnected with the agent module running in the NVME controller emulator process (second process) through inter-process communication.
其中代理模块负责将Guest OS对控制器仿真模型模块的请求封装成Host OS进程间通信的消息,传递给NVMe控制器模拟器进程的NVMe控制器模拟器接入模块。在另一个方向上,负责接收NVMe控制器模拟器进程的NVMe控制器模拟器接入模块发来的消息,并进行处理,对接到Guest OS的NVMe设备的响应处理。The proxy module is responsible for encapsulating the Guest OS's request for the controller simulation model module into a host OS inter-process communication message, and passing it to the NVMe controller simulator access module of the NVMe controller simulator process. In the other direction, it is responsible for receiving the message sent by the NVMe controller emulator access module of the NVMe controller emulator process, and processing it, and processing the response of the NVMe device connected to the Guest OS.
接入模块负责接收NVMe控制器模拟器代理模块发送过来的封装消息,将消息解析后,传递给NVMe控制器模拟器进程的NVMe控制器仿真模型模块。在另一个方向上,将NVMe控制器仿真模型模块的请求或响应封装成HostOS的进程间通信的消息,传递给Qemu进程的代理模块。The access module is responsible for receiving the encapsulation message sent by the NVMe controller emulator agent module, and after parsing the message, pass it to the NVMe controller emulation model module of the NVMe controller emulator process. In the other direction, the request or response of the NVMe controller simulation model module is encapsulated into an interprocess communication message of HostOS, and passed to the proxy module of the Qemu process.
在一些实施例中,所述仿真系统还包括:In some embodiments, the simulation system also includes:
存储介质仿真模型,包括属性获取操作接口、设置操作接口、读取操作接口、写入操作接口。Storage medium simulation model, including attribute acquisition operation interface, setting operation interface, reading operation interface, and writing operation interface.
在一些实施例中,所述属性获取操作接口和所述设置操作接口供所述待仿真的固件调用,所述读取操作接口和写入操作接口供所述控制器仿真模型做数据读写使用。In some embodiments, the attribute acquisition operation interface and the setting operation interface are used by the firmware to be simulated, and the read operation interface and write operation interface are used by the controller simulation model for data reading and writing. .
具体的,存储介质仿真模型负责模拟存储介质的属性获取、设置、读取、写入等操作接口。其中,属性获取、设置接口供待仿真的固件调用使用。读取、写入接口供NVMe控制器仿真模型做数据读写使用。Specifically, the storage medium simulation model is responsible for simulating operation interfaces such as attribute acquisition, setting, reading, and writing of the storage medium. Among them, the attribute acquisition and setting interfaces are used by the firmware to be simulated. The read and write interfaces are used for data reading and writing by the NVMe controller simulation model.
在一些实施例中,功能单元包括PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元,所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元和所述可执行单元之间互联;In some embodiments, the functional unit includes a PCIE interface unit, an NVMe core unit, a storage medium unit, and a commissioning and tracking unit, the PCIE interface unit, the NVMe core unit, the storage medium unit, and the commissioning and tracking unit interconnected with the executable unit;
其中,所述PCIe接口单元与所述消息转发模块连接,用于模拟PCIe总线、模拟读写PCIe配置空间、传输总线数据以及处理消息信号中断或扩展的消息信号中断;Wherein, the PCIe interface unit is connected to the message forwarding module for simulating the PCIe bus, simulating reading and writing of the PCIe configuration space, transmitting bus data, and processing message signal interruption or extended message signal interruption;
所述NVMe核心单元用于处理配置寄存器的读写、将管理命令转发给所述可执行单元、处理IO命令、处理门铃、搬移DMA数据;The NVMe core unit is used to process the reading and writing of configuration registers, forward management commands to the executable unit, process IO commands, process doorbells, and move DMA data;
所述存储介质单元还与所述存储介质仿真模型连接,用于向所述核心单元提供控制管理接口和IO数据接口以对所述存储介质仿真模型进行访问;The storage medium unit is also connected to the storage medium simulation model for providing a control management interface and an IO data interface to the core unit to access the storage medium simulation model;
所述调测跟踪单元为所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元和所述可执行单元提供打印和日志控制管理和输出功能。The commissioning and tracking unit provides print and log control management and output functions for the PCIE interface unit, the NVMe core unit, the storage medium unit and the executable unit.
具体的,如图4所示,控制器仿真模型模块负责PCIe总线的模拟、PCIe配置空间读写的模拟,总线数据的传输、MSI/MSI-X中断(消息信号中断、扩展的消息信号中断)的模拟处理、模拟NVMe协议定义的寄存器、负责初始化可执行单元、提供可执行单元程序加载功能、转发NVMe的Amdin命令(管理命令)给待仿真的固件、处理IO命令。Specifically, as shown in Figure 4, the controller simulation model module is responsible for the simulation of the PCIe bus, the simulation of reading and writing of the PCIe configuration space, the transmission of bus data, and MSI/MSI-X interruption (message signal interruption, extended message signal interruption) Simulation processing, simulating the registers defined by the NVMe protocol, responsible for initializing the executable unit, providing the executable unit program loading function, forwarding NVMe Amdin commands (management commands) to the firmware to be simulated, and processing IO commands.
在一些实施例中,NVMe控制器仿真模型的内部初始化,由NVMe控制器仿真模型运行时进行,初始化必要的内部通知信号事件(sc_event类型),内部处理逻辑线程(sc_thread类型),FIFO(sc_fifo类型)等。NVMe控制器仿真模型的寄存器的外部初始化,由外部Qemu进程中的GuestOS的NVMe驱动发起初始化。In some embodiments, the internal initialization of the NVMe controller simulation model is performed when the NVMe controller simulation model is running, and the necessary internal notification signal events (sc_event type), internal processing logic threads (sc_thread type), and FIFO (sc_fifo type) are initialized. )wait. The external initialization of the registers of the NVMe controller simulation model is initiated by the NVMe driver of the GuestOS in the external Qemu process.
控制器仿真模型可以包括可执行单元、PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元,所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元和所述可执行单元之间互联。The controller simulation model may include an executable unit, a PCIE interface unit, an NVMe core unit, a storage medium unit, and a commissioning and tracking unit, the PCIE interface unit, the NVMe core unit, the storage medium unit, the commissioning and tracking unit The unit is interconnected with the executable unit.
其中,PCIe接口单元完成PCIe总线的模拟,PCIe配置空间读写的模拟,总线数据的传输,MSI/MSI-X中断的处理。Among them, the PCIe interface unit completes the simulation of the PCIe bus, the simulation of reading and writing of the PCIe configuration space, the transmission of bus data, and the processing of MSI/MSI-X interrupts.
NVMe核心单元完成NVMe协议的模拟,NVMe协议定义的寄存器的模拟。包括NVMe控制器配置寄存器的读写的处理,将Admin命令的转发给可执行单元上运行的待仿真的固件处理,IO命令的处理,门铃的处理,DMA数据的搬移。The NVMe core unit completes the simulation of the NVMe protocol and the simulation of the registers defined by the NVMe protocol. Including the processing of reading and writing of NVMe controller configuration registers, forwarding Admin commands to the firmware to be simulated running on the executable unit, processing IO commands, processing doorbells, and moving DMA data.
可执行单元负责提供可执行环境,包括模拟CPU,内存,Cache,总线设备,可加载并运行待仿真的固件,完成待仿真的固件的执行,完成总线模型的配置,地址映射,Cache和内存的管理模型的初始化和配置。The executable unit is responsible for providing an executable environment, including simulating the CPU, memory, Cache, and bus devices, loading and running the firmware to be simulated, completing the execution of the firmware to be simulated, and completing the configuration of the bus model, address mapping, Cache and memory. Manage model initialization and configuration.
存储介质单元与所述存储介质仿真模型连接,用于根据存储介质仿真模型的特性,提供通用的存储介质的操作接口。包括控制管理接口和IO数据接口,并将接口提供给NVMe核心单元,模拟完成NVMe控制器对存储介质仿真模型的操作。The storage medium unit is connected with the storage medium simulation model, and is used to provide a common storage medium operation interface according to the characteristics of the storage medium simulation model. It includes control management interface and IO data interface, and provides the interface to the NVMe core unit to simulate and complete the operation of the NVMe controller on the storage medium simulation model.
调测跟踪单元为构成控制器仿真模型的各个单元和模块提供打印和日志控制管理和输出功能,完成打印和日志记录相关功能,用于各个单元和模块的测试和问题定位。The commissioning and tracking unit provides printing and log control management and output functions for each unit and module constituting the controller simulation model, completes printing and log recording related functions, and is used for testing and problem location of each unit and module.
在一些实施例中,所述可执行单元包括中断管理模块、软件引擎模块、总线仿真模块、缓存仿真模块以及内存仿真模块;In some embodiments, the executable unit includes an interrupt management module, a software engine module, a bus emulation module, a cache emulation module, and a memory emulation module;
所述中断管理模块用于提供中断功能;The interrupt management module is used to provide an interrupt function;
所述软件引擎模块提供所述运行环境并执行所述待仿真的固件;The software engine module provides the operating environment and executes the firmware to be simulated;
所述总线仿真模块用于实现所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元和所述可执行单元之间的互联;The bus emulation module is used to realize the interconnection between the PCIE interface unit, the NVMe core unit, the storage medium unit, the commissioning and tracking unit and the executable unit;
所述缓存仿真模块用于向所述软件引擎模块提供缓存功能;The cache emulation module is used to provide a cache function to the software engine module;
所述内存仿真模块用于向所述软件引擎模块提供内存功能。The memory emulation module is used to provide memory functions to the software engine module.
在一些实施例中,所述软件引擎模块用于接收所述管理命令,将所述管理命令保存到基于所述待仿真的固件配置的缓存位置并触发中断以通知所述待仿真的固件处理。In some embodiments, the software engine module is configured to receive the management command, save the management command to a cache location configured based on the firmware to be simulated, and trigger an interrupt to notify the firmware to be simulated to process.
在一些实施例中,所述待仿真的固件收到所述中断后,读取并处理所述缓存位置中的管理命令,其中所述管理命令包括创建或删除用于数据输入输出的递交队列的命令、创建或删除用于数据输入输出的完成队列的命令、获取命名空间信息的命令、获取特性的命令、设置特性的命令。In some embodiments, after the firmware to be emulated receives the interrupt, it reads and processes the management command in the cache location, wherein the management command includes creating or deleting a submission queue for data input and output commands, commands to create or delete completion queues for data input and output, commands to get namespace information, commands to get properties, and commands to set properties.
具体的,如图5所示,可执行单元可以包括中断管理模块,软件引擎模块,总线仿真模块,Cache仿真模块,内存仿真模块。Specifically, as shown in FIG. 5 , the executable unit may include an interrupt management module, a software engine module, a bus simulation module, a Cache simulation module, and a memory simulation module.
其中,中断管理模块负责模拟可执行单元的中断初始化,中断连接,中断触发,中断信号清除等功能。总线仿真模块用于模拟连接软件引擎模块与其他单元各个模块。Cache仿真模块用于为软件引擎模块提供Cache仿真功能。内存仿真模块用于为软件引擎模块提供内存仿真功能。Among them, the interrupt management module is responsible for simulating the interrupt initialization of the executable unit, interrupt connection, interrupt trigger, interrupt signal clearing and other functions. The bus simulation module is used for simulating the connection between the software engine module and each module of other units. The Cache simulation module is used to provide a Cache simulation function for the software engine module. The memory emulation module is used to provide the memory emulation function for the software engine module.
软件引擎模块负责模拟处理器的指令加载和执行,执行自定义固件模块提供的版本文件。软件引擎模块在将待仿真的固件程序加载到模拟CPU的可执行环境后,开始执行待仿真的固件程序。当有总线事务发来的对软件引擎的事务操作时,并将事务内容解析后,根据固件程序配置好的缓冲区位置将内容保存,触发中断通知待仿真的固件进行处理。The software engine module is responsible for simulating the instruction loading and execution of the processor, and executing the version file provided by the custom firmware module. After the software engine module loads the firmware program to be simulated into the executable environment of the simulated CPU, it starts to execute the firmware program to be simulated. When there is a transaction operation on the software engine sent by the bus transaction, after analyzing the transaction content, the content is saved according to the buffer position configured by the firmware program, and an interrupt is triggered to notify the firmware to be simulated to process.
待仿真的固件收到中断后,读取缓冲区的内容,识别NVMe命令类型,并进行处理。处理的Admin 命令可以包括NVMe协议定义的Identify命令(NVMe协议定义的一种命令,用来获取NVMe控制器的一些信息)、Get Feature命令(NVMe协议定义的一种命令,用来获取NVMe控制器的特定属性信息)、Set Feature命令(NVMe协议定义的一种命令,用来设置NVMe控制器的特定属性信息)、创建IO SQ(用于数据输入输出的递交队列)命令、创建IO CQ(用于数据输入输出的完成队列)命令、删除IO SQ命令、删除IO CQ命令、配置门铃缓冲区命令。After the emulated firmware receives the interrupt, it reads the contents of the buffer, identifies the NVMe command type, and processes it. The Admin commands processed can include the Identify command defined by the NVMe protocol (a command defined by the NVMe protocol to obtain some information about the NVMe controller), and the Get Feature command (a command defined by the NVMe protocol to obtain information about the NVMe controller) Specific attribute information), Set Feature command (a command defined by the NVMe protocol, used to set specific attribute information of the NVMe controller), create IO SQ (submission queue for data input and output) command, create IO CQ (use Completion queue for data input and output) command, delete IO SQ command, delete IO CQ command, configure doorbell buffer command.
例如,当收到创建IO SQ命令,读取SQE中的IO SQ的基地址,队列深度,队列ID,队列标识,对应的CQ队列ID,以队列ID为索引保存在本地存储中,设置队列建立标志。当收到创建IO CQ命令,读取SQE中的IO CQ的基地址,队列深度,队列ID,队列标识,对应的中断向量,以队列ID为索引保存在本地存储中,设置队列建立标志。当收到删除IO SQ命令,以队列ID为索引,清除队列建立标志。当收到删除IO CQ命令,以队列ID为索引,清除队列建立标志。当收到Get Feature命令,获取NVMe控制器的配置信息。当收到Set Feature命令,设置NMVe控制器的配置信息。当收到Identify命令,处理NVMe命名空间相关信息与其他信息。For example, when receiving the command to create an IO SQ, read the base address of the IO SQ in the SQE, the queue depth, the queue ID, the queue ID, and the corresponding CQ queue ID, and store them in the local storage with the queue ID as the index, and set the queue establishment sign. When the create IO CQ command is received, read the base address of the IO CQ in the SQE, the queue depth, the queue ID, the queue ID, and the corresponding interrupt vector, store them in the local storage with the queue ID as the index, and set the queue establishment flag. When the delete IO SQ command is received, the queue ID is used as the index to clear the queue establishment flag. When the delete IO CQ command is received, the queue ID is used as the index to clear the queue creation flag. When the Get Feature command is received, the configuration information of the NVMe controller is obtained. When receiving the Set Feature command, set the configuration information of the NMVe controller. When the Identify command is received, process NVMe namespace related information and other information.
待仿真的固件还负责NVMe控制器仿真模型中各个单元的初始化,基于存储介质模型完成垃圾回收、坏块处理、磨损均衡处理等后台任务、完成异常情况处理。另外,待仿真的固件还可以通过可执行单元内部总线地址发起对总线事务访问,完成对NVMe控制器仿真器的寄存器的读写访问。并通过可执行单元内部总线地址发起对总线事务访问,完成对存储介质的属性的获取和设置访问。The firmware to be simulated is also responsible for the initialization of each unit in the NVMe controller simulation model, and completes background tasks such as garbage collection, bad block processing, and wear leveling processing based on the storage medium model, and completes exception handling. In addition, the firmware to be simulated can also initiate access to the bus transaction through the internal bus address of the executable unit, and complete the read and write access to the registers of the NVMe controller emulator. And the bus transaction access is initiated through the internal bus address of the executable unit, and the acquisition and setting access to the attributes of the storage medium are completed.
在一些实施例中,所述PCIE接口单元、所述NVMe核心单元、所述存储介质单元、所述调测跟踪单元分别向所述总线仿真模块注册发起方接口的套接字和目标方接口的套接字,以实现各个单元之间的互联访问。In some embodiments, the PCIE interface unit, the NVMe core unit, the storage medium unit, and the commissioning and tracking unit register the socket of the initiator interface and the socket of the target interface with the bus emulation module respectively. Sockets to realize the interconnection access between each unit.
具体的,控制器仿真模型的各单元之间通过可以通过该总线仿真模块进行互联。Specifically, the units of the controller simulation model can be interconnected through the bus simulation module.
在一些实施例中,可以使用基于SystemC的TLM模型,为每个单元提供发起方接口和目标方接口的套接字,通过SystemC的TLM模型库,将套接字注册到总线仿真模块,由总线仿真模块根据各个单元映射的地址进行事务级分发,完成总线互联事务的仿真,从而实现各个模块之间的互联访问,完成仿真模拟。并且各个单元初始化时,可以初始化仿真单元自身需要的内部事件、内部FIFO、处理线程(sc_thread类型)、初始化等待事件的触发、将仿真单元的目标方接口套接字对应的处理事务级传输处理程序注册到总线目标侧。当有事务到达仿真单元时,仿真单元的目标方套接字对应的事务级传输处理程序会对事务进行解析,并将解析内容保存到仿真单元的FIFO中,然后触发内部事件。事件触发后,SystemC系统会调度处理线程,处理线程会读取FIFO中的内容,完成事件的处理,继续等待下一次事件触发。In some embodiments, the TLM model based on SystemC can be used to provide each unit with the socket of the initiator interface and the target interface. Through the TLM model library of SystemC, the socket is registered to the bus simulation module, and the bus The simulation module performs transaction-level distribution according to the addresses mapped by each unit, and completes the simulation of bus interconnection transactions, thereby realizing the interconnection access between various modules and completing the simulation. And when each unit is initialized, it can initialize the internal events required by the simulation unit itself, the internal FIFO, the processing thread (sc_thread type), initialize the triggering of waiting events, and process the transaction-level transmission processing program corresponding to the target interface socket of the simulation unit Register to the bus target side. When a transaction arrives at the simulation unit, the transaction-level transfer handler corresponding to the target socket of the simulation unit will analyze the transaction, save the analyzed content in the FIFO of the simulation unit, and then trigger an internal event. After the event is triggered, the SystemC system will schedule the processing thread, and the processing thread will read the content in the FIFO, complete the processing of the event, and continue to wait for the next event to be triggered.
这样,通过可执行单元加载固件程序完成管理平面的管理命令的执行,通过NVMe核心单元完成数据平台的IO命令的执行。In this way, the executable unit loads the firmware program to complete the execution of the management plane management command, and the NVMe core unit completes the execution of the data platform IO command.
需要说明的是,上述基于SystemC的事务级模型,构建NVMe控制器模拟系统,基于总线级事务分发,可执行单元访问外设的事务模拟的方法只是为了便于理解本申请的实施方式,并非用以限定本申请,任何在不脱离本申请设计和范围前提下所做的修改与变化,特别是对相关系统示意图、映射关系以及相关软固件框架的修改与变化,均在本申请的保护范围之内。It should be noted that the above-mentioned transaction-level model based on SystemC, the construction of the NVMe controller simulation system, and the bus-level transaction distribution based on the method of transaction simulation of the executable unit accessing peripherals are only for the convenience of understanding the implementation of this application, not for To limit this application, any modifications and changes made without departing from the design and scope of this application, especially the modifications and changes to related system diagrams, mapping relationships, and related software and firmware frameworks, are within the scope of protection of this application .
在一些实施例中,所述PCIE接口单元还包括PCIe接口模块和PCIe寄存器模块。In some embodiments, the PCIE interface unit further includes a PCIe interface module and a PCIe register module.
在一些实施例中,所述PCIe接口模块用于模拟PCIe总线的模拟和传输总线数据,以将所述虚拟主机发送的消息传递给所述NVMe核心单元以及将所述NVMe核心单元发送的消息传递给所述虚拟主机。In some embodiments, the PCIe interface module is used to simulate the simulation of the PCIe bus and transmit bus data, so as to pass the message sent by the virtual host to the NVMe core unit and the message sent by the NVMe core unit to the virtual host.
在一些实施例中,所述PCIe寄存器模块用于模拟读写PCIe配置空间、保存所述虚拟主机对消息信号中断或扩展的消息信号中断的配置信息。In some embodiments, the PCIe register module is used for simulating reading and writing of the PCIe configuration space, and saving the configuration information of the virtual host for the message signal interrupt or the extended message signal interrupt.
具体的,如图6所示,所述PCIE接口单元还包括PCIe接口模块和PCIe寄存器模块。PCIe接口模块负责完成PCIe总线的模拟,总线数据的传输。模拟PCIe EP 控制器对内部配置寄存器的访问,BAR空间的访问;将虚拟主机对PCIe总线上的PCIe设备BAR空间的memory访问转换为对NVMe设备的memory访问,传递给NVMe核心单元;反方向上,完成NVMe核心单元通过PCIe总线对虚拟主机内存访问的模拟。Specifically, as shown in FIG. 6 , the PCIE interface unit further includes a PCIe interface module and a PCIe register module. The PCIe interface module is responsible for completing the simulation of the PCIe bus and the transmission of bus data. Simulate the access of the PCIe EP controller to the internal configuration registers and the BAR space; convert the memory access of the virtual host to the BAR space of the PCIe device on the PCIe bus into the memory access to the NVMe device, and pass it to the NVMe core unit; in the opposite direction, Complete the simulation of the NVMe core unit accessing the memory of the virtual host through the PCIe bus.
PCIe寄存器模块完成虚拟主机对PCIe配置空间读写的模拟, MSI/MSI-X中断的配置和处理。The PCIe register module completes the virtual host's simulation of reading and writing to the PCIe configuration space, and the configuration and processing of MSI/MSI-X interrupts.
其中,PCIe接口模块的地址和目标方接口在初始化阶段可以基于TLM模型注册到可执行单元的总线仿真模块。当qume内部的NVMe控制器仿真模型调用PCIe接口对NVMe设备所在的PCIe设备发起PCIe总线访问时,将PCIe总线访问的类型按照设备寄存器读,寄存器写,地址读,地址写等总线数据传输类型,封装为内部通信报文,调用代理模块通过进程间通信的接口发送给接入模块;接入模块收到后,将报文进行解析,转换为TLM模型的发起方请求,对总线上连接映射的PCIe接口模块的寄存器地址或Memory数据地址发起访问。Wherein, the address of the PCIe interface module and the target interface can be registered in the bus simulation module of the executable unit based on the TLM model in the initialization phase. When the NVMe controller simulation model inside qume calls the PCIe interface to initiate PCIe bus access to the PCIe device where the NVMe device is located, the type of PCIe bus access is based on the device register read, register write, address read, address write and other bus data transmission types, Encapsulate it as an internal communication message, call the proxy module and send it to the access module through the inter-process communication interface; after receiving it, the access module parses the message and converts it into a request from the initiator of the TLM model, and maps the connections on the bus The register address or Memory data address of the PCIe interface module initiates access.
PCIe接口模块在初始化时基于TLM模型将一个用于访问主机地址的内存窗口地址空间和目标方接口注册到可执行单元的总线仿真模块。当NVMe控制器核心单元对虚拟主机地址的发起访问时,通过对用于访问虚拟主机地址的内存窗口地址空间发起事务级访问,触发PCIe接口模块的处理。PCIe接口模块调用NVMe控制器模拟器接入模块将消息发送给主机方向处理。代理模块启动软件进程通过进程间通信接口接收来自接入模块发送来的消息,并将消息转换为对Qemu内部运行的主机地址的操作。The PCIe interface module registers a memory window address space for accessing the host address and the target interface to the bus emulation module of the executable unit based on the TLM model during initialization. When the NVMe controller core unit initiates access to the virtual host address, it initiates transaction-level access to the memory window address space used to access the virtual host address, triggering the processing of the PCIe interface module. The PCIe interface module calls the NVMe controller emulator access module to send the message to the host for processing. The agent module starts the software process to receive the message sent from the access module through the inter-process communication interface, and converts the message into an operation on the host address running inside Qemu.
PCIe寄存器模块负责完成虚拟主机对MSI/MSI-X中断的配置,当虚拟主机驱动通过qume内部的NVME驱动调用PCIe接口对NVMe设备所在的PCIe设备发起MSI/MSI-X配置的PCIe总线访问时,PCIe寄存器模块负责保存对应的MSI/MSI-X的配置信息。The PCIe register module is responsible for completing the virtual host's configuration of MSI/MSI-X interrupts. When the virtual host driver invokes the PCIe interface through the NVME driver inside qume to initiate MSI/MSI-X configured PCIe bus access to the PCIe device where the NVMe device is located, The PCIe register module is responsible for saving the configuration information of the corresponding MSI/MSI-X.
当NVMe核心单元需要发起对虚拟主机的MSI/MSI-X中断时,由NVMe核心单元通知PCIe接口模块发起对MSI/MSI-X配置的地址的PCIe的事务访问,PCIe接口模块调用NVMe控制器模拟器接入模块将消息发送给虚拟主机方向处理。When the NVMe core unit needs to initiate an MSI/MSI-X interrupt to the virtual host, the NVMe core unit notifies the PCIe interface module to initiate a PCIe transaction access to the address configured by the MSI/MSI-X, and the PCIe interface module calls the NVMe controller to simulate The server access module sends the message to the virtual host for processing.
在一些实施例中,所述NVMe核心单元包括NVMe寄存器模块、用于管理的递交队列模块、用于管理的完成队列模块、用于数据输入输出的递交队列模块、用于数据输入输出的完成队列模块、存储模块、门铃触发模块、中断触发模块、DMA数据传输模块。In some embodiments, the NVMe core unit includes an NVMe register module, a submission queue module for management, a completion queue module for management, a submission queue module for data input and output, and a completion queue for data input and output module, storage module, doorbell trigger module, interrupt trigger module, DMA data transmission module.
在一些实施例中,所述NVMe寄存器模块用于处理NVMe配置寄存器的读写。In some embodiments, the NVMe register module is used to handle reading and writing of NVMe configuration registers.
在一些实施例中,所述门铃触发模块用于接收来自所述主机的门铃操作,并根据所述门铃操作对应的队列,通知用于管理的递交队列模块或用于数据输入输出的递交队列模块进行处理。In some embodiments, the doorbell trigger module is used to receive the doorbell operation from the host, and notify the delivery queue module for management or the delivery queue module for data input and output according to the queue corresponding to the doorbell operation to process.
在一些实施例中,所述用于管理的递交队列模块用于将管理的递交队列的入口对应的管理命令封装为总线级事务请求并发送给所述可执行单元处理;In some embodiments, the management delivery queue module is configured to package the management command corresponding to the entry of the management delivery queue into a bus-level transaction request and send it to the executable unit for processing;
所述用于管理的完成队列模块用于将所述可执行单元对所述管理的递交队列的入口对应的管理命令的处理结果放入用于管理的完成队列的入口,并调用所述中断触发模块通知所述虚拟主机。The completion queue module for management is used to put the execution unit's processing result of the management command corresponding to the entry of the delivery queue for management into the entry of the completion queue for management, and call the interrupt trigger module notifies the virtual host.
在一些实施例中,所述DMA数据传输模块用于根据所述门铃触发模块进行数据搬移或将所述用于管理的完成队列的入口的处理结果搬移到所述虚拟主机。In some embodiments, the DMA data transmission module is configured to perform data transfer according to the doorbell trigger module or transfer the processing result of the entry of the completed queue for management to the virtual host.
在一些实施例中,所述用于数据输入输出的递交队列模块用于处理用于数据输入输出的递交队列的入口对应的IO命令;In some embodiments, the submission queue module for data input and output is used to process the IO command corresponding to the entry of the submission queue for data input and output;
所述用于数据输入输出的完成队列模块用于处理用于数据输入输出的递交队列的入口对应的IO命令的处理结果,并放入用于数据输入输出的完成队列的入口,并调用所述中断触发模块通知所述虚拟主机;The completion queue module for data input and output is used to process the processing result of the IO command corresponding to the entry of the submission queue for data input and output, and put it into the entry of the completion queue for data input and output, and call the The interrupt trigger module notifies the virtual host;
所述存储模块用于创建存储空间,并基于所述IO命令向所述存储空间写入数据和/或从所述存储空间读取数据。The storage module is used for creating a storage space, and writing data into and/or reading data from the storage space based on the IO command.
具体的,如图7所示,NVMe核心单元主要包括NVMe寄存器模块,Admin SQ模块(用于管理的递交队列模块),Admin CQ模块(用于管理的完成队列模块),IO SQ模块(用于数据输入输出的递交队列模块),IO CQ模块(用于数据输入输出的完成队列模块),存储模块,门铃触发模块,中断触发模块, DMA数据传输模块。Specifically, as shown in Figure 7, the NVMe core unit mainly includes an NVMe register module, an Admin SQ module (a delivery queue module for management), an Admin CQ module (a completion queue module for management), and an IO SQ module (for Submission queue module for data input and output), IO CQ module (complete queue module for data input and output), storage module, doorbell trigger module, interrupt trigger module, DMA data transmission module.
其中,NVMe寄存器模块负责提供NVMe配置寄存器的读写的模拟,初始化时注册一段NVMe控制器仿真模型的总线内部寄存器地址空间到可执行单元的总线仿真模块,处理从虚拟主机PCIe总线对NVMe的寄存器地址的请求和NVMe控制器仿真模型内部总线对NVMe的寄存器读写的事务级操作接口封装,寄存器保存。通过同一份寄存器的存储空间,服务于两个不同总线的请求事务,完成对主机侧访问NVMe控制器仿真模型的寄存器的功能支持,同时也完成NVMe控制器仿真模型中可执行单元运行的固件侧通过内部总线对NVMe控制器仿真模型中寄存器访问的功能支持;NVMe寄存器模块还负责对特定寄存器的写操作和读操作的触发事件状态等功能。Among them, the NVMe register module is responsible for providing the simulation of reading and writing of NVMe configuration registers. During initialization, a section of the bus internal register address space of the NVMe controller simulation model is registered to the bus simulation module of the executable unit, and the registers of the NVMe from the virtual host PCIe bus are processed. The address request and the internal bus of the NVMe controller simulation model encapsulate the transaction-level operation interface for reading and writing NVMe registers, and the registers are saved. Through the storage space of the same register, it serves the request transactions of two different buses, completes the functional support for the host side to access the registers of the NVMe controller simulation model, and also completes the firmware side of the executable unit running in the NVMe controller simulation model Functional support for register access in the NVMe controller simulation model through the internal bus; the NVMe register module is also responsible for functions such as the trigger event status of write operations and read operations to specific registers.
Admin SQ模块负责模拟处理Admin SQ队列中的SQE对应的NVMe管理命令。包括创建IO SQ命令、创建IO CQ命令、删除IO SQ命令、删除IO CQ命令、Identify命令、获取特性(Get Feature)命令、设置特性(Set Feature)命令等NVMe协议命令。The Admin SQ module is responsible for simulating and processing the NVMe management commands corresponding to the SQE in the Admin SQ queue. Including create IO SQ command, create IO CQ command, delete IO SQ command, delete IO CQ command, Identify command, get feature (Get Feature) command, set feature (Set Feature) command and other NVMe protocol commands.
Admin CQ模块负责模拟处理Admin SQ队列中的SQE对应的NVMe管理命令的处理结果放入Admin CQ队列的CQE入口,并调用中断触发模块通知主机。The Admin CQ module is responsible for simulating the processing results of the NVMe management commands corresponding to the SQE in the Admin SQ queue, putting them into the CQE entry of the Admin CQ queue, and calling the interrupt trigger module to notify the host.
IO SQ模块负责模拟处理IO SQ队列中的SQE对应的NVMe IO命令。包括读命令和写命令。The IO SQ module is responsible for simulating and processing the NVMe IO commands corresponding to the SQE in the IO SQ queue. Including read command and write command.
IO CQ模块负责模拟处理IO SQ队列中的SQE对应的NVMe IO命令的处理结果放入IO CQ队列的CQE入口,并调用中断触发模块通知主机。The IO CQ module is responsible for simulating the processing results of the NVMe IO commands corresponding to the SQE in the IO SQ queue, putting them into the CQE entry of the IO CQ queue, and calling the interrupt trigger module to notify the host.
存储模块负责模拟存储空间的创建,向存储空间的写入数据和从存储空间读取数据,对存储空间的管理。The storage module is responsible for creating the simulated storage space, writing data to and reading data from the storage space, and managing the storage space.
门铃触发模块负责模拟接收来自主机的门铃操作,根据门铃对应的队列,通知Admin SQ模块或IO SQ模块进行处理。The doorbell trigger module is responsible for simulating the doorbell operation received from the host, and notifies the Admin SQ module or IO SQ module to process according to the queue corresponding to the doorbell.
中断触发模块负责模拟PCIe的MSI/MSI-X中断,通知主机。The interrupt trigger module is responsible for simulating the MSI/MSI-X interrupt of PCIe and notifying the host.
DMA数据传输模块负责SQE、CQE的搬移,IO数据的搬移,从主机向控制器方向的数据搬移,由门铃触发模块触发。由控制器向主机方向的数据搬移完成后,通过中断触发模块触发中断给主机。The DMA data transmission module is responsible for the transfer of SQE and CQE, the transfer of IO data, and the transfer of data from the host to the controller, which is triggered by the doorbell trigger module. After the transfer of data from the controller to the host is completed, an interrupt is triggered to the host through the interrupt trigger module.
当NVMe寄存器模块作为TLM模型的目标端接收到总线发送过来的事务消息时,将消息内容存入FIFO,发送内部通知信号事件,由内部处理逻辑线程捕获事件后,读取FIFO内容进行处理。对于只读寄存器,在初始化时写入NVMe控制器模拟的固定值,当读取寄存器事务发生时,将寄存器的内容以事务形式返回给总线。当写入寄存器事务发生时,将写入寄存器的值保存到本地,并根据写入寄存器的地址,来确定是否进行后续的处理,如果需要触发NVMe控制器仿真状态机的转换,状态机的转换按照NVMe协议规范定义,在此不赘述。当写入寄存器的地址是门铃寄存器时,调用门铃触发模块进行处理。When the NVMe register module, as the target of the TLM model, receives the transaction message sent by the bus, it stores the message content in FIFO and sends an internal notification signal event. After the internal processing logic thread captures the event, it reads the FIFO content for processing. For read-only registers, a fixed value simulated by the NVMe controller is written at initialization, and when a read register transaction occurs, the contents of the register are returned to the bus as a transaction. When the write register transaction occurs, save the value of the write register to the local, and determine whether to perform subsequent processing according to the address of the write register, if it is necessary to trigger the transition of the NVMe controller simulation state machine, the transition of the state machine According to the definition of the NVMe protocol specification, details are not described here. When the address written into the register is the doorbell register, call the doorbell trigger module for processing.
门铃触发模块计算当前门铃寄存器的位置,查找对应的SQ队列的位置,Admin SQ队列对应门铃的地址索引为0,IO SQ 1对应的门铃的地址索引为1,IO SQ 2对应的门铃的地址索引为2,依次类推。找到SQ队列的位置后,找到最新的SQE的位置,由DMA数据传输模块将SQE从主机搬移到本地,写入队列对应的FIFO中,如果是Admin SQ的门铃,则发送事件,通知Admin SQ模块进行处理。The doorbell trigger module calculates the location of the current doorbell register and searches for the location of the corresponding SQ queue. The address index of the doorbell corresponding to the Admin SQ queue is 0, the address index of the doorbell corresponding to IO SQ 1 is 1, and the address index of the doorbell corresponding to IO SQ 2 is 2, and so on. After finding the position of the SQ queue, find the position of the latest SQE, and the DMA data transmission module will move the SQE from the host to the local, and write it into the FIFO corresponding to the queue. If it is the doorbell of Admin SQ, it will send an event to notify the Admin SQ module to process.
如果是IO SQ的门铃,则发送事件,通知IO SQ模块进行处理。IO SQ模块收到事件后,从队列的FIFO中读取SQE的内容,将SQE的内容封装为对存储介质的请求,发送给存储模块,由存储模块完成完成IO命令的处理。如果是写命令,读取IO SQE的IO命令中携带的PRP1/PRP2或S/G List信息对应的主机内存地址,复制地址的数据到本地缓存,并调用存储介质模型提供的接口写入IO命令指定LBA参数及数据长度NLB参数对应的存储介质模型提供的存储空间;如果是读命令,读取IO SQE的IO命令中携带的LBA参数及数据长度NLB参数对应的存储介质模型提供的存储空间的内容,将内容写入命令中携带的PRP1/PRP2或S/GList信息对应的主机内存地址。If it is the doorbell of IO SQ, an event is sent to notify the IO SQ module to process it. After the IO SQ module receives the event, it reads the content of the SQE from the FIFO of the queue, encapsulates the content of the SQE as a request for the storage medium, and sends it to the storage module, and the storage module completes the processing of the IO command. If it is a write command, read the host memory address corresponding to the PRP1/PRP2 or S/G List information carried in the IO command of IO SQE, copy the data of the address to the local cache, and call the interface provided by the storage medium model to write the IO command Specify the storage space provided by the storage medium model corresponding to the LBA parameter and the data length NLB parameter; if it is a read command, read the storage space provided by the storage medium model corresponding to the LBA parameter and the data length NLB parameter carried in the IO command of IO SQE Content, write the content to the host memory address corresponding to the PRP1/PRP2 or S/GList information carried in the command.
当IO SQ命令处理完成后,将执行结果和对应的IO SQE的入口ID,发送给IO CQ模块FIFO,写IO CQ模块寄存器通知IO CQ模块进行处理。When the IO SQ command processing is completed, the execution result and the corresponding IO SQE entry ID are sent to the IO CQ module FIFO, and the IO CQ module register is written to notify the IO CQ module to process.
IO CQ模块收到寄存器事件触发后,从FIFO收到IO SQ发送的命令处理结果后,IOCQ模块填写对应的CQE的内容后,向DMA数据传输模块发起DMA传输请求,由DMA数据传输模块将CQE搬移到主机内存,移动IO CQ的CQE指针,将CQ的标识传递给中断触发模块进行处理。中断触发模块读取CQ对应的中断向量对应的主机地址,通过发起对PCIe总线的事务操作,触发MSIX中断到主机。After the IO CQ module receives the register event trigger, after receiving the command processing result sent by the IO SQ from the FIFO, the IOCQ module fills in the corresponding CQE content, and initiates a DMA transmission request to the DMA data transmission module, and the DMA data transmission module sends the CQE Move to the host memory, move the CQE pointer of the IO CQ, and pass the CQ identification to the interrupt trigger module for processing. The interrupt trigger module reads the host address corresponding to the interrupt vector corresponding to the CQ, and triggers the MSIX interrupt to the host by initiating a transaction operation on the PCIe bus.
当存储模块收到IO命令时,调用DMA数据传输模块将IO命令对应的PRP/SGL信息中的主机地址数据搬移到本地存储区,重新封装后,发起总线事务请求,转发给存储模型单元进行处理。When the storage module receives the IO command, it calls the DMA data transmission module to move the host address data in the PRP/SGL information corresponding to the IO command to the local storage area, and after repackaging, initiates a bus transaction request and forwards it to the storage model unit for processing .
而Admin SQ模块收到事件后,从队列的FIFO中读取SQE的内容,将SQE的内容封装为总线级事务请求,发送给可执行单元,由可执行单元的自定义固件程序进行接收处理。当可执行单元的自定义固件程序处理完Admin SQ命令处理完成后,将执行结果和对应的Admins SQE的入口ID,发送给Admin CQ模块FIFO,写Admin CQ模块寄存器通知Admin CQ模块进行处理。Admin CQ模块收到寄存器事件触发后,从FIFO收到可执行单元的自定义固件程序发送的命令处理结果后,填写对应的Admin CQE的内容,向DMA数据传输模块发起DMA传输请求,DMA数据传输模块向总线发起PCIe数据传输请求,将CQE内容通过PCIe接口模块搬移到主机内存,移动Admin CQ的CQE指针,将CQ的标识传递给中断触发模块进行处理。After the Admin SQ module receives the event, it reads the content of the SQE from the FIFO of the queue, encapsulates the content of the SQE into a bus-level transaction request, and sends it to the executable unit, which is then received and processed by the custom firmware program of the executable unit. When the custom firmware program of the executable unit finishes processing the Admin SQ command, the execution result and the corresponding Admins SQE entry ID are sent to the Admin CQ module FIFO, and the Admin CQ module register is written to notify the Admin CQ module to process. After the Admin CQ module receives the register event trigger, after receiving the command processing result sent by the custom firmware program of the executable unit from the FIFO, it fills in the corresponding Admin CQE content, initiates a DMA transfer request to the DMA data transfer module, and DMA data transfer The module initiates a PCIe data transmission request to the bus, moves the CQE content to the host memory through the PCIe interface module, moves the CQE pointer of the Admin CQ, and passes the CQ identifier to the interrupt trigger module for processing.
中断触发模块则根据收到的CQ标识读取CQ对应的中断向量对应的主机地址,该地址在主机NVMe驱动初始化时由主机配置给NVMe控制器模拟器的PCIe接口单元,中断触发模块将中断向量标识发送给PCIe接口单元。通过PCIe接口单元发起对PCIe总线的事务操作,触发MSIX中断到主机。The interrupt trigger module reads the host address corresponding to the interrupt vector corresponding to the CQ according to the received CQ identifier. This address is configured by the host to the PCIe interface unit of the NVMe controller emulator when the host NVMe driver is initialized. The interrupt trigger module will interrupt the vector The identification is sent to the PCIe interface unit. Initiate the transaction operation on the PCIe bus through the PCIe interface unit, trigger the MSIX interrupt to the host.
通过上述模块,NVMe核心单元能够完成NVMe协议的模拟,包括NVMe控制器配置寄存器的读写的模拟,将Admin SQ命令的转发给可执行单元上运行的自定义固件程序处理,IO命令的处理,门铃的处理,DMA数据的搬移。并接收Admin SQ对应的Doorbell中断,检查Admin SQ的入口项Admin SQE,将Admin SQ入口项Admin SQE中的管理命令发送给可执行单元上运行的自定义固件程序模块处理。还可以接收可执行单元完成的CQE的内容,写入Admin CQ的入口Admin CQE,并触发中断通知主机。NVMe核心单元负责接收IO SQ对应的Doorbell中断,检查IO SQ的入口项IO SQE;IO处理完成后,处理结果写入IO CQ的入口项IOCQE,并触发中断通知主机。Through the above modules, the NVMe core unit can complete the simulation of the NVMe protocol, including the simulation of reading and writing of the NVMe controller configuration register, forwarding the Admin SQ command to the custom firmware program running on the executable unit for processing, and the processing of the IO command. Doorbell processing, DMA data transfer. And receive the Doorbell interrupt corresponding to Admin SQ, check the entry item Admin SQE of Admin SQ, and send the management command in the entry item Admin SQE of Admin SQ to the custom firmware program module running on the executable unit for processing. It can also receive the content of the CQE completed by the executable unit, write it into the Admin CQE of the Admin CQ, and trigger an interrupt to notify the host. The NVMe core unit is responsible for receiving the Doorbell interrupt corresponding to the IO SQ, and checking the entry item IO SQE of the IO SQ; after the IO processing is completed, the processing result is written into the entry item IOCQE of the IO CQ, and an interrupt is triggered to notify the host.
在一些实施例中,所述存储介质单元包括存储介质模型框架模块,存储介质控制模块和存储介质I/O模块。In some embodiments, the storage medium unit includes a storage medium model framework module, a storage medium control module and a storage medium I/O module.
在一些实施例中,所述存储介质模型框架模块提供控制管理接口和IO数据接口以对所述存储介质仿真模型进行访问;In some embodiments, the storage medium model framework module provides a control management interface and an IO data interface to access the storage medium simulation model;
所述存储介质控制模块用于提供存储介质控制信息;The storage medium control module is used to provide storage medium control information;
所述存储介质I/O模块用于提供存储介质数据IO操作。The storage medium I/O module is used for providing storage medium data IO operations.
具体的,如图8所示,存储介质单元主要包括存储介质模型框架模块,存储介质控制模块,存储介质I/O模块。Specifically, as shown in FIG. 8 , the storage medium unit mainly includes a storage medium model framework module, a storage medium control module, and a storage medium I/O module.
其中,存储介质模型框架模块用于提供存储介质的控制接口和数据接口。提供存储介质模型的注册框架,用来兼容管理不同类型的存储介质的处理。存储介质模型框架模块映射存储介质的标识与对应操作的关联关系,提供控制信息的注册交互接口,I/O信息的注册接口,注册的信息在进行存储介质IO处理时,在NVMe核心模块与存储介质交互的控制路径的流程中进行调用以设置或获取对应的存储介质控制信息数据,在NVMe核心模块与存储介质交互的I/O数据路径的流程中进行调用以对相对应的存储介质数据进行读写等操作。Among them, the storage medium model framework module is used to provide the control interface and data interface of the storage medium. Provides a storage medium model registration framework for compatible management of different types of storage media. The storage medium model framework module maps the association between the identification of the storage medium and the corresponding operation, provides the registration interaction interface of the control information, and the registration interface of the I/O information. It is called in the process of the control path of media interaction to set or obtain the corresponding storage medium control information data, and it is called in the process of the I/O data path of the interaction between the NVMe core module and the storage medium to perform the corresponding storage medium data. Read and write operations.
存储介质控制模块用于提供存储介质控制信息的模拟。The storage medium control module is used to provide simulation of storage medium control information.
存储介质I/O模块用于提供存储介质数据I/O操作的模拟。The storage medium I/O module is used to provide simulation of storage medium data I/O operations.
存储介质模型支持自定义固件通过发起总线事务访问完成对存储介质属性信息和配置信息的读写访问。存储介质模型支持NVMe控制器仿真模块通过发起总线事务访问完成对存储介质的IO数据的读写访问。存储介质模型访问注册到存储介质框架的存储介质仿真模型,完成对数据IO的读写访问。The storage medium model supports custom firmware to complete read and write access to storage medium attribute information and configuration information by initiating bus transaction access. The storage medium model supports the NVMe controller simulation module to complete the read and write access to the IO data of the storage medium by initiating bus transaction access. The storage medium model accesses the storage medium simulation model registered in the storage medium framework to complete the read and write access to data IO.
在一些实施例中,所述调测跟踪单元包括寄存器操作模块,打印和日志控制模块以及单元测试管理模块。In some embodiments, the commissioning and tracking unit includes a register operation module, a printing and log control module, and a unit test management module.
在一些实施例中,所述寄存器操作模块对所述可执行单元、所述PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元中的寄存器发起读写访问;In some embodiments, the register operation module initiates read and write access to registers in the executable unit, the PCIE interface unit, the NVMe core unit, the storage medium unit, and the commissioning and tracking unit;
所述打印和日志控制模块用于提供打印控制和日志控制;The print and log control module is used to provide print control and log control;
所述单元测试模块用于提供所述可执行单元、所述PCIE接口单元、NVMe核心单元、存储介质单元以及调测跟踪单元的测试入口,并用于处理单元测试命令。The unit test module is used to provide test entries of the executable unit, the PCIE interface unit, the NVMe core unit, the storage medium unit and the commissioning and tracking unit, and is used to process unit test commands.
具体的,如图9所示,调测跟踪单元主要包括寄存器操作模块,打印和日志控制模块,单元测试管理模块。Specifically, as shown in FIG. 9 , the commissioning and tracking unit mainly includes a register operation module, a printing and log control module, and a unit test management module.
其中,寄存器操作模块用于提供寄存器内容的列表显示和读写寄存器操作。打印和日志控制模块用于提供各个模块的打印控制和日志控制。单元测试模块用于提供各个模块的单元测试入口和单元测试命令的处理。Among them, the register operation module is used to provide list display of register content and read and write register operation. The print and log control module is used to provide print control and log control for each module. The unit test module is used to provide the unit test entry of each module and the processing of unit test commands.
这样,寄存器操作模块通过发起总线级事务请求,对各个模块的寄存器发起读写访问。打印和日志控制模块,通过发起总线级事务请求,对各个模块的调测用的寄存器发起读写访问来控制各个仿真单元的打印和日志输出。单元测试模块根据单元测试的需求组织打桩配置和单元测试。支持对各个单元的单独测试。In this way, the register operation module initiates read and write access to the registers of each module by initiating a bus-level transaction request. The print and log control module controls the print and log output of each simulation unit by initiating a bus-level transaction request and initiating read and write access to the registers used for debugging of each module. The unit test module organizes piling configuration and unit tests according to the needs of unit tests. Support for individual testing of individual units.
在一些实施例中,如图10所示,NVMe控制器仿真模型在具体应用实施时,还需要外部的Qemu进程,自定义固件程序,存储介质仿真模型等一起配合使用。如图9所示,S001对应用户应用、S002对应NVMe设备接口;S003对应Qemu内部的NVMe控制器模拟器代理模块;S004对应NVMe控制器模拟器进程的NVMe控制器模拟器接入模块;S005对应PCIe接口单元;S006对应可执行单元;S007对应NVMe核心单元;S008对应自定义固件程序;S009 对应存储介质模型单元;S010对应存储介质仿真模型;S011对应调测跟踪单元。In some embodiments, as shown in FIG. 10 , when the NVMe controller simulation model is implemented in a specific application, an external Qemu process, a custom firmware program, a storage medium simulation model, etc. are required to be used together. As shown in Figure 9, S001 corresponds to the user application, S002 corresponds to the NVMe device interface; S003 corresponds to the NVMe controller simulator agent module inside Qemu; S004 corresponds to the NVMe controller simulator access module of the NVMe controller simulator process; S005 corresponds to PCIe interface unit; S006 corresponds to the executable unit; S007 corresponds to the NVMe core unit; S008 corresponds to the custom firmware program; S009 corresponds to the storage medium model unit; S010 corresponds to the storage medium simulation model; S011 corresponds to the commissioning and tracking unit.
这样,一个完整的管理命令的主要流程可以如下:S001、S002、S003、S004、S005、S006、S007、S006、S008、S006、S009、S010。In this way, the main flow of a complete management command can be as follows: S001, S002, S003, S004, S005, S006, S007, S006, S008, S006, S009, S010.
一个完整的IO命令的主要流程可以如下: S001、S002、S003、S004、S005、S006、S007、S006、S009、S010。The main process of a complete IO command can be as follows: S001, S002, S003, S004, S005, S006, S007, S006, S009, S010.
本申请技术方案提出了一种用于NVME设备的仿真系统,提供可支持待仿真固件运行的可执行单元,并在可执行单元内部互联总线上提供对NVMe控制器仿真模型的寄存器内部访问,从而能够独立设计开发调测控制器内部固件。The technical solution of this application proposes a simulation system for NVME equipment, which provides an executable unit that can support the operation of the firmware to be simulated, and provides internal access to the registers of the NVMe controller simulation model on the internal interconnection bus of the executable unit, thereby Able to independently design, develop and debug the internal firmware of the controller.
所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本申请实施例公开的范围(包括权利要求)被限于这些例子;在本申请实施例的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,并存在如上的本申请实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。因此,凡在本申请实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本申请实施例的保护范围之内。Those of ordinary skill in the art should understand that: the discussion of any of the above embodiments is exemplary only, and is not intended to imply that the scope (including claims) disclosed by the embodiments of the present application is limited to these examples; under the idea of the embodiments of the present application , the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present application, which are not provided in details for the sake of brevity. Therefore, within the spirit and principle of the embodiments of the present application, any omissions, modifications, equivalent replacements, improvements, etc., shall be included in the protection scope of the embodiments of the present application.
Claims (24)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310351183.0A CN116069453B (en) | 2023-04-04 | 2023-04-04 | a simulation system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310351183.0A CN116069453B (en) | 2023-04-04 | 2023-04-04 | a simulation system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN116069453A true CN116069453A (en) | 2023-05-05 |
| CN116069453B CN116069453B (en) | 2023-07-14 |
Family
ID=86182296
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310351183.0A Active CN116069453B (en) | 2023-04-04 | 2023-04-04 | a simulation system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116069453B (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117556754A (en) * | 2024-01-11 | 2024-02-13 | 北京数渡信息科技有限公司 | PCIe switch chip pre-silicon simulation system |
| CN117591462A (en) * | 2024-01-19 | 2024-02-23 | 成都大征创智科技有限公司 | A peripheral connection method based on PCIE protocol in digital processor |
| CN117971400A (en) * | 2024-04-02 | 2024-05-03 | 深圳云豹智能有限公司 | A network card device simulation system, method, electronic device and storage medium |
| CN121050413A (en) * | 2025-10-31 | 2025-12-02 | 上海创景信息科技股份有限公司 | Hardware-in-loop test-oriented MCP2515_CAN controller virtual simulation and integration method and system |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112395146A (en) * | 2020-11-27 | 2021-02-23 | 深圳忆联信息系统有限公司 | SSD firmware simulation verification method, system, computer equipment and storage medium |
| CN114385524A (en) * | 2020-10-20 | 2022-04-22 | 北京梆梆安全科技有限公司 | Embedded firmware simulation system and method and device thereof, and electronic equipment |
| CN114397999A (en) * | 2021-11-25 | 2022-04-26 | 北京智芯微电子科技有限公司 | Communication method, device and equipment based on nonvolatile memory interface-remote processing message transmission |
| CN115878267A (en) * | 2022-12-26 | 2023-03-31 | 山石网科通信技术股份有限公司 | Simulation device and method for firmware system, storage medium and electronic device |
-
2023
- 2023-04-04 CN CN202310351183.0A patent/CN116069453B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114385524A (en) * | 2020-10-20 | 2022-04-22 | 北京梆梆安全科技有限公司 | Embedded firmware simulation system and method and device thereof, and electronic equipment |
| CN112395146A (en) * | 2020-11-27 | 2021-02-23 | 深圳忆联信息系统有限公司 | SSD firmware simulation verification method, system, computer equipment and storage medium |
| CN114397999A (en) * | 2021-11-25 | 2022-04-26 | 北京智芯微电子科技有限公司 | Communication method, device and equipment based on nonvolatile memory interface-remote processing message transmission |
| CN115878267A (en) * | 2022-12-26 | 2023-03-31 | 山石网科通信技术股份有限公司 | Simulation device and method for firmware system, storage medium and electronic device |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117556754A (en) * | 2024-01-11 | 2024-02-13 | 北京数渡信息科技有限公司 | PCIe switch chip pre-silicon simulation system |
| CN117556754B (en) * | 2024-01-11 | 2024-03-19 | 北京数渡信息科技有限公司 | PCIe switch chip pre-silicon simulation system |
| CN117591462A (en) * | 2024-01-19 | 2024-02-23 | 成都大征创智科技有限公司 | A peripheral connection method based on PCIE protocol in digital processor |
| CN117971400A (en) * | 2024-04-02 | 2024-05-03 | 深圳云豹智能有限公司 | A network card device simulation system, method, electronic device and storage medium |
| CN121050413A (en) * | 2025-10-31 | 2025-12-02 | 上海创景信息科技股份有限公司 | Hardware-in-loop test-oriented MCP2515_CAN controller virtual simulation and integration method and system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN116069453B (en) | 2023-07-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN116069453B (en) | a simulation system | |
| US7613847B2 (en) | Partially virtualizing an I/O device for use by virtual machines | |
| CN106201349B (en) | A method and apparatus for processing read/write requests in a physical host | |
| CN114818599B (en) | Chip simulation verification system | |
| US9037770B2 (en) | Accelerator engine emulation over an interconnect link | |
| CN104142849B (en) | Method and system for sharing multiple hosts and single input/output virtualization virtual functions | |
| US8103815B2 (en) | Lazy handling of end of interrupt messages in a virtualized environment | |
| TWI278755B (en) | An apparatus and method for high performance volatile disk drive memory access using an integrated DMA engine | |
| US9471520B2 (en) | Controlling operations according to another system's architecture | |
| CN104636076A (en) | Distributed block device driving method and system for cloud storage | |
| CN103559087A (en) | Interrupt realization method between virtual processors, relevant device and system | |
| CN115113977A (en) | Descriptor reading apparatus and device, method and integrated circuit | |
| US11586567B2 (en) | Techniques for virtualizing PF-VF mailbox communication in SR-IOV devices | |
| CN114397999B (en) | Communication method, device and equipment based on nonvolatile memory interface-remote processing message transmission | |
| CN115421795A (en) | Software and hardware cooperative multi-port storage acceleration system | |
| CN117389694A (en) | Virtual storage IO performance improving method based on virtio-blk technology | |
| US20090083021A1 (en) | Emulation of ahci-based solid state drive using nand interface | |
| CN120256405B (en) | A request processing method, device, equipment, system, medium and product | |
| CN115269326A (en) | Task processing method, device, medium and equipment based on chip monitoring system | |
| CN119621502B (en) | RDMA network card front-end and back-end simulation implementation method, system, equipment and storage medium | |
| CN117971400B (en) | Network card equipment simulation system, network card equipment simulation method, electronic equipment and storage medium | |
| CN104834613B (en) | Computer system and method for accessing virtual machine | |
| JP6965943B2 (en) | Configuration management device, configuration management system, configuration management method, and configuration management program | |
| CN116418857A (en) | NVMeoF computing node virtualization method based on intermediary transparent transmission | |
| Zhang et al. | NVMe-over-RPMsg: A Virtual Storage Device Model Applied to Heterogeneous Multi-Core SoCs |
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 | ||
| CP03 | Change of name, title or address |
Address after: 215000 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province Patentee after: Suzhou Yuannao Intelligent Technology Co.,Ltd. Country or region after: China Address before: 215000 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province Patentee before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Country or region before: China |
|
| CP03 | Change of name, title or address |