PCIe MSIX interrupt generation method

By using interrupt counters and polling mechanisms in PCIe devices to process MSIX interrupt signals, the message loss problem caused by simultaneous triggering of multiple interrupt vectors is solved, and efficient interrupt signal reception and processing is achieved, improving the reliability and performance of the device.

CN118672951BActive Publication Date: 2024-11-01成都星拓微电子科技股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411162869.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-01
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

The existing PCIe MSIX interrupt mechanism may cause interrupt messages to be lost when multiple interrupt vectors are triggered simultaneously, affecting device performance and stability.

Method used

The interrupt counter is used to temporarily store the interrupt signal, and the interrupt request is sent in sequence on the MSIX interrupt interface through the polling mechanism to ensure that the interrupt message is not lost.

Benefits of technology

Without increasing power consumption, it effectively receives and processes a large number of simultaneous interrupt signals to avoid loss of interrupt messages and improves the reliability and performance of PCIe devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672951B_ABST
    Figure CN118672951B_ABST
Patent Text Reader

Abstract

The present invention discloses a PCIe MSIX interrupt generation method. In order to solve the problem of the risk of loss of interrupt messages, the PCIe MSIX interrupt generation method of the present invention includes: a first interrupt source sends an interrupt signal or an indication of an interrupt signal to a first interrupt counter, and the count value in the first interrupt counter is incremented by one; when the count value in the first interrupt counter is not zero, the flag information of the first interrupt counter is set to a valid state; polling the flag information of multiple interrupt counters, if the flag information of the first interrupt counter is in a valid state, sending a first interrupt request to an MSIX interrupt processing module; querying the MSIX table address according to the first interrupt request, reading the message address and message data and sending the message address and message data to the PCIe IP core, reading the mask bit and sending it to the MSIX interrupt processing module; then determining that the PCIe IP core generates an MSIX message according to the mask bit. The MSIX interrupt interface in the present invention can receive a large number of interrupt signals at the same time without causing loss.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to a PCIe MSIX interrupt generation method. Background Art

[0002] The core component of the computer system hardware architecture is the system bus, which is responsible for connecting the processor, main memory and peripheral devices together to achieve the transmission of data, control and status information. The development of the system bus has gone through the first and second generation parallel buses to the current third generation serial bus, namely Peripheral Component Interconnect express (PCIe).

[0003] PCIe is mainly used to connect computers to various external high-speed devices, such as network cards, graphics cards, hard disks, and Universal Serial Bus (USB) host controllers, which can all be connected to the computer's central processing unit through PCIe.

[0004] With the continuous growth of user demand, in order to improve the response speed of the central processor to PCIe events, PCIe introduced an interrupt mechanism. Initially, the traditional interrupt request (INTerrupt request, INTx) interrupt mechanism was adopted, but because INTx needs to occupy a dedicated interrupt pin, and for multi-functional PCIe devices, each function has at most one interrupt pin, when a specific event occurs, the driver needs to query the device to determine which event is triggered, which reduces the efficiency of interrupt processing. Therefore, the traditional INTx interrupt mechanism has been replaced by the message signal interrupt (Message Signal Interrupt, MSI).

[0005] However, MSI also has some limitations: first, the MSI mechanism only allows each PCIe Function to have a maximum of 32 interrupt vectors, which may not be sufficient for some application scenarios; second, under the MSI mechanism, all interrupt vectors of each PCIe Function share a message address and cannot be assigned to different CPUs to achieve balanced distribution of interrupt services among CPUs; finally, under the MSI mechanism, the interrupt vectors of all PCIe Functions are continuous, which cannot meet the needs of distinguishing interrupt priorities.

[0006] To solve these problems, the Message Signaled Interrupt Express (MSIX) interrupt mechanism came into being. MSIX supports up to 2048 interrupt vectors. The message and address corresponding to each interrupt vector are stored in a special MSIX table. Each interrupt vector corresponds to an entry in the MSIX table.

[0007] Although MSIX supports up to 2048 interrupt vectors, when a large number of interrupts are triggered simultaneously, the MSIX module in the PCIe intellectual property (IP) core may not be able to send so many MSIX interrupt messages at the same time, resulting in the loss of some interrupts, which may affect the performance of the PCIe device or even cause functional abnormalities.

[0008] In a PCIe chip or PCIe device with a PCIe interface, there will be a dedicated PCIe IP core to handle PCIe communication transactions, and a dedicated MSIX interrupt interface is set up to receive interrupt requests sent by the application layer. The MSIX interrupt interface can only receive one interrupt request at a time, while the application layer can send up to 2048 interrupt requests. A large number of interrupt requests may cause interrupt request loss.

[0009] In other words, in the prior art, the interrupt signal is directly connected to the interrupt processing module. When multiple interrupt messages are triggered at the same time, there is a risk of losing the interrupt message due to a lack of response time.

[0010] The present invention provides a PCIe MSIX interrupt generation method, which solves the problem of the risk of interrupt message loss when multiple interrupt vectors are triggered simultaneously, thereby improving reliability. Summary of the invention

[0011] In order to alleviate or partially alleviate the above technical problems, the solution of the present invention is as follows:

[0012] A PCIe MSIX interrupt generation method comprises the following steps: a first interrupt source sends an interrupt signal or an indication of an interrupt signal to a first interrupt counter, and the count value in the first interrupt counter is incremented by one; when the count value in the first interrupt counter is not zero, setting the flag information of the first interrupt counter to a valid state; wherein the first interrupt source is one of a plurality of interrupt sources in an application layer, the first interrupt counter is one of a plurality of interrupt counters, and the plurality of interrupt sources and the plurality of interrupt counters correspond to each other one by one; polling the flag information of a plurality of interrupt counters, and if the flag information of the first interrupt counter is in a valid state, sending a first interrupt request to an MSIX interrupt processing module; querying an MSIX table address according to the first interrupt request, reading a message address and message data and sending the message address and message data to a PCIe IP core, reading a mask bit and sending it to an MSIX interrupt processing module; if the mask bit is 0, the MSIX interrupt processing module sends a second interrupt request to an MSIX interrupt interface in the PCIe IP core; if the MSIX interrupt interface receives the second interrupt request, the PCIe IP core generates an MSIX message.

[0013] Further, if the PCIe IP core receives the second interrupt request, the MSIX interrupt interface sends second confirmation information to the MSIX interrupt processing module.

[0014] Furthermore, polling the flag information of multiple interrupt counters is performed by the interrupt query and processing module; after receiving the second confirmation information, the MSIX interrupt processing module sends the first confirmation information to the interrupt query and processing module.

[0015] Furthermore, after receiving the first confirmation information, the interruption query and processing module controls the count value in the first interruption counter to perform a subtraction operation.

[0016] Further, the mask bit is a bit of a control vector in the MSIX table.

[0017] Furthermore, the first interrupt request includes an interrupt number.

[0018] Furthermore, the method runs in a PCIe chip.

[0019] The technical solution of the present invention has the following beneficial technical effects:

[0020] Under the premise of not significantly increasing power consumption, the present invention temporarily stores the interrupt triggering signal through the inserted interrupt counter, and then sends these interrupts in the MSIX interrupt interface in sequence, so that the MSIX interrupt interface can simultaneously receive a large number of interrupt signals triggered simultaneously without losing these interrupt signals.

[0021] In addition, other beneficial effects of the present invention will be mentioned in the specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is an exemplary PCIe chip block diagram of the present invention;

[0023] Figure 2 It is a signal waveform diagram of the present invention;

[0024] Figure 3 It is a schematic diagram of the MSIX table structure of the present invention;

[0025] Figure 4 It is a flow chart of the PCIe MSIX interrupt generation method. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.

[0027] In order to clearly describe the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order.

[0028] Figure 1 The block diagram of an exemplary PCIe chip of the present invention is shown in FIG. The PCIe chip includes an application layer, an interrupt query and processing module, and a PCIe IP core.

[0029] N interrupt counters are also designed between the interrupt query and processing module and the application layer: a first interrupt counter, a second interrupt counter, ..., and an Nth interrupt counter, where N is a positive integer. The first interrupt counter can be any one of the N interrupt counters.

[0030] The application layer includes N interrupt sources: a first interrupt source, a second interrupt source, ..., and an Nth interrupt source, which correspond one-to-one to the aforementioned first interrupt counter, the second interrupt counter, ..., and the Nth interrupt counter, respectively.

[0031] An MSIX interrupt processing module and an MSIX table are designed between the interrupt query and processing module and the PCIe IP core. The present invention will introduce the working details of the above components in detail in the PCIe MSIX interrupt generation method later.

[0032] In addition, the PCIe IP core includes an MSIX interrupt interface. It is common technical knowledge in the art to establish a sending link and a receiving link between the PCIe core and the computer.

[0033] Figure 2 is a signal waveform diagram of the present invention. As an example, the interrupt source in the application layer sends a high-level pulse to the interrupt counter, and the count value in the interrupt counter increases by 1. After the interrupt source in the figure sends two high-level pulses continuously, the count value in the interrupt counter becomes 2. If a valid interrupt read occurs, the count value in the interrupt counter decreases by 1 and returns to the value 1.

[0034] Figure 3 Schematic diagram of the MSIX table structure of the present invention. The MSIX table includes multiple entries: entry 0, entry 1, ..., entry N-2 and entry N-1. Each entry includes multiple fields: DW3, DW2, DW1 and DW0.

[0035] As an example, the DW3 field is a control vector, the DW2 field is a data message, the DW1 field is an upper segment address, and the DW0 field is a lower segment address.

[0036] Figure 4 : is a flow chart of a PCIe MSIX interrupt generation method. The PCIe MSIX interrupt generation method of the present invention comprises the following steps:

[0037] First, an interrupt source in the application layer sends an interrupt signal, and the interrupt signal or an indication of the interrupt signal is transmitted to a corresponding interrupt counter. For example, if the first interrupt source sends an interrupt signal, the interrupt signal or an indication of the interrupt signal is transmitted to the first interrupt counter.

[0038] Furthermore, the interrupt source may send a high level pulse to the interrupt counter as an indication of the interrupt signal. After the interrupt counter receives a high level pulse, the count value in the interrupt counter is incremented by 1.

[0039] Furthermore, when the count value in the interrupt counter is not 0, the flag information is set to a valid state to notify the interrupt query and processing module to indicate that there is an interrupt signal that needs to be processed.

[0040] Further, when the count value in the interrupt counter is 0, the flag information is set to an invalid state.

[0041] Then, the interrupt query and processing module polls each interrupt counter, and when it is determined that the count value in the interrupt counter is not 0, that is, the flag information of the interrupt counter is in a valid state, the first interrupt request is sent to the MSIX interrupt processing module. By way of example, without loss of generality, it is assumed that the flag information of the first interrupt counter is in a valid state.

[0042] For example, when polling each interrupt counter, the interrupt query and processing module can check the flag information to determine whether the count value in the interrupt counter is 0. For example, if the flag information indicates that the count value in the interrupt counter is not 0, the flag information is set to be valid, otherwise it is set to be invalid.

[0043] Taking the flag information of the first interrupt counter as a valid state as an example, after the MSIX interrupt processing module sends the second interrupt request to the MSIX interrupt interface in the PCIe IP core, according to the second confirmation information sent by the MSIX interrupt interface to the MSIX interrupt processing module and the first confirmation information sent by the MSIX interrupt processing module to the interrupt query and processing module, the interrupt query and processing module sends a decrement instruction to the first interrupt counter. According to the received decrement instruction, the first interrupt counter performs a decrement operation on the count value in the first interrupt counter.

[0044] Furthermore, after the MSIX interrupt processing module receives the first interrupt request sent by the interrupt query and processing module, it queries the corresponding MSIX table address according to the interrupt number, reads the corresponding message address, message data and mask bits, and sends the message address and message data to the PCIe IP core, and then removes the message address and message data in the corresponding entry.

[0045] The first interrupt request includes an interrupt number, and the first interrupt request is an interrupt request generated according to an interrupt request format that can be parsed by the MSIX interrupt processing module.

[0046] The second interrupt request is an interrupt request generated according to an interrupt request format that can be parsed by the MSIX interrupt interface in the PCIe IP core.

[0047] Further, the mask bit is sent to the MSIX interrupt processing module. If the mask bit is 0, the MSIX interrupt processing module sends a second interrupt request to the MSIX interrupt interface in the PCIe IP core; otherwise, the MSIX interrupt processing module does not send the second interrupt request to the MSIX interrupt interface in the PCIe IP core.

[0048] Illustratively, the mask bit may be a bit in the control vector, illustratively, the first bit.

[0049] Finally, after the MSIX interrupt interface in the PCIe IP core receives the second interrupt request, the PCIe IP core generates an MSIX message to end the processing of an interrupt signal.

[0050] Further, if the PCIe IP core receives the second interrupt request, the MSIX interrupt interface sends a second confirmation message to the MSIX interrupt processing module to execute the aforementioned operation of causing the interrupt counter to decrement by 1.

[0051] Furthermore, as needed, the PCIe IP core may also send register configuration information to the MSIX table.

[0052] In order to better illustrate the present invention, numerous specific details are provided in the above specific embodiments. It should be understood by those skilled in the art that the present invention can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present invention.

[0053] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A PCIe MSIX interrupt generation method, characterized in that: The steps include: The first interrupt source sends an interrupt signal or an indication of an interrupt signal to the first interrupt counter, and the count value in the first interrupt counter increases by one; When the count value in the first interrupt counter is not zero, the flag information of the first interrupt counter is set to a valid state; wherein, The first interrupt source is one of a plurality of interrupt sources in the application layer, the first interrupt counter is one of a plurality of interrupt counters, and the plurality of interrupt sources and the plurality of interrupt counters correspond one to one; Polling flag information of multiple interrupt counters, if the flag information of the first interrupt counter is in a valid state, sending a first interrupt request to the MSIX interrupt processing module; Query the MSIX table address according to the first interrupt request, read the message address and message data and send the message address and message data to the PCIe IP core, read the mask bit and send it to the MSIX interrupt processing module; If the mask bit is 0, the MSIX interrupt processing module sends a second interrupt request to the MSIX interrupt interface in the PCIe IP core; If the MSIX interrupt interface receives a second interrupt request, the PCIe IP core generates an MSIX message.

2. The PCIe MSIX interrupt generation method according to claim 1, characterized in that: If the PCIe IP core receives the second interrupt request, the MSIX interrupt interface sends a second confirmation message to the MSIX interrupt processing module.

3. The PCIe MSIX interrupt generation method according to claim 2, characterized in that: Polling the flag information of multiple interrupt counters is performed by the interrupt query and processing module; After receiving the second confirmation information, the MSIX interrupt processing module sends the first confirmation information to the interrupt query and processing module.

4. The PCIe MSIX interrupt generation method according to claim 3, characterized in that: After receiving the first confirmation information, the interrupt query and processing module controls the count value in the first interrupt counter to perform a subtraction operation.

5. The PCIe MSIX interrupt generation method according to claim 4, characterized in that: The mask bit is a bit of the control vector in the MSIX table.

6. The PCIe MSIX interrupt generation method according to claim 5, characterized in that: The first interrupt request includes an interrupt number.

7. The PCIe MSIX interrupt generation method according to claim 6, characterized in that: The method is run in a PCIe chip.