From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FE0BC433DB for ; Wed, 10 Feb 2021 08:28:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9E5A64E3E for ; Wed, 10 Feb 2021 08:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbhBJI1K (ORCPT ); Wed, 10 Feb 2021 03:27:10 -0500 Received: from mail-oi1-f169.google.com ([209.85.167.169]:42596 "EHLO mail-oi1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233534AbhBJI0W (ORCPT ); Wed, 10 Feb 2021 03:26:22 -0500 Received: by mail-oi1-f169.google.com with SMTP id u66so1137800oig.9; Wed, 10 Feb 2021 00:26:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aGjLISWJ+fszvKmcvo2/oB8kqSJgVo4mq+414YKd0ak=; b=tTM6x9WvBKj6CCIlz5RGq1bETqJFXJYJAyrAXjmBzr16syAZxbUCQOGezwW2g727mV w614B9nQnvXZ8OYELXXA+2fURs4cGDkRsj/f66PXoqNUY5tY8ZpgyahSXVf8kBX0L/sE WDjWyDtsCnZofUMxrngqtSJ2clsWhMoo+KtFahwp8HtKKFJiaA/MhFZb+gkY7qLNnHzs oLjEvT1FJW58acYBABkf7kLGPUpra3CoZtS+Ul8ViCMgUNv/4hzy3yRVOXff/MuTvPPd wVBu46NiyjJc3trNDdKRUYqvPe3wVCdyXiay6CbPlbN/K/EHZ2Bi9E8+uurDFardRwmZ /j4g== X-Gm-Message-State: AOAM530czFG4/8pl89E0IAj34w1s5I0BFI7K9LTibSdoee0QrQpUkjP1 JT9cbPZ8rztGkspJ0aSdxBnTfklbLzCSp3+DHaE= X-Google-Smtp-Source: ABdhPJw76RbbTdIjOWOYdNuMSRd5sBeR2j0014yZb4MdeOrBQA1HjGlwkbMtEPnZoE9rsvsL6sEmWZSBR33/719FBhk= X-Received: by 2002:a54:4e88:: with SMTP id c8mr1277055oiy.148.1612945537621; Wed, 10 Feb 2021 00:25:37 -0800 (PST) MIME-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> <20210205222644.2357303-5-saravanak@google.com> <20210209213320.GA219007@robh.at.kernel.org> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 10 Feb 2021 09:25:26 +0100 Message-ID: Subject: Re: [PATCH v4 4/8] of: property: Add fw_devlink support for optional properties To: Saravana Kannan Cc: Rob Herring , Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Frank Rowand , Marc Zyngier , Thomas Gleixner , Linux Doc Mailing List , LKML , Linux PM , linux-clk , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , ACPI Devel Maling List , Marek Szyprowski , Android Kernel Team , Joerg Roedel , Linux IOMMU Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi Saravana, CC iommu On Tue, Feb 9, 2021 at 10:55 PM Saravana Kannan wrote: > On Tue, Feb 9, 2021 at 1:33 PM Rob Herring wrote: > > On Fri, Feb 05, 2021 at 02:26:40PM -0800, Saravana Kannan wrote: > > > Not all DT bindings are mandatory bindings. Add support for optional DT > > > bindings and mark iommus, iommu-map, dmas as optional DT bindings. > > > > I don't think we can say these are optional or not. It's got to be a > > driver decision somehow. > > Right, so maybe the word "optional" isn't a good name for it. I can > change that if you want. > > The point being, fw_devlink can't block the probe of this driver based > on iommu property. We let the driver decide if it wants to > -EPROBE_DEFER or not or however it wants to handle this. The driver cannot make that decision, cfr. below. > > For example, if IOMMU is optional, what happens with this sequence: > > > > driver probes without IOMMU > > driver calls dma_map_?() > > IOMMU driver probes > > h/w accesses DMA buffer --> BOOM! Does it really behave that way? Or does it continue without IOMMU? > Right. But how is this really related to fw_devlink? AFAICT, this is > an issue even today. If the driver needs the IOMMU, then it needs to > make sure the IOMMU has probed? What am I missing? Individual I/O (IOMMU slave) drivers are completely unaware of the presence or absence of an IOMMU; they just use the DMA API, which is the same regardless of an IOMMU being used or not. While for GPIO/IRQ/CLK/DMA/... have request/get_{gpio,irq,clk,dma,...} APIs for a driver to get a reference, which can return -EPROBE_DEFER, no such thing exists for IOMMUs. This is handled by the IOMMU core instead. Using the IOMMU or not is more like a system policy decision. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds