This application is based upon and claims the benefit of priority from Japanese patent application No. 2016-101282, filed on May 20, 2016 and Japanese patent application No. 2017-031933, filed on Feb. 23, 2017, the disclosure of which is incorporated herein in its entirety by reference.
The present disclosure relates to a semiconductor device and its memory access control method. For example, the present disclosure relates to a semiconductor device including a main-arithmetic unit that executes a program, a sub-arithmetic unit that executes a process of a part of the program, and a shared memory that is shared by the main-arithmetic unit and the sub-arithmetic unit, and relates to its memory access control method.
In a semiconductor device that performs various processes based on a program, there are cases where a plurality of programs are executed in one semiconductor device. Such a semiconductor device requires a memory protection mechanism to prevent interference in a memory space used by a plurality of programs (e.g., to prevent a plurality of programs from using the same area in a memory space). Therefore, Japanese Unexamined Patent Application Publication No. 2014-48849 discloses an example of the memory protection mechanism.
A semiconductor device disclosed in Japanese Unexamined Patent Application Publication No. 2014-48849 is a safety control system in which a drive control unit that performs drive control of a device to be controlled and a safety control unit that performs safety control related to the drive control are disposed in one processor, and in which: a predetermined storage area is allocated as a data storage area for each of the drive control unit and the safety control unit in advance; and the safety control system includes memory protection information storage means in which the storage area allocated to the safety control unit is registered as a storage area that cannot be accessed by the drive control unit, and memory protection means for, when the drive control unit performs memory access, referring to the access destination and registration information registered in the memory protection information storage means, and when the access destination is in the storage area that cannot be accessed by the drive control unit, preventing the drive control unit from accessing the storage area allocated to the safety control unit.
The present inventors have found the following problem. A semiconductor device improves its processing speed by including, in addition to a main-arithmetic unit that performs various processes, a sub-arithmetic unit that executes a specific process of a part of a program executed by the main-arithmetic unit. Further, the semiconductor device including the main-arithmetic unit and the sub-arithmetic unit includes a shared memory that is shared by the main-arithmetic unit and the sub-arithmetic unit. In such a semiconductor device, the sub-arithmetic unit directly accesses the shared memory in order to increase the processing speed. It should be noted that the technique disclosed in Japanese Unexamined Patent Application Publication No. 2014-48849 can perform memory protection for the shared memory that occurs in the main-arithmetic unit. However, in the case where the sub-arithmetic unit directly accesses the shared memory that is also used by the main-arithmetic unit, there is a problem that the technique disclosed in Japanese Unexamined Patent Application Publication No. 2014-48849 cannot perform memory protection against access to the shared memory by the sub-arithmetic unit.
Other objects and novel features will be more apparent from the following description in the specification and the accompanying drawings.
According to one embodiment, a semiconductor device include: a sub-arithmetic unit configured to execute a process of a part of a program executed by a main-arithmetic unit; and a shared memory shared by the main-arithmetic unit and the sub-arithmetic unit, in which the sub-arithmetic unit includes a memory protection unit configured to permit or prohibit access to the shared memory based on an access permission range address value provided from the main-arithmetic unit, the access to the shared memory being access that arises in a process executed by the sub-arithmetic unit.
According to one embodiment, a semiconductor device and its memory access control method can perform memory protection against access to the shared memory by the sub-arithmetic unit.
The above and other aspects, advantages and features will be more apparent from the following description of certain embodiments taken in conjunction with the accompanying drawings, in which:
For clarifying the explanation, the following descriptions and the drawings may be partially omitted and simplified as appropriate. Further, the same symbols are assigned to the same components throughout the drawings and duplicated explanations are omitted as required.
First Embodiment
The CPU 10 executes a program. In the semiconductor device 1, as the program is executed by the CPU 10, access to the hardware IPs 22 and 23 and the shared memory 21 occurs. The CPU 10 includes an arithmetic unit 11 that executes the program. The semiconductor device 1 may include a memory controller, an internal memory, an input/output interface circuit, and so on, though they are omitted in
The OS and the application programs APPa and APPb include programs having high reliability that have been verified at a high level and are sufficiently protected in regard to functional safety or security (hereinafter referred to as “reliability-verified programs”) and programs that have been verified only at a low level and are not sufficiently protected in regard to functional safety or security (hereinafter referred to as “reliability-unverified programs”) in a mixed manner. Information on whether a program is a reliability-verified program or a reliability-unverified program is included in the program in advance. The criterion for this determination is determined, for example, in accordance with a criterion specified in the International Standards Organization. Note that although the embodiment is explained on the assumption that the semiconductor device includes only one OS, actual embodiments are not limited in this way. That is, the number of OSs may be more than one.
Examples of the reliability-verified program include a self-driving application in an automobile. Meanwhile, examples of the reliability-unverified program include a moving-picture playback application. When a reliability-verified program and a reliability-unverified program are executed in the same CPU, it is necessary to prevent data of the reliability-verified program and the reliability-unverified program from interfering with each other (i.e., prevent the reliability-verified program and the reliability-unverified program from using each other's data). Note that although an example of an automobile is shown above, the actual application is not limited in this way.
The shared memory 21 is, for example, a volatile memory such as a DRAM (Dynamic Random Access Memory) or a nonvolatile memory such as a Flash memory. The shared memory 21 is accessed by the CPU 10 and the hardware IPs 22 and 23. Note that the shared memory 21 may be any memory used by the semiconductor device 1 and may be disposed in a semiconductor chip different from the chip in which the CPU 10 and the hardware IPs 22 and 23 are disposed.
Each of the hardware IPs 22 and 23 is a hardware component that executes a process of a part of the program executed by the CPU 10. For example, each of the hardware IPs 22 and 23 performs only (or mainly) a specific process such as a process for decoding an encoded image, an image conversion process that is performed as one process in an image recognition process, or a feature-value extraction process. In
Therefore,
The information processing unit 31 performs a specific process according to an operation instruction provided from the CPU 10. The register group 32 includes a plurality of registers. In the example shown in
When an access request occurs in the information processing unit 31, the memory access command generation unit 33 generates an address in the shared memory 21 corresponding to the access request and outputs the access request with the generated access address attached thereto. For example, when an access request for a pixel value at specific coordinates in an image stored in the shared memory 21 occurs in the information processing unit 31, the memory access command generation unit 33 generates an address in the shared memory 21 at which the pixel specified by the information processing unit 31 by using the coordinates is stored.
The memory protection unit 34 provides, among access requests issued from the information processing unit 31 to the shared memory 21, access requests for addresses within the access permission range specified by the access permission range address values to the shared memory 21 and blocks (i.e., intercepts) access requests for addresses outside the access permission range specified by the access permission range address values. Note that in the hardware IP 22, an access request that is received by the memory protection unit 34 is output from the memory access command generation unit 33.
Further, when the memory protection unit 34 detects an access request for an address outside the access permission range specified by the access permission range address values, it outputs an error notification ERR1 to the CPU 10. Then, in response to the error notification ERR1, the CPU 10 performs at least one of a process for stopping the operation of the hardware IP 22 and a process for stopping the program using the hardware IP 22 as an interrupt process.
As described above, in the semiconductor device 1 according to the first embodiment, the hardware IP 22 determines whether or not an access request issued from the information processing unit 31 to the shared memory 21 should be actually provided to the shared memory 21 based on the access permission range address values set by the CPU 10. Therefore,
In each of
Similarly, when a processing instruction is an instruction by a functionally-safe application, the hardware IP is permitted to access, in the access range permitted for functionally-safe applications, only a memory space from the access permission start address stored in the register group 32 to the access permission last address also stored in the register group 32 as shown in
Next, an operation of the semiconductor device 1 according to the first embodiment is explained. In the following explanation, the operation of the semiconductor device 1 is divided into a hardware IP start-up operation, a hardware IP register setting operation, a hardware IP memory access operation, and an operation in which a memory access violation occurs, and they are explained one by one.
Firstly,
The application outputs a register setting instruction including access permission range address values as one of operation parameters for the hardware IP to a functionally-safe application (an OS in
Then, the hardware IP stores the operation parameters included in the register setting instruction into the register group 32. Further, the hardware IP sets an access permission range in the memory protection unit 34 based on the access permission range address values included in the operation parameters stored in the register group 32.
Then, the application generates an instruction about a specific process for the hardware IP and provides this specific process as a processing instruction to the hardware IP. The hardware IP starts a process in response to this processing instruction.
As described above, the CPU 10 performs the process for storing the access permission range address values into the register group 32 of the hardware IP before starting up the hardware IP.
Next,
Further,
As shown in the first and second examples of the memory access sequence of the hardware IP, there are various conceivable methods for blocking an access request according to the specifications as processes that are performed by the memory protection unit 34 when a memory access violation occurs.
Next,
In the interrupt process P1, the OS issues (i.e., the OS causes the CPU to issue) a reset instruction (or an initialization instruction) to the hardware IP. The hardware IP performs an initialization process for restoring the information processing unit 31, the register group 32, the memory access command generation unit 33, and the memory protection unit 34 to initialized states based on this reset instruction.
In the interrupt process P2, the OS issues a process stop instruction to the application that is using the hardware IP. Upon receiving the process stop instruction, the application performs a finish process irrespective of its processing state at that moment and thereby stops the process.
In the interrupt process P3, the OS finishes a task related to the application that is using the hardware IP irrespective of its processing state at that moment. In the example shown in
As explained above, in the semiconductor device 1 according to the first embodiment, the memory protection unit 34 provided in the hardware IP outputs only access requests for addresses within the memory access range provided from the CPU 10 to the shared memory 21. Therefore, in the semiconductor device 1 according to the first embodiment, the CPU 10 can restrict the access range for the hardware IP. Further, in the semiconductor device 1 according to the first embodiment, by restricting the access range for the hardware IP, it is possible to prevent the hardware IP from corrupting (i.e., destructing) data stored in an area used by other applications due to a malfunction of the application running on the CPU 10 or due to hacking or the like.
Further, the semiconductor device 1 according to the first embodiment can achieve high processing performance by having the hardware IP process a process of a part of a program executed by the CPU 10. Further, by providing the hardware IP with the memory protection mechanism as described above, the semiconductor device 1 according to the first embodiment can achieve both high processing performance and high reliability.
Second Embodiment
In a second embodiment, a hardware IP 22a, which is another embodiment of the hardware IP 22, is explained. Note that in the following explanation of the second embodiment, the same symbols as those of the first embodiment are assigned to the same components/structures as those of the first embodiment and their explanations are omitted.
The internal memory 41 is a memory whose memory space is not defined in the memory space used by the CPU 10 and hence is a memory that only the hardware IP 22a can use. The internal memory 41 is, for example, an SRAM (Static Random Access Memory).
The reset control circuit 42 performs an initialization process for initializing at least the register group 32, the information processing unit 31, the memory protection unit 34, the internal memory 41, and the shared memory 21. Further, the reset control circuit 42 performs the initialization process at least either in the start-up of the hardware IP 22a or in the end of its operation. In the example shown in
Next, an operation of the hardware IP 22a according to the second embodiment is explained. Therefore,
As shown in
In response to the notification of the processing instruction from the CPU 10, the hardware IP 22a first performs an internal reset process. In this internal reset process, the hardware IP 22a resets (i.e., initializes) at least the internal memory 41 and the information processing unit 31. After that, the reset control circuit 42 of the hardware IP 22a performs an external reset process for performing an initialization process for the access permission range in the shared memory 21 specified by the access permission range address values stored in the register group 32. After completing this external reset process, the hardware IP 22a starts a process according to the processing instruction.
Next,
As shown in
In the above explanation, an example in which the register group 32 and the whole area corresponding to the access permission range in the shared memory 21 are initialized in the reset process in the finish sequence is explained. However, there are cases in which when a process using the hardware IP 22a is performed, its processing result needs to be kept (i.e., left undeleted) so that an application can refer to the processing result of the hardware IP 22a after the operation of the hardware IP 22a is finished. In such cases, the hardware IP 22a needs to store (or save) the processing result that should be kept in an area that is not initialized by the initialization process performed by the reset control circuit 42. Therefore, another example of an external reset process performed by the reset control circuit 42 is explained with reference to
In some cases, the hardware IP is used by a plurality of applications. In such a situation, there is a problem that, for example, when a register setting value or a processing result that is used in the previous process remains in the hardware IP, an application that uses the hardware IP later could malfunction because of the presence of the remaining information, or that hacking can be performed between applications by using the remaining information as a clue.
However, in the hardware IP 22a according to the second embodiment, used information is initialized (i.e., deleted) when the hardware IP 22a is started up and when its operation is finished. In this way, the semiconductor device including the hardware IP 22a according to the second embodiment can prevent the problem which would otherwise be caused due to data interference between applications and lower the possibility of hacking.
In particular, the internal memory 41 provided in the hardware IP 22a according to the second embodiment is a memory space that is not defined in the memory space recognized by the CPU 10. Since this internal memory 41 is not recognized by the CPU 10, it is impossible to reset the internal memory 41 under normal circumstances. However, the above-described internal memory 41 can be initialized in the hardware IP 22a according to the second embodiment. Therefore, it is possible to prevent the problem which would otherwise be caused by the information remaining in the internal memory 41.
Third Embodiment
In a third embodiment, a semiconductor device 2, which is another embodiment of the semiconductor device 1 according to the first embodiment, is explained. Note that in the following explanation of the third embodiment, the same symbols as those of the first embodiment are assigned to the same components/structures as those of the first embodiment and their explanations are omitted.
As explained above, in the semiconductor device 2 according to the third embodiment, the memory management unit 51 can set (i.e., defines) an access permission range for each application. The semiconductor device 2 according to the third embodiment can improve its reliability compared to that of the semiconductor device 1 according to the first embodiment by preventing interference between applications.
Fourth Embodiment
In a fourth embodiment, a hardware IP 22b, which is another embodiment of the hardware IP 22 according to the first embodiment, is explained. Note that a semiconductor device according to the fourth embodiment is explained hereinafter on the assumption that the semiconductor device is obtained by replacing the hardware IP 22 of the semiconductor device 2 according to the third embodiment with the hardware IP 22b. However, the hardware IP 22b can be used even when the semiconductor device does not include the memory management unit 51.
In the semiconductor device according to the fourth embodiment, the hardware IP 22b is permitted to access a different memory range for each unit process indicated by an application of the CPU 10 and uses the permitted memory range. Further, a work memory that the hardware IP 22b uses when it is executing a process indicated by the application of the CPU 10 is specified by an operation parameter stored in the shared memory 21.
Therefore,
As shown in
Further, in the semiconductor device according to the fourth embodiment, the start address of a work memory 0 and the start address of a work memory 1 are stored within the access permission range of the hardware IP 22b. Addresses within the access permission range are set for these start addresses of the work memories by the application APPa. Further, by using the operation parameter read unit 61, the hardware IP 22b reads the start address of a work memory for each unit process of the hardware IP 22b and uses the address within the access permission range as the address of the work memory.
As explained above, in the semiconductor device according to the fourth embodiment, a work memory in the shared memory 21 used by the hardware IP 22b can be arbitrarily set from the application APPa. However, since the start address of the work memory is set in the shared memory 21, the operation parameter read unit 61 could read a wrong address due to a failure in the shared memory 21 or a malfunction of the application APPa. Further, when this wrong address is within the access permission range set by an MMU, there is a risk that a memory range that is permitted for access that occurs in a different frame could be corrupted (i.e., destructed). Even in such a case, in the semiconductor device according to the fourth embodiment, owing to the memory protection unit 34, the access is performed outside the access permission range set for each frame, thus preventing the memory range used in the different frame from being corrupted. In this way, the semiconductor device according to the fourth embodiment can prevent the hardware IP 22b from corrupting data stored in a memory area used in a different frame due to a malfunction of an application running on the CPU 10, hacking, or the like, while providing high flexibility in the arrangement of work memories in the shared memory 21 used by the hardware IP 22b.
Further, in the semiconductor device according to the fourth embodiment, within the memory management area that is set by the memory management unit 51 and is permitted for access that occurs in a program using the hardware IP 22b, an access permission range for the hardware IP 22b is further set. In this way, it is possible to prevent the program using the hardware IP 22b or another hardware IP used by the program using the hardware IP 22b from corrupting information in the shared memory 21.
While the invention has been described in terms of several embodiments, those skilled in the art will recognize that the invention can be practiced with various modifications within the spirit and scope of the appended claims and the invention is not limited to the examples described above.
Further, the scope of the claims is not limited by the embodiments described above.
Furthermore, it is noted that, Applicant's intent is to encompass equivalents of all claim elements, even if amended later during prosecution.
The first and second embodiments can be combined as desirable by one of ordinary skill in the art.
For example, although the above explanation is given by using a functionally-safe application and a functionally-unsafe application, the functionally-safe application and the functionally-unsafe application in the explanation can be replaced by a host OS and a guest OS, respectively.
Number | Date | Country | Kind |
---|---|---|---|
2016-101282 | May 2016 | JP | national |
2017-031933 | Feb 2017 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
5113523 | Colley | May 1992 | A |
5481734 | Yoshida | Jan 1996 | A |
6757809 | Yoshida | Jun 2004 | B1 |
7711990 | Nickolls | May 2010 | B1 |
9189247 | Gehrmann | Nov 2015 | B2 |
9524170 | Theur | Dec 2016 | B2 |
9749319 | Serebrin | Aug 2017 | B2 |
9940265 | Yun | Apr 2018 | B2 |
9954681 | Case | Apr 2018 | B2 |
10013199 | Tsirkin | Jul 2018 | B2 |
10089248 | Newman | Oct 2018 | B2 |
10101936 | Kirshenbaum | Oct 2018 | B2 |
20030101292 | Fisher | May 2003 | A1 |
20050076010 | Bass | Apr 2005 | A1 |
20080222116 | Bass | Sep 2008 | A1 |
20080244325 | Tyulenev | Oct 2008 | A1 |
20100017893 | Foley | Jan 2010 | A1 |
20100107249 | Krig | Apr 2010 | A1 |
20100214304 | Jonas | Aug 2010 | A1 |
20110078760 | De Perthuis | Mar 2011 | A1 |
20110145934 | Abramovici | Jun 2011 | A1 |
20120023311 | Yamamoto | Jan 2012 | A1 |
20130054933 | Fister et al. | Feb 2013 | A1 |
20130151567 | Ellison | Jun 2013 | A1 |
20130283391 | Mangalampalli | Oct 2013 | A1 |
20140259149 | Circello et al. | Sep 2014 | A1 |
20150015589 | Chung | Jan 2015 | A1 |
20150178090 | Theuer | Jun 2015 | A1 |
20150227414 | Varma | Aug 2015 | A1 |
20160371496 | Sell | Dec 2016 | A1 |
20170187805 | Guim Bernet | Jun 2017 | A1 |
20180157590 | Persson | Jun 2018 | A1 |
Number | Date | Country |
---|---|---|
2014-048849 | Mar 2014 | JP |
201448849 | Mar 2014 | JP |
Entry |
---|
EMMA2: a high-performance hierarchical multiprocessor; Appiani et al.; IEEE Micro, vol. 9, iss. 1, pp. 42-56; Feb. 1989 (Year: 1989). |
Partially Separated Page Tables for Efficient Operating System Assisted Hierarchical Memory Management on Heterogeneous Architectures; Gerofi et al.; 13th IEEE/ACM International Symposium on Cluster, Cloud, and Grid Computing ; May 13-16, 2013 (Year: 2013). |
A fully configurable and scalable neural coprocessor IP for SoC implementations of machine learning applications; Martinez-Corral et al.; 2017 NASA/ESA Conference on Adaptive Hardware and Systems; Jul. 24-27, 2017 (Year: 2017). |
Machine translation of Japanese unexamined publication 2014-48849 (Year: 2014). |
Extended European Search Report dated Oct. 10, 2017 in the European counterpart Patent Application No. 17168956.5. |
Number | Date | Country | |
---|---|---|---|
20170337008 A1 | Nov 2017 | US |