Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4107327imj; Tue, 19 Feb 2019 15:40:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IagjYxeDI3HU+nYiNdV6wWi9w0GhEmMuNMWhGH5fsQU8U4Q5u4iioDwYDIreWle57WvVxJX X-Received: by 2002:a62:8dd9:: with SMTP id p86mr31482327pfk.143.1550619634216; Tue, 19 Feb 2019 15:40:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550619634; cv=none; d=google.com; s=arc-20160816; b=l55GQtpbR3nfVTYlb5UoXhc4HCrZWa/vbciB9ExgMoZdEOHwibVhC9i3mPJM8+XGEJ 6y2xtC7cln/a9OqDbZDBu9wmq/XcIxbjJBjZdMcN9tgMc+oVFFYVRE1frmI3NqPkDrRW aZA9SceOgdRkQfGTsqE0pFbAnL+dLn0myCqyESufbW+Y0aRuTV6qo7pRpQayshFUbalb DSSKeiogFHo36Py0rj9C5tMGlxFFPx18r9nZTO5/Ynqig92LLQ8jwBl312B7cSppRn2R BWBnf7xHf5dM+GVpb127MJrj5uyhKC1TI19ijMBuJbBe4obiZCQslRPkCd52HysSsC4L 4ZKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=C3HpskIZHOlSnWS6IdFryCO/r0xlCFW+NgKCY956cuE=; b=iFfwQxqXbr7tUyQELiy1fpHt7Ln1NoJPztBpMJ74xEIKU1mxSBGoz+Kzdsyeb4kxzR jNN/7jbWyelljZmcN0bTytcTap5oFU7ipHjPQqeuHGU6hghB0VAMeinCpBVP62fenlR5 1+MZV5U58nuRSzhQXRdjgzLrW5xGovJwEegeylPcLVvYcNqa09vzIp9ExqPIfdLccolL i3cuOm93/S2v1lz6EJQlBvUYIbpqGAIyOBVnuvn0LlMEKKyFWJSFc7c0rzX8LXC2EKKR dRetutGZsVZmFAB2WTAAdcL9zyVetK1jD4Y9t7DBElZYTBlN5qpnPOYc8bO9hpBp2D83 QaEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h4cMTBsC; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x27si6332357pga.195.2019.02.19.15.40.19; Tue, 19 Feb 2019 15:40:34 -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=@chromium.org header.s=google header.b=h4cMTBsC; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729993AbfBSXiR (ORCPT + 99 others); Tue, 19 Feb 2019 18:38:17 -0500 Received: from mail-lj1-f175.google.com ([209.85.208.175]:38098 "EHLO mail-lj1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729585AbfBSXiQ (ORCPT ); Tue, 19 Feb 2019 18:38:16 -0500 Received: by mail-lj1-f175.google.com with SMTP id j19so18354190ljg.5 for ; Tue, 19 Feb 2019 15:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C3HpskIZHOlSnWS6IdFryCO/r0xlCFW+NgKCY956cuE=; b=h4cMTBsCf3wBIE7mkGV6oYFDz0+/pP42StFGmSeLSMCqqHPwEZnuyA2CVuW+/bwsrp MpeaZnKFbrD9EYr9iQMGHEi3tpHLy73PXBiabsnZSjHqmEPZA2gDQgyuyq1iwvDjdv3E zavMKQdN2MiCp+yAMOkXeQdPXdQ8w1VfMWB48= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C3HpskIZHOlSnWS6IdFryCO/r0xlCFW+NgKCY956cuE=; b=KfhksSSdz81nab/n9V5UsAy/kcTgD0O0Kr8m65E9oeVvbjbugTnSk1cdF0L6y3Sk4t 0Xy6g6a5XNNVOtBCfcGw6hnPO5gVbV5BBBwZ0B+n+PJBJo4bQUI32Zti19o4ih16wgKo x+lG5xNJ48Pj0nHWscA46n8xVJ0eRXGiv8yFqFdy9XT9UwAFPVT3dF36C8n7IU9UcEZr PgROvFA+FJzma9/9vItdzb3nc4aQywA74wctJ06yXhJrUsyC3tyOF5l1n8Fu4Mt/0Tnh yP+gVWz5yvxX52mLmWuga1d+mcY4ur/+1IYiDBZICEKCDe7Pnk8aZedUGLdTnrdYdUtZ QDJw== X-Gm-Message-State: AHQUAubqAk4tQOCJK1zwJgv5FBsKn41ycG49LMTytszqhBKITkKfVkMU qrVbsxPl/uPd046T1NTddd7CxXZrNe0= X-Received: by 2002:a2e:9a55:: with SMTP id k21mr7589589ljj.191.1550619494324; Tue, 19 Feb 2019 15:38:14 -0800 (PST) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id 67-v6sm4714932ljc.26.2019.02.19.15.38.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 15:38:14 -0800 (PST) Received: by mail-lf1-f49.google.com with SMTP id u21so16192650lfu.1 for ; Tue, 19 Feb 2019 15:38:14 -0800 (PST) X-Received: by 2002:a19:ae0b:: with SMTP id f11mr13049011lfc.104.1550619018042; Tue, 19 Feb 2019 15:30:18 -0800 (PST) MIME-Version: 1.0 References: <1550394300-17420-1-git-send-email-yong.wu@mediatek.com> <1550394300-17420-7-git-send-email-yong.wu@mediatek.com> In-Reply-To: <1550394300-17420-7-git-send-email-yong.wu@mediatek.com> From: Evan Green Date: Tue, 19 Feb 2019 15:29:41 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 06/22] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring , Tomasz Figa , Will Deacon , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, yingjoe.chen@mediatek.com, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, Matthias Kaehlcke Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 17, 2019 at 1:07 AM Yong Wu wrote: > > MediaTek extend the arm v7s descriptor to support the dram over 4GB. > > In the mt2712 and mt8173, it's called "4GB mode", the physical address > is from 0x4000_0000 to 0x1_3fff_ffff, but from EMI point of view, it > is remapped to high address from 0x1_0000_0000 to 0x1_ffff_ffff, the > bit32 is always enabled. thus, in the M4U, we always enable the bit9 > for all PTEs which means to enable bit32 of physical address. > > but in mt8183, M4U support the dram from 0x4000_0000 to 0x3_ffff_ffff > which isn't remaped. We extend the PTEs: the bit9 represent bit32 of > PA and the bit4 represent bit33 of PA. Meanwhile the iova still is > 32bits. > > In order to unify code, in the "4GB mode", we add the bit32 for the > physical address manually in our driver. > > Correspondingly, Adding bit32 and bit33 for the PA in the iova_to_phys > has to been moved into v7s. > > Regarding whether the pagetable address could be over 4GB, the mt8183 > support it while the previous mt8173 don't. thus keep it as is. > > Signed-off-by: Yong Wu > Reviewed-by: Robin Murphy > --- > Comparing the previous version, I add MTK_4GB quirk always since mtk_iommu > has already controlled the PA itself. Helped from Evan. Thanks for all the explanation on this one. I think I understand it now, and it looks good to me. Reviewed-by: Evan Green