All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Julien Thierry <jthierry@redhat.com>, qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org, drjones@redhat.com, aik@ozlabs.ru,
	maz@kernel.org, qemu-devel@nongnu.org, eric.auger@redhat.com,
	shan.gavin@gmail.com, pbonzini@redhat.com
Subject: Re: [RFC PATCH] hw/arm/virt: Support NMI injection
Date: Thu, 30 Jan 2020 08:54:37 +1100	[thread overview]
Message-ID: <4a517e53-9a7c-903a-9fbc-e1aab1cccefb@redhat.com> (raw)
In-Reply-To: <51a83889-f2ef-5403-6661-710cfa1ffe01@redhat.com>

On 1/29/20 6:57 PM, Julien Thierry wrote:
> On 1/29/20 3:46 AM, Gavin Shan wrote:
>> On 1/28/20 7:29 PM, Julien Thierry wrote:

.../...

>>
>> Julien, thanks for the explanation. The question we're not sure if NMI should
>> be injected on receiving HMP/QMP "nmi" command. It means it's not clear what
>> behavior we should have for this command on ARM. However, I have one more
>> unrelated question: "pseudo" NMI on ARM64 should be PPI? I mean SPI can't
>> be "pseudo" NMI.
>>
> 
> I'm not sure I understand why you say "SPI can't be "pseudo" NMI". Currently both PPI and SPI are supported in the "pseudo" NMI scheme. Do you think that should not be the case? If so, can you elaborate?
> 
> Thanks,
> 

Julien, NMI interrupt is connected to the system by request_nmi() where we have
a check as below. -EINVAL will be returned from request_nmi() on those interrupts
whose descriptors aren't marked with IRQ_NOAUTOEN. SPI falls into this category.
Please refer to below code snippet extracted from gic_irq_domain_map() for more
details.

kernel/irq/manage.c::request_nmi()

int request_nmi(unsigned int irq, irq_handler_t handler,
                 unsigned long irqflags, const char *name, void *dev_id)
{
	:
         if (!desc || irq_settings_can_autoenable(desc) ||
             !irq_settings_can_request(desc) ||
             WARN_ON(irq_settings_is_per_cpu_devid(desc)) ||
             !irq_supports_nmi(desc))
		return -EINVAL;
	:
}


acpi_register_gsi
    irq_create_fwspec_mapping
       irq_domain_alloc_irqs
          __irq_domain_alloc_irqs
             irq_domain_alloc_irqs_hierarchy
                gic_irq_domain_alloc                  # irq_domain_ops::alloc
                   gic_irq_domain_map

drivers/irqchip/irq-gic-v3.c::gic_irq_domain_map()

static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
                               irq_hw_number_t hw)
{
	:
        switch (__get_intid_range(hw)) {
         case PPI_RANGE:
         case EPPI_RANGE:
                 irq_set_percpu_devid(irq);
                 irq_domain_set_info(d, irq, hw, chip, d->host_data,
                                     handle_percpu_devid_irq, NULL, NULL);
                 irq_set_status_flags(irq, IRQ_NOAUTOEN);                      <<<< this flag
                 break;

         case SPI_RANGE:
         case ESPI_RANGE:
                 irq_domain_set_info(d, irq, hw, chip, d->host_data,
                                     handle_fasteoi_irq, NULL, NULL);
                 irq_set_probe(irq);
                 irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
                 break;
            :
	}
         :
}

Thanks,
Gavin



  reply	other threads:[~2020-01-29 21:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19  4:06 [RFC PATCH] hw/arm/virt: Support NMI injection Gavin Shan
2020-01-14 21:50 ` Gavin Shan
2020-01-17 14:00 ` Peter Maydell
2020-01-28  6:48 ` Gavin Shan
2020-01-28  8:05   ` Auger Eric
2020-01-28  9:25     ` Marc Zyngier
2020-01-28 10:56       ` Auger Eric
2020-01-28 10:59         ` Peter Maydell
2020-01-28 11:13           ` Marc Zyngier
2020-01-29  3:30         ` Gavin Shan
2020-01-28  8:29   ` Julien Thierry
2020-01-29  3:46     ` Gavin Shan
2020-01-29  7:57       ` Julien Thierry
2020-01-29 21:54         ` Gavin Shan [this message]
2020-01-30 10:58           ` Marc Zyngier
2020-01-31  6:51             ` Gavin Shan
2020-01-29  2:44   ` Alexey Kardashevskiy
2020-01-29  3:41     ` Gavin Shan
2020-01-29  9:04     ` Marc Zyngier
2020-01-31  6:59       ` Gavin Shan
2020-01-31  9:39         ` Marc Zyngier
2020-02-04  3:51           ` Gavin Shan
2020-02-04 10:22             ` Peter Maydell
2020-02-05  3:09               ` Shan Gavin
2020-02-05  8:07             ` 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=4a517e53-9a7c-903a-9fbc-e1aab1cccefb@redhat.com \
    --to=gshan@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=drjones@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=jthierry@redhat.com \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shan.gavin@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.