summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorEdmond Chung <edmondchung@google.com>2020-08-03 18:15:09 -0700
committerTreeHugger Robot <treehugger-gerrit@google.com>2020-12-23 07:38:34 +0000
commit478910511c900157f23b4d4426f67dda56744b3c (patch)
treed707ebc404848d29eb2cc783dd5163d7c00fc3b1 /platform
parent035c6beda25612d0c0072000488f45f3725c6355 (diff)
downloadlwis-478910511c900157f23b4d4426f67dda56744b3c.tar.gz
General: No kernel panic for SysMMU page faults.
This disables kernel panic if LWIS hits SysMMU page faults, and let userspace handle the errors more gracefully. Bug: 162036180 Signed-off-by: Edmond Chung <edmondchung@google.com> Change-Id: Ic4e22e7a0a65231d5d1b8b8e9a0cf3095c617a5d
Diffstat (limited to 'platform')
-rw-r--r--platform/gs101/lwis_platform_gs101.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/platform/gs101/lwis_platform_gs101.c b/platform/gs101/lwis_platform_gs101.c
index b17da6b..6a15a8d 100644
--- a/platform/gs101/lwis_platform_gs101.c
+++ b/platform/gs101/lwis_platform_gs101.c
@@ -22,9 +22,7 @@
#include "lwis_platform.h"
/* Uncomment to let kernel panic when IOMMU hits a page fault. */
-/* TODO: Add error handling to propagate IOMMU errors back to userspace,
- * so we don't need to panic here. */
-#define ENABLE_PAGE_FAULT_PANIC
+/* #define ENABLE_PAGE_FAULT_PANIC */
int lwis_platform_probe(struct lwis_device *lwis_dev)
{
@@ -58,7 +56,7 @@ int lwis_platform_probe(struct lwis_device *lwis_dev)
return 0;
}
-static int __attribute__((unused)) lwis_iommu_fault_handler(struct iommu_fault *fault, void *param)
+static int lwis_iommu_fault_handler(struct iommu_fault *fault, void *param)
{
struct lwis_device *lwis_dev = (struct lwis_device *)param;
struct lwis_mem_page_fault_event_payload event_payload;
@@ -82,9 +80,9 @@ static int __attribute__((unused)) lwis_iommu_fault_handler(struct iommu_fault *
&event_payload, sizeof(event_payload));
#ifdef ENABLE_PAGE_FAULT_PANIC
- return NOTIFY_BAD;
+ return -EFAULT;
#else
- return NOTIFY_OK;
+ return -EAGAIN;
#endif /* ENABLE_PAGE_FAULT_PANIC */
}