diff options
author | Akihiko Odaki | 2022-08-29 10:35:24 +0200 |
---|---|---|
committer | Michael S. Tsirkin | 2022-11-07 20:08:17 +0100 |
commit | 15377f6e79cc6aa08dbafe82607e0bda13ca44b5 (patch) | |
tree | 689870d114b96e0fd61fd47b73ee92e5c1d6a7df /include | |
parent | MAINTAINERS: Add qapi/virtio.json to section "virtio" (diff) | |
download | qemu-15377f6e79cc6aa08dbafe82607e0bda13ca44b5.tar.gz qemu-15377f6e79cc6aa08dbafe82607e0bda13ca44b5.tar.xz qemu-15377f6e79cc6aa08dbafe82607e0bda13ca44b5.zip |
msix: Assert that specified vector is in range
There were several different ways to deal with the situation where the
vector specified for a msix function is out of bound:
- early return a function and keep progresssing
- propagate the error to the caller
- mark msix unusable
- assert it is in bound
- just ignore
An out-of-bound vector should not be specified if the device
implementation is correct so let msix functions always assert that the
specified vector is in range.
An exceptional case is virtio-pci, which allows the guest to configure
vectors. For virtio-pci, it is more appropriate to introduce its own
checks because it is sometimes too late to check the vector range in
msix functions.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20220829083524.143640-1-akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
Signed-off-by: Akihiko Odaki <<a href="mailto:akihiko.odaki@daynix.com" target="_blank">akihiko.odaki@daynix.com</a>><br>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/pci/msix.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h index 4f1cda0ebe..0e6f257e45 100644 --- a/include/hw/pci/msix.h +++ b/include/hw/pci/msix.h @@ -33,10 +33,10 @@ 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_vector_use(PCIDevice *dev, unsigned vector); +void msix_vector_use(PCIDevice *dev, unsigned vector); void msix_vector_unuse(PCIDevice *dev, unsigned vector); void msix_unuse_all_vectors(PCIDevice *dev); -void msix_set_mask(PCIDevice *dev, int vector, bool mask, Error **errp); +void msix_set_mask(PCIDevice *dev, int vector, bool mask); void msix_notify(PCIDevice *dev, unsigned vector); |