linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Duc Dang <dhdang@apm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Rafael Wysocki <rafael@kernel.org>,
	linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
	patches <patches@apm.com>, Bjorn Helgaas <bhelgaas@google.com>,
	punit.agrawal@arm.com
Subject: Re: Defining polarity and trigger mode for static interrupts in _PRT
Date: Wed, 24 Aug 2016 17:56:35 -0500	[thread overview]
Message-ID: <20160824225635.GM23914@localhost> (raw)
In-Reply-To: <CADaLNDm+edKaveG76h_fbMjM_b==PdranXLoATL8+JrsWRC6BQ@mail.gmail.com>

On Wed, Aug 24, 2016 at 03:19:21PM -0700, Duc Dang wrote:
> On Wed, Aug 24, 2016 at 1:30 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> > On Wed, 24 Aug 2016 14:30:00 -0500
> > Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> >> On Wed, Aug 24, 2016 at 03:27:23PM +0100, Lorenzo Pieralisi wrote:
> >> > [ +Bjorn, Punit]
> >> >
> >> > On Wed, Aug 24, 2016 at 04:06:13AM -0700, Duc Dang wrote:
> >> > > [Resend in plain text mode]
> >> > >
> >> > > Hi Lorenzo, Rafael,
> >> > >
> >> > > ACPI 6.1 spec does not specify how to set interrupt polarity and
> >> > > trigger mode in _PRT when the interrupts are static (hardwired to
> >> > > specific interrupt inputs in interrupt controller). In current
> >> > > acpi_pci_irq_enable (drivers/acpi/pci_irq.c) implementation, by
> >> > > default the trigger mode is set to LEVEL_SENSITIVE, polarity is set to
> >> > > ACTIVE_LOW. This default setting won't work for ARM64 GICv2, GICv2m,
> >> > > GICv3 controllers and will cause failures in PCIe AER, PME services
> >> > > (on X-Gene platforms).
> >>
> >> PCI (not PCIe) r3.0, sec 2.2.6, says "Interrupts on PCI are optional
> >> and defined as 'level sensitive,' asserted low."
> >>
> >> I've heard before that ARM64 does this differently, but I still don't
> >> understand the difference.  Obviously if you plug a legacy PCI card
> >> into an ARM64 system, it's still going to pull INTA# low to assert an
> >> interrupt.  So is there something special about ARM64 that inverts
> >> that, or what?
> >
> > There is certainly an inverter somewhere on the interrupt path, because
> > the GIC triggers on level high, not level low. But I don't think that's
> > the issue Duc is trying to outline here, because that's not something
> > SW can fix. I'm worried that in his system, the interrupt is edge
> > triggered instead.
> 
> Yes, there is an inverter in the interrupt path to deliver interrupt to the GIC
> as level-high. X-Gene GIC uses level high for PCI INTx. I myself has been
> lucky when using trigger-rising for PCI INTx in DT boot mode.

I'd say the code in drivers/acpi/pci_irq.c should be generic and
assume what's in the PCI spec, i.e., level-triggered, active low.  If
a platform needs to do something else, that exception should be
handled in platform-specific code somehow, not in pci_irq.c.

> >> > > Is there any way to specify polarity and trigger mode for static
> >> > > interrupts in _PRT?
> >>
> >> There is no way I'm aware of in _PRT to specify polarity and trigger
> >> mode.  I don't know the history, but my guess is that it would be seen
> >> as superfluous given that the PCI spec requires level, active low.
> 
> The device still pulls the INTx pin low to trigger interrupt, but the
> interrupt delivered
> to interrupt controller (GIC in this case) is not necessarily to be
> level-low. Current code
> assume level-low mode to program to the interrupt controller for INTx,
> and fails for
> GIC, GICv2m and GICv3.
> 
> >>
> >> Obviously I'm missing something important.
> >
> > Same here, unless the HW is not PCI compliant...
> >
> > Thanks,
> >
> >         M.
> > --
> > Jazz is not dead. It just smells funny.
> 
> Regards,
> Duc Dang.

  reply	other threads:[~2016-08-24 22:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADaLNDm-HmnOsrntDC8zz28bwiQZVv36LG-iMDATqzavY7cXVg@mail.gmail.com>
2016-08-24 14:27 ` Defining polarity and trigger mode for static interrupts in _PRT Lorenzo Pieralisi
2016-08-24 19:30   ` Bjorn Helgaas
2016-08-24 20:30     ` Marc Zyngier
2016-08-24 22:19       ` Duc Dang
2016-08-24 22:56         ` Bjorn Helgaas [this message]
2016-08-25 11:18         ` Marc Zyngier
2016-08-25 16:52           ` Duc Dang
2016-08-25 18:59             ` Marc Zyngier
2016-08-26  9:08               ` Lorenzo Pieralisi
2016-08-26 11:04                 ` okaya
2016-08-26 12:08                 ` Marc Zyngier
2016-08-26 14:07                   ` Sinan Kaya
2016-08-26 17:06                     ` Lorenzo Pieralisi
2016-08-26 22:53                       ` Sinan Kaya
2016-08-30 10:08                         ` Lorenzo Pieralisi
2016-08-30 15:51                           ` Duc Dang
2016-08-30 17:54                             ` Sinan Kaya
2016-08-31 10:07                               ` Lorenzo Pieralisi
2016-08-31 13:05                           ` Bjorn Helgaas
2016-08-31 13:34                             ` Lorenzo Pieralisi
2016-08-31 16:05                               ` Bjorn Helgaas
2016-08-31 16:37                                 ` Lorenzo Pieralisi
2016-08-31 23:08                                   ` Rafael J. Wysocki
2016-09-02 11:09                                     ` Lorenzo Pieralisi
2016-09-02 21:28                                       ` Rafael J. Wysocki
2016-08-25 10:04       ` Punit Agrawal
2016-08-25 11:14         ` Lorenzo Pieralisi
2016-08-25 16:46           ` Duc Dang
2016-08-25 17:20             ` Bjorn Helgaas
2016-08-24 15:26 ` 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=20160824225635.GM23914@localhost \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dhdang@apm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=patches@apm.com \
    --cc=punit.agrawal@arm.com \
    --cc=rafael@kernel.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).