Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7002824ybi; Mon, 8 Jul 2019 12:28:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjYvB7Y1CFjv4XE/FS8RqxM6DqTDBYAqfZDeWQITmR/Bgk9TOFfVlFz5ZsRfeHMkxinKst X-Received: by 2002:a17:902:4283:: with SMTP id h3mr26316971pld.15.1562614119760; Mon, 08 Jul 2019 12:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562614119; cv=none; d=google.com; s=arc-20160816; b=Ktz44KK5xFLEZnJkvr5OqmpjYEnE28Psg5MASRNHwFebz2erK+yLAI/0a+mizSKmVN xT+8H4NKNV3xq+01T0rCTCl7temCK8itjVY6IBYMfzi/AMHRSolf5d/K7SoFt5HY90jz sA7yE2CVPUoftP7wv9JYpNT7pm/3K5pFzEp99QhVUxNPjhcUmGblqKhnT+zdj3inOi00 Cb9Uofu8PRROXnFiy3em8YsVeHxfxOPqL5Bg7i25BOUsmvTRtd3w9ect8twk8SYmH6nA 4zHEyOuI8QNd7floptOy7GWRfdR2len6rDmNGsMJ86XqJaGMzI4HfLbvjSpbLuVd1tbD YVQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=0ZlZQON9aXZI6W+/rm8yZm1Su8lHYcjbQIV3vB7p7ls=; b=THMOkkgR3qOoSFe+afzaOyOhVMzEr4RKW5bzbx0mTRJkS23D7jRueJSQEHynlVO3UU fYNvuNBFdzNGlwOrTFqtHRKbFvbh8Xtjnj/WZW7cQgnz0gZCE6frMWTWOEpF+TSYULlG OzW2XXotJvU6MrtJQcL2W8h2ihl8MQo3rPQSb5dkEu6vj5fWWOkDsmCcqKIdhdhqfTHr Ns1fUeyjsV719NYsCqWtIAlnllvReRO46sxEWJ9qd0Jxd9utjAYevPtvEXAqRs7lMqIu NYYA+8dwGyujJdOoOes3wJPtOKGpM3t0OAMtFtsTENIdpXKbMgGcQGhcMDGPhVEVrln5 yYPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="WLG9PY/b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si14425492pls.183.2019.07.08.12.28.24; Mon, 08 Jul 2019 12:28:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="WLG9PY/b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729419AbfGHPMc (ORCPT + 99 others); Mon, 8 Jul 2019 11:12:32 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37674 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfGHPMb (ORCPT ); Mon, 8 Jul 2019 11:12:31 -0400 Received: by mail-pl1-f193.google.com with SMTP id b3so5127645plr.4; Mon, 08 Jul 2019 08:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0ZlZQON9aXZI6W+/rm8yZm1Su8lHYcjbQIV3vB7p7ls=; b=WLG9PY/b56egrw6ro2o0M9u014Bd6pXU/gKDM9DWFKxH39OIF3810maRQKFlW5uRIq pN+4h9otmfgFm2UMQ05iVf/Mz/oGsvnbZgMWTSNQujR8HC+qUf73scnCmGiRJH+v0k08 smv9KF8upZ4PAvBORJTFLeotH0hcXF9rwCuDgCTGs1M8R9cApI/vNYc7JLSeqATcqdfI h9abqenJJqCvOVVx0LKtp2nIG/lIyiqsEPUtvRfgGJ5jymTuV3QTGxV7KiDXtnfmeQCk IVOu6WplVBtQMIhTvR1thGTS8x4ieB5i5f/al64O31QA5Ml7yJ3AQVYX0yGYLoBoqLwD PgJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0ZlZQON9aXZI6W+/rm8yZm1Su8lHYcjbQIV3vB7p7ls=; b=uYOct0+wvqNwwBBTyNFFdnU/uVaetnVjvHCWcw+bD/hKA1RXhrTlIJbUqFOXnbKOBm nTjoc+1minjXfYby7CAG4xZSJMQZEQTY+H/wCuhOk90B2PJj7RFARc6NnETL4y8xD+W8 56bV/arjwOG7WCGEGZqhOnAQ87AQNpNeDXEwrVoaKdGO+KAFLTf0ZON/USSruXh4OW53 6urZ0cChSp6I/BwFrchFaE6G9TLdbA8mJiIBC7xdad4fjnCl4UtuLtF5/tqLyPApX0Sn NhAqtEePs20vrrpu8tBDnU2swl6vtQIJ/IgwHKPKOOu72f15lps8KxSZ5EYNA0T8ldL0 8lCg== X-Gm-Message-State: APjAAAXUswhjy8T6jwVVp/fNzGQnNRr0NIHcrH0PLZgm/ujCE2Newx5P Kl+tXv5j5Y3vRxTWVAVhuzQ= X-Received: by 2002:a17:902:b20d:: with SMTP id t13mr24385288plr.229.1562598750859; Mon, 08 Jul 2019 08:12:30 -0700 (PDT) Received: from aw-bldr-10.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id q198sm23082354pfq.155.2019.07.08.08.12.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 08:12:30 -0700 (PDT) From: Jeffrey Hugo To: robdclark@gmail.com, sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch, bjorn.andersson@linaro.org Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH v2] drm/msm/mdp5: Find correct node for creating gem address space Date: Mon, 8 Jul 2019 08:12:24 -0700 Message-Id: <20190708151224.22555-1-jeffrey.l.hugo@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Creating the msm gem address space requires a reference to the dev where the iommu is located. The driver currently assumes this is the same as the platform device, which breaks when the iommu is outside of the platform device (ie in the parent). Default to using the platform device, but check to see if that has an iommu reference, and if not, use the parent device instead. This should handle all the various iommu designs for mdp5 supported systems. Signed-off-by: Jeffrey Hugo --- v2: It turns out there isn't a universal way to get the iommu device, so check to see if its in the current node or parent drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 4a60f5fca6b0..02dc7d426cb0 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -663,6 +663,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) struct msm_kms *kms; struct msm_gem_address_space *aspace; int irq, i, ret; + struct device *iommu_dev; /* priv->kms would have been populated by the MDP5 driver */ kms = priv->kms; @@ -702,7 +703,11 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) mdelay(16); if (config->platform.iommu) { - aspace = msm_gem_address_space_create(&pdev->dev, + iommu_dev = &pdev->dev; + if (!iommu_dev->iommu_fwspec) + iommu_dev = iommu_dev->parent; + + aspace = msm_gem_address_space_create(iommu_dev, config->platform.iommu, "mdp5"); if (IS_ERR(aspace)) { ret = PTR_ERR(aspace); -- 2.17.1