From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CEC8C6379F for ; Tue, 14 Feb 2023 02:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229545AbjBNCKG (ORCPT ); Mon, 13 Feb 2023 21:10:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbjBNCKG (ORCPT ); Mon, 13 Feb 2023 21:10:06 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 480EA13DDB for ; Mon, 13 Feb 2023 18:10:04 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id d8so16827418ljq.9 for ; Mon, 13 Feb 2023 18:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3krWooVaD7gxI/MuHJdJwJLEDhxVnEkT/xDyRE1I7q4=; b=GXJrXEqNRD1mVB/HSZOcdpX+RH6803clEiJVhlmWpeODDuRt5paX0sitpBcn9QRxaB BqwlEu+LCHuD8w2zEyLpbpaTSt50acsBW9rWOXIk7p+KgTZepLzLUJ+APqbgyZ/+Lqms FvlET0dgS24fIC8BU1xbv8rC9zFNIefN9IU//IKYcIKlPVO81E5t097UjGGtb4KTC/6l nmXO92fBNxi4NyGqYE2ZQXyBFKaaekXjVPWaYijTXxpwnEhoR4zPY/Oi218infdOOpcx Uep8iDffbXxvCNIJ79cJAHwkWRVYS/SldkLCunrSRwheIZ5AxehP3cfhZLVdzbbqMc7q uPrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3krWooVaD7gxI/MuHJdJwJLEDhxVnEkT/xDyRE1I7q4=; b=3/nkL8nBv7nkJBNPsFhUkyRnOXUBsc6gvmtE1XKpYIOjZEtpKtUAJzsU3rJ7b6T/Uz OKM8i4IFFJb0PE3yVIWy6yEzZwLDNTmX8de7foScfTleBe6xsbpHD3vkEX5ehV0jKm1O eGojnwjWd45izOOT4xWYS1OjIgJgJYhEpcMrHhE1L8XGoiQ4dV7rCQd6P9Iodj7LC61w 9zOPNi9j0ls5+3YaIrxRgSoAyYvFk781W+/Beh37M0+UR7VuOFQjff5yYI2bpVvhpdWq 6XWqMqjXqtWaCZZRQlZNBla8fzD5FY3oKch7r1a++91BYRpKVfzS3t/W4yO7eRXkD3mO VUYg== X-Gm-Message-State: AO0yUKWPI2HNngXVMjZd6Tmj71WvrGaMwFZWJDRz/EFd+/UPS0yRBIaO ozyvG2NRgcFE5xbw3Hpg8rj6Og== X-Google-Smtp-Source: AK7set/INJUhsu9dINYFmoXc80j9iZnt4BbCJb6ebVarThokQgjPgR6cbE8l2ONMPwLmrHUW7Y2IHg== X-Received: by 2002:a2e:9813:0:b0:28b:5621:7be with SMTP id a19-20020a2e9813000000b0028b562107bemr218378ljj.35.1676340602613; Mon, 13 Feb 2023 18:10:02 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j17-20020a2eb711000000b0029066c8906dsm2239518ljo.23.2023.02.13.18.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 18:10:02 -0800 (PST) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Yassine Oudjana , Jami Kettunen Subject: [PATCH 4/4] drm/msm/a5xx: fix context faults during ring switch Date: Tue, 14 Feb 2023 05:09:56 +0300 Message-Id: <20230214020956.164473-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230214020956.164473-1-dmitry.baryshkov@linaro.org> References: <20230214020956.164473-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The rptr_addr is set in the preempt_init_ring(), which is called from a5xx_gpu_init(). It uses shadowptr() to set the address, however the shadow_iova is not yet initialized at that time. Move the rptr_addr setting to the a5xx_preempt_hw_init() which is called after setting the shadow_iova, getting the correct value for the address. Fixes: 8907afb476ac ("drm/msm: Allow a5xx to mark the RPTR shadow as privileged") Suggested-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c index 7e0affd60993..f58dd564d122 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c @@ -207,6 +207,7 @@ void a5xx_preempt_hw_init(struct msm_gpu *gpu) a5xx_gpu->preempt[i]->wptr = 0; a5xx_gpu->preempt[i]->rptr = 0; a5xx_gpu->preempt[i]->rbase = gpu->rb[i]->iova; + a5xx_gpu->preempt[i]->rptr_addr = shadowptr(a5xx_gpu, gpu->rb[i]); } /* Write a 0 to signal that we aren't switching pagetables */ @@ -257,7 +258,6 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, ptr->data = 0; ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE; - ptr->rptr_addr = shadowptr(a5xx_gpu, ring); ptr->counter = counters_iova; return 0; -- 2.30.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 062ADC636CC for ; Tue, 14 Feb 2023 02:10:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43D2A10E7DB; Tue, 14 Feb 2023 02:10:13 +0000 (UTC) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61FAD10E7C7 for ; Tue, 14 Feb 2023 02:10:04 +0000 (UTC) Received: by mail-lj1-x234.google.com with SMTP id x29so16931995ljq.0 for ; Mon, 13 Feb 2023 18:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3krWooVaD7gxI/MuHJdJwJLEDhxVnEkT/xDyRE1I7q4=; b=GXJrXEqNRD1mVB/HSZOcdpX+RH6803clEiJVhlmWpeODDuRt5paX0sitpBcn9QRxaB BqwlEu+LCHuD8w2zEyLpbpaTSt50acsBW9rWOXIk7p+KgTZepLzLUJ+APqbgyZ/+Lqms FvlET0dgS24fIC8BU1xbv8rC9zFNIefN9IU//IKYcIKlPVO81E5t097UjGGtb4KTC/6l nmXO92fBNxi4NyGqYE2ZQXyBFKaaekXjVPWaYijTXxpwnEhoR4zPY/Oi218infdOOpcx Uep8iDffbXxvCNIJ79cJAHwkWRVYS/SldkLCunrSRwheIZ5AxehP3cfhZLVdzbbqMc7q uPrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3krWooVaD7gxI/MuHJdJwJLEDhxVnEkT/xDyRE1I7q4=; b=2EAqLSMUP9qU9lk17/WI+Cl2JoqCFiEaReI1d5LhkoiJar6w6LRxxnD0qpuMlXnbx7 oSbelIJJQsyr5B2oFti2iO485KU0JvUoKp8/phUnrnL1vxxYLLWOn4AjnJLkbSCgmLP/ HUVTBf7OurS6zTK5r6YdznYVMbWqVMWH1uuEI9ODSOgOQzBQm0dkwjenWq61lAbR8Gko sKsdS301CfnZIeQLi2Qu6/uPAvDaQ4XiDD4/bURTZGDl4ErVRbr7gOp/oSSHquL7tWSz Wm8mV6aFbrXFmgt5nXJ/7Z8DxCr7UdrGsP0mMNJSTmzpgSA16PLG+cv0/fPwvwuKOYAn 1NZg== X-Gm-Message-State: AO0yUKXRGCb+wYpp4BJVZuunwJXvG6TyxuEpWZ+m1Xi/7B/yjI9I9uK7 A1M8tpdfOxTELyllYb+J96GXHQ== X-Google-Smtp-Source: AK7set/INJUhsu9dINYFmoXc80j9iZnt4BbCJb6ebVarThokQgjPgR6cbE8l2ONMPwLmrHUW7Y2IHg== X-Received: by 2002:a2e:9813:0:b0:28b:5621:7be with SMTP id a19-20020a2e9813000000b0028b562107bemr218378ljj.35.1676340602613; Mon, 13 Feb 2023 18:10:02 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j17-20020a2eb711000000b0029066c8906dsm2239518ljo.23.2023.02.13.18.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 18:10:02 -0800 (PST) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH 4/4] drm/msm/a5xx: fix context faults during ring switch Date: Tue, 14 Feb 2023 05:09:56 +0300 Message-Id: <20230214020956.164473-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230214020956.164473-1-dmitry.baryshkov@linaro.org> References: <20230214020956.164473-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: freedreno@lists.freedesktop.org, Yassine Oudjana , linux-arm-msm@vger.kernel.org, Bjorn Andersson , dri-devel@lists.freedesktop.org, Stephen Boyd , Jami Kettunen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The rptr_addr is set in the preempt_init_ring(), which is called from a5xx_gpu_init(). It uses shadowptr() to set the address, however the shadow_iova is not yet initialized at that time. Move the rptr_addr setting to the a5xx_preempt_hw_init() which is called after setting the shadow_iova, getting the correct value for the address. Fixes: 8907afb476ac ("drm/msm: Allow a5xx to mark the RPTR shadow as privileged") Suggested-by: Rob Clark Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c index 7e0affd60993..f58dd564d122 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c @@ -207,6 +207,7 @@ void a5xx_preempt_hw_init(struct msm_gpu *gpu) a5xx_gpu->preempt[i]->wptr = 0; a5xx_gpu->preempt[i]->rptr = 0; a5xx_gpu->preempt[i]->rbase = gpu->rb[i]->iova; + a5xx_gpu->preempt[i]->rptr_addr = shadowptr(a5xx_gpu, gpu->rb[i]); } /* Write a 0 to signal that we aren't switching pagetables */ @@ -257,7 +258,6 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, ptr->data = 0; ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE; - ptr->rptr_addr = shadowptr(a5xx_gpu, ring); ptr->counter = counters_iova; return 0; -- 2.30.2