From: Yijing Wang <wangyijing@huawei.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: Bjorn Helgaas <bhelgaas@google.com>, <linux-pci@vger.kernel.org>,
"Hanjun Guo" <guohanjun@huawei.com>
Subject: Re: [PATCH] PCI: Avoid initialize MSI/MSIX if device power state != PCI_D0
Date: Thu, 10 Oct 2013 20:32:31 +0800 [thread overview]
Message-ID: <52569E5F.90307@huawei.com> (raw)
In-Reply-To: <1381407317.2788.102.camel@deadeye.wl.decadent.org.uk>
On 2013/10/10 20:15, Ben Hutchings wrote:
> On Thu, 2013-10-10 at 16:31 +0800, Yijing Wang wrote:
>> Currently, if device power state != PCI_D0, we still initialize
>> device MSI/MSIX, but we won't write the MSI message to device
>> MSI/MSIX registers. It's weird, we don't configure MSI/MSIX
>> registers properly, but pci_enable_msi() or pci_enable_msix()
>> return success, and even these registers will never be updated later.
>> So I think it should return error if device power state != PCI_D0.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>> drivers/pci/msi.c | 10 ++++------
>> 1 files changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>> index d5f90d6..eb502f6 100644
>> --- a/drivers/pci/msi.c
>> +++ b/drivers/pci/msi.c
>> @@ -308,9 +308,7 @@ void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
>>
>> void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
>> {
>> - if (entry->dev->current_state != PCI_D0) {
>> - /* Don't touch the hardware now */
>> - } else if (entry->msi_attrib.is_msix) {
>> + if (entry->msi_attrib.is_msix) {
> [...]
>
> As I said before, this function was being called to change IRQ
> affinities during suspend/resume at a point when most PCI devices were
> in D3. If that is no longer the case then this change is probably OK.
> Otherwise you should not touch this function.
Hi ben, sorry for the mistake, now I know what you worry about. I will update this patch,
keep __write_msi_msg() function not changed. Only add some guard for pci_enable_msi()/pci_enable_msix() ..
Thanks!
Yijing.
>
> Ben.
>
--
Thanks!
Yijing
prev parent reply other threads:[~2013-10-10 12:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 8:31 [PATCH] PCI: Avoid initialize MSI/MSIX if device power state != PCI_D0 Yijing Wang
2013-10-10 12:15 ` Ben Hutchings
2013-10-10 12:32 ` Yijing Wang [this message]
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=52569E5F.90307@huawei.com \
--to=wangyijing@huawei.com \
--cc=ben@decadent.org.uk \
--cc=bhelgaas@google.com \
--cc=guohanjun@huawei.com \
--cc=linux-pci@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 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.