Skip to contentSkip to conversation

ignore vgacon if hardware not present

PATCH In review Rusty Russell 2 participants 7 messages Mar 29, 2007 – Mar 30, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ignore vgacon if hardware not present

(Did this fall through the cracks? I don't see it in -mm. It's standalone, and saves some silly code in lguest and presumably others). ==

Avoid trying to set up vgacon if there's no vga hardware present.

From: Gerd Hoffmann <[email protected]>

---
 drivers/video/console/vgacon.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

===================================================================

drivers/video/console/vgacon.c +2 -1
@@ -372,7 +372,8 @@ static const char *vgacon_startup(void)
 	}
 
 	/* VGA16 modes are not handled by VGACON */
-	if ((ORIG_VIDEO_MODE == 0x0D) ||	/* 320x200/4 */
+	if ((ORIG_VIDEO_MODE == 0x00) ||	/* SCREEN_INFO not initialized */
+	    (ORIG_VIDEO_MODE == 0x0D) ||	/* 320x200/4 */
 	    (ORIG_VIDEO_MODE == 0x0E) ||	/* 640x200/4 */
 	    (ORIG_VIDEO_MODE == 0x10) ||	/* 640x350/4 */
 	    (ORIG_VIDEO_MODE == 0x12) ||	/* 640x480/4 */
#1 lore raw
Quoted 2 lines · Rusty Russell

(Did this fall through the cracks? I don't see it in -mm. It's standalone, and saves some silly code in lguest and presumably others).

Normally it should go to some some console maintainer?

Ok I can add it.

-Andi

#2 lore raw
Quoted 5 lines · Andi Kleen
Quoted 2 lines · Rusty Russell

(Did this fall through the cracks? I don't see it in -mm. It's standalone, and saves some silly code in lguest and presumably others).

Normally it should go to some some console maintainer?

Hmm, but who?

Quoted 1 line

Ok I can add it.

Thanks. While you're in a patch-applying mood, how about this?

Cheers,
Rusty.
==
Use X86_EFLAGS_IF in irqflags.h.

Move X86_EFLAGS_IF et al out to a new header: processor-flags.h, so we can include it from irqflags.h and use it in raw_irqs_disabled_flags().

As a side-effect, we could now use these flags in .S files.

---
 include/asm-i386/irqflags.h        |    3 ++-
 include/asm-i386/processor-flags.h |   26 ++++++++++++++++++++++++++
 include/asm-i386/processor.h       |   22 +---------------------
 3 files changed, 29 insertions(+), 22 deletions(-)

===================================================================

include/asm-i386/processor-flags.h new file +26 -0
@@ -0,0 +1,26 @@
+#ifndef __ASM_I386_PROCESSOR_FLAGS_H
+#define __ASM_I386_PROCESSOR_FLAGS_H
+/* Various flags defined: can be included from assembler. */
+
+/*
+ * EFLAGS bits
+ */
+#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
+#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
+#define X86_EFLAGS_AF	0x00000010 /* Auxillary carry Flag */
+#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
+#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
+#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
+#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
+#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
+#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
+#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
+#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
+#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
+#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
+#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
+#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
+#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
+#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
+
+#endif	/* __ASM_I386_PROCESSOR_FLAGS_H */

===================================================================

include/asm-i386/irqflags.h +2 -1
@@ -9,6 +9,7 @@
  */
 #ifndef _ASM_IRQFLAGS_H
 #define _ASM_IRQFLAGS_H
+#include <asm/processor-flags.h>
 
 #ifndef __ASSEMBLY__
 static inline unsigned long native_save_fl(void)
@@ -119,7 +120,7 @@ static inline unsigned long __raw_local_
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-	return !(flags & (1 << 9));
+	return !(flags & X86_EFLAGS_IF);
 }
 
 static inline int raw_irqs_disabled(void)

===================================================================

include/asm-i386/processor.h +1 -21
@@ -21,6 +21,7 @@
 #include <asm/percpu.h>
 #include <linux/cpumask.h>
 #include <linux/init.h>
+#include <asm/processor-flags.h>
 
 /* flag for disabling the tsc */
 extern int tsc_disable;
@@ -125,27 +126,6 @@ extern void detect_ht(struct cpuinfo_x86
 #else
 static inline void detect_ht(struct cpuinfo_x86 *c) {}
 #endif
-
-/*
- * EFLAGS bits
- */
-#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
-#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
-#define X86_EFLAGS_AF	0x00000010 /* Auxillary carry Flag */
-#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
-#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
-#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
-#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
-#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
-#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
-#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
-#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
-#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
-#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
-#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
-#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
-#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
-#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
 
 static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
 					 unsigned int *ecx, unsigned int *edx)
#3 lore raw
Quoted 5 lines · Rusty Russell
Quoted 4 lines · Andi Kleen
Quoted 2 lines · Rusty Russell

(Did this fall through the cracks? I don't see it in -mm. It's standalone, and saves some silly code in lguest and presumably others).

Quoted 7 lines
Quoted 1 line

Normally it should go to some some console maintainer?

Hmm, but who?

Quoted 1 line

Ok I can add it.

Thanks. While you're in a patch-applying mood, how about this?

Ok. Can you do it for x86-64 too?

-Andi

#4 lore raw

PATCH 1/1 Use X86_EFLAGS_IF in x86-64/irqflags.h.

Quoted 1 line · Andi Kleen

On Thu, Mar 29, 2007 at 09:06:57PM +1000, Rusty Russell wrote:

[SNIP: processor-flags.h patch for i386 ]

Quoted 1 line

Ok. Can you do it for x86-64 too?

OK, here it is. Compiles, but -rc5-mm2 doesn't link for me on x86-64 at the moment.

Something seems quite wrong with CONFIG_X86_VSMP. AFAICT (1 << 18) is the "alignment check" flag, not the "virtual interrupt" flag which I expected.

Cheers,
Rusty.
==
As per i386 patch: move X86_EFLAGS_IF et al out to a new header:
processor-flags.h, so we can include it from irqflags.h and use it in raw_irqs_disabled_flags().

As a side-effect, we could now use these flags in .S files.

include/asm-x86_64/irqflags.h +5 -4
diff -r 533294f1af63 include/asm-x86_64/irqflags.h
@@ -9,6 +9,7 @@
  */
 #ifndef _ASM_IRQFLAGS_H
 #define _ASM_IRQFLAGS_H
+#include <asm/processor-flags.h>
 
 #ifndef __ASSEMBLY__
 /*
@@ -53,19 +54,19 @@ static inline void raw_local_irq_disable
 {
 	unsigned long flags = __raw_local_save_flags();
 
-	raw_local_irq_restore((flags & ~(1 << 9)) | (1 << 18));
+	raw_local_irq_restore((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
 }
 
 static inline void raw_local_irq_enable(void)
 {
 	unsigned long flags = __raw_local_save_flags();
 
-	raw_local_irq_restore((flags | (1 << 9)) & ~(1 << 18));
+	raw_local_irq_restore((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
 }
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-	return !(flags & (1<<9)) || (flags & (1 << 18));
+	return !(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC);
 }
 
 #else /* CONFIG_X86_VSMP */
@@ -82,7 +83,7 @@ static inline void raw_local_irq_enable(
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-	return !(flags & (1 << 9));
+	return !(flags & X86_EFLAGS_IF);
 }
 
 #endif
include/asm-x86_64/processor-flags.h new file +26 -0
diff -r 533294f1af63 include/asm-x86_64/processor-flags.h
@@ -0,0 +1,26 @@
+#ifndef __ASM_X86_64_PROCESSOR_FLAGS_H
+#define __ASM_X86_64_PROCESSOR_FLAGS_H
+/* Various flags defined: can be included from assembler. */
+
+/*
+ * EFLAGS bits
+ */
+#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
+#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
+#define X86_EFLAGS_AF	0x00000010 /* Auxillary carry Flag */
+#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
+#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
+#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
+#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
+#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
+#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
+#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
+#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
+#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
+#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
+#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
+#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
+#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
+#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
+
+#endif /* __ASM_X86_64_PROCESSOR_FLAGS_H */
include/asm-x86_64/processor.h +1 -21
diff -r 533294f1af63 include/asm-x86_64/processor.h
@@ -20,6 +20,7 @@
 #include <asm/percpu.h>
 #include <linux/personality.h>
 #include <linux/cpumask.h>
+#include <asm/processor-flags.h>
 
 #define TF_MASK		0x00000100
 #define IF_MASK		0x00000200
@@ -103,27 +104,6 @@ extern unsigned short num_cache_leaves;
 extern unsigned short num_cache_leaves;
 
 /*
- * EFLAGS bits
- */
-#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
-#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
-#define X86_EFLAGS_AF	0x00000010 /* Auxillary carry Flag */
-#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
-#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
-#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
-#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
-#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
-#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
-#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
-#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
-#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
-#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
-#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
-#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
-#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
-#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
-
-/*
  * Intel CPU features in CR4
  */
 #define X86_CR4_VME		0x0001	/* enable vm86 extensions */
#5 lore raw

Re: [PATCH] Use X86_EFLAGS_IF in x86-64/irqflags.h.

Quoted 9 lines · Rusty Russell
Quoted 1 line · Andi Kleen

On Thu, Mar 29, 2007 at 09:06:57PM +1000, Rusty Russell wrote:

[SNIP: processor-flags.h patch for i386 ]

Quoted 1 line

Ok. Can you do it for x86-64 too?

OK, here it is. Compiles, but -rc5-mm2 doesn't link for me on x86-64 at the moment.

What's the problem?

Quoted 4 lines

Something seems quite wrong with CONFIG_X86_VSMP. AFAICT (1 << 18) is the "alignment check" flag, not the "virtual interrupt" flag which I expected.

They abuse that intentionally as a way to talk to their hypervisor. You don't want to know details.

-Andi

#6 lore raw

Re: [PATCH] Use X86_EFLAGS_IF in x86-64/irqflags.h.

Quoted 4 lines · Andi Kleen
Quoted 3 lines · Rusty Russell
Quoted 1 line · Andi Kleen

On Thu, Mar 29, 2007 at 09:06:57PM +1000, Rusty Russell wrote:

Quoted 8 lines
Quoted 6 lines

[SNIP: processor-flags.h patch for i386 ]

Quoted 1 line

Ok. Can you do it for x86-64 too?

OK, here it is. Compiles, but -rc5-mm2 doesn't link for me on x86-64 at the moment.

What's the problem?

Sorry, should have included it, I assumed a known issue:

LD .tmp_vmlinux1
ld: section .vsyscall_1 [0000000000533400 -> 000000000053342e] overlaps section .jiffies [0000000000533400 -> 0000000000533407]
ld: .tmp_vmlinux1: section .vsyscall_1 lma 0x533400 overlaps previous sections
make: *** [.tmp_vmlinux1] Error 1

Cheers,
Rusty.