From patchwork Tue Dec 1 08:53:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 335121 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp5503379ilb; Tue, 1 Dec 2020 01:28:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhdgrIWu2sIIEysM+c/rdnBmUd2qtdb6qYHzZpvbWBZEkdCm0ERXDvrSt7xWZYIlImODPK X-Received: by 2002:a17:906:385:: with SMTP id b5mr2134808eja.194.1606814917943; Tue, 01 Dec 2020 01:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606814917; cv=none; d=google.com; s=arc-20160816; b=a2uLDJu/HNbG//9Uj3NN/5Ha/NAlA/rlN0TKOT5U+aiWgu2YHIMVrzFiB7/JJUO8o2 ag1IHVG3oTtEDSWVA1iccHVDgAaaRscVqrkO+JEwNrln8/LVV2hwzdvYp8iuRI+ZHEMp 2NlpRAfctTZFBkgsopiSNsNatSfh9HHY4nUGfsVGpiybgm54Wc+yvp5T5eoQ/wndT9bi Vn5FujzI9DhcaatoSAfAGbD0h6tvt9fZiyvSxlJ7AJtcr0ASwbaHjWMLzr10a9Tk4t0B RaaQZYEpQsjXgCd5NJMxM/to8dO+Yddy1l955YU5XNt9NaXzmL6WHdHISQLmRfvGqhDN XMaA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xCpFST0PYEyZedi52+Mh1ygaI6iAzan/0DG2KzKmssI=; b=hDw8cQMx53HvF2oOBB8ItDc4mWyHaGnm4rXSEra/Ffc1sFhxDg/LW8Krcbey/3RPrc VhNVciuVDqSjRqSlKQTkD5EuaWvgLjhM46LFZvRy/hpoKNEJNp/0UCbCsT0ZA3spf/3q 9w23EzWvSdusGm16/HICf2FkeiTU9pG8M5TCLI3Pfpy/v1fIWANRqDxLR5+8TJYQhGKD r3ozP9eZ4abINr0nBXhe4ezp+WoyrdehUZpidz3XjspZWpdwuiQ752ta93P84acaqncC OOZ4vJoxFsFKJbnfL92TFnaPb6x8A2kua6VGEX8ufVDL3Vlzt2xKKcGFluN1/udxTekn s5SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpA2JkI8; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz20si626977ejc.177.2020.12.01.01.28.37; Tue, 01 Dec 2020 01:28:37 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=wpA2JkI8; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387400AbgLAJZr (ORCPT + 14 others); Tue, 1 Dec 2020 04:25:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:42250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729359AbgLAJFd (ORCPT ); Tue, 1 Dec 2020 04:05:33 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D5A220809; Tue, 1 Dec 2020 09:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813517; bh=kv9VnM2SU4WJoCphbb6ScV7W9Q0DRF2CQiTVHDHoAO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpA2JkI8FRDpa9MLz1tbHzw8m7xHUsD8ylkochNmNCL54OgqVAhuVkEJwx0+gPngc NH5kNmSCccLYtRFireVE0rVkVe8ZlgnQ3yj8uPzqnM6siFQjaTkSE/61/Enueugmvb FTeD6SFebox6ZBswHkWRvbtMIo7Ysh7ca80F9SeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rui Miguel Silva , Jens Wiklander , Sasha Levin Subject: [PATCH 5.4 67/98] optee: add writeback to valid memory type Date: Tue, 1 Dec 2020 09:53:44 +0100 Message-Id: <20201201084658.365781307@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084652.827177826@linuxfoundation.org> References: <20201201084652.827177826@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rui Miguel Silva [ Upstream commit 853735e404244f5496cdb6188c5ed9a0f9627ee6 ] Only in smp systems the cache policy is setup as write alloc, in single cpu systems the cache policy is set as writeback and it is normal memory, so, it should pass the is_normal_memory check in the share memory registration. Add the right condition to make it work in no smp systems. Fixes: cdbcf83d29c1 ("tee: optee: check type of registered shared memory") Signed-off-by: Rui Miguel Silva Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin --- drivers/tee/optee/call.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c index cf2367ba08d63..aadedec3bfe7b 100644 --- a/drivers/tee/optee/call.c +++ b/drivers/tee/optee/call.c @@ -530,7 +530,8 @@ void optee_free_pages_list(void *list, size_t num_entries) static bool is_normal_memory(pgprot_t p) { #if defined(CONFIG_ARM) - return (pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC; + return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) || + ((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK)); #elif defined(CONFIG_ARM64) return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL); #else