public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: "Zhang, Xiantao" <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Hollis Blanchard
	<hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Zhang Wei <Wei.Zhang-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: Re: [kvm-ppc-devel] Current e500 kvm guest kernel booting log
Date: Tue, 18 Dec 2007 11:04:01 +0100	[thread overview]
Message-ID: <47679B11.8070604@linux.vnet.ibm.com> (raw)
In-Reply-To: <42DFA526FC41B1429CE7279EF83C6BDCB131B6-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1868 bytes --]

Hollis already pointed me to the mkasm-values patches which are the continuation of the mkasm-offset discussion on lkml Hollis last patch was based on.
As stated before by Xiantao and Hollis in this thread the mkasm-value patches are not yet accepted upstream, but may be useful for us.
Based on Hollis old mkasm-offsets patch, the further discussion on lkml and Xiantaos suggestion about the FORCE target I created a mkasm-values patch that now is at least able to do what we need for ppc and should fit the ia64 needs too.
We might use it internally until mkasm-values is accepted in any way or in a local form like ia64 that currently use their own script - let us at least use a common one together and mkasm-values may be a good base for that ;-)
The current patch is for discussion only because it won't fit git head of avi's tree - I need to rebase Hollis tree first and I'll send an update once I get around to do it.

The patch work to create, and re-generate asm-values.h as we need it and since now every architecture has its own arch/kvm&asm directory we can even keep the name "asm-values.h" the lkml patches expect. Because these preview patches are for discussion only I attach both to this mail instead of sending standard [patch][x/y] mails.

@Zhang Wai - afaik you use Hollis kvmppc development tree, you can just remove the old mkasm-offset patch and add these two to get the offset stuff to work for now

-- 

Grüsse / regards, 
Christian Ehrhardt

IBM Linux Technology Center, Open Virtualization
+49 7031/16-3385
Ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Ehrhardt-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Johann Weihen 
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

[-- Attachment #2: mkasm-values-new --]
[-- Type: text/plain, Size: 2483 bytes --]

diff -r 78da6ce942cc include/asm-generic/asm-values.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/asm-generic/asm-values.h	Mon Dec 17 13:38:19 2007 +0100
@@ -0,0 +1,7 @@
+#define DEFINE(sym, val) \
+	asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+#define OFFSET(sym, str, mem) \
+	DEFINE(sym, offsetof(struct str, mem));
diff -r 78da6ce942cc scripts/Makefile.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/Makefile.asm	Tue Dec 18 10:36:48 2007 +0100
@@ -0,0 +1,29 @@
+# ==========================================================================
+# Help generate definitions needed by assembly language modules.
+# ==========================================================================
+
+include scripts/Kbuild.include
+
+ifndef asm-values_h
+    asm-values := $(shell test -e $(srctree)/$(src)/asm-values.c && echo ok)
+    ifneq ($(asm-values),)
+	asm-values_h := asm-values.h
+	asm-values   := asm-values.s
+    endif
+endif
+
+always		+= $(asm-values_h)
+targets		+= $(asm-values_h) $(asm-values)
+mkasm-values	:= $(srctree)/scripts/mkasm-values.sh
+
+quiet_cmd_mkasm-values = GEN     $@
+      cmd_mkasm-values = $(CONFIG_SHELL) $(mkasm-values) $< $@ $(2)
+
+quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@
+      cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
+
+$(obj)/asm-values.h: $(obj)/asm-values.s
+	$(call cmd,mkasm-values,$(ASM_NS))
+
+$(obj)/%.s: $(src)/%.c
+	$(call if_changed_dep,cc_s_c)
diff -r 78da6ce942cc scripts/mkasm-values.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/mkasm-values.sh	Mon Dec 17 13:38:19 2007 +0100
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Input file "*.s", made by Kbuild from a "*.c" source, where values of
+# interest are calculated, is processed in a suitable output header file.
+#
+# $1 - input filename;
+# $2 - output filename;
+# $3 - generate (private) file with given namespace (optional)
+
+set -e
+
+[ -z "$1" ] || [ -z "$2" ] && {
+	echo "$0:
+
+Two parameters needed. Exiting.
+"
+	exit 1
+}
+
+NS=`echo $3 | tr a-z A-Z`
+case $NS in
+	MIPS)
+SED_SCRIPT='
+/^@@@/{
+s|^@@@||;
+s| #.*$||;
+p;
+}'	;;
+	*)
+TAB="`printf '\t'`"
+SED_SCRIPT="
+/^->/{
+s|^->||;
+s|^\([^ ]*\) [\$#]*\([^ ]*\) \([^$TAB]*\).*|#define \1 \2$TAB/* \3 */|;
+p;
+}"	;;
+esac
+
+NS=__ASM_VALUES_${NS:=H}__
+
+exec 1>$2
+echo "\
+#if !defined($NS)
+#define $NS
+
+/*
+ * $2
+ * was generated from
+ * $1
+ */
+"
+sed -ne "$SED_SCRIPT" $1
+
+echo "
+#endif"

[-- Attachment #3: use-mkasm-for-kvm-powerpc --]
[-- Type: text/plain, Size: 3944 bytes --]

diff -r 1b4814a8e0ed drivers/kvm/Makefile
--- a/drivers/kvm/Makefile	Tue Dec 18 10:37:21 2007 +0100
+++ b/drivers/kvm/Makefile	Tue Dec 18 10:37:37 2007 +0100
@@ -14,7 +14,7 @@ kvm-amd-objs = svm.o
 kvm-amd-objs = svm.o
 obj-$(CONFIG_KVM_AMD) += kvm-amd.o
 
+include $(srctree)/scripts/Makefile.asm
+FORCE: $(obj)/asm-values.h
 kvm-powerpc-objs := powerpc.o ppc_emulate.o ppc_tlb.o ppc_44x_exceptions.o
 obj-$(CONFIG_KVM_POWERPC) += kvm-powerpc.o
-
-AFLAGS_ppc_44x_exceptions.o := -I$(obj)
diff -r 1b4814a8e0ed drivers/kvm/ppc-offsets.c
--- a/drivers/kvm/ppc-offsets.c	Tue Dec 18 10:37:21 2007 +0100
+++ b/drivers/kvm/ppc-offsets.c	Tue Dec 18 10:37:37 2007 +0100
@@ -21,38 +21,36 @@
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include "kvm.h"
-
-#define DEFINE(sym, val) \
-	asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+#include <asm-generic/asm-values.h>
 
 int main(void)
 {
 	DEFINE(TLBE_BYTES, sizeof(struct tlbe));
 
-	DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, host_stack));
-	DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, host_pid));
-	DEFINE(VCPU_HOST_TLB, offsetof(struct kvm_vcpu, host_tlb));
-	DEFINE(VCPU_SHADOW_TLB, offsetof(struct kvm_vcpu, shadow_tlb));
-	DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, gpr));
-	DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, lr));
-	DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, cr));
-	DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, xer));
-	DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, ctr));
-	DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, pc));
-	DEFINE(VCPU_GUEST_MSR, offsetof(struct kvm_vcpu, guest_msr));
-	DEFINE(VCPU_SHADOW_MSR, offsetof(struct kvm_vcpu, shadow_msr));
-	DEFINE(VCPU_SPRG4, offsetof(struct kvm_vcpu, sprg4));
-	DEFINE(VCPU_SPRG5, offsetof(struct kvm_vcpu, sprg5));
-	DEFINE(VCPU_SPRG6, offsetof(struct kvm_vcpu, sprg6));
-	DEFINE(VCPU_SPRG7, offsetof(struct kvm_vcpu, sprg7));
-	DEFINE(VCPU_PID, offsetof(struct kvm_vcpu, pid));
+	OFFSET(VCPU_HOST_STACK, struct kvm_vcpu, host_stack);
+	OFFSET(VCPU_HOST_PID, struct kvm_vcpu, host_pid);
+	OFFSET(VCPU_HOST_TLB, struct kvm_vcpu, host_tlb);
+	OFFSET(VCPU_SHADOW_TLB, struct kvm_vcpu, shadow_tlb);
+	OFFSET(VCPU_GPRS, struct kvm_vcpu, gpr);
+	OFFSET(VCPU_LR, struct kvm_vcpu, lr);
+	OFFSET(VCPU_CR, struct kvm_vcpu, cr);
+	OFFSET(VCPU_XER, struct kvm_vcpu, xer);
+	OFFSET(VCPU_CTR, struct kvm_vcpu, ctr);
+	OFFSET(VCPU_PC, struct kvm_vcpu, pc);
+	OFFSET(VCPU_GUEST_MSR, struct kvm_vcpu, guest_msr);
+	OFFSET(VCPU_SHADOW_MSR, struct kvm_vcpu, shadow_msr);
+	OFFSET(VCPU_SPRG4, struct kvm_vcpu, sprg4);
+	OFFSET(VCPU_SPRG5, struct kvm_vcpu, sprg5);
+	OFFSET(VCPU_SPRG6, struct kvm_vcpu, sprg6);
+	OFFSET(VCPU_SPRG7, struct kvm_vcpu, sprg7);
+	OFFSET(VCPU_PID, struct kvm_vcpu, pid);
 
-	DEFINE(VCPU_TRAMPOLINE, offsetof(struct kvm_vcpu, trampoline));
-	DEFINE(VCPU_TRAMPOLINE_TLBE, offsetof(struct kvm_vcpu, trampoline_tlbe));
-	DEFINE(VCPU_LINEAR, offsetof(struct kvm_vcpu, linear));
-	DEFINE(VCPU_RESUME_GUEST, offsetof(struct kvm_vcpu, resume_guest));
-	DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, last_inst));
-	DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, fault_dear));
-	DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, fault_esr));
+	OFFSET(VCPU_TRAMPOLINE, struct kvm_vcpu, trampoline);
+	OFFSET(VCPU_TRAMPOLINE_TLBE, struct kvm_vcpu, trampoline_tlbe);
+	OFFSET(VCPU_LINEAR, struct kvm_vcpu, linear);
+	OFFSET(VCPU_RESUME_GUEST, struct kvm_vcpu, resume_guest);
+	OFFSET(VCPU_LAST_INST, struct kvm_vcpu, last_inst);
+	OFFSET(VCPU_FAULT_DEAR, struct kvm_vcpu, fault_dear);
+	OFFSET(VCPU_FAULT_ESR, struct kvm_vcpu, fault_esr);
 	return 0;
 }
diff -r 1b4814a8e0ed drivers/kvm/ppc_44x_exceptions.S
--- a/drivers/kvm/ppc_44x_exceptions.S	Tue Dec 18 10:37:21 2007 +0100
+++ b/drivers/kvm/ppc_44x_exceptions.S	Tue Dec 18 10:37:37 2007 +0100
@@ -24,7 +24,7 @@
 #include <asm/page.h>
 
 #include "powerpc.h"
-#include "ppc-offsets.h"
+#include "asm-values.h"
 
 #define VCPU_GPR(n)     (VCPU_GPRS + (n * 4))
 

[-- Attachment #4: Type: text/plain, Size: 308 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

[-- Attachment #5: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  parent reply	other threads:[~2007-12-18 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ABF87B0B6A38C0458E319AC973ED68AEA21127@zch01exm26.fsl.freescale.net>
     [not found] ` <1197387675.9632.17.camel@basalt>
     [not found]   ` <ABF87B0B6A38C0458E319AC973ED68AEA21458@zch01exm26.fsl.freescale.net>
     [not found]     ` <1197487161.26038.30.camel@basalt>
     [not found]       ` <ABF87B0B6A38C0458E319AC973ED68AEA21669@zch01exm26.fsl.freescale.net>
     [not found]         ` <1197590501.28334.10.camel@basalt>
     [not found]           ` <42DFA526FC41B1429CE7279EF83C6BDCAD021D@pdsmsx415.ccr.corp.intel.com>
     [not found]             ` <ABF87B0B6A38C0458E319AC973ED68AEA2183A@zch01exm26.fsl.freescale.net>
     [not found]               ` <1197945239.5026.12.camel@diesel>
2007-12-18  2:52                 ` [kvm-ppc-devel] Current e500 kvm guest kernel booting log Zhang, Xiantao
     [not found]                   ` <42DFA526FC41B1429CE7279EF83C6BDCB131B6-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-12-18 10:04                     ` Christian Ehrhardt [this message]
     [not found]                       ` <47679B11.8070604-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-12-19  8:50                         ` Zhang Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47679B11.8070604@linux.vnet.ibm.com \
    --to=ehrhardt-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=Wei.Zhang-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox