Equipment topology simulation method and device, chip, medium and electronic equipment
By creating device topology relationship tree and virtual devices, the problem of poor flexibility and scalability in the PCIE device topology simulation process in the prior art is solved, and high flexibility and scalability equipment topology simulation is achieved.
Patent Information
- Application Number
- CN202311109087.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-02-28
AI Technical Summary
In the topology simulation process of existing PCIE devices, only topology simulation of specific types of devices can be implemented. Adding new types of devices requires a lot of code to be changed, which has problems of poor flexibility and scalability.
By obtaining device configuration information and dictionary data, creating a device topology relationship tree, traversing the relationship tree to create a virtual device, and reading and writing data through message transmission with the host side, device topology simulation is realized.
A highly flexible and scalable device topology simulation process is realized without being restricted by device type and no code upgrade is required.
Smart Images

Figure CN119538459A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a device topology simulation method, device, chip, medium and electronic device. Background Art
[0002] PCI (Peripheral Component Interconnect) is a local parallel bus standard. The PCI bus is a tree structure and is independent of the CPU (Central Processing Unit) bus and can operate in parallel with the CPU bus. PCI devices and PCI bridges can be connected to the PCI bus. Only one PCI master device is allowed on the PCI bus, and the others are all PCI slave devices. Moreover, read and write operations can only be performed between master and slave devices, and data exchange between slave devices needs to be transferred through the master device.
[0003] PCI Express (PCIE) is derived from PCI extension and is compatible with PCI. It is a layered protocol consisting of a transaction layer, a data link layer, and a physical layer. In the DPU (Data Processing Unit) scenario, in order for the DPU to simulate multiple different types of standard PCIE devices to the HOST (host side), it is necessary to simulate the entire PCIE topology and different types of PCIE devices; the HOST side operating system enumerates PCIE devices to implement the topology simulation of PCIE devices.
[0004] In the process of implementing the present invention, it is found that there are at least the following technical problems in the prior art: in the current PCIE device topology simulation process, only topology simulation of specific types of devices can be realized. If new types of devices are added, a large amount of code needs to be modified to support them, which has the problem of poor flexibility and scalability. Summary of the invention
[0005] The present invention provides a device topology simulation method, device, chip, medium and electronic device to realize a highly flexible and highly expansible device topology simulation process.
[0006] According to one aspect of the present invention, a device topology simulation method is provided, comprising:
[0007] Acquire device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information;
[0008] Traversing the device topology tree, and creating a virtual device according to the traversed device information;
[0009] A scanning message sent by the host end is received, data is read and written to the configuration space of the virtual device in the device topology relationship tree based on the scanning message, and the data reading and writing result is sent to the host end so that the host end performs device topology simulation.
[0010] Optionally, the device configuration information includes a device connection relationship and a device type, and the dictionary data includes an identifier of the device type.
[0011] Optionally, the creating a device topology relationship tree based on the dictionary data and the device configuration information includes: extracting the device type in the device configuration information, and matching the device type identifier in the dictionary data based on the device type; extracting the device attachment relationship of the device in the device configuration information, wherein the device attachment relationship includes parent node information and information of the attached child node; creating the data structure of the device based on the identifier of the device type of the device, the parent node information and information of the attached child node; and forming the device topology relationship tree based on multiple data structures of the devices.
[0012] Optionally, the data structure of the device includes a pointer to the child node;
[0013] The forming of the device topology relationship tree based on the data structures of the plurality of devices includes: mounting the data structure of each device to the parent node of the device to form the device topology relationship tree.
[0014] Optionally, after creating a virtual device according to the traversed device information, the method further includes: sending a restart instruction to the host side to trigger the host side to reset, and performing device scanning enumeration and sending scanning messages during the reset process.
[0015] Optionally, the method further includes: receiving device identifier information sent by the host after completing the reset, and modifying the device configuration information into device information recognizable by the host based on the device identifier information.
[0016] Optionally, before acquiring the device configuration information and dictionary data, the method further includes: receiving a URI resource operation, and driving the step of acquiring the device configuration information and dictionary data based on the resource operation.
[0017] According to another aspect of the present invention, there is provided a device topology simulation apparatus, comprising:
[0018] A relationship tree creation module, used to obtain device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information;
[0019] A device creation module, used to traverse the device topology tree and create a virtual device according to the traversed device information;
[0020] The information sending module is used to receive the scanning message sent by the host end, read and write data to the configuration space of the virtual device in the device topology relationship tree based on the scanning message, and send the data reading and writing results to the host end so that the host end performs device topology simulation.
[0021] According to another aspect of the present invention, a chip is provided, which includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the device topology simulation method provided in an embodiment of the present invention.
[0022] According to another aspect of the present invention, an electronic device is provided. The electronic device includes the chip provided by an embodiment of the present invention.
[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the device topology simulation method described in any embodiment of the present invention when executed.
[0024] The technical solution of the embodiment of the present invention is to pre-set device configuration information and dictionary data, wherein the device configuration information includes device-related information of different device types to be set in the DPU, and the dictionary data includes device type identifiers of different device types. A device topology relationship tree is constructed through the device configuration information and dictionary data, and device topology simulation is implemented through message transmission with the host side, which is not limited by the device type and does not require code upgrade, thereby improving the flexibility and scalability of device topology simulation.
[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 is a flow chart of a device topology simulation method provided by an embodiment of the present invention;
[0028] Figure 2 It is a structural schematic diagram of a device topology simulation apparatus provided by an embodiment of the present invention;
[0029] Figure 3 is a schematic diagram of the structure of a chip provided by an embodiment of the present invention;
[0030] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] Figure 1 This is a flow chart of a device topology simulation method provided by an embodiment of the present invention. This embodiment is applicable to the case of performing device topology simulation on devices of different types and numbers. The method can be executed by a device topology simulation device. The device topology simulation device can be implemented in the form of hardware and / or software. The device topology simulation device can be configured in an electronic device such as a computer or a server. Figure 1 As shown, the method includes:
[0034] S110: Acquire device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information.
[0035] S120: traverse the device topology tree, and create a virtual device according to the traversed device information.
[0036] S130, receiving a scan message sent by the host end, reading and writing data in the configuration space of the virtual device in the device topology relationship tree based on the scan message, and sending the data reading and writing results to the host end, so that the host end performs device topology simulation.
[0037] The device in this embodiment may be a PCIE device in a DPU scenario. The device types of the PCIE device include but are not limited to bridge, virtio net, virtio blk, NVME (Non-Volatile Memory Express), RDMA (Remote Direct Memory Access), etc.
[0038] Pre-set device configuration information, which includes relevant information of the PCIE device to be created in the DPU, and the relevant information includes the device type. The device configuration information can be obtained in the form of preloading, that is, importing the device configuration information from the outside, or it can be obtained through interactive page configuration. Specifically, an interactive page is displayed, and the interactive page includes a device addition control and an information collection control for each newly added device to collect relevant information of the PCIE device to be configured, and form the device configuration information based on the relevant information of the PCIE device. Optionally, the device configuration information can be an XML format file. By forming the device configuration information, the relevant information of the PCIE device of any device type to be configured can be defined, without being restricted by the device type, and the configuration flexibility and scalability are strong.
[0039] The dictionary data includes an identifier of the device type, which may be a preset string used to uniquely mark each device type. Exemplarily, the strings "pf-net", "pf-blk", "pf-nvme", "pf-crypto", "pf-rdma", etc. may be used as identifiers to represent the following device types, respectively: virtio net, virtio blk, nvme, crypto, rdma, etc. The dictionary data may be pre-created, for example, it may be a device type identifier based on a PCIE device in a historical DPU. After obtaining the dictionary data, the field data may be verified through the device configuration information, and it may be determined that the device configuration information includes a set of device types, and it may be determined whether the dictionary data includes a device type identifier corresponding to the device type in the above set. In the case where the dictionary data does not include the device type identifier of any device type, the device type may be displayed, the device type identifier of the device type may be received, and the dictionary data may be updated.
[0040] In some embodiments, dictionary data may also be created after receiving device configuration information. Specifically, it may be determined that the device configuration information includes a set of device types, the set of device types is displayed through an interactive page, and a device type identifier of each device type is received to generate dictionary data. In some embodiments, it may also be determined that the device configuration information includes a device type, and for each device type, the device configuration information of the device type is generated according to a preset template based on preset characters and device types. Exemplarily, the preset character may be "pf", and the preset template may be a preset character and a device type connected based on a connector "-". It will be understood that the preset characters and preset templates are preset according to user needs and are not limited here.
[0041] In this embodiment, through the above-mentioned device configuration information and dictionary data, a device topology relationship tree can be created for PCIE devices of any device type to perform device topology simulation, which is not limited by the device type and does not require code upgrades, thereby improving the flexibility and scalability of device topology simulation.
[0042] Optionally, the device configuration information includes the device attachment relationship and the device type. The device attachment relationship includes the parent node information of the device, and the child node information attached to the device. The parent node information may be the parent node identifier, and the child node information may include but is not limited to the number of child nodes, child node identifiers, etc. The device attachment relationship can be used to determine the association relationship between devices to build a device topology relationship tree. The device type can be matched to the device type identifier in the dictionary data to distinguish different device types.
[0043] Optionally, a device topology relationship tree is created based on the dictionary data and the device configuration information, including: extracting the device type in the device configuration information, and matching the device type identifier in the dictionary data based on the device type; extracting the device attachment relationship of the device in the device configuration information, wherein the device attachment relationship includes parent node information and information of the attached child node; creating the data structure of the device based on the identifier of the device type of the device, the parent node information and information of the attached child node; and forming the device topology relationship tree based on multiple data structures of the devices.
[0044] In this embodiment, the data structure may be a topology (topo) data structure. For any PCIE device as a node, the data structure of the node is formed, and the data structures of multiple nodes may form a device topology tree. Specifically, for any node, the identifier of the device type on the node, the parent node information of the node and the information of the attached child node are determined, and the above information is filled into the topo data structure to form the data structure of the node.
[0045] According to the device attachment relationship, the device topology relationship tree may include three types of nodes, such as topo-up nodes, topo-dp nodes, and topo-ep nodes. The data structures of different types of nodes may include different information. Optionally, the data structure of the topo-up node includes the parent node information of the current node and the information of the topo-dp node attached to the current node, that is, the child node information. The data structure of the topo-dp node includes the parent node information of the topo-dp node and the information of the topo-ep node attached to the topo-dp node, that is, the child node information; the data structure of the topo-ep node includes the parent node information of the topo-ep node.
[0046] On the basis of the above embodiments, the data structure of each node also includes other information. Taking the topo-up node as an example, its data structure includes the identification of the topo-up node on the host side, that is, the host ID number, the number of each virtual device type mounted under the node, the parent node of the topo-up node, the number and pointer of the topo-dp nodes mounted on the topo-up node, the dp device mounted on the topo-up node and the slot number of the topo-up node, etc.
[0047] For a topo-dp node, its data structure includes the identifier of the topo-dp node on the host side, the number of each virtual device type mounted under the node, the parent node of the topo-dp node, the number of topo-ep nodes and ep devices mounted on the topo-dp node, the slot number of the topo-dp node, etc.
[0048] For a topo-ep node, its data structure includes the identifier of the topo-ep node on the host side, the device type mounted on the topo-ep node, the parent node of the topo-ep node, the fake device pointer mounted on the topo-ep node, the real device pointer pointing to the topo-ep node, the slot number of the topo-ep node, etc.
[0049] Optionally, the initial data structure of the node can be formed based on the information required for the data structure of each node type, and the initial data structure includes information types without added values. The relevant information required for each node is extracted through the device configuration information, and the read relevant information is added to the initial data structure based on the node type to obtain the data structure of each node.
[0050] On the basis of the above embodiments, each node implements a set of interface functions respectively, and the operations of adding, deleting, and attaching nodes can be realized through the above interface functions. Any node can be optionally configured with one or more of the following interface functions: adding child nodes function, deleting child nodes function, attaching to parent nodes function, deleting the association relationship with parent nodes function, topo cascade function, parent node acquisition function, topo node information output function, topo node reset function, topo node slot number acquisition function, topo node device deletion function, etc. Executing the above interface functions can realize the corresponding functions. Exemplarily, for any node, the parent node information of the node can be obtained through the parent node acquisition function, and the data structure of the node can be attached to its parent node through the attach to parent node function, etc.
[0051] Optionally, the data structure of the device also includes a pointer to a child node; accordingly, forming the device topology relationship tree based on the data structures of the multiple devices includes: mounting the data structure of each device to the parent node of the device to form the device topology relationship tree. Specifically, for any node, the data structure of the node can be mounted to the child node pointer included in the parent node to achieve the mounting between nodes. The mounting between data structures can be achieved by calling the mounting to parent node function to form the device topology relationship tree.
[0052] The device topology relationship tree includes the connection relationship between the PCIE devices to be constructed in the DPU, as well as the device information of each PCIE device, providing a basis for PCIE device topology simulation.
[0053] A virtual device is created according to the device topology relationship tree. Specifically, each device information in the device topology relationship tree can be traversed to create a virtual device corresponding to each device information. A device creation instruction can be generated based on each device information, and the device creation instruction is sent to the resource management hardware abstraction layer to initiate a device creation operation to create a virtual device, which is a PCIE device. Optionally, when creating each virtual device, a configuration space is allocated for each virtual device. After creating the virtual settings, it also includes PCI configuration of the virtual device to initialize the PCI configuration space of the virtual device, that is, to set the initial value for the configuration space of the PCIE device. Here, the device topology relationship tree includes device information of different device types. Accordingly, virtual devices of different device types can be created without being restricted by the device type to perform PCIE device topology simulation of any device type.
[0054] After creating a virtual device according to the traversed device information, a restart instruction is sent to the host side to trigger the host side to reset, and the device scan enumeration is performed and a scan message is sent during the reset process. The host side performs a scan enumeration of PCI devices during the reset process, and sends a scan message to the DPU side, which can be a PCIE TLP message. The DPU side parses the received scan message to obtain the message content. In response to the scan message, the configuration space data of the virtual device created including each device information in the device topology relationship tree is read and written, and the read and write data of each virtual device is obtained to form a feedback message, and the feedback message is sent to the host side, wherein the feedback message can be a TLP message. When the host side receives the feedback message, it can parse the feedback message to obtain the data of the configuration space of the virtual device, and create the virtual device through the data of the configuration space of the virtual device to realize the device topology simulation.
[0055] On the basis of the above embodiment, the device identifier information sent by the host side after the reset is completed is received, and the device configuration information is modified to the device information recognizable by the host side based on the device identifier information. The device identifier information can be BDF (Bus, Device, Function, bus number, device number, function number) information. The host side extracts the above BDF information through the data in the configuration space of the device, and sends the device identifier information to the DPU side. The original device configuration information on the DPU side has been modified to the device information recognizable by the host side, so as to mark whether each device has completed the device topology simulation and verify the device topology simulation.
[0056] The device topology simulation method in this embodiment is triggered by a URI resource operation, which may be a virtual device creation operation. Specifically, a URI resource operation may be received, and the step of obtaining device configuration information and dictionary data may be driven based on the resource operation.
[0057] The technical solution of this embodiment is to pre-set device configuration information and dictionary data, wherein the device configuration information includes device-related information of different device types to be set in the DPU, and the dictionary data includes device type identifiers of different device types. A device topology relationship tree is constructed through the device configuration information and dictionary data, and device topology simulation is realized through message transmission with the host side, which is not limited by the device type and does not require code upgrade, thereby improving the flexibility and scalability of device topology simulation.
[0058] Figure 2 Schematic diagram of a device topology simulation apparatus provided by an embodiment of the present invention. Figure 2 As shown, the device comprises:
[0059] A relationship tree creation module 210, configured to obtain device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information;
[0060] A device creation module 220, configured to traverse the device topology tree and create a virtual device according to the traversed device information;
[0061] The information sending module 230 is used to receive the scanning message sent by the host end, read and write data to the configuration space of the virtual device in the device topology relationship tree based on the scanning message, and send the data reading and writing results to the host end so that the host end performs device topology simulation.
[0062] The technical solution of this embodiment is to pre-set device configuration information and dictionary data, wherein the device configuration information includes device-related information of different device types to be set in the DPU, and the dictionary data includes device type identifiers of different device types. A device topology relationship tree is constructed through the device configuration information and dictionary data, and device topology simulation is realized through message transmission with the host side, which is not limited by the device type and does not require code upgrade, thereby improving the flexibility and scalability of device topology simulation.
[0063] Based on the above embodiment, optionally, the device configuration information includes a device connection relationship and a device type, and the dictionary data includes an identifier of the device type.
[0064] Optionally, the relationship tree creation module 210 is used to:
[0065] Extract the device type in the device configuration information, and match the device type identifier in the dictionary data based on the device type; extract the device attachment relationship of the device in the device configuration information, the device attachment relationship includes parent node information and attached child node information; create the data structure of the device based on the device type identifier of the device, the parent node information and the attached child node information; form the device topology relationship tree based on multiple data structures of the devices.
[0066] Optionally, the data structure of the device includes a pointer to the child node;
[0067] The relationship tree creation module 210 is further used to: mount the data structure of each of the devices to the parent node of the device to form a device topology relationship tree.
[0068] Optionally, the device also includes: an instruction sending module, which is used to send a restart instruction to the host side after creating a virtual device according to the traversed device information, so as to trigger the host side to reset, and perform device scanning enumeration and send scanning messages during the reset process.
[0069] Optionally, the apparatus further includes: an information modification module, configured to receive device identifier information sent by the host end after completing the reset, and modify the device configuration information into device information recognizable by the host end based on the device identifier information.
[0070] Optionally, the device further includes: the relationship tree creation module 210 is further used for:
[0071] Before acquiring device configuration information and dictionary data, a URI resource operation is received, and the step of acquiring device configuration information and dictionary data is driven to be executed based on the resource operation.
[0072] The device topology simulation apparatus provided in the embodiment of the present invention can execute the device topology simulation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0073] Figure 3 It is a structural schematic diagram of a chip provided by an embodiment of the present invention, the chip includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the device topology simulation method.
[0074] The chip may be, but is not limited to, a DPU (Data Processing Unit) chip. The chip can implement device topology simulation without being restricted by device type and without requiring code upgrades, thereby improving the flexibility and scalability of device topology simulation.
[0075] The chip includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. Various programs and data required for chip operation can also be stored in the RAM 13. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0076] A number of components in the chip are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the chip to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0077] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the device topology simulation method.
[0078] In some embodiments, the device topology simulation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on a chip via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the device topology simulation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the device topology simulation method in any other appropriate manner (e.g., by means of firmware).
[0079] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0080] The computer program for implementing the device topology simulation method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0081] Figure 4 : is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0082] like Figure 4 As shown, the electronic device includes the chip 200 provided in the above embodiment, which is used to implement device topology simulation of the electronic device. The electronic device can implement device topology simulation by configuring the above chip, and is not limited by the device type, and does not need to upgrade the code, thereby improving the flexibility and scalability of device topology simulation.
[0083] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a device topology simulation method, the method comprising:
[0084] Acquire device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information; traverse the device topology relationship tree, and create a virtual device according to the traversed device information; receive a scan message sent by the host end, read and write data to the configuration space of the virtual device in the device topology relationship tree based on the scan message, and send the data reading and writing results to the host end, so that the host end performs device topology simulation.
[0085] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0086] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0087] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0088] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0089] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0090] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A device topology simulation method, characterized in that: include: Acquire device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information; Traversing the device topology tree, and creating a virtual device according to the traversed device information; A scan message sent by the host is received, data is read and written to the configuration space of the virtual device in the device topology relationship tree based on the scan message, and the data reading and writing result is sent to the host so that the host performs device topology simulation.
2. The method according to claim 1, characterized in that The device configuration information includes device connection relationship and device type, and the dictionary data includes the identifier of the device type.
3. The method according to claim 2, characterized in that The creating a device topology relationship tree based on the dictionary data and the device configuration information includes: Extracting the device type in the device configuration information, and matching the identifier of the device type in the dictionary data based on the device type; Extracting a device mounting relationship of a device in the device configuration information, wherein the device mounting relationship includes information of a parent node and information of a mounted child node; Creating a data structure of the device based on an identifier of the device type of the device, the parent node information, and information of the attached child node; The device topology relationship tree is formed based on the data structures of the plurality of devices.
4. The method according to claim 3, characterized in that The data structure of the device includes a pointer to the child node; The forming of the device topology relationship tree based on the data structures of the plurality of devices comprises: The data structure of each of the devices is mounted to the parent node of the device to form a device topology relationship tree.
5. The method according to claim 1, characterized in that After creating a virtual device based on the traversed device information, it also includes: A restart instruction is sent to the host end to trigger the host end to reset, and during the reset process, device scanning enumeration is performed and scanning messages are sent.
6. The method according to claim 1, characterized in that The method further comprises: Receive device identifier information sent by the host end after completing the reset, and modify the device configuration information to device information recognizable by the host end based on the device identifier information.
7. The method according to claim 1, characterized in that Before acquiring the device configuration information and the dictionary data, the method further includes: A URI resource operation is received, and the step of obtaining device configuration information and dictionary data is driven to be executed based on the resource operation.
8. A device topology simulation apparatus, characterized in that: include: A relationship tree creation module, used to obtain device configuration information and dictionary data, and create a device topology relationship tree based on the dictionary data and the device configuration information; A device creation module, used to traverse the device topology tree and create a virtual device according to the traversed device information; The information sending module is used to receive the scanning message sent by the host end, read and write data to the configuration space of the virtual device in the device topology relationship tree based on the scanning message, and send the data reading and writing results to the host end so that the host end performs device topology simulation.
9. A chip, characterized in that: The chip includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the device topology simulation method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The electronic device comprises the chip according to claim 9.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the device topology simulation method according to any one of claims 1 to 7 when executed.
Citation Information
Cited By
Multi-chip link management method and device in multi-chip verification environment
CN120822474A
Method and apparatus for multi-chip link management in a multi-chip verification environment
CN120822474B