In the following, exemplary embodiments of the invention will be described with the aid of the accompanying figures, where
a-b are a sequence chart of allocation and deallocation of a memory region to a subsystem according to an exemplary embodiment of the invention;
In
Memory is provided for various subsystems of the overall device system. Such subsystems, designated SS 1 to SS n in
The memory management unit provides a unified view of the memory system for all subsystems regardless of the actual physical memory implementation. The provided functions may be, amongst others, allocation and deallocation of memory regions to subsystems, transfer of memory region ownership from one subsystem to another (which will be explained in detail below), and protection of memory regions against undesired access.
One aspect of the invention is the defining of ownerships for memory regions by the memory management unit. The owner of a memory region may thus be understood as a subsystem or component that is allowed to use the respective memory region for any procedures, such as standard read/write processes. Several owners may be assigned to a single memory region and thus be granted access to the same memory region, or a memory region may also not have a current owner and would be available for a new ownership registration on request. Ownership and related features of memory resources for subsystems are controlled by the intelligent memory management unit IMMU by using a defined region code for each allocated memory region. Some portions of the overall memory resources could still be permanently or temporarily dedicated to specific tasks and not be available in the memory allocation and transfer process, e.g. for tasks that require strict performance guarantees or are exceptionally demanding in view of performance. Specific examples of memory management procedures according to the invention will be presented in more detail below.
Several parameters may be used by the IMMU and in messages between subsystems, IMMU and memory units for efficient memory management according to exemplary embodiments of the invention. These parameter values may in one embodiment be stored in a table at the memory management unit to keep track of all controlled memory resources. Possible parameters are:
Further parameters may be defined that could e.g. be user defined or vendor specific for various purposes. All of the parameters and implementation examples presented above are given by way of example only and may also be realized differently. All parameters are updated by the memory management unit if some attribute of a memory region has been changed, e.g. by a deallocation or a region transfer. Also, all values may be stored into the IMMU table during system boot.
Columns three and four show logical and physical starting addresses of the memory regions, respectively. As mentioned above, the memory management unit is able to translate logical addresses for the subsystems into physical memory addresses.
In column five, the size of each memory region is indicated. In this example, there are two unallocated regions of a first size and three allocated regions of a second size; however, these are only examples, and the size of a memory region may be variable and may also optionally be changed during operation. This may for example be the case when only part of a region needs to be transferred or de-allocated.
Basic functions of an exemplary system according to the invention include allocation and deallocation of memory to subsystems (
Referring to
Deallocation of memory from a subsystem may be performed in a similar way, illustrated in
A further function of exemplary embodiments of the invention is transfer of a memory region ownership. That is, a memory region is allocated to a first subsystem SS1 as described above, and subsequently transferred to a second subsystem SS2 without any intermediate deallocation/allocation step. This is illustrated by example in
If then the first subsystem is not in need of the allocated memory region any more and the data located in the memory region is required by a second subsystem, the first subsystem may transfer the ownership to a second subsystem. At that time, the ownership of the respective memory region is defined by the parameter “owner ID” in the IMMU table, having a value of the first subsystem ID. It should be noted that an unprotected memory region may also be owned by more than one subsystem, that is, several subsystems may have access to the allocated memory region and are thus defined as parameter values for the owner ID.
In exemplary embodiments of the invention, the ownership transfer itself is achieved as illustrated in the following with regard to
In a second segment, the memory region is transferred from a first subsystem SS1 to a second subsystem SS2 by communicating its respective parameters in step 210. The communicated parameters may for example include size, performance grade, protection flag and the region code of the memory region to be transferred. The second subsystem SS2 receives the parameters in step 212 and may acknowledge the transfer by another communication (step 214) to the first subsystem. This part of the transfer procedure, that is the communication between first and second subsystems, is performed via the control interface CI.
As a last part, the second subsystem SS2 registers as a new owner of the memory region to the memory management unit IMMU by transmitting via the memory interface MI the region code and logical starting address of the region along with its subsystem identifier to the IMMU in step 218, which in response (step 220) updates the IMMU table with the new parameter values for owner ID and logical address, while all other parameters remain unchanged. Finally, the IMMU may acknowledge the ownership update by an acknowledgement signal or message to the second subsystem SS2 in step 222. Now the subsystem may access the memory region as usual.
The transfer procedure as illustrated above is only given by way of example and may vary in various embodiments of the invention. For example, acknowledgements may not be required or steps such as sending an acknowledgement and registering with the IMMU might be performed simultaneously. Also, further messages and/or parameters might be transmitted to achieve the transfer of the memory region code to another subsystem. Instead of a first memory allocation (step 200) right before the region transfer, another similar region transfer (or several region transfers) from another subsystem may have been performed beforehand. Many other modifications of the method are conceivable to a person skilled in the art.
In the above example, ownership of a complete and unchanged memory region was transferred to another subsystem. However, also only fractions of a memory region may be transferred or de-allocated, as already mentioned above. In case of a partial transfer of a memory region, size and starting address of the transferred portion (or alternatively of the portion not to be transferred) are transmitted with the further parameters. The IMMU may then change the parameter table by creating a new row for the cut-off part of the memory region and updating the parameters of the old region, thus creating a new region of smaller size, which may then be transferred or allocated as before.
In an alternative embodiment, the first subsystem may not return the ownership of a memory region until the second subsystem SS2 has registered as a new owner at the IMMU. That is, for example all steps relating to the region code transfer between both subsystems might be performed before the transfer request to the IMMU.
All further procedures, such as read and write procedures to the memory are performed in the way known in the art, with the exception that the IMMU may be able to block access to unallocated and protected memory regions. The translation between physical and logical addresses for all procedures is done by the IMMU. As an example, each read or write procedure requires a command for identification of the read/write type, a user ID and an address.
If several operations arrive at the IMMU simultaneously, they will be processed sequentially. Processing order may be based on known schemes such as priority arbitration, round-robin, reserved time-slot scheme or any combination of these. Alternatively, a user may be allowed to define a custom arbitration scheme.
Some memory parts may be dedicated to a specific subsystem, which may be hard-coded in the IMMU. As described above, such a dedicated memory region may be indicated by a parameter in the IMMU table. In addition to the memory managed by the IMMU, a subsystem may further have access to internal memory that is not controlled or even seen by the IMMU. The internal memory of a subsystem may be located within the same physical memory element as the IMMU controlled memory or alternatively on separate physical memory units.
In general, the invention as described by way of example above may be physically implemented in various schemes. One example will now be described with reference to
The fact that the actual memory implementation is hidden from the subsystems by the memory management unit facilitates the optional use of heterogeneous memory structures in a device. Not only DRAM units as described in the example above may be used, but also combinations of different memory architectures and types. For example, the complete memory system that is managed by the IMMU might include volatile storage types such as DRAM and SRAM, but also non-volatile elements such as flash memory or hard disks.
The physical addresses of the allocated memory regions are selected based on performance requirements given by the subsystems. The distinct memory blocks forming the global memory system may vary in available bandwidth, latency, memory size, or power consumption. In addition, some memory blocks might have more users than others.
To avoid memory fragmentation, the memory may need to be rearranged in certain intervals. All memory accesses may be stalled until the rearrangement procedure is completed. This may also be done if at an allocation request there is no memory region of sufficient size.
Garbage collection may be performed if the amount of unallocated memory is less than a certain percentage of total memory. In this process all transferred and currently non-registered memory regions are marked as free if they have been unused for y clock cycles, with y being a configurable value. After this, the memory is defragmented.
The data flowing from the subsystems into a memory can be processed by the IMMU if required. This processing may include calculating error detection or correction codes, compressing the data, or utilizing some other signal processing algorithm to transform the data into another form.
In the system, various error messages may be defined for handling special situations that may occur during operation. Some examples are described in the following.
For instance, the available memory may be less than the amount of memory requested by a subsystem. In that case, the memory management unit may in an exemplary embodiment of the invention try to allocate a smaller memory portion and extend this portion as soon as more resources are available again.
Another example would be that the performance grade that was required by the requesting subsystem by means of the performance parameter included in the request cannot be met.
As mentioned above, memory performance may relate to bandwidth, number of concurrent owners/users, and similar characteristics. One possibility to handle such an error according to an exemplary embodiment may be that a memory region with lower performance is allocated at first, again with an option to extend or change the allocated memory region as soon as suitable memory portions are released.
In any case, it is not necessarily required to wait until another memory portion is in fact de-allocated. If a memory region's state is changed from protected to unprotected, this also provides the system with the possibility to allow access of this now unprotected memory region to another subsystem.
If a subsystem attempts to register as a new owner of an untransferred memory region, it may receive an error message to indicate that the given parameters are not correct, and thus requesting the subsystem to re-register with correct parameters. It would also be possible to retry registering after a certain time to ensure that the transfer request of the previous region owner has been completed at the IMMU.
When memory is being defragmented or garbage collection is performed, access to the respective memory regions will be stalled and an error message may be communicated to any subsystem that tries to access the memory region, indicating to try again at a later moment.
All embodiments, descriptions and explanations above should not be understood as limiting, but were given by way of example only to enable an understanding of the invention. All features and details described for a specific embodiment may be transferred and combined with any of the further described embodiments, as long as they are not mutually exclusive. A person skilled in the art will easily see that many modifications, improvements, and various combinations of the above embodiments are possible without departing from the spirit and scope of the invention.