| 0a2d5b43 | 02-Feb-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
types: use int-ll64 for both aarch32 and aarch64
Since commit 031dbb122472 ("AArch32: Add essential Arch helpers"), it is difficult to use consistent format strings for printf() family between aarch
types: use int-ll64 for both aarch32 and aarch64
Since commit 031dbb122472 ("AArch32: Add essential Arch helpers"), it is difficult to use consistent format strings for printf() family between aarch32 and aarch64.
For example, uint64_t is defined as 'unsigned long long' for aarch32 and as 'unsigned long' for aarch64. Likewise, uintptr_t is defined as 'unsigned int' for aarch32, and as 'unsigned long' for aarch64.
A problem typically arises when you use printf() in common code.
One solution could be, to cast the arguments to a type long enough for both architectures. For example, if 'val' is uint64_t type, like this:
printf("val = %llx\n", (unsigned long long)val);
Or, somebody may suggest to use a macro provided by <inttypes.h>, like this:
printf("val = %" PRIx64 "\n", val);
But, both would make the code ugly.
The solution adopted in Linux kernel is to use the same typedefs for all architectures. The fixed integer types in the kernel-space have been unified into int-ll64, like follows:
typedef signed char int8_t; typedef unsigned char uint8_t;
typedef signed short int16_t; typedef unsigned short uint16_t;
typedef signed int int32_t; typedef unsigned int uint32_t;
typedef signed long long int64_t; typedef unsigned long long uint64_t;
[ Linux commit: 0c79a8e29b5fcbcbfd611daf9d500cfad8370fcf ]
This gets along with the codebase shared between 32 bit and 64 bit, with the data model called ILP32, LP64, respectively.
The width for primitive types is defined as follows:
ILP32 LP64 int 32 32 long 32 64 long long 64 64 pointer 32 64
'long long' is 64 bit for both, so it is used for defining uint64_t. 'long' has the same width as pointer, so for uintptr_t.
We still need an ifdef conditional for (s)size_t.
All 64 bit architectures use "unsigned long" size_t, and most 32 bit architectures use "unsigned int" size_t. H8/300, S/390 are known as exceptions; they use "unsigned long" size_t despite their architecture is 32 bit.
One idea for simplification might be to define size_t as 'unsigned long' across architectures, then forbid the use of "%z" string format. However, this would cause a distortion between size_t and sizeof() operator. We have unknowledge about the native type of sizeof(), so we need a guess of it anyway. I want the following formula to always return 1:
__builtin_types_compatible_p(size_t, typeof(sizeof(int)))
Fortunately, ARM is probably a majority case. As far as I know, all 32 bit ARM compilers use "unsigned int" size_t.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| fab2319e | 27-Nov-2017 |
Arve Hjønnevåg <arve@android.com> |
trusty: Pass cpu suspend/resume reason to trusty
Add off/on argument to SMC_FC_CPU_SUSPEND SMC_FC_CPU_RESUME and pass 1 when called from the cpu on/off hooks.
Change-Id: Ie233c446fd38b3ff8546e445a8
trusty: Pass cpu suspend/resume reason to trusty
Add off/on argument to SMC_FC_CPU_SUSPEND SMC_FC_CPU_RESUME and pass 1 when called from the cpu on/off hooks.
Change-Id: Ie233c446fd38b3ff8546e445a8d86a15d2816093 Signed-off-by: Arve Hjønnevåg <arve@android.com>
show more ...
|
| 27d8e1e7 | 28-Sep-2017 |
Arve Hjønnevåg <arve@android.com> |
trusty: Run bl33 in EL1 instead of EL2 is trusty image is 32-bit
The secure physical timer is inacessible from 32-bit S-EL1 (when EL3 is 64-bit) so trusty will use the non-secure physical timer in t
trusty: Run bl33 in EL1 instead of EL2 is trusty image is 32-bit
The secure physical timer is inacessible from 32-bit S-EL1 (when EL3 is 64-bit) so trusty will use the non-secure physical timer in this case. Linux will use the virtual timer instead of the physical timer when started in EL1.
Change-Id: Ie49348d9a27e5287676dd4a77f678ecbd6c2309f Signed-off-by: Arve Hjønnevåg <arve@android.com>
show more ...
|
| cb03c917 | 04-Aug-2015 |
Arve Hjønnevåg <arve@android.com> |
trusty: Add fpu/simd support
The original patch has been partly merged. This adds the missing pieces.
Change-Id: I77fd434feab396ff05d9b8e0c1761e4dd588a701 Signed-off-by: Arve Hjønnevåg <arve@androi
trusty: Add fpu/simd support
The original patch has been partly merged. This adds the missing pieces.
Change-Id: I77fd434feab396ff05d9b8e0c1761e4dd588a701 Signed-off-by: Arve Hjønnevåg <arve@android.com>
show more ...
|
| 61496151 | 13-May-2015 |
Arve Hjønnevåg <arve@android.com> |
trusty: Add generic-arm64 support
Add smc calls to return gic base address and print to the debug console. Allows running a generic trusty binary.
Change-Id: I4b6540f140f11432cdff43c3f5a2097df09dc9
trusty: Add generic-arm64 support
Add smc calls to return gic base address and print to the debug console. Allows running a generic trusty binary.
Change-Id: I4b6540f140f11432cdff43c3f5a2097df09dc9d1 Signed-off-by: Arve Hjønnevåg <arve@android.com>
show more ...
|
| d67d0214 | 23-Feb-2017 |
Varun Wadekar <vwadekar@nvidia.com> |
spd: trusty: support for AARCH64 mode
This patch removes support for running Trusty in the AARCH32 mode as all platforms use it in only AARCH64 mode.
Signed-off-by: Varun Wadekar <vwadekar@nvidia.c
spd: trusty: support for AARCH64 mode
This patch removes support for running Trusty in the AARCH32 mode as all platforms use it in only AARCH64 mode.
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
show more ...
|
| 8e590624 | 17-Feb-2017 |
Varun Wadekar <vwadekar@nvidia.com> |
spd: trusty: save context starting from the stack end
This patch uses the stack end to start saving the CPU context during world switch. The previous logic, used the stack start to save the context,
spd: trusty: save context starting from the stack end
This patch uses the stack end to start saving the CPU context during world switch. The previous logic, used the stack start to save the context, thus overwriting the other members of the context.
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
show more ...
|
| 0e1f9e31 | 29-Sep-2016 |
Varun Wadekar <vwadekar@nvidia.com> |
spd: trusty: add SET_ROT_PARAMS handling
If Trusty is not running on the device, then Verified Boot is not supported and the NS layer will fail gracefully later during boot. This patch just returns
spd: trusty: add SET_ROT_PARAMS handling
If Trusty is not running on the device, then Verified Boot is not supported and the NS layer will fail gracefully later during boot. This patch just returns success for the case when Trusty is not running on the device and the bootloader issues SET_ROT_PARAMS call during boot, so that we can at least boot non-Android images.
Change-Id: I40fc249983df80fb8cc5be5e4ce94c99d5b5f17d Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
show more ...
|
| feb5aa24 | 24-May-2016 |
Wayne Lin <wlin@nvidia.com> |
spd: trusty: pass boot params to the Trusted OS
This patch passes the boot parameters, provided by the previous bootloader, to the Trusted OS via X0, X1 and X2.
Original change by: Wayne Lin <wlin@
spd: trusty: pass boot params to the Trusted OS
This patch passes the boot parameters, provided by the previous bootloader, to the Trusted OS via X0, X1 and X2.
Original change by: Wayne Lin <wlin@nvidia.com>
Change-Id: I2039612a8a8226158babfd505ce8c31c4212319c Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
show more ...
|
| 64c07d0f | 20-Apr-2016 |
Anthony Zhou <anzhou@nvidia.com> |
spd: trusty: only process one function ID at a time
In multi-guest trusty environment, all guest's SMCs will be forwarded to Trusty. This change only allows 1 guest's SMC to be forwarded at a time a
spd: trusty: only process one function ID at a time
In multi-guest trusty environment, all guest's SMCs will be forwarded to Trusty. This change only allows 1 guest's SMC to be forwarded at a time and returns 'busy' status to all other requests.
Change-Id: I2144467d11e3680e28ec816adeec2766bca114d4 Signed-off-by: Anthony Zhou <anzhou@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
show more ...
|