On Fri, Nov 22, 2019 at 07:29:32PM +0100, Eric Auger wrote:
> @@ -443,6 +489,8 @@ static IOMMUTLBEntry 
> virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,
>      if (!ep) {
>          if (!bypass_allowed) {
>              error_report_once("%s sid=%d is not known!!", __func__, sid);
> +            virtio_iommu_report_fault(s, VIRTIO_IOMMU_FAULT_R_UNKNOWN,
> +                                      0, sid, 0);

I guess we could report the faulting address as well, it can be useful for
diagnostics.

>          } else {
>              entry.perm = flag;
>          }
> @@ -455,6 +503,8 @@ static IOMMUTLBEntry 
> virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,
>                            "%s %02x:%02x.%01x not attached to any domain\n",
>                            __func__, PCI_BUS_NUM(sid),
>                            PCI_SLOT(sid), PCI_FUNC(sid));
> +            virtio_iommu_report_fault(s, VIRTIO_IOMMU_FAULT_R_DOMAIN,
> +                                      0, sid, 0);

Here as well, especially since that error would get propagated by a linux
guest to the device driver

>          } else {
>              entry.perm = flag;
>          }
> @@ -468,16 +518,25 @@ static IOMMUTLBEntry 
> virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,
>          qemu_log_mask(LOG_GUEST_ERROR,
>                        "%s no mapping for 0x%"PRIx64" for sid=%d\n",
>                        __func__, addr, sid);
> +        virtio_iommu_report_fault(s, VIRTIO_IOMMU_FAULT_R_MAPPING,
> +                                  0, sid, addr);

Flag VIRTIO_IOMMU_FAULT_F_ADDRESS denotes a valid address field

Thanks,
Jean

Reply via email to