Re: [PATCH 1/3] KVM: VMX: Use proper types to access const arrays

2013-06-27 Thread Mathias Krause
On 27 June 2013 15:33, Paolo Bonzini pbonz...@redhat.com wrote: Il 26/06/2013 20:36, Mathias Krause ha scritto: Use a const pointer type instead of casting away the const qualifier from const arrays. Keep the pointer array on the stack, nonetheless. Making it static just increases the object

[PATCH 0/3] KVM: small type cleanups

2013-06-26 Thread Mathias Krause
Hi, this small series contains a few type and style cleanups. It has no impact on the generated code but removes a few small nits from the code. Please apply! Thanks, Mathias Krause (3): KVM: VMX: Use proper types to access const arrays KVM: VMX: Use size_t to store sizeof() values KVM

[PATCH 2/3] KVM: VMX: Use size_t to store sizeof() values

2013-06-26 Thread Mathias Krause
The type for storing values of the sizeof operator should be size_t. No semantical changes, only type correctness. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/vmx.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86

[PATCH 3/3] KVM: x86: Drop useless cast

2013-06-26 Thread Mathias Krause
Void pointers don't need no casting, drop it. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/x86.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index e8ba99c..472350c 100644 --- a/arch/x86/kvm/x86.c +++ b

[PATCH 1/3] KVM: VMX: Use proper types to access const arrays

2013-06-26 Thread Mathias Krause
Use a const pointer type instead of casting away the const qualifier from const arrays. Keep the pointer array on the stack, nonetheless. Making it static just increases the object size. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/vmx.c | 15 +++ 1 file

Re: [PATCH 2/8] KVM: x86 emulator: use aligned variants of SSE register ops

2012-09-04 Thread Mathias Krause
On Tue, Sep 4, 2012 at 2:13 PM, Avi Kivity a...@redhat.com wrote: On 09/04/2012 03:09 PM, Avi Kivity wrote: On 08/30/2012 02:30 AM, Mathias Krause wrote: As the the compiler ensures that the memory operand is always aligned to a 16 byte memory location, I'm not sure it does. Is V4SI aligned

[PATCH 0/8] KVM: minor cleanups and optimizations

2012-08-29 Thread Mathias Krause
in a cache line together with data that gets written to. The latter should speed up the emulation of SSE register moves as the aligned variant of MOVDQ has lower latencies and higher throughput than the unaligned one. Regards, Mathias Krause (8): KVM: x86: minor size optimization KVM: x86

[PATCH 1/8] KVM: x86: minor size optimization

2012-08-29 Thread Mathias Krause
Some fields can be constified and/or made static to reduce code and data size. Numbers for a 32 bit build: textdata bss dec hex filename before: 3351 80 03431 d67 cpuid.o after: 3391 0 03391 d3f cpuid.o Signed-off-by: Mathias

[PATCH 3/8] KVM: x86: mark opcode tables const

2012-08-29 Thread Mathias Krause
The opcode tables never change at runtime, therefor mark them const. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/emulate.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86

[PATCH 6/8] KVM: x86: more constification

2012-08-29 Thread Mathias Krause
Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/lapic.c |2 +- arch/x86/kvm/x86.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 18d149d..07ad628 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch

[PATCH 8/8] KVM: SVM: constify lookup tables

2012-08-29 Thread Mathias Krause
We never modify direct_access_msrs[], msrpm_ranges[], svm_exit_handlers[] or x86_intercept_map[] at runtime. Mark them r/o. Signed-off-by: Mathias Krause mini...@googlemail.com Cc: Joerg Roedel joerg.roe...@amd.com --- arch/x86/kvm/svm.c |8 1 file changed, 4 insertions(+), 4

[PATCH 7/8] KVM: VMX: constify lookup tables

2012-08-29 Thread Mathias Krause
We use vmcs_field_to_offset_table[], kvm_vmx_segment_fields[] and kvm_vmx_exit_handlers[] as lookup tables only -- make them r/o. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/vmx.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch

[PATCH 2/8] KVM: x86 emulator: use aligned variants of SSE register ops

2012-08-29 Thread Mathias Krause
As the the compiler ensures that the memory operand is always aligned to a 16 byte memory location, use the aligned variant of MOVDQ for read_sse_reg() and write_sse_reg(). Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/emulate.c | 64

[PATCH 4/8] KVM: x86: constify emulate_ops

2012-08-29 Thread Mathias Krause
We never change emulate_ops[] at runtime so it should be r/o. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/include/asm/kvm_emulate.h |2 +- arch/x86/kvm/emulate.c | 22 +++--- arch/x86/kvm/x86.c |2 +- 3 files changed, 13

[PATCH 5/8] KVM: x86: constify read_write_emulator_ops

2012-08-29 Thread Mathias Krause
We never change those, make them r/o. Signed-off-by: Mathias Krause mini...@googlemail.com --- arch/x86/kvm/x86.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f8b0148..79ac03c 100644 --- a/arch/x86/kvm/x86.c +++ b