virtio-devices: iommu: Return NOENT for UNMAP on unknown domain

The virtio spec mandates VIRTIO_IOMMU_S_NOENT, not S_INVAL, when
the target domain does not exist.

Signed-off-by: Rob Bradford <rbradford@meta.com>
Assisted-by: Claude:claude-opus-4-7
This commit is contained in:
Rob Bradford
2026-04-26 22:13:41 +01:00
parent f74255f5e8
commit 1376f6e9ef

View File

@@ -621,7 +621,7 @@ impl Request {
return Err(Error::InvalidUnmapRequestBypassDomain);
}
} else {
status = VIRTIO_IOMMU_S_INVAL;
status = VIRTIO_IOMMU_S_NOENT;
return Err(Error::InvalidUnmapRequestMissingDomain);
}
@@ -641,7 +641,7 @@ impl Request {
{
let domains = mapping.domains.read().unwrap();
let Some(domain) = domains.get(&domain_id) else {
status = VIRTIO_IOMMU_S_INVAL;
status = VIRTIO_IOMMU_S_NOENT;
return Err(Error::InvalidUnmapRequestMissingDomain);
};
for (&start, m) in domain.mappings.iter() {
@@ -678,7 +678,7 @@ impl Request {
let mut domains = mapping.domains.write().unwrap();
let Some(domain) = domains.get_mut(&domain_id) else {
status = VIRTIO_IOMMU_S_INVAL;
status = VIRTIO_IOMMU_S_NOENT;
return Err(Error::InvalidUnmapRequestMissingDomain);
};
domain