xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jean Guyader <jean.guyader@gmail.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH] qemu-xen-traditional: Enable MSI after host sleep (v2)
Date: Thu, 10 May 2012 20:04:51 +0100	[thread overview]
Message-ID: <CAEBdQ90RhbfBSYg0fyvaHL54mdYKFSfFCGKqvFK_65C2ftB-bw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

After a host sleep MSI will be off on the host but qemu still thinks
it's on because of some state that have been set previously.

If qemu thinks that the device has been configure already
and the host MSI are disabled tell Xen to reconfigure the MSI.

Signed-off-by: Jean Guyader <jean.guyader@gmail.com>

[-- Attachment #2: msi-after-sleep.patch --]
[-- Type: text/x-patch, Size: 1553 bytes --]

diff --git a/hw/pass-through.c b/hw/pass-through.c
index f832c5a..a6a9b7a 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -3772,6 +3772,21 @@ static int pt_pmcsr_reg_write(struct pt_dev *ptdev,
     return 0;
 }
 
+static int msi_is_enable(struct pt_dev *dev)
+{
+    uint16_t val = 0;
+    uint32_t address = 0;
+    if (!dev->msi)
+        return 0;
+
+    address = dev->msi->ctrl_offset;
+    if (!address)
+        return 0;
+
+    val = pci_read_word(dev->pci_dev, address);
+    return val & PCI_MSI_FLAGS_ENABLE;
+}
+
 /* write Message Control register */
 static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
     struct pt_reg_tbl *cfg_entry,
@@ -3803,8 +3818,7 @@ static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
     /* update MSI */
     if (val & PCI_MSI_FLAGS_ENABLE)
     {
-        /* setup MSI pirq for the first time */
-        if (ptdev->msi->flags & MSI_FLAG_UNINIT)
+        if (!msi_is_enable(ptdev))
         {
             if (ptdev->msi_trans_en) {
                 PT_LOG("guest enabling MSI, disable MSI-INTx translation\n");
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index 70c4023..99f9afd 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -67,12 +67,6 @@ int pt_msi_setup(struct pt_dev *dev)
     int pirq = -1;
     uint8_t gvec = 0;
 
-    if ( !(dev->msi->flags & MSI_FLAG_UNINIT) )
-    {
-        PT_LOG("Error: setup physical after initialized?? \n");
-        return -1;
-    }
-
     gvec = dev->msi->data & 0xFF;
     if (!gvec) {
         /* if gvec is 0, the guest is asking for a particular pirq that

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2012-05-10 19:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 19:04 Jean Guyader [this message]
2012-05-11 16:06 ` [PATCH] qemu-xen-traditional: Enable MSI after host sleep (v2) Stefano Stabellini
2012-05-24  9:44   ` Jean Guyader

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=CAEBdQ90RhbfBSYg0fyvaHL54mdYKFSfFCGKqvFK_65C2ftB-bw@mail.gmail.com \
    --to=jean.guyader@gmail.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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).