All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 2/4] x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode
Date: Thu, 21 Jan 2021 17:23:04 +0100	[thread overview]
Message-ID: <3e6652f4-693c-cb03-a5f1-bf90e0f83253@suse.com> (raw)
In-Reply-To: <20210115142820.35224-3-roger.pau@citrix.com>

On 15.01.2021 15:28, Roger Pau Monne wrote:
> --- a/xen/arch/x86/hvm/vioapic.c
> +++ b/xen/arch/x86/hvm/vioapic.c
> @@ -268,6 +268,17 @@ static void vioapic_write_redirent(
>  
>      spin_unlock(&d->arch.hvm.irq_lock);
>  
> +    if ( ent.fields.trig_mode == VIOAPIC_EDGE_TRIG &&
> +         ent.fields.remote_irr && is_iommu_enabled(d) )
> +            /*
> +             * Since IRR has been cleared and further interrupts can be
> +             * injected also attempt to deassert any virtual line of passed
> +             * through devices using this pin. Switching a pin from level to
> +             * trigger mode can be used as a way to EOI an interrupt at the
> +             * IO-APIC level.
> +             */
> +            hvm_dpci_eoi(d, gsi);
> +
>      if ( is_hardware_domain(d) && unmasked )
>      {
>          /*

I assume in the comment you mean "... from level to edge
mode ...". But this isn't reflected in the if() you add -
you do the same also when the mode doesn't change. Or do
you build on the assumption that ent.fields.remote_irr can
only be set if the prior mode was "level" (in which case
an assertion may be warranted, as I don't think this is
overly obvious)?

Also, looking at this code, is it correct to trigger an IRQ
upon the guest writing the upper half of an unmasked RTE
with remote_irr clear? I'd assume this needs to be strictly
limited to a 1->0 transition of the mask bit. If other code
indeed guarantees this in all cases, perhaps another place
where an assertion would be warranted?

Jan


  reply	other threads:[~2021-01-21 16:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 14:28 [PATCH v2 0/4] x86/intr: guest interrupt handling fixes/cleanup Roger Pau Monne
2021-01-15 14:28 ` [PATCH v2 1/4] x86/vioapic: check IRR before attempting to inject interrupt after EOI Roger Pau Monne
2021-01-21 16:03   ` Jan Beulich
2021-01-21 17:27     ` Roger Pau Monné
2021-01-15 14:28 ` [PATCH v2 2/4] x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode Roger Pau Monne
2021-01-21 16:23   ` Jan Beulich [this message]
2021-01-21 17:45     ` Roger Pau Monné
2021-01-22  9:13       ` Jan Beulich
2021-01-15 14:28 ` [PATCH v2 3/4] x86/vpic: issue dpci EOI for cleared pins at ICW1 Roger Pau Monne
2021-01-22  9:02   ` Jan Beulich
2021-01-22  9:53     ` Roger Pau Monné
2021-01-22 10:06       ` Jan Beulich
2021-01-15 14:28 ` [PATCH v2 4/4] x86/dpci: remove the dpci EOI timer Roger Pau Monne
2021-01-15 14:56   ` Roger Pau Monné
2021-01-22 11:37   ` Jan Beulich

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=3e6652f4-693c-cb03-a5f1-bf90e0f83253@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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.