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 |
|
@ -1,2 +1,8 @@
|
|||
clog
|
||||
*.xz
|
||||
*.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,64 @@
|
|||
From 0eadbb65c0026fb4eec89c54f6b48a0febd87f92 Mon Sep 17 00:00:00 2001
|
||||
From: Laura Abbott <labbott@redhat.com>
|
||||
Date: Fri, 9 Sep 2016 08:19:17 -0700
|
||||
Subject: [PATCH] iio: Use type header from kernel tree
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
To: Jonathan Cameron <jic23@kernel.org>
|
||||
To: Hartmut Knaack <knaack.h@gmx.de>
|
||||
To: Lars-Peter Clausen <lars@metafoo.de>
|
||||
To: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
|
||||
Cc: linux-iio@vger.kernel.org
|
||||
Cc: linux-kernel@vger.kernel.org
|
||||
|
||||
|
||||
The iio tools have been updated as new event types have been added to
|
||||
the kernel. The tools currently use the standard system headers which
|
||||
means that the system may not have the newest defintitions. This leads
|
||||
to build failures when building newer tools on older hosts:
|
||||
|
||||
gcc -Wall -g -D_GNU_SOURCE -c -o iio_event_monitor.o
|
||||
iio_event_monitor.c
|
||||
iio_event_monitor.c:59:3: error: ‘IIO_UVINDEX’ undeclared here (not in a
|
||||
function)
|
||||
[IIO_UVINDEX] = "uvindex",
|
||||
^~~~~~~~~~~
|
||||
iio_event_monitor.c:59:3: error: array index in initializer not of
|
||||
integer type
|
||||
iio_event_monitor.c:59:3: note: (near initialization for
|
||||
‘iio_chan_type_name_spec’)
|
||||
iio_event_monitor.c:97:3: error: ‘IIO_MOD_LIGHT_UV’ undeclared here (not
|
||||
in a function)
|
||||
[IIO_MOD_LIGHT_UV] = "uv",
|
||||
^~~~~~~~~~~~~~~~
|
||||
iio_event_monitor.c:97:3: error: array index in initializer not of
|
||||
integer type
|
||||
iio_event_monitor.c:97:3: note: (near initialization for
|
||||
‘iio_modifier_names’)
|
||||
<builtin>: recipe for target 'iio_event_monitor.o' failed
|
||||
|
||||
Switch to using the header from the kernel tree to ensure the newest
|
||||
defintions are always picked up.
|
||||
|
||||
Signed-off-by: Laura Abbott <labbott@redhat.com>
|
||||
---
|
||||
tools/iio/iio_event_monitor.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
|
||||
index d9b7e0f..f02523d 100644
|
||||
--- a/tools/iio/iio_event_monitor.c
|
||||
+++ b/tools/iio/iio_event_monitor.c
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include "iio_utils.h"
|
||||
#include <linux/iio/events.h>
|
||||
-#include <linux/iio/types.h>
|
||||
+#include "../../include/uapi/linux/iio/types.h"
|
||||
|
||||
static const char * const iio_chan_type_name_spec[] = {
|
||||
[IIO_VOLTAGE] = "voltage",
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -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,
|
|
@ -0,0 +1,28 @@
|
|||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Thu, 3 May 2012 20:27:11 +0100
|
||||
Subject: [PATCH] ARM: tegra: usb no reset
|
||||
|
||||
Patch for disconnect issues with storage attached to a
|
||||
tegra-ehci controller
|
||||
---
|
||||
drivers/usb/core/hub.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
|
||||
index 43cb2f2e3b43..7f838ec11c81 100644
|
||||
--- a/drivers/usb/core/hub.c
|
||||
+++ b/drivers/usb/core/hub.c
|
||||
@@ -4996,6 +4996,13 @@ static void hub_event(struct work_struct *work)
|
||||
(u16) hub->change_bits[0],
|
||||
(u16) hub->event_bits[0]);
|
||||
|
||||
+ /* Don't disconnect USB-SATA on TrimSlice */
|
||||
+ if (strcmp(dev_name(hdev->bus->controller), "tegra-ehci.0") == 0) {
|
||||
+ if ((hdev->state == 7) && (hub->change_bits[0] == 0) &&
|
||||
+ (hub->event_bits[0] == 0x2))
|
||||
+ hub->event_bits[0] = 0;
|
||||
+ }
|
||||
+
|
||||
/* Lock the device, then check to see if we were
|
||||
* disconnected while waiting for the lock to succeed. */
|
||||
usb_lock_device(hdev);
|
|
@ -0,0 +1,60 @@
|
|||
From 0451d4e795929a69a0fda6d960aa4b077c5bd179 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Howells <dhowells@redhat.com>
|
||||
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 along with their corresponding
|
||||
type GUIDs.
|
||||
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
include/linux/efi.h | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index ec36f42..3259ad6 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -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)
|
||||
+
|
||||
/*
|
||||
* 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[];
|
||||
+} efi_signature_data_t;
|
||||
+
|
||||
+typedef struct {
|
||||
+ efi_guid_t signature_type;
|
||||
+ u32 signature_list_size;
|
||||
+ u32 signature_header_size;
|
||||
+ u32 signature_size;
|
||||
+ 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:
|
||||
*/
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
From e4c62c12635a371e43bd17e8d33a936668264491 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Howells <dhowells@redhat.com>
|
||||
Date: Fri, 5 May 2017 08:21:58 +0100
|
||||
Subject: [PATCH 2/4] efi: Add an EFI signature blob parser
|
||||
|
||||
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.
|
||||
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
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.
|
||||
|
||||
+config EFI_SIGNATURE_LIST_PARSER
|
||||
+ bool "EFI signature list parser"
|
||||
+ depends on EFI
|
||||
+ select X509_CERTIFICATE_PARSER
|
||||
+ help
|
||||
+ This option provides support for parsing EFI signature lists for
|
||||
+ X.509 certificates and turning them into keys.
|
||||
+
|
||||
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
|
||||
|
||||
ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
|
||||
|
||||
diff --git a/certs/efi_parser.c b/certs/efi_parser.c
|
||||
new file mode 100644
|
||||
index 0000000..4e396f9
|
||||
--- /dev/null
|
||||
+++ b/certs/efi_parser.c
|
||||
@@ -0,0 +1,112 @@
|
||||
+/* EFI signature/key/certificate list parser
|
||||
+ *
|
||||
+ * 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
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+#define pr_fmt(fmt) "EFI: "fmt
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/printk.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/efi.h>
|
||||
+
|
||||
+/**
|
||||
+ * 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
|
||||
+ * @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 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;
|
||||
+
|
||||
+ pr_devel("-->%s(,%zu)\n", __func__, size);
|
||||
+
|
||||
+ while (size > 0) {
|
||||
+ const efi_signature_data_t *elem;
|
||||
+ efi_signature_list_t list;
|
||||
+ size_t lsize, esize, hsize, elsize;
|
||||
+
|
||||
+ if (size < sizeof(list))
|
||||
+ return -EBADMSG;
|
||||
+
|
||||
+ memcpy(&list, data, sizeof(list));
|
||||
+ pr_devel("LIST[%04x] guid=%pUl ls=%x hs=%x ss=%x\n",
|
||||
+ offs,
|
||||
+ list.signature_type.b, list.signature_list_size,
|
||||
+ list.signature_header_size, list.signature_size);
|
||||
+
|
||||
+ lsize = list.signature_list_size;
|
||||
+ hsize = list.signature_header_size;
|
||||
+ esize = list.signature_size;
|
||||
+ elsize = lsize - sizeof(list) - hsize;
|
||||
+
|
||||
+ if (lsize > size) {
|
||||
+ pr_devel("<--%s() = -EBADMSG [overrun @%x]\n",
|
||||
+ __func__, offs);
|
||||
+ return -EBADMSG;
|
||||
+ }
|
||||
+
|
||||
+ if (lsize < sizeof(list) ||
|
||||
+ lsize - sizeof(list) < hsize ||
|
||||
+ esize < sizeof(*elem) ||
|
||||
+ elsize < esize ||
|
||||
+ elsize % esize != 0) {
|
||||
+ pr_devel("- bad size combo @%x\n", offs);
|
||||
+ return -EBADMSG;
|
||||
+ }
|
||||
+
|
||||
+ handler = get_handler_for_guid(&list.signature_type);
|
||||
+ if (!handler) {
|
||||
+ data += lsize;
|
||||
+ size -= lsize;
|
||||
+ offs += lsize;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ data += sizeof(list) + hsize;
|
||||
+ size -= sizeof(list) + hsize;
|
||||
+ offs += sizeof(list) + hsize;
|
||||
+
|
||||
+ for (; elsize > 0; elsize -= esize) {
|
||||
+ elem = data;
|
||||
+
|
||||
+ pr_devel("ELEM[%04x]\n", offs);
|
||||
+ handler(source,
|
||||
+ &elem->signature_data,
|
||||
+ esize - sizeof(*elem));
|
||||
+
|
||||
+ data += esize;
|
||||
+ size -= esize;
|
||||
+ offs += esize;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index 3259ad6..08024c6 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -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);
|
||||
|
||||
+
|
||||
+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
|
||||
* @start: starting kvirt address
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
From 6b6203b92cfb457a0669a9c87a29b360405bffc6 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Garrett <matthew.garrett@nebula.com>
|
||||
Date: Fri, 9 Aug 2013 18:36:30 -0400
|
||||
Subject: [PATCH 10/20] Add option to automatically enforce module signatures
|
||||
when in Secure Boot mode
|
||||
|
||||
UEFI Secure Boot provides a mechanism for ensuring that the firmware will
|
||||
only load signed bootloaders and kernels. Certain use cases may also
|
||||
require that all kernel modules also be signed. Add a configuration option
|
||||
that enforces this automatically when enabled.
|
||||
|
||||
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
|
||||
---
|
||||
Documentation/x86/zero-page.txt | 2 ++
|
||||
arch/x86/Kconfig | 11 ++++++
|
||||
arch/x86/boot/compressed/eboot.c | 66 +++++++++++++++++++++++++++++++++++
|
||||
arch/x86/include/uapi/asm/bootparam.h | 3 +-
|
||||
arch/x86/kernel/setup.c | 6 ++++
|
||||
include/linux/module.h | 6 ++++
|
||||
kernel/module.c | 7 ++++
|
||||
7 files changed, 100 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt
|
||||
index 95a4d34af3fd..b8527c6b7646 100644
|
||||
--- a/Documentation/x86/zero-page.txt
|
||||
+++ b/Documentation/x86/zero-page.txt
|
||||
@@ -31,6 +31,8 @@ Offset Proto Name Meaning
|
||||
1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
|
||||
1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer
|
||||
(below)
|
||||
+1EB/001 ALL kbd_status Numlock is enabled
|
||||
+1EC/001 ALL secure_boot Secure boot is enabled in the firmware
|
||||
1EF/001 ALL sentinel Used to detect broken bootloaders
|
||||
290/040 ALL edd_mbr_sig_buffer EDD MBR signatures
|
||||
2D0/A00 ALL e820_map E820 memory map table
|
||||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
|
||||
index bada636d1065..d666ef8b616c 100644
|
||||
--- a/arch/x86/Kconfig
|
||||
+++ b/arch/x86/Kconfig
|
||||
@@ -1786,6 +1786,17 @@ config EFI_MIXED
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
+config EFI_SECURE_BOOT_SIG_ENFORCE
|
||||
+ def_bool n
|
||||
+ depends on EFI
|
||||
+ prompt "Force module signing when UEFI Secure Boot is enabled"
|
||||
+ ---help---
|
||||
+ UEFI Secure Boot provides a mechanism for ensuring that the
|
||||
+ firmware will only load signed bootloaders and kernels. Certain
|
||||
+ use cases may also require that all kernel modules also be signed.
|
||||
+ Say Y here to automatically enable module signature enforcement
|
||||
+ when a system boots with UEFI Secure Boot enabled.
|
||||
+
|
||||
config SECCOMP
|
||||
def_bool y
|
||||
prompt "Enable seccomp to safely compute untrusted bytecode"
|
||||
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
|
||||
index cc69e37548db..ebc85c1eefd6 100644
|
||||
--- a/arch/x86/boot/compressed/eboot.c
|
||||
+++ b/arch/x86/boot/compressed/eboot.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <asm/efi.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/desc.h>
|
||||
+#include <asm/bootparam_utils.h>
|
||||
|
||||
#include "../string.h"
|
||||
#include "eboot.h"
|
||||
@@ -537,6 +538,67 @@ static void setup_efi_pci(struct boot_params *params)
|
||||
efi_call_early(free_pool, pci_handle);
|
||||
}
|
||||
|
||||
+static int get_secure_boot(void)
|
||||
+{
|
||||
+ u8 sb, setup;
|
||||
+ unsigned long datasize = sizeof(sb);
|
||||
+ efi_guid_t var_guid = EFI_GLOBAL_VARIABLE_GUID;
|
||||
+ efi_status_t status;
|
||||
+
|
||||
+ status = efi_early->call((unsigned long)sys_table->runtime->get_variable,
|
||||
+ L"SecureBoot", &var_guid, NULL, &datasize, &sb);
|
||||
+
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (sb == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+
|
||||
+ status = efi_early->call((unsigned long)sys_table->runtime->get_variable,
|
||||
+ L"SetupMode", &var_guid, NULL, &datasize,
|
||||
+ &setup);
|
||||
+
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (setup == 1)
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * See if we have Graphics Output Protocol
|
||||
+ */
|
||||
+static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
|
||||
+ unsigned long size)
|
||||
+{
|
||||
+ efi_status_t status;
|
||||
+ void **gop_handle = NULL;
|
||||
+
|
||||
+ status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||
+ size, (void **)&gop_handle);
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ return status;
|
||||
+
|
||||
+ status = efi_call_early(locate_handle,
|
||||
+ EFI_LOCATE_BY_PROTOCOL,
|
||||
+ proto, NULL, &size, gop_handle);
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ goto free_handle;
|
||||
+
|
||||
+ if (efi_early->is64)
|
||||
+ status = setup_gop64(si, proto, size, gop_handle);
|
||||
+ else
|
||||
+ status = setup_gop32(si, proto, size, gop_handle);
|
||||
+
|
||||
+free_handle:
|
||||
+ efi_call_early(free_pool, gop_handle);
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
static efi_status_t
|
||||
setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height)
|
||||
{
|
||||
@@ -1094,6 +1156,10 @@ struct boot_params *efi_main(struct efi_config *c,
|
||||
else
|
||||
setup_boot_services32(efi_early);
|
||||
|
||||
+ sanitize_boot_params(boot_params);
|
||||
+
|
||||
+ boot_params->secure_boot = get_secure_boot();
|
||||
+
|
||||
setup_graphics(boot_params);
|
||||
|
||||
setup_efi_pci(boot_params);
|
||||
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
|
||||
index c18ce67495fa..2b3e5427097b 100644
|
||||
--- a/arch/x86/include/uapi/asm/bootparam.h
|
||||
+++ b/arch/x86/include/uapi/asm/bootparam.h
|
||||
@@ -134,7 +134,8 @@ struct boot_params {
|
||||
__u8 eddbuf_entries; /* 0x1e9 */
|
||||
__u8 edd_mbr_sig_buf_entries; /* 0x1ea */
|
||||
__u8 kbd_status; /* 0x1eb */
|
||||
- __u8 _pad5[3]; /* 0x1ec */
|
||||
+ __u8 secure_boot; /* 0x1ec */
|
||||
+ __u8 _pad5[2]; /* 0x1ed */
|
||||
/*
|
||||
* The sentinel is set to a nonzero value (0xff) in header.S.
|
||||
*
|
||||
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
|
||||
index bbfbca5fea0c..d40e961753c9 100644
|
||||
--- a/arch/x86/kernel/setup.c
|
||||
+++ b/arch/x86/kernel/setup.c
|
||||
@@ -1160,6 +1160,12 @@ void __init setup_arch(char **cmdline_p)
|
||||
|
||||
io_delay_init();
|
||||
|
||||
+#ifdef CONFIG_EFI_SECURE_BOOT_SIG_ENFORCE
|
||||
+ if (boot_params.secure_boot) {
|
||||
+ enforce_signed_modules();
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Parse the ACPI tables for possible boot-time SMP configuration.
|
||||
*/
|
||||
diff --git a/include/linux/module.h b/include/linux/module.h
|
||||
index 05bd6c989a0c..32327704e18d 100644
|
||||
--- a/include/linux/module.h
|
||||
+++ b/include/linux/module.h
|
||||
@@ -260,6 +260,12 @@ extern const typeof(name) __mod_##type##__##name##_device_table \
|
||||
|
||||
struct notifier_block;
|
||||
|
||||
+#ifdef CONFIG_MODULE_SIG
|
||||
+extern void enforce_signed_modules(void);
|
||||
+#else
|
||||
+static inline void enforce_signed_modules(void) {};
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_MODULES
|
||||
|
||||
extern int modules_disabled; /* for sysctl */
|
||||
diff --git a/kernel/module.c b/kernel/module.c
|
||||
index cb864505d020..cb1f1da69bf4 100644
|
||||
--- a/kernel/module.c
|
||||
+++ b/kernel/module.c
|
||||
@@ -4285,6 +4285,13 @@ void module_layout(struct module *mod,
|
||||
EXPORT_SYMBOL(module_layout);
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_MODULE_SIG
|
||||
+void enforce_signed_modules(void)
|
||||
+{
|
||||
+ sig_enforce = true;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
bool secure_modules(void)
|
||||
{
|
||||
#ifdef CONFIG_MODULE_SIG
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
||||
Date: Thu, 16 Apr 2015 13:01:46 -0400
|
||||
Subject: [PATCH] Input - synaptics: pin 3 touches when the firmware reports 3
|
||||
fingers
|
||||
|
||||
Synaptics PS/2 touchpad can send only 2 touches in a report. They can
|
||||
detect 4 or 5 and this information is valuable.
|
||||
|
||||
In commit 63c4fda (Input: synaptics - allocate 3 slots to keep stability
|
||||
in image sensors), we allocate 3 slots, but we still continue to report
|
||||
the 2 available fingers. That means that the client sees 2 used slots while
|
||||
there is a total of 3 fingers advertised by BTN_TOOL_TRIPLETAP.
|
||||
|
||||
For old kernels this is not a problem because max_slots was 2 and libinput/
|
||||
xorg-synaptics knew how to deal with that. Now that max_slot is 3, the
|
||||
clients ignore BTN_TOOL_TRIPLETAP and count the actual used slots (so 2).
|
||||
It then gets confused when receiving the BTN_TOOL_TRIPLETAP and DOUBLETAP
|
||||
information, and goes wild.
|
||||
|
||||
We can pin the 3 slots until we get a total number of fingers below 2.
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1212230
|
||||
|
||||
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
||||
---
|
||||
drivers/input/mouse/synaptics.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
|
||||
index 3a32caf06bf1..58102970f94f 100644
|
||||
--- a/drivers/input/mouse/synaptics.c
|
||||
+++ b/drivers/input/mouse/synaptics.c
|
||||
@@ -940,6 +940,14 @@ static void synaptics_report_mt_data(struct psmouse *psmouse,
|
||||
input_report_abs(dev, ABS_MT_PRESSURE, hw[i]->z);
|
||||
}
|
||||
|
||||
+ /* keep (slot count <= num_fingers) by pinning all slots */
|
||||
+ if (num_fingers >= 3) {
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ input_mt_slot(dev, i);
|
||||
+ input_mt_report_slot_state(dev, MT_TOOL_FINGER, true);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
input_mt_drop_unused(dev);
|
||||
|
||||
/* Don't use active slot count to generate BTN_TOOL events. */
|
|
@ -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
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
From: Josh Stone <jistone@redhat.com>
|
||||
Date: Fri, 21 Nov 2014 10:40:00 -0800
|
||||
Subject: [PATCH] Kbuild: Add an option to enable GCC VTA
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Due to recent codegen issues, gcc -fvar-tracking-assignments was
|
||||
unconditionally disabled in commit 2062afb4f804a ("Fix gcc-4.9.0
|
||||
miscompilation of load_balance() in scheduler"). However, this reduces
|
||||
the debuginfo coverage for variable locations, especially in inline
|
||||
functions. VTA is certainly not perfect either in those cases, but it
|
||||
is much better than without. With compiler versions that have fixed the
|
||||
codegen bugs, we would prefer to have the better details for SystemTap,
|
||||
and surely other debuginfo consumers like perf will benefit as well.
|
||||
|
||||
This patch simply makes CONFIG_DEBUG_INFO_VTA an option. I considered
|
||||
Frank and Linus's discussion of a cc-option-like -fcompare-debug test,
|
||||
but I'm convinced that a narrow test of an arch-specific codegen issue
|
||||
is not really useful. GCC has their own regression tests for this, so
|
||||
I'd suggest GCC_COMPARE_DEBUG=-fvar-tracking-assignments-toggle is more
|
||||
useful for kernel developers to test confidence.
|
||||
|
||||
In fact, I ran into a couple more issues when testing for this patch[1],
|
||||
although neither of those had any codegen impact.
|
||||
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1140872
|
||||
|
||||
With gcc-4.9.2-1.fc22, I can now build v3.18-rc5 with Fedora's i686 and
|
||||
x86_64 configs, and this is completely clean with GCC_COMPARE_DEBUG.
|
||||
|
||||
Cc: Frank Ch. Eigler <fche@redhat.com>
|
||||
Cc: Jakub Jelinek <jakub@redhat.com>
|
||||
Cc: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
|
||||
Cc: Michel Dänzer <michel@daenzer.net>
|
||||
Signed-off-by: Josh Stone <jistone@redhat.com>
|
||||
---
|
||||
Makefile | 4 ++++
|
||||
lib/Kconfig.debug | 18 +++++++++++++++++-
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 257ef5892ab7..3cc6f4477e78 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -701,7 +701,11 @@ KBUILD_CFLAGS += -fomit-frame-pointer
|
||||
endif
|
||||
endif
|
||||
|
||||
+ifdef CONFIG_DEBUG_INFO_VTA
|
||||
+KBUILD_CFLAGS += $(call cc-option, -fvar-tracking-assignments)
|
||||
+else
|
||||
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
|
||||
+endif
|
||||
|
||||
ifdef CONFIG_DEBUG_INFO
|
||||
ifdef CONFIG_DEBUG_INFO_SPLIT
|
||||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
|
||||
index e2894b23efb6..d98afe18f704 100644
|
||||
--- a/lib/Kconfig.debug
|
||||
+++ b/lib/Kconfig.debug
|
||||
@@ -165,7 +165,23 @@ config DEBUG_INFO_DWARF4
|
||||
Generate dwarf4 debug info. This requires recent versions
|
||||
of gcc and gdb. It makes the debug information larger.
|
||||
But it significantly improves the success of resolving
|
||||
- variables in gdb on optimized code.
|
||||
+ variables in gdb on optimized code. The gcc docs also
|
||||
+ recommend enabling -fvar-tracking-assignments for maximum
|
||||
+ benefit. (see DEBUG_INFO_VTA)
|
||||
+
|
||||
+config DEBUG_INFO_VTA
|
||||
+ bool "Enable var-tracking-assignments for debuginfo"
|
||||
+ depends on DEBUG_INFO
|
||||
+ help
|
||||
+ Enable gcc -fvar-tracking-assignments for improved debug
|
||||
+ information on variable locations in optimized code. Per
|
||||
+ gcc, DEBUG_INFO_DWARF4 is recommended for best use of VTA.
|
||||
+
|
||||
+ VTA has been implicated in codegen bugs (gcc PR61801,
|
||||
+ PR61904), so this may deserve some caution. One can set
|
||||
+ GCC_COMPARE_DEBUG=-fvar-tracking-assignments-toggle in the
|
||||
+ environment to automatically compile everything both ways,
|
||||
+ generating an error if anything differs.
|
||||
|
||||
config GDB_SCRIPTS
|
||||
bool "Provide GDB scripts for kernel debugging"
|
|
@ -0,0 +1,246 @@
|
|||
From 90dc66270b02981b19a085c6a9184e3452b7b3e8 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
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
|
||||
allows for a third party signing certificate to be used in conjunction
|
||||
with signed modules. By importing the public certificate into the 'db'
|
||||
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.
|
||||
|
||||
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/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/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
|
||||
+ 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.
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
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 0000000..b44e464
|
||||
--- /dev/null
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -0,0 +1,168 @@
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/sched.h>
|
||||
+#include <linux/cred.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/efi.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <keys/asymmetric-type.h>
|
||||
+#include <keys/system_keyring.h>
|
||||
+#include "internal.h"
|
||||
+
|
||||
+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;
|
||||
+
|
||||
+ status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
|
||||
+ if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
+ pr_err("Couldn't get size: 0x%lx\n", status);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ db = kmalloc(lsize, GFP_KERNEL);
|
||||
+ if (!db) {
|
||||
+ pr_err("Couldn't allocate memory for uefi cert list\n");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
+ }
|
||||
+
|
||||
+ *size = lsize;
|
||||
+ return db;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * 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;
|
||||
+ 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;
|
||||
+
|
||||
+ 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.
|
||||
+ */
|
||||
+ 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("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);
|
||||
+ if (!mok) {
|
||||
+ pr_info("MODSIGN: Couldn't get UEFI MokListRT\n");
|
||||
+ } else {
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
+ dbx = get_cert_list(L"dbx", &secure_var, &dbxsize);
|
||||
+ if (!dbx) {
|
||||
+ pr_info("MODSIGN: Couldn't get UEFI dbx list\n");
|
||||
+ } else {
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+late_initcall(load_uefi_certs);
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
From 9f1958a0cc911e1f79b2733ee5029dbd819ff328 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
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 ignore the db
|
||||
variable if it is found.
|
||||
|
||||
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Signed-off-by: David Howells <dhowells@redhat.com>
|
||||
---
|
||||
certs/load_uefi.c | 44 ++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 34 insertions(+), 10 deletions(-)
|
||||
|
||||
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;
|
||||
+
|
||||
+ status = efi.get_variable(L"MokIgnoreDB", &guid, NULL, &size, &db);
|
||||
+ return status == EFI_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* 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)
|
||||
{
|
||||
@@ -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.
|
||||
*/
|
||||
- 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("UEFI:db",
|
||||
- db, dbsize, get_handler_for_db);
|
||||
- if (rc)
|
||||
- pr_err("Couldn't parse db signatures: %d\n", rc);
|
||||
- kfree(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("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
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
# Makefile for source rpm: kernel
|
||||
SPECFILE := kernel.spec
|
||||
|
||||
# we only check the .sign signatures
|
||||
UPSTREAM_CHECKS = sign
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
%:
|
||||
@echo "Try fedpkg $@ or something like that"
|
||||
@exit 1
|
||||
|
||||
prep: config-files
|
||||
fedpkg -v prep
|
||||
|
||||
noarch:
|
||||
fedpkg -v local --arch=noarch
|
||||
|
||||
# 'make local' also needs to build the noarch firmware package
|
||||
local:
|
||||
fedpkg -v local
|
||||
|
||||
extremedebug:
|
||||
@perl -pi -e 's/# CONFIG_DEBUG_PAGEALLOC is not set/CONFIG_DEBUG_PAGEALLOC=y/' config-nodebug
|
||||
|
||||
config-files:
|
||||
@./build_configs.sh
|
||||
|
||||
debug:
|
||||
@perl -pi -e 's/^%define debugbuildsenabled 1/%define debugbuildsenabled 0/' kernel.spec
|
||||
@rpmdev-bumpspec -c "Reenable debugging options." kernel.spec
|
||||
|
||||
release:
|
||||
@perl -pi -e 's/^%define debugbuildsenabled 0/%define debugbuildsenabled 1/' kernel.spec
|
||||
@rpmdev-bumpspec -c "Disable debugging options." kernel.spec
|
||||
|
||||
nodebuginfo:
|
||||
@perl -pi -e 's/^%define with_debuginfo %\{\?_without_debuginfo: 0\} %\{\?\!_without_debuginfo: 1\}/%define with_debuginfo %\{\?_without_debuginfo: 0\} %\{\?\!_without_debuginfo: 0\}/' kernel.spec
|
||||
|
||||
nodebug: release
|
||||
@perl -pi -e 's/^%define debugbuildsenabled 1/%define debugbuildsenabled 0/' kernel.spec
|
||||
|
||||
ifeq ($(MAKECMDGOALS),me a sandwich)
|
||||
.PHONY: me a sandwich
|
||||
me a:
|
||||
@:
|
||||
|
||||
sandwich:
|
||||
@[ `id -u` -ne 0 ] && echo "What? Make it yourself." || echo Okay.
|
||||
endif
|
|
@ -1,45 +0,0 @@
|
|||
RHEL_MAJOR = 8
|
||||
RHEL_MINOR = 99
|
||||
|
||||
#
|
||||
# RHEL_RELEASE
|
||||
# -------------
|
||||
#
|
||||
# Represents build number in 'release' part of RPM's name-version-release.
|
||||
# name is <package_name>, e.g. kernel
|
||||
# version is upstream kernel version this kernel is based on, e.g. 4.18.0
|
||||
# release is <RHEL_RELEASE>.<dist_tag>[<buildid>], e.g. 100.el8
|
||||
#
|
||||
# Use this spot to avoid future merge conflicts.
|
||||
# Do not trim this comment.
|
||||
RHEL_RELEASE = 122
|
||||
|
||||
#
|
||||
# Early y+1 numbering
|
||||
# --------------------
|
||||
#
|
||||
# In early y+1 process, RHEL_RELEASE consists of 2 numbers: x.y
|
||||
# First is RHEL_RELEASE inherited/merged from y as-is, second number
|
||||
# is incremented with each build starting from 1. After merge from y,
|
||||
# it resets back to 1. This way y+1 nvr reflects status of last merge.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# rhel8.0 rhel-8.1
|
||||
# kernel-4.18.0-58.el8 --> kernel-4.18.0-58.1.el8
|
||||
# kernel-4.18.0-58.2.el8
|
||||
# kernel-4.18.0-59.el8 kernel-4.18.0-59.1.el8
|
||||
# kernel-4.18.0-60.el8
|
||||
# kernel-4.18.0-61.el8 --> kernel-4.18.0-61.1.el8
|
||||
#
|
||||
#
|
||||
# Use this spot to avoid future merge conflicts.
|
||||
# Do not trim this comment.
|
||||
EARLY_YSTREAM ?= no
|
||||
EARLY_YBUILD:=
|
||||
EARLY_YRELEASE:=
|
||||
ifneq ("$(ZSTREAM)", "yes")
|
||||
ifeq ("$(EARLY_YSTREAM)","yes")
|
||||
RHEL_RELEASE:=$(RHEL_RELEASE).$(EARLY_YRELEASE)
|
||||
endif
|
||||
endif
|
|
@ -0,0 +1,76 @@
|
|||
# This file contains patches that we intend to carry for longer than
|
||||
# "Should show up in a stable release soonish"
|
||||
# Some of these may eventually drop out
|
||||
|
||||
kbuild-AFTER_LINK.patch
|
||||
|
||||
arm64-avoid-needing-console-to-enable-serial-console.patch
|
||||
|
||||
geekbox-v4-device-tree-support.patch
|
||||
|
||||
Initial-AllWinner-A64-and-PINE64-support.patch
|
||||
|
||||
arm64-pcie-quirks-xgene.patch
|
||||
|
||||
usb-phy-tegra-Add-38.4MHz-clock-table-entry.patch
|
||||
|
||||
ARM-tegra-usb-no-reset.patch
|
||||
|
||||
bcm283x-upstream-fixes.patch
|
||||
|
||||
lib-cpumask-Make-CPUMASK_OFFSTACK-usable-without-deb.patch
|
||||
|
||||
input-kill-stupid-messages.patch
|
||||
|
||||
die-floppy-die.patch
|
||||
|
||||
no-pcspkr-modalias.patch
|
||||
|
||||
silence-fbcon-logo.patch
|
||||
|
||||
Kbuild-Add-an-option-to-enable-GCC-VTA.patch
|
||||
|
||||
crash-driver.patch
|
||||
|
||||
#Secure boot patches
|
||||
Add-secure_modules-call.patch
|
||||
PCI-Lock-down-BAR-access-when-module-security-is-ena.patch
|
||||
x86-Lock-down-IO-port-access-when-module-security-is.patch
|
||||
ACPI-Limit-access-to-custom_method.patch
|
||||
asus-wmi-Restrict-debugfs-interface-when-module-load.patch
|
||||
Restrict-dev-mem-and-dev-kmem-when-module-loading-is.patch
|
||||
acpi-Ignore-acpi_rsdp-kernel-parameter-when-module-l.patch
|
||||
kexec-Disable-at-runtime-if-the-kernel-enforces-modu.patch
|
||||
x86-Restrict-MSR-access-when-module-loading-is-restr.patch
|
||||
Add-option-to-automatically-enforce-module-signature.patch
|
||||
efi-Disable-secure-boot-if-shim-is-in-insecure-mode.patch
|
||||
efi-Add-EFI_SECURE_BOOT-bit.patch
|
||||
hibernate-Disable-in-a-signed-modules-environment.patch
|
||||
Add-EFI-signature-data-types.patch
|
||||
Add-an-EFI-signature-blob-parser-and-key-loader.patch
|
||||
KEYS-Add-a-system-blacklist-keyring.patch
|
||||
MODSIGN-Import-certificates-from-UEFI-Secure-Boot.patch
|
||||
MODSIGN-Support-not-importing-certs-from-db.patch
|
||||
Add-sysrq-option-to-disable-secure-boot-mode.patch
|
||||
kexec-uefi-copy-secure_boot-flag-in-boot-params.patch
|
||||
|
||||
drm-i915-hush-check-crtc-state.patch
|
||||
|
||||
disable-i8042-check-on-apple-mac.patch
|
||||
|
||||
lis3-improve-handling-of-null-rate.patch
|
||||
|
||||
scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
|
||||
|
||||
criu-no-expert.patch
|
||||
|
||||
ath9k-rx-dma-stop-check.patch
|
||||
|
||||
xen-pciback-Don-t-disable-PCI_COMMAND-on-PCI-device-.patch
|
||||
|
||||
Input-synaptics-pin-3-touches-when-the-firmware-repo.patch
|
||||
|
||||
firmware-Drop-WARN-from-usermodehelper_read_trylock-.patch
|
||||
|
||||
drm-i915-turn-off-wc-mmaps.patch
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
https://gitlab.com/cki-project/kernel-ark/-/commit/8773e8c6039ff74d1426cc80de30de759cd0c2a2
|
||||
8773e8c6039ff74d1426cc80de30de759cd0c2a2 irq: export irq_check_status_bit
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/e187313e5f0086538fefe0925ef84480f99616d8
|
||||
e187313e5f0086538fefe0925ef84480f99616d8 gcc-plugins: fix gcc 11 indigestion with plugins...
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/0c84b348e33ab9d7df5c3c5acc7fbc07fd96fafc
|
||||
0c84b348e33ab9d7df5c3c5acc7fbc07fd96fafc Fix up bad merge with efi: generalize efi_get_secureboot
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/364788093bdf437c33753d327136c363be8f756c
|
||||
364788093bdf437c33753d327136c363be8f756c Fix up a merge issue with rxe.c
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/a4d554ce883e24df77cce42bc2deec527028c213
|
||||
a4d554ce883e24df77cce42bc2deec527028c213 Filter out LTO build options from the perl ccopts
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/17b0f7f1d49df30661b517d668715ff5ee1bab09
|
||||
17b0f7f1d49df30661b517d668715ff5ee1bab09 Fixes "acpi: prefer booting with ACPI over DTS" to be RHEL only
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/e7c009cd91ababdbb5f726ef592c7800f0682d3a
|
||||
e7c009cd91ababdbb5f726ef592c7800f0682d3a arch/x86: Remove vendor specific CPU ID checks
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/7120b2a26fc4c7954fd0395973dc6739c110e091
|
||||
7120b2a26fc4c7954fd0395973dc6739c110e091 redhat: Replace hardware.redhat.com link in Unsupported message
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/7a28e2fde653a161913abb8eee943cdacb5ff2ae
|
||||
7a28e2fde653a161913abb8eee943cdacb5ff2ae x86: Fix compile issues with rh_check_supported()
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/45f64c1a24e73af7987cffec3ea941e29364f87f
|
||||
45f64c1a24e73af7987cffec3ea941e29364f87f e1000e: bump up timeout to wait when ME un-configure ULP mode
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/6c14763b1ce98698949ff45135c15e333aa6416d
|
||||
6c14763b1ce98698949ff45135c15e333aa6416d drm/sun4i: sun6i_mipi_dsi: fix horizontal timing calculation
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/67a19b16012b12cffba0b515c6503e5f8cdbb798
|
||||
67a19b16012b12cffba0b515c6503e5f8cdbb798 drm: panel: add Xingbangda XBD599 panel
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/d220dbf98cef820367b5a2a2eeaacebee958bdd4
|
||||
d220dbf98cef820367b5a2a2eeaacebee958bdd4 dt-bindings: panel: add binding for Xingbangda XBD599 panel
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/80660062260dec4bdca9540922577542c16145e8
|
||||
80660062260dec4bdca9540922577542c16145e8 ARM: fix __get_user_check() in case uaccess_* calls are not inlined
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/24d8743613b2a6a585fc68cfe95078d9a3d5b389
|
||||
24d8743613b2a6a585fc68cfe95078d9a3d5b389 mm/kmemleak: skip late_init if not skip disable
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/b697ff5e26974fee8fcd31a1e221e9dd41515efc
|
||||
b697ff5e26974fee8fcd31a1e221e9dd41515efc KEYS: Make use of platform keyring for module signature verify
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/081d2185e22479b449586c4e9843602ca0d49806
|
||||
081d2185e22479b449586c4e9843602ca0d49806 Drop that for now
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/5ef51389cf6673a0e9e004909c7be1dc785050b2
|
||||
5ef51389cf6673a0e9e004909c7be1dc785050b2 Input: rmi4 - remove the need for artificial IRQ in case of HID
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/c1788012ebf8de46e9dc80d18051ed0c77c811b6
|
||||
c1788012ebf8de46e9dc80d18051ed0c77c811b6 ARM: tegra: usb no reset
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/577365feaa909db4c0949eabfcda7e4a972b8e54
|
||||
577365feaa909db4c0949eabfcda7e4a972b8e54 arm: make CONFIG_HIGHPTE optional without CONFIG_EXPERT
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/331be9c5a436057ee852075c102d9d90a9046a30
|
||||
331be9c5a436057ee852075c102d9d90a9046a30 redhat: rh_kabi: deduplication friendly structs
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/34d79fbfb327f732ebf3ece4db21a14f81fedf03
|
||||
34d79fbfb327f732ebf3ece4db21a14f81fedf03 redhat: rh_kabi add a comment with warning about RH_KABI_EXCLUDE usage
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/93a4b5f12d5a1c2d62cf1d7c440b31d9847eab07
|
||||
93a4b5f12d5a1c2d62cf1d7c440b31d9847eab07 redhat: rh_kabi: introduce RH_KABI_EXTEND_WITH_SIZE
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/8e5c06356457f5351289e9f687b991189d163dae
|
||||
8e5c06356457f5351289e9f687b991189d163dae redhat: rh_kabi: Indirect EXTEND macros so nesting of other macros will resolve.
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/212cbccda77cc81fcb60123907eabdac8ad5adb7
|
||||
212cbccda77cc81fcb60123907eabdac8ad5adb7 redhat: rh_kabi: Fix RH_KABI_SET_SIZE to use dereference operator
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/6f7744b412e1fb86a67d8761e64df69cf891b4ad
|
||||
6f7744b412e1fb86a67d8761e64df69cf891b4ad redhat: rh_kabi: Add macros to size and extend structs
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/049623d33998be30d79692c69b34acb502c496e3
|
||||
049623d33998be30d79692c69b34acb502c496e3 Removing Obsolete hba pci-ids from rhel8
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/43ef1d631ecfe84084db3572c9ed1bedbdceb0f8
|
||||
43ef1d631ecfe84084db3572c9ed1bedbdceb0f8 mptsas: pci-id table changes
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/e5726695109dd1a73da92487b75de6a51d54c015
|
||||
e5726695109dd1a73da92487b75de6a51d54c015 mptsas: Taint kernel if mptsas is loaded
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/ee4dcd6f04ca76ad35ab0f38c436ab2f7de53f16
|
||||
ee4dcd6f04ca76ad35ab0f38c436ab2f7de53f16 mptspi: pci-id table changes
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/bd305f716d8b64be1926bc7aebe02468ac6bf599
|
||||
bd305f716d8b64be1926bc7aebe02468ac6bf599 qla2xxx: Remove PCI IDs of deprecated adapter
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/803ff9a2c660c094e14d246ef05019bf6008d503
|
||||
803ff9a2c660c094e14d246ef05019bf6008d503 be2iscsi: remove unsupported device IDs
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/2cb24399321f555f18b0804d3fe02cf53949fba1
|
||||
2cb24399321f555f18b0804d3fe02cf53949fba1 mptspi: Taint kernel if mptspi is loaded
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/ad1740551ff4af49f1ef10a130783d9369e955a0
|
||||
ad1740551ff4af49f1ef10a130783d9369e955a0 hpsa: remove old cciss-based smartarray pci ids
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/4197ba3e766656eea9175c11ed05903620d98a28
|
||||
4197ba3e766656eea9175c11ed05903620d98a28 qla4xxx: Remove deprecated PCI IDs from RHEL 8
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/7e285aec22ab1213639afda877902db363473cb0
|
||||
7e285aec22ab1213639afda877902db363473cb0 aacraid: Remove depreciated device and vendor PCI id's
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/846109a16be92155e69731c36dde48761d375153
|
||||
846109a16be92155e69731c36dde48761d375153 megaraid_sas: remove deprecated pci-ids
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/6fd2019d01cee7ff36dc047d3ecdb504b968f222
|
||||
6fd2019d01cee7ff36dc047d3ecdb504b968f222 mpt*: remove certain deprecated pci-ids
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/dddcd5c1129b275ff160324036a662739db51fc3
|
||||
dddcd5c1129b275ff160324036a662739db51fc3 kernel: add SUPPORT_REMOVED kernel taint
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/08d77161dba915d1ed0d9fede658085440ab4474
|
||||
08d77161dba915d1ed0d9fede658085440ab4474 Rename RH_DISABLE_DEPRECATED to RHEL_DIFFERENCES
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/e2dc2ca6a25a445bf22ceb6a8e38e02706605341
|
||||
e2dc2ca6a25a445bf22ceb6a8e38e02706605341 Add option of 13 for FORCE_MAX_ZONEORDER
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/2384646bf71d8c282cf49bb20321fdf802c61cce
|
||||
2384646bf71d8c282cf49bb20321fdf802c61cce s390: Lock down the kernel when the IPL secure flag is set
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/5850c93175b9d2e1081873f4bbe08dead202cb08
|
||||
5850c93175b9d2e1081873f4bbe08dead202cb08 efi: Lock down the kernel if booted in secure boot mode
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/53250b991f841be025fa4d264850dadc0fae2861
|
||||
53250b991f841be025fa4d264850dadc0fae2861 efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/72223fd1241cc5c70b96a491db14d54c83beadd8
|
||||
72223fd1241cc5c70b96a491db14d54c83beadd8 security: lockdown: expose a hook to lock the kernel down
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/7ba28f03674fa9346610c3fea7fc93bc58f06d2a
|
||||
7ba28f03674fa9346610c3fea7fc93bc58f06d2a Make get_cert_list() use efi_status_to_str() to print error messages.
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/2ae9082db0b54d831a9b3782c049d9917e37d89f
|
||||
2ae9082db0b54d831a9b3782c049d9917e37d89f Add efi_status_to_str() and rework efi_status_to_err().
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/cee1461ada1b7e4b92cd154e7ec241119afcd644
|
||||
cee1461ada1b7e4b92cd154e7ec241119afcd644 Add support for deprecating processors
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/2420149f8f5fa9dd1e2dc793765b498022922a81
|
||||
2420149f8f5fa9dd1e2dc793765b498022922a81 arm: aarch64: Drop the EXPERT setting from ARM64_FORCE_52BIT
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/1d69b30b98b60aff639351f5788d20a3b17f6e27
|
||||
1d69b30b98b60aff639351f5788d20a3b17f6e27 iommu/arm-smmu: workaround DMA mode issues
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/6b2e73e508e7a117b1db91596097c00e5570f64a
|
||||
6b2e73e508e7a117b1db91596097c00e5570f64a rh_kabi: introduce RH_KABI_EXCLUDE
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/ecb9206bce179eb600c52642a6753012a69ce4a2
|
||||
ecb9206bce179eb600c52642a6753012a69ce4a2 ipmi: do not configure ipmi for HPE m400
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/473be59fe72afa9969cf8d10609ef3f14f594631
|
||||
473be59fe72afa9969cf8d10609ef3f14f594631 IB/rxe: Mark Soft-RoCE Transport driver as tech-preview
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/b94117795261f9c074a7addca2252238871b5081
|
||||
b94117795261f9c074a7addca2252238871b5081 scsi: smartpqi: add inspur advantech ids
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/cae871558c333880c1687cab6f2a71accf40d105
|
||||
cae871558c333880c1687cab6f2a71accf40d105 ice: mark driver as tech-preview
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/7d9cb007404211ea6638bde4a28dd0fbe8d95de0
|
||||
7d9cb007404211ea6638bde4a28dd0fbe8d95de0 kABI: Add generic kABI macros to use for kABI workarounds
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/bd353e9aae8877dd490e6c92b67849e0dcfbab25
|
||||
bd353e9aae8877dd490e6c92b67849e0dcfbab25 add pci_hw_vendor_status()
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/41a259999969bbdfe9f556ce71f2c3c07d7454f4
|
||||
41a259999969bbdfe9f556ce71f2c3c07d7454f4 ahci: thunderx2: Fix for errata that affects stop engine
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/2a107343529ce648c11bff62e9f72bbeec738f3f
|
||||
2a107343529ce648c11bff62e9f72bbeec738f3f Vulcan: AHCI PCI bar fix for Broadcom Vulcan early silicon
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/03e48a48f400a51a182a1254cf22ff0c08706d76
|
||||
03e48a48f400a51a182a1254cf22ff0c08706d76 bpf: Add tech preview taint for syscall
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/607f0e89af7ef5682f79f2eea0a99638a1bc0c4f
|
||||
607f0e89af7ef5682f79f2eea0a99638a1bc0c4f bpf: set unprivileged_bpf_disabled to 1 by default, add a boot parameter
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/31da227877eb734ddb484bc519aae85ce200802e
|
||||
31da227877eb734ddb484bc519aae85ce200802e add Red Hat-specific taint flags
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/7a2e2c83be0230667756cccb5bc3687419dfbb8b
|
||||
7a2e2c83be0230667756cccb5bc3687419dfbb8b kdump: fix a grammar issue in a kernel message
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/d345d54d33e7d496c9d845e4723550dd37cb3f88
|
||||
d345d54d33e7d496c9d845e4723550dd37cb3f88 tags.sh: Ignore redhat/rpm
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/5c67dc1eb0783a5c4ca4eb5c545ff6fe05facff0
|
||||
5c67dc1eb0783a5c4ca4eb5c545ff6fe05facff0 put RHEL info into generated headers
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/ce12884c009ec3bed11100c9d19f6d97628cf8ae
|
||||
ce12884c009ec3bed11100c9d19f6d97628cf8ae kdump: add support for crashkernel=auto
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/18fb1389afccdc5535977a10669b49a37829b55a
|
||||
18fb1389afccdc5535977a10669b49a37829b55a kdump: round up the total memory size to 128M for crashkernel reservation
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/5fb9821441cc0b77101ad9c0dfaa747957a4cce4
|
||||
5fb9821441cc0b77101ad9c0dfaa747957a4cce4 acpi: prefer booting with ACPI over DTS
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/0cf21a40db6fca5d89cf3d65808117c8c14e524e
|
||||
0cf21a40db6fca5d89cf3d65808117c8c14e524e aarch64: acpi scan: Fix regression related to X-Gene UARTs
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/de13e14cc2388478d9a2c68c5d90affd92098f11
|
||||
de13e14cc2388478d9a2c68c5d90affd92098f11 ACPI / irq: Workaround firmware issue on X-Gene based m400
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/71c098f4afa38a15a95495c14f71fb087ab27308
|
||||
71c098f4afa38a15a95495c14f71fb087ab27308 modules: add rhelversion MODULE_INFO tag
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/3247f9c838f4aa91aa5d08c152b385d61554d4b5
|
||||
3247f9c838f4aa91aa5d08c152b385d61554d4b5 ACPI: APEI: arm64: Ignore broken HPE moonshot APEI support
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/e80982feaa68226ff60d2f83dace2016c35270d3
|
||||
e80982feaa68226ff60d2f83dace2016c35270d3 Add Red Hat tainting
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/2987f9a606df106f5bdfa4113eb55356a21085a6
|
||||
2987f9a606df106f5bdfa4113eb55356a21085a6 Introduce CONFIG_RH_DISABLE_DEPRECATED
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/a99885a5e77af594dfdce586cc83e5911d8401ce
|
||||
a99885a5e77af594dfdce586cc83e5911d8401ce Pull the RHEL version defines out of the Makefile
|
||||
|
||||
https://gitlab.com/cki-project/kernel-ark/-/commit/cd3a5d30570279538623ea8a1255db0ee4b728f7
|
||||
cd3a5d30570279538623ea8a1255db0ee4b728f7 [initial commit] Add Red Hat variables in the top level makefile
|
||||
|
25
README.rst
25
README.rst
|
@ -1,25 +0,0 @@
|
|||
===================
|
||||
The Kernel dist-git
|
||||
===================
|
||||
|
||||
The kernel is maintained in a `source tree`_ rather than directly in dist-git.
|
||||
The specfile is maintained as a `template`_ in the source tree along with a set
|
||||
of build scripts to generate configurations, (S)RPMs, and to populate the
|
||||
dist-git repository.
|
||||
|
||||
The `documentation`_ for the source tree covers how to contribute and maintain
|
||||
the tree.
|
||||
|
||||
If you're looking for the downstream patch set it's available in the source
|
||||
tree with "git log master..ark-patches" or
|
||||
`online`_.
|
||||
|
||||
Each release in dist-git is tagged in the source repository so you can easily
|
||||
check out the source tree for a build. The tags are in the format
|
||||
name-version-release, but note release doesn't contain the dist tag since the
|
||||
source can be built in different build roots (Fedora, CentOS, etc.)
|
||||
|
||||
.. _source tree: https://gitlab.com/cki-project/kernel-ark.git
|
||||
.. _template: https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/kernel.spec.template
|
||||
.. _documentation: https://gitlab.com/cki-project/kernel-ark/-/wikis/home
|
||||
.. _online: https://gitlab.com/cki-project/kernel-ark/-/commits/ark-patches
|
|
@ -0,0 +1,82 @@
|
|||
|
||||
Kernel package tips & tricks.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The kernel is one of the more complicated packages in the distro, and
|
||||
for the newcomer, some of the voodoo in the spec file can be somewhat scary.
|
||||
This file attempts to document some of the magic.
|
||||
|
||||
|
||||
Speeding up make prep
|
||||
---------------------
|
||||
The kernel is nearly 500MB of source code, and as such, 'make prep'
|
||||
takes a while. The spec file employs some trickery so that repeated
|
||||
invocations of make prep don't take as long. Ordinarily the %prep
|
||||
phase of a package will delete the tree it is about to untar/patch.
|
||||
The kernel %prep keeps around an unpatched version of the tree,
|
||||
and makes a symlink tree clone of that clean tree and than applies
|
||||
the patches listed in the spec to the symlink tree.
|
||||
This makes a huge difference if you're doing multiple make preps a day.
|
||||
As an added bonus, doing a diff between the clean tree and the symlink
|
||||
tree is slightly faster than it would be doing two proper copies of the tree.
|
||||
|
||||
|
||||
build logs.
|
||||
-----------
|
||||
There's a convenience helper script in scripts/grab-logs.sh
|
||||
that will grab the build logs from koji for the kernel version reported
|
||||
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. At the top level, is
|
||||
config-generic. Add options here that should be present in every possible
|
||||
config on all architectures.
|
||||
|
||||
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.
|
||||
|
||||
The heirarchy looks like this..
|
||||
|
||||
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.
|
||||
|
||||
|
||||
debug options.
|
||||
--------------
|
||||
This is a little complicated, as the purpose & meaning of this changes
|
||||
depending on where we are in the release cycle.
|
||||
If we are building for a current stable release, 'make release' has
|
||||
typically been run already, which sets up the following..
|
||||
- Two builds occur, a 'kernel' and a 'kernel-debug' flavor.
|
||||
- kernel-debug will get various heavyweight debugging options like
|
||||
lockdep etc turned on.
|
||||
|
||||
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 from 'config-debug' are always turned on.
|
||||
This is done to increase coverage testing, as not many people actually
|
||||
run kernel-debug.
|
||||
|
||||
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,10 @@
|
|||
Config TODOs:
|
||||
* review & disable a bunch of the I2C, RTC, DVB, SOUND options.
|
||||
|
||||
Spec file TODOs:
|
||||
|
||||
* modules-extra: Do a few more things to make it a bit more robust.
|
||||
- Allow for comments in the mod-extra.list file.
|
||||
- Don't fail the build if a module is listed but not built (maybe).
|
||||
- See if it can be tied into Kconfig instead of module names.
|
||||
|
|
@ -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 {
|
|
@ -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,29 @@
|
|||
From 487ff7b0e537506057960a0c2d9482d19f2acf4a Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Wed, 26 Apr 2017 11:12:54 +0100
|
||||
Subject: [PATCH] Add option of 13 for FORCE_MAX_ZONEORDER
|
||||
|
||||
This is a hack, but it's what the other distros currently use
|
||||
for aarch64 with 4K pages so we'll do the same while upstream
|
||||
decides what the best outcome is (which isn't this).
|
||||
|
||||
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
||||
---
|
||||
arch/arm64/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
|
||||
index 3741859765cf..deec9511f1d3 100644
|
||||
--- a/arch/arm64/Kconfig
|
||||
+++ b/arch/arm64/Kconfig
|
||||
@@ -751,6 +751,7 @@ config XEN
|
||||
config FORCE_MAX_ZONEORDER
|
||||
int
|
||||
default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
|
||||
+ default "13" if (ARCH_THUNDER && !ARM64_64K_PAGES)
|
||||
default "12" if (ARM64_16K_PAGES && TRANSPARENT_HUGEPAGE)
|
||||
default "11"
|
||||
help
|
||||
--
|
||||
2.12.2
|
||||
|
|
@ -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.
|
|
@ -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,38 @@
|
|||
From: "kernel-team@fedoraproject.org" <kernel-team@fedoraproject.org>
|
||||
Date: Wed, 6 Feb 2013 09:57:47 -0500
|
||||
Subject: [PATCH] ath9k: rx dma stop check
|
||||
|
||||
---
|
||||
drivers/net/wireless/ath/ath9k/mac.c | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
|
||||
index bba85d1a6cd1..ebbee8f17130 100644
|
||||
--- a/drivers/net/wireless/ath/ath9k/mac.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/mac.c
|
||||
@@ -693,7 +693,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset)
|
||||
{
|
||||
#define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
- u32 mac_status, last_mac_status = 0;
|
||||
+ u32 mac_status = 0, last_mac_status = 0;
|
||||
int i;
|
||||
|
||||
/* Enable access to the DMA observation bus */
|
||||
@@ -723,6 +723,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset)
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
+ if (!AR_SREV_9300_20_OR_LATER(ah) &&
|
||||
+ (mac_status & 0x700) == 0) {
|
||||
+ /*
|
||||
+ * DMA is idle but the MAC is still stuck
|
||||
+ * processing events
|
||||
+ */
|
||||
+ *reset = true;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
ath_err(common,
|
||||
"DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n",
|
||||
AH_RX_STOP_DMA_TIMEOUT / 1000,
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_60XX_WDT is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_DEBUGFS=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_GHC_ICMPV6=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_GHC_UDP=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_DEST=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_FRAGMENT=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_HOP=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_IPV6=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_MOBILITY=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_ROUTING=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6LOWPAN_NHC_UDP=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_6PACK=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_8139CP=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_8139TOO=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_8139TOO_8129=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_8139TOO_PIO is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_8139TOO_TUNE_TWISTER is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_8139_OLD_RX_RESET is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_8723AU_AP_MODE is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_8723AU_BT_COEXIST is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_9P_FS=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_9P_FSCACHE=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_9P_FS_POSIX_ACL=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_9P_FS_SECURITY=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_A11Y_BRAILLE_CONSOLE=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AB3100_CORE is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AB3100_OTP is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ABP060MG=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ABX500_CORE is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ACCESSIBILITY=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ACENIC=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ACENIC_OMIT_TIGON_I is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ACORN_PARTITION is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ACPI_ALS=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ACPI_DEBUG is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ACPI_DEBUGGER is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ACPI_NFIT is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ACPI_PCI_SLOT=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ACPI_SPCR_TABLE=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ACQUIRE_WDT is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD2S1200 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD2S1210 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD2S90 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5064 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD525X_DPOT is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5360 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5380 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5421 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5446 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5449 is not set
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue