From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Herrmann Subject: Re: [PATCH v3 10/13] xen/iommu: smmu: Check for duplicate stream IDs when registering master devices Date: Fri, 20 Feb 2015 15:47:50 +0100 Message-ID: <20150220144750.GA26005@alberich> References: <1422643768-23614-1-git-send-email-julien.grall@linaro.org> <1422643768-23614-11-git-send-email-julien.grall@linaro.org> <1424435723.30924.212.camel@citrix.com> <54E737D8.2020700@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YOorz-0002M1-Tk for xen-devel@lists.xenproject.org; Fri, 20 Feb 2015 14:47:56 +0000 Received: by mail-wg0-f44.google.com with SMTP id k14so13631390wgh.3 for ; Fri, 20 Feb 2015 06:47:54 -0800 (PST) Content-Disposition: inline In-Reply-To: <54E737D8.2020700@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Andreas Herrmann , xen-devel@lists.xenproject.org, tim@xen.org, Ian Campbell , stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Fri, Feb 20, 2015 at 01:34:16PM +0000, Julien Grall wrote: > On 20/02/15 12:35, Ian Campbell wrote: > > On Fri, 2015-01-30 at 18:49 +0000, Julien Grall wrote: > >> From: Andreas Herrmann > >> > >> If DT information lists one stream ID twice for the master devices of > >> an SMMU this can cause a multi match when stream ID matching is used. > >> For stream ID indexing this might trigger an overwrite of an S2CR that > >> is already in use. > >> > >> So better check for duplicates when DT information is parsed. > >> > >> Taken from the linux ML: > >> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-January/226099.html > >> > >> Cc: Andreas Herrmann > >> Signed-off-by: Andreas Herrmann > >> Signed-off-by: Julien Grall > > > > I think you were going to drop this one as it is not strictly required? > > > > I'm still not entirely clear on the motivation for this patch, looking > > at the v2 thread I see "But, the developer made have written by mistake > > twice the streamid for the device." which I think you were saying that > > the DT might, hypothetically, be wrong and have duplicated IDs, is that > > right? > > > > Is it a hypothetical problem or have we seen it in a real device-tree? > > It's an hypothetical problem. The algo on the next patch won't work > correctly otherwise. Seconded -- this patch is to avoid potential problems if the DT information is bogus. As the algorithm of the other patch assumes there are no duplicate streamids I needed to double-check it. Of course I had created special DTs containing this kind of error to test the check. > I may need to rework a bit the next patch if we drop it. I think it's easier to keep the check when DT information is gathered. Alternative would be to drop it and to be prepared for potential bug reports about multi-match errors or random other problems in case of an overwrite of an already configured S2CR. Andreas