On Mon, Dec 16, 2013 at 02:12:37PM +0000, James Hogan wrote: > From: Sanjay Lal <sanjayl@xxxxxxxxxxx> > > Add APIs for converting between KVM guest KSEG0 addresses and guest > physical addresses. These will be used for translating addresses when > loading a kernel ELF in KVM mode. > > In KVM trap and emulate mode both the guest kernel and guest userspace > execute in useg: > Guest User address space: 0x00000000..0x3fffffff > Guest Kernel Unmapped: 0x40000000..0x5fffffff > Guest Kernel Mapped: 0x60000000..0x7fffffff > > Signed-off-by: Sanjay Lal <sanjayl@xxxxxxxxxxx> > Signed-off-by: James Hogan <james.hogan@xxxxxxxxxx> > Cc: Aurelien Jarno <aurelien@xxxxxxxxxxx> > --- > Changes in v2: > - Expand commit message > - Remove unnecessary include > --- > hw/mips/addr.c | 10 ++++++++++ > include/hw/mips/cpudevs.h | 4 ++++ > 2 files changed, 14 insertions(+) > > diff --git a/hw/mips/addr.c b/hw/mips/addr.c > index 99488f1..e62d6f4 100644 > --- a/hw/mips/addr.c > +++ b/hw/mips/addr.c > @@ -28,7 +28,17 @@ uint64_t cpu_mips_kseg0_to_phys(void *opaque, uint64_t addr) > return addr & 0x7fffffffll; > } > > +uint64_t cpu_mips_kvm_um_kseg0_to_phys(void *opaque, uint64_t addr) > +{ > + return addr & 0x3fffffffll; > +} > + > uint64_t cpu_mips_phys_to_kseg0(void *opaque, uint64_t addr) > { > return addr | ~0x7fffffffll; > } > + > +uint64_t cpu_mips_kvm_um_phys_to_kseg0(void *opaque, uint64_t addr) > +{ > + return addr | 0x40000000ll; > +} > diff --git a/include/hw/mips/cpudevs.h b/include/hw/mips/cpudevs.h > index 6bea24b..9e5af37 100644 > --- a/include/hw/mips/cpudevs.h > +++ b/include/hw/mips/cpudevs.h > @@ -6,6 +6,10 @@ > uint64_t cpu_mips_kseg0_to_phys(void *opaque, uint64_t addr); > uint64_t cpu_mips_phys_to_kseg0(void *opaque, uint64_t addr); > > +uint64_t cpu_mips_kvm_um_kseg0_to_phys(void *opaque, uint64_t addr); > +uint64_t cpu_mips_kvm_um_phys_to_kseg0(void *opaque, uint64_t addr); > + > + > /* mips_int.c */ > void cpu_mips_irq_init_cpu(CPUMIPSState *env); > Reviewed-by: Aurelien Jarno <aurelien@xxxxxxxxxxx> -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@xxxxxxxxxxx http://www.aurel32.net -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html