[PATCH 3 of 3] [KVM POWERPC] PowerPC 440 KVM implementation
Hollis Blanchard
hollisb at us.ibm.com
Tue Apr 8 14:19:11 EST 2008
On Monday 07 April 2008 21:58:17 Arnd Bergmann wrote:
> On Monday 07 April 2008, Hollis Blanchard wrote:
> > --- a/include/asm-powerpc/kvm.h
> > +++ b/include/asm-powerpc/kvm.h
> > @@ -1,6 +1,55 @@
> > +/*
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License, version 2, as
> > + * published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
> > USA. + *
> > + * Copyright IBM Corp. 2007
> > + *
> > + * Authors: Hollis Blanchard <hollisb at us.ibm.com>
> > + */
> > +
> > #ifndef __LINUX_KVM_POWERPC_H
> > #define __LINUX_KVM_POWERPC_H
> >
> > -/* powerpc does not support KVM */
> > +#include <asm/types.h>
> >
> > -#endif
> > +struct kvm_regs {
> > + __u32 pc;
> > + __u32 cr;
> > + __u32 ctr;
> > + __u32 lr;
> > + __u32 xer;
> > + __u32 msr;
> > + __u32 srr0;
> > + __u32 srr1;
> > + __u32 pid;
> > +
> > + __u32 sprg0;
> > + __u32 sprg1;
> > + __u32 sprg2;
> > + __u32 sprg3;
> > + __u32 sprg4;
> > + __u32 sprg5;
> > + __u32 sprg6;
> > + __u32 sprg7;
> > +
> > + __u64 fpr[32];
> > + __u32 gpr[32];
> > +};
> > +
> > +struct kvm_sregs {
> > +};
> > +
> > +struct kvm_fpu {
> > +};
> > +
> > +#endif /* __LINUX_KVM_POWERPC_H */
>
> Since this defines part of the ABI, it would be nice if it's possible
> to have it in a platform independent way. Most of the registers here
> should probably become "unsigned long" instead of "__u32" so that
> the definition can be used for a potential 64 bit port.
If there is one thing I have learned in my various porting efforts, it's that
using a variable-sized type in an interface is just begging for trouble.
x86 uses fixed 64-bit variables here (even with x86-32), so that might be the
right solution here.
> Also, I noticed that you lump everything into kvm_regs, instead of
> using sregs for stuff like srr0 and kvm_fpu for the fprs. What is
> the reason for that?
The FPRs and SPRs are only really useful for two things here: debugger support
and migration. We don't really support either at the moment, so this part of
the user/kernel ABI will need change as we implement those.
I will move the FPR stuff into kvm_fpu though. (I think when I originally
wrote this, kvm_fpu was defined to be x86 stuff, but it obviously isn't
now...)
--
Hollis Blanchard
IBM Linux Technology Center
More information about the Linuxppc-dev
mailing list