[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V5 14/25] pci: export functions for cpr
From: |
Steve Sistare |
Subject: |
[PATCH V5 14/25] pci: export functions for cpr |
Date: |
Wed, 7 Jul 2021 10:20:23 -0700 |
Export msix_is_pending, msix_init_vector_notifiers, and pci_update_mappings
for use by cpr. No functional change.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hw/pci/msix.c | 20 ++++++++++++++------
hw/pci/pci.c | 3 +--
include/hw/pci/msix.h | 5 +++++
include/hw/pci/pci.h | 1 +
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index ae9331c..73f4259 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -64,7 +64,7 @@ static uint8_t *msix_pending_byte(PCIDevice *dev, int vector)
return dev->msix_pba + vector / 8;
}
-static int msix_is_pending(PCIDevice *dev, int vector)
+int msix_is_pending(PCIDevice *dev, unsigned int vector)
{
return *msix_pending_byte(dev, vector) & msix_pending_mask(vector);
}
@@ -579,6 +579,17 @@ static void msix_unset_notifier_for_vector(PCIDevice *dev,
unsigned int vector)
dev->msix_vector_release_notifier(dev, vector);
}
+void msix_init_vector_notifiers(PCIDevice *dev,
+ MSIVectorUseNotifier use_notifier,
+ MSIVectorReleaseNotifier release_notifier,
+ MSIVectorPollNotifier poll_notifier)
+{
+ assert(use_notifier && release_notifier);
+ dev->msix_vector_use_notifier = use_notifier;
+ dev->msix_vector_release_notifier = release_notifier;
+ dev->msix_vector_poll_notifier = poll_notifier;
+}
+
int msix_set_vector_notifiers(PCIDevice *dev,
MSIVectorUseNotifier use_notifier,
MSIVectorReleaseNotifier release_notifier,
@@ -586,11 +597,8 @@ int msix_set_vector_notifiers(PCIDevice *dev,
{
int vector, ret;
- assert(use_notifier && release_notifier);
-
- dev->msix_vector_use_notifier = use_notifier;
- dev->msix_vector_release_notifier = release_notifier;
- dev->msix_vector_poll_notifier = poll_notifier;
+ msix_init_vector_notifiers(dev, use_notifier, release_notifier,
+ poll_notifier);
if ((dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &
(MSIX_ENABLE_MASK | MSIX_MASKALL_MASK)) == MSIX_ENABLE_MASK) {
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 377084f..2590898 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -225,7 +225,6 @@ static const TypeInfo pcie_bus_info = {
};
static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num);
-static void pci_update_mappings(PCIDevice *d);
static void pci_irq_handler(void *opaque, int irq_num, int level);
static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom, Error **);
static void pci_del_option_rom(PCIDevice *pdev);
@@ -1334,7 +1333,7 @@ static pcibus_t pci_bar_address(PCIDevice *d,
return new_addr;
}
-static void pci_update_mappings(PCIDevice *d)
+void pci_update_mappings(PCIDevice *d)
{
PCIIORegion *r;
int i;
diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h
index 4c4a60c..46606cf 100644
--- a/include/hw/pci/msix.h
+++ b/include/hw/pci/msix.h
@@ -32,6 +32,7 @@ int msix_present(PCIDevice *dev);
bool msix_is_masked(PCIDevice *dev, unsigned vector);
void msix_set_pending(PCIDevice *dev, unsigned vector);
void msix_clr_pending(PCIDevice *dev, int vector);
+int msix_is_pending(PCIDevice *dev, unsigned vector);
int msix_vector_use(PCIDevice *dev, unsigned vector);
void msix_vector_unuse(PCIDevice *dev, unsigned vector);
@@ -41,6 +42,10 @@ void msix_notify(PCIDevice *dev, unsigned vector);
void msix_reset(PCIDevice *dev);
+void msix_init_vector_notifiers(PCIDevice *dev,
+ MSIVectorUseNotifier use_notifier,
+ MSIVectorReleaseNotifier release_notifier,
+ MSIVectorPollNotifier poll_notifier);
int msix_set_vector_notifiers(PCIDevice *dev,
MSIVectorUseNotifier use_notifier,
MSIVectorReleaseNotifier release_notifier,
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 6be4e0c..bef3e49 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -902,5 +902,6 @@ extern const VMStateDescription vmstate_pci_device;
}
MSIMessage pci_get_msi_message(PCIDevice *dev, int vector);
+void pci_update_mappings(PCIDevice *d);
#endif
--
1.8.3.1
- Re: [PATCH V5 16/25] vfio-pci: cpr part 1, (continued)
- [PATCH V5 17/25] vfio-pci: cpr part 2, Steve Sistare, 2021/07/07
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Alex Williamson, 2021/07/16
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Steven Sistare, 2021/07/19
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Alex Williamson, 2021/07/19
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Steven Sistare, 2021/07/19
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Zheng Chuan, 2021/07/28
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Steven Sistare, 2021/07/30
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Zheng Chuan, 2021/07/31
[PATCH V5 14/25] pci: export functions for cpr,
Steve Sistare <=
[PATCH V5 15/25] vfio-pci: refactor for cpr, Steve Sistare, 2021/07/07
[PATCH V5 18/25] vhost: reset vhost devices upon cprsave, Steve Sistare, 2021/07/07
[PATCH V5 24/25] cpr: only-cpr-capable option, Steve Sistare, 2021/07/07
[PATCH V5 22/25] chardev: cpr for pty, Steve Sistare, 2021/07/07
[PATCH V5 21/25] chardev: cpr for simple devices, Steve Sistare, 2021/07/07
[PATCH V5 23/25] chardev: cpr for sockets, Steve Sistare, 2021/07/07
[PATCH V5 25/25] simplify savevm, Steve Sistare, 2021/07/07
[PATCH V5 02/25] cpr: reboot mode, Steve Sistare, 2021/07/07