Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422885rdh; Sun, 29 Oct 2023 15:58:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5LomGRldEeGEzA3bq2gD9zVKCz11/DjXvexgQWpoUxYuCNb61KjgTJmcmNi2M0EzgQLsq X-Received: by 2002:a17:902:dac4:b0:1cc:51b8:8100 with SMTP id q4-20020a170902dac400b001cc51b88100mr233777plx.7.1698620312836; Sun, 29 Oct 2023 15:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620312; cv=none; d=google.com; s=arc-20160816; b=Kv12EnqCQUrbuCRaDjU+7UfSiCpwSZLgf/IrJYBlFrztbVsCbfFXAGTwiP2HsNf1S1 E6x/BJigUVjJps4IIf1cgcDLiHV0BPnsVnO63YRbXOh9D8i0YUp7xA0CuZo/hSkF/Q7z MS0e0qJ4sNTmsHOC3tSNGFeGimnU4dnZonNGoYXhKFTSUmoAc9SD7arGIMj5kTSJhVWO lcWb7WT7Dz3Me1Ij8moU7pXk7R2odeJWp60sMgFZKA/BXBomSgCXKAgHZhsxz+RpTurP szK2lVLSjnZ/ORwb9+d+NeIwUY0Iv1TzqlshuIwPmwzfkrzIV3xKzTtJomEIW4awFk89 D2og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o5P+m1pzQrgODFxHOWWGsQ8Y53kPjozmrlgKX4LxsRs=; fh=16YMVjP9Ktj46ZYXBPO/C976eJEvP9DyHZtqDMjmUPo=; b=DCXualRS5HXIe6yW7z9Rj83rT3b+gMXyH+M9sibtQCIZatloi+26V9IdZFg8JdHkzU TYJDmO/Mzg8gP0dDdPbB5kkMIrFyuywovIJEQ/LtJZmvNR5KMAkzBgB679E4G7Y/1Ahi b+zUbyYLEVoxnW6nNz1Q3VLjwevRdecvKGQjhY/FZx0HyZiR2qts3nnPTIhEJPtL++Wk /fyQ6qi1pBvjBhX/DVL8ctXGmcSMfevIwN7TjMtxU3VxZtdL4XVo4NmieVfhc48DBIqV T2PZkSDrpOvAdF6rxG0iRcRJAF8uRbWZiC2wK0H0MYsUyqU3i7fTUv7EwMBZi6Ooij4Q mTYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=po0gwspo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f1-20020a170902684100b001cad3a744aesi4123592pln.153.2023.10.29.15.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:58:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=po0gwspo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 57CA48057DB4; Sun, 29 Oct 2023 15:58:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231325AbjJ2W6Y (ORCPT + 99 others); Sun, 29 Oct 2023 18:58:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231317AbjJ2W6R (ORCPT ); Sun, 29 Oct 2023 18:58:17 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C4F1720; Sun, 29 Oct 2023 15:57:04 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 151A4C4339A; Sun, 29 Oct 2023 22:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620224; bh=7Q9FhoPe2eraIBXpik0bjdEAkFsAsPzqbrBnYZf+BvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=po0gwspoSZ5pO/MJmwPXzmQ56RsbCmcAZpleQa06FQZDpN7vaPo7JRZb7hueLpaXG GlBvIO7dW11mlsKT3Yd2M03rU+KX+JHROpsOviA0C75nknDEslVMQllHSO6LGd1hZ3 aRLxkAzFfklD+gxghbXBNLDeOCPG/dYHv6t2mkxTHr9v+JcpR8VZXG17RkNUNkRUYI N6AKB9T+O1Aa938/ojAeAhEABCbTAKwTnC/DbG044fyBcPz0NU+k0dLFB/aDOC07fU Lz6wDhcW9gglm2TuB3LxvKPZA58GsVKpu889ZL4ABouoTyIH2A4RFg+i1ne8klzpdf Pbyo7OaT/S4IQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stanislaw Gruszka , Karol Wachowski , Sasha Levin , jacek.lawrynowicz@linux.intel.com, ogabbay@kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.5 50/52] Revert "accel/ivpu: Use cached buffers for FW loading" Date: Sun, 29 Oct 2023 18:53:37 -0400 Message-ID: <20231029225441.789781-50-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.9 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:58:30 -0700 (PDT) From: Stanislaw Gruszka [ Upstream commit 610b5d219d1ccac8064556310cc0e62e3c202389 ] This reverts commit 645d694559cab36fe6a57c717efcfa27d9321396. The commit cause issues with memory access from the device side. Switch back to write-combined memory mappings until the issues will be properly addressed. Add extra wmb() needed when boot_params->save_restore_ret_address() is modified. Reviewed-by: Karol Wachowski Signed-off-by: Stanislaw Gruszka Link: https://patchwork.freedesktop.org/patch/msgid/20231017121353.532466-1-stanislaw.gruszka@linux.intel.com Signed-off-by: Sasha Levin --- drivers/accel/ivpu/ivpu_fw.c | 9 ++++----- drivers/accel/ivpu/ivpu_gem.h | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c index 93c69aaa6218d..34e4026c77589 100644 --- a/drivers/accel/ivpu/ivpu_fw.c +++ b/drivers/accel/ivpu/ivpu_fw.c @@ -195,8 +195,7 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) if (ret) return ret; - fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, - DRM_IVPU_BO_CACHED | DRM_IVPU_BO_NOSNOOP); + fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, DRM_IVPU_BO_WC); if (!fw->mem) { ivpu_err(vdev, "Failed to allocate firmware runtime memory\n"); return -ENOMEM; @@ -273,7 +272,7 @@ int ivpu_fw_load(struct ivpu_device *vdev) memset(start, 0, size); } - clflush_cache_range(fw->mem->kvaddr, fw->mem->base.size); + wmb(); /* Flush WC buffers after writing fw->mem */ return 0; } @@ -375,7 +374,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params if (!ivpu_fw_is_cold_boot(vdev)) { boot_params->save_restore_ret_address = 0; vdev->pm->is_warmboot = true; - clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K); + wmb(); /* Flush WC buffers after writing save_restore_ret_address */ return; } @@ -430,7 +429,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params boot_params->punit_telemetry_sram_size = ivpu_hw_reg_telemetry_size_get(vdev); boot_params->vpu_telemetry_enable = ivpu_hw_reg_telemetry_enable_get(vdev); - clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K); + wmb(); /* Flush WC buffers after writing bootparams */ ivpu_fw_boot_params_print(vdev, boot_params); } diff --git a/drivers/accel/ivpu/ivpu_gem.h b/drivers/accel/ivpu/ivpu_gem.h index f4130586ff1b2..6b0ceda5f2537 100644 --- a/drivers/accel/ivpu/ivpu_gem.h +++ b/drivers/accel/ivpu/ivpu_gem.h @@ -8,8 +8,6 @@ #include #include -#define DRM_IVPU_BO_NOSNOOP 0x10000000 - struct dma_buf; struct ivpu_bo_ops; struct ivpu_file_priv; @@ -85,9 +83,6 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo) static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo) { - if (bo->flags & DRM_IVPU_BO_NOSNOOP) - return false; - return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED; } -- 2.42.0