From: Kenneth Lee Subject: Re: [RFC PATCH 2/7] iommu: Add share domain interface in iommu for spimdev Date: Thu, 2 Aug 2018 12:15:47 +0800 Message-ID: <20180802041547.GM160746@Turing-Arch-b> References: <20180801102221.5308-1-nek.in.cn@gmail.com> <20180801102221.5308-3-nek.in.cn@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: Kenneth Lee , Herbert Xu , "kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Jonathan Corbet , Greg Kroah-Hartman , "linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "Kumar, Sanjay K" , Hao Fang , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org" , Alex Williamson , Thomas Gleixner , "linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Philippe Ombredanne , Zaibo Xu , "David S . Miller" , "linux-accelerators-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" To: "Tian, Kevin" Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: linux-crypto.vger.kernel.org T24gVGh1LCBBdWcgMDIsIDIwMTggYXQgMDM6MTc6MDNBTSArMDAwMCwgVGlhbiwgS2V2aW4gd3Jv dGU6Cj4gRGF0ZTogVGh1LCAyIEF1ZyAyMDE4IDAzOjE3OjAzICswMDAwCj4gRnJvbTogIlRpYW4s IEtldmluIiA8a2V2aW4udGlhbkBpbnRlbC5jb20+Cj4gVG86IEtlbm5ldGggTGVl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