mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tj@kernel.org" <tj@kernel.org>
To: Pang Raymond <Raymond_rule@hotmail.com>
Cc: linux ide <linux-ide@vger.kernel.org>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: BUG: INTx is assered unexpectly when unload AHCI driver with MSIx support.
Date: Wed, 6 Jul 2016 09:52:36 -0400	[thread overview]
Message-ID: <20160706135236.GG3262@mtj.duckdns.org> (raw)
In-Reply-To: <HK2PR03MB173248BF420102DE4E54BD6EFC3A0@HK2PR03MB1732.apcprd03.prod.outlook.com>

Hello,

(Can you please flow the text a bit below 80 column when you reply?)

On Wed, Jul 06, 2016 at 02:51:47AM +0000, Pang Raymond wrote:
> Why does the phenomenon appear?
> 	Two factors cause this problem.
> 		1. In MSIx's irq handler
> 		   (ahci_multi_irqs_intr_hard()), we do not clear
> 		   GHC.IS register which presents which ports need
> 		   interrupt service.  static irqreturn_t
> 		   ahci_multi_irqs_intr_hard(int irq, void
> 		   *dev_instance)
> 			{
> 				//  omitting unconcerned codes here
> 				// ...				
> 				// here we just clear PxIS register, not clear GHC.IS
> 				status = readl(port_mmio + PORT_IRQ_STAT);
> 				writel(status, port_mmio + PORT_IRQ_STAT);
> 				// ...
> 			}
> 		2. In PCI subsystem, after Disable MSIx, INTx is
>		   enabled automatically.
> 			void pci_msix_shutdown(struct pci_dev *dev)
> 			{
> 				// omitting unconcerned codes here
> 				// ...				
> 				// after Disable MSIx, enable INTx imediately
> 				pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
> 				pci_intx_for_msi(dev, 1);
> 				dev->msix_enabled = 0;
> 				pcibios_alloc_irq(dev);
> 			}
>
> When Kernel enables INTx(I mean clearing PCI configure space
> Rx04.bit10), controller will find GHC.IS is not Zero (because driver
> haven't cleared GHC.IS after servicing MSIx interrupt), so it
> believes some SATA ports need interrupt servicing and asserts INTx
> interrupt.

Looks like you debugged the problem.  Care to write up and test a
patch?

Thanks a lot!

-- 
tejun

       reply	other threads:[~2016-07-06 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <HK2PR03MB173248BF420102DE4E54BD6EFC3A0@HK2PR03MB1732.apcprd03.prod.outlook.com>
2016-07-06 13:52 ` tj [this message]
     [not found]   ` <HK2PR03MB1732DE50EA9D44F23481968AFC3F0@HK2PR03MB1732.apcprd03.prod.outlook.com>
2016-07-12 17:30     ` 答复: " tj
     [not found]       ` <HK2PR03MB1732E094DCB79C7EF0F5C1B4FC330@HK2PR03MB1732.apcprd03.prod.outlook.com>
2016-07-18 22:28         ` tj

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=20160706135236.GG3262@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=Raymond_rule@hotmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®