Method, device and equipment for realizing GPIO (General Purpose Input / Output) controller supporting virtualization

By hardware isolation and virtualization mapping of GPIO in a multi-operating system environment, the problem of GPIO controller access conflict is solved, and flexible interrupt grouping and high security solutions are realized, reducing hardware overhead and wiring pressure, suitable for Automotive chips with high functional safety requirements.

CN119025451AActive Publication Date: 2024-11-26SIENGINE TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411167799.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-26
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

In a multi-operating system environment, access to the same GPIO controller is prone to conflicts. Existing solutions such as reading and writing first or using Firewall will lead to hardware waste and flexibility, which will be difficult to meet functional security requirements.

Method used

By isolating GPIOs with hardware and virtualized mapping in 4k domains, the address space of GPIOs is divided into multiple 4k domains, allocated to GPIO and GIC respectively, and the GIC ID is used for interrupt grouping to ensure that each GPIO is only the corresponding GIC Handle the interruption.

Benefits of technology

Without increasing chip area and GIC SPI usage, the problem of access conflicts between multiple operating systems for the same GPIO controller is solved, and the flexibility and security of interrupting packets is achieved, reducing chip manufacturing costs and wiring pressure are reduced, and the cost of savings of GIC SPI number.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025451A_ABST
    Figure CN119025451A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device and equipment for realizing a GPIO (General Purpose Input / Output) controller supporting virtualization, and relates to the technical field of communication control, the method comprises the following steps of: carrying out hardware isolation on GPIOs corresponding to a safgpiounit, and carrying out virtualization mapping on registers in 4k domains with the same number based on the number of GPIOs corresponding to a next group of registers of a GPIO controller; based on the number of GPIOs and the number of GICs, the address space of GPIOs is cut into 4k domains with the set number; the first number of 4k domains are distributed to the internal reg of each GPIO, and the second number of 4k domains are distributed to each GIC. According to the method and the device, the problem of access conflict of multiple operating systems to the same GPIO controller can be solved, and the interruption grouping is ensured to be flexible and configurable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication control technology, and in particular to a method, device and equipment for implementing a GPIO controller supporting virtualization. Background Art

[0002] Currently, the entire GPIO (General-purpose input / output) controller only occupies a 4k domain. Taking a 32-bit GPIO controller as an example, a GPIO controller contains a set of 32-bit registers that can control 32 GPIOs, and each bit corresponds to a GPIO. Through software configuration of registers, each GPIO can be configured to various required modes, such as input or output, whether to interrupt debounce, debounce time, level-triggered interrupt or edge-triggered interrupt, whether to clear interrupt, etc. For interrupts, generally for a GPIO controller, 32 interrupts of 32 GPIOs will be combined into one interrupt line and sent out.

[0003] For a single operating system, the above solution will not have any problems in the implementation process, but for multiple operating systems, since they cannot control each other, when the same GPIO controller is operated, it is easy to overwrite by mistake. For example, operating system 1 only wants to configure GPIO1 under the GPIO controller, but accidentally overwrites the configuration of other 31 GPIOs. The existing SOC (System on Chip) chips are generally multi-core heterogeneous architectures and multi-operating systems. Although the following three methods can be used to resolve conflicts, none of them is ideal: Method 1: Read first and then write. However, if two operating systems configure the same controller at the same time, conflicts will still occur, causing unexpected consequences, and it is difficult to avoid, especially for automotive chips with high functional safety requirements. This error may cause unacceptable safety issues. Method 2: With the help of a firewall, a GPIO controller is used by only one operating system to solve the problem of accidental rewriting. However, this will greatly limit the flexibility of the entire SOC system and also cause a large waste of GPIO. Method 3: A GPIO controller contains only one GPIO. However, if there are a large number of GPIOs, more instantiations will occupy a large amount of chip area. In addition, one GPIO corresponds to one interrupt line. Each GIC (Generic Interrupt Controller) must be connected to all GPIO interrupt lines. For example, if there are 200 GPIOs, each GIC must be connected to 200 GPIO interrupt lines, which poses a great challenge to layout and routing. In addition, the number of SPIs of GIC is limited, so this method is also a huge waste of SPI. Summary of the invention

[0004] The present application provides a method, apparatus and device for implementing a GPIO controller supporting virtualization, which can solve the problem of access conflicts between multiple operating systems to the same GPIO controller and ensure that interrupt grouping is flexible and configurable.

[0005] In a first aspect, an embodiment of the present application provides a method for implementing a GPIO controller supporting virtualization, and the method for implementing a GPIO controller supporting virtualization includes: The GPIO corresponding to saf_gpio_unit is hardware isolated, and based on the number of GPIOs corresponding to a group of registers under the GPIO controller, the registers are virtually mapped in the same number of 4k domains; Based on the number of GPIOs and the number of GICs, the GPIO address space is divided into a set number of 4k domains; Allocate the first number of 4k domains to the internal regs of the GPIOs respectively, and allocate the second number of 4k domains to the GICs respectively; The set quantity is the sum of the first quantity and the second quantity.

[0006] In combination with the first aspect, in one implementation, the GPIO corresponding to the saf_gpio_unit is hardware isolated, and based on the number of GPIOs corresponding to a group of registers under the GPIO controller, the registers are virtualized and mapped in the same number of 4k domains, specifically including: Get the 32 GPIOs corresponding to saf_gpio_unit and perform hardware isolation on the 32 GPIOs; A set of 32-bit registers under the GPIO controller are virtually mapped in 32 4k domains.

[0007] In combination with the first aspect, in one implementation, the step of dividing the GPIO address space into a set number of 4k domains based on the number of GPIOs and the number of GICs specifically includes: Get the number of GPIOs and GICs, and cut the GPIO address space into 37 4k domains, where the number of GPIOs obtained is 32 and the number of GICs is 5.

[0008] In combination with the first aspect, in one implementation, allocating the first number of 4k domains to the internal regs of each GPIO respectively and allocating the second number of 4k domains to each GIC respectively specifically includes: For the 37 4k domains, 32 4k domains are respectively allocated to the internal regs of the 32 GPIOs, and 5 4k domains are allocated to the 5 GICs, wherein each GPIO corresponds to a 4k domain, and each GIC corresponds to a 4k domain.

[0009] In combination with the first aspect, in one implementation, the 37 4k domains are cut into 18 bits of address, and the 18 bits include the upper 6 bits, the lower 8 bits and the other 4 bits.

[0010] In combination with the first aspect, in one implementation, the upper 6 bits are used to distinguish 4k domains, the lower 8 bits are used for internal reg addressing of 32 GPIOs, and the other 4 bits are all set to 0, indicating no meaning.

[0011] In combination with the first aspect, in one implementation, the GPIO controller implementation method further includes: A GIC ID is allocated to each GPIO, and the GIC ID is used to identify the GIC to which the GPIO belongs. When the GPIO completes the GIC ID allocation, the GPIO interrupts are grouped.

[0012] In combination with the first aspect, in one implementation, the interrupt status of the GPIO in each group can only be read from the corresponding 4k domain of the GIC corresponding to the current group.

[0013] In a second aspect, an embodiment of the present application provides a GPIO controller implementation device supporting virtualization, and the GPIO controller implementation device supporting virtualization includes: The mapping module is used to perform hardware isolation on the GPIO corresponding to saf_gpio_unit, and based on the number of GPIOs corresponding to a group of registers under GPIOcontroller, virtualize the registers in the same number of 4k domains; A split module, which is used to split the GPIO address space into a set number of 4k domains based on the number of GPIOs and the number of GICs; An allocation module, which is used to allocate the first number of 4k domains to the internal regs of each GPIO respectively, and allocate the second number of 4k domains to each GIC respectively; The set quantity is the sum of the first quantity and the second quantity.

[0014] In a third aspect, an embodiment of the present application provides a GPIO controller implementation device that supports virtualization, wherein the GPIO controller implementation device that supports virtualization includes a processor, a memory, and a GPIO controller implementation program that supports virtualization, which is stored in the memory and can be executed by the processor, wherein when the GPIO controller implementation program that supports virtualization is executed by the processor, the steps of the above-mentioned GPIO controller implementation method that supports virtualization are implemented.

[0015] The beneficial effects brought by the technical solution provided in the embodiments of the present application include: Without increasing the chip area, increasing the back-end layout and routing pressure, and occupying too much of the GIC's SPI (Serial Peripheral Interface), the problem of multiple operating systems accessing the same GPIO controller is solved, and flexible interrupt grouping is ensured. At the same time, considering the back-end wiring pressure and the limited number of GIC SPIs, through design improvements, flexible access to multiple virtual machines is achieved, with high security, convenient software operation, saving chip manufacturing costs, greatly reducing the back-end layout and routing pressure, greatly saving the number of SPIs on the GIC, and flexible interrupt configuration. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A flowchart of a method for implementing a GPIO controller supporting virtualization in this application; Figure 2 This is a functional block diagram corresponding to the implementation method of the GPIO controller supporting virtualization in this application; Figure 3 A schematic diagram of the functional modules of a GPIO controller implementation device supporting virtualization in this application; Figure 4 A schematic diagram of the hardware structure of the GPIO controller implementation device supporting virtualization for this application. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0018] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0019] On the first aspect, the embodiments of the present application provide a method for implementing a GPIO controller that supports virtualization, which solves the problem of access conflicts between multiple operating systems to the same GPIO controller without increasing the chip area, increasing the pressure on back-end layout and wiring, and occupying too much SPI (Serial Peripheral Interface) of GIC, and ensures that interrupt grouping is flexible and configurable.

[0020] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of the implementation method of the GPIO controller supporting virtualization in this application. Figure 1 As shown, the implementation method of the GPIO controller supporting virtualization includes: S1: Perform hardware isolation on the GPIO corresponding to saf_gpio_unit, and based on the number of GPIOs corresponding to a group of registers under the GPIO controller, virtualize and map the registers in the same number of 4k domains; It should be noted that saf_gpio_unit, namely GPIO secure access unit, is a main functional module used to implement register configuration and interrupt processing.

[0021] Furthermore, in one embodiment, the GPIO corresponding to saf_gpio_unit is hardware isolated, and based on the number of GPIOs corresponding to a group of registers under GPIOcontroller, the registers are virtualized and mapped in the same number of 4k domains, specifically including: S101: Obtain 32 GPIOs corresponding to saf_gpio_unit, and perform hardware isolation on the obtained 32 GPIOs; S102: Virtually map a group of 32-bit registers under the GPIO controller in 32 4k domains.

[0022] Specifically, the 32 GPIOs of saf_gpio_unit are isolated by hardware, and then a set of 32-bit registers under the GPIO controller are virtually mapped in 32 4k domains.

[0023] S2: Based on the number of GPIOs and the number of GICs, the GPIO address space is divided into a set number of 4k domains; Furthermore, in one embodiment, based on the number of GPIOs and the number of GICs, the address space of the GPIO is cut into a set number of 4k domains, specifically including: taking WIDTH=32 and GIC_NUM=5 as an example, the number of GPIOs and the number of GICs are obtained, and the address space of the GPIO is cut into 37 4k domains, wherein the number of GPIOs obtained is 32 and the number of GICs is 5.

[0024] See also Figure 2 As shown, it is a functional block diagram corresponding to the implementation method of the GPIO controller supporting virtualization in this application, Figure 2 Take WIDTH=32 and GIC_NUM=5 as an example, where WIDTH indicates the number of GPIOs and GIC_NUM indicates the number of GICs. Both WIDTH and GIC_NUM are parameters, which can be configured according to specific usage scenarios when the module is instantiated. The GPIO address space is divided into 37 4k domains. Figure 2 In the example, intr[i] represents an interrupt line. NVIC stands for Embedded Vectored Interrupt Controller, which is a type of GIC.

[0025] S3: Allocate the first number of 4k domains to the internal reg of each GPIO respectively, and allocate the second number of 4k domains to each GIC respectively; set the number to be the sum of the first number and the second number.

[0026] Furthermore, in one embodiment, a first number of 4k domains are respectively allocated to the internal reg of each GPIO, and a second number of 4k domains are respectively allocated to each GIC, specifically including: for the 37 4k domains cut, 32 4k domains are respectively allocated to the internal regs (i.e., registers, which is the abbreviation of registers) of 32 GPIOs, and 5 4k domains are allocated to 5 GICs, wherein each GPIO corresponds to a 4k domain, and each GIC corresponds to a 4k domain. Figure 2 In the figure, GPIO0~GPIO31 represent 32 GPIO domains, GIC0, GIC1, GIC2, NVIC0, NVIC1 represent 5 GICs, intr0(GIC0), intr1(GIC1), intr2(GIC2), intr3(NVIC0), intr4(NVIC1) represent 5 GIC domains. Address Re-Mapping represents address mapping, and Address Decoder represents address decoder.

[0027] Specifically, for the address space of the divided GPIO, 37 4k domains are obtained, of which the first 32 4k domains are respectively allocated to the internal regs of the 32 GPIOs, and the other 5 4k domains are allocated to the 5 GICs.

[0028] It should be noted that, for the 37 4k domains, the address occupies 18 bits, and the 18 bits include the upper 6 bits, the lower 8 bits and the other 4 bits. The upper 6 bits are used to distinguish the 4k domains, the lower 8 bits are used for the internal reg addressing of the 32 GPIOs, and the other 4 bits are all set to 0, indicating that they have no meaning. Specifically, for the 37 4k domains, the address will occupy 18 bits, and only the lower 18 bits are valid. Among them, the upper 6 bits of the 18 bits are used to distinguish different 4k domains, and the lower 8 bits are used for the internal reg addressing of the 32 GPIOs, which will cause 4 bits to be useless, so all the unused bits are set to "0".

[0029] Furthermore, the GPIO controller implementation method of the present application also includes: allocating a GIC ID (code) to each GPIO, wherein the GIC ID is used to identify the GIC to which the GPIO belongs, and when the GPIO completes the GIC ID allocation, the GPIO interrupts are grouped.

[0030] Specifically, a GIC ID is assigned to each GPIO, and a total of 32 GIC IDs are assigned. The 32 GIC IDs are used to identify the GIC to which the GPIO belongs. After the GIC ID is configured, the corresponding bit of the intr_status register of the corresponding GIC ID will be turned on. When all 32 GPIOs are configured with GIC IDs, the grouping of GPIO interrupts is realized. The interrupt status of the GPIO in each group can only be read from the corresponding 4k domain of the GIC corresponding to the current group.

[0031] The firewall configures which operating system has access to each 4k domain of the GPIO controller. In other words, the firewall configures which operating system each GPIO belongs to. For example, GPIO0 and GPIO3 can be configured to OS1, and GPIO1 and GPIO2 can be configured to OS2.

[0032] The solution of the present application occupies a total of 37 (WIDTH+GIC_NUM) 4k address spaces, which is 36 more than the existing solution. However, the virtualization method is adopted to avoid access conflicts among multiple operating systems. It has the flexibility of Solution 3 described in the background technology, but only has the hardware overhead of Solution 1 and Solution 2. The software operation is simpler and more convenient than Solution 1 and Solution 2, and is as convenient as Solution 3.

[0033] Regarding the implementation method of the GPIO controller supporting virtualization of the present application, the software operation process in the actual application process is described below. Assuming that the firewall has been configured, the steps are as follows: Step 1: Configure the GIC ID of GPIO (configure the GIC ID of the GPIOs that need to be used, and do not configure the GPIOs that are not used); Step 2: Configure GPIO DDR, that is, in / out direction; Step 3: Configure INTMASK; Step 4: Configure INTTYPE; Step 5: Configure INTPOL; Step 6: Configure DEBTIME; Step 7: Configure DEBEN (interrupt debounce is enabled, GPIO _in will be used by the controller after two-beat synchronization. If DEBEN is not enabled, it will not cause metastable state. GPIO _in will be given to intr after two-beat synchronization); Step 8: Configure INTEN; Step 9: Assuming that GPIO0 and GPIO2 both belong to GIC1 (assuming they are both input), if GPIO0_in or GPIO2_in goes up, the corresponding SPI of GIC1 will go up, and the 4k domain of the corresponding GIC will be read to obtain the interrupt status of the GIC domain; Step 10: APB write writes 1 to the INTSTATUS of the corresponding GPIO to clear the corresponding interrupt.

[0034] The implementation method of the GPIO controller supporting virtualization in the embodiment of the present application solves the access conflict problem of the same GPIO controller under multiple operating systems based on the defects of the existing design. At the same time, considering the pressure of back-end layout and wiring, and the limited number of SPIs of GIC, etc., through design improvement, beneficial effects are achieved in the following aspects: 1. Flexible access to multiple virtual machines avoids access conflicts between multiple operating systems to the same GPIO controller. With Firewall, any GPIO under a GPIO controller can be configured for use by any operating system. When different operating systems access the same GPIO controller, there will be no access conflict. That is, when operating system 1 configures the GPIO under operating system 1, it will not rewrite the GPIO of operating system 2. In other words, access conflicts between operating systems are avoided, and it is extremely flexible and there is no GPIO waste. 2. High security, avoiding functional safety issues caused by access conflicts caused by accidental rewriting of multiple operating systems, which is especially important for automotive chips with high functional safety requirements; 3. The software is easy to operate. The software operation is convenient and flexible. You don’t need to consider the GPIO configuration under other operating systems. You only need to focus on the GPIO configuration of the current operating system, which makes the software development code concise and simplified, saves the running time when the GPIO configuration instructions are issued, and improves the response speed; 4. Save chip manufacturing costs. The number of GPIOs contained in a GPIO controller can be configured during instantiation, supporting up to 32 GPIOs. It is easy to instantiate. A GPIO controller can contain 32 GPIOs with a small area, which greatly saves chip area. Compared with the solution of "a GPIO controller contains only one GPIO", the area is reduced by nearly 31 times; 5. Greatly reduce the pressure of back-end layout and wiring. The instantiation is simple and the number of instantiations is small, which greatly reduces the pressure of back-end layout and the number of interrupt lines. For a GPIO controller with 32 GPIOs, only one interrupt line is connected to one GIC, which greatly reduces the pressure of back-end wiring. 6. Greatly save the number of SPI on GIC and the number of interrupt lines. The number of SPI occupied is 1 / 32 of the solution "one GPIO controller contains only one GPIO"; 7. Interrupt configuration is flexible and supports interrupt grouping by GIC. How to group can be configured by software, which is extremely flexible and all GPIO functions are retained.

[0035] In a second aspect, an embodiment of the present application also provides a GPIO controller implementation device that supports virtualization.

[0036] In one embodiment, referring to Figure 3 , Figure 3 This is a functional module diagram of a GPIO controller implementation device supporting virtualization in this application. Figure 3 As shown, the GPIO controller implementation device supporting virtualization includes: a mapping module, a segmentation module, and an allocation module.

[0037] The mapping module is used to perform hardware isolation on the GPIO corresponding to saf_gpio_unit, and based on the number of GPIOs corresponding to a group of registers under GPIOcontroller, virtualize the registers in the same number of 4k domains; The segmentation module is used to segment the GPIO address space into a set number of 4k domains based on the number of GPIOs and the number of GICs; the allocation module is used to allocate a first number of 4k domains to the internal regs of each GPIO, and a second number of 4k domains to each GIC; wherein the set number is the sum of the first number and the second number.

[0038] Among them, the functional implementation of each module in the above-mentioned GPIO controller implementation device supporting virtualization corresponds to the steps in the above-mentioned GPIO controller implementation method embodiment supporting virtualization, and its functions and implementation processes are no longer repeated here.

[0039] In a third aspect, an embodiment of the present application provides a GPIO controller implementation device that supports virtualization. The GPIO controller implementation device that supports virtualization may be a personal computer (PC), a laptop computer, a server, or other device with data processing capabilities.

[0040] Reference Figure 4 , Figure 4 The hardware structure diagram of the GPIO controller implementation device supporting virtualization involved in the embodiment of the present application is shown in FIG. In the embodiment of the present application, the GPIO controller implementation device supporting virtualization may include a processor, a memory, a communication interface, and a communication bus.

[0041] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.

[0042] The communication interface includes input / output (I / O) interface, physical interface and logical interface, etc., which are used to realize the GPIO controller supporting virtualization to realize the interconnection of devices inside the device, and the interface used to realize the GPIO controller supporting virtualization to realize the interconnection of the device with other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display (Display), a keyboard (Keyboard), etc.

[0043] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0044] The processor may be a general-purpose processor, and the general-purpose processor may call the GPIO controller implementation program supporting virtualization stored in the memory, and execute the GPIO controller implementation method supporting virtualization provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the GPIO controller implementation program supporting virtualization is called may refer to the various embodiments of the GPIO controller implementation method supporting virtualization of the present application, and will not be repeated here.

[0045] Those skilled in the art will understand that Figure 4 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0046] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0047] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.

[0048] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.

[0049] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0050] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.

[0051] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.

[0052] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for implementing a GPIO controller supporting virtualization, characterized in that: The method for implementing the GPIO controller supporting virtualization includes: The GPIO corresponding to saf_gpio_unit is hardware isolated, and based on the number of GPIOs corresponding to a group of registers under the GPIO controller, the registers are virtually mapped in the same number of 4k domains; Based on the number of GPIOs and the number of GICs, the GPIO address space is divided into a set number of 4k domains; Allocate the first number of 4k domains to the internal regs of the GPIOs respectively, and allocate the second number of 4k domains to the GICs respectively; The set quantity is the sum of the first quantity and the second quantity.

2. A method for implementing a GPIO controller supporting virtualization as claimed in claim 1, characterized in that: The GPIO corresponding to saf_gpio_unit is isolated by hardware, and based on the number of GPIOs corresponding to a group of registers under the GPIO controller, the registers are virtualized and mapped in the same number of 4k domains, specifically including: Get the 32 GPIOs corresponding to saf_gpio_unit and perform hardware isolation on the 32 GPIOs; A set of 32-bit registers under the GPIO controller are virtually mapped in 32 4k domains.

3. A method for implementing a GPIO controller supporting virtualization as claimed in claim 2, characterized in that: The address space of the GPIO is divided into a set number of 4k domains based on the number of GPIOs and the number of GICs, specifically including: Get the number of GPIOs and GICs, and cut the GPIO address space into 37 4k domains, where the number of GPIOs obtained is 32 and the number of GICs is 5.

4. A method for implementing a GPIO controller supporting virtualization as claimed in claim 3, characterized in that: The first number of 4k domains are respectively allocated to the internal regs of each GPIO, and the second number of 4k domains are respectively allocated to each GIC, specifically including: For the 37 4k domains, 32 4k domains are respectively allocated to the internal regs of the 32 GPIOs, and 5 4k domains are allocated to the 5 GICs, wherein each GPIO corresponds to a 4k domain, and each GIC corresponds to a 4k domain.

5. A method for implementing a GPIO controller supporting virtualization as claimed in claim 3, characterized in that: The 37 4k domains occupy 18 bits of address, and the 18 bits include the upper 6 bits, the lower 8 bits and the other 4 bits.

6. A method for implementing a GPIO controller supporting virtualization as claimed in claim 5, characterized in that: The upper 6 bits are used to distinguish the 4k domain, the lower 8 bits are used for internal reg addressing of 32 GPIOs, and the other 4 bits are all set to 0, indicating no meaning.

7. A method for implementing a GPIO controller supporting virtualization as claimed in claim 1, characterized in that: The GPIO controller implementation method also includes: A GIC ID is allocated to each GPIO, and the GIC ID is used to identify the GIC to which the GPIO belongs. When the GPIO completes the GICID allocation, the GPIO interrupts are grouped.

8. A method for implementing a GPIO controller supporting virtualization as claimed in claim 7, characterized in that: The interrupt status of the GPIO in each group can only be read from the corresponding 4k domain of the GIC corresponding to the current group.

9. A GPIO controller implementation device supporting virtualization, characterized in that: The GPIO controller implementation device supporting virtualization includes: The mapping module is used to perform hardware isolation on the GPIO corresponding to saf_gpio_unit, and based on the number of GPIOs corresponding to a group of registers under GPIOcontroller, virtualize the registers in the same number of 4k domains; A split module, which is used to split the GPIO address space into a set number of 4k domains based on the number of GPIOs and the number of GICs; An allocation module, which is used to allocate the first number of 4k domains to the internal regs of each GPIO respectively, and allocate the second number of 4k domains to each GIC respectively; The set quantity is the sum of the first quantity and the second quantity.

10. A GPIO controller implementation device supporting virtualization, characterized in that: The GPIO controller implementation device supporting virtualization includes a processor, a memory, and a GPIO controller implementation program supporting virtualization stored in the memory and executable by the processor, wherein when the GPIO controller implementation program supporting virtualization is executed by the processor, the steps of the GPIO controller implementation method supporting virtualization as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Realization method of I2C bus for multi-hardware platform FT server

    CN102650975A

  • Interface interruption measurement method and device

    CN113032305A

  • Method for controlling external equipment in automobile, automobile intelligent cabin and automobile

    CN118519362A

  • Direct mapping of MSI-x registers using paravirtualized memory monitoring

    US20140229647A1

  • Virtualized fabric name server for storage area network

    US20220164210A1