VFIO updates 2016-03-28
- Use 128bit math to avoid asserts with IOMMU regions (Bandan Das) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJW+a1UAAoJECObm247sIsiqMsP/RX+lfr2LF7MA7mTEHFIya51 K0LkICysQ5Kh/nIa7yPuPKuGJaDazpYrASq4P5dwm/5IPHk3r/eE7oue7/f1itOK Rgv1sv2nsVkd0p9adTpMkuIAYzLPyp2enL6iuFZo8urwFDfjfAxo8Q0pFd/nxWz7 u7ft69vV40uWtHDg3TZx1EH19UJc0S2ouJeP1Q/MBLZ6FrJq2/SkgujNdX/OvnAv 0zi9mKOykc+lDEzQShXyivIDnl8NYwnEDdcfMvCf3JoV5j/SkCtLyryRoKGOV2LW 53687rNucVX5HLiFEs2hBuYhpxo5/Y7XOxAgbtRkkX1Dh12oy0u1NlV21BV5sPpQ KfiIimtVcq/EuLhs/HLMvwT83EwIRvlXmXiJxii5vWU7Nimmx+dpBqtkrwJ0qzch SPs+SxcCKCNLYeSPQxZ5mQTaf4uNgvBWMVm0nJtQvrWfUp/iLdDMeOx5Dx2wnoT4 8ksHkJin7j2JQnmQiCrPHgLsp47NF0cJixe10DkA9AaQBUcPaExfyr/n5qZIkbvz gxbW0QG1bkpYPD8uNxgFIblSlQGXVTpcvVUaUW7crEH+Dw3GK4h8UcTkKH7rqHGk 9eg0NfHMQDpS/Hr8MneXuOOlUOH2s9ZR0zVPsEwR1kqV1GNEmPbAz1tiLrGLwH3r /UBzyVFjBrdeP4gAJt4/ =DpB8 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20160328.0' into staging VFIO updates 2016-03-28 - Use 128bit math to avoid asserts with IOMMU regions (Bandan Das) # gpg: Signature made Mon 28 Mar 2016 23:16:52 BST using RSA key ID 3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" * remotes/awilliam/tags/vfio-update-20160328.0: vfio: convert to 128 bit arithmetic calculations when adding mem regions Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7cd592bc65
@ -323,7 +323,7 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
||||
{
|
||||
VFIOContainer *container = container_of(listener, VFIOContainer, listener);
|
||||
hwaddr iova, end;
|
||||
Int128 llend;
|
||||
Int128 llend, llsize;
|
||||
void *vaddr;
|
||||
int ret;
|
||||
|
||||
@ -349,12 +349,12 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
||||
if (int128_ge(int128_make64(iova), llend)) {
|
||||
return;
|
||||
}
|
||||
end = int128_get64(llend);
|
||||
end = int128_get64(int128_sub(llend, int128_one()));
|
||||
|
||||
if ((iova < container->min_iova) || ((end - 1) > container->max_iova)) {
|
||||
if ((iova < container->min_iova) || (end > container->max_iova)) {
|
||||
error_report("vfio: IOMMU container %p can't map guest IOVA region"
|
||||
" 0x%"HWADDR_PRIx"..0x%"HWADDR_PRIx,
|
||||
container, iova, end - 1);
|
||||
container, iova, end);
|
||||
ret = -EFAULT;
|
||||
goto fail;
|
||||
}
|
||||
@ -364,7 +364,7 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
||||
if (memory_region_is_iommu(section->mr)) {
|
||||
VFIOGuestIOMMU *giommu;
|
||||
|
||||
trace_vfio_listener_region_add_iommu(iova, end - 1);
|
||||
trace_vfio_listener_region_add_iommu(iova, end);
|
||||
/*
|
||||
* FIXME: We should do some checking to see if the
|
||||
* capabilities of the host VFIO IOMMU are adequate to model
|
||||
@ -395,13 +395,16 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
||||
section->offset_within_region +
|
||||
(iova - section->offset_within_address_space);
|
||||
|
||||
trace_vfio_listener_region_add_ram(iova, end - 1, vaddr);
|
||||
trace_vfio_listener_region_add_ram(iova, end, vaddr);
|
||||
|
||||
ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly);
|
||||
llsize = int128_sub(llend, int128_make64(iova));
|
||||
|
||||
ret = vfio_dma_map(container, iova, int128_get64(llsize),
|
||||
vaddr, section->readonly);
|
||||
if (ret) {
|
||||
error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
|
||||
"0x%"HWADDR_PRIx", %p) = %d (%m)",
|
||||
container, iova, end - iova, vaddr, ret);
|
||||
container, iova, int128_get64(llsize), vaddr, ret);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user