Skip to content

Commit 0aa2c23

Browse files
xiaoguangwuwenlingz
authored andcommitted
hv: change GPU passthru translation mode to TT_PASSTHROUGH
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]>
1 parent 6435259 commit 0aa2c23

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

hypervisor/arch/x86/vtd.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <board.h>
2323
#include <vm_config.h>
2424
#include <pci.h>
25+
#include <vm.h>
2526

2627
#define DBG_IOMMU 0
2728

@@ -1136,6 +1137,21 @@ static int32_t iommu_attach_device(struct iommu_domain *domain, uint8_t bus, uin
11361137
pr_err("dmaru[%d] doesn't support trans passthrough", dmar_unit->index);
11371138
ret = -ENODEV;
11381139
}
1140+
} else if ((bus == ((CONFIG_GPU_SBDF >> 8) & 0xFFU)) && (devfun == (CONFIG_GPU_SBDF & 0xFFU))) {
1141+
hi_64 = dmar_set_bitslice(hi_64,
1142+
CTX_ENTRY_UPPER_AW_MASK, CTX_ENTRY_UPPER_AW_POS, (uint64_t)width_to_agaw(domain->addr_width));
1143+
1144+
/* TODO: This is a GVT-G WA to resolve invisible cursor issue in Guest. But this change is harmlessly
1145+
* due to benefits for SOS graphic performance. Will revisit how much benefits after root cause the
1146+
* cursor issue, then determine if it needs to revert or not.
1147+
*/
1148+
if (is_sos_vm(get_vm_from_vmid(domain->vm_id))) {
1149+
lo_64 = dmar_set_bitslice(lo_64,
1150+
CTX_ENTRY_LOWER_TT_MASK, CTX_ENTRY_LOWER_TT_POS, DMAR_CTX_TT_PASSTHROUGH);
1151+
} else {
1152+
lo_64 = dmar_set_bitslice(lo_64,
1153+
CTX_ENTRY_LOWER_TT_MASK, CTX_ENTRY_LOWER_TT_POS, DMAR_CTX_TT_UNTRANSLATED);
1154+
}
11391155
} else {
11401156
/* TODO: add Device TLB support */
11411157
hi_64 = dmar_set_bitslice(hi_64,

0 commit comments

Comments
 (0)