All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Huacai Chen <chenhuacai@gmail.com>
Cc: Huacai Chen <chenhc@lemote.com>,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH 2/2] target/mips/kvm: Assert unreachable code is not used
Date: Mon, 7 Dec 2020 23:23:16 +0100	[thread overview]
Message-ID: <5555cc1f-8053-a964-ca3d-3b34a5954c19@amsat.org> (raw)
In-Reply-To: <98e6a5b3-15b5-0365-67dd-23830687d949@redhat.com>

On 11/24/20 12:02 PM, Paolo Bonzini wrote:
> On 24/11/20 11:41, Philippe Mathieu-Daudé wrote:
>> Huacai, ping?
>>
>> On 5/12/20 9:09 AM, Philippe Mathieu-Daudé wrote:
>>> +Paolo
>>>
>>> On 4/29/20 10:29 AM, Philippe Mathieu-Daudé wrote:
>>>> This code must not be used outside of KVM. Abort if it is.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>> ---
>>>>    target/mips/kvm.c | 8 ++------
>>>>    1 file changed, 2 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/target/mips/kvm.c b/target/mips/kvm.c
>>>> index de3e26ef1f..050bfbd7fa 100644
>>>> --- a/target/mips/kvm.c
>>>> +++ b/target/mips/kvm.c
>>>> @@ -196,9 +196,7 @@ int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq,
>>>> int level)
>>>>        CPUState *cs = CPU(cpu);
>>>>        struct kvm_mips_interrupt intr;
>>>>    -    if (!kvm_enabled()) {
>>>> -        return 0;
>>>> -    }
>>>> +    assert(kvm_enabled());
>>>>          intr.cpu = -1;
>>>>    @@ -219,9 +217,7 @@ int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int
>>>> irq, int level)
>>>>        CPUState *dest_cs = CPU(cpu);
>>>>        struct kvm_mips_interrupt intr;
>>>>    -    if (!kvm_enabled()) {
>>>> -        return 0;
>>>> -    }
>>>> +    assert(kvm_enabled());
>>>>          intr.cpu = dest_cs->cpu_index;
>>>>   
>>>
>>
> 
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> For kvm_mips_set_ipi_interrupt, however, it would be nicer if
> hw/intc/mips_gic.c always used gic->vps[vp].env->irq[], and the qemu_irq
> handler took care of calling kvm_mips_set_ipi_interrupt.
> 
> Likewise, there is some duplication between kvm_mips_interrupt's caller
> and kvm_arch_pre_run.  I'm not sure if kvm_arch_pre_run is needed at all.

OK, I'll have a look and ask Huacai to test.

Meanwhile, patch applied to mips-next.

Thanks,

Phil.


  reply	other threads:[~2020-12-07 22:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  8:29 [PATCH 0/2] mips: Minor simplifications for KVM use Philippe Mathieu-Daudé
2020-04-29  8:29 ` [PATCH 1/2] hw/mips/mips_int: De-duplicate KVM interrupt delivery Philippe Mathieu-Daudé
2020-04-29  8:48   ` chen huacai
2020-05-12  7:08     ` Philippe Mathieu-Daudé
2020-05-26  7:57       ` Thomas Huth
2020-05-26  8:17         ` Philippe Mathieu-Daudé
2020-04-29  8:29 ` [PATCH 2/2] target/mips/kvm: Assert unreachable code is not used Philippe Mathieu-Daudé
2020-05-12  7:09   ` Philippe Mathieu-Daudé
2020-11-24 10:41     ` Philippe Mathieu-Daudé
2020-11-24 11:02       ` Paolo Bonzini
2020-12-07 22:23         ` Philippe Mathieu-Daudé [this message]
2020-11-25  1:16       ` Huacai Chen
2020-05-26  7:52 ` [PATCH 0/2] mips: Minor simplifications for KVM use Philippe Mathieu-Daudé

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=5555cc1f-8053-a964-ca3d-3b34a5954c19@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhc@lemote.com \
    --cc=chenhuacai@gmail.com \
    --cc=pbonzini@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 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.