public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [kvm-ppc-devel] Current e500 kvm guest kernel booting log
       [not found]               ` <1197945239.5026.12.camel@diesel>
@ 2007-12-18  2:52                 ` Zhang, Xiantao
       [not found]                   ` <42DFA526FC41B1429CE7279EF83C6BDCB131B6-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Xiantao @ 2007-12-18  2:52 UTC (permalink / raw)
  To: Hollis Blanchard, Zhang Wei
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hollis Blanchard wrote:
> On Fri, 2007-12-14 at 14:15 +0800, Zhang Wei wrote:
>>> Hollis Blanchard wrote:
>>>> On Thu, 2007-12-13 at 18:14 +0800, Zhang Wei wrote:
>>>>>> From: Hollis Blanchard [mailto:hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org]
>>>>>>>> We haven't touched the "hack" code recently, since we've been
>>>>>>>> refactoring the upstream tree. That's pretty much done
>>>>>>>> though, and right
>>>>>>>> now I'm just starting to integrate the old 440 support with the
>>>>>>>> new upstream code. That's not in a good state right now, but I
>>>>>>>> could clean it up and send it out if you're interested.
>>>>>>> 
>>>>>>> Yes! I think hack codes are only for verifying the idea. Our
>>>>>>> target is for upstream code. I hope I could join you!
>>>>>> 
>>>>>> Well, unfortunately at the moment I'm just fighting with
>>>>>> asm-offsets.h . :( Since I'm basically already on vacation, I'm
>>>>>> not sure I'll be able to get anything ready until January.
>>>>>> 
>>>>> 
>>>>> Do you mind send out the asm-offsets.h? Maybe I can take it base
>>>>> on the hack code.
>>>> 
>>>> Oh, the file is the same. The problem is how to have Kbuild
>>>> automatically generate it.
>>> 
>>> IA64 have the same issues , do you have good idea to handle it ? 
>>> Now, I let kvm makefile to call a extenal script to solve it. :)
>>> 
>> 
>> Do you mean if you change the struct kvm_vcpu of the kvm.h file, but
>> the asm-offsets.h file can not be re-generated by your current
>> Makefile? 
>> 
>> If it is, you can modify Makefile as below:
>> - $(obj)/kvm-offsets.s: $(src)/kvm-offsets.c
>> + $(obj)/kvm-offsets.s: $(src)/kvm-offsets.c FORCE
>> 
>> Or is there any other problems about asm-offsets.h in Makefile?
> 
> Yes, there is a larger problem: forget the dependencies; how do we
> generate asm-offsets.h in the first place? The Makefile hackery that
> I've posted before is not a good solution, and I'm looking for that
> good solution.

I have a solution, but don't know this is the best one.  According to
the rules, all c or asm files should depend on 
FORCE, so in your own Makefile, you can set FORCE: asm-offsets.h ,
asm-offsets.h should be compiled before any 
Source files:)


> IA64 needs to generate its own asm-offsets too, and so does lguest.
> That's why I've been looking at the "mkasm-values" patches recently
> (google it)...


-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-ppc-devel] Current e500 kvm guest kernel booting log
       [not found]                   ` <42DFA526FC41B1429CE7279EF83C6BDCB131B6-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-12-18 10:04                     ` Christian Ehrhardt
       [not found]                       ` <47679B11.8070604-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Ehrhardt @ 2007-12-18 10:04 UTC (permalink / raw)
  To: Zhang, Xiantao
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Hollis Blanchard,
	Zhang Wei

[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-ppc-devel] Current e500 kvm guest kernel booting log
       [not found]                       ` <47679B11.8070604-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
@ 2007-12-19  8:50                         ` Zhang Wei
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang Wei @ 2007-12-19  8:50 UTC (permalink / raw)
  To: Christian Ehrhardt, Zhang, Xiantao
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Hollis Blanchard

> 
> 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
> 

Good!
I'll continue my jobs. Thanks!

Cheers!
Wei.

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-19  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
     [not found]                       ` <47679B11.8070604-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-12-19  8:50                         ` Zhang Wei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox