public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Pavel Fedin <p.fedin@samsung.com>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: 'Christoffer Dall' <christoffer.dall@linaro.org>
Subject: Re: [PATCH v3 2/3] Detect vGIC presence at runtime
Date: Fri, 14 Aug 2015 14:10:35 +0100	[thread overview]
Message-ID: <55CDE8CB.5040205@arm.com> (raw)
In-Reply-To: <017201d0d68c$82ae4950$880adbf0$@samsung.com>

On 14/08/15 13:26, Pavel Fedin wrote:
>  Hello! Thank you for quick response.
> 
>> This is fairly unreadable. Please use a switch statement instead.
> 
>  Christoffer disliked it in v1, so i thought a bit and changed it. Ok, will change it back.
> 
>> And here, we're going to assume that the arch timer still usable. We
>> definitely need a way to *prevent* the timer to be used when there is no
>> GIC. Otherwise, we're going to start trying to setup the mapping for the
>> active state, and the guest may start poking it.
> 
> But, this seems to be already done, isn't it?
> According to http://lxr.free-electrons.com/source/arch/arm/kvm/arm.c#L439:
> --- cut ---
> 459         /*
> 460          * Enable the arch timers only if we have an in-kernel VGIC
> 461          * and it has been properly initialized, since we cannot handle
> 462          * interrupts from the virtual timer with a userspace gic.
> 463          */
> 464         if (irqchip_in_kernel(kvm) && vgic_initialized(kvm))
> 465                 kvm_timer_enable(kvm);
> --- cut ---

Right, I failed to remember that one. Sorry. It should be safe then.
Hopefully.

[...]

>  And some more. Actually, it is possible to emulate generic timer in userspace, just not the virtual
> one. IIRC access to physical timer can be trapped. So, if we modify guest's device tree by removing
> virtual timer IRQ, the guest will fall back to physical timer. And this will be caught by the
> hypervisor. After this all we have to do is to add corresponding exit code which would allow the
> userspace to emulate missing CP15 (or system in case of ARM64) registers. So, this timer issue is
> not grave, just i postpone implementing it until GIC issues are settled down.

This is completely Linux-specific, unfortunately. And it relies on
userpace to expose a modified DT, so you need to be able to report back
to userspace that you can't deal with the virtual timer.

Which brings me to the next point: how do you tell userspace that your
timers are non-functional?

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2015-08-14 13:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 10:53 [PATCH v3 0/3] KVM: arm/arm64: Allow to use KVM without in-kernel irqchip Pavel Fedin
2015-08-05 10:53 ` [PATCH v3 1/3] Fix NULL pointer dereference if KVM is used " Pavel Fedin
2015-08-05 10:53 ` [PATCH v3 2/3] Detect vGIC presence at runtime Pavel Fedin
2015-08-14 11:26   ` Marc Zyngier
2015-08-14 12:26     ` Pavel Fedin
2015-08-14 13:10       ` Marc Zyngier [this message]
2015-08-14 13:41         ` Pavel Fedin
2015-08-05 10:53 ` [PATCH v3 3/3] Make KVM_CAP_IRQFD dependent on KVM_CAP_IRQCHIP Pavel Fedin

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=55CDE8CB.5040205@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=p.fedin@samsung.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