22 Commits

Author SHA1 Message Date
feiyuchen
9f6785063a Add SEPolicy for audio HAL to use EdgeTpu
The added policies for Audio HAL (`hal_audio_default`) are exactly the same as Camera HAL (`hal_camera_default`).

Background: Audio team is migrating audio processing offload to TPU. POR is for Android U QPR.
Design doc: https://docs.google.com/document/d/1KarcXFbfiJVxHDFgT5AYNE0-tUc0cr_63dCNK-5HQys/edit?resourcekey=0-J-4NEenhAWuoa5Ou7ZGYgw

Bug: 289466639
Change-Id: I02b7ba4e4956b0db615b21a88dc47b615cc66e44
Test: It was tested in above Bug that Audio HAL could use EdgeTpu
2023-11-08 16:58:53 +00:00
Treehugger Robot
c5c4ae5c1f Merge "Allow hal_neuralnetworks_darwinn and dba service to read DMA buf." into main 2023-10-10 23:26:20 +00:00
qinyiyan
af16ce519d Allow hal_neuralnetworks_darwinn and dba service to read DMA buf.
AVC denials seen:
avc:  denied  { read } for  name="system" dev="tmpfs" ino=592 scontext=u:r:hal_neuralnetworks_darwinn:s0 tcontext=u:object_r:dmabuf_system_heap_device:s0 tclass=chr_file permissive=0

bug: 303526151
Test: forrest build
Change-Id: I42e714908df163df6a328f451202a93fc11caeee
2023-10-05 14:13:31 -07:00
Yu-Chi Cheng
7232d53128 Added SELinux rules for vendor.darwinn.runtime. properties.
This allows DarwiNN runtime components to access related system
properties, including the ones that control host DMA-BUF allocation.

Bug: 297432189
Test: verified camera to work on local device
Change-Id: I4b3f566417445a2a0ef6eae64d9b0ed7d20ff26c
2023-09-26 20:49:42 +00:00
qinyiyan
33274eb576 Add tachyon service to the device.mk and sepolicy.
Bug: 299932913

Change-Id: Ifb8e55c07a9534ae49c96669c90357d04fb31f23
2023-09-11 14:01:16 -07:00
Renato Grottesi
146e77649b Revert^2 "New ArmNN AIDL SELinux permissions and settings"
58c26f29062fb48925f58c88aa11b25403c370c3

Compile ArmNN shim over the support library

This change adds the SELinux permissions for the new
ArmNN AIDL backend based on a shim over the NNAPI
Support Library.

Test: Local run of CtsNNAPITestCases
Test: Local run of VtsHalNeuralnetworksTargetTest
Test: Local run of MLTS Benchmark
Bug: 283724775
Change-Id: I24b69c4f6d65f45ec6935744717b66bed14cb236
2023-07-13 09:08:41 +00:00
Android Culprit Assistant
58c26f2906 Revert "New ArmNN AIDL SELinux permissions and settings"
This revert was created by Android Culprit Assistant. The culprit was identified in the following culprit search session (http://go/aca-get/123b2665-83ef-4fd0-904d-a0d8c5782db9).

Bug: b/290958543
Change-Id: I6c085728c663845efb1006e62a54482c01d500ff
2023-07-12 20:49:39 +00:00
Renato Grottesi
6deca6aed4 New ArmNN AIDL SELinux permissions and settings
Compile ArmNN shim over the support library

This change adds the SELinux permissions for the new
ArmNN AIDL backend based on a shim over the NNAPI
Support Library.

Test: Local run of CtsNNAPITestCases
Test: Local run of VtsHalNeuralnetworksTargetTest
Test: Local run of MLTS Benchmark
Bug: 283724775
Change-Id: Ie63c9adebf723c0df22c9533f46ad7475414dd3a
2023-07-12 13:08:22 +00:00
Quinn Yan
4ce2179821 Merge "Enable RT threads by default for Edgetpu DBA HAL." into udc-dev 2023-05-18 20:22:09 +00:00
Yu-Chi Cheng
708eec566d Allowed edgetpu_vendor_service to access hetero runtime system
properties.

Those properties include the one for trace level
("vendor.google.silicon.max_trace_level"), which will be used by the
edgetpu vendor service during on device compilation. This change is
required to avoid SELinux errors.

Bug: 282963211
Test: verified no avc error after this change with GCA + perfetto.
Change-Id: I66333571bc9dbbf86e033eefb1054c79b260ff67
2023-05-17 21:38:06 +00:00
qinyiyan
aaae6818d0 Enable RT threads by default for Edgetpu DBA HAL.
Bug:267379294
Test: forrest build.

Change-Id: I95d6c276bb29c8f24bbf4b672e64d78e2e073301
2023-05-11 20:43:01 +00:00
Charles Chen
29f5fc9cfe Allow nnapi for isolated_compute_app
isolated_compute_app was not able to use NNAPIv2 in Android U, so this
is a workaround to temporarily unblock the app from using hardware
acceleratetion.

Bug: 281138203
Test: Manual
Change-Id: I3c1f829b690b4ad1fe8bc43ff9435cbf62d048d4
2023-05-06 01:00:53 +00:00
Charles Chen
1d909e7e72 Allow DBA for isolated_compute_app
NNAPI will be deprecated soon so we are allowing isolated_compute_app to
access DBA access for migration.

Bug: 274535894
Test: Manual
Change-Id: Ic407a47f584307a0e6e0de36827aaa9b851aee80
2023-05-04 00:22:29 +00:00
feiyuchen
0f1433b2c8 Allow EdgeTPU DBA service to access the edgetpu_app_service
EdgeTpu DBA service calls edgetpu_app_service's UserIsAuthorized API in order to know whether its clients are authorized to use priviledge features, see code: https://source.corp.google.com/android-internal/vendor/google/darwinn2/dba/service/edgetpu_device.cpp;l=73;rcl=1c57b54efe12cdb408cb21a992155a04d151e3ce

It looks like the SELinux rule is missing today. Though I'm not sure why DBA service doesn't crash today.


Bug: 237103652
Change-Id: I8c5da7413eb6f9efc527c9f9f1d1242f0cb4dea8
2023-03-24 18:31:33 +00:00
Yu-Chi Cheng
8e965d36a2 Added the hetero runtime system property SELinux rules.
Currently, there is a hetero runtime property that darwinn
and other hetero runtime project will use: the trace level
(vendor.google.silicon.max_trace_level).

This change allows edgetpu services and clients to be able to see
that property in order to change the trace level.

Bug: 272292650
Test: verified it to build but not tested on device yet since selinux
has not been enforced yet.

Change-Id: Id6d345b92d2e710b41ca58907ad443fc2667054a
2023-03-16 14:10:10 -07:00
Richard Hsu
0b006f7129 Merge "[Flag] Update default TPU cache coherency to be enabled" into udc-dev 2023-03-13 06:27:09 +00:00
Richard Hsu
513af61761 [Flag] Update default TPU cache coherency to be enabled
The TPU cache coherency was set to false by default for testing/migration purposes. Now that the applications have been verified to work with TPU cache coherency, this CL changes the default behavior of TPU cache coherency to be enabled.

Bug: 255828212

Test:
All child bugs in b/255828212. Speech, Camera, TPU internal tests.

Change-Id: I276bb227fad352ad0a71ab2f9b771720b90bb729
2023-03-12 21:53:17 -07:00
feiyuchen
bd8d9ca737 Allow NNAPI HAL to read tflite_delegate.force_disable_io_coherency flag
The flag was added in ag/21062178.
After this CL, the flag is readable by all apps and all DarwiNN HALs.

Bug: 268548819
Change-Id: I28a185d66002f1656aeb10723c34d5eb517742c4
2023-03-07 20:53:10 +00:00
feiyuchen
a59d019822 Allow EdgeTpu service to read persist.device_config.edgetpu_native properties
Background:
Darwinn Runtime team wants to use a cloud-based infra (Android Core Experiments) to push flags from server to device. The flags will be stored into android properties under the namespace: `persist.device_config.edgetpu_native`, which has a property context called `device_config_edgetpu_native_prop` as added by the other CL: https://android-review.git.corp.google.com/c/platform/system/sepolicy/+/2434232

Change:
Allow EdgeTpu service to read device_config_edgetpu_native_prop

Test: Verified EdgeTpu has access to read the property
Bug: 243553703
Bug: 246401730
Change-Id: I19dca0e2d3008e36bdbca50f610810148a7e11dd
2023-02-15 07:19:07 +00:00
feiyuchen
1fa64096e9 Add android property vendor.edgetpu.tflite_delegate.force_disable_io_coherency
because we need it for DarwinnDelegate to forcelly disable the cache coherency feature for debugging purpose. This sys prop should be readable by all Darwinn Delegate clients, but only modifiable by `adb root`.

Test: Verified that both camera app and camera HAL can read the flag. See pending CL cl/507001854 and android_flag_permission_test.md

Bug: 262420821
Change-Id: I0ae7e02f1d4805956a05afeb92f892cbac6d5213
2023-02-03 23:44:52 +00:00
Victor Barr
810349517a Add support for dba hal in common edgetpu packages
Previously supported in some cases. Now extend it to all common cases

Bug: 263394888
Test: Built and ran DBA Hal on Android Device
Change-Id: I9a5c6a6c8d8b6c23a7d86678ecae57a9f0bcdf7a
2023-01-17 18:04:45 +00:00
Adam Shih
af0e90ecb1 centralize common settings for edgeTPU
Bug: 258114806
Test: build pass with all the things still in the ROM
Change-Id: Iafa355c047d39cfb21ef043ed0e7b4108630b781
2022-11-08 13:34:35 +08:00