Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1194819

[PATCH 5/8] x86/vm86: Add a separate config option for hardware IRQ handling

From Brian Gerst <brgerst@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 5/8] x86/vm86: Add a separate config option for hardware IRQ handling
Date 2015-07-29 07:50 +0200
Message-ID <pRspB-7rV-17@gated-at.bofh.it> (permalink)
References <pRspA-7rV-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Allow disabling hardware interrupt support for vm86.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/Kconfig                   |  8 ++++++++
 arch/x86/include/asm/irq_vectors.h | 10 ----------
 arch/x86/include/asm/vm86.h        | 20 ++++++++++++++++++--
 arch/x86/kernel/vm86_32.c          | 12 ++++++++++--
 4 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cbd2d62..7c7ec31 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1067,6 +1067,14 @@ config VM86
        bool
        default X86_LEGACY_VM86
 
+config VM86_INTERRUPTS
+	bool "Enable VM86 interrupt support"
+	default y
+	depends on VM86
+	---help---
+	  This option allows VM86 programs to request interrupts for
+	  real mode hardware drivers.
+
 config X86_16BIT
 	bool "Enable support for 16-bit segments" if EXPERT
 	default y
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 4c2d2eb..6ca9fd6 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -117,16 +117,6 @@
 
 #define FPU_IRQ				  13
 
-#define	FIRST_VM86_IRQ			   3
-#define LAST_VM86_IRQ			  15
-
-#ifndef __ASSEMBLY__
-static inline int invalid_vm86_irq(int irq)
-{
-	return irq < FIRST_VM86_IRQ || irq > LAST_VM86_IRQ;
-}
-#endif
-
 /*
  * Size the maximum number of interrupts.
  *
diff --git a/arch/x86/include/asm/vm86.h b/arch/x86/include/asm/vm86.h
index dd45aa1..05f6394 100644
--- a/arch/x86/include/asm/vm86.h
+++ b/arch/x86/include/asm/vm86.h
@@ -49,7 +49,6 @@ int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
 void save_v86_state(struct kernel_vm86_regs *, int);
 
 struct task_struct;
-void release_vm86_irqs(struct task_struct *);
 
 #define free_vm86(t) do {				\
 	struct thread_struct *__t = (t);		\
@@ -62,7 +61,6 @@ void release_vm86_irqs(struct task_struct *);
 #else
 
 #define handle_vm86_fault(a, b)
-#define release_vm86_irqs(a)
 
 static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c)
 {
@@ -75,4 +73,22 @@ static inline void save_v86_state(struct kernel_vm86_regs *, int) { }
 
 #endif /* CONFIG_VM86 */
 
+#ifdef CONFIG_VM86_INTERRUPTS
+
+#define FIRST_VM86_IRQ		 3
+#define LAST_VM86_IRQ		15
+
+static inline int invalid_vm86_irq(int irq)
+{
+	return irq < FIRST_VM86_IRQ || irq > LAST_VM86_IRQ;
+}
+
+void release_vm86_irqs(struct task_struct *);
+
+#else /* CONFIG_VM86_INTERRUPTS */
+
+static inline void release_vm86_irqs(struct task_struct *tsk) { }
+
+#endif /* CONFIG_VM86_INTERRUPTS */
+
 #endif /* _ASM_X86_VM86_H */
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index ffe98ec..9cdd33c 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -189,8 +189,15 @@ out:
 }
 
 
-
+#ifdef CONFIG_VM86_INTERRUPTS
 static int do_vm86_irq_handling(int subfunction, int irqnumber);
+#else
+static inline int do_vm86_irq_handling(int subfunction, int irqnumber)
+{
+	return -EINVAL;
+}
+#endif
+
 static long do_sys_vm86(struct vm86plus_struct __user *v86, bool plus);
 
 SYSCALL_DEFINE1(vm86old, struct vm86_struct __user *, v86)
@@ -713,6 +720,7 @@ simulate_sigsegv:
 	save_v86_state(regs, VM86_UNKNOWN);
 }
 
+#ifdef CONFIG_VM86_INTERRUPTS
 /* ---------------- vm86 special IRQ passing stuff ----------------- */
 
 #define VM86_IRQNAME		"vm86irq"
@@ -828,4 +836,4 @@ static int do_vm86_irq_handling(int subfunction, int irqnumber)
 	}
 	return -EINVAL;
 }
-
+#endif
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 5/8] x86/vm86: Add a separate config option for hardware IRQ handling Brian Gerst <brgerst@gmail.com> - 2015-07-29 07:50 +0200

csiph-web