Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp415595pxf; Wed, 31 Mar 2021 06:42:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzosF5iOmdecxr+bIgEF2C+Mw9lWGN+ZOvLBNbUeCLIcXrg4mwJ6poDxXPhty52GcVkdwm7 X-Received: by 2002:a17:906:1182:: with SMTP id n2mr3643165eja.234.1617198130636; Wed, 31 Mar 2021 06:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617198130; cv=none; d=google.com; s=arc-20160816; b=Fd/9gm6tk7cTE6+1On+0yZoXQTxwZo+KMsjNQzJRVIPWYXG+YUULePXZnVEcIUE0eZ PX16k/5YQcBQ9r5ydj6Uwepzop6oDcFWGcSQr5sZTfXKN6ZPAqs2NoKPeHRqQMB6VZXx 4wWUpVmLYXZxjo3iyuaS9wm7R/Oo1epOfkzj+4RfE/X5tqCbb2/97Mj/IOvr5NtWZ0N/ rELniT6eWX9x01YYPXBJ8Qum3/YRlxksP7zxTrzfZvNHLtMYRVbmR9z/qCO/LY6ItlOH AQiuVZIyy7Ij/g18etMKn5d3C7c0ROdUYHw2hiPYq5+OVCQosNMtXSPq6T0cPpFOxUoD Ax+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=7F1deS5QWVK4KYnOzaLbhNHQC6aug03ApEK2A2NzYGA=; b=yFkdzkGJsr93BMa6kkaR41LgPoBazAsnXC5kO8BeChQdnTFkK2vzxblx+/d4BULhS+ YTQFn1pt02Uwm9VY0eSY9ZschtCUjcBYr6HSARX6/VkEiSMoslrj83A+1NOjXZzN+KYb Aa1koaB/sS/4OaB+w/vhXn7VfXWm5pMgfZgZHpqi3uiA1QsyBbW5awDlMk2STwOd6XC0 GPWaWz+WKtsjzf9lF5Be8KPPSNGF0tO+9UUr2Ox3/m5VEXaFXhoucEJVFDaLMysWDmDJ OnRok0b81g/ehoLF1TPssKc4qMnAUbcwv+GJH+t4e0nemjYmCU8RUvgN/N7SMgGu60gK yI+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H43yUMdS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx25si1850304edb.242.2021.03.31.06.41.47; Wed, 31 Mar 2021 06:42:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H43yUMdS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235945AbhCaNke (ORCPT + 99 others); Wed, 31 Mar 2021 09:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235993AbhCaNkL (ORCPT ); Wed, 31 Mar 2021 09:40:11 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B67C06175F for ; Wed, 31 Mar 2021 06:40:10 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id u20so23842614lja.13 for ; Wed, 31 Mar 2021 06:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7F1deS5QWVK4KYnOzaLbhNHQC6aug03ApEK2A2NzYGA=; b=H43yUMdSWba5CkZEw+Cqmmn7i4lFJ/UW3UcmfVjvwhoJFqyAJ+/8/4cTEcyYPG8bbH dsTQmmErgLzmewm2gjllG3X4poLoKENQVXhYC4IyArHGJbZpa5KVIi2kMNxU082JQeSI D4kkZIqNxUHr/QdWRiy4yDOAMcXaab27tJQUUiWIVd2moAeylcLBuQNRxChBNa4cgLLd Z3irhXRGAyIj8/DI9abbrA8pigSviyJ8mbrrE03WZYYkig7Lktj/RUNA1v7vu/FX3vpd 123lof+XmUeB8yk0Hxa64AM94RRyzUdnSJoADFmc4FJUa/TvU6eUSI42BZ524KUD/6yx t2AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7F1deS5QWVK4KYnOzaLbhNHQC6aug03ApEK2A2NzYGA=; b=nS0+z6SPu7VRCoBbiDT7gkUT0+zzrPgiaJ8FFeFKug5nJH7ZxfC7hWPy3d+JolIrPQ l2U+q2gcCPRe1M1gq7u82yvntIqwIe+I+EoVIukHMjzkcE8T3tyuv5RzubXf+/PaKdaS JOFp9qyy5RIuT0QTKf5DXfYOroi5zgyXkOMb7EmXf9b4u7Q+41hiHjG0NgQonFUiJCzH 0iWNnXetgnGzKH3wMCLr/xDUctWCpzf2wDacrwN/c7HD0WI5gtrUGk8QqZhNe7Ypck1J AWXoZBdrQIG8uGWVRHxo8xn9yuFE+bTw3GdyP5fsthDyQSSTYnmLvZwi52KknCv1Pauk ACtg== X-Gm-Message-State: AOAM532qu76p9HNIYDIsXODfZvB3ocBWWB3Zig3uGqX9zxrB1lozeRzY hPRQXqBKgZxt50eWx3QpXOEgQ3iE9J9iVA== X-Received: by 2002:a2e:9857:: with SMTP id e23mr2182526ljj.78.1617198008818; Wed, 31 Mar 2021 06:40:08 -0700 (PDT) Received: from [192.168.1.211] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id b25sm237748lff.268.2021.03.31.06.40.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Mar 2021 06:40:08 -0700 (PDT) Subject: Re: [PATCH v2] drm/msm: a6xx: Make sure the SQE microcode is safe To: Jordan Crouse , linux-arm-msm@vger.kernel.org Cc: Akhil P Oommen , Daniel Vetter , David Airlie , Eric Anholt , Jonathan Marek , Rob Clark , Sai Prakash Ranjan , Sean Paul , Sharat Masetty , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20210210005205.783377-1-jcrouse@codeaurora.org> From: Dmitry Baryshkov Message-ID: Date: Wed, 31 Mar 2021 16:40:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210210005205.783377-1-jcrouse@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On 10/02/2021 03:52, Jordan Crouse wrote: > Most a6xx targets have security issues that were fixed with new versions > of the microcode(s). Make sure that we are booting with a safe version of > the microcode for the target and print a message and error if not. > > v2: Add more informative error messages and fix typos > > Signed-off-by: Jordan Crouse [skipped] > + } else { > + /* > + * a650 tier targets don't need whereami but still need to be > + * equal to or newer than 1.95 for other security fixes > + */ > + if (adreno_is_a650(adreno_gpu)) { > + if ((buf[0] & 0xfff) >= 0x195) { > + ret = true; > + goto out; > + } I think this is incorrect. The latest firmware i have here also fails this check, with the buf[0] = 0x016dd099, so buf[0] & 0xfff = 0x099. Could you please confirm the versioning? > + > + DRM_DEV_ERROR(&gpu->pdev->dev, > + "a650 SQE ucode is too old. Have version %x need at least %x\n", > + buf[0] & 0xfff, 0x195); > + } > + > + /* > + * When a660 is added those targets should return true here > + * since those have all the critical security fixes built in > + * from the start > + */ > + } > +out: > msm_gem_put_vaddr(obj); > + return ret; > } > > static int a6xx_ucode_init(struct msm_gpu *gpu) > @@ -566,7 +611,13 @@ static int a6xx_ucode_init(struct msm_gpu *gpu) > } > > msm_gem_object_set_name(a6xx_gpu->sqe_bo, "sqefw"); > - a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo); > + if (!a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo)) { > + msm_gem_unpin_iova(a6xx_gpu->sqe_bo, gpu->aspace); > + drm_gem_object_put(a6xx_gpu->sqe_bo); > + > + a6xx_gpu->sqe_bo = NULL; > + return -EPERM; > + } > } > > gpu_write64(gpu, REG_A6XX_CP_SQE_INSTR_BASE_LO, -- With best wishes Dmitry