Skip to content

Commit

Permalink
hv: change GPU passthru translation mode to TT_PASSTHROUGH
Browse files Browse the repository at this point in the history
This is a WA to fix the invisible cursor issue. The TT_PASSTHROUGH
mode will not use iommu to do the address translation.

Tracked-On: #4509
Signed-off-by: Xiaoguang Wu <[email protected]>
Reviewed-by: Zhao Yakui <[email protected]>
  • Loading branch information
xiaoguangwu authored and wenlingz committed Mar 20, 2020
1 parent 6435259 commit 0aa2c23
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hypervisor/arch/x86/vtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <board.h>
#include <vm_config.h>
#include <pci.h>
#include <vm.h>

#define DBG_IOMMU 0

Expand Down Expand Up @@ -1136,6 +1137,21 @@ static int32_t iommu_attach_device(struct iommu_domain *domain, uint8_t bus, uin
pr_err("dmaru[%d] doesn't support trans passthrough", dmar_unit->index);
ret = -ENODEV;
}
} else if ((bus == ((CONFIG_GPU_SBDF >> 8) & 0xFFU)) && (devfun == (CONFIG_GPU_SBDF & 0xFFU))) {
hi_64 = dmar_set_bitslice(hi_64,
CTX_ENTRY_UPPER_AW_MASK, CTX_ENTRY_UPPER_AW_POS, (uint64_t)width_to_agaw(domain->addr_width));

/* TODO: This is a GVT-G WA to resolve invisible cursor issue in Guest. But this change is harmlessly
* due to benefits for SOS graphic performance. Will revisit how much benefits after root cause the
* cursor issue, then determine if it needs to revert or not.
*/
if (is_sos_vm(get_vm_from_vmid(domain->vm_id))) {
lo_64 = dmar_set_bitslice(lo_64,
CTX_ENTRY_LOWER_TT_MASK, CTX_ENTRY_LOWER_TT_POS, DMAR_CTX_TT_PASSTHROUGH);
} else {
lo_64 = dmar_set_bitslice(lo_64,
CTX_ENTRY_LOWER_TT_MASK, CTX_ENTRY_LOWER_TT_POS, DMAR_CTX_TT_UNTRANSLATED);
}
} else {
/* TODO: add Device TLB support */
hi_64 = dmar_set_bitslice(hi_64,
Expand Down

0 comments on commit 0aa2c23

Please sign in to comment.