System on chip, frequency modulation method thereof, electronic equipment and storage medium
By dynamically adjusting the processor's clock frequency in the on-chip system, the problems of resource waste and clock chaos in the multiprocessor architecture are solved, and power consumption reduction and performance improvement are achieved.
Patent Information
- Application Number
- CN202411111745.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-26
AI Technical Summary
In the multiprocessor architecture of the system-on-chip system, the processor still maintains a fixed clock frequency when there is no data transmission, resulting in waste of resources and may cause clock chaos and affect system operation stability.
The first processor determines the target frequency of the second processor and sends a frequency modulation message to the third processor, causing it to rewrite the frequency division control register of the second processor, and dynamically adjusts the clock frequency of the second processor to reduce the overall Power consumption and improve system performance.
It realizes dynamic frequency modulation of specific processors without affecting the system-on-chip clock, reducing overall power consumption and improving system performance.
Smart Images

Figure CN119024950A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of chip technology, and in particular to a system on chip and a frequency modulation method thereof, an electronic device and a storage medium. Background Art
[0002] The multi-processor architecture of System on a Chip (SoC) integrates multiple processor cores on a single chip to achieve higher performance, lower power consumption, and more compact system design. This architecture is often used in applications that need to process a large number of parallel tasks or require higher computing power. In the multi-processor architecture of the system on a chip, each processor core can run programs and perform tasks independently, and communicate and collaborate through shared memory or other communication mechanisms.
[0003] In a multi-processor system-on-chip, one or some processors will work at a fixed clock frequency after the system is running, and will maintain this clock frequency even if there is no data transmission, resulting in a waste of resources. However, the processor adjusts its own frequency through conventional methods such as monitoring the idle rate, which will cause confusion in the system-on-chip clock and generate bus signal sampling errors, affecting the overall operation stability of the system-on-chip. Summary of the invention
[0004] In view of this, the present disclosure provides a system on chip and its frequency modulation method, electronic device and storage medium, which can realize the frequency modulation of a specific processor without affecting the system on chip clock, thereby achieving the purpose of reducing the overall power consumption of the system on chip and improving the overall performance of the system on chip.
[0005] According to a first aspect of the present disclosure, a frequency modulation method of a system on chip is provided, the method being applied to a system on chip, the system on chip comprising a first processor, a second processor and a third processor, the first processor communicating with the second processor and the third processor respectively;
[0006] The frequency modulation method of the system on chip includes: when the clock frequency of the second processor needs to be adjusted, the first processor determines the target frequency of the second processor; the first processor sends a frequency modulation message to the third processor, and the frequency modulation message carries the target frequency of the second processor; the third processor rewrites the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency.
[0007] In some embodiments of the first aspect of the present disclosure, the on-chip system also includes: a busy register, which can be accessed by the first processor and the second processor and is used to record a busy value, and the busy value is used to indicate the operating status of the second processor; the method also includes: the first processor monitors the busy register, and determines that the clock frequency of the second processor needs to be adjusted when the busy value in the busy register changes.
[0008] In some implementations of the first aspect of the present disclosure, the busy value is determined by the second processor and written into the busy register according to one or more of the following:
[0009] System idle ratio of the second processor;
[0010] A first interrupt statistic value indicates the number of peripheral interrupt requests processed by the second processor within a first predetermined time period.
[0011] In some implementations of the first aspect of the present disclosure, the first interrupt statistic is determined in the following manner: the second processor periodically collects global variables in each peripheral register, the global variable in a peripheral register represents the number of interrupts of a peripheral controller within a unit time; the second processor performs statistical operations on the global variables in each peripheral register to obtain the first interrupt statistic, the first interrupt statistic is the number of peripheral interrupts processed by the second processor within a unit time.
[0012] In some implementations of the first aspect of the present disclosure, it also includes: the first processor determines whether it is necessary to adjust the clock frequency of the second processor based on a second interrupt statistic value, and the second interrupt statistic value represents the number of interrupt requests initiated by the first processor for each peripheral controller within a second predetermined time length.
[0013] In some implementations of the first aspect of the present disclosure, the on-chip system also includes: peripheral registers, which can be accessed by the first processor and the second processor; the second interrupt statistic value is determined based on the interrupt request count value recorded in each of the peripheral registers.
[0014] In some implementations of the first aspect of the present disclosure, the second interrupt statistic is obtained in the following manner: the first processor periodically collects interrupt request count values in each peripheral register, and the interrupt request count value in a peripheral register represents the number of interrupt requests initiated by the first processor for a peripheral controller per unit time; the first processor performs statistical operations on the interrupt request count values in each peripheral register to obtain the second interrupt statistic, and the second interrupt statistic is the number of peripheral interrupt requests initiated by the first processor per unit time.
[0015] In some implementations of the first aspect of the present disclosure, the first processor determines the target frequency of the second processor, including: after a frequency modulation driving engine in the first processor is initialized, the frequency modulation driving engine calls a preconfigured third ACPI method, and when the third ACPI method is called, reads a frequency modulation parameter of the second processor from an ACPI table in the first processor; the first processor determines the target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor;
[0016] The frequency modulation parameters include one or more of the following:
[0017] A first parameter indicating the currently supported frequency modulation mode;
[0018] A second parameter indicating the number of FM gears currently supported;
[0019] Indicates the frequency modulation level value of the target frequency corresponding to each frequency modulation level.
[0020] In some implementations of the first aspect of the present disclosure, the current frequency of the second processor is read from the ACPI table by the frequency modulation driving engine calling a preconfigured second ACPI method.
[0021] In some implementations of the first aspect of the present disclosure, the first processor determines the target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, including one of the following:
[0022] When the first parameter indicates that the first frequency modulation mode is currently supported, obtaining a frequency value set by a user and determining that the target frequency of the second processor is the frequency value set by the user;
[0023] When the first parameter indicates that the second frequency modulation mode is currently supported, the value of the second parameter is 2, and the first processor determines a frequency modulation gear value in the frequency modulation parameter that is different from the current frequency of the second processor as the target frequency of the second processor;
[0024] When the first parameter indicates that the second frequency modulation mode is currently supported, the second parameter is greater than 2, and the first processor selects one from a plurality of the frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor.
[0025] In some implementations of the first aspect of the present disclosure, the first processor determines the target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, including:
[0026] The first processor selects one from a plurality of frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor based on the second interrupt statistic and pre-configured gear thresholds corresponding to each frequency modulation gear, and the second interrupt statistic represents the number of interrupt requests initiated by the first processor for each peripheral controller within a second predetermined time length.
[0027] In some implementations of the first aspect of the present disclosure, the first processor determines the target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, including:
[0028] When the frequency modulation driving engine in the first processor detects that the second interrupt statistic value is greater than the second gear threshold and less than the first gear threshold, it is determined that the frequency modulation gear of the second processor is the second frequency modulation gear corresponding to the second gear threshold, and the gear value of the first frequency modulation gear corresponding to the first gear threshold is higher than the gear value of the second frequency modulation gear;
[0029] The frequency modulation driving engine in the first processor calls the second ACPI method to read the gear value of the second frequency modulation gear from the frequency modulation parameters as the target frequency of the second processor.
[0030] In some implementation modes of the first aspect of the present disclosure, the first processor sends a frequency modulation message to the third processor, including:
[0031] The frequency modulation driver engine in the first processor calls a preconfigured first ACPI method. When the first ACPI method is called, it parses the Method request of the second processor in the ACPI table to generate an SCMI message and sends it to the third processor. The SCMI message carries the target frequency of the second processor.
[0032] In some implementations of the first aspect of the present disclosure, the input clock source of the second processor includes a main clock source, and the main clock source is used to provide a main clock signal for the second processor, and the main clock signal is the main clock of the core of the second processor; the third processor rewrites the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, including: the third processor rewrites the value of the first frequency division control register used to control the main clock source of the second processor to the target frequency of the second processor, so that the frequency of the main clock signal of the second processor is changed to the target frequency.
[0033] In some implementations of the first aspect of the present disclosure, the input clock source of the second processor also includes: a reference clock source, the reference clock source is used to provide a reference clock signal for the second processor, and the reference clock signal is a backup clock of the core of the second processor; the method also includes: before rewriting the first frequency division control register, the third processor controls the main clock source of the second processor to pause, enables the reference clock source of the second processor, so that the input clock of the second processor is switched from the main clock signal to the reference clock signal; and, after rewriting the first frequency division control register, the third processor releases the main clock source of the second processor to pause, controls the reference clock source of the second processor to pause, so that the input clock of the second processor is switched from the reference clock signal back to the main clock signal.
[0034] According to a second aspect of the present disclosure, a system on chip is provided, comprising: a first processor, a second processor and a third processor, wherein the first processor can communicate with the second processor and the third processor respectively; wherein:
[0035] The first processor is used to determine the target frequency of the second processor when the clock frequency of the second processor needs to be adjusted, and send a frequency modulation message to the third processor, where the frequency modulation message carries the target frequency of the second processor;
[0036] The third processor is used to rewrite the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency.
[0037] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a memory storing a program, wherein the program comprises instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0038] According to a fourth aspect of the present disclosure, there is provided a computer-readable storage medium storing a program, wherein the program includes instructions, and when the instructions are executed by a processor, the processor executes the above method.
[0039] It can be seen from the above technical solution that in the embodiment of the present disclosure, the first processor can determine the target frequency of the second processor, the first processor sends a frequency modulation message for the second processor to the third processor, and the third processor rewrites the frequency division control register of the second processor according to the target frequency in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency. Therefore, the embodiment of the present disclosure can realize dynamic frequency modulation of a specific processor under a multi-processor architecture, thereby achieving the purpose of reducing the overall power consumption of the system on chip and improving the overall performance of the system on chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 It is a schematic diagram of the architecture of the system on chip of the child laborer according to the embodiment of the present disclosure;
[0042] Figure 2 A flow chart of a system-on-chip frequency modulation method provided in an embodiment of the present disclosure;
[0043] Figure 3 A schematic diagram of a busy register update process involved in an embodiment of the present disclosure;
[0044] Figure 4 A schematic diagram of the corresponding relationship between the frequency modulation value and the frequency value involved in the embodiment of the present disclosure;
[0045] Figure 5 A schematic diagram of the corresponding relationship between the interrupt statistics value and the frequency value per unit time of the second processor involved in the embodiment of the present disclosure;
[0046] Figure 6 is a structural example diagram of a clock management module in a second processor involved in an embodiment of the present disclosure;
[0047] Figure 7 This is an example diagram of a communication process between a second processor and a third processor involved in an embodiment of the present disclosure;
[0048] Figure 8 A schematic diagram of a specific implementation flow of the frequency modulation method involved in an embodiment of the present disclosure;
[0049] Fig. 9 A schematic block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0051] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments, and are not intended to limit the present disclosure. The singular forms "a", "said" and "the" used in the embodiments of the present disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0052] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0053] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0054] Terminology explanation:
[0055] RV core: a processor core based on the RISC-V instruction set architecture. RISC-V is an open instruction set architecture (ISA) based on the principles of reduced instruction set computers (RISC). The design of RISC-V ISA is concise, modular, and scalable, and can support different application requirements. It defines a set of basic instruction sets and also provides standard extensions, such as floating point, vector, encryption, etc., so that users can choose the appropriate instruction set extension according to their needs. The second processor of the disclosed embodiment is constructed using the RV core.
[0056] Peripherals: External hardware devices connected to the SoC, including but not limited to serial port devices, audio devices, storage devices, etc.
[0057] System Architecture
[0058] An embodiment of the present disclosure provides a system on chip, which may include a first processor, a second processor and a third processor, wherein the first processor can communicate with the second processor and the third processor respectively; wherein the first processor can be used to determine the target frequency of the second processor when the clock frequency of the second processor needs to be adjusted, and send a frequency modulation message to the third processor, wherein the frequency modulation message carries the target frequency of the second processor; the third processor can be used to rewrite the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency.
[0059] Specifically, the system on chip provided by the embodiment of the present disclosure can implement frequency modulation of a specific processor without affecting the system on chip clock by executing the following method, thereby achieving the purpose of reducing the overall power consumption of the system on chip and improving the overall performance of the system on chip.
[0060] The exemplary architecture of the system on chip according to the embodiment of the present disclosure is described in detail below.
[0061] Figure 1 Schematic diagram of the multi-processor architecture of the system on chip provided by the embodiment of the present application is shown. Figure 1 As shown, the system on chip 100 may include: a first processor, a second processor, a third processor, a memory and an inter-core component. The first processor and the second processor communicate through the inter-core component, and the memory can be accessed by the first processor and the second processor.
[0062] The memory may be a memory of a system on chip, or may be other memory built into the system on chip. For example, because DDR has a higher data transmission rate and efficiency, and can transmit data twice in each clock cycle, providing a higher bandwidth, the memory of the embodiment of the present disclosure is preferably a double data rate synchronous dynamic random access memory (DDR, Double Data Rate Synchronous Dynamic Random Access Memory) and the like. It is understandable that the memory may also be any other type of random access memory (RAM), for example, a static random access memory (SRAM, Static Random Access Memory), a synchronous dynamic random access memory (SDRAM, Synchronous Dynamic Random Access Memory), a dynamic random access memory (DRAM, Dynamic Random Access Memory), etc., and this is not limited by the embodiment of the present disclosure.
[0063] The first processor may be a single-core processor or a multi-core processor, and the core of the first processor may be, but is not limited to, ARM, RV core, or other types of processor cores. The operating system of the first processor may adopt, but is not limited to, general-purpose operating systems such as Windows, Linux, macOS, and UNIX. In different scenarios, the first processor may adopt different operating systems. For example, for desktop applications, the operating system of the first processor adopts Windows, while Linux is more suitable for servers and embedded systems.
[0064] The second processor can be a single-core processor, and the second processor can adopt a processor core based on the RISC-V instruction set architecture (hereinafter referred to as RV core), an ARM core or a processor core identical to the first processor. The operating system of the second processor can adopt but is not limited to a real-time operating system (RTOS, Real-Time Operating System). RTOS is an operating system specially designed for processing real-time tasks, which is characterized by low latency, predictability and high responsiveness to real-time tasks. Different from general-purpose operating systems (such as Windows, Linux, etc.), RTOS pays more attention to support for real-time performance and reliability. The second processor adopts RTOS, which can improve the real-time performance and stability of the system on chip.
[0065] The first processor and the second processor may be connected to each other through, for example, an inter-core component, a low-speed serial bus, a high-speed serial bus, or any other feasible method, wherein the inter-core component may include but is not limited to a register set (regfile), a shared memory set (share mem, shared memory), and the like.
[0066] In some embodiments, the system on chip 100 may adopt a large and small core heterogeneous system architecture, that is, the first processor adopts a large core and the second processor adopts a small core. The first processor can be used as the main processor of the system on chip and the second processor can be used as the slave processor of the system on chip. All kinds of tasks in the application layer of the system on chip can be handled by the first processor, and the second processor can be used to perform related processing of specific components in the system on chip, such as peripherals, input and output interfaces, etc.
[0067] Figure 1 Schematic diagram of SoC architecture of an embodiment of the present disclosure is shown. Figure 1The first processor can be used to execute application layer tasks, preferably a multi-core processor, including but not limited to core 1, core 2, ..., core n, n is an integer greater than 2, and the cores in the first processor can be the same or different. The second processor can be a processor (IOP, IO Processor IOP) that processes input and output (I / O) operations, which can be used to manage the driver of the external hardware device (hereinafter referred to as peripherals) of the SoC. The first processor and the second processor can communicate through the inter-core component, the second processor can directly access the peripherals, and the first processor can access the peripherals through the second processor.
[0068] See also Figure 1 The second processor can integrate, have built-in or externally connect various types of peripheral controllers (also called peripheral controller interfaces). The processor core of the second processor can be connected to the peripheral controllers through the internal bus of the second processor. These peripheral controllers can communicate with corresponding external hardware devices through different standard bus protocols. Thus, the second processor can interact with external hardware devices (i.e., peripherals) through the peripheral controllers.
[0069] See also Figure 1 , the peripheral controller may include but is not limited to: Universal Asynchronous Receiver-Transmitter (UART), Inter-Integrated Circuit (I2C), Serial Peripheral Interface (SPI), High Definition Audio (HAD), Secure Digital / Multimedia Card (SD / MMC), Gigabit Media Access Control (GMAC), Neural Processing Unit (NPU), Inter-IC Sound (I2S), Coder-Decoder (CODEC), Enhanced Serial Peripheral Interface (eSPI), etc. In specific applications, the peripheral controller of IOP can be expanded as needed, and the embodiments of the present disclosure do not limit this.
[0070] UART can be used for serial data transmission between computer systems and external devices, and is used to connect devices such as modems and serial printers. I2C can be used to connect communications between integrated circuits, and is used to connect external devices such as sensors, memory, and displays. SPI is used for high-speed data transmission between computer systems and external devices, and is used to connect flash memory, sensors, and displays. HDA is used to connect audio devices such as speakers, microphones, and sound cards to achieve high-definition audio transmission and processing. SD / MMC is used to connect storage devices such as flash memory cards and multimedia cards, and is used in digital cameras, mobile phones, and other devices. GMAC is used to connect computer systems to Gigabit Ethernet networks to achieve high-speed network communication. NPU is used to perform artificial neural network calculations, and is used in deep learning and artificial intelligence applications. I2S is used to connect audio codecs, digital signal processors, and other devices to achieve high-quality audio transmission. CODEC is used for encoding and decoding digital signals, and is used in audio and video processing. eSPI is used to connect computer systems and external devices, supporting high-speed data transmission and function expansion.
[0071] See also Figure 1 , the peripherals of the SoC may include but are not limited to serial port devices, audio devices, storage devices, etc. The embodiments of the present disclosure do not limit the types and quantities of the peripherals of the SoC.
[0072] It should be noted that although Figure 1 The peripheral controller is arranged in the second processor, but those skilled in the art should understand that in a specific application, the peripheral controller can be arranged outside the second processor as needed.
[0073] See also Figure 1 The third processor in the system on chip 100 can be used as a slave processor, which can be used to perform processing such as system control and security tasks. The security tasks may include but are not limited to encryption and decryption, security authentication, etc. The system control is not limited to system power on and off, system configuration, etc.
[0074] The third processor can communicate with the first processor, and the communication method includes but is not limited to shared memory, register group, etc. In some examples, the third processor can communicate with the first processor through the system control and management interface (SCMI, System Control and Management Interface). SCMI is a standard interface protocol for communication between processors and peripherals. SCMI aims to provide a unified way for the processor to communicate and control various peripherals in the system (such as sensors, power managers, schedulers, etc.). Through SCMI, the processor can send commands to peripherals, request data, and receive notifications and events sent by peripherals. This standardized interface protocol helps to simplify system design and improve the portability and interoperability of the system. Through SCMI communication, the processor can effectively interact with various peripherals in the system to achieve comprehensive control and management of the system, thereby improving the overall performance and efficiency of the system.
[0075] It should be noted that the above system 100 is only for illustration, and the system architecture applicable to the embodiments of the present disclosure is not limited thereto. Those skilled in the art should understand that the following methods, devices, etc. of the embodiments of the present disclosure can be applied to other forms of on-chip systems including three processors.
[0076] Exemplary Methods
[0077] Figure 2 FIG. 1 is a flow chart of a method for frequency modulation of a system on a chip provided by an embodiment of the present disclosure. Figure 2 , the system-on-chip frequency modulation method may include the following steps:
[0078] Step 201, when the clock frequency of the second processor needs to be adjusted, the first processor determines the target frequency of the second processor;
[0079] Step 202: The first processor sends a frequency modulation message to the third processor, where the frequency modulation message carries the target frequency of the second processor;
[0080] Step 203: The third processor rewrites the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency.
[0081] In some implementations, before step 201, the system on chip frequency modulation method may further include: the first processor determines whether the clock frequency of the second processor needs to be adjusted according to the running state of the second processor.
[0082] In some implementations, the system on chip may also include: a busy register, which can be accessed by the first processor and the second processor and is used to record a busy value, and the busy value can be used to indicate the operating status of the second processor. In this implementation, the first processor determines whether the clock frequency of the second processor needs to be adjusted according to the operating status of the second processor. Specifically, it can be: the first processor monitors the busy register, and determines that the clock frequency of the second processor needs to be adjusted when the busy value in the busy register changes. By adding a group of registers or spaces that can be accessed by both the first processor and the second processor to record the busy value of the second processor, the second processor can detect the operating status of the first processor in real time and adjust the frequency according to the operating status of the first processor, thereby realizing the first processor detecting the operating status of the second processor while being compatible with the existing system on chip architecture.
[0083] Exemplarily, the busy register may be set in the register group of the aforementioned system on chip.
[0084] Specifically, the busy value is written into the busy register by the second processor, the busy register can be accessed by the first processor, the second processor can read and write the busy register, and the first processor can read the busy value in the busy register as needed. For example, the busy value can be "0" or "1", "0" represents that the second processor is running in a low-frequency state, and "1" represents that the second processor is running in a high-frequency state. The second processor can rewrite the busy value in the busy register as needed, and the first processor can periodically read the busy value in the busy register. If it is found that the busy value changes from "0" to "1", it is determined that the second processor needs to be frequency-upgraded. If it is found that the busy value changes from "1" to "0", it is determined that the second processor needs to be frequency-downgraded.
[0085] In some implementations, the busy value may be determined based on one or more of the following: 1) the system idle ratio of the second processor; 2) a first interrupt statistic value, which indicates the number of peripheral interrupt requests processed by the second processor within a first predetermined duration. Here, the first predetermined duration may be a unit time (e.g., 1 second, 1 millisecond, 1 microsecond, etc.), a predefined custom duration, a randomly selected time period, or others. This is not limited in the embodiments of the present disclosure.
[0086] The first interrupt statistic can be determined based on the number of interrupts of all peripheral controllers connected to the second processor within the first predetermined time period. In a specific application, a register of a peripheral can include but is not limited to a control register, a status register, a data register, a configuration register, an address register, an interrupt register, an error register, a power management register, etc. In the disclosed embodiment, the second processor can obtain the first interrupt statistic by querying the number of interrupts within the first predetermined time period recorded in the above-mentioned registers of each peripheral in the register group, and using the number of interrupts within the first predetermined time period recorded in all registers of all peripherals.
[0087] The first interrupt statistic may be the sum of the number of interrupts recorded in all registers of all peripherals within the first predetermined time period, or may be the average value, weighted average value, weighted sum, etc. of the number of interrupts recorded in the respective registers of all peripherals within the first predetermined time period. The specific calculation method of the first interrupt statistic is not limited in the embodiments of the present disclosure.
[0088] In some implementations, the first interrupt statistic value can be determined in the following manner: first, the second processor periodically collects global variables in each peripheral register, and a global variable in a peripheral register represents the number of interrupts of a peripheral controller in a unit time; then, the second processor performs statistical operations on the global variables in each peripheral register to obtain a first interrupt statistic value, and the first interrupt statistic value is the number of peripheral interrupts processed by the second processor in a unit time. For example, a timer task can be configured in the second processor, and after the second processor is started, the timer task automatically starts the aforementioned collection and statistical operation process, thereby automatically obtaining the first interrupt statistic value at a regular time, so that the second processor can judge its own operating status in real time through the first interrupt statistic value, thereby modifying the busy value in a timely manner.
[0089] In a specific application, the second processor can rewrite the busy value in the busy register to "1" when one or two of the following conditions are met, so that the first processor can know the running state of the second processor through the busy value: 1) the first interrupt statistic value is greater than or equal to the first predetermined threshold; 2) the system idle ratio of the second processor is less than the second predetermined threshold. The first predetermined threshold and the second predetermined threshold can be flexibly set according to needs, and can also be set to an empirical value.
[0090] For example, the second processor can detect its own system idle ratio in real time. When it detects that the system idle ratio is less than 50%, the busy value can be rewritten from "0" to "1". When its own system idle ratio is greater than or equal to 50%, the busy value can be kept at "0".
[0091] For another example, the second processor may rewrite the busy value to “1” when the first interrupt statistic value is greater than or equal to 50, and the busy value will remain at the default value “0” as long as the first interrupt statistic value is less than 50.
[0092] Figure 3 FIG. 2 shows a schematic diagram of the process of the second processor updating the busy register. Figure 3 , assuming that there are x (x is an integer greater than 2) peripherals Dev1, Dev2, ..., Devx, after the first processor issues an interrupt request for the peripheral Dev1, the second processor rewrites the interrupt control bit in the register of the peripheral Dev1 in response to the interrupt event of the interrupt request, and the global variable dev1_regfile_intcnt of the peripheral Dev1 is increased by 1, and the request processing of the peripheral Dev1 is completed. Similarly, the peripherals Dev2 to Devx also update their global variables in real time. After the timing task in the second processor starts, the global variables of each peripheral are detected to obtain the first interrupt statistical number g_intcnt. The second processor determines whether the first interrupt statistical number is greater than the first preset threshold "1" and whether the system idle ratio of the second processor is less than the second preset threshold "60%". If so, the busy value in the busy register is modified to 1, otherwise the busy value in the busy register remains 0. Among them, the first interrupt statistical number is calculated by the following formula (1).
[0093] g_intcnt=dev1_regfile_intcnt+dev2_regfile_intcnt+…+devx_regfile_intcnt (1)
[0094] In some implementations, the first processor may determine whether to adjust the clock frequency of the second processor based on a second interrupt statistic value, where the second interrupt statistic value may represent the number of interrupt requests initiated by the first processor for each peripheral controller within a second predetermined time period.
[0095] Similarly, the second predetermined duration may be, but is not limited to, a unit time, a predefined custom duration, a randomly selected time period, or other time periods, which are not limited in the embodiments of the present disclosure.
[0096] The second interrupt statistic can be determined based on the interrupt request count value recorded in each register of the corresponding peripheral that can be accessed by the first processor. Among them, the register of the corresponding peripheral is used for communication between the first processor and the second processor, that is, the register of the corresponding peripheral refers to the register related to the peripheral in the register group between the first processor and the second processor. In specific applications, the register group in the core component can include registers of multiple peripherals, and the register of each peripheral can include but is not limited to control registers, status registers, data registers, configuration registers, address registers, interrupt registers, error registers, power management registers, etc. In the embodiment of the present disclosure, the first processor can obtain the second interrupt statistic by querying the number of interrupts within the second predetermined time length recorded in all registers related to the peripheral in the register group, and using the number of interrupts within the second predetermined time length recorded in all registers related to the peripheral in the register group.
[0097] For example, the second interrupt statistic value may be the sum of the number of interruptions within the second predetermined time period recorded in all registers related to the peripheral device in the register group, or may be the average value, weighted average value, weighted sum, etc. of the number of interruptions within the second predetermined time period recorded in all registers related to the peripheral device in the register group. The specific calculation method of the second interrupt statistic value is not limited in the embodiment of the present disclosure.
[0098] In some implementations, the second interrupt statistic can be obtained in the following manner: first, the first processor periodically collects interrupt request count values in each peripheral register, and the interrupt request count value in a peripheral register represents the number of interrupt requests initiated by the first processor for a peripheral controller per unit time; second, the first processor performs statistical operations on the interrupt request count values in each peripheral register to obtain a second interrupt statistic, and the second interrupt statistic is the number of peripheral interrupt requests initiated by the first processor per unit time. For example, a timer task can be configured in the first processor, and after the first processor is started, the timer task can automatically start the aforementioned collection and statistical operation process, thereby automatically obtaining the second interrupt statistic at regular intervals, so that the first processor can judge the operating status of the second processor in real time through the second interrupt statistic, thereby timely initiating frequency modulation of the second processor.
[0099] In step 201, there may be multiple ways for the first processor to determine the target frequency of the second processor. In some implementations, in step 201, the first processor may determine the target frequency of the second processor in the following manner: first, after the frequency modulation drive engine in the first processor is initialized, the frequency modulation drive engine calls the preconfigured third ACPI method, and when the third ACPI method is called, the frequency modulation parameters of the second processor are read from the ACPI table in the first processor; then, the first processor may determine the target frequency of the second processor based on the frequency modulation parameters and the current frequency of the second processor. Among them, the frequency modulation parameters may include, but are not limited to, one or more of the following: a first parameter indicating the currently supported frequency modulation mode, a second parameter indicating the number of currently supported frequency modulation gears, and a frequency modulation gear value indicating the target frequency corresponding to each frequency modulation gear.
[0100] In some implementations, the current frequency of the second processor may be read from an Advanced Configuration and Power Interface (ACPI) table by the frequency modulation driver engine calling a preconfigured second ACPI method.
[0101] For the ACPI table, the third ACPI method, the second ACPI method, etc., please refer to the description of ACPI configuration below and the following embodiment 1, which will not be repeated here.
[0102] Specifically, the first processor determines the target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, which may be but is not limited to one of the following:
[0103] 1) Manual frequency modulation, that is, when the first parameter indicates that the first frequency modulation mode is currently supported, obtaining a frequency value set by the user and determining that the target frequency of the second processor is the frequency value set by the user;
[0104] 2) Fuzzy frequency modulation, that is, when the first parameter indicates that the second frequency modulation mode is currently supported, the value of the second parameter is 2, and the first processor determines a frequency modulation gear value in the frequency modulation parameter that is different from the current frequency of the second processor as the target frequency of the second processor;
[0105] 3) Fine frequency modulation mode, that is, when the first parameter indicates that the second frequency modulation mode is currently supported, the second parameter is greater than 2, and the first processor selects one from multiple frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor.
[0106] Therefore, not only can multiple modes of second processor frequency modulation be achieved, but the frequency modulation mode of the second processor can also be controlled according to the pre-configured ACPI table, which is convenient for the staff to flexibly set the frequency modulation mode of the second processor according to the scene requirements and better meet the needs of actual applications.
[0107] In manual frequency modulation mode, automatic frequency modulation can be turned off, and the default frequency value can be written through the frequency modulation driver engine in the first processor or a new frequency value can be configured in the human-computer interaction interface. Manual frequency modulation mode can be applied to power consumption testing, industrial control, automobiles, workstations and other scenarios that do not require low power consumption and have high real-time communication.
[0108] In the fuzzy frequency modulation mode, only two frequency modulation gears can be set (for example, 37.5Mhz and 300Mhz). The fuzzy frequency modulation mode does not have high requirements on communication real-time performance but has certain requirements on power consumption. It is more suitable for consumer electronics scenarios such as notebooks and tablets in the Internet of Things scenario.
[0109] In the fine frequency modulation mode, more than two frequency modulation gears can be set, which is suitable for scenarios with high power consumption and real-time requirements. In the fine frequency modulation mode, the first processor counts and calculates the frequency modulation value, and the second processor does not need to participate in the calculation, which is equivalent to releasing a part of the instruction performance for the second processor, which can improve the internal performance of the second processor.
[0110] In the fuzzy frequency modulation mode, the process of the first processor determining the target frequency of the second processor according to the frequency modulation parameters and the current frequency of the second processor can be specifically as follows: the first processor selects one from a plurality of frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor according to the first interrupt statistic and the first predetermined threshold, and the first interrupt statistic represents the number of peripheral interrupt requests processed by the second processor within the first predetermined time. Thus, in the fuzzy frequency modulation mode, when the first interrupt statistic (that is, the number of interrupts of the first peripheral) is greater than or equal to a certain value, the frequency of the second processor can be increased from a low gear to a high gear to achieve frequency increase, and when the first interrupt statistic (that is, the number of interrupts of the first peripheral) is less than a certain value, the frequency of the second processor can be reduced from a high gear to a low gear to achieve frequency reduction, and rough frequency modulation of the second processor can be achieved. This frequency modulation method is simple and easy to implement, and has higher efficiency.
[0111] In the fine frequency modulation mode, the process of the first processor determining the target frequency of the second processor according to the frequency modulation parameters and current frequency of the second processor can be specifically as follows: the first processor selects one from a plurality of frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor according to the second interrupt statistic and the pre-configured gear threshold corresponding to each frequency modulation gear, and the second interrupt statistic represents the number of interrupt requests for each peripheral controller initiated by the first processor within the second predetermined time length. Therefore, in the fine frequency modulation mode, the frequency of the second processor can be finely adjusted according to the number of peripheral-related interrupts initiated by the first processor, and this frequency modulation method can realize the fine control of the operating frequency of the second processor, thereby meeting the fine frequency modulation requirements of specific scenarios.
[0112] Figure 4 and Figure 5 A schematic diagram of gear adjustment is shown. Figure 4 In the figure, the ordinate is the frequency modulation value, and the abscissa is the frequency modulation gear value corresponding to the frequency modulation value. Figure 5 In the figure, the vertical axis is the statistical value of the number of interruptions per millisecond, and the horizontal axis is the frequency modulation gear value. Figure 4 and Figure 5 In the fine frequency tuning mode, 4 gears can be configured, namely 37.5Mhz, 100Mhz, 200Mhz, and 300Mhz. 300Mhz is the highest frequency gear, 37.5Mhz is the lowest frequency gear, 100Mhz is the second lowest frequency gear, and 200Mhz is the second highest frequency gear. Figure 4 The frequency modulation values corresponding to these four gears are shown. Figure 5 The figure shows the interruption thresholds per 100 milliseconds corresponding to the four gears. Figure 4 and Figure 5 The difference is that the fuzzy FM mode has two gears and only uses Figure 4 and Figure 5 The highest frequency gear is 300Mhz and the lowest frequency gear is 37.5Mhz.
[0113] Before step 201, the method may further include: configuring the aforementioned frequency modulation parameters through ACPI. The ACPI configuration method of the frequency modulation mode in the embodiment of the present disclosure is described in detail below.
[0114] In some embodiments, an ACPI node identifying the second processor can be added to the ACPI table of the first processor, the value of the ACPI node can be set to the identifier of the second processor (for example, the ID of the second processor), and a first ACPI method for configuring a third parameter (i.e., the target frequency), a second ACPI method for obtaining the current frequency, and a third ACPI method for obtaining the first parameter and the second parameter can be used in the ACPI table.
[0115] Exemplarily, after the ACPI node a identifying the second processor is added to the ACPI table, the device ID list in the ACPI table may be expressed as follows:
[0116] 0-GPU
[0117] 1-NPU
[0118] 2-DP_DC
[0119] 3-VPU_DECODE
[0120] 4-VPU_ENCODE
[0121] 5-SCE
[0122] 6-GMAC
[0123] 7-NOC
[0124] 8-CPU
[0125] 9-DMU
[0126] a-IOP.
[0127] Exemplarily, the configuration method of each ACPI method is as follows:
[0128] 1) First ACPI method for configuring target frequency:
[0129] For example, the first ACPI method can be defined as: Method (PSCF), which contains two variables: Arg0 and Arg1. Arg0 indicates the device ID, and the device ID in Arg0 is set to the identifier of the second processor. Arg1 indicates the target frequency, and the target frequency in Arg1 is set to the target frequency determined by the first processor. The result (return) returned by Method (PSCF) is used to indicate whether the configuration is successful or not. The returned result value of 0 indicates that the configuration is successful. If the returned result value is not 0, it indicates that the configuration failed.
[0130] Specifically, the frequency modulation driving engine in the first processor calls Method (PSCF), and when Method (PSCF) is called, the first processor executes Figure 5 The process shown is to send a frequency modulation message to the third processor, and wait for and receive a response message after the third processor completes the frequency configuration and returns a result of whether the configuration is successful or not.
[0131] 2) Second ACPI method for obtaining the current frequency:
[0132] For example, the second ACPI method may be defined as: Method(PGCF), which
[0133] Contains a variable, namely Arg0, Arg0 indicates the device ID, the device ID in Arg0 is set to the identifier of the second processor, the result (return) returned by Method (PGCF) is used to indicate the current frequency value of the second processor, the unit defaults to KHz, if the result returned by Method (PGCF) is "-1", it indicates that the current frequency acquisition failed.
[0134] Specifically, the frequency modulation driving engine in the first processor calls Method (PGCF), and when Method (PGCF) is called, it obtains or detects the current frequency of the second processor from the second processor and returns the current frequency value of the second processor.
[0135] 3) A third ACPI method for obtaining the first parameter and the second parameter:
[0136] For example, the third ACPI method can be defined as: Method(PGCL), Method(PGCL) contains a variable, namely Arg0, Arg0 indicates the device ID, the device ID in Arg0 is set to the identifier of the second processor, and the result (return) returned by Method(PGCF) can be expressed as: Package(NumElements){p0,p1,Package(NumElements){f0,f1,……}}.
[0137] Among them, p0 indicates the currently supported FM mode. The value of p0 is 0, which indicates that the currently supported FM mode is "manual". The value of p0 is 1, which indicates that the currently supported FM mode is "automatic fuzzy". The value of p0 is 2, which indicates that the currently supported FM mode is "automatic fine". p1 indicates the supported frequency modulation gear. The value of p1 is "4", which indicates that 4 frequency modulation gears are supported in the "automatic fine" mode. Package (f0, f1, f2...) indicates the supported frequency modulation gear values. f0, f1, and f2 indicate the frequency modulation gear values.
[0138] For example, if the currently supported frequency modulation mode is "auto fine" (i.e., the fine frequency modulation mode mentioned above), the value of p1 is 4, and the four frequency modulation gear values are 37.5M, 100M, 200M, and 300M, respectively, then the result returned by Method(PGCF) is:
[0139] Package(NumElements){2,4,Package(NumElements){37.5,100,200,300}.
[0140] For example, if the currently supported FM mode is "auto fuzzy" (i.e., the fuzzy FM mode mentioned above), the value of p1 is 2, and the two frequency FM gear values are 37.5M and 300M respectively, then the result returned by Method(PGCF) is: Package(NumElements){1,2,Package(NumElements){37.5,300}.
[0141] In some implementations, the method may further include: in response to a frequency modulation parameter modification command input by a user in an interface provided by the first processor, updating the frequency modulation parameters configured in the ACPI table. In this way, it is convenient for users to flexibly adjust the frequency modulation mode and other frequency modulation parameters according to actual application requirements.
[0142] If the frequency modulation mode indicated by the frequency modulation parameters obtained through the ACPI method is fuzzy frequency modulation, it can be modified through the command line after the operating system of the first processor enters the user interface. For example, the frequency modulation mode of the second processor can be set to manual frequency modulation through the "freqiop modeset manual" command. After that, the frequency modulation driving engine in the first processor starts to switch to the manual frequency modulation mode according to the newly set frequency modulation mode, and the frequency modulation driving engine in the first processor will no longer detect the busy register. Finally, the frequency value of the manual frequency modulation mode can be configured to 200Mhz through the "freqiop set 200000" command. After receiving the frequency value change, the frequency modulation driving engine in the first processor starts to call the ACPI method (for example, Method (PGCF)) to send a frequency modulation message to the third processor. The third processor rewrites the frequency division control register or frequency division controller of the second processor according to the frequency value to realize the frequency value change of the second processor.
[0143] In some implementations, step 202 may include: the frequency modulation driver engine in the first processor calls a preconfigured first ACPI method, and when the first ACPI method is called, it parses the Method request of the second processor in the ACPI table to generate an SCMI message and sends it to the third processor, and the SCMI message carries the target frequency of the second processor.
[0144] In step 203, the frequency division control register refers to a frequency division control register for controlling the input clock source of the second processor, which can be a register of the clock of the second processor, and only the third processor has the authority to access the frequency division control register. Specifically, the frequency division control register (Divider Control Register) is a register for controlling the operation of the frequency divider. The frequency division control register in step 203 can be set in the clock management and timing control system of the second processor. The frequency division control register allows the user or system to dynamically adjust the frequency division ratio of the frequency divider. By modifying a specific bit or field in the register, the ratio at which the frequency divider divides the input clock signal can be changed. This flexibility enables the second processor to adjust the clock frequency as needed to meet different performance requirements or the needs of external devices.
[0145] In specific applications, the frequency division control register is used in combination with modules such as the frequency divider and clock generator to achieve precise timing control and clock management. By properly configuring the frequency division control register, the system clock frequency can be adjusted to reduce power consumption or synchronize operations with external devices.
[0146] Figure 6 The module structure diagram of the second processor for timing control and clock management is shown. Figure 6In the embodiment, the input clock of the second processor is increased to two channels, one of which is the reference clock clk_ref and the other is the core main clock clk_iop of the second processor. The reference clock clk_ref is used to provide accurate timing for the software system and to provide a fixed-frequency input clock for low-speed peripherals. Figure 6 In the figure, the left side is the port connected to the clock source, including the reference clock port clk_ref connected to the reference clock source and the core master clock port clk_iop connected to the master clock source. The reference clock port clk_ref and the core master clock port clk_iop are connected to the clock divider DIV. The input end of the clock divider DIV is connected to the third processor and the output end is connected to the clock selector. The input end of the clock selector is connected to the iop reference clock or the iop master clock. The clock divider is used to adjust the iop master clock according to the target frequency configured by the third processor. The clock selector is used to select a clock signal from the iop reference clock and the iop master clock to provide to the second processor. Figure 5 In the process, the iop reference clock or the iop main clock can be provided to the second processor after being processed by the clock divider and the clock selector.
[0147] In the conventional way, one core has one clock. Figure 5 In the structure shown, a reference clock is added to the core of the second processor, and the reference clock can be used to adjust the main clock, and the core main clock can be switched to work after the frequency modulation is completed. In this way, it can be ensured that the normal operation of the second processor will not be affected during the frequency modulation process, and clock confusion can be avoided more effectively.
[0148] The input clock source of the second processor may include a main clock source, which may be used to provide a main clock signal for the second processor, and the main clock signal is the main clock of the core of the second processor. In this implementation, the third processor in step 203 rewrites the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, which may include: the third processor rewrites the value of the first frequency division control register used to control the main clock source of the second processor to the target frequency of the second processor, so that the frequency of the main clock signal of the second processor is changed to the target frequency.
[0149] The input clock source of the second processor may also include a reference clock source, which may be used to provide a reference clock signal for the second processor, and the reference clock signal is a backup clock of the core of the second processor. In this embodiment, the method may also include: before rewriting the first frequency division control register, the third processor controls the master clock source of the second processor to pause, enables the reference clock source of the second processor, so that the input clock of the second processor switches from the master clock signal to the reference clock signal; and, after rewriting the first frequency division control register, the third processor releases the master clock source of the second processor to pause, controls the reference clock source of the second processor to pause, so that the input clock of the second processor switches from the reference clock signal back to the master clock signal. Thus, the reference clock can be used to adjust the master clock, and the core master clock can be switched to work after the frequency modulation is completed, which can ensure that the normal operation of the second processor will not be affected during the frequency modulation process, and more effectively avoid clock confusion.
[0150] Figure 7 A schematic diagram of the flow of interaction between the first processor and the third processor is shown. Figure 7 The execution process of steps 202 to 203 may include: after calculating the frequency modulation value (i.e., the target frequency), the driver engine in the operating system of the first processor calls the first ACPI Method in the ACPI table, the first ACPI Method parses the Method request and executes the corresponding SCMI communication to initiate an SCMI message to the third processor through the existing SCMI protocol channel, the third processor receives and parses the SCMI message to obtain the target frequency, rewrites the frequency division register value based on the target frequency to achieve the change of the operating frequency of the second processor, executes the corresponding SCMI communication to return an ACPI method response (ACPI Method Return), and the driver engine in the operating system of the first processor waits for and obtains the ACPI method response, parses and completes it.
[0151] The specific implementation of the embodiment of the present disclosure is described in detail below in conjunction with specific embodiments.
[0152] Example 1: Using ACPI to select a frequency modulation mode and perform frequency modulation
[0153] Figure 8 FIG. 4 shows a flow chart of using ACPI to select a frequency modulation mode for frequency modulation in this embodiment. Figure 8 As shown, the frequency modulation process of this embodiment may include:
[0154] The first processor configures the frequency modulation parameters in the ACPI table. The specific implementation method can be referred to in the previous text and will not be repeated here.
[0155] During the process of starting the operating system of the first processor, after the first processor is initialized, the frequency modulation driver engine (iop devfreq Driver agent) in the first processor calls the first ACPI method to read the initial value of the frequency modulation parameter during initialization, and runs one of the following three modes according to the initial value of the frequency modulation parameter: manual frequency modulation, fuzzy frequency modulation and fine frequency modulation.
[0156] The software timer in the second processor periodically obtains the number of interrupts of each peripheral device in a unit time or the system idle ratio (OS idle), and uses the number of interrupts of each peripheral device in a unit time to obtain a first interrupt statistic value. When the system idle ratio is less than a second predetermined threshold and / or the first interrupt statistic value is greater than or equal to the first predetermined threshold, the second processor rewrites the busy value in the busy register.
[0157] When the frequency modulation driver engine in the first processor detects that the busy value in the busy register has changed, it calls the second ACPI method to read the current frequency of the second processor from the ACPI table, determines the frequency modulation value based on the current frequency modulation mode and the current frequency of the second processor, and calls the third ACPI method to send a frequency modulation message to the third processor through the SCMI interface, wherein the frequency modulation message carries the frequency modulation value.
[0158] At the same time, the timing task in the first processor periodically obtains the number of interrupt requests received per unit time in the registers of all peripheral devices and determines a second interrupt statistic value, and notifies the frequency modulation driving engine in the first processor when the second interrupt statistic value is greater than or equal to a third predetermined threshold value. After being notified, the frequency modulation driving engine in the first processor calls the second ACPI method to read the current frequency of the second processor from the ACPI table, determines the frequency modulation value based on the current frequency modulation mode and the current frequency of the second processor, and calls the third ACPI method to send a frequency modulation message to the third processor through the SCMI interface, wherein the frequency modulation message carries the frequency modulation value.
[0159] The third processor receives the frequency modulation message through the SCMI, and sets the frequency division value in the frequency division control register of the second processor according to the frequency modulation value therein to divide the input main clock of the second processor.
[0160] Exemplarily, the implementation process of manual frequency modulation can be: when the manual frequency modulation mode is run, a human-computer interaction interface pops up, and the user inputs a frequency modulation value or a frequency division value through the human-computer interaction interface. The first processor initiates frequency modulation to the third processor in response to the user's input event on the human-computer interaction interface, and the third processor rewrites the frequency division control register or the frequency division controller of the second processor according to the frequency modulation value or the frequency division value, thereby achieving the purpose of frequency modulation. The human-computer interaction interface can be a GUI or a command line control interface.
[0161] The specific implementation process of fine frequency modulation and fuzzy frequency modulation can be referred to the following embodiments and will not be described in detail.
[0162] Embodiment 2
[0163] In this embodiment, the specific implementation process of fuzzy frequency modulation is exemplified.
[0164] In fuzzy frequency modulation, only these two frequency values are adjustable. That is, when the firmware of the second processor periodically monitors the interrupt times of each peripheral register during operation and the number of interrupts is greater than the first predetermined threshold and the system idle ratio is less than the second predetermined threshold, it means that the second processor is busy. The second processor can rewrite the busy value in the busy register, for example, change the busy value from 0 to 1. The frequency modulation driving engine in the first processor periodically polls the busy register. If the busy value changes, the ACPI method can be called to determine the frequency modulation value and initiate communication with the third processor. The third processor configures the main clock frequency of the second processor according to the frequency modulation value, so that the operating frequency of the second processor is increased to meet the operation requirements.
[0165] The specific implementation process of the frequency modulation method when using the fuzzy frequency modulation mode may include the following steps:
[0166] Step a1: the first processor system is initialized and ACPI configuration information is read.
[0167] Step a2, after the first processor runs to the frequency modulation driving engine, it obtains that the frequency modulation parameter is a fuzzy frequency modulation mode, and the frequency modulation gears include 37.5Mhz and 300Mhz;
[0168] Step a3: the frequency modulation driving engine periodically monitors the busy register of the second processor.
[0169] Step a4: After the second processor is started, it runs at 1 / 8 frequency, that is, the operating frequency is 37.5Mhz.
[0170] Step a5: the second processor initializes the timing task and periodically queries the interrupt count values and system idle ratio values of the current registers of all peripherals.
[0171] Step a6, after the second processor's scheduled task arrives, it obtains the current first interrupt statistic and system idle ratio, and finds that the system idle ratio is less than 60% and the first interrupt statistic is greater than 1, then the second processor determines that the current minimum frequency of the system will not meet the performance guarantee.
[0172] Step a7: The second processor writes the busy value in the busy register to 1.
[0173] Step a8: the frequency modulation driving engine in the first processor detects that the busy value in the busy register has changed from 0->1, and starts to initiate a frequency increase process.
[0174] Step a9: The first processor sets the frequency modulation value to full speed mode, for example, 1.
[0175] Step a10: the first processor calls the ACPI method, parses the ACPI method, executes the corresponding SCMI communication, and sends the SCMI message for frequency modulation (ie, the frequency modulation message mentioned above) to the third processor.
[0176] Step a11, the third processor receives the SCMI message from the first processor, parses and processes it to obtain a frequency modulation value;
[0177] Step a12, the third processor pauses the main clock of the second processor and writes a new frequency division value into the frequency division control register of the second processor. The frequency division value can be Figure 3 , Figure 4 and the frequency modulation value of step a11 to determine;
[0178] Step a13, the third processor releases the main clock pause of the second processor, and the frequency modulation of the second processor is completed.
[0179] The process of using the fuzzy frequency modulation mode to reduce the frequency of the second processor is similar to the above process and will not be described in detail.
[0180] Example 3: Fine Frequency Modulation
[0181] In this embodiment, the specific implementation process of fine frequency modulation is exemplified.
[0182] In fine frequency tuning, you can set 4 frequency tuning gear values, namely, 37.5Mhz, 100Mhz, 200Mhz, and 300Mhz.
[0183] When the frequency modulation driving engine of the first processor initiates a communication request to the second processor, a write operation is initiated to the interrupt control bit of the register, and the number of interrupt requests of the corresponding peripheral is increased by 1 each time it is written.
[0184] The frequency modulation driving engine of the first processor regularly monitors the number of interrupt requests of all peripherals with a period of 10ms. When the sum of the number of interrupt requests of all peripherals is greater than 1 and less than 10, the corresponding frequency modulation value will be 1 / 8. When the sum of the number of interrupt requests of all peripherals is greater than 10 and less than 20, the corresponding frequency modulation value will be 1 / 3. When the sum of the number of interrupt requests of all peripherals is greater than 20 and less than 50, the corresponding frequency modulation value will be 2 / 3. When the sum of the number of interrupt requests of all peripherals is greater than 50, the corresponding frequency modulation value will be 1.
[0185] The first processor compares the currently obtained frequency modulation value with the frequency modulation value obtained last time, and if they are different, calls the ACPI method to initiate communication with the third processor so as to perform frequency modulation on the second processor.
[0186] The implementation process of the frequency modulation method in the fine frequency modulation mode may include the following steps:
[0187] Step b1, the first processor system is initialized and the ACPI configuration information is read.
[0188] Step b2: After the first processor runs to the frequency modulation driving engine, it obtains the frequency modulation parameter as the fine frequency modulation mode.
[0189] Step b3: the frequency modulation driving engine of the first processor changes its operating state and periodically monitors the interrupt request count values of all peripherals.
[0190] Step b4, after the second processor is started, it runs at 1 / 8 frequency, 37.5Mhz.
[0191] Step b5, the first processor's scheduled task arrives, and it is calculated that n+m+i+…>20.
[0192] n is the interrupt request count value of peripheral 1, m is the interrupt request count value of peripheral 2, i is the interrupt request count value of peripheral 3, and so on. n+m+i+… represents the sum of the interrupt request count values of all peripherals, that is, the second interrupt statistical value.
[0193] Step b6, the frequency modulation driving engine of the first processor determines that the current frequency of the second processor system will not meet the performance guarantee based on the frequency value 200Mhz corresponding to the threshold "20" and the current frequency of the second processor (37.5Mhz), and starts to initiate the frequency increase process.
[0194] Step b7, the first processor combines the Figure 3 , Figure 4 FM gear configuration, set the FM value to 2 / 3.
[0195] Step b8, the first processor calls the ACPI method, the first processor parses the ACPI method, executes the corresponding SCMI communication, and sends the SCMI message for frequency modulation (ie, the frequency modulation message mentioned above) to the third processor.
[0196] Step b9, the third processor receives the SCMI message from the first processor, parses and processes it to obtain the frequency modulation value;
[0197] Step b10: The third processor pauses the main clock of the second processor and writes a new frequency division value into the frequency division control register of the second processor. The frequency division value can be Figure 3 , Figure 4 and the frequency modulation value of step b7 to determine;
[0198] Step b11, the third processor releases the main clock pause of the second processor, and the frequency modulation of the second processor is completed.
[0199] In this embodiment, when the first processor has only a small number of requests to send to the second processor, the first processor initiates a clock frequency reduction request to the third processor for the second processor, and the third processor writes a larger frequency division value to the frequency division control register that controls the main clock of the second processor. When the first processor has a large number of requests, it indicates that a large amount of data needs to be transmitted through the second processor. At this time, the first processor can initiate a frequency increase request to the third processor for the second processor to run at full speed and process data as quickly as possible. Therefore, by dynamically adjusting the clock frequency of the second processor, the purpose of reducing the power consumption of the running second processor is achieved.
[0200] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0201] The present disclosure also provides a computer-readable storage medium on which a computer program is stored. The program includes instructions. When the instructions are executed by one or more processors of a computing device, the steps of the method described in the above method embodiment are executed.
[0202] The present disclosure also provides an electronic device, such as Fig. 9 As shown, the electronic device 900 includes one or more processors 901, and also includes a memory 902 for storing one or more programs, which are executed by the one or more processors 901 to implement the method flow shown in the above embodiments of the present disclosure and / or the program units corresponding to each unit in the device.
[0203] The various components are interconnected using different buses and can be mounted on a common motherboard or in other ways as needed. The processor 901 can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the user interface on an external input / output device (such as a display device coupled to the interface). In other embodiments, if desired, multiple processors and / or multiple buses can be used with multiple memories and multiple memories.
[0204] The processor 901 may include one or more single-core processors or multi-core processors. The processor 901 may include any combination of general-purpose processors or dedicated processors (such as image processors, application processors, baseband processors, etc.).
[0205] The memory 902 is a computer-readable storage medium provided by the present disclosure, which can be used to store non-transient software programs, non-transient computer executable programs and units, such as the following in the embodiments of the present disclosure: Figure 2 The processor 901 executes the non-transient software programs, instructions and units stored in the memory 902, thereby executing the above method embodiments. Figure 2 The methods shown correspond to programs, instructions, and units.
[0206] The electronic device 900 may further include: an input device 903 and an output device 904. The processor 901, the memory 902, the input device 903 and the output device 904 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0207] The input device 903 can receive input digital or character information, and generate signal input related to user settings and function control related to the frequency modulation device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 904 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0208] The above-mentioned programs (also referred to as software, software applications, or codes) include machine instructions for programmable processors, and these computer programs can be implemented using object-oriented programming languages, assembly or machine languages.
[0209] With the development of time and technology, the meaning of medium is becoming more and more extensive, and the propagation path of computer programs is no longer limited to tangible media, and can also be downloaded directly from the network, etc. Any combination of one or more computer-readable storage media can be used. Computer-readable storage media can be used but not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing programs, which can be used by or in combination with instruction execution systems, devices or devices.
[0210] The technical solution provided by the present disclosure is described in detail above. The principles and implementation methods of the present disclosure are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present disclosure. At the same time, for those skilled in the art, according to the idea of the present disclosure, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present disclosure.
[0211] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A frequency modulation method for a system on chip, characterized in that: The method is applied to a system on chip, the system on chip comprising a first processor, a second processor and a third processor, the first processor communicating with the second processor and the third processor respectively; The frequency modulation method of the system on chip includes: When the clock frequency of the second processor needs to be adjusted, the first processor determines a target frequency of the second processor; The first processor sends a frequency modulation message to the third processor, where the frequency modulation message carries the target frequency of the second processor; The third processor rewrites the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency.
2. The method according to claim 1, characterized in that: The system on chip further includes: a busy register, which can be accessed by the first processor and the second processor and is used to record a busy value, wherein the busy value is used to indicate the operating state of the second processor; The method further includes: the first processor monitoring the busy register, and determining that the clock frequency of the second processor needs to be adjusted when a busy value in the busy register changes.
3. The method according to claim 1, characterized in that The busy value is determined by the second processor and written into the busy register according to one or more of the following: System idle ratio of the second processor; A first interrupt statistic value indicates the number of peripheral interrupt requests processed by the second processor within a first predetermined time period.
4. The method according to claim 3, characterized in that The first interruption statistic is determined by: The second processor periodically collects global variables in each peripheral register, wherein a global variable in a peripheral register represents the number of interrupts of a peripheral controller in a unit time; The second processor performs statistical operations on the global variables in each peripheral register to obtain the first interrupt statistical value, where the first interrupt statistical value is the number of peripheral interrupts processed by the second processor in a unit time.
5. The method according to claim 1, characterized in that Also includes: The first processor determines whether the clock frequency of the second processor needs to be adjusted according to a second interrupt statistic value, where the second interrupt statistic value represents the number of interrupt requests initiated by the first processor for each peripheral controller within a second predetermined time period.
6. The method according to claim 5, characterized in that The system on chip further includes: a peripheral register, the peripheral register being accessible by the first processor and the second processor; The second interrupt statistic value is determined according to the interrupt request count value recorded in each of the peripheral registers.
7. The method according to claim 6, characterized in that The second interruption statistic is obtained by: The first processor periodically collects interrupt request count values in each peripheral register, wherein the interrupt request count value in one peripheral register represents the number of interrupt requests initiated by the first processor for one peripheral controller per unit time; The first processor performs statistical calculations on the interrupt request count values in each peripheral register to obtain a second interrupt statistical value, where the second interrupt statistical value is the number of peripheral interrupt requests initiated by the first processor within a unit time.
8. The method according to claim 1, characterized in that The first processor determines a target frequency of the second processor, including: After the frequency modulation driving engine in the first processor is initialized, the frequency modulation driving engine calls a preconfigured third ACPI method, and when the third ACPI method is called, the frequency modulation parameters of the second processor are read from the ACPI table in the first processor; The first processor determines a target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor; The frequency modulation parameters include one or more of the following: A first parameter indicating the currently supported frequency modulation mode; A second parameter indicating the number of FM gears currently supported; Indicates the frequency modulation level value of the target frequency corresponding to each frequency modulation level.
9. The method according to claim 8, characterized in that The current frequency of the second processor is read from the ACPI table by the frequency modulation driving engine calling a preconfigured second ACPI method.
10. The method according to claim 8, characterized in that The first processor determines the target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, including one of the following: When the first parameter indicates that the first frequency modulation mode is currently supported, obtaining a frequency value set by a user and determining that the target frequency of the second processor is the frequency value set by the user; When the first parameter indicates that the second frequency modulation mode is currently supported, the value of the second parameter is 2, and the first processor determines a frequency modulation gear value in the frequency modulation parameter that is different from the current frequency of the second processor as the target frequency of the second processor; When the first parameter indicates that the second frequency modulation mode is currently supported, the second parameter is greater than 2, and the first processor selects one from a plurality of the frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor.
11. The method according to claim 8, characterized in that The first processor determines a target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, including: The first processor selects one from a plurality of frequency modulation gear values different from the current frequency of the second processor as the target frequency of the second processor based on the second interrupt statistic and pre-configured gear thresholds corresponding to each frequency modulation gear, and the second interrupt statistic represents the number of interrupt requests initiated by the first processor for each peripheral controller within a second predetermined time length.
12. The method according to claim 8, characterized in that The first processor determines a target frequency of the second processor according to the frequency modulation parameter and the current frequency of the second processor, including: When the frequency modulation driving engine in the first processor detects that the second interrupt statistic value is greater than the second gear threshold and less than the first gear threshold, it is determined that the frequency modulation gear of the second processor is the second frequency modulation gear corresponding to the second gear threshold, and the gear value of the first frequency modulation gear corresponding to the first gear threshold is higher than the gear value of the second frequency modulation gear; The frequency modulation driving engine in the first processor calls the second ACPI method to read the gear value of the second frequency modulation gear from the frequency modulation parameters as the target frequency of the second processor.
13. The method according to claim 1, characterized in that The first processor sending a frequency modulation message to the third processor includes: The frequency modulation driver engine in the first processor calls a preconfigured first ACPI method. When the first ACPI method is called, it parses the Method request of the second processor in the ACPI table to generate an SCMI message and sends it to the third processor. The SCMI message carries the target frequency of the second processor.
14. The method according to claim 1, characterized in that The input clock source of the second processor comprises a main clock source, the main clock source is used to provide a main clock signal for the second processor, the main clock signal is a main clock of the core of the second processor; The third processor rewrites the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, including: the third processor rewrites the value of the first frequency division control register used to control the main clock source of the second processor into the target frequency of the second processor, so that the frequency of the main clock signal of the second processor is changed to the target frequency.
15. The method according to claim 14, characterized in that The input clock source of the second processor further includes: a reference clock source, the reference clock source is used to provide a reference clock signal for the second processor, the reference clock signal is a backup clock of the core of the second processor; The method also includes: before rewriting the first frequency division control register, the third processor controls the main clock source of the second processor to pause and enables the reference clock source of the second processor so that the input clock of the second processor is switched from the main clock signal to the reference clock signal; and after rewriting the first frequency division control register, the third processor releases the pause of the main clock source of the second processor and controls the pause of the reference clock source of the second processor so that the input clock of the second processor is switched from the reference clock signal back to the main clock signal.
16. A system on chip, characterized in that: include: A first processor, a second processor and a third processor, wherein the first processor can communicate with the second processor and the third processor respectively; wherein The first processor is used to determine the target frequency of the second processor when the clock frequency of the second processor needs to be adjusted, and send a frequency modulation message to the third processor, where the frequency modulation message carries the target frequency of the second processor; The third processor is used to rewrite the frequency division control register of the second processor according to the target frequency of the second processor in the frequency modulation message, so that the clock frequency of the second processor is adjusted to the target frequency.
17. An electronic device, characterized in that: include: A memory storing a program, the program comprising instructions which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 15.
18. A computer-readable storage medium storing a program, the program comprising instructions which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 15.
