All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Fedin <p.fedin@samsung.com>
To: 'Peter Crosthwaite' <peter.crosthwaite@xilinx.com>
Cc: 'Peter Maydell' <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, 'Alexander Graf' <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 0/2] Remove CP15 timer from the device tree if KVM is used without in-kernel irqchip
Date: Thu, 25 Jun 2015 13:50:22 +0300	[thread overview]
Message-ID: <00e601d0af34$bcd2b4b0$36781e10$@samsung.com> (raw)
In-Reply-To: <CAEgOgz4eFOf54B656Z-xSvoUjRw8jCuZO6Kw6PKJsiKU8o-XFg@mail.gmail.com>

 Hello!

> Curious, what is the kernels algorithm for choosing a timer when
> multiple are in the device-tree?

 To tell the truth, i don't know. Actually, during my first tests i just disabled architected timer in guest kernel config, and it started working. So, i decided to teach qemu to do the fixup. Of course this is not supposed to work with older kernel versions, which do not use device tree and just know that the hardware is there.

> There are a lot of QEMU reasons for knocking out device tree nodes,
> un-emulated hardware being a big one. Should we be looking for a more
> core solution to the "should this device tree node really be here"
> problem?

 Perhaps. However, if you take a look at the code, it is generic enough (i hope). It doesn't touch machine-specific files at all, and it modifies device tree after machine-specific code does its own fixups. Also, the routine which is responsible for device tree removal is generic and reusable. You can use it in order to knock out any device by its "compatible" string.
 OTOH:
1) Not all operating systems use device trees (WinCE ? Win 8+ ?)
2) Nonresponsive hardware found in device tree is not a fault by itself. The driver just fails and that's it. The problem here is not unresponsive CP15, it's the other way round. It is responsive, but cannot be handled correctly. Actually, even this can be fixed; in order to do this we need to implement a VMEXIT in KVM upon IRQ arrival with corresponding return code, so that GIC emulated in userspace can pick up timer interrupt generated in kernel space.

 However, here i can offer two ideas, each of them is big enough.
 1. Why do we need to supply DTB at all? qemu actually knows about all hardware it emulates, why cannot it just construct the device tree ?
 2. If we decide to supply DTB, why do we need machine-specific setup code at all? We could make qemu parsing the device tree and creating hardware model according to it. I believe this would be way more flexible than what we have now.

> Does an unedited vexpress DTS just work except for this one thing?

 Yes, it does. I feed unmodified tree to the qemu and the model successfully boots up. On another machine, with working vGIC, the same kernel and DTB correctly recognizes architected timer.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

  reply	other threads:[~2015-06-25 10:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 11:58 [Qemu-devel] [PATCH 0/2] Remove CP15 timer from the device tree if KVM is used without in-kernel irqchip Pavel Fedin
2015-06-24 11:58 ` [Qemu-devel] [PATCH 1/2] Introduce qemu_fdt_remove_compatible() Pavel Fedin
2015-06-24 11:58 ` [Qemu-devel] [PATCH 2/2] Remove CP15 timer from the device tree if KVM is used without in-kernel irqchip Pavel Fedin
2015-06-25  6:22 ` [Qemu-devel] [PATCH 0/2] " Peter Crosthwaite
2015-06-25 10:50   ` Pavel Fedin [this message]
2015-06-25 10:59     ` Peter Maydell
2015-06-25 12:14       ` Pavel Fedin
2015-06-25 12:27         ` Peter Maydell
2015-06-25 13:21           ` Pavel Fedin
2015-06-25 14:17         ` Peter Maydell

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='00e601d0af34$bcd2b4b0$36781e10$@samsung.com' \
    --to=p.fedin@samsung.com \
    --cc=agraf@suse.de \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.