[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 4/9] msix: simplify the conditional in msix_set/unset_vector_n
From: |
Longpeng(Mike) |
Subject: |
[PATCH v3 4/9] msix: simplify the conditional in msix_set/unset_vector_notifiers |
Date: |
Tue, 21 Sep 2021 07:01:57 +0800 |
'msix_function_masked' is synchronized with the device's config,
we can use it to replace the complex conditional statementis in
msix_set/unset_vector_notifiers.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
---
hw/pci/msix.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index ae9331cd0b..67682289af 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -592,8 +592,7 @@ int msix_set_vector_notifiers(PCIDevice *dev,
dev->msix_vector_release_notifier = release_notifier;
dev->msix_vector_poll_notifier = poll_notifier;
- if ((dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &
- (MSIX_ENABLE_MASK | MSIX_MASKALL_MASK)) == MSIX_ENABLE_MASK) {
+ if (!dev->msix_function_masked) {
for (vector = 0; vector < dev->msix_entries_nr; vector++) {
ret = msix_set_notifier_for_vector(dev, vector);
if (ret < 0) {
@@ -622,8 +621,7 @@ void msix_unset_vector_notifiers(PCIDevice *dev)
assert(dev->msix_vector_use_notifier &&
dev->msix_vector_release_notifier);
- if ((dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &
- (MSIX_ENABLE_MASK | MSIX_MASKALL_MASK)) == MSIX_ENABLE_MASK) {
+ if (!dev->msix_function_masked) {
for (vector = 0; vector < dev->msix_entries_nr; vector++) {
msix_unset_notifier_for_vector(dev, vector);
}
--
2.23.0
- [PATCH v3 0/9] optimize the downtime for vfio migration, Longpeng(Mike), 2021/09/20
- [PATCH v3 5/9] msix: reset poll_notifier to NULL if fail to set notifiers, Longpeng(Mike), 2021/09/20
- [PATCH v3 3/9] vfio: simplify the failure path in vfio_msi_enable, Longpeng(Mike), 2021/09/20
- [PATCH v3 1/9] vfio: simplify the conditional statements in vfio_msi_enable, Longpeng(Mike), 2021/09/20
- [PATCH v3 6/9] kvm: irqchip: extract kvm_irqchip_add_deferred_msi_route, Longpeng(Mike), 2021/09/20
- [PATCH v3 4/9] msix: simplify the conditional in msix_set/unset_vector_notifiers,
Longpeng(Mike) <=
- [PATCH v3 8/9] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration", Longpeng(Mike), 2021/09/20
- [PATCH v3 9/9] vfio: defer to commit kvm irq routing when enable msi/msix, Longpeng(Mike), 2021/09/20
- [PATCH v3 7/9] vfio: add infrastructure to commit the deferred kvm routing, Longpeng(Mike), 2021/09/20
- [PATCH v3 2/9] vfio: move re-enabling INTX out of the common helper, Longpeng(Mike), 2021/09/20