From: Pavel Fedin <p.fedin@samsung.com>
To: 'Peter Maydell' <peter.maydell@linaro.org>,
'QEMU' <qemu-devel@nongnu.org>
Cc: 'Eric Auger' <eric.auger@linaro.org>,
'Marc Zyngier' <marc.zyngier@arm.com>,
'Andre Przywara' <andre.przywara@arm.com>,
'Shlomo Pongratz' <shlomopongratz@gmail.com>,
'Shlomo Pongratz' <shlomo.pongratz@huawei.com>,
'Christoffer Dall' <christoffer.dall@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] KVM: arm/arm64: Add VGICv3 save/restore API documentation
Date: Thu, 08 Oct 2015 16:28:03 +0300 [thread overview]
Message-ID: <00a801d101cd$29570fb0$7c052f10$@samsung.com> (raw)
In-Reply-To: <CAFEAcA8RWqipM7LRXc-Se6xJ9FkbVm=2Mr=pe1pB_NnS2wfsvw@mail.gmail.com>
Hello!
Since we are discussing qemu here, i removed kernel mailing lists and added qemu-devel.
> A quick look at your patch suggests you still have data
> structures like
>
> +struct gicv3_irq_state {
> + /* The enable bits are only banked for per-cpu interrupts. */
> + unsigned long *enabled;
> + unsigned long *pending;
> + unsigned long *active;
> + unsigned long *level;
> + unsigned long *group;
> + bool edge_trigger; /* true: edge-triggered, false: level-triggered */
> + uint32_t mask_size; /* Size of bitfields in long's, for migration */
> +};
>
> I think it's probably going to be better to have an array
> of redistributor structures (one per CPU)
Already done. See struct GICv3CPUState - this is per-CPU data. During realize, i allocate an array of these structures and put the pointer into s->cpu.
GICv3CPUState holds both redistributor and CPU interface data, for simplicity, because they come in pairs.
> and then keep
> the state that in hardware is in each redistributor inside
> those sub-structures.
I can do it easily, but here i left the original layout by Shlomo Pongratz, because i thought that it will be easier for his SW emulation code to handle it. I remember that he performs some bitwise logic on these bitmasks based on CPU masks in order to determine what to do on which CPUs, so i thought that it will be better to leave them as they are. These bitfields have one bit per CPU, just SPI bits are always set/cleared altogether (i have set_all_cpus() and clear_all_cpus() inlines for this purpose).
I had even better idea of splitting up gicv3_irq_state, and storing only per-CPU IRQs in the GICv3CPUState, and SPIs in GICv3State. In this case bitfields would be of a fixed size, and one bit would represent one interrupt. This would decrease memory usage, because we would not have to duplicate SPI bits for every CPU. But will this be good for SW emulation?
OTOH, i have rechecked current SW emulation code, and i see that it uses macros like GIC_TEST_xxx, and cpu mask is always (1 << ncpu). So, can we safely replace mask with just CPU number in these macros? It would solve the problem. Shlomo, your word?
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia
next prev parent reply other threads:[~2015-10-08 13:28 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 19:50 [PATCH] KVM: arm/arm64: Add VGICv3 save/restore API documentation Christoffer Dall
2015-10-07 19:50 ` Christoffer Dall
2015-10-08 7:17 ` Pavel Fedin
2015-10-08 7:17 ` Pavel Fedin
2015-10-08 8:23 ` Christoffer Dall
2015-10-08 8:23 ` Christoffer Dall
2015-10-08 9:10 ` Pavel Fedin
2015-10-08 9:10 ` Pavel Fedin
2015-10-08 9:28 ` Christoffer Dall
2015-10-08 9:28 ` Christoffer Dall
2015-10-08 10:14 ` Marc Zyngier
2015-10-08 10:14 ` Marc Zyngier
2015-10-08 12:28 ` Pavel Fedin
2015-10-08 12:28 ` Pavel Fedin
2015-10-08 12:36 ` Christoffer Dall
2015-10-08 12:36 ` Christoffer Dall
2015-10-08 12:45 ` Pavel Fedin
2015-10-08 12:45 ` Pavel Fedin
2015-10-08 12:51 ` Marc Zyngier
2015-10-08 12:51 ` Marc Zyngier
2015-10-08 12:55 ` Peter Maydell
2015-10-08 12:55 ` Peter Maydell
2015-10-08 13:28 ` Pavel Fedin [this message]
2015-10-08 13:37 ` [Qemu-devel] " Peter Maydell
2015-10-08 14:29 ` Pavel Fedin
2015-10-08 10:25 ` Peter Maydell
2015-10-08 10:25 ` Peter Maydell
2015-10-09 7:30 ` Pavel Fedin
2015-10-09 7:30 ` Pavel Fedin
2015-10-09 8:06 ` Marc Zyngier
2015-10-09 8:06 ` Marc Zyngier
2015-10-09 8:10 ` Pavel Fedin
2015-10-09 8:10 ` Pavel Fedin
2015-10-09 8:29 ` Marc Zyngier
2015-10-09 8:29 ` Marc Zyngier
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='00a801d101cd$29570fb0$7c052f10$@samsung.com' \
--to=p.fedin@samsung.com \
--cc=andre.przywara@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=eric.auger@linaro.org \
--cc=marc.zyngier@arm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shlomo.pongratz@huawei.com \
--cc=shlomopongratz@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 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.