From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/4] kvm: let split be optional for kvm_arch_irqchip_create
Date: Wed, 19 Dec 2018 10:53:25 -0500 [thread overview]
Message-ID: <20181219105308-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20181219085038.7729-2-peterx@redhat.com>
On Wed, Dec 19, 2018 at 04:50:35PM +0800, Peter Xu wrote:
> This patch allows the kvm_arch_irqchip_create() to return 0 if the
> split irqchip is specified but not forced by the user. Also, modify
> kvm_irqchip_create() similiarly.
>
> This patch should have no functional change for existing code since
> currently if split is specified it must be forced by the user so we'll
> always have machine_kernel_irqchip_required() returns true. However it
> could potentially be used in follow up patches when we want to turn
> split kernel irqchip as default for QEMU 4.0 which could trigger the
> case that kernel_irqchip_required=N while kernel_irqchip_split=Y. When
> with that, we'll first try with split irqchip, and falls back to
> normal kernel irqchip when split capability is not provided by the
> kernel.
>
> This brings us benefit that we can even run a default QEMU 4.0 on old
> kernels that does not support split irqchip (<4.4) but at the same
> time enable split irqchip for new kernels (>=4.4) as default.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Paolo, if you can ack this one, I can merge the rest.
> ---
> accel/kvm/kvm-all.c | 3 ++-
> target/i386/kvm.c | 6 +++---
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 4880a05399..b008364041 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -1468,7 +1468,8 @@ static void kvm_irqchip_create(MachineState *machine, KVMState *s)
> * in-kernel irqchip for us */
> ret = kvm_arch_irqchip_create(machine, s);
> if (ret == 0) {
> - if (machine_kernel_irqchip_split(machine)) {
> + if (machine_kernel_irqchip_required(machine) &&
> + machine_kernel_irqchip_split(machine)) {
> perror("Split IRQ chip mode not supported.");
> exit(1);
> } else {
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 739cf8c8ea..8f919f8f9f 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -3685,9 +3685,9 @@ int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
> if (machine_kernel_irqchip_split(ms)) {
> ret = kvm_vm_enable_cap(s, KVM_CAP_SPLIT_IRQCHIP, 0, 24);
> if (ret) {
> - error_report("Could not enable split irqchip mode: %s",
> - strerror(-ret));
> - exit(1);
> + assert(ret < 0);
> + /* If split not required, return 0 instead to retry */
> + return machine_kernel_irqchip_required(ms) ? ret : 0;
> } else {
> DPRINTF("Enabled KVM_CAP_SPLIT_IRQCHIP\n");
> kvm_split_irqchip = true;
> --
> 2.17.1
next prev parent reply other threads:[~2018-12-19 15:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 8:50 [Qemu-devel] [PATCH 0/4] q35: change defaults for kernel irqchip and IR Peter Xu
2018-12-19 8:50 ` [Qemu-devel] [PATCH 1/4] kvm: let split be optional for kvm_arch_irqchip_create Peter Xu
2018-12-19 15:53 ` Michael S. Tsirkin [this message]
2018-12-19 20:15 ` Paolo Bonzini
2018-12-19 8:50 ` [Qemu-devel] [PATCH 2/4] q35: set split kernel irqchip as default Peter Xu
2018-12-19 15:52 ` Michael S. Tsirkin
2018-12-19 20:16 ` Paolo Bonzini
2018-12-19 20:12 ` Paolo Bonzini
2018-12-19 21:24 ` Eduardo Habkost
2018-12-19 21:45 ` Paolo Bonzini
2018-12-20 5:31 ` Peter Xu
2018-12-19 8:50 ` [Qemu-devel] [PATCH 3/4] x86-iommu: switch intr_supported to OnOffAuto type Peter Xu
2018-12-19 8:50 ` [Qemu-devel] [PATCH 4/4] x86-iommu: turn on IR by default if proper Peter Xu
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=20181219105308-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--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 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).