Data Copying Method, Apparatus, Computer-Readable Storage Medium, and Electronic Device
By generating and converting addresses within the chip using a memory management unit and direct memory access controller, the method reduces chip manufacturing costs and facilitates efficient data copying without requiring a system memory management unit.
Patent Information
- Application Number
- JP2025503446
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-07-22
- Filing Date
- 2023-07-14
- Publication Date
- 2025-07-30
- Estimated Expiration
- 2043-07-14
AI Technical Summary
Existing chip technologies require a System Memory Management Unit (SMMU) for address conversion, increasing manufacturing costs.
A data copying method that generates an address conversion request through a target virtual machine, converts the intermediate physical address to a physical address using a memory management unit, and arranges this physical address to a direct memory access controller, eliminating the need for a system memory management unit.
This approach reduces the manufacturing cost of the chip by eliminating the need for a system memory management unit, while enabling efficient data copying operations.
Smart Images

Figure 2025524719000001_ABST
Abstract
Description
Technical Field
[0001] This disclosure claims the priority of a Chinese patent application filed with the Chinese Patent Office on July 22, 2022, with an application number of CN202210868561.8 and an invention title of "Data Copying Method, Apparatus, Computer-Readable Storage Medium, and Electronic Device", and all of its content is incorporated herein by reference.
[0002] This disclosure relates to chip technology, and in particular to a data copying method, apparatus, computer-readable storage medium, and electronic device.
Background Art
[0003] It is possible to use a virtualization manager to realize that multiple virtual machines operate simultaneously on one chip. Here, the chip may include a Direct Memory Access (DMA) controller, and a System Memory Management Unit (SMMU) may be further arranged in the chip.
Summary of the Invention
Problems to be Solved by the Invention
[0004] [[ID=2,6]]Embodiments of this disclosure provide a data copying method, apparatus, computer-readable storage medium, and electronic device.
Means for Solving the Problems
[0005] A data copying method according to an aspect of an embodiment of this disclosure includes: generating an address conversion request including an intermediate physical address through a target virtual machine; converting the intermediate physical address to a physical address through a memory management unit; arranging the physical address to a direct memory access controller through the target virtual machine. Controlling, through the direct memory access controller, a target module including a memory module and / or a peripheral device module to perform a data copy according to the physical address.
[0006] A data copy device according to another aspect of an embodiment of the present disclosure A generation module used to generate an address conversion request including an intermediate physical address through a target virtual machine; A conversion module used to convert the intermediate physical address included in the address conversion request generated by the generation module into a physical address through a memory management unit; An arrangement module used to arrange the physical address converted by the conversion module to a direct memory access controller through the target virtual machine; A control module used to control, through the direct memory access controller, a target module including a memory module and / or a peripheral device module to perform a data copy according to the physical address converted by the conversion module.
[0007] A computer-readable storage medium according to still another aspect of an embodiment of the present disclosure stores a computer program for executing the above data copy method.
[0008] An electronic device according to another aspect of an embodiment of the present disclosure A processor; A memory for storing instructions executable by the processor, and The processor is used to read and execute the executable instructions from the memory to implement the above data copy method.
[0009] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, and when instructions in the computer program product are executed by a processor, the above data copy method is implemented.
Advantages of the Invention
[0010] According to the data copying method, apparatus, computer-readable storage medium, electronic device, and product provided in the above embodiments of the present disclosure, an address conversion request can be generated through a target virtual machine, the intermediate physical address in the address conversion request can be converted into a physical address through a memory management unit, and the physical address can be arranged in a direct memory access controller through the target virtual machine. In the embodiments of the present disclosure, it is the physical address rather than the intermediate physical address that is arranged in the direct memory access controller. Therefore, the direct memory access controller can control the target module to perform data copying based on the physical address, and there is no need to perform address conversion by using a system memory management unit. For this reason, there is no need to arrange a system memory management unit on the chip, thereby reducing the manufacturing cost of the chip.
[0011] Hereinafter, with reference to the drawings and embodiments, the technical solutions of the present disclosure will be described in more detail.
Brief Description of the Drawings
[0012]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13-1
Figure 13-2
Figure 14-1
Figure 14-2
Figure 15-1
Figure 15-2
Figure 16
Figure 17
Figure 18
Figure 19
Mode for Carrying Out the Invention
[0013] To interpret the present disclosure, exemplary embodiments of the present disclosure will be described in detail below with reference to the drawings. It should be clearly understood that the described embodiments are only some embodiments of the present disclosure, not all embodiments, and the present disclosure is not limited to the exemplary embodiments.
[0014] Unless otherwise specifically described, the relative arrangements of the members and steps described in these embodiments, as well as the mathematical formulas and numerical values, do not limit the scope of the present disclosure. Application Summary
[0015] The chip may be a System on Chip (SOC). As shown in FIGS. 1, 2, and 3, in the related art, the chip may include a Memory Management Unit (MMU), a memory module, a peripheral device module, a Direct Memory Access controller, a system memory management unit, and a chip bus module.
[0016] One basic function of the memory management unit is the management of virtual memory, including but not limited to converting a virtual address to a physical address (PA), converting a virtual address to an intermediate physical address (IPA), and converting the intermediate physical address to a physical address.
[0017] The Direct Memory Access controller is used to realize data copying, that is, the replication of data from one address space to another address space.
[0018] The system memory management unit can be responsible for the management of chip peripheral devices.
[0019] Note that by using a virtualization manager (also referred to as a virtualization manager module), it is possible to realize that a plurality of virtual machines (Guest OS) operate simultaneously on one chip. Here, both the virtualization manager and the plurality of virtual machines may be software modules operating on the chip.
[0020] When actually operating, the virtual machine can indirectly operate the hardware through the virtualization manager. When the virtual machine uses a direct memory access controller, usually, the source address and destination address of the data can be arranged in IPA format in the direct memory access controller. For example, as shown in FIG. 2, when a virtual machine named Guest OS A exclusively occupies the direct memory access controller, Guest OS A can directly arrange the source address and destination address in IPA format in the direct memory access controller. Also, for example, as shown in FIG. 3, when a virtual machine named Guest OS A does not exclusively occupy the direct memory access controller and shares the direct memory access controller with other virtual machines (in this case, the virtualization manager is responsible for realizing mutual exclusion when each virtual machine accesses the direct memory access controller), Guest OS A can arrange the source address and destination address in IPA format in the direct memory access controller through the virtualization manager.
[0021] After the source address and destination address in IPA format are arranged in the direct memory access controller, the source address and destination address in IPA format can be converted into the source address and destination address in PA format. The direct memory access controller can execute data copy processing based on the source address and destination address in PA format, that is, it can control the relevant module to execute the replication of data from the address space corresponding to the source address in PA format to the address space corresponding to the destination address in PA format.
[0022] Exemplary system In an embodiment of the present disclosure, the virtual machine can convert the IPA format address into the PA format address through the memory management unit, and the virtual machine can also arrange the PA format address in the direct memory access controller. In this way, the conversion from the IPA format address to the PA format address does not need to depend on other modules or units other than the memory management unit. For example, it does not need to depend on the system memory management unit. Therefore, as shown in FIGS. 4 to 6, it is not necessary to arrange the system memory management unit on the chip for address conversion, thereby reducing the manufacturing cost of the chip.
[0023] Exemplary method FIG. 7 is a schematic flowchart of a data copy method provided in one exemplary embodiment of the present disclosure. The method shown in FIG. 7 may include step 710, step 720, step 730 and step 740, and each step will be described below.
[0024] In step 710, an address conversion request including an intermediate physical address is generated through the target virtual machine.
[0025] In one selectable example, step 710 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the generation module executed by the processor.
[0026] Note that the target virtual machine may be any one of a plurality of virtual machines operating on the chip. For example, it is Guest OS A in FIGS. 5 and 6. The "target" in the target virtual machine does not constitute a limitation on the target virtual machine.
[0027] Before generating an address translation request, the target virtual machine can obtain a virtual address and call the memory management unit to convert the virtual address into an intermediate physical address. Next, the target virtual machine can generate an address translation request including the intermediate physical address, and the address translation request is used to request the conversion of the intermediate physical address into a physical address.
[0028] In step 720, the intermediate physical address is converted into a physical address through the memory management unit.
[0029] In one selectable example, step 720 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by a conversion module executed by the processor.
[0030] Optionally, the target virtual machine can transfer the address translation request to the memory management unit, and the memory management unit can, in response to the address translation request, convert the intermediate physical address included in the address translation request into a physical address. Or, the target virtual machine can transfer the address translation request to the virtualization manager, and the virtualization manager can, in response to the address translation request, call the memory management unit to convert the intermediate physical address included in the address translation request into a physical address.
[0031] In step 730, the physical address is arranged in the direct memory access controller through the target virtual machine.
[0032] In one selectable example, step 730 may be executed by the processor calling the corresponding instructions stored in the memory, or may be executed by the placement module executed by the processor.
[0033] Optionally, the target virtual machine can place the physical address in the direct memory access controller according to a preset copying method, or the target virtual machine can determine a copying method that conforms to the physical address and place the physical address in the direct memory access controller according to the determined copying method.
[0034] In step 740, control the target module including the memory module and / or the peripheral device module to perform a data copy according to the physical address through the direct memory access controller.
[0035] In one selectable example, step 740 may be executed by the processor calling the corresponding instructions stored in the memory, or may be executed by the control module executed by the processor.
[0036] As shown in FIGS. 5 and 6, the memory module, the peripheral device module, and the direct memory access controller can each exchange data with the chip bus module. In this way, based on the relay transmission of the information exchanged by the chip bus module, the control of the memory module and / or the peripheral device module by the direct memory access controller can be realized. Under the control of the direct memory access controller, the memory module and / or the peripheral device module can perform data copying according to the physical address.
[0037] In an embodiment of the present disclosure, an address translation request can be generated through a target virtual machine, an intermediate physical address in the address translation request can be converted into a physical address through a memory management unit, and the physical address can be arranged to a direct memory access controller through the target virtual machine. In the embodiment of the present disclosure, since it is the physical address rather than the intermediate physical address that is arranged to the direct memory access controller, the direct memory access controller can be controlled to perform data copying on a target module based on the physical address, and there is no need to perform address translation by using a system memory management unit. Therefore, there is no need to arrange a system memory management unit on a chip, thereby reducing the manufacturing cost of the chip.
[0038] Based on the embodiment shown in FIG. 7, as shown in FIG. 8, before step 720, the method further includes step 715.
[0039] In step 715, the intermediate physical address is sent to the memory management unit through a virtualization manager.
[0040] In one selectable example, step 715 may be executed by a processor calling a corresponding instruction stored in a memory, or may be executed by a transmission module executed by the processor.
[0041] After the target virtual machine generates an address translation request, the target virtual machine can transfer the address translation request to the virtualization manager. After receiving the address translation request from the target virtual machine, the virtualization manager can send the intermediate physical address included in the address translation request to the memory management unit. After receiving the intermediate physical address from the virtualization manager, the memory management unit can convert the intermediate physical address into a physical address and reply the physical address to the virtualization manager. After receiving the physical address from the memory management unit, the virtualization manager can provide the physical address to the target virtual machine so that the target virtual machine can place the physical address in the direct memory access controller.
[0042] In an embodiment of the present disclosure, the virtualization manager can efficiently and reliably provide the intermediate physical address included in the address translation request to the memory management unit, thereby facilitating the memory management unit to execute the corresponding address translation process.
[0043] In one selectable example, the intermediate physical address includes a source intermediate physical address and a destination intermediate physical address, and the physical address includes a source physical address converted from the source intermediate physical address and a destination physical address converted from the destination intermediate physical address.
[0044] Based on the embodiment shown in FIG. 7, as shown in FIG. 9, step 740 includes step 7402, step 7404, and step 7406.
[0045] In step 7402, determine the data characteristic information of the stored data corresponding to the source physical address.
[0046] In one selectable example, step 7402 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by a first determination sub-module in the control module executed by the processor.
[0047] Optionally, the stored data corresponding to the source physical address may mean the data stored in the address space corresponding to the source physical address, and the data feature information includes, but is not limited to, data format, data volume size, data update period, etc.
[0048] In step 7404, determine a copy method that matches the data feature information of the stored data corresponding to the source physical address.
[0049] In one selectable example, step 7404 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the second determination sub-module in the control module executed by the processor.
[0050] Note that the correspondence between the data feature information and the copy method can be preset. The copy method includes, but is not limited to, single transfer, cyclic transfer, double buffer mode, etc. In step 7404, based on the preset correspondence, the copy method corresponding to the data feature information determined in step 7402 can be determined, and the determined copy method can be the copy method that matches this data feature information.
[0051] In step 7406, control the target module through the direct memory access controller to copy the stored data from the source physical address to the destination physical address according to the determined copy method.
[0052] In one selectable example, step 7406 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the control sub-module in the control module executed by the processor.
[0053] Assume that the source intermediate physical address included in the intermediate physical address is IPA1, the destination intermediate physical address included in the intermediate physical address is IPA2, the source physical address converted from IPA1 is PA1, and the destination physical address converted from IPA2 is PA2. Then, the physical address may include PA1 and PA2.
[0054] After obtaining the physical address including PA1 and PA2, the data feature information T1 of the memory data Data1 corresponding to PA1 can be determined. Based on the pre-set correspondence between the data feature information and the copy method, the copy method C1 corresponding to T1 is determined, and the target module is controlled through the direct memory access controller to copy Data1 from PA1 to PA2 according to the copy method C1 (that is, perform replication from the address space corresponding to PA1 to the address space corresponding to PA2).
[0055] Optionally, PA1 may be an address in the memory or an address of a peripheral device on the bus. PA2 may be an address in the memory or an address of a peripheral device on the bus. In this way, Data1 is copied from PA1 to PA2, and the copy path of Data1 may be in four cases: address in the memory → address in the memory, address in the memory → address of the peripheral device, address of the peripheral device → address of the peripheral device, address of the peripheral device → address in the memory.
[0056] In an embodiment of the present disclosure, the physical address converted from the intermediate physical address included in the address conversion request can include both the source physical address and the destination physical address. By referring to the data feature information of the stored data corresponding to the source physical address, a copy of the stored data can be made in a manner that conforms to this data feature information. For example, when the amount of stored data is very small, a single transfer method can be adopted to efficiently realize the copy of the stored data. Also, for example, when the stored data is peripheral device data that needs to be read periodically, a cyclic transfer method can be adopted to realize the copy of the stored data. In this way, it is advantageous to ensure the data copy efficiency and meet the data demand.
[0057] Based on the embodiment shown in FIG. 7, as shown in FIG. 10, after step 740, this method further includes step 750 and step 760.
[0058] In step 750, in response to detecting a failure of data copy, it is determined whether the number of data copy failures has reached a preset number. If it has reached, step 760 is executed; if not, the process returns to step 730 for execution.
[0059] In step 760, abnormal prompt information is output to the direct memory access controller.
[0060] In one selectable example, in response to detecting a failure of data copying in step 750, the operation of determining whether the number of data copying failures has reached a preset number may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by a trigger module or an output module executed by the processor. The operation executed when the number of data copying failures does not reach the preset number may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by a trigger module executed by the processor (the trigger module is used to trigger the execution of step 730). The operation executed when the number of data copying failures reaches the preset number may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by an output module executed by the processor.
[0061] Optionally, the preset number may be 2, 3, 4, 5 or other numbers, which will not be enumerated one by one here.
[0062] Optionally, the output format of the abnormality prompt information includes, but is not limited to, voice, characters, lights, etc.
[0063] After controlling to perform data copying on the target module according to the physical address by executing step 740, it is possible to detect whether the data copying is successful or failed.
[0064] When detecting a failure of data copying, the number of data copying failures can be determined and compared with the preset number.
[0065] If the number of data copying failures is less than the preset number, it can return to step 730 for execution, that is, relocate the physical address to the direct memory access controller through the target virtual machine, and then execute the steps after step 730 again.
[0066] If the number of data copy failures is equal to or greater than a preset number, abnormal prompt information for the direct memory access controller can be output. For example, "DMA controller abnormality" can be announced by voice, or "DMA controller abnormality" can be displayed in a pop-up window on the screen to prompt manual inspection of the cause of the abnormality of the direct memory access controller. Generally, the causes of abnormalities in the direct memory access controller include, but are not limited to, clock errors, power errors, memory module errors, peripheral device module errors, direct memory access controller errors, electromagnetic compatibility (EMC) interference errors, etc.
[0067] In addition, if the number of data copy failures is equal to or greater than a preset number, in addition to outputting abnormal prompt information, the cause of the abnormality of the direct memory access controller can be manually inspected, and the execution from step 710 to step 740 above can also be prohibited until the abnormality of the direct memory access controller is eliminated.
[0068] In one selectable example, the preset number of times is 2. The physical address converted from the intermediate physical address in the address conversion request includes the source physical address PA1 and the destination physical address PA2 at the same time. Through the target virtual machine, for the first time, PA1 and PA2 are arranged in the direct memory access controller, and after the target module is controlled for the first time to copy Data1 from PA1 to PA2, if a data copy failure is detected, at this time, the number of data copy failures is 1, which is less than the preset number of times. Therefore, next, through the target virtual machine, for the second time, PA1 and PA2 are arranged in the direct memory access controller, and the target module can be controlled for the second time to copy Data1 from PA1 to PA2. After the target module is controlled for the second time to copy Data1 from PA1 to PA2, if a data copy failure is detected, at this time, the number of data copy failures is 2, which is equal to the preset number of times. Therefore, abnormal prompt information for the direct memory access controller can be output by voice, characters, etc.
[0069] In the embodiment of the present disclosure, after the target module is controlled to perform data copying according to the physical address, if the data copying fails and the number of data copying failures does not reach the preset number of times, it can return to the step of arranging the physical address to try data copying again, and if the data copying fails and the number of data copying failures reaches the preset number of times, do not try data copying again, output abnormal prompt information, and prompt to manually check the cause of the abnormality of the direct memory access controller, so as to quickly eliminate the abnormality and then be able to perform normal data copying.
[0070] Based on the embodiment shown in FIG. 7, as shown in FIG. 11, before step 730, this method further includes step 722 and step 724.
[0071] In step 722, obtain the occupancy mode for the direct memory access controller of the target virtual machine.
[0072] In one selectable example, step 722 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the first acquisition module executed by the processor.
[0073] Note that there are two possible situations for the occupancy mode. One is the exclusive mode, and the other is the non-exclusive mode. Among them, in the exclusive mode, the target virtual machine can communicate directly with the direct memory access controller, and in the non-exclusive mode, the target virtual machine can communicate with the direct memory access controller through the virtualization manager. Here, for the case of the exclusive mode, Figure 5 can be referred to, and for the situation of the non-exclusive mode, Figure 6 can be referred to.
[0074] In step 724, obtain the control information for the direct memory access controller.
[0075] In one selectable example, step 724 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the second acquisition module executed by the processor.
[0076] Optionally, the control information obtained in step 724 may be called DMA control information, and the DMA control information may include at least one of copy speed information, copy mode information, and data check method.
[0077] Step 730 includes step 7302 and step 7304.
[0078] In step 7302, determine the arrangement method that matches the occupancy mode.
[0079] In one selectable example, step 7302 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the third decision sub-module in the placement module executed by the processor.
[0080] When the occupancy mode is the exclusive mode, the placement method matching the occupancy mode may be direct placement. When the occupancy mode is the non-exclusive mode, the placement method matching the occupancy mode may be to perform placement through the virtualization manager.
[0081] In step 7304, the physical address and control information are placed in the direct memory access controller according to the placement method through the target virtual machine.
[0082] In one selectable example, step 7304 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the placement sub-module in the placement module executed by the processor.
[0083] When the occupancy mode is the exclusive mode, the target virtual machine can directly place the physical address and control information in the direct memory access controller. When the occupancy mode is the non-exclusive mode, the target virtual machine can place the physical address and control information in the direct memory access controller through the virtualization manager.
[0084] In the embodiments of the present disclosure, by referring to the occupancy mode of the target virtual machine for the direct memory access controller and adopting a placement method that conforms to this occupancy mode, the physical address and control information can be efficiently and reliably placed in the direct memory access controller, thereby facilitating the direct memory access controller to perform data copy processing by referring to the physical address and control information.
[0085] Based on the embodiment shown in FIG. 7, as shown in FIG. 12, step 730 includes step 7306 and step 7308.
[0086] In step 7306, access permission information for the physical address of the target virtual machine is determined through the virtualization manager.
[0087] In one selectable example, step 7306 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the fourth determination sub-module in the placement module executed by the processor.
[0088] Optionally, the virtualization manager can determine access permission information for the physical address of the target virtual machine according to a preset access permission control policy, and the access permission information is used to characterize whether the target virtual machine has access permission to the physical address.
[0089] In one specific embodiment, the physical address has a corresponding access whitelist, which includes a plurality of virtual machine identifier information. Based on the embodiment shown in FIG. 12, step 7306 includes step 73062 in FIG. 13-1 or step 73064 in FIG. 13-2. [[ID=1!7]]
[0090] In step 73062, in response to the identifier information of the target virtual machine being in the access whitelist, the virtualization manager determines that the access permission information characterizes that the target virtual machine has access permission to the physical address.
[0091] In step 73064, in response to the identifier information of the target virtual machine not being in the access whitelist, the virtualization manager determines that the access permission information characterizes that the target virtual machine does not have access permission to the physical address.
[0092] Incidentally, the correspondence between the physical address and the access whitelist can be memorized in advance. After converting the intermediate physical address included in the address conversion request into a physical address through the memory management unit, the virtualization manager can determine the access whitelist corresponding to the physical address based on the previously memorized correspondence, and traverse the access whitelist corresponding to the physical address to determine whether the identifier information of the target virtual machine is in the access whitelist corresponding to the physical address.
[0093] When the identifier information of the target virtual machine is in the access whitelist corresponding to the physical address, the access permission information determined by the virtualization manager can be represented as "1", characterizing that the target virtual machine has the access permission to the physical address. When the identifier information of the target virtual machine is not in the access whitelist corresponding to the physical address, the access permission information determined by the virtualization manager can be represented as "0", characterizing that the target virtual machine does not have the access permission to the physical address.
[0094] By adopting such an embodiment, for the installation of the access whitelist, by determining whether the identifier information of the target virtual machine is in the access whitelist corresponding to the physical address, it is possible to efficiently and surely determine whether the target virtual machine has the access permission to the physical address.
[0095] Incidentally, in a specific implementation, an access blacklist corresponding to the physical address may be installed. When the identifier information of the target virtual machine is in the access blacklist, the access permission information can characterize that the target virtual machine does not have the access permission to the physical address. When the identifier information of the target virtual machine is not in the access blacklist, the access permission information can characterize that the target virtual machine has the access permission to the physical address.
[0096] In step 7308, in response to the access right information characterizing that the target virtual machine has the access right to the physical address, the physical address is arranged to the direct memory access controller through the target virtual machine.
[0097] In one selectable example, step 7308 may be executed by the processor calling the corresponding instruction stored in the memory, or may be executed by the arrangement sub-module in the arrangement module executed by the processor.
[0098] When the access right information characterizes that the target virtual machine has the access right to the physical address, the virtualization manager can send the physical address to the target virtual machine, and the target virtual machine can arrange the physical address to the direct memory access controller. In this way, the direct memory access controller can execute the data copy process based on the physical address.
[0099] When the access right information characterizes that the target virtual machine does not have the access right to the physical address, the virtualization manager does not send the physical address to the target virtual machine, and the target virtual machine does not arrange the physical address.
[0100] In an embodiment of the present disclosure, access permission information for the physical address of a target virtual machine can be determined through a virtualization manager. When the access permission information characterizes that the target virtual machine has access permission to the physical address, the physical address is arranged in a direct memory access controller through the target virtual machine. Thereby, the embodiment of the present disclosure utilizes the virtualization manager to make a judgment related to access permission before arranging the physical address in the direct memory access controller, thereby restricting the area that the target virtual machine can access through the direct memory access controller and ensuring the security when the target virtual machine accesses the memory through the direct memory access controller.
[0101] Based on the embodiment shown in FIG. 13-1 or FIG. 13-2, as shown in FIG. 14-1 or FIG. 14-2, step 720 includes step 7202.
[0102] In step 7202, in response to the absence of an intermediate physical address in the recorded address, the intermediate physical address is converted to a physical address through a memory management unit.
[0103] This method further includes step 770.
[0104] In step 770, in response to the access permission information characterizing that the target virtual machine does not have access permission to the physical address, an intermediate physical address is added to the recorded address.
[0105] In one selectable example, step 770 may be executed by the processor calling a corresponding instruction stored in the memory, or may be executed by an additional module executed by the processor.
[0106] Optionally, the recorded address can be represented in the form of an address table.
[0107] In one selectable example, the target virtual machine is Guest OS A. After Guest OS A generates an address translation request whose included intermediate physical address is IPA0, assuming that Guest OS A then sends the address translation request to the virtualization manager, the virtualization manager can traverse the recorded addresses to determine whether IPA0 exists in the recorded addresses.
[0108] If IPA0 exists in the recorded addresses, the virtualization manager can reject the address translation request of Guest OS A.
[0109] If IPA0 does not exist in the recorded addresses, the virtualization manager can call the memory management unit to convert IPA0 into a physical address. The obtained physical address may be PA0. The virtualization manager can further determine the access permission information for PA0 of Guest OS A. If the access permission information characterizes that Guest OS A does not have access permission to PA0, the virtualization manager can add IPA0 to the recorded addresses. If the access permission information characterizes that Guest OS A has access permission to PA0, the virtualization manager may not need to add IPA0 to the recorded addresses. The virtualization manager can also send PA0 to Guest OS A so that Guest OS A arranges PA0 to the direct memory access controller.
[0110] Regarding the case where the access right information described in the previous paragraph characterizes that Guest OS A does not have the access right to PA0, since the virtual manager adds IPA0 to the recorded address, Guest OS A regenerates an address translation request whose included intermediate physical address is IPA0, and after sending the address translation request to the virtual manager, the virtual manager can determine that IPA0 exists in the recorded address by traversing the recorded address. At this time, the virtual manager can reject the address translation request of Guest OS A, without the need to call the memory management unit to convert IPA0 to a physical address, and without the need to execute the access right information determination step and the physical address allocation step based on the physical address. Thus, it is advantageous for saving computing resources.
[0111] In the embodiments of the present disclosure, by updating and using the recorded address, it is not necessary to convert the intermediate physical address in all address translation requests through the memory management unit, and it is only necessary to convert the intermediate physical address that does not exist in the recorded address. Thereby, it is advantageous for saving computing resources.
[0112] Based on the embodiments shown in FIG. 13-1 or FIG. 13-2, as shown in FIG. 15-1 or FIG. 15-2, this method further includes step 780 and step 790.
[0113] In step 780, in response to the target virtual machine generating more address translation requests than a preset number within a preset time, and each access right information corresponding to the address translation request characterizing that the target virtual machine does not have the access right to the physical address, the authority confirmation prompt information is output, where the authority confirmation prompt information includes the identifier information and the physical address of the target virtual machine.
[0114] In one selectable example, step 780 may be executed by the processor calling the corresponding instructions stored in the memory, or may be executed by an output module executed by the processor.
[0115] Optionally, the preset time may be 30 seconds, 1 minute, 2 minutes, etc., and the preset number may be 30, 40, 50, 60, 100, etc., which will not be enumerated one by one here.
[0116] Suppose the target virtual machine generates 105 address translation requests containing physical addresses within one minute, and based on the access white list corresponding to the physical addresses, the virtualization manager determines that none of the access permission information corresponding to each address translation request indicates that the target virtual machine has the access permission to the physical address. In this case, it is possible to output permission confirmation prompt information including the identifier information of the target virtual machine and the physical address by voice, text, etc. For example, it can announce by voice "Please confirm whether Guest OS A has the access permission to PA0", and also, for example, display "Please confirm whether Guest OS A has the access permission to PA0" on a pop-up window on the screen to prompt people to confirm whether Guest OS A has the access permission to PA0.
[0117] In step 790, in response to a trigger operation on the permission confirmation prompt information, add the identifier information of the target virtual machine to the access white list.
[0118] In one selectable example, step 790 may be executed by the processor calling the corresponding instructions stored in the memory, or may be executed by an additional module executed by the processor.
[0119] Optionally, in response to the authorization confirmation prompt information output in step 780, a person can say "yes" or "no" verbally. If the person says "yes" verbally, it is considered that a trigger operation for the authorization confirmation prompt information has been received, and then the name of Guest OS A can be added to the access white list. Alternatively, two selection buttons, "yes" and "no", can be displayed below the pop-up window on the screen. In response to the authorization confirmation prompt information output in step 780, a person can manually select the "yes" selection button or the "no" selection button. If the person manually selects the "yes" selection button, it is considered that a trigger operation for the authorization confirmation prompt information has been received, and then the name of Guest OS A can be added to the access white list.
[0120] In an embodiment of the present disclosure, if the target virtual machine generates a large number of address conversion requests containing the same intermediate physical address within a short period of time, and all the access permission information corresponding to these address conversion requests indicates that the target virtual machine does not have the access permission to the physical address, then by outputting the authorization confirmation prompt information, it can be prompted to a person to confirm whether the target virtual machine has the access permission to the physical address. If it is confirmed by the person that the target virtual machine has the access permission to the physical address, the identifier information of the target virtual machine can be added to the access white list, thereby ensuring the accuracy of the information recorded in the access white list.
[0121] Optionally, as shown in FIG. 16, the data copy method provided in the embodiment of the present disclosure may include the following steps.
[0122] In step 1602, Guest OS A uses the MMU to convert the source virtual address VA1 and the destination virtual address VA2 into the source intermediate physical address IPA1 and the destination intermediate physical address IPA2.
[0123] In step 1604, Guest OS A requests the virtualization manager to use the MMU to convert the source intermediate physical address IPA1 and the destination intermediate physical address IPA2 into the source physical address PA1 and the destination physical address PA2.
[0124] In step 1606, Guest OS A places the source physical address PA1, the destination physical address PA2, and the control information in the DMA controller (suitable when Guest OS A exclusively occupies the DMA controller), or Guest OS A places the source physical address PA1, the destination physical address PA2, and the control information in the DMA controller through the virtualization manager (suitable when Guest OS A and other virtual machines share the DMA controller).
[0125] In step 1608, the DMA controller controls the memory module or the peripheral device module to copy data from the source physical address PA1 to the destination physical address PA2.
[0126] As described above, the embodiments of the present disclosure can realize the virtualization of the DMA controller on a chip without an SMMU. Thereby, multiple virtual machines operating on the chip can all accurately and quickly use the DMA controller to copy data, which is advantageous for reducing chip costs.
[0127] Any data copying method provided in the embodiments of the present disclosure can be executed by any suitable device having data processing capabilities, and the device includes, but is not limited to, terminal devices and servers, etc. Alternatively, any copying method provided in the embodiments of the present disclosure can be executed by a processor. For example, the processor executes any copying method referred to in the embodiments of the present disclosure by calling the corresponding instructions stored in the memory. The description is omitted hereinafter.
[0128] As can be understood by those skilled in the art, all or some of the steps for implementing the embodiments of the above method can be completed by a program instructing relevant hardware, and the aforementioned program can be stored in a computer-readable storage medium. When this program is executed, the steps including the embodiments of the above method are executed. The aforementioned storage medium includes various media such as read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk that can store program codes.
[0129] Exemplary Device FIG. 17 is a schematic structural diagram of a data copy device provided in one exemplary embodiment of the present disclosure. The device shown in FIG. 17 is used to implement the embodiments of any of the above methods of the present disclosure. The device shown in FIG. 17 includes a generation module 1710, a conversion module 1720, an arrangement module 1730, and a control module 1740.
[0130] The generation module 1710 is used to generate an address conversion request including an intermediate physical address through a target virtual machine.
[0131] The conversion module 1720 is used to convert the intermediate physical address included in the address conversion request generated by the generation module 1710 into a physical address through a memory management unit.
[0132] The arrangement module 1730 is used to arrange the physical address converted by the conversion module 1720 to a direct memory access controller through a target virtual machine.
[0133] The control module 1740 is used to control a target module including a memory module and / or a peripheral device module to perform data copying according to the physical address converted by the conversion module 1720 through a direct memory access controller.
[0134] In one selectable example, as shown in FIG. 18, this apparatus further includes a transmission module 1715 for transmitting an intermediate physical address through a virtualization manager to a memory management unit before converting the intermediate physical address included in an address translation request generated by a generation module 1710 into a physical address through the memory management unit.
[0135] In one selectable example, the intermediate physical address includes a source intermediate physical address and a destination intermediate physical address, and the physical address includes a source physical address converted from the source intermediate physical address and a destination physical address converted from the destination intermediate physical address.
[0136] As shown in FIG. 18, a control module 1740 includes a first determination sub-module 17402 for determining data feature information of stored data corresponding to a source physical address, a second determination sub-module 17404 for determining a copy method that matches the data feature information determined by the first determination sub-module 17402, and a control sub-module 17406 for controlling, through a direct memory access controller, a target module to copy stored data from a source physical address to a destination physical address according to the copy method determined by the second determination sub-module 17404.
[0137] In one selectable example, as shown in FIG. 18, this apparatus includes a trigger module 1750 for triggering a placement module 1730 after the control module 1740 controls, through a direct memory access controller, a target module to perform data copying according to a physical address, detecting a failure of the data copying, and in response to the number of data copying failures not reaching a preset number. After the control module 1740 controls the target module to perform data copying according to the physical address through the direct memory access controller, it detects a failure in the data copying, and in response to the number of data copying failures reaching a preset number, it further includes an output module 1760 for outputting abnormal prompt information to the direct memory access controller.
[0138] In one selectable example, as shown in FIG. 18, this device a first acquisition module 1722 for acquiring the occupancy mode of the target virtual machine with respect to the direct memory access controller before arranging the physical address to the direct memory access controller through the target virtual machine; a second acquisition module 1724 for acquiring control information for the direct memory access controller, and further includes The arrangement module 1730 a third determination sub-module 17302 for determining an arrangement method matching the occupancy mode acquired by the first acquisition module 1722; an arrangement sub-module 17304 for arranging the physical address and the control information acquired by the second acquisition module 1724 through the target virtual machine to the direct memory access controller according to the arrangement method determined by the third determination sub-module 17302.
[0139] In the device of the present disclosure, each of the various selectable embodiments, selectable forms, and selectable examples disclosed above can be flexibly selected and combined as needed, thereby realizing the corresponding functions and effects, and the present disclosure will not list them one by one.
[0140] Exemplary electronic device FIG. 19 shows a block diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 1900 includes one or more processors 1910 and a memory 1920.
[0141] The processor 1910 may be a central processing unit (CPU) or other form of processing unit having data processing capabilities and / or instruction execution capabilities, and may control other components within the electronic device 1900 to execute desired functions.
[0142] The memory 1920 can include one or more computer program products, and the computer program products can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory can include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory can include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions can be stored in the computer-readable storage media, and the processor 1910 can execute one or more computer program instructions to realize the data copying method and / or other desired functions of any of the method embodiments of the present disclosure described above.
[0143] In one selectable example, the electronic device 1900 can further include an input device 1930 and an output device 1940, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0144] This input device 1930 can further include, for example, a keyboard, a mouse, etc.
[0145] This output device 1940 can output various information externally. This output device 1940 can include, for example, a display, a speaker, a printer, a communication network, and remote output devices connected thereto.
[0146] For simplicity, FIG. 19 shows only some of the components related to the present disclosure within this electronic device 1900, and omits components such as buses, input / output interfaces, etc. In addition, depending on the specific application situation, the electronic device 1900 can further include any other appropriate components.
[0147] Exemplary Computer Program Product and Computer Readable Storage Medium In addition to the above methods and devices, embodiments of the present disclosure may also be a computer program product including computer program instructions, and when the computer program instructions are executed by a processor, cause the processor to execute steps in a data copying method according to any of the embodiments of the methods of the present disclosure described in the "Exemplary Methods" section hereinabove.
[0148] The computer program product can create program code for performing operations of the embodiments of the present disclosure in any combination of one or more programming languages, which include object-oriented programming languages such as Java (registered trademark), C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on a user's computing device, partially on a user's device, executed as an individual software package, partially executed on a user's computing device and partially on a remote computing device, or entirely executed on a remote computing device or a server.
[0149] Also, embodiments of the present disclosure may be a computer readable storage medium storing computer program instructions that, when executed by a processor, cause the processor to execute steps in a data copying method according to any of the embodiments of the methods of the present disclosure described in the "Exemplary Methods" section herein.
[0150] The computer-readable storage medium can use any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (non-exhaustive list) of the readable storage medium include an electrical connection having one or more conductors, a mobile hard drive, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0151] As described above, the basic principles of the present disclosure have been explained with reference to specific embodiments. However, the advantages, superiority, effects, etc. mentioned in the present disclosure are not limited and are merely illustrative, and these advantages, superiority, effects, etc. are not necessarily possessed by each embodiment of the present disclosure. Also, the specific details disclosed above are not limited and are merely for the purpose of illustration and facilitating understanding, and the above details do not limit the present disclosure to be necessarily implemented by the above specific details.
[0152] Those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and the scope of equivalent technologies, the present disclosure is also intended to include these modifications and variations.
Claims
1. Generating an address translation request including an intermediate physical address through a target virtual machine; Converting the intermediate physical address to a physical address through a memory management unit; Arranging the physical address to a direct memory access controller through the target virtual machine; Controlling, through the direct memory access controller, a target module including a memory module and / or a peripheral device module to perform a data copy according to the physical address. A data copy method.
2. Before the step of converting the intermediate physical address to a physical address through a memory management unit, the method further includes: Transmitting the intermediate physical address to the memory management unit through a virtualization manager. The data copy method according to Claim 1.
3. The intermediate physical address includes a source intermediate physical address and a destination intermediate physical address, and the physical address includes a source physical address converted from the source intermediate physical address and a destination physical address converted from the destination intermediate physical address. The step of controlling, through the direct memory access controller, a target module to perform a data copy according to the physical address includes: Determining data feature information of stored data corresponding to the source physical address; Determining a copy method matching the data feature information; Controlling, through the direct memory access controller, a target module to copy the stored data from the source physical address to the destination physical address according to the copy method. The data copy method according to Claim 1.
4. After the step of controlling, through the direct memory access controller, a target module to perform a data copy according to the physical address, the method includes: Detecting a failure of the data copy, and in response to the number of failures of the data copy not reaching a preset number, returning to and executing the step of arranging the physical address to a direct memory access controller through the target virtual machine. detecting a failure of the data copy, and in response to the number of failures of the data copy reaching the preset number, outputting abnormal prompt information for the direct memory access controller; The data copy method according to claim 1.
5. Before the step of arranging the physical address in the direct memory access controller through the target virtual machine, the method further includes: acquiring an occupancy mode of the target virtual machine with respect to the direct memory access controller; acquiring control information for the direct memory access controller; The step of arranging the physical address in the direct memory access controller through the target virtual machine includes: determining an arrangement method matching the occupancy mode; arranging the physical address and the control information in the target virtual machine according to the arrangement method in the direct memory access controller. The data copy method according to claim 1.
6. a generation module used to generate an address conversion request including an intermediate physical address through a target virtual machine; a conversion module used to convert the intermediate physical address included in the address conversion request generated by the generation module into a physical address through a memory management unit; an arrangement module used to arrange the physical address converted by the conversion module in a direct memory access controller through the target virtual machine; a control module used to control the direct memory access controller to perform data copying according to the physical address converted by the conversion module for a target module including a memory module and / or a peripheral device module; A data copy device.
7. Before converting the intermediate physical address included in the address conversion request generated by the generation module into a physical address through a memory management unit, the method further includes a transmission module used to transmit the intermediate physical address included in the address conversion request generated by the generation module to the memory management unit through a virtualization manager. The data copy device according to claim 6.
8. The intermediate physical address includes a source intermediate physical address and a destination intermediate physical address, and the physical address includes a source physical address converted from the source intermediate physical address and a destination physical address converted from the destination intermediate physical address. The control module includes a first determination sub-module used to determine data feature information of stored data corresponding to the source physical address; a second determination sub-module used to determine a copy method that matches the data feature information determined by the first determination sub-module; and a control sub-module used to control, through the direct memory access controller, the target module to copy the stored data from the source physical address to the destination physical address according to the copy method determined by the second determination sub-module. The data copying device according to claim 6.
9. A computer-readable storage medium storing a computer program used to execute the data copying method according to any one of claims 1 to 5.
10. An electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor reads and executes the executable instructions from the memory to implement the data copying method according to any one of claims 1 to 5.
11. A computer program product, wherein when instructions in the computer program product are executed by a processor, the data copying method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Direct access memory device
JP2003281074A
Switch, information processor, and address translation method
WO2008120325A1