From 86bb766e16858126cbb59f3c6347a203a6038b25 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Tue, 3 Apr 2018 09:13:34 -0700 Subject: gpu: nvgpu: assume 1:1 IPA to PA mapping for syncpt Currently, hyp_read_ipa_pa_info() only translates IPA for RAM mappings. It fails for MMIO mappings. In particular, it will fail when attempting to translate addresses in the syncpoint shim aperture. As a workaround, assume 1:1 IPA to PA mapping when hyp_read_ipa_pa_info fails, and address is in syncpt shim aperture. Bug 2096877 Change-Id: I5267f0a8febf065157910ad3408374cacd398731 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/1687796 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Richard Zhao Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/soc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/common/linux/soc.c b/drivers/gpu/nvgpu/common/linux/soc.c index 22645381..305d8bd9 100644 --- a/drivers/gpu/nvgpu/common/linux/soc.c +++ b/drivers/gpu/nvgpu/common/linux/soc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -67,8 +67,21 @@ static u64 nvgpu_tegra_hv_ipa_pa(struct gk20a *g, u64 ipa) err = hyp_read_ipa_pa_info(&info, platform->vmid, ipa); if (err < 0) { - nvgpu_err(g, "ipa=%llx translation failed vmid=%u err=%d", + /* WAR for bug 2096877 + * hyp_read_ipa_pa_info only looks up RAM mappings. + * assume one to one IPA:PA mapping for syncpt aperture + */ + u64 start = g->syncpt_unit_base; + u64 end = g->syncpt_unit_base + g->syncpt_unit_size; + if ((ipa >= start) && (ipa < end)) { + pa = ipa; + nvgpu_log(g, gpu_dbg_map_v, + "ipa=%llx vmid=%d -> pa=%llx (SYNCPT)\n", + ipa, platform->vmid, pa); + } else { + nvgpu_err(g, "ipa=%llx translation failed vmid=%u err=%d", ipa, platform->vmid, err); + } } else { pa = info.base + info.offset; nvgpu_log(g, gpu_dbg_map_v, -- cgit v1.2.2