@@ -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);
}
'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(-)