Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp20300223ybl; Sat, 4 Jan 2020 23:02:22 -0800 (PST) X-Google-Smtp-Source: APXvYqx70mTbFuntZvlDROMhbL9qMDZzpUGdp58v9a9m4VFtQs1Skd9N3n8W+v8ufuTkdhC52u3b X-Received: by 2002:a05:6830:1615:: with SMTP id g21mr113336544otr.49.1578207742273; Sat, 04 Jan 2020 23:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578207742; cv=none; d=google.com; s=arc-20160816; b=NDwuuMeH4/zyJOXMcfxZfPD9fvUHite8VPm4fZeZcgavVl2TBSuuA1VWIt0+s4fnTR zMii0wbZsx587/FnQdM8y7kbtmrZd5w8tF0BhgQUbk5m0cDynKA1qICyyLNtR4SGa7Jn f5tqr1+LESRwRogJIK0ggXw5JMY8OHiwyTaTOCh+uaIc3PLlinoqjQI10YjCDnz55Ftk zZxgerGiUqfhS92S2MUOoJxyeSqMyUguctcZHSY12cPV5P9JInkXDmgBamo3/CmQVcvj QxLMPKUN1M0Xm++M2deZ6H0z6Z5kYKL3+E96LvsJ2YIiPjlimb8XnsK46xa/DX3KKDTh V3Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:from:to :subject:cc:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=fXJccl+t87GFbOjHrMn50MmDuKMfLZa8hpEbl0ojp1o=; b=dJez8E2dhssakZvx7QPLVztxCyaJPJkmC5sCkPYrnD5/77YJE8YIopms46AtXgQ54/ GSfacCa2cP4soKUTzoXEkODX7Vi2l8GUrxTnkgKcBrw/mYF89uDGTy0p/5sohJ20wWAe VsA2j4xyuwgZvda8NmmDBH8Rh+3wXSF+6cMSFHqqw1S89l092sG0tLD0mXtdrBX1znaI rcBS5X7VNDnC+wVmFRmUgocm4fouAenoPBhDlGrUmI+wrJfaO63G04jRq9tHzyNDJjsP qeoBgN4ScTp9sjbRbYHejpSgu5awIRoWC3MZAgUmB4uWYOK5Ix6Mg+EZMuwuvavW0KmZ CVWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oS6hjrDT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si11419330oib.252.2020.01.04.23.01.39; Sat, 04 Jan 2020 23:02:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oS6hjrDT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbgAEG5B (ORCPT + 99 others); Sun, 5 Jan 2020 01:57:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:36718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgAEG5B (ORCPT ); Sun, 5 Jan 2020 01:57:01 -0500 Received: from kernel.org (unknown [104.132.0.74]) (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 A1292207FD; Sun, 5 Jan 2020 06:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578207420; bh=jPcU/Bcq9WdEzhf/t7zr0YO26CiHBAfIo7kaL16gGe4=; h=In-Reply-To:References:Cc:Subject:To:From:Date:From; b=oS6hjrDTCFiVmjbbM87CCOuCyieEZwWwTvtJsRVqlY+Cl5T97yH3OEC2cVp/KiOwI c8umeEu7wkDUqO87Ql0p+S/vGk4wa8Ydpxcb8RhS/ZWwYgt/jZTnTPs5o43u4Ka4M5 bc61eUoCdek/JM1xG5UCOuD0iw7ath030hUw3dSU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20200101033704.32264-1-masneyb@onstation.org> <20200101111521.GA67534@gerhold.net> Cc: Brian Masney , Bjorn Andersson , Andy Gross , linux-arm-msm , Linux Kernel Mailing List Subject: Re: [PATCH] firmware: qcom: scm: add 32 bit iommu page table support To: Rob Clark , Stephan Gerhold From: Stephen Boyd User-Agent: alot/0.8.1 Date: Sat, 04 Jan 2020 22:56:59 -0800 Message-Id: <20200105065700.A1292207FD@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Rob Clark (2020-01-01 12:14:35) > On Wed, Jan 1, 2020 at 3:16 AM Stephan Gerhold wrot= e: > > > > On Tue, Dec 31, 2019 at 10:37:04PM -0500, Brian Masney wrote: > > > Add 32 bit implmentations of the functions > > > __qcom_scm_iommu_secure_ptbl_size() and > > > __qcom_scm_iommu_secure_ptbl_init() that are required by the qcom_iom= mu > > > driver. > > > > > > Signed-off-by: Brian Masney > > > --- > > > drivers/firmware/qcom_scm-32.c | 32 ++++++++++++++++++++++++++++++-- > > > 1 file changed, 30 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/firmware/qcom_scm-32.c b/drivers/firmware/qcom_s= cm-32.c > > > index 48e2ef794ea3..f149a85d36b0 100644 > > > --- a/drivers/firmware/qcom_scm-32.c > > > +++ b/drivers/firmware/qcom_scm-32.c > > > @@ -638,13 +638,41 @@ int __qcom_scm_restore_sec_cfg(struct device *d= ev, u32 device_id, > > > int __qcom_scm_iommu_secure_ptbl_size(struct device *dev, u32 spare, > > > size_t *size) > > > { > > > - return -ENODEV; > > > + int psize[2] =3D { 0, 0 }; > > > > I would use an explicit size (i.e. __le32) here. > > > > > + int ret; > > > + > > > + ret =3D qcom_scm_call(dev, QCOM_SCM_SVC_MP, > > > + QCOM_SCM_IOMMU_SECURE_PTBL_SIZE, > > > + &spare, sizeof(spare), &psize, sizeof(psize= )); > > > + if (ret || psize[1]) > > > + return ret ? ret : -EINVAL; > > > + > > > + *size =3D psize[0]; > > > + > > > + return 0; > > > } > > > > > > int __qcom_scm_iommu_secure_ptbl_init(struct device *dev, u64 addr, = u32 size, > > > u32 spare) > > > { > > > - return -ENODEV; > > > + struct msm_scm_ptbl_init { > > > + __le32 paddr; > > > + __le32 size; > > > + __le32 spare; > > > + } req; > > > + int ret, scm_ret =3D 0; > > > + > > > + req.paddr =3D addr; > > > + req.size =3D size; > > > + req.spare =3D spare; > > > > I'm not sure if there is actually anyone using qcom in BE mode (does > > that even work?), but all the other methods in this file explicitly > > convert using cpu_to_le32(), so this method should do the same :) >=20 > sboyd used to occasionally fix things related to qcom in BE back in > the day.. not sure if modern snapdragons still support BE. >=20 > (I'm willing to just pretend that they don't.. that lessens the chance > that someday someone gets far enough to try the GPU in BE mode, and > realizes they've wasted their time getting that far ;-)) >=20 Yeah it used to work many ages ago, but I don't think anyone besides me tested it, except maybe for the folks working in QCA back then.