From 8da32d526ded3207923d17442269d8c05e875282 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Tue, 24 Aug 2021 11:32:35 -0700 Subject: [PATCH 01/20] ANDROID: cfi: explicitly clear diag in __cfi_slowpath When CONFIG_CFI_PERMISSIVE is not set, ensure the third argument passed to __cfi_check from __cfi_slowpath is NULL to avoid an invalid memory access in __cfi_check_fail. __cfi_check_fail always traps anyway, but the error message will be less confusing with this patch. Note that kernels built with full LTO aren't affected as they always clear the argument before a __cfi_slowpath call. Later kernel versions are also not affected as they use -fno-sanitize-trap=cfi. Bug: 196763360 Change-Id: Ifa5b4e324737a3069f7a772dd9b392042ec8407e Signed-off-by: Sami Tolvanen --- kernel/cfi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/cfi.c b/kernel/cfi.c index db013eb92dd2..44b8bdaf2006 100644 --- a/kernel/cfi.c +++ b/kernel/cfi.c @@ -320,6 +320,9 @@ void cfi_slowpath_handler(uint64_t id, void *ptr, void *diag) { cfi_check_fn fn = find_check_fn((unsigned long)ptr); + if (!IS_ENABLED(CONFIG_CFI_PERMISSIVE)) + diag = NULL; + if (likely(fn)) fn(id, ptr, diag); else /* Don't allow unchecked modules */ From 2c68b9071dcd23733d848e4497eb28c7ef35df4e Mon Sep 17 00:00:00 2001 From: wangting11 Date: Fri, 27 Aug 2021 13:00:00 +0800 Subject: [PATCH 02/20] ANDROID: GKI: update xiaomi symbol list Leaf changes summary: 17 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 10 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 7 Added variables 10 Added functions: [A] 'function int __traceiter_android_rvh_check_preempt_tick(void*, task_struct*, unsigned long int*, bool*, unsigned long int, cfs_rq*, sched_entity*, unsigned int)' [A] 'function int __traceiter_android_rvh_cpuset_fork(void*, task_struct*, int*)' [A] 'function int __traceiter_android_rvh_dequeue_entity(void*, cfs_rq*, sched_entity*)' [A] 'function int __traceiter_android_rvh_enqueue_entity(void*, cfs_rq*, sched_entity*)' [A] 'function int __traceiter_android_rvh_set_cpus_allowed_comm(void*, task_struct*, const cpumask*)' [A] 'function int __traceiter_android_vh_map_util_freq(void*, unsigned long int, unsigned long int, unsigned long int, unsigned long int*, cpufreq_policy*, bool*)' [A] 'function int __traceiter_android_vh_sched_setaffinity_early(void*, task_struct*, const cpumask*, int*)' [A] 'function void cpuset_cpus_allowed(task_struct*, cpumask*)' [A] 'function const char* drm_get_connector_type_name(unsigned int)' [A] 'function int gpio_request_array(const gpio*, size_t)' 7 Added variables: [A] 'tracepoint __tracepoint_android_rvh_check_preempt_tick' [A] 'tracepoint __tracepoint_android_rvh_cpuset_fork' [A] 'tracepoint __tracepoint_android_rvh_dequeue_entity' [A] 'tracepoint __tracepoint_android_rvh_enqueue_entity' [A] 'tracepoint __tracepoint_android_rvh_set_cpus_allowed_comm' [A] 'tracepoint __tracepoint_android_vh_map_util_freq' [A] 'tracepoint __tracepoint_android_vh_sched_setaffinity_early' Bug: 197910412 Signed-off-by: ting wang Change-Id: Iadbd3477ee983c254a06956295ce0a46b6dcbf91 --- android/abi_gki_aarch64.xml | 10375 +++++++++++++++---------------- android/abi_gki_aarch64_xiaomi | 30 + 2 files changed, 5174 insertions(+), 5231 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 988fe060257c..bb7b84185652 100755 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -258,17 +258,21 @@ + + + + @@ -313,6 +317,7 @@ + @@ -409,6 +414,7 @@ + @@ -432,6 +438,7 @@ + @@ -1049,6 +1056,7 @@ + @@ -1883,6 +1891,7 @@ + @@ -2296,6 +2305,7 @@ + @@ -5352,17 +5362,21 @@ + + + + @@ -5407,6 +5421,7 @@ + @@ -5503,6 +5518,7 @@ + @@ -5529,6 +5545,7 @@ + @@ -8145,9 +8162,9 @@ - - - + + + @@ -8160,7 +8177,6 @@ - @@ -8242,7 +8258,6 @@ - @@ -8652,7 +8667,14 @@ - + + + + + + + + @@ -8660,13 +8682,6 @@ - - - - - - - @@ -11035,6 +11050,7 @@ + @@ -11386,8 +11402,8 @@ - - + + @@ -12003,7 +12019,23 @@ - + + + + + + + + + + + + + + + + + @@ -12601,6 +12633,7 @@ + @@ -14148,12 +14181,6 @@ - - - - - - @@ -14623,6 +14650,9 @@ + + + @@ -14817,7 +14847,29 @@ - + + + + + + + + + + + + + + + + + + + + + + + @@ -17675,7 +17727,6 @@ - @@ -18049,11 +18100,7 @@ - - - - - + @@ -19000,7 +19047,6 @@ - @@ -19067,7 +19113,6 @@ - @@ -19505,14 +19550,6 @@ - - - - - - - - @@ -19863,7 +19900,7 @@ - + @@ -20574,6 +20611,7 @@ + @@ -21314,6 +21352,11 @@ + + + + + @@ -23326,7 +23369,7 @@ - + @@ -23530,6 +23573,7 @@ + @@ -23834,7 +23878,23 @@ - + + + + + + + + + + + + + + + + + @@ -24477,7 +24537,7 @@ - + @@ -24826,7 +24886,6 @@ - @@ -24904,7 +24963,7 @@ - + @@ -24961,6 +25020,7 @@ + @@ -25311,6 +25371,7 @@ + @@ -26867,7 +26928,6 @@ - @@ -30547,9 +30607,9 @@ - - - + + + @@ -31434,7 +31494,6 @@ - @@ -31689,7 +31748,68 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -32193,7 +32313,6 @@ - @@ -32608,6 +32727,7 @@ + @@ -36349,7 +36469,6 @@ - @@ -37139,8 +37258,8 @@ - - + + @@ -38063,17 +38182,6 @@ - - - - - - - - - - - @@ -38352,9 +38460,9 @@ - - - + + + @@ -38860,6 +38968,7 @@ + @@ -39816,7 +39925,6 @@ - @@ -42248,15 +42356,7 @@ - - - - - - - - @@ -42593,18 +42693,7 @@ - - - - - - - - - - - - + @@ -42700,12 +42789,12 @@ - - - - - - + + + + + + @@ -42810,7 +42899,6 @@ - @@ -43552,21 +43640,21 @@ - + - + - + - + - + - + @@ -44001,7 +44089,6 @@ - @@ -45625,8 +45712,8 @@ - - + + @@ -45972,7 +46059,35 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46533,7 +46648,14 @@ - + + + + + + + + @@ -47179,11 +47301,6 @@ - - - - - @@ -47584,7 +47701,7 @@ - + @@ -47710,6 +47827,11 @@ + + + + + @@ -48015,7 +48137,7 @@ - + @@ -48160,56 +48282,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -48550,6 +48623,7 @@ + @@ -49483,7 +49557,7 @@ - + @@ -50327,26 +50401,8 @@ - - - - - - - - - - - - - - - - - - @@ -50605,26 +50661,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -50811,6 +50847,7 @@ + @@ -51400,7 +51437,23 @@ - + + + + + + + + + + + + + + + + + @@ -51762,7 +51815,6 @@ - @@ -52681,9 +52733,9 @@ - - - + + + @@ -53403,6 +53455,7 @@ + @@ -53987,7 +54040,7 @@ - + @@ -54452,7 +54505,7 @@ - + @@ -55313,26 +55366,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -56670,7 +56703,6 @@ - @@ -57133,11 +57165,6 @@ - - - - - @@ -58352,44 +58379,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -59553,65 +59543,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -60386,7 +60318,6 @@ - @@ -61322,7 +61253,17 @@ - + + + + + + + + + + + @@ -62365,7 +62306,7 @@ - + @@ -62851,10 +62792,10 @@ - - - - + + + + @@ -62904,6 +62845,12 @@ + + + + + + @@ -63163,6 +63110,7 @@ + @@ -63485,47 +63433,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -64095,11 +64003,6 @@ - - - - - @@ -65126,11 +65029,6 @@ - - - - - @@ -65583,7 +65481,7 @@ - + @@ -67151,7 +67049,7 @@ - + @@ -67427,7 +67325,6 @@ - @@ -67624,6 +67521,7 @@ + @@ -69145,14 +69043,7 @@ - - - - - - - - + @@ -69278,14 +69169,6 @@ - - - - - - - - @@ -69971,8 +69854,8 @@ - - + + @@ -70091,7 +69974,6 @@ - @@ -70757,8 +70639,8 @@ - - + + @@ -70830,6 +70712,7 @@ + @@ -71265,38 +71148,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -71407,7 +71259,7 @@ - + @@ -74097,7 +73949,6 @@ - @@ -75492,11 +75343,11 @@ - + - + @@ -76538,12 +76389,12 @@ - - - - - - + + + + + + @@ -77827,6 +77678,7 @@ + @@ -78064,7 +77916,6 @@ - @@ -78781,6 +78632,7 @@ + @@ -79592,6 +79444,7 @@ + @@ -79664,6 +79517,9 @@ + + + @@ -79680,11 +79536,6 @@ - - - - - @@ -79707,7 +79558,6 @@ - @@ -80162,7 +80012,7 @@ - + @@ -80238,14 +80088,6 @@ - - - - - - - - @@ -83163,6 +83005,7 @@ + @@ -83781,7 +83624,7 @@ - + @@ -84461,9 +84304,9 @@ - - - + + + @@ -84931,26 +84774,7 @@ - - - - - - - - - - - - - - - - - - - - + @@ -84975,7 +84799,7 @@ - + @@ -85000,6 +84824,7 @@ + @@ -85038,6 +84863,7 @@ + @@ -86407,7 +86233,7 @@ - + @@ -87037,8 +86863,8 @@ - - + + @@ -88098,7 +87924,6 @@ - @@ -88258,6 +88083,14 @@ + + + + + + + + @@ -88692,7 +88525,20 @@ - + + + + + + + + + + + + + + @@ -89249,7 +89095,7 @@ - + @@ -89329,7 +89175,7 @@ - + @@ -89624,6 +89470,7 @@ + @@ -89760,7 +89607,7 @@ - + @@ -91222,7 +91069,6 @@ - @@ -91717,17 +91563,6 @@ - - - - - - - - - - - @@ -92487,7 +92322,7 @@ - + @@ -93031,7 +92866,7 @@ - + @@ -93469,7 +93304,7 @@ - + @@ -94166,9 +94001,6 @@ - - - @@ -95403,6 +95235,7 @@ + @@ -95678,8 +95511,8 @@ - - + + @@ -95876,8 +95709,8 @@ - - + + @@ -96997,6 +96830,7 @@ + @@ -97969,7 +97803,14 @@ - + + + + + + + + @@ -99030,10 +98871,10 @@ - - - + + + @@ -99057,7 +98898,7 @@ - + @@ -99198,8 +99039,8 @@ - - + + @@ -99799,7 +99640,6 @@ - @@ -100068,6 +99908,7 @@ + @@ -100593,7 +100434,20 @@ - + + + + + + + + + + + + + + @@ -100652,6 +100506,9 @@ + + + @@ -104017,20 +103874,7 @@ - - - - - - - - - - - - - - + @@ -104365,6 +104209,7 @@ + @@ -107674,7 +107519,7 @@ - + @@ -108214,11 +108059,6 @@ - - - - - @@ -108545,6 +108385,7 @@ + @@ -110269,7 +110110,6 @@ - @@ -110354,7 +110194,6 @@ - @@ -110473,8 +110312,8 @@ - - + + @@ -111006,6 +110845,7 @@ + @@ -111962,6 +111802,17 @@ + + + + + + + + + + + @@ -112002,6 +111853,18 @@ + + + + + + + + + + + + @@ -112040,6 +111903,12 @@ + + + + + + @@ -112329,6 +112198,12 @@ + + + + + + @@ -112944,6 +112819,16 @@ + + + + + + + + + + @@ -113081,6 +112966,13 @@ + + + + + + + @@ -113695,17 +113587,21 @@ + + + + @@ -113750,6 +113646,7 @@ + @@ -113846,6 +113743,7 @@ + @@ -113872,6 +113770,7 @@ + @@ -114132,38 +114031,38 @@ - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - + + + @@ -114173,32 +114072,32 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - + + @@ -114217,8 +114116,8 @@ - - + + @@ -114234,57 +114133,57 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + @@ -114295,16 +114194,16 @@ - - + + - - + + @@ -114328,12 +114227,12 @@ - - - - - - + + + + + + @@ -114350,9 +114249,9 @@ - - - + + + @@ -114368,33 +114267,33 @@ - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + @@ -114407,22 +114306,22 @@ - - - - + + + + - - - - + + + + - - - - + + + + @@ -114496,13 +114395,13 @@ - - - - - - - + + + + + + + @@ -114511,29 +114410,29 @@ - - - + + + - - - - - - + + + + + + - - - - + + + + - - + + @@ -114575,11 +114474,11 @@ - - - - - + + + + + @@ -114599,14 +114498,14 @@ - - + + - - - - + + + + @@ -114629,27 +114528,27 @@ - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + @@ -114699,21 +114598,21 @@ - - - - - + + + + + - - - - - - + + + + + + - - + + @@ -114754,18 +114653,18 @@ - - + + - - - + + + - - - + + + @@ -114798,17 +114697,17 @@ - - - - + + + + - - - - - + + + + + @@ -114819,58 +114718,58 @@ - - - - + + + + - - + + - - - + + + - - - + + + - - + + - - - - + + + + - - + + - - + + - - + + - - - - - + + + + + - - - + + + @@ -114879,49 +114778,49 @@ - - - - + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + @@ -114931,10 +114830,10 @@ - - - - + + + + @@ -114978,17 +114877,17 @@ - - + + - - + + - - - + + + @@ -115023,10 +114922,10 @@ - - - - + + + + @@ -115058,13 +114957,13 @@ - - - + + + - - + + @@ -115095,8 +114994,8 @@ - - + + @@ -115105,8 +115004,8 @@ - - + + @@ -115128,8 +115027,8 @@ - - + + @@ -115176,8 +115075,8 @@ - - + + @@ -115199,10 +115098,10 @@ - - - - + + + + @@ -115238,9 +115137,9 @@ - - - + + + @@ -115384,16 +115283,16 @@ - - + + - - + + @@ -115423,53 +115322,53 @@ - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + @@ -115487,9 +115386,9 @@ - - - + + + @@ -115537,67 +115436,67 @@ - - - - + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + @@ -115613,16 +115512,16 @@ - - + + - - - - - - + + + + + + @@ -115643,33 +115542,33 @@ - - + + - - + + - - - + + + - - - - - + + + + + - - - - - + + + + + @@ -115679,8 +115578,8 @@ - - + + @@ -115693,8 +115592,8 @@ - - + + @@ -115764,9 +115663,9 @@ - - - + + + @@ -115781,19 +115680,19 @@ - - - + + + - - - + + + - - - + + + @@ -115825,9 +115724,9 @@ - - - + + + @@ -115905,14 +115804,14 @@ - - - + + + - - - + + + @@ -115921,65 +115820,65 @@ - - - + + + - - - - + + + + - - + + - - - - - + + + + + - - - - - + + + + + - - + + - - - - + + + + - - + + - - + + - - - + + + - - - + + + @@ -115988,19 +115887,19 @@ - - - + + + - - - + + + - - - + + + @@ -116008,35 +115907,35 @@ - - - + + + - - + + - - + + - - - + + + - - + + @@ -116153,8 +116052,8 @@ - - + + @@ -116237,28 +116136,28 @@ - - - + + + - - + + - - - - - + + + + + @@ -116273,11 +116172,11 @@ - - - - - + + + + + @@ -116289,11 +116188,11 @@ - - - - - + + + + + @@ -116312,8 +116211,8 @@ - - + + @@ -116350,10 +116249,10 @@ - - - - + + + + @@ -116391,22 +116290,22 @@ - - + + - - - - + + + + - - + + - - + + @@ -116433,22 +116332,22 @@ - - + + - - - - + + + + - - - + + + @@ -116509,8 +116408,8 @@ - - + + @@ -116521,18 +116420,18 @@ - - + + - - - + + + - - - + + + @@ -116544,8 +116443,8 @@ - - + + @@ -116561,9 +116460,9 @@ - - - + + + @@ -116596,12 +116495,12 @@ - - + + - - + + @@ -116612,23 +116511,23 @@ - - + + - - - + + + - - - - + + + + @@ -116643,9 +116542,9 @@ - - - + + + @@ -116660,8 +116559,8 @@ - - + + @@ -116681,47 +116580,52 @@ - - - + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - + - + - - - - - + + + + + + + + + + @@ -116764,12 +116668,12 @@ - - + + - - + + @@ -116798,10 +116702,10 @@ - - - - + + + + @@ -116856,42 +116760,42 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - + + - - - + + + - - - + + + - + @@ -116926,10 +116830,10 @@ - - - - + + + + @@ -116937,9 +116841,9 @@ - - - + + + @@ -116949,7 +116853,7 @@ - + @@ -116960,8 +116864,8 @@ - - + + @@ -116978,22 +116882,22 @@ - - + + - - - + + + - - - + + + @@ -117043,11 +116947,11 @@ - - - - - + + + + + @@ -117055,44 +116959,44 @@ - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - + + - - + + - - - - + + + + @@ -117107,8 +117011,8 @@ - - + + @@ -117129,18 +117033,18 @@ - - - + + + - - - + + + @@ -117165,11 +117069,11 @@ - - - - - + + + + + @@ -117179,8 +117083,8 @@ - - + + @@ -117196,18 +117100,18 @@ - - + + - - + + - - - - + + + + @@ -117238,8 +117142,8 @@ - - + + @@ -117248,7 +117152,7 @@ - + @@ -117279,11 +117183,11 @@ - - - - - + + + + + @@ -117293,25 +117197,25 @@ - - - + + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -117348,11 +117252,11 @@ - - - - - + + + + + @@ -117362,11 +117266,11 @@ - - - - - + + + + + @@ -117398,9 +117302,9 @@ - - - + + + @@ -117411,8 +117315,8 @@ - - + + @@ -117422,9 +117326,9 @@ - - - + + + @@ -117433,11 +117337,11 @@ - - - - - + + + + + @@ -117450,16 +117354,16 @@ - - + + - - + + - - + + @@ -117470,8 +117374,8 @@ - - + + @@ -117507,49 +117411,49 @@ - - + + - - - - + + + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -117571,9 +117475,9 @@ - - - + + + @@ -117586,9 +117490,9 @@ - - - + + + @@ -117610,10 +117514,10 @@ - - - - + + + + @@ -117644,15 +117548,15 @@ - - - - + + + + - - - + + + @@ -117672,8 +117576,8 @@ - - + + @@ -117689,8 +117593,8 @@ - - + + @@ -117698,13 +117602,13 @@ - - + + - - - + + + @@ -117715,9 +117619,9 @@ - - - + + + @@ -117734,16 +117638,16 @@ - - + + - - + + @@ -117759,9 +117663,9 @@ - - - + + + @@ -117846,9 +117750,9 @@ - - - + + + @@ -117861,17 +117765,17 @@ - - - - + + + + - - - - + + + + @@ -117884,9 +117788,9 @@ - - - + + + @@ -117907,11 +117811,11 @@ - - - - - + + + + + @@ -117959,20 +117863,20 @@ - - + + - - + + - - + + @@ -117985,8 +117889,8 @@ - - + + @@ -118008,12 +117912,12 @@ - - - - - - + + + + + + @@ -118022,40 +117926,40 @@ - - - + + + - - - - - - - + + + + + + + - - + + - - - + + + - - - - + + + + - - - - + + + + @@ -118090,28 +117994,28 @@ - - - + + + - - + + - - - - + + + + - - - + + + @@ -118133,10 +118037,10 @@ - - - - + + + + @@ -118158,11 +118062,11 @@ - - - - - + + + + + @@ -118185,15 +118089,15 @@ - - - + + + - - - - + + + + @@ -118210,14 +118114,14 @@ - - - + + + - - - + + + @@ -118246,22 +118150,22 @@ - - + + - - + + - - - - + + + + @@ -118284,10 +118188,10 @@ - - - - + + + + @@ -118295,15 +118199,15 @@ - - - - + + + + - - - + + + @@ -118400,11 +118304,11 @@ - - - - - + + + + + @@ -118595,29 +118499,29 @@ - - - - + + + + - - - + + + - - - - + + + + - - - - - + + + + + @@ -118627,10 +118531,10 @@ - - - - + + + + @@ -118669,14 +118573,14 @@ - - - - - - - - + + + + + + + + @@ -118689,9 +118593,9 @@ - - - + + + @@ -118724,8 +118628,8 @@ - - + + @@ -118787,14 +118691,14 @@ - - - + + + - - - + + + @@ -118802,10 +118706,10 @@ - - - - + + + + @@ -118850,15 +118754,15 @@ - - - - + + + + - - - + + + @@ -118957,16 +118861,16 @@ - - - + + + - - - - - + + + + + @@ -119016,46 +118920,46 @@ - - - + + + - - - - - + + + + + - - - - - + + + + + - - + + - - - - - + + + + + - - + + - - + + @@ -119150,9 +119054,9 @@ - - - + + + @@ -119174,17 +119078,17 @@ - - + + - - - + + + - - + + @@ -119192,15 +119096,15 @@ - - - + + + - - - - + + + + @@ -119211,34 +119115,34 @@ - - + + - - - - + + + + - - + + - - - + + + - - - - + + + + @@ -119250,9 +119154,9 @@ - - - + + + @@ -119260,8 +119164,8 @@ - - + + @@ -119272,15 +119176,15 @@ - + - - - - - - + + + + + + @@ -119292,13 +119196,13 @@ - - - - + + + + - - + + @@ -119318,10 +119222,10 @@ - - - - + + + + @@ -119471,46 +119375,46 @@ - - - + + + - - - + + + - - + + - - - - - + + + + + - - + + - - - + + + - - - - + + + + - - - - - + + + + + @@ -119643,8 +119547,8 @@ - - + + @@ -119677,16 +119581,16 @@ - - + + - - + + - - + + @@ -119698,16 +119602,16 @@ - - + + - - + + @@ -119723,9 +119627,9 @@ - - - + + + @@ -119735,62 +119639,62 @@ - - + + - - - + + + - - + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + @@ -119808,14 +119712,14 @@ - - - + + + - - - + + + @@ -119850,13 +119754,13 @@ - - - - - - - + + + + + + + @@ -120080,62 +119984,62 @@ - - + + - - - + + + - - + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + @@ -120151,15 +120055,15 @@ - - + + - - - - - + + + + + @@ -120170,10 +120074,10 @@ - - - - + + + + @@ -120202,8 +120106,8 @@ - - + + @@ -120211,9 +120115,9 @@ - - - + + + @@ -120250,9 +120154,9 @@ - - - + + + @@ -120261,8 +120165,8 @@ - - + + @@ -120270,19 +120174,19 @@ - - - - - + + + + + - - - - - - + + + + + + @@ -120290,16 +120194,16 @@ - - + + - - + + - - + + @@ -120312,17 +120216,17 @@ - - + + - - + + - - - + + + @@ -120369,19 +120273,19 @@ - - - - - - - + + + + + + + - - - + + + @@ -120389,17 +120293,17 @@ - - - + + + - - + + @@ -120417,20 +120321,20 @@ - - + + - - + + - - + + @@ -120443,11 +120347,11 @@ - - - - - + + + + + @@ -120458,33 +120362,33 @@ - - - + + + - - - - + + + + - - - - + + + + - - + + - - + + @@ -120759,23 +120663,23 @@ - - + + - - - - + + + + - - - + + + @@ -120791,12 +120695,12 @@ - - - - - - + + + + + + @@ -120848,20 +120752,20 @@ - - + + - - - - + + + + - - - - + + + + @@ -120985,10 +120889,10 @@ - - - - + + + + @@ -121033,9 +120937,9 @@ - - - + + + @@ -121160,19 +121064,23 @@ - - - + + + + + + + - - - + + + - - - + + + @@ -121273,8 +121181,8 @@ - - + + @@ -121296,9 +121204,9 @@ - - - + + + @@ -121326,8 +121234,8 @@ - - + + @@ -121342,24 +121250,24 @@ - - + + - - - + + + - - - - + + + + - - - + + + @@ -121378,9 +121286,9 @@ - - - + + + @@ -121388,18 +121296,18 @@ - - + + - - - + + + - - - + + + @@ -121420,9 +121328,9 @@ - - - + + + @@ -121448,89 +121356,89 @@ - - + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - + + - - - - + + + + - - - - + + + + @@ -121582,17 +121490,17 @@ - - + + - - + + - - - + + + @@ -121606,20 +121514,20 @@ - - + + - - + + - - + + @@ -121684,9 +121592,9 @@ - - - + + + @@ -121694,52 +121602,52 @@ - - + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -121750,9 +121658,9 @@ - - - + + + @@ -121760,10 +121668,10 @@ - - - - + + + + @@ -121777,30 +121685,30 @@ - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + @@ -121836,8 +121744,8 @@ - - + + @@ -121913,20 +121821,20 @@ - - + + - - - - - - - - - - + + + + + + + + + + @@ -121935,19 +121843,19 @@ - - - + + + - - - - + + + + - - - + + + @@ -121974,24 +121882,24 @@ - - - - + + + + - - + + - - - - + + + + @@ -122230,8 +122138,8 @@ - - + + @@ -122245,13 +122153,13 @@ - - + + - - - + + + @@ -122290,14 +122198,14 @@ - - - + + + - - - + + + @@ -122305,17 +122213,17 @@ - - - - + + + + - - + + @@ -122330,9 +122238,9 @@ - - - + + + @@ -122346,50 +122254,50 @@ - - - - + + + + - - + + - - + + - - + + - - - - + + + + - - - - + + + + - - + + - - - + + + - - + + @@ -122399,15 +122307,15 @@ - - - + + + - - - - + + + + @@ -122429,27 +122337,27 @@ - - - - + + + + - - - - - + + + + + - - - + + + - - + + @@ -122463,9 +122371,9 @@ - - - + + + @@ -122474,30 +122382,30 @@ - - - + + + - - + + - - - + + + - - - - + + + + - - - - + + + + @@ -122513,26 +122421,26 @@ - - + + - - - + + + - - + + - - - + + + @@ -122549,8 +122457,8 @@ - - + + @@ -122565,8 +122473,8 @@ - - + + @@ -122614,18 +122522,18 @@ - - - + + + - - + + - - - + + + @@ -122633,13 +122541,13 @@ - - + + - - - + + + @@ -122647,9 +122555,9 @@ - - - + + + @@ -122707,8 +122615,8 @@ - - + + @@ -122727,8 +122635,8 @@ - - + + @@ -122771,12 +122679,12 @@ - - + + - - + + @@ -122813,35 +122721,35 @@ - - + + - - - + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + @@ -122853,13 +122761,13 @@ - - - + + + - - + + @@ -122902,33 +122810,33 @@ - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + @@ -122949,8 +122857,8 @@ - - + + @@ -122975,10 +122883,10 @@ - - - - + + + + @@ -122988,12 +122896,12 @@ - - + + - - + + @@ -123004,17 +122912,17 @@ - - - - - - - + + + + + + + - - + + @@ -123031,8 +122939,8 @@ - - + + @@ -123058,15 +122966,15 @@ - - + + - - - - - + + + + + @@ -123078,8 +122986,8 @@ - - + + @@ -123105,8 +123013,8 @@ - - + + @@ -123116,20 +123024,20 @@ - - + + - + - - - + + + @@ -123143,41 +123051,41 @@ - - - - + + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - - + + + @@ -123187,13 +123095,13 @@ - - + + - - - + + + @@ -123207,41 +123115,41 @@ - - - - - - + + + + + + - - + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + @@ -123251,8 +123159,8 @@ - - + + @@ -123264,18 +123172,18 @@ - - + + - - - - + + + + @@ -123299,19 +123207,19 @@ - - - + + + - - - + + + - - - + + + @@ -123324,34 +123232,39 @@ - - - + + + - - - - + + + - - + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + @@ -123384,9 +123297,9 @@ - - - + + + @@ -123395,13 +123308,13 @@ - - + + - - - + + + @@ -123490,8 +123403,8 @@ - - + + @@ -123516,13 +123429,13 @@ - - - + + + - - + + @@ -123567,27 +123480,27 @@ - - + + - + - - - + + + - - + + - - + + @@ -123638,38 +123551,38 @@ - - - - + + + + - - - - - - - - + + + + + + + + - - + + - - + + - + - - + + @@ -123680,38 +123593,38 @@ - - - - + + + + - - + + - - - + + + - - + + - - - - - + + + + + - - - - + + + + @@ -123726,28 +123639,28 @@ - - - - - + + + + + - - + + - - - - - + + + + + - - - - + + + + @@ -123769,18 +123682,18 @@ - - + + - - + + - - + + @@ -123803,12 +123716,12 @@ - - + + - - + + @@ -123845,9 +123758,9 @@ - - - + + + @@ -123882,81 +123795,81 @@ - - - + + + - - - + + + - - - - + + + + - - - - - - + + + + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -124081,12 +123994,12 @@ - - + + - - + + @@ -124129,14 +124042,14 @@ - - + + - - - - + + + + @@ -124157,36 +124070,36 @@ - - - - - + + + + + - - + + - - - + + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -124197,39 +124110,39 @@ - - + + - - - + + + - - - - + + + + - - - + + + - - + + - - - + + + - - - - + + + + @@ -124255,14 +124168,14 @@ - - + + - - - - + + + + @@ -124279,8 +124192,8 @@ - - + + @@ -124360,14 +124273,14 @@ - - - - - - - - + + + + + + + + @@ -124398,9 +124311,9 @@ - - - + + + @@ -124420,18 +124333,18 @@ - - - - + + + + - - - + + + @@ -124439,18 +124352,18 @@ - - - - - - + + + + + + - - - + + + @@ -124460,8 +124373,8 @@ - - + + @@ -124476,8 +124389,8 @@ - - + + @@ -124492,8 +124405,8 @@ - - + + @@ -124526,20 +124439,20 @@ - - + + - - + + - - + + @@ -124566,12 +124479,12 @@ - - + + - - + + @@ -124579,34 +124492,34 @@ - - + + - - - + + + - - - - + + + + - - - - + + + + - - - + + + - - + + @@ -124688,9 +124601,9 @@ - - - + + + @@ -124851,29 +124764,29 @@ - - - + + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -124881,47 +124794,47 @@ - - - - - + + + + + - - - - + + + + - - + + - - + + - - - - - - + + + + + + - - - - - + + + + + @@ -124956,8 +124869,8 @@ - - + + @@ -125057,13 +124970,13 @@ - - - + + + - - + + @@ -125074,15 +124987,15 @@ - - - - - - - - - + + + + + + + + + @@ -125118,9 +125031,9 @@ - - - + + + @@ -125144,21 +125057,21 @@ - - - - + + + + - - - - + + + + - - - + + + @@ -125171,10 +125084,10 @@ - - - - + + + + @@ -125182,11 +125095,11 @@ - - - - - + + + + + @@ -125209,10 +125122,10 @@ - - - - + + + + @@ -125225,20 +125138,20 @@ - - - + + + - - - - + + + + - + - - + + @@ -125248,9 +125161,9 @@ - - - + + + @@ -125339,14 +125252,14 @@ - - - + + + - - + + @@ -125422,8 +125335,8 @@ - - + + @@ -125433,66 +125346,66 @@ - - + + - - - - - - - - - + + + + + + + + + - - + + - - - - - - - - - + + + + + + + + + - - + + - - + + - - + + - - + + - + - - - - + + + + @@ -125512,21 +125425,21 @@ - - - - + + + + - - - + + + - - - - + + + + @@ -125537,23 +125450,23 @@ - - - - - - - - + + + + + + + + - - + + - - - + + + @@ -125562,10 +125475,10 @@ - - - - + + + + @@ -125597,46 +125510,46 @@ - - - - + + + + - - - + + + - - + + - - + + - - - + + + - - - - - + + + + + - - + + - - - + + + @@ -125645,31 +125558,31 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - + + @@ -125678,23 +125591,23 @@ - - - + + + - - - + + + - - - + + + @@ -125702,34 +125615,34 @@ - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - - + + + + + @@ -125739,10 +125652,10 @@ - - - - + + + + @@ -125758,10 +125671,10 @@ - - - - + + + + @@ -125771,10 +125684,10 @@ - - - - + + + + @@ -125784,37 +125697,37 @@ - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + @@ -125825,9 +125738,9 @@ - - - + + + @@ -125838,11 +125751,11 @@ - - - - - + + + + + @@ -125874,11 +125787,11 @@ - - + + - + @@ -125895,15 +125808,15 @@ - - + + - - + + - - + + @@ -125923,8 +125836,8 @@ - - + + @@ -125934,8 +125847,8 @@ - - + + @@ -125947,8 +125860,8 @@ - - + + @@ -125962,18 +125875,18 @@ - - - + + + - - - - + + + + - - + + @@ -125981,10 +125894,10 @@ - - - - + + + + @@ -125997,14 +125910,14 @@ - - - - + + + + - - + + @@ -126035,22 +125948,22 @@ - - - + + + - - - + + + - - + + @@ -126061,29 +125974,29 @@ - - - - + + + + - - - - - + + + + + - - + + - - - + + + - - + + @@ -126102,11 +126015,11 @@ - - - - - + + + + + @@ -126114,8 +126027,8 @@ - - + + @@ -126133,11 +126046,11 @@ - - - - - + + + + + @@ -126165,21 +126078,21 @@ - - - + + + - - - - + + + + - - - - + + + + @@ -126192,9 +126105,9 @@ - - - + + + @@ -126205,13 +126118,13 @@ - - + + - - - + + + @@ -126219,50 +126132,50 @@ - - - + + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - - + + + @@ -126276,8 +126189,8 @@ - - + + @@ -126348,9 +126261,9 @@ - - - + + + @@ -126384,12 +126297,12 @@ - - + + - - - + + + @@ -126398,17 +126311,17 @@ - - - + + + - - - + + + - + @@ -126419,9 +126332,9 @@ - - - + + + @@ -126486,10 +126399,10 @@ - - - - + + + + @@ -126517,13 +126430,13 @@ - - - - - - - + + + + + + + @@ -126710,12 +126623,12 @@ - - + + - - + + @@ -126727,11 +126640,11 @@ - - - - - + + + + + @@ -126772,8 +126685,8 @@ - - + + @@ -126826,8 +126739,8 @@ - - + + @@ -126839,9 +126752,9 @@ - - - + + + @@ -126852,28 +126765,28 @@ - - - + + + - - - - - - + + + + + + - - + + - - - - - + + + + + @@ -126884,9 +126797,9 @@ - - - + + + @@ -126947,8 +126860,8 @@ - - + + @@ -126987,9 +126900,9 @@ - - - + + + @@ -127045,8 +126958,8 @@ - - + + @@ -127099,51 +127012,51 @@ - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - - - - + + + + + @@ -127151,18 +127064,18 @@ - - - - + + + + - - + + @@ -127170,14 +127083,14 @@ - - - - + + + + - - - + + + @@ -127208,17 +127121,17 @@ - - + + - - - + + + @@ -127228,9 +127141,9 @@ - - - + + + @@ -127272,12 +127185,12 @@ - - + + - - + + @@ -127291,67 +127204,67 @@ - - - + + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + @@ -127359,19 +127272,19 @@ - - + + - - + + - - - - - + + + + + @@ -127382,41 +127295,41 @@ - - - - + + + + - - - + + + - - + + - - - - - + + + + + - - + + - - + + @@ -127425,16 +127338,16 @@ - - - - + + + + - - - - + + + + @@ -127455,11 +127368,11 @@ - - - - - + + + + + @@ -127476,24 +127389,24 @@ - - - - + + + + - - - - - + + + + + - - - - - + + + + + @@ -127528,12 +127441,12 @@ - - + + - - + + @@ -127558,18 +127471,18 @@ - - - + + + - - + + - - - + + + @@ -127593,18 +127506,18 @@ - - - - - + + + + + - - - - - + + + + + @@ -127615,19 +127528,19 @@ - - - - + + + + - - + + - - - + + + @@ -127646,14 +127559,14 @@ - - - + + + - - - + + + @@ -127679,9 +127592,9 @@ - - - + + + @@ -127694,14 +127607,14 @@ - - - - + + + + - - + + @@ -127719,39 +127632,39 @@ - - + + - - - + + + - - - - - + + + + + - - - + + + - - - - - + + + + + @@ -127764,9 +127677,9 @@ - - - + + + @@ -127799,14 +127712,14 @@ - - - - + + + + - - + + @@ -127817,44 +127730,44 @@ - - - - + + + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + + @@ -127888,16 +127801,16 @@ - - - - - - + + + + + + - - - + + + @@ -127905,9 +127818,9 @@ - - - + + + @@ -127944,33 +127857,33 @@ - - - + + + - - - + + + - - + + - - + + - - - + + + - - - - + + + + @@ -127995,9 +127908,9 @@ - - - + + + @@ -128013,32 +127926,32 @@ - - - - + + + + - - + + - - + + - - - + + + - - - + + + - - - + + + @@ -128047,9 +127960,9 @@ - - - + + + @@ -128057,74 +127970,74 @@ - - - + + + - - + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - + + - - + + - - - - + + + + @@ -128136,38 +128049,38 @@ - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + @@ -128182,8 +128095,8 @@ - - + + @@ -128199,8 +128112,8 @@ - - + + @@ -128214,61 +128127,61 @@ - - - - - + + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - + + + + @@ -128286,12 +128199,12 @@ - - - - - - + + + + + + @@ -128302,12 +128215,12 @@ - - - - - - + + + + + + @@ -128322,9 +128235,9 @@ - - - + + + @@ -128337,15 +128250,15 @@ - - + + - - - - - + + + + + @@ -128362,10 +128275,10 @@ - - - - + + + + @@ -128380,10 +128293,10 @@ - - - - + + + + @@ -128402,8 +128315,8 @@ - - + + @@ -128414,8 +128327,8 @@ - - + + @@ -128522,25 +128435,25 @@ - - + + - - - - - - + + + + + + - - - + + + - - + + @@ -128566,8 +128479,8 @@ - - + + @@ -128582,16 +128495,16 @@ - - + + - - + + - - + + @@ -128676,19 +128589,19 @@ - - - + + + - - - + + + - - - + + + @@ -128703,8 +128616,8 @@ - - + + @@ -128735,9 +128648,9 @@ - - - + + + @@ -128767,14 +128680,14 @@ - - - + + + - - - + + + @@ -128787,9 +128700,9 @@ - - - + + + @@ -128797,10 +128710,10 @@ - - - - + + + + @@ -128814,12 +128727,12 @@ - - + + - - + + @@ -128840,9 +128753,9 @@ - - - + + + @@ -128854,9 +128767,9 @@ - - - + + + @@ -128900,8 +128813,8 @@ - - + + @@ -128938,9 +128851,9 @@ - - - + + + @@ -128956,10 +128869,10 @@ - - - - + + + + @@ -128980,10 +128893,10 @@ - - - - + + + + @@ -129016,17 +128929,17 @@ - - + + - - - + + + @@ -129040,40 +128953,40 @@ - - + + - - + + - - - - - + + + + + - - - + + + - - - + + + - - + + - - + + - - + + @@ -129095,20 +129008,20 @@ - - - - - - + + + + + + - - + + - - + + @@ -129116,21 +129029,21 @@ - - - - - + + + + + - - - - - + + + + + - - + + @@ -129141,7 +129054,7 @@ - + @@ -129160,21 +129073,21 @@ - - - - + + + + - - - - - - - - - + + + + + + + + + @@ -129201,8 +129114,8 @@ - - + + @@ -129222,9 +129135,9 @@ - - - + + + @@ -129232,23 +129145,23 @@ - - - + + + - - - + + + - - - + + + @@ -129265,31 +129178,31 @@ - - + + - - - + + + - - + + - - - - + + + + @@ -129299,11 +129212,11 @@ - - - - - + + + + + @@ -129354,10 +129267,10 @@ - - - - + + + + @@ -129416,24 +129329,24 @@ - - + + - - + + - - + + @@ -129443,11 +129356,11 @@ - - - - - + + + + + @@ -129492,14 +129405,14 @@ - - - - + + + + - - - + + + @@ -129726,8 +129639,8 @@ - - + + @@ -129747,29 +129660,29 @@ - - - + + + - - + + - - + + - - + + - - + + - - + + @@ -129781,14 +129694,14 @@ - - - + + + - - - + + + @@ -129801,16 +129714,16 @@ - - - - + + + + - - - - + + + + @@ -129847,12 +129760,12 @@ - - + + - - + + @@ -129894,24 +129807,24 @@ - - + + - - + + - - + + - - + + @@ -129931,13 +129844,13 @@ - - + + - - - + + + @@ -129951,18 +129864,19 @@ - - - - + + + + - - - - + + + + + @@ -129976,8 +129890,8 @@ - - + + @@ -129991,8 +129905,8 @@ - - + + @@ -130026,8 +129940,8 @@ - - + + @@ -130045,10 +129959,10 @@ - - - - + + + + @@ -130061,54 +129975,54 @@ - - + + - - - + + + - - + + - + - + - - - - + + + + - - - - + + + + - - - - - - - - - + + + + + + + + + - - + + - - + + @@ -130117,36 +130031,36 @@ - - - - - + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + @@ -130157,12 +130071,12 @@ - - - - - - + + + + + + @@ -130181,9 +130095,9 @@ - - - + + + @@ -130193,8 +130107,8 @@ - - + + @@ -130208,19 +130122,19 @@ - - - - + + + + - - - + + + - - + + @@ -130273,11 +130187,11 @@ - - - - - + + + + + @@ -130293,20 +130207,20 @@ - - + + - - + + - - + + @@ -130314,20 +130228,20 @@ - - + + - - + + - - + + @@ -130383,8 +130297,8 @@ - - + + @@ -130394,21 +130308,21 @@ - - - - - + + + + + - - - - + + + + @@ -130422,24 +130336,24 @@ - - - + + + - - + + - - - - + + + + - - - + + + @@ -130467,38 +130381,38 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + @@ -130507,7 +130421,7 @@ - + @@ -130547,17 +130461,17 @@ - + - + - - + + @@ -130576,8 +130490,8 @@ - - + + @@ -130604,31 +130518,31 @@ - - + + - - - - + + + + - - - + + + - - - + + + @@ -130688,8 +130602,8 @@ - - + + @@ -130730,16 +130644,16 @@ - - + + - - + + - - + + @@ -130750,8 +130664,8 @@ - - + + @@ -130770,12 +130684,12 @@ - - + + - - + + @@ -130791,8 +130705,8 @@ - - + + @@ -130911,10 +130825,10 @@ - - - - + + + + @@ -130923,20 +130837,20 @@ - - - - - - - - + + + + + + + + - - - - + + + + @@ -130944,14 +130858,14 @@ - - - + + + - - - + + + @@ -130969,8 +130883,8 @@ - - + + @@ -130982,8 +130896,8 @@ - - + + @@ -131020,8 +130934,8 @@ - - + + @@ -131072,22 +130986,22 @@ - - - - + + + + - - - - + + + + - - - - + + + + @@ -131173,8 +131087,8 @@ - - + + @@ -131182,22 +131096,22 @@ - - + + - - - - - - + + + + + + - - - - + + + + @@ -131210,9 +131124,9 @@ - - - + + + @@ -131220,9 +131134,9 @@ - - - + + + @@ -131270,13 +131184,13 @@ - - - - - - - + + + + + + + @@ -131284,28 +131198,28 @@ - - + + - - + + - - + + - - + + - - + + @@ -131321,20 +131235,20 @@ - - - - - - + + + + + + - - - + + + - - + + @@ -131350,8 +131264,8 @@ - - + + @@ -131368,8 +131282,8 @@ - - + + @@ -131382,15 +131296,15 @@ - - - + + + - - - - + + + + @@ -131398,39 +131312,39 @@ - - - + + + - - - - + + + + - - + + - - - + + + - - - - + + + + - - - + + + - - - + + + @@ -131438,30 +131352,30 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - + + @@ -131588,8 +131502,8 @@ - - + + @@ -131708,12 +131622,12 @@ - - + + - - + + @@ -131725,14 +131639,14 @@ - - - + + + - - - + + + @@ -131740,9 +131654,9 @@ - - - + + + @@ -131767,12 +131681,12 @@ - - + + - - + + @@ -131790,10 +131704,10 @@ - - - - + + + + @@ -131810,62 +131724,62 @@ - - - - + + + + - - - + + + - - + + - - - - - - + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + @@ -131876,7 +131790,7 @@ - + @@ -131910,10 +131824,10 @@ - - - - + + + + @@ -131955,7 +131869,7 @@ - + @@ -131963,34 +131877,34 @@ - - + + - - + + - - + + - - - - - - + + + + + + - - - - + + + + - - + + @@ -132001,10 +131915,10 @@ - - - - + + + + @@ -132014,8 +131928,8 @@ - - + + @@ -132026,8 +131940,8 @@ - - + + @@ -132065,8 +131979,8 @@ - - + + @@ -132104,14 +132018,14 @@ - - - - - + + + + + - - + + @@ -132145,11 +132059,11 @@ - - - - - + + + + + @@ -132261,21 +132175,21 @@ - - + + - - - + + + - - + + - - + + @@ -132309,11 +132223,11 @@ - - - - - + + + + + @@ -132328,21 +132242,21 @@ - - + + - - + + - - + + - - - + + + @@ -132358,11 +132272,11 @@ - - - - - + + + + + @@ -132396,21 +132310,21 @@ - - - - + + + + - - - - + + + + - - - + + + @@ -132431,26 +132345,26 @@ - - - - + + + + - - - + + + - - - - - + + + + + - - - + + + @@ -132459,20 +132373,20 @@ - - - + + + - - - + + + - - - + + + @@ -132482,26 +132396,26 @@ - - - + + + - - - + + + - - - - + + + + - - - - + + + + @@ -132615,9 +132529,9 @@ - - - + + + @@ -132626,9 +132540,9 @@ - - - + + + @@ -132636,21 +132550,21 @@ - - + + - - - - + + + + - - + + - - + + @@ -132658,15 +132572,15 @@ - - - + + + - - - - + + + + @@ -132678,33 +132592,33 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + - - - + + + @@ -132712,28 +132626,28 @@ - - - + + + - - - - - + + + + + - - + + - - - + + + - - + + @@ -132744,13 +132658,13 @@ - - - - - - - + + + + + + + @@ -132782,10 +132696,10 @@ - - - - + + + + @@ -132793,10 +132707,10 @@ - - - - + + + + @@ -132804,10 +132718,10 @@ - - - - + + + + @@ -132830,10 +132744,10 @@ - - - - + + + + @@ -132849,29 +132763,29 @@ - + - - + + - - + + - - - - + + + + - - - - - - + + + + + + @@ -132900,13 +132814,13 @@ - - - - - - - + + + + + + + @@ -132925,10 +132839,10 @@ - - - - + + + + @@ -132945,10 +132859,10 @@ - - - - + + + + @@ -132958,30 +132872,30 @@ - - - + + + - - - - - - + + + + + + - - + + - - - - - - - + + + + + + + @@ -132998,13 +132912,13 @@ - - + + - - - + + + @@ -133023,39 +132937,39 @@ - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - + + @@ -133072,55 +132986,55 @@ - - - - - + + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + @@ -133130,9 +133044,9 @@ - - - + + + @@ -133142,16 +133056,16 @@ - - - - - + + + + + - - - + + + @@ -133186,15 +133100,15 @@ - - - + + + - - - - + + + + @@ -133207,11 +133121,11 @@ - - - - - + + + + + @@ -133221,11 +133135,11 @@ - - - - - + + + + + @@ -133235,8 +133149,8 @@ - - + + @@ -133248,25 +133162,25 @@ - - + + - - + + - - - - - - - + + + + + + + - - + + @@ -133277,9 +133191,9 @@ - - - + + + @@ -133367,22 +133281,22 @@ - - - - - + + + + + - - - - - + + + + + - - + + @@ -133461,13 +133375,13 @@ - - + + - - - + + + @@ -133519,8 +133433,8 @@ - - + + @@ -133536,9 +133450,9 @@ - - - + + + @@ -133548,17 +133462,17 @@ - - - - + + + + - - - - - + + + + + @@ -133575,17 +133489,17 @@ - - + + - - - - - - - + + + + + + + @@ -133594,23 +133508,23 @@ - - + + - - - - + + + + - - - + + + - - + + @@ -133621,12 +133535,12 @@ - - - - - - + + + + + + @@ -133638,8 +133552,8 @@ - - + + @@ -133651,18 +133565,18 @@ - - - - - - + + + + + + - - - - + + + + @@ -133670,12 +133584,12 @@ - - + + - - + + @@ -133713,9 +133627,9 @@ - - - + + + @@ -133727,8 +133641,8 @@ - - + + @@ -133760,45 +133674,45 @@ - - - + + + - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + @@ -133843,9 +133757,9 @@ - - - + + + @@ -133876,10 +133790,10 @@ - - - - + + + + @@ -133971,14 +133885,14 @@ - - - - + + + + - - + + @@ -133996,8 +133910,8 @@ - - + + @@ -134242,9 +134156,9 @@ - - - + + + @@ -134333,9 +134247,9 @@ - - - + + + @@ -134356,13 +134270,13 @@ - - - - - - - + + + + + + + @@ -134374,29 +134288,29 @@ - - - + + + - - + + - - + + - - - - - - + + + + + + - - + + @@ -134454,9 +134368,9 @@ - - - + + + @@ -134468,9 +134382,9 @@ - - - + + + @@ -134594,9 +134508,9 @@ - - - + + + @@ -134622,30 +134536,30 @@ - - + + - - + + - - + + - - - - + + + + - - - - - - + + + + + + @@ -134662,9 +134576,9 @@ - - - + + + @@ -134682,8 +134596,8 @@ - - + + @@ -134718,10 +134632,10 @@ - - - - + + + + @@ -134730,21 +134644,21 @@ - - - - + + + + - - - + + + - - - - + + + + @@ -134752,21 +134666,21 @@ - - - - + + + + - - - - - + + + + + - - - + + + @@ -134785,12 +134699,12 @@ - - - + + + - - + + @@ -134805,26 +134719,26 @@ - - + + - - + + - - + + - + - + @@ -134836,12 +134750,12 @@ - - + + - - + + @@ -134856,23 +134770,23 @@ - - + + - - + + - - - + + + - + - + @@ -134891,15 +134805,15 @@ - - - + + + - - - - + + + + @@ -134912,20 +134826,20 @@ - - - + + + - - - - + + + + - - - + + + @@ -134947,9 +134861,9 @@ - - - + + + @@ -134958,10 +134872,10 @@ - - - - + + + + @@ -134969,9 +134883,9 @@ - - - + + + @@ -134979,9 +134893,9 @@ - - - + + + @@ -134990,17 +134904,17 @@ - - - - + + + + - + @@ -135012,8 +134926,8 @@ - - + + @@ -135113,8 +135027,8 @@ - - + + @@ -135123,8 +135037,8 @@ - - + + @@ -135156,19 +135070,19 @@ - - - - - - - - - + + + + + + + + + - - + + @@ -135180,9 +135094,9 @@ - - - + + + @@ -135201,14 +135115,14 @@ - - - - + + + + - - + + @@ -135236,9 +135150,9 @@ - - - + + + @@ -135252,7 +135166,6 @@ - @@ -135274,19 +135187,19 @@ - - + + - - - - + + + + - - - + + + @@ -135304,8 +135217,8 @@ - - + + @@ -135315,24 +135228,24 @@ - - - - - + + + + + - - - - + + + + - - - - - + + + + + @@ -135342,26 +135255,26 @@ - - - - + + + + - - - + + + - - - + + + - - - + + + @@ -135384,12 +135297,12 @@ - + - - - + + + @@ -135510,10 +135423,10 @@ - - - - + + + + @@ -135521,10 +135434,10 @@ - - - - + + + + @@ -135603,19 +135516,19 @@ - - - + + + - - - + + + - - - + + + @@ -135645,8 +135558,8 @@ - - + + @@ -135664,8 +135577,8 @@ - - + + @@ -135679,14 +135592,14 @@ - - - + + + - - - + + + @@ -135720,9 +135633,9 @@ - - - + + + @@ -135813,11 +135726,11 @@ - - - - - + + + + + @@ -136045,9 +135958,9 @@ - - - + + + @@ -136165,15 +136078,15 @@ - - + + - - - - - + + + + + @@ -136207,8 +136120,8 @@ - - + + @@ -136243,17 +136156,17 @@ - - + + - - + + - - - + + + @@ -136264,8 +136177,8 @@ - - + + @@ -136292,12 +136205,12 @@ - - + + - - + + @@ -136320,8 +136233,8 @@ - - + + @@ -136343,8 +136256,8 @@ - - + + @@ -136375,9 +136288,9 @@ - - - + + + @@ -136400,9 +136313,9 @@ - - - + + + @@ -136417,12 +136330,12 @@ - - + + - - + + @@ -136441,8 +136354,8 @@ - - + + @@ -136457,16 +136370,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -136500,8 +136413,8 @@ - - + + @@ -136519,9 +136432,9 @@ - - - + + + @@ -136533,9 +136446,9 @@ - - - + + + @@ -136554,24 +136467,24 @@ - - - + + + - - - - + + + + - - - + + + @@ -136593,8 +136506,8 @@ - - + + @@ -136613,9 +136526,9 @@ - - - + + + @@ -136624,28 +136537,28 @@ - - - - + + + + - - + + - - + + - - - + + + - - - + + + @@ -136654,14 +136567,14 @@ - - - - + + + + - - + + @@ -136672,9 +136585,9 @@ - - - + + + @@ -136700,8 +136613,8 @@ - - + + @@ -136798,15 +136711,15 @@ - - - + + + - - - - + + + + @@ -136818,8 +136731,8 @@ - - + + @@ -136863,14 +136776,14 @@ - - + + - - - - + + + + @@ -136894,30 +136807,30 @@ - - + + - - + + - - - + + + - - - + + + - - + + @@ -136937,9 +136850,9 @@ - - - + + + @@ -136947,8 +136860,8 @@ - - + + @@ -136974,9 +136887,9 @@ - - - + + + @@ -136997,10 +136910,10 @@ - - - - + + + + @@ -137050,9 +136963,9 @@ - - - + + + @@ -137112,21 +137025,21 @@ - - - + + + - - - - - - + + + + + + - - + + @@ -137317,10 +137230,10 @@ - - - - + + + + @@ -137607,10 +137520,10 @@ - - - - + + + + @@ -137660,9 +137573,9 @@ - - - + + + @@ -137676,15 +137589,15 @@ - - - - + + + + - - - + + + @@ -137762,9 +137675,9 @@ - - - + + + @@ -137791,21 +137704,21 @@ - - - - + + + + - - - - + + + + - - - + + + @@ -137824,9 +137737,9 @@ - - - + + + @@ -137841,14 +137754,14 @@ - - - + + + - - - + + + @@ -137890,15 +137803,15 @@ - - + + - - - - - + + + + + @@ -137906,11 +137819,11 @@ - - - - - + + + + + @@ -137987,8 +137900,8 @@ - - + + @@ -138024,8 +137937,8 @@ - - + + @@ -138092,9 +138005,9 @@ - - - + + + @@ -138165,26 +138078,26 @@ - - - - - - - + + + + + + + - - + + - - - + + + @@ -138229,13 +138142,13 @@ - - - + + + - - - + + + @@ -138299,15 +138212,15 @@ - - + + - - + + @@ -138318,16 +138231,16 @@ - - - - - + + + + + - - - + + + @@ -138336,11 +138249,11 @@ - - - - - + + + + + @@ -138349,9 +138262,9 @@ - - - + + + @@ -138401,11 +138314,11 @@ - - - - - + + + + + @@ -138415,17 +138328,17 @@ - - - + + + - - + + - - + + @@ -138434,12 +138347,12 @@ - - + + - - + + @@ -138447,8 +138360,8 @@ - - + + @@ -138465,8 +138378,8 @@ - - + + @@ -138474,12 +138387,12 @@ - - - + + + - + @@ -138508,17 +138421,17 @@ - - - + + + - - + + @@ -138585,28 +138498,28 @@ - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + @@ -138616,17 +138529,17 @@ - - + + - - - - + + + + @@ -138637,26 +138550,26 @@ - - - - + + + + - - - - + + + + - - + + - - - - + + + + @@ -138667,9 +138580,9 @@ - - - + + + @@ -138701,10 +138614,10 @@ - - - - + + + + @@ -138737,9 +138650,9 @@ - - - + + + @@ -138756,15 +138669,15 @@ - - - - + + + + - - - + + + @@ -138788,12 +138701,12 @@ - - - - - - + + + + + + @@ -138815,13 +138728,13 @@ - - + + - - - + + + @@ -138838,10 +138751,10 @@ - - - - + + + + @@ -138852,47 +138765,47 @@ - - - + + + - - + + - - - - - - - + + + + + + + - - + + - - - + + + - - - - - - - + + + + + + + - - - - - - + + + + + + diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index af58084a7ad6..132268bcaafd 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -142,6 +142,31 @@ free_uid find_user +#required by migt.ko + __traceiter_android_rvh_after_enqueue_task + __traceiter_android_rvh_after_dequeue_task + __traceiter_android_vh_map_util_freq + __tracepoint_android_rvh_after_enqueue_task + __tracepoint_android_rvh_after_dequeue_task + __tracepoint_android_vh_map_util_freq + +#required by turbo.ko + __traceiter_android_rvh_set_cpus_allowed_comm + __traceiter_android_vh_sched_setaffinity_early + __traceiter_android_rvh_cpuset_fork + __tracepoint_android_rvh_set_cpus_allowed_comm + __tracepoint_android_vh_sched_setaffinity_early + __tracepoint_android_rvh_cpuset_fork + cpuset_cpus_allowed + +#required by fas.ko + __traceiter_android_rvh_check_preempt_tick + __traceiter_android_rvh_dequeue_entity + __traceiter_android_rvh_enqueue_entity + __tracepoint_android_rvh_check_preempt_tick + __tracepoint_android_rvh_dequeue_entity + __tracepoint_android_rvh_enqueue_entity + #required by pm8941-pwrkey.ko module console_printk @@ -157,3 +182,8 @@ __traceiter_android_vh_tune_swappiness __tracepoint_android_vh_tune_swappiness +#required by msm_drm.ko module + drm_get_connector_type_name + +#required by mi_gamekey.ko module + gpio_request_array From 73839b71c83b8a3c7f10285ba8a0a846cab1c6a2 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Thu, 12 Aug 2021 01:26:35 -0700 Subject: [PATCH 03/20] FROMGIT: usb: dwc3: Decouple USB 2.0 L1 & L2 events On DWC_usb3 revisions 3.00a and newer (including DWC_usb31 and DWC_usb32) the GUCTL1 register gained the DEV_DECOUPLE_L1L2_EVT field (bit 31) which when enabled allows the controller in device mode to treat USB 2.0 L1 LPM & L2 events separately. After commit d1d90dd27254 ("usb: dwc3: gadget: Enable suspend events") the controller will now receive events (and therefore interrupts) for every state change when entering/exiting either L1 or L2 states. Since L1 is handled entirely by the hardware and requires no software intervention, there is no need to even enable these events and unnecessarily notify the gadget driver. Enable the aforementioned bit to help reduce the overall interrupt count for these L1 events that don't need to be handled while retaining the events for full L2 suspend/wakeup. Tested-by: Jun Li Tested-by: Amit Pundir # for RB5 (sm8250) Tested-by: John Stultz # for HiKey960 & db845c Reviewed-by: Jun Li Acked-by: Felipe Balbi Signed-off-by: Jack Pham Link: https://lore.kernel.org/r/20210812082635.12924-1-jackp@codeaurora.org Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 843714bb37d9a3780160d7b4a4a72b8077a77589 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Bug: 197291225 Change-Id: Id800cd1ae6d45108b17432ff864902f4d6d57759 Signed-off-by: Jack Pham --- drivers/usb/dwc3/core.c | 9 +++++++++ drivers/usb/dwc3/core.h | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3121ff82cb81..1d421c6557d6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1050,6 +1050,15 @@ static int dwc3_core_init(struct dwc3 *dwc) if (!DWC3_VER_IS_PRIOR(DWC3, 290A)) reg |= DWC3_GUCTL1_DEV_L1_EXIT_BY_HW; + /* + * Decouple USB 2.0 L1 & L2 events which will allow for + * gadget driver to only receive U3/L2 suspend & wakeup + * events and prevent the more frequent L1 LPM transitions + * from interrupting the driver. + */ + if (!DWC3_VER_IS_PRIOR(DWC3, 300A)) + reg |= DWC3_GUCTL1_DEV_DECOUPLE_L1L2_EVT; + if (dwc->dis_tx_ipgap_linecheck_quirk) reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 07d70418b7bd..d938f85c5847 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -257,9 +257,10 @@ #define DWC3_GUCTL_HSTINAUTORETRY BIT(14) /* Global User Control 1 Register */ -#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) +#define DWC3_GUCTL1_DEV_DECOUPLE_L1L2_EVT BIT(31) #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) -#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) +#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) +#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) /* Global Status Register */ #define DWC3_GSTS_OTG_IP BIT(10) From 94fbab9d6c82befb547f75433dd886f2611071a6 Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Wed, 25 Aug 2021 02:26:18 +0800 Subject: [PATCH 04/20] ANDROID: vendor_hooks: Add hook in kmalloc_slab() Add hook in kmalloc_slab() for debug kmalloc slab memory leak. Bug: 197614797 Signed-off-by: Liujie Xie Change-Id: I402a9f968f2bf1e75daa461c05a53a8fabf70028 --- include/trace/hooks/mm.h | 3 +++ mm/slab_common.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index ac6142a6e02a..31fc6d780981 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -117,6 +117,9 @@ DECLARE_HOOK(android_vh_mem_cgroup_css_online, DECLARE_HOOK(android_vh_mem_cgroup_css_offline, TP_PROTO(struct cgroup_subsys_state *css, struct mem_cgroup *memcg), TP_ARGS(css, memcg)); +DECLARE_HOOK(android_vh_kmalloc_slab, + TP_PROTO(unsigned int index, gfp_t flags, struct kmem_cache **s), + TP_ARGS(index, flags, s)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/slab_common.c b/mm/slab_common.c index 29c857c78465..d9473ad1d233 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -641,6 +641,7 @@ static inline unsigned int size_index_elem(unsigned int bytes) struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) { unsigned int index; + struct kmem_cache *s = NULL; if (size <= 192) { if (!size) @@ -653,6 +654,10 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) index = fls(size - 1); } + trace_android_vh_kmalloc_slab(index, flags, &s); + if (s) + return s; + return kmalloc_caches[kmalloc_type(flags)][index]; } From b0778aaff48a9f76890ea889aea0d1b9c7dcc65c Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Sun, 5 Sep 2021 13:14:53 +0800 Subject: [PATCH 05/20] ANDROID: vendor_hooks: export android_vh_kmalloc_slab export android_vh_kmalloc_slab for driver Fixes: commit 94fbab9d6c82 ("ANDROID: vendor_hooks: Add hook in kmalloc_slab()") Bug: 197614797 Signed-off-by: Liujie Xie Change-Id: I0ad5f090d78b4c0b6c456bc2fe47716c6ba46791 --- drivers/android/vendor_hooks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 1302b9b0f5f2..9746d9bffed1 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -380,3 +380,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_sendmsg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_recvmsg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg_stat); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pci_d3_sleep); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_slab); From 878e0caa773151b8a9445f24d3e059d0ece5566d Mon Sep 17 00:00:00 2001 From: Jiewen Wang Date: Mon, 6 Sep 2021 16:50:35 +0800 Subject: [PATCH 06/20] ANDROID: vendor_hooks: Add hook in mmap_region() Add hook in mmap_region() to record the vma and address information of monitored processes. Bug: 198385827 Change-Id: I0bde29113b47ca7f4a9f5d42a54188e791ca3b7e Signed-off-by: Jiewen Wang --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/mmap.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9746d9bffed1..5d9030f56e32 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -381,3 +381,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_recvmsg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg_stat); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pci_d3_sleep); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_slab); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 31fc6d780981..c194a587764d 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -120,6 +120,9 @@ DECLARE_HOOK(android_vh_mem_cgroup_css_offline, DECLARE_HOOK(android_vh_kmalloc_slab, TP_PROTO(unsigned int index, gfp_t flags, struct kmem_cache **s), TP_ARGS(index, flags, s)); +DECLARE_HOOK(android_vh_mmap_region, + TP_PROTO(struct vm_area_struct *vma, unsigned long addr), + TP_ARGS(vma, addr)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/mmap.c b/mm/mmap.c index b1ca729a11f2..9a4f09216130 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1964,6 +1964,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr, vma_set_page_prot(vma); vm_write_end(vma); + trace_android_vh_mmap_region(vma, addr); + return addr; unmap_and_free_vma: From 955f917251d8ff9c04cf0404e35bf6be5e3666c5 Mon Sep 17 00:00:00 2001 From: Jiewen Wang Date: Mon, 6 Sep 2021 16:55:03 +0800 Subject: [PATCH 07/20] ANDROID: vendor_hooks: Add hook in try_to_unmap_one() Add hook in try_to_unmap_one() to trace this function for debug memory swap bugs. Bug: 198385827 Change-Id: I1fdbe60e09bb491b949e06a07133710453ecca03 Signed-off-by: Jiewen Wang --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/rmap.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 5d9030f56e32..f0ca247d88df 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -382,3 +382,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg_stat); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pci_d3_sleep); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_slab); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index c194a587764d..4b299fd6e613 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -123,6 +123,9 @@ DECLARE_HOOK(android_vh_kmalloc_slab, DECLARE_HOOK(android_vh_mmap_region, TP_PROTO(struct vm_area_struct *vma, unsigned long addr), TP_ARGS(vma, addr)); +DECLARE_HOOK(android_vh_try_to_unmap_one, + TP_PROTO(struct vm_area_struct *vma, struct page *page, unsigned long addr, bool ret), + TP_ARGS(vma, page, addr, ret)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/rmap.c b/mm/rmap.c index faeed19c8a89..b1cb10941651 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -77,6 +77,8 @@ #include +#include + #include "internal.h" static struct kmem_cache *anon_vma_cachep; @@ -1706,6 +1708,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, } mmu_notifier_invalidate_range_end(&range); + trace_android_vh_try_to_unmap_one(vma, page, address, ret); return ret; } From a844dfbbcba62b0a2167723e53d1ae65d0eef1bb Mon Sep 17 00:00:00 2001 From: Ruslan Bilovol Date: Mon, 1 Mar 2021 15:05:36 +0200 Subject: [PATCH 08/20] UPSTREAM: usb: gadget: u_audio: convert to strscpy Usage of strlcpy in Linux Kernel has been recently deprecated [1], convert driver to strscpy [1] https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Ruslan Bilovol Link: https://lore.kernel.org/r/1614603943-11668-2-git-send-email-ruslan.bilovol@gmail.com Signed-off-by: Greg Kroah-Hartman Bug: 199044440 Change-Id: If27abc1574f89f344d191f538d671d0f8390d4cb (cherry picked from commit d23922fcac48e57f3bf00b1dc4c9c0f5b4f6fe59) Signed-off-by: Jack Pham --- drivers/usb/gadget/function/u_audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 265c4d805f81..5fbceee897a3 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -549,15 +549,15 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, if (err < 0) goto snd_fail; - strlcpy(pcm->name, pcm_name, sizeof(pcm->name)); + strscpy(pcm->name, pcm_name, sizeof(pcm->name)); pcm->private_data = uac; uac->pcm = pcm; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &uac_pcm_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &uac_pcm_ops); - strlcpy(card->driver, card_name, sizeof(card->driver)); - strlcpy(card->shortname, card_name, sizeof(card->shortname)); + strscpy(card->driver, card_name, sizeof(card->driver)); + strscpy(card->shortname, card_name, sizeof(card->shortname)); sprintf(card->longname, "%s %i", card_name, card->dev->id); snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, From c71892dd9ed186d69089ea8d19079e5830c227c1 Mon Sep 17 00:00:00 2001 From: Ruslan Bilovol Date: Fri, 4 Jun 2021 00:01:02 +0200 Subject: [PATCH 09/20] UPSTREAM: usb: gadget: f_uac2/u_audio: add feedback endpoint support As per USB and UAC2 specs, asynchronous audio sink endpoint requires explicit synchronization mechanism (Isochronous Feedback Endpoint) Implement feedback companion endpoint for ISO OUT endpoint This patch adds all required infrastructure and USB requests handling for feedback endpoint. Syncrhonization itself is still dummy (feedback ep always reports 'nomimal frequency' e.g. no adjustement is needed). This satisfies hosts that require feedback endpoint (like Win10) and poll it periodically Actual synchronization mechanism should be implemented separately Signed-off-by: Ruslan Bilovol Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20210603220104.1216001-2-jbrunet@baylibre.com Signed-off-by: Greg Kroah-Hartman Bug: 199044440 Change-Id: I07b5b3e54251c68bff24a2c78ed4e0b30f107693 (cherry picked from commit 24f779dac8f3efb9629adc0e486914d93dc45517) Signed-off-by: Jack Pham --- drivers/usb/gadget/function/f_uac2.c | 49 ++++++++++- drivers/usb/gadget/function/u_audio.c | 119 +++++++++++++++++++++++++- drivers/usb/gadget/function/u_audio.h | 3 + 3 files changed, 168 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 7aa4c8bc5a1a..5d63244ba319 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -240,7 +240,7 @@ static struct usb_interface_descriptor std_as_out_if1_desc = { .bDescriptorType = USB_DT_INTERFACE, .bAlternateSetting = 1, - .bNumEndpoints = 1, + .bNumEndpoints = 2, .bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceSubClass = USB_SUBCLASS_AUDIOSTREAMING, .bInterfaceProtocol = UAC_VERSION_2, @@ -317,6 +317,37 @@ static struct uac2_iso_endpoint_descriptor as_iso_out_desc = { .wLockDelay = 0, }; +/* STD AS ISO IN Feedback Endpoint */ +static struct usb_endpoint_descriptor fs_epin_fback_desc = { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + + .bEndpointAddress = USB_DIR_IN, + .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_USAGE_FEEDBACK, + .wMaxPacketSize = cpu_to_le16(3), + .bInterval = 1, +}; + +static struct usb_endpoint_descriptor hs_epin_fback_desc = { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + + .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_USAGE_FEEDBACK, + .wMaxPacketSize = cpu_to_le16(4), + .bInterval = 4, +}; + +static struct usb_endpoint_descriptor ss_epin_fback_desc = { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + + .bEndpointAddress = USB_DIR_IN, + .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_USAGE_FEEDBACK, + .wMaxPacketSize = cpu_to_le16(4), + .bInterval = 4, +}; + + /* Audio Streaming IN Interface - Alt0 */ static struct usb_interface_descriptor std_as_in_if0_desc = { .bLength = sizeof std_as_in_if0_desc, @@ -431,6 +462,7 @@ static struct usb_descriptor_header *fs_audio_desc[] = { (struct usb_descriptor_header *)&as_out_fmt1_desc, (struct usb_descriptor_header *)&fs_epout_desc, (struct usb_descriptor_header *)&as_iso_out_desc, + (struct usb_descriptor_header *)&fs_epin_fback_desc, (struct usb_descriptor_header *)&std_as_in_if0_desc, (struct usb_descriptor_header *)&std_as_in_if1_desc, @@ -461,6 +493,7 @@ static struct usb_descriptor_header *hs_audio_desc[] = { (struct usb_descriptor_header *)&as_out_fmt1_desc, (struct usb_descriptor_header *)&hs_epout_desc, (struct usb_descriptor_header *)&as_iso_out_desc, + (struct usb_descriptor_header *)&hs_epin_fback_desc, (struct usb_descriptor_header *)&std_as_in_if0_desc, (struct usb_descriptor_header *)&std_as_in_if1_desc, @@ -492,6 +525,7 @@ static struct usb_descriptor_header *ss_audio_desc[] = { (struct usb_descriptor_header *)&ss_epout_desc, (struct usb_descriptor_header *)&ss_epout_desc_comp, (struct usb_descriptor_header *)&as_iso_out_desc, + (struct usb_descriptor_header *)&ss_epin_fback_desc, (struct usb_descriptor_header *)&std_as_in_if0_desc, (struct usb_descriptor_header *)&std_as_in_if1_desc, @@ -568,22 +602,26 @@ static void setup_headers(struct f_uac2_opts *opts, struct usb_ss_ep_comp_descriptor *epin_desc_comp = NULL; struct usb_endpoint_descriptor *epout_desc; struct usb_endpoint_descriptor *epin_desc; + struct usb_endpoint_descriptor *epin_fback_desc; int i; switch (speed) { case USB_SPEED_FULL: epout_desc = &fs_epout_desc; epin_desc = &fs_epin_desc; + epin_fback_desc = &fs_epin_fback_desc; break; case USB_SPEED_HIGH: epout_desc = &hs_epout_desc; epin_desc = &hs_epin_desc; + epin_fback_desc = &hs_epin_fback_desc; break; default: epout_desc = &ss_epout_desc; epin_desc = &ss_epin_desc; epout_desc_comp = &ss_epout_desc_comp; epin_desc_comp = &ss_epin_desc_comp; + epin_fback_desc = &ss_epin_fback_desc; } i = 0; @@ -611,6 +649,7 @@ static void setup_headers(struct f_uac2_opts *opts, headers[i++] = USBDHDR(epout_desc_comp); headers[i++] = USBDHDR(&as_iso_out_desc); + headers[i++] = USBDHDR(epin_fback_desc); } if (EPIN_EN(opts)) { headers[i++] = USBDHDR(&std_as_in_if0_desc); @@ -844,6 +883,12 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); return -ENODEV; } + agdev->in_ep_fback = usb_ep_autoconfig(gadget, + &fs_epin_fback_desc); + if (!agdev->in_ep_fback) { + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); + return -ENODEV; + } } if (EPIN_EN(uac2_opts)) { @@ -867,8 +912,10 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) le16_to_cpu(ss_epout_desc.wMaxPacketSize)); hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress; + hs_epin_fback_desc.bEndpointAddress = fs_epin_fback_desc.bEndpointAddress; hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress; ss_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress; + ss_epin_fback_desc.bEndpointAddress = fs_epin_fback_desc.bEndpointAddress; ss_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress; setup_descriptor(uac2_opts); diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 5fbceee897a3..f637ebec80b0 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -38,6 +38,10 @@ struct uac_rtd_params { unsigned int max_psize; /* MaxPacketSize of endpoint */ struct usb_request **reqs; + + struct usb_request *req_fback; /* Feedback endpoint request */ + unsigned int ffback; /* Real frequency reported by feedback endpoint */ + bool fb_ep_enabled; /* if the ep is enabled */ }; struct snd_uac_chip { @@ -70,6 +74,32 @@ static const struct snd_pcm_hardware uac_pcm_hardware = { .periods_min = MIN_PERIODS, }; +static void u_audio_set_fback_frequency(enum usb_device_speed speed, + unsigned int freq, void *buf) +{ + u32 ff = 0; + + if (speed == USB_SPEED_FULL) { + /* + * Full-speed feedback endpoints report frequency + * in samples/microframe + * Format is encoded in Q10.10 left-justified in the 24 bits, + * so that it has a Q10.14 format. + */ + ff = DIV_ROUND_UP((freq << 14), 1000); + } else { + /* + * High-speed feedback endpoints report frequency + * in samples/microframe. + * Format is encoded in Q12.13 fitted into four bytes so that + * the binary point is located between the second and the third + * byte fromat (that is Q16.16) + */ + ff = DIV_ROUND_UP((freq << 13), 1000); + } + *(__le32 *)buf = cpu_to_le32(ff); +} + static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req) { unsigned int pending; @@ -173,6 +203,34 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req) dev_err(uac->card->dev, "%d Error!\n", __LINE__); } +static void u_audio_iso_fback_complete(struct usb_ep *ep, + struct usb_request *req) +{ + struct uac_rtd_params *prm = req->context; + struct snd_uac_chip *uac = prm->uac; + struct g_audio *audio_dev = uac->audio_dev; + int status = req->status; + unsigned long flags; + + /* i/f shutting down */ + if (!prm->fb_ep_enabled || req->status == -ESHUTDOWN) + return; + + /* + * We can't really do much about bad xfers. + * Afterall, the ISOCH xfers could fail legitimately. + */ + if (status) + pr_debug("%s: iso_complete status(%d) %d/%d\n", + __func__, status, req->actual, req->length); + + u_audio_set_fback_frequency(audio_dev->gadget->speed, + prm->ffback, req->buf); + + if (usb_ep_queue(ep, req, GFP_ATOMIC)) + dev_err(uac->card->dev, "%d Error!\n", __LINE__); +} + static int uac_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_uac_chip *uac = snd_pcm_substream_chip(substream); @@ -335,14 +393,33 @@ static inline void free_ep(struct uac_rtd_params *prm, struct usb_ep *ep) dev_err(uac->card->dev, "%s:%d Error!\n", __func__, __LINE__); } +static inline void free_ep_fback(struct uac_rtd_params *prm, struct usb_ep *ep) +{ + struct snd_uac_chip *uac = prm->uac; + + if (!prm->fb_ep_enabled) + return; + + prm->fb_ep_enabled = false; + + if (prm->req_fback) { + usb_ep_dequeue(ep, prm->req_fback); + kfree(prm->req_fback->buf); + usb_ep_free_request(ep, prm->req_fback); + prm->req_fback = NULL; + } + + if (usb_ep_disable(ep)) + dev_err(uac->card->dev, "%s:%d Error!\n", __func__, __LINE__); +} int u_audio_start_capture(struct g_audio *audio_dev) { struct snd_uac_chip *uac = audio_dev->uac; struct usb_gadget *gadget = audio_dev->gadget; struct device *dev = &gadget->dev; - struct usb_request *req; - struct usb_ep *ep; + struct usb_request *req, *req_fback; + struct usb_ep *ep, *ep_fback; struct uac_rtd_params *prm; struct uac_params *params = &audio_dev->params; int req_len, i; @@ -374,6 +451,42 @@ int u_audio_start_capture(struct g_audio *audio_dev) dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); } + ep_fback = audio_dev->in_ep_fback; + if (!ep_fback) + return 0; + + /* Setup feedback endpoint */ + config_ep_by_speed(gadget, &audio_dev->func, ep_fback); + prm->fb_ep_enabled = true; + usb_ep_enable(ep_fback); + req_len = ep_fback->maxpacket; + + req_fback = usb_ep_alloc_request(ep_fback, GFP_ATOMIC); + if (req_fback == NULL) + return -ENOMEM; + + prm->req_fback = req_fback; + req_fback->zero = 0; + req_fback->context = prm; + req_fback->length = req_len; + req_fback->complete = u_audio_iso_fback_complete; + + req_fback->buf = kzalloc(req_len, GFP_ATOMIC); + if (!req_fback->buf) + return -ENOMEM; + + /* + * Configure the feedback endpoint's reported frequency. + * Always start with original frequency since its deviation can't + * be meauserd at start of playback + */ + prm->ffback = params->c_srate; + u_audio_set_fback_frequency(audio_dev->gadget->speed, + prm->ffback, req_fback->buf); + + if (usb_ep_queue(ep_fback, req_fback, GFP_ATOMIC)) + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); + return 0; } EXPORT_SYMBOL_GPL(u_audio_start_capture); @@ -382,6 +495,8 @@ void u_audio_stop_capture(struct g_audio *audio_dev) { struct snd_uac_chip *uac = audio_dev->uac; + if (audio_dev->in_ep_fback) + free_ep_fback(&uac->c_prm, audio_dev->in_ep_fback); free_ep(&uac->c_prm, audio_dev->out_ep); } EXPORT_SYMBOL_GPL(u_audio_stop_capture); diff --git a/drivers/usb/gadget/function/u_audio.h b/drivers/usb/gadget/function/u_audio.h index 5ea6b86f1fda..53e6baf55cbf 100644 --- a/drivers/usb/gadget/function/u_audio.h +++ b/drivers/usb/gadget/function/u_audio.h @@ -30,7 +30,10 @@ struct g_audio { struct usb_gadget *gadget; struct usb_ep *in_ep; + struct usb_ep *out_ep; + /* feedback IN endpoint corresponding to out_ep */ + struct usb_ep *in_ep_fback; /* Max packet size for all in_ep possible speeds */ unsigned int in_ep_maxpsize; From d33287acf37b7b1823308c5430a7903ef8d0fcd5 Mon Sep 17 00:00:00 2001 From: Ruslan Bilovol Date: Fri, 4 Jun 2021 00:01:03 +0200 Subject: [PATCH 10/20] UPSTREAM: usb: gadget: f_uac2: add adaptive sync support for capture Current f_uac2 USB OUT (aka 'capture') synchronization implements 'ASYNC' scenario which means USB Gadget has it's own freerunning clock and can update Host about real clock frequency through feedback endpoint so Host can align number of samples sent to the USB gadget to prevent overruns/underruns In case if Gadget can has no it's internal clock and can consume audio samples at any rate (for example, on the Gadget side someone records audio directly to a file, or audio samples are played through an external DAC as soon as they arrive), UAC2 spec suggests 'ADAPTIVE' synchronization type. Change UAC2 driver to make it configurable through additional 'c_sync' configfs file. Default remains 'asynchronous' with possibility to switch it to 'adaptive' Signed-off-by: Ruslan Bilovol Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20210603220104.1216001-3-jbrunet@baylibre.com Signed-off-by: Greg Kroah-Hartman Bug: 199044440 Change-Id: I5003048575535b97274fe9137b53894deb6647d6 (cherry picked from commit 40c73b30546e759bedcec607fedc2d4be954508f) Signed-off-by: Jack Pham --- .../ABI/testing/configfs-usb-gadget-uac2 | 1 + Documentation/usb/gadget-testing.rst | 1 + drivers/usb/gadget/function/f_uac2.c | 100 ++++++++++++++++-- drivers/usb/gadget/function/u_uac2.h | 2 + 4 files changed, 95 insertions(+), 9 deletions(-) diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac2 b/Documentation/ABI/testing/configfs-usb-gadget-uac2 index d4356c8b8cd6..e7e59d7fb12f 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uac2 +++ b/Documentation/ABI/testing/configfs-usb-gadget-uac2 @@ -8,6 +8,7 @@ Description: c_chmask capture channel mask c_srate capture sampling rate c_ssize capture sample size (bytes) + c_sync capture synchronization type (async/adaptive) p_chmask playback channel mask p_srate playback sampling rate p_ssize playback sample size (bytes) diff --git a/Documentation/usb/gadget-testing.rst b/Documentation/usb/gadget-testing.rst index 2085e7b24eeb..f5a12667bd41 100644 --- a/Documentation/usb/gadget-testing.rst +++ b/Documentation/usb/gadget-testing.rst @@ -728,6 +728,7 @@ The uac2 function provides these attributes in its function directory: c_chmask capture channel mask c_srate capture sampling rate c_ssize capture sample size (bytes) + c_sync capture synchronization type (async/adaptive) p_chmask playback channel mask p_srate playback sampling rate p_ssize playback sample size (bytes) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 5d63244ba319..321e6c05ba93 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -44,6 +44,7 @@ #define EPIN_EN(_opts) ((_opts)->p_chmask != 0) #define EPOUT_EN(_opts) ((_opts)->c_chmask != 0) +#define EPOUT_FBACK_IN_EN(_opts) ((_opts)->c_sync == USB_ENDPOINT_SYNC_ASYNC) struct f_uac2 { struct g_audio g_audio; @@ -240,7 +241,7 @@ static struct usb_interface_descriptor std_as_out_if1_desc = { .bDescriptorType = USB_DT_INTERFACE, .bAlternateSetting = 1, - .bNumEndpoints = 2, + .bNumEndpoints = 1, .bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceSubClass = USB_SUBCLASS_AUDIOSTREAMING, .bInterfaceProtocol = UAC_VERSION_2, @@ -273,7 +274,7 @@ static struct usb_endpoint_descriptor fs_epout_desc = { .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = USB_DIR_OUT, - .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, + /* .bmAttributes = DYNAMIC */ /* .wMaxPacketSize = DYNAMIC */ .bInterval = 1, }; @@ -282,7 +283,7 @@ static struct usb_endpoint_descriptor hs_epout_desc = { .bLength = USB_DT_ENDPOINT_SIZE, .bDescriptorType = USB_DT_ENDPOINT, - .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, + /* .bmAttributes = DYNAMIC */ /* .wMaxPacketSize = DYNAMIC */ .bInterval = 4, }; @@ -292,7 +293,7 @@ static struct usb_endpoint_descriptor ss_epout_desc = { .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = USB_DIR_OUT, - .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, + /* .bmAttributes = DYNAMIC */ /* .wMaxPacketSize = DYNAMIC */ .bInterval = 4, }; @@ -649,7 +650,9 @@ static void setup_headers(struct f_uac2_opts *opts, headers[i++] = USBDHDR(epout_desc_comp); headers[i++] = USBDHDR(&as_iso_out_desc); - headers[i++] = USBDHDR(epin_fback_desc); + + if (EPOUT_FBACK_IN_EN(opts)) + headers[i++] = USBDHDR(epin_fback_desc); } if (EPIN_EN(opts)) { headers[i++] = USBDHDR(&std_as_in_if0_desc); @@ -820,6 +823,23 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) std_as_out_if1_desc.bInterfaceNumber = ret; uac2->as_out_intf = ret; uac2->as_out_alt = 0; + + if (EPOUT_FBACK_IN_EN(uac2_opts)) { + fs_epout_desc.bmAttributes = + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC; + hs_epout_desc.bmAttributes = + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC; + ss_epout_desc.bmAttributes = + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC; + std_as_out_if1_desc.bNumEndpoints++; + } else { + fs_epout_desc.bmAttributes = + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE; + hs_epout_desc.bmAttributes = + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE; + ss_epout_desc.bmAttributes = + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE; + } } if (EPIN_EN(uac2_opts)) { @@ -883,11 +903,14 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); return -ENODEV; } - agdev->in_ep_fback = usb_ep_autoconfig(gadget, + if (EPOUT_FBACK_IN_EN(uac2_opts)) { + agdev->in_ep_fback = usb_ep_autoconfig(gadget, &fs_epin_fback_desc); - if (!agdev->in_ep_fback) { - dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); - return -ENODEV; + if (!agdev->in_ep_fback) { + dev_err(dev, "%s:%d Error!\n", + __func__, __LINE__); + return -ENODEV; + } } } @@ -1242,11 +1265,68 @@ end: \ \ CONFIGFS_ATTR(f_uac2_opts_, name) +#define UAC2_ATTRIBUTE_SYNC(name) \ +static ssize_t f_uac2_opts_##name##_show(struct config_item *item, \ + char *page) \ +{ \ + struct f_uac2_opts *opts = to_f_uac2_opts(item); \ + int result; \ + char *str; \ + \ + mutex_lock(&opts->lock); \ + switch (opts->name) { \ + case USB_ENDPOINT_SYNC_ASYNC: \ + str = "async"; \ + break; \ + case USB_ENDPOINT_SYNC_ADAPTIVE: \ + str = "adaptive"; \ + break; \ + default: \ + str = "unknown"; \ + break; \ + } \ + result = sprintf(page, "%s\n", str); \ + mutex_unlock(&opts->lock); \ + \ + return result; \ +} \ + \ +static ssize_t f_uac2_opts_##name##_store(struct config_item *item, \ + const char *page, size_t len) \ +{ \ + struct f_uac2_opts *opts = to_f_uac2_opts(item); \ + int ret = 0; \ + \ + mutex_lock(&opts->lock); \ + if (opts->refcnt) { \ + ret = -EBUSY; \ + goto end; \ + } \ + \ + if (!strncmp(page, "async", 5)) \ + opts->name = USB_ENDPOINT_SYNC_ASYNC; \ + else if (!strncmp(page, "adaptive", 8)) \ + opts->name = USB_ENDPOINT_SYNC_ADAPTIVE; \ + else { \ + ret = -EINVAL; \ + goto end; \ + } \ + \ + ret = len; \ + \ +end: \ + mutex_unlock(&opts->lock); \ + return ret; \ +} \ + \ +CONFIGFS_ATTR(f_uac2_opts_, name) + UAC2_ATTRIBUTE(p_chmask); UAC2_ATTRIBUTE(p_srate); UAC2_ATTRIBUTE(p_ssize); UAC2_ATTRIBUTE(c_chmask); UAC2_ATTRIBUTE(c_srate); +UAC2_ATTRIBUTE_SYNC(c_sync); UAC2_ATTRIBUTE(c_ssize); UAC2_ATTRIBUTE(req_number); @@ -1257,6 +1337,7 @@ static struct configfs_attribute *f_uac2_attrs[] = { &f_uac2_opts_attr_c_chmask, &f_uac2_opts_attr_c_srate, &f_uac2_opts_attr_c_ssize, + &f_uac2_opts_attr_c_sync, &f_uac2_opts_attr_req_number, NULL, }; @@ -1295,6 +1376,7 @@ static struct usb_function_instance *afunc_alloc_inst(void) opts->c_chmask = UAC2_DEF_CCHMASK; opts->c_srate = UAC2_DEF_CSRATE; opts->c_ssize = UAC2_DEF_CSSIZE; + opts->c_sync = UAC2_DEF_CSYNC; opts->req_number = UAC2_DEF_REQ_NUM; return &opts->func_inst; } diff --git a/drivers/usb/gadget/function/u_uac2.h b/drivers/usb/gadget/function/u_uac2.h index b5035711172d..13589c3c805c 100644 --- a/drivers/usb/gadget/function/u_uac2.h +++ b/drivers/usb/gadget/function/u_uac2.h @@ -21,6 +21,7 @@ #define UAC2_DEF_CCHMASK 0x3 #define UAC2_DEF_CSRATE 64000 #define UAC2_DEF_CSSIZE 2 +#define UAC2_DEF_CSYNC USB_ENDPOINT_SYNC_ASYNC #define UAC2_DEF_REQ_NUM 2 struct f_uac2_opts { @@ -31,6 +32,7 @@ struct f_uac2_opts { int c_chmask; int c_srate; int c_ssize; + int c_sync; int req_number; bool bound; From 406a51b4861bf60fff28e77faca9b3118f0566ae Mon Sep 17 00:00:00 2001 From: Ruslan Bilovol Date: Fri, 4 Jun 2021 00:01:04 +0200 Subject: [PATCH 11/20] UPSTREAM: usb: gadget: u_audio: add real feedback implementation This adds interface between userspace and feedback endpoint to report real feedback frequency to the Host. Current implementation adds new userspace interface ALSA mixer control "Capture Pitch 1000000" (similar to aloop driver's "PCM Rate Shift 100000" mixer control) Value in PPM is chosen to have correction value agnostic of the actual HW rate, which the application is not necessarily dealing with, while still retaining a good enough precision to allow smooth clock correction on the playback side, if necessary. Similar to sound/usb/endpoint.c, a slow down is allowed up to 25%. This has no impact on the required bandwidth. Speedup correction has an impact on the bandwidth reserved for the isochronous endpoint. The default allowed speedup is 500ppm. This seems to be more than enough but, if necessary, this is configurable through a module parameter. The reserved bandwidth is rounded up to the next packet size. Usage of this new control is easy to implement in existing userspace tools like alsaloop from alsa-utils. Signed-off-by: Ruslan Bilovol Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20210603220104.1216001-4-jbrunet@baylibre.com Signed-off-by: Greg Kroah-Hartman Bug: 199044440 Change-Id: If23b59a8bd19a32ba688c688fbfd9e34eb4330c7 (cherry picked from commit e89bb4288378b85c82212b60dc98ecda6b3d3a70) Signed-off-by: Jack Pham --- .../ABI/testing/configfs-usb-gadget-uac2 | 1 + Documentation/usb/gadget-testing.rst | 1 + drivers/usb/gadget/function/f_uac2.c | 9 +- drivers/usb/gadget/function/u_audio.c | 124 ++++++++++++++++-- drivers/usb/gadget/function/u_audio.h | 9 ++ drivers/usb/gadget/function/u_uac2.h | 2 + 6 files changed, 136 insertions(+), 10 deletions(-) diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac2 b/Documentation/ABI/testing/configfs-usb-gadget-uac2 index e7e59d7fb12f..26fb8e9b4e61 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uac2 +++ b/Documentation/ABI/testing/configfs-usb-gadget-uac2 @@ -9,6 +9,7 @@ Description: c_srate capture sampling rate c_ssize capture sample size (bytes) c_sync capture synchronization type (async/adaptive) + fb_max maximum extra bandwidth in async mode p_chmask playback channel mask p_srate playback sampling rate p_ssize playback sample size (bytes) diff --git a/Documentation/usb/gadget-testing.rst b/Documentation/usb/gadget-testing.rst index f5a12667bd41..9d6276f82774 100644 --- a/Documentation/usb/gadget-testing.rst +++ b/Documentation/usb/gadget-testing.rst @@ -729,6 +729,7 @@ The uac2 function provides these attributes in its function directory: c_srate capture sampling rate c_ssize capture sample size (bytes) c_sync capture synchronization type (async/adaptive) + fb_max maximum extra bandwidth in async mode p_chmask playback channel mask p_srate playback sampling rate p_ssize playback sample size (bytes) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 321e6c05ba93..ae29ff2b2b68 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -584,8 +584,11 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, ssize = uac2_opts->c_ssize; } + if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC)) + srate = srate * (1000 + uac2_opts->fb_max) / 1000; + max_size_bw = num_channels(chmask) * ssize * - ((srate / (factor / (1 << (ep_desc->bInterval - 1)))) + 1); + DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))); ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw, max_size_ep)); @@ -957,6 +960,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) agdev->params.c_srate = uac2_opts->c_srate; agdev->params.c_ssize = uac2_opts->c_ssize; agdev->params.req_number = uac2_opts->req_number; + agdev->params.fb_max = uac2_opts->fb_max; ret = g_audio_setup(agdev, "UAC2 PCM", "UAC2_Gadget"); if (ret) goto err_free_descs; @@ -1329,6 +1333,7 @@ UAC2_ATTRIBUTE(c_srate); UAC2_ATTRIBUTE_SYNC(c_sync); UAC2_ATTRIBUTE(c_ssize); UAC2_ATTRIBUTE(req_number); +UAC2_ATTRIBUTE(fb_max); static struct configfs_attribute *f_uac2_attrs[] = { &f_uac2_opts_attr_p_chmask, @@ -1339,6 +1344,7 @@ static struct configfs_attribute *f_uac2_attrs[] = { &f_uac2_opts_attr_c_ssize, &f_uac2_opts_attr_c_sync, &f_uac2_opts_attr_req_number, + &f_uac2_opts_attr_fb_max, NULL, }; @@ -1378,6 +1384,7 @@ static struct usb_function_instance *afunc_alloc_inst(void) opts->c_ssize = UAC2_DEF_CSSIZE; opts->c_sync = UAC2_DEF_CSYNC; opts->req_number = UAC2_DEF_REQ_NUM; + opts->fb_max = UAC2_DEF_FB_MAX; return &opts->func_inst; } diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index f637ebec80b0..018dd0978995 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "u_audio.h" @@ -35,12 +36,12 @@ struct uac_rtd_params { void *rbuf; + unsigned int pitch; /* Stream pitch ratio to 1000000 */ unsigned int max_psize; /* MaxPacketSize of endpoint */ struct usb_request **reqs; struct usb_request *req_fback; /* Feedback endpoint request */ - unsigned int ffback; /* Real frequency reported by feedback endpoint */ bool fb_ep_enabled; /* if the ep is enabled */ }; @@ -75,18 +76,29 @@ static const struct snd_pcm_hardware uac_pcm_hardware = { }; static void u_audio_set_fback_frequency(enum usb_device_speed speed, - unsigned int freq, void *buf) + unsigned long long freq, + unsigned int pitch, + void *buf) { u32 ff = 0; + /* + * Because the pitch base is 1000000, the final divider here + * will be 1000 * 1000000 = 1953125 << 9 + * + * Instead of dealing with big numbers lets fold this 9 left shift + */ + if (speed == USB_SPEED_FULL) { /* * Full-speed feedback endpoints report frequency - * in samples/microframe + * in samples/frame * Format is encoded in Q10.10 left-justified in the 24 bits, * so that it has a Q10.14 format. + * + * ff = (freq << 14) / 1000 */ - ff = DIV_ROUND_UP((freq << 14), 1000); + freq <<= 5; } else { /* * High-speed feedback endpoints report frequency @@ -94,9 +106,14 @@ static void u_audio_set_fback_frequency(enum usb_device_speed speed, * Format is encoded in Q12.13 fitted into four bytes so that * the binary point is located between the second and the third * byte fromat (that is Q16.16) + * + * ff = (freq << 16) / 8000 */ - ff = DIV_ROUND_UP((freq << 13), 1000); + freq <<= 4; } + + ff = DIV_ROUND_CLOSEST_ULL((freq * pitch), 1953125); + *(__le32 *)buf = cpu_to_le32(ff); } @@ -209,8 +226,8 @@ static void u_audio_iso_fback_complete(struct usb_ep *ep, struct uac_rtd_params *prm = req->context; struct snd_uac_chip *uac = prm->uac; struct g_audio *audio_dev = uac->audio_dev; + struct uac_params *params = &audio_dev->params; int status = req->status; - unsigned long flags; /* i/f shutting down */ if (!prm->fb_ep_enabled || req->status == -ESHUTDOWN) @@ -225,7 +242,8 @@ static void u_audio_iso_fback_complete(struct usb_ep *ep, __func__, status, req->actual, req->length); u_audio_set_fback_frequency(audio_dev->gadget->speed, - prm->ffback, req->buf); + params->c_srate, prm->pitch, + req->buf); if (usb_ep_queue(ep, req, GFP_ATOMIC)) dev_err(uac->card->dev, "%d Error!\n", __LINE__); @@ -480,9 +498,10 @@ int u_audio_start_capture(struct g_audio *audio_dev) * Always start with original frequency since its deviation can't * be meauserd at start of playback */ - prm->ffback = params->c_srate; + prm->pitch = 1000000; u_audio_set_fback_frequency(audio_dev->gadget->speed, - prm->ffback, req_fback->buf); + params->c_srate, prm->pitch, + req_fback->buf); if (usb_ep_queue(ep_fback, req_fback, GFP_ATOMIC)) dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); @@ -578,12 +597,82 @@ void u_audio_stop_playback(struct g_audio *audio_dev) } EXPORT_SYMBOL_GPL(u_audio_stop_playback); +static int u_audio_pitch_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + struct uac_rtd_params *prm = snd_kcontrol_chip(kcontrol); + struct snd_uac_chip *uac = prm->uac; + struct g_audio *audio_dev = uac->audio_dev; + struct uac_params *params = &audio_dev->params; + unsigned int pitch_min, pitch_max; + + pitch_min = (1000 - FBACK_SLOW_MAX) * 1000; + pitch_max = (1000 + params->fb_max) * 1000; + + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 1; + uinfo->value.integer.min = pitch_min; + uinfo->value.integer.max = pitch_max; + uinfo->value.integer.step = 1; + return 0; +} + +static int u_audio_pitch_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct uac_rtd_params *prm = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = prm->pitch; + + return 0; +} + +static int u_audio_pitch_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct uac_rtd_params *prm = snd_kcontrol_chip(kcontrol); + struct snd_uac_chip *uac = prm->uac; + struct g_audio *audio_dev = uac->audio_dev; + struct uac_params *params = &audio_dev->params; + unsigned int val; + unsigned int pitch_min, pitch_max; + int change = 0; + + pitch_min = (1000 - FBACK_SLOW_MAX) * 1000; + pitch_max = (1000 + params->fb_max) * 1000; + + val = ucontrol->value.integer.value[0]; + + if (val < pitch_min) + val = pitch_min; + if (val > pitch_max) + val = pitch_max; + + if (prm->pitch != val) { + prm->pitch = val; + change = 1; + } + + return change; +} + +static const struct snd_kcontrol_new u_audio_controls[] = { +{ + .iface = SNDRV_CTL_ELEM_IFACE_PCM, + .name = "Capture Pitch 1000000", + .info = u_audio_pitch_info, + .get = u_audio_pitch_get, + .put = u_audio_pitch_put, +}, +}; + int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, const char *card_name) { struct snd_uac_chip *uac; struct snd_card *card; struct snd_pcm *pcm; + struct snd_kcontrol *kctl; struct uac_params *params; int p_chmask, c_chmask; int err; @@ -671,6 +760,23 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &uac_pcm_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &uac_pcm_ops); + if (c_chmask && g_audio->in_ep_fback) { + strscpy(card->mixername, card_name, sizeof(card->driver)); + + kctl = snd_ctl_new1(&u_audio_controls[0], &uac->c_prm); + if (!kctl) { + err = -ENOMEM; + goto snd_fail; + } + + kctl->id.device = pcm->device; + kctl->id.subdevice = 0; + + err = snd_ctl_add(card, kctl); + if (err < 0) + goto snd_fail; + } + strscpy(card->driver, card_name, sizeof(card->driver)); strscpy(card->shortname, card_name, sizeof(card->shortname)); sprintf(card->longname, "%s %i", card_name, card->dev->id); diff --git a/drivers/usb/gadget/function/u_audio.h b/drivers/usb/gadget/function/u_audio.h index 53e6baf55cbf..a218cdf771fe 100644 --- a/drivers/usb/gadget/function/u_audio.h +++ b/drivers/usb/gadget/function/u_audio.h @@ -11,6 +11,14 @@ #include +/* + * Same maximum frequency deviation on the slower side as in + * sound/usb/endpoint.c. Value is expressed in per-mil deviation. + * The maximum deviation on the faster side will be provided as + * parameter, as it impacts the endpoint required bandwidth. + */ +#define FBACK_SLOW_MAX 250 + struct uac_params { /* playback */ int p_chmask; /* channel mask */ @@ -23,6 +31,7 @@ struct uac_params { int c_ssize; /* sample size */ int req_number; /* number of preallocated requests */ + int fb_max; /* upper frequency drift feedback limit per-mil */ }; struct g_audio { diff --git a/drivers/usb/gadget/function/u_uac2.h b/drivers/usb/gadget/function/u_uac2.h index 13589c3c805c..179d3ef6a195 100644 --- a/drivers/usb/gadget/function/u_uac2.h +++ b/drivers/usb/gadget/function/u_uac2.h @@ -23,6 +23,7 @@ #define UAC2_DEF_CSSIZE 2 #define UAC2_DEF_CSYNC USB_ENDPOINT_SYNC_ASYNC #define UAC2_DEF_REQ_NUM 2 +#define UAC2_DEF_FB_MAX 5 struct f_uac2_opts { struct usb_function_instance func_inst; @@ -34,6 +35,7 @@ struct f_uac2_opts { int c_ssize; int c_sync; int req_number; + int fb_max; bool bound; struct mutex lock; From 3d371f087c953c0e08a228169d4e5c44aea99416 Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Fri, 27 Aug 2021 09:58:53 +0200 Subject: [PATCH 12/20] UPSTREAM: usb: gadget: f_uac2: fixup feedback endpoint stop When the uac2 function is stopped, there seems to be an issue reported on some platforms (Intel Merrifield at least) BUG: kernel NULL pointer dereference, address: 0000000000000008 ... RIP: 0010:dwc3_gadget_del_and_unmap_request+0x19/0xe0 ... Call Trace: dwc3_remove_requests.constprop.0+0x12f/0x170 __dwc3_gadget_ep_disable+0x7a/0x160 dwc3_gadget_ep_disable+0x3d/0xd0 usb_ep_disable+0x1c/0x70 u_audio_stop_capture+0x79/0x120 [u_audio] afunc_set_alt+0x73/0x80 [usb_f_uac2] composite_setup+0x224/0x1b90 [libcomposite] The issue happens only when the gadget is using the sync type "async", not "adaptive". This indicates that problem is coming from the feedback endpoint, which is only used with async synchronization mode. The problem is that request is freed regardless of usb_ep_dequeue(), which ends up badly if the request is not actually dequeued yet. Update the feedback endpoint free function to release the endpoint the same way it is done for the data endpoint, which takes care of the problem. Fixes: 24f779dac8f3 ("usb: gadget: f_uac2/u_audio: add feedback endpoint support") Reported-by: Ferry Toth Tested-by: Ferry Toth Acked-by: Felipe Balbi Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20210827075853.266912-1-jbrunet@baylibre.com Signed-off-by: Greg Kroah-Hartman Bug: 199044440 Change-Id: I96cc41a0dc0e3ad15f9c9bbe5737f22e0fc74433 (cherry picked from commit 75432ba583a8a374b8d1ad2d3ba559a78f7454fc) Signed-off-by: Jack Pham --- drivers/usb/gadget/function/u_audio.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 018dd0978995..63d9340f008e 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -230,7 +230,13 @@ static void u_audio_iso_fback_complete(struct usb_ep *ep, int status = req->status; /* i/f shutting down */ - if (!prm->fb_ep_enabled || req->status == -ESHUTDOWN) + if (!prm->fb_ep_enabled) { + kfree(req->buf); + usb_ep_free_request(ep, req); + return; + } + + if (req->status == -ESHUTDOWN) return; /* @@ -421,9 +427,10 @@ static inline void free_ep_fback(struct uac_rtd_params *prm, struct usb_ep *ep) prm->fb_ep_enabled = false; if (prm->req_fback) { - usb_ep_dequeue(ep, prm->req_fback); - kfree(prm->req_fback->buf); - usb_ep_free_request(ep, prm->req_fback); + if (usb_ep_dequeue(ep, prm->req_fback)) { + kfree(prm->req_fback->buf); + usb_ep_free_request(ep, prm->req_fback); + } prm->req_fback = NULL; } From 35afadf0dab2b061148068d3a0d674696c7a0890 Mon Sep 17 00:00:00 2001 From: Subbaraman Narayanamurthy Date: Fri, 3 Sep 2021 16:56:12 -0700 Subject: [PATCH 13/20] FROMLIST: thermal: Fix a NULL pointer dereference of_parse_thermal_zones() parses the thermal-zones node and registers a thermal_zone device for each subnode. However, if a thermal zone is consuming a thermal sensor and that thermal sensor device hasn't probed yet, an attempt to set trip_point_*_temp for that thermal zone device can cause a NULL pointer dereference. Fix it. console:/sys/class/thermal/thermal_zone87 # echo 120000 > trip_point_0_temp ... Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 ... Call trace: of_thermal_set_trip_temp+0x40/0xc4 trip_point_temp_store+0xc0/0x1dc dev_attr_store+0x38/0x88 sysfs_kf_write+0x64/0xc0 kernfs_fop_write_iter+0x108/0x1d0 vfs_write+0x2f4/0x368 ksys_write+0x7c/0xec __arm64_sys_write+0x20/0x30 el0_svc_common.llvm.7279915941325364641+0xbc/0x1bc do_el0_svc+0x28/0xa0 el0_svc+0x14/0x24 el0_sync_handler+0x88/0xec el0_sync+0x1c0/0x200 While at it, fix the possible NULL pointer dereference in other functions as well: of_thermal_get_temp(), of_thermal_set_emul_temp(), of_thermal_get_trend(). Cc: stable@vger.kernel.org Suggested-by: David Collins Signed-off-by: Subbaraman Narayanamurthy Bug: 199134856 Link: https://lore.kernel.org/linux-pm/1631041289-11804-1-git-send-email-quic_subbaram@quicinc.com/T/#u Change-Id: I6d5108d3abc7554f91f2e98f2617162224bf0ce3 Signed-off-by: Subbaraman Narayanamurthy --- drivers/thermal/thermal_of.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 5b76f9a1280d..84278a609ff7 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -89,7 +89,7 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz, { struct __thermal_zone *data = tz->devdata; - if (!data->ops->get_temp) + if (!data->ops || !data->ops->get_temp) return -EINVAL; return data->ops->get_temp(data->sensor_data, temp); @@ -186,6 +186,9 @@ static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, { struct __thermal_zone *data = tz->devdata; + if (!data->ops || !data->ops->set_emul_temp) + return -EINVAL; + return data->ops->set_emul_temp(data->sensor_data, temp); } @@ -194,7 +197,7 @@ static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, { struct __thermal_zone *data = tz->devdata; - if (!data->ops->get_trend) + if (!data->ops || !data->ops->get_trend) return -EINVAL; return data->ops->get_trend(data->sensor_data, trip, trend); @@ -301,7 +304,7 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, if (trip >= data->ntrips || trip < 0) return -EDOM; - if (data->ops->set_trip_temp) { + if (data->ops && data->ops->set_trip_temp) { int ret; ret = data->ops->set_trip_temp(data->sensor_data, trip, temp); From ab9ceb4334cd02e593c0eae77f54f6d75103846d Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Wed, 1 Sep 2021 18:29:12 -0700 Subject: [PATCH 14/20] FROMLIST: usb: gadget: f_uac2: Add missing companion descriptor for feedback EP The f_uac2 function fails to enumerate when connected in SuperSpeed due to the feedback endpoint missing the companion descriptor. We can reuse the ss_epin_desc_comp descriptor and append it behind the ss_epin_fback_desc both in the static definition of the ss_audio_desc structure as well as its dynamic construction in setup_headers(). Fixes: 24f779dac8f3 ("usb: gadget: f_uac2/u_audio: add feedback endpoint support") Signed-off-by: Jack Pham Bug: 199044440 Link: https://lore.kernel.org/linux-usb/20210902014317.16775-1-jackp@codeaurora.org/ Change-Id: I0e8d73d69675b649c6b13a48900b391fd5423129 Signed-off-by: Jack Pham --- drivers/usb/gadget/function/f_uac2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index ae29ff2b2b68..c3f87fa6874a 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -527,6 +527,7 @@ static struct usb_descriptor_header *ss_audio_desc[] = { (struct usb_descriptor_header *)&ss_epout_desc_comp, (struct usb_descriptor_header *)&as_iso_out_desc, (struct usb_descriptor_header *)&ss_epin_fback_desc, + (struct usb_descriptor_header *)&ss_epin_desc_comp, (struct usb_descriptor_header *)&std_as_in_if0_desc, (struct usb_descriptor_header *)&std_as_in_if1_desc, @@ -654,8 +655,11 @@ static void setup_headers(struct f_uac2_opts *opts, headers[i++] = USBDHDR(&as_iso_out_desc); - if (EPOUT_FBACK_IN_EN(opts)) + if (EPOUT_FBACK_IN_EN(opts)) { headers[i++] = USBDHDR(epin_fback_desc); + if (epin_desc_comp) + headers[i++] = USBDHDR(epin_desc_comp); + } } if (EPIN_EN(opts)) { headers[i++] = USBDHDR(&std_as_in_if0_desc); From 3f26745caeab48fa1facacb7aef58d10783a2dae Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Mon, 6 Sep 2021 14:04:00 +0200 Subject: [PATCH 15/20] FROMLIST: usb: gadget: f_uac2: fixed EP-IN wMaxPacketSize Async feedback patches broke enumeration on Windows 10 previously fixed by commit 789ea77310f0 ("usb: gadget: f_uac2: always increase endpoint max_packet_size by one audio slot"). While the existing calculation for EP OUT capture for async mode yields size+1 frame due to uac2_opts->fb_max > 0, playback side lost the +1 feature. Therefore the +1 frame addition must be re-introduced for playback. Win10 enumerates the device only when both EP IN and EP OUT max packet sizes are (at least) +1 frame. Signed-off-by: Pavel Hofman Tested-by: Henrik Enquist Tested-by: Jack Pham Bug: 199044440 Link: https://lore.kernel.org/linux-usb/b11414f0-1783-192e-2b79-066dd4c814d0@ivitera.com/ Change-Id: I74994d717b0eb543104e3ed7b20ca06c7c584be9 Signed-off-by: Jack Pham --- drivers/usb/gadget/function/f_uac2.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index c3f87fa6874a..4b506412e273 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -585,11 +585,17 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, ssize = uac2_opts->c_ssize; } - if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC)) + if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC)) { + // Win10 requires max packet size + 1 frame srate = srate * (1000 + uac2_opts->fb_max) / 1000; - - max_size_bw = num_channels(chmask) * ssize * - DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))); + // updated srate is always bigger, therefore DIV_ROUND_UP always yields +1 + max_size_bw = num_channels(chmask) * ssize * + (DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)))); + } else { + // adding 1 frame provision for Win10 + max_size_bw = num_channels(chmask) * ssize * + (DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))) + 1); + } ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw, max_size_ep)); From f00a543047ff4d11e565090b4e3d5e559a7fea3e Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Mon, 6 Sep 2021 15:08:22 +0200 Subject: [PATCH 16/20] FROMLIST: usb: gadget: u_audio: EP-OUT bInterval in fback frequency The patch increases the bitshift in feedback frequency calculation with EP-OUT bInterval value. Tests have revealed that Win10 and OSX UAC2 drivers require the feedback frequency to be based on the actual packet interval instead of on the USB2 microframe. Otherwise they ignore the feedback value. Linux snd-usb-audio driver detects the applied bitshift automatically. Signed-off-by: Pavel Hofman Tested-by: Henrik Enquist Bug: 199044440 Link: https://lore.kernel.org/linux-usb/20210906130822.12256-1-pavel.hofman@ivitera.com/ Change-Id: Idf8f1c6cde108d7527be4cdd030d87ec645252fd Signed-off-by: Jack Pham --- drivers/usb/gadget/function/u_audio.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 63d9340f008e..5f661325f5b0 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -76,11 +76,13 @@ static const struct snd_pcm_hardware uac_pcm_hardware = { }; static void u_audio_set_fback_frequency(enum usb_device_speed speed, + struct usb_ep *out_ep, unsigned long long freq, unsigned int pitch, void *buf) { u32 ff = 0; + const struct usb_endpoint_descriptor *ep_desc; /* * Because the pitch base is 1000000, the final divider here @@ -108,8 +110,13 @@ static void u_audio_set_fback_frequency(enum usb_device_speed speed, * byte fromat (that is Q16.16) * * ff = (freq << 16) / 8000 + * + * Win10 and OSX UAC2 drivers require number of samples per packet + * in order to honor the feedback value. + * Linux snd-usb-audio detects the applied bit-shift automatically. */ - freq <<= 4; + ep_desc = out_ep->desc; + freq <<= 4 + (ep_desc->bInterval - 1); } ff = DIV_ROUND_CLOSEST_ULL((freq * pitch), 1953125); @@ -247,7 +254,7 @@ static void u_audio_iso_fback_complete(struct usb_ep *ep, pr_debug("%s: iso_complete status(%d) %d/%d\n", __func__, status, req->actual, req->length); - u_audio_set_fback_frequency(audio_dev->gadget->speed, + u_audio_set_fback_frequency(audio_dev->gadget->speed, audio_dev->out_ep, params->c_srate, prm->pitch, req->buf); @@ -506,7 +513,7 @@ int u_audio_start_capture(struct g_audio *audio_dev) * be meauserd at start of playback */ prm->pitch = 1000000; - u_audio_set_fback_frequency(audio_dev->gadget->speed, + u_audio_set_fback_frequency(audio_dev->gadget->speed, ep, params->c_srate, prm->pitch, req_fback->buf); From 8cf5bb6946a26dca28fd9c3c8a075deccba2bd31 Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Wed, 24 Mar 2021 21:37:50 -0700 Subject: [PATCH 17/20] UPSTREAM: mm: memblock: fix section mismatch warning again Commit 34dc2efb39a2 ("memblock: fix section mismatch warning") marked memblock_bottom_up() and memblock_set_bottom_up() as __init, but they could be referenced from non-init functions like memblock_find_in_range_node() on architectures that enable CONFIG_ARCH_KEEP_MEMBLOCK. For such builds kernel test robot reports: WARNING: modpost: vmlinux.o(.text+0x74fea4): Section mismatch in reference from the function memblock_find_in_range_node() to the function .init.text:memblock_bottom_up() The function memblock_find_in_range_node() references the function __init memblock_bottom_up(). This is often because memblock_find_in_range_node lacks a __init annotation or the annotation of memblock_bottom_up is wrong. Replace __init annotations with __init_memblock annotations so that the appropriate section will be selected depending on CONFIG_ARCH_KEEP_MEMBLOCK. Link: https://lore.kernel.org/lkml/202103160133.UzhgY0wt-lkp@intel.com Link: https://lkml.kernel.org/r/20210316171347.14084-1-rppt@kernel.org Fixes: 34dc2efb39a2 ("memblock: fix section mismatch warning") Signed-off-by: Mike Rapoport Reviewed-by: Arnd Bergmann Reported-by: kernel test robot Reviewed-by: David Hildenbrand Acked-by: Nick Desaulniers Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit a024b7c2850dddd01e65b8270f0971deaf272f27) Bug: 187129171 Signed-off-by: Connor O'Brien Change-Id: Ic5c2281030801424904ba3df442464d670e37667 --- include/linux/memblock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 7643d2dfa959..4ce9c8f9e684 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size) /* * Set the allocation direction to bottom-up or top-down. */ -static inline __init void memblock_set_bottom_up(bool enable) +static inline __init_memblock void memblock_set_bottom_up(bool enable) { memblock.bottom_up = enable; } @@ -470,7 +470,7 @@ static inline __init void memblock_set_bottom_up(bool enable) * if this is true, that said, memblock will allocate memory * in bottom-up direction. */ -static inline __init bool memblock_bottom_up(void) +static inline __init_memblock bool memblock_bottom_up(void) { return memblock.bottom_up; } From 90c60a51f510da64554abe9c6b748ed624543192 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Thu, 19 Aug 2021 14:00:57 -0700 Subject: [PATCH 18/20] UPSTREAM: f2fs: guarantee to write dirty data when enabling checkpoint back We must flush all the dirty data when enabling checkpoint back. Let's guarantee that first by adding a retry logic on sync_inodes_sb(). In addition to that, this patch adds to flush data in fsync when checkpoint is disabled, which can mitigate the sync_inodes_sb() failures in advance. Bug: 194449609 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim (cherry picked from commit dddd3d65293a52c2c3850c19b1e5115712e534d8) Change-Id: I5bbef7386ddbb44fd925262fb68a8ef0a4960993 --- fs/f2fs/file.c | 5 ++--- fs/f2fs/super.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 3ad86f20ea73..750a27c473d8 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -263,8 +263,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, }; unsigned int seq_id = 0; - if (unlikely(f2fs_readonly(inode->i_sb) || - is_sbi_flag_set(sbi, SBI_CP_DISABLED))) + if (unlikely(f2fs_readonly(inode->i_sb))) return 0; trace_f2fs_sync_file_enter(inode); @@ -278,7 +277,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, ret = file_write_and_wait_range(file, start, end); clear_inode_flag(inode, FI_NEED_IPU); - if (ret) { + if (ret || is_sbi_flag_set(sbi, SBI_CP_DISABLED)) { trace_f2fs_sync_file_exit(inode, cp_reason, datasync, ret); return ret; } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 6d2eba662b84..1539052338b9 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1965,8 +1965,17 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) { + int retry = DEFAULT_RETRY_IO_COUNT; + /* we should flush all the data to keep data consistency */ - sync_inodes_sb(sbi->sb); + do { + sync_inodes_sb(sbi->sb); + cond_resched(); + congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT); + } while (get_pages(sbi, F2FS_DIRTY_DATA) && retry--); + + if (unlikely(retry < 0)) + f2fs_warn(sbi, "checkpoint=enable has some unwritten data."); down_write(&sbi->gc_lock); f2fs_dirty_to_prefree(sbi); From 774f1bd29cbaa84a9b211216099559c96b2bbab0 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Wed, 8 Sep 2021 13:25:55 -0700 Subject: [PATCH 19/20] ANDROID: Disable CFI on restricted vendor hooks in TRACE_HEADER_MULTI_READ commit 5e767aa07eea ("ANDROID: use static_call() for restricted hooks") introduced an implementation of __iteriter_##_name when TRACE_HEADER_MULTI_READ is defined. __nocfi that function as well in order to keep the performance optimizations from commit 384becf1643b ("ANDROID: Disable CFI on restricted vendor hooks"). Fixes: 384becf1643b ("ANDROID: Disable CFI on restricted vendor hooks") Change-Id: I6ea1cd767bad95c324c06398475174b710ae4dbe Signed-off-by: Elliot Berman --- include/trace/hooks/vendor_hooks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/hooks/vendor_hooks.h b/include/trace/hooks/vendor_hooks.h index f51a9ac31045..87fe9ccdc331 100644 --- a/include/trace/hooks/vendor_hooks.h +++ b/include/trace/hooks/vendor_hooks.h @@ -33,7 +33,7 @@ int android_rvh_probe_register(struct tracepoint *tp, void *probe, void *data); .unregfunc = _unreg, \ .funcs = NULL }; \ __TRACEPOINT_ENTRY(_name); \ - int __traceiter_##_name(void *__data, proto) \ + int __nocfi __traceiter_##_name(void *__data, proto) \ { \ struct tracepoint_func *it_func_ptr; \ void *it_func; \ From 6c3417436a6f3ac0813095d90d970bd243659df1 Mon Sep 17 00:00:00 2001 From: Jone Chou Date: Fri, 10 Sep 2021 21:13:08 +0800 Subject: [PATCH 20/20] ANDROID: kernel: fix module info for debug_kinfo After commit f80fb3a3d508 ("arm64: add support for kernel ASLR") The module range is determined by module_alloc_base and MODULES_VSIZE; Fixes: c6857771051a ("ANDROID: kernel: add module info for debug_kinfo") Bug: 191677481 Bug: 191767613 Bug: 199478594 Signed-off-by: Jone Chou Change-Id: Id41d95cfba01e8e5502d058f98e30ecbaf52abe4 --- drivers/staging/android/debug_kinfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/debug_kinfo.c b/drivers/staging/android/debug_kinfo.c index 0a8d4deeb6dc..8e67fb3a205f 100644 --- a/drivers/staging/android/debug_kinfo.c +++ b/drivers/staging/android/debug_kinfo.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "debug_kinfo.h" /* @@ -163,7 +164,10 @@ static int debug_kinfo_probe(struct platform_device *pdev) info->mod_core_layout_offset = offsetof(struct module, core_layout); info->mod_init_layout_offset = offsetof(struct module, init_layout); info->mod_kallsyms_offset = offsetof(struct module, kallsyms); -#if defined(CONFIG_MODULES) && defined(MODULES_VADDR) +#if defined(CONFIG_RANDOMIZE_BASE) && defined(MODULES_VSIZE) + info->module_start_va = module_alloc_base; + info->module_end_va = info->module_start_va + MODULES_VSIZE; +#elif defined(CONFIG_MODULES) && defined(MODULES_VADDR) info->module_start_va = MODULES_VADDR; info->module_end_va = MODULES_END; #else