From: Peter Maydell <peter.maydell@linaro.org>
To: Pavel Fedin <p.fedin@samsung.com>
Cc: Diana Craciun <diana.craciun@freescale.com>,
Shlomo Pongratz <shlomo.pongratz@huawei.com>,
Shlomo Pongratz <shlomopongratz@gmail.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Vijay Kilari <vijay.kilari@gmail.com>
Subject: Re: [Qemu-devel] [RFC PATCH v3 1/4] hw/intc/arm_gicv3_common: Add state information
Date: Mon, 26 Oct 2015 10:59:53 +0000 [thread overview]
Message-ID: <CAFEAcA_ir8q-9mCoFkDwEh5dy-DDyunnBtQH01NA8m6SBCxSuA@mail.gmail.com> (raw)
In-Reply-To: <00f501d10fc1$ffd3a420$ff7aec60$@samsung.com>
On 26 October 2015 at 07:43, Pavel Fedin <p.fedin@samsung.com> wrote:
> Hello!
>
> I skipped many of comments because they are straightforward to address, decided to discuss only important ones.
>
>> So we're going to (potentially) emulate:
>> * non-system-register config
>> * non-affinity-routing config
>>
>> ? OK, but are we really sure we want to do that? Legacy config
>> is deprecated and it's really going to complicate the model...
>
> I remember that you told me that we are going to emulate full-blown
> GICv3, with HYP support and will all legacy stuff. You told me about
> this while merging the initial GICv3 series, so we reserved MMIO space
> for legacy CPU interface. So, i was pretty confident that we are going
> to do this over time, aren't we?
Yeah, you're right -- we should at least leave ourselves the room
to do that.
>> (Are we starting out with the non-legacy config that forces
>> system-regs and affinity-routing to always-on?)
>
> Yes, we are, but i also remember that you told me that migration data
> format, once implemented, is set in stone, so we should think very well.
You'll see from a comment I made in a later patch that we can have
optional migration subsections, so we can have the data which is
only needed in legacy configs be in its own subsection which won't
break migration for non-legacy setups. It's the non-legacy used by
KVM format we really need to get right from the start.
> (*) So far, i added also the following legacy stuff:
>
> 1. GICC_CTLR
>
> This is currently used to store GRPEN bits. I thought that having
> dedicated bool's for them is too much, they are just single bits,
> and they have to be mirrored in GICC_CTLR, once implemented. So i
> just squashed them in there from the beginning. Additionally, some
> of its bits, like FIQBypDisGrpX and IRQBypDisGrpX, do not have
> analogs in system registers. So, if we even implement them, we'll
> have to store them in dedicated place, and now we already have this
> place.
The only reason not to want to do this is that it means we have
legacy state in the not-legacy parts of the migration struct...
> 2. GIC_SPENDSGIR (**)
>
> Actually this is not used by in-kernel vGIC, but this is necessary
> for SW emulation. Because, as far as i can understand Shlomo's code,
> for software emulation we need to track down which source CPUs are
> sending SGIs, even if we don't emulate legacy interface. Because,
> for example, if two CPUs send an SGI to another CPU at the same time,
> the destination CPU should actually get two interrupts. So, we have
> to track down whose interrupts are already delivered and whose are
> not yet. And Shlomo's code uses a bitmask for that, which i put in
> GICv3SGISource.
I haven't looked into the details but this suggests to me that the
emulation code is doing something wrong. The GICv3 registers should
expose (one way or another) all the state in hardware, and a sw
emulation version should not need any extra state in order to behave
correctly.
>> > +struct GICv3SGISource {
>> > + /* For each SGI on the target CPU, we store bit mask
>> > + * indicating which source CPUs have made this SGI
>> > + * pending on the target CPU. These correspond to
>> > + * the bytes in the GIC_SPENDSGIR* registers as
>> > + * read by the target CPU.
>> > + */
>> > + unsigned long *pending;
>> > + int32_t size; /* Bitmap size for migration */
>> > +};
>>
>> This doesn't look right. There is one GICD_SPENDSGIR* register set
>> for each CPU, but each CPU has only 8 pending bits per SGI.
>> (That's because this is only relevant for legacy operation
>> with affinity-routing disabled, and the limitations on
>> legacy operation apply.) So you don't need a huge bitmap here.
>> I would default to modelling this as uint32_t spendsgir[4]
>> unless there's a good reason to do something else.
>
> This is about (**). Or do you want to tell that GICv3 with affinity
> routing enabled simply doesn't care about source CPUs, and if several
> CPUs trigger the same SGI for the same destination, the destination
> gets only one SGI?
There is no hidden state in the GIC. If a non-legacy GICv3 has
no register state to store information about source CPUs, then
it cannot care about source CPUs. (For instance, note that the
OS is not passed info about SGI source CPUs in the INTID bits
[12:10] on reads of GICC_IAR if affinity routing is enabled.)
One of the GICv2-to-GICv3+affinity changes is that in GICv3
SGIs were banked by both source and destination processor;
in GICv3+affinity-routing, they are banked only by destination
processor.
thanks
-- PMM
next prev parent reply other threads:[~2015-10-26 11:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-22 14:02 [Qemu-devel] [RFC PATCH v3 0/4] GICv3 live migration support Pavel Fedin
2015-10-22 14:02 ` [Qemu-devel] [RFC PATCH v3 1/4] hw/intc/arm_gicv3_common: Add state information Pavel Fedin
2015-10-23 13:57 ` Peter Maydell
2015-10-24 12:30 ` Shlomo Pongratz
2015-10-24 12:35 ` Peter Maydell
2015-10-26 7:43 ` Pavel Fedin
2015-10-26 10:59 ` Peter Maydell [this message]
2015-10-22 14:02 ` [Qemu-devel] [RFC PATCH v3 2/4] kernel: Add definitions for GICv3 attributes Pavel Fedin
2015-10-22 14:02 ` [Qemu-devel] [RFC PATCH v3 3/4] hw/intc/arm_gicv3_kvm: Implement get/put functions Pavel Fedin
2015-10-23 13:57 ` Peter Maydell
2015-10-26 7:59 ` Pavel Fedin
2015-10-26 11:09 ` Peter Maydell
2015-10-22 14:02 ` [Qemu-devel] [RFC PATCH v3 4/4] hw/intc/arm_gicv3_common: Add vmstate descriptors Pavel Fedin
2015-10-23 13:57 ` 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=CAFEAcA_ir8q-9mCoFkDwEh5dy-DDyunnBtQH01NA8m6SBCxSuA@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=diana.craciun@freescale.com \
--cc=p.fedin@samsung.com \
--cc=qemu-devel@nongnu.org \
--cc=shlomo.pongratz@huawei.com \
--cc=shlomopongratz@gmail.com \
--cc=vijay.kilari@gmail.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).