All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex@shazbot.org>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PATCH for-12.0 6/9] vfio/pci: Rename capability functions
Date: Mon,  9 Nov 2026 10:06:22 +0100	[thread overview]
Message-ID: <20261109090625.908592-7-clg@redhat.com> (raw)
In-Reply-To: <20261109090625.908592-1-clg@redhat.com>

  vfio_add_emulated_word      -> vfio_pci_cap_add_emulated_word
  vfio_add_emulated_long      -> vfio_pci_cap_add_emulated_long
  vfio_pci_disable_rp_atomics -> vfio_pci_cap_disable_rp_atomics

No functional change.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/vfio/pci.h      | 10 +++++-----
 hw/vfio/pci-caps.c | 32 ++++++++++++++++----------------
 hw/vfio/pci.c      | 12 ++++++------
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 6fb2575053fa..2d0237b9afce 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -263,11 +263,11 @@ void vfio_pci_bars_exit(VFIOPCIDevice *vdev);
 void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev);
 
 /* Capabilities */
-void vfio_add_emulated_word(VFIOPCIDevice *vdev, int pos,
-                            uint16_t val, uint16_t mask);
-void vfio_add_emulated_long(VFIOPCIDevice *vdev, int pos,
-                            uint32_t val, uint32_t mask);
-void vfio_pci_disable_rp_atomics(VFIOPCIDevice *vdev);
+void vfio_pci_cap_add_emulated_word(VFIOPCIDevice *vdev, int pos,
+                                    uint16_t val, uint16_t mask);
+void vfio_pci_cap_add_emulated_long(VFIOPCIDevice *vdev, int pos,
+                                    uint32_t val, uint32_t mask);
+void vfio_pci_cap_disable_rp_atomics(VFIOPCIDevice *vdev);
 bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, Error **errp);
 
 /* Quirks */
diff --git a/hw/vfio/pci-caps.c b/hw/vfio/pci-caps.c
index 6c4fb8db4209..df0759d38b22 100644
--- a/hw/vfio/pci-caps.c
+++ b/hw/vfio/pci-caps.c
@@ -59,7 +59,7 @@ static void vfio_set_word_bits(uint8_t *buf, uint16_t val, uint16_t mask)
     pci_set_word(buf, (pci_get_word(buf) & ~mask) | val);
 }
 
-void vfio_add_emulated_word(VFIOPCIDevice *vdev, int pos,
+void vfio_pci_cap_add_emulated_word(VFIOPCIDevice *vdev, int pos,
                             uint16_t val, uint16_t mask)
 {
     PCIDevice *pdev = PCI_DEVICE(vdev);
@@ -74,7 +74,7 @@ static void vfio_set_long_bits(uint8_t *buf, uint32_t val, uint32_t mask)
     pci_set_long(buf, (pci_get_long(buf) & ~mask) | val);
 }
 
-void vfio_add_emulated_long(VFIOPCIDevice *vdev, int pos,
+void vfio_pci_cap_add_emulated_long(VFIOPCIDevice *vdev, int pos,
                             uint32_t val, uint32_t mask)
 {
     PCIDevice *pdev = PCI_DEVICE(vdev);
@@ -148,7 +148,7 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice *vdev)
     vdev->clear_parent_atomics_on_exit = true;
 }
 
-void vfio_pci_disable_rp_atomics(VFIOPCIDevice *vdev)
+void vfio_pci_cap_disable_rp_atomics(VFIOPCIDevice *vdev)
 {
     PCIDevice *pdev = PCI_DEVICE(vdev);
 
@@ -220,15 +220,15 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
          * Endpoints, which changes the type and clears the LNK & LNK2 fields.
          */
         if (type == PCI_EXP_TYPE_ENDPOINT) {
-            vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
+            vfio_pci_cap_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
                                    PCI_EXP_TYPE_RC_END << 4,
                                    PCI_EXP_FLAGS_TYPE);
 
             /* Link Capabilities, Status, and Control goes away */
             if (size > PCI_EXP_LNKCTL) {
-                vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP, 0, ~0);
-                vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0);
-                vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA, 0, ~0);
+                vfio_pci_cap_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP, 0, ~0);
+                vfio_pci_cap_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0);
+                vfio_pci_cap_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA, 0, ~0);
 
 #ifndef PCI_EXP_LNKCAP2
 #define PCI_EXP_LNKCAP2 44
@@ -238,9 +238,9 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
 #endif
                 /* Link 2 Capabilities, Status, and Control goes away */
                 if (size > PCI_EXP_LNKCAP2) {
-                    vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP2, 0, ~0);
-                    vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL2, 0, ~0);
-                    vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA2, 0, ~0);
+                    vfio_pci_cap_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP2, 0, ~0);
+                    vfio_pci_cap_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL2, 0, ~0);
+                    vfio_pci_cap_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA2, 0, ~0);
                 }
             }
 
@@ -258,13 +258,13 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
          * These devices don't support LNK/LNK2 capabilities, so make them up.
          */
         if (type == PCI_EXP_TYPE_RC_END) {
-            vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
+            vfio_pci_cap_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
                                    PCI_EXP_TYPE_ENDPOINT << 4,
                                    PCI_EXP_FLAGS_TYPE);
-            vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP,
+            vfio_pci_cap_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP,
                            QEMU_PCI_EXP_LNKCAP_MLW(QEMU_PCI_EXP_LNK_X1) |
                            QEMU_PCI_EXP_LNKCAP_MLS(QEMU_PCI_EXP_LNK_2_5GT), ~0);
-            vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0);
+            vfio_pci_cap_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0);
         }
 
         vfio_pci_enable_rp_atomics(vdev);
@@ -278,7 +278,7 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
      * config space.
      */
     if ((flags & PCI_EXP_FLAGS_VERS) == 0) {
-        vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
+        vfio_pci_cap_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
                                1, PCI_EXP_FLAGS_VERS);
     }
 
@@ -476,8 +476,8 @@ static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, uint16_t pos)
          * BAR size.  A write of an unsupported value is undefined, therefore
          * the register field is essentially RO.
          */
-        vfio_add_emulated_long(vdev, pos + PCI_REBAR_CAP + (i * 8), cap, ~0);
-        vfio_add_emulated_long(vdev, pos + PCI_REBAR_CTRL + (i * 8), ctrl, ~0);
+        vfio_pci_cap_add_emulated_long(vdev, pos + PCI_REBAR_CAP + (i * 8), cap, ~0);
+        vfio_pci_cap_add_emulated_long(vdev, pos + PCI_REBAR_CTRL + (i * 8), ctrl, ~0);
     }
 
     return 0;
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index a8a6b7b030fa..a52bdfaf1f83 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -1158,7 +1158,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
             error_setg(errp, "invalid PCI vendor ID provided");
             return false;
         }
-        vfio_add_emulated_word(vdev, PCI_VENDOR_ID, vdev->vendor_id, ~0);
+        vfio_pci_cap_add_emulated_word(vdev, PCI_VENDOR_ID, vdev->vendor_id, ~0);
         trace_vfio_pci_emulated_vendor_id(vbasedev->name, vdev->vendor_id);
     } else {
         vdev->vendor_id = pci_get_word(pdev->config + PCI_VENDOR_ID);
@@ -1169,7 +1169,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
             error_setg(errp, "invalid PCI device ID provided");
             return false;
         }
-        vfio_add_emulated_word(vdev, PCI_DEVICE_ID, vdev->device_id, ~0);
+        vfio_pci_cap_add_emulated_word(vdev, PCI_DEVICE_ID, vdev->device_id, ~0);
         trace_vfio_pci_emulated_device_id(vbasedev->name, vdev->device_id);
     } else {
         vdev->device_id = pci_get_word(pdev->config + PCI_DEVICE_ID);
@@ -1180,7 +1180,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
             error_setg(errp, "invalid PCI subsystem vendor ID provided");
             return false;
         }
-        vfio_add_emulated_word(vdev, PCI_SUBSYSTEM_VENDOR_ID,
+        vfio_pci_cap_add_emulated_word(vdev, PCI_SUBSYSTEM_VENDOR_ID,
                                vdev->sub_vendor_id, ~0);
         trace_vfio_pci_emulated_sub_vendor_id(vbasedev->name,
                                               vdev->sub_vendor_id);
@@ -1191,7 +1191,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
             error_setg(errp, "invalid PCI subsystem device ID provided");
             return false;
         }
-        vfio_add_emulated_word(vdev, PCI_SUBSYSTEM_ID, vdev->sub_device_id, ~0);
+        vfio_pci_cap_add_emulated_word(vdev, PCI_SUBSYSTEM_ID, vdev->sub_device_id, ~0);
         trace_vfio_pci_emulated_sub_device_id(vbasedev->name,
                                               vdev->sub_device_id);
     }
@@ -1206,7 +1206,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
             return false;
         }
         /* Higher 24 bits of PCI_CLASS_REVISION are class code */
-        vfio_add_emulated_long(vdev, PCI_CLASS_REVISION,
+        vfio_pci_cap_add_emulated_long(vdev, PCI_CLASS_REVISION,
                                vdev->class_code << 8, ~0xff);
         trace_vfio_pci_emulated_class_code(vbasedev->name, vdev->class_code);
     } else {
@@ -1433,7 +1433,7 @@ static void vfio_exitfn(PCIDevice *pdev)
         timer_free(vdev->intx.mmap_timer);
     }
     vfio_pci_msi_teardown(vdev);
-    vfio_pci_disable_rp_atomics(vdev);
+    vfio_pci_cap_disable_rp_atomics(vdev);
     vfio_pci_bars_exit(vdev);
     vfio_migration_exit(vbasedev);
     if (!vbasedev->mdev) {
-- 
2.56.0



  parent reply	other threads:[~2026-11-09  9:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  9:06 [PATCH for-12.0 0/9] vfio/pci: Split pci.c Cédric Le Goater
2026-11-09  9:06 ` [PATCH for-12.0 1/9] vfio/pci: Extract interrupt handling into pci-irq.c Cédric Le Goater
2026-11-09  9:06 ` [PATCH for-12.0 2/9] vfio/pci: Move vfio_mmap_set_enabled() to region.c Cédric Le Goater
2026-11-30 22:47   ` Alex Williamson
2026-11-09  9:06 ` [PATCH for-12.0 3/9] vfio/pci: Rename IRQ functions Cédric Le Goater
2026-11-30 22:47   ` Alex Williamson
2026-11-09  9:06 ` [PATCH for-12.0 4/9] vfio/pci: Replace deprecated g_memdup() with g_memdup2() Cédric Le Goater
2026-11-09  9:06 ` [PATCH for-12.0 5/9] vfio/pci: Extract PCI capability setup into pci-caps.c Cédric Le Goater
2026-11-09  9:06 ` Cédric Le Goater [this message]
2026-11-09  9:06 ` [PATCH for-12.0 7/9] vfio/pci: Rename vfio_sub_page_bar_update_mappings() function Cédric Le Goater
2026-11-09  9:06 ` [PATCH for-12.0 8/9] vfio/pci: Extract ROM handling into pci-rom.c Cédric Le Goater
2026-11-09  9:06 ` [PATCH for-12.0 9/9] vfio/pci: Rename vfio_opt_rom_in_denylist() to vfio_quirk_rom_in_denylist() Cédric Le Goater

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=20261109090625.908592-7-clg@redhat.com \
    --to=clg@redhat.com \
    --cc=alex@shazbot.org \
    --cc=qemu-devel@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.