Message ID | 20240227140500.98077-1-W_Armin@gmx.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-83369-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2722873dyb; Tue, 27 Feb 2024 06:15:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXoPFC4a6H8trKqthQzepFrF1qaX2k1TUNMITBfZudYu4p4s+Fln1rr0y7xlvpZbjEOekZcX/AAO94Lu2JBNSvnhs/lFw== X-Google-Smtp-Source: AGHT+IGjJFHgW7O/Fn4184R3izxIfKudjzDd2OuNjF9V/IIe8pxHkFzf90hSbdt1NizeKwjMcylW X-Received: by 2002:a17:902:ec85:b0:1dc:7845:537c with SMTP id x5-20020a170902ec8500b001dc7845537cmr11104021plg.1.1709043315428; Tue, 27 Feb 2024 06:15:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709043315; cv=pass; d=google.com; s=arc-20160816; b=vxNPG8OVpsGd4Uob0gDa4ezp1uTrZv+ZYKQOpQwfXL48L/r9tf7nrvDLeiYqAGs6JA eUFK+bMHNdIGUNpQkbvB7WJLhrTCuPjzWUeGChPX1g19gaf6Ce29yk2gtawDAVAD3V8v tzqgOUWjIntbZRd6cJnbf0fniP9qt9VySkpLOD0KX/utFz5VMoCbkeY0HPTqqI6sbDe+ maf1rhdLHTgE1LquvPp6kNC1Yxhrs/sjWF5EhsJQsfDzndPOxPaj6mlK7sj1JesOASTD CkbkdEFTcPVpZos3CsfZU27zDTMY+wuFWjGWznsCzgaA8QUElWe7crw9Fw9vErCx32G0 G/Mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=0D1BijnrnxtriSO7yJcKAd0RfreEyrQNsga9+rFa89s=; fh=Iw0cdpf9yN87ufu137c7ThcNR/cLOoX+JIMwqQQfbho=; b=j73U1T+7fLvrMTB5m9YY7pgDNOs8gz1Gk9hdwADR8Ks+tz3YMXDQZQQ7q7oFeXyvGm RRPpL2q7Fq0FHhmKLgvH9zH4tjCIIFzQWs0Ios+yibP2IEaGLGCBpUj90t2LS/dZ16KA 7+alqUgL6VE5+OOBVBlsQwt0Y/BSMNq+Fu/5bBRgxd9gxXACpKUedAhHWs2gNcBxcFUy VhhXLsqUIQHRD4tLiaBithP1AOt64LtfRiIfj8QACIE735bv6CRC+nCuWVTUr3SRkwZR 6wxuOiXcCEbbGPa6HBD7OFpFJvuVdPRdNGm0SeIPFCU/ls1QUmMDIc3L616RqJcL24Np 5vZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=c0MEvqrL; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-83369-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83369-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k16-20020a628410000000b006e508074d91si4538307pfd.107.2024.02.27.06.15.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 06:15:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83369-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=c0MEvqrL; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-83369-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83369-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 78B8D289129 for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 14:05:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BF61143C46; Tue, 27 Feb 2024 14:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="c0MEvqrL" Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69E831420B3; Tue, 27 Feb 2024 14:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709042714; cv=none; b=INTEF96AEvgIYobPj4csHHaD7Y5NpGz2XlVsxP7vkz/0E223W4knIwjOBMK51rfmK40fHcef4Msn9KMTZ5n4YnKG5kfoBIk5VmNFkPsaiMxnm99CnZRDb/gtVBxizEteAATYdW4/bJus7U8aAV3uQQxRHHvzH03M8RucD1lU0gA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709042714; c=relaxed/simple; bh=ROXC9XFT8HNDRbWxYhHY2D/L904usz1YVAl5inJlhGk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=iaoNciAwzidJ+1OyoG29xYPPSQN2APuChnYf0xfQnBu1LhdeM9I0rnO0PclprcNyA2i6GA/s5Uc/rsrodwwt0XYyXsOQ7GOBaSE7ylG8jWY7KfPT1zXH+bPQTW84bhm7a0y+t3dENjsueeckXJDmO3iPTpbq/YDttlRDLMSFDUE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=c0MEvqrL; arc=none smtp.client-ip=212.227.15.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1709042702; x=1709647502; i=w_armin@gmx.de; bh=ROXC9XFT8HNDRbWxYhHY2D/L904usz1YVAl5inJlhGk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=c0MEvqrLpDu70Jk33JtQbIIL3fUa9sTy35IY8UOIk0VLjsJiCFQVGeXN3L+KyjDs jHkdtbcDSPswuytfPIhzI3ZZyar6B7SgdirnUFc2KTJ/LlDegphMZiPo31ExskrfG LnkvVXZiGy9UWKlVHjMuJ9nzcaN9W29uOSmcgaFXQlGgaSES/eg5oi1KeMQnNLDS7 XsueaguuGM59/SXCLgGWbYACaRzL6WFHGtkzgRAu4omW/NCbb/JHoIWWTxwiQbFKp NYV6eDYBZFPXBWhulxRzVCoRj0oyF44lPIyoe/OZQgWYpIeoUMGlmyMTgF4uXZpeb cZjWCctw5NJ8/P1ucw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbAcs-1r3QOs2Sfw-00beWD; Tue, 27 Feb 2024 15:05:02 +0100 From: Armin Wolf <W_Armin@gmx.de> To: Shyam-sundar.S-k@amd.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] platform/x86/amd/pmf: Do not use readl() for policy buffer access Date: Tue, 27 Feb 2024 15:04:59 +0100 Message-Id: <20240227140500.98077-1-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:C6aJtexdwYmUh9Ddv7QlNY/6bRDo3vx1aY3rneKfsYaNVPw/Plg JqNWbcFLJ8FcYdUI/IyCq3iNw57NBDmbNi0sSjbbDxopWqLVulKRm8L3fm5LeoMaYGV2Scg pTP8/rQGx/T1IqD0k/yZa7g2Ev0bGLyKOFQwJlELfOuoBqZ7nTgK1Pa09uDs7M1EqtYpO0H c2QlGTsmkAwpAB1ijInnw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:elZWmxoBk8Y=;CxMYko5Aj/lRL5QnnxQnlfAlxNu ViGcnuNGRP5uql0hSD4VvVnx7Q4z44KAFVsx3Eb8KnlH3+EP/O8uU3e2d2AW4Q2V2xSpxzE/E gyp1wZbVuC/OSt+VgQLvPYfXZnx/rsLXoo4zZQR1LKzjHZmVkSj2+jlPEAorHj9onsmOoOo94 YV3hmgl2jI1V+8W539C4yovoHGHWq2XRTd/eyVBOxcygpzMjT8feKmxEBUGO2J44WLXFEmdHT xBILXLLcAgtIZfMsmZfcti6DsJ+hnCs8n+Ix1Eh3glcvdnlNRR+pCnNt+dkwBU2ZLpqYBEMSI Sbb8MrtLZmAX/ydicobnURYz9R2HWfC8bdoiqykPcd/T3tvlq691bNZ87nTRYcjQml85l5BpN YlkhhMjjhyZQDbtQJRXBW1YpqscY0L5y/ckH98iu4jlXveFUxyAXu8wSAEbZL8QrcwWYkVl8d 9dU4s5DCqLO61HhCBRtr9caPDIgH4PDUMCqIuA9fgz2MRAQiv2uuo398ObP535Lxtn6c+TpsI vwgQcnEXLKC9EesbuvdLIIeeKmG8XTXH90xp7mzopIpMWz3afT2blRrYZ4qyKHPAQaJmuxOEm CRG1SgAU1OHBicVDBShf407zrPsXUo1HjNpa4pYhi8GLc7mnPQQK1xOaXLnUMGrPONdNxvcIm HR5WmcMWXoTFfWUC8dUwwj2WuS+v12UjpEByi9MUyjJeCTgAgvJdy32oIPn19Xckyc/wKuwd0 QpCJPj5S2so4cEKRMEPOUEZNPH3x4frWPkQI9fKgf1dJT9GEj9uWhNC9952msROp8w1rda1pC tORionmXDgUl998fi/xgtaVwbapabigUmax82zymLNDro= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792061803502136850 X-GMAIL-MSGID: 1792061803502136850 |
Series |
[1/2] platform/x86/amd/pmf: Do not use readl() for policy buffer access
|
|
Commit Message
Armin Wolf
Feb. 27, 2024, 2:04 p.m. UTC
The policy buffer is allocated using normal memory allocation
functions, so readl() should not be used on it.
Compile-tested only.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/platform/x86/amd/pmf/tee-if.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.39.2
Comments
On Tue, 27 Feb 2024, Armin Wolf wrote: > The policy buffer is allocated using normal memory allocation > functions, so readl() should not be used on it. > > Compile-tested only. > > Signed-off-by: Armin Wolf <W_Armin@gmx.de> > --- > drivers/platform/x86/amd/pmf/tee-if.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c > index 16973bebf55f..70d09103ab18 100644 > --- a/drivers/platform/x86/amd/pmf/tee-if.c > +++ b/drivers/platform/x86/amd/pmf/tee-if.c > @@ -249,8 +249,8 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev) > u32 cookie, length; > int res; > > - cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET); > - length = readl(dev->policy_buf + POLICY_COOKIE_LEN); > + cookie = dev->policy_buf[POLICY_COOKIE_OFFSET]; > + length = dev->policy_buf[POLICY_COOKIE_LEN]; Hmm, the next question is, is it okay to get just 8 bits instead the full dword (the policy_buf is unsigned char *)?
diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c index 16973bebf55f..70d09103ab18 100644 --- a/drivers/platform/x86/amd/pmf/tee-if.c +++ b/drivers/platform/x86/amd/pmf/tee-if.c @@ -249,8 +249,8 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev) u32 cookie, length; int res; - cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET); - length = readl(dev->policy_buf + POLICY_COOKIE_LEN); + cookie = dev->policy_buf[POLICY_COOKIE_OFFSET]; + length = dev->policy_buf[POLICY_COOKIE_LEN]; if (cookie != POLICY_SIGN_COOKIE || !length) return -EINVAL;