From patchwork Tue Sep 5 22:56:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 111757 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp52115qge; Tue, 5 Sep 2017 15:57:27 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4XQYp61UjZe5ElXo86AyvrWk+xARINXV9LlHc1+9iFhTL6l9dYkO5EQOmln62biHcjxLjE X-Received: by 10.159.198.2 with SMTP id f2mr6064593plo.10.1504652247000; Tue, 05 Sep 2017 15:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504652246; cv=none; d=google.com; s=arc-20160816; b=zY86cbVxfkfgeV3shSTdUKWCB8ujQjnTgCxny3TAaTcIWYumF0pYuHQ/fnycJp38+v FEqDAAypPDJT4LB5vBnhQvfslsgQZ9qhaFFEimjGSPRljkguzBJrZCO5GWvKGI4wHtKZ tkK0imME82laG8G9v8RaIoV110wTzgTwdc4M0n1DWSVv+/v3puGCM9zVHbIBJ91zS+zS 6ArbpSVsfkVraTlqy9AxD/UkXxOXJWjTYaB8U4B8kQdmOUYV7w5ZZ5Ice/0uodXU02u1 qRtfhtvTq1NCmz1E1VdXVRWnfB3A1j6H1pLVqXfso0soZmj/gpoAbhpmcwXRqfD2FEFb nnxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=7kw/U/09UHpIJBzrkTyd/p6/sQ4b2ATOKT60YRDIHHY=; b=RBz5JTOgAjRVXM1tj5Q8Id/m3PVL3nKw2B6PHT7VgurdxhkBEGSd0YQc3w1fmce2Fx l4W0j8B/zgzHoCoMnbPoUDRID5aJQEbP5ueM2ooF/L4os0heAmzqIbW1eXirjIv6W7mP QxwwplsRj5TN4OTEsPynBSRYDYwuf6h2jbjfXcTQ9xi9q2x1aOdhh0uTfB/0GImyHAOW XbpZVbvJQKGl5ih25Wi+CzB5PlczNKQoV9D1dN9Mqo85VBAtgPDeGt8i3Qxjud5NkVTa A7XEh8E6go4d8T/trH2U6zOgTbbErW26h7J9r0F6BYN7HsIaNJbR692T9JonyuAWtqXS ivJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=cDK3w2wK; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o89si57218pfj.18.2017.09.05.15.57.26; Tue, 05 Sep 2017 15:57:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=cDK3w2wK; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752924AbdIEW5Z (ORCPT + 3 others); Tue, 5 Sep 2017 18:57:25 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:36161 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752824AbdIEW5Y (ORCPT ); Tue, 5 Sep 2017 18:57:24 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v85MuPC1026035; Tue, 5 Sep 2017 17:56:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1504652185; bh=N9WUFpRrx5+bY2LTbhv9GWVpqH25xzpoJuxKsmpNpNM=; h=From:To:CC:Subject:Date; b=cDK3w2wKaQ3J0E7mev9hQiC37KNP80G3lLBeA1pfVKSxnJXdQ9Wf+5+jpSWDLRRk/ BqPcpVcmgzOixZtnR9XAjSLYQ47GWOAe7HE3ZNBmjuU9grosN5ohcdynhlomOVrHIJ MQTNkt6k5TiH3LFHNc8ULUizvj1IovibjFJX88vc= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v85MuKhB007062; Tue, 5 Sep 2017 17:56:20 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 5 Sep 2017 17:56:20 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 5 Sep 2017 17:56:20 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v85MuKFJ029780; Tue, 5 Sep 2017 17:56:20 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v85MuJ304538; Tue, 5 Sep 2017 17:56:19 -0500 (CDT) From: Suman Anna To: Joerg Roedel CC: , Tony Lindgren , Tero Kristo , Laurent Pinchart , , , Suman Anna Subject: [PATCH v2 0/2] Dual MMU support for TI DRA7xx DSPs Date: Tue, 5 Sep 2017 17:56:16 -0500 Message-ID: <20170905225618.912-1-s-anna@ti.com> X-Mailer: git-send-email 2.13.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hi Joerg, The following is v2 of the patch series that enhances the OMAP IOMMU driver to support the mirror-programming of the two MMUs present within the DSP subsystems on TI DRA7xx/AM57xx family of SoCs. The main changes are to address the review comments on the registration of the MMU devices with the IOMMU core. I have added logic in omap_iommu_probe function to not register the second MMU device with the IOMMU core. There is also only one iommu_group now and the iommu sysfs entries do not show the second core anymore. Example output log given below. I have chosen to make the modifications in the probe rather than the .add_device callback as this is much simpler. It eliminates the need for additional logic for refcounting (need the iommu_group allocation only for the first client) and moving the iommu_group allocation out of probe. This also ensures the IOMMU device and group registration is done during probe itself irrespective of whether there are client nodes defined or not in the DTS (for the .add_device callbacks to be effective). Patches still based on your 4.13 arm/omap branch. DT representation and usage details are the same as described in v1 [1]. regards Suman [1] https://marc.info/?l=linux-omap&m=150418532431811&w=2 Following is the output of sysfs with these MMUs exercised with additional patches now: root@am57xx-evm:~# dmesg | grep mmu [ 0.520328] omap-iommu 40d01000.mmu: 40d01000.mmu registered [ 0.520676] omap-iommu 40d02000.mmu: 40d02000.mmu registered [ 0.521148] omap-iommu 58882000.mmu: 58882000.mmu registered [ 0.521638] omap-iommu 55082000.mmu: 55082000.mmu registered [ 0.522226] omap-iommu 41501000.mmu: 41501000.mmu registered [ 0.522575] omap-iommu 41502000.mmu: 41502000.mmu registered [ 0.523040] iommu: Adding device 58820000.ipu to group 1 [ 0.523192] iommu: Adding device 55020000.ipu to group 2 [ 0.523444] iommu: Adding device 40800000.dsp to group 0 [ 0.523841] iommu: Adding device 41000000.dsp to group 3 root@am57xx-evm:~# ls -l /sys/class/iommu/ lrwxrwxrwx 1 root root 0 Aug 8 03:59 40d01000.mmu -> ../../devices/platform/44000000.ocp/40d01000.mmu/iommu/40d01000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 41501000.mmu -> ../../devices/platform/44000000.ocp/41501000.mmu/iommu/41501000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 55082000.mmu -> ../../devices/platform/44000000.ocp/55082000.mmu/iommu/55082000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 58882000.mmu -> ../../devices/platform/44000000.ocp/58882000.mmu/iommu/58882000.mmu root@am57xx-evm:~# ls -l /sys/kernel/iommu_groups/ drwxr-xr-x 3 root root 0 Aug 8 03:59 0 drwxr-xr-x 3 root root 0 Aug 8 03:59 1 drwxr-xr-x 3 root root 0 Aug 8 03:59 2 drwxr-xr-x 3 root root 0 Aug 8 03:59 3 root@am57xx-evm:~# ls -l /sys/kernel/iommu_groups/*/devices /sys/kernel/iommu_groups/0/devices: lrwxrwxrwx 1 root root 0 Aug 8 03:59 40800000.dsp -> ../../../../devices/platform/44000000.ocp/40800000.dsp /sys/kernel/iommu_groups/1/devices: lrwxrwxrwx 1 root root 0 Aug 8 03:59 58820000.ipu -> ../../../../devices/platform/44000000.ocp/58820000.ipu /sys/kernel/iommu_groups/2/devices: lrwxrwxrwx 1 root root 0 Aug 8 03:59 55020000.ipu -> ../../../../devices/platform/44000000.ocp/55020000.ipu /sys/kernel/iommu_groups/3/devices: lrwxrwxrwx 1 root root 0 Aug 8 03:59 41000000.dsp -> ../../../../devices/platform/44000000.ocp/41000000.dsp root@am57xx-evm:~# ls -l /sys/kernel/iommu_groups/*/devices/*/ /sys/kernel/iommu_groups/0/devices/40800000.dsp/: lrwxrwxrwx 1 root root 0 Aug 8 04:04 driver -> ../../../../bus/platform/drivers/omap-rproc -rw-r--r-- 1 root root 4096 Aug 8 03:59 driver_override lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu -> ../40d01000.mmu/iommu/40d01000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu_group -> ../../../../kernel/iommu_groups/0 -r--r--r-- 1 root root 4096 Aug 8 03:59 modalias lrwxrwxrwx 1 root root 0 Aug 8 03:59 of_node -> ../../../../firmware/devicetree/base/ocp/dsp@40800000 drwxr-xr-x 2 root root 0 Aug 8 03:59 power drwxr-xr-x 3 root root 0 Aug 8 04:04 remoteproc lrwxrwxrwx 1 root root 0 Aug 8 03:59 subsystem -> ../../../../bus/platform -rw-r--r-- 1 root root 4096 Aug 8 03:59 uevent /sys/kernel/iommu_groups/1/devices/58820000.ipu/: lrwxrwxrwx 1 root root 0 Aug 8 04:04 driver -> ../../../../bus/platform/drivers/omap-rproc -rw-r--r-- 1 root root 4096 Aug 8 03:59 driver_override lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu -> ../58882000.mmu/iommu/58882000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu_group -> ../../../../kernel/iommu_groups/1 -r--r--r-- 1 root root 4096 Aug 8 03:59 modalias lrwxrwxrwx 1 root root 0 Aug 8 03:59 of_node -> ../../../../firmware/devicetree/base/ocp/ipu@58820000 drwxr-xr-x 2 root root 0 Aug 8 03:59 power drwxr-xr-x 3 root root 0 Aug 8 04:04 remoteproc lrwxrwxrwx 1 root root 0 Aug 8 03:59 subsystem -> ../../../../bus/platform -rw-r--r-- 1 root root 4096 Aug 8 03:59 uevent /sys/kernel/iommu_groups/2/devices/55020000.ipu/: lrwxrwxrwx 1 root root 0 Aug 8 04:04 driver -> ../../../../bus/platform/drivers/omap-rproc -rw-r--r-- 1 root root 4096 Aug 8 03:59 driver_override lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu -> ../55082000.mmu/iommu/55082000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu_group -> ../../../../kernel/iommu_groups/2 -r--r--r-- 1 root root 4096 Aug 8 03:59 modalias lrwxrwxrwx 1 root root 0 Aug 8 03:59 of_node -> ../../../../firmware/devicetree/base/ocp/ipu@55020000 drwxr-xr-x 2 root root 0 Aug 8 03:59 power drwxr-xr-x 3 root root 0 Aug 8 04:04 remoteproc lrwxrwxrwx 1 root root 0 Aug 8 03:59 subsystem -> ../../../../bus/platform -rw-r--r-- 1 root root 4096 Aug 8 03:59 uevent /sys/kernel/iommu_groups/3/devices/41000000.dsp/: lrwxrwxrwx 1 root root 0 Aug 8 04:04 driver -> ../../../../bus/platform/drivers/omap-rproc -rw-r--r-- 1 root root 4096 Aug 8 03:59 driver_override lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu -> ../41501000.mmu/iommu/41501000.mmu lrwxrwxrwx 1 root root 0 Aug 8 03:59 iommu_group -> ../../../../kernel/iommu_groups/3 -r--r--r-- 1 root root 4096 Aug 8 03:59 modalias lrwxrwxrwx 1 root root 0 Aug 8 03:59 of_node -> ../../../../firmware/devicetree/base/ocp/dsp@41000000 drwxr-xr-x 2 root root 0 Aug 8 03:59 power drwxr-xr-x 3 root root 0 Aug 8 04:04 remoteproc lrwxrwxrwx 1 root root 0 Aug 8 03:59 subsystem -> ../../../../bus/platform -rw-r--r-- 1 root root 4096 Aug 8 03:59 uevent Suman Anna (2): iommu/omap: Change the attach detection logic iommu/omap: Add support to program multiple iommus drivers/iommu/omap-iommu.c | 375 ++++++++++++++++++++++++++++++++++----------- drivers/iommu/omap-iommu.h | 30 ++-- 2 files changed, 296 insertions(+), 109 deletions(-) -- 2.13.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html