From: "Cédric Le Goater" <clg@kaod.org>
To: Greg Kurz <groug@kaod.org>, David Gibson <david@gibson.dropbear.id.au>
Cc: Daniel Henrique Barboza <danielhb@linux.ibm.com>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 for-5.2 2/3] ppc/xive: Introduce dedicated kvm_irqchip_in_kernel() wrappers
Date: Sat, 8 Aug 2020 12:49:41 +0200 [thread overview]
Message-ID: <e718da5f-c5f3-db74-be94-938700384ce7@kaod.org> (raw)
In-Reply-To: <159679993438.876294.7285654331498605426.stgit@bahia.lan>
Some more comments, because I still think there are some shortcuts.
My feeling is that all the kvmppc_xive* could be part of a QOM interface
defining how to use a kernel device backend. When the kernel IRQ device
is not available, under TCG or under an hypervisor not advertising
support at the KVM level, the QOM interface kernel device backend
would be a no-op, else it would implement what the kvmppc_xive_* do
today. So, it's something we would change like ->intc after an interrupt
mode has been negotiated.
It's an intuition regarding POWER10/XIVE2 and nested support which
could need a different interface of the KVM XIVE device in the future.
I don't think we need today but it would clarify some of the shortcuts.
> +/*
> + * kvm_irqchip_in_kernel() will cause the compiler to turn this
> + * info a nop if CONFIG_KVM isn't defined.
> + */
> +#define spapr_xive_in_kernel(xive) \
> + (kvm_irqchip_in_kernel() && (xive)->fd != -1)
> +
Here, we have a shortcut. kvm_irqchip_in_kernel() is a compilation
trick but the real handler :
{
return SPAPR_XIVE(xrtr)->fd != -1;
}
is a shortcut. We are using ->fd to know if QEMU is connected with
a KVM device or not.
> void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
> {
> XiveSource *xsrc = &xive->source;
> int i;
>
> - if (kvm_irqchip_in_kernel()) {
> + if (spapr_xive_in_kernel(xive)) {
> Error *local_err = NULL;
>
> kvmppc_xive_synchronize_state(xive, &local_err);
With a QOM interface for a kernel device backend, this would become :
XIVE_BACKEND_GET_CLASS(xive->backend)->synchronize_state(xive);
and we could drop all the 'if' statement.
Makes sense ? I think XICS behaves the same.
Thanks,
C.
next prev parent reply other threads:[~2020-08-08 10:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-07 11:31 [PATCH v3 for-5.2 0/3] spapr: Cleanups for XIVE Greg Kurz
2020-08-07 11:32 ` [PATCH v3 for-5.2 1/3] ppc/xive: Rework setup of XiveSource::esb_mmio Greg Kurz
2020-08-07 12:36 ` Cédric Le Goater
2020-08-13 10:50 ` David Gibson
2020-08-07 11:32 ` [PATCH v3 for-5.2 2/3] ppc/xive: Introduce dedicated kvm_irqchip_in_kernel() wrappers Greg Kurz
2020-08-07 12:42 ` Cédric Le Goater
2020-08-08 10:49 ` Cédric Le Goater [this message]
2020-08-13 10:56 ` David Gibson
2020-08-07 11:32 ` [PATCH v3 for-5.2 3/3] spapr/xive: Convert KVM device fd checks to assert() Greg Kurz
2020-08-07 12:37 ` Cédric Le Goater
2020-08-13 11:00 ` David Gibson
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=e718da5f-c5f3-db74-be94-938700384ce7@kaod.org \
--to=clg@kaod.org \
--cc=danielhb@linux.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 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).