Communication method, apparatus, storage medium, and electronic device
By using the request and response registers of the bridge-cross-core communication module in a multi-core processor, the resource mutual exclusion problem in communication between the multi-core processor and the hardware security module is solved, and effective communication between the multi-core processor and the hardware security module is achieved.
Patent Information
- Application Number
- CN202611517577.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-11-24
AI Technical Summary
Existing bridge-to-core communication modules only provide one set of registers, which is insufficient to meet the communication needs of multi-core processors and hardware security modules.
In multi-core processors, the target communication channel is determined by bridging the request register and response register of the cross-core communication module. When the task queue of the hardware security module is idle, the interrupt handling function is triggered to add the service request to the task queue and reset the response register, supporting communication processes in synchronous and asynchronous waiting modes.
It enables effective communication between multi-core processors and hardware security modules, solves the resource mutual exclusion problem, and is suitable for communication scenarios involving multi-core processors and hardware security modules.
Smart Images

Figure CN123157658A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, specifically to a communication method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the continuous development of automotive electronics and information technology, the number of software systems and their exposed interfaces in automobiles has increased explosively, leading to a year-on-year increase in cybersecurity risks. To meet the growing cybersecurity demands of OEMs and users, more and more chip companies are adding an independent HSM (Hardware Security Module) when designing and manufacturing chips to provide cybersecurity protection as a root of trust.
[0003] Hardware security modules typically integrate multiple commonly used cryptographic hardware peripherals and utilize hardware features such as exclusive flash memory and debug protection to achieve physical isolation. Software systems running on other cores need to establish communication with the hardware security module to access the information security functions it provides.
[0004] Currently, communication between the processor's cores and hardware security modules is typically provided through a Bridge (cross-core communication module). This Bridge module uses a set of registers to handle inter-core data transfer and interrupt triggering. However, during the development of this invention, the inventors discovered that since processors generally have multiple cores, and the software systems running on each core may need to access the hardware security module, the Bridge module, which only provides a set of registers for data transfer and interrupt triggering, is ill-suited for scenarios involving communication between multi-core processors and hardware security modules. Summary of the Invention
[0005] In response, this application provides a communication method, apparatus, storage medium, and electronic device to solve the problem that bridge-to-core communication hardware only provides a set of registers for data transmission and interrupt triggering, which is difficult to adapt to scenarios where processors have multiple cores and hardware security modules communicate.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0007] The first aspect of this application discloses a communication method applied to a multi-core processor, the multi-core processor comprising: a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores, wherein the bridge-cross-core communication module includes a request register and a response register, and N is a positive integer greater than or equal to 2, the method comprising:
[0008] When the kernel accesses the hardware security module, it determines the target communication channel of the communication channel module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module.
[0009] When the hardware security module receives the service request, it triggers the interrupt handling function of the bridge-core communication module. The interrupt handling function is used to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free.
[0010] Optionally, the above communication method further includes:
[0011] When the kernel accesses the hardware security module, it acquires a spinlock and then determines the target communication channel after acquiring the spinlock.
[0012] Optionally, the above communication method further includes:
[0013] When both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in a synchronous waiting mode, the hardware security module resets the request end flag of the target communication channel when it completes the service request. When the kernel determines that the request end flag of the target communication channel is 0, it reads the response result of the hardware security module and releases the target communication channel.
[0014] Optionally, the above communication method further includes:
[0015] When both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in asynchronous waiting mode, after the hardware security module completes the service request, it determines the responding kernel based on the kernel ID of the service request, and triggers the interrupt handling function of the bridge-cross-core communication module to perform interrupt handling on the responding kernel through the response register.
[0016] The response kernel reads the channel ID of the response register, resets the response register, executes the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and releases the channel ID of the response register after execution.
[0017] A second aspect of this application discloses a communication device applied to a multi-core processor, the multi-core processor comprising: a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores, the bridge-cross-core communication module comprising a request register and a response register, where N is a positive integer greater than or equal to 2, the device comprising:
[0018] The access request unit determines the target communication channel of the communication channel module when the kernel accesses the hardware security module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module.
[0019] The first execution processing unit is configured to trigger the interrupt handling function of the bridge-core communication module when the hardware security module receives the service request. The interrupt handling function is configured to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free.
[0020] Optionally, the communication device described above further includes:
[0021] The spinlock acquisition unit is used to acquire a spinlock when the kernel accesses the hardware security module, and to determine the target communication channel after acquiring the spinlock.
[0022] Optionally, the communication device described above further includes:
[0023] The first release unit is configured to, when both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in the synchronous waiting mode, reset the request end flag of the target communication channel when the hardware security module completes the service request, and when the kernel determines that the request end flag of the target communication channel is 0, read the response result of the hardware security module and release the target communication channel.
[0024] Optionally, the communication device described above further includes:
[0025] The second execution processing unit is configured to, when both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in the asynchronous waiting mode, after the hardware security module completes the service request, determine the responding kernel according to the kernel ID of the service request, and trigger the interrupt handling function of the bridge-cross-core communication module to perform interrupt handling on the responding kernel through the response register;
[0026] The second release unit is used by the response kernel to read the channel ID of the response register, reset the response register, execute the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and release the channel ID of the response register after execution.
[0027] A third aspect of this application discloses an electronic device, including a processor and a memory; wherein:
[0028] The memory is used to store computer instructions;
[0029] The processor is used to execute computer instructions stored in the memory, specifically performing the communication method as disclosed in any one of the first aspects.
[0030] The fourth aspect of this application discloses a storage medium for storing a program, which, when executed, is used to implement the communication method as described in any one of the first aspects.
[0031] This invention provides a communication method applied to a multi-core processor. The multi-core processor includes a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores. The bridge-cross-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2. When a core accesses the hardware security module, it determines the target communication channel of the communication channel module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module. When the hardware security module receives a service request, it triggers the interrupt handling function of the bridge-cross-core communication module. The interrupt handling function is used to add the service request to the task queue and reset the response register when the task queue of the hardware security module is empty, and to fill the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not empty. This allows different cores to communicate with the hardware security module simultaneously using a set of registers of the bridge-cross-core communication hardware, solving the resource mutual exclusion problem in communication between multi-core processors and the hardware security module, and thus adapting to scenarios where multi-core processors communicate with the hardware security module. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0033] Figure 1 This application provides a schematic diagram of the structure of a multi-kernel access hardware security module;
[0034] Figure 2 An internal structure diagram of the communication channel of a communication channel module provided in this application;
[0035] Figure 3 An internal structure diagram of a service request mark provided in this application;
[0036] Figure 4 A schematic diagram of the internal field structure of a request register provided in this application;
[0037] Figure 5 A schematic diagram of the internal field structure of a response register provided in this application;
[0038] Figure 6 This application provides a schematic diagram of the request phase communication process between the kernel and a hardware security module.
[0039] Figure 7 A schematic diagram of the communication process between the kernel and a hardware security module during the response phase, provided for the purposes of this application;
[0040] Figure 8 A schematic diagram of the communication flow between the kernel and the hardware security module during the response phase, provided for this application;
[0041] Figure 9 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation
[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] This application provides a communication method, apparatus, storage medium, and electronic device to solve the problem that bridge-cross-core communication hardware only provides a set of registers for data transmission and interrupt triggering, which is difficult to adapt to scenarios where processors have multiple cores and hardware security modules communicate.
[0044] This communication method can be applied to multi-core processors, such as... Figure 1 As shown, the multi-core processor mainly includes: a hardware security module, a bridge-core communication module, a communication channel module, and at least N cores. The bridge-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2.
[0045] The kernel acts as the request initiator, responsible for filling in the service request information and reading the response results from the hardware security module. For example, the kernel could be the Tricore core of the Infineon TC3x series chip.
[0046] The hardware security module acts as the request responder, responsible for receiving and processing service requests from the kernel.
[0047] The communication channel module includes several independent communication channels used to store inter-core synchronization control flags, kernel service request information, and hardware security module response information.
[0048] In some embodiments, the communication structure of the communication channel module provided in this application can be as follows: Figure 1 As shown, taking the TC3x series chip as an example of a multi-core processor, the communication channel module can be set in the LMU (Local Memory Unit) area of the chip. This area is a shared RAM area, which can be accessed by all CPU cores in a cache-free manner, effectively avoiding cache coherency issues.
[0049] In practical applications, the communication channel module can be an array of length 16, with each array element representing an independent channel. The communication channel module can implement communication transmission through communication flags, with different flags indicating different states of the communication channel. In this embodiment, the communication flags in the communication channel module mainly include: an occupation flag, a request end flag, a service response flag, and a service request flag.
[0050] In some embodiments, the internal structure of the communication channel of the communication channel module is as follows: Figure 2 As shown. The occupy flag can be represented by `occupyFlag`, which indicates whether the channel is occupied; a value of 1 indicates the channel is occupied, and a value of 0 indicates the channel is not occupied. In practical applications, whenever the Tricore core is about to send a service request to the HSM, it needs to traverse the occupy flags of each channel in the communication channels to obtain an available channel. An available channel can be any channel with an occupy flag of 0.
[0051] In some embodiments, the request end flag can be represented by requestEndFlag, which indicates whether the service request has ended. This flag is cleared whenever the HSM completes the service request for the channel; that is, the request end flag is 0 when the service request for the channel has ended, and 1 when the service request for the channel has not ended.
[0052] In some embodiments, the service response flag can be represented by `serviceResponse`, which indicates the service response result code. This code describes whether the HSM failed to execute the service request and the reason for the failure. The service response flag is 1 when the HSM successfully executes the service request, and 0 otherwise.
[0053] In some embodiments, the service request flag can be represented by serviceRequest, which describes all the information Tricore cores send to the HSM regarding the service request content.
[0054] It should be noted that, in addition to the above-mentioned flags, the communication channel of the communication channel module can also carry a flag with memory byte alignment, such as reserved, to align memory data.
[0055] In practical applications, the service request flag can be used to obtain information such as request type, sending kernel ID, service channel ID, service priority, request mode, callback function address, and service request content.
[0056] In some embodiments, the internal structure of the service request flag can be as follows: Figure 3 As shown, the request type can be represented by srvId. HSM can provide a variety of functions, including common cryptographic algorithms, secure boot, secure storage, etc. HSM uses this field to identify the request type and execute the corresponding processing logic.
[0057] In some embodiments, the sending kernel ID can be represented by coreId, which is the Tricore core ID that sent the request. After processing the asynchronous request, the HSM core triggers an interrupt from the bridge-cross-core communication module and sends the interrupt to a specific Tricore core based on the coreId. The corresponding Tricore core, upon receiving the interrupt from the bridge-cross-core communication module, executes the callback function set in the pCallBackFunc (callback function pointer) field.
[0058] In some embodiments, the service channel ID can be represented by channelId. After processing the asynchronous request, the HSM core will send this field to the Tricore core so that the Tricore core can find the corresponding channel and read the processing result.
[0059] In some embodiments, service priority can be represented by priority, and the HSM core can schedule according to the priority of the Tricore core request.
[0060] In some embodiments, the request mode can be represented by `requestMode`, which can be divided into synchronous and asynchronous request modes. The HSM will execute different logic based on the request mode to notify the HSM that processing is complete.
[0061] In some embodiments, the callback function address can be represented by pCallBackFunc. In asynchronous requests, the Tricore core executes the callback handling function logic after receiving the interrupt response notification from the HSM.
[0062] In some embodiments, the service request content can be represented by Srv, which includes the specific functions required by the service request, and the parameters required by the various functions supported by HSM are encapsulated by the union structure.
[0063] The bridge-to-core communication module is used to trigger interrupts and store inter-core communication flow control information.
[0064] The request register in the bridge-to-core communication module is the interrupt register for the kernel to send requests to the hardware security module, that is, the interrupt register for the Tricore core to send requests to the HSM. Its internal fields include... Figure 4 As shown, the definitions of each field are as shown in Table 1-1:
[0065] Table 1-1 Field Definitions of Interrupt Registers for Kernel Requests to Hardware Security Modules
[0066]
[0067] The response register in the bridge-to-core communication module is the interrupt register for the hardware security module to send responses to the kernel, that is, the interrupt register for the HSM to send responses to the Tricore core. Its internal fields include... Figure 5 As shown, the definitions of each field are as shown in Table 1-2:
[0068] Table 1-2 Field Definitions of Interrupt Registers for Hardware Security Modules Sending Responses to the Kernel
[0069]
[0070] The hardware security module has a built-in task queue for sequentially receiving and temporarily storing requests from various kernels.
[0071] This communication method primarily targets communication between the hardware security module and the kernel. The kernel acts as the request initiator in this communication method, while the hardware security module acts as the request responder. (See also...) Figure 6 The main steps include the following:
[0072] When the kernel accesses the hardware security module, that is, when the kernel initiates a service request to the hardware security module, the steps to be executed include S101 to S103:
[0073] S101. Determine the target communication channel for the communication channel module.
[0074] The target communication channel is an idle communication channel in the communication channel module.
[0075] In practical applications, the occupancy flags in the communication channel module are iterated to obtain an available channel, and then the occupancy flag is set to occupy the communication channel, thereby determining the target communication channel of the communication channel module.
[0076] In some embodiments, before performing step S101 and determining the target communication channel of the communication channel module, the following may also be included:
[0077] S100, Determine whether a spinlock has been acquired.
[0078] In practical applications, the kernel that initiates the request will first try to acquire the kernel's spinlock. This spinlock is a mutex lock. When multiple kernels try to acquire the spinlock at the same time, only one kernel can successfully acquire the spinlock. The other kernels will spin and wait until the kernel that acquired the spinlock releases the spinlock. Only then will the other kernels have a chance to reacquire the spinlock.
[0079] Spinlocks can prevent multiple kernels from simultaneously preempting a single communication channel and causing errors when multiple kernels access hardware security modules at the same time.
[0080] It is understandable that when the kernel accesses the hardware security module, it acquires the spinlock and then determines the target communication channel after acquiring the spinlock.
[0081] S102. Write the request information into the target communication channel.
[0082] After determining the target communication channel, the kernel will fill the request information into the target communication channel.
[0083] S103, The control request register sends a service request to the hardware security module.
[0084] In practical applications, a service request can be sent to the hardware security module by setting the request register. This service request is used to trigger the interrupt handling function of the bridge-to-core communication module.
[0085] When the hardware security module receives a service request, that is, when the hardware security module receives a service request from the kernel, the steps to be executed include S201:
[0086] S201, triggers the interrupt handling function of the bridge cross-core communication module.
[0087] In practical applications, the hardware security module continuously executes the main polling logic, proactively and constantly asking if there are any new service requests and whether the new service requests need to be processed.
[0088] During the continuous execution of the main polling logic by the hardware security module, if a service request initiated by the kernel is received, the interrupt handling function of the bridge-core communication module will be triggered. This interrupt handling function of the bridge-core communication module is used to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free.
[0089] Service requests added to the task queue can be executed sequentially or according to priority. This application does not impose specific limitations on them, and all of them are within the scope of protection of this application.
[0090] Specifically, when there is no free time in the task queue of the hardware security module, an error code is entered into the service response flag of the target communication channel.
[0091] It should be noted that after resetting the response register, the hardware security module exits the interrupt handling function of the bridge-to-core communication module and continues to execute the main polling logic. Both the kernel and the hardware security module enter the response phase.
[0092] For example, taking the Tricore core, which uses the Infineon TC3x series chip as its core, as an example, the request phase communication process between the Tricore core and the HSM can be as follows: Figure 6 As shown.
[0093] The communication method provided in this embodiment is applied to a multi-core processor, which includes a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores. The bridge-cross-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2. When a core accesses the hardware security module, it determines the target communication channel of the communication channel module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module. When the hardware security module receives a service request, it triggers the interrupt handling function of the bridge-cross-core communication module. The interrupt handling function is used to add the service request to the task queue and reset the response register when the task queue of the hardware security module is idle, and to fill the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not idle. This allows different cores to communicate with the hardware security module simultaneously using a set of registers of the bridge-cross-core communication hardware, solving the resource mutual exclusion problem in communication between multi-core processors and the hardware security module, and thus adapting to scenarios where multi-core processors communicate with the hardware security module.
[0094] In practical applications, the response phases of the kernel and hardware security modules can be divided into synchronous waiting modes and asynchronous waiting modes. For the synchronous waiting mode in the kernel and hardware security module response phases, the communication method provided in this application further includes:
[0095] When both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in synchronous waiting mode, the hardware security module resets the request end flag of the target communication channel when it completes the service request. When the kernel determines that the request end flag of the target communication channel is 0, it reads the response result of the hardware security module and releases the target communication channel.
[0096] Taking the Tricore kernel as an example again, the flowchart of the synchronous waiting mode when the Tricore kernel and HSM are in the response phase can be as follows: Figure 7 As shown, it mainly includes:
[0097] Tricore cores poll and wait for the target communication channel's request end flag to be 0 to determine whether the HSM has completed the service request.
[0098] After the HSM completes its service request, it resets the request termination flag of the target communication channel. At this point, the Tricore core reads the HSM's response and releases the target communication channel.
[0099] However, for asynchronous waiting modes in the response phase of the kernel and hardware security modules, the communication method provided in this application also includes:
[0100] When both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in asynchronous waiting mode, after the hardware security module completes the service request, it determines the responding kernel based on the kernel ID of the service request, and triggers the interrupt handling function of the bridge-cross-kernel communication module to perform interrupt handling on the responding kernel through the response register.
[0101] The kernel reads the channel ID from the response register, resets the response register, executes the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and releases the channel ID of the response register after execution.
[0102] Taking the Tricore kernel as an example again, the flowchart of the asynchronous waiting mode when the Tricore kernel and HSM are in the response phase is as follows: Figure 8 As shown, it mainly includes:
[0103] After receiving notification that the HSM has successfully received the service request, the Tricore core will end the waiting process and execute other processing logic.
[0104] After completing a service request, HSM first sets the SRC register to specify the Tricore core that will respond to the interrupt handler function of the bridge-cross-core communication module. Then, it triggers the interrupt handler function of the bridge-cross-core communication module corresponding to the Tricore core by setting the response register of the bridge-cross-core communication module.
[0105] The Tricore core will execute the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and release the channel ID of the response register after execution.
[0106] It is worth noting that the proposed solution supports both synchronous and asynchronous waiting modes in the response phases of the kernel and hardware security modules, which can be flexibly configured according to different application requirements and information security service characteristics, thereby improving the application flexibility of HSM.
[0107] Furthermore, this scheme defines the structure for inter-core information transmission, which can effectively transmit various kernel request information and HSM response results, and has a certain degree of scalability.
[0108] Based on the communication method provided in the above embodiments, another embodiment of this application also provides a communication device applicable to a multi-core processor. The multi-core processor includes: a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores. The bridge-cross-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2. The device includes:
[0109] The access request unit determines the target communication channel of the communication channel module when the kernel accesses the hardware security module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module.
[0110] The first execution processing unit is configured to trigger the interrupt handling function of the bridge-core communication module when the hardware security module receives the service request. The interrupt handling function is configured to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free.
[0111] In some embodiments, the communication device further includes:
[0112] The spinlock acquisition unit is used to acquire a spinlock when the kernel accesses the hardware security module, and to determine the target communication channel after acquiring the spinlock.
[0113] In some embodiments, the communication device further includes:
[0114] The first release unit is configured to, when both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in the synchronous waiting mode, reset the request end flag of the target communication channel when the hardware security module completes the service request, and when the kernel determines that the request end flag of the target communication channel is 0, read the response result of the hardware security module and release the target communication channel.
[0115] In some embodiments, the communication device further includes:
[0116] The second execution processing unit is configured to, when both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in the asynchronous waiting mode, after the hardware security module completes the service request, determine the responding kernel according to the kernel ID of the service request, and trigger the interrupt handling function of the bridge-cross-core communication module to perform interrupt handling on the responding kernel through the response register;
[0117] The second release unit is used by the response kernel to read the channel ID of the response register, reset the response register, execute the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and release the channel ID of the response register after execution.
[0118] The communication device provided in this embodiment is applied to a multi-core processor. The multi-core processor includes: a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores. The bridge-cross-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2. The device includes: an access request unit, which, when a core accesses the hardware security module, determines the target communication channel of the communication channel module, writes request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module; and a first execution processing unit, used for... When the hardware security module receives the service request, it triggers the interrupt handling function of the bridge-cross-core communication module. The interrupt handling function is used to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free. This enables different cores to communicate with the hardware security module simultaneously using a set of registers of the bridge-cross-core communication hardware, solving the resource mutual exclusion problem of multi-core and hardware security module communication, and thus adapting to the scenario of multi-core processors communicating with the hardware security module.
[0119] This application also provides an electronic device, such as... Figure 9 As shown, it includes a processor 601 and a memory 602, wherein:
[0120] The memory is used to store computer instructions;
[0121] The processor is used to execute computer instructions stored in the memory, specifically the communication method provided in any embodiment of the present invention.
[0122] This application also provides a storage medium for storing a program, which, when executed, is used to implement the communication method provided in any embodiment of the present invention.
[0123] The features described in the various embodiments of this specification can be substituted for or combined with each other. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the description of the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort. Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0124] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0125] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A communication method, characterized in that, Applied to a multi-core processor, the multi-core processor includes: a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores. The bridge-cross-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2. The method includes: When the kernel accesses the hardware security module, it determines the target communication channel of the communication channel module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module. When the hardware security module receives the service request, it triggers the interrupt handling function of the bridge-core communication module. The interrupt handling function is used to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free.
2. The communication method according to claim 1, characterized in that, Also includes: When the kernel accesses the hardware security module, it acquires a spinlock and then determines the target communication channel after acquiring the spinlock.
3. The communication method according to claim 1, characterized in that, Also includes: When both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in a synchronous waiting mode, the hardware security module resets the request end flag of the target communication channel when it completes the service request. When the kernel determines that the request end flag of the target communication channel is 0, it reads the response result of the hardware security module and releases the target communication channel.
4. The communication method according to claim 1, characterized in that, Also includes: When both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in asynchronous waiting mode, after the hardware security module completes the service request, it determines the responding kernel based on the kernel ID of the service request, and triggers the interrupt handling function of the bridge-cross-core communication module to perform interrupt handling on the responding kernel through the response register. The response kernel reads the channel ID of the response register, resets the response register, executes the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and releases the channel ID of the response register after execution.
5. A communication device, characterized in that, Applied to a multi-core processor, the multi-core processor includes: a hardware security module, a bridge-cross-core communication module, a communication channel module, and at least N cores. The bridge-cross-core communication module includes a request register and a response register, where N is a positive integer greater than or equal to 2. The device includes: The access request unit determines the target communication channel of the communication channel module when the kernel accesses the hardware security module, writes the request information into the target communication channel, and controls the request register to send a service request to the hardware security module. The target communication channel is an idle communication channel in the communication channel module. The first execution processing unit is configured to trigger the interrupt handling function of the bridge-core communication module when the hardware security module receives the service request. The interrupt handling function is configured to add the service request to the task queue and reset the response register when the task queue of the hardware security module is free, and to fill in the service response flag of the target communication channel and reset the response register when the task queue of the hardware security module is not free.
6. The communication device according to claim 5, characterized in that, Also includes: The spinlock acquisition unit is used to acquire a spinlock when the kernel accesses the hardware security module, and to determine the target communication channel after acquiring the spinlock.
7. The communication device according to claim 5, characterized in that, Also includes: The first release unit is configured to, when both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in the synchronous waiting mode, reset the request end flag of the target communication channel when the hardware security module completes the service request, and when the kernel determines that the request end flag of the target communication channel is 0, read the response result of the hardware security module and release the target communication channel.
8. The communication device according to claim 5, characterized in that, Also includes: The second execution processing unit is configured to, when both the hardware security module and the kernel are in the response phase, if the hardware security module and the kernel are in the asynchronous waiting mode, after the hardware security module completes the service request, determine the responding kernel according to the kernel ID of the service request, and trigger the interrupt handling function of the bridge-cross-core communication module to perform interrupt handling on the responding kernel through the response register; The second release unit is used by the response kernel to read the channel ID of the response register, reset the response register, execute the corresponding response result processing logic according to the callback function processing address configured in the channel ID of the response register, and release the channel ID of the response register after execution.
9. An electronic device, characterized in that, Includes processor and memory; wherein: The memory is used to store computer instructions; The processor is used to execute computer instructions stored in the memory, specifically the communication method as described in any one of claims 1-4.
10. A storage medium, characterized in that, Used to store a program, which, when executed, is used to implement the communication method as described in any one of claims 1 to 4.
