qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"John G Johnson" <john.g.johnson@oracle.com>,
	"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
	"Jagannathan Raman" <jag.raman@oracle.com>,
	qemu-trivial@nongnu.org, "Jason Wang" <jasowang@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH-for-7.0] hw/pci: Don't open-code pci_intx()
Date: Tue, 16 Nov 2021 18:26:55 +0100	[thread overview]
Message-ID: <20211116172655.2752742-1-philmd@redhat.com> (raw)

Use the pci_intx() helper instead of open-coding it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Based-on: <20211116170133.724751-3-fbarrat@linux.ibm.com>
---
 hw/net/vmxnet3.c  | 2 +-
 hw/remote/iohub.c | 6 ++----
 hw/remote/proxy.c | 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 41f796a247d..c7fc5f44d8f 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1350,7 +1350,7 @@ static void vmxnet3_update_features(VMXNET3State *s)
 static bool vmxnet3_verify_intx(VMXNET3State *s, int intx)
 {
     return s->msix_used || msi_enabled(PCI_DEVICE(s))
-        || intx == pci_get_byte(s->parent_obj.config + PCI_INTERRUPT_PIN) - 1;
+                        || intx == pci_intx(PCI_DEVICE(s));
 }
 
 static void vmxnet3_validate_interrupt_idx(bool is_msix, int idx)
diff --git a/hw/remote/iohub.c b/hw/remote/iohub.c
index 547d597f0fe..0e0bb651d1a 100644
--- a/hw/remote/iohub.c
+++ b/hw/remote/iohub.c
@@ -93,11 +93,9 @@ void process_set_irqfd_msg(PCIDevice *pci_dev, MPQemuMsg *msg)
 {
     RemoteMachineState *machine = REMOTE_MACHINE(current_machine);
     RemoteIOHubState *iohub = &machine->iohub;
-    int pirq, intx;
+    int pirq;
 
-    intx = pci_get_byte(pci_dev->config + PCI_INTERRUPT_PIN) - 1;
-
-    pirq = remote_iohub_map_irq(pci_dev, intx);
+    pirq = remote_iohub_map_irq(pci_dev, pci_intx(pci_dev));
 
     if (event_notifier_get_fd(&iohub->irqfds[pirq]) != -1) {
         qemu_set_fd_handler(event_notifier_get_fd(&iohub->resamplefds[pirq]),
diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c
index bad164299dd..22f32a5930b 100644
--- a/hw/remote/proxy.c
+++ b/hw/remote/proxy.c
@@ -32,14 +32,13 @@ static void proxy_intx_update(PCIDevice *pci_dev)
 {
     PCIProxyDev *dev = PCI_PROXY_DEV(pci_dev);
     PCIINTxRoute route;
-    int pin = pci_get_byte(pci_dev->config + PCI_INTERRUPT_PIN) - 1;
 
     if (dev->virq != -1) {
         kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, &dev->intr, dev->virq);
         dev->virq = -1;
     }
 
-    route = pci_device_route_intx_to_irq(pci_dev, pin);
+    route = pci_device_route_intx_to_irq(pci_dev, pci_intx(pci_dev));
 
     dev->virq = route.irq;
 
-- 
2.31.1



             reply	other threads:[~2021-11-16 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 17:26 Philippe Mathieu-Daudé [this message]
2021-12-15 10:37 ` [PATCH-for-7.0] hw/pci: Don't open-code pci_intx() Philippe Mathieu-Daudé
2021-12-15 15:01 ` Jag Raman

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=20211116172655.2752742-1-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=dmitry.fleytman@gmail.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=jag.raman@oracle.com \
    --cc=jasowang@redhat.com \
    --cc=john.g.johnson@oracle.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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 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).