Command processing method, device, equipment and computer readable storage medium
By applying for memory space on the SOC and using quantity registers and first-in-first-out buffers to manage command data, the problem of high CPU polling frequency is solved, and the instruction processing efficiency and controller utilization are improved.
Patent Information
- Application Number
- CN202311330665.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-10-13
AI Technical Summary
During the command processing process, the SOC's central processor needs to continuously poll the status register, resulting in the inability to process other services in a timely manner and low command processing efficiency.
The central processor applies for memory space on the SOC to store the command data to be processed, and uses the quantity register and the first-in-first-out buffer to manage the processing and status updates of the command data, reducing the number of polls and improving processing efficiency.
This reduces the polling frequency, improves the SOC's business processing capabilities and instruction processing efficiency, and improves the utilization of the controller.
Smart Images

Figure CN117520228B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a command processing method, apparatus, device, and computer-readable storage medium. Background Art
[0002] In today's era of data explosion, with the development of storage technology, smart network cards are increasingly appearing in people's sight. People have handed over many of the processing of the System On Chip (SOC) to the hardware (i.e., the controller) for calculation, so there is non-volatile memory express (NVME) offloading. In order to pursue flexibility, many network cards currently only do the data processing offloading part.
[0003] In the related technology, when processing a command, the central processing unit of the SOC sends the command to the hardware register through the bus, the hardware parses the command to generate a hardware descriptor, and the hardware drives the DMA to move data through the descriptor. After the move is completed, the hardware writes feedback (Acknowledgement, ack) completion status to the status register. The central processing unit of the SOC polls the processing status of the status register. When the polled processing status is the ack completion status, the SOC sends the next command.
[0004] However, the entire command processing process requires the SOC's central processor to constantly poll the processing status of the status register, resulting in the SOC being unable to process other services in a timely manner. The next command can only be sent after the previous command is completed, requiring the central processor to keep sending commands, resulting in low instruction processing efficiency. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a command processing method, device, equipment and computer-readable storage medium to reduce the polling frequency so that the SOC can handle other services, improve the utilization rate of the controller, and improve the instruction processing efficiency.
[0006] In a first aspect, an embodiment of the present disclosure provides a command processing method, the method comprising:
[0007] Applying for memory space on the SOC through the central processing unit, and storing the command data to be processed in the memory space;
[0008] Sending the accumulated quantity of command data and the storage address of each command data to be processed to the quantity register through the central processing unit;
[0009] Reading the accumulated number of command data and the storage address of each command data to be processed from the number register by the controller, and calculating the number of command data to be processed in the memory space based on the accumulated number of command data;
[0010] Determine, by the controller, whether the state of the first-in-first-out buffer is a first preset state;
[0011] If the state of the FIFO buffer is a first preset state, driving the DMA engine to move the command data to be processed from the memory space according to the first descriptor, parsing the command to be processed from the command data to be processed, generating a second descriptor of the command to be processed, and storing the command to be processed in the FIFO buffer;
[0012] Driving a DMA engine to sequentially process the pending commands in the FIFO buffer based on the second descriptor by a controller;
[0013] Determining, by a controller, whether the state of the FIFO buffer is a second preset state;
[0014] If the state of the FIFO buffer is the second preset state, the processing state of the state register of the pending command is updated to a completion state through the controller.
[0015] In a second aspect, an embodiment of the present disclosure provides a command processing device, the device comprising:
[0016] A storage module, used to apply for memory space on the SOC through the central processing unit, and store the command data to be processed in the memory space;
[0017] A sending module, used for sending the accumulated quantity of command data and the storage address of each command data to be processed to the quantity register through the central processing unit;
[0018] a calculation module, configured to read the cumulative number of command data and the storage address of each command data to be processed from the number register through a controller, and calculate the number of command data to be processed in the memory space based on the cumulative number of command data;
[0019] A first determination module, used for determining through a controller whether the state of the FIFO buffer is a first preset state;
[0020] a moving module, configured to drive the DMA engine to move the command data to be processed from the memory space according to the first descriptor if the state of the FIFO buffer is the first preset state, parse the command to be processed from the command data to be processed, generate a second descriptor of the command to be processed, and store the command to be processed in the FIFO buffer;
[0021] A processing module, configured to drive a DMA engine to sequentially process the to-be-processed commands in the FIFO buffer based on the second descriptor through a controller;
[0022] A second determination module, configured to determine, through a controller, whether the state of the FIFO buffer is a second preset state;
[0023] The first updating module is used for updating the processing status of the status register of the to-be-processed command to a completion status through a controller if the status of the FIFO buffer is a second preset status.
[0024] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0025] Memory;
[0026] Processor; and
[0027] Computer programs;
[0028] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0029] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method as described in the first aspect.
[0030] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method described in the first aspect is implemented.
[0031] The command processing method, device, equipment and computer-readable storage medium provided by the embodiment of the present disclosure apply for memory space on the SOC through the central processing unit, store the command data to be processed in the memory space, send the cumulative number of command data and the storage address of each command data to be processed to the number register through the central processing unit, read the cumulative number of command data and the storage address of each command data to be processed from the number register through the controller, and calculate the number of command data to be processed in the memory space based on the cumulative number of command data. Further, the controller determines whether the state of the first-in-first-out buffer is the first preset state. If the state of the first-in-first-out buffer is the first preset state, the DMA engine is driven according to the first descriptor to move the command data to be processed from the memory space, parse the command to be processed from the command data to be processed, generate the second descriptor of the command to be processed, and store the command to be processed in the first-in-first-out buffer. Then, the controller drives the DMA engine based on the second descriptor to process the commands to be processed in the first-in-first-out buffer in sequence, and the controller determines whether the state of the first-in-first-out buffer is the second preset state. Furthermore, if the state of the FIFO buffer is the second preset state, the processing state of the status register of the pending command is updated to the completion state through the controller. Compared with the prior art, the present disclosure applies for memory space on the SOC through the central processing unit, stores the pending command data in the memory space, and can send multiple pending command data at one time, thereby improving the efficiency of command sending. When the state of the FIFO buffer is the second preset state, the processing state of the status register of the pending command is updated to the completion state through the controller, and the completion state of multiple pending command data can be polled at the same time, thereby reducing the number of completion state polling times, allowing the SOC to handle other services, improving the utilization rate of the controller, and improving the instruction processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0034] Figure 1 A flowchart of a command processing method provided by an embodiment of the present disclosure;
[0035] Figure 2A flowchart of a command processing method provided by another embodiment of the present disclosure;
[0036] Figure 3 A schematic diagram of the structure of a command processing device provided in an embodiment of the present disclosure;
[0037] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0038] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0039] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0040] In today's era of data explosion, with the development of storage technology, smart network cards are increasingly appearing in people's sight. People have handed over many of the processing of the System On Chip (SOC) to the hardware (i.e., the controller) for calculation, so there is non-volatile memory express (NVME) offloading. In order to pursue flexibility, many network cards currently only do the data processing offloading part.
[0041] In the related technology, when processing a command, the central processing unit of the SOC sends the command to the hardware register through the bus, the hardware parses the command to generate a hardware descriptor, and the hardware drives the DMA to move data through the descriptor. After the move is completed, the hardware writes feedback (Acknowledgement, ack) completion status to the status register. The central processing unit of the SOC polls the processing status of the status register. When the polled processing status is the ack completion status, the SOC sends the next command.
[0042] However, the entire command processing process requires the central processor of the SOC to constantly poll the processing status of the status register, resulting in the SOC being unable to process other services in a timely manner. The next command can only be sent after the previous command is completed, requiring the central processor to keep sending commands, resulting in low instruction processing efficiency. To address this problem, the present disclosure provides a command processing method, which is described below in conjunction with a specific embodiment.
[0043] Figure 1A flow chart of the command processing method provided in the embodiment of the present disclosure. The executor of the method is an electronic device. The electronic device may be a portable mobile device such as a smart phone, a tablet computer, a laptop computer, a car navigation device, an intelligent sports equipment, etc.; it may also be a fixed device such as a personal computer, a smart home appliance, a server, etc., wherein the server may be a single server or a server cluster, and the server cluster may be a distributed cluster or a centralized cluster. The electronic device includes a central processing unit and a controller, the central processing unit is equivalent to software, and the controller is equivalent to hardware. The method can be applied to the scenario of processing commands, and can also be applied to the scenario of sensing the completion status of commands. It can be understood that the command processing method provided in the embodiment of the present disclosure can also be applied in other scenarios.
[0044] Below Figure 1 The command processing method shown is introduced, the central processing unit is equivalent to software, the controller is equivalent to hardware, and the specific steps of the method are as follows:
[0045] S101 , applying for memory space on the SOC through a central processing unit, and storing command data to be processed in the memory space.
[0046] In this step, the central processing unit applies for memory space on the SOC and stores the pending command data in the memory space. Specifically, the software applies for a piece of memory space on the SOC. The size of the memory is determined by the software, which depends on the SOC polling interval and the SOC resource situation. The larger the memory applied for, the more pending commands can be stored. The longer the SOC polling interval, the fewer polling times. The software only needs to continue adding new commands to the memory when the command in the memory is about to be completed. The memory space is used to store the pending command data.
[0047] In some embodiments, applying for memory space on the SOC through the central processor includes: sending a request for memory space to the SOC through the central processor; and the SOC is used to allocate memory space for the command data to be processed based on the request.
[0048] S102: Send the accumulated number of command data and the storage address of each command data to be processed to the number register through the central processing unit.
[0049] In this step, the central processor sends the cumulative number of command data and the storage address of each command data to be processed to the quantity register, and may also send the data length of each command data to be processed. Optionally, the quantity register may be a doorbell register, which is not limited.
[0050] S103, reading the accumulated number of command data and the storage address of each command data to be processed from the number register through the controller, and calculating the number of command data to be processed in the memory space based on the accumulated number of command data.
[0051] In this step, the controller can read the cumulative number of command data and the storage address of each command data to be processed from a quantity register such as a doorbell register. The controller further calculates the number of command data to be processed in the memory space based on the cumulative number of command data.
[0052] S104: Determine, by the controller, whether the state of the FIFO buffer is a first preset state.
[0053] In this step, the controller determines whether the state of the FIFO buffer is a first preset state. Specifically, the first preset state is a non-full state, that is, the write address is less than a preset threshold. The controller determines whether the write address of the FIFO buffer is less than the preset threshold. For example, the depth of the FIFO buffer is 8, and the preset threshold is 7. This is only an example, and the depth of the FIFO buffer and the preset threshold are not limited.
[0054] S105. If the state of the first-in-first-out buffer is the first preset state, drive the DMA engine to move the command data to be processed from the memory space according to the first descriptor, parse the command to be processed from the command data to be processed, generate a second descriptor of the command to be processed, and store the command to be processed in the first-in-first-out buffer.
[0055] If the controller determines that the state of the FIFO buffer is the first preset state, the controller drives the DMA engine to move the pending command data from the memory space according to the first descriptor, and further, after moving the pending command data, parses the pending command from the pending command data, generates a second descriptor of the pending command, and stores the pending command in the FIFO buffer. Optionally, the first descriptor is used to drive the DMA engine to move the pending command data from the memory space, and the second descriptor is used to drive the DMA engine to process the pending command.
[0056] In some embodiments, if the controller determines that the state of the FIFO buffer is not the first preset state, the controller no longer moves the command data to be processed from the memory space, and the DMA engine is in a waiting state.
[0057] S106: Drive a DMA engine through a controller based on the second descriptor to sequentially process the pending commands in the first-in-first-out buffer.
[0058] After generating the second descriptor of the pending command, the controller drives the DMA engine to process the pending commands in the FIFO buffer in sequence based on the second descriptor. Specifically, the DMA engine processes the first pending command in the FIFO buffer, and after the first pending command is processed, the DMA engine processes the second pending command in the FIFO buffer until all pending commands in the FIFO buffer are processed.
[0059] S107: Determine, by a controller, whether the state of the FIFO buffer is a second preset state.
[0060] In this step, the controller determines whether the state of the FIFO buffer is a second preset state, the second preset state is an empty state, and the controller determines whether the read address of the FIFO buffer is an empty state.
[0061] S108: If the state of the FIFO buffer is the second preset state, the controller updates the processing state of the state register of the to-be-processed command to a completion state.
[0062] If it is determined that the state of the first-in-first-out buffer is the second preset state, it means that all the pending commands in the first-in-first-out buffer have been processed. The controller updates the processing state of the status register of the pending commands to the completion state. The completion state of multiple pending command data can be polled at the same time, reducing the number of completion state polling times, so that the SOC can handle other services, improve the utilization rate of the controller, and improve the instruction processing efficiency.
[0063] In some embodiments, if it is determined that the state of the first-in-first-out buffer is not the second preset state, it means that the pending commands in the first-in-first-out buffer have not been processed, then the controller continues to drive the DMA engine based on the second descriptor to process the pending commands in the first-in-first-out buffer in sequence.
[0064] In the disclosed embodiment, a central processor applies for memory space on the SOC, stores the command data to be processed in the memory space, sends the cumulative number of command data and the storage address of each command data to be processed to the quantity register through the central processor, reads the cumulative number of command data and the storage address of each command data to be processed from the quantity register through the controller, and calculates the number of command data to be processed in the memory space based on the cumulative number of command data. Further, the controller determines whether the state of the first-in-first-out buffer is the first preset state. If the state of the first-in-first-out buffer is the first preset state, the DMA engine is driven according to the first descriptor to move the command data to be processed from the memory space, parses the command to be processed from the command data to be processed, generates a second descriptor of the command to be processed, and stores the command to be processed in the first-in-first-out buffer. Then, the controller drives the DMA engine based on the second descriptor to process the commands to be processed in the first-in-first-out buffer in sequence, and the controller determines whether the state of the first-in-first-out buffer is the second preset state. Furthermore, if the state of the FIFO buffer is the second preset state, the processing state of the status register of the pending command is updated to the completion state through the controller. Compared with the prior art, the present disclosure applies for memory space on the SOC through the central processing unit, stores the pending command data in the memory space, and can send multiple pending command data at one time, thereby improving the efficiency of command sending. When the state of the FIFO buffer is the second preset state, the processing state of the status register of the pending command is updated to the completion state through the controller, and the completion state of multiple pending command data can be polled at the same time, thereby reducing the number of completion state polling times, allowing the SOC to handle other services, improving the utilization rate of the controller, and improving the instruction processing efficiency.
[0065] Figure 2 A flowchart of a command processing method provided by another embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the method includes the following steps:
[0066] S201, applying for memory space on the SOC through the central processing unit, and storing the command data to be processed in the memory space.
[0067] Specifically, the implementation process and principle of S201 and S101 are the same, and will not be repeated here.
[0068] S202: Send the accumulated number of command data and the storage address of each command data to be processed to the number register through the central processing unit.
[0069] Specifically, the implementation process and principle of S202 and S102 are the same, and will not be repeated here.
[0070] S203, read the cumulative number of command data and the storage address of each command data to be processed from the quantity register through the controller, and calculate the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register based on the tail pointer of the command data to be processed and the head pointer in the head pointer register.
[0071] Optionally, the cumulative number of command data includes a tail pointer of the command data to be processed. In this embodiment, the controller reads the cumulative number of command data and the storage address of each command data to be processed from the number register, and further the controller calculates the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register based on the tail pointer of the command data to be processed and the head pointer in the head pointer register. The tail pointer of the command data to be processed is used to represent the cumulative number of command data, that is, the total number of command data so far; the head pointer in the head pointer register is the number of command data that has been processed; the difference between the tail pointer and the head pointer represents the number of command data to be processed.
[0072] S204: Determine the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register as the amount of command data to be processed in the memory space.
[0073] Further, the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register is determined as the number of command data to be processed in the memory space. For example, the tail pointer of the command data to be processed is 10, the head pointer in the head pointer register is 6, and the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register is 4, and it is determined that the number of command data to be processed in the memory space is 4 command data to be processed.
[0074] S205: Determine, by the controller, whether the state of the FIFO buffer is a first preset state.
[0075] Specifically, the implementation process and principle of S205 and S104 are the same, and will not be repeated here.
[0076] S206. If the state of the first-in-first-out buffer is the first preset state, drive the DMA engine to move the command data to be processed from the memory space according to the first descriptor, parse the command to be processed from the command data to be processed, generate a second descriptor of the command to be processed, and store the command to be processed in the first-in-first-out buffer.
[0077] Specifically, the implementation process and principle of S206 and S105 are the same, and will not be repeated here.
[0078] In some embodiments, when S206 drives the DMA engine to move the command data to be processed from the memory space according to the first descriptor, specifically includes but is not limited to S2061 and S2062:
[0079] S2061. Generate a first descriptor for moving the command data to be processed based on the storage address of each piece of command data to be processed.
[0080] In this embodiment, the controller generates a first descriptor according to the storage address of each command data to be processed, and the first descriptor is used to drive the DMA engine to move the command data to be processed from the memory space.
[0081] S2062: Drive the DMA engine to move the command data to be processed from the storage address of each piece of command data to be processed in the memory space based on the first descriptor.
[0082] In this embodiment, the controller drives the DMA engine to move the command data to be processed from the storage address of each command data to be processed in the memory space according to the first descriptor.
[0083] S207: Drive a DMA engine through a controller based on the second descriptor to sequentially process the pending commands in the first-in-first-out buffer.
[0084] Specifically, the implementation process and principle of S207 and S106 are the same, and will not be repeated here.
[0085] In some embodiments, S207 may include but is not limited to S2071, S2072, S2073:
[0086] S2071, determining, by the controller, whether the state of the DMA engine is an idle state;
[0087] S2072, if the state of the DMA engine is an idle state, reading a target command from a first-in-first-out buffer through a controller, and sending a second descriptor corresponding to the target command to the DMA engine;
[0088] In some embodiments, the target command is read from a first-in-first-out buffer by a controller, and a second descriptor corresponding to the target command is sent to a DMA engine, including: reading a next executed command from the pending commands in the first-in-first-out buffer by a controller, and determining the next executed command as the target command; determining a second descriptor corresponding to the target command from the second descriptors of the pending commands, and sending the second descriptor corresponding to the target command to the DMA engine.
[0089] In some embodiments, if the state of the DMA engine is not an idle state, it means that the DMA engine is moving data, and then waiting is performed.
[0090] S2073. Drive a DMA engine to process the target command based on the second descriptor.
[0091] In this step, the controller drives the DMA engine to process the target command based on the second descriptor. Specifically, the controller drives the DMA engine to execute the data moving operation corresponding to the target command based on the second descriptor.
[0092] S208: Determine, by a controller, whether the state of the FIFO buffer is a second preset state.
[0093] Specifically, the implementation process and principle of S208 and S107 are the same, and will not be repeated here.
[0094] S209: If the state of the FIFO buffer is the second preset state, the controller updates the processing state of the state register of the pending command to a completion state.
[0095] Specifically, the implementation process and principle of S209 and S108 are the same, and will not be repeated here.
[0096] S210 . Update the head pointer in the head pointer register through the controller.
[0097] After updating the processing status of the status register of the pending command to the completion status, the controller further updates the head pointer in the head pointer register, that is, updates the number of processed command data after the processing of the pending command is completed.
[0098] S211. Obtain, through a central processing unit, a processing status of a status register of the command to be processed and a head pointer of the head pointer register.
[0099] In this step, the central processing unit obtains the processing status of the status register of the command to be processed and the head pointer of the head pointer register to sense the processing status of the command to be processed.
[0100] In some embodiments, after obtaining the processing status of the status register of the command to be processed and the head pointer of the head pointer register through the central processing unit, the method also includes: sending the cumulative number of command data for the next time and the storage address of each command data to be processed next time to the quantity register through the central processing unit to process the next command.
[0101] In the disclosed embodiment, a central processor applies for memory space on the SOC, stores the command data to be processed in the memory space, sends the cumulative number of command data and the storage address of each command data to be processed to the quantity register through the central processor, reads the cumulative number of command data and the storage address of each command data to be processed from the quantity register through the controller, calculates the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register based on the tail pointer of the command data to be processed, and determines the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register as the number of command data to be processed in the memory space. Further, the controller determines whether the state of the first-in-first-out buffer is the first preset state. If the state of the first-in-first-out buffer is the first preset state, the DMA engine is driven to move the command data to be processed from the memory space according to the first descriptor, parses the command to be processed from the command data to be processed, generates a second descriptor of the command to be processed, and stores the command to be processed in the first-in-first-out buffer. Then, the controller drives the DMA engine based on the second descriptor to process the pending commands in the FIFO buffer in sequence, and the controller determines whether the state of the FIFO buffer is the second preset state. If the state of the FIFO buffer is the second preset state, the controller updates the processing state of the status register of the pending command to the completion state. Then, the controller updates the head pointer in the head pointer register, and the central processing unit obtains the processing state of the status register of the pending command and the head pointer of the head pointer register. Compared with the prior art, the embodiment of the present disclosure applies for memory space on the SOC through the central processing unit, stores the pending command data in the memory space, and can send multiple pending command data at one time, thereby improving the efficiency of command sending. When the state of the FIFO buffer is the second preset state, the controller updates the processing state of the status register of the pending command to the completion state, and can simultaneously poll the completion state of multiple pending command data, thereby reducing the number of completion state polling, so that the SOC can handle other services, improve the utilization rate of the controller, and improve the instruction processing efficiency.
[0102] Figure 3 Schematic diagram of the structure of the command processing device provided in the embodiment of the present disclosure. The command processing device may be the electronic device as described in the above embodiment, or the command processing device may be a component or assembly in the electronic device. The command processing device provided in the embodiment of the present disclosure may execute the processing flow provided in the command processing method embodiment, such as Figure 3As shown, the command processing device 300 includes: a storage module 301, a sending module 302, a calculation module 303, a first judgment module 304, a moving module 305, a processing module 306, a second judgment module 307, and a first update module 308; wherein the storage module 301 is used to apply for memory space on the SOC through the central processing unit, and store the command data to be processed in the memory space; the sending module 302 is used to send the cumulative number of command data and the storage address of each command data to be processed to the number register through the central processing unit; the calculation module 303 is used to read the cumulative number of command data and the storage address of each command data to be processed from the number register through the controller, and calculate the number of command data to be processed in the memory space based on the cumulative number of command data; the first judgment module 304 is used to judge the first-in-first-out through the controller The first-in-first-out buffer is configured to determine whether the state of the first-in-first-out buffer is a first preset state; the moving module 305 is configured to drive the DMA engine to move the command data to be processed from the memory space according to the first descriptor if the state of the first-in-first-out buffer is the first preset state, parse the command to be processed from the command data to be processed, generate a second descriptor of the command to be processed, and store the command to be processed in the first-in-first-out buffer; the processing module 306 is configured to drive the DMA engine to process the commands to be processed in the first-in-first-out buffer in sequence based on the second descriptor through the controller; the second judging module 307 is configured to determine whether the state of the first-in-first-out buffer is a second preset state through the controller; the first updating module 308 is configured to update the processing state of the status register of the command to be processed to a completion state through the controller if the state of the first-in-first-out buffer is the second preset state.
[0103] Optionally, when the storage module 301 applies for memory space on the SOC through the central processor, it is specifically used to: send a request for memory space to the SOC through the central processor; and the SOC is used to allocate memory space for the command data to be processed based on the request.
[0104] Optionally, the cumulative number of command data includes a tail pointer of command data to be processed; when the calculation module 303 calculates the number of command data to be processed in the memory space based on the cumulative number of command data, it is specifically used to: calculate the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register based on the tail pointer of the command data to be processed and the head pointer in the head pointer register; determine the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register as the number of command data to be processed in the memory space.
[0105] Optionally, when the moving module 305 drives the DMA engine to move the command data to be processed from the memory space according to the first descriptor, it is specifically used to: generate a first descriptor for moving the command data to be processed based on the storage address of each command data to be processed; and drive the DMA engine to move the command data to be processed from the storage address of each command data to be processed in the memory space based on the first descriptor.
[0106] Optionally, when the processing module 306 drives the DMA engine through the controller based on the second descriptor to process the pending commands in the first-in-first-out buffer in sequence, it is specifically used to: determine whether the state of the DMA engine is an idle state through the controller; if the state of the DMA engine is an idle state, read the target command from the first-in-first-out buffer through the controller, and send the second descriptor corresponding to the target command to the DMA engine; and drive the DMA engine to process the target command based on the second descriptor.
[0107] Optionally, when the processing module 306 reads the target command from the first-in-first-out buffer through the controller and sends the second descriptor corresponding to the target command to the DMA engine, it is specifically used to: read the next executed command from the pending commands in the first-in-first-out buffer through the controller, and determine the next executed command as the target command; determine the second descriptor corresponding to the target command from the second descriptor of the pending commands, and send the second descriptor corresponding to the target command to the DMA engine.
[0108] Optionally, after the first update module 308 updates the processing status of the status register of the command to be processed to a completed status through the controller, the command processing device 300 also includes: a second update module 309 and an acquisition module 310; the second update module 309 is used to update the head pointer in the head pointer register through the controller; the acquisition module 310 is used to acquire the processing status of the status register of the command to be processed and the head pointer of the head pointer register through the central processing unit.
[0109] Figure 3 The command processing device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0110] Figure 4 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 4 , which shows a structural schematic diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0111] like Figure 4 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603 to implement the command processing method of the embodiment described in the present disclosure. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0112] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0113] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the command processing method as described above. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0114] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0115] In addition, an embodiment of the present disclosure further provides a vehicle, comprising: a memory; a processor; and a computer program; wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the command processing method as described above.
[0116] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with 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"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0117] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0118] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0119] Applying for memory space on the SOC through the central processing unit, and storing the command data to be processed in the memory space;
[0120] Sending the accumulated quantity of command data and the storage address of each command data to be processed to the quantity register through the central processing unit;
[0121] Reading the accumulated number of command data and the storage address of each command data to be processed from the number register by the controller, and calculating the number of command data to be processed in the memory space based on the accumulated number of command data;
[0122] Determine, by the controller, whether the state of the first-in-first-out buffer is a first preset state;
[0123] If the state of the FIFO buffer is a first preset state, driving the DMA engine to move the command data to be processed from the memory space according to the first descriptor, parsing the command to be processed from the command data to be processed, generating a second descriptor of the command to be processed, and storing the command to be processed in the FIFO buffer;
[0124] Driving a DMA engine to sequentially process the pending commands in the FIFO buffer based on the second descriptor by a controller;
[0125] Determining, by a controller, whether the state of the FIFO buffer is a second preset state;
[0126] If the state of the FIFO buffer is the second preset state, the processing state of the state register of the pending command is updated to a completion state through the controller.
[0127] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0128] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0129] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0130] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0131] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0132] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. 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.
[0133] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0134] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0135] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A command processing method, characterized in that: The method comprises: Applying for memory space on the SOC through the central processing unit, and storing the command data to be processed in the memory space; Sending the accumulated quantity of command data and the storage address of each command data to be processed to the quantity register through the central processing unit; Reading the accumulated number of command data and the storage address of each command data to be processed from the number register by the controller, and calculating the number of command data to be processed in the memory space based on the accumulated number of command data; Determine, by the controller, whether the state of the first-in-first-out buffer is a first preset state; If the state of the FIFO buffer is a first preset state, driving the DMA engine to move the command data to be processed from the memory space according to the first descriptor, parsing the command to be processed from the command data to be processed, generating a second descriptor of the command to be processed, and storing the command to be processed in the FIFO buffer; Driving a DMA engine to sequentially process the pending commands in the FIFO buffer based on the second descriptor by a controller; Determining, by a controller, whether the state of the FIFO buffer is a second preset state; If the state of the FIFO buffer is the second preset state, the processing state of the state register of the pending command is updated to a completion state through the controller; The first preset state is a non-full state, that is, the write address is less than a preset threshold; the controller determines whether the state of the first-in-first-out buffer is the first preset state, including: Determine by the controller whether the write address of the first-in-first-out buffer is less than a preset threshold; The second preset state is an empty state; and the controller is used to determine whether the state of the first-in-first-out buffer is the second preset state, including: The controller determines whether the read address of the first-in-first-out buffer is in an empty state.
2. The method according to claim 1, characterized in that The applying for memory space on the SOC through the central processing unit includes: A request for memory space is sent to the SOC via the central processing unit; the SOC is used to allocate memory space for the command data to be processed based on the request.
3. The method according to claim 1, characterized in that: The cumulative amount of command data includes a tail pointer of the command data to be processed; The calculating the amount of command data to be processed in the memory space based on the accumulated amount of command data includes: Based on the tail pointer of the command data to be processed and the head pointer in the head pointer register, calculating the difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register; The difference between the tail pointer of the command data to be processed and the head pointer in the head pointer register is determined as the amount of command data to be processed in the memory space.
4. The method according to claim 1, characterized in that: The step of driving the DMA engine to move the command data to be processed from the memory space according to the first descriptor includes: Based on the storage address of each piece of command data to be processed, generating a first descriptor for moving the command data to be processed; The DMA engine is driven based on the first descriptor to move the command data to be processed from the storage address of each piece of command data to be processed in the memory space.
5. The method according to claim 1, characterized in that The controller drives the DMA engine based on the second descriptor to sequentially process the pending commands in the first-in-first-out buffer, including: Determine through the controller whether the state of the DMA engine is idle; If the state of the DMA engine is an idle state, the target command is read from the first-in-first-out buffer through the controller, and the second descriptor corresponding to the target command is sent to the DMA engine; A DMA engine is driven to process the target command based on the second descriptor.
6. The method according to claim 5, characterized in that The controller reads the target command from the first-in-first-out buffer and sends the second descriptor corresponding to the target command to the DMA engine, including: Reading a next executed command from the pending commands in the first-in-first-out buffer by a controller, and determining the next executed command as a target command; A second descriptor corresponding to the target command is determined from the second descriptors of the commands to be processed, and the second descriptor corresponding to the target command is sent to a DMA engine.
7. The method according to claim 1, characterized in that After the controller updates the processing status of the status register of the pending command to a completion status, the method further includes: Updating the head pointer in the head pointer register by the controller; The processing status of the status register of the command to be processed and the head pointer of the head pointer register are obtained through the central processing unit.
8. A command processing device, characterized in that: include: A storage module, used to apply for memory space on the SOC through the central processing unit, and store the command data to be processed in the memory space; A sending module, used for sending the accumulated quantity of command data and the storage address of each command data to be processed to the quantity register through the central processing unit; a calculation module, configured to read the cumulative number of command data and the storage address of each command data to be processed from the number register through a controller, and calculate the number of command data to be processed in the memory space based on the cumulative number of command data; A first determination module, used for determining through a controller whether the state of the FIFO buffer is a first preset state; a moving module, configured to drive the DMA engine to move the command data to be processed from the memory space according to the first descriptor if the state of the FIFO buffer is the first preset state, parse the command to be processed from the command data to be processed, generate a second descriptor of the command to be processed, and store the command to be processed in the FIFO buffer; A processing module, configured to drive a DMA engine to sequentially process the to-be-processed commands in the FIFO buffer based on the second descriptor through a controller; A second determination module, configured to determine, through a controller, whether the state of the FIFO buffer is a second preset state; A first updating module, configured to update the processing status of the status register of the to-be-processed command to a completion status through a controller if the status of the FIFO buffer is a second preset status; The first preset state is a non-full state, that is, the write address is less than a preset threshold; when the first judgment module judges through the controller whether the state of the first-in-first-out buffer is the first preset state, it is specifically used to: Determine by the controller whether the write address of the first-in-first-out buffer is less than a preset threshold; The second preset state is an empty state; when the second judgment module judges through the controller whether the state of the first-in-first-out buffer is the second preset state, it is specifically used to: The controller determines whether the read address of the first-in-first-out buffer is in an empty state.
9. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Information handling system including non-disruptive command and data movement between storage and one or more auxiliary processors
US6226695B1
Data writing method, system-on-chip chip, and computer readable storage medium
WO2022198601A1
