intel_iommu.c (8ffa52c20d5693d454f65f2024a1494edfea65d4) intel_iommu.c (ff5b5d5b6df5655946142820912b28f1a67efc94)
1/*
2 * QEMU emulation of an Intel IOMMU (VT-d)
3 * (DMA Remapping device)
4 *
5 * Copyright (C) 2013 Knut Omang, Oracle <knut.omang@oracle.com>
6 * Copyright (C) 2014 Le Tan, <tamlokveer@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 2342 unchanged lines hidden (view full) ---

2351{
2352 uint16_t domain_id;
2353 uint8_t am;
2354 hwaddr addr;
2355
2356 if ((inv_desc->lo & VTD_INV_DESC_IOTLB_RSVD_LO) ||
2357 (inv_desc->hi & VTD_INV_DESC_IOTLB_RSVD_HI)) {
2358 error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
1/*
2 * QEMU emulation of an Intel IOMMU (VT-d)
3 * (DMA Remapping device)
4 *
5 * Copyright (C) 2013 Knut Omang, Oracle <knut.omang@oracle.com>
6 * Copyright (C) 2014 Le Tan, <tamlokveer@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 2342 unchanged lines hidden (view full) ---

2351{
2352 uint16_t domain_id;
2353 uint8_t am;
2354 hwaddr addr;
2355
2356 if ((inv_desc->lo & VTD_INV_DESC_IOTLB_RSVD_LO) ||
2357 (inv_desc->hi & VTD_INV_DESC_IOTLB_RSVD_HI)) {
2358 error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2359 ", lo=0x%"PRIx64" (reserved bits unzero)\n",
2359 ", lo=0x%"PRIx64" (reserved bits unzero)",
2360 __func__, inv_desc->hi, inv_desc->lo);
2361 return false;
2362 }
2363
2364 switch (inv_desc->lo & VTD_INV_DESC_IOTLB_G) {
2365 case VTD_INV_DESC_IOTLB_GLOBAL:
2366 vtd_iotlb_global_invalidate(s);
2367 break;

--- 4 unchanged lines hidden (view full) ---

2372 break;
2373
2374 case VTD_INV_DESC_IOTLB_PAGE:
2375 domain_id = VTD_INV_DESC_IOTLB_DID(inv_desc->lo);
2376 addr = VTD_INV_DESC_IOTLB_ADDR(inv_desc->hi);
2377 am = VTD_INV_DESC_IOTLB_AM(inv_desc->hi);
2378 if (am > VTD_MAMV) {
2379 error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2360 __func__, inv_desc->hi, inv_desc->lo);
2361 return false;
2362 }
2363
2364 switch (inv_desc->lo & VTD_INV_DESC_IOTLB_G) {
2365 case VTD_INV_DESC_IOTLB_GLOBAL:
2366 vtd_iotlb_global_invalidate(s);
2367 break;

--- 4 unchanged lines hidden (view full) ---

2372 break;
2373
2374 case VTD_INV_DESC_IOTLB_PAGE:
2375 domain_id = VTD_INV_DESC_IOTLB_DID(inv_desc->lo);
2376 addr = VTD_INV_DESC_IOTLB_ADDR(inv_desc->hi);
2377 am = VTD_INV_DESC_IOTLB_AM(inv_desc->hi);
2378 if (am > VTD_MAMV) {
2379 error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2380 ", lo=0x%"PRIx64" (am=%u > VTD_MAMV=%u)\n",
2380 ", lo=0x%"PRIx64" (am=%u > VTD_MAMV=%u)",
2381 __func__, inv_desc->hi, inv_desc->lo,
2382 am, (unsigned)VTD_MAMV);
2383 return false;
2384 }
2385 vtd_iotlb_page_invalidate(s, domain_id, addr, am);
2386 break;
2387
2388 default:
2389 error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2381 __func__, inv_desc->hi, inv_desc->lo,
2382 am, (unsigned)VTD_MAMV);
2383 return false;
2384 }
2385 vtd_iotlb_page_invalidate(s, domain_id, addr, am);
2386 break;
2387
2388 default:
2389 error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2390 ", lo=0x%"PRIx64" (type mismatch: 0x%llx)\n",
2390 ", lo=0x%"PRIx64" (type mismatch: 0x%llx)",
2391 __func__, inv_desc->hi, inv_desc->lo,
2392 inv_desc->lo & VTD_INV_DESC_IOTLB_G);
2393 return false;
2394 }
2395 return true;
2396}
2397
2398static bool vtd_process_inv_iec_desc(IntelIOMMUState *s,

--- 1502 unchanged lines hidden ---
2391 __func__, inv_desc->hi, inv_desc->lo,
2392 inv_desc->lo & VTD_INV_DESC_IOTLB_G);
2393 return false;
2394 }
2395 return true;
2396}
2397
2398static bool vtd_process_inv_iec_desc(IntelIOMMUState *s,

--- 1502 unchanged lines hidden ---