Re: [Qemu-devel] [PATCH v5 10/12] hw/mips: malta: Add KVM support

2014-06-19 Thread Sanjay Lal
On Jun 19, 2014, at 9:27 AM, Aurelien Jarno aurel...@aurel32.net wrote: On Tue, Jun 17, 2014 at 11:10:35PM +0100, James Hogan wrote: In KVM mode the bootrom is loaded and executed from the last 1MB of DRAM. What is the reason for that? I am not opposed to that, but if it is really needed,

Re: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the MIPS-VZ extensions.

2013-06-10 Thread Sanjay Lal
power consumption on a modern 48-Way SMP SoC based system. What about running non pv UP systems? See above. I think this is what Sanjay Lal is doing. The KVM implementation from MIPS (currently in mainline) supports UP systems in trap and emulate mode. The patch set I posted earlier

Re: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the MIPS-VZ extensions.

2013-06-10 Thread Sanjay Lal
On Jun 7, 2013, at 4:03 PM, David Daney wrote: From: David Daney david.da...@cavium.com These patches take a somewhat different approach to MIPS virtualization via the MIPS-VZ extensions than the patches previously sent by Sanjay Lal. Several facts about the code: o Currently

Re: [PATCH 10/18] KVM/MIPS32-VZ: Add API for VZ-ASE Capability

2013-05-30 Thread Sanjay Lal
On May 30, 2013, at 10:07 AM, David Daney wrote: On 05/28/2013 09:34 AM, Paolo Bonzini wrote: Il 19/05/2013 07:47, Sanjay Lal ha scritto: - Add API to allow clients (QEMU etc.) to check whether the H/W supports the MIPS VZ-ASE. Why does this matter to userspace? Do the userspace have

Re: [PATCH 06/18] KVM/MIPS32-VZ: VZ-ASE related callbacks to handle guest exceptions that trap to the Root context.

2013-05-30 Thread Sanjay Lal
On May 28, 2013, at 8:04 AM, Paolo Bonzini wrote: Il 19/05/2013 07:47, Sanjay Lal ha scritto: +static int kvm_vz_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) +{ +struct mips_coproc *cop0 = vcpu-arch.cop0; + +/* some registers are not restored + * random

Re: [PATCH 06/18] KVM/MIPS32-VZ: VZ-ASE related callbacks to handle guest exceptions that trap to the Root context.

2013-05-30 Thread Sanjay Lal
On May 28, 2013, at 9:14 AM, Paolo Bonzini wrote: Il 19/05/2013 07:47, Sanjay Lal ha scritto: +#endif +local_irq_save(flags); +if (kvm_mips_handle_vz_root_tlb_fault(badvaddr, vcpu) 0) { +run-exit_reason = KVM_EXIT_INTERNAL_ERROR

Re: [PATCH 06/18] KVM/MIPS32-VZ: VZ-ASE related callbacks to handle guest exceptions that trap to the Root context.

2013-05-30 Thread Sanjay Lal
On May 30, 2013, at 1:11 PM, Paolo Bonzini wrote: Il 30/05/2013 20:35, Sanjay Lal ha scritto: +#endif +local_irq_save(flags); +if (kvm_mips_handle_vz_root_tlb_fault(badvaddr, vcpu) 0) { +run-exit_reason = KVM_EXIT_INTERNAL_ERROR

Re: [PATCH v4 0/6] mips/kvm: Fix ABI for compatibility with 64-bit guests.

2013-05-22 Thread Sanjay Lal
On May 22, 2013, at 5:54 AM, Gleb Natapov wrote: On Tue, May 21, 2013 at 01:54:49PM -0700, David Daney wrote: From: David Daney david.da...@cavium.com The initial patch set implementing MIPS KVM does not handle 64-bit guests or use of the FPU. This patch set corrects these ABI issues,

Re: [PATCH v4 5/6] mips/kvm: Fix ABI by moving manipulation of CP0 registers to KVM_{G,S}ET_ONE_REG

2013-05-22 Thread Sanjay Lal
On May 21, 2013, at 1:54 PM, David Daney wrote: From: David Daney david.da...@cavium.com Because not all 256 CP0 registers are ever implemented, we need a different method of manipulating them. Use the KVM_SET_ONE_REG/KVM_GET_ONE_REG mechanism. Code related to implementing

Re: [PATCH v5 0/6] mips/kvm: Fix ABI for compatibility with 64-bit guests.

2013-05-22 Thread Sanjay Lal
--- 4 files changed, 367 insertions(+), 102 deletions(-) -- 1.7.11.7 Acked-by: Sanjay Lal sanj...@kymasys.com Regards Sanjay -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: [PATCH 2/4] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-21 Thread Sanjay Lal
On May 21, 2013, at 1:00 AM, Gleb Natapov wrote: On Sun, May 19, 2013 at 10:36:32AM -0400, Sanjay Lal wrote: On May 19, 2013, at 8:52 AM, Gleb Natapov wrote: On Sat, May 18, 2013 at 06:54:24AM -0700, Sanjay Lal wrote: - As suggested by Gleb, wrap calls to gfn_to_pfn

Re: [PATCH 00/18] KVM/MIPS32: Support for the new Virtualization ASE (VZ-ASE)

2013-05-20 Thread Sanjay Lal
On May 20, 2013, at 8:50 AM, David Daney wrote: On 05/18/2013 10:47 PM, Sanjay Lal wrote: The following patch set adds support for the recently announced virtualization extensions for the MIPS32 architecture and allows running unmodified kernels in Guest Mode. For more info please

Re: [PATCH 00/18] KVM/MIPS32: Support for the new Virtualization ASE (VZ-ASE)

2013-05-20 Thread Sanjay Lal
On May 20, 2013, at 10:29 AM, David Daney wrote: On 05/20/2013 09:58 AM, Sanjay Lal wrote: On May 20, 2013, at 8:50 AM, David Daney wrote: On 05/18/2013 10:47 PM, Sanjay Lal wrote: The following patch set adds support for the recently announced virtualization extensions for the MIPS32

Re: [PATCH 2/4] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-19 Thread Sanjay Lal
On May 19, 2013, at 8:52 AM, Gleb Natapov wrote: On Sat, May 18, 2013 at 06:54:24AM -0700, Sanjay Lal wrote: - As suggested by Gleb, wrap calls to gfn_to_pfn() with srcu_read_lock/unlock(). Memory slots should be acccessed from a SRCU read section. - kvm_mips_map_page() now returns

[PATCH v3 0/4] KVM/MIPS32: Fixes for Linux 3.10

2013-05-18 Thread Sanjay Lal
KVM/MIPS ABI defined by David Daney @ Cavium. -- Sanjay Lal (4): KVM/MIPS32: Move include/asm/kvm.h = include/uapi/asm/kvm.h since it is a user visible API. KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock() KVM/MIPS32: Export min_low_pfn. KVM/MIPS32: Bring in patch

[PATCH 1/4] KVM/MIPS32: Move include/asm/kvm.h = include/uapi/asm/kvm.h since it is a user visible API.

2013-05-18 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm.h | 55 arch/mips/include/uapi/asm/kvm.h | 55 2 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 arch/mips

[PATCH 2/4] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-18 Thread Sanjay Lal
-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_tlb.c | 36 +++- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c index 89511a9..ab2e9b0 100644 --- a/arch/mips/kvm/kvm_tlb.c +++ b/arch/mips/kvm

[PATCH 3/4] KVM/MIPS32: Export min_low_pfn.

2013-05-18 Thread Sanjay Lal
The KVM module uses the standard MIPS cache management routines, which use min_low_pfn. This creates and indirect dependency, requiring min_low_pfn to be exported. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/mips_ksyms.c | 6 ++ arch/mips/kvm/kvm_tlb.c | 1 - 2

[PATCH 4/4] KVM/MIPS32: Bring in patch from David Daney with new 64 bit compatible ABI.

2013-05-18 Thread Sanjay Lal
be hidden behind function pointers as appropriate. Signed-off-by: David Daney david.da...@cavium.com Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm_host.h | 4 - arch/mips/include/uapi/asm/kvm.h | 106 ++--- arch/mips/kvm/kvm_mips.c | 102

[PATCH 00/18] KVM/MIPS32: Support for the new Virtualization ASE (VZ-ASE)

2013-05-18 Thread Sanjay Lal
in Guest mode. This greatly reduces VM exits. (2) Trap and Emulate: Runs minimally modified guest kernels in UM and uses binary patching to minimize the number of traps and improve performance. This is used for processors that do not support the VZ-ASE. -- Sanjay Lal (18): Revert MIPS

[PATCH 02/18] Revert MIPS: Allow ASID size to be determined at boot time.

2013-05-18 Thread Sanjay Lal
This reverts commit d532f3d26716a39dfd4b88d687bd344fbe77e390. Conflicts: arch/mips/mm/tlbex.c Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/mmu_context.h | 95 ++--- arch/mips/kernel/genex.S| 2 +- arch/mips/kernel

[PATCH 01/18] Revert MIPS: microMIPS: Support dynamic ASID sizing.

2013-05-18 Thread Sanjay Lal
This reverts commit f6b06d9361a008afb93b97fb3683a6e92d69d0f4. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/mm/tlbex.c | 34 ++ 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 4d46d37

[PATCH 05/18] KVM/MIPS32-VZ: VZ-ASE assembler wrapper functions to set GuestIDs

2013-05-18 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_vz_locore.S | 74 +++ 1 file changed, 74 insertions(+) create mode 100644 arch/mips/kvm/kvm_vz_locore.S diff --git a/arch/mips/kvm/kvm_vz_locore.S b/arch/mips/kvm/kvm_vz_locore.S new

[PATCH 03/18] KVM/MIPS32: Export min_low_pfn.

2013-05-18 Thread Sanjay Lal
The KVM module uses the standard MIPS cache management routines, which use min_low_pfn. This creates and indirect dependency, requiring min_low_pfn to be exported. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/mips_ksyms.c | 6 ++ 1 file changed, 6 insertions(+) diff

[PATCH 04/18] KVM/MIPS32-VZ: MIPS VZ-ASE related register defines and helper macros.

2013-05-18 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/mipsvzregs.h | 494 + 1 file changed, 494 insertions(+) create mode 100644 arch/mips/include/asm/mipsvzregs.h diff --git a/arch/mips/include/asm/mipsvzregs.h b/arch/mips/include/asm

[PATCH 07/18] KVM/MIPS32: VZ-ASE related CPU feature flags and options.

2013-05-18 Thread Sanjay Lal
- GuestIDs and Virtual IRQs are optional - New TLBINV instruction is also optional Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/cpu-features.h | 36 arch/mips/include/asm/cpu-info.h | 21 + arch/mips/include

[PATCH 13/18] KVM/MIPS32-VZ: Top level handler for Guest faults

2013-05-18 Thread Sanjay Lal
- Add VZ specific VM Exit reasons to the traces. - Add top level handler for Guest Exit exceptions. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_mips.c | 73 +++- 1 file changed, 53 insertions(+), 20 deletions(-) diff --git

[PATCH 06/18] KVM/MIPS32-VZ: VZ-ASE related callbacks to handle guest exceptions that trap to the Root context.

2013-05-18 Thread Sanjay Lal
The VZ-ASE provices the Guest with its own COP0 context, so the types of exceptions that will trap to the root a lot fewer than in the trap and emulate case. - Root level TLB miss handlers that map GPAs to RPAs. - Guest Exits Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm

[PATCH 08/18] KVM/MIPS32-VZ: Entry point for trampolining to the guest and trap handlers.

2013-05-18 Thread Sanjay Lal
- Add support for the MIPS VZ-ASE - Whitespace fixes Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_locore.S | 1088 +++- 1 file changed, 573 insertions(+), 515 deletions(-) diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm

[PATCH 17/18] KVM/MIPS32: Revert to older method for accessing ASID parameters

2013-05-18 Thread Sanjay Lal
- Now that commit d532f3d26 has been reverted in the MIPS tree, revert back to the older method of using the ASID_MASK. - Trivial cleanup: s/unsigned long/long Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_mips_dyntrans.c | 24 ++-- arch/mips/kvm/kvm_mips_emul.c

[PATCH 09/18] KVM/MIPS32-VZ: Add support for CONFIG_KVM_MIPS_VZ option

2013-05-18 Thread Sanjay Lal
- Add config option for KVM/MIPS with VZ support. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/Kconfig | 14 +- arch/mips/kvm/Makefile | 14 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm

[PATCH 10/18] KVM/MIPS32-VZ: Add API for VZ-ASE Capability

2013-05-18 Thread Sanjay Lal
- Add API to allow clients (QEMU etc.) to check whether the H/W supports the MIPS VZ-ASE. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index a5c86fc..5889e976

[PATCH 11/18] KVM/MIPS32-VZ: VZ: Handle Guest TLB faults that are handled in Root context

2013-05-18 Thread Sanjay Lal
- Guest physical addresses need to be mapped by the Root TLB. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_tlb.c | 444 +++- 1 file changed, 359 insertions(+), 85 deletions(-) diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm

[PATCH 12/18] KVM/MIPS32-VZ: VM Exit Stats, add VZ exit reasons.

2013-05-18 Thread Sanjay Lal
- Additional VZ related exit reasons, used in the trace logs. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_mips_stats.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips_stats.c b/arch/mips/kvm/kvm_mips_stats.c

[PATCH 14/18] KVM/MIPS32-VZ: Guest exception batching support.

2013-05-18 Thread Sanjay Lal
- In Trap Emulate the hypervisor maintains exception priority in order to comply with the priorities defined by the architecture. - In VZ mode, we just set all the pending exception bits, and let the processor deliver them to the guest in the expected priority order. Signed-off-by: Sanjay

[PATCH 15/18] KVM/MIPS32: Add dummy trap handler to catch unexpected exceptions and dump out useful info

2013-05-18 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_trap_emul.c | 68 --- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/arch/mips/kvm/kvm_trap_emul.c b/arch/mips/kvm/kvm_trap_emul.c index 466aeef..19b32a1 100644 --- a/arch

[PATCH 16/18] KVM/MIPS32-VZ: Add VZ-ASE support to KVM/MIPS data structures.

2013-05-18 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm_host.h | 244 ++- 1 file changed, 191 insertions(+), 53 deletions(-) diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index e68781e..c92e297 100644

[PATCH 18/18] KVM/MIPS32-VZ: Dump out additional info about VZ features as part of /proc/cpuinfo

2013-05-18 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/proc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index a3e4614..308e042 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -99,6 +99,17

[PATCH] KVM/MIPS32: Export min_low_pfn.

2013-05-17 Thread Sanjay Lal
The KVM module uses the standard MIPS cache management routines, which use min_low_pfn. This creates and indirect dependency, requiring min_low_pfn to be exported. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/mips_ksyms.c | 6 ++ 1 file changed, 6 insertions(+) diff

[PATCH v2 0/3] KVM/MIPS32: Fixes for Linux 3.10

2013-05-17 Thread Sanjay Lal
The following patch set fixes a few issues with KVM/MIPS32 in Linux 3.10. -- Sanjay Lal (3): KVM/MIPS32: Move include/asm/kvm.h = include/uapi/asm/kvm.h since it is a user visible API. KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock() KVM/MIPS32: Fix up KVM breakage

[PATCH 1/3] KVM/MIPS32: Move include/asm/kvm.h = include/uapi/asm/kvm.h since it is a user visible API.

2013-05-17 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm.h | 55 arch/mips/include/uapi/asm/kvm.h | 55 2 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 arch/mips

[PATCH 2/3] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-17 Thread Sanjay Lal
-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_tlb.c | 36 +++- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c index 89511a9..ab2e9b0 100644 --- a/arch/mips/kvm/kvm_tlb.c +++ b/arch/mips/kvm

[PATCH 3/3] KVM/MIPS32: Fix up KVM breakage caused by d532f3d26716a39dfd4b88d687bd344fbe77e390 which allows ASID mask and increment to be determined @ runtime.

2013-05-17 Thread Sanjay Lal
on the MIPS mailing list and until a solution is found, For now define KVM_ASID_MASK as 0xFF to fix this issue up for Linux 3.10. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm_host.h | 5 + arch/mips/kvm/kvm_mips_emul.c| 22 +++--- arch/mips/kvm

Re: [PATCH 2/2] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-15 Thread Sanjay Lal
On May 14, 2013, at 2:27 AM, Gleb Natapov wrote: +EXPORT_SYMBOL(min_low_pfn); /* defined by bootmem.c, but not exported by generic code */ + What you need this for? It is not used anywhere in this patch and by mips/kvm code in general. I did some digging around myself, since the

Re: [PATCH 2/2] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-15 Thread Sanjay Lal
On May 15, 2013, at 10:30 AM, Gleb Natapov wrote: On Wed, May 15, 2013 at 09:54:24AM -0700, David Daney wrote: On 05/15/2013 08:54 AM, Sanjay Lal wrote: On May 14, 2013, at 2:27 AM, Gleb Natapov wrote: +EXPORT_SYMBOL(min_low_pfn); /* defined by bootmem.c, but not exported

[PATCH 2/2] KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock()

2013-05-13 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_tlb.c | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c index 89511a9..218075f 100644 --- a/arch/mips/kvm/kvm_tlb.c

[PATCH 0/2] KVM/MIPS32: Fixes for Linux 3.10

2013-05-13 Thread Sanjay Lal
for a particular gfn. - Follow the latest convention and move the kvm.h API file under uapi/... -- Sanjay Lal (2): KVM/MIPS32: Move include/asm/kvm.h = include/uapi/asm/kvm.h since it is a user visible API. KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock() arch/mips/include/asm/kvm.h

[PATCH 1/2] KVM/MIPS32: Move include/asm/kvm.h = include/uapi/asm/kvm.h since it is a user visible API.

2013-05-13 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm.h | 55 arch/mips/include/uapi/asm/kvm.h | 55 2 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 arch/mips

Re: [PATCH 0/2] KVM/MIPS32: Fixes for Linux 3.10

2013-05-13 Thread Sanjay Lal
On May 13, 2013, at 2:07 PM, David Daney wrote: Sanjay, Have you looked at: http://www.linux-mips.org/archives/linux-mips/2013-05/msg00049.html We should start working toward unifying the KVM interface. David Daney. Hey David, I am currently in the process of integrating and

Re: [PATCH] mips/kvm: Fix ABI for compatibility with 64-bit guests.

2013-05-06 Thread Sanjay Lal
On May 6, 2013, at 3:39 PM, David Daney wrote: /* for KVM_GET_REGS and KVM_SET_REGS */ +/* + * If Config[AT] is zero (32-bit CPU), the register contents are + * stored in the lower 32-bits of the struct kvm_regs fields and sign + * extended to 64-bits. + */ struct kvm_regs { -

Re: [PATCH] KVM/MIPS32: Sync up with latest KVM API changes

2013-03-18 Thread Sanjay Lal
On Mar 18, 2013, at 12:04 PM, Jonas Gorski wrote: On 15 March 2013 03:09, Sanjay Lal sanj...@kymasys.com wrote: - Rename KVM_MEMORY_SLOTS - KVM_USER_MEM_SLOTS - Fix kvm_arch_{prepare,commit}_memory_region() - Also remove kvm_arch_set_memory_region which was unused. I just stumbled upon

[PATCH] KVM/MIPS32: define KVM_USER_MEM_SLOTS

2013-03-14 Thread Sanjay Lal
) Reported-by: Andrew Morton a...@linux-foundation.org Cc: Alex Williamson alex.william...@redhat.com Cc: Marcelo Tosatti mtosa...@redhat.com Cc: Gleb Natapov g...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Signed-off-by: Andrew Morton a...@linux-foundation.org Signed-off-by: Sanjay Lal sanj

[PATCH] KVM/MIPS32: Sync up with latest KVM API changes

2013-03-14 Thread Sanjay Lal
- Rename KVM_MEMORY_SLOTS - KVM_USER_MEM_SLOTS - Fix kvm_arch_{prepare,commit}_memory_region() - Also remove kvm_arch_set_memory_region which was unused. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm_host.h | 2 +- arch/mips/kvm/kvm_mips.c | 12

Re: [Qemu-devel] [PATCH 11/12] KVM/MIPS: MIPS specfic APIs for KVM.

2013-03-06 Thread Sanjay Lal
On Mar 2, 2013, at 7:45 AM, Peter Maydell wrote: On 2 March 2013 15:18, Sanjay Lal sanj...@kymasys.com wrote: +/* If we have an interrupt but the guest is not ready to receive an + * interrupt, request an interrupt window exit. This will + * cause a return to userspace as soon

Re: [Qemu-devel] [PATCH 01/12] KVM/MIPS: Bootcode for MIPS SMP configurations with a GCMP

2013-03-06 Thread Sanjay Lal
On Mar 2, 2013, at 12:03 PM, Peter Maydell wrote: On 2 March 2013 15:18, Sanjay Lal sanj...@kymasys.com wrote: --- /dev/null +++ b/hw/mips_cps_bootcode.h @@ -0,0 +1,310 @@ +/* Sample boot code for 1004K CPS (Coherent Processing System.) + * Not Generic for all Release 2 or higher MIPS32

Re: [Qemu-devel] [PATCH 03/12] KVM/MIPS: Add save/restore state APIs for saving/restoring KVM guests.

2013-03-06 Thread Sanjay Lal
On Mar 2, 2013, at 7:27 AM, Peter Maydell wrote: 2013/3/2 Sanjay Lal sanj...@kymasys.com: +static void gt64xxx_save(QEMUFile *f, void *opaque) +{ +GT64120State *s = opaque; + +/* CPU Configuration */ +qemu_put_be32s(f, s-regs[GT_CPU]); +qemu_put_be32s(f, s-regs[GT_MULTI

[Qemu-devel][PATCH 01/12] KVM/MIPS: Bootcode for MIPS SMP configurations with a GCMP

2013-03-02 Thread Sanjay Lal
--- hw/mips_cps_bootcode.h | 310 + 1 file changed, 310 insertions(+) create mode 100644 hw/mips_cps_bootcode.h diff --git a/hw/mips_cps_bootcode.h b/hw/mips_cps_bootcode.h new file mode 100644 index 000..40289a4 --- /dev/null +++

[Qemu-devel][PATCH 01/12] MIPS: Bootcode for MIPS SMP configurations with a GCMP

2013-03-02 Thread Sanjay Lal
--- hw/mips_cps_bootcode.h | 310 + 1 file changed, 310 insertions(+) create mode 100644 hw/mips_cps_bootcode.h diff --git a/hw/mips_cps_bootcode.h b/hw/mips_cps_bootcode.h new file mode 100644 index 000..40289a4 --- /dev/null +++

[Qemu-devel][PATCH 02/12] KVM/MIPS: GIC emulation for SMP guests.

2013-03-02 Thread Sanjay Lal
. + * + * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. + * Authors: Sanjay Lal sanj...@kymasys.com +*/ + +#include hw.h +#include qemu/bitmap.h +#include exec/memory.h +#include sysemu/sysemu.h + +#ifdef CONFIG_KVM +#include sysemu/kvm.h +#include kvm_mips.h +#endif + +#include

[Qemu-devel][PATCH 05/12] KVM/MIPS: In KVM mode, inject IRQ2 (I/O) interupts via ioctls(). COP0 emulation is in-kernel

2013-03-02 Thread Sanjay Lal
--- hw/mips_int.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/mips_int.c b/hw/mips_int.c index 6423fd0..6c655af 100644 --- a/hw/mips_int.c +++ b/hw/mips_int.c @@ -23,6 +23,8 @@ #include hw.h #include mips_cpudevs.h #include cpu.h +#include sysemu/kvm.h +#include

[Qemu-devel][PATCH 03/12] KVM/MIPS: Add save/restore state APIs for saving/restoring KVM guests.

2013-03-02 Thread Sanjay Lal
--- hw/gt64xxx.c | 317 +++ 1 file changed, 317 insertions(+) diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c index 977a2c5..3583ca8 100644 --- a/hw/gt64xxx.c +++ b/hw/gt64xxx.c @@ -31,6 +31,8 @@ //#define DEBUG +#define GT64XXX_VM_VERSION

[Qemu-devel][PATCH 04/12] KVM/MIPS: Do not start the periodic timer in KVM mode. Compare/Count timer interrupts are handled in-kernel.

2013-03-02 Thread Sanjay Lal
--- hw/mips_timer.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/mips_timer.c b/hw/mips_timer.c index 83c400c..0c86a3b 100644 --- a/hw/mips_timer.c +++ b/hw/mips_timer.c @@ -19,11 +19,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

[Qemu-devel][PATCH 06/12] KVM/MIPS: Define APIs to convert Guest KSEG0 - Guest Physical addresses.

2013-03-02 Thread Sanjay Lal
In trap and emulate mode both the guest kernel and guest userspace execute in UM: Guest User address space: 0x - 0x4000 Guest Kernel Unmapped: 0x4000 - 0x6000 Guest Kernel Mapped:0x6000 - 0x8000 --- hw/mips_addr.c| 14 ++

[Qemu-devel][PATCH 12/12] KVM/MIPS: General KVM support and support for SMP Guests

2013-03-02 Thread Sanjay Lal
- In KVM mode the bootrom is loaded and executed from the last 1MB of DRAM. - Use the CPS bootrom from MIPS in KVM mode. This allows bootstrapping of multiple cores. - Add suport for MIPS GIC emulation for SMP Guests. --- hw/mips_malta.c | 192

[Qemu-devel][PATCH 07/12] KVM/MIPS: QEMU - Kernel interface for KVM/MIPS

2013-03-02 Thread Sanjay Lal
of this archive + * for more details. + * + * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. + * Authors: Sanjay Lal sanj...@kymasys.com + */ + +#ifndef __LINUX_KVM_MIPS_H +#define __LINUX_KVM_MIPS_H + +#include linux/types.h + +#define __KVM_MIPS + +#define N_MIPS_COPROC_REGS 32

[Qemu-devel][PATCH 08/12] KVM/MIPS: Enable KVM/MIPS for MIPS targets. Add MIPS GIC code to the build.

2013-03-02 Thread Sanjay Lal
--- configure | 17 +++-- hw/mips/Makefile.objs | 2 +- target-mips/Makefile.objs | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure b/configure index bf5970f..5447661 100755 --- a/configure +++ b/configure @@ -1370,7 +1370,12 @@

[Qemu-devel][PATCH 09/12] KVM/MIPS: set sigmask length to 16 for MIPS targets.

2013-03-02 Thread Sanjay Lal
--- kvm-all.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index 4decfdc..2ac9e88 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1966,7 +1966,12 @@ int kvm_set_signal_mask(CPUArchState *env, const sigset_t *sigset) sigmask = g_malloc(sizeof(*sigmask) +

Re: [PATCH v2 11/18] KVM/MIPS32: Routines to handle specific traps/exceptions while executing the guest.

2013-02-18 Thread Sanjay Lal
On Feb 18, 2013, at 1:44 AM, Gleb Natapov wrote: On Fri, Feb 15, 2013 at 11:10:46AM -0500, Sanjay Lal wrote: On Feb 6, 2013, at 8:20 AM, Gleb Natapov wrote: On Wed, Nov 21, 2012 at 06:34:09PM -0800, Sanjay Lal wrote: +static gpa_t kvm_trap_emul_gva_to_gpa_cb(gva_t gva) +{ + gpa_t gpa

Re: [PATCH v2 07/18] KVM/MIPS32: MMU/TLB operations for the Guest.

2013-02-16 Thread Sanjay Lal
On Feb 15, 2013, at 1:41 PM, Gleb Natapov wrote: On Fri, Feb 15, 2013 at 01:19:29PM -0500, Sanjay Lal wrote: On Feb 6, 2013, at 7:08 AM, Gleb Natapov wrote: +static void kvm_mips_map_page(struct kvm *kvm, gfn_t gfn) +{ + pfn_t pfn; + + if (kvm-arch.guest_pmap[gfn

Re: [PATCH v2 11/18] KVM/MIPS32: Routines to handle specific traps/exceptions while executing the guest.

2013-02-15 Thread Sanjay Lal
On Feb 6, 2013, at 8:20 AM, Gleb Natapov wrote: On Wed, Nov 21, 2012 at 06:34:09PM -0800, Sanjay Lal wrote: +static gpa_t kvm_trap_emul_gva_to_gpa_cb(gva_t gva) +{ +gpa_t gpa; +uint32_t kseg = KSEGX(gva); + +if ((kseg == CKSEG0) || (kseg == CKSEG1)) You seems to be using

Re: [PATCH v2 07/18] KVM/MIPS32: MMU/TLB operations for the Guest.

2013-02-15 Thread Sanjay Lal
On Feb 6, 2013, at 7:08 AM, Gleb Natapov wrote: +static void kvm_mips_map_page(struct kvm *kvm, gfn_t gfn) +{ +pfn_t pfn; + +if (kvm-arch.guest_pmap[gfn] != KVM_INVALID_PAGE) +return; + +pfn =kvm_mips_gfn_to_pfn(kvm, gfn); This call should be in srcu read

Re: [PATCH v2 09/18] KVM/MIPS32: COP0 accesses profiling.

2013-02-15 Thread Sanjay Lal
On Feb 6, 2013, at 8:17 AM, Gleb Natapov wrote: On Wed, Nov 21, 2012 at 06:34:07PM -0800, Sanjay Lal wrote: +int kvm_mips_dump_stats(struct kvm_vcpu *vcpu) +{ +int i, j __unused; +#ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS +printk(\nKVM VCPU[%d] COP0 Access Profile:\n, vcpu

Re: [PATCH v2 00/18] KVM for MIPS32 Processors

2013-01-24 Thread Sanjay Lal
On Jan 24, 2013, at 10:05 AM, Ralf Baechle wrote: On Wed, Nov 21, 2012 at 06:33:58PM -0800, Sanjay Lal wrote: I've queued the patch set. I've done a few stylistic changes such as getting rid of all use of ulong and u_long data types in favor of unsigned long. I also ran

Re: [PATCH v2 00/18] KVM for MIPS32 Processors

2012-11-27 Thread Sanjay Lal
On Nov 26, 2012, at 1:53 PM, David Daney wrote: I have several general questions about this patch... On 11/21/2012 06:33 PM, Sanjay Lal wrote: The following patchset implements KVM support for MIPS32R2 processors, using Trap Emulate, with basic runtime binary translation to improve

[PATCH v2 02/18] KVM/MIPS32: Arch specific KVM data structures.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/kvm.h | 55 arch/mips/include/asm/kvm_host.h | 669 +++ 2 files changed, 724 insertions(+) create mode 100644 arch/mips/include/asm/kvm.h create mode 100644 arch/mips/include

[PATCH v2 00/18] KVM for MIPS32 Processors

2012-11-22 Thread Sanjay Lal
. As a workaround, make sure that CONFIG_SMP is disabled for Guest kernels. This will be fixed in a future release. (4) FPU support: Currently KVM/MIPS emulates a 24K CPU without a FPU. This will be fixed in a future release -- Sanjay Lal (18): KVM/MIPS32: Infrastructure/build files. KVM

[PATCH v2 18/18] KVM/MIPS32: Binary patching of select privileged instructions.

2012-11-22 Thread Sanjay Lal
] and this is mapped into the guest kernel address space @ VA 0x0. mfc0/mtc0 operations are transformed to load/stores. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_mips_comm.h | 23 ++ arch/mips/kvm/kvm_mips_commpage.c | 37 ++ arch/mips/kvm/kvm_mips_dyntrans.c | 149

[PATCH v2 14/18] MIPS: ASM offsets for VCPU arch specific fields.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/asm-offsets.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c index 0c4bce4..66895de 100644 --- a/arch/mips/kernel

[PATCH v2 12/18] MIPS: Export routines needed by the KVM module.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/mm/c-r4k.c | 6 -- arch/mips/mm/cache.c | 1 + arch/mips/mm/tlb-r4k.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 2b61462..1923063 100644 --- a/arch

[PATCH v2 07/18] KVM/MIPS32: MMU/TLB operations for the Guest.

2012-11-22 Thread Sanjay Lal
to the guest If entry does exist in the Guest TLB and is VALID Inject the TLB entry into the Shadow TLB Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_tlb.c | 932 1 file changed, 932 insertions(+) create

[PATCH v2 08/18] KVM/MIPS32: Release notes and KVM module Makefile

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/00README.txt | 31 +++ arch/mips/kvm/Makefile | 17 + 2 files changed, 48 insertions(+) create mode 100644 arch/mips/kvm/00README.txt create mode 100644 arch/mips/kvm/Makefile diff

[PATCH v2 16/18] MIPS: Export symbols used by KVM/MIPS module

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/smp.c | 1 + mm/bootmem.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 9005bf9..60ea489 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c

[PATCH v2 10/18] KVM/MIPS32: Guest interrupt delivery.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_mips_int.c | 243 +++ arch/mips/kvm/kvm_mips_int.h | 49 + 2 files changed, 292 insertions(+) create mode 100644 arch/mips/kvm/kvm_mips_int.c create mode 100644 arch/mips/kvm

[PATCH v2 11/18] KVM/MIPS32: Routines to handle specific traps/exceptions while executing the guest.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_cb.c| 14 ++ arch/mips/kvm/kvm_trap_emul.c | 482 ++ 2 files changed, 496 insertions(+) create mode 100644 arch/mips/kvm/kvm_cb.c create mode 100644 arch/mips/kvm

[PATCH v2 09/18] KVM/MIPS32: COP0 accesses profiling.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_mips_stats.c | 81 ++ 1 file changed, 81 insertions(+) create mode 100644 arch/mips/kvm/kvm_mips_stats.c diff --git a/arch/mips/kvm/kvm_mips_stats.c b/arch/mips/kvm/kvm_mips_stats.c new

[PATCH v2 17/18] KVM/MIPS32: Do not call vcpu_load when injecting interrupts.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index be70035..ecd96ce 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1880,7 +1880,7 @@ static long

[PATCH v2 15/18] MIPS: Pull in MIPS fix: fix endless loop when processing signals for kernel tasks.

2012-11-22 Thread Sanjay Lal
This bug is discussed in: http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/00719.html Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kernel/entry.S | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S

[PATCH v2 06/18] KVM/MIPS32: Privileged instruction/target branch emulation.

2012-11-22 Thread Sanjay Lal
- The Guest kernel is run in UM and privileged instructions cause a trap. - If the instruction causing the trap is in a branch delay slot, the branch needs to be emulated to figure out the PC @ which the guest will resume execution. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips

[PATCH v2 04/18] KVM/MIPS32: MIPS arch specific APIs for KVM

2012-11-22 Thread Sanjay Lal
- Implements the arch specific APIs for KVM, some are stubs for MIPS - kvm_mips_handle_exit(): Main 'C' distpatch routine for handling exceptions while in Guest mode. - Also implements in-kernel timer interrupt support for the guest. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips

[PATCH v2 05/18] KVM/MIPS32: KVM Guest kernel support.

2012-11-22 Thread Sanjay Lal
-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/mach-generic/spaces.h | 9 - arch/mips/include/asm/processor.h | 5 + arch/mips/include/asm/uaccess.h | 11 ++- arch/mips/kernel/binfmt_elfo32.c| 4 arch/mips/kernel/cevt

[PATCH v2 13/18] MIPS: If KVM is enabled then use the KVM specific routine to flush the TLBs on a ASID wrap.

2012-11-22 Thread Sanjay Lal
Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/mmu_context.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index 9b02cfb..10a3fd2 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b

[PATCH v2 03/18] KVM/MIPS32: Entry point for trampolining to the guest and trap handlers.

2012-11-22 Thread Sanjay Lal
while in guest context. Save guest context, restore some kernel context and jump to main 'C' handler: kvm_mips_handle_exit() Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_locore.S | 651 + 1 file changed, 651 insertions

Re: [PATCH 04/20] KVM/MIPS32: MIPS arch specific APIs for KVM

2012-11-14 Thread Sanjay Lal
On Nov 1, 2012, at 11:18 AM, Avi Kivity wrote: + +/* Set the appropriate status bits based on host CPU features, before we hit the scheduler */ +kvm_mips_set_c0_status(); + +local_irq_enable(); Ah, so you handle exits with interrupts enabled. But that's not how we usually

Re: [PATCH 07/20] KVM/MIPS32: Dynamic binary translation of select privileged instructions.

2012-11-02 Thread Sanjay Lal
On Nov 1, 2012, at 11:24 AM, Avi Kivity wrote: On 10/31/2012 05:19 PM, Sanjay Lal wrote: Currently, the following instructions are translated: - CACHE (indexed) - CACHE (va based): translated to a synci, overkill on D-CACHE operations, but still much faster than a trap. - mfc0/mtc0

Re: [PATCH 07/20] KVM/MIPS32: Dynamic binary translation of select privileged instructions.

2012-11-02 Thread Sanjay Lal
On Nov 1, 2012, at 11:24 AM, Avi Kivity wrote: On 10/31/2012 05:19 PM, Sanjay Lal wrote: Currently, the following instructions are translated: - CACHE (indexed) - CACHE (va based): translated to a synci, overkill on D-CACHE operations, but still much faster than a trap. - mfc0/mtc0

Re: [PATCH 02/20] KVM/MIPS32: Arch specific KVM data structures.

2012-11-02 Thread Sanjay Lal
On Nov 1, 2012, at 11:04 AM, Avi Kivity wrote: On 10/31/2012 05:18 PM, Sanjay Lal wrote: + +/* Special address that contains the comm page, used for reducing # of traps */ +#define KVM_GUEST_COMMPAGE_ADDR 0x0 + +struct kvm_arch +{ +/* Guest GVA-HPA page table */ +ulong

Re: [PATCH 00/20] KVM for MIPS32 Processors

2012-11-02 Thread Sanjay Lal
On Nov 1, 2012, at 10:51 AM, Avi Kivity wrote: On 10/31/2012 05:17 PM, Sanjay Lal wrote: The following patchset implements KVM support for MIPS32R2 processors, using Trap Emulate, with basic runtime binary translation to improve performance. The goal has been to keep the Guest kernel

[PATCH 04/20] KVM/MIPS32: MIPS arch specific APIs for KVM

2012-10-31 Thread Sanjay Lal
- Implements the arch specific APIs for KVM, some are stubs for MIPS - kvm_mips_handle_exit(): Main 'C' distpatch routine for handling exceptions while in Guest mode. - Also implements in-kernel timer interrupt support for the guest. Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips

[PATCH 05/20] KVM/MIPS32: KVM Guest kernel support.

2012-10-31 Thread Sanjay Lal
-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/include/asm/mach-generic/spaces.h | 9 - arch/mips/include/asm/processor.h | 5 + arch/mips/include/asm/uaccess.h | 15 --- arch/mips/kernel/binfmt_elfo32.c| 6 +- arch/mips/kernel

[PATCH 08/20] KVM/MIPS32: MMU/TLB operations for the Guest.

2012-10-31 Thread Sanjay Lal
to the guest If entry does exist in the Guest TLB and is VALID Inject the TLB entry into the Shadow TLB Signed-off-by: Sanjay Lal sanj...@kymasys.com --- arch/mips/kvm/kvm_tlb.c | 889 1 file changed, 889 insertions(+) create

  1   2   >