]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blobdiff - arch/arm64/kernel/sys.c
Add PREM-related syscalls
[hercules2020/nv-tegra/linux-4.4.git] / arch / arm64 / kernel / sys.c
index 75151aaf1a52025237be5e0becc8ffac514bae2c..b4ab54752677d67759de53144cc6e5ac86f5746a 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/slab.h>
 #include <linux/syscalls.h>
 
+#include <asm-generic/irq_regs.h>
+
 asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
                         unsigned long prot, unsigned long flags,
                         unsigned long fd, off_t off)
@@ -42,6 +44,41 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
 asmlinkage long sys_rt_sigreturn_wrapper(void);
 #define sys_rt_sigreturn       sys_rt_sigreturn_wrapper
 
+/* Added functions for PREM support */
+
+/*
+ * Disable IRQ syscall (__NR_prem_irq_disable)
+ */
+asmlinkage long sys_prem_irq_disable(void)
+{
+       /* We need to update userspace pstate that is going to be recovered.
+       * If we call any system call, the irq enabled on OS level */
+       struct pt_regs * regs = task_pt_regs(current);
+       regs->pstate |= (PSR_I_BIT | PSR_F_BIT);
+       return 0;
+}
+
+/*
+ * Enable IRQ syscall (__NR_prem_irq_enable)
+ */
+asmlinkage long sys_prem_irq_enable(void)
+{
+       struct pt_regs * regs = task_pt_regs(current);
+       regs->pstate &= ~(PSR_I_BIT | PSR_F_BIT);
+       return 0;
+}
+
+extern void __flush_dcache_all(void);
+
+/*
+ * Flush and invalidate entire cache (__NR_prem_flush)
+ */
+asmlinkage long sys_prem_flush(void)
+{
+       __flush_dcache_all();
+       return 0;
+}
+
 #undef __SYSCALL
 #define __SYSCALL(nr, sym)     [nr] = sym,