From patchwork Mon Jun 6 03:58:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9157175 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AAE2A607FD for ; Mon, 6 Jun 2016 04:09:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1CC927B13 for ; Mon, 6 Jun 2016 04:09:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95D072821F; Mon, 6 Jun 2016 04:09:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FD9027C8F for ; Mon, 6 Jun 2016 04:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753226AbcFFEIp (ORCPT ); Mon, 6 Jun 2016 00:08:45 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:32881 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbcFFEIo (ORCPT ); Mon, 6 Jun 2016 00:08:44 -0400 Received: by mail-pf0-f194.google.com with SMTP id u67so796157pfu.0; Sun, 05 Jun 2016 21:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=P3LpYuFKWawN2rjCR1o+kRC1u1POKQZFUKt4LiIP99s=; b=0gpklUNHtQzZoWyRbuZwjv3Kd0QeHt7bFevikVWSzvexVwbqy0e5QYho+fnkNutfxV zTXQFKlkqavqNW9juTRxvwkDE4AyuT0QXViqrAE9KlPIuwGzvcw5CQLbKBiHyIjn2KXl cW4TDKx23zXM2cAlI8Obj8U4DLJOTgvUqjjLfDIxepiRKoZj5IDDEXg5pBD+hEonYD+L 41emKmpugKNvuhcNswhOYzU2o1DT6kuiJF1hQSkPFROokvtJsgz68r4llxtRCE/JSLDw dsCSJmGZeoY1aurTvR5cSayL6lm6g+RimDOQ9EDOqQEFj8KsZVnl2Lg1PyjVkvpkmHux ZDTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=P3LpYuFKWawN2rjCR1o+kRC1u1POKQZFUKt4LiIP99s=; b=KV/UDW1vTE0BPT5fwhIw0hzp6ApD7LTpW4XUzwkzMsB81ZxeiOY2uK6/b9+vrIIuwO MFeD0DjplhAK/854z0tYI6i67OZLBBsECBFkmFf0fZjcT1XLoZBDHFltaA9+xegnvvVh 489Nh6Vf8Nl7Rr6daBmb3m6KC+vGFvcm92eJUb5EfsGvvWOmmmubk3ET91z2Vk2t6TqR 2k13eprdpPGSPDGTeCC7GUgpTOXNa1LMQtO5qiwgf8E3Mq9WaaUspN+nqd9X9UMcbGJY aRdxiG29EKpMnFEmpAkB/CM5QJbZJxzRdMdOEAbkSNMxtZytllco8Kfxfw55lRClFsAt nr4g== X-Gm-Message-State: ALyK8tI52SJEBuiySa7brEu9Z3N8t96vQyFR35v9zNCMu0Jq4gysDM4ztMpD2c8vC8dK5w== X-Received: by 10.98.35.129 with SMTP id q1mr23063264pfj.48.1465186123105; Sun, 05 Jun 2016 21:08:43 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id qz5sm6171482pab.1.2016.06.05.21.08.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jun 2016 21:08:42 -0700 (PDT) From: Magnus Damm To: iommu@lists.linux-foundation.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm Date: Mon, 06 Jun 2016 12:58:22 +0900 Message-Id: <20160606035822.31763.39713.sendpatchset@little-apple> In-Reply-To: <20160606035723.31763.66500.sendpatchset@little-apple> References: <20160606035723.31763.66500.sendpatchset@little-apple> Subject: [PATCH v2 06/11] iommu/ipmmu-vmsa: Teach xlate() to skip disabled iommus Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm The ->xlate() call gets invoked even though the iommu device has status = "disabled" in DT, so make sure we skip over disabled devices. In my mind it would make sense to have this at some shared level, but I guess some users may want to configure the iommu regardless of DT state. Signed-off-by: Magnus Damm --- Changes since V1: - Reworked slightly to fit on top of updated patch order drivers/iommu/ipmmu-vmsa.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- 0017/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 10:58:18.530607110 +0900 @@ -1001,7 +1001,13 @@ static struct iommu_group *ipmmu_device_ static int ipmmu_of_xlate_dma(struct device *dev, struct of_phandle_args *spec) { - /* dummy callback to satisfy of_iommu_configure() */ + /* If the IPMMU device is disabled in DT then return error + * to make sure the of_iommu code does not install ops + * even though the iommu device is disabled + */ + if (!of_device_is_available(spec->np)) + return -ENODEV; + return 0; }