All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Barrat <fbarrat@linux.ibm.com>
To: clg@kaod.org, danielhb413@gmail.com, mst@redhat.com,
	marcel.apfelbaum@gmail.com, qemu-ppc@nongnu.org,
	qemu-devel@nongnu.org
Subject: [PATCH 1/2] pcie: Don't try triggering a LSI when not defined
Date: Mon, 21 Mar 2022 16:33:56 +0100	[thread overview]
Message-ID: <20220321153357.165775-2-fbarrat@linux.ibm.com> (raw)
In-Reply-To: <20220321153357.165775-1-fbarrat@linux.ibm.com>

This patch skips [de]asserting a LSI interrupt if the device doesn't
have any LSI defined. Doing so would trigger an assert in
pci_irq_handler().

The PCIE root port implementation in qemu requests a LSI (INTA), but a
subclass may want to change that behavior since it's a valid
configuration. For example on the POWER8/POWER9/POWER10 systems, the
root bridge doesn't request any LSI.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 hw/pci/pcie.c     | 8 ++++++--
 hw/pci/pcie_aer.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 67a5d67372..71c5194b80 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -354,7 +354,9 @@ static void hotplug_event_notify(PCIDevice *dev)
     } else if (msi_enabled(dev)) {
         msi_notify(dev, pcie_cap_flags_get_vector(dev));
     } else {
-        pci_set_irq(dev, dev->exp.hpev_notified);
+        if (pci_intx(dev) != -1) {
+            pci_set_irq(dev, dev->exp.hpev_notified);
+        }
     }
 }
 
@@ -362,7 +364,9 @@ static void hotplug_event_clear(PCIDevice *dev)
 {
     hotplug_event_update_event_status(dev);
     if (!msix_enabled(dev) && !msi_enabled(dev) && !dev->exp.hpev_notified) {
-        pci_irq_deassert(dev);
+        if (pci_intx(dev) != -1) {
+            pci_irq_deassert(dev);
+        }
     }
 }
 
diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c
index e1a8a88c8c..d936bfca20 100644
--- a/hw/pci/pcie_aer.c
+++ b/hw/pci/pcie_aer.c
@@ -291,7 +291,9 @@ static void pcie_aer_root_notify(PCIDevice *dev)
     } else if (msi_enabled(dev)) {
         msi_notify(dev, pcie_aer_root_get_vector(dev));
     } else {
-        pci_irq_assert(dev);
+        if (pci_intx(dev) != -1) {
+            pci_irq_assert(dev);
+        }
     }
 }
 
-- 
2.35.1



  reply	other threads:[~2022-03-21 15:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 15:33 [PATCH 0/2] Remove PCIE root bridge LSI on powernv Frederic Barrat
2022-03-21 15:33 ` Frederic Barrat [this message]
2022-03-24 13:07   ` [PATCH 1/2] pcie: Don't try triggering a LSI when not defined Daniel Henrique Barboza
2022-03-24 13:47     ` Frederic Barrat
2022-03-24 14:02       ` Daniel Henrique Barboza
2022-03-21 15:33 ` [PATCH 2/2] ppc/pnv: Remove LSI on the PCIE host bridge Frederic Barrat
2022-03-24 13:10   ` Daniel Henrique Barboza
2022-04-06  7:52 ` [PATCH 0/2] Remove PCIE root bridge LSI on powernv Michael S. Tsirkin
2022-04-06  8:57   ` Frederic Barrat

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=20220321153357.165775-2-fbarrat@linux.ibm.com \
    --to=fbarrat@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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.