Skip to contentSkip to conversation

lguest patches for compiling x86_64

PATCH New Glauber de Oliveira Costa 1 participant 13 messages Jan 19, 2008

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

cover lguest patches for compiling x86_64

Right now, I have lguest in-tree module compiling on x86_64. It's not yet on a sendable state, since the module itself isn't loading.

However, this subset of the series is pretty straightforward, and I'm sending it now aiming at reducing the delta size in the future ;-)

Have fun,

#1 lore raw

PATCH 1/6 explicitly use ktime.h include

This patch adds the ktime.h header explicitly to hypercalls file, and avoid depending on it being included somewhere else.

---
 drivers/lguest/hypercalls.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/lguest/hypercalls.c +1 -0
index 32666d0..0f2cb4f 100644
@@ -23,6 +23,7 @@
 #include <linux/uaccess.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
+#include <linux/ktime.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include "lg.h"
Signature · 1 line
1.5.0.6
#2 lore raw

PATCH 1/6 explicitly use ktime.h include

In reply to Glauber de Oliveira Costa

This patch adds the ktime.h header explicitly to hypercalls file, and avoid depending on it being included somewhere else.

---
 drivers/lguest/hypercalls.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/lguest/hypercalls.c +1 -0
index 32666d0..0f2cb4f 100644
@@ -23,6 +23,7 @@
 #include <linux/uaccess.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
+#include <linux/ktime.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include "lg.h"
Signature · 1 line
1.5.0.6
#3 lore raw

PATCH 2/6 explicitly use hrtimer.h include

This patch adds the hrtimer.h header explicitly to lg.h file, and avoid depending on it being included somewhere else.

---
 drivers/lguest/lg.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/lguest/lg.h +1 -0
index f9707cf..eb51fc2 100644
@@ -8,6 +8,7 @@
 #include <linux/lguest.h>
 #include <linux/lguest_launcher.h>
 #include <linux/wait.h>
+#include <linux/hrtimer.h>
 #include <linux/err.h>
 #include <asm/semaphore.h>
 
Signature · 1 line
1.5.0.6
#4 lore raw

PATCH 2/6 explicitly use hrtimer.h include

In reply to Glauber de Oliveira Costa

This patch adds the hrtimer.h header explicitly to lg.h file, and avoid depending on it being included somewhere else.

---
 drivers/lguest/lg.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/lguest/lg.h +1 -0
index f9707cf..eb51fc2 100644
@@ -8,6 +8,7 @@
 #include <linux/lguest.h>
 #include <linux/lguest_launcher.h>
 #include <linux/wait.h>
+#include <linux/hrtimer.h>
 #include <linux/err.h>
 #include <asm/semaphore.h>
 
Signature · 1 line
1.5.0.6
#5 lore raw

PATCH 3/6 explicitly use sched.h include

This patch adds the sched.h header explicitly to lguest_user file, and avoid depending on it being included somewhere else.

---
 drivers/lguest/lguest_user.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/lguest/lguest_user.c +1 -0
index a87fca6..85d42d3 100644
@@ -6,6 +6,7 @@
 #include <linux/uaccess.h>
 #include <linux/miscdevice.h>
 #include <linux/fs.h>
+#include <linux/sched.h>
 #include "lg.h"
 
 /*L:055 When something happens, the Waker process needs a way to stop the
Signature · 1 line
1.5.0.6
#6 lore raw

PATCH 3/6 explicitly use sched.h include

In reply to Glauber de Oliveira Costa

This patch adds the sched.h header explicitly to lguest_user file, and avoid depending on it being included somewhere else.

---
 drivers/lguest/lguest_user.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/lguest/lguest_user.c +1 -0
index a87fca6..85d42d3 100644
@@ -6,6 +6,7 @@
 #include <linux/uaccess.h>
 #include <linux/miscdevice.h>
 #include <linux/fs.h>
+#include <linux/sched.h>
 #include "lg.h"
 
 /*L:055 When something happens, the Waker process needs a way to stop the
Signature · 1 line
1.5.0.6
#7 lore raw

PATCH 4/6 use __PAGE_KERNEL instead of _PAGE_KERNEL

x86_64 don't expose the intermediate representation with one underline, _PAGE_KERNEL, just the double-underlined one.

Use it, to get a common ground between 32 and 64-bit

---
 drivers/lguest/page_tables.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/lguest/page_tables.c +2 -2
index 399c05d..fb5ebd0 100644
@@ -645,7 +645,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
 
 	/* Make the last PGD entry for this Guest point to the Switcher's PTE
 	 * page for this CPU (with appropriate flags). */
-	switcher_pgd = __pgd(__pa(switcher_pte_page) | _PAGE_KERNEL);
+	switcher_pgd = __pgd(__pa(switcher_pte_page) | __PAGE_KERNEL);
 
 	cpu->lg->pgdirs[cpu->cpu_pgd].pgdir[SWITCHER_PGD_INDEX] = switcher_pgd;
 
@@ -657,7 +657,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
 	 * page is already mapped there, we don't have to copy them out
 	 * again. */
 	pfn = __pa(cpu->regs_page) >> PAGE_SHIFT;
-	regs_pte = pfn_pte(pfn, __pgprot(_PAGE_KERNEL));
+	regs_pte = pfn_pte(pfn, __pgprot(__PAGE_KERNEL));
 	switcher_pte_page[(unsigned long)pages/PAGE_SIZE%PTRS_PER_PTE] = regs_pte;
 }
 /*:*/
Signature · 1 line
1.5.0.6
#8 lore raw

PATCH 4/6 use __PAGE_KERNEL instead of _PAGE_KERNEL

In reply to Glauber de Oliveira Costa

x86_64 don't expose the intermediate representation with one underline, _PAGE_KERNEL, just the double-underlined one.

Use it, to get a common ground between 32 and 64-bit

---
 drivers/lguest/page_tables.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/lguest/page_tables.c +2 -2
index 399c05d..fb5ebd0 100644
@@ -645,7 +645,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
 
 	/* Make the last PGD entry for this Guest point to the Switcher's PTE
 	 * page for this CPU (with appropriate flags). */
-	switcher_pgd = __pgd(__pa(switcher_pte_page) | _PAGE_KERNEL);
+	switcher_pgd = __pgd(__pa(switcher_pte_page) | __PAGE_KERNEL);
 
 	cpu->lg->pgdirs[cpu->cpu_pgd].pgdir[SWITCHER_PGD_INDEX] = switcher_pgd;
 
@@ -657,7 +657,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
 	 * page is already mapped there, we don't have to copy them out
 	 * again. */
 	pfn = __pa(cpu->regs_page) >> PAGE_SHIFT;
-	regs_pte = pfn_pte(pfn, __pgprot(_PAGE_KERNEL));
+	regs_pte = pfn_pte(pfn, __pgprot(__PAGE_KERNEL));
 	switcher_pte_page[(unsigned long)pages/PAGE_SIZE%PTRS_PER_PTE] = regs_pte;
 }
 /*:*/
Signature · 1 line
1.5.0.6
#9 lore raw

PATCH 5/6 export check_tsc_unstable

Exporrt check_tsc_unstable function as GPL symbol. lguest is a user of it.

---
 arch/x86/kernel/tsc_64.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/x86/kernel/tsc_64.c +3 -1
index c62f3b6..947554d 100644
@@ -92,10 +92,12 @@ sched_clock(void) __attribute__((alias("native_sched_clock")));
 
 static int tsc_unstable;
 
-inline int check_tsc_unstable(void)
+int check_tsc_unstable(void)
 {
 	return tsc_unstable;
 }
+EXPORT_SYMBOL_GPL(check_tsc_unstable);
+
 #ifdef CONFIG_CPU_FREQ
 
 /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
Signature · 1 line
1.5.0.6
#10 lore raw

PATCH 5/6 export check_tsc_unstable

In reply to Glauber de Oliveira Costa

Exporrt check_tsc_unstable function as GPL symbol. lguest is a user of it.

---
 arch/x86/kernel/tsc_64.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/x86/kernel/tsc_64.c +3 -1
index c62f3b6..947554d 100644
@@ -92,10 +92,12 @@ sched_clock(void) __attribute__((alias("native_sched_clock")));
 
 static int tsc_unstable;
 
-inline int check_tsc_unstable(void)
+int check_tsc_unstable(void)
 {
 	return tsc_unstable;
 }
+EXPORT_SYMBOL_GPL(check_tsc_unstable);
+
 #ifdef CONFIG_CPU_FREQ
 
 /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
Signature · 1 line
1.5.0.6
#11 lore raw

PATCH 6/6 export __supported_pte_mask

export __supported_pte_mask variable as GPL symbol. lguest is a user of it.

---
 arch/x86/kernel/setup64.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/setup64.c +2 -0
index 8fa0de8..5cc1339 100644
@@ -41,6 +41,8 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask __read_mostly = ~0UL;
+EXPORT_SYMBOL_GPL(__supported_pte_mask);
+
 static int do_not_nx __cpuinitdata = 0;
 
 /* noexec=on|off
Signature · 1 line
1.5.0.6
#12 lore raw

PATCH 6/6 export __supported_pte_mask

In reply to Glauber de Oliveira Costa

export __supported_pte_mask variable as GPL symbol. lguest is a user of it.

---
 arch/x86/kernel/setup64.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/setup64.c +2 -0
index 8fa0de8..5cc1339 100644
@@ -41,6 +41,8 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask __read_mostly = ~0UL;
+EXPORT_SYMBOL_GPL(__supported_pte_mask);
+
 static int do_not_nx __cpuinitdata = 0;
 
 /* noexec=on|off
Signature · 1 line
1.5.0.6