Equipment access method, device and equipment based on address space identifier
By using a single-level page table design based on address space identifiers, the address translation process of the device memory management unit is simplified, solving the problems of high hardware complexity and excessive resource consumption, and achieving low latency and efficient data transmission.
Patent Information
- Application Number
- CN202511810200.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-10
AI Technical Summary
Existing device memory management units suffer from high hardware complexity, high latency, excessive resource consumption, and difficulty in ensuring security in heavily virtualized scenarios, especially in embedded and security-sensitive scenarios.
A single-level page table based on address space identifiers is adopted to simplify the device memory management unit. The fixed context is directly indexed through address space identifiers, simplifying the address translation process and reducing the complexity of external memory access and dynamic configuration.
It reduces hardware implementation costs and power consumption, improves data transmission efficiency, simplifies hardware formal verification, and adapts to the needs of embedded and resource-constrained scenarios.
Smart Images

Figure CN121636381A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of address mapping technology, and in particular to a device access method, apparatus, and device based on address space identifiers. Background Technology
[0002] The device memory management unit (MMU) is a component that ensures the security and efficiency of direct memory access on devices, enabling the translation of virtual addresses to physical addresses. As technology advances, the complexity requirements of heavily virtualized scenarios such as servers are increasing. However, resource-constrained and security-sensitive scenarios such as embedded systems and automotive security domains require simplified solutions tailored to their specific characteristics to balance functionality, cost, and security.
[0003] Currently, in heavily virtualized scenarios such as servers and cloud computing, the mainstream device memory management unit is the traditional system memory management unit. These units integrate numerous complex features to meet the demands of multiple device accesses and frequent dynamic changes in address space. Taking ARM SMMUv3 as an example, it employs a dynamic context management mode. When a device initiates a direct memory access request, it must first query the identifier table and context table in external memory using the device's identity identifier and load the device-specific translation configuration. If it needs to access process virtual memory, it also needs to verify the process address identifier. The address translation stage requires multi-level page table traversal, with each traversal requiring access to external memory. The entire process relies on multiple external interactions and software collaboration.
[0004] Traditional system memory management units (MMUs) suffer from the following main problems: high dependence on the operating system and drivers, making them unreliable during stages such as firmware booting where complete driver support is lacking; complex hardware implementation, increasing chip area and power consumption, while also making formal verification and security auditing difficult; mismatch between page-level fine-grained mapping and the needs of scenarios such as booting and fixed topology devices, with redundant logic reducing efficiency; excessive resource consumption, making it difficult for low-cost, low-energy-constrained devices to withstand; and complex mapping and replacement strategies, making it difficult to verify the correctness of mappings such as non-overlapping and consistent permissions, thus failing to meet the needs of security-sensitive scenarios. Summary of the Invention
[0005] This invention provides a device access method, apparatus, and device based on address space identifiers. By directly indexing a single-level page table with a fixed context based on address space identifiers, the device memory management unit is simplified, solving the technical problems of high complexity, high latency, and difficult maintenance caused by the dynamic redundancy design in the prior art.
[0006] According to one aspect of the present invention, a device access method based on address space identifiers is provided, applied to a simplified device memory management unit, the method comprising:
[0007] Establish single-level range tables, where each single-level range table corresponds to the fixed device context of the simplified device memory management unit, and the single-level range table includes virtual address range and physical base address;
[0008] Obtain device access requests, read address space identifiers and virtual addresses from device access requests, and match the corresponding target range table from each single-level range table based on the address space identifiers;
[0009] Calculate the target physical address based on the target range table and the virtual address, and establish device access based on the target physical address.
[0010] Optionally, matching the corresponding target range table from each single-level range table based on the address space identifier includes: when the address space identifier is not 0, matching the corresponding target device context based on the address space identifier to determine the target range table associated with the target device context.
[0011] Optionally, the method also includes: when the address space identifier is 0, directly using the virtual address as the target physical address, and establishing device access based on the target physical address.
[0012] Optionally, the target physical address is calculated based on the target range table and the virtual address, including: when the virtual address falls within the target virtual address range of the target range table, determining the starting address corresponding to the target virtual address range; calculating the difference between the virtual address and the starting address, and adding the difference to the target physical base address in the target range table to obtain the target physical address.
[0013] Optionally, the method also includes: triggering an address matching error message and terminating device access when the virtual address does not fall within the target virtual address range of the target range table.
[0014] Optionally, the method also includes: attempting to perform the corresponding read / write operation based on the target physical address; if the read / write operation is executed normally, establishing device access based on the target physical address; otherwise, triggering a permission exception prompt, recording the hardware exception type as page fault or range fault, and terminating device access.
[0015] Optionally, establishing device access based on the target physical address includes: extracting data transmission requirements from the device access request; and, according to the data transmission requirements, controlling the establishment of a data path between the device and the target physical address, and executing data transmission.
[0016] According to another aspect of the present invention, a device access apparatus based on address space identifiers is provided for use in a simplified device memory management unit, the apparatus comprising:
[0017] The single-level range table creation module is used to create each single-level range table. The single-level range table corresponds to the fixed device context of the simplified device memory management unit. The single-level range table includes a virtual address range and a physical base address.
[0018] The target range table matching module is used to obtain device access requests, read address space identifiers and virtual addresses from the device access requests, and match the corresponding target range table from each single-level range table based on the address space identifiers.
[0019] The device access establishment module is used to calculate the target physical address based on the target range table and the virtual address, and to establish device access based on the target physical address.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] At least one processor;
[0022] and a memory communicatively connected to the at least one processor;
[0023] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform a device access method based on address space identifier as described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement a device access method based on address space identifier as described in any embodiment of the present invention.
[0025] The technical solution of this invention simplifies the data structure design of address mapping by replacing the traditional multi-level page table with a single-level structure, reduces the complexity of dynamic configuration, and facilitates hardware formal verification. Direct matching via address space identifiers eliminates the steps of resolving device identity identifiers and querying external table entries, reducing the number of external memory accesses. By calculating the target physical address and establishing access, the hardware address translation logic is simplified, reducing hardware implementation costs and power consumption, and improving data transmission efficiency.
[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of a device access method based on address space identifier according to Embodiment 1 of the present invention;
[0029] Figure 2 This is a flowchart of another device access method based on address space identifiers according to Embodiment 2 of the present invention;
[0030] Figure 3 This is a schematic diagram of a device access device based on address space identifier according to Embodiment 3 of the present invention;
[0031] Figure 4 This is a schematic diagram of the structure of an electronic device that implements a device access method based on address space identification according to an embodiment of the present invention. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0034] Example 1
[0035] Figure 1This is a flowchart illustrating a device access method based on address space identifiers, as provided in Embodiment 1 of the present invention. This embodiment is applicable to device access scenarios. The method can be executed by a device access device based on address space identifiers, which can be implemented in hardware and / or software. This device access device can be applied to a simplified device memory management unit. For example... Figure 1 As shown, the method includes:
[0036] S110. Establish each single-level range table, wherein the single-level range table corresponds to the fixed device context of the simplified device memory management unit, and the single-level range table includes virtual address range and physical base address.
[0037] The Address Space Identifier (ASID) is used to identify the device context. In the Simplified Device Memory Management Unit (AMMU), each ASID corresponds to a fixed device context. When a device initiates a Direct Memory Access (DMA) request, it carries this identifier. The AMMU can directly locate the corresponding single-level range table through the ASID, achieving fast matching of virtual and physical address translation. The Simplified Device Memory Management Unit is a simplified device memory management unit designed for embedded, resource-constrained, and security-sensitive scenarios. It employs an ASID-based direct indexing of fixed device contexts and a single-level range table design, aiming to reduce hardware and driver implementation costs, minimize resource overhead, and achieve predictable DMA isolation and convenient configuration verification. The single-level range table refers to the data result in the AMMU that corresponds one-to-one with the fixed device context, replacing the traditional multi-level page table. The single-level range table includes a virtual address range and a physical base address. The fixed device context refers to the fixed memory access context preset by the AMMU for the device; each context corresponds to an ASID and a single-level range table. A virtual address range refers to the range of virtual addresses accessible to a device as defined in a single-level range table. It includes a start address and an end address and serves as the basis for determining the validity of a virtual address request initiated by the device. The AMMU matches the virtual address in the device access request against this range; only virtual addresses falling within the range are used for subsequent physical address calculation. The physical base address refers to the starting address of the physical memory corresponding to the virtual address mapping stored in the single-level range table. Once a virtual address matches the corresponding virtual address range, the actual physical memory address can be calculated using the offset relationship between the virtual address and the physical base address.
[0038] S120. Obtain a device access request, read the address space identifier and virtual address from the device access request, and match the corresponding target range table from each single-level range table based on the address space identifier.
[0039] Among them, a device access request refers to a memory access request initiated by a device. The device access request carries an address space identifier and a virtual address, including a source virtual address and a destination virtual address, and serves as the input basis for the AMMU to perform address translation and access control. The target range table refers to the single-level range table corresponding to the ASID in the device access request, matched by the AMMU from all single-level range tables. It is the direct basis for subsequent calculation of the target physical address.
[0040] Optionally, matching the corresponding target range table from each single-level range table based on the address space identifier includes: when the address space identifier is not 0, matching the corresponding target device context based on the address space identifier to determine the target range table associated with the target device context.
[0041] Specifically, when the ASID carried in the access request initiated by the device is not 0, the ASID is first matched with the fixed device context. The AMMU pre-configures a dedicated fixed device context for each device to be managed, and each fixed device context is bound to a unique ASID. That is to say, the ASID is equivalent to the unique identifier of the fixed device context, and there is no situation where one ASID corresponds to multiple fixed device contexts. At this time, the AMMU does not need to dynamically load the context by querying multi-level tables in external memory, as in the traditional System Memory Management Unit (SMMU). Instead, it directly uses hardware logic to map the ASID to the preset fixed device context, quickly locate the target device context bound to the ASID, and use the single-level range table bound to the target device context as the target range table. The entire process relies entirely on the hardware association logic preset by the AMMU, without external memory access or software driver intervention to supplement configuration. This simplifies the matching process, reduces latency, and avoids the complexity and failure risks brought by the dynamic context management of traditional SMMUs, fully adapting to the low-overhead and high-reliability requirements of embedded and resource-constrained scenarios.
[0042] Optionally, the method also includes: when the address space identifier is 0, directly using the virtual address as the target physical address, and establishing device access based on the target physical address.
[0043] It's important to note that while AMMU's core function is to translate device virtual addresses to physical addresses, not all scenarios require complex mappings. For example, during the boot phase, a device may only need to access a fixed physical memory region, or some simpler devices may have a direct virtual-to-physical address mapping design, eliminating the need for a single-level range table for mapping calculations. ASID=0 is the identifier that triggers AMMU's pass-through mode. When the ASID in a device's access request is 0, AMMU skips the steps of matching the single-level range table and calculating the offset between the virtual and physical addresses, directly recognizing the virtual address in the device's access request as the target physical address.
[0044] Furthermore, after determining the target physical address, the AMMU establishes device access based on that address. However, this process still needs to ensure basic access security. Although no mapping is required, the AMMU will by default verify whether the access initiated by the device conforms to the system's preset basic security boundaries. If it does not exceed the security boundaries, the device is allowed to directly interact with memory based on the target physical address. If it exceeds the security boundaries, access will be denied to prevent unauthorized operations.
[0045] S130. Calculate the target physical address based on the target range table and the virtual address, and establish device access based on the target physical address.
[0046] The target physical address refers to the actual physical memory address calculated by the AMMU based on the physical base address and virtual address range in the target range table, combined with the virtual address in the device access request. The device ultimately completes memory access through this address.
[0047] Optionally, the target physical address is calculated based on the target range table and the virtual address, including: when the virtual address falls within the target virtual address range of the target range table, determining the starting address corresponding to the target virtual address range; calculating the difference between the virtual address and the starting address, and adding the difference to the target physical base address in the target range table to obtain the target physical address.
[0048] The target range table pre-configures virtual address ranges, which clearly define the start and end intervals of virtual addresses that the corresponding device can legally access. For example, the virtual address range of a certain target range table might be set to 0x20000000-0x2000FFFF. The AMMU first compares the virtual address extracted from the device access request with this start and end interval. If the virtual address is smaller than the start address or larger than the end address, it means that the virtual address exceeds the device's legal access range, and the AMMU will reject subsequent address translation to prevent unauthorized access. If the virtual address falls within the interval, the address is confirmed as valid, and the process proceeds to the next calculation stage.
[0049] Specifically, once the virtual address verification passes, the AMMU extracts the starting address of the target virtual address range from the target range table. This starting address serves as the reference for calculating the offset between the virtual address and the physical address. Because there is a one-to-one mapping between the virtual address range and the physical base address in the target range table, the offset of the virtual address within the range directly corresponds to the offset of the physical address starting from the physical base address.
[0050] First, the starting address of the target virtual address range is subtracted from the virtual address in the device access request to obtain the offset of that virtual address within the current virtual address range. For example, if the virtual address is 0x20000008 and the starting address is 0x20000000, the offset is 0x8. Then, the offset is added to the target physical base address stored in the target range table, for example, 0x90000000. The final result is the target physical address accessible to the device: 0x90000000 + 0x8 = 0x90000008. The entire calculation process is based entirely on preset information in the target range table and can be completed through simple subtraction and addition operations. Unlike traditional SMMUs, it does not require multi-level page table traversal or software driver intervention to handle page faults. This simplifies hardware logic, reduces resource overhead, and ensures low latency and high reliability in address translation, fully adapting to the needs of embedded and resource-constrained scenarios.
[0051] Optionally, the method also includes: triggering an address matching error message and terminating device access when the virtual address does not fall within the target virtual address range of the target range table.
[0052] Specifically, when the verification finds that the virtual address does not fall within the target virtual address range, it indicates that the device is attempting to access a memory region beyond its preset permissions. In this case, the AMMU will immediately trigger an address matching exception message. It should be noted that the exception message is a hardware-level signal feedback, which does not rely on the operating system or driver software intervention. Unlike traditional SMMUs, which need to trigger a software interrupt and wait for driver configuration when encountering page faults or other exceptions, the AMMU's exception message is directly generated by the hardware logic and can be quickly fed back to the system control module or relevant monitoring units to promptly locate illegal access behavior.
[0053] Furthermore, upon triggering the exception message, AMMU will simultaneously terminate the current device access process: on the one hand, it will refuse to continue executing subsequent physical address calculation steps; on the other hand, it will block the access connection between the device and memory, prohibiting the device from initiating any data read / write operations based on the illegal virtual address, thus completely cutting off the path of unauthorized access at the hardware level and avoiding security risks such as memory data leakage and system instability damage caused by illegal device access.
[0054] Optionally, establishing device access based on the target physical address includes: extracting data transmission requirements from the device access request; and, according to the data transmission requirements, controlling the establishment of a data path between the device and the target physical address, and executing data transmission.
[0055] Specifically, the access request initiated by the device, in addition to information used for address translation such as ASID and virtual address, also contains explicit data transmission related configurations, i.e., data transmission requirements. These include the data transmission direction, such as whether the device is writing data to or reading data from memory; the data transmission length, such as the specific number of bytes to be transmitted (1KB, 4KB, etc.); the data transmission priority; and whether data verification is enabled. The AMMU will directly parse the signal or register configuration of the device access request through the hardware interface to extract the data transmission requirements.
[0056] Furthermore, after clarifying the target physical address and data transmission requirements, the AMMU plays a hardware control role. First, based on the data transmission direction and target physical address, it controls the system's internal bus resources to establish a dedicated data path between the device and the memory region corresponding to the target physical address. For example, when a device needs to read memory data, a path is established from the target physical address to the device's data receiving interface; when a device needs to write to memory, a path is established from the device's data sending interface to the target physical address. This path is isolated from the access paths of other devices to prevent data transmission conflicts. Second, combined with the data transmission length configuration, a transmission counter is set to control the number of bytes transmitted, preventing out-of-bounds memory writes or reads due to exceeding the preset length. If the transmission request includes a priority configuration, the AMMU coordinates the bus arbitration mechanism to assign the corresponding priority to the current device's transmission request, ensuring that high-priority requests occupy bus resources first. Finally, after the data path is established and all configurations take effect, the AMMU triggers data transmission execution until the preset length of data transmission is completed, or until transmission is terminated due to an exception.
[0057] The technical solution of this invention simplifies the data structure design of address mapping by replacing the traditional multi-level page table with a single-level structure, reduces the complexity of dynamic configuration, and facilitates hardware formal verification. Direct matching via address space identifiers eliminates the steps of resolving device identity identifiers and querying external table entries, reducing the number of external memory accesses. By calculating the target physical address and establishing access, the hardware address translation logic is simplified, reducing hardware implementation costs and power consumption, and improving data transmission efficiency.
[0058] Example 2
[0059] Figure 2This is a flowchart of a device access method based on address space identifiers provided in Embodiment 2 of the present invention. This embodiment adds a permission attribute verification process to the above-described Embodiment 1. The specific content of steps S210-S230 is largely the same as steps S110-S130 in Embodiment 1, therefore, it will not be described again in this embodiment. Figure 2 As shown, the method includes:
[0060] S210. Establish each single-level range table, wherein the single-level range table corresponds to the fixed device context of the simplified device memory management unit, and the single-level range table includes virtual address range and physical base address.
[0061] S220. Obtain a device access request, read the address space identifier and virtual address from the device access request, and match the corresponding target range table from each single-level range table based on the address space identifier.
[0062] Optionally, matching the corresponding target range table from each single-level range table based on the address space identifier includes: when the address space identifier is not 0, matching the corresponding target device context based on the address space identifier to determine the target range table associated with the target device context.
[0063] Optionally, the method also includes: when the address space identifier is 0, directly using the virtual address as the target physical address, and establishing device access based on the target physical address.
[0064] S230. Calculate the target physical address based on the target range table and the virtual address.
[0065] Optionally, the target physical address is calculated based on the target range table and the virtual address, including: when the virtual address falls within the target virtual address range of the target range table, determining the starting address corresponding to the target virtual address range; calculating the difference between the virtual address and the starting address, and adding the difference to the target physical base address in the target range table to obtain the target physical address.
[0066] Optionally, the method also includes: triggering an address matching error message and terminating device access when the virtual address does not fall within the target virtual address range of the target range table.
[0067] S240. Attempt to execute the corresponding read / write operation based on the target physical address.
[0068] It is known that the AMMU does not have configured read / write execution permission rules. After the device completes address mapping, it can directly perform read and write operations on memory. If read / write operations cannot be performed, an exception will be triggered. The hardware will also record the exception type, whether it is a page fault or a range fault, to facilitate subsequent problem localization. After extracting the device's access type, the AMMU will directly execute read / write operations. When the operation cannot be completed, it will determine that the permissions are incompatible based on the actual fault situation. If the operation can be executed normally, it will determine that the permissions are compatible. The entire process abandons the traditional permission attribute preset and verification logic, and uses the actual read / write results as the basis for permission determination.
[0069] S250. When the read / write operation is executed normally, device access is established based on the target physical address; otherwise, a permission error message is triggered, the hardware records the error type as page fault or range fault, and device access is terminated.
[0070] Specifically, when read / write operations are executed normally, it indicates that the device access behavior is within the legal address range and complies with the permission rules. The AMMU will continue to advance the subsequent process, that is, based on the previously calculated target physical address, according to the data transmission requirements in the device access request, controlling the establishment of a data path between the device and the memory region corresponding to the target physical address, and executing data transmission to ensure the smoothness of the access process. However, when read / write operations cannot be executed normally, the AMMU will immediately trigger an exception prompt, and the hardware will record the specific type of the exception, such as page fault or range fault. This exception information can be quickly transmitted to the system control module or monitoring unit, facilitating technicians to accurately locate the cause of the fault. Simultaneously, the AMMU will terminate the current device access process, not only refusing to establish a data path but also blocking any interaction between the device and memory, cutting off the path of illegal access at the hardware level and avoiding memory data security risks caused by operation failures.
[0071] Optionally, establishing device access based on the target physical address includes: extracting data transmission requirements from the device access request; and, according to the data transmission requirements, controlling the establishment of a data path between the device and the target physical address, and executing data transmission.
[0072] The technical solution of this invention attempts to execute corresponding read and write operations based on the target physical address, replacing preset permission verification with the actual operation result. This eliminates the hardware logic for permission attribute configuration and comparison, simplifies the AMMU's permission control process, and reduces hardware implementation complexity. When read and write operations are normal, device access is established, ensuring efficient execution of legitimate device access and maintaining smooth data transmission. When an operation fails, an exception message is triggered, and the hardware records page faults or range fault types, accurately locating the root cause of the fault. Simultaneously, terminating device access can promptly block illegal operations at the hardware level, avoiding memory data security risks.
[0073] Example 3
[0074] Figure 3 This is a schematic diagram of a device access device based on address space identifiers provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a single-level range table establishment module 310, used to establish each single-level range table, wherein the single-level range table corresponds to the fixed device context of the simplified device memory management unit, and the single-level range table includes a virtual address range and a physical base address;
[0075] The target range table matching module 320 is used to obtain device access requests, read address space identifiers and virtual addresses from the device access requests, and match the corresponding target range table from each single-level range table based on the address space identifiers;
[0076] The device access establishment module 330 is used to calculate the target physical address based on the target range table and the virtual address, and to establish device access based on the target physical address.
[0077] Optionally, the target range table matching module 320 specifically includes: a target range table unit, used to: when the address space identifier is not 0, match the corresponding target device context based on the address space identifier to determine the target range table associated with the target device context.
[0078] Optionally, the device further includes a direct access module, used to directly use the virtual address as the target physical address when the address space identifier is 0, and to establish device access based on the target physical address.
[0079] Optionally, the device access establishment module 330 specifically includes: a target physical address calculation unit, used to: determine the starting address corresponding to the target virtual address range when the virtual address falls within the target virtual address range of the target range table; calculate the difference between the virtual address and the starting address, and add the difference to the target physical base address in the target range table to obtain the target physical address.
[0080] Optionally, the device further includes an address matching error message module, used to trigger an address matching error message and terminate device access when the virtual address does not fall within the target virtual address range of the target range table.
[0081] Optionally, the device also includes: a permission attribute verification module, used to: attempt to execute the corresponding read and write operations based on the target physical address; when the read and write operations are executed normally, establish device access based on the target physical address; otherwise, trigger a permission exception prompt, record the exception type as page fault or range fault in the hardware, and terminate device access.
[0082] Optionally, the device access establishment module 330 specifically includes: a device access unit, used to: extract data transmission requirements from the device access request; and, according to the data transmission requirements, control the device to establish a data path between the device and the target physical address, and execute data transmission.
[0083] The technical solution of this invention simplifies the data structure design of address mapping by replacing the traditional multi-level page table with a single-level structure, reduces the complexity of dynamic configuration, and facilitates hardware formal verification. Direct matching via address space identifiers eliminates the steps of resolving device identity identifiers and querying external table entries, reducing the number of external memory accesses. By calculating the target physical address and establishing access, the hardware address translation logic is simplified, reducing hardware implementation costs and power consumption, and improving data transmission efficiency.
[0084] The device access apparatus based on address space identifier provided in the embodiments of the present invention can execute the device access method based on address space identifier provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0085] Example 4
[0086] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0087] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0088] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0089] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a device access method based on address space identification.
[0090] In some embodiments, a device access method based on address space identifiers may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the device access method based on address space identifiers described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a device access method based on address space identifiers by any other suitable means (e.g., by means of firmware).
[0091] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0092] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0093] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0094] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0095] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0096] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0097] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0098] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A device access method based on address space identification, characterized by, The application is applied to a simplified device memory management unit, and comprises: establishing single-level range tables, wherein the single-level range tables correspond to fixed device contexts of the simplified device memory management unit, and the single-level range tables comprise virtual address ranges and physical base addresses; obtaining a device access request, reading an address space identifier and a virtual address from the device access request, and matching a corresponding target range table from the single-level range tables based on the address space identifier; calculating a target physical address according to the target range table and the virtual address, and establishing device access based on the target physical address.
2. The method of claim 1, wherein, The matching of the corresponding target range table from the single-level range tables based on the address space identifier comprises: when the address space identifier is not 0, a corresponding target device context is matched based on the address space identifier to determine a target range table associated with the target device context.
3. The method of claim 2, wherein, The method further comprises: when the address space identifier is 0, the virtual address is directly taken as a target physical address, and device access is established based on the target physical address.
4. The method of claim 1, wherein, The calculation of the target physical address according to the target range table and the virtual address comprises: when the virtual address falls within a target virtual address range of the target range table, a start address corresponding to the target virtual address range is determined; a difference between the virtual address and the start address is calculated, and the difference and a target physical base address in the target range table are added to obtain the target physical address.
5. The method of claim 4, wherein, The method further comprises: when the virtual address does not fall within the target virtual address range of the target range table, an address matching exception prompt is triggered, and device access is terminated.
6. The method of claim 1, wherein, The method further comprises: based on the target physical address, a corresponding read-write operation is attempted to be performed; when the read-write operation is normally performed, device access is established based on the target physical address, otherwise, a permission exception prompt is triggered, a hardware records an exception type as a page fault or a range fault, and device access is terminated.
7. The method according to any one of claims 1 to 6, characterized in that, The establishment of the device access based on the target physical address comprises: data transmission requirements in the device access request are extracted; data transmission paths between the device and the target physical address are controlled according to the data transmission requirements, and data transmission is performed.
8. A device access apparatus based on address space identification, characterized by, The application is applied to a simplified device memory management unit, and comprises: a single-level range table establishing module, configured to establish single-level range tables, wherein the single-level range tables correspond to fixed device contexts of the simplified device memory management unit, and the single-level range tables comprise virtual address ranges and physical base addresses; a target range table matching module, configured to obtain a device access request, read an address space identifier and a virtual address from the device access request, and match a corresponding target range table from the single-level range tables based on the address space identifier; a device access establishing module, configured to calculate a target physical address according to the target range table and the virtual address, and establish device access based on the target physical address.
9. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; The memory stores a computer program capable of being executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method in any one of claims 1-7.
10. A computer storage medium, characterized in that, The computer storage medium stores computer instructions for enabling the processor to implement the method in any one of claims 1-7 when executed.
Citation Information
Cited By
Memory allocation method and system, medium and product
CN121807578A
Memory access method of computing device and related device
CN122045080A
Memory access method of computing device and related device
CN122045080B
