Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7040927imm; Tue, 24 Jul 2018 07:29:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFWcFJdUyPsSM7xyxxmPKPYWIfh1Ub+0Uv8T07gw7S2NGK3AppLONZq+Ursej3uz6HFux8 X-Received: by 2002:a62:8917:: with SMTP id v23-v6mr18165551pfd.127.1532442580418; Tue, 24 Jul 2018 07:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532442580; cv=none; d=google.com; s=arc-20160816; b=FqFvEJ0+k+888MNu6v4p86J/j0FEt5zNIOihRWYb5wGBXAhWjRZDXmrquKUFaiFlLE eSXsokWaxJG0EvFn60Vzfrl7FfocLlbigdcmAYxyHp3/1PtFkhpNGyh59fumUCi6Gary QgG5IyEyLMjFaBod40T+iqvcQeDlZcQp1Je3dlnimhUkNtd4wGgEQiO3WozGUQcMWr95 uG2Z8IsLk3wkOwG0vEHVNyULGZ0QtHzozJqbqy9ylJmi7b26JPNq2JeHzuR5BhJ+YZVq Vjndpbgd1WkkO5eKH0zAwp6iOza2ZGfGUGqbXfTo1Xpf7ehZIEGhP4cIGjcaoy/BNzE1 iOMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=07fkf8sSdvmIGzLTM9UAuM9aXxq3EzFebvCRHnGraLo=; b=wYKf8KWAsVxRPZiBF8LaEUvgMCLhcK95h2gmXe/H2H8ootqkiWxl1g4KxesufY2Isn EUWBRezc19G35rT+/wNDTGOXsVRlpHNYivKghcr6tN1fd4QuYv2rSuuTA9wLY5mhaBUv I7OFnqZPx6OIXn+CMal4IUkDj4ArqmE9oAkTzFQ1IN3O6l5KMIxGKMDkhW4Rp5C8q9TK NGFXJZ0a+1WYNv0RaiX0qjYxXN51Xlj2TSkOLNlrdVd5KE40qSv3hGxMlCJkSxI3UzEs d8sL6Yyepf4BfmGdWw6jV6U79glEc6RBYJDu2fvsM9QRWpSP4FrYl9CSx1sxbaC+I2fk kgNQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6-v6si11780383pgm.647.2018.07.24.07.29.25; Tue, 24 Jul 2018 07:29:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388543AbeGXPfH (ORCPT + 99 others); Tue, 24 Jul 2018 11:35:07 -0400 Received: from mail.bootlin.com ([62.4.15.54]:35682 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388460AbeGXPfH (ORCPT ); Tue, 24 Jul 2018 11:35:07 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 07C9E207AB; Tue, 24 Jul 2018 16:28:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-78-122.w90-88.abo.wanadoo.fr [90.88.20.122]) by mail.bootlin.com (Postfix) with ESMTPSA id 48CCE203D9; Tue, 24 Jul 2018 16:28:08 +0200 (CEST) Date: Tue, 24 Jul 2018 16:28:06 +0200 From: Boris Brezillon To: Arnd Bergmann Cc: Peter Rosin , Wolfram Sang , linux-i2c@vger.kernel.org, Jonathan Corbet , "open list:DOCUMENTATION" , Greg Kroah-Hartman , Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Rafal Ciepiela , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , DTML , Linux Kernel Mailing List , Vitor Soares , Geert Uytterhoeven , Linus Walleij , Xiang Lin , linux-gpio@vger.kernel.org, Sekhar Nori , Przemyslaw Gaj Subject: Re: [PATCH v6 00/10] Add the I3C subsystem Message-ID: <20180724162806.318a92c6@bbrezillon> In-Reply-To: References: <20180719152930.3715-1-boris.brezillon@bootlin.com> <2ab0ab75-2df0-2714-f007-c33b25481016@axentia.se> <20180720101206.tv7nsoanwo5ftnia@ninjato> <21b269c5-a3a7-c5de-c81e-c9c9301ae13e@axentia.se> <20180720151751.242d4809@bbrezillon> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On Tue, 24 Jul 2018 16:03:38 +0200 Arnd Bergmann wrote: > On Fri, Jul 20, 2018 at 3:17 PM, Boris Brezillon > wrote: > > On Fri, 20 Jul 2018 13:28:10 +0200 Arnd Bergmann wrote: > > > >> On Fri, Jul 20, 2018 at 1:13 PM, Peter Rosin wrote: > >> > On 2018-07-20 12:57, Arnd Bergmann wrote: > >> >> * What I understand from reading i2c-demux-pinctrl.c, a slave device > >> >> will only ever be observable from one master at a time, when you > >> >> switch over, all children get removed on one master and added to > >> >> the other one, to be probed again by their respective drivers. > >> >> I can see this as a useful feature on i3c as well, in particular to > >> >> deal with the situation where we have i2c slaves connected to a > >> >> pinmux that can switch them between an i3c master and an > >> >> i2c-only master (possibly a gpio based one). That particular use > >> >> case however doesn't seem to fix well in the current code, which > >> >> is structure around i3c buses. > >> > > >> > It's pretty easy to come up with examples where this reprobing is > >> > not desirable at all. E.g. if one of the involved I2C devices is > >> > a HDMI encoder (I have a TDA19988 here) sitting in the middle of the > >> > graphics pipeline. Blink-blink on the screen because some *other* > >> > unrelated device needed to be accessed by an alternative master. Not > >> > pretty. > >> > >> Agreed, we definitely don't want to reprobe all devices during normal > >> operation for i3c master handover. > >> > > > > Re-probing would not happen, no matter the solution we choose. It's > > that, in one case, you would have X virtual/linux devices representing > > the same physical device and in the other case, you would just have > > one, and everytime a transfer is requested by the driver, the core > > would pick the appropriate master to do it (most likely the one in > > control of the bus at that time) > > I think this is one of the cases I'd want to avoid: controlling multiple > masters that are active at the same time without going through > the handover. That's simply not possible, the I3C protocol forbids it. There can only be one active master on the bus at any point in time. > > If we have an actual pinmux between two masters and only one > of them can even see the bus, I think we should go through a > complete remove/probe cycle the way that the i2c-demux-pinctrl > does today. If OTOH we a primary/secondary master pair with > handover capability, I would prefer to not see one slave on > both devices at the same time, or (ideally) only use one of the > two masters and disable the other one completely. Again, you don't have a choice because it's part of the protocol. At any time, you only have one active master on the bus, and other masters are acting as slaves until they gain bus ownership (if they ever do). Say that device A wants to do an HDR transfer on the bus, and HDR is only supported by master X, but master Y is currently owning the bus. Master X will first have to request bus ownership before doing the transfer requested by device A. Now, imagine that device A wants to do an SDR transfer which is supported by both master X and master Y, and master Y is in control. Instead of requesting a bus handover, the framework would just automatically decide to do the transfer through master Y. That's the sort of things this separate bus/master representation allows. > > >> If we find a case in which it is needed, we could still deal with it > >> like this: > >> - enumerate all slaves connected to the bus for each of the > >> two masters > > > > That's what will happen if you don't share the same bus representation. > > To clarify: I meant list them in the DT representation, not enumerate > them in Linux during boot. Sorry for using a misleading description here. Okay. > > >> - mark each slave as status="enabled" in at most one of the > >> buses, and as disabled everywhere else > > > > We shouldn't need to do that. We can just let the driver check whether > > the master provides the necessary capabilities to efficiently > > communicate with the device, and if it does not just return -ENOTSUPP > > in the ->probe() function. This way you'll have a device, but not > > driver controlling it on one bus, and on the other bus, you'll have > > another device (which points to the same physical device) this time > > with a driver attached to it. > > I'd still hope that we can completely avoid that case and never > have the case where one physical device has two live > representations in the kernel. It /could/ still be done of course, > but would not always do the right thing, depending on the > type of device (a temperature sensor could just be probed > twice without problems, a network device probably cannot) Not really feasible if we don't share the same bus representation. So, that means you hope we'll never have a real case where 2 masters are connected to the same physical bus and both exposed to the same Linux instance. I'm still unsure what you think adds complexity in the current approach. When I implemented it, it looked like is was almost the same (in term of complexity) to have a bus object separated from the master, but I'm probably missing something. Anyway, here's what I propose. I'll work on a v7 where the bus object is tied to the master (and not exposed in sysfs or the DT representation) and the master itself is not represented as a device on the bus. This way you'll have both solutions to compare them and take a decision. Regards, Boris