summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'remotes/bonzini/softmmu-smap' into stagingPeter Maydell2014-06-0585-1332/+1138
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remotes/bonzini/softmmu-smap: (33 commits) target-i386: cleanup x86_cpu_get_phys_page_debug target-i386: fix protection bits in the TLB for SMEP target-i386: support long addresses for 4MB pages (PSE-36) target-i386: raise page fault for reserved bits in large pages target-i386: unify reserved bits and NX bit check target-i386: simplify pte/vaddr calculation target-i386: raise page fault for reserved physical address bits target-i386: test reserved PS bit on PML4Es target-i386: set correct error code for reserved bit access target-i386: introduce support for 1 GB pages target-i386: introduce do_check_protect label target-i386: tweak handling of PG_NX_MASK target-i386: commonize checks for PAE and non-PAE target-i386: commonize checks for 4MB and 4KB pages target-i386: commonize checks for 2MB and 4KB pages target-i386: fix coding standards in x86_cpu_handle_mmu_fault target-i386: simplify SMAP handling in MMU_KSMAP_IDX target-i386: fix kernel accesses with SMAP and CPL = 3 target-i386: move check_io helpers to seg_helper.c target-i386: rename KSMAP to KNOSMAP ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * target-i386: cleanup x86_cpu_get_phys_page_debugPaolo Bonzini2014-06-051-18/+17
| | | | | | | | | | | | Make the code a bit more similar to x86_cpu_handle_mmu_fault. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: fix protection bits in the TLB for SMEPPaolo Bonzini2014-06-051-1/+3
| | | | | | | | | | | | | | | | | | User pages must be marked as non-executable when running under SMEP; otherwise, fetching the page first and then calling it will fail. With this patch, all SMEP testcases in kvm-unit-tests now pass. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: support long addresses for 4MB pages (PSE-36)Paolo Bonzini2014-06-052-5/+10
| | | | | | | | | | | | | | 4MB pages can use 40-bit addresses by putting the higher 8 bits in bits 20-13 of the PDE. Bit 21 is reserved. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: raise page fault for reserved bits in large pagesPaolo Bonzini2014-06-052-0/+3
| | | | | | | | | | | | In large pages, bit 12 is for PAT, but bits starting at 13 are reserved. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: unify reserved bits and NX bit checkPaolo Bonzini2014-06-051-12/+4
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: simplify pte/vaddr calculationPaolo Bonzini2014-06-051-8/+7
| | | | | | | | | | | | | | They can moved to after the dirty bit processing, and unified between CR0.PG=1 and CR0.PG=0. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: raise page fault for reserved physical address bitsPaolo Bonzini2014-06-052-12/+32
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: test reserved PS bit on PML4EsPaolo Bonzini2014-06-051-0/+3
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: set correct error code for reserved bit accessPaolo Bonzini2014-06-051-17/+9
| | | | | | | | | | | | The correct error code is 9 (present, reserved), not 8. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: introduce support for 1 GB pagesPaolo Bonzini2014-06-052-3/+8
| | | | | | | | | | | | | | Given the simplifications to the code in the previous patches, this is now very simple to do. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: introduce do_check_protect labelPaolo Bonzini2014-06-051-36/+38
| | | | | | | | | | | | This will help adding 1GB page support in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: tweak handling of PG_NX_MASKPaolo Bonzini2014-06-051-4/+4
| | | | | | | | | | | | | | Remove the tail of the PAE case, so that we can use "goto" in the next patch to jump to the protection checks. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: commonize checks for PAE and non-PAEPaolo Bonzini2014-06-051-79/+41
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: commonize checks for 4MB and 4KB pagesPaolo Bonzini2014-06-051-77/+41
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: commonize checks for 2MB and 4KB pagesPaolo Bonzini2014-06-051-83/+44
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: fix coding standards in x86_cpu_handle_mmu_faultPaolo Bonzini2014-06-051-5/+9
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: simplify SMAP handling in MMU_KSMAP_IDXPaolo Bonzini2014-06-052-9/+5
| | | | | | | | | | | | | | Do not use this MMU index at all if CR4.SMAP is false, and drop the SMAP check from x86_cpu_handle_mmu_fault. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: fix kernel accesses with SMAP and CPL = 3Paolo Bonzini2014-06-053-8/+33
| | | | | | | | | | | | | | | | | | With SMAP, implicit kernel accesses from user mode always behave as if AC=0. To do this, kernel mode is not anymore a separate MMU mode. Instead, KERNEL_IDX is renamed to KSMAP_IDX and the kernel mode accessors wrap KSMAP_IDX and KNOSMAP_IDX. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: move check_io helpers to seg_helper.cPaolo Bonzini2014-06-052-42/+42
| | | | | | | | | | | | Prepare for adding _kernel accessors there in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-i386: rename KSMAP to KNOSMAPPaolo Bonzini2014-06-052-7/+7
| | | | | | | | | | | | This is the mode where SMAP is overridden, put "NO" in its name. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: move all load/store functions to cpu_ldst.hPaolo Bonzini2014-06-056-376/+368
| | | | | | | | | | | | | | | | Unify pieces of cpu-all.h, exec-all.h, softmmu_exec.h and tcg/tcg.h into a single new header file with all helpers. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: introduce cpu_ldst.hPaolo Bonzini2014-06-0550-60/+84
| | | | | | | | | | | | | | | | | | | | This will collect all load and store helpers soon. For now it is just a replacement for softmmu_exec.h, which this patch stops including directly, but we also include it where this will be necessary in order to simplify the next patch. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * target-arm: move arm_*_code to a separate filePaolo Bonzini2014-06-055-22/+50
| | | | | | | | | | | | | | These will soon require cpu_ldst.h, so move them out of cpu.h. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: move softmmu_template.h out of include/Paolo Bonzini2014-06-052-8/+8
| | | | | | | | | | | | | | It is only included in cputlb.c now. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: commonize helper definitionsPaolo Bonzini2014-06-0518-220/+19
| | | | | | | | | | | | | | | | | | They do not need to be in op_helper.c. Because cputlb.c now includes softmmu_template.h twice for each size, io_readX must be elided the second time through. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: move ALIGNED_ONLY to cpu.hPaolo Bonzini2014-06-058-4/+5
| | | | | | | | | | | | | | Prepare for moving softmmu_header.h inclusion out of .c files Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: make do_unaligned_access a method of CPUPaolo Bonzini2014-06-0514-37/+63
| | | | | | | | | | | | | | | | | | We will reference it from more files in the next patch. To avoid ruining the small steps we're making towards multi-target, make it a method of CPU rather than just a global. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: move definition of CPU_MMU_INDEX to inclusion site, drop ACCESS_TYPEPaolo Bonzini2014-06-053-27/+16
| | | | | | | | | | Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: move MMUSUFFIX under SOFTMMU_CODE_ACCESSPaolo Bonzini2014-06-051-9/+2
| | | | | | | | | | Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: start introducing SOFTMMU_CODE_ACCESS in softmmu_header.hPaolo Bonzini2014-06-052-5/+5
| | | | | | | | | | | | | | | | | | This preprocessor symbol is already used in softmmu_template.h. We will use it to distinguish the two "fake" ACCESS_TYPEs NB_MMU_MODES and NB_MMU_MODES + 1. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * hw: use ld_p/st_p instead of ld_raw/st_rawPaolo Bonzini2014-06-0510-253/+253
| | | | | | | | | | | | | | | | | | | | The ld_raw and st_raw definitions are only needed in code that must compile for both user-mode and softmmu emulation. Device models can use the equivalent ld_p/st_p which are simple pointer accessors. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * nseries: clean up coding stylePaolo Bonzini2014-06-051-127/+145
| | | | | | | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * cputlb: Fix regression with TCG interpreter (bug 1310324)Stefan Weil2014-06-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 0f842f8a246f2b5b51a11c13f933bf7a90ae8e96 replaced GETPC_EXT() which was derived from GETPC() by GETRA_EXT() without fixing cputlb.c. A later patch replaced GETRA_EXT() by GETRA() in exec/softmmu_template.h which is included in cputlb.c. The TCG interpreter failed because the values returned by GETRA() were no longer explicitly set to 0. The redefinition of GETRA() introduced here fixes this. In addition, GETPC_ADJ which is also used in exec/softmmu_template.h is set to 0. Both changes reduce the compiled code size for cputlb.c by more than 100 bytes, so the normal TCG without interpreter also profits from the reduced code size and slightly faster code. Cc: qemu-stable@nongnu.org Reported-by: Giovanni Mascellani <gio@debian.org> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | Merge remote-tracking branch 'remotes/rth/tcg-next' into stagingPeter Maydell2014-06-0517-428/+237
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | * remotes/rth/tcg-next: TCG: Fix tcg_gen_extr_i64_tl for 32bit tcg: Remove TCG_TARGET_HAS_new_ldst tci: Convert to new ldst opcodes tcg-i386: Fix win64 qemu store Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | TCG: Fix tcg_gen_extr_i64_tl for 32bitAlexander Graf2014-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We expose a generic helper "tcg_gen_extr_i64_tl" for 64bit targets, but the same function for 32bit targets is a misnomer and refers to an invalid function name. Fix up the definition to point to the correct internal helper names instead. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
| * | tcg: Remove TCG_TARGET_HAS_new_ldstRichard Henderson2014-06-0413-234/+28
| | | | | | | | | | | | | | | | | | | | | Since all backends have been converted, remove the compatibility code. Acked-by: Claudio Fontana <claudio.fontana@huawei.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
| * | tci: Convert to new ldst opcodesRichard Henderson2014-06-043-193/+207
| | | | | | | | | | | | | | | Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
| * | tcg-i386: Fix win64 qemu storeRichard Henderson2014-06-041-1/+2
| |/ | | | | | | | | | | | | | | The first non-register argument isn't placed at offset 0. Cc: qemu-stable@nongnu.org Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
* | Merge remote-tracking branch 'remotes/kvm/uq/master' into stagingPeter Maydell2014-06-0514-77/+175
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remotes/kvm/uq/master: kvm: Fix eax for cpuid leaf 0x40000000 kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation kvm: Enable -cpu option to hide KVM kvm: Ensure negative return value on kvm_init() error handling path target-i386: set CC_OP to CC_OP_EFLAGS in cpu_load_eflags target-i386: get CPL from SS.DPL target-i386: rework CPL checks during task switch, preparing for next patch target-i386: fix segment flags for SMM and VM86 mode target-i386: Fix vm86 mode regression introduced in fd460606fd6f. kvm_stat: allow choosing between tracepoints and old stats kvmclock: Ensure time in migration never goes backward Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | kvm: Fix eax for cpuid leaf 0x40000000Jidong Xiao2014-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Linux kernel 3.5, KVM has documented eax for leaf 0x40000000 to be KVM_CPUID_FEATURES: https://github.com/torvalds/linux/commit/57c22e5f35aa4b9b2fe11f73f3e62bbf9ef36190 But qemu still tries to set it to 0. It would be better to make qemu and kvm consistent. This patch just fixes this issue. Signed-off-by: Jidong Xiao <jidong.xiao@gmail.com> [Include kvm_base in the value. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculationMarcelo Tosatti2014-06-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure proper env->tsc value for kvmclock_current_nsec calculation. Reported-by: Marcin Gibuła <m.gibula@beyond.pl> Cc: qemu-stable@nongnu.org Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | kvm: Enable -cpu option to hide KVMAlex Williamson2014-06-033-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The latest Nvidia driver (337.88) specifically checks for KVM as the hypervisor and reports Code 43 for the driver in a Windows guest when found. Removing or changing the KVM signature is sufficient for the driver to load and work. This patch adds an option to easily allow the KVM hypervisor signature to be hidden using '-cpu kvm=off'. We continue to expose KVM via the cpuid value by default. The state of this option does not supercede or replace -enable-kvm or the accel=kvm machine option. This only changes the visibility of KVM to the guest and paravirtual features specifically tied to the KVM cpuid. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | kvm: Ensure negative return value on kvm_init() error handling pathEduardo Habkost2014-05-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | We need to ensure ret < 0 when going through the error path, or QEMU may try to run the half-initialized VM and crash. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | target-i386: set CC_OP to CC_OP_EFLAGS in cpu_load_eflagsPaolo Bonzini2014-05-214-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | There is no reason to keep that out of the function. The comment refers to the disassembler's cc_op state rather than the CPUState field. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | target-i386: get CPL from SS.DPLPaolo Bonzini2014-05-213-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CS.RPL is not equal to the CPL in the few instructions between setting CR0.PE and reloading CS. We get this right in the common case, because writes to CR0 do not modify the CPL, but it would not be enough if an SMI comes exactly during that brief period. Were this to happen, the RSM instruction would erroneously set CPL to the low two bits of the real-mode selector; and if they are not 00, the next instruction fetch cannot access the code segment and causes a triple fault. However, SS.DPL *is* always equal to the CPL. In real processors (AMD only) there is a weird case of SYSRET setting SS.DPL=SS.RPL from the STAR register while forcing CPL=3, but we do not emulate that. Tested-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | target-i386: rework CPL checks during task switch, preparing for next patchPaolo Bonzini2014-05-211-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During task switch, all of CS.DPL, CS.RPL, SS.DPL must match (in addition to all the other requirements) and will be the new CPL. So far this worked by carefully setting the CS selector and flags before doing the task switch; but this will not work once we get the CPL from SS.DPL. Temporarily assume that the CPL comes from CS.RPL during task switch to a protected-mode task, until the descriptor of SS is loaded. Tested-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | target-i386: fix segment flags for SMM and VM86 modePaolo Bonzini2014-05-215-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the next patch, these need to be correct or VM86 tasks have the wrong CPL. The flags are basically what the Intel VMX documentation say is mandatory for entry into a VM86 guest. For consistency, SMM ought to have the same flags except with CPL=0. Tested-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | target-i386: Fix vm86 mode regression introduced in fd460606fd6f.Kevin O'Connor2014-05-211-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit fd460606fd6f moved setting of eflags above calls to cpu_x86_load_seg_cache() in seg_helper.c. Unfortunately, in do_interrupt_protected() this moved the clearing of VM_MASK above a test for it. Fix this regression by storing the value of VM_MASK at the start of do_interrupt_protected(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * | kvm_stat: allow choosing between tracepoints and old statsPaolo Bonzini2014-05-211-19/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old stats contain information not available in the tracepoints. By default, keep the old behavior, but allow choosing which set of stats to present, or even both. Inspired by a patch from Marcelo Tosatti. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud