xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH] qemu-xen-trad: free all the pirqs for msi/msix when driver unloads
Date: Thu, 03 Jul 2014 11:12:18 +0800	[thread overview]
Message-ID: <53B4CA12.80709@oracle.com> (raw)
In-Reply-To: <21428.8198.371406.754367@mariner.uk.xensource.com>

There is a patch dependency missed.

commit adf74189dd58014744a4b8c9d64407d629da5e2f
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Dec 10 12:43:33 2012 +0000

     qemu-xen-trad/pt_msi_disable: do not clear all MSI flags

     "qemu-xen-trad: fix msi_translate with PV event delivery" added a
     pt_msi_disable() call into pt_msgctrl_reg_write, clearing the MSI flags
     as a consequence. MSIs get enabled again soon after by calling
     pt_msi_setup.

     However the MSI flags are only setup once in the pt_msgctrl_reg_init
     function, so from the QEMU point of view the device has lost some
     important properties, like for example PCI_MSI_FLAGS_64BIT.

     This patch fixes the bug by clearing only the MSI
     enabled/mapped/initialized flags in pt_msi_disable.

     Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
     Tested-by: G.R. <firemeteor@users.sourceforge.net>
     Xen-devel: http://marc.info/?l=xen-devel&m=135489879503075

diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index 73f737d..b03b989 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -213,7 +213,7 @@ void pt_msi_disable(struct pt_dev *dev)

  out:
      /* clear msi info */
-    dev->msi->flags = 0;
+    dev->msi->flags &= ~(MSI_FLAG_UNINIT | PT_MSI_MAPPED | 
PCI_MSI_FLAGS_ENABLE);
      dev->msi->pirq = -1;
      dev->msi_trans_en = 0;
  }

On 2014-7-2 23:06, Ian Jackson wrote:
> Konrad Rzeszutek Wilk writes ("[Xen-devel] [PATCH] qemu-xen-trad: free all the pirqs for msi/msix when driver unloads"):
>> From: Zhenzhong Duan<zhenzhong.duan@oracle.com>
>>
>> Pirqs are not freed when driver unloads, then new pirqs are allocated when
>> driver reloads. This could exhaust pirqs if do it in a loop.
>>
>> This patch fixes the bug by freeing pirqs when ENABLE bit is cleared in
>> msi/msix control reg.
> I have backported this to 4.4 and 4.3.  It did not apply cleanly to
> 4.2 (and I have not investgated why).
>
> Thanks,
> Ian.

  reply	other threads:[~2014-07-03  3:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 16:44 [PATCH] Fix qemu traditional with PCI passthrough Konrad Rzeszutek Wilk
2014-04-08 16:44 ` [PATCH] qemu-xen-trad: free all the pirqs for msi/msix when driver unloads Konrad Rzeszutek Wilk
2014-07-02 15:06   ` Ian Jackson
2014-07-03  3:12     ` Zhenzhong Duan [this message]
2014-07-03 17:54       ` Konrad Rzeszutek Wilk
2014-07-04  1:29         ` Zhenzhong Duan
2014-07-07 20:40           ` Konrad Rzeszutek Wilk
2014-07-08  1:12             ` Zhenzhong Duan
2014-08-04 14:01               ` Konrad Rzeszutek Wilk
2014-08-05  7:31                 ` Zhenzhong Duan
2014-08-05 15:21                   ` Konrad Rzeszutek Wilk
2014-08-07  3:29       ` Zhenzhong Duan
2014-04-08 16:56 ` [PATCH] Fix qemu traditional with PCI passthrough Ian Jackson
2014-06-25 14:59   ` [PATCH] Fix qemu traditional with PCI passthrough. [and 2 more messages] Ian Jackson

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=53B4CA12.80709@oracle.com \
    --to=zhenzhong.duan@oracle.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --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 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).