From: Avi Kivity <avi@redhat.com>
To: Christoffer Dall <cdall@cs.columbia.edu>
Cc: kvm@vger.kernel.org, catalin.marinas@arm.com,
tech@virtualopensystems.com, android-virt@lists.cs.columbia.edu
Subject: Re: [PATCH v4 07/10] ARM: KVM: Emulation framework and CP15 emulation
Date: Tue, 09 Aug 2011 14:17:20 +0300 [thread overview]
Message-ID: <4E411740.6050007@redhat.com> (raw)
In-Reply-To: <20110806103949.27198.28630.stgit@localhost6.localdomain6>
On 08/06/2011 01:39 PM, Christoffer Dall wrote:
> Adds a new important function in the main KVM/ARM code called
> handle_exit() which is called from kvm_arch_vcpu_ioctl_run() on returns
> from guest execution. This function examines the Hyp-Syndrome-Register
> (HSR), which contains information telling KVM what caused the exit from
> the guest.
>
> Some of the reasons for an exit are CP15 accesses, which are
> not allowed from the guest and this commits handles these exits by
> emulating the intented operation in software and skip the guest
> instruction.
>
>
> /**
> * kvm_arch_vcpu_ioctl_run - the main VCPU run function to execute guest code
> * @vcpu: The VCPU pointer
> @@ -339,6 +396,26 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
> kvm_guest_exit();
> debug_ws_exit(vcpu->arch.regs.pc);
> trace_kvm_exit(vcpu->arch.regs.pc);
> +
> + ret = handle_exit(vcpu, run, ret);
> + if (ret) {
> + kvm_err(ret, "Error in handle_exit");
> + break;
> + }
> +
> + if (run->exit_reason == KVM_EXIT_MMIO)
> + break;
> +
> + if (need_resched()) {
> + vcpu_put(vcpu);
> + schedule();
> + vcpu_load(vcpu);
> + }
Preempt notifiers mean you don't need vcpu_put()/vcpu_load() - the
scheduler will call kvm_arch_vcpu_put/load() automatically during
context switch.
> +
> + if (signal_pending(current)&& !(run->exit_reason)) {
> + run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
> + break;
> + }
> }
You're supposed to return -EINTR on a signal. run->exit_reason isn't
defined in this case, but traditionally we return KVM_EXIT_INTR (which
means host signal, not guest signal - yes it's confusing).
> +
> +/**
> + * emulate_cp15_c15_access -- emulates cp15 accesses for CRn == 15
> + * @vcpu: The VCPU pointer
> + * @p: The coprocessor parameters struct pointer holding trap inst. details
> + *
> + * The CP15 c15 register is implementation defined, but some guest kernels
> + * attempt to read/write a diagnostics register here. We always return 0 and
> + * ignore writes and hope for the best. This may need to be refined.
> + */
> +static int emulate_cp15_c15_access(struct kvm_vcpu *vcpu,
> + struct coproc_params *p)
> +{
> + trace_kvm_emulate_cp15_imp(p->Op1, p->Rt1, p->CRn, p->CRm,
> + p->Op2, p->is_write);
_imp?
> +
> + if (!p->is_write)
> + *vcpu_reg(vcpu, p->Rt1) = 0;
> +
> + return 0;
> +}
> +
>
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-08-09 11:17 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-06 10:38 [PATCH v4 00/10] KVM/ARM Implementation Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 01/10] ARM: KVM: Initial skeleton to compile KVM support Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 02/10] ARM: KVM: Hypervisor identity mapping Christoffer Dall
2011-08-09 9:20 ` Avi Kivity
2011-08-09 9:29 ` Catalin Marinas
2011-08-09 9:29 ` Christoffer Dall
2011-08-09 10:23 ` [Android-virt] " Alexey Smirnov
2011-08-09 11:23 ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 03/10] ARM: KVM: Add hypervisor inititalization Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 04/10] ARM: KVM: Memory virtualization setup Christoffer Dall
2011-08-09 9:57 ` Avi Kivity
2011-08-09 11:24 ` [Android-virt] " Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 05/10] ARM: KVM: Inject IRQs and FIQs from userspace Christoffer Dall
2011-08-09 10:07 ` Avi Kivity
2011-08-09 11:27 ` [Android-virt] " Christoffer Dall
2011-08-09 11:37 ` Avi Kivity
2011-08-09 11:40 ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 06/10] ARM: KVM: World-switch implementation Christoffer Dall
2011-08-09 11:09 ` Avi Kivity
2011-08-09 11:29 ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 07/10] ARM: KVM: Emulation framework and CP15 emulation Christoffer Dall
2011-08-09 11:17 ` Avi Kivity [this message]
2011-08-09 11:34 ` Christoffer Dall
2011-08-09 11:39 ` Avi Kivity
2011-08-09 11:40 ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 08/10] ARM: KVM: Handle guest faults in KVM Christoffer Dall
2011-08-09 11:24 ` Avi Kivity
2011-08-09 11:35 ` Christoffer Dall
2011-08-06 10:40 ` [PATCH v4 09/10] ARM: KVM: Handle I/O aborts Christoffer Dall
2011-08-09 11:34 ` Avi Kivity
2011-08-09 11:39 ` Christoffer Dall
2011-08-09 11:46 ` Avi Kivity
2011-08-06 10:40 ` [PATCH v4 10/10] ARM: KVM: Guest wait-for-interrupts (WFI) support Christoffer Dall
2011-08-09 11:43 ` [PATCH v4 00/10] KVM/ARM Implementation Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E411740.6050007@redhat.com \
--to=avi@redhat.com \
--cc=android-virt@lists.cs.columbia.edu \
--cc=catalin.marinas@arm.com \
--cc=cdall@cs.columbia.edu \
--cc=kvm@vger.kernel.org \
--cc=tech@virtualopensystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).