Compare commits
250 Commits
Author | SHA1 | Date |
---|---|---|
Jeremy Cline | 77b4be52ad | |
Jeremy Cline | 27cfcafb2f | |
Jeremy Cline | 8beabd1392 | |
Justin M. Forbes | fd35fe59bf | |
Jeremy Cline | f2b2c6d600 | |
Hans de Goede | 518d5bb753 | |
Justin M. Forbes | ca0e9ac5f4 | |
Jeremy Cline | cf7cc62d07 | |
Jeremy Cline | ba1ab78151 | |
Jeremy Cline | ce4ce5d093 | |
Jeremy Cline | 636a4cdbbc | |
Jeremy Cline | 14db0a600c | |
Jeremy Cline | d8e8a0a8ab | |
Jeremy Cline | 7db14a4837 | |
Peter Robinson | 77966bf896 | |
Peter Robinson | 98a3d289ad | |
Peter Robinson | e4553886cb | |
Hendrik Brueckner | f3915030d5 | |
Laura Abbott | e697eedd30 | |
Justin M. Forbes | 813051e405 | |
Jeremy Cline | 127e4b3348 | |
Jeremy Cline | 4cb1c26d72 | |
Jeremy Cline | 9be75b8abe | |
Jeremy Cline | 10390db15b | |
Jeremy Cline | 1558cb281e | |
Jeremy Cline | 8b94128329 | |
Peter Robinson | 8a80a030dc | |
Jeremy Cline | 50cf052e0a | |
Jeremy Cline | b03622d9f2 | |
Justin M. Forbes | 8838225a6f | |
Laura Abbott | 5666c27e64 | |
Justin M. Forbes | 7867cdd943 | |
Laura Abbott | d5b6319851 | |
Jeremy Cline | 018b8e4a87 | |
Laura Abbott | 3710ee3b42 | |
Laura Abbott | 308f00978c | |
Jeremy Cline | 4094ee6db0 | |
Laura Abbott | 9a6529fd7c | |
Laura Abbott | 3a5c5f63ee | |
Laura Abbott | 40f9e55244 | |
Jeremy Cline | 6f85ee7075 | |
Laura Abbott | 7b899a696a | |
Laura Abbott | 4fea2c0242 | |
Laura Abbott | 830e8957dd | |
Justin M. Forbes | 6daca93125 | |
Laura Abbott | a66a3dcb97 | |
Laura Abbott | 213cf1056b | |
Justin M. Forbes | 2770e4161e | |
Laura Abbott | 986e2bf640 | |
Justin M. Forbes | e9c6acc15d | |
Laura Abbott | 1045178022 | |
Justin M. Forbes | bcb90a9168 | |
Justin M. Forbes | 0e73a86b91 | |
Laura Abbott | beca8c749b | |
Laura Abbott | c895e3e2a6 | |
Peter Robinson | 56929c445d | |
Laura Abbott | 9cf2060cf4 | |
Laura Abbott | 2fdf7a70ca | |
Laura Abbott | e312b54c27 | |
Justin M. Forbes | 504a8b71fb | |
Laura Abbott | 6072571208 | |
Laura Abbott | 99240edf74 | |
Justin M. Forbes | 6c23658af4 | |
Justin M. Forbes | 6fdd3afab7 | |
Justin M. Forbes | 34149598a0 | |
Justin M. Forbes | 65381b0451 | |
Justin M. Forbes | 232f01096a | |
Laura Abbott | 1b900de110 | |
Justin M. Forbes | 51134825ce | |
Justin M. Forbes | 8193bc4081 | |
Justin M. Forbes | 81c5cae063 | |
Laura Abbott | 81a9ddcc39 | |
Justin M. Forbes | cc95f96a35 | |
Justin M. Forbes | 08916b3e71 | |
Justin M. Forbes | 0aa04bc129 | |
Jeremy Cline | d667ebc96e | |
Jeremy Cline | 2a754e66fc | |
Peter Jones | 72428d1181 | |
Justin M. Forbes | c8bb01fd16 | |
Justin M. Forbes | 058327179c | |
Justin M. Forbes | d5330eddf9 | |
Peter Jones | ef89896add | |
Laura Abbott | 2c4dd31721 | |
Laura Abbott | 27985889f4 | |
Justin M. Forbes | d99469ccaf | |
Justin M. Forbes | 87e3972ebc | |
Justin M. Forbes | e4f9feb252 | |
Laura Abbott | 1d54a7154e | |
Justin M. Forbes | bf69959d65 | |
Justin M. Forbes | 1034158e62 | |
Jeremy Cline | 9f4545c739 | |
Justin M. Forbes | b29ed2a214 | |
Justin M. Forbes | 36391cd9f7 | |
Justin M. Forbes | 140ae2611b | |
Jeremy Cline | 12b5c8b2dd | |
Jeremy Cline | cf4237c095 | |
Jeremy Cline | 9036f48254 | |
Jeremy Cline | 87c50127e5 | |
Jeremy Cline | 037a83ae59 | |
Jeremy Cline | 4b3da64509 | |
Jeremy Cline | ec92e419c1 | |
Jeremy Cline | 9457eae4a0 | |
Jeremy Cline | c75cb4d7fb | |
Jeremy Cline | 9edb1b5f46 | |
Jeremy Cline | 9d76398e4c | |
Jeremy Cline | c3d299955c | |
Jeremy Cline | b79b0786b5 | |
Justin M. Forbes | 1cf74e2eb3 | |
Jeremy Cline | 86e75d4e1d | |
Laura Abbott | b529933894 | |
Jeremy Cline | bc798b5499 | |
Jeremy Cline | 5bd783b4f1 | |
Peter Robinson | fe6b94d468 | |
Jeremy Cline | 8a38849fd5 | |
Justin M. Forbes | 23f3bf12e4 | |
Laura Abbott | 2db7ed1700 | |
Laura Abbott | aebca61f61 | |
Peter Robinson | 2608bff05a | |
Jeremy Cline | 2874a5a7c6 | |
Laura Abbott | 2dc72b4c2b | |
Jeremy Cline | 0b2f464984 | |
Laura Abbott | d1f0bd4027 | |
Justin M. Forbes | 801d19161f | |
Justin M. Forbes | ec3df71072 | |
Laura Abbott | 8a85282a3e | |
Laura Abbott | ab11b77a1c | |
Justin M. Forbes | 3118e0a1c8 | |
Justin M. Forbes | a8b36f84c0 | |
Justin M. Forbes | a555e19e17 | |
Justin M. Forbes | 0f7dd25184 | |
Peter Robinson | 4dcf8ed48b | |
Peter Robinson | a89c694dae | |
Peter Robinson | 76c2ad6c53 | |
Peter Robinson | bfb8931567 | |
Jeremy Cline | 559e9d75b4 | |
Jeremy Cline | 2e4987d5de | |
Justin M. Forbes | 5103366c43 | |
Peter Robinson | 8d3daaedfb | |
Justin M. Forbes | cbcfcbeb75 | |
Laura Abbott | 05aec14be1 | |
Laura Abbott | 93c78cc6c3 | |
Laura Abbott | d1e360d978 | |
Laura Abbott | 7f47d72242 | |
Peter Robinson | 89fc77b9f1 | |
Laura Abbott | 41248f94be | |
Laura Abbott | f5dae5ae2c | |
Justin M. Forbes | 83203f5209 | |
Justin M. Forbes | c820b80a60 | |
Justin M. Forbes | 0ea486fcad | |
Justin M. Forbes | 1aa23033fb | |
Justin M. Forbes | 0cb1905143 | |
Justin M. Forbes | a900c89274 | |
Justin M. Forbes | dc02f0a06e | |
Justin M. Forbes | 5457b85556 | |
Justin M. Forbes | 2ef60f262b | |
Justin M. Forbes | b842984e58 | |
Justin M. Forbes | 9ee85faed7 | |
Laura Abbott | 8072782f6b | |
Justin M. Forbes | 6824746386 | |
Laura Abbott | b814ce76f1 | |
Justin M. Forbes | b5bd296f44 | |
Justin M. Forbes | 01bdf6af77 | |
Justin M. Forbes | 4ad810e16c | |
Justin M. Forbes | a17cbdc004 | |
Dan Horák | 2511dad196 | |
Josh Boyer | 62b80a4038 | |
Justin M. Forbes | fe7dbebdc9 | |
Justin M. Forbes | 8d07ed2f94 | |
Laura Abbott | 13226bf184 | |
Justin M. Forbes | c0af8b92a4 | |
Justin M. Forbes | 9219d489ea | |
Justin M. Forbes | 91612fa839 | |
Justin M. Forbes | 3731d1998b | |
Peter Robinson | 359584d0b2 | |
Justin M. Forbes | 3ff7c261fb | |
Laura Abbott | 884e6796eb | |
Peter Robinson | 48844fd6b6 | |
Laura Abbott | 98256c97e2 | |
Peter Robinson | 8170661ca5 | |
Laura Abbott | 138d22d1eb | |
Justin M. Forbes | d04a86fb89 | |
Laura Abbott | 64f33c4317 | |
Laura Abbott | 0e0274ef2a | |
Laura Abbott | dafc5e7283 | |
Laura Abbott | d882602b3c | |
Peter Robinson | 8eec00e5b0 | |
Peter Robinson | 95b2186ebe | |
Peter Robinson | a68ff15c18 | |
Peter Robinson | 18dd17cef8 | |
Peter Robinson | 7b272f5f61 | |
Laura Abbott | ad8ff58ce8 | |
Peter Robinson | bb6904669c | |
Laura Abbott | f812443471 | |
Laura Abbott | ba3922d446 | |
Laura Abbott | 96cfd83feb | |
Laura Abbott | a745d26757 | |
Laura Abbott | b1d734dbb2 | |
Peter Robinson | eba478c4ed | |
Laura Abbott | 11323bafe4 | |
Laura Abbott | 327bbdd586 | |
Peter Robinson | 56b3075dd5 | |
Peter Robinson | 61735b7e1f | |
Laura Abbott | 1d0a43b42a | |
Peter Robinson | 1813594755 | |
Peter Robinson | ab0ecf4db3 | |
Laura Abbott | 9fda242458 | |
Laura Abbott | 2c8a78f6f7 | |
Peter Robinson | 6e4187d96a | |
Laura Abbott | 7e2bb11900 | |
Peter Robinson | 52e0b88057 | |
Peter Robinson | 52bf9a1496 | |
Laura Abbott | d324f86298 | |
Laura Abbott | 57409267f0 | |
Laura Abbott | 2424e41c20 | |
Laura Abbott | 2a29cf3d8e | |
Laura Abbott | 75d7722833 | |
Laura Abbott | dd5571e274 | |
Laura Abbott | 8b912ff0a2 | |
Justin M. Forbes | f26079d12a | |
Peter Robinson | 2d87208294 | |
Laura Abbott | 21ab0c2a00 | |
Peter Robinson | 51402ab09f | |
Laura Abbott | 6cfc6d7a4f | |
Peter Robinson | 60af1429f5 | |
Justin M. Forbes | b6f36d8a11 | |
Justin M. Forbes | 54ab91b6a4 | |
Peter Robinson | 08948206d4 | |
Laura Abbott | 08c2a9e70f | |
Laura Abbott | c7cad27274 | |
Laura Abbott | f2ae1bd31e | |
Justin M. Forbes | 96d0ae1b8b | |
Laura Abbott | 1277b8fb18 | |
Laura Abbott | 45b26b00cf | |
Laura Abbott | ef764ba61d | |
Laura Abbott | 0a68615771 | |
Laura Abbott | 68ec0e27db | |
Laura Abbott | bd7a89ecd2 | |
Justin M. Forbes | a4dbe86b01 | |
Laura Abbott | d99a489b14 | |
Laura Abbott | fcf9426e02 | |
Peter Robinson | e4d5f75352 | |
Laura Abbott | 404faa836a | |
Laura Abbott | eb9960f1b9 | |
Laura Abbott | 8add29085b | |
Laura Abbott | d18ad13791 | |
Laura Abbott | 21edfc4e20 | |
Laura Abbott | 23315538c3 | |
Peter Robinson | 29de5f9ac5 | |
Peter Robinson | 0c188d6dbc | |
Laura Abbott | c6ffc2cb48 |
|
@ -3,5 +3,6 @@ clog
|
|||
*.bz2
|
||||
*.rpm
|
||||
*.orig
|
||||
*.sign
|
||||
kernel-[234].*/
|
||||
perf-man-*.tar.gz
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
From 3ce5852ec6add45a28fe1706e9163351940e905c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 2 Oct 2017 18:25:29 -0400
|
||||
Subject: [PATCH 1/3] Make get_cert_list() not complain about cert lists that
|
||||
aren't present.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
certs/load_uefi.c | 37 ++++++++++++++++++++++---------------
|
||||
1 file changed, 22 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/certs/load_uefi.c b/certs/load_uefi.c
|
||||
index 3d884598601..9ef34c44fd1 100644
|
||||
--- a/certs/load_uefi.c
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -35,8 +35,8 @@ static __init bool uefi_check_ignore_db(void)
|
||||
/*
|
||||
* Get a certificate list blob from the named EFI variable.
|
||||
*/
|
||||
-static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
- unsigned long *size)
|
||||
+static __init int get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
+ unsigned long *size, void **cert_list)
|
||||
{
|
||||
efi_status_t status;
|
||||
unsigned long lsize = 4;
|
||||
@@ -44,26 +44,33 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
void *db;
|
||||
|
||||
status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
|
||||
+ if (status == EFI_NOT_FOUND) {
|
||||
+ *size = 0;
|
||||
+ *cert_list = NULL;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
pr_err("Couldn't get size: 0x%lx\n", status);
|
||||
- return NULL;
|
||||
+ return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
db = kmalloc(lsize, GFP_KERNEL);
|
||||
if (!db) {
|
||||
pr_err("Couldn't allocate memory for uefi cert list\n");
|
||||
- return NULL;
|
||||
+ return -ENOMEM;
|
||||
}
|
||||
|
||||
status = efi.get_variable(name, guid, NULL, &lsize, db);
|
||||
if (status != EFI_SUCCESS) {
|
||||
kfree(db);
|
||||
pr_err("Error reading db var: 0x%lx\n", status);
|
||||
- return NULL;
|
||||
+ return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
*size = lsize;
|
||||
- return db;
|
||||
+ *cert_list = db;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -152,10 +159,10 @@ static int __init load_uefi_certs(void)
|
||||
* an error if we can't get them.
|
||||
*/
|
||||
if (!uefi_check_ignore_db()) {
|
||||
- db = get_cert_list(L"db", &secure_var, &dbsize);
|
||||
- if (!db) {
|
||||
+ rc = get_cert_list(L"db", &secure_var, &dbsize, &db);
|
||||
+ if (rc < 0) {
|
||||
pr_err("MODSIGN: Couldn't get UEFI db list\n");
|
||||
- } else {
|
||||
+ } else if (dbsize != 0) {
|
||||
rc = parse_efi_signature_list("UEFI:db",
|
||||
db, dbsize, get_handler_for_db);
|
||||
if (rc)
|
||||
@@ -164,10 +171,10 @@ static int __init load_uefi_certs(void)
|
||||
}
|
||||
}
|
||||
|
||||
- mok = get_cert_list(L"MokListRT", &mok_var, &moksize);
|
||||
- if (!mok) {
|
||||
+ rc = get_cert_list(L"MokListRT", &mok_var, &moksize, &mok);
|
||||
+ if (rc < 0) {
|
||||
pr_info("MODSIGN: Couldn't get UEFI MokListRT\n");
|
||||
- } else {
|
||||
+ } else if (moksize != 0) {
|
||||
rc = parse_efi_signature_list("UEFI:MokListRT",
|
||||
mok, moksize, get_handler_for_db);
|
||||
if (rc)
|
||||
@@ -175,10 +182,10 @@ static int __init load_uefi_certs(void)
|
||||
kfree(mok);
|
||||
}
|
||||
|
||||
- dbx = get_cert_list(L"dbx", &secure_var, &dbxsize);
|
||||
- if (!dbx) {
|
||||
+ rc = get_cert_list(L"dbx", &secure_var, &dbxsize, &dbx);
|
||||
+ if (rc < 0) {
|
||||
pr_info("MODSIGN: Couldn't get UEFI dbx list\n");
|
||||
- } else {
|
||||
+ } else if (dbxsize != 0) {
|
||||
rc = parse_efi_signature_list("UEFI:dbx",
|
||||
dbx, dbxsize,
|
||||
get_handler_for_dbx);
|
||||
--
|
||||
2.15.0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
From b42db0860e13067fcc7cbfba3966c9e652668bbc Mon Sep 17 00:00:00 2001
|
||||
From: Eric Sandeen <sandeen@sandeen.net>
|
||||
Date: Mon, 16 Apr 2018 23:06:53 -0700
|
||||
Subject: [PATCH] xfs: enhance dinode verifier
|
||||
|
||||
Add several more validations to xfs_dinode_verify:
|
||||
|
||||
- For LOCAL data fork formats, di_nextents must be 0.
|
||||
- For LOCAL attr fork formats, di_anextents must be 0.
|
||||
- For inodes with no attr fork offset,
|
||||
- format must be XFS_DINODE_FMT_EXTENTS if set at all
|
||||
- di_anextents must be 0.
|
||||
|
||||
Thanks to dchinner for pointing out a couple related checks I had
|
||||
forgotten to add.
|
||||
|
||||
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
||||
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199377
|
||||
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
---
|
||||
fs/xfs/libxfs/xfs_inode_buf.c | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
index ef68b1de006a..1201107eabc6 100644
|
||||
--- a/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
@@ -466,6 +466,8 @@ xfs_dinode_verify(
|
||||
return __this_address;
|
||||
if (di_size > XFS_DFORK_DSIZE(dip, mp))
|
||||
return __this_address;
|
||||
+ if (dip->di_nextents)
|
||||
+ return __this_address;
|
||||
/* fall through */
|
||||
case XFS_DINODE_FMT_EXTENTS:
|
||||
case XFS_DINODE_FMT_BTREE:
|
||||
@@ -484,12 +486,31 @@ xfs_dinode_verify(
|
||||
if (XFS_DFORK_Q(dip)) {
|
||||
switch (dip->di_aformat) {
|
||||
case XFS_DINODE_FMT_LOCAL:
|
||||
+ if (dip->di_anextents)
|
||||
+ return __this_address;
|
||||
+ /* fall through */
|
||||
case XFS_DINODE_FMT_EXTENTS:
|
||||
case XFS_DINODE_FMT_BTREE:
|
||||
break;
|
||||
default:
|
||||
return __this_address;
|
||||
}
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * If there is no fork offset, this may be a freshly-made inode
|
||||
+ * in a new disk cluster, in which case di_aformat is zeroed.
|
||||
+ * Otherwise, such an inode must be in EXTENTS format; this goes
|
||||
+ * for freed inodes as well.
|
||||
+ */
|
||||
+ switch (dip->di_aformat) {
|
||||
+ case 0:
|
||||
+ case XFS_DINODE_FMT_EXTENTS:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return __this_address;
|
||||
+ }
|
||||
+ if (dip->di_anextents)
|
||||
+ return __this_address;
|
||||
}
|
||||
|
||||
/* only version 3 or greater inodes are extensively verified here */
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 2c4306f719b083d17df2963bc761777576b8ad1b Mon Sep 17 00:00:00 2001
|
||||
From: Eric Sandeen <sandeen@redhat.com>
|
||||
Date: Mon, 16 Apr 2018 23:07:27 -0700
|
||||
Subject: [PATCH] xfs: set format back to extents if xfs_bmap_extents_to_btree
|
||||
|
||||
If xfs_bmap_extents_to_btree fails in a mode where we call
|
||||
xfs_iroot_realloc(-1) to de-allocate the root, set the
|
||||
format back to extents.
|
||||
|
||||
Otherwise we can assume we can dereference ifp->if_broot
|
||||
based on the XFS_DINODE_FMT_BTREE format, and crash.
|
||||
|
||||
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199423
|
||||
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
---
|
||||
fs/xfs/libxfs/xfs_bmap.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
|
||||
index 6a7c2f03ea11..040eeda8426f 100644
|
||||
--- a/fs/xfs/libxfs/xfs_bmap.c
|
||||
+++ b/fs/xfs/libxfs/xfs_bmap.c
|
||||
@@ -725,12 +725,16 @@ xfs_bmap_extents_to_btree(
|
||||
*logflagsp = 0;
|
||||
if ((error = xfs_alloc_vextent(&args))) {
|
||||
xfs_iroot_realloc(ip, -1, whichfork);
|
||||
+ ASSERT(ifp->if_broot == NULL);
|
||||
+ XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
|
||||
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
|
||||
return error;
|
||||
}
|
||||
|
||||
if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
|
||||
xfs_iroot_realloc(ip, -1, whichfork);
|
||||
+ ASSERT(ifp->if_broot == NULL);
|
||||
+ XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
|
||||
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
|
||||
return -ENOSPC;
|
||||
}
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
From c8218e9b3c38fcd36a2d06eec09952a0c6cee9e0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 2 Oct 2017 18:22:13 -0400
|
||||
Subject: [PATCH 2/3] Add efi_status_to_str() and rework efi_status_to_err().
|
||||
|
||||
This adds efi_status_to_str() for use when printing efi_status_t
|
||||
messages, and reworks efi_status_to_err() so that the two use a common
|
||||
list of errors.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
include/linux/efi.h | 3 ++
|
||||
drivers/firmware/efi/efi.c | 122 ++++++++++++++++++++++++++++++++++-----------
|
||||
2 files changed, 95 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index 18b16bf5ce1..436b3c93c3d 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -42,6 +42,8 @@
|
||||
#define EFI_ABORTED (21 | (1UL << (BITS_PER_LONG-1)))
|
||||
#define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1)))
|
||||
|
||||
+#define EFI_IS_ERROR(x) ((x) & (1UL << (BITS_PER_LONG-1)))
|
||||
+
|
||||
typedef unsigned long efi_status_t;
|
||||
typedef u8 efi_bool_t;
|
||||
typedef u16 efi_char16_t; /* UNICODE character */
|
||||
@@ -1183,6 +1185,7 @@ static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {}
|
||||
#endif
|
||||
|
||||
extern int efi_status_to_err(efi_status_t status);
|
||||
+extern const char *efi_status_to_str(efi_status_t status);
|
||||
|
||||
/*
|
||||
* Variable Attributes
|
||||
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
|
||||
index 557a47829d0..e8f9c7d84e9 100644
|
||||
--- a/drivers/firmware/efi/efi.c
|
||||
+++ b/drivers/firmware/efi/efi.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/ucs2_string.h>
|
||||
#include <linux/memblock.h>
|
||||
+#include <linux/bsearch.h>
|
||||
|
||||
#include <asm/early_ioremap.h>
|
||||
|
||||
@@ -865,40 +866,101 @@ int efi_mem_type(unsigned long phys_addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
+struct efi_error_code {
|
||||
+ efi_status_t status;
|
||||
+ int errno;
|
||||
+ const char *description;
|
||||
+};
|
||||
+
|
||||
+static const struct efi_error_code efi_error_codes[] = {
|
||||
+ { EFI_SUCCESS, 0, "Success"},
|
||||
+#if 0
|
||||
+ { EFI_LOAD_ERROR, -EPICK_AN_ERRNO, "Load Error"},
|
||||
+#endif
|
||||
+ { EFI_INVALID_PARAMETER, -EINVAL, "Invalid Parameter"},
|
||||
+ { EFI_UNSUPPORTED, -ENOSYS, "Unsupported"},
|
||||
+ { EFI_BAD_BUFFER_SIZE, -ENOSPC, "Bad Buffer Size"},
|
||||
+ { EFI_BUFFER_TOO_SMALL, -ENOSPC, "Buffer Too Small"},
|
||||
+ { EFI_NOT_READY, -EAGAIN, "Not Ready"},
|
||||
+ { EFI_DEVICE_ERROR, -EIO, "Device Error"},
|
||||
+ { EFI_WRITE_PROTECTED, -EROFS, "Write Protected"},
|
||||
+ { EFI_OUT_OF_RESOURCES, -ENOMEM, "Out of Resources"},
|
||||
+#if 0
|
||||
+ { EFI_VOLUME_CORRUPTED, -EPICK_AN_ERRNO, "Volume Corrupt"},
|
||||
+ { EFI_VOLUME_FULL, -EPICK_AN_ERRNO, "Volume Full"},
|
||||
+ { EFI_NO_MEDIA, -EPICK_AN_ERRNO, "No Media"},
|
||||
+ { EFI_MEDIA_CHANGED, -EPICK_AN_ERRNO, "Media changed"},
|
||||
+#endif
|
||||
+ { EFI_NOT_FOUND, -ENOENT, "Not Found"},
|
||||
+#if 0
|
||||
+ { EFI_ACCESS_DENIED, -EPICK_AN_ERRNO, "Access Denied"},
|
||||
+ { EFI_NO_RESPONSE, -EPICK_AN_ERRNO, "No Response"},
|
||||
+ { EFI_NO_MAPPING, -EPICK_AN_ERRNO, "No mapping"},
|
||||
+ { EFI_TIMEOUT, -EPICK_AN_ERRNO, "Time out"},
|
||||
+ { EFI_NOT_STARTED, -EPICK_AN_ERRNO, "Not started"},
|
||||
+ { EFI_ALREADY_STARTED, -EPICK_AN_ERRNO, "Already started"},
|
||||
+#endif
|
||||
+ { EFI_ABORTED, -EINTR, "Aborted"},
|
||||
+#if 0
|
||||
+ { EFI_ICMP_ERROR, -EPICK_AN_ERRNO, "ICMP Error"},
|
||||
+ { EFI_TFTP_ERROR, -EPICK_AN_ERRNO, "TFTP Error"},
|
||||
+ { EFI_PROTOCOL_ERROR, -EPICK_AN_ERRNO, "Protocol Error"},
|
||||
+ { EFI_INCOMPATIBLE_VERSION, -EPICK_AN_ERRNO, "Incompatible Version"},
|
||||
+#endif
|
||||
+ { EFI_SECURITY_VIOLATION, -EACCES, "Security Policy Violation"},
|
||||
+#if 0
|
||||
+ { EFI_CRC_ERROR, -EPICK_AN_ERRNO, "CRC Error"},
|
||||
+ { EFI_END_OF_MEDIA, -EPICK_AN_ERRNO, "End of Media"},
|
||||
+ { EFI_END_OF_FILE, -EPICK_AN_ERRNO, "End of File"},
|
||||
+ { EFI_INVALID_LANGUAGE, -EPICK_AN_ERRNO, "Invalid Languages"},
|
||||
+ { EFI_COMPROMISED_DATA, -EPICK_AN_ERRNO, "Compromised Data"},
|
||||
+
|
||||
+ // warnings
|
||||
+ { EFI_WARN_UNKOWN_GLYPH, -EPICK_AN_ERRNO, "Warning Unknown Glyph"},
|
||||
+ { EFI_WARN_DELETE_FAILURE, -EPICK_AN_ERRNO, "Warning Delete Failure"},
|
||||
+ { EFI_WARN_WRITE_FAILURE, -EPICK_AN_ERRNO, "Warning Write Failure"},
|
||||
+ { EFI_WARN_BUFFER_TOO_SMALL, -EPICK_AN_ERRNO, "Warning Buffer Too Small"},
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+static int
|
||||
+efi_status_cmp_bsearch(const void *key, const void *item)
|
||||
+{
|
||||
+ u64 status = (u64)(uintptr_t)key;
|
||||
+ struct efi_error_code *code = (struct efi_error_code *)item;
|
||||
+
|
||||
+ if (status < code->status)
|
||||
+ return -1;
|
||||
+ if (status > code->status)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int efi_status_to_err(efi_status_t status)
|
||||
{
|
||||
- int err;
|
||||
+ struct efi_error_code *found;
|
||||
+ size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
|
||||
|
||||
- switch (status) {
|
||||
- case EFI_SUCCESS:
|
||||
- err = 0;
|
||||
- break;
|
||||
- case EFI_INVALID_PARAMETER:
|
||||
- err = -EINVAL;
|
||||
- break;
|
||||
- case EFI_OUT_OF_RESOURCES:
|
||||
- err = -ENOSPC;
|
||||
- break;
|
||||
- case EFI_DEVICE_ERROR:
|
||||
- err = -EIO;
|
||||
- break;
|
||||
- case EFI_WRITE_PROTECTED:
|
||||
- err = -EROFS;
|
||||
- break;
|
||||
- case EFI_SECURITY_VIOLATION:
|
||||
- err = -EACCES;
|
||||
- break;
|
||||
- case EFI_NOT_FOUND:
|
||||
- err = -ENOENT;
|
||||
- break;
|
||||
- case EFI_ABORTED:
|
||||
- err = -EINTR;
|
||||
- break;
|
||||
- default:
|
||||
- err = -EINVAL;
|
||||
- }
|
||||
+ found = bsearch((void *)(uintptr_t)status, efi_error_codes,
|
||||
+ sizeof(struct efi_error_code), num,
|
||||
+ efi_status_cmp_bsearch);
|
||||
+ if (!found)
|
||||
+ return -EINVAL;
|
||||
+ return found->errno;
|
||||
+}
|
||||
|
||||
- return err;
|
||||
+const char *
|
||||
+efi_status_to_str(efi_status_t status)
|
||||
+{
|
||||
+ struct efi_error_code *found;
|
||||
+ size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
|
||||
+
|
||||
+ found = bsearch((void *)(uintptr_t)status, efi_error_codes,
|
||||
+ sizeof(struct efi_error_code), num,
|
||||
+ efi_status_cmp_bsearch);
|
||||
+ if (!found)
|
||||
+ return "Unknown error code";
|
||||
+ return found->description;
|
||||
}
|
||||
|
||||
bool efi_is_table_address(unsigned long phys_addr)
|
||||
--
|
||||
2.15.0
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 520e902d864930e2d4f329983d9ae9781a24231f Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 2 Oct 2017 18:18:30 -0400
|
||||
Subject: [PATCH 3/3] Make get_cert_list() use efi_status_to_str() to print
|
||||
error messages.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
certs/load_uefi.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/certs/load_uefi.c b/certs/load_uefi.c
|
||||
index 9ef34c44fd1..13a2826715d 100644
|
||||
--- a/certs/load_uefi.c
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -51,7 +51,8 @@ static __init int get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
}
|
||||
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
- pr_err("Couldn't get size: 0x%lx\n", status);
|
||||
+ pr_err("Couldn't get size: %s (0x%lx)\n",
|
||||
+ efi_status_to_str(status), status);
|
||||
return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
@@ -64,7 +65,8 @@ static __init int get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
status = efi.get_variable(name, guid, NULL, &lsize, db);
|
||||
if (status != EFI_SUCCESS) {
|
||||
kfree(db);
|
||||
- pr_err("Error reading db var: 0x%lx\n", status);
|
||||
+ pr_err("Error reading db var: %s (0x%lx)\n",
|
||||
+ efi_status_to_str(status), status);
|
||||
return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
--
|
||||
2.15.0
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
From dbdda4277cf0422a9ccb7ea98d0263c3cdbecdf6 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Salter <msalter@redhat.com>
|
||||
Date: Tue, 8 May 2018 21:54:39 -0400
|
||||
Subject: [PATCH] ACPI / irq: Workaround firmware issue on X-Gene based
|
||||
m400
|
||||
|
||||
The ACPI firmware on the xgene-based m400 platorms erroneously
|
||||
describes its UART interrupt as ACPI_PRODUCER rather than
|
||||
ACPI_CONSUMER. This leads to the UART driver being unable to
|
||||
find its interrupt and the kernel unable find a console.
|
||||
Work around this by avoiding the producer/consumer check
|
||||
for X-Gene UARTs.
|
||||
|
||||
Signed-off-by: Mark Salter <msalter@redhat.com>
|
||||
---
|
||||
drivers/acpi/irq.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
|
||||
index 7c352cba0528..028c1a564cff 100644
|
||||
--- a/drivers/acpi/irq.c
|
||||
+++ b/drivers/acpi/irq.c
|
||||
@@ -129,6 +129,7 @@ struct acpi_irq_parse_one_ctx {
|
||||
unsigned int index;
|
||||
unsigned long *res_flags;
|
||||
struct irq_fwspec *fwspec;
|
||||
+ bool skip_producer_check;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -200,7 +201,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
|
||||
return AE_CTRL_TERMINATE;
|
||||
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
|
||||
eirq = &ares->data.extended_irq;
|
||||
- if (eirq->producer_consumer == ACPI_PRODUCER)
|
||||
+ if (!ctx->skip_producer_check &&
|
||||
+ eirq->producer_consumer == ACPI_PRODUCER)
|
||||
return AE_OK;
|
||||
if (ctx->index >= eirq->interrupt_count) {
|
||||
ctx->index -= eirq->interrupt_count;
|
||||
@@ -235,8 +237,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
|
||||
static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
|
||||
struct irq_fwspec *fwspec, unsigned long *flags)
|
||||
{
|
||||
- struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
|
||||
+ struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
|
||||
|
||||
+ /*
|
||||
+ * Firmware on arm64-based HPE m400 platform incorrectly marks
|
||||
+ * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
|
||||
+ * Don't do the producer/consumer check for that device.
|
||||
+ */
|
||||
+ if (IS_ENABLED(CONFIG_ARM64)) {
|
||||
+ struct acpi_device *adev = acpi_bus_get_acpi_device(handle);
|
||||
+
|
||||
+ if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
|
||||
+ ctx.skip_producer_check = true;
|
||||
+ }
|
||||
acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx);
|
||||
return ctx.rc;
|
||||
}
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From patchwork Fri Apr 20 03:29:47 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: ACPI / scan: Fix regression related to X-Gene UARTs
|
||||
From: Mark Salter <msalter@redhat.com>
|
||||
X-Patchwork-Id: 10351797
|
||||
Message-Id: <20180420032947.23023-1-msalter@redhat.com>
|
||||
To: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= <frederic.danis.oss@gmail.com>
|
||||
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
|
||||
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
|
||||
Date: Thu, 19 Apr 2018 23:29:47 -0400
|
||||
|
||||
Commit e361d1f85855 ("ACPI / scan: Fix enumeration for special UART
|
||||
devices") caused a regression with some X-Gene based platforms (Mustang
|
||||
and M400) with invalid DSDT. The DSDT makes it appear that the UART
|
||||
device is also a slave device attached to itself. With the above commit
|
||||
the UART won't be enumerated by ACPI scan (slave serial devices shouldn't
|
||||
be). So check for X-Gene UART device and skip slace device check on it.
|
||||
|
||||
Signed-off-by: Mark Salter <msalter@redhat.com>
|
||||
---
|
||||
drivers/acpi/scan.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
|
||||
index cc234e6a6297..1dcdd0122862 100644
|
||||
--- a/drivers/acpi/scan.c
|
||||
+++ b/drivers/acpi/scan.c
|
||||
@@ -1551,6 +1551,14 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
|
||||
fwnode_property_present(&device->fwnode, "baud")))
|
||||
return true;
|
||||
|
||||
+ /*
|
||||
+ * Firmware on some arm64 X-Gene platforms will make the UART
|
||||
+ * device appear as both a UART and a slave of that UART. Just
|
||||
+ * bail out here for X-Gene UARTs.
|
||||
+ */
|
||||
+ if (!strcmp(acpi_device_hid(device), "APMC0D08"))
|
||||
+ return false;
|
||||
+
|
||||
INIT_LIST_HEAD(&resource_list);
|
||||
acpi_dev_get_resources(device, &resource_list,
|
||||
acpi_check_serial_bus_slave,
|
|
@ -1,37 +1,36 @@
|
|||
From ba3f737b8521314b62edaa7d4cc4bdc9aeefe394 Mon Sep 17 00:00:00 2001
|
||||
From 0451d4e795929a69a0fda6d960aa4b077c5bd179 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Howells <dhowells@redhat.com>
|
||||
Date: Tue, 23 Oct 2012 09:30:54 -0400
|
||||
Subject: [PATCH 15/20] Add EFI signature data types
|
||||
Date: Fri, 5 May 2017 08:21:58 +0100
|
||||
Subject: [PATCH 1/4] efi: Add EFI signature data types
|
||||
|
||||
Add the data types that are used for containing hashes, keys and certificates
|
||||
for cryptographic verification.
|
||||
|
||||
Bugzilla: N/A
|
||||
Upstream-status: Fedora mustard for now
|
||||
Add the data types that are used for containing hashes, keys and
|
||||
certificates for cryptographic verification along with their corresponding
|
||||
type GUIDs.
|
||||
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
include/linux/efi.h | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
include/linux/efi.h | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index 5af91b58afae..190858d62fe3 100644
|
||||
index ec36f42..3259ad6 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -603,6 +603,9 @@ void efi_native_runtime_setup(void);
|
||||
#define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)
|
||||
#define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b)
|
||||
|
||||
+#define EFI_CERT_SHA256_GUID EFI_GUID(0xc1c41626, 0x504c, 0x4092, 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28)
|
||||
+#define EFI_CERT_X509_GUID EFI_GUID(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72)
|
||||
@@ -614,6 +614,10 @@ void efi_native_runtime_setup(void);
|
||||
#define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f)
|
||||
#define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23)
|
||||
|
||||
+#define EFI_CERT_SHA256_GUID EFI_GUID(0xc1c41626, 0x504c, 0x4092, 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28)
|
||||
+#define EFI_CERT_X509_GUID EFI_GUID(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72)
|
||||
+#define EFI_CERT_X509_SHA256_GUID EFI_GUID(0x3bd2a492, 0x96c0, 0x4079, 0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed)
|
||||
+
|
||||
typedef struct {
|
||||
efi_guid_t guid;
|
||||
u64 table;
|
||||
@@ -853,6 +856,20 @@ typedef struct {
|
||||
/*
|
||||
* This GUID is used to pass to the kernel proper the struct screen_info
|
||||
* structure that was populated by the stub based on the GOP protocol instance
|
||||
@@ -873,6 +877,27 @@ typedef struct {
|
||||
efi_memory_desc_t entry[0];
|
||||
} efi_memory_attributes_table_t;
|
||||
|
||||
|
||||
+typedef struct {
|
||||
+ efi_guid_t signature_owner;
|
||||
+ u8 signature_data[];
|
||||
|
@ -45,6 +44,13 @@ index 5af91b58afae..190858d62fe3 100644
|
|||
+ u8 signature_header[];
|
||||
+ /* efi_signature_data_t signatures[][] */
|
||||
+} efi_signature_list_t;
|
||||
+
|
||||
+typedef u8 efi_sha256_hash_t[32];
|
||||
+
|
||||
+typedef struct {
|
||||
+ efi_sha256_hash_t to_be_signed_hash;
|
||||
+ efi_time_t time_of_revocation;
|
||||
+} efi_cert_x509_sha256_t;
|
||||
+
|
||||
/*
|
||||
* All runtime access to EFI goes through this structure:
|
||||
|
|
|
@ -1,29 +1,38 @@
|
|||
From 822b4b3eb76ca451a416a51f0a7bfedfa5c5ea39 Mon Sep 17 00:00:00 2001
|
||||
From e4c62c12635a371e43bd17e8d33a936668264491 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Howells <dhowells@redhat.com>
|
||||
Date: Tue, 23 Oct 2012 09:36:28 -0400
|
||||
Subject: [PATCH 16/20] Add an EFI signature blob parser and key loader.
|
||||
Date: Fri, 5 May 2017 08:21:58 +0100
|
||||
Subject: [PATCH 2/4] efi: Add an EFI signature blob parser
|
||||
|
||||
X.509 certificates are loaded into the specified keyring as asymmetric type
|
||||
keys.
|
||||
Add a function to parse an EFI signature blob looking for elements of
|
||||
interest. A list is made up of a series of sublists, where all the
|
||||
elements in a sublist are of the same type, but sublists can be of
|
||||
different types.
|
||||
|
||||
For each sublist encountered, the function pointed to by the
|
||||
get_handler_for_guid argument is called with the type specifier GUID and
|
||||
returns either a pointer to a function to handle elements of that type or
|
||||
NULL if the type is not of interest.
|
||||
|
||||
If the sublist is of interest, each element is passed to the handler
|
||||
function in turn.
|
||||
|
||||
[labbott@fedoraproject.org: Drop KEY_ALLOC_TRUSTED]
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
crypto/asymmetric_keys/Kconfig | 8 +++
|
||||
crypto/asymmetric_keys/Makefile | 1 +
|
||||
crypto/asymmetric_keys/efi_parser.c | 108 ++++++++++++++++++++++++++++++++++++
|
||||
include/linux/efi.h | 4 ++
|
||||
4 files changed, 121 insertions(+)
|
||||
create mode 100644 crypto/asymmetric_keys/efi_parser.c
|
||||
certs/Kconfig | 8 ++++
|
||||
certs/Makefile | 1 +
|
||||
certs/efi_parser.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
include/linux/efi.h | 9 +++++
|
||||
4 files changed, 130 insertions(+)
|
||||
create mode 100644 certs/efi_parser.c
|
||||
|
||||
diff --git a/certs/Kconfig b/certs/Kconfig
|
||||
index 6ce51ed..630ae09 100644
|
||||
--- a/certs/Kconfig
|
||||
+++ b/certs/Kconfig
|
||||
@@ -82,4 +82,12 @@ config SYSTEM_BLACKLIST_HASH_LIST
|
||||
wrapper to incorporate the list into the kernel. Each <hash> should
|
||||
be a string of hex digits.
|
||||
|
||||
diff --git a/crypto/asymmetric_keys/Kconfig b/crypto/asymmetric_keys/Kconfig
|
||||
index 331f6baf2df8..5f9002d3192e 100644
|
||||
--- a/crypto/asymmetric_keys/Kconfig
|
||||
+++ b/crypto/asymmetric_keys/Kconfig
|
||||
@@ -61,4 +61,12 @@ config SIGNED_PE_FILE_VERIFICATION
|
||||
This option provides support for verifying the signature(s) on a
|
||||
signed PE binary.
|
||||
|
||||
+config EFI_SIGNATURE_LIST_PARSER
|
||||
+ bool "EFI signature list parser"
|
||||
+ depends on EFI
|
||||
|
@ -32,28 +41,28 @@ index 331f6baf2df8..5f9002d3192e 100644
|
|||
+ This option provides support for parsing EFI signature lists for
|
||||
+ X.509 certificates and turning them into keys.
|
||||
+
|
||||
endif # ASYMMETRIC_KEY_TYPE
|
||||
diff --git a/crypto/asymmetric_keys/Makefile b/crypto/asymmetric_keys/Makefile
|
||||
index 6516855bec18..c099fe15ed6d 100644
|
||||
--- a/crypto/asymmetric_keys/Makefile
|
||||
+++ b/crypto/asymmetric_keys/Makefile
|
||||
@@ -10,6 +10,7 @@ asymmetric_keys-y := \
|
||||
signature.o
|
||||
|
||||
obj-$(CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE) += public_key.o
|
||||
endmenu
|
||||
diff --git a/certs/Makefile b/certs/Makefile
|
||||
index 4119bb3..738151a 100644
|
||||
--- a/certs/Makefile
|
||||
+++ b/certs/Makefile
|
||||
@@ -9,6 +9,7 @@ obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
|
||||
else
|
||||
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
|
||||
endif
|
||||
+obj-$(CONFIG_EFI_SIGNATURE_LIST_PARSER) += efi_parser.o
|
||||
|
||||
#
|
||||
# X.509 Certificate handling
|
||||
diff --git a/crypto/asymmetric_keys/efi_parser.c b/crypto/asymmetric_keys/efi_parser.c
|
||||
|
||||
ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
|
||||
|
||||
diff --git a/certs/efi_parser.c b/certs/efi_parser.c
|
||||
new file mode 100644
|
||||
index 000000000000..636feb18b733
|
||||
index 0000000..4e396f9
|
||||
--- /dev/null
|
||||
+++ b/crypto/asymmetric_keys/efi_parser.c
|
||||
@@ -0,0 +1,108 @@
|
||||
+++ b/certs/efi_parser.c
|
||||
@@ -0,0 +1,112 @@
|
||||
+/* EFI signature/key/certificate list parser
|
||||
+ *
|
||||
+ * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
|
||||
+ * Copyright (C) 2012, 2016 Red Hat, Inc. All Rights Reserved.
|
||||
+ * Written by David Howells (dhowells@redhat.com)
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
|
@ -67,27 +76,44 @@ index 000000000000..636feb18b733
|
|||
+#include <linux/printk.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/efi.h>
|
||||
+#include <keys/asymmetric-type.h>
|
||||
+
|
||||
+static __initdata efi_guid_t efi_cert_x509_guid = EFI_CERT_X509_GUID;
|
||||
+
|
||||
+/**
|
||||
+ * parse_efi_signature_list - Parse an EFI signature list for certificates
|
||||
+ * @source: The source of the key
|
||||
+ * @data: The data blob to parse
|
||||
+ * @size: The size of the data blob
|
||||
+ * @keyring: The keyring to add extracted keys to
|
||||
+ * @get_handler_for_guid: Get the handler func for the sig type (or NULL)
|
||||
+ *
|
||||
+ * Parse an EFI signature list looking for elements of interest. A list is
|
||||
+ * made up of a series of sublists, where all the elements in a sublist are of
|
||||
+ * the same type, but sublists can be of different types.
|
||||
+ *
|
||||
+ * For each sublist encountered, the @get_handler_for_guid function is called
|
||||
+ * with the type specifier GUID and returns either a pointer to a function to
|
||||
+ * handle elements of that type or NULL if the type is not of interest.
|
||||
+ *
|
||||
+ * If the sublist is of interest, each element is passed to the handler
|
||||
+ * function in turn.
|
||||
+ *
|
||||
+ * Error EBADMSG is returned if the list doesn't parse correctly and 0 is
|
||||
+ * returned if the list was parsed correctly. No error can be returned from
|
||||
+ * the @get_handler_for_guid function or the element handler function it
|
||||
+ * returns.
|
||||
+ */
|
||||
+int __init parse_efi_signature_list(const void *data, size_t size, struct key *keyring)
|
||||
+int __init parse_efi_signature_list(
|
||||
+ const char *source,
|
||||
+ const void *data, size_t size,
|
||||
+ efi_element_handler_t (*get_handler_for_guid)(const efi_guid_t *))
|
||||
+{
|
||||
+ efi_element_handler_t handler;
|
||||
+ unsigned offs = 0;
|
||||
+ size_t lsize, esize, hsize, elsize;
|
||||
+
|
||||
+ pr_devel("-->%s(,%zu)\n", __func__, size);
|
||||
+
|
||||
+ while (size > 0) {
|
||||
+ efi_signature_list_t list;
|
||||
+ const efi_signature_data_t *elem;
|
||||
+ key_ref_t key;
|
||||
+ efi_signature_list_t list;
|
||||
+ size_t lsize, esize, hsize, elsize;
|
||||
+
|
||||
+ if (size < sizeof(list))
|
||||
+ return -EBADMSG;
|
||||
|
@ -108,6 +134,7 @@ index 000000000000..636feb18b733
|
|||
+ __func__, offs);
|
||||
+ return -EBADMSG;
|
||||
+ }
|
||||
+
|
||||
+ if (lsize < sizeof(list) ||
|
||||
+ lsize - sizeof(list) < hsize ||
|
||||
+ esize < sizeof(*elem) ||
|
||||
|
@ -117,7 +144,8 @@ index 000000000000..636feb18b733
|
|||
+ return -EBADMSG;
|
||||
+ }
|
||||
+
|
||||
+ if (efi_guidcmp(list.signature_type, efi_cert_x509_guid) != 0) {
|
||||
+ handler = get_handler_for_guid(&list.signature_type);
|
||||
+ if (!handler) {
|
||||
+ data += lsize;
|
||||
+ size -= lsize;
|
||||
+ offs += lsize;
|
||||
|
@ -132,24 +160,9 @@ index 000000000000..636feb18b733
|
|||
+ elem = data;
|
||||
+
|
||||
+ pr_devel("ELEM[%04x]\n", offs);
|
||||
+
|
||||
+ key = key_create_or_update(
|
||||
+ make_key_ref(keyring, 1),
|
||||
+ "asymmetric",
|
||||
+ NULL,
|
||||
+ handler(source,
|
||||
+ &elem->signature_data,
|
||||
+ esize - sizeof(*elem),
|
||||
+ (KEY_POS_ALL & ~KEY_POS_SETATTR) |
|
||||
+ KEY_USR_VIEW,
|
||||
+ KEY_ALLOC_NOT_IN_QUOTA);
|
||||
+
|
||||
+ if (IS_ERR(key))
|
||||
+ pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
|
||||
+ PTR_ERR(key));
|
||||
+ else
|
||||
+ pr_notice("Loaded cert '%s' linked to '%s'\n",
|
||||
+ key_ref_to_ptr(key)->description,
|
||||
+ keyring->description);
|
||||
+ esize - sizeof(*elem));
|
||||
+
|
||||
+ data += esize;
|
||||
+ size -= esize;
|
||||
|
@ -160,16 +173,21 @@ index 000000000000..636feb18b733
|
|||
+ return 0;
|
||||
+}
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index 190858d62fe3..668aa1244885 100644
|
||||
index 3259ad6..08024c6 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -1025,6 +1025,10 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm,
|
||||
@@ -1055,6 +1055,15 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm,
|
||||
char * __init efi_md_typeattr_format(char *buf, size_t size,
|
||||
const efi_memory_desc_t *md);
|
||||
|
||||
+struct key;
|
||||
+extern int __init parse_efi_signature_list(const void *data, size_t size,
|
||||
+ struct key *keyring);
|
||||
|
||||
+
|
||||
+typedef void (*efi_element_handler_t)(const char *source,
|
||||
+ const void *element_data,
|
||||
+ size_t element_size);
|
||||
+extern int __init parse_efi_signature_list(
|
||||
+ const char *source,
|
||||
+ const void *data, size_t size,
|
||||
+ efi_element_handler_t (*get_handler_for_guid)(const efi_guid_t *));
|
||||
+
|
||||
/**
|
||||
* efi_range_is_wc - check the WC bit on an address range
|
||||
|
|
1080
AllWinner-h3.patch
1080
AllWinner-h3.patch
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,73 +0,0 @@
|
|||
From 4d6fa57b4dab0d77f4d8e9d9c73d1e63f6fe8fee Mon Sep 17 00:00:00 2001
|
||||
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
|
||||
Date: Fri, 21 Apr 2017 23:14:48 +0200
|
||||
Subject: macsec: avoid heap overflow in skb_to_sgvec
|
||||
|
||||
While this may appear as a humdrum one line change, it's actually quite
|
||||
important. An sk_buff stores data in three places:
|
||||
|
||||
1. A linear chunk of allocated memory in skb->data. This is the easiest
|
||||
one to work with, but it precludes using scatterdata since the memory
|
||||
must be linear.
|
||||
2. The array skb_shinfo(skb)->frags, which is of maximum length
|
||||
MAX_SKB_FRAGS. This is nice for scattergather, since these fragments
|
||||
can point to different pages.
|
||||
3. skb_shinfo(skb)->frag_list, which is a pointer to another sk_buff,
|
||||
which in turn can have data in either (1) or (2).
|
||||
|
||||
The first two are rather easy to deal with, since they're of a fixed
|
||||
maximum length, while the third one is not, since there can be
|
||||
potentially limitless chains of fragments. Fortunately dealing with
|
||||
frag_list is opt-in for drivers, so drivers don't actually have to deal
|
||||
with this mess. For whatever reason, macsec decided it wanted pain, and
|
||||
so it explicitly specified NETIF_F_FRAGLIST.
|
||||
|
||||
Because dealing with (1), (2), and (3) is insane, most users of sk_buff
|
||||
doing any sort of crypto or paging operation calls a convenient function
|
||||
called skb_to_sgvec (which happens to be recursive if (3) is in use!).
|
||||
This takes a sk_buff as input, and writes into its output pointer an
|
||||
array of scattergather list items. Sometimes people like to declare a
|
||||
fixed size scattergather list on the stack; othertimes people like to
|
||||
allocate a fixed size scattergather list on the heap. However, if you're
|
||||
doing it in a fixed-size fashion, you really shouldn't be using
|
||||
NETIF_F_FRAGLIST too (unless you're also ensuring the sk_buff and its
|
||||
frag_list children arent't shared and then you check the number of
|
||||
fragments in total required.)
|
||||
|
||||
Macsec specifically does this:
|
||||
|
||||
size += sizeof(struct scatterlist) * (MAX_SKB_FRAGS + 1);
|
||||
tmp = kmalloc(size, GFP_ATOMIC);
|
||||
*sg = (struct scatterlist *)(tmp + sg_offset);
|
||||
...
|
||||
sg_init_table(sg, MAX_SKB_FRAGS + 1);
|
||||
skb_to_sgvec(skb, sg, 0, skb->len);
|
||||
|
||||
Specifying MAX_SKB_FRAGS + 1 is the right answer usually, but not if you're
|
||||
using NETIF_F_FRAGLIST, in which case the call to skb_to_sgvec will
|
||||
overflow the heap, and disaster ensues.
|
||||
|
||||
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
Cc: security@kernel.org
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/macsec.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
|
||||
index ff0a5ed..dbab05a 100644
|
||||
--- a/drivers/net/macsec.c
|
||||
+++ b/drivers/net/macsec.c
|
||||
@@ -2716,7 +2716,7 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
|
||||
}
|
||||
|
||||
#define MACSEC_FEATURES \
|
||||
- (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
|
||||
+ (NETIF_F_SG | NETIF_F_HIGHDMA)
|
||||
static struct lock_class_key macsec_netdev_addr_lock_key;
|
||||
|
||||
static int macsec_dev_init(struct net_device *dev)
|
||||
--
|
||||
cgit v1.1
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
From: "J. Bruce Fields" <bfields@redhat.com>
|
||||
Date: 2017-04-14 15:04:40
|
||||
Subject: [PATCH] nfsd: check for oversized NFSv2/v3 arguments
|
||||
|
||||
A client can append random data to the end of an NFSv2 or NFSv3 RPC call
|
||||
without our complaining; we'll just stop parsing at the end of the
|
||||
expected data and ignore the rest.
|
||||
|
||||
Encoded arguments and replies are stored together in an array of pages,
|
||||
and if a call is too large it could leave inadequate space for the
|
||||
reply. This is normally OK because NFS RPC's typically have either
|
||||
short arguments and long replies (like READ) or long arguments and short
|
||||
replies (like WRITE). But a client that sends an incorrectly long reply
|
||||
can violate those assumptions. This was observed to cause crashes.
|
||||
|
||||
So, insist that the argument not be any longer than we expect.
|
||||
|
||||
Also, several operations increment rq_next_page in the decode routine
|
||||
before checking the argument size, which can leave rq_next_page pointing
|
||||
well past the end of the page array, causing trouble later in
|
||||
svc_free_pages.
|
||||
|
||||
As followup we may also want to rewrite the encoding routines to check
|
||||
more carefully that they aren't running off the end of the page array.
|
||||
|
||||
Reported-by: Tuomas Haanpää <thaan@synopsys.com>
|
||||
Reported-by: Ari Kauppi <ari@synopsys.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
|
||||
---
|
||||
fs/nfsd/nfs3xdr.c | 23 +++++++++++++++++------
|
||||
fs/nfsd/nfsxdr.c | 13 ++++++++++---
|
||||
include/linux/sunrpc/svc.h | 3 +--
|
||||
3 files changed, 28 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
|
||||
index dba2ff8eaa68..be66bcadfaea 100644
|
||||
--- a/fs/nfsd/nfs3xdr.c
|
||||
+++ b/fs/nfsd/nfs3xdr.c
|
||||
@@ -334,8 +334,11 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
if (!p)
|
||||
return 0;
|
||||
p = xdr_decode_hyper(p, &args->offset);
|
||||
-
|
||||
args->count = ntohl(*p++);
|
||||
+
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
len = min(args->count, max_blocksize);
|
||||
|
||||
/* set up the kvec */
|
||||
@@ -349,7 +352,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
v++;
|
||||
}
|
||||
args->vlen = v;
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -536,9 +539,11 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
p = decode_fh(p, &args->fh);
|
||||
if (!p)
|
||||
return 0;
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -564,10 +569,14 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->verf = p; p += 2;
|
||||
args->dircount = ~0;
|
||||
args->count = ntohl(*p++);
|
||||
+
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
args->count = min_t(u32, args->count, PAGE_SIZE);
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -585,6 +594,9 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->dircount = ntohl(*p++);
|
||||
args->count = ntohl(*p++);
|
||||
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
len = args->count = min(args->count, max_blocksize);
|
||||
while (len > 0) {
|
||||
struct page *p = *(rqstp->rq_next_page++);
|
||||
@@ -592,8 +604,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->buffer = page_address(p);
|
||||
len -= PAGE_SIZE;
|
||||
}
|
||||
-
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
|
||||
index 41b468a6a90f..79268369f7b3 100644
|
||||
--- a/fs/nfsd/nfsxdr.c
|
||||
+++ b/fs/nfsd/nfsxdr.c
|
||||
@@ -257,6 +257,9 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
len = args->count = ntohl(*p++);
|
||||
p++; /* totalcount - unused */
|
||||
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
len = min_t(unsigned int, len, NFSSVC_MAXBLKSIZE_V2);
|
||||
|
||||
/* set up somewhere to store response.
|
||||
@@ -272,7 +275,7 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
v++;
|
||||
}
|
||||
args->vlen = v;
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -360,9 +363,11 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readli
|
||||
p = decode_fh(p, &args->fh);
|
||||
if (!p)
|
||||
return 0;
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -400,9 +405,11 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->cookie = ntohl(*p++);
|
||||
args->count = ntohl(*p++);
|
||||
args->count = min_t(u32, args->count, PAGE_SIZE);
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
|
||||
index e770abeed32d..6ef19cf658b4 100644
|
||||
--- a/include/linux/sunrpc/svc.h
|
||||
+++ b/include/linux/sunrpc/svc.h
|
||||
@@ -336,8 +336,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
char *cp = (char *)p;
|
||||
struct kvec *vec = &rqstp->rq_arg.head[0];
|
||||
- return cp >= (char*)vec->iov_base
|
||||
- && cp <= (char*)vec->iov_base + vec->iov_len;
|
||||
+ return cp == (char *)vec->iov_base + vec->iov_len;
|
||||
}
|
||||
|
||||
static inline int
|
||||
--
|
||||
2.9.3
|
||||
|
||||
--
|
||||
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
|
||||
the body of a message to majordomo@vger.kernel.org
|
||||
More majordomo info at http://vger.kernel.org/majordomo-info.html
|
|
@ -0,0 +1,24 @@
|
|||
From ea6e7d9d0fe3e448aef19b3943d4897ae0bef128 Mon Sep 17 00:00:00 2001
|
||||
From: Fedora Kernel Team <kernel-team@fedoraproject.org>
|
||||
Date: Thu, 3 Aug 2017 13:46:51 -0500
|
||||
Subject: [PATCH] Fix for module sig verification
|
||||
|
||||
---
|
||||
kernel/module_signing.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kernel/module_signing.c b/kernel/module_signing.c
|
||||
index 937c844..d3d6f95 100644
|
||||
--- a/kernel/module_signing.c
|
||||
+++ b/kernel/module_signing.c
|
||||
@@ -81,6 +81,6 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen)
|
||||
}
|
||||
|
||||
return verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
|
||||
- NULL, VERIFYING_MODULE_SIGNATURE,
|
||||
+ (void *)1UL, VERIFYING_MODULE_SIGNATURE,
|
||||
NULL, NULL);
|
||||
}
|
||||
--
|
||||
2.13.3
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
From 2a54526850121cd0d7cf649a321488b4dab5731d Mon Sep 17 00:00:00 2001
|
||||
From: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Date: Fri, 26 Oct 2012 12:36:24 -0400
|
||||
Subject: [PATCH 17/20] KEYS: Add a system blacklist keyring
|
||||
|
||||
This adds an additional keyring that is used to store certificates that
|
||||
are blacklisted. This keyring is searched first when loading signed modules
|
||||
and if the module's certificate is found, it will refuse to load. This is
|
||||
useful in cases where third party certificates are used for module signing.
|
||||
|
||||
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
---
|
||||
certs/system_keyring.c | 22 ++++++++++++++++++++++
|
||||
include/keys/system_keyring.h | 4 ++++
|
||||
init/Kconfig | 9 +++++++++
|
||||
3 files changed, 35 insertions(+)
|
||||
|
||||
diff --git a/certs/system_keyring.c b/certs/system_keyring.c
|
||||
index 50979d6dcecd..787eeead2f57 100644
|
||||
--- a/certs/system_keyring.c
|
||||
+++ b/certs/system_keyring.c
|
||||
@@ -22,6 +22,9 @@ static struct key *builtin_trusted_keys;
|
||||
#ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
|
||||
static struct key *secondary_trusted_keys;
|
||||
#endif
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+struct key *system_blacklist_keyring;
|
||||
+#endif
|
||||
|
||||
extern __initconst const u8 system_certificate_list[];
|
||||
extern __initconst const unsigned long system_certificate_list_size;
|
||||
@@ -99,6 +102,16 @@ static __init int system_trusted_keyring_init(void)
|
||||
if (key_link(secondary_trusted_keys, builtin_trusted_keys) < 0)
|
||||
panic("Can't link trusted keyrings\n");
|
||||
#endif
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+ system_blacklist_keyring = keyring_alloc(".system_blacklist_keyring",
|
||||
+ KUIDT_INIT(0), KGIDT_INIT(0), current_cred(),
|
||||
+ ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
|
||||
+ KEY_USR_VIEW | KEY_USR_READ | KEY_USR_SEARCH),
|
||||
+ KEY_ALLOC_NOT_IN_QUOTA,
|
||||
+ NULL, NULL);
|
||||
+ if (IS_ERR(system_blacklist_keyring))
|
||||
+ panic("Can't allocate system blacklist keyring\n");
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -214,6 +227,15 @@ int verify_pkcs7_signature(const void *data, size_t len,
|
||||
trusted_keys = builtin_trusted_keys;
|
||||
#endif
|
||||
}
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+ ret = pkcs7_validate_trust(pkcs7, system_blacklist_keyring);
|
||||
+ if (!ret) {
|
||||
+ /* module is signed with a cert in the blacklist. reject */
|
||||
+ pr_err("Module key is in the blacklist\n");
|
||||
+ ret = -EKEYREJECTED;
|
||||
+ goto error;
|
||||
+ }
|
||||
+#endif
|
||||
ret = pkcs7_validate_trust(pkcs7, trusted_keys);
|
||||
if (ret < 0) {
|
||||
if (ret == -ENOKEY)
|
||||
diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
|
||||
index fbd4647767e9..5bc291a3d261 100644
|
||||
--- a/include/keys/system_keyring.h
|
||||
+++ b/include/keys/system_keyring.h
|
||||
@@ -33,6 +33,10 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
|
||||
#define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+extern struct key *system_blacklist_keyring;
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_IMA_BLACKLIST_KEYRING
|
||||
extern struct key *ima_blacklist_keyring;
|
||||
|
||||
diff --git a/init/Kconfig b/init/Kconfig
|
||||
index 34407f15e6d3..461ad575a608 100644
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -1859,6 +1859,15 @@ config SYSTEM_DATA_VERIFICATION
|
||||
module verification, kexec image verification and firmware blob
|
||||
verification.
|
||||
|
||||
+config SYSTEM_BLACKLIST_KEYRING
|
||||
+ bool "Provide system-wide ring of blacklisted keys"
|
||||
+ depends on KEYS
|
||||
+ help
|
||||
+ Provide a system keyring to which blacklisted keys can be added.
|
||||
+ Keys in the keyring are considered entirely untrusted. Keys in this
|
||||
+ keyring are used by the module signature checking to reject loading
|
||||
+ of modules signed with a blacklisted key.
|
||||
+
|
||||
config PROFILING
|
||||
bool "Profiling support"
|
||||
help
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
From fb2ac204a70da565de9ef9a9d6d69a40c2d59727 Mon Sep 17 00:00:00 2001
|
||||
From: David Howells <dhowells@redhat.com>
|
||||
Date: Fri, 5 May 2017 08:21:56 +0100
|
||||
Subject: [PATCH] KEYS: Allow unrestricted boot-time addition of keys to
|
||||
secondary keyring
|
||||
|
||||
Allow keys to be added to the system secondary certificates keyring during
|
||||
kernel initialisation in an unrestricted fashion. Such keys are implicitly
|
||||
trusted and don't have their trust chains checked on link.
|
||||
|
||||
This allows keys in the UEFI database to be added in secure boot mode for
|
||||
the purposes of module signing.
|
||||
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
certs/internal.h | 18 ++++++++++++++++++
|
||||
certs/system_keyring.c | 33 +++++++++++++++++++++++++++++++++
|
||||
2 files changed, 51 insertions(+)
|
||||
create mode 100644 certs/internal.h
|
||||
|
||||
diff --git a/certs/internal.h b/certs/internal.h
|
||||
new file mode 100644
|
||||
index 0000000..5dcbefb
|
||||
--- /dev/null
|
||||
+++ b/certs/internal.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* Internal definitions
|
||||
+ *
|
||||
+ * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
|
||||
+ * Written by David Howells (dhowells@redhat.com)
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public Licence
|
||||
+ * as published by the Free Software Foundation; either version
|
||||
+ * 2 of the Licence, or (at your option) any later version.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * system_keyring.c
|
||||
+ */
|
||||
+#ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
|
||||
+extern void __init add_trusted_secondary_key(const char *source,
|
||||
+ const void *data, size_t len);
|
||||
+#endif
|
||||
diff --git a/certs/system_keyring.c b/certs/system_keyring.c
|
||||
index 6251d1b..5ac8ba6 100644
|
||||
--- a/certs/system_keyring.c
|
||||
+++ b/certs/system_keyring.c
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <keys/asymmetric-type.h>
|
||||
#include <keys/system_keyring.h>
|
||||
#include <crypto/pkcs7.h>
|
||||
+#include "internal.h"
|
||||
|
||||
static struct key *builtin_trusted_keys;
|
||||
#ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
|
||||
@@ -265,3 +266,35 @@ int verify_pkcs7_signature(const void *data, size_t len,
|
||||
EXPORT_SYMBOL_GPL(verify_pkcs7_signature);
|
||||
|
||||
#endif /* CONFIG_SYSTEM_DATA_VERIFICATION */
|
||||
+
|
||||
+#ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
|
||||
+/**
|
||||
+ * add_trusted_secondary_key - Add to secondary keyring with no validation
|
||||
+ * @source: Source of key
|
||||
+ * @data: The blob holding the key
|
||||
+ * @len: The length of the data blob
|
||||
+ *
|
||||
+ * Add a key to the secondary keyring without checking its trust chain. This
|
||||
+ * is available only during kernel initialisation.
|
||||
+ */
|
||||
+void __init add_trusted_secondary_key(const char *source,
|
||||
+ const void *data, size_t len)
|
||||
+{
|
||||
+ key_ref_t key;
|
||||
+
|
||||
+ key = key_create_or_update(make_key_ref(secondary_trusted_keys, 1),
|
||||
+ "asymmetric",
|
||||
+ NULL, data, len,
|
||||
+ (KEY_POS_ALL & ~KEY_POS_SETATTR) |
|
||||
+ KEY_USR_VIEW,
|
||||
+ KEY_ALLOC_NOT_IN_QUOTA |
|
||||
+ KEY_ALLOC_BYPASS_RESTRICTION);
|
||||
+
|
||||
+ if (IS_ERR(key))
|
||||
+ pr_err("Problem loading %s X.509 certificate (%ld)\n",
|
||||
+ source, PTR_ERR(key));
|
||||
+ else
|
||||
+ pr_notice("Loaded %s cert '%s' linked to secondary sys keyring\n",
|
||||
+ source, key_ref_to_ptr(key)->description);
|
||||
+}
|
||||
+#endif /* CONFIG_SECONDARY_TRUSTED_KEYRING */
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
From 71db1b222ecdf6cb4356f6f1e2bd45cd2f0e85e1 Mon Sep 17 00:00:00 2001
|
||||
From: Laura Abbott <labbott@redhat.com>
|
||||
Date: Tue, 18 Oct 2016 13:58:44 -0700
|
||||
Subject: [PATCH] MODSIGN: Don't try secure boot if EFI runtime is disabled
|
||||
|
||||
Secure boot depends on having EFI runtime variable access. The code
|
||||
does not handle a lack of runtime variables gracefully. Add a check
|
||||
to just bail out of EFI runtime is disabled.
|
||||
|
||||
Signed-off-by: Laura Abbott <labbott@redhat.com>
|
||||
---
|
||||
kernel/modsign_uefi.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/kernel/modsign_uefi.c b/kernel/modsign_uefi.c
|
||||
index a41da14..2bdaf76 100644
|
||||
--- a/kernel/modsign_uefi.c
|
||||
+++ b/kernel/modsign_uefi.c
|
||||
@@ -71,6 +71,10 @@ static int __init load_uefi_certs(void)
|
||||
if (!efi_enabled(EFI_SECURE_BOOT))
|
||||
return 0;
|
||||
|
||||
+ /* Things blow up if efi runtime is disabled */
|
||||
+ if (efi_runtime_disabled())
|
||||
+ return 0;
|
||||
+
|
||||
keyring = get_system_keyring();
|
||||
if (!keyring) {
|
||||
pr_err("MODSIGN: Couldn't get system keyring\n");
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 8a4535bcfe24d317be675e53cdc8c61d22fdc7f3 Mon Sep 17 00:00:00 2001
|
||||
From 90dc66270b02981b19a085c6a9184e3452b7b3e8 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Date: Fri, 26 Oct 2012 12:42:16 -0400
|
||||
Subject: [PATCH 18/20] MODSIGN: Import certificates from UEFI Secure Boot
|
||||
Date: Fri, 5 May 2017 08:21:59 +0100
|
||||
Subject: [PATCH 3/4] MODSIGN: Import certificates from UEFI Secure Boot
|
||||
|
||||
Secure Boot stores a list of allowed certificates in the 'db' variable.
|
||||
This imports those certificates into the system trusted keyring. This
|
||||
|
@ -11,104 +11,68 @@ variable, a user can allow a module signed with that certificate to
|
|||
load. The shim UEFI bootloader has a similar certificate list stored
|
||||
in the 'MokListRT' variable. We import those as well.
|
||||
|
||||
In the opposite case, Secure Boot maintains a list of disallowed
|
||||
certificates in the 'dbx' variable. We load those certificates into
|
||||
the newly introduced system blacklist keyring and forbid any module
|
||||
signed with those from loading.
|
||||
Secure Boot also maintains a list of disallowed certificates in the 'dbx'
|
||||
variable. We load those certificates into the newly introduced system
|
||||
blacklist keyring and forbid any module signed with those from loading and
|
||||
forbid the use within the kernel of any key with a matching hash.
|
||||
|
||||
This facility is enabled by setting CONFIG_LOAD_UEFI_KEYS.
|
||||
|
||||
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
certs/system_keyring.c | 13 ++++++
|
||||
include/keys/system_keyring.h | 1 +
|
||||
init/Kconfig | 9 ++++
|
||||
kernel/Makefile | 3 ++
|
||||
kernel/modsign_uefi.c | 99 +++++++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 125 insertions(+)
|
||||
create mode 100644 kernel/modsign_uefi.c
|
||||
certs/Kconfig | 16 ++++++
|
||||
certs/Makefile | 4 ++
|
||||
certs/load_uefi.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 188 insertions(+)
|
||||
create mode 100644 certs/load_uefi.c
|
||||
|
||||
diff --git a/certs/system_keyring.c b/certs/system_keyring.c
|
||||
index 787eeead2f57..4d9123ed5c07 100644
|
||||
--- a/certs/system_keyring.c
|
||||
+++ b/certs/system_keyring.c
|
||||
@@ -30,6 +30,19 @@ extern __initconst const u8 system_certificate_list[];
|
||||
extern __initconst const unsigned long system_certificate_list_size;
|
||||
|
||||
/**
|
||||
+ * get_system_keyring - Return a pointer to the system keyring
|
||||
+ *
|
||||
+ */
|
||||
+struct key *get_system_keyring(void)
|
||||
+{
|
||||
+ struct key *system_keyring = NULL;
|
||||
+
|
||||
+ system_keyring = builtin_trusted_keys;
|
||||
+ return system_keyring;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(get_system_keyring);
|
||||
+
|
||||
+/**
|
||||
* restrict_link_to_builtin_trusted - Restrict keyring addition by built in CA
|
||||
*
|
||||
* Restrict the addition of keys into a keyring based on the key-to-be-added
|
||||
diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
|
||||
index 5bc291a3d261..56ff5715ab67 100644
|
||||
--- a/include/keys/system_keyring.h
|
||||
+++ b/include/keys/system_keyring.h
|
||||
@@ -36,6 +36,7 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
|
||||
#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
extern struct key *system_blacklist_keyring;
|
||||
#endif
|
||||
+extern struct key *get_system_keyring(void);
|
||||
|
||||
#ifdef CONFIG_IMA_BLACKLIST_KEYRING
|
||||
extern struct key *ima_blacklist_keyring;
|
||||
diff --git a/init/Kconfig b/init/Kconfig
|
||||
index 461ad575a608..93646fd7b1c8 100644
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -2009,6 +2009,15 @@ config MODULE_SIG_ALL
|
||||
comment "Do not forget to sign required modules with scripts/sign-file"
|
||||
depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL
|
||||
|
||||
+config MODULE_SIG_UEFI
|
||||
+ bool "Allow modules signed with certs stored in UEFI"
|
||||
+ depends on MODULE_SIG && SYSTEM_BLACKLIST_KEYRING && EFI
|
||||
+ select EFI_SIGNATURE_LIST_PARSER
|
||||
diff --git a/certs/Kconfig b/certs/Kconfig
|
||||
index 630ae09..edf9f75 100644
|
||||
--- a/certs/Kconfig
|
||||
+++ b/certs/Kconfig
|
||||
@@ -90,4 +90,20 @@ config EFI_SIGNATURE_LIST_PARSER
|
||||
This option provides support for parsing EFI signature lists for
|
||||
X.509 certificates and turning them into keys.
|
||||
|
||||
+config LOAD_UEFI_KEYS
|
||||
+ bool "Load certs and blacklist from UEFI db for module checking"
|
||||
+ depends on SYSTEM_BLACKLIST_KEYRING
|
||||
+ depends on SECONDARY_TRUSTED_KEYRING
|
||||
+ depends on EFI
|
||||
+ depends on EFI_SIGNATURE_LIST_PARSER
|
||||
+ help
|
||||
+ This will import certificates stored in UEFI and allow modules
|
||||
+ signed with those to be loaded. It will also disallow loading
|
||||
+ of modules stored in the UEFI dbx variable.
|
||||
+ If the kernel is booted in secure boot mode, this option will cause
|
||||
+ the kernel to load the certificates from the UEFI db and MokListRT
|
||||
+ into the secondary trusted keyring. It will also load any X.509
|
||||
+ SHA256 hashes in the dbx list into the blacklist.
|
||||
+
|
||||
choice
|
||||
prompt "Which hash algorithm should modules be signed with?"
|
||||
depends on MODULE_SIG
|
||||
diff --git a/kernel/Makefile b/kernel/Makefile
|
||||
index eb26e12c6c2a..e0c2268cb97e 100644
|
||||
--- a/kernel/Makefile
|
||||
+++ b/kernel/Makefile
|
||||
@@ -57,6 +57,7 @@ endif
|
||||
obj-$(CONFIG_UID16) += uid16.o
|
||||
obj-$(CONFIG_MODULES) += module.o
|
||||
obj-$(CONFIG_MODULE_SIG) += module_signing.o
|
||||
+obj-$(CONFIG_MODULE_SIG_UEFI) += modsign_uefi.o
|
||||
obj-$(CONFIG_KALLSYMS) += kallsyms.o
|
||||
obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
|
||||
obj-$(CONFIG_KEXEC_CORE) += kexec_core.o
|
||||
@@ -113,6 +114,8 @@ obj-$(CONFIG_MEMBARRIER) += membarrier.o
|
||||
|
||||
obj-$(CONFIG_HAS_IOMEM) += memremap.o
|
||||
|
||||
+$(obj)/modsign_uefi.o: KBUILD_CFLAGS += -fshort-wchar
|
||||
+ The effect of this is that, if the kernel is booted in secure boot
|
||||
+ mode, modules signed with UEFI-stored keys will be permitted to be
|
||||
+ loaded and keys that match the blacklist will be rejected.
|
||||
+
|
||||
$(obj)/configs.o: $(obj)/config_data.h
|
||||
|
||||
targets += config_data.gz
|
||||
diff --git a/kernel/modsign_uefi.c b/kernel/modsign_uefi.c
|
||||
endmenu
|
||||
diff --git a/certs/Makefile b/certs/Makefile
|
||||
index 738151a..a5e057a 100644
|
||||
--- a/certs/Makefile
|
||||
+++ b/certs/Makefile
|
||||
@@ -11,6 +11,10 @@ obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
|
||||
endif
|
||||
obj-$(CONFIG_EFI_SIGNATURE_LIST_PARSER) += efi_parser.o
|
||||
|
||||
+obj-$(CONFIG_LOAD_UEFI_KEYS) += load_uefi.o
|
||||
+$(obj)/load_uefi.o: KBUILD_CFLAGS += -fshort-wchar
|
||||
+
|
||||
+
|
||||
ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
|
||||
|
||||
$(eval $(call config_filename,SYSTEM_TRUSTED_KEYS))
|
||||
diff --git a/certs/load_uefi.c b/certs/load_uefi.c
|
||||
new file mode 100644
|
||||
index 000000000000..fe4a6f2bf10a
|
||||
index 0000000..b44e464
|
||||
--- /dev/null
|
||||
+++ b/kernel/modsign_uefi.c
|
||||
@@ -0,0 +1,99 @@
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -0,0 +1,168 @@
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/sched.h>
|
||||
+#include <linux/cred.h>
|
||||
|
@ -117,14 +81,22 @@ index 000000000000..fe4a6f2bf10a
|
|||
+#include <linux/slab.h>
|
||||
+#include <keys/asymmetric-type.h>
|
||||
+#include <keys/system_keyring.h>
|
||||
+#include "module-internal.h"
|
||||
+#include "internal.h"
|
||||
+
|
||||
+static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, unsigned long *size)
|
||||
+static __initdata efi_guid_t efi_cert_x509_guid = EFI_CERT_X509_GUID;
|
||||
+static __initdata efi_guid_t efi_cert_x509_sha256_guid = EFI_CERT_X509_SHA256_GUID;
|
||||
+static __initdata efi_guid_t efi_cert_sha256_guid = EFI_CERT_SHA256_GUID;
|
||||
+
|
||||
+/*
|
||||
+ * Get a certificate list blob from the named EFI variable.
|
||||
+ */
|
||||
+static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
+ unsigned long *size)
|
||||
+{
|
||||
+ efi_status_t status;
|
||||
+ unsigned long lsize = 4;
|
||||
+ unsigned long tmpdb[4];
|
||||
+ void *db = NULL;
|
||||
+ void *db;
|
||||
+
|
||||
+ status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
|
||||
+ if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
|
@ -135,23 +107,89 @@ index 000000000000..fe4a6f2bf10a
|
|||
+ db = kmalloc(lsize, GFP_KERNEL);
|
||||
+ if (!db) {
|
||||
+ pr_err("Couldn't allocate memory for uefi cert list\n");
|
||||
+ goto out;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ status = efi.get_variable(name, guid, NULL, &lsize, db);
|
||||
+ if (status != EFI_SUCCESS) {
|
||||
+ kfree(db);
|
||||
+ db = NULL;
|
||||
+ pr_err("Error reading db var: 0x%lx\n", status);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+out:
|
||||
+
|
||||
+ *size = lsize;
|
||||
+ return db;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * * Load the certs contained in the UEFI databases
|
||||
+ * */
|
||||
+ * Blacklist an X509 TBS hash.
|
||||
+ */
|
||||
+static __init void uefi_blacklist_x509_tbs(const char *source,
|
||||
+ const void *data, size_t len)
|
||||
+{
|
||||
+ char *hash, *p;
|
||||
+
|
||||
+ hash = kmalloc(4 + len * 2 + 1, GFP_KERNEL);
|
||||
+ if (!hash)
|
||||
+ return;
|
||||
+ p = memcpy(hash, "tbs:", 4);
|
||||
+ p += 4;
|
||||
+ bin2hex(p, data, len);
|
||||
+ p += len * 2;
|
||||
+ *p = 0;
|
||||
+
|
||||
+ mark_hash_blacklisted(hash);
|
||||
+ kfree(hash);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Blacklist the hash of an executable.
|
||||
+ */
|
||||
+static __init void uefi_blacklist_binary(const char *source,
|
||||
+ const void *data, size_t len)
|
||||
+{
|
||||
+ char *hash, *p;
|
||||
+
|
||||
+ hash = kmalloc(4 + len * 2 + 1, GFP_KERNEL);
|
||||
+ if (!hash)
|
||||
+ return;
|
||||
+ p = memcpy(hash, "bin:", 4);
|
||||
+ p += 4;
|
||||
+ bin2hex(p, data, len);
|
||||
+ p += len * 2;
|
||||
+ *p = 0;
|
||||
+
|
||||
+ mark_hash_blacklisted(hash);
|
||||
+ kfree(hash);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Return the appropriate handler for particular signature list types found in
|
||||
+ * the UEFI db and MokListRT tables.
|
||||
+ */
|
||||
+static __init efi_element_handler_t get_handler_for_db(const efi_guid_t *sig_type)
|
||||
+{
|
||||
+ if (efi_guidcmp(*sig_type, efi_cert_x509_guid) == 0)
|
||||
+ return add_trusted_secondary_key;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Return the appropriate handler for particular signature list types found in
|
||||
+ * the UEFI dbx and MokListXRT tables.
|
||||
+ */
|
||||
+static __init efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type)
|
||||
+{
|
||||
+ if (efi_guidcmp(*sig_type, efi_cert_x509_sha256_guid) == 0)
|
||||
+ return uefi_blacklist_x509_tbs;
|
||||
+ if (efi_guidcmp(*sig_type, efi_cert_sha256_guid) == 0)
|
||||
+ return uefi_blacklist_binary;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Load the certs contained in the UEFI databases
|
||||
+ */
|
||||
+static int __init load_uefi_certs(void)
|
||||
+{
|
||||
+ efi_guid_t secure_var = EFI_IMAGE_SECURITY_DATABASE_GUID;
|
||||
|
@ -159,17 +197,9 @@ index 000000000000..fe4a6f2bf10a
|
|||
+ void *db = NULL, *dbx = NULL, *mok = NULL;
|
||||
+ unsigned long dbsize = 0, dbxsize = 0, moksize = 0;
|
||||
+ int rc = 0;
|
||||
+ struct key *keyring = NULL;
|
||||
+
|
||||
+ /* Check if SB is enabled and just return if not */
|
||||
+ if (!efi_enabled(EFI_SECURE_BOOT))
|
||||
+ return 0;
|
||||
+
|
||||
+ keyring = get_system_keyring();
|
||||
+ if (!keyring) {
|
||||
+ pr_err("MODSIGN: Couldn't get system keyring\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ if (!efi.get_variable)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Get db, MokListRT, and dbx. They might not exist, so it isn't
|
||||
+ * an error if we can't get them.
|
||||
|
@ -178,7 +208,8 @@ index 000000000000..fe4a6f2bf10a
|
|||
+ if (!db) {
|
||||
+ pr_err("MODSIGN: Couldn't get UEFI db list\n");
|
||||
+ } else {
|
||||
+ rc = parse_efi_signature_list(db, dbsize, keyring);
|
||||
+ rc = parse_efi_signature_list("UEFI:db",
|
||||
+ db, dbsize, get_handler_for_db);
|
||||
+ if (rc)
|
||||
+ pr_err("Couldn't parse db signatures: %d\n", rc);
|
||||
+ kfree(db);
|
||||
|
@ -188,7 +219,8 @@ index 000000000000..fe4a6f2bf10a
|
|||
+ if (!mok) {
|
||||
+ pr_info("MODSIGN: Couldn't get UEFI MokListRT\n");
|
||||
+ } else {
|
||||
+ rc = parse_efi_signature_list(mok, moksize, keyring);
|
||||
+ rc = parse_efi_signature_list("UEFI:MokListRT",
|
||||
+ mok, moksize, get_handler_for_db);
|
||||
+ if (rc)
|
||||
+ pr_err("Couldn't parse MokListRT signatures: %d\n", rc);
|
||||
+ kfree(mok);
|
||||
|
@ -198,8 +230,9 @@ index 000000000000..fe4a6f2bf10a
|
|||
+ if (!dbx) {
|
||||
+ pr_info("MODSIGN: Couldn't get UEFI dbx list\n");
|
||||
+ } else {
|
||||
+ rc = parse_efi_signature_list(dbx, dbxsize,
|
||||
+ system_blacklist_keyring);
|
||||
+ rc = parse_efi_signature_list("UEFI:dbx",
|
||||
+ dbx, dbxsize,
|
||||
+ get_handler_for_dbx);
|
||||
+ if (rc)
|
||||
+ pr_err("Couldn't parse dbx signatures: %d\n", rc);
|
||||
+ kfree(dbx);
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
From 9d2e5c61d5adcf7911f67ed44a1b0ff881f175bb Mon Sep 17 00:00:00 2001
|
||||
From 9f1958a0cc911e1f79b2733ee5029dbd819ff328 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Date: Thu, 3 Oct 2013 10:14:23 -0400
|
||||
Subject: [PATCH 19/20] MODSIGN: Support not importing certs from db
|
||||
Date: Fri, 5 May 2017 08:21:59 +0100
|
||||
Subject: [PATCH 4/4] MODSIGN: Allow the "db" UEFI variable to be suppressed
|
||||
|
||||
If a user tells shim to not use the certs/hashes in the UEFI db variable
|
||||
for verification purposes, shim will set a UEFI variable called MokIgnoreDB.
|
||||
Have the uefi import code look for this and not import things from the db
|
||||
variable.
|
||||
for verification purposes, shim will set a UEFI variable called
|
||||
MokIgnoreDB. Have the uefi import code look for this and ignore the db
|
||||
variable if it is found.
|
||||
|
||||
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
kernel/modsign_uefi.c | 40 +++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 31 insertions(+), 9 deletions(-)
|
||||
certs/load_uefi.c | 44 ++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 34 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/kernel/modsign_uefi.c b/kernel/modsign_uefi.c
|
||||
index fe4a6f2bf10a..a41da14b1ffd 100644
|
||||
--- a/kernel/modsign_uefi.c
|
||||
+++ b/kernel/modsign_uefi.c
|
||||
@@ -8,6 +8,23 @@
|
||||
#include <keys/system_keyring.h>
|
||||
#include "module-internal.h"
|
||||
|
||||
+static __init int check_ignore_db(void)
|
||||
diff --git a/certs/load_uefi.c b/certs/load_uefi.c
|
||||
index b44e464..3d88459 100644
|
||||
--- a/certs/load_uefi.c
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -13,6 +13,26 @@ static __initdata efi_guid_t efi_cert_x509_sha256_guid = EFI_CERT_X509_SHA256_GU
|
||||
static __initdata efi_guid_t efi_cert_sha256_guid = EFI_CERT_SHA256_GUID;
|
||||
|
||||
/*
|
||||
+ * Look to see if a UEFI variable called MokIgnoreDB exists and return true if
|
||||
+ * it does.
|
||||
+ *
|
||||
+ * This UEFI variable is set by the shim if a user tells the shim to not use
|
||||
+ * the certs/hashes in the UEFI db variable for verification purposes. If it
|
||||
+ * is set, we should ignore the db variable also and the true return indicates
|
||||
+ * this.
|
||||
+ */
|
||||
+static __init bool uefi_check_ignore_db(void)
|
||||
+{
|
||||
+ efi_status_t status;
|
||||
+ unsigned int db = 0;
|
||||
+ unsigned long size = sizeof(db);
|
||||
+ efi_guid_t guid = EFI_SHIM_LOCK_GUID;
|
||||
+
|
||||
+ /* Check and see if the MokIgnoreDB variable exists. If that fails
|
||||
+ * then we don't ignore DB. If it succeeds, we do.
|
||||
+ */
|
||||
+ status = efi.get_variable(L"MokIgnoreDB", &guid, NULL, &size, &db);
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+ return status == EFI_SUCCESS;
|
||||
+}
|
||||
+
|
||||
static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, unsigned long *size)
|
||||
+/*
|
||||
* Get a certificate list blob from the named EFI variable.
|
||||
*/
|
||||
static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
@@ -113,7 +133,9 @@ static __init efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_ty
|
||||
}
|
||||
|
||||
/*
|
||||
- * Load the certs contained in the UEFI databases
|
||||
+ * Load the certs contained in the UEFI databases into the secondary trusted
|
||||
+ * keyring and the UEFI blacklisted X.509 cert SHA256 hashes into the blacklist
|
||||
+ * keyring.
|
||||
*/
|
||||
static int __init load_uefi_certs(void)
|
||||
{
|
||||
efi_status_t status;
|
||||
@@ -47,7 +64,7 @@ static int __init load_uefi_certs(void)
|
||||
efi_guid_t mok_var = EFI_SHIM_LOCK_GUID;
|
||||
void *db = NULL, *dbx = NULL, *mok = NULL;
|
||||
unsigned long dbsize = 0, dbxsize = 0, moksize = 0;
|
||||
- int rc = 0;
|
||||
+ int ignore_db, rc = 0;
|
||||
struct key *keyring = NULL;
|
||||
|
||||
/* Check if SB is enabled and just return if not */
|
||||
@@ -60,17 +77,22 @@ static int __init load_uefi_certs(void)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ /* See if the user has setup Ignore DB mode */
|
||||
+ ignore_db = check_ignore_db();
|
||||
+
|
||||
@@ -129,15 +151,17 @@ static int __init load_uefi_certs(void)
|
||||
/* Get db, MokListRT, and dbx. They might not exist, so it isn't
|
||||
* an error if we can't get them.
|
||||
*/
|
||||
|
@ -64,22 +64,24 @@ index fe4a6f2bf10a..a41da14b1ffd 100644
|
|||
- if (!db) {
|
||||
- pr_err("MODSIGN: Couldn't get UEFI db list\n");
|
||||
- } else {
|
||||
- rc = parse_efi_signature_list(db, dbsize, keyring);
|
||||
- rc = parse_efi_signature_list("UEFI:db",
|
||||
- db, dbsize, get_handler_for_db);
|
||||
- if (rc)
|
||||
- pr_err("Couldn't parse db signatures: %d\n", rc);
|
||||
- kfree(db);
|
||||
+ if (!ignore_db) {
|
||||
+ if (!uefi_check_ignore_db()) {
|
||||
+ db = get_cert_list(L"db", &secure_var, &dbsize);
|
||||
+ if (!db) {
|
||||
+ pr_err("MODSIGN: Couldn't get UEFI db list\n");
|
||||
+ } else {
|
||||
+ rc = parse_efi_signature_list(db, dbsize, keyring);
|
||||
+ rc = parse_efi_signature_list("UEFI:db",
|
||||
+ db, dbsize, get_handler_for_db);
|
||||
+ if (rc)
|
||||
+ pr_err("Couldn't parse db signatures: %d\n", rc);
|
||||
+ kfree(db);
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
mok = get_cert_list(L"MokListRT", &mok_var, &moksize);
|
||||
--
|
||||
2.9.3
|
||||
|
|
52
README.txt
52
README.txt
|
@ -31,29 +31,30 @@ by make verrel
|
|||
config heirarchy.
|
||||
-----------------
|
||||
Instead of having to maintain a config file for every arch variant we build on,
|
||||
the kernel spec uses a nested system of configs. Each option CONFIG_FOO is
|
||||
represented by a single file named CONFIG_FOO which contains the state (=y, =m,
|
||||
=n). These options are collected in the folder baseconfig. Architecture specifi
|
||||
options are set in nested folders. An option set in a nested folder will
|
||||
override the same option set in one of the higher levels.
|
||||
the kernel spec uses a nested system of configs. At the top level, is
|
||||
config-generic. Add options here that should be present in every possible
|
||||
config on all architectures.
|
||||
|
||||
The individual CONFIG_FOO files only exist in the pkg-git repository. The RPM
|
||||
contains kernel-foo.config files which are the result of combining all the
|
||||
CONFIG_FOO files. The files are combined by running build_configs.sh. This
|
||||
script _must_ be run each time one of the options is changed.
|
||||
Beneath this are per-arch overrides. For example config-x86-generic add
|
||||
additional x86 specific options, and also _override_ any options that were
|
||||
set in config-generic.
|
||||
|
||||
Example flow:
|
||||
The heirarchy looks like this..
|
||||
|
||||
# Enable the option CONFIG_ABC123 as a module for all arches
|
||||
echo "CONFIG_ABC123=m" > baseconfig/CONFIG_ABC1234
|
||||
# enable the option CONFIG_XYZ321 for only x86
|
||||
echo "# CONFIG_XYZ321 is not set" > baseconfig/CONFIG_XYZ321
|
||||
echo "CONFIG_XYZ321=m" > baseconfig/x86/CONFIG_XYZ321
|
||||
# regenerate the combined config files
|
||||
./build_configs.sh
|
||||
config-generic
|
||||
|
|
||||
config-x86-generic
|
||||
| |
|
||||
config-x86-32-generic config-x86-64-generic
|
||||
|
||||
An option set in a lower level will override the same option set in one
|
||||
of the higher levels.
|
||||
|
||||
|
||||
There exist two additional overrides, config-debug, and config-nodebug,
|
||||
which override -generic, and the per-arch overrides. It is documented
|
||||
further below.
|
||||
|
||||
The file config_generation gives a listing of what folders go into each
|
||||
config file generated.
|
||||
|
||||
debug options.
|
||||
--------------
|
||||
|
@ -68,11 +69,14 @@ typically been run already, which sets up the following..
|
|||
If we are building for rawhide, 'make debug' has been run, which changes
|
||||
the status quo to:
|
||||
- We only build one kernel 'kernel'
|
||||
- The debug options are always turned on.
|
||||
- The debug options from 'config-debug' are always turned on.
|
||||
This is done to increase coverage testing, as not many people actually
|
||||
run kernel-debug.
|
||||
|
||||
The debug options are managed in a separate heierarchy under debugconfig. This
|
||||
works in a similar manner to baseconfig. More deeply nested folders, again,
|
||||
override options. The file config_generation gives a listing of what folders
|
||||
go into each config file generated.
|
||||
To add new debug options, add an option to _both_ config-debug and config-nodebug,
|
||||
and also new stanzas to the Makefile 'debug' and 'release' targets.
|
||||
|
||||
Sometimes debug options get added to config-generic, or per-arch overrides
|
||||
instead of config-[no]debug. In this instance, the options should have no
|
||||
discernable performance impact, otherwise they belong in the debug files.
|
||||
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
From 5744a0927df22f46e4b7f134b3dfb405fdfcf6ce Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Cline <jeremy@jcline.org>
|
||||
Date: Wed, 2 May 2018 15:16:29 -0400
|
||||
Subject: [PATCH 1/2] Revert "random: use a different mixing algorithm for
|
||||
add_device_randomness()"
|
||||
|
||||
This reverts commit 89b59f050347d376c2ace8b1ceb908a218cfdc2e.
|
||||
|
||||
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
|
||||
---
|
||||
drivers/char/random.c | 55 ++++---------------------------------------
|
||||
1 file changed, 4 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/drivers/char/random.c b/drivers/char/random.c
|
||||
index 8f4e11842c60..aa5b04af86c6 100644
|
||||
--- a/drivers/char/random.c
|
||||
+++ b/drivers/char/random.c
|
||||
@@ -831,10 +831,6 @@ static void numa_crng_init(void)
|
||||
static void numa_crng_init(void) {}
|
||||
#endif
|
||||
|
||||
-/*
|
||||
- * crng_fast_load() can be called by code in the interrupt service
|
||||
- * path. So we can't afford to dilly-dally.
|
||||
- */
|
||||
static int crng_fast_load(const char *cp, size_t len)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -861,51 +857,6 @@ static int crng_fast_load(const char *cp, size_t len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * crng_slow_load() is called by add_device_randomness, which has two
|
||||
- * attributes. (1) We can't trust the buffer passed to it is
|
||||
- * guaranteed to be unpredictable (so it might not have any entropy at
|
||||
- * all), and (2) it doesn't have the performance constraints of
|
||||
- * crng_fast_load().
|
||||
- *
|
||||
- * So we do something more comprehensive which is guaranteed to touch
|
||||
- * all of the primary_crng's state, and which uses a LFSR with a
|
||||
- * period of 255 as part of the mixing algorithm. Finally, we do
|
||||
- * *not* advance crng_init_cnt since buffer we may get may be something
|
||||
- * like a fixed DMI table (for example), which might very well be
|
||||
- * unique to the machine, but is otherwise unvarying.
|
||||
- */
|
||||
-static int crng_slow_load(const char *cp, size_t len)
|
||||
-{
|
||||
- unsigned long flags;
|
||||
- static unsigned char lfsr = 1;
|
||||
- unsigned char tmp;
|
||||
- unsigned i, max = CHACHA20_KEY_SIZE;
|
||||
- const char * src_buf = cp;
|
||||
- char * dest_buf = (char *) &primary_crng.state[4];
|
||||
-
|
||||
- if (!spin_trylock_irqsave(&primary_crng.lock, flags))
|
||||
- return 0;
|
||||
- if (crng_init != 0) {
|
||||
- spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
- return 0;
|
||||
- }
|
||||
- if (len > max)
|
||||
- max = len;
|
||||
-
|
||||
- for (i = 0; i < max ; i++) {
|
||||
- tmp = lfsr;
|
||||
- lfsr >>= 1;
|
||||
- if (tmp & 1)
|
||||
- lfsr ^= 0xE1;
|
||||
- tmp = dest_buf[i % CHACHA20_KEY_SIZE];
|
||||
- dest_buf[i % CHACHA20_KEY_SIZE] ^= src_buf[i % len] ^ lfsr;
|
||||
- lfsr += (tmp << 3) | (tmp >> 5);
|
||||
- }
|
||||
- spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -1089,8 +1040,10 @@ void add_device_randomness(const void *buf, unsigned int size)
|
||||
unsigned long time = random_get_entropy() ^ jiffies;
|
||||
unsigned long flags;
|
||||
|
||||
- if (!crng_ready() && size)
|
||||
- crng_slow_load(buf, size);
|
||||
+ if (!crng_ready()) {
|
||||
+ crng_fast_load(buf, size);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
trace_add_device_randomness(size, _RET_IP_);
|
||||
spin_lock_irqsave(&input_pool.lock, flags);
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From e1b1b5b62740b0e6ea8258a4eb81b2a336538fed Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Cline <jeremy@jcline.org>
|
||||
Date: Wed, 2 May 2018 15:18:03 -0400
|
||||
Subject: [PATCH 2/2] Revert "random: fix crng_ready() test"
|
||||
|
||||
This reverts commit cd8d7a5778a4abf76ee8fe8f1bfcf78976029f8d.
|
||||
|
||||
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
|
||||
---
|
||||
drivers/char/random.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/char/random.c b/drivers/char/random.c
|
||||
index aa5b04af86c6..ef05cc685b74 100644
|
||||
--- a/drivers/char/random.c
|
||||
+++ b/drivers/char/random.c
|
||||
@@ -428,7 +428,7 @@ struct crng_state primary_crng = {
|
||||
* its value (from 0->1->2).
|
||||
*/
|
||||
static int crng_init = 0;
|
||||
-#define crng_ready() (likely(crng_init > 1))
|
||||
+#define crng_ready() (likely(crng_init > 0))
|
||||
static int crng_init_cnt = 0;
|
||||
static unsigned long crng_global_init_time = 0;
|
||||
#define CRNG_INIT_CNT_THRESH (2*CHACHA20_KEY_SIZE)
|
||||
@@ -838,7 +838,7 @@ static int crng_fast_load(const char *cp, size_t len)
|
||||
|
||||
if (!spin_trylock_irqsave(&primary_crng.lock, flags))
|
||||
return 0;
|
||||
- if (crng_init != 0) {
|
||||
+ if (crng_ready()) {
|
||||
spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
return 0;
|
||||
}
|
||||
@@ -913,7 +913,7 @@ static void _extract_crng(struct crng_state *crng,
|
||||
{
|
||||
unsigned long v, flags;
|
||||
|
||||
- if (crng_ready() &&
|
||||
+ if (crng_init > 1 &&
|
||||
(time_after(crng_global_init_time, crng->init_time) ||
|
||||
time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL)))
|
||||
crng_reseed(crng, crng == &primary_crng ? &input_pool : NULL);
|
||||
@@ -1200,7 +1200,7 @@ void add_interrupt_randomness(int irq, int irq_flags)
|
||||
fast_mix(fast_pool);
|
||||
add_interrupt_bench(cycles);
|
||||
|
||||
- if (unlikely(crng_init == 0)) {
|
||||
+ if (!crng_ready()) {
|
||||
if ((fast_pool->count >= 64) &&
|
||||
crng_fast_load((char *) fast_pool->pool,
|
||||
sizeof(fast_pool->pool))) {
|
||||
@@ -2269,7 +2269,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
|
||||
{
|
||||
struct entropy_store *poolp = &input_pool;
|
||||
|
||||
- if (unlikely(crng_init == 0)) {
|
||||
+ if (!crng_ready()) {
|
||||
crng_fast_load(buffer, count);
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,424 @@
|
|||
From bb86b4b0bbae12341df16fedf51aeda480364fbf Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Thu, 19 Apr 2018 19:35:58 +0100
|
||||
Subject: [PATCH] ARM: dts: Add am335x-pocketbeagle
|
||||
|
||||
PocketBeagle is an ultra-tiny-yet-complete open-source USB-key-fob computer.
|
||||
|
||||
This board family can be indentified by the A335PBGL in the at24 eeprom:
|
||||
A2: [aa 55 33 ee 41 33 33 35 50 42 47 4c 30 30 41 32 |.U3.A335PBGL00A2|]
|
||||
|
||||
http://beagleboard.org/pocket
|
||||
https://github.com/beagleboard/pocketbeagle
|
||||
|
||||
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
|
||||
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
||||
CC: Tony Lindgren <tony@atomide.com>
|
||||
CC: Jason Kridner <jkridner@beagleboard.org>
|
||||
CC: Drew Fustini <drew@beagleboard.org>
|
||||
CC: Peter Robinson <pbrobinson@redhat.com>
|
||||
---
|
||||
Changes in v3:
|
||||
- Fix: Board eeprom in subject message. (accidently copied PocketBone)
|
||||
Changes in v2:
|
||||
- Use SPDX tags.
|
||||
- Use eeprom@50, remove repeated node and fix and remove '_' to fix node_name_chars_strict Warning
|
||||
- Fix: PocketBeagle Name in Subject (not PocketBeagle Blue)
|
||||
- Fix: leds remove '_' to fix node_name_chars_strict warning
|
||||
- Fix: node_name_chars_strict pinmux_*_pins label's.
|
||||
---
|
||||
arch/arm/boot/dts/Makefile | 1 +
|
||||
arch/arm/boot/dts/am335x-osd335x-common.dtsi | 124 ++++++++++
|
||||
arch/arm/boot/dts/am335x-pocketbeagle.dts | 237 +++++++++++++++++++
|
||||
3 files changed, 362 insertions(+)
|
||||
create mode 100644 arch/arm/boot/dts/am335x-osd335x-common.dtsi
|
||||
create mode 100644 arch/arm/boot/dts/am335x-pocketbeagle.dts
|
||||
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index ade7a38543dc..a632bbef01f5 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -675,6 +675,7 @@ dtb-$(CONFIG_SOC_AM33XX) += \
|
||||
am335x-nano.dtb \
|
||||
am335x-pepper.dtb \
|
||||
am335x-phycore-rdk.dtb \
|
||||
+ am335x-pocketbeagle.dtb \
|
||||
am335x-shc.dtb \
|
||||
am335x-sbc-t335.dtb \
|
||||
am335x-sl50.dtb \
|
||||
diff --git a/arch/arm/boot/dts/am335x-osd335x-common.dtsi b/arch/arm/boot/dts/am335x-osd335x-common.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..f8ff473f94f0
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/am335x-osd335x-common.dtsi
|
||||
@@ -0,0 +1,124 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
|
||||
+ *
|
||||
+ * Author: Robert Nelson <robertcnelson@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+/ {
|
||||
+ cpus {
|
||||
+ cpu@0 {
|
||||
+ cpu0-supply = <&dcdc2_reg>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ memory@80000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x80000000 0x20000000>; /* 512 MB */
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu0_opp_table {
|
||||
+ /*
|
||||
+ * Octavo Systems:
|
||||
+ * The EFUSE_SMA register is not programmed for any of the AM335x wafers
|
||||
+ * we get and we are not programming them during our production test.
|
||||
+ * Therefore, from a DEVICE_ID revision point of view, the silicon looks
|
||||
+ * like it is Revision 2.1. However, from an EFUSE_SMA point of view for
|
||||
+ * the HW OPP table, the silicon looks like it is Revision 1.0 (ie the
|
||||
+ * EFUSE_SMA register reads as all zeros).
|
||||
+ */
|
||||
+ oppnitro-1000000000 {
|
||||
+ opp-supported-hw = <0x06 0x0100>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&am33xx_pinmux {
|
||||
+ i2c0_pins: pinmux-i2c0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* (C17) I2C0_SDA.I2C0_SDA */
|
||||
+ AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* (C16) I2C0_SCL.I2C0_SCL */
|
||||
+ >;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2c0_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+ clock-frequency = <400000>;
|
||||
+
|
||||
+ tps: tps@24 {
|
||||
+ reg = <0x24>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+/include/ "tps65217.dtsi"
|
||||
+
|
||||
+&tps {
|
||||
+ interrupts = <7>; /* NMI */
|
||||
+ interrupt-parent = <&intc>;
|
||||
+
|
||||
+ ti,pmic-shutdown-controller;
|
||||
+
|
||||
+ pwrbutton {
|
||||
+ interrupts = <2>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ regulators {
|
||||
+ dcdc1_reg: regulator@0 {
|
||||
+ regulator-name = "vdds_dpr";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ dcdc2_reg: regulator@1 {
|
||||
+ /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
|
||||
+ regulator-name = "vdd_mpu";
|
||||
+ regulator-min-microvolt = <925000>;
|
||||
+ regulator-max-microvolt = <1351500>;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ dcdc3_reg: regulator@2 {
|
||||
+ /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
|
||||
+ regulator-name = "vdd_core";
|
||||
+ regulator-min-microvolt = <925000>;
|
||||
+ regulator-max-microvolt = <1150000>;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo1_reg: regulator@3 {
|
||||
+ regulator-name = "vio,vrtc,vdds";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo2_reg: regulator@4 {
|
||||
+ regulator-name = "vdd_3v3aux";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo3_reg: regulator@5 {
|
||||
+ regulator-name = "vdd_1v8";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo4_reg: regulator@6 {
|
||||
+ regulator-name = "vdd_3v3a";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&aes {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sham {
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/am335x-pocketbeagle.dts b/arch/arm/boot/dts/am335x-pocketbeagle.dts
|
||||
new file mode 100644
|
||||
index 000000000000..62fe5cab9fae
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/am335x-pocketbeagle.dts
|
||||
@@ -0,0 +1,237 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
|
||||
+ *
|
||||
+ * Author: Robert Nelson <robertcnelson@gmail.com>
|
||||
+ */
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "am33xx.dtsi"
|
||||
+#include "am335x-osd335x-common.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "TI AM335x PocketBeagle";
|
||||
+ compatible = "ti,am335x-pocketbeagle", "ti,am335x-bone", "ti,am33xx";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&usr_leds_pins>;
|
||||
+
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ usr0 {
|
||||
+ label = "beaglebone:green:usr0";
|
||||
+ gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "heartbeat";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ usr1 {
|
||||
+ label = "beaglebone:green:usr1";
|
||||
+ gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "mmc0";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ usr2 {
|
||||
+ label = "beaglebone:green:usr2";
|
||||
+ gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "cpu0";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ usr3 {
|
||||
+ label = "beaglebone:green:usr3";
|
||||
+ gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vmmcsd_fixed: fixedregulator0 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vmmcsd_fixed";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&am33xx_pinmux {
|
||||
+ i2c2_pins: pinmux-i2c2-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3) /* (D17) uart1_rtsn.I2C2_SCL */
|
||||
+ AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3) /* (D18) uart1_ctsn.I2C2_SDA */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ ehrpwm0_pins: pinmux-ehrpwm0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* (A13) mcasp0_aclkx.ehrpwm0A */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ ehrpwm1_pins: pinmux-ehrpwm1-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* (U14) gpmc_a2.ehrpwm1A */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ mmc0_pins: pinmux-mmc0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* (C15) spi0_cs1.gpio0[6] */
|
||||
+ AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* (G16) mmc0_dat0.mmc0_dat0 */
|
||||
+ AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* (G15) mmc0_dat1.mmc0_dat1 */
|
||||
+ AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* (F18) mmc0_dat2.mmc0_dat2 */
|
||||
+ AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* (F17) mmc0_dat3.mmc0_dat3 */
|
||||
+ AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* (G18) mmc0_cmd.mmc0_cmd */
|
||||
+ AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* (G17) mmc0_clk.mmc0_clk */
|
||||
+ AM33XX_IOPAD(0x9a0, PIN_INPUT | MUX_MODE4) /* (B12) mcasp0_aclkr.mmc0_sdwp */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ spi0_pins: pinmux-spi0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0) /* (A17) spi0_sclk.spi0_sclk */
|
||||
+ AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0) /* (B17) spi0_d0.spi0_d0 */
|
||||
+ AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* (B16) spi0_d1.spi0_d1 */
|
||||
+ AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0) /* (A16) spi0_cs0.spi0_cs0 */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ spi1_pins: pinmux-spi1-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x964, PIN_INPUT_PULLUP | MUX_MODE4) /* (C18) eCAP0_in_PWM0_out.spi1_sclk */
|
||||
+ AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE4) /* (E18) uart0_ctsn.spi1_d0 */
|
||||
+ AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE4) /* (E17) uart0_rtsn.spi1_d1 */
|
||||
+ AM33XX_IOPAD(0x9b0, PIN_INPUT_PULLUP | MUX_MODE4) /* (A15) xdma_event_intr0.spi1_cs1 */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ usr_leds_pins: pinmux-usr-leds-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7) /* (V15) gpmc_a5.gpio1[21] - USR_LED_0 */
|
||||
+ AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7) /* (U15) gpmc_a6.gpio1[22] - USR_LED_1 */
|
||||
+ AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7) /* (T15) gpmc_a7.gpio1[23] - USR_LED_2 */
|
||||
+ AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7) /* (V16) gpmc_a8.gpio1[24] - USR_LED_3 */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ uart0_pins: pinmux-uart0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* (E15) uart0_rxd.uart0_rxd */
|
||||
+ AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (E16) uart0_txd.uart0_txd */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ uart4_pins: pinmux-uart4-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6) /* (T17) gpmc_wait0.uart4_rxd */
|
||||
+ AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* (U17) gpmc_wpn.uart4_txd */
|
||||
+ >;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&epwmss0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ehrpwm0 {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ehrpwm0_pins>;
|
||||
+};
|
||||
+
|
||||
+&epwmss1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ehrpwm1 {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ehrpwm1_pins>;
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ eeprom: eeprom@50 {
|
||||
+ compatible = "atmel,24c256";
|
||||
+ reg = <0x50>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2c2_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+ clock-frequency = <400000>;
|
||||
+};
|
||||
+
|
||||
+&mmc1 {
|
||||
+ status = "okay";
|
||||
+ vmmc-supply = <&vmmcsd_fixed>;
|
||||
+ bus-width = <4>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc0_pins>;
|
||||
+ cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
|
||||
+};
|
||||
+
|
||||
+&rtc {
|
||||
+ system-power-controller;
|
||||
+};
|
||||
+
|
||||
+&tscadc {
|
||||
+ status = "okay";
|
||||
+ adc {
|
||||
+ ti,adc-channels = <0 1 2 3 4 5 6 7>;
|
||||
+ ti,chan-step-avg = <16 16 16 16 16 16 16 16>;
|
||||
+ ti,chan-step-opendelay = <0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98>;
|
||||
+ ti,chan-step-sampledelay = <0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart4 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart4_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_ctrl_mod {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb0_phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb0 {
|
||||
+ status = "okay";
|
||||
+ dr_mode = "otg";
|
||||
+};
|
||||
+
|
||||
+&usb1_phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb1 {
|
||||
+ status = "okay";
|
||||
+ dr_mode = "host";
|
||||
+};
|
||||
+
|
||||
+&cppi41dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
From patchwork Thu Jan 18 12:34:18 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: ARM: dts: imx6qdl-udoo: Disable usbh1 to avoid kernel hang
|
||||
From: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
X-Patchwork-Id: 10173115
|
||||
Message-Id: <1516278858-15464-1-git-send-email-fabio.estevam@nxp.com>
|
||||
To: <shawnguo@kernel.org>
|
||||
Cc: maggu2810@gmail.com, peter.chen@nxp.com, mail@maciej.szmigiero.name,
|
||||
Fabio Estevam <fabio.estevam@nxp.com>, linux-arm-kernel@lists.infradead.org
|
||||
Date: Thu, 18 Jan 2018 10:34:18 -0200
|
||||
|
||||
Currently the kernel hangs when USB Host1 is enabled due to the lack of
|
||||
support for controlling the USB hub clock and GPIO reset line.
|
||||
|
||||
Peter Chen has made several attempts to fix this problem, but his series
|
||||
has not been applied yet, so better disable USB host1 for now to avoid
|
||||
the kernel hang.
|
||||
|
||||
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
Acked-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
|
||||
Tested-by: Markus Rathgeb <maggu2810@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/imx6qdl-udoo.dtsi | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
|
||||
index 4161b7d..1f0b9f6 100644
|
||||
--- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi
|
||||
+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
|
||||
@@ -274,7 +274,8 @@
|
||||
pinctrl-0 = <&pinctrl_usbh>;
|
||||
vbus-supply = <®_usb_h1_vbus>;
|
||||
clocks = <&clks IMX6QDL_CLK_CKO>;
|
||||
- status = "okay";
|
||||
+ /* currently USB support causes a kernel hang. Disable it for now */
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&usdhc3 {
|
|
@ -1,902 +0,0 @@
|
|||
From e9e601215d294d473a593641b1ecfd1fa4586a90 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Thu, 6 Apr 2017 13:52:54 +0100
|
||||
Subject: [PATCH 1/4] [RFC,v2,1/4] ARM: dts: imx6qdl: add HummingBoard2 boards
|
||||
|
||||
From: Jon Nettleton <jon@solid-run.com>
|
||||
|
||||
This adds support for the Hummingboard Gate and Edge devices from
|
||||
SolidRun.
|
||||
|
||||
Signed-off-by: Jon Nettleton <jon@solid-run.com>
|
||||
Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
|
||||
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
arch/arm/boot/dts/Makefile | 2 +
|
||||
arch/arm/boot/dts/imx6dl-hummingboard2.dts | 52 +++
|
||||
arch/arm/boot/dts/imx6q-hummingboard2.dts | 60 +++
|
||||
arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi | 543 +++++++++++++++++++++++++++
|
||||
4 files changed, 657 insertions(+)
|
||||
create mode 100644 arch/arm/boot/dts/imx6dl-hummingboard2.dts
|
||||
create mode 100644 arch/arm/boot/dts/imx6q-hummingboard2.dts
|
||||
create mode 100644 arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 011808490fed..ccdff6650541 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -353,6 +353,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
|
||||
imx6dl-gw552x.dtb \
|
||||
imx6dl-gw553x.dtb \
|
||||
imx6dl-hummingboard.dtb \
|
||||
+ imx6dl-hummingboard2.dtb \
|
||||
imx6dl-icore.dtb \
|
||||
imx6dl-icore-rqs.dtb \
|
||||
imx6dl-nit6xlite.dtb \
|
||||
@@ -397,6 +398,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
|
||||
imx6q-gw553x.dtb \
|
||||
imx6q-h100.dtb \
|
||||
imx6q-hummingboard.dtb \
|
||||
+ imx6q-hummingboard2.dtb \
|
||||
imx6q-icore.dtb \
|
||||
imx6q-icore-rqs.dtb \
|
||||
imx6q-marsboard.dtb \
|
||||
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard2.dts b/arch/arm/boot/dts/imx6dl-hummingboard2.dts
|
||||
new file mode 100644
|
||||
index 000000000000..990b5050de5b
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/imx6dl-hummingboard2.dts
|
||||
@@ -0,0 +1,52 @@
|
||||
+/*
|
||||
+ * Device Tree file for SolidRun HummingBoard2
|
||||
+ * Copyright (C) 2015 Rabeeh Khoury <rabeeh@solid-run.com>
|
||||
+ * Based on work by Russell King
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "imx6dl.dtsi"
|
||||
+#include "imx6qdl-hummingboard2.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "SolidRun HummingBoard2 Solo/DualLite";
|
||||
+ compatible = "solidrun,hummingboard2/dl", "fsl,imx6dl";
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/imx6q-hummingboard2.dts b/arch/arm/boot/dts/imx6q-hummingboard2.dts
|
||||
new file mode 100644
|
||||
index 000000000000..f5eec9163bb8
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/imx6q-hummingboard2.dts
|
||||
@@ -0,0 +1,60 @@
|
||||
+/*
|
||||
+ * Device Tree file for SolidRun HummingBoard2
|
||||
+ * Copyright (C) 2015 Rabeeh Khoury <rabeeh@solid-run.com>
|
||||
+ * Based on work by Russell King
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "imx6q.dtsi"
|
||||
+#include "imx6qdl-hummingboard2.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "SolidRun HummingBoard2 Dual/Quad";
|
||||
+ compatible = "solidrun,hummingboard2/q", "fsl,imx6q";
|
||||
+};
|
||||
+
|
||||
+&sata {
|
||||
+ status = "okay";
|
||||
+ fsl,transmit-level-mV = <1104>;
|
||||
+ fsl,transmit-boost-mdB = <0>;
|
||||
+ fsl,transmit-atten-16ths = <9>;
|
||||
+ fsl,no-spread-spectrum;
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..11b63f6f2b89
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
@@ -0,0 +1,543 @@
|
||||
+/*
|
||||
+ * Device Tree file for SolidRun HummingBoard2
|
||||
+ * Copyright (C) 2015 Rabeeh Khoury <rabeeh@solid-run.com>
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively,
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+#include "imx6qdl-microsom.dtsi"
|
||||
+#include "imx6qdl-microsom-ar8035.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ chosen {
|
||||
+ stdout-path = &uart1;
|
||||
+ };
|
||||
+
|
||||
+ ir_recv: ir-receiver {
|
||||
+ compatible = "gpio-ir-receiver";
|
||||
+ gpios = <&gpio7 9 1>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_gpio7_9>;
|
||||
+ linux,rc-map-name = "rc-rc6-mce";
|
||||
+ };
|
||||
+
|
||||
+ usdhc2_pwrseq: usdhc2-pwrseq {
|
||||
+ compatible = "mmc-pwrseq-simple";
|
||||
+ reset-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ reg_3p3v: regulator-3p3v {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "3P3V";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ reg_1p8v: regulator-1p8v {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "1P8V";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ reg_usbh1_vbus: regulator-usb-h1-vbus {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ enable-active-high;
|
||||
+ gpio = <&gpio1 0 0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_usbh1_vbus>;
|
||||
+ regulator-name = "usb_h1_vbus";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ };
|
||||
+
|
||||
+ reg_usbotg_vbus: regulator-usb-otg-vbus {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ enable-active-high;
|
||||
+ gpio = <&gpio3 22 0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_usbotg_vbus>;
|
||||
+ regulator-name = "usb_otg_vbus";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ };
|
||||
+
|
||||
+ reg_usbh2_vbus: regulator-usb-h2-vbus {
|
||||
+ compatible = "regulator-gpio";
|
||||
+ enable-active-high;
|
||||
+ enable-gpio = <&gpio2 13 0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_usbh2_vbus>;
|
||||
+ regulator-name = "usb_h2_vbus";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-boot-on;
|
||||
+ };
|
||||
+
|
||||
+ reg_usbh3_vbus: regulator-usb-h3-vbus {
|
||||
+ compatible = "regulator-gpio";
|
||||
+ enable-active-high;
|
||||
+ enable-gpio = <&gpio7 10 0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_usbh3_vbus>;
|
||||
+ regulator-name = "usb_h3_vbus";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-boot-on;
|
||||
+ };
|
||||
+
|
||||
+ sound-sgtl5000 {
|
||||
+ audio-codec = <&sgtl5000>;
|
||||
+ audio-routing =
|
||||
+ "MIC_IN", "Mic Jack",
|
||||
+ "Mic Jack", "Mic Bias",
|
||||
+ "Headphone Jack", "HP_OUT";
|
||||
+ compatible = "fsl,imx-audio-sgtl5000";
|
||||
+ model = "On-board Codec";
|
||||
+ mux-ext-port = <5>;
|
||||
+ mux-int-port = <1>;
|
||||
+ ssi-controller = <&ssi1>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&audmux {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ecspi2 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_ecspi2>;
|
||||
+ cs-gpios = <&gpio2 26 0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_hdmi>;
|
||||
+ ddc-i2c-bus = <&i2c2>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c1 {
|
||||
+ clock-frequency = <100000>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_i2c1>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ pcf8523: rtc@68 {
|
||||
+ compatible = "nxp,pcf8523";
|
||||
+ reg = <0x68>;
|
||||
+ nxp,12p5_pf;
|
||||
+ };
|
||||
+
|
||||
+ sgtl5000: codec@0a {
|
||||
+ clocks = <&clks IMX6QDL_CLK_CKO>;
|
||||
+ compatible = "fsl,sgtl5000";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_sgtl5000>;
|
||||
+ reg = <0x0a>;
|
||||
+ VDDA-supply = <®_3p3v>;
|
||||
+ VDDIO-supply = <®_3p3v>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ clock-frequency = <100000>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_i2c2>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c3 {
|
||||
+ clock-frequency = <100000>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_i2c3>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&iomuxc {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hog>;
|
||||
+
|
||||
+ hummingboard2 {
|
||||
+ pinctrl_hog: hoggrp {
|
||||
+ fsl,pins = <
|
||||
+ /*
|
||||
+ * 36 pin headers GPIO description. The pins
|
||||
+ * numbering as following -
|
||||
+ *
|
||||
+ * 3.2v 5v 74 75
|
||||
+ * 73 72 71 70
|
||||
+ * 69 68 67 66
|
||||
+ *
|
||||
+ * 77 78 79 76
|
||||
+ * 65 64 61 60
|
||||
+ * 53 52 51 50
|
||||
+ * 49 48 166 132
|
||||
+ * 95 94 90 91
|
||||
+ * GND 54 24 204
|
||||
+ *
|
||||
+ * The GPIO numbers can be extracted using
|
||||
+ * signal name from below.
|
||||
+ * Example -
|
||||
+ * MX6QDL_PAD_EIM_DA10__GPIO3_IO10 is
|
||||
+ * GPIO(3,10) which is (3-1)*32+10 = gpio 74
|
||||
+ *
|
||||
+ * i.e. The mapping of GPIO(X,Y) to Linux gpio
|
||||
+ * number is : gpio number = (X-1) * 32 + Y
|
||||
+ */
|
||||
+ /* DI1_PIN15 */
|
||||
+ MX6QDL_PAD_EIM_DA10__GPIO3_IO10 0x400130b1
|
||||
+ /* DI1_PIN02 */
|
||||
+ MX6QDL_PAD_EIM_DA11__GPIO3_IO11 0x400130b1
|
||||
+ /* DISP1_DATA00 */
|
||||
+ MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x400130b1
|
||||
+ /* DISP1_DATA01 */
|
||||
+ MX6QDL_PAD_EIM_DA8__GPIO3_IO08 0x400130b1
|
||||
+ /* DISP1_DATA02 */
|
||||
+ MX6QDL_PAD_EIM_DA7__GPIO3_IO07 0x400130b1
|
||||
+ /* DISP1_DATA03 */
|
||||
+ MX6QDL_PAD_EIM_DA6__GPIO3_IO06 0x400130b1
|
||||
+ /* DISP1_DATA04 */
|
||||
+ MX6QDL_PAD_EIM_DA5__GPIO3_IO05 0x400130b1
|
||||
+ /* DISP1_DATA05 */
|
||||
+ MX6QDL_PAD_EIM_DA4__GPIO3_IO04 0x400130b1
|
||||
+ /* DISP1_DATA06 */
|
||||
+ MX6QDL_PAD_EIM_DA3__GPIO3_IO03 0x400130b1
|
||||
+ /* DISP1_DATA07 */
|
||||
+ MX6QDL_PAD_EIM_DA2__GPIO3_IO02 0x400130b1
|
||||
+ /* DI1_D0_CS */
|
||||
+ MX6QDL_PAD_EIM_DA13__GPIO3_IO13 0x400130b1
|
||||
+ /* DI1_D1_CS */
|
||||
+ MX6QDL_PAD_EIM_DA14__GPIO3_IO14 0x400130b1
|
||||
+ /* DI1_PIN01 */
|
||||
+ MX6QDL_PAD_EIM_DA15__GPIO3_IO15 0x400130b1
|
||||
+ /* DI1_PIN03 */
|
||||
+ MX6QDL_PAD_EIM_DA12__GPIO3_IO12 0x400130b1
|
||||
+ /* DISP1_DATA08 */
|
||||
+ MX6QDL_PAD_EIM_DA1__GPIO3_IO01 0x400130b1
|
||||
+ /* DISP1_DATA09 */
|
||||
+ MX6QDL_PAD_EIM_DA0__GPIO3_IO00 0x400130b1
|
||||
+ /* DISP1_DATA10 */
|
||||
+ MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x400130b1
|
||||
+ /* DISP1_DATA11 */
|
||||
+ MX6QDL_PAD_EIM_EB0__GPIO2_IO28 0x400130b1
|
||||
+ /* DISP1_DATA12 */
|
||||
+ MX6QDL_PAD_EIM_A17__GPIO2_IO21 0x400130b1
|
||||
+ /* DISP1_DATA13 */
|
||||
+ MX6QDL_PAD_EIM_A18__GPIO2_IO20 0x400130b1
|
||||
+ /* DISP1_DATA14 */
|
||||
+ MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x400130b1
|
||||
+ /* DISP1_DATA15 */
|
||||
+ MX6QDL_PAD_EIM_A20__GPIO2_IO18 0x400130b1
|
||||
+ /* DISP1_DATA16 */
|
||||
+ MX6QDL_PAD_EIM_A21__GPIO2_IO17 0x400130b1
|
||||
+ /* DISP1_DATA17 */
|
||||
+ MX6QDL_PAD_EIM_A22__GPIO2_IO16 0x400130b1
|
||||
+ /* DISP1_DATA18 */
|
||||
+ MX6QDL_PAD_EIM_A23__GPIO6_IO06 0x400130b1
|
||||
+ /* DISP1_DATA19 */
|
||||
+ MX6QDL_PAD_EIM_A24__GPIO5_IO04 0x400130b1
|
||||
+ /* DISP1_DATA20 */
|
||||
+ MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x400130b1
|
||||
+ /* DISP1_DATA21 */
|
||||
+ MX6QDL_PAD_EIM_D30__GPIO3_IO30 0x400130b1
|
||||
+ /* DISP1_DATA22 */
|
||||
+ MX6QDL_PAD_EIM_D26__GPIO3_IO26 0x400130b1
|
||||
+ /* DISP1_DATA23 */
|
||||
+ MX6QDL_PAD_EIM_D27__GPIO3_IO27 0x400130b1
|
||||
+ /* DI1_DISP_CLK */
|
||||
+ MX6QDL_PAD_EIM_A16__GPIO2_IO22 0x400130b1
|
||||
+ /* SPDIF_IN */
|
||||
+ MX6QDL_PAD_ENET_RX_ER__GPIO1_IO24 0x400130b1
|
||||
+ /* SPDIF_OUT */
|
||||
+ MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x400130b1
|
||||
+
|
||||
+ /* MikroBUS GPIO pin number 10 */
|
||||
+ MX6QDL_PAD_EIM_LBA__GPIO2_IO27 0x400130b1
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_ecspi2: hummingboard2-ecspi2grp {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1
|
||||
+ MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
|
||||
+ MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
|
||||
+ MX6QDL_PAD_EIM_RW__GPIO2_IO26 0x000b1 /* CS */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_gpio7_9: hummingboard2-gpio7_9 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD4_CMD__GPIO7_IO09 0x80000000
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_hdmi: hummingboard2-hdmi {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_i2c1: hummingboard2-i2c1 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
|
||||
+ MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_i2c2: hummingboard2-i2c2 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
|
||||
+ MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_i2c3: hummingboard2-i2c3 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
|
||||
+ MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_mipi: hummingboard2_mipi {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x4001b8b1
|
||||
+ MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x4001b8b1
|
||||
+ MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_pcie_reset: hummingboard2-pcie-reset {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD4_DAT3__GPIO2_IO11 0x1b0b1
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_pwm1: pwm1grp {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_DISP0_DAT8__PWM1_OUT 0x1b0b1
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_sgtl5000: hummingboard2-sgtl5000 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
|
||||
+ MX6QDL_PAD_KEY_COL0__AUD5_TXC 0x130b0
|
||||
+ MX6QDL_PAD_KEY_ROW0__AUD5_TXD 0x110b0
|
||||
+ MX6QDL_PAD_KEY_COL1__AUD5_TXFS 0x130b0
|
||||
+ MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usbh1_vbus: hummingboard2-usbh1-vbus {
|
||||
+ fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usbh2_vbus: hummingboard2-usbh2-vbus {
|
||||
+ fsl,pins = <MX6QDL_PAD_SD4_DAT5__GPIO2_IO13 0x1b0b0>;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usbh3_vbus: hummingboard2-usbh3-vbus {
|
||||
+ fsl,pins = <MX6QDL_PAD_SD4_CLK__GPIO7_IO10 0x1b0b0>;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usbotg_id: hummingboard2-usbotg-id {
|
||||
+ /*
|
||||
+ * Similar to pinctrl_usbotg_2, but we want it
|
||||
+ * pulled down for a fixed host connection.
|
||||
+ */
|
||||
+ fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usbotg_vbus: hummingboard2-usbotg-vbus {
|
||||
+ fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usdhc2_aux: hummingboard2-usdhc2-aux {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x13071
|
||||
+ MX6QDL_PAD_KEY_ROW1__SD2_VSELECT 0x1b071
|
||||
+ MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30 0x1b0b0
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usdhc2: hummingboard2-usdhc2 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
|
||||
+ MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
|
||||
+ MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
|
||||
+ MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
|
||||
+ MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
|
||||
+ MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x13059
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usdhc2_100mhz: hummingboard2-usdhc2-100mhz {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD2_CMD__SD2_CMD 0x170b9
|
||||
+ MX6QDL_PAD_SD2_CLK__SD2_CLK 0x100b9
|
||||
+ MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x170b9
|
||||
+ MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x170b9
|
||||
+ MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x170b9
|
||||
+ MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x130b9
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usdhc2_200mhz: hummingboard2-usdhc2-200mhz {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD2_CMD__SD2_CMD 0x170f9
|
||||
+ MX6QDL_PAD_SD2_CLK__SD2_CLK 0x100f9
|
||||
+ MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x170f9
|
||||
+ MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x170f9
|
||||
+ MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x170f9
|
||||
+ MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x130f9
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_usdhc3: hummingboard2-usdhc3 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
|
||||
+ MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059
|
||||
+ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x17059
|
||||
+ MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x17059
|
||||
+ MX6QDL_PAD_SD3_RST__SD3_RESET 0x17059
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ pinctrl_hummingboard2_uart3: hummingboard2-uart3 {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_EIM_D25__UART3_TX_DATA 0x1b0b1
|
||||
+ MX6QDL_PAD_EIM_D24__UART3_RX_DATA 0x40013000
|
||||
+ >;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&ldb {
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ lvds-channel@0 {
|
||||
+ fsl,data-mapping = "spwg";
|
||||
+ fsl,data-width = <18>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pcie {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_pcie_reset>;
|
||||
+ reset-gpio = <&gpio2 11 0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pwm1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_pwm1>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pwm3 {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&pwm4 {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&ssi1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbh1 {
|
||||
+ disable-over-current;
|
||||
+ vbus-supply = <®_usbh1_vbus>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbotg {
|
||||
+ disable-over-current;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_usbotg_id>;
|
||||
+ vbus-supply = <®_usbotg_vbus>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usdhc2 {
|
||||
+ pinctrl-names = "default", "state_100mhz", "state_200mhz";
|
||||
+ pinctrl-0 = <
|
||||
+ &pinctrl_hummingboard2_usdhc2_aux
|
||||
+ &pinctrl_hummingboard2_usdhc2
|
||||
+ >;
|
||||
+ pinctrl-1 = <
|
||||
+ &pinctrl_hummingboard2_usdhc2_aux
|
||||
+ &pinctrl_hummingboard2_usdhc2_100mhz
|
||||
+ >;
|
||||
+ pinctrl-2 = <
|
||||
+ &pinctrl_hummingboard2_usdhc2_aux
|
||||
+ &pinctrl_hummingboard2_usdhc2_200mhz
|
||||
+ >;
|
||||
+ mmc-pwrseq = <&usdhc2_pwrseq>;
|
||||
+ cd-gpios = <&gpio1 4 0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usdhc3 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <
|
||||
+ &pinctrl_hummingboard2_usdhc3
|
||||
+ >;
|
||||
+ vmmc-supply = <®_3p3v>;
|
||||
+ vqmmc-supply = <®_3p3v>;
|
||||
+ bus-width = <8>;
|
||||
+ non-removable;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart3 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_uart3>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
--
|
||||
2.12.2
|
||||
|
||||
From 3da2a99c4a8f19e846b19071441d2c6b88e00c06 Mon Sep 17 00:00:00 2001
|
||||
From: Russell King <rmk+kernel@arm.linux.org.uk>
|
||||
Date: Fri, 13 Jan 2017 14:45:30 +0000
|
||||
Subject: [PATCH 2/4] ARM: dts: imx6*-hummingboard2: fix SD card detect
|
||||
|
||||
Fix the SD card detect signal, which was missing the polarity
|
||||
specification, and the pull-up necessary for proper signalling.
|
||||
|
||||
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
|
||||
---
|
||||
arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
index 11b63f6f2b89..734487edf200 100644
|
||||
--- a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
+++ b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
@@ -393,7 +393,7 @@
|
||||
|
||||
pinctrl_hummingboard2_usdhc2_aux: hummingboard2-usdhc2-aux {
|
||||
fsl,pins = <
|
||||
- MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x13071
|
||||
+ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
|
||||
MX6QDL_PAD_KEY_ROW1__SD2_VSELECT 0x1b071
|
||||
MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30 0x1b0b0
|
||||
>;
|
||||
@@ -520,7 +520,7 @@
|
||||
&pinctrl_hummingboard2_usdhc2_200mhz
|
||||
>;
|
||||
mmc-pwrseq = <&usdhc2_pwrseq>;
|
||||
- cd-gpios = <&gpio1 4 0>;
|
||||
+ cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
--
|
||||
2.12.2
|
||||
|
||||
From 57b0103b600a535a35e5ff9714649519a0b3a77a Mon Sep 17 00:00:00 2001
|
||||
From: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
Date: Fri, 13 Jan 2017 14:45:35 +0000
|
||||
Subject: [PATCH 3/4] ARM: dts: imx6*-hummingboard2: use proper gpio flags
|
||||
definitions
|
||||
|
||||
Use proper gpio flag definitions for GPIOs rather than using opaque
|
||||
uninformative numbers.
|
||||
|
||||
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
index 734487edf200..88aaed26dd77 100644
|
||||
--- a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
+++ b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
ir_recv: ir-receiver {
|
||||
compatible = "gpio-ir-receiver";
|
||||
- gpios = <&gpio7 9 1>;
|
||||
+ gpios = <&gpio7 9 GPIO_ACTIVE_LOW>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_hummingboard2_gpio7_9>;
|
||||
linux,rc-map-name = "rc-rc6-mce";
|
||||
@@ -80,7 +80,7 @@
|
||||
reg_usbh1_vbus: regulator-usb-h1-vbus {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
- gpio = <&gpio1 0 0>;
|
||||
+ gpio = <&gpio1 0 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_hummingboard2_usbh1_vbus>;
|
||||
regulator-name = "usb_h1_vbus";
|
||||
@@ -91,7 +91,7 @@
|
||||
reg_usbotg_vbus: regulator-usb-otg-vbus {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
- gpio = <&gpio3 22 0>;
|
||||
+ gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_hummingboard2_usbotg_vbus>;
|
||||
regulator-name = "usb_otg_vbus";
|
||||
@@ -102,7 +102,7 @@
|
||||
reg_usbh2_vbus: regulator-usb-h2-vbus {
|
||||
compatible = "regulator-gpio";
|
||||
enable-active-high;
|
||||
- enable-gpio = <&gpio2 13 0>;
|
||||
+ enable-gpio = <&gpio2 13 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_hummingboard2_usbh2_vbus>;
|
||||
regulator-name = "usb_h2_vbus";
|
||||
@@ -114,7 +114,7 @@
|
||||
reg_usbh3_vbus: regulator-usb-h3-vbus {
|
||||
compatible = "regulator-gpio";
|
||||
enable-active-high;
|
||||
- enable-gpio = <&gpio7 10 0>;
|
||||
+ enable-gpio = <&gpio7 10 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_hummingboard2_usbh3_vbus>;
|
||||
regulator-name = "usb_h3_vbus";
|
||||
--
|
||||
2.12.2
|
||||
|
||||
From f931de70370ff576f381cb9745bc54225a1a8056 Mon Sep 17 00:00:00 2001
|
||||
From: Russell King <rmk+kernel@arm.linux.org.uk>
|
||||
Date: Fri, 13 Jan 2017 14:45:40 +0000
|
||||
Subject: [PATCH 4/4] ARM: dts: imx6*-hummingboard2: convert to more
|
||||
conventional vmmc-supply
|
||||
|
||||
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
|
||||
---
|
||||
arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi | 26 +++++++++++++++++++-------
|
||||
1 file changed, 19 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
index 88aaed26dd77..f19d30b34ac4 100644
|
||||
--- a/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
+++ b/arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
|
||||
@@ -56,11 +56,6 @@
|
||||
linux,rc-map-name = "rc-rc6-mce";
|
||||
};
|
||||
|
||||
- usdhc2_pwrseq: usdhc2-pwrseq {
|
||||
- compatible = "mmc-pwrseq-simple";
|
||||
- reset-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
|
||||
- };
|
||||
-
|
||||
reg_3p3v: regulator-3p3v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "3P3V";
|
||||
@@ -123,6 +118,18 @@
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
+ reg_usdhc2_vmmc: reg-usdhc2-vmmc {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pinctrl_hummingboard2_vmmc>;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-name = "usdhc2_vmmc";
|
||||
+ startup-delay-us = <1000>;
|
||||
+ };
|
||||
+
|
||||
sound-sgtl5000 {
|
||||
audio-codec = <&sgtl5000>;
|
||||
audio-routing =
|
||||
@@ -393,7 +400,6 @@
|
||||
|
||||
pinctrl_hummingboard2_usdhc2_aux: hummingboard2-usdhc2-aux {
|
||||
fsl,pins = <
|
||||
- MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
|
||||
MX6QDL_PAD_KEY_ROW1__SD2_VSELECT 0x1b071
|
||||
MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30 0x1b0b0
|
||||
>;
|
||||
@@ -432,6 +438,12 @@
|
||||
>;
|
||||
};
|
||||
|
||||
+ pinctrl_hummingboard2_vmmc: hummingboard2-vmmc {
|
||||
+ fsl,pins = <
|
||||
+ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
pinctrl_hummingboard2_usdhc3: hummingboard2-usdhc3 {
|
||||
fsl,pins = <
|
||||
MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
|
||||
@@ -519,7 +531,7 @@
|
||||
&pinctrl_hummingboard2_usdhc2_aux
|
||||
&pinctrl_hummingboard2_usdhc2_200mhz
|
||||
>;
|
||||
- mmc-pwrseq = <&usdhc2_pwrseq>;
|
||||
+ vmmc-supply = <®_usdhc2_vmmc>;
|
||||
cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
--
|
||||
2.12.2
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
From bb3e08008c0e48fd4f51a0f0957eecae61a24d69 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Tue, 1 Nov 2016 09:35:30 +0000
|
||||
Subject: [PATCH] Revert "mmc: omap_hsmmc: Use dma_request_chan() for
|
||||
requesting DMA channel"
|
||||
|
||||
This reverts commit 81eef6ca92014845d40e3f1310e42b7010303acc.
|
||||
---
|
||||
drivers/mmc/host/omap_hsmmc.c | 50 ++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 40 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
|
||||
index 24ebc9a..3563321 100644
|
||||
--- a/drivers/mmc/host/omap_hsmmc.c
|
||||
+++ b/drivers/mmc/host/omap_hsmmc.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_device.h>
|
||||
+#include <linux/omap-dmaengine.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mmc/core.h>
|
||||
#include <linux/mmc/mmc.h>
|
||||
@@ -1992,6 +1993,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
|
||||
struct resource *res;
|
||||
int ret, irq;
|
||||
const struct of_device_id *match;
|
||||
+ dma_cap_mask_t mask;
|
||||
+ unsigned tx_req, rx_req;
|
||||
const struct omap_mmc_of_data *data;
|
||||
void __iomem *base;
|
||||
|
||||
@@ -2121,17 +2124,44 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
|
||||
|
||||
omap_hsmmc_conf_bus_power(host);
|
||||
|
||||
- host->rx_chan = dma_request_chan(&pdev->dev, "rx");
|
||||
- if (IS_ERR(host->rx_chan)) {
|
||||
- dev_err(mmc_dev(host->mmc), "RX DMA channel request failed\n");
|
||||
- ret = PTR_ERR(host->rx_chan);
|
||||
+ if (!pdev->dev.of_node) {
|
||||
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
|
||||
+ if (!res) {
|
||||
+ dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n");
|
||||
+ ret = -ENXIO;
|
||||
+ goto err_irq;
|
||||
+ }
|
||||
+ tx_req = res->start;
|
||||
+
|
||||
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
|
||||
+ if (!res) {
|
||||
+ dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n");
|
||||
+ ret = -ENXIO;
|
||||
+ goto err_irq;
|
||||
+ }
|
||||
+ rx_req = res->start;
|
||||
+ }
|
||||
+
|
||||
+ dma_cap_zero(mask);
|
||||
+ dma_cap_set(DMA_SLAVE, mask);
|
||||
+
|
||||
+ host->rx_chan =
|
||||
+ dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
|
||||
+ &rx_req, &pdev->dev, "rx");
|
||||
+
|
||||
+ if (!host->rx_chan) {
|
||||
+ dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel\n");
|
||||
+ ret = -ENXIO;
|
||||
goto err_irq;
|
||||
}
|
||||
|
||||
- host->tx_chan = dma_request_chan(&pdev->dev, "tx");
|
||||
- if (IS_ERR(host->tx_chan)) {
|
||||
- dev_err(mmc_dev(host->mmc), "TX DMA channel request failed\n");
|
||||
- ret = PTR_ERR(host->tx_chan);
|
||||
+ host->tx_chan =
|
||||
+ dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
|
||||
+ &tx_req, &pdev->dev, "tx");
|
||||
+
|
||||
+ if (!host->tx_chan) {
|
||||
+ dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel\n");
|
||||
+ ret = -ENXIO;
|
||||
goto err_irq;
|
||||
}
|
||||
|
||||
@@ -2189,9 +2219,9 @@ err_slot_name:
|
||||
mmc_remove_host(mmc);
|
||||
err_irq:
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
- if (!IS_ERR_OR_NULL(host->tx_chan))
|
||||
+ if (host->tx_chan)
|
||||
dma_release_channel(host->tx_chan);
|
||||
- if (!IS_ERR_OR_NULL(host->rx_chan))
|
||||
+ if (host->rx_chan)
|
||||
dma_release_channel(host->rx_chan);
|
||||
pm_runtime_dont_use_autosuspend(host->dev);
|
||||
pm_runtime_put_sync(host->dev);
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -1,573 +0,0 @@
|
|||
From 223599514133293bb9afe7b82937140c3b275877 Mon Sep 17 00:00:00 2001
|
||||
From: Eddie Cai <eddie.cai.linux@gmail.com>
|
||||
Date: Tue, 14 Feb 2017 18:07:31 +0800
|
||||
Subject: ARM: dts: rockchip: add dts for RK3288-Tinker board
|
||||
|
||||
This patch add basic support for RK3288-Tinker board. We can boot in to rootfs
|
||||
with this patch.
|
||||
|
||||
Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm/boot/dts/Makefile | 1 +
|
||||
arch/arm/boot/dts/rk3288-tinker.dts | 536 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 537 insertions(+)
|
||||
create mode 100644 arch/arm/boot/dts/rk3288-tinker.dts
|
||||
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 0118084..fb46849 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -695,6 +695,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
rk3288-popmetal.dtb \
|
||||
rk3288-r89.dtb \
|
||||
rk3288-rock2-square.dtb \
|
||||
+ rk3288-tinker.dtb \
|
||||
rk3288-veyron-brain.dtb \
|
||||
rk3288-veyron-jaq.dtb \
|
||||
rk3288-veyron-jerry.dtb \
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
new file mode 100644
|
||||
index 0000000..f601c78
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -0,0 +1,536 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively,
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use,
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "rk3288.dtsi"
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+
|
||||
+/ {
|
||||
+ model = "Rockchip RK3288 Tinker Board";
|
||||
+ compatible = "asus,rk3288-tinker", "rockchip,rk3288";
|
||||
+
|
||||
+ memory {
|
||||
+ reg = <0x0 0x80000000>;
|
||||
+ device_type = "memory";
|
||||
+ };
|
||||
+
|
||||
+ ext_gmac: external-gmac-clock {
|
||||
+ compatible = "fixed-clock";
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <125000000>;
|
||||
+ clock-output-names = "ext_gmac";
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ autorepeat;
|
||||
+
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwrbtn>;
|
||||
+
|
||||
+ button@0 {
|
||||
+ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_POWER>;
|
||||
+ label = "GPIO Key Power";
|
||||
+ linux,input-type = <1>;
|
||||
+ wakeup-source;
|
||||
+ debounce-interval = <100>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gpio-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ act-led {
|
||||
+ gpios=<&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger="mmc0";
|
||||
+ };
|
||||
+
|
||||
+ heartbeat-led {
|
||||
+ gpios=<&gpio1 RK_PD1 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger="heartbeat";
|
||||
+ };
|
||||
+
|
||||
+ pwr-led {
|
||||
+ gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "default-on";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,name = "rockchip,tinker-codec";
|
||||
+ simple-audio-card,mclk-fs = <512>;
|
||||
+
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&hdmi>;
|
||||
+ };
|
||||
+
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_sys: vsys-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc_sys";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ };
|
||||
+
|
||||
+ vcc_sd: sdmmc-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_pwr>;
|
||||
+ regulator-name = "vcc_sd";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ startup-delay-us = <100000>;
|
||||
+ vin-supply = <&vcc_io>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu0 {
|
||||
+ cpu0-supply = <&vdd_cpu>;
|
||||
+};
|
||||
+
|
||||
+&gmac {
|
||||
+ assigned-clocks = <&cru SCLK_MAC>;
|
||||
+ assigned-clock-parents = <&ext_gmac>;
|
||||
+ clock_in_out = "input";
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy-supply = <&vcc33_lan>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rgmii_pins>;
|
||||
+ snps,reset-gpio = <&gpio4 7 0>;
|
||||
+ snps,reset-active-low;
|
||||
+ snps,reset-delays-us = <0 10000 1000000>;
|
||||
+ tx_delay = <0x30>;
|
||||
+ rx_delay = <0x10>;
|
||||
+ status = "ok";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ ddc-i2c-bus = <&i2c5>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ clock-frequency = <400000>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ rk808: pmic@1b {
|
||||
+ compatible = "rockchip,rk808";
|
||||
+ reg = <0x1b>;
|
||||
+ interrupt-parent = <&gpio0>;
|
||||
+ interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ #clock-cells = <1>;
|
||||
+ clock-output-names = "xin32k", "rk808-clkout2";
|
||||
+ dvs-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>,
|
||||
+ <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pmic_int &global_pwroff &dvs_1 &dvs_2>;
|
||||
+ rockchip,system-power-controller;
|
||||
+ wakeup-source;
|
||||
+
|
||||
+ vcc1-supply = <&vcc_sys>;
|
||||
+ vcc2-supply = <&vcc_sys>;
|
||||
+ vcc3-supply = <&vcc_sys>;
|
||||
+ vcc4-supply = <&vcc_sys>;
|
||||
+ vcc6-supply = <&vcc_sys>;
|
||||
+ vcc7-supply = <&vcc_sys>;
|
||||
+ vcc8-supply = <&vcc_io>;
|
||||
+ vcc9-supply = <&vcc_io>;
|
||||
+ vcc10-supply = <&vcc_io>;
|
||||
+ vcc11-supply = <&vcc_sys>;
|
||||
+ vcc12-supply = <&vcc_io>;
|
||||
+ vddio-supply = <&vcc_io>;
|
||||
+
|
||||
+ regulators {
|
||||
+ vdd_cpu: DCDC_REG1 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <750000>;
|
||||
+ regulator-max-microvolt = <1350000>;
|
||||
+ regulator-name = "vdd_arm";
|
||||
+ regulator-ramp-delay = <6000>;
|
||||
+ regulator-state-mem {
|
||||
+ regulator-off-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_gpu: DCDC_REG2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <850000>;
|
||||
+ regulator-max-microvolt = <1250000>;
|
||||
+ regulator-name = "vdd_gpu";
|
||||
+ regulator-ramp-delay = <6000>;
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_ddr: DCDC_REG3 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-name = "vcc_ddr";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_io: DCDC_REG4 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vcc_io";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3300000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_ldo1: LDO_REG1 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc18_ldo1";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc33_mipi: LDO_REG2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vcc33_mipi";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-off-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_10: LDO_REG3 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+ regulator-name = "vdd_10";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_codec: LDO_REG4 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc18_codec";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vccio_sd: LDO_REG5 {
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vccio_sd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3300000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd10_lcd: LDO_REG6 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+ regulator-name = "vdd10_lcd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_18: LDO_REG7 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc_18";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_lcd: LDO_REG8 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc18_lcd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc33_sd: SWITCH_REG1 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-name = "vcc33_sd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc33_lan: SWITCH_REG2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-name = "vcc33_lan";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c5 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2s {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&io_domains {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ sdcard-supply = <&vccio_sd>;
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
|
||||
+ bias-pull-up;
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ backlight {
|
||||
+ bl_en: bl-en {
|
||||
+ rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ buttons {
|
||||
+ pwrbtn: pwrbtn {
|
||||
+ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ eth_phy {
|
||||
+ eth_phy_pwr: eth-phy-pwr {
|
||||
+ rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pmic {
|
||||
+ pmic_int: pmic-int {
|
||||
+ rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO \
|
||||
+ &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ dvs_1: dvs-1 {
|
||||
+ rockchip,pins = <RK_GPIO0 11 RK_FUNC_GPIO \
|
||||
+ &pcfg_pull_down>;
|
||||
+ };
|
||||
+
|
||||
+ dvs_2: dvs-2 {
|
||||
+ rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO \
|
||||
+ &pcfg_pull_down>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sdmmc {
|
||||
+ sdmmc_bus4: sdmmc-bus4 {
|
||||
+ rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_clk: sdmmc-clk {
|
||||
+ rockchip,pins = <6 20 RK_FUNC_1 \
|
||||
+ &pcfg_pull_none_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_cmd: sdmmc-cmd {
|
||||
+ rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_pwr: sdmmc-pwr {
|
||||
+ rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ usb {
|
||||
+ host_vbus_drv: host-vbus-drv {
|
||||
+ rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ pwr_3g: pwr-3g {
|
||||
+ rockchip,pins = <7 8 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&saradc {
|
||||
+ vref-supply = <&vcc18_ldo1>;
|
||||
+ status ="okay";
|
||||
+};
|
||||
+
|
||||
+&sdmmc {
|
||||
+ bus-width = <4>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ cap-sd-highspeed;
|
||||
+ card-detect-delay = <200>;
|
||||
+ disable-wp; /* wp not hooked up */
|
||||
+ num-slots = <1>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
|
||||
+ status = "okay";
|
||||
+ vmmc-supply = <&vcc33_sd>;
|
||||
+ vqmmc-supply = <&vccio_sd>;
|
||||
+};
|
||||
+
|
||||
+&tsadc {
|
||||
+ rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
|
||||
+ rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart3 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart4 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbphy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_host0_ehci {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_host1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_otg {
|
||||
+ status= "okay";
|
||||
+};
|
||||
+
|
||||
+&vopb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopb_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopl {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopl_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&wdt {
|
||||
+ status = "okay";
|
||||
+};
|
||||
--
|
||||
cgit v1.1
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
From 0ab09d651b5858f9bc7d5f74e725334a661828e0 Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Fri, 9 Mar 2018 14:47:17 +0000
|
||||
Subject: nvmem: sunxi-sid: fix H3 SID controller support
|
||||
|
||||
It seems that doing some operation will make the value pre-read on H3
|
||||
SID controller wrong again, so all operation should be performed by
|
||||
register.
|
||||
|
||||
Change the SID reading to use register only.
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/sunxi_sid.c | 71 +++++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 50 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
|
||||
index 99bd54d..26bb637 100644
|
||||
--- a/drivers/nvmem/sunxi_sid.c
|
||||
+++ b/drivers/nvmem/sunxi_sid.c
|
||||
@@ -85,13 +85,14 @@ static int sunxi_sid_read(void *context, unsigned int offset,
|
||||
}
|
||||
|
||||
static int sun8i_sid_register_readout(const struct sunxi_sid *sid,
|
||||
- const unsigned int word)
|
||||
+ const unsigned int offset,
|
||||
+ u32 *out)
|
||||
{
|
||||
u32 reg_val;
|
||||
int ret;
|
||||
|
||||
/* Set word, lock access, and set read command */
|
||||
- reg_val = (word & SUN8I_SID_OFFSET_MASK)
|
||||
+ reg_val = (offset & SUN8I_SID_OFFSET_MASK)
|
||||
<< SUN8I_SID_OFFSET_SHIFT;
|
||||
reg_val |= SUN8I_SID_OP_LOCK | SUN8I_SID_READ;
|
||||
writel(reg_val, sid->base + SUN8I_SID_PRCTL);
|
||||
@@ -101,7 +102,49 @@ static int sun8i_sid_register_readout(const struct sunxi_sid *sid,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ if (out)
|
||||
+ *out = readl(sid->base + SUN8I_SID_RDKEY);
|
||||
+
|
||||
writel(0, sid->base + SUN8I_SID_PRCTL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * On Allwinner H3, the value on the 0x200 offset of the SID controller seems
|
||||
+ * to be not reliable at all.
|
||||
+ * Read by the registers instead.
|
||||
+ */
|
||||
+static int sun8i_sid_read_byte_by_reg(const struct sunxi_sid *sid,
|
||||
+ const unsigned int offset,
|
||||
+ u8 *out)
|
||||
+{
|
||||
+ u32 word;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = sun8i_sid_register_readout(sid, offset & ~0x03, &word);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ *out = (word >> ((offset & 0x3) * 8)) & 0xff;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int sun8i_sid_read_by_reg(void *context, unsigned int offset,
|
||||
+ void *val, size_t bytes)
|
||||
+{
|
||||
+ struct sunxi_sid *sid = context;
|
||||
+ u8 *buf = val;
|
||||
+ int ret;
|
||||
+
|
||||
+ while (bytes--) {
|
||||
+ ret = sun8i_sid_read_byte_by_reg(sid, offset++, buf++);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -131,26 +174,12 @@ static int sunxi_sid_probe(struct platform_device *pdev)
|
||||
|
||||
size = cfg->size;
|
||||
|
||||
- if (cfg->need_register_readout) {
|
||||
- /*
|
||||
- * H3's SID controller have a bug that the value at 0x200
|
||||
- * offset is not the correct value when the hardware is reseted.
|
||||
- * However, after doing a register-based read operation, the
|
||||
- * value become right.
|
||||
- * Do a full read operation here, but ignore its value
|
||||
- * (as it's more fast to read by direct MMIO value than
|
||||
- * with registers)
|
||||
- */
|
||||
- for (i = 0; i < (size >> 2); i++) {
|
||||
- ret = sun8i_sid_register_readout(sid, i);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
econfig.size = size;
|
||||
econfig.dev = dev;
|
||||
- econfig.reg_read = sunxi_sid_read;
|
||||
+ if (cfg->need_register_readout)
|
||||
+ econfig.reg_read = sun8i_sid_read_by_reg;
|
||||
+ else
|
||||
+ econfig.reg_read = sunxi_sid_read;
|
||||
econfig.priv = sid;
|
||||
nvmem = nvmem_register(&econfig);
|
||||
if (IS_ERR(nvmem))
|
||||
@@ -163,7 +192,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
- randomness[i] = sunxi_sid_read_byte(sid, i);
|
||||
+ econfig.reg_read(sid, i, &randomness[i], 1);
|
||||
|
||||
add_device_randomness(randomness, size);
|
||||
kfree(randomness);
|
||||
--
|
||||
cgit v1.1
|
|
@ -0,0 +1,610 @@
|
|||
From patchwork Mon Apr 9 22:02:57 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3,1/3] usb: phy: tegra: Cleanup error messages
|
||||
X-Patchwork-Submitter: Dmitry Osipenko <digetx@gmail.com>
|
||||
X-Patchwork-Id: 896433
|
||||
Message-Id: <c08393c7ac6964d14750e8a4b0ffa34884b1416f.1523307883.git.digetx@gmail.com>
|
||||
To: Thierry Reding <thierry.reding@gmail.com>,
|
||||
Jonathan Hunter <jonathanh@nvidia.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Alan Stern <stern@rowland.harvard.edu>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Date: Tue, 10 Apr 2018 01:02:57 +0300
|
||||
From: Dmitry Osipenko <digetx@gmail.com>
|
||||
List-Id: <linux-tegra.vger.kernel.org>
|
||||
|
||||
Tegra's PHY driver has a mix of pr_err() and dev_err(), let's switch to
|
||||
dev_err() and use common errors message formatting across the driver for
|
||||
consistency.
|
||||
|
||||
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
---
|
||||
drivers/usb/phy/phy-tegra-usb.c | 69 ++++++++++++++++++++++++-----------------
|
||||
1 file changed, 41 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
|
||||
index 0e8d23e51732..e46219e7fa93 100644
|
||||
--- a/drivers/usb/phy/phy-tegra-usb.c
|
||||
+++ b/drivers/usb/phy/phy-tegra-usb.c
|
||||
@@ -236,10 +236,14 @@ static void set_phcd(struct tegra_usb_phy *phy, bool enable)
|
||||
|
||||
static int utmip_pad_open(struct tegra_usb_phy *phy)
|
||||
{
|
||||
+ int err;
|
||||
+
|
||||
phy->pad_clk = devm_clk_get(phy->u_phy.dev, "utmi-pads");
|
||||
if (IS_ERR(phy->pad_clk)) {
|
||||
- pr_err("%s: can't get utmip pad clock\n", __func__);
|
||||
- return PTR_ERR(phy->pad_clk);
|
||||
+ err = PTR_ERR(phy->pad_clk);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to get UTMIP pad clock: %d\n", err);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -282,7 +286,7 @@ static int utmip_pad_power_off(struct tegra_usb_phy *phy)
|
||||
void __iomem *base = phy->pad_regs;
|
||||
|
||||
if (!utmip_pad_count) {
|
||||
- pr_err("%s: utmip pad already powered off\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev, "UTMIP pad already powered off\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -338,7 +342,8 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
|
||||
set_phcd(phy, true);
|
||||
|
||||
if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0)
|
||||
- pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Timeout waiting for PHY to stabilize on disable\n");
|
||||
}
|
||||
|
||||
static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
|
||||
@@ -370,7 +375,8 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
|
||||
|
||||
if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID,
|
||||
USB_PHY_CLK_VALID))
|
||||
- pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Timeout waiting for PHY to stabilize on enable\n");
|
||||
}
|
||||
|
||||
static int utmi_phy_power_on(struct tegra_usb_phy *phy)
|
||||
@@ -617,15 +623,15 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
|
||||
|
||||
ret = gpio_direction_output(phy->reset_gpio, 0);
|
||||
if (ret < 0) {
|
||||
- dev_err(phy->u_phy.dev, "gpio %d not set to 0\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev, "GPIO %d not set to 0: %d\n",
|
||||
+ phy->reset_gpio, ret);
|
||||
return ret;
|
||||
}
|
||||
msleep(5);
|
||||
ret = gpio_direction_output(phy->reset_gpio, 1);
|
||||
if (ret < 0) {
|
||||
- dev_err(phy->u_phy.dev, "gpio %d not set to 1\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev, "GPIO %d not set to 1: %d\n",
|
||||
+ phy->reset_gpio, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -661,13 +667,13 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
|
||||
/* Fix VbusInvalid due to floating VBUS */
|
||||
ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08);
|
||||
if (ret) {
|
||||
- pr_err("%s: ulpi write failed\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev, "ULPI write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B);
|
||||
if (ret) {
|
||||
- pr_err("%s: ulpi write failed\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev, "ULPI write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -728,28 +734,30 @@ static int ulpi_open(struct tegra_usb_phy *phy)
|
||||
|
||||
phy->clk = devm_clk_get(phy->u_phy.dev, "ulpi-link");
|
||||
if (IS_ERR(phy->clk)) {
|
||||
- pr_err("%s: can't get ulpi clock\n", __func__);
|
||||
- return PTR_ERR(phy->clk);
|
||||
+ err = PTR_ERR(phy->clk);
|
||||
+ dev_err(phy->u_phy.dev, "Failed to get ULPI clock: %d\n", err);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
err = devm_gpio_request(phy->u_phy.dev, phy->reset_gpio,
|
||||
"ulpi_phy_reset_b");
|
||||
if (err < 0) {
|
||||
- dev_err(phy->u_phy.dev, "request failed for gpio: %d\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev, "Request failed for GPIO %d: %d\n",
|
||||
+ phy->reset_gpio, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = gpio_direction_output(phy->reset_gpio, 0);
|
||||
if (err < 0) {
|
||||
- dev_err(phy->u_phy.dev, "gpio %d direction not set to output\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "GPIO %d direction not set to output: %d\n",
|
||||
+ phy->reset_gpio, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
|
||||
if (!phy->ulpi) {
|
||||
- dev_err(phy->u_phy.dev, "otg_ulpi_create returned NULL\n");
|
||||
+ dev_err(phy->u_phy.dev, "Failed to create ULPI OTG\n");
|
||||
err = -ENOMEM;
|
||||
return err;
|
||||
}
|
||||
@@ -766,8 +774,10 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
|
||||
|
||||
phy->pll_u = devm_clk_get(phy->u_phy.dev, "pll_u");
|
||||
if (IS_ERR(phy->pll_u)) {
|
||||
- pr_err("Can't get pll_u clock\n");
|
||||
- return PTR_ERR(phy->pll_u);
|
||||
+ err = PTR_ERR(phy->pll_u);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to get pll_u clock: %d\n", err);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
err = clk_prepare_enable(phy->pll_u);
|
||||
@@ -782,7 +792,8 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
|
||||
}
|
||||
}
|
||||
if (!phy->freq) {
|
||||
- pr_err("invalid pll_u parent rate %ld\n", parent_rate);
|
||||
+ dev_err(phy->u_phy.dev, "Invalid pll_u parent rate %ld\n",
|
||||
+ parent_rate);
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
@@ -791,7 +802,7 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
|
||||
err = regulator_enable(phy->vbus);
|
||||
if (err) {
|
||||
dev_err(phy->u_phy.dev,
|
||||
- "failed to enable usb vbus regulator: %d\n",
|
||||
+ "Failed to enable USB VBUS regulator: %d\n",
|
||||
err);
|
||||
goto fail;
|
||||
}
|
||||
@@ -855,7 +866,8 @@ static int read_utmi_param(struct platform_device *pdev, const char *param,
|
||||
int err = of_property_read_u32(pdev->dev.of_node, param, &value);
|
||||
*dest = (u8)value;
|
||||
if (err < 0)
|
||||
- dev_err(&pdev->dev, "Failed to read USB UTMI parameter %s: %d\n",
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "Failed to read USB UTMI parameter %s: %d\n",
|
||||
param, err);
|
||||
return err;
|
||||
}
|
||||
@@ -871,14 +883,14 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
||||
if (!res) {
|
||||
- dev_err(&pdev->dev, "Failed to get UTMI Pad regs\n");
|
||||
+ dev_err(&pdev->dev, "Failed to get UTMI pad regs\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
|
||||
resource_size(res));
|
||||
if (!tegra_phy->pad_regs) {
|
||||
- dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
|
||||
+ dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1020,15 +1032,16 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
|
||||
tegra_phy->reset_gpio =
|
||||
of_get_named_gpio(np, "nvidia,phy-reset-gpio", 0);
|
||||
if (!gpio_is_valid(tegra_phy->reset_gpio)) {
|
||||
- dev_err(&pdev->dev, "invalid gpio: %d\n",
|
||||
- tegra_phy->reset_gpio);
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "Invalid GPIO: %d\n", tegra_phy->reset_gpio);
|
||||
return tegra_phy->reset_gpio;
|
||||
}
|
||||
tegra_phy->config = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
- dev_err(&pdev->dev, "phy_type is invalid or unsupported\n");
|
||||
+ dev_err(&pdev->dev, "phy_type %u is invalid or unsupported\n",
|
||||
+ phy_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
From patchwork Mon Apr 9 22:02:58 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3,
|
||||
2/3] usb: tegra: Move utmi-pads reset from ehci-tegra to tegra-phy
|
||||
X-Patchwork-Submitter: Dmitry Osipenko <digetx@gmail.com>
|
||||
X-Patchwork-Id: 896435
|
||||
Message-Id: <66330166c6a53e8f463ec231e3cb8195fa3036cc.1523307883.git.digetx@gmail.com>
|
||||
To: Thierry Reding <thierry.reding@gmail.com>,
|
||||
Jonathan Hunter <jonathanh@nvidia.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Alan Stern <stern@rowland.harvard.edu>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Date: Tue, 10 Apr 2018 01:02:58 +0300
|
||||
From: Dmitry Osipenko <digetx@gmail.com>
|
||||
List-Id: <linux-tegra.vger.kernel.org>
|
||||
|
||||
UTMI pads are shared by USB controllers and reset of UTMI pads is shared
|
||||
with the reset of USB1 controller. Currently reset of UTMI pads is done by
|
||||
the EHCI driver and ChipIdea UDC works because EHCI driver always happen
|
||||
to be probed first. Move reset controls from ehci-tegra to tegra-phy in
|
||||
order to resolve the problem.
|
||||
|
||||
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
---
|
||||
drivers/usb/host/ehci-tegra.c | 87 ++++++++++++++++++---------------------
|
||||
drivers/usb/phy/phy-tegra-usb.c | 79 ++++++++++++++++++++++++++++++++---
|
||||
include/linux/usb/tegra_usb_phy.h | 2 +
|
||||
3 files changed, 115 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
|
||||
index a6f4389f7e88..4d2cdec4cb78 100644
|
||||
--- a/drivers/usb/host/ehci-tegra.c
|
||||
+++ b/drivers/usb/host/ehci-tegra.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#define DRV_NAME "tegra-ehci"
|
||||
|
||||
static struct hc_driver __read_mostly tegra_ehci_hc_driver;
|
||||
-static bool usb1_reset_attempted;
|
||||
|
||||
struct tegra_ehci_soc_config {
|
||||
bool has_hostpc;
|
||||
@@ -51,67 +50,54 @@ struct tegra_ehci_hcd {
|
||||
enum tegra_usb_phy_port_speed port_speed;
|
||||
};
|
||||
|
||||
-/*
|
||||
- * The 1st USB controller contains some UTMI pad registers that are global for
|
||||
- * all the controllers on the chip. Those registers are also cleared when
|
||||
- * reset is asserted to the 1st controller. This means that the 1st controller
|
||||
- * can only be reset when no other controlled has finished probing. So we'll
|
||||
- * reset the 1st controller before doing any other setup on any of the
|
||||
- * controllers, and then never again.
|
||||
- *
|
||||
- * Since this is a PHY issue, the Tegra PHY driver should probably be doing
|
||||
- * the resetting of the USB controllers. But to keep compatibility with old
|
||||
- * device trees that don't have reset phandles in the PHYs, do it here.
|
||||
- * Those old DTs will be vulnerable to total USB breakage if the 1st EHCI
|
||||
- * device isn't the first one to finish probing, so warn them.
|
||||
- */
|
||||
static int tegra_reset_usb_controller(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *phy_np;
|
||||
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
||||
struct tegra_ehci_hcd *tegra =
|
||||
(struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
|
||||
- bool has_utmi_pad_registers = false;
|
||||
+ struct reset_control *rst;
|
||||
+ int err;
|
||||
|
||||
phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0);
|
||||
if (!phy_np)
|
||||
return -ENOENT;
|
||||
|
||||
- if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers"))
|
||||
- has_utmi_pad_registers = true;
|
||||
+ /*
|
||||
+ * The 1st USB controller contains some UTMI pad registers that are
|
||||
+ * global for all the controllers on the chip. Those registers are
|
||||
+ * also cleared when reset is asserted to the 1st controller.
|
||||
+ */
|
||||
+ rst = of_reset_control_get_shared(phy_np, "utmi-pads");
|
||||
+ if (IS_ERR(rst)) {
|
||||
+ dev_warn(&pdev->dev,
|
||||
+ "can't get utmi-pads reset from the PHY\n");
|
||||
+ dev_warn(&pdev->dev,
|
||||
+ "continuing, but please update your DT\n");
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * PHY driver performs UTMI-pads reset in a case of
|
||||
+ * non-legacy DT.
|
||||
+ */
|
||||
+ reset_control_put(rst);
|
||||
+ }
|
||||
|
||||
- if (!usb1_reset_attempted) {
|
||||
- struct reset_control *usb1_reset;
|
||||
+ of_node_put(phy_np);
|
||||
|
||||
- if (!has_utmi_pad_registers)
|
||||
- usb1_reset = of_reset_control_get(phy_np, "utmi-pads");
|
||||
- else
|
||||
- usb1_reset = tegra->rst;
|
||||
-
|
||||
- if (IS_ERR(usb1_reset)) {
|
||||
- dev_warn(&pdev->dev,
|
||||
- "can't get utmi-pads reset from the PHY\n");
|
||||
- dev_warn(&pdev->dev,
|
||||
- "continuing, but please update your DT\n");
|
||||
- } else {
|
||||
- reset_control_assert(usb1_reset);
|
||||
- udelay(1);
|
||||
- reset_control_deassert(usb1_reset);
|
||||
-
|
||||
- if (!has_utmi_pad_registers)
|
||||
- reset_control_put(usb1_reset);
|
||||
- }
|
||||
+ /* reset control is shared, hence initialize it first */
|
||||
+ err = reset_control_deassert(tegra->rst);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
- usb1_reset_attempted = true;
|
||||
- }
|
||||
+ err = reset_control_assert(tegra->rst);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
- if (!has_utmi_pad_registers) {
|
||||
- reset_control_assert(tegra->rst);
|
||||
- udelay(1);
|
||||
- reset_control_deassert(tegra->rst);
|
||||
- }
|
||||
+ udelay(1);
|
||||
|
||||
- of_node_put(phy_np);
|
||||
+ err = reset_control_deassert(tegra->rst);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -440,7 +426,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
||||
goto cleanup_hcd_create;
|
||||
}
|
||||
|
||||
- tegra->rst = devm_reset_control_get(&pdev->dev, "usb");
|
||||
+ tegra->rst = devm_reset_control_get_shared(&pdev->dev, "usb");
|
||||
if (IS_ERR(tegra->rst)) {
|
||||
dev_err(&pdev->dev, "Can't get ehci reset\n");
|
||||
err = PTR_ERR(tegra->rst);
|
||||
@@ -452,8 +438,10 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
||||
goto cleanup_hcd_create;
|
||||
|
||||
err = tegra_reset_usb_controller(pdev);
|
||||
- if (err)
|
||||
+ if (err) {
|
||||
+ dev_err(&pdev->dev, "Failed to reset controller\n");
|
||||
goto cleanup_clk_en;
|
||||
+ }
|
||||
|
||||
u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0);
|
||||
if (IS_ERR(u_phy)) {
|
||||
@@ -538,6 +526,9 @@ static int tegra_ehci_remove(struct platform_device *pdev)
|
||||
usb_phy_shutdown(hcd->usb_phy);
|
||||
usb_remove_hcd(hcd);
|
||||
|
||||
+ reset_control_assert(tegra->rst);
|
||||
+ udelay(1);
|
||||
+
|
||||
clk_disable_unprepare(tegra->clk);
|
||||
|
||||
usb_put_hcd(hcd);
|
||||
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
|
||||
index e46219e7fa93..ea7ef1dc0b42 100644
|
||||
--- a/drivers/usb/phy/phy-tegra-usb.c
|
||||
+++ b/drivers/usb/phy/phy-tegra-usb.c
|
||||
@@ -236,17 +236,83 @@ static void set_phcd(struct tegra_usb_phy *phy, bool enable)
|
||||
|
||||
static int utmip_pad_open(struct tegra_usb_phy *phy)
|
||||
{
|
||||
- int err;
|
||||
+ int ret;
|
||||
|
||||
phy->pad_clk = devm_clk_get(phy->u_phy.dev, "utmi-pads");
|
||||
if (IS_ERR(phy->pad_clk)) {
|
||||
- err = PTR_ERR(phy->pad_clk);
|
||||
+ ret = PTR_ERR(phy->pad_clk);
|
||||
dev_err(phy->u_phy.dev,
|
||||
- "Failed to get UTMIP pad clock: %d\n", err);
|
||||
- return err;
|
||||
+ "Failed to get UTMIP pad clock: %d\n", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ phy->pad_rst = devm_reset_control_get_optional_shared(
|
||||
+ phy->u_phy.dev, "utmi-pads");
|
||||
+ if (IS_ERR(phy->pad_rst)) {
|
||||
+ ret = PTR_ERR(phy->pad_rst);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to get UTMI-pads reset: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(phy->pad_clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to enable UTMI-pads clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ spin_lock(&utmip_pad_lock);
|
||||
+
|
||||
+ ret = reset_control_deassert(phy->pad_rst);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to initialize UTMI-pads reset: %d\n", ret);
|
||||
+ goto unlock;
|
||||
+ }
|
||||
+
|
||||
+ ret = reset_control_assert(phy->pad_rst);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to assert UTMI-pads reset: %d\n", ret);
|
||||
+ goto unlock;
|
||||
+ }
|
||||
+
|
||||
+ udelay(1);
|
||||
+
|
||||
+ ret = reset_control_deassert(phy->pad_rst);
|
||||
+ if (ret)
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to deassert UTMI-pads reset: %d\n", ret);
|
||||
+unlock:
|
||||
+ spin_unlock(&utmip_pad_lock);
|
||||
+
|
||||
+ clk_disable_unprepare(phy->pad_clk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int utmip_pad_close(struct tegra_usb_phy *phy)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = clk_prepare_enable(phy->pad_clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to enable UTMI-pads clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = reset_control_assert(phy->pad_rst);
|
||||
+ if (ret)
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to assert UTMI-pads reset: %d\n", ret);
|
||||
+
|
||||
+ udelay(1);
|
||||
+
|
||||
+ clk_disable_unprepare(phy->pad_clk);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static void utmip_pad_power_on(struct tegra_usb_phy *phy)
|
||||
@@ -700,6 +766,9 @@ static void tegra_usb_phy_close(struct tegra_usb_phy *phy)
|
||||
if (!IS_ERR(phy->vbus))
|
||||
regulator_disable(phy->vbus);
|
||||
|
||||
+ if (!phy->is_ulpi_phy)
|
||||
+ utmip_pad_close(phy);
|
||||
+
|
||||
clk_disable_unprepare(phy->pll_u);
|
||||
}
|
||||
|
||||
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
|
||||
index d641ea1660b7..0c5c3ea8b2d7 100644
|
||||
--- a/include/linux/usb/tegra_usb_phy.h
|
||||
+++ b/include/linux/usb/tegra_usb_phy.h
|
||||
@@ -17,6 +17,7 @@
|
||||
#define __TEGRA_USB_PHY_H
|
||||
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/reset.h>
|
||||
#include <linux/usb/otg.h>
|
||||
|
||||
/*
|
||||
@@ -76,6 +77,7 @@ struct tegra_usb_phy {
|
||||
bool is_legacy_phy;
|
||||
bool is_ulpi_phy;
|
||||
int reset_gpio;
|
||||
+ struct reset_control *pad_rst;
|
||||
};
|
||||
|
||||
void tegra_usb_phy_preresume(struct usb_phy *phy);
|
||||
|
||||
From patchwork Mon Apr 9 22:02:59 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3,3/3] usb: phy: Add Kconfig entry for Tegra PHY driver
|
||||
X-Patchwork-Submitter: Dmitry Osipenko <digetx@gmail.com>
|
||||
X-Patchwork-Id: 896434
|
||||
Message-Id: <aad79a65528636ee5fd217cfb7273de10147fc13.1523307883.git.digetx@gmail.com>
|
||||
To: Thierry Reding <thierry.reding@gmail.com>,
|
||||
Jonathan Hunter <jonathanh@nvidia.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Alan Stern <stern@rowland.harvard.edu>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Date: Tue, 10 Apr 2018 01:02:59 +0300
|
||||
From: Dmitry Osipenko <digetx@gmail.com>
|
||||
List-Id: <linux-tegra.vger.kernel.org>
|
||||
|
||||
Tegra's EHCI driver has a build dependency on Tegra's PHY driver and
|
||||
currently Tegra's PHY driver is built only when Tegra's EHCI driver is
|
||||
built. Add own Kconfig entry for the Tegra's PHY driver so that drivers
|
||||
other than ehci-tegra (like ChipIdea UDC) could work with ehci-tegra
|
||||
driver being disabled in kernels config by allowing user to manually
|
||||
select the PHY driver.
|
||||
|
||||
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
---
|
||||
drivers/usb/host/Kconfig | 4 +---
|
||||
drivers/usb/phy/Kconfig | 9 +++++++++
|
||||
drivers/usb/phy/Makefile | 2 +-
|
||||
3 files changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
|
||||
index 5d958da8e1bc..9f0aeb068acb 100644
|
||||
--- a/drivers/usb/host/Kconfig
|
||||
+++ b/drivers/usb/host/Kconfig
|
||||
@@ -234,9 +234,7 @@ config USB_EHCI_TEGRA
|
||||
tristate "NVIDIA Tegra HCD support"
|
||||
depends on ARCH_TEGRA
|
||||
select USB_EHCI_ROOT_HUB_TT
|
||||
- select USB_PHY
|
||||
- select USB_ULPI
|
||||
- select USB_ULPI_VIEWPORT
|
||||
+ select USB_TEGRA_PHY
|
||||
help
|
||||
This driver enables support for the internal USB Host Controllers
|
||||
found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
|
||||
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
|
||||
index 0f8ab981d572..b9b0a44be679 100644
|
||||
--- a/drivers/usb/phy/Kconfig
|
||||
+++ b/drivers/usb/phy/Kconfig
|
||||
@@ -159,6 +159,15 @@ config USB_MXS_PHY
|
||||
|
||||
MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x.
|
||||
|
||||
+config USB_TEGRA_PHY
|
||||
+ tristate "NVIDIA Tegra USB PHY Driver"
|
||||
+ depends on ARCH_TEGRA
|
||||
+ select USB_PHY
|
||||
+ select USB_ULPI
|
||||
+ help
|
||||
+ This driver provides PHY support for the USB controllers found
|
||||
+ on NVIDIA Tegra SoC's.
|
||||
+
|
||||
config USB_ULPI
|
||||
bool "Generic ULPI Transceiver Driver"
|
||||
depends on ARM || ARM64
|
||||
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
|
||||
index 25e579fb92b8..df1d99010079 100644
|
||||
--- a/drivers/usb/phy/Makefile
|
||||
+++ b/drivers/usb/phy/Makefile
|
||||
@@ -16,7 +16,7 @@ obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
|
||||
obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
|
||||
obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
|
||||
obj-$(CONFIG_TWL6030_USB) += phy-twl6030-usb.o
|
||||
-obj-$(CONFIG_USB_EHCI_TEGRA) += phy-tegra-usb.o
|
||||
+obj-$(CONFIG_USB_TEGRA_PHY) += phy-tegra-usb.o
|
||||
obj-$(CONFIG_USB_GPIO_VBUS) += phy-gpio-vbus-usb.o
|
||||
obj-$(CONFIG_USB_ISP1301) += phy-isp1301.o
|
||||
obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o
|
|
@ -0,0 +1,64 @@
|
|||
From 369971aa0101c4cfb84dacaaaa1b5cc5790c14ff Mon Sep 17 00:00:00 2001
|
||||
From: Thierry Reding <treding@nvidia.com>
|
||||
Date: Wed, 11 Apr 2018 10:34:17 +0200
|
||||
Subject: [PATCH] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
|
||||
|
||||
Depending on the kernel configuration, early ARM architecture setup code
|
||||
may have attached the GPU to a DMA/IOMMU mapping that transparently uses
|
||||
the IOMMU to back the DMA API. Tegra requires special handling for IOMMU
|
||||
backed buffers (a special bit in the GPU's MMU page tables indicates the
|
||||
memory path to take: via the SMMU or directly to the memory controller).
|
||||
Transparently backing DMA memory with an IOMMU prevents Nouveau from
|
||||
properly handling such memory accesses and causes memory access faults.
|
||||
|
||||
As a side-note: buffers other than those allocated in instance memory
|
||||
don't need to be physically contiguous from the GPU's perspective since
|
||||
the GPU can map them into contiguous buffers using its own MMU. Mapping
|
||||
these buffers through the IOMMU is unnecessary and will even lead to
|
||||
performance degradation because of the additional translation.
|
||||
|
||||
Signed-off-by: Thierry Reding <treding@nvidia.com>
|
||||
---
|
||||
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
|
||||
index 1f07999aea1d..ac7706f56f6f 100644
|
||||
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
|
||||
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
|
||||
@@ -19,6 +19,11 @@
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
+
|
||||
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
|
||||
+#include <asm/dma-iommu.h>
|
||||
+#endif
|
||||
+
|
||||
#include <core/tegra.h>
|
||||
#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
|
||||
#include "priv.h"
|
||||
@@ -105,6 +110,20 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev)
|
||||
unsigned long pgsize_bitmap;
|
||||
int ret;
|
||||
|
||||
+#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
|
||||
+ if (dev->archdata.mapping) {
|
||||
+ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
|
||||
+
|
||||
+ arm_iommu_release_mapping(mapping);
|
||||
+ arm_iommu_detach_device(dev);
|
||||
+
|
||||
+ if (dev->archdata.dma_coherent)
|
||||
+ set_dma_ops(dev, &arm_coherent_dma_ops);
|
||||
+ else
|
||||
+ set_dma_ops(dev, &arm_dma_ops);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (!tdev->func->iommu_bit)
|
||||
return;
|
||||
|
||||
--
|
||||
2.16.3
|
||||
|
|
@ -0,0 +1,857 @@
|
|||
From patchwork Wed Mar 28 09:50:48 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,1/2] arm64: fpsimd: Split cpu field out from struct fpsimd_state
|
||||
From: Dave P Martin <Dave.Martin@arm.com>
|
||||
X-Patchwork-Id: 10312693
|
||||
Message-Id: <1522230649-22008-2-git-send-email-Dave.Martin@arm.com>
|
||||
To: linux-arm-kernel@lists.infradead.org
|
||||
Cc: Mark Rutland <mark.rutland@arm.com>, Will Deacon <will.deacon@arm.com>,
|
||||
Kees Cook <keescook@chromium.org>
|
||||
Date: Wed, 28 Mar 2018 10:50:48 +0100
|
||||
|
||||
In preparation for using a common representation of the FPSIMD
|
||||
state for tasks and KVM vcpus, this patch separates out the "cpu"
|
||||
field that is used to track the cpu on which the state was most
|
||||
recently loaded.
|
||||
|
||||
This will allow common code to operate on task and vcpu contexts
|
||||
without requiring the cpu field to be stored at the same offset
|
||||
from the FPSIMD register data in both cases. This should avoid the
|
||||
need for messing with the definition of those parts of struct
|
||||
vcpu_arch that are exposed in the KVM user ABI.
|
||||
|
||||
The resulting change is also convenient for grouping and defining
|
||||
the set of thread_struct fields that are supposed to be accessible
|
||||
to copy_{to,from}_user(), which includes user_fpsimd_state but
|
||||
should exclude the cpu field. This patch does not amend the
|
||||
usercopy whitelist to match: that will be addressed in a subsequent
|
||||
patch.
|
||||
|
||||
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
|
||||
---
|
||||
arch/arm64/include/asm/fpsimd.h | 29 ++------------------------
|
||||
arch/arm64/include/asm/processor.h | 4 ++--
|
||||
arch/arm64/kernel/fpsimd.c | 42 +++++++++++++++++++++-----------------
|
||||
arch/arm64/kernel/ptrace.c | 10 ++++-----
|
||||
arch/arm64/kernel/signal.c | 3 +--
|
||||
arch/arm64/kernel/signal32.c | 3 +--
|
||||
6 files changed, 34 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h
|
||||
index 8857a0f..1bfc920 100644
|
||||
--- a/arch/arm64/include/asm/fpsimd.h
|
||||
+++ b/arch/arm64/include/asm/fpsimd.h
|
||||
@@ -24,31 +24,6 @@
|
||||
#include <linux/cache.h>
|
||||
#include <linux/stddef.h>
|
||||
|
||||
-/*
|
||||
- * FP/SIMD storage area has:
|
||||
- * - FPSR and FPCR
|
||||
- * - 32 128-bit data registers
|
||||
- *
|
||||
- * Note that user_fpsimd forms a prefix of this structure, which is
|
||||
- * relied upon in the ptrace FP/SIMD accessors.
|
||||
- */
|
||||
-struct fpsimd_state {
|
||||
- union {
|
||||
- struct user_fpsimd_state user_fpsimd;
|
||||
- struct {
|
||||
- __uint128_t vregs[32];
|
||||
- u32 fpsr;
|
||||
- u32 fpcr;
|
||||
- /*
|
||||
- * For ptrace compatibility, pad to next 128-bit
|
||||
- * boundary here if extending this struct.
|
||||
- */
|
||||
- };
|
||||
- };
|
||||
- /* the id of the last cpu to have restored this state */
|
||||
- unsigned int cpu;
|
||||
-};
|
||||
-
|
||||
#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
|
||||
/* Masks for extracting the FPSR and FPCR from the FPSCR */
|
||||
#define VFP_FPSCR_STAT_MASK 0xf800009f
|
||||
@@ -62,8 +37,8 @@ struct fpsimd_state {
|
||||
|
||||
struct task_struct;
|
||||
|
||||
-extern void fpsimd_save_state(struct fpsimd_state *state);
|
||||
-extern void fpsimd_load_state(struct fpsimd_state *state);
|
||||
+extern void fpsimd_save_state(struct user_fpsimd_state *state);
|
||||
+extern void fpsimd_load_state(struct user_fpsimd_state *state);
|
||||
|
||||
extern void fpsimd_thread_switch(struct task_struct *next);
|
||||
extern void fpsimd_flush_thread(void);
|
||||
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
|
||||
index fce604e..4a04535 100644
|
||||
--- a/arch/arm64/include/asm/processor.h
|
||||
+++ b/arch/arm64/include/asm/processor.h
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <linux/string.h>
|
||||
|
||||
#include <asm/alternative.h>
|
||||
-#include <asm/fpsimd.h>
|
||||
#include <asm/hw_breakpoint.h>
|
||||
#include <asm/lse.h>
|
||||
#include <asm/pgtable-hwdef.h>
|
||||
@@ -107,7 +106,8 @@ struct thread_struct {
|
||||
#ifdef CONFIG_COMPAT
|
||||
unsigned long tp2_value;
|
||||
#endif
|
||||
- struct fpsimd_state fpsimd_state;
|
||||
+ struct user_fpsimd_state fpsimd_state;
|
||||
+ unsigned int fpsimd_cpu;
|
||||
void *sve_state; /* SVE registers, if any */
|
||||
unsigned int sve_vl; /* SVE vector length */
|
||||
unsigned int sve_vl_onexec; /* SVE vl after next exec */
|
||||
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
|
||||
index e7226c4..c4be311 100644
|
||||
--- a/arch/arm64/kernel/fpsimd.c
|
||||
+++ b/arch/arm64/kernel/fpsimd.c
|
||||
@@ -64,7 +64,7 @@
|
||||
* been loaded into its FPSIMD registers most recently, or whether it has
|
||||
* been used to perform kernel mode NEON in the meantime.
|
||||
*
|
||||
- * For (a), we add a 'cpu' field to struct fpsimd_state, which gets updated to
|
||||
+ * For (a), we add a fpsimd_cpu field to thread_struct, which gets updated to
|
||||
* the id of the current CPU every time the state is loaded onto a CPU. For (b),
|
||||
* we add the per-cpu variable 'fpsimd_last_state' (below), which contains the
|
||||
* address of the userland FPSIMD state of the task that was loaded onto the CPU
|
||||
@@ -73,7 +73,7 @@
|
||||
* With this in place, we no longer have to restore the next FPSIMD state right
|
||||
* when switching between tasks. Instead, we can defer this check to userland
|
||||
* resume, at which time we verify whether the CPU's fpsimd_last_state and the
|
||||
- * task's fpsimd_state.cpu are still mutually in sync. If this is the case, we
|
||||
+ * task's fpsimd_cpu are still mutually in sync. If this is the case, we
|
||||
* can omit the FPSIMD restore.
|
||||
*
|
||||
* As an optimization, we use the thread_info flag TIF_FOREIGN_FPSTATE to
|
||||
@@ -90,14 +90,14 @@
|
||||
* flag with local_bh_disable() unless softirqs are already masked.
|
||||
*
|
||||
* For a certain task, the sequence may look something like this:
|
||||
- * - the task gets scheduled in; if both the task's fpsimd_state.cpu field
|
||||
+ * - the task gets scheduled in; if both the task's fpsimd_cpu field
|
||||
* contains the id of the current CPU, and the CPU's fpsimd_last_state per-cpu
|
||||
* variable points to the task's fpsimd_state, the TIF_FOREIGN_FPSTATE flag is
|
||||
* cleared, otherwise it is set;
|
||||
*
|
||||
* - the task returns to userland; if TIF_FOREIGN_FPSTATE is set, the task's
|
||||
* userland FPSIMD state is copied from memory to the registers, the task's
|
||||
- * fpsimd_state.cpu field is set to the id of the current CPU, the current
|
||||
+ * fpsimd_cpu field is set to the id of the current CPU, the current
|
||||
* CPU's fpsimd_last_state pointer is set to this task's fpsimd_state and the
|
||||
* TIF_FOREIGN_FPSTATE flag is cleared;
|
||||
*
|
||||
@@ -115,7 +115,7 @@
|
||||
* whatever is in the FPSIMD registers is not saved to memory, but discarded.
|
||||
*/
|
||||
struct fpsimd_last_state_struct {
|
||||
- struct fpsimd_state *st;
|
||||
+ struct user_fpsimd_state *st;
|
||||
bool sve_in_use;
|
||||
};
|
||||
|
||||
@@ -417,7 +417,7 @@ static void fpsimd_to_sve(struct task_struct *task)
|
||||
{
|
||||
unsigned int vq;
|
||||
void *sst = task->thread.sve_state;
|
||||
- struct fpsimd_state const *fst = &task->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state const *fst = &task->thread.fpsimd_state;
|
||||
unsigned int i;
|
||||
|
||||
if (!system_supports_sve())
|
||||
@@ -443,7 +443,7 @@ static void sve_to_fpsimd(struct task_struct *task)
|
||||
{
|
||||
unsigned int vq;
|
||||
void const *sst = task->thread.sve_state;
|
||||
- struct fpsimd_state *fst = &task->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state *fst = &task->thread.fpsimd_state;
|
||||
unsigned int i;
|
||||
|
||||
if (!system_supports_sve())
|
||||
@@ -539,7 +539,7 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
|
||||
{
|
||||
unsigned int vq;
|
||||
void *sst = task->thread.sve_state;
|
||||
- struct fpsimd_state const *fst = &task->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state const *fst = &task->thread.fpsimd_state;
|
||||
unsigned int i;
|
||||
|
||||
if (!test_tsk_thread_flag(task, TIF_SVE))
|
||||
@@ -908,10 +908,9 @@ void fpsimd_thread_switch(struct task_struct *next)
|
||||
* the TIF_FOREIGN_FPSTATE flag so the state will be loaded
|
||||
* upon the next return to userland.
|
||||
*/
|
||||
- struct fpsimd_state *st = &next->thread.fpsimd_state;
|
||||
-
|
||||
- if (__this_cpu_read(fpsimd_last_state.st) == st
|
||||
- && st->cpu == smp_processor_id())
|
||||
+ if (__this_cpu_read(fpsimd_last_state.st) ==
|
||||
+ &next->thread.fpsimd_state
|
||||
+ && next->thread.fpsimd_cpu == smp_processor_id())
|
||||
clear_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE);
|
||||
else
|
||||
set_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE);
|
||||
@@ -927,7 +926,8 @@ void fpsimd_flush_thread(void)
|
||||
|
||||
local_bh_disable();
|
||||
|
||||
- memset(¤t->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
|
||||
+ memset(¤t->thread.fpsimd_state, 0,
|
||||
+ sizeof current->thread.fpsimd_state);
|
||||
fpsimd_flush_task_state(current);
|
||||
|
||||
if (system_supports_sve()) {
|
||||
@@ -1004,11 +1004,10 @@ static void fpsimd_bind_to_cpu(void)
|
||||
{
|
||||
struct fpsimd_last_state_struct *last =
|
||||
this_cpu_ptr(&fpsimd_last_state);
|
||||
- struct fpsimd_state *st = ¤t->thread.fpsimd_state;
|
||||
|
||||
- last->st = st;
|
||||
+ last->st = ¤t->thread.fpsimd_state;
|
||||
last->sve_in_use = test_thread_flag(TIF_SVE);
|
||||
- st->cpu = smp_processor_id();
|
||||
+ current->thread.fpsimd_cpu = smp_processor_id();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1043,7 +1042,7 @@ void fpsimd_update_current_state(struct user_fpsimd_state const *state)
|
||||
|
||||
local_bh_disable();
|
||||
|
||||
- current->thread.fpsimd_state.user_fpsimd = *state;
|
||||
+ current->thread.fpsimd_state = *state;
|
||||
if (system_supports_sve() && test_thread_flag(TIF_SVE))
|
||||
fpsimd_to_sve(current);
|
||||
|
||||
@@ -1055,12 +1054,17 @@ void fpsimd_update_current_state(struct user_fpsimd_state const *state)
|
||||
local_bh_enable();
|
||||
}
|
||||
|
||||
+void fpsimd_flush_state(unsigned int *cpu)
|
||||
+{
|
||||
+ *cpu = NR_CPUS;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Invalidate live CPU copies of task t's FPSIMD state
|
||||
*/
|
||||
void fpsimd_flush_task_state(struct task_struct *t)
|
||||
{
|
||||
- t->thread.fpsimd_state.cpu = NR_CPUS;
|
||||
+ fpsimd_flush_state(&t->thread.fpsimd_cpu);
|
||||
}
|
||||
|
||||
static inline void fpsimd_flush_cpu_state(void)
|
||||
@@ -1159,7 +1163,7 @@ EXPORT_SYMBOL(kernel_neon_end);
|
||||
|
||||
#ifdef CONFIG_EFI
|
||||
|
||||
-static DEFINE_PER_CPU(struct fpsimd_state, efi_fpsimd_state);
|
||||
+static DEFINE_PER_CPU(struct user_fpsimd_state, efi_fpsimd_state);
|
||||
static DEFINE_PER_CPU(bool, efi_fpsimd_state_used);
|
||||
static DEFINE_PER_CPU(bool, efi_sve_state_used);
|
||||
|
||||
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
|
||||
index 9ae31f7..fdeaba0de 100644
|
||||
--- a/arch/arm64/kernel/ptrace.c
|
||||
+++ b/arch/arm64/kernel/ptrace.c
|
||||
@@ -629,7 +629,7 @@ static int __fpr_get(struct task_struct *target,
|
||||
|
||||
sve_sync_to_fpsimd(target);
|
||||
|
||||
- uregs = &target->thread.fpsimd_state.user_fpsimd;
|
||||
+ uregs = &target->thread.fpsimd_state;
|
||||
|
||||
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs,
|
||||
start_pos, start_pos + sizeof(*uregs));
|
||||
@@ -660,14 +660,14 @@ static int __fpr_set(struct task_struct *target,
|
||||
*/
|
||||
sve_sync_to_fpsimd(target);
|
||||
|
||||
- newstate = target->thread.fpsimd_state.user_fpsimd;
|
||||
+ newstate = target->thread.fpsimd_state;
|
||||
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newstate,
|
||||
start_pos, start_pos + sizeof(newstate));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- target->thread.fpsimd_state.user_fpsimd = newstate;
|
||||
+ target->thread.fpsimd_state = newstate;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1169,7 +1169,7 @@ static int compat_vfp_get(struct task_struct *target,
|
||||
compat_ulong_t fpscr;
|
||||
int ret, vregs_end_pos;
|
||||
|
||||
- uregs = &target->thread.fpsimd_state.user_fpsimd;
|
||||
+ uregs = &target->thread.fpsimd_state;
|
||||
|
||||
if (target == current)
|
||||
fpsimd_preserve_current_state();
|
||||
@@ -1202,7 +1202,7 @@ static int compat_vfp_set(struct task_struct *target,
|
||||
compat_ulong_t fpscr;
|
||||
int ret, vregs_end_pos;
|
||||
|
||||
- uregs = &target->thread.fpsimd_state.user_fpsimd;
|
||||
+ uregs = &target->thread.fpsimd_state;
|
||||
|
||||
vregs_end_pos = VFP_STATE_SIZE - sizeof(compat_ulong_t);
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0,
|
||||
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
|
||||
index f60c052..d026615 100644
|
||||
--- a/arch/arm64/kernel/signal.c
|
||||
+++ b/arch/arm64/kernel/signal.c
|
||||
@@ -178,8 +178,7 @@ static void __user *apply_user_offset(
|
||||
|
||||
static int preserve_fpsimd_context(struct fpsimd_context __user *ctx)
|
||||
{
|
||||
- struct user_fpsimd_state const *fpsimd =
|
||||
- ¤t->thread.fpsimd_state.user_fpsimd;
|
||||
+ struct user_fpsimd_state const *fpsimd = ¤t->thread.fpsimd_state;
|
||||
int err;
|
||||
|
||||
/* copy the FP and status/control registers */
|
||||
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
|
||||
index 79feb86..4ea38d3 100644
|
||||
--- a/arch/arm64/kernel/signal32.c
|
||||
+++ b/arch/arm64/kernel/signal32.c
|
||||
@@ -148,8 +148,7 @@ union __fpsimd_vreg {
|
||||
|
||||
static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)
|
||||
{
|
||||
- struct user_fpsimd_state const *fpsimd =
|
||||
- ¤t->thread.fpsimd_state.user_fpsimd;
|
||||
+ struct user_fpsimd_state const *fpsimd = ¤t->thread.fpsimd_state;
|
||||
compat_ulong_t magic = VFP_MAGIC;
|
||||
compat_ulong_t size = VFP_STORAGE_SIZE;
|
||||
compat_ulong_t fpscr, fpexc;
|
||||
From patchwork Wed Mar 28 09:50:49 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,2/2] arm64: uaccess: Fix omissions from usercopy whitelist
|
||||
From: Dave P Martin <Dave.Martin@arm.com>
|
||||
X-Patchwork-Id: 10312691
|
||||
Message-Id: <1522230649-22008-3-git-send-email-Dave.Martin@arm.com>
|
||||
To: linux-arm-kernel@lists.infradead.org
|
||||
Cc: Mark Rutland <mark.rutland@arm.com>, Will Deacon <will.deacon@arm.com>,
|
||||
Kees Cook <keescook@chromium.org>
|
||||
Date: Wed, 28 Mar 2018 10:50:49 +0100
|
||||
|
||||
When the hardend usercopy support was added for arm64, it was
|
||||
concluded that all cases of usercopy into and out of thread_struct
|
||||
were statically sized and so didn't require explicit whitelisting
|
||||
of the appropriate fields in thread_struct.
|
||||
|
||||
Testing with usercopy hardening enabled has revealed that this is
|
||||
not the case for certain ptrace regset manipulation calls on arm64.
|
||||
This occurs because the sizes of usercopies associated with the
|
||||
regset API are dynamic by construction, and because arm64 does not
|
||||
always stage such copies via the stack: indeed the regset API is
|
||||
designed to avoid the need for that by adding some bounds checking.
|
||||
|
||||
This is currently believed to affect only the fpsimd and TLS
|
||||
registers.
|
||||
|
||||
Because the whitelisted fields in thread_struct must be contiguous,
|
||||
this patch groups them together in a nested struct. It is also
|
||||
necessary to be able to determine the location and size of that
|
||||
struct, so rather than making the struct anonymous (which would
|
||||
save on edits elsewhere) or adding an anonymous union containing
|
||||
named and unnamed instances of the same struct (gross), this patch
|
||||
gives the struct a name and makes the necessary edits to code that
|
||||
references it (noisy but simple).
|
||||
|
||||
Care is needed to ensure that the new struct does not contain
|
||||
padding (which the usercopy hardening would fail to protect).
|
||||
|
||||
For this reason, the presence of tp2_value is made unconditional,
|
||||
since a padding field would be needed there in any case. This pads
|
||||
up to the 16-byte alignment required by struct user_fpsimd_state.
|
||||
|
||||
Reported-by: Mark Rutland <mark.rutland@arm.com>
|
||||
Fixes: 9e8084d3f761 ("arm64: Implement thread_struct whitelist for hardened usercopy")
|
||||
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
|
||||
Acked-by: Kees Cook <keescook@chromium.org>
|
||||
---
|
||||
|
||||
Changes since v1:
|
||||
|
||||
* Add a BUILD_BUG_ON() check for padding in the whitelist struct.
|
||||
* Move to using sizeof_field() for assigning *size; get rid of the
|
||||
dummy pointer that was used previously.
|
||||
* Delete bogus comment about why no whitelist is (was) needed.
|
||||
---
|
||||
arch/arm64/include/asm/processor.h | 38 +++++++++++++++++++-----------
|
||||
arch/arm64/kernel/fpsimd.c | 47 +++++++++++++++++++-------------------
|
||||
arch/arm64/kernel/process.c | 6 ++---
|
||||
arch/arm64/kernel/ptrace.c | 30 ++++++++++++------------
|
||||
arch/arm64/kernel/signal.c | 3 ++-
|
||||
arch/arm64/kernel/signal32.c | 3 ++-
|
||||
arch/arm64/kernel/sys_compat.c | 2 +-
|
||||
7 files changed, 72 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
|
||||
index 4a04535..224af48 100644
|
||||
--- a/arch/arm64/include/asm/processor.h
|
||||
+++ b/arch/arm64/include/asm/processor.h
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
+#include <linux/build_bug.h>
|
||||
+#include <linux/stddef.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include <asm/alternative.h>
|
||||
@@ -102,11 +104,18 @@ struct cpu_context {
|
||||
|
||||
struct thread_struct {
|
||||
struct cpu_context cpu_context; /* cpu context */
|
||||
- unsigned long tp_value; /* TLS register */
|
||||
-#ifdef CONFIG_COMPAT
|
||||
- unsigned long tp2_value;
|
||||
-#endif
|
||||
- struct user_fpsimd_state fpsimd_state;
|
||||
+
|
||||
+ /*
|
||||
+ * Whitelisted fields for hardened usercopy:
|
||||
+ * Maintainers must ensure manually that this contains no
|
||||
+ * implicit padding.
|
||||
+ */
|
||||
+ struct {
|
||||
+ unsigned long tp_value; /* TLS register */
|
||||
+ unsigned long tp2_value;
|
||||
+ struct user_fpsimd_state fpsimd_state;
|
||||
+ } uw;
|
||||
+
|
||||
unsigned int fpsimd_cpu;
|
||||
void *sve_state; /* SVE registers, if any */
|
||||
unsigned int sve_vl; /* SVE vector length */
|
||||
@@ -116,14 +125,17 @@ struct thread_struct {
|
||||
struct debug_info debug; /* debugging */
|
||||
};
|
||||
|
||||
-/*
|
||||
- * Everything usercopied to/from thread_struct is statically-sized, so
|
||||
- * no hardened usercopy whitelist is needed.
|
||||
- */
|
||||
static inline void arch_thread_struct_whitelist(unsigned long *offset,
|
||||
unsigned long *size)
|
||||
{
|
||||
- *offset = *size = 0;
|
||||
+ /* Verify that there is no padding among the whitelisted fields: */
|
||||
+ BUILD_BUG_ON(sizeof_field(struct thread_struct, uw) !=
|
||||
+ sizeof_field(struct thread_struct, uw.tp_value) +
|
||||
+ sizeof_field(struct thread_struct, uw.tp2_value) +
|
||||
+ sizeof_field(struct thread_struct, uw.fpsimd_state));
|
||||
+
|
||||
+ *offset = offsetof(struct thread_struct, uw);
|
||||
+ *size = sizeof_field(struct thread_struct, uw);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
@@ -131,13 +143,13 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
|
||||
({ \
|
||||
unsigned long *__tls; \
|
||||
if (is_compat_thread(task_thread_info(t))) \
|
||||
- __tls = &(t)->thread.tp2_value; \
|
||||
+ __tls = &(t)->thread.uw.tp2_value; \
|
||||
else \
|
||||
- __tls = &(t)->thread.tp_value; \
|
||||
+ __tls = &(t)->thread.uw.tp_value; \
|
||||
__tls; \
|
||||
})
|
||||
#else
|
||||
-#define task_user_tls(t) (&(t)->thread.tp_value)
|
||||
+#define task_user_tls(t) (&(t)->thread.uw.tp_value)
|
||||
#endif
|
||||
|
||||
/* Sync TPIDR_EL0 back to thread_struct for current */
|
||||
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
|
||||
index c4be311..7a8ac960b6 100644
|
||||
--- a/arch/arm64/kernel/fpsimd.c
|
||||
+++ b/arch/arm64/kernel/fpsimd.c
|
||||
@@ -222,7 +222,7 @@ static void sve_user_enable(void)
|
||||
* sets TIF_SVE.
|
||||
*
|
||||
* When stored, FPSIMD registers V0-V31 are encoded in
|
||||
- * task->fpsimd_state; bits [max : 128] for each of Z0-Z31 are
|
||||
+ * task->thread.uw.fpsimd_state; bits [max : 128] for each of Z0-Z31 are
|
||||
* logically zero but not stored anywhere; P0-P15 and FFR are not
|
||||
* stored and have unspecified values from userspace's point of
|
||||
* view. For hygiene purposes, the kernel zeroes them on next use,
|
||||
@@ -231,9 +231,9 @@ static void sve_user_enable(void)
|
||||
* task->thread.sve_state does not need to be non-NULL, valid or any
|
||||
* particular size: it must not be dereferenced.
|
||||
*
|
||||
- * * FPSR and FPCR are always stored in task->fpsimd_state irrespctive of
|
||||
- * whether TIF_SVE is clear or set, since these are not vector length
|
||||
- * dependent.
|
||||
+ * * FPSR and FPCR are always stored in task->thread.uw.fpsimd_state
|
||||
+ * irrespective of whether TIF_SVE is clear or set, since these are
|
||||
+ * not vector length dependent.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -251,10 +251,10 @@ static void task_fpsimd_load(void)
|
||||
|
||||
if (system_supports_sve() && test_thread_flag(TIF_SVE))
|
||||
sve_load_state(sve_pffr(current),
|
||||
- ¤t->thread.fpsimd_state.fpsr,
|
||||
+ ¤t->thread.uw.fpsimd_state.fpsr,
|
||||
sve_vq_from_vl(current->thread.sve_vl) - 1);
|
||||
else
|
||||
- fpsimd_load_state(¤t->thread.fpsimd_state);
|
||||
+ fpsimd_load_state(¤t->thread.uw.fpsimd_state);
|
||||
|
||||
if (system_supports_sve()) {
|
||||
/* Toggle SVE trapping for userspace if needed */
|
||||
@@ -291,9 +291,9 @@ static void task_fpsimd_save(void)
|
||||
}
|
||||
|
||||
sve_save_state(sve_pffr(current),
|
||||
- ¤t->thread.fpsimd_state.fpsr);
|
||||
+ ¤t->thread.uw.fpsimd_state.fpsr);
|
||||
} else
|
||||
- fpsimd_save_state(¤t->thread.fpsimd_state);
|
||||
+ fpsimd_save_state(¤t->thread.uw.fpsimd_state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,20 +404,21 @@ static int __init sve_sysctl_init(void) { return 0; }
|
||||
(SVE_SIG_ZREG_OFFSET(vq, n) - SVE_SIG_REGS_OFFSET))
|
||||
|
||||
/*
|
||||
- * Transfer the FPSIMD state in task->thread.fpsimd_state to
|
||||
+ * Transfer the FPSIMD state in task->thread.uw.fpsimd_state to
|
||||
* task->thread.sve_state.
|
||||
*
|
||||
* Task can be a non-runnable task, or current. In the latter case,
|
||||
* softirqs (and preemption) must be disabled.
|
||||
* task->thread.sve_state must point to at least sve_state_size(task)
|
||||
* bytes of allocated kernel memory.
|
||||
- * task->thread.fpsimd_state must be up to date before calling this function.
|
||||
+ * task->thread.uw.fpsimd_state must be up to date before calling this
|
||||
+ * function.
|
||||
*/
|
||||
static void fpsimd_to_sve(struct task_struct *task)
|
||||
{
|
||||
unsigned int vq;
|
||||
void *sst = task->thread.sve_state;
|
||||
- struct user_fpsimd_state const *fst = &task->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
|
||||
unsigned int i;
|
||||
|
||||
if (!system_supports_sve())
|
||||
@@ -431,7 +432,7 @@ static void fpsimd_to_sve(struct task_struct *task)
|
||||
|
||||
/*
|
||||
* Transfer the SVE state in task->thread.sve_state to
|
||||
- * task->thread.fpsimd_state.
|
||||
+ * task->thread.uw.fpsimd_state.
|
||||
*
|
||||
* Task can be a non-runnable task, or current. In the latter case,
|
||||
* softirqs (and preemption) must be disabled.
|
||||
@@ -443,7 +444,7 @@ static void sve_to_fpsimd(struct task_struct *task)
|
||||
{
|
||||
unsigned int vq;
|
||||
void const *sst = task->thread.sve_state;
|
||||
- struct user_fpsimd_state *fst = &task->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state *fst = &task->thread.uw.fpsimd_state;
|
||||
unsigned int i;
|
||||
|
||||
if (!system_supports_sve())
|
||||
@@ -510,7 +511,7 @@ void fpsimd_sync_to_sve(struct task_struct *task)
|
||||
}
|
||||
|
||||
/*
|
||||
- * Ensure that task->thread.fpsimd_state is up to date with respect to
|
||||
+ * Ensure that task->thread.uw.fpsimd_state is up to date with respect to
|
||||
* the user task, irrespective of whether SVE is in use or not.
|
||||
*
|
||||
* This should only be called by ptrace. task must be non-runnable.
|
||||
@@ -525,21 +526,21 @@ void sve_sync_to_fpsimd(struct task_struct *task)
|
||||
|
||||
/*
|
||||
* Ensure that task->thread.sve_state is up to date with respect to
|
||||
- * the task->thread.fpsimd_state.
|
||||
+ * the task->thread.uw.fpsimd_state.
|
||||
*
|
||||
* This should only be called by ptrace to merge new FPSIMD register
|
||||
* values into a task for which SVE is currently active.
|
||||
* task must be non-runnable.
|
||||
* task->thread.sve_state must point to at least sve_state_size(task)
|
||||
* bytes of allocated kernel memory.
|
||||
- * task->thread.fpsimd_state must already have been initialised with
|
||||
+ * task->thread.uw.fpsimd_state must already have been initialised with
|
||||
* the new FPSIMD register values to be merged in.
|
||||
*/
|
||||
void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
|
||||
{
|
||||
unsigned int vq;
|
||||
void *sst = task->thread.sve_state;
|
||||
- struct user_fpsimd_state const *fst = &task->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
|
||||
unsigned int i;
|
||||
|
||||
if (!test_tsk_thread_flag(task, TIF_SVE))
|
||||
@@ -909,7 +910,7 @@ void fpsimd_thread_switch(struct task_struct *next)
|
||||
* upon the next return to userland.
|
||||
*/
|
||||
if (__this_cpu_read(fpsimd_last_state.st) ==
|
||||
- &next->thread.fpsimd_state
|
||||
+ &next->thread.uw.fpsimd_state
|
||||
&& next->thread.fpsimd_cpu == smp_processor_id())
|
||||
clear_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE);
|
||||
else
|
||||
@@ -926,8 +927,8 @@ void fpsimd_flush_thread(void)
|
||||
|
||||
local_bh_disable();
|
||||
|
||||
- memset(¤t->thread.fpsimd_state, 0,
|
||||
- sizeof current->thread.fpsimd_state);
|
||||
+ memset(¤t->thread.uw.fpsimd_state, 0,
|
||||
+ sizeof current->thread.uw.fpsimd_state);
|
||||
fpsimd_flush_task_state(current);
|
||||
|
||||
if (system_supports_sve()) {
|
||||
@@ -986,7 +987,7 @@ void fpsimd_preserve_current_state(void)
|
||||
|
||||
/*
|
||||
* Like fpsimd_preserve_current_state(), but ensure that
|
||||
- * current->thread.fpsimd_state is updated so that it can be copied to
|
||||
+ * current->thread.uw.fpsimd_state is updated so that it can be copied to
|
||||
* the signal frame.
|
||||
*/
|
||||
void fpsimd_signal_preserve_current_state(void)
|
||||
@@ -1005,7 +1006,7 @@ static void fpsimd_bind_to_cpu(void)
|
||||
struct fpsimd_last_state_struct *last =
|
||||
this_cpu_ptr(&fpsimd_last_state);
|
||||
|
||||
- last->st = ¤t->thread.fpsimd_state;
|
||||
+ last->st = ¤t->thread.uw.fpsimd_state;
|
||||
last->sve_in_use = test_thread_flag(TIF_SVE);
|
||||
current->thread.fpsimd_cpu = smp_processor_id();
|
||||
}
|
||||
@@ -1042,7 +1043,7 @@ void fpsimd_update_current_state(struct user_fpsimd_state const *state)
|
||||
|
||||
local_bh_disable();
|
||||
|
||||
- current->thread.fpsimd_state = *state;
|
||||
+ current->thread.uw.fpsimd_state = *state;
|
||||
if (system_supports_sve() && test_thread_flag(TIF_SVE))
|
||||
fpsimd_to_sve(current);
|
||||
|
||||
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
|
||||
index c0da6ef..f08a2ed 100644
|
||||
--- a/arch/arm64/kernel/process.c
|
||||
+++ b/arch/arm64/kernel/process.c
|
||||
@@ -257,7 +257,7 @@ static void tls_thread_flush(void)
|
||||
write_sysreg(0, tpidr_el0);
|
||||
|
||||
if (is_compat_task()) {
|
||||
- current->thread.tp_value = 0;
|
||||
+ current->thread.uw.tp_value = 0;
|
||||
|
||||
/*
|
||||
* We need to ensure ordering between the shadow state and the
|
||||
@@ -351,7 +351,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
|
||||
* for the new thread.
|
||||
*/
|
||||
if (clone_flags & CLONE_SETTLS)
|
||||
- p->thread.tp_value = childregs->regs[3];
|
||||
+ p->thread.uw.tp_value = childregs->regs[3];
|
||||
} else {
|
||||
memset(childregs, 0, sizeof(struct pt_regs));
|
||||
childregs->pstate = PSR_MODE_EL1h;
|
||||
@@ -379,7 +379,7 @@ static void tls_thread_switch(struct task_struct *next)
|
||||
tls_preserve_current_state();
|
||||
|
||||
if (is_compat_thread(task_thread_info(next)))
|
||||
- write_sysreg(next->thread.tp_value, tpidrro_el0);
|
||||
+ write_sysreg(next->thread.uw.tp_value, tpidrro_el0);
|
||||
else if (!arm64_kernel_unmapped_at_el0())
|
||||
write_sysreg(0, tpidrro_el0);
|
||||
|
||||
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
|
||||
index fdeaba0de..436a132 100644
|
||||
--- a/arch/arm64/kernel/ptrace.c
|
||||
+++ b/arch/arm64/kernel/ptrace.c
|
||||
@@ -629,7 +629,7 @@ static int __fpr_get(struct task_struct *target,
|
||||
|
||||
sve_sync_to_fpsimd(target);
|
||||
|
||||
- uregs = &target->thread.fpsimd_state;
|
||||
+ uregs = &target->thread.uw.fpsimd_state;
|
||||
|
||||
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs,
|
||||
start_pos, start_pos + sizeof(*uregs));
|
||||
@@ -655,19 +655,19 @@ static int __fpr_set(struct task_struct *target,
|
||||
struct user_fpsimd_state newstate;
|
||||
|
||||
/*
|
||||
- * Ensure target->thread.fpsimd_state is up to date, so that a
|
||||
+ * Ensure target->thread.uw.fpsimd_state is up to date, so that a
|
||||
* short copyin can't resurrect stale data.
|
||||
*/
|
||||
sve_sync_to_fpsimd(target);
|
||||
|
||||
- newstate = target->thread.fpsimd_state;
|
||||
+ newstate = target->thread.uw.fpsimd_state;
|
||||
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newstate,
|
||||
start_pos, start_pos + sizeof(newstate));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- target->thread.fpsimd_state = newstate;
|
||||
+ target->thread.uw.fpsimd_state = newstate;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -692,7 +692,7 @@ static int tls_get(struct task_struct *target, const struct user_regset *regset,
|
||||
unsigned int pos, unsigned int count,
|
||||
void *kbuf, void __user *ubuf)
|
||||
{
|
||||
- unsigned long *tls = &target->thread.tp_value;
|
||||
+ unsigned long *tls = &target->thread.uw.tp_value;
|
||||
|
||||
if (target == current)
|
||||
tls_preserve_current_state();
|
||||
@@ -705,13 +705,13 @@ static int tls_set(struct task_struct *target, const struct user_regset *regset,
|
||||
const void *kbuf, const void __user *ubuf)
|
||||
{
|
||||
int ret;
|
||||
- unsigned long tls = target->thread.tp_value;
|
||||
+ unsigned long tls = target->thread.uw.tp_value;
|
||||
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- target->thread.tp_value = tls;
|
||||
+ target->thread.uw.tp_value = tls;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ static int sve_get(struct task_struct *target,
|
||||
start = end;
|
||||
end = SVE_PT_SVE_FPCR_OFFSET(vq) + SVE_PT_SVE_FPCR_SIZE;
|
||||
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
|
||||
- &target->thread.fpsimd_state.fpsr,
|
||||
+ &target->thread.uw.fpsimd_state.fpsr,
|
||||
start, end);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -941,7 +941,7 @@ static int sve_set(struct task_struct *target,
|
||||
start = end;
|
||||
end = SVE_PT_SVE_FPCR_OFFSET(vq) + SVE_PT_SVE_FPCR_SIZE;
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
|
||||
- &target->thread.fpsimd_state.fpsr,
|
||||
+ &target->thread.uw.fpsimd_state.fpsr,
|
||||
start, end);
|
||||
|
||||
out:
|
||||
@@ -1169,7 +1169,7 @@ static int compat_vfp_get(struct task_struct *target,
|
||||
compat_ulong_t fpscr;
|
||||
int ret, vregs_end_pos;
|
||||
|
||||
- uregs = &target->thread.fpsimd_state;
|
||||
+ uregs = &target->thread.uw.fpsimd_state;
|
||||
|
||||
if (target == current)
|
||||
fpsimd_preserve_current_state();
|
||||
@@ -1202,7 +1202,7 @@ static int compat_vfp_set(struct task_struct *target,
|
||||
compat_ulong_t fpscr;
|
||||
int ret, vregs_end_pos;
|
||||
|
||||
- uregs = &target->thread.fpsimd_state;
|
||||
+ uregs = &target->thread.uw.fpsimd_state;
|
||||
|
||||
vregs_end_pos = VFP_STATE_SIZE - sizeof(compat_ulong_t);
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0,
|
||||
@@ -1225,7 +1225,7 @@ static int compat_tls_get(struct task_struct *target,
|
||||
const struct user_regset *regset, unsigned int pos,
|
||||
unsigned int count, void *kbuf, void __user *ubuf)
|
||||
{
|
||||
- compat_ulong_t tls = (compat_ulong_t)target->thread.tp_value;
|
||||
+ compat_ulong_t tls = (compat_ulong_t)target->thread.uw.tp_value;
|
||||
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
|
||||
}
|
||||
|
||||
@@ -1235,13 +1235,13 @@ static int compat_tls_set(struct task_struct *target,
|
||||
const void __user *ubuf)
|
||||
{
|
||||
int ret;
|
||||
- compat_ulong_t tls = target->thread.tp_value;
|
||||
+ compat_ulong_t tls = target->thread.uw.tp_value;
|
||||
|
||||
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- target->thread.tp_value = tls;
|
||||
+ target->thread.uw.tp_value = tls;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1538,7 +1538,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
|
||||
break;
|
||||
|
||||
case COMPAT_PTRACE_GET_THREAD_AREA:
|
||||
- ret = put_user((compat_ulong_t)child->thread.tp_value,
|
||||
+ ret = put_user((compat_ulong_t)child->thread.uw.tp_value,
|
||||
(compat_ulong_t __user *)datap);
|
||||
break;
|
||||
|
||||
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
|
||||
index d026615..a0c4138 100644
|
||||
--- a/arch/arm64/kernel/signal.c
|
||||
+++ b/arch/arm64/kernel/signal.c
|
||||
@@ -178,7 +178,8 @@ static void __user *apply_user_offset(
|
||||
|
||||
static int preserve_fpsimd_context(struct fpsimd_context __user *ctx)
|
||||
{
|
||||
- struct user_fpsimd_state const *fpsimd = ¤t->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state const *fpsimd =
|
||||
+ ¤t->thread.uw.fpsimd_state;
|
||||
int err;
|
||||
|
||||
/* copy the FP and status/control registers */
|
||||
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
|
||||
index 4ea38d3..884177a 100644
|
||||
--- a/arch/arm64/kernel/signal32.c
|
||||
+++ b/arch/arm64/kernel/signal32.c
|
||||
@@ -148,7 +148,8 @@ union __fpsimd_vreg {
|
||||
|
||||
static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)
|
||||
{
|
||||
- struct user_fpsimd_state const *fpsimd = ¤t->thread.fpsimd_state;
|
||||
+ struct user_fpsimd_state const *fpsimd =
|
||||
+ ¤t->thread.uw.fpsimd_state;
|
||||
compat_ulong_t magic = VFP_MAGIC;
|
||||
compat_ulong_t size = VFP_STORAGE_SIZE;
|
||||
compat_ulong_t fpscr, fpexc;
|
||||
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c
|
||||
index a382b2a..9155989 100644
|
||||
--- a/arch/arm64/kernel/sys_compat.c
|
||||
+++ b/arch/arm64/kernel/sys_compat.c
|
||||
@@ -88,7 +88,7 @@ long compat_arm_syscall(struct pt_regs *regs)
|
||||
return do_compat_cache_op(regs->regs[0], regs->regs[1], regs->regs[2]);
|
||||
|
||||
case __ARM_NR_compat_set_tls:
|
||||
- current->thread.tp_value = regs->regs[0];
|
||||
+ current->thread.uw.tp_value = regs->regs[0];
|
||||
|
||||
/*
|
||||
* Protect against register corruption from context switch.
|
|
@ -1,77 +0,0 @@
|
|||
From patchwork Sat Apr 8 07:18:40 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: reset: hi6220: Set module license so that it can be loaded
|
||||
From: Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
X-Patchwork-Id: 9670985
|
||||
Message-Id: <20170408071840.29380-1-lintonrjeremy@gmail.com>
|
||||
To: linux-kernel@vger.kernel.org
|
||||
Cc: p.zabel@pengutronix.de, saberlily.xia@hisilicon.com,
|
||||
puck.chen@hisilicon.com, xinliang.liu@linaro.org,
|
||||
Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
Date: Sat, 8 Apr 2017 02:18:40 -0500
|
||||
|
||||
The hi6220_reset driver can be built as a standalone module
|
||||
yet it cannot be loaded because it depends on GPL exported symbols.
|
||||
|
||||
Lets set the module license so that the module loads, and things like
|
||||
the on-board kirin drm starts working.
|
||||
|
||||
Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
|
||||
---
|
||||
drivers/reset/hisilicon/hi6220_reset.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/drivers/reset/hisilicon/hi6220_reset.c b/drivers/reset/hisilicon/hi6220_reset.c
|
||||
index 35ce53e..d5e5229 100644
|
||||
--- a/drivers/reset/hisilicon/hi6220_reset.c
|
||||
+++ b/drivers/reset/hisilicon/hi6220_reset.c
|
||||
@@ -155,3 +155,5 @@ static int __init hi6220_reset_init(void)
|
||||
}
|
||||
|
||||
postcore_initcall(hi6220_reset_init);
|
||||
+
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
From patchwork Mon Apr 3 05:28:42 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,1/2] regulator: hi655x: Describe consumed platform device
|
||||
From: Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
X-Patchwork-Id: 9658793
|
||||
Message-Id: <20170403052843.12711-2-lintonrjeremy@gmail.com>
|
||||
To: linux-kernel@vger.kernel.org
|
||||
Cc: broonie@kernel.org, lgirdwood@gmail.com, puck.chen@hisilicon.com,
|
||||
lee.jones@linaro.org, Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
Date: Mon, 3 Apr 2017 00:28:42 -0500
|
||||
|
||||
The hi655x-regulator driver consumes a similarly named platform device.
|
||||
Adding that to the module device table, allows modprobe to locate this
|
||||
driver once the device is created.
|
||||
|
||||
Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
---
|
||||
drivers/regulator/hi655x-regulator.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/drivers/regulator/hi655x-regulator.c b/drivers/regulator/hi655x-regulator.c
|
||||
index 065c100..36ae54b 100644
|
||||
--- a/drivers/regulator/hi655x-regulator.c
|
||||
+++ b/drivers/regulator/hi655x-regulator.c
|
||||
@@ -214,7 +214,14 @@ static int hi655x_regulator_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static const struct platform_device_id hi655x_regulator_table[] = {
|
||||
+ { .name = "hi655x-regulator" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(platform, hi655x_regulator_table);
|
||||
+
|
||||
static struct platform_driver hi655x_regulator_driver = {
|
||||
+ .id_table = hi655x_regulator_table,
|
||||
.driver = {
|
||||
.name = "hi655x-regulator",
|
||||
},
|
|
@ -1,93 +0,0 @@
|
|||
From patchwork Thu Oct 6 09:52:07 2016
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: arm64: mm: Fix memmap to be initialized for the entire section
|
||||
From: Robert Richter <rrichter@cavium.com>
|
||||
X-Patchwork-Id: 9364537
|
||||
Message-Id: <1475747527-32387-1-git-send-email-rrichter@cavium.com>
|
||||
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon
|
||||
<will.deacon@arm.com>
|
||||
Cc: Mark Rutland <mark.rutland@arm.com>, linux-efi@vger.kernel.org,
|
||||
David Daney <david.daney@cavium.com>,
|
||||
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
|
||||
linux-kernel@vger.kernel.org, Robert Richter <rrichter@cavium.com>,
|
||||
Hanjun Guo <hanjun.guo@linaro.org>, linux-arm-kernel@lists.infradead.org
|
||||
Date: Thu, 6 Oct 2016 11:52:07 +0200
|
||||
|
||||
There is a memory setup problem on ThunderX systems with certain
|
||||
memory configurations. The symptom is
|
||||
|
||||
kernel BUG at mm/page_alloc.c:1848!
|
||||
|
||||
This happens for some configs with 64k page size enabled. The bug
|
||||
triggers for page zones with some pages in the zone not assigned to
|
||||
this particular zone. In my case some pages that are marked as nomap
|
||||
were not reassigned to the new zone of node 1, so those are still
|
||||
assigned to node 0.
|
||||
|
||||
The reason for the mis-configuration is a change in pfn_valid() which
|
||||
reports pages marked nomap as invalid:
|
||||
|
||||
68709f45385a arm64: only consider memblocks with NOMAP cleared for linear mapping
|
||||
|
||||
This causes pages marked as nomap being no long reassigned to the new
|
||||
zone in memmap_init_zone() by calling __init_single_pfn().
|
||||
|
||||
Fixing this by restoring the old behavior of pfn_valid() to use
|
||||
memblock_is_memory(). Also changing users of pfn_valid() in arm64 code
|
||||
to use memblock_is_map_memory() where necessary. This only affects
|
||||
code in ioremap.c. The code in mmu.c still can use the new version of
|
||||
pfn_valid().
|
||||
|
||||
Should be marked stable v4.5..
|
||||
|
||||
Signed-off-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
arch/arm64/mm/init.c | 2 +-
|
||||
arch/arm64/mm/ioremap.c | 5 +++--
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
|
||||
index bbb7ee76e319..25b8659c2a9f 100644
|
||||
--- a/arch/arm64/mm/init.c
|
||||
+++ b/arch/arm64/mm/init.c
|
||||
@@ -147,7 +147,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
|
||||
#ifdef CONFIG_HAVE_ARCH_PFN_VALID
|
||||
int pfn_valid(unsigned long pfn)
|
||||
{
|
||||
- return memblock_is_map_memory(pfn << PAGE_SHIFT);
|
||||
+ return memblock_is_memory(pfn << PAGE_SHIFT);
|
||||
}
|
||||
EXPORT_SYMBOL(pfn_valid);
|
||||
#endif
|
||||
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
|
||||
index 01e88c8bcab0..c17c220b0c48 100644
|
||||
--- a/arch/arm64/mm/ioremap.c
|
||||
+++ b/arch/arm64/mm/ioremap.c
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/export.h>
|
||||
+#include <linux/memblock.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/io.h>
|
||||
@@ -55,7 +56,7 @@ static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
|
||||
/*
|
||||
* Don't allow RAM to be mapped.
|
||||
*/
|
||||
- if (WARN_ON(pfn_valid(__phys_to_pfn(phys_addr))))
|
||||
+ if (WARN_ON(memblock_is_map_memory(phys_addr)))
|
||||
return NULL;
|
||||
|
||||
area = get_vm_area_caller(size, VM_IOREMAP, caller);
|
||||
@@ -96,7 +97,7 @@ EXPORT_SYMBOL(__iounmap);
|
||||
void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
|
||||
{
|
||||
/* For normal memory we already have a cacheable mapping. */
|
||||
- if (pfn_valid(__phys_to_pfn(phys_addr)))
|
||||
+ if (memblock_is_map_memory(phys_addr))
|
||||
return (void __iomem *)__phys_to_virt(phys_addr);
|
||||
|
||||
return __ioremap_caller(phys_addr, size, __pgprot(PROT_NORMAL),
|
|
@ -0,0 +1,403 @@
|
|||
From patchwork Mon Apr 9 15:45:50 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,1/5] crypto: thunderx_zip: Fix fallout from CONFIG_VMAP_STACK
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331719
|
||||
Message-Id: <20180409154554.7578-2-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>,
|
||||
stable <stable@vger.kernel.org>
|
||||
Date: Mon, 9 Apr 2018 17:45:50 +0200
|
||||
|
||||
Enabling virtual mapped kernel stacks breaks the thunderx_zip
|
||||
driver. On compression or decompression the executing CPU hangs
|
||||
in an endless loop. The reason for this is the usage of __pa
|
||||
by the driver which does no longer work for an address that is
|
||||
not part of the 1:1 mapping.
|
||||
|
||||
The zip driver allocates a result struct on the stack and needs
|
||||
to tell the hardware the physical address within this struct
|
||||
that is used to signal the completion of the request.
|
||||
|
||||
As the hardware gets the wrong address after the broken __pa
|
||||
conversion it writes to an arbitrary address. The zip driver then
|
||||
waits forever for the completion byte to contain a non-zero value.
|
||||
|
||||
Allocating the result struct from 1:1 mapped memory resolves this
|
||||
bug.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
Cc: stable <stable@vger.kernel.org> # 4.14
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_crypto.c | 22 ++++++++++++++--------
|
||||
1 file changed, 14 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_crypto.c b/drivers/crypto/cavium/zip/zip_crypto.c
|
||||
index 8df4d26cf9d4..b92b6e7e100f 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_crypto.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_crypto.c
|
||||
@@ -124,7 +124,7 @@ int zip_compress(const u8 *src, unsigned int slen,
|
||||
struct zip_kernel_ctx *zip_ctx)
|
||||
{
|
||||
struct zip_operation *zip_ops = NULL;
|
||||
- struct zip_state zip_state;
|
||||
+ struct zip_state *zip_state;
|
||||
struct zip_device *zip = NULL;
|
||||
int ret;
|
||||
|
||||
@@ -135,20 +135,23 @@ int zip_compress(const u8 *src, unsigned int slen,
|
||||
if (!zip)
|
||||
return -ENODEV;
|
||||
|
||||
- memset(&zip_state, 0, sizeof(struct zip_state));
|
||||
+ zip_state = kzalloc(sizeof(*zip_state), GFP_ATOMIC);
|
||||
+ if (!zip_state)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
zip_ops = &zip_ctx->zip_comp;
|
||||
|
||||
zip_ops->input_len = slen;
|
||||
zip_ops->output_len = *dlen;
|
||||
memcpy(zip_ops->input, src, slen);
|
||||
|
||||
- ret = zip_deflate(zip_ops, &zip_state, zip);
|
||||
+ ret = zip_deflate(zip_ops, zip_state, zip);
|
||||
|
||||
if (!ret) {
|
||||
*dlen = zip_ops->output_len;
|
||||
memcpy(dst, zip_ops->output, *dlen);
|
||||
}
|
||||
-
|
||||
+ kfree(zip_state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -157,7 +160,7 @@ int zip_decompress(const u8 *src, unsigned int slen,
|
||||
struct zip_kernel_ctx *zip_ctx)
|
||||
{
|
||||
struct zip_operation *zip_ops = NULL;
|
||||
- struct zip_state zip_state;
|
||||
+ struct zip_state *zip_state;
|
||||
struct zip_device *zip = NULL;
|
||||
int ret;
|
||||
|
||||
@@ -168,7 +171,10 @@ int zip_decompress(const u8 *src, unsigned int slen,
|
||||
if (!zip)
|
||||
return -ENODEV;
|
||||
|
||||
- memset(&zip_state, 0, sizeof(struct zip_state));
|
||||
+ zip_state = kzalloc(sizeof(*zip_state), GFP_ATOMIC);
|
||||
+ if (!zip_state)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
zip_ops = &zip_ctx->zip_decomp;
|
||||
memcpy(zip_ops->input, src, slen);
|
||||
|
||||
@@ -179,13 +185,13 @@ int zip_decompress(const u8 *src, unsigned int slen,
|
||||
zip_ops->input_len = slen;
|
||||
zip_ops->output_len = *dlen;
|
||||
|
||||
- ret = zip_inflate(zip_ops, &zip_state, zip);
|
||||
+ ret = zip_inflate(zip_ops, zip_state, zip);
|
||||
|
||||
if (!ret) {
|
||||
*dlen = zip_ops->output_len;
|
||||
memcpy(dst, zip_ops->output, *dlen);
|
||||
}
|
||||
-
|
||||
+ kfree(zip_state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
From patchwork Mon Apr 9 15:45:51 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,2/5] crypto: thunderx_zip: Limit result reading attempts
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331705
|
||||
Message-Id: <20180409154554.7578-3-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>,
|
||||
stable <stable@vger.kernel.org>
|
||||
Date: Mon, 9 Apr 2018 17:45:51 +0200
|
||||
|
||||
After issuing a request an endless loop was used to read the
|
||||
completion state from memory which is asynchronously updated
|
||||
by the ZIP coprocessor.
|
||||
|
||||
Add an upper bound to the retry attempts to prevent a CPU getting stuck
|
||||
forever in case of an error. Additionally, add a read memory barrier
|
||||
and a small delay between the reading attempts.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
Cc: stable <stable@vger.kernel.org> # 4.14
|
||||
---
|
||||
drivers/crypto/cavium/zip/common.h | 21 +++++++++++++++++++++
|
||||
drivers/crypto/cavium/zip/zip_deflate.c | 4 ++--
|
||||
drivers/crypto/cavium/zip/zip_inflate.c | 4 ++--
|
||||
3 files changed, 25 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/common.h b/drivers/crypto/cavium/zip/common.h
|
||||
index dc451e0a43c5..58fb3ed6e644 100644
|
||||
--- a/drivers/crypto/cavium/zip/common.h
|
||||
+++ b/drivers/crypto/cavium/zip/common.h
|
||||
@@ -46,8 +46,10 @@
|
||||
#ifndef __COMMON_H__
|
||||
#define __COMMON_H__
|
||||
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
+#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
@@ -149,6 +151,25 @@ struct zip_operation {
|
||||
u32 sizeofzops;
|
||||
};
|
||||
|
||||
+static inline int zip_poll_result(union zip_zres_s *result)
|
||||
+{
|
||||
+ int retries = 1000;
|
||||
+
|
||||
+ while (!result->s.compcode) {
|
||||
+ if (!--retries) {
|
||||
+ pr_err("ZIP ERR: request timed out");
|
||||
+ return -ETIMEDOUT;
|
||||
+ }
|
||||
+ udelay(10);
|
||||
+ /*
|
||||
+ * Force re-reading of compcode which is updated
|
||||
+ * by the ZIP coprocessor.
|
||||
+ */
|
||||
+ rmb();
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* error messages */
|
||||
#define zip_err(fmt, args...) pr_err("ZIP ERR:%s():%d: " \
|
||||
fmt "\n", __func__, __LINE__, ## args)
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_deflate.c b/drivers/crypto/cavium/zip/zip_deflate.c
|
||||
index 9a944b8c1e29..d7133f857d67 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_deflate.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_deflate.c
|
||||
@@ -129,8 +129,8 @@ int zip_deflate(struct zip_operation *zip_ops, struct zip_state *s,
|
||||
/* Stats update for compression requests submitted */
|
||||
atomic64_inc(&zip_dev->stats.comp_req_submit);
|
||||
|
||||
- while (!result_ptr->s.compcode)
|
||||
- continue;
|
||||
+ /* Wait for completion or error */
|
||||
+ zip_poll_result(result_ptr);
|
||||
|
||||
/* Stats update for compression requests completed */
|
||||
atomic64_inc(&zip_dev->stats.comp_req_complete);
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_inflate.c b/drivers/crypto/cavium/zip/zip_inflate.c
|
||||
index 50cbdd83dbf2..7e0d73e2f89e 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_inflate.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_inflate.c
|
||||
@@ -143,8 +143,8 @@ int zip_inflate(struct zip_operation *zip_ops, struct zip_state *s,
|
||||
/* Decompression requests submitted stats update */
|
||||
atomic64_inc(&zip_dev->stats.decomp_req_submit);
|
||||
|
||||
- while (!result_ptr->s.compcode)
|
||||
- continue;
|
||||
+ /* Wait for completion or error */
|
||||
+ zip_poll_result(result_ptr);
|
||||
|
||||
/* Decompression requests completed stats update */
|
||||
atomic64_inc(&zip_dev->stats.decomp_req_complete);
|
||||
From patchwork Mon Apr 9 15:45:52 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,3/5] crypto: thunderx_zip: Prevent division by zero
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331709
|
||||
Message-Id: <20180409154554.7578-4-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>
|
||||
Date: Mon, 9 Apr 2018 17:45:52 +0200
|
||||
|
||||
Avoid two potential divisions by zero when calculating average
|
||||
values for the zip statistics.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_main.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
|
||||
index 1cd8aa488185..79b449e0f955 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.c
|
||||
@@ -482,10 +482,11 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
atomic64_add(val, &st->pending_req);
|
||||
}
|
||||
|
||||
- avg_chunk = (atomic64_read(&st->comp_in_bytes) /
|
||||
- atomic64_read(&st->comp_req_complete));
|
||||
- avg_cr = (atomic64_read(&st->comp_in_bytes) /
|
||||
- atomic64_read(&st->comp_out_bytes));
|
||||
+ val = atomic64_read(&st->comp_req_complete);
|
||||
+ avg_chunk = (val) ? atomic64_read(&st->comp_in_bytes) / val : 0;
|
||||
+
|
||||
+ val = atomic64_read(&st->comp_out_bytes);
|
||||
+ avg_cr = (val) ? atomic64_read(&st->comp_in_bytes) / val : 0;
|
||||
seq_printf(s, " ZIP Device %d Stats\n"
|
||||
"-----------------------------------\n"
|
||||
"Comp Req Submitted : \t%lld\n"
|
||||
From patchwork Mon Apr 9 15:45:53 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,4/5] crypto: thunderx_zip: Fix statistics pending request value
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331711
|
||||
Message-Id: <20180409154554.7578-5-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>
|
||||
Date: Mon, 9 Apr 2018 17:45:53 +0200
|
||||
|
||||
The pending request counter was read from the wrong register. While
|
||||
at it, there is no need to use an atomic for it as it is only read
|
||||
localy in a loop.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_main.c | 13 +++++--------
|
||||
drivers/crypto/cavium/zip/zip_main.h | 1 -
|
||||
2 files changed, 5 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
|
||||
index 79b449e0f955..ae5b20c695ca 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.c
|
||||
@@ -469,6 +469,8 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
struct zip_stats *st;
|
||||
|
||||
for (index = 0; index < MAX_ZIP_DEVICES; index++) {
|
||||
+ u64 pending = 0;
|
||||
+
|
||||
if (zip_dev[index]) {
|
||||
zip = zip_dev[index];
|
||||
st = &zip->stats;
|
||||
@@ -476,10 +478,8 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
/* Get all the pending requests */
|
||||
for (q = 0; q < ZIP_NUM_QUEUES; q++) {
|
||||
val = zip_reg_read((zip->reg_base +
|
||||
- ZIP_DBG_COREX_STA(q)));
|
||||
- val = (val >> 32);
|
||||
- val = val & 0xffffff;
|
||||
- atomic64_add(val, &st->pending_req);
|
||||
+ ZIP_DBG_QUEX_STA(q)));
|
||||
+ pending += val >> 32 & 0xffffff;
|
||||
}
|
||||
|
||||
val = atomic64_read(&st->comp_req_complete);
|
||||
@@ -514,10 +514,7 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
(u64)atomic64_read(&st->decomp_in_bytes),
|
||||
(u64)atomic64_read(&st->decomp_out_bytes),
|
||||
(u64)atomic64_read(&st->decomp_bad_reqs),
|
||||
- (u64)atomic64_read(&st->pending_req));
|
||||
-
|
||||
- /* Reset pending requests count */
|
||||
- atomic64_set(&st->pending_req, 0);
|
||||
+ pending);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.h b/drivers/crypto/cavium/zip/zip_main.h
|
||||
index 64e051f60784..e1e4fa92ce80 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.h
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.h
|
||||
@@ -74,7 +74,6 @@ struct zip_stats {
|
||||
atomic64_t comp_req_complete;
|
||||
atomic64_t decomp_req_submit;
|
||||
atomic64_t decomp_req_complete;
|
||||
- atomic64_t pending_req;
|
||||
atomic64_t comp_in_bytes;
|
||||
atomic64_t comp_out_bytes;
|
||||
atomic64_t decomp_in_bytes;
|
||||
From patchwork Mon Apr 9 15:45:54 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,5/5] crypto: thunderx_zip: Fix smp_processor_id() warnings
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331715
|
||||
Message-Id: <20180409154554.7578-6-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>
|
||||
Date: Mon, 9 Apr 2018 17:45:54 +0200
|
||||
|
||||
Switch to raw_smp_processor_id() to prevent a number of
|
||||
warnings from kernel debugging. We do not care about
|
||||
preemption here, as the CPU number is only used as a
|
||||
poor mans load balancing or device selection. If preemption
|
||||
happens during a compress/decompress operation a small performance
|
||||
hit will occur but everything will continue to work, so just
|
||||
ignore it.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_device.c | 4 ++--
|
||||
drivers/crypto/cavium/zip/zip_main.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_device.c b/drivers/crypto/cavium/zip/zip_device.c
|
||||
index ccf21fb91513..f174ec29ed69 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_device.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_device.c
|
||||
@@ -87,12 +87,12 @@ u32 zip_load_instr(union zip_inst_s *instr,
|
||||
* Distribute the instructions between the enabled queues based on
|
||||
* the CPU id.
|
||||
*/
|
||||
- if (smp_processor_id() % 2 == 0)
|
||||
+ if (raw_smp_processor_id() % 2 == 0)
|
||||
queue = 0;
|
||||
else
|
||||
queue = 1;
|
||||
|
||||
- zip_dbg("CPU Core: %d Queue number:%d", smp_processor_id(), queue);
|
||||
+ zip_dbg("CPU Core: %d Queue number:%d", raw_smp_processor_id(), queue);
|
||||
|
||||
/* Take cmd buffer lock */
|
||||
spin_lock(&zip_dev->iq[queue].lock);
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
|
||||
index ae5b20c695ca..be055b9547f6 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.c
|
||||
@@ -113,7 +113,7 @@ struct zip_device *zip_get_device(int node)
|
||||
*/
|
||||
int zip_get_node_id(void)
|
||||
{
|
||||
- return cpu_to_node(smp_processor_id());
|
||||
+ return cpu_to_node(raw_smp_processor_id());
|
||||
}
|
||||
|
||||
/* Initializes the ZIP h/w sub-system */
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ACPI_SPCR_TABLE=y
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ACT200L_DONGLE=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ACTISYS_DONGLE=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ADXL345_I2C is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ADXL345_SPI is not set
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ALI_FIR=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ALLOW_LOCKDOWN_LIFT_BY_SYSRQ=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ALTERA_MSGDMA=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ARM64_ERRATUM_858921=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ATH10K_SDIO=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ATH10K_SPECTRAL is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ATH10K_USB=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ATH9K_COMMON_SPECTRAL is not set
|
|
@ -1 +1 @@
|
|||
CONFIG_B43LEGACY_DEBUG=y
|
||||
# CONFIG_B43LEGACY_DEBUG is not set
|
||||
|
|
|
@ -1 +1 @@
|
|||
CONFIG_B43_DEBUG=y
|
||||
# CONFIG_B43_DEBUG is not set
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BACKLIGHT_ARCXCNN=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BATTERY_LEGO_EV3 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BATTERY_MAX1721X is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BCM_FLEXRM_MBOX is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BFQ_GROUP_IOSCHED=y
|
|
@ -1 +0,0 @@
|
|||
CONFIG_BLK_CPQ_CISS_DA=m
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_BLK_DEV_HD is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BLK_DEV_THROTTLING_LOW is not set
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_BLK_DEV_UB is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BNXT_FLOWER_OFFLOAD=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BOOTPARAM_LOCKDEP_CROSSRELEASE_FULLSTACK is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BPF_JIT_ALWAYS_ON=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BPF_KPROBE_OVERRIDE is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BPF_STREAM_PARSER=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BRCMSTB_GISB_ARB is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BTRFS_FS_REF_VERIFY is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BT_HCIUART_SERDEV=y
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_BT_QCOMSMD is not set
|
|
@ -1 +0,0 @@
|
|||
CONFIG_BT_SCO=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CAN_HI311X=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CAN_MCBA_USB=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CAN_PEAK_PCIEFD=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CAN_VXCAN=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CCS811 is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CEC_PIN=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CEC_PLATFORM_DRIVERS=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CHARGER_LTC3651 is not set
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_CHARGER_QCOM_SMBB is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CHASH_SELFTEST is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CHASH_STATS is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CHELSIO_IPSEC_INLINE=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CHT_DC_TI_PMIC_OPREGION=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CIFS_DEBUG_DUMP_KEYS is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CIFS_SMB_DIRECT is not set
|
|
@ -1 +0,0 @@
|
|||
CONFIG_CISS_SCSI_TAPE=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CLK_HSDK is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CLOCK_THERMAL is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CORTINA_PHY=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CPU_ISOLATION is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRAMFS_MTD is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CRC4=m
|
|
@ -1 +1 @@
|
|||
# CONFIG_CROS_KBD_LED_BACKLIGHT is not set
|
||||
CONFIG_CROS_KBD_LED_BACKLIGHT=m
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_DEV_CCREE is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CRYPTO_DEV_NITROX_CNN55XX=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_DEV_SP_CCP is not set
|
|
@ -1 +1 @@
|
|||
CONFIG_CRYPTO_DH=m
|
||||
CONFIG_CRYPTO_DH=y
|
||||
|
|
|
@ -1 +1 @@
|
|||
CONFIG_CRYPTO_GCM=m
|
||||
CONFIG_CRYPTO_GCM=y
|
||||
|
|
|
@ -1 +1 @@
|
|||
CONFIG_CRYPTO_GHASH=m
|
||||
CONFIG_CRYPTO_GHASH=y
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue