Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp283282pxu; Wed, 25 Nov 2020 03:07:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDIbpS7wjia9j+Do7GGG6PjruLVGUXwMapteaAx7e8+XS/aHhuVrNVRo2TqmWPoZFnHD06 X-Received: by 2002:a50:99d6:: with SMTP id n22mr2948329edb.261.1606302459778; Wed, 25 Nov 2020 03:07:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606302459; cv=none; d=google.com; s=arc-20160816; b=IB5QjK9sU9PNGg3P5NmfQ7E0frk5W8xuc0vTqc8o/wUKRhdYtZzr5YQ+IhJbja1BAQ hNEwq1jSf79bwLOt+Vtq0jXbSqYpKoWrNgAZGX2/LaxdniU4fwemDPvMFZwvXK+AXYMl zHGBTbwZgj+gqdDyIBQTjIYkkJhJYUaFsrld4/N+6DgyiuBfOQSJmEeDYppHd9UbG1YO 5QfwJKOaUheFe5qcSZkn2x+MNfpH5/FhhOf2g2JAnodlm/TZ4rm0pGu9xUqMcnFpNJD+ 0+ATGb5/l1qfFVW9XFB1zjM8Mmh8CrJDrZO62BZFcD0eir5G5TwTX83zBa6WNSvo+fPj 0iNg== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=xI/ceqZKKONm10j9fLWN04WfsGQ+Y6PfpXlP79ucbtc=; b=RpW4IXOSq5KRMijRQgz0gJ34/UGNNUkUCsgOS8EvnVZ/y2vhzYkjAsBsEYBLz6LldF myfVXjeqfrEHfK3c/7hNgFUf9yw3QM1inepo5KLZRE4x+ddAlvZ8Wuvm7ms2YGHJ3FQ6 ePe7fJcM5sT+JP3GvI3bTx4IpGwWbqrY+CNNjktdFj70hNWwGqe0o0NcszofUjpSaQ6e Y28m2vvVPxxzlyKQfD4cMgbzyPiPZjhoaBsg3BDM2u1VnDVVJyZr3tJpVRy8NTz2Lf/8 JWSgTxpN1vQ6w87sIG8itWAapdL8Kz6/+XZk+6sPutcQ5W6Na5GzynnDf0UaU0pnIv0q sEjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Vy5FClWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i7si1415930ejo.726.2020.11.25.03.07.16; Wed, 25 Nov 2020 03:07:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@mediatek.com header.s=dk header.b=Vy5FClWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbgKYLDq (ORCPT + 99 others); Wed, 25 Nov 2020 06:03:46 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:27639 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726189AbgKYLDq (ORCPT ); Wed, 25 Nov 2020 06:03:46 -0500 X-UUID: 0772767d57e343e6891beb8ab16b4e8e-20201125 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=xI/ceqZKKONm10j9fLWN04WfsGQ+Y6PfpXlP79ucbtc=; b=Vy5FClWJFnjQyR2mZzAmi3S6inaTOenZU3qhbvrxlXtKflmvFTy6blSm+77b7dpHtGZ3iPP21cHe4J/o2+EYEqhFX0NXMoKAj5iRO99L8uhKXaq/X7K1aZ1sCha+O5L0PmBAPQyTnynkabuPPr2SCqhXMSHQDL3iZHpLJkfkkY4=; X-UUID: 0772767d57e343e6891beb8ab16b4e8e-20201125 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 617537765; Wed, 25 Nov 2020 19:03:36 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 25 Nov 2020 19:03:34 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 25 Nov 2020 19:03:33 +0800 Message-ID: <1606302214.26323.141.camel@mhfsdcap03> Subject: Re: [PATCH] iommu: Improve the performance for direct_mapping From: Yong Wu To: Will Deacon CC: , , Nicolas Boichat , , , Joerg Roedel , , Krzysztof Kozlowski , Tomasz Figa , , , Matthias Brugger , Robin Murphy , Date: Wed, 25 Nov 2020 19:03:34 +0800 In-Reply-To: <20201124110520.GA12980@willie-the-truck> References: <20201120090628.6566-1-yong.wu@mediatek.com> <20201123123258.GC10233@willie-the-truck> <1606209884.26323.132.camel@mhfsdcap03> <20201124110520.GA12980@willie-the-truck> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 3E37F2948B73A16F8990BEF5FB644CD56B780219D1EF19A777FBD0308C48F13A2000:8 X-MTK: N Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gVHVlLCAyMDIwLTExLTI0IG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