diff --git a/android/GKI_VERSION b/android/GKI_VERSION
index df5f76c88f61..ca7dca22a8d6 100644
--- a/android/GKI_VERSION
+++ b/android/GKI_VERSION
@@ -1 +1 @@
-LTS_5.4.161_b9d179c605d3
+LTS_5.4.161_5d7a491ae4a7
diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml
index d9c149005f72..ebc1d68e38dc 100644
--- a/android/abi_gki_aarch64.xml
+++ b/android/abi_gki_aarch64.xml
@@ -2365,6 +2365,7 @@
+
@@ -6213,12 +6214,12 @@
-
+
-
+
-
+
@@ -6884,12 +6885,12 @@
-
+
-
+
-
+
@@ -19586,109 +19587,109 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -22162,9 +22163,9 @@
-
+
-
+
@@ -23718,6 +23719,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -25155,165 +25167,165 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -25932,6 +25944,11 @@
+
+
+
+
+
@@ -26343,7 +26360,7 @@
-
+
@@ -26397,7 +26414,7 @@
-
+
@@ -28617,18 +28634,18 @@
-
+
-
+
-
+
-
+
-
+
@@ -31261,7 +31278,7 @@
-
+
@@ -31269,7 +31286,7 @@
-
+
@@ -32557,7 +32574,7 @@
-
+
@@ -32819,7 +32836,7 @@
-
+
@@ -35859,109 +35876,109 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -37083,6 +37100,14 @@
+
+
+
+
+
+
+
+
@@ -37877,14 +37902,6 @@
-
-
-
-
-
-
-
-
@@ -46666,13 +46683,6 @@
-
-
-
-
-
-
-
@@ -46773,102 +46783,102 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -46877,7 +46887,7 @@
-
+
@@ -46901,347 +46911,347 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -47268,63 +47278,63 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -47412,12 +47422,12 @@
-
+
-
+
-
+
@@ -47484,24 +47494,24 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -48200,22 +48210,22 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
@@ -48224,18 +48234,18 @@
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
@@ -48370,7 +48380,7 @@
-
+
@@ -48789,18 +48799,18 @@
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -48845,42 +48855,42 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
@@ -48895,13 +48905,13 @@
-
-
-
+
+
+
-
-
+
+
@@ -55450,6 +55460,12 @@
+
+
+
+
+
+
@@ -55831,97 +55847,97 @@
-
-
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -67103,55 +67119,55 @@
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -73937,16 +73953,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -73960,12 +73966,6 @@
-
-
-
-
-
-
@@ -78188,6 +78188,12 @@
+
+
+
+
+
+
@@ -81841,6 +81847,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -85969,11 +85985,11 @@
-
+
-
+
@@ -85981,14 +85997,14 @@
-
+
-
+
-
+
@@ -91169,12 +91185,12 @@
-
+
-
+
@@ -91183,7 +91199,7 @@
-
+
@@ -92138,422 +92154,422 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -92573,63 +92589,63 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -92655,59 +92671,59 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -92733,7 +92749,7 @@
-
+
@@ -92799,13 +92815,13 @@
-
+
-
+
@@ -105551,10 +105567,10 @@
-
-
-
-
+
+
+
+
@@ -107366,8 +107382,8 @@
-
-
+
+
@@ -107393,74 +107409,74 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
@@ -107795,25 +107811,25 @@
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -108222,8 +108238,8 @@
-
-
+
+
@@ -108243,52 +108259,52 @@
-
-
-
-
+
+
+
+
-
+
-
+
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
-
-
-
+
+
+
@@ -108297,18 +108313,18 @@
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -108318,28 +108334,28 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
@@ -108478,7 +108494,7 @@
-
+
@@ -108541,54 +108557,54 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -109234,7 +109250,7 @@
-
+
@@ -109256,7 +109272,7 @@
-
+
@@ -109266,7 +109282,7 @@
-
+
@@ -109274,12 +109290,12 @@
-
+
-
+
@@ -109302,7 +109318,7 @@
-
+
@@ -109318,15 +109334,15 @@
-
+
-
+
-
+
@@ -109337,7 +109353,7 @@
-
+
@@ -109351,7 +109367,7 @@
-
+
@@ -109906,7 +109922,7 @@
-
+
@@ -109983,12 +109999,12 @@
-
+
-
+
@@ -110002,11 +110018,6 @@
-
-
-
-
-
@@ -112435,53 +112446,53 @@
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -112914,165 +112925,165 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -113186,18 +113197,18 @@
-
+
-
+
-
+
-
+
-
+
@@ -114635,7 +114646,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -114823,7 +114850,7 @@
-
+
@@ -114902,7 +114929,7 @@
-
+
@@ -114951,7 +114978,7 @@
-
+
@@ -115242,7 +115269,7 @@
-
+
@@ -115253,7 +115280,7 @@
-
+
@@ -115261,7 +115288,7 @@
-
+
@@ -115711,7 +115738,7 @@
-
+
@@ -117045,12 +117072,6 @@
-
-
-
-
-
-
@@ -117058,6 +117079,12 @@
+
+
+
+
+
+
@@ -117124,16 +117151,16 @@
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -117489,21 +117516,21 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
@@ -119181,7 +119208,7 @@
-
+
@@ -119194,31 +119221,31 @@
-
+
-
+
-
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
@@ -119289,24 +119316,24 @@
-
+
-
+
-
+
-
+
-
+
-
-
+
+
@@ -119325,8 +119352,8 @@
-
-
+
+
@@ -119361,85 +119388,85 @@
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
+
-
+
@@ -119480,7 +119507,7 @@
-
+
@@ -119495,72 +119522,72 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -119611,44 +119638,44 @@
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
@@ -119657,22 +119684,22 @@
-
-
+
+
-
-
+
+
-
+
-
+
-
+
@@ -119730,7 +119757,7 @@
-
+
@@ -120021,17 +120048,17 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -124742,9 +124769,9 @@
-
-
-
+
+
+
@@ -126123,12 +126150,12 @@
-
-
+
+
-
-
+
+
@@ -128948,15 +128975,15 @@
-
+
-
+
-
+
@@ -129104,57 +129131,57 @@
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
@@ -130964,38 +130991,38 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
@@ -136308,8 +136335,8 @@
-
-
+
+
@@ -139148,9 +139175,9 @@
-
-
-
+
+
+
@@ -139743,9 +139770,9 @@
-
-
-
+
+
+
@@ -140217,15 +140244,15 @@
-
+
-
+
-
+
-
+
@@ -140264,7 +140291,7 @@
-
+
@@ -140274,7 +140301,7 @@
-
+
@@ -140285,17 +140312,17 @@
-
+
-
+
-
+
@@ -140305,13 +140332,13 @@
-
+
-
+
@@ -140322,22 +140349,22 @@
-
+
-
+
-
+
-
+
@@ -142479,9 +142506,9 @@
-
-
-
+
+
+
@@ -142494,20 +142521,20 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -142518,8 +142545,8 @@
-
-
+
+
@@ -144275,28 +144302,28 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -144628,9 +144655,9 @@
-
-
-
+
+
+
@@ -147369,6 +147396,10 @@
+
+
+
+
@@ -147719,24 +147750,24 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -147984,18 +148015,18 @@
-
+
-
+
-
+
-
+
-
+
@@ -148505,7 +148536,7 @@
-
+
@@ -148606,6 +148637,12 @@
+
+
+
+
+
+
@@ -148980,6 +149017,13 @@
+
+
+
+
+
+
+
@@ -149670,20 +149714,20 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -150813,7 +150857,7 @@
-
+
@@ -150824,35 +150868,35 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -152753,12 +152797,12 @@
-
+
-
+
-
+
@@ -153706,9 +153750,9 @@
-
+
-
+
@@ -162851,22 +162895,22 @@
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -162933,19 +162977,19 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -164174,18 +164218,18 @@
-
+
-
+
-
+
-
+
-
+
@@ -164416,7 +164460,7 @@
-
+
@@ -164640,12 +164684,12 @@
-
+
-
+
-
+
@@ -164700,7 +164744,7 @@
-
+
@@ -164838,12 +164882,12 @@
-
+
-
+
@@ -165101,10 +165145,10 @@
-
-
-
-
+
+
+
+
@@ -165623,12 +165667,6 @@
-
-
-
-
-
-
@@ -166568,15 +166606,15 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -166670,12 +166708,6 @@
-
-
-
-
-
-
@@ -166898,209 +166930,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -167236,39 +167068,28 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
@@ -167343,106 +167164,99 @@
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
@@ -167450,10 +167264,6 @@
-
-
-
-
@@ -167561,7 +167371,7 @@
-
+
@@ -167574,8 +167384,8 @@
-
-
+
+
@@ -167606,8 +167416,8 @@
-
-
+
+
@@ -167787,12 +167597,12 @@
-
-
+
+
-
-
+
+
@@ -167803,100 +167613,100 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
-
-
-
-
-
-
+
+
+
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -168973,7 +168783,7 @@
-
+
@@ -171415,7 +171225,7 @@
-
+
@@ -171455,7 +171265,7 @@
-
+
@@ -171537,7 +171347,7 @@
-
+
@@ -171977,7 +171787,7 @@
-
+
@@ -173722,7 +173532,7 @@
-
+
@@ -173742,7 +173552,7 @@
-
+
@@ -173750,12 +173560,12 @@
-
+
-
+
@@ -173886,7 +173696,7 @@
-
+
@@ -175278,9 +175088,9 @@
-
-
-
+
+
+
@@ -175552,75 +175362,75 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -177043,7 +176853,7 @@
-
+
@@ -177179,7 +176989,7 @@
-
+
@@ -177722,27 +177532,27 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -178205,13 +178015,224 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -178293,7 +178314,7 @@
-
+
@@ -178306,6 +178327,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -184196,72 +184228,72 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -190945,16 +190977,16 @@
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -190963,69 +190995,69 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/android/abi_gki_aarch64_db845c b/android/abi_gki_aarch64_db845c
index d9bc40995f5b..898684f65cfe 100644
--- a/android/abi_gki_aarch64_db845c
+++ b/android/abi_gki_aarch64_db845c
@@ -583,6 +583,7 @@
__kfifo_alloc
__kfifo_free
kmalloc_order_trace
+ ktime_get_with_offset
__local_bh_enable_ip
memmove
param_ops_ulong
@@ -590,6 +591,7 @@
__rcu_read_lock
__rcu_read_unlock
regulatory_hint
+ rfc1042_header
skb_copy
skb_realloc_headroom
strlcat
@@ -660,6 +662,7 @@
phy_pm_runtime_get_sync
phy_pm_runtime_put_sync
platform_get_irq_byname_optional
+ pm_runtime_barrier
system_freezable_wq
usb_add_gadget_udc
usb_decode_ctrl
@@ -733,7 +736,6 @@
generic_file_read_iter
generic_file_splice_read
generic_read_dir
- generic_shutdown_super
__get_free_pages
get_zeroed_page
iget5_locked
@@ -745,6 +747,7 @@
kernel_read
kernel_write
kern_path
+ kill_anon_super
kobject_create_and_add
kobject_put
lockref_get
diff --git a/arch/arm/configs/vendor/sdxlemur.config b/arch/arm/configs/vendor/sdxlemur.config
index 8cdf99ab5a29..bb2d436b3e62 100644
--- a/arch/arm/configs/vendor/sdxlemur.config
+++ b/arch/arm/configs/vendor/sdxlemur.config
@@ -380,3 +380,4 @@ CONFIG_GKI_HIDDEN_DRM_CONFIGS=y
CONFIG_SDX_EXT_IPC=y
# CONFIG_SCHED_DEBUG is not set
CONFIG_MACSEC=y
+CONFIG_SYSVIPC=y
diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig
index cf3b76daba79..13f4ea529726 100644
--- a/arch/arm64/configs/gki_defconfig
+++ b/arch/arm64/configs/gki_defconfig
@@ -317,6 +317,7 @@ CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_EXAR is not set
+CONFIG_SERIAL_8250_RUNTIME_UARTS=0
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
diff --git a/arch/arm64/configs/vendor/holi_GKI.config b/arch/arm64/configs/vendor/holi_GKI.config
index 8583022f8f88..031730e79137 100644
--- a/arch/arm64/configs/vendor/holi_GKI.config
+++ b/arch/arm64/configs/vendor/holi_GKI.config
@@ -9,7 +9,6 @@ CONFIG_QCOM_COMMAND_DB=m
CONFIG_PINCTRL_HOLI=m
CONFIG_REGULATOR_STUB=m
CONFIG_REGULATOR_PROXY_CONSUMER=m
-CONFIG_KEYBOARD_GPIO=m
CONFIG_EXTCON=m
CONFIG_SPMI_MSM_PMIC_ARB=m
CONFIG_SPMI_MSM_PMIC_ARB_DEBUG=m
@@ -52,7 +51,6 @@ CONFIG_QCOM_SMP2P=m
CONFIG_QCOM_SMSM=m
CONFIG_MSM_QMP=m
CONFIG_QCOM_SMP2P_SLEEPSTATE=m
-CONFIG_RPMSG_CHAR=m
CONFIG_RPMSG_QCOM_GLINK_RPM=m
CONFIG_RPMSG_QCOM_GLINK_SMEM=m
CONFIG_QCOM_GLINK=m
@@ -72,7 +70,6 @@ CONFIG_MSM_SERVICE_LOCATOR=m
CONFIG_MSM_SERVICE_NOTIFIER=m
CONFIG_QSEE_IPC_IRQ=m
CONFIG_RPMSG_QCOM_GLINK_SPSS=m
-CONFIG_REGULATOR_FIXED_VOLTAGE=m
CONFIG_REGULATOR_QTI_FIXED_VOLTAGE=m
CONFIG_REGULATOR_REFGEN=m
CONFIG_COMMON_CLK_QCOM=m
@@ -186,15 +183,11 @@ CONFIG_SND_USB_AUDIO_QMI=m
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_STORAGE_ENE_UB6250 is not set
-# CONFIG_USB_UAS is not set
-CONFIG_USB_STORAGE=m
-CONFIG_USB_CONFIGFS_NCM=m
CONFIG_USB_CONFIGFS_F_CCID=m
CONFIG_USB_CONFIGFS_F_CDEV=m
CONFIG_USB_CONFIGFS_F_GSI=m
CONFIG_MSM_QUSB_PHY=m
CONFIG_MEDIA_USB_SUPPORT=y
-CONFIG_USB_VIDEO_CLASS=m
CONFIG_LEDS_QPNP_FLASH_V2=m
CONFIG_QTI_IOMMU_SUPPORT=m
CONFIG_MMC_SDHCI_MSM=m
diff --git a/arch/x86/configs/gki_defconfig b/arch/x86/configs/gki_defconfig
index 64cb6f5cd38b..8dade88321d3 100644
--- a/arch/x86/configs/gki_defconfig
+++ b/arch/x86/configs/gki_defconfig
@@ -290,6 +290,7 @@ CONFIG_INPUT_UINPUT=y
CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_RUNTIME_UARTS=0
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_HW_RANDOM=y
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index ed8ec011a9fd..42f3e42a10ee 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -4,7 +4,7 @@
#include
-#define COMMAND_LINE_SIZE 2048
+#define COMMAND_LINE_SIZE 4096
#include
#include
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 2739ebbc684b..add45eb9ea97 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -662,7 +662,7 @@ static void binder_free_buf_locked(struct binder_alloc *alloc,
BUG_ON(buffer->user_data > alloc->buffer + alloc->buffer_size);
if (buffer->async_transaction) {
- alloc->free_async_space += size + sizeof(struct binder_buffer);
+ alloc->free_async_space += buffer_size + sizeof(struct binder_buffer);
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
"%d: binder_free_buf size %zd async free %zd\n",
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index 0fe92ba12568..28755e98ddbf 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
/* Uncomment this block to log an error on every VERIFY failure */
@@ -529,6 +530,8 @@ struct fastrpc_apps {
struct hlist_head drivers;
spinlock_t hlock;
struct device *dev;
+ /* Indicates fastrpc device node info */
+ struct device *dev_fastrpc;
unsigned int latency;
int rpmsg_register;
bool legacy_remote_heap;
@@ -547,6 +550,8 @@ struct fastrpc_apps {
void *ramdump_handle;
bool enable_ramdump;
struct mutex mut_uid;
+ /* Indicates cdsp device status */
+ int remote_cdsp_status;
};
struct fastrpc_mmap {
@@ -2972,6 +2977,39 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
return err;
}
+/*
+ * name : fastrpc_get_dsp_status
+ * @in : pointer to fastrpc_apps
+ * @out : void
+ * Description : This function reads the property
+ * string from device node and updates the cdsp device
+ * avialbility status if the node belongs to cdsp device.
+ */
+
+static void fastrpc_get_dsp_status(struct fastrpc_apps *me)
+{
+ int ret = -1;
+ struct device_node *node = NULL;
+ const char *name = NULL;
+
+ do {
+ node = of_find_compatible_node(node, NULL, "qcom,pil-tz-generic");
+ if (node) {
+ ret = of_property_read_string(node, "qcom,firmware-name", &name);
+ if (!strcmp(name, "cdsp")) {
+ ret = of_device_is_available(node);
+ me->remote_cdsp_status = ret;
+ ADSPRPC_INFO("adsprpc: %s: cdsp node found with ret:%x\n",
+ __func__, ret);
+ break;
+ }
+ } else {
+ ADSPRPC_ERR("adsprpc: Error: %s: cdsp node not found\n", __func__);
+ break;
+ }
+ } while (1);
+}
+
static void fastrpc_init(struct fastrpc_apps *me)
{
int i;
@@ -6683,6 +6721,52 @@ bail:
return err;
}
+/*
+ * name : remote_cdsp_status_show
+ * @in : dev : pointer to device node
+ * attr: pointer to device attribute
+ * @out : buf : Contains remote cdsp status
+ * @Description : This function updates the buf with
+ * remote cdsp status by reading the fastrpc node
+ * @returns : bytes written to buf
+ */
+
+static ssize_t remote_cdsp_status_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct fastrpc_apps *me = &gfa;
+
+ /*
+ * Default remote DSP status: 0
+ * driver possibly not probed yet or not the main device.
+ */
+
+ if (!dev || !dev->driver ||
+ !of_device_is_compatible(dev->of_node, "qcom,msm-fastrpc-compute")) {
+ ADSPRPC_ERR(
+ "adsprpc: Error: %s: driver not probed yet or not the main device\n",
+ __func__);
+ return 0;
+ }
+
+ return scnprintf(buf, PAGE_SIZE, "%d",
+ me->remote_cdsp_status);
+}
+
+/* Remote cdsp status attribute declartion as read only */
+static DEVICE_ATTR_RO(remote_cdsp_status);
+
+/* Declaring attribute for remote dsp */
+static struct attribute *msm_remote_dsp_attrs[] = {
+ &dev_attr_remote_cdsp_status.attr,
+ NULL
+};
+
+/* Defining remote dsp attributes in attributes group */
+static struct attribute_group msm_remote_dsp_attr_group = {
+ .attrs = msm_remote_dsp_attrs,
+};
+
static int fastrpc_probe(struct platform_device *pdev)
{
int err = 0;
@@ -6693,6 +6777,14 @@ static int fastrpc_probe(struct platform_device *pdev)
if (of_device_is_compatible(dev->of_node,
"qcom,msm-fastrpc-compute")) {
+ me->dev_fastrpc = dev;
+ err = sysfs_create_group(&pdev->dev.kobj, &msm_remote_dsp_attr_group);
+ if (err) {
+ ADSPRPC_ERR(
+ "adsprpc: Error: %s: initialization of sysfs create group failed with %d\n",
+ __func__, err);
+ goto bail;
+ }
init_secure_vmid_list(dev, "qcom,adsp-remoteheap-vmid",
&gcinfo[0].rhvm);
fastrpc_init_privileged_gids(dev, "qcom,fastrpc-gids",
@@ -6814,6 +6906,7 @@ static int __init fastrpc_device_init(void)
}
memset(me, 0, sizeof(*me));
fastrpc_init(me);
+ fastrpc_get_dsp_status(me);
me->dev = NULL;
me->legacy_remote_heap = false;
VERIFY(err, 0 == platform_driver_register(&fastrpc_driver));
diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c
index 07250b388b56..9c500245b4e2 100644
--- a/drivers/hwtracing/coresight/coresight-byte-cntr.c
+++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c
@@ -182,7 +182,7 @@ EXPORT_SYMBOL(tmc_etr_byte_cntr_stop);
static void etr_pcie_close_channel(struct byte_cntr *byte_cntr_data)
{
- if (!byte_cntr_data)
+ if (!byte_cntr_data || !byte_cntr_data->pcie_chan_opened)
return;
mutex_lock(&byte_cntr_data->byte_cntr_lock);
diff --git a/drivers/i2c/busses/i2c-msm-geni.c b/drivers/i2c/busses/i2c-msm-geni.c
index 0fb48f90b612..9c508aa56efe 100644
--- a/drivers/i2c/busses/i2c-msm-geni.c
+++ b/drivers/i2c/busses/i2c-msm-geni.c
@@ -1235,11 +1235,15 @@ geni_i2c_txn_ret:
pm_runtime_mark_last_busy(gi2c->dev);
pm_runtime_put_autosuspend(gi2c->dev);
}
+
gi2c->cur = NULL;
- gi2c->err = 0;
- GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
- "i2c txn ret:%d\n", ret);
- return ret;
+ GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
+ "i2c txn ret:%d, num:%d, err%:%d\n", ret, num, gi2c->err);
+
+ if (gi2c->err)
+ return gi2c->err;
+ else
+ return ret;
}
static u32 geni_i2c_func(struct i2c_adapter *adap)
diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c
index 19114337368a..029970344159 100644
--- a/drivers/input/misc/qcom-hv-haptics.c
+++ b/drivers/input/misc/qcom-hv-haptics.c
@@ -1474,7 +1474,7 @@ static int haptics_open_loop_drive_config(struct haptics_chip *chip, bool en)
u8 val;
if ((is_boost_vreg_enabled_in_open_loop(chip) ||
- is_haptics_external_powered(chip)) && en) {
+ chip->hboost_enabled || is_haptics_external_powered(chip)) && en) {
/* Force VREG_RDY */
rc = haptics_masked_write(chip, chip->cfg_addr_base,
HAP_CFG_VSET_CFG_REG, FORCE_VREG_RDY_BIT,
@@ -1818,13 +1818,17 @@ static int haptics_set_manual_rc_clk_cal(struct haptics_chip *chip)
static int haptics_update_fifo_samples(struct haptics_chip *chip,
u8 *samples, u32 length)
{
- int rc, count, i;
+ int rc = 0, count, i, remain;
+ u8 tmp[HAP_PTN_V2_FIFO_DIN_NUM] = {0};
if (samples == NULL) {
dev_err(chip->dev, "no FIFO samples available\n");
return -EINVAL;
}
+ if (!length)
+ return 0;
+
if (chip->ptn_revision == HAP_PTN_V1) {
for (i = 0; i < length; i++) {
rc = haptics_update_fifo_sample_v1(chip, samples[i]);
@@ -1833,6 +1837,7 @@ static int haptics_update_fifo_samples(struct haptics_chip *chip,
}
} else {
count = length / HAP_PTN_V2_FIFO_DIN_NUM;
+ remain = length % HAP_PTN_V2_FIFO_DIN_NUM;
for (i = 0; i < count; i++) {
rc = haptics_update_fifo_sample_v2(chip,
samples, HAP_PTN_V2_FIFO_DIN_NUM);
@@ -1842,16 +1847,26 @@ static int haptics_update_fifo_samples(struct haptics_chip *chip,
samples += HAP_PTN_V2_FIFO_DIN_NUM;
}
- if (length % HAP_PTN_V2_FIFO_DIN_NUM) {
- rc = haptics_update_fifo_sample_v2(chip,
- samples,
- length % HAP_PTN_V2_FIFO_DIN_NUM);
- if (rc < 0)
- return rc;
+ if (remain) {
+ /*
+ * In HAP_PTN_V2 module, when 1-byte FIFO write clashes
+ * with the HW FIFO read operation, the HW will only read
+ * 1 valid byte in every 4 bytes FIFO samples. So avoid
+ * this by keeping the samples 4-byte aligned and always
+ * use 4-byte write for HAP_PTN_V2 module.
+ */
+ if (chip->ptn_revision == HAP_PTN_V2) {
+ memcpy(tmp, samples, remain);
+ rc = haptics_update_fifo_sample_v2(chip,
+ tmp, HAP_PTN_V2_FIFO_DIN_NUM);
+ } else {
+ rc = haptics_update_fifo_sample_v2(chip,
+ samples, remain);
+ }
}
}
- return 0;
+ return rc;
}
static int haptics_set_fifo_playrate(struct haptics_chip *chip,
@@ -1984,6 +1999,10 @@ static int haptics_set_fifo(struct haptics_chip *chip, struct fifo_cfg *fifo)
return available;
num = min_t(u32, available, num);
+ /* Keep the FIFO programming 4-byte aligned if FIFO refilling is needed */
+ if ((num < fifo->num_s) && (num % HAP_PTN_V2_FIFO_DIN_NUM))
+ num = round_down(num, HAP_PTN_V2_FIFO_DIN_NUM);
+
rc = haptics_update_fifo_samples(chip, fifo->samples, num);
if (rc < 0) {
dev_err(chip->dev, "write FIFO samples failed, rc=%d\n", rc);
@@ -2875,23 +2894,18 @@ static irqreturn_t fifo_empty_irq_handler(int irq, void *data)
if (num < 0)
goto unlock;
- /*
- * With HAPTICS_PATTERN module revision 2.0 and above, if use
- * 1-byte write before 4-byte write, the hardware would insert
- * zeros in between to keep the FIFO samples 4-byte aligned, and
- * the inserted 0 values would cause HW stop driving hence spurs
- * will be seen on the haptics output. So only use 1-byte write
- * at the end of FIFO streaming.
- */
- if (samples_left <= num)
- num = samples_left;
- else if ((chip->ptn_revision >= HAP_PTN_V2) &&
- (num % HAP_PTN_V2_FIFO_DIN_NUM))
- num -= (num % HAP_PTN_V2_FIFO_DIN_NUM);
-
samples = fifo->samples + status->samples_written;
- /* Write more pattern data into FIFO memory. */
+ /*
+ * Always use 4-byte burst write in the middle of FIFO programming to
+ * avoid HW padding zeros during 1-byte write which would cause the HW
+ * stop driving for the unexpected padding zeros.
+ */
+ if (num < samples_left)
+ num = round_down(num, HAP_PTN_V2_FIFO_DIN_NUM);
+ else
+ num = samples_left;
+
rc = haptics_update_fifo_samples(chip, samples, num);
if (rc < 0) {
dev_err(chip->dev, "Update FIFO samples failed, rc=%d\n",
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
index f607d9877e1a..1c2b4f3e454d 100644
--- a/drivers/interconnect/qcom/icc-rpm.c
+++ b/drivers/interconnect/qcom/icc-rpm.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
*/
@@ -133,6 +133,9 @@ int qcom_icc_rpm_set(struct icc_node *src, struct icc_node *dst)
do_div(clk_rate, qn->buswidth);
bus_clk_rate[i] = max(bus_clk_rate[i], clk_rate);
+
+ if (bus_clk_rate[i] > RPM_CLK_MAX_LEVEL)
+ bus_clk_rate[i] = RPM_CLK_MAX_LEVEL;
}
}
diff --git a/drivers/media/platform/msm/npu/npu_mgr.c b/drivers/media/platform/msm/npu/npu_mgr.c
index ca3a37288e57..f36aff27ccc5 100644
--- a/drivers/media/platform/msm/npu/npu_mgr.c
+++ b/drivers/media/platform/msm/npu/npu_mgr.c
@@ -911,6 +911,13 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg)
prop_rsp_pkt->num_params,
prop_rsp_pkt->prop_param[0]);
+ if (prop_rsp_pkt->header.size <
+ sizeof(struct ipc_msg_header_pkt)) {
+ pr_err("Invalid rsp pkt size %d\n",
+ prop_rsp_pkt->header.size);
+ break;
+ }
+
host_ctx->cmd_ret_status = prop_rsp_pkt->header.status;
if (prop_rsp_pkt->num_params > 0) {
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 971c3b7a51c3..2eff13c24253 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -95,7 +95,7 @@ static DEFINE_SPINLOCK(ubi_devices_lock);
static ssize_t version_show(struct class *class, struct class_attribute *attr,
char *buf)
{
- return scnprintf(buf, sizeof(int), "%d\n", UBI_VERSION);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", UBI_VERSION);
}
static CLASS_ATTR_RO(version);
@@ -376,49 +376,49 @@ static ssize_t dev_attribute_show(struct device *dev,
return -ENODEV;
if (attr == &dev_eraseblock_size)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->leb_size);
else if (attr == &dev_avail_eraseblocks)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->avail_pebs);
else if (attr == &dev_total_eraseblocks)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->good_peb_count);
else if (attr == &dev_volumes_count)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->vol_count - UBI_INT_VOL_COUNT);
else if (attr == &dev_max_ec)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->max_ec);
else if (attr == &dev_reserved_for_bad)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->beb_rsvd_pebs);
else if (attr == &dev_bad_peb_count)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->bad_peb_count);
else if (attr == &dev_max_vol_count)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->vtbl_slots);
else if (attr == &dev_min_io_size)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->min_io_size);
else if (attr == &dev_bgt_enabled)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->thread_enabled);
else if (attr == &dev_mtd_num)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->mtd->index);
else if (attr == &dev_ro_mode)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
ubi->ro_mode);
else if (attr == &dev_mtd_trigger_scrub)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
atomic_read(&ubi->scrub_work_count));
else if (attr == &dev_mtd_max_scrub_sqnum)
- ret = scnprintf(buf, sizeof(unsigned long long), "%llu\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%llu\n",
get_max_sqnum(ubi));
else if (attr == &dev_mtd_min_scrub_sqnum)
- ret = scnprintf(buf, sizeof(unsigned long long), "%llu\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%llu\n",
ubi_wl_scrub_get_min_sqnum(ubi));
else
ret = -EINVAL;
@@ -516,7 +516,7 @@ static int uif_init(struct ubi_device *ubi)
int i, err;
dev_t dev;
- scnprintf(ubi->ubi_name, sizeof(UBI_NAME_STR) + 5,
+ scnprintf(ubi->ubi_name, sizeof(ubi->ubi_name),
UBI_NAME_STR "%d", ubi->ubi_num);
/*
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 327f369d9fd0..c1d562f6b7e5 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -54,7 +54,7 @@ static struct device_attribute attr_vol_upd_marker =
static ssize_t vol_attribute_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int ret, size;
+ int ret;
struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev);
struct ubi_device *ubi;
@@ -73,35 +73,32 @@ static ssize_t vol_attribute_show(struct device *dev,
spin_unlock(&ubi->volumes_lock);
if (attr == &attr_vol_reserved_ebs)
- ret = scnprintf(buf, sizeof(int), "%d\n", vol->reserved_pebs);
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n", vol->reserved_pebs);
else if (attr == &attr_vol_type) {
const char *tp;
- if (vol->vol_type == UBI_DYNAMIC_VOLUME) {
+ if (vol->vol_type == UBI_DYNAMIC_VOLUME)
tp = "dynamic";
- size = 8;
- } else {
+ else
tp = "static";
- size = 7;
- }
- ret = scnprintf(buf, size, "%s\n", tp);
+ ret = scnprintf(buf, PAGE_SIZE, "%s\n", tp);
} else if (attr == &attr_vol_name)
- ret = scnprintf(buf, vol->name_len + 1, "%s\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%s\n",
vol->name);
else if (attr == &attr_vol_corrupted)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
vol->corrupted);
else if (attr == &attr_vol_alignment)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
vol->alignment);
else if (attr == &attr_vol_usable_eb_size)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
vol->usable_leb_size);
else if (attr == &attr_vol_data_bytes)
- ret = scnprintf(buf, sizeof(unsigned long long), "%lld\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%lld\n",
vol->used_bytes);
else if (attr == &attr_vol_upd_marker)
- ret = scnprintf(buf, sizeof(int), "%d\n",
+ ret = scnprintf(buf, PAGE_SIZE, "%d\n",
vol->upd_marker);
else
/* This must be a bug */
diff --git a/drivers/net/wireless/cnss2/debug.c b/drivers/net/wireless/cnss2/debug.c
index 84b5deeeff3a..c58133204ec7 100644
--- a/drivers/net/wireless/cnss2/debug.c
+++ b/drivers/net/wireless/cnss2/debug.c
@@ -136,12 +136,36 @@ static int cnss_stats_show_state(struct seq_file *s,
return 0;
}
+static int cnss_stats_show_capability(struct seq_file *s,
+ struct cnss_plat_data *plat_priv)
+{
+ if (test_bit(CNSS_FW_READY, &plat_priv->driver_state)) {
+ seq_puts(s, "\n<---------------- FW Capability ----------------->\n");
+ seq_printf(s, "Chip ID: 0x%x\n", plat_priv->chip_info.chip_id);
+ seq_printf(s, "Chip family: 0x%x\n",
+ plat_priv->chip_info.chip_family);
+ seq_printf(s, "Board ID: 0x%x\n",
+ plat_priv->board_info.board_id);
+ seq_printf(s, "SOC Info: 0x%x\n", plat_priv->soc_info.soc_id);
+ seq_printf(s, "Firmware Version: 0x%x\n",
+ plat_priv->fw_version_info.fw_version);
+ seq_printf(s, "Firmware Build Timestamp: %s\n",
+ plat_priv->fw_version_info.fw_build_timestamp);
+ seq_printf(s, "Firmware Build ID: %s\n",
+ plat_priv->fw_build_id);
+ }
+
+ return 0;
+}
+
static int cnss_stats_show(struct seq_file *s, void *data)
{
struct cnss_plat_data *plat_priv = s->private;
cnss_stats_show_state(s, plat_priv);
+ cnss_stats_show_capability(s, plat_priv);
+
return 0;
}
diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_core.c b/drivers/platform/msm/ep_pcie/ep_pcie_core.c
index 3b663d9fa8c9..684ce0400a5e 100644
--- a/drivers/platform/msm/ep_pcie/ep_pcie_core.c
+++ b/drivers/platform/msm/ep_pcie/ep_pcie_core.c
@@ -2003,6 +2003,11 @@ checkbme:
link_fail:
dev->power_on = false;
+ if (dev->phy_rev >= 3)
+ ep_pcie_write_mask(dev->parf + PCIE20_PARF_LTSSM, BIT(8), 0);
+ else
+ ep_pcie_write_mask(dev->elbi + PCIE20_ELBI_SYS_CTRL, BIT(0), 0);
+
if (!ep_pcie_debug_keep_resource)
ep_pcie_pipe_clk_deinit(dev);
pipe_clk_fail:
@@ -2021,7 +2026,6 @@ out:
int ep_pcie_core_disable_endpoint(void)
{
- u32 val = 0;
unsigned long irqsave_flags;
struct ep_pcie_dev_t *dev = &ep_pcie_dev;
@@ -2051,10 +2055,6 @@ int ep_pcie_core_disable_endpoint(void)
}
dev->conf_ipa_msi_iatu = false;
- val = readl_relaxed(dev->elbi + PCIE20_ELBI_SYS_STTS);
- EP_PCIE_DBG(dev, "PCIe V%d: LTSSM_STATE during disable:0x%x\n",
- dev->rev, (val >> 0xC) & 0x3f);
-
EP_PCIE_DBG2(dev, "PCIe V%d: Set pcie_disconnect_req during D3_COLD\n",
dev->rev);
ep_pcie_write_reg_field(dev->tcsr_perst_en,
diff --git a/drivers/platform/msm/mhi_dev/mhi.c b/drivers/platform/msm/mhi_dev/mhi.c
index 56b846e18f89..1b6259bdcaba 100644
--- a/drivers/platform/msm/mhi_dev/mhi.c
+++ b/drivers/platform/msm/mhi_dev/mhi.c
@@ -57,6 +57,7 @@
#define HOST_ADDR_MSB(addr) ((addr >> 32) & 0xFFFFFFFF)
#define MHI_IPC_LOG_PAGES (100)
+#define MHI_IPC_ERR_LOG_PAGES (10)
#define MHI_REGLEN 0x100
#define MHI_INIT 0
#define MHI_REINIT 1
@@ -71,7 +72,9 @@
uint32_t bhi_imgtxdb;
enum mhi_msg_level mhi_msg_lvl = MHI_MSG_ERROR;
enum mhi_msg_level mhi_ipc_msg_lvl = MHI_MSG_VERBOSE;
+enum mhi_msg_level mhi_ipc_err_msg_lvl = MHI_MSG_ERROR;
void *mhi_ipc_log;
+void *mhi_ipc_err_log;
static struct mhi_dev *mhi_ctx;
static void mhi_hwc_cb(void *priv, enum ipa_mhi_event_type event,
@@ -156,7 +159,8 @@ void mhi_dev_read_from_host_ipa(struct mhi_dev *mhi, struct mhi_addr *transfer)
(int)transfer->size,
mhi_dev_ring_cache_completion_cb, &ring_req);
if (rc)
- pr_err("error while reading from host:%d\n", rc);
+ mhi_log(MHI_MSG_ERROR, "error while reading from host:%d\n",
+ rc);
wait_for_completion(&done);
}
@@ -226,7 +230,8 @@ void mhi_dev_write_to_host_ipa(struct mhi_dev *mhi, struct mhi_addr *transfer,
(int)transfer->size,
cb_func, ereq);
if (rc)
- pr_err("error while writing to host:%d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "error while writing to host:%d\n", rc);
} else if (tr_type == MHI_DEV_DMA_SYNC) {
/* Copy the device content to a local device
* physical address.
@@ -237,7 +242,8 @@ void mhi_dev_write_to_host_ipa(struct mhi_dev *mhi, struct mhi_addr *transfer,
(u64) mhi->cache_dma_handle,
(int) transfer->size);
if (rc)
- pr_err("error while writing to host:%d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "error while writing to host:%d\n", rc);
}
}
@@ -276,7 +282,7 @@ static int mhi_dev_schedule_msi_ipa(struct mhi_dev *mhi, struct event_req *ereq)
rc = ep_pcie_get_msi_config(mhi->phandle, &cfg);
if (rc) {
- pr_err("Error retrieving pcie msi logic\n");
+ mhi_log(MHI_MSG_ERROR, "Error retrieving pcie msi logic\n");
return rc;
}
@@ -294,14 +300,16 @@ static int mhi_dev_schedule_msi_ipa(struct mhi_dev *mhi, struct event_req *ereq)
ereq->msi_cb = mhi_dev_event_msi_cb;
ch->msi_cnt++;
mhi_log(MHI_MSG_VERBOSE,
- "Sending MSI %d to 0x%llx as data = 0x%x for ch %d msi_count %d, ereq flush_num %d\n",
+ "Sending MSI %d to 0x%llx as data = 0x%x for ch_id:%d\t"
+ "msi_count %d, ereq flush_num %d\n",
ctx->ev.msivec, msi_addr.host_pa,
*ring->msi_buf, ch->ch_id,
ch->msi_cnt, ereq->flush_num);
} else {
ereq->msi_cb = mhi_dev_cmd_event_msi_cb;
mhi_log(MHI_MSG_VERBOSE,
- "Sending MSI %d to 0x%llx as data = 0x%x for cmd ack, ereq flush_num %d\n",
+ "Sending MSI %d to 0x%llx as data = 0x%x for cmd ack\t"
+ "ereq flush_num %d\n",
ctx->ev.msivec, msi_addr.host_pa, *ring->msi_buf,
ereq->flush_num);
}
@@ -380,7 +388,7 @@ static void mhi_dev_event_msi_cb(void *req)
if (ch->evt_buf_wp == ch->evt_buf_size)
ch->evt_buf_wp = 0;
/* Return the event req to the list */
- spin_lock_irqsave(&mhi->lock, flags);
+ mutex_lock(&ch->ch_lock);
if (ch->curr_ereq == NULL)
ch->curr_ereq = ereq;
else {
@@ -388,7 +396,7 @@ static void mhi_dev_event_msi_cb(void *req)
ereq->is_stale = false;
list_add_tail(&ereq->list, &ch->event_req_buffers);
}
- spin_unlock_irqrestore(&mhi->lock, flags);
+ mutex_unlock(&ch->ch_lock);
}
static void msi_trigger_completion_cb(void *data)
@@ -408,7 +416,8 @@ static int mhi_trigger_msi_edma(struct mhi_dev_ring *ring, u32 idx)
if (!mhi_ctx->msi_lower) {
rc = ep_pcie_get_msi_config(mhi_ctx->phandle, &cfg);
if (rc) {
- pr_err("Error retrieving pcie msi logic\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error retrieving pcie msi logic\n");
return rc;
}
@@ -431,7 +440,8 @@ static int mhi_trigger_msi_edma(struct mhi_dev_ring *ring, u32 idx)
sizeof(u32),
DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): desc is null, MSI to Host failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "desc is null, MSI to Host failed\n");
spin_unlock_irqrestore(&mhi_ctx->msi_lock, flags);
return -EFAULT;
}
@@ -457,17 +467,19 @@ static int mhi_dev_send_multiple_tr_events(struct mhi_dev *mhi, int evnt_ring,
struct mhi_dev_channel *ch;
if (!ereq) {
- pr_err("%s(): invalid event req\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "invalid event req\n");
return -EINVAL;
}
if (evnt_ring_idx > mhi->cfg.event_rings) {
- pr_err("Invalid event ring idx: %lld\n", evnt_ring_idx);
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid event ring_id:%lld\n", evnt_ring_idx);
return -EINVAL;
}
if (!ring) {
- pr_err("%s(): Ring %d not present\n", __func__, evnt_ring_idx);
+ mhi_log(MHI_MSG_ERROR, "ring_id:%d not present\n",
+ evnt_ring_idx);
return -EINVAL;
}
@@ -477,7 +489,8 @@ static int mhi_dev_send_multiple_tr_events(struct mhi_dev *mhi, int evnt_ring,
rc = mhi_ring_start(ring, ctx, mhi);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "error starting event ring %d\n", evnt_ring);
+ "error starting event ring_id:%d\n",
+ evnt_ring_idx);
return rc;
}
}
@@ -503,12 +516,12 @@ static int mhi_dev_send_multiple_tr_events(struct mhi_dev *mhi, int evnt_ring,
if (ch->state == MHI_DEV_CH_STOPPED ||
ch->state == MHI_DEV_CH_PENDING_STOP) {
mhi_log(MHI_MSG_ERROR,
- "Ch:%d is in %d state, abort sending completion evnt\n"
+ "ch_id:%d is in %d state, abort sending cmpl evnt\n"
, ch->ch_id, ch->state);
rc = -ENXIO;
goto exit;
}
- mhi_log(MHI_MSG_VERBOSE, "Flushing %d cmpl events of ch %d\n",
+ mhi_log(MHI_MSG_VERBOSE, "Flushing %d cmpl events of ch_id:%d\n",
ereq->num_events, ch->ch_id);
} else {
mhi_log(MHI_MSG_VERBOSE,
@@ -518,7 +531,8 @@ static int mhi_dev_send_multiple_tr_events(struct mhi_dev *mhi, int evnt_ring,
rc = mhi_dev_add_element(ring, ereq->tr_events, ereq, evt_len);
if (rc) {
- pr_err("%s(): error in adding element rc %d\n", __func__, rc);
+ mhi_log(MHI_MSG_ERROR,
+ "error in adding element rc %d\n", rc);
goto exit;
}
@@ -560,12 +574,12 @@ static int mhi_dev_send_multiple_tr_events(struct mhi_dev *mhi, int evnt_ring,
if (mhi_ctx->use_edma) {
rc = mhi_trigger_msi_edma(ring, ctx->ev.msivec);
if (rc)
- pr_err("%s: error sending in msi\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "error sending in msi\n");
} else {
/* Schedule DMA for MSI*/
rc = mhi_dev_schedule_msi_ipa(mhi, ereq);
if (rc)
- pr_err("%s: error sending in msi\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "error sending in msi\n");
}
exit:
@@ -640,34 +654,29 @@ static int mhi_dev_flush_transfer_completion_events(struct mhi_dev *mhi,
if (ch->state == MHI_DEV_CH_CLOSED ||
ch->state == MHI_DEV_CH_STOPPED) {
mhi_log(MHI_MSG_DBG,
- "Ch %d closed with %d writes pending\n",
+ "ch_id:%d closed with %d writes pending\n",
ch->ch_id, ch->pend_wr_count + 1);
rc = -ENODEV;
break;
}
- spin_lock_irqsave(&mhi->lock, flags);
if (list_empty(&ch->flush_event_req_buffers)) {
- spin_unlock_irqrestore(&mhi->lock, flags);
break;
}
flush_ereq = container_of(ch->flush_event_req_buffers.next,
struct event_req, list);
list_del_init(&flush_ereq->list);
- spin_unlock_irqrestore(&mhi->lock, flags);
if (ch->flush_req_cnt++ >= U32_MAX)
ch->flush_req_cnt = 0;
flush_ereq->flush_num = ch->flush_req_cnt;
- mhi_log(MHI_MSG_DBG, "Flush num %d called for ch %d\n",
+ mhi_log(MHI_MSG_DBG, "Flush num %d called for ch_id:%d\n",
ch->flush_req_cnt, ch->ch_id);
/* Check the limits of the buffer to be flushed */
if (flush_ereq->tr_events < ch->tr_events ||
(flush_ereq->tr_events + flush_ereq->num_events) >
(ch->tr_events + ch->evt_buf_size)) {
- pr_err("%s: Invalid completion event buffer!\n",
- __func__);
mhi_log(MHI_MSG_ERROR,
"Invalid cmpl evt buf - start %pK, end %pK\n",
flush_ereq->tr_events,
@@ -792,7 +801,6 @@ static int mhi_dev_queue_transfer_completion(struct mhi_req *mreq, bool *flush)
ch->curr_ereq->context = ch;
/* Move current event req to flush list*/
- spin_lock_irqsave(&mhi_ctx->lock, flags);
list_add_tail(&ch->curr_ereq->list,
&ch->flush_event_req_buffers);
@@ -804,12 +812,10 @@ static int mhi_dev_queue_transfer_completion(struct mhi_req *mreq, bool *flush)
ch->curr_ereq->num_events = 0;
ch->curr_ereq->start = ch->evt_buf_rp;
} else {
- pr_err("%s evt req buffers empty\n", __func__);
mhi_log(MHI_MSG_ERROR,
"evt req buffers empty\n");
ch->curr_ereq = NULL;
}
- spin_unlock_irqrestore(&mhi_ctx->lock, flags);
}
return 0;
}
@@ -849,11 +855,14 @@ int mhi_transfer_host_to_device_ipa(void *dev, uint64_t host_pa, uint32_t len,
mhi_log(MHI_MSG_VERBOSE, "device 0x%llx <-- host 0x%llx, size %d\n",
(uint64_t) mhi->read_dma_handle, host_addr_pa, (int) len);
+ ch = mreq->client->channel;
if (mreq->mode == DMA_SYNC) {
rc = ipa_dma_sync_memcpy((u64) mhi->read_dma_handle,
host_addr_pa, (int) len);
if (rc) {
- pr_err("error while reading chan using sync:%d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "error while reading ch_id:%d using sync, rc\n",
+ ch->ch_id, rc);
return rc;
}
memcpy(dev, mhi->read_handle, len);
@@ -866,7 +875,8 @@ int mhi_transfer_host_to_device_ipa(void *dev, uint64_t host_pa, uint32_t len,
if (ring->rd_offset == ring->wr_offset) {
mhi_log(MHI_MSG_VERBOSE,
- "Setting snd_cmpl to 1 for ch %d\n", ch->ch_id);
+ "Setting snd_cmpl to 1 for ch_id:%d\n",
+ ch->ch_id);
mreq->snd_cmpl = 1;
}
@@ -874,7 +884,7 @@ int mhi_transfer_host_to_device_ipa(void *dev, uint64_t host_pa, uint32_t len,
rc = mhi_dev_queue_transfer_completion(mreq, NULL);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Failed to queue completion for ch %d, rc %d\n",
+ "Failed to queue completion for ch_id:%d, rc %d\n",
ch->ch_id, rc);
return rc;
}
@@ -884,7 +894,8 @@ int mhi_transfer_host_to_device_ipa(void *dev, uint64_t host_pa, uint32_t len,
mreq);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "DMA read error %d for ch %d\n", rc, ch->ch_id);
+ "DMA read error %d for ch_id:%d\n",
+ rc, ch->ch_id);
/* Roll back the completion event that we wrote above */
mhi_dev_rollback_compl_evt(ch);
/* Unmap the buffer */
@@ -948,7 +959,8 @@ int mhi_transfer_device_to_host_ipa(uint64_t host_addr, void *dev, uint32_t len,
/* Queue the completion event for the current transfer */
rc = mhi_dev_queue_transfer_completion(req, &flush);
if (rc) {
- pr_err("Failed to queue completion: %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to queue completion: %d\n", rc);
return rc;
}
@@ -1006,7 +1018,7 @@ void mhi_dev_read_from_host_edma(struct mhi_dev *mhi, struct mhi_addr *transfer)
transfer->phy_addr, host_addr_pa,
(int)transfer->size, DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
return;
}
descriptor->callback_param = &read_from_host;
@@ -1057,7 +1069,8 @@ void mhi_dev_write_to_host_edma(struct mhi_dev *mhi, struct mhi_addr *transfer,
transfer->virt_addr, transfer->size,
DMA_TO_DEVICE);
if (dma_mapping_error(&mhi->pdev->dev, dma)) {
- pr_err("%s(): dma mapping failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "dma mapping failed\n");
return;
}
}
@@ -1081,7 +1094,7 @@ void mhi_dev_write_to_host_edma(struct mhi_dev *mhi, struct mhi_addr *transfer,
dma, (int)transfer->size,
DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
dma_unmap_single(&mhi->pdev->dev,
(size_t)transfer->virt_addr, transfer->size,
DMA_TO_DEVICE);
@@ -1102,7 +1115,7 @@ void mhi_dev_write_to_host_edma(struct mhi_dev *mhi, struct mhi_addr *transfer,
(int)transfer->size,
DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
return;
}
@@ -1153,7 +1166,7 @@ int mhi_transfer_host_to_device_edma(void *dev, uint64_t host_pa, uint32_t len,
host_addr_pa, (int)len,
DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
return -EFAULT;
}
descriptor->callback_param = &transfer_host_to_device;
@@ -1173,7 +1186,7 @@ int mhi_transfer_host_to_device_edma(void *dev, uint64_t host_pa, uint32_t len,
mreq->dma = dma_map_single(&mhi->pdev->dev, dev, len,
DMA_FROM_DEVICE);
if (dma_mapping_error(&mhi->pdev->dev, mreq->dma)) {
- pr_err("%s(): dma map single failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "dma map single failed\n");
return -ENOMEM;
}
@@ -1181,14 +1194,16 @@ int mhi_transfer_host_to_device_edma(void *dev, uint64_t host_pa, uint32_t len,
if (ring->rd_offset == ring->wr_offset) {
mhi_log(MHI_MSG_VERBOSE,
- "Setting snd_cmpl to 1 for ch %d\n", ch->ch_id);
+ "Setting snd_cmpl to 1 for ch_id:%d\n",
+ ch->ch_id);
mreq->snd_cmpl = 1;
}
/* Queue the completion event for the current transfer */
rc = mhi_dev_queue_transfer_completion(mreq, NULL);
if (rc) {
- pr_err("Failed to queue completion: %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to queue completion: %d\n", rc);
return rc;
}
@@ -1197,7 +1212,7 @@ int mhi_transfer_host_to_device_edma(void *dev, uint64_t host_pa, uint32_t len,
host_addr_pa, (int)len,
DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
/* Roll back the completion event that we wrote above */
mhi_dev_rollback_compl_evt(ch);
dma_unmap_single(&mhi->pdev->dev, (size_t)dev, len,
@@ -1249,7 +1264,7 @@ int mhi_transfer_device_to_host_edma(uint64_t host_addr, void *dev,
host_addr_pa, mhi->write_dma_handle,
(int)len, DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
return -EFAULT;
}
descriptor->callback_param = &transfer_device_to_host;
@@ -1267,7 +1282,7 @@ int mhi_transfer_device_to_host_edma(uint64_t host_addr, void *dev,
req->dma = dma_map_single(&mhi->pdev->dev, req->buf,
req->len, DMA_TO_DEVICE);
if (dma_mapping_error(&mhi->pdev->dev, req->dma)) {
- pr_err("%s(): dma map single failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "dma map single failed\n");
return -ENOMEM;
}
@@ -1279,7 +1294,8 @@ int mhi_transfer_device_to_host_edma(uint64_t host_addr, void *dev,
/* Queue the completion event for the current transfer */
rc = mhi_dev_queue_transfer_completion(req, &flush);
if (rc) {
- pr_err("Failed to queue completion: %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to queue completion: %d\n", rc);
return rc;
}
@@ -1287,7 +1303,7 @@ int mhi_transfer_device_to_host_edma(uint64_t host_addr, void *dev,
host_addr_pa, req->dma, (int) len,
DMA_PREP_INTERRUPT);
if (!descriptor) {
- pr_err("%s(): descriptor is null\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "descriptor is null\n");
/* Roll back the completion event that we wrote above */
mhi_dev_rollback_compl_evt(ch);
/* Unmap the buffer */
@@ -1369,13 +1385,15 @@ static int mhi_enable_int(void)
rc = mhi_dev_mmio_enable_ctrl_interrupt(mhi_ctx);
if (rc) {
- pr_err("Failed to enable control interrupt: %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to enable control interrupt: %d\n", rc);
return rc;
}
rc = mhi_dev_mmio_enable_cmdb_interrupt(mhi_ctx);
if (rc) {
- pr_err("Failed to enable command db: %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to enable command db: %d\n", rc);
return rc;
}
mhi_update_state_info(MHI_STATE_CONNECTED);
@@ -1400,20 +1418,22 @@ static int mhi_hwc_init(struct mhi_dev *mhi)
*/
rc = mhi_enable_int();
if (rc)
- pr_err("Error configuring interrupts: rc = %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error configuring interrupts: rc = %d\n", rc);
return rc;
}
/* Call IPA HW_ACC Init with MSI Address and db routing info */
rc = ep_pcie_get_msi_config(mhi_ctx->phandle, &cfg);
if (rc) {
- pr_err("Error retrieving pcie msi logic\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error retrieving pcie msi logic\n");
return rc;
}
rc = mhi_pcie_config_db_routing(mhi);
if (rc) {
- pr_err("Error configuring DB routing\n");
+ mhi_log(MHI_MSG_ERROR, "Error configuring DB routing\n");
return rc;
}
@@ -1477,16 +1497,18 @@ static void mhi_hwc_cb(void *priv, enum ipa_mhi_event_type event,
switch (event) {
case IPA_MHI_EVENT_READY:
mhi_log(MHI_MSG_INFO,
- "HW Channel uC is ready event=0x%X\n", event);
+ "HW ch uC is ready event=0x%X\n", event);
rc = mhi_hwc_start(mhi_ctx);
if (rc) {
- pr_err("hwc_init start failed with %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "hwc_init start failed with %d\n", rc);
return;
}
rc = mhi_enable_int();
if (rc) {
- pr_err("Error configuring interrupts, rc = %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error configuring interrupts, rc = %d\n", rc);
return;
}
@@ -1495,12 +1517,14 @@ static void mhi_hwc_cb(void *priv, enum ipa_mhi_event_type event,
case IPA_MHI_EVENT_DATA_AVAILABLE:
rc = mhi_dev_notify_sm_event(MHI_DEV_EVENT_HW_ACC_WAKEUP);
if (rc) {
- pr_err("Event HW_ACC_WAKEUP failed with %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Event HW_ACC_WAKEUP failed with %d\n", rc);
return;
}
break;
default:
- pr_err("HW Channel uC unknown event 0x%X\n", event);
+ mhi_log(MHI_MSG_ERROR,
+ "HW ch uC unknown event 0x%X\n", event);
break;
}
}
@@ -1517,14 +1541,16 @@ static int mhi_hwc_chcmd(struct mhi_dev *mhi, uint chid,
case MHI_DEV_RING_EL_RESET:
case MHI_DEV_RING_EL_STOP:
if ((chid-HW_CHANNEL_BASE) > NUM_HW_CHANNELS) {
- pr_err("Invalid Channel ID = 0x%X\n", chid);
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid HW ch_id:%d\n", chid);
return -EINVAL;
}
rc = ipa_mhi_disconnect_pipe(
mhi->ipa_clnt_hndl[chid-HW_CHANNEL_BASE]);
if (rc)
- pr_err("Stopping HW Channel%d failed 0x%X\n",
+ mhi_log(MHI_MSG_ERROR,
+ "Stopping HW ch_id:%d failed 0x%X\n",
chid, rc);
break;
case MHI_DEV_RING_EL_START:
@@ -1532,24 +1558,28 @@ static int mhi_hwc_chcmd(struct mhi_dev *mhi, uint chid,
connect_params.sys.skip_ep_cfg = true;
if (chid > HW_CHANNEL_END) {
- pr_err("Channel DB for %d not enabled\n", chid);
+ mhi_log(MHI_MSG_ERROR,
+ "ch DB for ch_id:%d not enabled\n", chid);
return -EINVAL;
}
if ((chid-HW_CHANNEL_BASE) > NUM_HW_CHANNELS) {
- pr_err("Invalid Channel = 0x%X\n", chid);
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid HW ch_id:%d\n", chid);
return -EINVAL;
}
rc = ipa_mhi_connect_pipe(&connect_params,
&mhi->ipa_clnt_hndl[chid-HW_CHANNEL_BASE]);
if (rc)
- pr_err("HW Channel%d start failed : %d\n",
+ mhi_log(MHI_MSG_ERROR,
+ "HW ch_id:%d start failed : %d\n",
chid, rc);
break;
case MHI_DEV_RING_EL_INVALID:
default:
- pr_err("Invalid Ring Element type = 0x%X\n", type);
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid Ring Element type = 0x%X\n", type);
break;
}
@@ -1563,13 +1593,13 @@ static void mhi_dev_core_ack_ctrl_interrupts(struct mhi_dev *dev,
rc = mhi_dev_mmio_read(dev, MHI_CTRL_INT_STATUS_A7, int_value);
if (rc) {
- pr_err("Failed to read A7 status\n");
+ mhi_log(MHI_MSG_ERROR, "Failed to read A7 status\n");
return;
}
rc = mhi_dev_mmio_write(dev, MHI_CTRL_INT_CLEAR_A7, *int_value);
if (rc) {
- pr_err("Failed to clear A7 status\n");
+ mhi_log(MHI_MSG_ERROR, "Failed to clear A7 status\n");
return;
}
}
@@ -1595,7 +1625,7 @@ int mhi_dev_syserr(struct mhi_dev *mhi)
if (WARN_ON(!mhi))
return -EINVAL;
- pr_err("MHI dev sys error\n");
+ mhi_log(MHI_MSG_ERROR, "MHI dev sys error\n");
return mhi_dev_dump_mmio(mhi);
}
@@ -1613,12 +1643,13 @@ int mhi_dev_send_event(struct mhi_dev *mhi, int evnt_ring,
rc = ep_pcie_get_msi_config(mhi->phandle, &cfg);
if (rc) {
- pr_err("Error retrieving pcie msi logic\n");
+ mhi_log(MHI_MSG_ERROR, "Error retrieving pcie msi logic\n");
return rc;
}
if (evnt_ring_idx > mhi->cfg.event_rings) {
- pr_err("Invalid event ring idx: %lld\n", evnt_ring_idx);
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid event ring_id: %lld\n", evnt_ring_idx);
return -EINVAL;
}
@@ -1627,7 +1658,8 @@ int mhi_dev_send_event(struct mhi_dev *mhi, int evnt_ring,
rc = mhi_ring_start(ring, ctx, mhi);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "error starting event ring %d\n", evnt_ring);
+ "error starting event ring_id:%d\n",
+ evnt_ring_idx);
return rc;
}
}
@@ -1696,12 +1728,12 @@ static int mhi_dev_send_completion_event_async(struct mhi_dev_channel *ch,
rc = mhi_dev_queue_transfer_completion(mreq, NULL);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Failed to queue completion for ch %d, rc %d\n",
+ "Failed to queue completion for ch_id:%d, rc %d\n",
ch->ch_id, rc);
return rc;
}
- mhi_log(MHI_MSG_VERBOSE, "Calling flush for ch %d\n", ch->ch_id);
+ mhi_log(MHI_MSG_VERBOSE, "Calling flush for ch_id:%d\n", ch->ch_id);
rc = mhi_dev_flush_transfer_completion_events(mhi, ch);
if (rc) {
mhi_log(MHI_MSG_ERROR,
@@ -1855,7 +1887,7 @@ static void mhi_dev_process_reset_cmd(struct mhi_dev *mhi, int ch_id)
rc = mhi_dev_mmio_disable_chdb_a7(mhi, ch_id);
if (rc) {
mhi_log(MHI_MSG_VERBOSE,
- "Failed to disable chdb for ch %d\n", ch_id);
+ "Failed to disable chdb for ch_id:%d\n", ch_id);
rc = mhi_dev_send_cmd_comp_event(mhi,
MHI_CMD_COMPL_CODE_UNDEFINED);
if (rc)
@@ -1865,19 +1897,19 @@ static void mhi_dev_process_reset_cmd(struct mhi_dev *mhi, int ch_id)
}
ch = &mhi->ch[ch_id];
- mhi_log(MHI_MSG_VERBOSE, "Processing reset cmd for ch%d\n", ch_id);
+ mhi_log(MHI_MSG_VERBOSE, "Processing reset cmd for ch_id:%d\n", ch_id);
/*
* Ensure that the completions that are present in the flush list are
- * removed from the list and discarded before stopping the channel.
- * Otherwise, those stale events may get flushed along with a valid
- * event in the next flush operation.
+ * removed from the list and added to event req list before channel
+ * reset. Otherwise, those stale events may get flushed along with a
+ * valid event in the next flush operation.
*/
- spin_lock_irqsave(&mhi_ctx->lock, flags);
- list_for_each_entry_safe(itr, tmp, &ch->flush_event_req_buffers, list) {
- list_del(&itr->list);
- kfree(itr);
+ if (!list_empty(&ch->flush_event_req_buffers)) {
+ list_for_each_entry_safe(itr, tmp, &ch->flush_event_req_buffers, list) {
+ list_del(&itr->list);
+ list_add_tail(&itr->list, &ch->event_req_buffers);
+ }
}
- spin_unlock_irqrestore(&mhi_ctx->lock, flags);
/* hard stop and set the channel to stop */
mhi->ch_ctx_cache[ch_id].ch_state =
@@ -1905,7 +1937,8 @@ static void mhi_dev_process_reset_cmd(struct mhi_dev *mhi, int ch_id)
rc = mhi_dev_send_cmd_comp_event(mhi,
MHI_CMD_COMPL_CODE_SUCCESS);
if (rc)
- pr_err("Error sending command completion event\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error sending command completion event\n");
ch->reset_pending = false;
}
@@ -1922,18 +1955,18 @@ static int mhi_dev_process_cmd_ring(struct mhi_dev *mhi,
union mhi_dev_ring_ctx *evt_ctx;
ch_id = el->generic.chid;
- mhi_log(MHI_MSG_VERBOSE, "for channel:%d and cmd:%d\n",
+ mhi_log(MHI_MSG_VERBOSE, "for ch_id:%d and cmd %d\n",
ch_id, el->generic.type);
switch (el->generic.type) {
case MHI_DEV_RING_EL_START:
- mhi_log(MHI_MSG_VERBOSE, "received start cmd for channel %d\n",
+ mhi_log(MHI_MSG_VERBOSE, "received start cmd for ch_id:%d\n",
ch_id);
if (ch_id >= (HW_CHANNEL_BASE)) {
rc = mhi_hwc_chcmd(mhi, ch_id, el->generic.type);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Error with HW channel cmd %d\n", rc);
+ "Error with HW ch cmd %d\n", rc);
rc = mhi_dev_send_cmd_comp_event(mhi,
MHI_CMD_COMPL_CODE_UNDEFINED);
if (rc)
@@ -1946,7 +1979,7 @@ static int mhi_dev_process_cmd_ring(struct mhi_dev *mhi,
rc = mhi_dev_mmio_enable_chdb_a7(mhi, ch_id);
if (rc) {
mhi_log(MHI_MSG_VERBOSE,
- "Failed to enable chdb for ch %d\n",
+ "Failed to enable chdb for ch_id:%d\n",
ch_id);
goto send_undef_completion_event;
}
@@ -1961,7 +1994,7 @@ static int mhi_dev_process_cmd_ring(struct mhi_dev *mhi,
mhi);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "start ring failed for ch %d\n", ch_id);
+ "start ring failed for ch_id:%d\n", ch_id);
goto send_undef_completion_event;
}
@@ -1986,21 +2019,11 @@ static int mhi_dev_process_cmd_ring(struct mhi_dev *mhi,
rc = mhi_ring_start(evt_ring, evt_ctx, mhi);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "error starting event ring %d\n",
+ "error starting event ring_id:%d\n",
mhi->ch_ctx_cache[ch_id].err_indx);
goto send_undef_completion_event;
}
}
- mutex_lock(&mhi->ch[ch_id].ch_lock);
- rc = mhi_dev_alloc_evt_buf_evt_req(mhi, &mhi->ch[ch_id],
- evt_ring);
- mutex_unlock(&mhi->ch[ch_id].ch_lock);
- if (rc) {
- mhi_log(MHI_MSG_ERROR,
- "Failed to alloc ereqs for er %d\n",
- mhi->ch_ctx_cache[ch_id].err_indx);
- goto send_undef_completion_event;
- }
}
if (MHI_USE_DMA(mhi))
@@ -2019,7 +2042,9 @@ send_start_completion_event:
rc = mhi_dev_send_cmd_comp_event(mhi,
MHI_CMD_COMPL_CODE_SUCCESS);
if (rc)
- pr_err("Error sending command completion event\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error sending compl event for ch_id:%d\n",
+ ch_id);
mhi_update_state_info_ch(ch_id, MHI_STATE_CONNECTED);
/* Trigger callback to clients */
@@ -2045,7 +2070,8 @@ send_undef_completion_event:
rc = mhi_hwc_chcmd(mhi, ch_id, el->generic.type);
if (rc)
mhi_log(MHI_MSG_ERROR,
- "send channel stop cmd event failed\n");
+ "send ch stop cmd event failed for ch_id:%d\n",
+ ch_id);
/* send the completion event to the host */
event.evt_cmd_comp.ptr = mhi->cmd_ctx_cache->rbase +
@@ -2062,7 +2088,8 @@ send_undef_completion_event:
rc = mhi_dev_flush_cmd_completion_events(mhi, &event);
if (rc) {
- pr_err("stop event send failed\n");
+ mhi_log(MHI_MSG_ERROR,
+ "stop event send failed\n");
return rc;
}
} else {
@@ -2075,7 +2102,9 @@ send_undef_completion_event:
*/
ring = &mhi->ring[ch_id + mhi->ch_ring_start];
if (ring->state == RING_STATE_UINT) {
- pr_err("Channel not opened for %d\n", ch_id);
+ mhi_log(MHI_MSG_ERROR,
+ "Channel not opened for ch_id:%d\n",
+ ch_id);
return -EINVAL;
}
@@ -2089,7 +2118,8 @@ send_undef_completion_event:
&mhi->ring[mhi->ch_ring_start + ch_id],
ch_id, mhi);
if (rc)
- pr_err("stop event send failed\n");
+ mhi_log(MHI_MSG_ERROR,
+ "stop event send failed\n");
mutex_unlock(&ch->ring->event_lock);
mutex_unlock(&ch->ch_lock);
@@ -2107,7 +2137,8 @@ send_undef_completion_event:
rc = mhi_hwc_chcmd(mhi, ch_id, el->generic.type);
if (rc)
mhi_log(MHI_MSG_ERROR,
- "send channel stop cmd event failed\n");
+ "send ch stop cmd event failed ch_id:%d\n",
+ ch_id);
/* send the completion event to the host */
event.evt_cmd_comp.ptr = mhi->cmd_ctx_cache->rbase +
@@ -2124,7 +2155,9 @@ send_undef_completion_event:
rc = mhi_dev_flush_cmd_completion_events(mhi, &event);
if (rc) {
- pr_err("stop event send failed\n");
+ mhi_log(MHI_MSG_ERROR,
+ "stop event send failed for ch_id:%d\n",
+ ch_id);
return rc;
}
} else {
@@ -2135,7 +2168,9 @@ send_undef_completion_event:
ring = &mhi->ring[ch_id + mhi->ch_ring_start];
if (ring->state == RING_STATE_UINT) {
- pr_err("Channel not opened for %d\n", ch_id);
+ mhi_log(MHI_MSG_ERROR,
+ "Channel not opened for ch_id:%d\n",
+ ch_id);
return -EINVAL;
}
ch = &mhi->ch[ch_id];
@@ -2143,7 +2178,7 @@ send_undef_completion_event:
mutex_lock(&ch->ring->event_lock);
if (ch->db_pending) {
mhi_log(MHI_MSG_ERROR,
- "skipping reset cmd ack for channel %d\n",
+ "skipping reset cmd ack for ch_id:%d\n",
ch_id);
ch->reset_pending = true;
mutex_unlock(&ch->ring->event_lock);
@@ -2161,7 +2196,9 @@ send_undef_completion_event:
}
break;
default:
- pr_err("%s: Invalid command:%d\n", __func__, el->generic.type);
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid command:%d, ch_id:%d\n",
+ el->generic.type, ch_id);
break;
}
return rc;
@@ -2176,7 +2213,7 @@ static int mhi_dev_process_tre_ring(struct mhi_dev *mhi,
if (ring->id < mhi->ch_ring_start) {
mhi_log(MHI_MSG_VERBOSE,
- "invalid channel ring id (%d), should be < %lu\n",
+ "invalid channel ring_id:%d, should be < %lu\n",
ring->id, mhi->ch_ring_start);
return -EINVAL;
}
@@ -2215,11 +2252,11 @@ static void mhi_dev_process_ring_pending(struct work_struct *work)
list_for_each_safe(cp, q, &mhi->process_ring_list) {
ring = list_entry(cp, struct mhi_dev_ring, list);
list_del(cp);
- mhi_log(MHI_MSG_VERBOSE, "processing ring %d\n", ring->id);
+ mhi_log(MHI_MSG_VERBOSE, "processing ring_id:%d\n", ring->id);
if (ring->id < mhi->ch_ring_start) {
mhi_log(MHI_MSG_ERROR,
- "ring (%d) is not a channel ring\n", ring->id);
+ "ring_id:%d is not a channel ring\n", ring->id);
goto exit;
}
@@ -2228,7 +2265,7 @@ static void mhi_dev_process_ring_pending(struct work_struct *work)
rc = mhi_dev_process_ring(ring);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "error processing ring %d\n", ring->id);
+ "error processing ring_id:%d\n", ring->id);
goto exit;
}
mutex_lock(&ch->ch_lock);
@@ -2243,7 +2280,7 @@ static void mhi_dev_process_ring_pending(struct work_struct *work)
*/
ch_id = ch->ch_id;
mhi_log(MHI_MSG_VERBOSE,
- "processing pending ch:%d reset\n", ch_id);
+ "processing pending ch_id:%d reset\n", ch_id);
rc = mhi_dev_process_ring(
&mhi->ring[mhi->cmd_ring_idx]);
if (rc) {
@@ -2304,7 +2341,8 @@ static bool mhi_dev_queue_channel_db(struct mhi_dev *mhi,
if (chintr_value & 1) {
ring = &mhi->ring[ch_num + mhi->ch_ring_start];
if (ring->state == RING_STATE_UINT) {
- pr_debug("Channel not opened for %d\n", ch_num);
+ pr_debug("Channel not opened for ch_id:%d\n",
+ ch_num);
continue;
}
mhi_ring_set_state(ring, RING_STATE_PENDING);
@@ -2316,7 +2354,8 @@ static bool mhi_dev_queue_channel_db(struct mhi_dev *mhi,
mutex_unlock(&ch->ch_lock);
rc = mhi_dev_mmio_disable_chdb_a7(mhi, ch_num);
if (rc) {
- pr_err("Error disabling chdb\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error disabling chdb\n");
return work_pending;
}
}
@@ -2419,25 +2458,28 @@ static int mhi_dev_abort(struct mhi_dev *mhi)
/* Clean up initialized channels */
rc = mhi_deinit(mhi);
if (rc) {
- pr_err("Error during mhi_deinit with %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error during mhi_deinit with %d\n", rc);
return rc;
}
rc = mhi_dev_mmio_mask_chdb_interrupts(mhi_ctx);
if (rc) {
- pr_err("Failed to enable channel db\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to enable ch db\n");
return rc;
}
rc = mhi_dev_mmio_disable_ctrl_interrupt(mhi_ctx);
if (rc) {
- pr_err("Failed to enable control interrupt\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to enable control interrupt\n");
return rc;
}
rc = mhi_dev_mmio_disable_cmdb_interrupt(mhi_ctx);
if (rc) {
- pr_err("Failed to enable command db\n");
+ mhi_log(MHI_MSG_ERROR, "Failed to enable command db\n");
return rc;
}
@@ -2455,7 +2497,8 @@ static int mhi_dev_abort(struct mhi_dev *mhi)
rc = ep_pcie_register_event(mhi_ctx->phandle,
&mhi_ctx->event_reg);
if (rc) {
- pr_err("Failed to register for events from PCIe\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to register for events from PCIe\n");
return rc;
}
@@ -2492,11 +2535,11 @@ static void mhi_dev_transfer_completion_cb(void *mreq)
ch->state == MHI_DEV_CH_STOPPED) {
if (inbound)
mhi_log(MHI_MSG_DBG,
- "Ch %d closed with %d writes pending\n",
+ "ch_id:%d closed with %d writes pending\n",
ch->ch_id, ch->pend_wr_count + 1);
else
mhi_log(MHI_MSG_DBG,
- "Ch %d closed with read pending\n", ch->ch_id);
+ "ch_id:%d closed with read pending\n", ch->ch_id);
return;
}
@@ -2507,7 +2550,7 @@ static void mhi_dev_transfer_completion_cb(void *mreq)
/* Flush read completions to host */
if (snd_cmpl && mhi_ctx->ch_ctx_cache[ch->ch_id].ch_type ==
MHI_DEV_CH_TYPE_OUTBOUND_CHANNEL) {
- mhi_log(MHI_MSG_DBG, "Calling flush for ch %d\n", ch->ch_id);
+ mhi_log(MHI_MSG_DBG, "Calling flush for ch_id:%d\n", ch->ch_id);
rc = mhi_dev_flush_transfer_completion_events(mhi_ctx, ch);
if (rc) {
mhi_log(MHI_MSG_ERROR,
@@ -2520,7 +2563,7 @@ static void mhi_dev_transfer_completion_cb(void *mreq)
rc = mhi_dev_process_stop_cmd(ch->ring, ch->ch_id, mhi_ctx);
if (rc)
mhi_log(MHI_MSG_ERROR,
- "Error while stopping channel (%d)\n", ch->ch_id);
+ "Error while stopping ch_id:%d\n", ch->ch_id);
}
}
@@ -2549,7 +2592,7 @@ static void mhi_dev_scheduler(struct work_struct *work)
rc = mhi_dev_mmio_get_mhi_state(mhi, &state, &mhi_reset);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "get mhi state failed\n");
mutex_unlock(&mhi_ctx->mhi_lock);
return;
}
@@ -2559,7 +2602,8 @@ static void mhi_dev_scheduler(struct work_struct *work)
"processing mhi device reset\n");
rc = mhi_dev_abort(mhi);
if (rc)
- pr_err("device reset failed:%d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "device reset failed:%d\n", rc);
mutex_unlock(&mhi_ctx->mhi_lock);
queue_work(mhi->ring_init_wq, &mhi->re_init);
return;
@@ -2567,13 +2611,14 @@ static void mhi_dev_scheduler(struct work_struct *work)
rc = mhi_dev_get_event_notify(state, &event);
if (rc) {
- pr_err("unsupported state :%d\n", state);
+ mhi_log(MHI_MSG_ERROR,
+ "unsupported state :%d\n", state);
goto fail;
}
rc = mhi_dev_notify_sm_event(event);
if (rc) {
- pr_err("error sending SM event\n");
+ mhi_log(MHI_MSG_ERROR, "error sending SM event\n");
goto fail;
}
}
@@ -2696,7 +2741,8 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
mhi->ctrl_base.device_pa,
mhi->ctrl_base.size);
if (!mhi->ctrl_base.device_va) {
- pr_err("io remap failed for mhi address\n");
+ mhi_log(MHI_MSG_ERROR,
+ "io remap failed for mhi address\n");
return -EINVAL;
}
}
@@ -2705,7 +2751,7 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
if (mhi->config_iatu) {
rc = mhi_dev_config_outbound_iatu(mhi);
if (rc) {
- pr_err("Configuring iATU failed\n");
+ mhi_log(MHI_MSG_ERROR, "Configuring iATU failed\n");
return rc;
}
}
@@ -2713,25 +2759,25 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
/* Get Channel, event and command context base pointer */
rc = mhi_dev_mmio_get_chc_base(mhi);
if (rc) {
- pr_err("Fetching channel context failed\n");
+ mhi_log(MHI_MSG_ERROR, "Fetching ch context failed\n");
return rc;
}
rc = mhi_dev_mmio_get_erc_base(mhi);
if (rc) {
- pr_err("Fetching event ring context failed\n");
+ mhi_log(MHI_MSG_ERROR, "Fetching event ring context failed\n");
return rc;
}
rc = mhi_dev_mmio_get_crc_base(mhi);
if (rc) {
- pr_err("Fetching command ring context failed\n");
+ mhi_log(MHI_MSG_ERROR, "Fetching command ring context failed\n");
return rc;
}
rc = mhi_dev_update_ner(mhi);
if (rc) {
- pr_err("Fetching NER failed\n");
+ mhi_log(MHI_MSG_ERROR, "Fetching NER failed\n");
return rc;
}
@@ -2776,7 +2822,8 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
&mhi->cmd_ctx_cache_dma_handle,
GFP_KERNEL);
if (!mhi->cmd_ctx_cache) {
- pr_err("no memory while allocating cmd ctx\n");
+ mhi_log(MHI_MSG_ERROR,
+ "no memory while allocating cmd ctx\n");
rc = -ENOMEM;
goto exit;
}
@@ -2849,7 +2896,7 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
rc = mhi_ring_start(&mhi->ring[0],
(union mhi_dev_ring_ctx *)mhi->cmd_ctx_cache, mhi);
if (rc) {
- pr_err("MHI ring start failed:%d\n", rc);
+ mhi_log(MHI_MSG_ERROR, "MHI ring start failed:%d\n", rc);
goto exit;
}
@@ -3080,14 +3127,11 @@ static int mhi_dev_alloc_evt_buf_evt_req(struct mhi_dev *mhi,
int rc;
uint32_t size, i;
- if (evt_ring)
- size = evt_ring->ring_size;
- else
- size = mhi_dev_get_evt_ring_size(mhi, ch->ch_id);
+ size = mhi_dev_get_evt_ring_size(mhi, ch->ch_id);
if (!size) {
mhi_log(MHI_MSG_ERROR,
- "Evt buf size is 0 for channel %d", ch->ch_id);
+ "Evt buf size is 0 for ch_id:%d", ch->ch_id);
return -EINVAL;
}
@@ -3112,13 +3156,13 @@ static int mhi_dev_alloc_evt_buf_evt_req(struct mhi_dev *mhi,
ch->evt_req_size = size;
mhi_log(MHI_MSG_INFO,
- "Channel %d evt buf size is %d\n", ch->ch_id, ch->evt_buf_size);
+ "ch_id:%d evt buf size is %d\n", ch->ch_id, ch->evt_buf_size);
/* Allocate event requests */
ch->ereqs = kcalloc(ch->evt_req_size, sizeof(*ch->ereqs), GFP_KERNEL);
if (!ch->ereqs) {
mhi_log(MHI_MSG_ERROR,
- "Failed to alloc ereqs for Channel %d\n", ch->ch_id);
+ "Failed to alloc ereqs for ch_id:%d\n", ch->ch_id);
rc = -ENOMEM;
goto free_ereqs;
}
@@ -3128,7 +3172,7 @@ static int mhi_dev_alloc_evt_buf_evt_req(struct mhi_dev *mhi,
GFP_KERNEL);
if (!ch->tr_events) {
mhi_log(MHI_MSG_ERROR,
- "Failed to alloc tr_events buffer for Channel %d\n",
+ "Failed to alloc tr_events buffer for ch_id:%d\n",
ch->ch_id);
rc = -ENOMEM;
goto free_ereqs;
@@ -3173,6 +3217,11 @@ int mhi_dev_open_channel(uint32_t chan_id,
struct mhi_dev_channel *ch;
struct platform_device *pdev;
+ if (!mhi_ctx || !mhi_ctx->pdev) {
+ mhi_log(MHI_MSG_ERROR, "Invalid open channel call for ch_id:%d\n", chan_id);
+ return -EINVAL;
+ }
+
pdev = mhi_ctx->pdev;
ch = &mhi_ctx->ch[chan_id];
@@ -3180,7 +3229,7 @@ int mhi_dev_open_channel(uint32_t chan_id,
if (ch->active_client) {
mhi_log(MHI_MSG_ERROR,
- "Channel (%d) already opened by client\n", chan_id);
+ "ch_id:%d already opened by client\n", chan_id);
rc = -EINVAL;
goto exit;
}
@@ -3228,7 +3277,7 @@ int mhi_dev_channel_isempty(struct mhi_dev_client *handle)
int rc;
if (!handle) {
- mhi_log(MHI_MSG_ERROR, "Invalid channel access\n");
+ mhi_log(MHI_MSG_ERROR, "Invalid ch access\n");
return -EINVAL;
}
@@ -3247,7 +3296,7 @@ bool mhi_dev_channel_has_pending_write(struct mhi_dev_client *handle)
struct mhi_dev_channel *ch;
if (!handle) {
- mhi_log(MHI_MSG_ERROR, "Invalid channel access\n");
+ mhi_log(MHI_MSG_ERROR, "Invalid ch access\n");
return -EINVAL;
}
@@ -3266,7 +3315,7 @@ void mhi_dev_close_channel(struct mhi_dev_client *handle)
int rc = 0;
struct event_req *itr, *tmp;
if (!handle) {
- mhi_log(MHI_MSG_ERROR, "Invalid channel access:%d\n", -ENODEV);
+ mhi_log(MHI_MSG_ERROR, "Invalid ch access:%d\n", -ENODEV);
return;
}
ch = handle->channel;
@@ -3287,17 +3336,17 @@ void mhi_dev_close_channel(struct mhi_dev_client *handle)
} while (++count < MHI_DEV_CH_CLOSE_TIMEOUT_COUNT);
if (ch->pend_wr_count)
- mhi_log(MHI_MSG_ERROR, "%d writes pending for channel %d\n",
+ mhi_log(MHI_MSG_ERROR, "%d writes pending for ch_id:%d\n",
ch->pend_wr_count, ch->ch_id);
if (!list_empty(&ch->event_req_buffers))
- mhi_log(MHI_MSG_ERROR, "%d pending flush for channel %d\n",
+ mhi_log(MHI_MSG_ERROR, "%d pending flush for ch_id:%d\n",
ch->pend_wr_count, ch->ch_id);
if (ch->state != MHI_DEV_CH_PENDING_START)
if ((ch->ch_type == MHI_DEV_CH_TYPE_OUTBOUND_CHANNEL &&
!mhi_dev_channel_isempty(handle)) || ch->tre_loc)
mhi_log(MHI_MSG_DBG,
- "Trying to close an active channel (%d)\n",
+ "Trying to close an active ch_id:%d\n",
ch->ch_id);
if (!list_empty(&ch->flush_event_req_buffers)) {
@@ -3368,7 +3417,8 @@ int mhi_dev_read_channel(struct mhi_req *mreq)
return -ENXIO;
if (mhi_ctx->ctrl_info != MHI_STATE_CONNECTED) {
- pr_err("Channel not connected:%d\n", mhi_ctx->ctrl_info);
+ mhi_log(MHI_MSG_ERROR,
+ "ch not connected:%d\n", mhi_ctx->ctrl_info);
return -ENODEV;
}
@@ -3379,7 +3429,7 @@ int mhi_dev_read_channel(struct mhi_req *mreq)
if (atomic_read(&mhi_ctx->is_suspended)) {
mhi_log(MHI_MSG_ERROR,
- "mhi still in suspend, return %d for read ch:%d\n",
+ "mhi still in suspend, return %d for read ch_id:%d\n",
rc, mreq->client->channel->ch_id);
return -ENODEV;
}
@@ -3395,7 +3445,7 @@ int mhi_dev_read_channel(struct mhi_req *mreq)
do {
if (ch->state == MHI_DEV_CH_STOPPED || ch->reset_pending) {
mhi_log(MHI_MSG_VERBOSE,
- "channel (%d) already stopped or RST pending\n",
+ "ch_id:%d already stopped or RST pending\n",
mreq->chan);
bytes_read = -1;
goto exit;
@@ -3442,13 +3492,13 @@ int mhi_dev_read_channel(struct mhi_req *mreq)
mreq->el = el;
mreq->transfer_len = bytes_to_read;
mreq->rd_offset = ring->rd_offset;
- mhi_log(MHI_MSG_VERBOSE, "reading %lu bytes from chan %d\n",
+ mhi_log(MHI_MSG_VERBOSE, "reading %lu bytes from ch_id:%d\n",
bytes_to_read, mreq->chan);
rc = mhi_ctx->host_to_device((void *) write_to_loc,
read_from_loc, bytes_to_read, mhi_ctx, mreq);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Error while reading chan (%d) rc %d\n",
+ "Error while reading ch_id:%d rc %d\n",
mreq->chan, rc);
mutex_unlock(&ch->ch_lock);
return rc;
@@ -3469,7 +3519,7 @@ int mhi_dev_read_channel(struct mhi_req *mreq)
rc = mhi_dev_process_stop_cmd(ring, mreq->chan, mhi_ctx);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Error while stopping channel (%d)\n",
+ "Error while stopping ch_id:%d\n",
mreq->chan);
bytes_read = -EIO;
}
@@ -3519,12 +3569,14 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
enum mhi_ctrl_info info;
if (WARN_ON(!wreq || !wreq->client || !wreq->buf)) {
- pr_err("%s: invalid parameters\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "invalid parameters\n");
return -ENXIO;
}
if (mhi_ctx->ctrl_info != MHI_STATE_CONNECTED) {
- pr_err("Channel not connected:%d\n", mhi_ctx->ctrl_info);
+ mhi_log(MHI_MSG_ERROR,
+ "ch not connected:%d\n", mhi_ctx->ctrl_info);
return -ENODEV;
}
@@ -3539,10 +3591,11 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
* to the MHI core -> notify SM.
*/
mutex_lock(&mhi_ctx->mhi_lock);
- mhi_log(MHI_MSG_CRITICAL, "Wakeup by chan:%d\n", ch->ch_id);
+ mhi_log(MHI_MSG_CRITICAL, "Wakeup by ch_id:%d\n", ch->ch_id);
rc = mhi_dev_notify_sm_event(MHI_DEV_EVENT_CORE_WAKEUP);
if (rc) {
- pr_err("error sending core wakeup event\n");
+ mhi_log(MHI_MSG_ERROR,
+ "error sending core wakeup event\n");
mutex_unlock(&mhi_ctx->mhi_lock);
mutex_unlock(&mhi_ctx->mhi_write_test);
return rc;
@@ -3559,7 +3612,7 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
if (suspend_wait_timeout >= MHI_WAKEUP_TIMEOUT_CNT ||
mhi_ctx->ctrl_info != MHI_STATE_CONNECTED) {
- pr_err("Failed to wake up core\n");
+ mhi_log(MHI_MSG_ERROR, "Failed to wake up core\n");
mutex_unlock(&mhi_ctx->mhi_write_test);
return -ENODEV;
}
@@ -3571,7 +3624,7 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
rc = mhi_ctrl_state_info(ch->ch_id, &info);
if (rc || (info != MHI_STATE_CONNECTED)) {
- mhi_log(MHI_MSG_ERROR, "Channel %d not started by host\n",
+ mhi_log(MHI_MSG_ERROR, "ch_id %d not started by host\n",
ch->ch_id);
mutex_unlock(&ch->ch_lock);
mutex_unlock(&mhi_ctx->mhi_write_test);
@@ -3581,7 +3634,7 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
ch->pend_wr_count++;
if (ch->state == MHI_DEV_CH_STOPPED || ch->reset_pending) {
mhi_log(MHI_MSG_ERROR,
- "channel %d already stopped or RST pending\n",
+ "ch_id:%d already stopped or RST pending\n",
wreq->chan);
bytes_written = -1;
goto exit;
@@ -3599,8 +3652,8 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
do {
if (ring->rd_offset == ring->wr_offset) {
mhi_log(MHI_MSG_ERROR,
- "%s():rd & wr offsets are equal\n",
- __func__);
+ "rd & wr offsets are equal for ch_id:%d\n",
+ wreq->chan);
mhi_log(MHI_MSG_INFO, "No TREs available\n");
break;
}
@@ -3608,8 +3661,9 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
el = &ring->ring_cache[ring->rd_offset];
tre_len = el->tre.len;
if (wreq->len > tre_len) {
- pr_err("%s(): rlen = %lu, tlen = %d: client buf > tre len\n",
- __func__, wreq->len, tre_len);
+ mhi_log(MHI_MSG_ERROR,
+ "rlen = %lu, tlen = %d: client buf > tre len\n",
+ wreq->len, tre_len);
bytes_written = -ENOMEM;
goto exit;
}
@@ -3627,7 +3681,7 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
mhi_ctx, wreq);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Error while writing chan (%d) rc %d\n",
+ "Error while writing ch_id:%d rc %d\n",
wreq->chan, rc);
goto exit;
} else if (wreq->mode == DMA_ASYNC)
@@ -3650,7 +3704,7 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
ring->rd_offset, bytes_to_write, code);
if (rc) {
mhi_log(MHI_MSG_VERBOSE,
- "err in snding cmpl evt ch:%d\n",
+ "err in snding cmpl evt ch_id:%d\n",
wreq->chan);
}
mhi_dev_ring_inc_index(ring, ring->rd_offset);
@@ -3668,7 +3722,7 @@ int mhi_dev_write_channel(struct mhi_req *wreq)
rc = mhi_dev_process_stop_cmd(ring, wreq->chan, mhi_ctx);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "channel %d stop failed\n", wreq->chan);
+ "ch_id:%d stop failed\n", wreq->chan);
}
}
exit:
@@ -3697,7 +3751,8 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
/* Poll for the host to set the reset bit */
rc = mhi_dev_mmio_get_mhi_state(mhi, &state, &mhi_reset);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "get mhi state failed\n");
return rc;
}
@@ -3716,7 +3771,8 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
"Wait for Host to set BHI_INTVEC\n");
rc = mhi_dev_mmio_read(mhi, BHI_INTVEC, &bhi_intvec);
if (rc) {
- pr_err("%s: Get BHI_INTVEC failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "Get BHI_INTVEC failed\n");
return rc;
}
bhi_max_cnt++;
@@ -3732,7 +3788,7 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
/* Indicate the host that the device is ready */
rc = ep_pcie_trigger_msi(mhi->phandle, bhi_intvec);
if (rc) {
- pr_err("%s: error sending msi\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "error sending msi\n");
return rc;
}
}
@@ -3740,7 +3796,7 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
/* Poll for the host to set the reset bit */
rc = mhi_dev_mmio_get_mhi_state(mhi, &state, &mhi_reset);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "get mhi state failed\n");
return rc;
}
@@ -3753,7 +3809,8 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
rc = mhi_dev_mmio_get_mhi_state(mhi, &state,
&mhi_reset);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "get mhi state failed\n");
return rc;
}
max_cnt++;
@@ -3784,20 +3841,20 @@ static void mhi_dev_enable(struct work_struct *work)
if (mhi->use_ipa) {
rc = ipa_dma_init();
if (rc) {
- pr_err("ipa dma init failed\n");
+ mhi_log(MHI_MSG_ERROR, "ipa dma init failed\n");
return;
}
rc = ipa_dma_enable();
if (rc) {
- pr_err("ipa enable failed\n");
+ mhi_log(MHI_MSG_ERROR, "ipa enable failed\n");
return;
}
}
rc = mhi_dev_mmio_get_mhi_state(mhi, &state, &mhi_reset);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "get mhi state failed\n");
return;
}
if (mhi_reset) {
@@ -3812,7 +3869,7 @@ static void mhi_dev_enable(struct work_struct *work)
msleep(MHI_SUSPEND_MIN);
rc = mhi_dev_mmio_get_mhi_state(mhi, &state, &mhi_reset);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "get mhi state failed\n");
return;
}
if (mhi_reset) {
@@ -3828,23 +3885,24 @@ static void mhi_dev_enable(struct work_struct *work)
if (state == MHI_DEV_M0_STATE) {
rc = mhi_dev_cache_host_cfg(mhi);
if (rc) {
- pr_err("Failed to cache the host config\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to cache the host config\n");
return;
}
rc = mhi_dev_mmio_set_env(mhi, MHI_ENV_VALUE);
if (rc) {
- pr_err("%s: env setting failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "env setting failed\n");
return;
}
} else {
- pr_err("MHI device failed to enter M0\n");
+ mhi_log(MHI_MSG_ERROR, "MHI device failed to enter M0\n");
return;
}
rc = mhi_hwc_init(mhi_ctx);
if (rc) {
- pr_err("error during hwc_init\n");
+ mhi_log(MHI_MSG_ERROR, "error during hwc_init\n");
return;
}
@@ -3865,7 +3923,8 @@ static void mhi_dev_enable(struct work_struct *work)
/*Enable MHI dev network stack Interface*/
rc = mhi_dev_net_interface_init();
if (rc)
- pr_err("%s Failed to initialize mhi_dev_net iface\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to initialize mhi_dev_net iface\n");
}
static void mhi_ring_init_cb(void *data)
@@ -3888,7 +3947,7 @@ int mhi_register_state_cb(void (*mhi_state_cb)
return -ENXIO;
if (channel >= MHI_MAX_SOFTWARE_CHANNELS) {
- pr_err("Invalid channel :%d\n", channel);
+ mhi_log(MHI_MSG_ERROR, "Invalid ch_id:%d\n", channel);
return -EINVAL;
}
@@ -3977,14 +4036,16 @@ static int get_device_tree_data(struct platform_device *pdev)
res_mem = platform_get_resource_byname(pdev,
IORESOURCE_MEM, "mhi_mmio_base");
if (!res_mem) {
- pr_err("Request MHI MMIO physical memory region failed\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Request MHI MMIO physical memory region failed\n");
return -EINVAL;
}
mhi->mmio_base_pa_addr = res_mem->start;
mhi->mmio_base_addr = ioremap_nocache(res_mem->start, MHI_1K_SIZE);
if (!mhi->mmio_base_addr) {
- pr_err("Failed to IO map MMIO registers\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to IO map MMIO registers\n");
return -EINVAL;
}
@@ -3994,7 +4055,8 @@ static int get_device_tree_data(struct platform_device *pdev)
res_mem = platform_get_resource_byname(pdev,
IORESOURCE_MEM, "ipa_uc_mbox_crdb");
if (!res_mem) {
- pr_err("Request IPA_UC_MBOX CRDB physical region failed\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Request IPA_UC_MBOX CRDB physical region failed\n");
rc = -EINVAL;
goto err;
}
@@ -4004,7 +4066,8 @@ static int get_device_tree_data(struct platform_device *pdev)
res_mem = platform_get_resource_byname(pdev,
IORESOURCE_MEM, "ipa_uc_mbox_erdb");
if (!res_mem) {
- pr_err("Request IPA_UC_MBOX ERDB physical region failed\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Request IPA_UC_MBOX ERDB physical region failed\n");
rc = -EINVAL;
goto err;
}
@@ -4018,7 +4081,7 @@ static int get_device_tree_data(struct platform_device *pdev)
"qcom,mhi-ifc-id",
&mhi_ctx->ifc_id);
if (rc) {
- pr_err("qcom,mhi-ifc-id does not exist\n");
+ mhi_log(MHI_MSG_ERROR, "qcom,mhi-ifc-id does not exist\n");
goto err;
}
@@ -4026,7 +4089,7 @@ static int get_device_tree_data(struct platform_device *pdev)
"qcom,mhi-ep-msi",
&mhi_ctx->mhi_ep_msi_num);
if (rc) {
- pr_err("qcom,mhi-ep-msi does not exist\n");
+ mhi_log(MHI_MSG_ERROR, "qcom,mhi-ep-msi does not exist\n");
goto err;
}
@@ -4034,7 +4097,8 @@ static int get_device_tree_data(struct platform_device *pdev)
"qcom,mhi-version",
&mhi_ctx->mhi_version);
if (rc) {
- pr_err("qcom,mhi-version does not exist\n");
+ mhi_log(MHI_MSG_ERROR,
+ "qcom,mhi-version does not exist\n");
goto err;
}
@@ -4049,7 +4113,8 @@ static int get_device_tree_data(struct platform_device *pdev)
"qcom,mhi-local-pa-base",
&mhi_ctx->device_local_pa_base);
if (rc) {
- pr_err("qcom,mhi-local-pa-base does not exist\n");
+ mhi_log(MHI_MSG_ERROR,
+ "qcom,mhi-local-pa-base does not exist\n");
goto err;
}
}
@@ -4060,7 +4125,8 @@ static int get_device_tree_data(struct platform_device *pdev)
if (mhi->config_iatu || mhi_ctx->mhi_int) {
mhi->mhi_irq = platform_get_irq_byname(pdev, "mhi-device-inta");
if (mhi->mhi_irq < 0) {
- pr_err("Invalid MHI device interrupt\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid MHI device interrupt\n");
rc = mhi->mhi_irq;
goto err;
}
@@ -4104,7 +4170,8 @@ static int mhi_init(struct mhi_dev *mhi)
rc = mhi_dev_mmio_init(mhi);
if (rc) {
- pr_err("Failed to update the MMIO init\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to update the MMIO init\n");
return rc;
}
@@ -4122,6 +4189,8 @@ static int mhi_init(struct mhi_dev *mhi)
for (i = 0; i < mhi->cfg.channels; i++) {
mhi->ch[i].ch_id = i;
mutex_init(&mhi->ch[i].ch_lock);
+ INIT_LIST_HEAD(&mhi->ch[i].event_req_buffers);
+ INIT_LIST_HEAD(&mhi->ch[i].flush_event_req_buffers);
}
}
@@ -4150,7 +4219,8 @@ static int mhi_dev_resume_mmio_mhi_reinit(struct mhi_dev *mhi_ctx)
rc = mhi_init(mhi_ctx);
if (rc) {
- pr_err("Error initializing MHI MMIO with %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error initializing MHI MMIO with %d\n", rc);
goto fail;
}
@@ -4169,7 +4239,8 @@ static int mhi_dev_resume_mmio_mhi_reinit(struct mhi_dev *mhi_ctx)
rc = ep_pcie_register_event(mhi_ctx->phandle, &mhi_ctx->event_reg);
if (rc) {
- pr_err("Failed to register for events from PCIe\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to register for events from PCIe\n");
goto fail;
}
@@ -4179,7 +4250,8 @@ static int mhi_dev_resume_mmio_mhi_reinit(struct mhi_dev *mhi_ctx)
if (rc == -EEXIST) {
mhi_ring_init_cb(mhi_ctx);
} else {
- pr_err("Error calling IPA cb with %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error calling IPA cb with %d\n", rc);
goto fail;
}
}
@@ -4188,21 +4260,22 @@ static int mhi_dev_resume_mmio_mhi_reinit(struct mhi_dev *mhi_ctx)
/* Invoke MHI SM when device is in RESET state */
rc = mhi_dev_sm_init(mhi_ctx);
if (rc) {
- pr_err("%s: Error during SM init\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "Error during SM init\n");
goto fail;
}
/* set the env before setting the ready bit */
rc = mhi_dev_mmio_set_env(mhi_ctx, MHI_ENV_VALUE);
if (rc) {
- pr_err("%s: env setting failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "env setting failed\n");
goto fail;
}
/* All set, notify the host */
rc = mhi_dev_sm_set_ready();
if (rc) {
- pr_err("%s: unable to set ready bit\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "unable to set ready bit\n");
goto fail;
}
@@ -4228,7 +4301,8 @@ static void mhi_dev_reinit(struct work_struct *work)
/* PCIe link is up with BME set */
rc = mhi_dev_resume_mmio_mhi_reinit(mhi_ctx);
if (rc) {
- pr_err("Failed to register for events from PCIe\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to register for events from PCIe\n");
return;
}
}
@@ -4281,13 +4355,14 @@ static int mhi_dev_resume_mmio_mhi_init(struct mhi_dev *mhi_ctx)
mhi_ctx->phandle = ep_pcie_get_phandle(mhi_ctx->ifc_id);
if (!mhi_ctx->phandle) {
- pr_err("PCIe driver get handle failed.\n");
+ mhi_log(MHI_MSG_ERROR,
+ "PCIe driver get handle failed.\n");
return -EINVAL;
}
rc = mhi_dev_recover(mhi_ctx);
if (rc) {
- pr_err("%s: get mhi state failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "get mhi state failed\n");
return rc;
}
@@ -4317,7 +4392,8 @@ static int mhi_dev_resume_mmio_mhi_init(struct mhi_dev *mhi_ctx)
rc = mhi_dev_mmio_write(mhi_ctx, MHIVER, mhi_ctx->mhi_version);
if (rc) {
- pr_err("Failed to update the MHI version\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to update the MHI version\n");
return rc;
}
mhi_ctx->event_reg.events = EP_PCIE_EVENT_PM_D3_HOT |
@@ -4335,19 +4411,21 @@ static int mhi_dev_resume_mmio_mhi_init(struct mhi_dev *mhi_ctx)
rc = ep_pcie_register_event(mhi_ctx->phandle, &mhi_ctx->event_reg);
if (rc) {
- pr_err("Failed to register for events from PCIe\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to register for events from PCIe\n");
return rc;
}
if (mhi_ctx->use_ipa) {
- pr_err("Registering with IPA\n");
+ mhi_log(MHI_MSG_ERROR, "Registering with IPA\n");
rc = ipa_register_ipa_ready_cb(mhi_ring_init_cb, mhi_ctx);
if (rc < 0) {
if (rc == -EEXIST) {
mhi_ring_init_cb(mhi_ctx);
} else {
- pr_err("Error calling IPA cb with %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error calling IPA cb with %d\n", rc);
return rc;
}
}
@@ -4356,14 +4434,14 @@ static int mhi_dev_resume_mmio_mhi_init(struct mhi_dev *mhi_ctx)
/* Invoke MHI SM when device is in RESET state */
rc = mhi_dev_sm_init(mhi_ctx);
if (rc) {
- pr_err("%s: Error during SM init\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "Error during SM init\n");
return rc;
}
/* set the env before setting the ready bit */
rc = mhi_dev_mmio_set_env(mhi_ctx, MHI_ENV_VALUE);
if (rc) {
- pr_err("%s: env setting failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "env setting failed\n");
return rc;
}
@@ -4392,7 +4470,7 @@ static int mhi_dev_resume_mmio_mhi_init(struct mhi_dev *mhi_ctx)
static void mhi_dev_resume_init_with_link_up(struct ep_pcie_notify *notify)
{
if (!notify || !notify->user) {
- pr_err("Null argument for notify\n");
+ mhi_log(MHI_MSG_ERROR, "Null argument for notify\n");
return;
}
@@ -4412,13 +4490,15 @@ static void mhi_dev_pcie_handle_event(struct work_struct *work)
if (mhi_dev_pcie_notify_event == MHI_INIT) {
rc = mhi_dev_resume_mmio_mhi_init(mhi_ctx);
if (rc) {
- pr_err("Error during MHI device initialization\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error during MHI device initialization\n");
return;
}
} else if (mhi_dev_pcie_notify_event == MHI_REINIT) {
rc = mhi_dev_resume_mmio_mhi_reinit(mhi_ctx);
if (rc) {
- pr_err("Error during MHI device re-initialization\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error during MHI device re-initialization\n");
return;
}
}
@@ -4428,19 +4508,21 @@ static int mhi_edma_init(struct device *dev)
{
mhi_ctx->tx_dma_chan = dma_request_slave_channel(dev, "tx");
if (IS_ERR_OR_NULL(mhi_ctx->tx_dma_chan)) {
- pr_err("%s(): request for TX chan failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "request for TX ch failed\n");
return -EIO;
}
- mhi_log(MHI_MSG_VERBOSE, "request for TX chan returned :%pK\n",
+ mhi_log(MHI_MSG_VERBOSE, "request for TX ch returned :%pK\n",
mhi_ctx->tx_dma_chan);
mhi_ctx->rx_dma_chan = dma_request_slave_channel(dev, "rx");
if (IS_ERR_OR_NULL(mhi_ctx->rx_dma_chan)) {
- pr_err("%s(): request for RX chan failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR,
+ "request for RX ch failed\n");
return -EIO;
}
- mhi_log(MHI_MSG_VERBOSE, "request for RX chan returned :%pK\n",
+ mhi_log(MHI_MSG_VERBOSE, "request for RX ch returned :%pK\n",
mhi_ctx->rx_dma_chan);
return 0;
}
@@ -4452,7 +4534,8 @@ static int mhi_dev_probe(struct platform_device *pdev)
if (pdev->dev.of_node) {
rc = get_device_tree_data(pdev);
if (rc) {
- pr_err("Error reading MHI Dev DT\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error reading MHI Dev DT\n");
return rc;
}
mhi_ipc_log = ipc_log_context_create(MHI_IPC_LOG_PAGES,
@@ -4461,6 +4544,12 @@ static int mhi_dev_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"Failed to create IPC logging context\n");
}
+ mhi_ipc_err_log = ipc_log_context_create(MHI_IPC_ERR_LOG_PAGES,
+ "mhi_err", 0);
+ if (mhi_ipc_err_log == NULL) {
+ dev_err(&pdev->dev,
+ "Failed to create IPC ERR logging context\n");
+ }
/*
* The below list and mutex should be initialized
* before calling mhi_uci_init to avoid crash in
@@ -4476,13 +4565,15 @@ static int mhi_dev_probe(struct platform_device *pdev)
if (mhi_ctx->use_edma) {
rc = mhi_edma_init(&pdev->dev);
if (rc) {
- pr_err("MHI: mhi edma init failed, rc = %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "MHI: mhi edma init failed, rc = %d\n", rc);
return rc;
}
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rc) {
- pr_err("Error set MHI DMA mask: rc = %d\n", rc);
+ mhi_log(MHI_MSG_ERROR,
+ "Error set MHI DMA mask: rc = %d\n", rc);
return rc;
}
}
@@ -4503,7 +4594,7 @@ static int mhi_dev_probe(struct platform_device *pdev)
mhi_ctx->pcie_event_wq = alloc_workqueue("mhi_dev_pcie_event_wq",
WQ_HIGHPRI, 0);
if (!mhi_ctx->pcie_event_wq) {
- pr_err("no memory\n");
+ mhi_log(MHI_MSG_ERROR, "no memory\n");
rc = -ENOMEM;
return rc;
}
@@ -4513,7 +4604,8 @@ static int mhi_dev_probe(struct platform_device *pdev)
/* PCIe link is already up */
rc = mhi_dev_resume_mmio_mhi_init(mhi_ctx);
if (rc) {
- pr_err("Error during MHI device initialization\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Error during MHI device initialization\n");
return rc;
}
} else {
@@ -4527,7 +4619,8 @@ static int mhi_dev_probe(struct platform_device *pdev)
rc = ep_pcie_register_event(mhi_ctx->phandle,
&mhi_ctx->event_reg);
if (rc) {
- pr_err("Failed to register for events from PCIe\n");
+ mhi_log(MHI_MSG_ERROR,
+ "Failed to register for events from PCIe\n");
return rc;
}
}
diff --git a/drivers/platform/msm/mhi_dev/mhi.h b/drivers/platform/msm/mhi_dev/mhi.h
index a7a34668a04f..16e0c1f7ed0a 100644
--- a/drivers/platform/msm/mhi_dev/mhi.h
+++ b/drivers/platform/msm/mhi_dev/mhi.h
@@ -673,7 +673,9 @@ enum mhi_msg_level {
extern uint32_t bhi_imgtxdb;
extern enum mhi_msg_level mhi_msg_lvl;
extern enum mhi_msg_level mhi_ipc_msg_lvl;
+extern enum mhi_msg_level mhi_ipc_err_msg_lvl;
extern void *mhi_ipc_log;
+extern void *mhi_ipc_err_log;
#define mhi_log(_msg_lvl, _msg, ...) do { \
if (_msg_lvl >= mhi_msg_lvl) { \
@@ -682,7 +684,11 @@ extern void *mhi_ipc_log;
} \
if (mhi_ipc_log && (_msg_lvl >= mhi_ipc_msg_lvl)) { \
ipc_log_string(mhi_ipc_log, \
- "[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \
+ "[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \
+ } \
+ if (mhi_ipc_err_log && (_msg_lvl >= mhi_ipc_err_msg_lvl)) { \
+ ipc_log_string(mhi_ipc_err_log, \
+ "[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \
} \
} while (0)
diff --git a/drivers/platform/msm/mhi_dev/mhi_dev_net.c b/drivers/platform/msm/mhi_dev/mhi_dev_net.c
index 08bf7f995f8f..d05bbe5f1f4f 100644
--- a/drivers/platform/msm/mhi_dev/mhi_dev_net.c
+++ b/drivers/platform/msm/mhi_dev/mhi_dev_net.c
@@ -43,7 +43,7 @@ enum mhi_dev_net_dbg_lvl {
MSG_NET_reserved = 0x80000000
};
-static enum mhi_dev_net_dbg_lvl mhi_net_msg_lvl = MHI_CRITICAL;
+static enum mhi_dev_net_dbg_lvl mhi_net_msg_lvl = MHI_ERROR;
static enum mhi_dev_net_dbg_lvl mhi_net_ipc_log_lvl = MHI_VERBOSE;
static void *mhi_net_ipc_log;
@@ -121,7 +121,7 @@ static int mhi_dev_net_init_ch_attributes(struct mhi_dev_net_ctxt *mhi_ctxt)
chan_attrib->dir = MHI_DIR_OUT;
chan_attrib->chan_id = channel;
chan_attrib->max_packet_size = TRB_MAX_DATA_SIZE;
- mhi_dev_net_log(MHI_INFO, "Write chan attributes dir %d chan_id %d\n",
+ mhi_dev_net_log(MHI_INFO, "Write ch attributes dir %d ch_id:%d\n",
chan_attrib->dir, chan_attrib->chan_id);
channel = MHI_CLIENT_IP_SW_4_IN;
@@ -129,7 +129,7 @@ static int mhi_dev_net_init_ch_attributes(struct mhi_dev_net_ctxt *mhi_ctxt)
chan_attrib->dir = MHI_DIR_IN;
chan_attrib->chan_id = channel;
chan_attrib->max_packet_size = TRB_MAX_DATA_SIZE;
- mhi_dev_net_log(MHI_INFO, "Read chan attributes dir %d chan_id %d\n",
+ mhi_dev_net_log(MHI_INFO, "Read ch attributes dir %d ch_id %d\n",
chan_attrib->dir, chan_attrib->chan_id);
return 0;
}
@@ -144,7 +144,7 @@ static void mhi_dev_net_process_queue_packets(struct work_struct *work)
struct mhi_req *wreq = NULL;
if (mhi_dev_channel_isempty(client->in_handle)) {
- mhi_dev_net_log(MHI_INFO, "%s stop network xmmit\n", __func__);
+ mhi_dev_net_log(MHI_INFO, "stop network xmmit\n");
netif_stop_queue(client->dev);
return;
}
@@ -176,8 +176,9 @@ static void mhi_dev_net_process_queue_packets(struct work_struct *work)
spin_unlock_irqrestore(&client->wrt_lock, flags);
xfer_data = mhi_dev_write_channel(wreq);
if (xfer_data <= 0) {
- pr_err("%s(): Failed to write skb len %d\n",
- __func__, skb->len);
+ mhi_dev_net_log(MHI_ERROR,
+ "Failed to write skb len %d\n",
+ skb->len);
kfree_skb(skb);
return;
}
@@ -186,8 +187,7 @@ static void mhi_dev_net_process_queue_packets(struct work_struct *work)
/* Check if free buffers are available*/
if (mhi_dev_channel_isempty(client->in_handle)) {
mhi_dev_net_log(MHI_INFO,
- "%s buffers are full stop xmit\n",
- __func__);
+ "buffers are full stop xmit\n");
netif_stop_queue(client->dev);
break;
}
@@ -279,9 +279,9 @@ static ssize_t mhi_dev_net_client_read(struct mhi_dev_net_client *mhi_handle)
struct mhi_req, list);
list_del_init(&req->list);
spin_unlock_irqrestore(&mhi_handle->rd_lock, flags);
- skb = alloc_skb(MHI_NET_DEFAULT_MTU, GFP_ATOMIC);
+ skb = alloc_skb(MHI_NET_DEFAULT_MTU, GFP_KERNEL);
if (skb == NULL) {
- pr_err("%s(): skb alloc failed\n", __func__);
+ mhi_dev_net_log(MHI_ERROR, "skb alloc failed\n");
spin_lock_irqsave(&mhi_handle->rd_lock, flags);
list_add_tail(&req->list, &mhi_handle->rx_buffers);
spin_unlock_irqrestore(&mhi_handle->rd_lock, flags);
@@ -298,7 +298,8 @@ static ssize_t mhi_dev_net_client_read(struct mhi_dev_net_client *mhi_handle)
bytes_avail = mhi_dev_read_channel(req);
if (bytes_avail < 0) {
- pr_err("Failed to read chan %d bytes_avail = %d\n",
+ mhi_dev_net_log(MHI_ERROR,
+ "Failed to read ch_id:%d bytes_avail = %d\n",
chan, bytes_avail);
spin_lock_irqsave(&mhi_handle->rd_lock, flags);
kfree_skb(skb);
@@ -473,7 +474,8 @@ static int mhi_dev_net_enable_iface(struct mhi_dev_net_client *mhi_dev_net_ptr)
mhi_dev_net_ether_setup :
mhi_dev_net_rawip_setup);
if (!netdev) {
- pr_err("Failed to allocate netdev for mhi_dev_net\n");
+ mhi_dev_net_log(MHI_ERROR,
+ "Failed to allocate netdev for mhi_dev_net\n");
goto net_dev_alloc_fail;
}
@@ -488,7 +490,8 @@ static int mhi_dev_net_enable_iface(struct mhi_dev_net_client *mhi_dev_net_ptr)
*mhi_dev_net_ctxt = mhi_dev_net_ptr;
ret = register_netdev(mhi_dev_net_ptr->dev);
if (ret) {
- pr_err("Failed to register mhi_dev_net device\n");
+ mhi_dev_net_log(MHI_ERROR,
+ "Failed to register mhi_dev_net device\n");
goto net_dev_reg_fail;
}
mhi_dev_net_log(MHI_INFO, "Successfully registred mhi_dev_net\n");
@@ -510,18 +513,18 @@ static int mhi_dev_net_open_chan_create_netif(struct mhi_dev_net_client *client)
struct list_head *cp, *q;
struct mhi_req *mreq;
- mhi_dev_net_log(MHI_DBG, "opening OUT %d IN %d channels\n",
+ mhi_dev_net_log(MHI_DBG, "opening OUT ch_id:%d IN ch_id:%d channels\n",
client->out_chan,
client->in_chan);
mhi_dev_net_log(MHI_DBG,
- "Initializing inbound chan %d.\n",
+ "Initializing inbound ch_id:%d.\n",
client->in_chan);
rc = mhi_dev_open_channel(client->out_chan, &client->out_handle,
mhi_net_ctxt.net_event_notifier);
if (rc < 0) {
mhi_dev_net_log(MHI_ERROR,
- "Failed to open chan %d, ret 0x%x\n",
+ "Failed to open ch_id:%d, ret 0x%x\n",
client->out_chan, rc);
goto handle_not_rdy_err;
} else
@@ -531,13 +534,13 @@ static int mhi_dev_net_open_chan_create_netif(struct mhi_dev_net_client *client)
mhi_net_ctxt.net_event_notifier);
if (rc < 0) {
mhi_dev_net_log(MHI_ERROR,
- "Failed to open chan %d, ret 0x%x\n",
+ "Failed to open ch_id:%d, ret 0x%x\n",
client->in_chan, rc);
goto handle_in_err;
} else
atomic_set(&client->tx_enabled, 1);
- mhi_dev_net_log(MHI_INFO, "IN %d, OUT %d channels are opened",
+ mhi_dev_net_log(MHI_INFO, "IN ch_id:%d, OUT ch_id:%d channels are opened",
client->in_chan, client->out_chan);
INIT_LIST_HEAD(&client->rx_buffers);
@@ -546,12 +549,14 @@ static int mhi_dev_net_open_chan_create_netif(struct mhi_dev_net_client *client)
ret = mhi_dev_net_alloc_read_reqs(client);
if (ret) {
- pr_err("failed to allocate rx req buffers\n");
+ mhi_dev_net_log(MHI_ERROR,
+ "failed to allocate rx req buffers\n");
goto rx_req_failed;
}
ret = mhi_dev_net_alloc_write_reqs(client);
if (ret) {
- pr_err("failed to allocate write req buffers\n");
+ mhi_dev_net_log(MHI_ERROR,
+ "failed to allocate write req buffers\n");
goto tx_req_failed;
}
if (atomic_read(&client->tx_enabled)) {
@@ -607,7 +612,8 @@ static int mhi_dev_net_rgstr_client(struct mhi_dev_net_client *client, int idx)
mutex_init(&client->out_chan_lock);
spin_lock_init(&client->wrt_lock);
spin_lock_init(&client->rd_lock);
- mhi_dev_net_log(MHI_INFO, "Registering out %d, In %d channels\n",
+ mhi_dev_net_log(MHI_INFO, "Registering OUT ch_id:%d\t"
+ "IN ch_id:%d channels\n",
client->out_chan, client->in_chan);
return 0;
}
@@ -648,20 +654,20 @@ static void mhi_dev_net_state_cb(struct mhi_dev_client_cb_data *cb_data)
ret = mhi_ctrl_state_info(mhi_client->in_chan, &info_in_ch);
if (ret) {
mhi_dev_net_log(MHI_ERROR,
- "Failed to obtain in_channel %d state\n",
+ "Failed to obtain IN ch_id:%d state\n",
mhi_client->in_chan);
return;
}
ret = mhi_ctrl_state_info(mhi_client->out_chan, &info_out_ch);
if (ret) {
mhi_dev_net_log(MHI_ERROR,
- "Failed to obtain out_channel %d state\n",
+ "Failed to obtain OUT ch_id:%d state\n",
mhi_client->out_chan);
return;
}
- mhi_dev_net_log(MHI_MSG_VERBOSE, "in_channel :%d, state :%d\n",
+ mhi_dev_net_log(MHI_MSG_VERBOSE, "IN ch_id::%d, state :%d\n",
mhi_client->in_chan, info_in_ch);
- mhi_dev_net_log(MHI_MSG_VERBOSE, "out_channel :%d, state :%d\n",
+ mhi_dev_net_log(MHI_MSG_VERBOSE, "OUT ch_id:%d, state :%d\n",
mhi_client->out_chan, info_out_ch);
if (info_in_ch == MHI_STATE_CONNECTED &&
info_out_ch == MHI_STATE_CONNECTED) {
diff --git a/drivers/platform/msm/mhi_dev/mhi_mmio.c b/drivers/platform/msm/mhi_dev/mhi_mmio.c
index a6aebc969a59..a306b58511c1 100644
--- a/drivers/platform/msm/mhi_dev/mhi_mmio.c
+++ b/drivers/platform/msm/mhi_dev/mhi_mmio.c
@@ -101,7 +101,7 @@ static int mhi_dev_mmio_mask_set_chdb_int_a7(struct mhi_dev *dev,
chid_idx = chdb_id/32;
if (chid_idx >= MHI_MASK_ROWS_CH_EV_DB) {
- pr_err("Invalid channel id:%d\n", chid_idx);
+ mhi_log(MHI_MSG_ERROR, "Invalid ch_id:%d\n", chid_idx);
return -EINVAL;
}
@@ -633,7 +633,7 @@ int mhi_dev_restore_mmio(struct mhi_dev *dev)
rc = mhi_dev_mmio_write(dev, MHI_CHDB_INT_MASK_A7_n(i),
dev->chdb[i].mask);
if (rc) {
- mhi_log(MHI_MSG_VERBOSE,
+ mhi_log(MHI_MSG_ERROR,
"Error writing enable for A7\n");
return rc;
}
diff --git a/drivers/platform/msm/mhi_dev/mhi_ring.c b/drivers/platform/msm/mhi_dev/mhi_ring.c
index e7b6fb4c389e..06d18c81e9ce 100644
--- a/drivers/platform/msm/mhi_dev/mhi_ring.c
+++ b/drivers/platform/msm/mhi_dev/mhi_ring.c
@@ -94,7 +94,7 @@ int mhi_dev_cache_ring(struct mhi_dev_ring *ring, size_t wr_offset)
if (ring->wr_offset == wr_offset) {
mhi_log(MHI_MSG_VERBOSE,
- "nothing to cache for ring %d, local wr_ofst %lu\n",
+ "nothing to cache for ring_id:%d, local wr_ofst %lu\n",
ring->id, ring->wr_offset);
mhi_log(MHI_MSG_VERBOSE,
"new wr_offset %lu\n", wr_offset);
@@ -112,16 +112,16 @@ int mhi_dev_cache_ring(struct mhi_dev_ring *ring, size_t wr_offset)
ring->id < (mhi_ctx->ev_ring_start +
mhi_ctx->cfg.event_rings)) {
mhi_log(MHI_MSG_VERBOSE,
- "not caching event ring %d\n", ring->id);
+ "not caching event ring_id:%d\n", ring->id);
return 0;
}
- mhi_log(MHI_MSG_VERBOSE, "caching ring %d, start %lu, end %lu\n",
+ mhi_log(MHI_MSG_VERBOSE, "caching ring_id:%d, start %lu, end %lu\n",
ring->id, old_offset, wr_offset);
if (mhi_dev_fetch_ring_elements(ring, old_offset, wr_offset)) {
mhi_log(MHI_MSG_ERROR,
- "failed to fetch elements for ring %d, start %lu, end %lu\n",
+ "failed to fetch elements for ring_id:%d, start %lu, end %lu\n",
ring->id, old_offset, wr_offset);
return -EINVAL;
}
@@ -143,28 +143,28 @@ int mhi_dev_update_wr_offset(struct mhi_dev_ring *ring)
case RING_TYPE_CMD:
rc = mhi_dev_mmio_get_cmd_db(ring, &wr_offset);
if (rc) {
- pr_err("%s: CMD DB read failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "CMD DB read failed\n");
return rc;
}
mhi_log(MHI_MSG_VERBOSE,
- "ring %d wr_offset from db 0x%lx\n",
+ "ring_id:%d wr_offset from db 0x%lx\n",
ring->id, (size_t) wr_offset);
break;
case RING_TYPE_ER:
rc = mhi_dev_mmio_get_erc_db(ring, &wr_offset);
if (rc) {
- pr_err("%s: EVT DB read failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "EVT DB read failed\n");
return rc;
}
break;
case RING_TYPE_CH:
rc = mhi_dev_mmio_get_ch_db(ring, &wr_offset);
if (rc) {
- pr_err("%s: CH DB read failed\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "CH DB read failed\n");
return rc;
}
mhi_log(MHI_MSG_VERBOSE,
- "ring %d wr_offset from db 0x%lx\n",
+ "ring_id:%d wr_offset from db 0x%lx\n",
ring->id, (size_t) wr_offset);
break;
default:
@@ -192,14 +192,17 @@ int mhi_dev_process_ring_element(struct mhi_dev_ring *ring, size_t offset)
/* get the element and invoke the respective callback */
el = &ring->ring_cache[offset];
- mhi_log(MHI_MSG_VERBOSE, "evnt ptr : 0x%llx\n", el->tre.data_buf_ptr);
- mhi_log(MHI_MSG_VERBOSE, "evnt len : 0x%x, offset:%lu\n",
+ if (ring->type == RING_TYPE_CH) {
+ mhi_log(MHI_MSG_VERBOSE, "TRE data buff ptr : 0x%llx\n",
+ el->tre.data_buf_ptr);
+ mhi_log(MHI_MSG_VERBOSE, "TRE len : 0x%x, rd_offset:%lu\n",
el->tre.len, offset);
+ }
if (ring->ring_cb)
return ring->ring_cb(ring->mhi_dev, el, (void *)ring);
else
- mhi_log(MHI_MSG_ERROR, "No callback registered for ring %d\n",
+ mhi_log(MHI_MSG_ERROR, "No callback registered for ring_id:%d\n",
ring->id);
return 0;
@@ -209,54 +212,52 @@ EXPORT_SYMBOL(mhi_dev_process_ring_element);
int mhi_dev_process_ring(struct mhi_dev_ring *ring)
{
int rc = 0;
- union mhi_dev_ring_element_type *el;
if (WARN_ON(!ring))
return -EINVAL;
mhi_log(MHI_MSG_VERBOSE,
- "Before wr update ring_id (%d) element (%lu) with wr:%lu\n",
+ "Before wr update ring_id:%d rp:%lu wp:%lu\n",
ring->id, ring->rd_offset, ring->wr_offset);
rc = mhi_dev_update_wr_offset(ring);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Error updating write-offset for ring %d\n",
+ "Error updating write-offset for ring_id:%d\n",
ring->id);
return rc;
}
- /* get the element and invoke the respective callback */
- el = &ring->ring_cache[ring->wr_offset];
-
- mhi_log(MHI_MSG_VERBOSE, "evnt ptr : 0x%llx\n", el->tre.data_buf_ptr);
- mhi_log(MHI_MSG_VERBOSE, "evnt len : 0x%x, wr_offset:%lu\n",
- el->tre.len, ring->wr_offset);
-
- if (ring->type == RING_TYPE_CH) {
- /* notify the clients that there are elements in the ring */
- rc = mhi_dev_process_ring_element(ring, ring->rd_offset);
- if (rc)
- pr_err("Error fetching elements\n");
- return rc;
- }
mhi_log(MHI_MSG_VERBOSE,
- "After ring update ring_id (%d) element (%lu) with wr:%lu\n",
+ "After wp update ring_id:%d rp:%lu with wr:%lu\n",
ring->id, ring->rd_offset, ring->wr_offset);
+ /*
+ * Notify the clients that there are elements in the ring.
+ * For channels, simply notify client for the first element (no need to
+ * notify for all the elements) and return (no need to update rd
+ * pointer). When client consumes the elements, rp will be updated.
+ */
+ if (ring->type == RING_TYPE_CH) {
+ rc = mhi_dev_process_ring_element(ring, ring->rd_offset);
+ if (rc)
+ mhi_log(MHI_MSG_ERROR, "Error fetching elements\n");
+ return rc;
+ }
+
while (ring->rd_offset != ring->wr_offset) {
+ mhi_log(MHI_MSG_VERBOSE,
+ "Processing ring_id:%d rd_offset:%lu, wr_offset:%lu\n",
+ ring->id, ring->rd_offset, ring->wr_offset);
+
rc = mhi_dev_process_ring_element(ring, ring->rd_offset);
if (rc) {
mhi_log(MHI_MSG_ERROR,
- "Error processing ring (%d) element (%lu)\n",
+ "Error processing ring_id:%d element(rp):%lu\n",
ring->id, ring->rd_offset);
return rc;
}
- mhi_log(MHI_MSG_VERBOSE,
- "Processing ring (%d) rd_offset:%lu, wr_offset:%lu\n",
- ring->id, ring->rd_offset, ring->wr_offset);
-
mhi_dev_ring_inc_index(ring, ring->rd_offset);
}
@@ -297,7 +298,7 @@ int mhi_dev_add_element(struct mhi_dev_ring *ring,
ring->wr_offset - 1;
if (num_free_elem < num_elem) {
- mhi_log(MHI_MSG_ERROR, "No space to add %d elem in ring (%d)\n",
+ mhi_log(MHI_MSG_ERROR, "No space to add %d elem in ring_id:%d\n",
num_elem, ring->id);
return -EINVAL;
}
@@ -312,8 +313,9 @@ int mhi_dev_add_element(struct mhi_dev_ring *ring,
mhi_dev_ring_inc_index(ring, ring->rd_offset);
mhi_log(MHI_MSG_VERBOSE,
- "Writing %d elements, ring old 0x%x, new 0x%x\n",
- num_elem, old_offset, ring->rd_offset);
+ "Writing %d elements in ring_id:%d\t"
+ "ring old-offset 0x%x, new-offset 0x%x\n",
+ num_elem, ring->id, old_offset, ring->rd_offset);
ring->ring_ctx->generic.rp = (ring->rd_offset *
sizeof(union mhi_dev_ring_element_type)) +
@@ -335,7 +337,7 @@ int mhi_dev_add_element(struct mhi_dev_ring *ring,
host_addr.virt_addr = element;
host_addr.size = sizeof(union mhi_dev_ring_element_type);
- mhi_log(MHI_MSG_VERBOSE, "adding element to ring (%d)\n",
+ mhi_log(MHI_MSG_VERBOSE, "adding element to ring_id:%d\n",
ring->id);
mhi_log(MHI_MSG_VERBOSE, "rd_ofset %lu\n", ring->rd_offset);
mhi_log(MHI_MSG_VERBOSE, "type %d\n", element->generic.type);
@@ -355,7 +357,7 @@ int mhi_dev_add_element(struct mhi_dev_ring *ring,
(element + i)->evt_tr_comp.code);
mhi_log(MHI_MSG_VERBOSE, "evnt type :0x%x\n",
(element + i)->evt_tr_comp.type);
- mhi_log(MHI_MSG_VERBOSE, "evnt chid :0x%x\n",
+ mhi_log(MHI_MSG_VERBOSE, "evnt ch_id :0x%x\n",
(element + i)->evt_tr_comp.chid);
}
/* Adding multiple ring elements */
@@ -490,19 +492,6 @@ int mhi_ring_start(struct mhi_dev_ring *ring, union mhi_dev_ring_ctx *ctx,
ring->ring_shadow.device_va = mhi->ctrl_base.device_va + offset;
ring->ring_shadow.host_pa = mhi->ctrl_base.host_pa + offset;
- if (ring->type == RING_TYPE_ER)
- ring->ring_ctx_shadow =
- (union mhi_dev_ring_ctx *) (mhi->ev_ctx_shadow.device_va +
- (ring->id - mhi->ev_ring_start) *
- sizeof(union mhi_dev_ring_ctx));
- else if (ring->type == RING_TYPE_CMD)
- ring->ring_ctx_shadow =
- (union mhi_dev_ring_ctx *) mhi->cmd_ctx_shadow.device_va;
- else if (ring->type == RING_TYPE_CH)
- ring->ring_ctx_shadow =
- (union mhi_dev_ring_ctx *) (mhi->ch_ctx_shadow.device_va +
- (ring->id - mhi->ch_ring_start)*sizeof(union mhi_dev_ring_ctx));
-
ring->ring_ctx_shadow = ring->ring_ctx;
if (ring->type != RING_TYPE_ER || ring->type != RING_TYPE_CH) {
@@ -574,7 +563,7 @@ void mhi_ring_set_state(struct mhi_dev_ring *ring,
return;
if (state > RING_STATE_PENDING) {
- pr_err("%s: Invalid ring state\n", __func__);
+ mhi_log(MHI_MSG_ERROR, "Invalid ring state\n");
return;
}
diff --git a/drivers/platform/msm/mhi_dev/mhi_uci.c b/drivers/platform/msm/mhi_dev/mhi_uci.c
index 0039fa48c561..53ddfc75ab42 100644
--- a/drivers/platform/msm/mhi_dev/mhi_uci.c
+++ b/drivers/platform/msm/mhi_dev/mhi_uci.c
@@ -55,7 +55,7 @@ enum uci_dbg_level {
UCI_DBG_reserved = 0x80000000
};
-static enum uci_dbg_level mhi_uci_msg_lvl = UCI_DBG_CRITICAL;
+static enum uci_dbg_level mhi_uci_msg_lvl = UCI_DBG_ERROR;
static enum uci_dbg_level mhi_uci_ipc_log_lvl = UCI_DBG_INFO;
static void *mhi_uci_ipc_log;
@@ -452,7 +452,7 @@ static bool mhi_uci_are_channels_connected(struct uci_client *uci_client)
rc = mhi_ctrl_state_info(uci_client->in_chan, &info_ch_in);
if (rc) {
uci_log(UCI_DBG_DBG,
- "Channels %d is not available with %d\n",
+ "ch_id:%d is not available with %d\n",
uci_client->out_chan, rc);
return false;
}
@@ -460,7 +460,7 @@ static bool mhi_uci_are_channels_connected(struct uci_client *uci_client)
rc = mhi_ctrl_state_info(uci_client->out_chan, &info_ch_out);
if (rc) {
uci_log(UCI_DBG_DBG,
- "Channels %d is not available with %d\n",
+ "ch_id:%d is not available with %d\n",
uci_client->out_chan, rc);
return false;
}
@@ -468,7 +468,7 @@ static bool mhi_uci_are_channels_connected(struct uci_client *uci_client)
if ((info_ch_in != MHI_STATE_CONNECTED) ||
(info_ch_out != MHI_STATE_CONNECTED)) {
uci_log(UCI_DBG_DBG,
- "Channels %d or %d are not connected\n",
+ "ch_id:%d or %d are not connected\n",
uci_client->in_chan, uci_client->out_chan);
return false;
}
@@ -490,13 +490,13 @@ static int mhi_init_read_chan(struct uci_client *client_handle,
return -EINVAL;
}
if (chan >= MHI_MAX_SOFTWARE_CHANNELS) {
- uci_log(UCI_DBG_ERROR, "Incorrect channel number %d\n", chan);
+ uci_log(UCI_DBG_ERROR, "Incorrect ch_id:%d\n", chan);
return -EINVAL;
}
in_chan_attr = client_handle->in_chan_attr;
if (!in_chan_attr) {
- uci_log(UCI_DBG_ERROR, "Null channel attributes for chan %d\n",
+ uci_log(UCI_DBG_ERROR, "Null channel attributes for ch_id:%d\n",
client_handle->in_chan);
return -EINVAL;
}
@@ -531,7 +531,7 @@ static struct mhi_req *mhi_uci_get_req(struct uci_client *uci_handle)
spin_lock_irqsave(&uci_handle->req_lock, flags);
if (list_empty(&uci_handle->req_list)) {
- uci_log(UCI_DBG_ERROR, "Request pool empty for chans %d, %d\n",
+ uci_log(UCI_DBG_ERROR, "Request pool empty for ch_id:%d, %d\n",
uci_handle->in_chan, uci_handle->out_chan);
spin_unlock_irqrestore(&uci_handle->req_lock, flags);
return NULL;
@@ -546,7 +546,7 @@ static struct mhi_req *mhi_uci_get_req(struct uci_client *uci_handle)
* req is re-used
*/
if (req->is_stale && req->buf && MHI_UCI_IS_CHAN_DIR_IN(req->chan)) {
- uci_log(UCI_DBG_VERBOSE, "Freeing write buf for chan %d\n",
+ uci_log(UCI_DBG_VERBOSE, "Freeing write buf for ch_id:%d\n",
req->chan);
kfree(req->buf);
}
@@ -565,7 +565,7 @@ static int mhi_uci_put_req(struct uci_client *uci_handle, struct mhi_req *req)
spin_lock_irqsave(&uci_handle->req_lock, flags);
if (req->is_stale) {
uci_log(UCI_DBG_VERBOSE,
- "Got stale completion for ch %d, ignoring\n",
+ "Got stale completion for ch_id:%d, ignoring\n",
req->chan);
spin_unlock_irqrestore(&uci_handle->req_lock, flags);
return -EINVAL;
@@ -630,7 +630,8 @@ static int mhi_uci_send_sync(struct uci_client *uci_handle,
int ret_val;
uci_log(UCI_DBG_VERBOSE,
- "Sync write for ch %d size %d\n", uci_handle->out_chan, size);
+ "Sync write for ch_id:%d size %d\n",
+ uci_handle->out_chan, size);
ureq.client = uci_handle->out_handle;
ureq.buf = data_loc;
@@ -652,7 +653,7 @@ static int mhi_uci_send_async(struct uci_client *uci_handle,
struct mhi_req *ureq;
uci_log(UCI_DBG_DBG,
- "Async write for ch %d size %d\n",
+ "Async write for ch_id:%d size %d\n",
uci_handle->out_chan, size);
ureq = mhi_uci_get_req(uci_handle);
@@ -691,7 +692,7 @@ static int mhi_uci_send_packet(struct uci_client *uci_handle, void *data_loc,
ret_val = uci_handle->send(uci_handle, data_loc, size);
if (!ret_val) {
uci_log(UCI_DBG_VERBOSE,
- "No descriptors available, did we poll, chan %d?\n",
+ "No descriptors available, did we poll, ch_id:%d?\n",
uci_handle->out_chan);
mutex_unlock(&uci_handle->out_chan_lock);
if (uci_handle->f_flags & (O_NONBLOCK | O_NDELAY))
@@ -711,7 +712,7 @@ static int mhi_uci_send_packet(struct uci_client *uci_handle, void *data_loc,
* Wait till pending writes complete or a timeout.
*/
uci_log(UCI_DBG_VERBOSE,
- "Write req list empty for chan %d\n",
+ "Write req list empty for ch_id:%d\n",
uci_handle->out_chan);
mutex_unlock(&uci_handle->out_chan_lock);
if (uci_handle->f_flags & (O_NONBLOCK | O_NDELAY))
@@ -726,14 +727,14 @@ static int mhi_uci_send_packet(struct uci_client *uci_handle, void *data_loc,
* retry the write.
*/
uci_log(UCI_DBG_VERBOSE,
- "Write req struct available for chan %d\n",
+ "Write req struct available for ch_id:%d\n",
uci_handle->out_chan);
mutex_lock(&uci_handle->out_chan_lock);
ret_val = 0;
continue;
} else if (!ret_val) {
uci_log(UCI_DBG_ERROR,
- "Timed out waiting for write req, chan %d\n",
+ "Timed out waiting for write req, ch_id:%d\n",
uci_handle->out_chan);
return -EIO;
} else if (-ERESTARTSYS == ret_val) {
@@ -743,7 +744,7 @@ static int mhi_uci_send_packet(struct uci_client *uci_handle, void *data_loc,
}
} else if (ret_val < 0) {
uci_log(UCI_DBG_ERROR,
- "Err sending data: chan %d, buf %pK, size %d\n",
+ "Err sending data: ch_id:%d, buf %pK, size %d\n",
uci_handle->out_chan, data_loc, size);
ret_val = -EIO;
break;
@@ -807,18 +808,18 @@ static unsigned int mhi_uci_client_poll(struct file *file, poll_table *wait)
if (!atomic_read(&uci_ctxt.mhi_disabled) &&
!mhi_dev_channel_isempty(uci_handle->in_handle)) {
uci_log(UCI_DBG_VERBOSE,
- "Client can read chan %d\n", uci_handle->in_chan);
+ "Client can read ch_id:%d\n", uci_handle->in_chan);
mask |= POLLIN | POLLRDNORM;
}
if (!atomic_read(&uci_ctxt.mhi_disabled) &&
!mhi_dev_channel_isempty(uci_handle->out_handle)) {
uci_log(UCI_DBG_VERBOSE,
- "Client can write chan %d\n", uci_handle->out_chan);
+ "Client can write ch_id:%d\n", uci_handle->out_chan);
mask |= POLLOUT | POLLWRNORM;
}
uci_log(UCI_DBG_VERBOSE,
- "Client attempted to poll chan %d, returning mask 0x%x\n",
+ "Client attempted to poll ch_id:%d, returning mask 0x%x\n",
uci_handle->in_chan, mask);
mutex_unlock(&uci_handle->client_lock);
@@ -853,7 +854,7 @@ static int mhi_uci_alloc_reqs(struct uci_client *client)
list_add_tail(&client->reqs[i].list, &client->req_list);
uci_log(UCI_DBG_INFO,
- "Allocated %d write reqs for chan %d\n",
+ "Allocated %d write reqs for ch_id:%d\n",
num_reqs, client->out_chan);
return 0;
}
@@ -866,12 +867,12 @@ static int mhi_uci_read_async(struct uci_client *uci_handle, int *bytes_avail)
struct mhi_dev_client *client_handle;
uci_log(UCI_DBG_DBG,
- "Async read for ch %d\n", uci_handle->in_chan);
+ "Async read for ch_id:%d\n", uci_handle->in_chan);
ureq = mhi_uci_get_req(uci_handle);
if (!ureq) {
uci_log(UCI_DBG_ERROR,
- "Out of reqs for chan %d\n", uci_handle->in_chan);
+ "Out of reqs for ch_id:%d\n", uci_handle->in_chan);
return -EBUSY;
}
@@ -917,14 +918,14 @@ static int mhi_uci_read_async(struct uci_client *uci_handle, int *bytes_avail)
uci_log(UCI_DBG_ERROR, "Exit signal caught\n");
return compl_ret;
} else if (compl_ret == 0) {
- uci_log(UCI_DBG_ERROR, "Read timed out for ch %d\n",
+ uci_log(UCI_DBG_ERROR, "Read timed out for ch_id:%d\n",
uci_handle->in_chan);
return -EIO;
}
uci_log(UCI_DBG_VERBOSE,
- "wk up Read completed on ch %d\n", uci_handle->in_chan);
+ "wk up Read completed on ch_id:%d\n", uci_handle->in_chan);
uci_log(UCI_DBG_VERBOSE,
- "Got pkt of sz 0x%lx at adr %pK, ch %d\n",
+ "Got pkt of sz 0x%lx at adr %pK, ch_id:%d\n",
uci_handle->pkt_size,
uci_handle->pkt_loc, uci_handle->in_chan);
} else {
@@ -944,8 +945,8 @@ static int mhi_uci_read_sync(struct uci_client *uci_handle, int *bytes_avail)
struct mhi_req ureq;
struct mhi_dev_client *client_handle;
- uci_log(UCI_DBG_ERROR,
- "Sync read for ch %d\n", uci_handle->in_chan);
+ uci_log(UCI_DBG_INFO,
+ "Sync read for ch_id:%d\n", uci_handle->in_chan);
client_handle = uci_handle->in_handle;
ureq.chan = uci_handle->in_chan;
@@ -969,7 +970,7 @@ static int mhi_uci_read_sync(struct uci_client *uci_handle, int *bytes_avail)
uci_handle->pkt_size = ureq.transfer_len;
uci_log(UCI_DBG_VERBOSE,
- "Got pkt of sz 0x%lx at adr %pK, ch %d\n",
+ "Got pkt of sz 0x%lx at adr %pK, ch_id:%d\n",
uci_handle->pkt_size,
ureq.buf, ureq.chan);
} else {
@@ -985,13 +986,12 @@ static int open_client_mhi_channels(struct uci_client *uci_client)
int rc = 0;
if (!mhi_uci_are_channels_connected(uci_client)) {
- uci_log(UCI_DBG_ERROR, "%s:Channels are not connected\n",
- __func__);
+ uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
uci_log(UCI_DBG_DBG,
- "Starting channels %d %d.\n",
+ "Starting channels OUT ch_id:%d IN ch_id:%d\n",
uci_client->out_chan,
uci_client->in_chan);
mutex_lock(&uci_client->out_chan_lock);
@@ -1010,7 +1010,7 @@ static int open_client_mhi_channels(struct uci_client *uci_client)
}
uci_log(UCI_DBG_DBG,
- "Initializing inbound chan %d.\n",
+ "Initializing inbound ch_id:%d.\n",
uci_client->in_chan);
rc = mhi_init_read_chan(uci_client, uci_client->in_chan);
if (rc < 0) {
@@ -1031,7 +1031,7 @@ static int open_client_mhi_channels(struct uci_client *uci_client)
uci_ctxt.event_notifier);
if (rc < 0) {
uci_log(UCI_DBG_ERROR,
- "Failed to open chan %d, ret %d\n",
+ "Failed to open ch_id:%d, ret %d\n",
uci_client->out_chan, rc);
goto handle_in_err;
}
@@ -1134,14 +1134,14 @@ static int mhi_uci_client_release(struct inode *mhi_inode,
mutex_lock(&uci_handle->client_lock);
in_chan_attr = uci_handle->in_chan_attr;
if (!in_chan_attr) {
- uci_log(UCI_DBG_ERROR, "Null channel attributes for chan %d\n",
+ uci_log(UCI_DBG_ERROR, "Null channel attributes for ch_id:%d\n",
uci_handle->in_chan);
mutex_unlock(&uci_handle->client_lock);
return -EINVAL;
}
if (atomic_sub_return(1, &uci_handle->ref_count)) {
- uci_log(UCI_DBG_DBG, "Client close chan %d, ref count 0x%x\n",
+ uci_log(UCI_DBG_DBG, "Client close ch_id:%d, ref count 0x%x\n",
iminor(mhi_inode),
atomic_read(&uci_handle->ref_count));
mutex_unlock(&uci_handle->client_lock);
@@ -1149,7 +1149,7 @@ static int mhi_uci_client_release(struct inode *mhi_inode,
}
uci_log(UCI_DBG_DBG,
- "Last client left, closing channel 0x%x\n",
+ "Last client left, closing ch 0x%x\n",
iminor(mhi_inode));
do {
@@ -1161,7 +1161,7 @@ static int mhi_uci_client_release(struct inode *mhi_inode,
} while (++count < MHI_UCI_RELEASE_TIMEOUT_COUNT);
if (count == MHI_UCI_RELEASE_TIMEOUT_COUNT) {
- uci_log(UCI_DBG_DBG, "Channel %d has pending writes\n",
+ uci_log(UCI_DBG_DBG, "ch_id:%d has pending writes\n",
iminor(mhi_inode));
}
@@ -1192,7 +1192,7 @@ static int mhi_uci_client_release(struct inode *mhi_inode,
list_del_init(&ureq->list);
ureq->is_stale = true;
uci_log(UCI_DBG_VERBOSE,
- "Adding back req for chan %d to free list\n",
+ "Adding back req for ch_id:%d to free list\n",
ureq->chan);
list_add_tail(&ureq->list, &uci_handle->req_list);
count++;
@@ -1247,7 +1247,7 @@ static int mhi_state_uevent(struct device *dev, struct kobj_uevent_env *env)
rc = mhi_ctrl_state_info(MHI_DEV_UEVENT_CTRL, &info);
if (rc) {
- pr_err("Failed to obtain MHI_STATE\n");
+ uci_log(UCI_DBG_ERROR, "Failed to obtain MHI_STATE\n");
return -EINVAL;
}
@@ -1257,12 +1257,13 @@ static int mhi_state_uevent(struct device *dev, struct kobj_uevent_env *env)
for (i = 0; i < ARRAY_SIZE(mhi_chan_attr_table); i++) {
chan_attrib = &mhi_chan_attr_table[i];
if (chan_attrib->state_bcast) {
- uci_log(UCI_DBG_ERROR, "Calling notify for ch %d\n",
+ uci_log(UCI_DBG_INFO, "Calling notify for ch_id:%d\n",
chan_attrib->chan_id);
rc = mhi_ctrl_state_info(chan_attrib->chan_id, &info);
if (rc) {
- pr_err("Failed to obtain channel %d state\n",
- chan_attrib->chan_id);
+ uci_log(UCI_DBG_ERROR,
+ "Failed to obtain ch_id:%d state\n",
+ chan_attrib->chan_id);
return -EINVAL;
}
nbytes = 0;
@@ -1307,7 +1308,7 @@ static ssize_t mhi_uci_ctrl_client_read(struct file *file,
"MHI_STATE=DISCONNECTED");
break;
default:
- pr_err("invalid info:%d\n", info);
+ uci_log(UCI_DBG_ERROR, "invalid info:%d\n", info);
return -EINVAL;
}
@@ -1329,8 +1330,7 @@ static int __mhi_uci_client_read(struct uci_client *uci_handle,
do {
if (!mhi_uci_are_channels_connected(uci_handle)) {
- uci_log(UCI_DBG_ERROR,
- "%s:Channels are not connected\n", __func__);
+ uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
@@ -1344,7 +1344,7 @@ static int __mhi_uci_client_read(struct uci_client *uci_handle,
/* If nothing was copied yet, wait for data */
uci_log(UCI_DBG_VERBOSE,
- "No data read_data_ready %d, chan %d\n",
+ "No data read_data_ready %d, ch_id:%d\n",
atomic_read(&uci_handle->read_data_ready),
uci_handle->in_chan);
if (uci_handle->f_flags & (O_NONBLOCK | O_NDELAY))
@@ -1360,13 +1360,13 @@ static int __mhi_uci_client_read(struct uci_client *uci_handle,
}
uci_log(UCI_DBG_VERBOSE,
- "wk up Got data on ch %d read_data_ready %d\n",
+ "wk up Got data on ch_id:%d read_data_ready %d\n",
uci_handle->in_chan,
atomic_read(&uci_handle->read_data_ready));
} else if (*bytes_avail > 0) {
/* A valid packet was returned from MHI */
uci_log(UCI_DBG_VERBOSE,
- "Got packet: avail pkts %d phy_adr %pK, ch %d\n",
+ "Got packet: avail pkts %d phy_adr %pK, ch_id:%d\n",
atomic_read(&uci_handle->read_data_ready),
uci_handle->pkt_loc,
uci_handle->in_chan);
@@ -1399,7 +1399,7 @@ static ssize_t mhi_uci_client_read(struct file *file, char __user *ubuf,
mutex = &uci_handle->in_chan_lock;
mutex_lock(mutex);
- uci_log(UCI_DBG_VERBOSE, "Client attempted read on chan %d\n",
+ uci_log(UCI_DBG_VERBOSE, "Client attempted read on ch_id:%d\n",
uci_handle->in_chan);
ret_val = __mhi_uci_client_read(uci_handle, &bytes_avail);
@@ -1419,7 +1419,7 @@ static ssize_t mhi_uci_client_read(struct file *file, char __user *ubuf,
bytes_copied = *bytes_pending;
*bytes_pending = 0;
- uci_log(UCI_DBG_VERBOSE, "Copied 0x%lx of 0x%x, chan %d\n",
+ uci_log(UCI_DBG_VERBOSE, "Copied 0x%lx of 0x%x, ch_id:%d\n",
bytes_copied, (u32)*bytes_pending, uci_handle->in_chan);
} else {
addr_offset = uci_handle->pkt_size - *bytes_pending;
@@ -1430,7 +1430,7 @@ static ssize_t mhi_uci_client_read(struct file *file, char __user *ubuf,
}
bytes_copied = uspace_buf_size;
*bytes_pending -= uspace_buf_size;
- uci_log(UCI_DBG_VERBOSE, "Copied 0x%lx of 0x%x,chan %d\n",
+ uci_log(UCI_DBG_VERBOSE, "Copied 0x%lx of 0x%x,ch_id:%d\n",
bytes_copied,
(u32)*bytes_pending,
uci_handle->in_chan);
@@ -1438,7 +1438,7 @@ static ssize_t mhi_uci_client_read(struct file *file, char __user *ubuf,
/* We finished with this buffer, map it back */
if (*bytes_pending == 0) {
uci_log(UCI_DBG_VERBOSE,
- "All data consumed. Pkt loc %p ,chan %d\n",
+ "All data consumed. Pkt loc %p ,ch_id:%d\n",
uci_handle->pkt_loc, uci_handle->in_chan);
uci_handle->pkt_loc = 0;
uci_handle->pkt_size = 0;
@@ -1481,8 +1481,7 @@ static ssize_t mhi_uci_client_write(struct file *file,
}
if (!mhi_uci_are_channels_connected(uci_handle)) {
- uci_log(UCI_DBG_ERROR, "%s:Channels are not connected\n",
- __func__);
+ uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
@@ -1541,8 +1540,7 @@ static ssize_t mhi_uci_client_write_iter(struct kiocb *iocb,
}
if (!mhi_uci_are_channels_connected(uci_handle)) {
- uci_log(UCI_DBG_ERROR, "%s:Channels are not connected\n",
- __func__);
+ uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
@@ -1581,7 +1579,7 @@ void mhi_uci_chan_state_notify_all(struct mhi_dev *mhi,
for (i = 0; i < ARRAY_SIZE(mhi_chan_attr_table); i++) {
chan_attrib = &mhi_chan_attr_table[i];
if (chan_attrib->state_bcast) {
- uci_log(UCI_DBG_ERROR, "Calling notify for ch %d\n",
+ uci_log(UCI_DBG_ERROR, "Calling notify for ch_id:%d\n",
chan_attrib->chan_id);
mhi_uci_chan_state_notify(mhi, chan_attrib->chan_id,
ch_state);
@@ -1598,14 +1596,14 @@ void mhi_uci_chan_state_notify(struct mhi_dev *mhi,
int rc;
if (ch_id < 0 || ch_id >= MHI_MAX_SOFTWARE_CHANNELS) {
- uci_log(UCI_DBG_ERROR, "Invalid chan %d\n", ch_id);
+ uci_log(UCI_DBG_ERROR, "Invalid ch_id:%d\n", ch_id);
return;
}
uci_handle = &uci_ctxt.client_handles[CHAN_TO_CLIENT(ch_id)];
if (!uci_handle->out_chan_attr ||
!uci_handle->out_chan_attr->state_bcast) {
- uci_log(UCI_DBG_VERBOSE, "Uevents not enabled for chan %d\n",
+ uci_log(UCI_DBG_VERBOSE, "Uevents not enabled for ch_id:%d\n",
ch_id);
return;
}
@@ -1631,7 +1629,7 @@ void mhi_uci_chan_state_notify(struct mhi_dev *mhi,
rc = kobject_uevent_env(&mhi->dev->kobj, KOBJ_CHANGE, buf);
if (rc)
uci_log(UCI_DBG_ERROR,
- "Sending uevent failed for chan %d\n", ch_id);
+ "Sending uevent failed for ch_id:%d\n", ch_id);
if (ch_state == MHI_STATE_DISCONNECTED &&
!atomic_read(&uci_handle->ref_count)) {
@@ -1651,7 +1649,7 @@ void uci_ctrl_update(struct mhi_dev_client_cb_reason *reason)
if (reason->reason == MHI_DEV_CTRL_UPDATE) {
uci_ctrl_handle = &uci_ctxt.ctrl_handle;
if (!uci_ctrl_handle) {
- pr_err("Invalid uci ctrl handle\n");
+ uci_log(UCI_DBG_ERROR, "Invalid uci ctrl handle\n");
return;
}
@@ -1677,7 +1675,7 @@ static void uci_event_notifier(struct mhi_dev_client_cb_reason *reason)
uci_handle->out_chan_attr->tre_notif_cb(reason);
} else if (reason->reason == MHI_DEV_TRE_AVAILABLE) {
uci_log(UCI_DBG_DBG,
- "recived TRE available event for chan %d\n",
+ "recived TRE available event for ch_id:%d\n",
uci_handle->in_chan);
if (reason->ch_id % 2) {
atomic_set(&uci_handle->write_data_ready, 1);
@@ -1702,7 +1700,7 @@ static int mhi_register_client(struct uci_client *mhi_client, int index)
/* Init the completion event for AT ctrl read */
init_completion(&mhi_client->at_ctrl_read_done);
- uci_log(UCI_DBG_DBG, "Registering chan %d.\n", mhi_client->out_chan);
+ uci_log(UCI_DBG_DBG, "Registering ch_id:%d.\n", mhi_client->out_chan);
return 0;
}
@@ -2069,7 +2067,7 @@ static void mhi_uci_at_ctrl_client_cb(struct mhi_dev_client_cb_data *cb_data)
int rc, i;
struct mhi_req *ureq;
- uci_log(UCI_DBG_VERBOSE, " Rcvd MHI cb for channel %d, state %d\n",
+ uci_log(UCI_DBG_VERBOSE, " Rcvd MHI cb for ch_id:%d, state %d\n",
cb_data->channel, cb_data->ctrl_info);
if (cb_data->ctrl_info == MHI_STATE_CONNECTED) {
@@ -2120,7 +2118,7 @@ static void mhi_uci_generic_client_cb(struct mhi_dev_client_cb_data *cb_data)
{
struct uci_client *client = cb_data->user_data;
- uci_log(UCI_DBG_DBG, "Rcvd MHI cb for channel %d, state %d\n",
+ uci_log(UCI_DBG_DBG, "Rcvd MHI cb for ch_id:%d, state %d\n",
cb_data->channel, cb_data->ctrl_info);
if (cb_data->ctrl_info == MHI_STATE_CONNECTED)
@@ -2254,7 +2252,7 @@ int mhi_uci_init(void)
/* Control node */
uci_ctxt.cdev_ctrl = cdev_alloc();
if (uci_ctxt.cdev_ctrl == NULL) {
- pr_err("%s: ctrl cdev alloc failed\n", __func__);
+ uci_log(UCI_DBG_ERROR, "ctrl cdev alloc failed\n");
return 0;
}
diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c
index ce4ba0aaffab..4bfead753772 100644
--- a/drivers/power/supply/qcom/smb5-lib.c
+++ b/drivers/power/supply/qcom/smb5-lib.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2022 The Linux Foundation. All rights reserved.
*/
#include
@@ -8047,6 +8047,9 @@ static void smblib_lpd_ra_open_work(struct work_struct *work)
if (!(stat & TYPEC_WATER_DETECTION_STATUS_BIT)
|| (stat & TYPEC_TCCDEBOUNCE_DONE_STATUS_BIT)) {
chg->lpd_stage = LPD_STAGE_NONE;
+
+ /* Remove LPD_VOTER from ICL is moisture status is gone in attached state. */
+ vote(chg->usb_icl_votable, LPD_VOTER, false, 0);
goto out;
}
diff --git a/drivers/soc/qcom/icnss2/main.c b/drivers/soc/qcom/icnss2/main.c
index dc873a24e54f..462d4bb807d7 100644
--- a/drivers/soc/qcom/icnss2/main.c
+++ b/drivers/soc/qcom/icnss2/main.c
@@ -400,6 +400,17 @@ bool icnss_is_fw_down(void)
}
EXPORT_SYMBOL(icnss_is_fw_down);
+unsigned long icnss_get_device_config(void)
+{
+ struct icnss_priv *priv = icnss_get_plat_priv();
+
+ if (!priv)
+ return 0;
+
+ return priv->device_config;
+}
+EXPORT_SYMBOL(icnss_get_device_config);
+
bool icnss_is_rejuvenate(void)
{
if (!penv)
@@ -3905,6 +3916,14 @@ static void icnss_init_control_params(struct icnss_priv *priv)
}
}
+static void icnss_read_device_configs(struct icnss_priv *priv)
+{
+ if (of_property_read_bool(priv->pdev->dev.of_node,
+ "wlan-ipa-disabled")) {
+ set_bit(ICNSS_IPA_DISABLED, &priv->device_config);
+ }
+}
+
static inline void icnss_get_smp2p_info(struct icnss_priv *priv)
{
@@ -4007,6 +4026,8 @@ static int icnss_probe(struct platform_device *pdev)
icnss_init_control_params(priv);
+ icnss_read_device_configs(priv);
+
ret = icnss_resource_parse(priv);
if (ret)
goto out_reset_drvdata;
diff --git a/drivers/soc/qcom/icnss2/main.h b/drivers/soc/qcom/icnss2/main.h
index b75767a07af0..8ff61897b8a9 100644
--- a/drivers/soc/qcom/icnss2/main.h
+++ b/drivers/soc/qcom/icnss2/main.h
@@ -465,6 +465,7 @@ struct icnss_priv {
struct icnss_dms_data dms;
u8 use_nv_mac;
u32 wlan_en_delay_ms;
+ unsigned long device_config;
};
struct icnss_reg_info {
diff --git a/drivers/soc/qcom/spcom.c b/drivers/soc/qcom/spcom.c
index 1016843ca039..a966ba98c30a 100644
--- a/drivers/soc/qcom/spcom.c
+++ b/drivers/soc/qcom/spcom.c
@@ -621,7 +621,6 @@ static int spcom_handle_create_channel_command(void *cmd_buf, int cmd_size)
{
int ret = 0;
struct spcom_user_create_channel_command *cmd = cmd_buf;
- const size_t maxlen = sizeof(cmd->ch_name);
if (cmd_size != sizeof(*cmd)) {
spcom_pr_err("cmd_size [%d] , expected [%d]\n",
@@ -629,11 +628,6 @@ static int spcom_handle_create_channel_command(void *cmd_buf, int cmd_size)
return -EINVAL;
}
- if (strnlen(cmd->ch_name, maxlen) == maxlen) {
- spcom_pr_err("channel name is not NULL terminated\n");
- return -EINVAL;
- }
-
mutex_lock(&spcom_dev->chdev_count_lock);
ret = spcom_create_channel_chardev(cmd->ch_name, cmd->is_sharable);
mutex_unlock(&spcom_dev->chdev_count_lock);
@@ -2003,6 +1997,12 @@ static int spcom_create_channel_chardev(const char *name, bool is_sharable)
void *priv;
struct cdev *cdev;
+ if (!name || strnlen(name, SPCOM_CHANNEL_NAME_SIZE) ==
+ SPCOM_CHANNEL_NAME_SIZE) {
+ spcom_pr_err("invalid channel name\n");
+ return -EINVAL;
+ }
+
spcom_pr_dbg("creating channel [%s]\n", name);
ch = spcom_find_channel_by_name(name);
@@ -2037,7 +2037,12 @@ static int spcom_create_channel_chardev(const char *name, bool is_sharable)
devt = spcom_dev->device_no + spcom_dev->chdev_count;
priv = ch;
- dev = device_create(cls, parent, devt, priv, name);
+
+ /*
+ * Pass channel name as formatted string to avoid abuse by using a
+ * formatted string as channel name
+ */
+ dev = device_create(cls, parent, devt, priv, "%s", name);
if (IS_ERR(dev)) {
spcom_pr_err("device_create failed\n");
ret = -ENODEV;
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index d6491e973fa4..0d5ae8053049 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -1,26 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (c) 2015-2016, Linaro Limited
+ * Copyright (c) 2015-2017, 2019-2021 Linaro Limited
*/
+#include
#include
-#include
-#include
#include
+#include
#include
#include
#include
#include "tee_private.h"
-static void tee_shm_release(struct tee_shm *shm)
+static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
{
- struct tee_device *teedev = shm->teedev;
-
- mutex_lock(&teedev->mutex);
- idr_remove(&teedev->idr, shm->id);
- if (shm->ctx)
- list_del(&shm->link);
- mutex_unlock(&teedev->mutex);
-
if (shm->flags & TEE_SHM_POOL) {
struct tee_shm_pool_mgr *poolm;
@@ -52,51 +44,6 @@ static void tee_shm_release(struct tee_shm *shm)
tee_device_put(teedev);
}
-static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment
- *attach, enum dma_data_direction dir)
-{
- return NULL;
-}
-
-static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach,
- struct sg_table *table,
- enum dma_data_direction dir)
-{
-}
-
-static void tee_shm_op_release(struct dma_buf *dmabuf)
-{
- struct tee_shm *shm = dmabuf->priv;
-
- tee_shm_release(shm);
-}
-
-static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum)
-{
- return NULL;
-}
-
-static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
-{
- struct tee_shm *shm = dmabuf->priv;
- size_t size = vma->vm_end - vma->vm_start;
-
- /* Refuse sharing shared memory provided by application */
- if (shm->flags & TEE_SHM_REGISTER)
- return -EINVAL;
-
- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
- size, vma->vm_page_prot);
-}
-
-static const struct dma_buf_ops tee_shm_dma_buf_ops = {
- .map_dma_buf = tee_shm_op_map_dma_buf,
- .unmap_dma_buf = tee_shm_op_unmap_dma_buf,
- .release = tee_shm_op_release,
- .map = tee_shm_op_map,
- .mmap = tee_shm_op_mmap,
-};
-
static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
struct tee_device *teedev,
size_t size, u32 flags)
@@ -137,6 +84,7 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
goto err_dev_put;
}
+ refcount_set(&shm->refcount, 1);
shm->flags = flags | TEE_SHM_POOL;
shm->teedev = teedev;
shm->ctx = ctx;
@@ -159,21 +107,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
goto err_pool_free;
}
- if (flags & TEE_SHM_DMA_BUF) {
- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
-
- exp_info.ops = &tee_shm_dma_buf_ops;
- exp_info.size = shm->size;
- exp_info.flags = O_RDWR;
- exp_info.priv = shm;
-
- shm->dmabuf = dma_buf_export(&exp_info);
- if (IS_ERR(shm->dmabuf)) {
- ret = ERR_CAST(shm->dmabuf);
- goto err_rem;
- }
- }
-
if (ctx) {
teedev_ctx_get(ctx);
mutex_lock(&teedev->mutex);
@@ -182,10 +115,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
}
return shm;
-err_rem:
- mutex_lock(&teedev->mutex);
- idr_remove(&teedev->idr, shm->id);
- mutex_unlock(&teedev->mutex);
err_pool_free:
poolm->ops->free(poolm, shm);
err_kfree:
@@ -268,6 +197,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
goto err;
}
+ refcount_set(&shm->refcount, 1);
shm->flags = flags | TEE_SHM_REGISTER;
shm->teedev = teedev;
shm->ctx = ctx;
@@ -309,22 +239,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
goto err;
}
- if (flags & TEE_SHM_DMA_BUF) {
- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
-
- exp_info.ops = &tee_shm_dma_buf_ops;
- exp_info.size = shm->size;
- exp_info.flags = O_RDWR;
- exp_info.priv = shm;
-
- shm->dmabuf = dma_buf_export(&exp_info);
- if (IS_ERR(shm->dmabuf)) {
- ret = ERR_CAST(shm->dmabuf);
- teedev->desc->ops->shm_unregister(ctx, shm);
- goto err;
- }
- }
-
mutex_lock(&teedev->mutex);
list_add_tail(&shm->link, &ctx->list_shm);
mutex_unlock(&teedev->mutex);
@@ -352,6 +266,35 @@ err:
}
EXPORT_SYMBOL_GPL(tee_shm_register);
+static int tee_shm_fop_release(struct inode *inode, struct file *filp)
+{
+ tee_shm_put(filp->private_data);
+ return 0;
+}
+
+static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+ struct tee_shm *shm = filp->private_data;
+ size_t size = vma->vm_end - vma->vm_start;
+
+ /* Refuse sharing shared memory provided by application */
+ if (shm->flags & TEE_SHM_USER_MAPPED)
+ return -EINVAL;
+
+ /* check for overflowing the buffer's size */
+ if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
+ return -EINVAL;
+
+ return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
+ size, vma->vm_page_prot);
+}
+
+static const struct file_operations tee_shm_fops = {
+ .owner = THIS_MODULE,
+ .release = tee_shm_fop_release,
+ .mmap = tee_shm_fop_mmap,
+};
+
/**
* tee_shm_get_fd() - Increase reference count and return file descriptor
* @shm: Shared memory handle
@@ -364,10 +307,11 @@ int tee_shm_get_fd(struct tee_shm *shm)
if (!(shm->flags & TEE_SHM_DMA_BUF))
return -EINVAL;
- get_dma_buf(shm->dmabuf);
- fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC);
+ /* matched by tee_shm_put() in tee_shm_op_release() */
+ refcount_inc(&shm->refcount);
+ fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR);
if (fd < 0)
- dma_buf_put(shm->dmabuf);
+ tee_shm_put(shm);
return fd;
}
@@ -377,17 +321,7 @@ int tee_shm_get_fd(struct tee_shm *shm)
*/
void tee_shm_free(struct tee_shm *shm)
{
- /*
- * dma_buf_put() decreases the dmabuf reference counter and will
- * call tee_shm_release() when the last reference is gone.
- *
- * In the case of driver private memory we call tee_shm_release
- * directly instead as it doesn't have a reference counter.
- */
- if (shm->flags & TEE_SHM_DMA_BUF)
- dma_buf_put(shm->dmabuf);
- else
- tee_shm_release(shm);
+ tee_shm_put(shm);
}
EXPORT_SYMBOL_GPL(tee_shm_free);
@@ -494,10 +428,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id)
teedev = ctx->teedev;
mutex_lock(&teedev->mutex);
shm = idr_find(&teedev->idr, id);
+ /*
+ * If the tee_shm was found in the IDR it must have a refcount
+ * larger than 0 due to the guarantee in tee_shm_put() below. So
+ * it's safe to use refcount_inc().
+ */
if (!shm || shm->ctx != ctx)
shm = ERR_PTR(-EINVAL);
- else if (shm->flags & TEE_SHM_DMA_BUF)
- get_dma_buf(shm->dmabuf);
+ else
+ refcount_inc(&shm->refcount);
mutex_unlock(&teedev->mutex);
return shm;
}
@@ -509,7 +448,25 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id);
*/
void tee_shm_put(struct tee_shm *shm)
{
- if (shm->flags & TEE_SHM_DMA_BUF)
- dma_buf_put(shm->dmabuf);
+ struct tee_device *teedev = shm->teedev;
+ bool do_release = false;
+
+ mutex_lock(&teedev->mutex);
+ if (refcount_dec_and_test(&shm->refcount)) {
+ /*
+ * refcount has reached 0, we must now remove it from the
+ * IDR before releasing the mutex. This will guarantee that
+ * the refcount_inc() in tee_shm_get_from_id() never starts
+ * from 0.
+ */
+ idr_remove(&teedev->idr, shm->id);
+ if (shm->ctx)
+ list_del(&shm->link);
+ do_release = true;
+ }
+ mutex_unlock(&teedev->mutex);
+
+ if (do_release)
+ tee_shm_release(teedev, shm);
}
EXPORT_SYMBOL_GPL(tee_shm_put);
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 3e4738bbe488..1d063c35b5fe 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1157,11 +1157,27 @@ int dwc3_core_init(struct dwc3 *dwc)
dwc3_writel(dwc->regs, DWC31_LCSR_TX_DEEMPH_3(0),
dwc->gen2_tx_de_emph3 & DWC31_TX_DEEMPH_MASK);
- /* set inter-packet gap 199.794ns to improve EL_23 margin */
+ /*
+ * Set inter-packet gap 199.794ns to improve EL_23 margin.
+ *
+ * STAR 9001346572: Host: When a Single USB 2.0 Endpoint Receives NAKs Continuously, Host
+ * Stops Transfers to Other Endpoints. When an active endpoint that is not currently cached
+ * in the host controller is chosen to be cached to the same cache index as the endpoint
+ * that receives NAK, The endpoint that receives the NAK responses would be in continuous
+ * retry mode that would prevent it from getting evicted out of the host controller cache.
+ * This would prevent the new endpoint to get into the endpoint cache and therefore service
+ * to this endpoint is not done.
+ * The workaround is to disable lower layer LSP retrying the USB2.0 NAKed transfer. Forcing
+ * this to LSP upper layer allows next EP to evict the stuck EP from cache.
+ */
if (dwc->revision >= DWC3_USB31_REVISION_170A) {
reg = dwc3_readl(dwc->regs, DWC3_GUCTL1);
reg |= DWC3_GUCTL1_IP_GAP_ADD_ON(1);
dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
+
+ reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+ reg |= DWC3_GUCTL3_USB20_RETRY_DISABLE;
+ dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
}
return 0;
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 3bd15568f1ab..a796ed1bbe91 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -413,6 +413,7 @@
#define DWC3_GUCTL2_RST_ACTBITLATER BIT(14)
/* Global User Control Register 3 */
+#define DWC3_GUCTL3_USB20_RETRY_DISABLE BIT(16)
#define DWC3_GUCTL3_SPLITDISABLE BIT(14)
/* Device Configuration Register */
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index fdfb46424a39..d947f2a848cb 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2004,6 +2004,9 @@ unknown:
if (w_index != 0x5 || (w_value >> 8))
break;
interface = w_value & 0xFF;
+ if (interface >= MAX_CONFIG_INTERFACES ||
+ !os_desc_cfg->interface[interface])
+ break;
buf[6] = w_index;
count = count_ext_prop(os_desc_cfg,
interface);
diff --git a/drivers/usb/gadget/function/f_accessory.c b/drivers/usb/gadget/function/f_accessory.c
index 2d2ebbb41a38..de873380f7d1 100644
--- a/drivers/usb/gadget/function/f_accessory.c
+++ b/drivers/usb/gadget/function/f_accessory.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Gadget Function Driver for Android USB accessories
*
@@ -142,12 +143,62 @@ static struct usb_interface_descriptor acc_interface_desc = {
.bInterfaceProtocol = 0,
};
+static struct usb_endpoint_descriptor acc_superspeedplus_in_desc = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = cpu_to_le16(1024),
+};
+
+static struct usb_endpoint_descriptor acc_superspeedplus_out_desc = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = cpu_to_le16(1024),
+};
+
+static struct usb_ss_ep_comp_descriptor acc_superspeedplus_comp_desc = {
+ .bLength = sizeof(acc_superspeedplus_comp_desc),
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
+
+ /* the following 2 values can be tweaked if necessary */
+ /* .bMaxBurst = 0, */
+ /* .bmAttributes = 0, */
+};
+
+static struct usb_endpoint_descriptor acc_superspeed_in_desc = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = cpu_to_le16(1024),
+};
+
+static struct usb_endpoint_descriptor acc_superspeed_out_desc = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = cpu_to_le16(1024),
+};
+
+static struct usb_ss_ep_comp_descriptor acc_superspeed_comp_desc = {
+ .bLength = sizeof(acc_superspeed_comp_desc),
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
+
+ /* the following 2 values can be tweaked if necessary */
+ /* .bMaxBurst = 0, */
+ /* .bmAttributes = 0, */
+};
+
static struct usb_endpoint_descriptor acc_highspeed_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
- .wMaxPacketSize = __constant_cpu_to_le16(512),
+ .wMaxPacketSize = cpu_to_le16(512),
};
static struct usb_endpoint_descriptor acc_highspeed_out_desc = {
@@ -155,7 +206,7 @@ static struct usb_endpoint_descriptor acc_highspeed_out_desc = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
- .wMaxPacketSize = __constant_cpu_to_le16(512),
+ .wMaxPacketSize = cpu_to_le16(512),
};
static struct usb_endpoint_descriptor acc_fullspeed_in_desc = {
@@ -186,6 +237,24 @@ static struct usb_descriptor_header *hs_acc_descs[] = {
NULL,
};
+static struct usb_descriptor_header *ss_acc_descs[] = {
+ (struct usb_descriptor_header *) &acc_interface_desc,
+ (struct usb_descriptor_header *) &acc_superspeed_in_desc,
+ (struct usb_descriptor_header *) &acc_superspeed_comp_desc,
+ (struct usb_descriptor_header *) &acc_superspeed_out_desc,
+ (struct usb_descriptor_header *) &acc_superspeed_comp_desc,
+ NULL,
+};
+
+static struct usb_descriptor_header *ssp_acc_descs[] = {
+ (struct usb_descriptor_header *) &acc_interface_desc,
+ (struct usb_descriptor_header *) &acc_superspeedplus_in_desc,
+ (struct usb_descriptor_header *) &acc_superspeedplus_comp_desc,
+ (struct usb_descriptor_header *) &acc_superspeedplus_out_desc,
+ (struct usb_descriptor_header *) &acc_superspeedplus_comp_desc,
+ NULL,
+};
+
static struct usb_string acc_string_defs[] = {
[INTERFACE_STRING_INDEX].s = "Android Accessory Interface",
{ }, /* end of list */
@@ -1047,12 +1116,22 @@ __acc_function_bind(struct usb_configuration *c,
return ret;
/* support high speed hardware */
- if (gadget_is_dualspeed(c->cdev->gadget)) {
- acc_highspeed_in_desc.bEndpointAddress =
- acc_fullspeed_in_desc.bEndpointAddress;
- acc_highspeed_out_desc.bEndpointAddress =
- acc_fullspeed_out_desc.bEndpointAddress;
- }
+ acc_highspeed_in_desc.bEndpointAddress =
+ acc_fullspeed_in_desc.bEndpointAddress;
+ acc_highspeed_out_desc.bEndpointAddress =
+ acc_fullspeed_out_desc.bEndpointAddress;
+
+ /* support super speed hardware */
+ acc_superspeed_in_desc.bEndpointAddress =
+ acc_fullspeed_in_desc.bEndpointAddress;
+ acc_superspeed_out_desc.bEndpointAddress =
+ acc_fullspeed_out_desc.bEndpointAddress;
+
+ /* support super speed plus hardware */
+ acc_superspeedplus_in_desc.bEndpointAddress =
+ acc_fullspeed_in_desc.bEndpointAddress;
+ acc_superspeedplus_out_desc.bEndpointAddress =
+ acc_fullspeed_out_desc.bEndpointAddress;
DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n",
gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
@@ -1435,6 +1514,8 @@ static struct usb_function *acc_alloc(struct usb_function_instance *fi)
dev->function.strings = acc_strings,
dev->function.fs_descriptors = fs_acc_descs;
dev->function.hs_descriptors = hs_acc_descs;
+ dev->function.ss_descriptors = ss_acc_descs;
+ dev->function.ssp_descriptors = ssp_acc_descs;
dev->function.bind = acc_function_bind_configfs;
dev->function.unbind = acc_function_unbind;
dev->function.set_alt = acc_function_set_alt;
diff --git a/drivers/usb/gadget/function/f_cdev.c b/drivers/usb/gadget/function/f_cdev.c
index 9de5f19f3bbf..33d3a37dafd9 100644
--- a/drivers/usb/gadget/function/f_cdev.c
+++ b/drivers/usb/gadget/function/f_cdev.c
@@ -610,11 +610,11 @@ static int usb_cser_func_suspend(struct usb_function *f, u8 options)
if (!port->func_is_suspended) {
usb_cser_suspend(f);
port->func_is_suspended = true;
- } else {
- if (port->func_is_suspended) {
- port->func_is_suspended = false;
- usb_cser_resume(f);
- }
+ }
+ } else {
+ if (port->func_is_suspended) {
+ port->func_is_suspended = false;
+ usb_cser_resume(f);
}
}
return 0;
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 04c142c13075..ab827c1badc5 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -637,14 +637,17 @@ static int rndis_set_response(struct rndis_params *params,
rndis_set_cmplt_type *resp;
rndis_resp_t *r;
+ BufLength = le32_to_cpu(buf->InformationBufferLength);
+ BufOffset = le32_to_cpu(buf->InformationBufferOffset);
+ if ((BufLength > RNDIS_MAX_TOTAL_SIZE) ||
+ (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE))
+ return -EINVAL;
+
r = rndis_add_response(params, sizeof(rndis_set_cmplt_type));
if (!r)
return -ENOMEM;
resp = (rndis_set_cmplt_type *)r->buf;
- BufLength = le32_to_cpu(buf->InformationBufferLength);
- BufOffset = le32_to_cpu(buf->InformationBufferOffset);
-
#ifdef VERBOSE_DEBUG
pr_debug("%s: Length: %d\n", __func__, BufLength);
pr_debug("%s: Offset: %d\n", __func__, BufOffset);
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 6b1c4e1299b5..97c33c16ef5f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2581,6 +2581,11 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+ /* The below cases were checked when setting it. */
+ if (f2fs_is_pinned_file(inode))
+ return false;
+ if (fio && is_sbi_flag_set(sbi, SBI_NEED_FSCK))
+ return true;
if (f2fs_lfs_mode(sbi))
return true;
if (S_ISDIR(inode->i_mode))
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index a6fc4445ccdd..b42b1fa737bd 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3235,17 +3235,17 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
inode_lock(inode);
- if (f2fs_should_update_outplace(inode, NULL)) {
- ret = -EINVAL;
- goto out;
- }
-
if (!pin) {
clear_inode_flag(inode, FI_PIN_FILE);
f2fs_i_gc_failures_write(inode, 0);
goto done;
}
+ if (f2fs_should_update_outplace(inode, NULL)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
if (f2fs_pin_file_control(inode, false)) {
ret = -EAGAIN;
goto out;
diff --git a/fs/incfs/vfs.c b/fs/incfs/vfs.c
index 8d4c4e39fa46..b849568ae9b8 100644
--- a/fs/incfs/vfs.c
+++ b/fs/incfs/vfs.c
@@ -319,6 +319,7 @@ static struct mount_info *get_mount_info(struct super_block *sb)
{
struct mount_info *result = sb->s_fs_info;
+ WARN_ON(!result);
return result;
}
@@ -677,7 +678,7 @@ static int iterate_incfs_dir(struct file *file, struct dir_context *ctx)
struct mount_info *mi = get_mount_info(file_superblock(file));
bool root;
- if (!dir || !mi) {
+ if (!dir) {
error = -EBADF;
goto out;
}
@@ -1841,9 +1842,6 @@ static int dir_rename(struct inode *old_dir, struct dentry *old_dentry,
struct dentry *trap;
int error = 0;
- if (!mi)
- return -EBADF;
-
error = mutex_lock_interruptible(&mi->mi_dir_struct_mutex);
if (error)
return error;
@@ -2091,9 +2089,6 @@ static ssize_t incfs_getxattr(struct dentry *d, const char *name,
char *stored_value;
size_t stored_size;
- if (!mi)
- return -EBADF;
-
if (di && di->backing_path.dentry)
return vfs_getxattr(di->backing_path.dentry, name, value, size);
@@ -2130,9 +2125,6 @@ static ssize_t incfs_setxattr(struct dentry *d, const char *name,
void **stored_value;
size_t *stored_size;
- if (!mi)
- return -EBADF;
-
if (di && di->backing_path.dentry)
return vfs_setxattr(di->backing_path.dentry, name, value, size,
flags);
@@ -2173,11 +2165,6 @@ static ssize_t incfs_listxattr(struct dentry *d, char *list, size_t size)
return vfs_listxattr(di->backing_path.dentry, list, size);
}
-static int incfs_test_super(struct super_block *s, void *p)
-{
- return s->s_fs_info != NULL;
-}
-
struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
const char *dev_name, void *data)
{
@@ -2187,8 +2174,7 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
struct dentry *index_dir;
struct super_block *src_fs_sb = NULL;
struct inode *root_inode = NULL;
- struct super_block *sb = sget(type, incfs_test_super, set_anon_super,
- flags, NULL);
+ struct super_block *sb = sget(type, NULL, set_anon_super, flags, NULL);
int error = 0;
if (IS_ERR(sb))
@@ -2229,18 +2215,13 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
src_fs_sb = backing_dir_path.dentry->d_sb;
sb->s_maxbytes = src_fs_sb->s_maxbytes;
- if (!sb->s_fs_info) {
- mi = incfs_alloc_mount_info(sb, &options, &backing_dir_path);
+ mi = incfs_alloc_mount_info(sb, &options, &backing_dir_path);
- if (IS_ERR_OR_NULL(mi)) {
- error = PTR_ERR(mi);
- pr_err("incfs: Error allocating mount info. %d\n", error);
- mi = NULL;
- goto err;
- }
- sb->s_fs_info = mi;
- } else {
- mi = sb->s_fs_info;
+ if (IS_ERR_OR_NULL(mi)) {
+ error = PTR_ERR(mi);
+ pr_err("incfs: Error allocating mount info. %d\n", error);
+ mi = NULL;
+ goto err;
}
index_dir = open_or_create_index_dir(backing_dir_path.dentry);
@@ -2252,22 +2233,21 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
}
mi->mi_index_dir = index_dir;
+ sb->s_fs_info = mi;
root_inode = fetch_regular_inode(sb, backing_dir_path.dentry);
if (IS_ERR(root_inode)) {
error = PTR_ERR(root_inode);
goto err;
}
+ sb->s_root = d_make_root(root_inode);
if (!sb->s_root) {
- sb->s_root = d_make_root(root_inode);
- if (!sb->s_root) {
- error = -ENOMEM;
- goto err;
- }
- error = incfs_init_dentry(sb->s_root, &backing_dir_path);
- if (error)
- goto err;
+ error = -ENOMEM;
+ goto err;
}
+ error = incfs_init_dentry(sb->s_root, &backing_dir_path);
+ if (error)
+ goto err;
path_put(&backing_dir_path);
sb->s_flags |= SB_ACTIVE;
@@ -2288,9 +2268,6 @@ static int incfs_remount_fs(struct super_block *sb, int *flags, char *data)
struct mount_info *mi = get_mount_info(sb);
int err = 0;
- if (!mi)
- return err;
-
sync_filesystem(sb);
err = parse_options(&options, (char *)data);
if (err)
@@ -2318,9 +2295,6 @@ static int show_options(struct seq_file *m, struct dentry *root)
{
struct mount_info *mi = get_mount_info(root->d_sb);
- if (!mi)
- return -EBADF;
-
seq_printf(m, ",read_timeout_ms=%u", mi->mi_options.read_timeout_ms);
seq_printf(m, ",readahead=%u", mi->mi_options.readahead_pages);
if (mi->mi_options.read_log_pages != 0) {
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index efe078fe5d4a..0caa151cae4e 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -427,8 +427,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
if (unlikely(!inode))
return failed_creating(dentry);
- /* Do not set bits for OTH */
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP;
+ inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = ops;
inode->i_fop = &simple_dir_operations;
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index cd15c1b7fae0..e08ace76eba6 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -178,7 +178,7 @@ void tee_device_unregister(struct tee_device *teedev);
* @offset: offset of buffer in user space
* @pages: locked pages from userspace
* @num_pages: number of locked pages
- * @dmabuf: dmabuf used to for exporting to user space
+ * @refcount: reference counter
* @flags: defined by TEE_SHM_* in tee_drv.h
* @id: unique id of a shared memory object on this device
*
@@ -195,7 +195,7 @@ struct tee_shm {
unsigned int offset;
struct page **pages;
size_t num_pages;
- struct dma_buf *dmabuf;
+ refcount_t refcount;
u32 flags;
int id;
};
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 46e0e38f6003..094aafef7d6d 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1543,7 +1543,6 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
int xfrm_init_replay(struct xfrm_state *x);
-u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu);
u32 xfrm_state_mtu(struct xfrm_state *x, int mtu);
int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload);
int xfrm_init_state(struct xfrm_state *x);
diff --git a/include/soc/qcom/icnss2.h b/include/soc/qcom/icnss2.h
index cca3a95be74a..19510f022e12 100644
--- a/include/soc/qcom/icnss2.h
+++ b/include/soc/qcom/icnss2.h
@@ -23,6 +23,10 @@ enum icnss_uevent {
ICNSS_UEVENT_SMMU_FAULT,
};
+enum icnss_device_config {
+ ICNSS_IPA_DISABLED,
+};
+
struct icnss_uevent_hang_data {
void *hang_event_data;
uint16_t hang_event_data_len;
@@ -196,4 +200,5 @@ extern int icnss_prevent_l1(struct device *dev);
extern void icnss_allow_l1(struct device *dev);
extern int icnss_get_mhi_state(struct device *dev);
extern int icnss_is_pci_ep_awake(struct device *dev);
+extern unsigned long icnss_get_device_config(void);
#endif /* _ICNSS_WLAN_H_ */
diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h
index 8e04fd625b97..cef39e28803a 100644
--- a/include/uapi/linux/msm_ipa.h
+++ b/include/uapi/linux/msm_ipa.h
@@ -1005,8 +1005,9 @@ enum ipa_hw_type {
IPA_HW_v4_11 = 20,
IPA_HW_v5_0 = 21,
IPA_HW_v5_1 = 22,
+ IPA_HW_v5_2 = 23,
};
-#define IPA_HW_MAX (IPA_HW_v5_1 + 1)
+#define IPA_HW_MAX (IPA_HW_v5_2 + 1)
#define IPA_HW_v4_0 IPA_HW_v4_0
#define IPA_HW_v4_1 IPA_HW_v4_1
@@ -1017,6 +1018,7 @@ enum ipa_hw_type {
#define IPA_HW_v4_11 IPA_HW_v4_11
#define IPA_HW_v5_0 IPA_HW_v5_0
#define IPA_HW_v5_1 IPA_HW_v5_1
+#define IPA_HW_v5_2 IPA_HW_v5_2
/**
* enum ipa_hw_feature_support - IPA HW supported feature
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 6684696fa457..4b2819b0a05a 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -94,7 +94,7 @@ static struct hlist_head *dev_map_create_hash(unsigned int entries,
int i;
struct hlist_head *hash;
- hash = bpf_map_area_alloc(entries * sizeof(*hash), numa_node);
+ hash = bpf_map_area_alloc((u64) entries * sizeof(*hash), numa_node);
if (hash != NULL)
for (i = 0; i < entries; i++)
INIT_HLIST_HEAD(&hash[i]);
@@ -159,7 +159,7 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr)
spin_lock_init(&dtab->index_lock);
} else {
- dtab->netdev_map = bpf_map_area_alloc(dtab->map.max_entries *
+ dtab->netdev_map = bpf_map_area_alloc((u64) dtab->map.max_entries *
sizeof(struct bpf_dtab_netdev *),
dtab->map.numa_node);
if (!dtab->netdev_map)
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index b513f70b0cc0..17bf2db821c6 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -552,6 +552,14 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of,
BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
+ /*
+ * Release agent gets called with all capabilities,
+ * require capabilities to set release agent.
+ */
+ if ((of->file->f_cred->user_ns != &init_user_ns) ||
+ !capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
cgrp = cgroup_kn_lock_live(of->kn, false);
if (!cgrp)
return -ENODEV;
@@ -964,6 +972,12 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param)
/* Specifying two release agents is forbidden */
if (ctx->release_agent)
return cg_invalf(fc, "cgroup1: release_agent respecified");
+ /*
+ * Release agent gets called with all capabilities,
+ * require capabilities to set release agent.
+ */
+ if ((fc->user_ns != &init_user_ns) || !capable(CAP_SYS_ADMIN))
+ return cg_invalf(fc, "cgroup1: Setting release_agent not allowed");
ctx->release_agent = param->string;
param->string = NULL;
break;
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 957e3e58df65..9d3bda3d49fe 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -398,6 +398,7 @@ static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t by
return 0;
pipe->nrbufs++;
buf->ops = &page_cache_pipe_buf_ops;
+ buf->flags = 0;
get_page(buf->page = page);
buf->offset = offset;
buf->len = bytes;
@@ -524,6 +525,7 @@ static size_t push_pipe(struct iov_iter *i, size_t size,
break;
pipe->nrbufs++;
pipe->bufs[idx].ops = &default_pipe_buf_ops;
+ pipe->bufs[idx].flags = 0;
pipe->bufs[idx].page = page;
pipe->bufs[idx].offset = 0;
if (left <= PAGE_SIZE) {
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index df52061f99f7..2646e8f98f67 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -48,7 +48,7 @@ static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
if (err)
goto free_stab;
- stab->sks = bpf_map_area_alloc(stab->map.max_entries *
+ stab->sks = bpf_map_area_alloc((u64) stab->map.max_entries *
sizeof(struct sock *),
stab->map.numa_node);
if (stab->sks)
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 86c836fa2145..00210e55b4cd 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -499,7 +499,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb);
u32 padto;
- padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached));
+ padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached));
if (skb->len < padto)
esp.tfclen = padto - skb->len;
}
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 12570a73def8..7a739f16d82b 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -440,7 +440,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb);
u32 padto;
- padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached));
+ padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached));
if (skb->len < padto)
esp.tfclen = padto - skb->len;
}
diff --git a/net/tipc/link.c b/net/tipc/link.c
index f25010261a9e..8f2ee71c63c6 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1953,15 +1953,18 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
u16 peers_tol = msg_link_tolerance(hdr);
u16 peers_prio = msg_linkprio(hdr);
u16 rcv_nxt = l->rcv_nxt;
- u16 dlen = msg_data_sz(hdr);
+ u32 dlen = msg_data_sz(hdr), glen = 0;
int mtyp = msg_type(hdr);
bool reply = msg_probe(hdr);
- u16 glen = 0;
void *data;
char *if_name;
int rc = 0;
trace_tipc_proto_rcv(skb, false, l->name);
+
+ if (dlen > U16_MAX)
+ goto exit;
+
if (tipc_link_is_blocked(l) || !xmitq)
goto exit;
@@ -2063,7 +2066,8 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
if (glen != tipc_gap_ack_blks_sz(ga->gack_cnt))
ga = NULL;
}
-
+ if(glen > dlen)
+ break;
tipc_mon_rcv(l->net, data + glen, dlen - glen, l->addr,
&l->mon_state, l->bearer_id);
diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index 58708b4c7719..e7155a774300 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -457,6 +457,8 @@ void tipc_mon_rcv(struct net *net, void *data, u16 dlen, u32 addr,
state->probing = false;
/* Sanity check received domain record */
+ if (new_member_cnt > MAX_MON_DOMAIN)
+ return;
if (dlen < dom_rec_len(arrv_dom, 0))
return;
if (dlen != dom_rec_len(arrv_dom, new_member_cnt))
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index ea46d894063e..8bb052bb137e 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2517,7 +2517,7 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x)
}
EXPORT_SYMBOL(xfrm_state_delete_tunnel);
-u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu)
+u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)
{
const struct xfrm_type *type = READ_ONCE(x->type);
struct crypto_aead *aead;
@@ -2548,17 +2548,7 @@ u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu)
return ((mtu - x->props.header_len - crypto_aead_authsize(aead) -
net_adj) & ~(blksize - 1)) + net_adj - 2;
}
-EXPORT_SYMBOL_GPL(__xfrm_state_mtu);
-
-u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)
-{
- mtu = __xfrm_state_mtu(x, mtu);
-
- if (x->props.family == AF_INET6 && mtu < IPV6_MIN_MTU)
- return IPV6_MIN_MTU;
-
- return mtu;
-}
+EXPORT_SYMBOL_GPL(xfrm_state_mtu);
int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload)
{