Hi community
We have adapted the Proc class to support the IRQ on Fiasco.OC when compiling it in TrustZone Normal Side. Following the principle that in TrustZone the IRQ are used on Normal Side and the FIQ are used in Secure Side, we have only used the IRQ when compile the Fiasco.OC with TrustZone Normal Side. By default Fiasco.OC was using the IRQ and FIQ when compiling with TrustZone Normal Side. This is our patch:
diff --git a/src/kernel/fiasco/src/drivers/arm/processor-arm.cpp b/src/kernel/fiasco/src/drivers/arm/processor-arm.cpp index d9102c4..8ee9101 100644 --- a/src/kernel/fiasco/src/drivers/arm/processor-arm.cpp +++ b/src/kernel/fiasco/src/drivers/arm/processor-arm.cpp @@ -32,7 +32,7 @@ public: static Cpu_phys_id cpu_id(); };
-INTERFACE[arm && !arm_em_tz]: +INTERFACE[arm && !arm_em_tz && !arm_em_ns]:
EXTENSION class Proc { @@ -62,6 +62,22 @@ public: }; };
+INTERFACE[arm && arm_em_ns]: + +EXTENSION class Proc +{ +public: + enum : unsigned + { + Cli_mask = Status_IRQ_disabled, + Sti_mask = Status_IRQ_disabled, + Status_preempt_disabled = Status_IRQ_disabled, + Status_interrupts_mask = Status_IRQ_disabled, + Status_always_mask = 0x10 | Status_FIQ_disabled, + }; +}; + + INTERFACE[arm && !hyp]:
EXTENSION class Proc
Now when we compile Fiasco.OC and run the Hello example for Odroid-X2 using TrustZone Normal Side, it works fine. We have noted the when is compiled with TrustZone Secure Side, then only use the FIQ, but when try to run it on Odroid-X2 it fails. This is the serial output:
Boot with zImage Starting kernel ...
L4 Bootstrapper Build: #70 Thu Jun 4 23:50:31 CDT 2015, 4.8.3 20140303 (prerelease) Scanning up to 2048 MB RAM, starting at offset 32MB Memory size is 2048MB (40000000 - bfffffff) Limiting 'RAM' region [ 40000000, bfffffff] { 80000000} to [ 40000000, bcffffff] { 7d000000} due to 3024 MB address limit RAM: 0000000040000000 - 00000000bcffffff: 2048000kB Total RAM: 2000MB Scanning fiasco Scanning sigma0 Scanning moe Moving up to 5 modules behind 41100000 moving module 02 { 4107e000-410af65f } -> { 4116f000-411a065f } [202336] moving module 01 { 41074000-4107d377 } -> { 41165000-4116e377 } [37752] moving module 00 { 41043000-410732ef } -> { 41134000-411642ef } [197360] moving module 04 { 41029000-410425b3 } -> { 4111a000-411335b3 } [103860] moving module 03 { 4100f000-41028493 } -> { 41100000-41119493 } [103572] Loading fiasco Loading sigma0 Loading moe find kernel info page... found kernel info page at 0xb0002000 Regions of list 'regions' [ 40000000, 400000e3] { e4} Root mbi_rt [ 40090000, 4009681b] { 681c} Sigma0 sigma0 [ 40098000, 4009e177] { 6178} Sigma0 sigma0 [ 40140000, 4018b4ab] { 4b4ac} Root moe [ 41000000, 4100e4ff] { e500} Boot bootstrap [ 41100000, 41133fff] { 34000} Root Module [ b0001000, b0001aff] { b00} Kern fiasco [ b0002000, b003afff] { 39000} Kern fiasco API Version: (87) experimental Sigma0 config ip:40090100 sp:00000000 Roottask config ip:4014020c sp:00000000 Starting kernel fiasco at b00012c8 Hello from Startup::stage2 Per_cpu_data_alloc: (orig: 0xf002dd60-0xf002e768) Number of IRQs available at this GIC: 160 GIC: Switching IRQ 32 to secure GIC: Switching IRQ 33 to secure GIC: Switching IRQ 34 to secure GIC: Switching IRQ 35 to secure GIC: Switching IRQ 36 to secure GIC: Switching IRQ 37 to secure GIC: Switching IRQ 38 to secure GIC: Switching IRQ 39 to secure GIC: Switching IRQ 40 to secure GIC: Switching IRQ 41 to secure GIC: Switching IRQ 42 to secure GIC: Switching IRQ 43 to secure GIC: Switching IRQ 44 to secure GIC: Switching IRQ 45 to secure GIC: Switching IRQ 46 to secure GIC: Switching IRQ 47 to secure GIC: Switching IRQ 139 to secure GIC: Switching IRQ 140 to secure GIC: Switching IRQ 80 to secure GIC: Switching IRQ 74 to secure GIC: Switching IRQ 48 to secure GIC: Switching IRQ 49 to secure GIC: Switching IRQ 50 to secure GIC: Switching IRQ 51 to secure GIC: Switching IRQ 52 to secure GIC: Switching IRQ 53 to secure GIC: Switching IRQ 54 to secure GIC: Switching IRQ 55 to secure GIC: Switching IRQ 56 to secure GIC: Switching IRQ 57 to secure GIC: Switching IRQ 58 to secure GIC: Switching IRQ 59 to secure GIC: Switching IRQ 60 to secure GIC: Switching IRQ 61 to secure GIC: Switching IRQ 62 to secure GIC: Switching IRQ 63 to secure GIC: Switching IRQ 64 to secure GIC: Switching IRQ 79 to secure GIC: Switching IRQ 78 to secure GIC: Switching IRQ 9 to secure GIC: Switching IRQ 8 to secure GIC: Switching IRQ 10 to secure GIC: Switching IRQ 11 to secure
We are also interested to use Fiasco.OC for ODROID-X2 without TrustZone, in which case we must configure both IRQ and FIQ, but fails. This the serial output:
Boot with zImage Starting kernel ...
L4 Bootstrapper Build: #69 Thu Jun 4 23:44:25 CDT 2015, 4.8.3 20140303 (prerelease) Scanning up to 2048 MB RAM, starting at offset 32MB Memory size is 2048MB (40000000 - bfffffff) Limiting 'RAM' region [ 40000000, bfffffff] { 80000000} to [ 40000000, bcffffff] { 7d000000} due to 3024 MB address limit RAM: 0000000040000000 - 00000000bcffffff: 2048000kB Total RAM: 2000MB Scanning fiasco Scanning sigma0 Scanning moe Moving up to 5 modules behind 41100000 moving module 02 { 4107d000-410ae65f } -> { 4116e000-4119f65f } [202336] moving module 01 { 41073000-4107c377 } -> { 41164000-4116d377 } [37752] moving module 00 { 41043000-410729df } -> { 41134000-411639df } [195040] moving module 04 { 41029000-410425b3 } -> { 4111a000-411335b3 } [103860] moving module 03 { 4100f000-41028493 } -> { 41100000-41119493 } [103572] Loading fiasco Loading sigma0 Loading moe find kernel info page... found kernel info page at 0x40002000 Regions of list 'regions' [ 40000000, 400000e3] { e4} Root mbi_rt [ 40001000, 40001aff] { b00} Kern fiasco [ 40002000, 4003afff] { 39000} Kern fiasco [ 40090000, 4009681b] { 681c} Sigma0 sigma0 [ 40098000, 4009e177] { 6178} Sigma0 sigma0 [ 40140000, 4018b4ab] { 4b4ac} Root moe [ 41000000, 4100e4ff] { e500} Boot bootstrap [ 41100000, 41133fff] { 34000} Root Module API Version: (87) experimental Sigma0 config ip:40090100 sp:00000000 Roottask config ip:4014020c sp:00000000 Starting kernel fiasco at 400012c8 Hello from Startup::stage2 Per_cpu_data_alloc: (orig: 0xf002d7a0-0xf002e1a8) Number of IRQs available at this GIC: 160 FPU0: Arch: VFPv3(3), Part: VFPv3(30), r: 4, v: 9, i: 41, t: hard, p: dbl/sngl
KERNEL: Warning: No page-fault handler for 0xee202108, error 0x94000848, pc f002660c
Anyone know what is happening with interrupts in Exynos4412 when TrustZone is not used? Anyone have some idea?
Best regards