Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3402416ybi; Mon, 17 Jun 2019 23:45:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI8oAkcWuorwqUAeIhvYgqEKm6YpUfZ0/kWtmVOTsBZATQtnVLH1xXpC0P47Rp7OgwX354 X-Received: by 2002:a17:902:820c:: with SMTP id x12mr15538812pln.216.1560840324502; Mon, 17 Jun 2019 23:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560840324; cv=none; d=google.com; s=arc-20160816; b=tDmLYXnZYAfxbEfefBey6JJnBf3VyoCGM9rTKsUyFReYdTPOpCK1q/pq0pAgYP3F04 Tsh0LfQ2DRAPrNmDihoXjWhr/gH9APtjWmrB4N/Hh5W31rO5QG51IcsNuRQldzWaBql1 MWstg9TNILC/HjsK/tJY7I1LjcO9070BPaMP1fB/FaTseRmapXuzDx5SlxMRf3henor3 s8p9yB1KbSG87y/oamMhR5tMraiud05lSlSGZPhgLUYWjVxd3GMkIHGfS+0Dg72etIQ3 nYZDth9nkDWA8bEa5SeF+hefOSW5zZZ5hcv44D0naXoqch68vxmgWQR5MWGfAfBSmb+v PbCw== 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=2qhMEjTGxN0dhDss7cc7zfKbD1VT4IQism6fVgX1NpE=; b=azhtcAD6QTCepQ0VIiJxCpuo8HSIE/X4ka2+tCBL8VcVb7hv0aw70/HXqNLIKFiW9e Dne+iPWPSHc9gITYlugMj7d2zvUaWRhITHQuqYDkfTDMnI/XO9cYnRRUxx9NXW+CPwfW 2vXKA5AO182YE2cN9Z5muRsIV4gl5S6a2kXSVV9HJxZg8ojh30kDLCxD+mjraUQATZy2 p8ewzTNYp3x+OJJILUQyHNex8b/zEmo+XnXkAW4LWXWJfrh2fmg9JLIS6u1bkTu5BkSi 3XnXWQ1EJt0RkEz2wJ/dbLqbzOl3KQZ+KO0Nm6o7Db2sya9se7TCBMIxoz6h8d5pPfVw CNaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dvsdqA01; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f38si12174907plb.99.2019.06.17.23.45.08; Mon, 17 Jun 2019 23:45:24 -0700 (PDT) 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=@google.com header.s=20161025 header.b=dvsdqA01; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728748AbfFRGnX (ORCPT + 99 others); Tue, 18 Jun 2019 02:43:23 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34099 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726676AbfFRGnX (ORCPT ); Tue, 18 Jun 2019 02:43:23 -0400 Received: by mail-wr1-f68.google.com with SMTP id k11so12592555wrl.1 for ; Mon, 17 Jun 2019 23:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2qhMEjTGxN0dhDss7cc7zfKbD1VT4IQism6fVgX1NpE=; b=dvsdqA01/pZ+815FjjW8tFL5UWf7khLLQ82Ejhqn6TxNO1tCDktEgPtkMa4HNv7OLR 1U39nh2EFsrtSmlNZcgDcq/9sa+nGn3SUOMpDbfIAp95GzajjL3XI+3GbjB5ULFzEoSH IwACWh8kuOmwu5jEKWjMzofeGDXqP9safEXyJXu8ve2REW9BQaUclrQL8parNOK0OQjD B3wkQTkyxFJk8UmfoMVdfQg+Tn/UTwLgckw83gJpr19cDBf/Gz90iGpXy7nsEYrqDA2m eZwEj4HpXDoxWiOrmV6yaBfhp8pBtJeFO0hOjxV5cmt7gkv5WG1rUgP3mWcFMvMsVNL0 dfKw== 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=2qhMEjTGxN0dhDss7cc7zfKbD1VT4IQism6fVgX1NpE=; b=DkSmx4Nb1RhjoXK/0y9qmwA1gbCKZggEC4YQHe5jaEdj8K7NpPjeJb89LGLn/bpTH2 EUU3xU5WYOC+mOmcstL69l3e2MUKfu3tg5nU1tw/43kNZFXgMyIL/O748sUB8wr53NfO NHoB1mGNRpAe+W3fJk9FsOJFFcS1Pc0VimpgV95t+JXjnN6rPMSxuDgONtvsoskMOptz zKtU6oFUwj9v92pOa3vg2Dma39eYnoYV9BTmDfLN2g9s7pv2LZzkTrNbwGHbsfQ8PkYD BBKQZU/myhMNyEKd111AtiA5ti6PyHsfVqAjxvrL9/f9tkgZc4RWvdKVvNLG/hULdlHJ HkTw== X-Gm-Message-State: APjAAAXdu0TbPqeGm3aqnuRA+jR+qCZKPCNbTzw5UsLoIG961NT2K4fm G//FHgW2ghmw3AXFvRwFBkJDxFtpkLECd8CKVsq9VM0c X-Received: by 2002:a5d:4b43:: with SMTP id w3mr14892373wrs.166.1560838760111; Mon, 17 Jun 2019 23:19:20 -0700 (PDT) MIME-Version: 1.0 References: <1560169080-27134-1-git-send-email-yong.wu@mediatek.com> <1560169080-27134-15-git-send-email-yong.wu@mediatek.com> In-Reply-To: <1560169080-27134-15-git-send-email-yong.wu@mediatek.com> From: Tomasz Figa Date: Tue, 18 Jun 2019 15:19:07 +0900 Message-ID: Subject: Re: [PATCH v7 14/21] iommu/mediatek: Add mmu1 support To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring , Evan Green , Will Deacon , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , devicetree@vger.kernel.org, Linux Kernel Mailing List , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , =?UTF-8?B?WWluZ2pvZSBDaGVuICjpmbPoi7HmtLIp?= , 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 Mon, Jun 10, 2019 at 9:21 PM Yong Wu wrote: > > Normally the M4U HW connect EMI with smi. the diagram is like below: > EMI > | > M4U > | > smi-common > | > ----------------- > | | | | ... > larb0 larb1 larb2 larb3 > > Actually there are 2 mmu cells in the M4U HW, like this diagram: > > EMI > --------- > | | > mmu0 mmu1 <- M4U > | | > --------- > | > smi-common > | > ----------------- > | | | | ... > larb0 larb1 larb2 larb3 > > This patch add support for mmu1. In order to get better performance, > we could adjust some larbs go to mmu1 while the others still go to > mmu0. This is controlled by a SMI COMMON register SMI_BUS_SEL(0x220). > > mt2712, mt8173 and mt8183 M4U HW all have 2 mmu cells. the default > value of that register is 0 which means all the larbs go to mmu0 > defaultly. > > This is a preparing patch for adjusting SMI_BUS_SEL for mt8183. > > Signed-off-by: Yong Wu > Reviewed-by: Evan Green > --- > drivers/iommu/mtk_iommu.c | 46 +++++++++++++++++++++++++++++----------------- > 1 file changed, 29 insertions(+), 17 deletions(-) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index 3a14301..ec4ce74 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -72,26 +72,32 @@ > #define F_INT_CLR_BIT BIT(12) > > #define REG_MMU_INT_MAIN_CONTROL 0x124 > -#define F_INT_TRANSLATION_FAULT BIT(0) > -#define F_INT_MAIN_MULTI_HIT_FAULT BIT(1) > -#define F_INT_INVALID_PA_FAULT BIT(2) > -#define F_INT_ENTRY_REPLACEMENT_FAULT BIT(3) > -#define F_INT_TLB_MISS_FAULT BIT(4) > -#define F_INT_MISS_TRANSACTION_FIFO_FAULT BIT(5) > -#define F_INT_PRETETCH_TRANSATION_FIFO_FAULT BIT(6) > + /* mmu0 | mmu1 */ > +#define F_INT_TRANSLATION_FAULT (BIT(0) | BIT(7)) > +#define F_INT_MAIN_MULTI_HIT_FAULT (BIT(1) | BIT(8)) > +#define F_INT_INVALID_PA_FAULT (BIT(2) | BIT(9)) > +#define F_INT_ENTRY_REPLACEMENT_FAULT (BIT(3) | BIT(10)) > +#define F_INT_TLB_MISS_FAULT (BIT(4) | BIT(11)) > +#define F_INT_MISS_TRANSACTION_FIFO_FAULT (BIT(5) | BIT(12)) > +#define F_INT_PRETETCH_TRANSATION_FIFO_FAULT (BIT(6) | BIT(13)) If there are two IOMMUs, shouldn't we have two driver instances handle them, instead of making the driver combine them two internally? And, what is even more important from security point of view actually, have two separate page tables (aka IOMMU groups) for them? Best regards, Tomasz