Device permission table defining permission information for translated access requests
By introducing a transposed access control circuit system and a device permission cache memory into the data processing system, the security risk of the device directly issuing physical address access requests is resolved, thereby improving both security and performance.
Patent Information
- Application Number
- CN202280093891.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-03-28
- Filing Date
- 2022-12-20
- Publication Date
- 2024-11-05
AI Technical Summary
In the prior art, the direct issuance of physical address access requests by devices in data processing systems poses a security risk, and although pre-address translation reduces the latency of access requests, it fails to effectively guarantee system security.
A converted access control circuit system is introduced to determine whether the software content is allowed to access the target memory location by looking up the permission information defined in the device permission table, and to trigger an error response when it is determined that access is not allowed. This is combined with the device permission cache to reduce the lookup time.
While providing the advantage of reduced latency through early address translation, it also improves the security of the data processing system, prevents unauthorized access requests, and enhances the system's security and performance.
Smart Images

Figure CN118901062A_ABST
Abstract
Description
[0001] This technology relates to the field of data processing systems.
[0002] Some data processing systems support early address translation, in which a requesting device issues an early address translation request specifying a given virtual address (VA), and the address translation circuitry translates the virtual address into a corresponding physical address (PA), which is then provided back to the requesting device. The requesting device can then issue a translated access request specifying the physical address, which can provide faster service than if only a virtual address was specified, because the address does not need to be translated when issuing the translated access request, as it was previously translated when the early address translation request was sent.
[0003] Based on a first example of the present technology, a device is provided, the device comprising:
[0004] An address translation circuit system configured to translate a given virtual address into a given physical address in response to an advance address translation request issued by a requesting device on behalf of given software content, specifying a given virtual address, and to provide the given physical address to the requesting device for association with subsequent translated access requests issued by the requesting device; and
[0005] Translated access control circuitry system, which responds to a translated access control circuitry system issued by the requesting device on behalf of the given software content and specifying a target physical address.
[0006] The following operations are performed in response to access requests:
[0007] Based on the target physical address, look up the corresponding permission information that indicates the corresponding access permission defined in the device permission table for the physical address space region covering the target physical address, wherein the corresponding access permission provides information for checking whether the translated access request from multiple software contents is prohibited;
[0008] Based on the corresponding permission information, determine whether the given software content is prohibited from accessing the target memory location corresponding to the target physical address in response to a translated access request; and
[0009] An error response is triggered when it is determined that the given software content is prohibited from accessing the target memory location in response to a translated access request.
[0010] In view of another example of this technology, a method is provided, which includes:
[0011] In response to an advance address translation request issued by a requesting device on behalf of given software content, specifying a given virtual address, the given virtual address is translated to a given physical address, and the given physical address is provided to the requesting device for association with subsequent translated access requests issued by the requesting device; and
[0012] In response to a translated access request issued by the requesting device on behalf of the given software content and specifying a target physical address, the translated access control circuitry performs the following steps:
[0013] Based on the target physical address, look up the corresponding permission information that indicates the corresponding access permission defined in the device permission table for the physical address space region covering the target physical address, wherein the corresponding access permission provides information for checking whether the translated access request from multiple software contents is prohibited;
[0014] Based on the corresponding permission information, determine whether the given software content is prohibited from accessing the target memory location corresponding to the target physical address in response to a translated access request; and
[0015] An error response is triggered when it is determined that the given software content is prohibited from accessing the target memory location in response to a translated access request.
[0016] In view of another example of the present technology, a computer-readable medium is provided for storing computer-readable code for manufacturing an apparatus, the apparatus comprising:
[0017] An address translation circuit system configured to translate a given virtual address into a given physical address in response to an advance address translation request issued by a requesting device on behalf of given software content, specifying a given virtual address, and to provide the given physical address to the requesting device for association with subsequent translated access requests issued by the requesting device; and
[0018] Translated access control circuitry system, which responds to a translated access control circuitry system issued by the requesting device on behalf of the given software content and specifying a target physical address.
[0019] The following operations are performed in response to access requests:
[0020] Based on the target physical address, look up the corresponding permission information that indicates the corresponding access permission defined in the device permission table for the physical address space region covering the target physical address, wherein the corresponding access permission provides information for checking whether the translated access request from multiple software contents is prohibited;
[0021] Based on the corresponding permission information, determine whether the given software content is prohibited from accessing the target memory location corresponding to the target physical address in response to a translated access request; and
[0022] An error response is triggered when it is determined that the given software content is prohibited from accessing the target memory location in response to a translated access request.
[0023] Further aspects, features, and advantages of this technology will become apparent from the following exemplary description, which is read in conjunction with the accompanying drawings:
[0024] Figure 1 This illustrates multiple devices that share access to memory;
[0025] Figure 2 Examples of system-on-chip (SoC) and off-chip devices that share access to memory are shown;
[0026] Figure 3 This demonstrates a method for handling advance address translation requests;
[0027] Figure 4 This demonstrates another method for handling advance address translation requests;
[0028] Figure 5 This demonstrates an example method for handling translated access requests;
[0029] Figure 6 This shows an example of an incoming data packet in a protocol such as Peripheral Component Interconnect Express (PCIe);
[0030] Figure 7 This demonstrates another method for handling translated access requests;
[0031] Figure 8 Displays the device configuration table and device permissions table;
[0032] Figure 9 This provides an example set of permission and privilege levels, and the interactions between them;
[0033] Figure 10 Examples are shown illustrating physical addresses and how they can be used to look up entries in the device permissions table; and
[0034] Figure 11 An example is shown that provides device permission tables for various execution states.
[0035] Before discussing specific implementations of the examples with reference to the accompanying drawings, the following description of specific implementations and associated advantages is provided.
[0036] According to an example configuration, an apparatus is provided, comprising: an address translation circuitry configured to translate a given virtual address into a given physical address in response to an advance address translation request issued by a requesting device on behalf of given software content, specifying a given virtual address, and to provide the given physical address to the requesting device for association with a subsequent translated access request issued by the requesting device. The apparatus further comprises: a translated access control circuitry configured to perform the following operations in response to a translated access request issued by the requesting device on behalf of the given software content, specifying a target physical address:
[0037] • Based on the target physical address, look up the corresponding permission information that indicates the corresponding access permission defined in the device permission table for the physical address space region covering the target physical address, wherein the corresponding access permission provides information for checking whether the translated access request from multiple software contents is prohibited;
[0038] • Based on the corresponding permission information, determine whether the given software content is prohibited from accessing the target memory location corresponding to the target physical address in response to a translated access request; and
[0039] • An error response is triggered when it is determined that the given software content is prohibited from accessing the target memory location in response to a translated access request.
[0040] In a data processing system, physical addresses in the physical address space are used to identify locations in memory. Therefore, a device can access data at a given location in memory by issuing an access request that specifies a physical address corresponding to a given memory location. The device can also issue access requests on behalf of software content executing on the data processing system (e.g., a virtual machine, application, or hypervisor). (For example, the device may be a virtualization hardware accelerator or a shared I / O device used by several software contents). However, some devices (or some software contents) may be untrusted and only issue access requests to memory regions they are permitted to access—for example, a malicious actor could cause the device to issue access requests to protected memory, or in fact, such access could be made incorrectly (e.g., if an incorrect physical address is specified for the access request). Therefore, there is a potential security risk when a device is permitted to issue access requests specifying physical addresses.
[0041] To address this issue, one approach is to prevent devices in the data processing system from sending access requests specifying physical addresses, and instead, the devices can issue access requests specifying virtual addresses from the virtual address space. These virtual addresses can then be translated into physical addresses by the address translation circuitry. In some examples, there may even be two address translation stages—a first stage to translate the VA from the virtual address (VA) space into an intermediate address (which is perceived by the virtual machine or operating system as being in the physical address (PA) space, but is actually in an "intermediate PA space" or "guest PA space"), and the address in this address space can be called the intermediate physical address (IPA), and a second stage to translate the intermediate address into a PA in the system's PA space. However, it should be noted that a two-stage translation is optional, and this technique can be used regardless of whether a one-stage or two-stage address translation process is used.
[0042] Virtual addressing allows address mappings that define the translation between virtual and physical addresses to be configured such that certain physical addresses (not mapped to any virtual address for a given software content) are inaccessible by requests made on behalf of that software content. Furthermore, the address translation circuitry can perform checks (e.g., access permission checks) during virtual address translation to determine whether a requesting device is permitted to access a specified memory region. Therefore, by preventing devices from directly accessing memory (e.g., by issuing memory access requests for specified physical addresses), the security of the data processing system can be improved.
[0043] However, the process of translating a physical address into a virtual address and checking access permissions can be time-consuming—for example, it may require performing a page table walkthrough of the page table in memory. Even if a page table walkthrough is not required (e.g., when a request can use mapping information stored in a translation back buffer), the address translation circuitry can be shared among multiple sources of memory access requests (e.g., between multiple devices), and therefore contention for translation bandwidth can delay servicing the address translation for a given access request.
[0044] Therefore, to reduce latency for access requests, some devices may be permitted to issue advance address translation requests specifying a virtual address to be translated that does not actually require memory access at that time. The address translation circuitry translates this virtual address into a physical address, checks for any access permissions (if defined—which is unnecessary), and then (if the device is permitted access to the memory location corresponding to the translated physical address) returns the physical address to the device. The device can then issue a translated access request specifying the translated physical address at a later time (the time when memory access to the location associated with the translated physical address is actually required). In this way, latency associated with access requests issued by the device is reduced. The reduction in latency can be even greater when the device needs to issue several access requests to the same location in memory (e.g., the translated physical address can be cached at the device to allow reuse for later access requests).
[0045] However, the inventors of this technology recognized that allowing a device to issue access requests specifying a physical address still carries risks: the device may issue a translated access request specifying a physical address of a memory location it does not have access rights to. For example, the device may issue an access request specifying a physical address that is not received in response to an earlier address translation request—this could be due to malicious actors or operational errors, for example.
[0046] Therefore, it is advantageous to improve the security of data processing systems while still providing the benefits of early address translation (e.g., reduced latency associated with access requests).
[0047] To address this issue, this technology provides a translated access control circuitry (which may be an enhanced version of an existing access control circuitry—for example, for receiving a translated physical address from an address translation circuitry and performing access in response to an access request for a specified virtual address—or it may be a dedicated circuitry for processing translated access requests) that responds to a translated access request by looking up permission information corresponding to the target physical address specified by the request. The permission information is defined in a device permission table (DPT) and indicates a set of access permissions associated with a region of the physical address space (e.g., the system PA space, in the case of two-stage address translation). For example, the permission information may be the access permissions themselves, and in one example, the translated access control circuitry directly looks up the access permission in the table. The table may be a memory-based table, and therefore a direct lookup in the table may be an access to the memory system (the same memory system used for DPT-controlled access) to access an entry in the DPT. However, in other examples, the lookup of permission information can be performed in some other structure (e.g., cache memory), and the permission information does not need to be in the same access permission format as in the DPT. Based on the permission information, the translated access control circuitry can then determine whether the software content that issued the access request on its behalf is prohibited (e.g., not allowed) from accessing the target memory location corresponding to the target physical address by issuing the translated access request. If the translated access control circuitry determines that the software content is not permitted to access the target memory location identified by the translated access request, an error response is triggered—for example, this could involve rejecting the translated access request, and / or this could involve a different response, such as updating the error log to record that a prohibited access request was generated (but not necessarily preventing the access request itself from proceeding—the error log can then be checked before making a later access to the affected physical address to check whether the data content dependent on the data stored at that physical address is safe). In this way, the security of the system can be improved while still supporting early address translation.
[0048] It should be noted that if given software content is not permitted to access the identified target memory location using a translated access request, this does not necessarily mean that the given software content is also not permitted to access the identified target memory location using a non-translated access request specifying a virtual address. If a memory access request for the identified target memory address specifies a virtual address, it is possible that the location can actually be accessed by the software content, allowing for the security provided by address translation lookups through the address translation circuitry system. The reason for denying access to the target physical address can simply be a problem of distrusting the device to directly specify the physical address, rather than the problem of accessing the target physical address itself. Therefore, DPT can be used to control whether translated access requests (based on the physical address, which should have been translated in response to an earlier address translation request) are permitted for the target physical address.
[0049] If the translation-based access control (DPT) circuitry determines, based on access permission information, that the given software content is not prohibited from accessing the target memory location in response to a translation-based access request, then the request may be allowed to be serviced in memory, or it may be subject to further checks. Therefore, while failure to meet the DPT requirements may result in a request being rejected (and / or trigger other erroneous responses), this does not mean that requests that meet the DPT requirements must be accepted, as there may be other reasons for rejecting the request depending on what other checks are performed on the given system (e.g., checks unrelated to the processing of the address translation / translation-based access request).
[0050] As explained above, access requests (including translated access requests) can be issued on behalf of software content. Software content can be a virtual machine, for example, a virtual simulation of a computer system that may share a physical hardware platform with other virtual machines. Other examples of software content are applications or hypervisors. Devices such as I / O devices or hardware accelerators can be configured to provide functionality on behalf of specific software content. It should be noted that the relationship between software content and devices does not necessarily have to be 1:1 (e.g., a single piece of software content can be associated with more than one device, or multiple pieces of software content can share a single device).
[0051] In this technique, access permissions defined in a DPT provide information that can be used to check whether translated access requests from multiple software contents are permitted. For example, access permissions can be shared among multiple software contents, allowing a single DPT to define access permissions for multiple software contents. This helps reduce the overall memory footprint required for table data compared to alternative approaches that define completely separate table structures for each software content. Furthermore, by enabling the use of a single DPT for multiple software contents, this provides a DPT whose size can be statically determined (e.g., it does not require allocating entirely new tables to memory every time a new software content begins execution). This improves performance. Moreover, providing a single DPT structure that can be shared among multiple software contents improves cacheability in implementations that cache information from the DPT structure, as this means that a single cache entry can be used to verify requests for multiple software contents, rather than requiring separate cache entries for each content.
[0052] In some examples, the converted access control circuitry is configured to support at least one encoding of an entry in the device permissions table that identifies at least one access permission associated with identified software content specified by that entry in the device permissions table from among a plurality of software contents.
[0053] In some situations, it is desirable to define different access permissions for different software content—for example, some software content may be prohibited from accessing a given memory region using translated access requests, while other software content is allowed to access that region using translated access requests. Therefore, the translated access control circuitry system according to this technology also supports the encoding of a device permission table that enables the association of identified software content with a set of device permissions for a given physical address. This allows permissions for a given physical address to be defined based on the software content making the request, which can be useful because it allows for the definition of a richer set of permissions. For example, this could allow certain pages in memory to be accessed only by specific software content via translated access requests, or to be shared between specific software content and one or more other processes (when using translated access requests). Therefore, identifying software content associated with a set of permission information can further improve system security and availability.
[0054] In some examples, the translated access control circuitry is configured to support a device permission table comprising multiple entries indexed by physical addresses, wherein each of the multiple entries identifies access permissions to an associated physical address space region.
[0055] Therefore, unlike the paging table looked up by the address translation circuitry, the device access table in this example is indexed by the physical address, rather than by the virtual address (or by the intermediate address provided by stage 1 of the two-stage address translation).
[0056] In some examples, access permissions include device permission levels selected from a plurality of device permission levels, and at least one permission level includes at least one of the following:
[0057] • A private access level that identifies a given piece of software content among the plurality of software contents and indicates that a translated access request associated with a process other than that given software content is prohibited from accessing the associated physical address space region; and
[0058] • Shared privilege level, which identifies a given software content among the plurality of software contents and indicates that translated access requests associated with processes other than the given software content and supervisory processes operating at a privilege level higher than the plurality of software contents are prohibited from accessing the associated physical address space region.
[0059] In this way, some pages in memory can be made private to a given software content (for the purpose of access via translated access requests), thereby providing greater protection for the process executed by the given software content, or can be shared by the given software content and the supervisory process. It should be understood that in addition to the private and shared permission levels defined above, other permission levels can be defined. Therefore, the device permission table can support a richer set of permissions, rather than simply defining whether to allow or prohibit access to a given address via translated access requests. As mentioned above, whether a given address is specified with a private or shared permission level so that translated access requests can be handled can be separated from whether the given software content will be allowed to access the address using a non-translated access request with a specified virtual address. Permissions for non-translated access requests can be more lenient or stricter than those for translated access requests.
[0060] In some examples, the translated access control circuitry is configured to look up corresponding device configuration information indicating the given software content associated with the device identifier based on the device identifier specified in the translated access request, and the translated access control circuitry is configured to determine whether the given software content is prohibited from accessing the target memory location in response to the translated access request when the corresponding permission information specifies the at least one access permission associated with the identified software content.
[0061] In this way, the association between a device and software content can be variably configured using device configuration information. By extracting the relationship between device and software content identifiers using a device configuration table, and defining permissions in a device permissions table that can be encoded to define software content-specific permissions, this avoids the need to redefine detailed address-specific permissions in the device-specific table every time the software content on the device changes. Instead, the software content can change the software content identifier associated with the device, while the device permissions table remains the same. If the software content is used on a different device, the permissions of that software content in the device permissions table can be easily associated with the new device by updating the relevant software content identifier in the device configuration table indicated for the new device.
[0062] In some examples, the translated access control circuitry is configured to support a device configuration table that includes multiple entries indexed by device identifiers, each entry identifying device configuration information for the associated device. Therefore, unlike a device permission table indexed by physical address, the device configuration table in this example is indexed by device identifier.
[0063] In some examples, the device configuration information in each of the plurality of entries includes privilege information indicating whether the associated device is prohibited from issuing translated access requests. The privilege information includes privilege levels selected from a plurality of privilege levels, including at least one privilege level indicating that the associated device is permitted to issue translated access requests even when the device permission table indicates that access to a subset of the physical address space in response to a translated access request is prohibited for at least one software content associated with the device identifier.
[0064] Therefore, in at least some cases, the device configuration table can also be used to define a second set of permissions for a device on a per-device basis, which may be orthogonal to the permissions defined per-address region in the device permission table. This allows for a richer set of permissions that can be useful to the software. In some examples, the permissions indicated by the device configuration information in the device configuration table may supersede (take precedence over) the permissions indicated by the permission information in the device permission table, thereby allowing certain devices to be designated as, for example, trusted devices with more lenient access permissions indicated in the device permission table, or untrusted devices with more stringent access permissions than those indicated in the device permission table. Other encodings in the device configuration table may indicate that the permissions (for a particular memory region) indicated in the device permission table should be followed.
[0065] In some examples, the device includes a device permission cache configured to store permission information corresponding to a subset of access permissions defined in the device permission table, wherein the translated access control circuitry, in response to the translated access request, looks up the corresponding permission information in the device permission cache based on the target physical address of the translated access request.
[0066] Performing a lookup in a cached memory takes significantly less time than looking up a device permissions table in memory—this cached memory can be implemented as a hardware structure associated with a translated access control circuitry system and stores only a subset of permissions information, meaning fewer entries to consider. Therefore, providing a device permissions cache that stores permissions information about a subset of access permissions allows for reduced latency associated with access requests issued by the device, which can lead to performance improvements. It should be understood that the device permissions cache can also cache other information, such as information from a security table indicating additional access permissions depending on the security state.
[0067] In some examples, the translated access control circuitry system, in response to the advance address translation request, determines the corresponding permission information about the physical address space region covering the target physical location and stores the corresponding permission information in the device permission cache.
[0068] In some examples, the address translation circuitry is configured to look up a set of translation table permissions defined in the address translation table entries corresponding to the given virtual address and the given software content in response to the advance address translation request; and the translated access control circuitry is configured to determine the corresponding permission information based on the translation table permissions and store the corresponding permission information in the device permission cache.
[0069] For example, the address translation table can be a paging table in memory that defines virtual-to-physical address translations and associated access permissions, and lookups can be performed in memory or in a cache (e.g., a translation lookaside buffer, TLB) that stores a subset of the translations defined in the paging table. The paging table may already specify some access permission information (e.g., whether read access, write access, or instruction fetching to the corresponding paging table is permitted), and this information can be used to set the cached permission information in the device permissions cache. Because the address translation circuitry already looks up the address translations defined in the translation table (to translate a given virtual address to a given physical address), using the access permissions defined in the translation table avoids the need to look up access permissions defined in the DPT that might require additional memory access. This provides further performance improvements.
[0070] In some examples, the translated access control circuitry system, in response to determining, based on the translation table permissions, that at least one of the corresponding access permissions for the given physical address is unknown from the translation table permissions, sets a default access permission as the corresponding permission information to be stored in the device permission cache.
[0071] In some cases—for example, where access permission identifiers are device permission levels as discussed above (e.g., private or shared permissions)—at least one of the access permissions for a given physical address may be unknown from the translation table permissions. For example, translation table permissions may indicate access permissions for a given software content rather than other software content. In such cases, the translated access control circuitry may be configured to set the corresponding permission information in the DPT cache to the default access permission when the cache is pre-filled in response to an advance address translation request. For example, the default access permission may be the most restrictive access permission that still allows the given software content to access data stored at the memory location corresponding to the target physical address (e.g., in some examples, the default may be the “private” permission level discussed above). This allows for improved latency for at least some translated access requests covering the region of the target physical address (e.g., those translated access requests sent on behalf of the given software content) without compromising system security (e.g., through pessimistic prediction).
[0072] In an alternative implementation, the translated access control circuitry can be configured to look up the device permissions cache in response to an advance address translation request, and the access circuitry can be configured to look up a given access permission in the device permissions table in response to a miss detected in the DPT cache device permissions table. This method may introduce higher latency compared to pre-filling the cache with permissions defined in the translation table (due to the potential need for additional memory access), but it improves the latency associated with translated access requests. Specifically, by pre-looking up the device permissions cache in response to an advance address translation request (even if the permissions in the advance address translation request are not required before receiving a subsequent translated access request), any misses in the device permissions cache can be detected earlier, and the device permissions cache line-filling operation for storing the required permissions in the device permissions cache can be initiated earlier, reducing the probability of a miss when receiving a translated access request.
[0073] In some examples, the device permission table access circuitry is configured to perform a further lookup of the device permission table if, after the DPT cache has been pre-filled in response to an address translation request, no corresponding permission information is detected in the device permission cache during a lookup of the device permission cache performed in response to a translated access request. In these examples, the further lookup is based on the target physical address specified by the translated access request, and the further lookup includes identifying the corresponding access permission in the device permission table. The device permission table access circuitry is configured to store the corresponding permission information identified during the further lookup of the device permission cache.
[0074] Therefore, in one implementation, after a miss is detected when executing a translated access request, the permission information for that specific translated access request can be introduced into the device permission cache. This reduces the latency of subsequent translated accesses to the same region of the physical address space, thus improving performance.
[0075] In other examples, the translated access control circuitry is configured to reject a translated access request if, during a lookup for device permission access in response to the request, no corresponding permission information is found in the device permission cache. Furthermore, in some examples, this behavior can be enabled or disabled on a per-device basis (e.g., indicating for a given device that "this device should never directly access the physical address space").
[0076] Therefore, in an alternative implementation, if a lookup of the device permissions cache (performed during a translated access request) results in a miss, the translated access request is simply rejected. This method is relatively intuitive because, since any subsequent translated access to the same region of the physical address space will also miss, it might be assumed that this method will lead to an overall increase in latency. However, the inventors recognize that a lookup of the device permissions cache should only miss a small subset of permitted translated access requests, because for translated access requests valid based on a physical address returned by an earlier address translation request, the corresponding permissions information should already be stored in the cache when the earlier address translation request was served as described above. Furthermore, the inventors recognize that the time spent looking up the device permissions table cannot be significantly greater than, for example, the time spent re-issuing the translated access request as a non-translated access request for a specified virtual address and performing address translation for the virtual address using an address translation circuitry system. Therefore, in practice, the impact on latency associated with granted translated access requests will be minimal, and it is more efficient to simply reject translated access requests that miss in the device authority cache (in fact, many such translated access requests that miss in the device authority cache can be denied access in any case).
[0077] In some examples, the device includes a device permission table lookup circuitry configured to look up a multilevel table representing a device permission table, wherein each level of the multilevel table includes entries associated with a consecutive small region of the physical address space, the last level of the multilevel paging table defines the access permission, and each level other than the last level defines pointers to multiple tables in the next level, which can be selected based on a portion of the physical address.
[0078] By supporting multi-level device permission tables, this technology avoids the need for a contiguous address space range with a reserved size large enough to store the entire table covering the entire address range.
[0079] In some examples, the upper limit of several levels of the multi-level table supported by the device's permission table walkthrough circuitry is less than the upper limit of several levels of the paging table supported by the paging table walkthrough circuitry.
[0080] Therefore, a device permission table (even when implemented as a multi-level table) can be flatter than a multi-level paging table (e.g., with fewer levels). This means that access permissions defined in the table can be looked up much faster than any access permissions that could be defined in the paging table, resulting in reduced latency and thus improved performance. In practice, the granularity of specifying permissions for a device permission table may not be as fine as that used for an address translation table (e.g., since address mapping may require finer granularity than device permissions), so providing a larger number of paging table levels than the device permission table levels provides an improved balance between efficiency and functionality.
[0081] In some examples, the device permission table walkthrough circuitry is configured to support at least one encoding of entries at at least one level other than the last level, indicating access permissions applied to the entire physical address space block covered by the entry at the at least one level other than the last level.
[0082] In this way, if access permissions are the same for all given physical address blocks covered by higher-level table entries, then access permissions can be defined in a single entry in the higher-level table corresponding to the entire address block. This means that there is no need to suffer the latency associated with performing table walkthroughs up to the last level.
[0083] In some examples, the device includes: a device permission cache configured to store permission information corresponding to a subset of access permissions defined in the device permission table, and the translated access control circuitry configured to support at least one encoding of entries in the device permission table indicating that access permissions to each of a plurality of physical address space regions are identical and can be represented by a single entry in the device permission cache corresponding to a predetermined region among the plurality of regions.
[0084] For example, at least some entries in the DPT may maintain a contiguous indicator (e.g., it may be a single-bit indicator, or a multi-bit indicator if multiple sizes of contiguous regions are supported) that indicates that the access permissions defined in that entry also apply to at least one other entry in the table (e.g., it may be an adjacent entry in the table). This implies that a single entry in the device permissions cache can be used to indicate access permissions to a physical address space region covered by multiple entries in the DPT (e.g., if multiple entries are used for contiguous regions in memory, this implies that an entry in the device permissions cache can indicate permission information for a larger region of memory). This improves the cacheability of permission information—and thus leads to a further reduction in latency—because it allows permission information for a larger portion of the address space to be stored simultaneously in the device permissions cache without increasing the size of the cache.
[0085] In some examples, the translated access request is associated with a security state selected from a plurality of possible security states, and the lookup of the corresponding permission information is based on the security state and the target physical address.
[0086] For example, software content may operate in either a secure state (which may be alternatively referred to as a "trusted" or "confidential" state) or a less secure state (sometimes referred to as a "non-secure" state), or more than two defined possible states may exist, and different physical address space regions may be assigned for access to a specific security state. For instance, software content operating in one security state may be permitted to access more or different physical address space regions compared to software content operating in one security state (e.g., software content operating in a less secure state may be prohibited from accessing certain regions of the physical address space associated with the secure state). Therefore, it may be useful to further define access permissions based on the security state in which the software content operates, and to look up permission information based on the security state associated with the translated access request. This provides an additional layer of security.
[0087] In some examples, the converted access control circuitry is configured to support multiple device permission tables, each corresponding to a different security state.
[0088] One way to specify access permissions that depend on the security state and physical address is to support separate tables for each security state. This approach simplifies the lookup of permission information because the DPT for each security state does not need to cover the entire physical address space (for example, if a specific area of the physical address space is always prohibited for a given security state, it may not be necessary to define access permissions for that area in the DPT for that security state).
[0089] In some examples, the translated access control circuitry is configured to support sharing among multiple devices as a device permission table that defines access rights for translated access issued by the multiple devices.
[0090] For example, a single DPT can be used to define access permissions for multiple devices. This reduces the memory footprint of the DPT.
[0091] In some examples, the device includes: a device permission cache configured to store permission information corresponding to a subset of access permissions defined in the device permission table; and a device permission cache control circuitry configured to invalidate entries in the device permission cache in response to a device permission cache maintenance command triggered by software executed on the processing circuitry and having a different encoding than a translational backstop invalidation command used to trigger invalidation of paging table information from the translational backstop.
[0092] For example, a dedicated command can be defined to invalidate entries in the device permissions cache, which differs from any invalidation command used to invalidate entries in the translation look-aside buffer (TLB). Such a device permissions cache invalidation command can be used to invalidate obsolete entries in the device permissions cache, for example, because the corresponding access permissions in the DPT have been updated. This can help improve security. In some examples, the device permissions cache invalidation command can specify at least one filter condition for selecting which device permissions cache entries to invalidate. For example, the device permissions cache invalidation command can specify an address range or a specific address for which it invalidates device permissions cache entries (which can be specified using virtual addresses and therefore require translation, but in other examples, it may be simpler to only support physically addressed device permissions cache invalidation commands). The filter condition can also be based on a software content identifier (e.g., a virtual machine identifier (VMID)). In other examples, the device permissions cache invalidation command can simply be a global command that triggers all entries in the device permissions cache to be invalidated.
[0093] The concepts described herein may be embodied in computer-readable code used to manufacture devices embodying the described concepts. For example, the computer-readable code may be used in one or more stages of a semiconductor design and manufacturing process, including an electronic design automation (EDA) stage, to manufacture integrated circuits, which include devices for implementing the concepts. The aforementioned computer-readable code may additionally or alternatively facilitate the definition, modeling, simulation, verification, and / or testing of devices for implementing the concepts described herein.
[0094] For example, computer-readable code used to manufacture a device that implements the concepts described herein can define a code implementation in a hardware description language (HDL) representing that concept. For instance, the code can define a register-transfer-level (RTL) abstraction concept for defining one or more logic circuits of the device that implements the concept. The code can define an HDL representing one or more logic circuits that implements the device in Verilog, System Verilog, Chisel, or VHDL (Very High Speed Integrated Circuit Hardware Description Language), as well as intermediate representations such as FIRRTL. The computer-readable code can provide a definition of the implementation concept using a system-level modeling language, such as System C and System Verilog, or other behavioral representations of the concept that can be interpreted by a computer to facilitate the simulation, functional, and / or formal verification and testing of the concept.
[0095] Alternatively or alternatively, computer-readable code may implement a computer-readable representation of one or more connection tables. One or more connection tables may be generated by applying one or more logic synthesis procedures to the RTL representation. Alternatively or additionally, one or more logic synthesis procedures may generate a bitstream from the computer-readable code, which is loaded into a field-programmable gate array (FPGA) to configure the FPGA to implement the described concept. The FPGA may be deployed for the purpose of verifying and testing concepts prior to manufacturing in integrated circuits, or the FPGA may be deployed directly in a product.
[0096] Computer-readable code may include a mixture of code representations used for manufacturing equipment, such as one or more of RTL representations, connection list representations, or other computer-readable definitions used in semiconductor design and manufacturing processes to manufacture equipment implementing the present invention. Alternatively or additionally, the concept may define a combination of computer-readable definitions used in semiconductor design and manufacturing processes to manufacture equipment and computer-readable code definition instructions executed once the defined equipment is manufactured.
[0097] Such computer-readable code can be contained in any known transient computer-readable medium (such as wired or wireless transmission code on a network) or non-transitory computer-readable medium (such as semiconductors, disks, or optical discs). Integrated circuits made using computer-readable code may include one or more components such as a central processing unit, a graphics processing unit, a neural processing unit, a digital signal processor, or other components that individually or collectively implement the concept.
[0098] Specific implementation schemes will now be described with reference to the accompanying drawings.
[0099] Figure 1This illustration shows an example of a data processing system 100 including multiple devices 105 having access rights to shared memory 110. Each device 105 is configured to operate under the control of one or more software contents 125—for example, each device may be associated with a single software content (e.g., device 105c and software content 125c), or with more than one software content (e.g., device 105a and software contents 125a and 125b). Furthermore, a single software content 125 may also be associated with more than one device 105 (e.g., software content 125d is associated with two devices 105d and 105e). Each software content may be, for example, a virtual machine (VM), a hypervisor, or an application. Although Figure 1 Device 105 is shown as an off-chip device separate from SoC 115, but the techniques shown below can also be used for on-chip devices on the same integrated circuit as other components of SoC 115.
[0100] The data processing system 100 also includes a system-on-a-chip (SoC) 115 coupled to memory 110 and coupled via interconnect 120 to each of the devices 105. SoC 115 includes an address translation circuitry 116 configured to translate virtual addresses (VAs) into physical addresses (PAs) that directly identify locations within memory 110. For example, device 105 may, under the control of software content 125, issue an access request to access data in memory 110, and the access request may specify a virtual address from a virtual address space that needs to be translated into a physical address to perform memory access. Some devices in the device are also configured to issue an advance address translation request specifying a virtual address to be translated into a physical address by the address translation circuitry, which is then returned to the device (without actually requesting memory access to the memory system address associated with the physical address at the time of the advance address translation request). The device may then issue a translated access request specifying the translated physical address.
[0101] Therefore, SoC 115 also includes an access control circuitry 117 that controls access to memory 110. Specifically, access control circuitry 117 receives physical addresses from address translation circuitry 116 (e.g., after a VA translation specified in an access request) and from device 105 (e.g., with a translated access request), and performs access to data stored at the corresponding location in memory 110. Thus, access control circuitry 117 acts both as an access control circuitry for controlling access to memory in response to normal (e.g., untranslated) access requests and as a translated access control circuitry for controlling access to memory in response to translated access requests. However, it should be noted that in some implementations, separate access control circuitry and translated access control circuitry may be provided.
[0102] As described above, address translation circuitry 116 supports advance address translation requests. Providing support for advance address translation requests can be advantageous because it allows subsequent translated access requests issued by device 105 to specify a physical address. This means that translated access requests can be served faster (e.g., with reduced latency) than normal access requests (e.g., access requests specifying a virtual address) because the process of translating the virtual address into a physical address has already been performed. In some examples, a given process performed on one of device 105 may require multiple accesses to a specific memory location. Serving advance address translation requests to provide a physical address corresponding to that specific memory address means that device 105 only suffers one latency associated with address translation when it can subsequently issue multiple translated access requests specifying physical addresses. This provides a further reduction in latency (and a reduction in translation bandwidth pressure at address translation circuitry 116 compared to performing new translations for each access to the same address). However, even for addresses accessed only once by device 105, advance address translation can still be used to remove address translation delays from critical timing paths when memory access is actually needed.
[0103] Much of the latency associated with address translation is generally due to the need to check the address mapping and access rights to the access request or advance address translation request received by the address translation circuitry 116. This can cause delays when the address translation circuitry 116 is sharing sufficient translation bandwidth among multiple requesters, and long delays are likely to occur when the required entry is not yet cached at the address translation circuitry 116, and when the relevant translation table entry providing the address mapping and access rights is obtained from the access memory 110.
[0104] For access permission checks, address translation circuitry 116 can check whether the requesting device 105 (e.g., the requesting device) and / or the software content 125 operating on device 105 is permitted to access the identified location in memory. Therefore, in response to an advance address translation request, the physical address can be returned to the device after any required access permission checks have been passed.
[0105] However, in practice, device 105 may issue a translated access request specifying a physical address that is not received from address translation circuitry 116 in response to an advance address translation request. For example, a malicious actor could insert a translated access request specifying a physical address that device 105 is not permitted to access into program code executed by one of the devices 105. In another example, device 105 might incorrectly specify a protected physical address. Either situation could result in device 105 accessing data in memory 110 that it is not permitted to access. This poses a potential security risk unless address translation is performed again at access control circuitry 117 (via additional access permission checks) upon receiving the translated access request. However, it is foreseeable that re-performing address translation and access permission checks when issuing a translated access request may negate the performance improvements otherwise associated with early address translation; it may be argued that issuing a translated access request is pointless if it would be subject to the same access permission checks and therefore the same associated latency as an untranslated access request (e.g., an access request specifying a virtual address).
[0106] However, the inventors of this technology have proposed an alternative method that improves the security of systems employing early address translation without significantly increasing the latency associated with access requests.
[0107] Figure 2A specific example of a SoC 115 communicating with device 105 and connected to memory 110 is shown. Although memory 110 is shown as an off-chip device separate from SoC 115 in the figure, it should be understood that memory 110 may also include on-chip memory on the same integrated circuit as SoC 115. In this example, SoC 115 includes a root port 205 configured to forward messages received from device 105 to components within SoC 115 and to forward messages from within SoC 115 to device 105. SoC 115 also includes a central processing unit (CPU) 240, which includes a memory management unit (MMU) for translating VA to PA for access requests issued by the processing circuitry on the CPU. The SoC also includes a direct memory access (DMA) agent 245 (an example of an on-chip device) and a system memory management unit (SMMU) 242, which may also be referred to as an input / output memory management unit (IOMMU) or translation agent (TA), receiving requests from the DMA agent 245 and root port 205 and translating the VA specified in the request to a PA. The SMMU 242 includes the previously described address translation circuitry 116, which performs address translation and also checks various access permissions—for example, these access permissions (and the address mappings used for translation) may be defined in a page table stored in memory 110. The address translation circuitry 116 may have a translation lookup buffer (TLB) for caching page table entries for faster access than in memory 110.
[0108] The previously mentioned access control circuitry 117 may be provided within the SMMU 242 for generating access requests to be sent to the memory system based on the translation performed by the address translation circuitry 116. The access control circuitry 117 may also be implemented as distributed circuit logic, including not only a portion of the SMMU 242 but also a portion of the (translated) access control circuitry 117 in the root port 205. It may be useful to provide a portion of the translated access control circuitry 117 in the root port 205 so that translated access requests (which do not require address translation because they already specify a physical address) can be sent to memory without passing through the SMMU 242, saving bandwidth at the SMMU 242 for requests requiring translation. Alternatively, a portion of the access control circuitry 117 for serving non-translated requests translated by the address translation circuitry 116 may be provided within the SMMU 242 itself.
[0109] An interconnect 215 is also provided, which includes a memory controller for controlling access to memory in response to an access request for a specified PA. For example, the access request may include an access request forwarded to the interconnect 215 by the address translation circuitry 116 after the VA has been translated to PA, and / or a translated access request from the device 105 forwarded by the root port 205, and a memory access request made by the CPU 240 based on the CPU's MMU address translation.
[0110] For device memory access, if all permission checks pass (e.g., if device 105 and / or software content 125 are granted access to memory addresses based on paging table permissions), the access request continues to be passed to the interconnect / memory controller 215, and the memory controller accesses the relevant location in memory 110 and then provides a response to root port 205 for forwarding to device 105.
[0111] SoC 115 also includes a device access cache 230, which in this particular example is associated with root port 205. However, in other examples, cache 230 may be associated with multiple different root ports 205 (where more than one root port 205 is provided), or alternatively with SMMU 242. The device access cache is controlled by device access cache control circuitry 225, which, in response to a translated access request received by root port 205, searches the device access cache 230 based on the translated physical address specified in the request. If a hit is found in the device access cache 230, access information in the identified entry is checked, and the translated access request is denied or allowed based on the set of access permissions indicated by the access information. If the access permissions indicate that the translated access request is permitted, the translated access request is passed to memory controller 215 for servicing. Therefore, the security of a translated access request can be improved by performing an additional lookup of access information upon receipt.
[0112] The access permission information stored in the device permission cache 225 is a subset of the set of access permissions defined in the device permission table (DPT) 220 in memory 110. Therefore, if a lookup in the device permission cache (also referred to herein as the DPT cache) 230 fails, a lookup in the DPT can be performed to find the required access permission. Unlike any access permission defined in a paging table referenced by the address translation circuitry system 116, access permissions defined in the DPT (and their corresponding access permission information in the DPT cache) are indexed by physical addresses, allowing them to be looked up based on the PA specified by the translation access request.
[0113] Providing a DPT cache memory 230 in addition to the DPT in memory helps reduce the latency associated with translated access requests because, in general, cache lookups take much less time than lookups of structures in memory. This allows for the additional security provided by checking the access rights to these translated access requests without significantly increasing the latency associated with them.
[0114] Furthermore, in some implementations, the DPT cache may be pre-populated with permission information when an advance address translation request is executed. For example, access permissions defined in a paging table in memory (which have been looked up during address translation) may be used to populate the cache. Alternatively, the lookup of permission information may be performed in the DPT when the advance address translation request is processed. For example, this may involve performing a lookup in the DPT cache to see if the corresponding permission information for the translated physical address is already defined in the cache, and if the permission does not exist, line stuffing is performed. In any implementation, because the corresponding permission information is stored in the cache when the advance address translation request is served, a lookup of DPT access 230 when a translation access request is received from device 105 is unlikely to miss, unless the physical address was not provided to device 105 in a previous advance address translation request, or the permission for that address has been evicted from the device permission cache 230 due to a capacity conflict by the time the translation access request is received (the size of the device permission cache 230 may be selected to minimize the likelihood of such capacity conflicts). Therefore, in any specific implementation, the authorization information for the translated access request is pre-loaded into the DPT cache 225 during the early address translation process. This means that if the translated access request specifies a physical address obtained in response to an early address translation request (which is only possible for authorized translated access requests), a lookup in the DPT cache 230 upon receiving the translated access request should generally be successful, and thus the latency associated with checking the authorization information will be minimized for authorized translated access requests.
[0115] Furthermore, in this example, upon receiving a translated access request, device configuration information defined in the device configuration table (DCT) 250 is also looked up. The DCT identifies the correspondence between software content 125 and device 105. The DCT 250 can also specify additional permissions to be applied per device to the translated access request (which provides an additional layer of protection on top of the per-region permissions defined in the DPT 220, which uses physical address indexing). The DPT 220 and DCT 250 will be described in more detail below.
[0116] Although not in Figure 2 As explicitly shown, device configuration information can also be looked up when responding to an early address translation request, and entries in DCT 250 can be cached in device permission cache memory 230 or in a separate cache memory for device configuration information from DCT 250.
[0117] The format of information cached in the device access cache 230 does not need to be exactly the same as the corresponding information in the DCT 250 or DPT 220 on which the cached information is based. For example, information from DCT 250 and DPT 220 can be combined in different formats, or the information can be stored in the cache 230 in a compressed form or in an expanded form that also includes other information.
[0118] As described above, when the address translation circuit system 116 receives a virtual address (specified by an access request or an early address translation request), it can check the set of access permissions defined in the paging table in memory 110 (which also defines the translation between virtual and physical addresses).
[0119] The information in DCT 250 and DPT 220 can be controlled by software executing on CPU 240. Access control permissions governing which software is allowed to update entries in DCT 250 or DPT 220 can be set in the paging table used by the CPU 240's MMU, such that the paging table for a given software procedure defines whether that software procedure can access the addresses of DCT 250 and DPT 220. CPU 240 may support device-level cache maintenance commands, which can be used by software to trigger invalidation of DPT (and DCT) information cached in device-level cache 230. This invalidation can be issued by software whenever it changes any information specified in DCT 250 or DPT 220. Device-authorized cache maintenance commands can be simply global cache invalidation commands that trigger invalidation of all entries in device-authorized cache 230, or they can be finer-grained invalidation commands that trigger invalidation of entries that meet certain filtering criteria (e.g., DPT / DCT entries corresponding to caches with specified software content identifiers, or DPT entries corresponding to caches with specific physical addresses or ranges of physical addresses). The filtering criteria can be specified by the device-authorized cache maintenance commands. Device-authorized cache maintenance commands can be instructions supported in the instruction set architecture of CPU 240, or they can be memory-mapped commands triggered by software by issuing read or write memory access requests that specify an address mapped to represent a command addressing to SMMU 242 or DPT processing components 235, 230, 225. The command type can be represented by a specific address specified by the memory-mapped command, or, for write requests, by write data provided as a payload of a memory transaction. Therefore, there are various ways in which the CPU 240 can (in response to software) signal to invalidate entries in the device permission cache 230, but generally, supporting such a mechanism can be useful so that obsolete information can be invalidated when DCT 250 or DPT 220 is updated in memory 110.
[0120] Figure 3 This illustrates an example of how an advance address translation request issued by device 105 can be processed by the address translation circuitry and other components of the SoC.
[0121] like Figure 3As shown, the device issues an advance address translation request (305) on behalf of software content operating on the device. This advance address translation request specifies the virtual address (VA) to be translated to a physical address (PA) and is received at the root port, which forwards the advance address translation request (310) to the address translation circuitry (e.g., SMMU). The address translation circuitry then looks up the VA in memory (or in the set of page tables in the Translation Lookahead Buffer (TLB)) and checks (315) the access permissions to the virtual address defined in the page tables. If, based on these access permissions, it is determined (320) that the advance address translation request is not permitted (“No”), the request is rejected (325) and the VA-to-PA translation is not provided to the device. On the other hand, if it is determined (320) that the advance address translation request is permitted (“Yes”), the address translation circuitry translates the VA to the PA (the TLB or the corresponding page table entry for the VA also specifies the corresponding PA) and sends the PA (330) back to the root port for forwarding (335) to the device. The PA can then be specified in a subsequent translation access request (340) issued by the device.
[0122] As described above, in this example, the access permissions looked up by the address translation circuitry differ from those defined in the DPT, specifically because they are defined in the paging table used for virtual address-based lookups. The DPT defines an additional set of permissions that defines whether specific software content is allowed to access a specific physically addressed region using a translated access request for a specified physical address. Permissions in the DPT can be more lenient or stricter than those defined in the paging table—for example, the DPT can deny access that could have been accessed using a non-translated access request (using a translated access request) when using a virtual address-based paging table for lookups.
[0123] Figure 4 This shows another example of how an advance address translation request issued by device 105 can be processed by the address translation circuitry and other components of the SoC. Figure 4 The methods shown may include Figure 3 All steps in the process, but also include pre-filling the DPT cache based on access permissions defined in the paging table.
[0124] exist Figure 4 In the method shown, when it is determined that the device has issued an advance address translation request on behalf of the software content (“Yes”), the address translation circuitry looks up the VA specified in the request in the TLB or paging table, and checks the access rights to the VA defined in the paging table (410). If the address translation circuitry determines that the request is granted (“Yes”), the PA obtained by translating the VA is provided to the device (425).
[0125] In this example, in response to a successful (PA returned to the device) pre-translation request, the translated access control circuitry 117 also sets 430 permission information about the physical address in the DPT cache. For example, the permission information may be set based on access permissions defined in the paging table that have been looked up during address translation. These permissions are generally defined for specific software content (e.g., separate paging tables may be provided for different software content, as each software content may be associated with a different virtual address space). Therefore, the access permissions for the translated VA defined in the paging table will indicate whether the requesting software content is permitted to access the memory location (and may indicate specific types of requests that are permitted, such as reads and / or writes), rather than any other software content being permitted to access the memory location. Therefore, when pre-filling the cache based on the paging table, it may be appropriate to set permissions associated with other software content to the default permission level. In a specific example, if the paging table indicates that the requested software content is granted read / write access to a memory region covering the PA, the permission information in the corresponding DPT cache entry can be set to indicate that the memory region is "private" to the software content regarding read / write access rights (e.g., to indicate that read / write access from that software content is permitted, but read / write requests on behalf of other content are not prohibited).
[0126] In an alternative implementation, instead of setting permission information based on access permissions defined in a paging table, the address translation circuitry can look up permission information in the DPT cache. If a hit is determined in the DPT cache, no further action is taken. On the other hand, if a hit is determined not to be in the DPT cache (e.g., a miss exists), the DPT access circuitry 235 accesses the desired device access permission in the DPT, and the DPT cache control circuitry 225 updates the DPT cache to assign the acquired device access permission to the DPT cache 230. This is another way to warm up the DPT cache 230 to prepare it for subsequent translated access requests that may specify the same physical address. This particular method allows the complete set of access permissions to the PA defined in the DPT to be copied to the DPT cache, but may introduce greater latency than the method using paging table permissions because it may require additional memory access to read the DPT.
[0127] Returning to step 415, if the address translation circuitry determines that the software content is not permitted to access the memory location identified by PA (“No”), then the request is rejected at 420. At this point, as shown by the dashed line, a lookup of the DPT cache memory can still be performed at 430; however, in some implementations, this can be considered an unnecessary additional step, given that the corresponding PA is not permitted to be accessed by the device.
[0128] Figure 5 Show the method for handling the transformed access request. Figure 5 In this method, the device issues a translated access request 505 specifying a PA. This translated access request is sent by the device on behalf of the software content, and while the translated access request is generally legitimate (it is translated earlier than an address translation request), it may be malicious (e.g., the device may specify a PA that the software content is not allowed to access). The translated access control circuitry 117 then searches for the physical address 510 in the device permissions cache 230 in response to the translated access request. If the translated access control circuitry 117 detects a hit 515 on the physical address in the device permissions cache, it accesses the identified entry in the DPT cache and determines 520 whether the translated access request issued by the requesting software content is allowed to access the memory location corresponding to the specified physical address based on the permission information defined in the identified entry. If such access is not allowed (“No”), the access is denied 525. On the other hand, if it is determined that such access 520 is permitted (“Yes”), the access control circuitry 117 issues a memory request requesting access to the data at the memory location identified by 530 and sends a response to the device.
[0129] Returning to step 515, if no hit is detected in the DPT cache ("No"), for example, if a miss is detected, the DPT walkthrough circuitry can look up the access rights for pair PA in the DPT table. Then, the DPT cache is updated to store the required access rights, and the method continues to step 520.
[0130] However, in an alternative implementation (as shown by the dashed line), the lookup 535 for the DPT and the update 540 for the DPT cache can be omitted, and the transposed access control circuitry can instead simply reject 525 any transposed access request that is not detected in the DPT cache (in response to this rejection, the device can issue an additional access request specifying VA instead of PA). As explained above, due to... Figure 4The early cache line filling for the early address translation request shown at steps 440 and 445 is relatively rare. In some cases, the lookup of the DPT cache will miss when the translated access request is permitted, and therefore, in some situations, the circuitry required to support the DPT table lookup and cache line filling may be unreasonable when processing the translated access request (especially since the portion of the translated access control circuitry 117 distributed so that the circuitry at root port 205 does not need to provide the ability to trigger a DPT table lookup, as this can be done in the portion at SMMU 242, which invokes such a DPT table lookup when processing the early address translation request). Alternatively, the DPT lookup 535 and the DPT cache update 540 may depend on configuration information defined in the DCT; for example, if the configuration information determines that the device is not permitted to issue a translated access request at all, these steps may be omitted.
[0131] The device can communicate with the SoC 100 according to any protocol, but an example of a standard that can be used for communication between the device and, for example, the SoC is the Peripheral Component Interconnect Express (PCIe) standard.
[0132] Figure 6 This illustrates an example of a packet 605 carrying a translated access request using the PCIe standard. In this example, packet 605 includes a data payload 610 and a destination address 615. The destination address is a physical address, and in the case of a write request, the data payload holds the data to be written to the destination address. Packet 605 also includes a header 620 that defines the request (e.g., in this case, indicating that packet 605 includes a translated access request and indicating whether the request is a read request or a write request) and specifies a requester identifier 625 (also referred to herein as a device identifier) that identifies the device sending the request.
[0133] As shown in the figure, the requester identifier 625 is used to look up device configuration information defined in one or more device configuration tables 250 (the device configuration information may specify the software content identifier of the software content 125 associated with the device that issued the data packet 605), and the destination address 615 is used to look up permission information defined in one or more device permission tables 220.
[0134] Figure 7This is a flowchart illustrating another example of responding to a translated access request, where both the Device Configuration Table (DPT) and the Device Configuration Table (DCT) are considered. In this example, when a translated access request 705 is received, the translated access control circuitry 117 looks up device configuration information 730 (defined in the DCT) based on the requester identifier indicated by the request. The device configuration information specifies a software content identifier associated with the requester identifier (and optionally also device-specific permission information as described below), and can be looked up in the DCT (in memory) or in cache memory. The translated access control circuitry also looks up permission information 735 (defined in the DPT) based on the physical address specified as the target address of the request—again, this permission information can be looked up in the DPT (in memory) or in the DPT cache. Based on the combination of the device configuration information and the device permission information, the translated access control circuitry checks 740 whether the translated access request is permitted. If the translated access control circuitry determines that 745 access is permitted, then 750 access is performed and a response is returned to the requester. Otherwise, access to 755 is denied. If access is denied, this does not necessarily mean that the device cannot access the corresponding physical address at all, because the device can instead issue a non-translated access request for a specified virtual address, which is then processed by the address translation circuitry 116 based on the address mapping and access permissions defined in the paging table.
[0135] It should be noted that the order of steps shown in the flowchart is purely illustrative, and in practice, some steps may be performed in a different order than shown. For example, steps 730 and 735 may be performed in either order or in parallel with each other. Furthermore, in some example implementations, the information looked up in steps 730 and 735 may be defined in the same cache entry; in this case, a single lookup of that entry will cover both steps.
[0136] Figure 8 Examples of the Display Device Configuration Table (DCT) 250 and Device Permission Table (DPT) 220 are shown. In this example, DCT 250 specifies an associated software content identifier 810 for each device (e.g., identified by device identifier 805), which indicates the software content associated with the identified device. For example, the software content specified in the DCT for a given device is the software content currently associated with that device. Furthermore, DCT 250 specifies a privilege level (also referred to herein as device configuration information) 815, and each entry also includes a validity indicator 820 indicating whether the entry is valid.
[0137] Privilege level 715 indicates whether the identified device is permitted to issue translated access requests on behalf of the identified software content, and what types of access are permitted or denied. In other words, the device privilege level can indicate the trust level associated with the device. In this particular example, four privilege levels are defined:
[0138] 1. No access is allowed. If privilege level 1 is specified, this indicates that the identified device is not permitted to issue transposed access requests on behalf of any software content. A device with privilege level 1 may be considered an untrusted device.
[0139] 2. Allow private access. If privilege level 2 is specified, this indication device is permitted to issue a converted access request on behalf of the identified software content to a memory location in the DPT that is indicated as accessible only to the identified software content—for example, a memory location defined as private to (multiple) software content.
[0140] 3. Allow shared access. If privilege level 3 is specified, this indication device is permitted to issue transposed access requests on behalf of the identified software content to memory areas that are private to the software content or shared between the software content(s) and one or more other processes.
[0141] 4. Allow all access. If privilege level 4 is specified, this indicates that any translated access request issued by the device on behalf of the identified software content (even to memory regions marked as inaccessible, private, or shared in the DPT—in which case DCT privileges take precedence over DPT privileges) is permitted. A device with privilege level 4 can be considered a trusted device, and trusted devices do not specify incorrect physical addresses that were not previously returned by an earlier address translation request.
[0142] Therefore, DCT enables the assignment of different privilege levels to specific devices. Some devices may have undergone rigorous control during manufacturing to establish a root of trust within the device, and thus can be assigned more privileged levels 3 or 4. Other devices may be cheaper, but it is unknown whether they have undergone such rigorous manufacturing processes, and they may be more susceptible to corruption or errors, and can be assigned more stringent privilege levels 1 or 2 to restrict the ability to use translated access requests that directly specify physical addresses.
[0143] Turning now to DPT 220, this table specifies software content identifiers 825 for each physically addressed memory region 824, associated with software content, and permission hierarchies 830 defining a set of access permissions for the corresponding region. The table also defines read / write / execute instructions 835 to identify whether permission information is applicable to read access, write access, and / or execute access, and each entry includes a validity indicator 840 indicating whether the entry is valid, and a consecutive value 845. Alternatively, DPT entries may contain permission "indexes": small integer values that can be used to look up registers or tables for individual configurable permission settings. The consecutive indicator 845 indicates that, when set, the permission information defined in this entry is the same as the permission information defined in one or more other entries (and therefore, these multiple entries can be represented in a single entry in the device permission cache).
[0144] Permission level 830 indicates the extent to which a translated access request can access the corresponding memory region.
[0145] Specifically, this example defines four permission levels:
[0146] 1. No access is allowed. If the record permission level is 1, this indicates that the identified memory area is not permitted to be accessed using any translated access request. If the area has permission level 1, it is not necessary to specify the software content identifier (the software content ID field 825 can be ignored) because in this case, access permissions are independent of the software content identifier.
[0147] 2. Allow private access (to the specified software content). If permission level 2 is recorded along with the identified software content, this indicates that the storage area is private to the identified software content, and therefore, translated access requests from the identified software content to the identified storage area are permitted, but other translated access from other software content is not permitted.
[0148] 3. Shared Access Allowed. If permission level 3 is recorded, this indicates that access to the indicated memory region is shared between the indicated software content and one or more other processes (e.g., the indicated software content and the supervising process that supervises the indicated software content), and therefore the software content and one or more other processes are permitted to access the region using translated access requests. Optionally, the DPT entry may also allow the Additional Software Content ID field to specify the Additional Software Content ID of another software content that is permitted to share access to the memory region with the indicated software content.
[0149] 4. Access Permitted. If permission level 4 is recorded, this indicates that translated access to the identified memory location is permitted by any procedure. Similarly, if PA has permission level 4, it is not necessary to specify the software content, because in this case, access permissions are independent of the software content ID.
[0150] Therefore, DCT defines device-level access permissions (e.g., each entry in DCT corresponds to a specific device, but not a specific address range), while DPT defines address-level permissions (e.g., each entry corresponds to a specific physical address range).
[0151] In some cases, when a device issues a translated access request indicating a given PA, it is possible that the privilege level defined for the device in the DCT conflicts with the privilege level defined for the indicated PA in the DPT. Therefore, in some cases, one privilege level or authority level may supersede (take precedence over) the other.
[0152] Figure 9 This example illustrates how privilege levels defined in DCT 250 and permission levels defined in DPT 220 can be combined to indicate whether a translated access request is permitted. In this example, there are cases where privilege levels take precedence over permission levels; for instance, when privilege level 1 is defined, access is always blocked, and when privilege level 4 is defined, access is always permitted. For example, privilege level 1 could indicate that the device is untrusted, and therefore, all translated access requests issued by that device should be denied, regardless of the PA specified in the request. Similarly, privilege level 4 could indicate that the device is trusted, and therefore, all translated access requests issued by that device should be permitted, regardless of the PA specified in the request. In this way, when a device is considered trusted or untrusted, this can be indicated by updating a single entry in the DCT rather than requiring updating numerous entries in the DPT. This also avoids the need to look up the DPT in some cases.
[0153] In all other cases (e.g., when privilege level is 2 or 3), most restrictive permissions take precedence. Therefore, if the privilege level or permission level is 2 (private), access will be considered private to the given software content regardless of whether the privilege / permission level is 3.
[0154] It should be understood that this is only one possible way to define permission levels in DPT 220 and DCT 250, and other types of permissions can also be defined. Furthermore, as... Figure 8 As instructed, in Figure 9 Within the specified combination of permissions, these permissions can be further used. Figure 8The R / W / E field 835 shown indicates eligibility for areas that are allowed access using a translated access request, and specifies whether the permission applies to read (R), write (W), and / or instruction fetch (execute –E), respectively.
[0155] The device permission table can be implemented as a multi-level table in memory, wherein a table lookup circuitry is provided to look up permissions defined in the table. Figure 10 Displaying physical address 1005 can be used to find entries in a multi-level DPT. For example... Figure 10 As shown, a portion of the physical address is used as a level 0 index 1010, which can be combined with the DPT base address 1015 (e.g., configured in a register of the SMMU 242) to identify entries in level 0 table 1020. Each entry in level 0 table corresponds to a memory block and stores a base address indicating the corresponding level 1 table 1025 for that memory block. A separate level 1 table is defined for each address block, and the base address in each entry of level 0 table 1020 identifies that table. Some entries in level 0 table may also define the permission level for the entire memory block; if this is the case, the table walkthrough circuitry does not need to continue walking because the permission level defined in the level 0 table entry applies to all addresses within that block.
[0156] Once the base address in the level 1 table has been obtained from the level 0 table, the level 1 index 1030 derived from the physical address is combined with this base address to identify a level 1 table entry. Each entry in the level 1 table 1025 corresponds to a subset of memory addresses covered by the table, and a permission level is defined for that subset. For example, each level 1 table entry may include... Figure 7 The fields shown in the device permission table 220 are illustrated.
[0157] Furthermore, in this particular example, each entry 1035 in the Tier 1 table can specify individual access rights for a separate address range. Therefore, the GPI index 1040 is also derived from the physical address to identify the specific access rights in the Tier 1 entry 1035. For example, if the size of a DPT entry is smaller than a single cache line (the basic unit of memory access used to transfer data between different parts of the memory system), then since multiple DPT entries can fit onto a single cache line, the GPI index 1040 portion of the physical address can be used to select the relevant DPT entry from that cache line. In other examples, if the DPT entry size is a full cache line, the GPI index portion 1040 may not be necessary.
[0158] In this particular example, the physical address is 52 bits long, but the higher bits 1050 are not used to identify locations in memory (e.g., they can all be set to 0 or all to 1), nor are they used in DPT lookups. Similarly, the lowest bits 1055 are not used in DPT lookups because they indicate the individual address within the region corresponding to a single DPT entry.
[0159] It should be understood that although DPT is in Figure 10 The table is shown as a two-level table, but it can also include any number of levels. It may be useful that the number of levels in the DPT structure is less than the number of levels supported by a multi-level paging table structure for address translation in the address translation circuitry system 116. For example, a two-level DPT can be used, and a four-level paging table structure can be used for a given stage of address translation. This reflects that the paging table structure can define address mappings and permissions to control the processing of non-translation memory accesses with a finer granularity than the permissions defined in the DPT to control the use of translated memory accesses.
[0160] In some examples, access permissions in a DPT can depend on the operational state of the software content making the request; for example, a separate DPT can be defined for each of multiple operational states. Figure 11 Examples are shown where separate tables are defined for software content executing in a secure state (e.g., Security DPT 1105) and for software content executing in an insecure state (e.g., Insecure DPT 1110). Note that the label "Insecure" for Insecure DPT 1110 does not necessarily indicate that the table itself is insecure—this label merely indicates that this is a table used for software content operating in an insecure (e.g., less secure) state. Furthermore, as... Figure 11 As shown, additional permission tables can also be defined for other security states.
[0161] In this application, the term "configured as..." is used to mean that the elements of a device are configured to perform defined operations. In this context, "configuration" means the arrangement or manner of interconnection of hardware or software. For example, the device may have dedicated hardware that provides defined operations, or a processor or other processing device may be programmed to perform that function. "Configured as" does not mean that the elements of the device need to be changed in any way to provide the defined operations.
[0162] While illustrative embodiments of the invention have been described in detail herein with reference to the accompanying drawings, it should be understood that the invention is not limited to these precise embodiments, and various changes and modifications may be made therein by those skilled in the art without departing from the scope of the invention as defined in the appended claims.
Claims
1. A device comprising: address translation circuitry configured to, in response to an advance address translation request issued by a requestor device on behalf of given software content and specifying a given virtual address, translate the given virtual address to a given physical address and provide the given physical address to the requestor device for association with a subsequent translated access request issued by the requestor device; and translated access control circuitry that, in response to a translated access request issued by the requestor device on behalf of the given software content and specifying a target physical address, performs the following operations: searching, based on the target physical address, corresponding permission information indicating corresponding access permissions defined in a device permission table for a physical address space region covering the target physical address, wherein the corresponding access permissions provide information for checking whether the translated access request from the plurality of software contents is prohibited; determining, based on the corresponding permission information, whether the given software content is prohibited from accessing a target memory location corresponding to the target physical address in response to a translated access request; as well as When it is determined that the given software content is prohibited from accessing the target memory location in response to the translated access request, an error response is triggered.
2. The device according to claim 1, wherein The translated access control circuitry is configured to support at least one encoding of an entry in the device permissions table, the at least one encoding identifying at least one access right associated with an identified software content specified by the entry in the device permissions table from among a plurality of software content.
3. The apparatus according to claim 1 or claim 2, wherein The translated access control circuitry is configured to support the device permissions table comprising a plurality of entries indexed by physical addresses, wherein each entry of the plurality of entries is shared between the plurality of content and identifies access rights to an associated region of physical address space.
4. The apparatus according to claim 3, wherein: The access rights include a device permission level selected from a plurality of device permission levels; and The at least one permission level includes at least one of the following: a private permission level that identifies an identified software content among the plurality of software contents and indicates that translated access requests associated with processes other than the identified software content are prohibited from accessing the associated physical address space region; and A shared permission level that identifies identified software content among the plurality of software content and indicates that translated access requests associated with processes other than the identified software content and a supervisory process operating at a higher privilege level than the plurality of software content are prohibited from accessing the associated physical address space region.
5. Apparatus according to any preceding claim, wherein: The translated access control circuitry is configured to look up, based on a device identifier specified in the translated access request, corresponding device configuration information indicative of the given software content associated with the device identifier; and The translated access control circuitry is configured to determine, based on a comparison of the given software content and the identified software content, whether the given software content is prohibited from accessing the target memory location in response to a translated access request when the corresponding permission information specifies the at least one access permission associated with the identified software content.
6. The device according to claim 5, wherein The translated access control circuitry is configured to support the device configuration table comprising a plurality of entries indexed by a device identifier, wherein each entry of the plurality of entries identifies device configuration information for an associated device.
7. The apparatus of claim 6, wherein: the device configuration information in each entry of the plurality of entries includes privilege information indicating whether the associated device is prohibited from issuing translated access requests; The privilege information includes a privilege level selected from a plurality of privilege levels; and The multiple privilege levels include at least one privilege level indicating that: even when the device permission table indicates that access to a subset of the physical address space in response to a translated access request is prohibited for at least one software content associated with the device identifier, the associated device is permitted to issue a translated access request.
8. Apparatus according to any preceding claim, comprising a device permissions cache memory configured to store permissions information corresponding to a subset of the access permissions defined in the device permissions table, Wherein the translated access control circuitry, in response to the translated access request, looks up the corresponding permission information in the device permission cache based on the target physical address of the translated access request.
9. The device according to claim 8, wherein The translated access control circuitry determines the corresponding permission information for the region of the physical address space covering the target physical location in response to the advance address translation request and stores the corresponding permission information to the device permission cache.
10. Apparatus according to claim 8 or claim 9, wherein: The address translation circuitry is configured to, in response to the advance address translation request, look up a set of translation table permissions defined in an address translation table entry corresponding to the given virtual address and the given software content; and The translated access control circuitry is configured to determine the corresponding permission information dependent upon the translation table permissions and to store the corresponding permission information to the device permission cache.
11. The device according to claim 10, wherein The translated access control circuitry sets default access permissions as the corresponding permission information to be stored to the device permission cache in response to determining based on the translation table permissions that at least one of the corresponding access permissions for the given physical address is unknown from the translation table permissions.
12. Apparatus according to any preceding claim, comprising a device permission table walkthrough circuit system configured to search a multi-level table representing the device permission table, in: Each level of the multi-level table includes entries associated with a contiguous smaller region of the physical address space; The last level of the multi-level paging table defines the access rights; and Each level except the last level defines pointers to a plurality of tables in the next level, the pointers being selectable based on a portion of a physical address.
13. The device according to claim 12, wherein An upper limit of the number of levels of the multi-level table supported by the device permission table walk circuit system is less than an upper limit of the number of levels of the paging table supported by the paging table walk circuit system.
14. An apparatus according to claim 12 or claim 13, wherein The device permission table walkthrough circuit system is configured to support at least one encoding of entries at at least one level other than the last level, the at least one encoding indicating access permissions applicable to the entire physical address space block covered by the entries at the at least one level other than the last level.
15. Apparatus according to any preceding claim, comprising a device permissions cache memory configured to store permissions information corresponding to a subset of the access permissions defined in the device permissions table, wherein the translated access control circuit system is configured to support at least one encoding of an entry of the device permission table, the at least one encoding indicating that access permissions to each of a plurality of physical address space regions are the same and can be represented by a single entry in the device permission cache memory corresponding to a predetermined region of the plurality of regions.
16. Apparatus according to any preceding claim, wherein: The translated access request is associated with a security state selected from a plurality of possible security states; and The searching of the corresponding permission information is based on the security state and the target physical address.
17. The apparatus of claim 16, wherein The translated access control circuitry is configured to support a plurality of device permission tables, each device permission table corresponding to a different security state.
18. Apparatus according to any preceding claim, wherein The translated access control circuitry is configured to support a table shared among a plurality of devices to define access permissions for translated accesses issued by the plurality of devices as the device permissions table.
19. Apparatus according to any preceding claim, comprising: a device permissions cache memory configured to store permissions information corresponding to a subset of access permissions defined in the device permissions table; processing circuitry configured to execute software; and a device permission cache control circuitry configured to invalidate entries in the device permission cache in response to a device permission cache maintenance command triggered by the software executing on the processing circuitry and having a different encoding than a translation lookaside buffer invalidation command used to trigger invalidation of paging table information from a translation lookaside buffer.
20. A method comprising: responsive to an advance address translation request issued by a requestor device on behalf of given software content and specifying a given virtual address, translating the given virtual address to a given physical address and providing the given physical address to the requestor device for association with a subsequent translated access request issued by the requestor device; as well as In response to a translated access request issued by the requestor device on behalf of the given software content and specifying a target physical address, the translated access control circuitry performs the following steps: searching, based on the target physical address, corresponding permission information indicating corresponding access permissions defined in a device permission table for a physical address space region covering the target physical address, wherein the corresponding access permissions provide information for checking whether the translated access request from the plurality of software contents is prohibited; determining, based on the corresponding permission information, whether the given software content is prohibited from accessing a target memory location corresponding to the target physical address in response to a translated access request; as well as When it is determined that the given software content is prohibited from accessing the target memory location in response to the translated access request, an error response is triggered.
21. A computer readable medium storing computer readable code for manufacturing an apparatus, the apparatus comprising: address translation circuitry configured to, in response to an advance address translation request issued by a requestor device on behalf of given software content and specifying a given virtual address, translate the given virtual address to a given physical address and provide the given physical address to the requestor device for association with a subsequent translated access request issued by the requestor device; and translated access control circuitry that, in response to a translated access request issued by the requestor device on behalf of the given software content and specifying a target physical address, performs the following operations: searching, based on the target physical address, corresponding permission information indicating corresponding access permissions defined in a device permission table for a physical address space region covering the target physical address, wherein the corresponding access permissions provide information for checking whether the translated access request from the plurality of software contents is prohibited; determining, based on the corresponding permission information, whether the given software content is prohibited from accessing a target memory location corresponding to the target physical address in response to a translated access request; as well as When it is determined that the given software content is prohibited from accessing the target memory location in response to the translated access request, an error response is triggered.
