From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2on0141.outbound.protection.outlook.com ([207.46.100.141]:45037 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933330AbbDQPv2 convert rfc822-to-8bit (ORCPT ); Fri, 17 Apr 2015 11:51:28 -0400 From: Stuart Yoder To: Will Deacon , Varun Sethi CC: "Minghuan.Lian@freescale.com" , "linux-pci@vger.kernel.org" , Arnd Bergmann , "Mingkai.Hu@freescale.com" , "Roy Zang" , Bjorn Helgaas , Scott Wood , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH 1/2] irqchip/gicv3-its: Support share device ID Date: Fri, 17 Apr 2015 14:19:08 +0000 Message-ID: References: <1429091364-31939-1-git-send-email-Minghuan.Lian@freescale.com> <1429091364-31939-2-git-send-email-Minghuan.Lian@freescale.com> <20150416104008.GB25640@arm.com> In-Reply-To: <20150416104008.GB25640@arm.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org List-ID: > -----Original Message----- > From: Will Deacon [mailto:will.deacon@arm.com] > Sent: Thursday, April 16, 2015 5:40 AM > To: Sethi Varun-B16395 > Cc: Lian Minghuan-B31939; linux-pci@vger.kernel.org; Arnd Bergmann; Hu Mingkai-B21284; Zang Roy-R61911; Yoder > Stuart-B08248; Bjorn Helgaas; Wood Scott-B07421; linux-arm-kernel@lists.infradead.org > Subject: Re: [PATCH 1/2] irqchip/gicv3-its: Support share device ID > > Hi Varun, > > Thanks for adding me to Cc. > > On Wed, Apr 15, 2015 at 02:18:13PM +0100, Varun Sethi wrote: > > Yes, deviceid=stream id (i.e. ICID + other bits). I am not sure if TBU ID > > would also be forwarded as a part of stream id to GIC. My understanding is > > that TBU ID is forwarded (as a part of the stream ID) to the TCU in case > > of a TBU translation miss. In case of the LS2085 PCIe controller you would > > have to setup the PCIe device ID to stream ID translation table. We may > > have to restrict the number of entries based on the available number of > > contexts. > > Unfortunately, I'm having a really hard time parsing this thread (some parts > of it simply don't make sense; others use non-architectural terms and > overall I don't get a feeling for the problem). > > Please could you explain your system design step by step so that I can > understand (a) what you've built and (b) why the current design of Linux is > causing you problems? > > Sorry if I'm just being thick, but it's important that we get this right. I'll try to summarize some key points about the system... System is using a single SMMU-500 (1 TCU, 6 TBUs) and GICv3-ITS. There are PCI, fsl-mc, and platform devices that do DMA. Devices on the PCI and fsl-mc bus generate message interrupts. The flow a message interrupt would take is this: -------------- PCI device -------------- | | pcidevid + MSI msg | V -------------- PCI controller pcidevid -> streamID mapping -------------- | | streamID + MSI msg | V -------------- SMMU -------------- | | streamID + MSI msg | V -------------- CCN-504 (Dickens) -------------- | | streamID + MSI msg | V -------------- GICv3 ITS streamID == ITS deviceID -------------- So, the way things work (at least initially) is that each PCI device maps to a single streamID, and thus each device has a separate ITT in the ITS. So, things should be cool. However, there is an improvement we envision as possible due to the limited number of SMMU contexts (i.e. 64). If there are 64 SMMU context registers it means that there is a max of 64 software contexts where things can be isolated. But, say I have an SRIOV card with 64 VFs, and I want to assign 8 of the VFs to a KVM VM. Those 8 PCI devices could share the same streamID/ITS-device-ID since they all share the same isolation context. What would be nice is at the time the 8 VFS are being added to the IOMMU domain is for the pcidevid -> streamID mapping table to be updated dynamically. It simply lets us make more efficient use of the limited streamIDs we have. I think it is this improvement that Minghuan had in mind in this patch. Thanks, Stuart From mboxrd@z Thu Jan 1 00:00:00 1970 From: stuart.yoder@freescale.com (Stuart Yoder) Date: Fri, 17 Apr 2015 14:19:08 +0000 Subject: [PATCH 1/2] irqchip/gicv3-its: Support share device ID In-Reply-To: <20150416104008.GB25640@arm.com> References: <1429091364-31939-1-git-send-email-Minghuan.Lian@freescale.com> <1429091364-31939-2-git-send-email-Minghuan.Lian@freescale.com> <20150416104008.GB25640@arm.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org > -----Original Message----- > From: Will Deacon [mailto:will.deacon at arm.com] > Sent: Thursday, April 16, 2015 5:40 AM > To: Sethi Varun-B16395 > Cc: Lian Minghuan-B31939; linux-pci at vger.kernel.org; Arnd Bergmann; Hu Mingkai-B21284; Zang Roy-R61911; Yoder > Stuart-B08248; Bjorn Helgaas; Wood Scott-B07421; linux-arm-kernel at lists.infradead.org > Subject: Re: [PATCH 1/2] irqchip/gicv3-its: Support share device ID > > Hi Varun, > > Thanks for adding me to Cc. > > On Wed, Apr 15, 2015 at 02:18:13PM +0100, Varun Sethi wrote: > > Yes, deviceid=stream id (i.e. ICID + other bits). I am not sure if TBU ID > > would also be forwarded as a part of stream id to GIC. My understanding is > > that TBU ID is forwarded (as a part of the stream ID) to the TCU in case > > of a TBU translation miss. In case of the LS2085 PCIe controller you would > > have to setup the PCIe device ID to stream ID translation table. We may > > have to restrict the number of entries based on the available number of > > contexts. > > Unfortunately, I'm having a really hard time parsing this thread (some parts > of it simply don't make sense; others use non-architectural terms and > overall I don't get a feeling for the problem). > > Please could you explain your system design step by step so that I can > understand (a) what you've built and (b) why the current design of Linux is > causing you problems? > > Sorry if I'm just being thick, but it's important that we get this right. I'll try to summarize some key points about the system... System is using a single SMMU-500 (1 TCU, 6 TBUs) and GICv3-ITS. There are PCI, fsl-mc, and platform devices that do DMA. Devices on the PCI and fsl-mc bus generate message interrupts. The flow a message interrupt would take is this: -------------- PCI device -------------- | | pcidevid + MSI msg | V -------------- PCI controller pcidevid -> streamID mapping -------------- | | streamID + MSI msg | V -------------- SMMU -------------- | | streamID + MSI msg | V -------------- CCN-504 (Dickens) -------------- | | streamID + MSI msg | V -------------- GICv3 ITS streamID == ITS deviceID -------------- So, the way things work (at least initially) is that each PCI device maps to a single streamID, and thus each device has a separate ITT in the ITS. So, things should be cool. However, there is an improvement we envision as possible due to the limited number of SMMU contexts (i.e. 64). If there are 64 SMMU context registers it means that there is a max of 64 software contexts where things can be isolated. But, say I have an SRIOV card with 64 VFs, and I want to assign 8 of the VFs to a KVM VM. Those 8 PCI devices could share the same streamID/ITS-device-ID since they all share the same isolation context. What would be nice is at the time the 8 VFS are being added to the IOMMU domain is for the pcidevid -> streamID mapping table to be updated dynamically. It simply lets us make more efficient use of the limited streamIDs we have. I think it is this improvement that Minghuan had in mind in this patch. Thanks, Stuart