Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2864042imm; Fri, 20 Jul 2018 06:19:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+i0NfcFWm86baUt5OXQ2PfoRTJtIHP+nuMdXLsq/uAVU2GJ+I/OZK9+j16EIOLP7ampoh X-Received: by 2002:a62:789:: with SMTP id 9-v6mr2171202pfh.213.1532092746498; Fri, 20 Jul 2018 06:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532092746; cv=none; d=google.com; s=arc-20160816; b=oKFLhUQkEHhgLyRxrzCHTmAg0AqrmICGIC91PGrMtZmIoSokmjq9v5zLoJHQoSL4M+ cLJ19qkD3NuYfGCyG754sLm7NoG5xtVXXepTye5hE/HWBtlyIVcR1zYqKdagDphNzyH8 FXbTH3y8jgNBseCi66cE8rTRT1YhSvIgpYaur2jVIcjN4iF9FCAiY4wvqxhsz8knp2e9 B1OTATI/muWLMOVqhOlOL/gj0MqDKK+gTrItaiAJ3xLW7feSFs9Jf7H0YJeS78jbP3fB Pvl8dx0qHtA+jtDufAuJ2pyr8d2aSztQGhivtVqplOjBPA4lQw3vapt28DqUUmQUlNtW LZog== 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=Pf2TTtmNy1q6YMjQnjF2OSiA7w1hYdHMSVuxnuM6vSo=; b=xkUEdO39VgiFWz6CO7UlnucQD7Wn3E0vKki/+uSOwW21tUCSvzIsd4D4CSiTTe2mfL LVhWcGFiQ1noEmgzUBLkI6U9lslxX0d4y4u95kMx0N2aY25IJlpHGre8p/TXe/jBLRZM K+KcqtONIjC82Dg2hP1wLNsuCDKGE6rRwj0QsWCGHc8kKZGJ/Twe15JzM9lTtCn6eY44 a553RNcRuUkacK8vnSBKHJPwGKq6SShUIVGpgFAod8XQYwh4a644Z+uhO8uw9zlVtGU2 blXughozWO1Gbb+LPtUmyaaRAcwYYAwDJkP8+X899Scniwe/7syx904Jrqt7WIJoF/p2 temA== 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 o3-v6si1664975plk.321.2018.07.20.06.18.51; Fri, 20 Jul 2018 06:19:06 -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 S1731742AbeGTOGU (ORCPT + 99 others); Fri, 20 Jul 2018 10:06:20 -0400 Received: from mail.bootlin.com ([62.4.15.54]:49678 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731492AbeGTOGU (ORCPT ); Fri, 20 Jul 2018 10:06:20 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 9635B2073D; Fri, 20 Jul 2018 15:18:02 +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 DBC7F20618; Fri, 20 Jul 2018 15:17:51 +0200 (CEST) Date: Fri, 20 Jul 2018 15:17:51 +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: <20180720151751.242d4809@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> 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 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) > What is the least contrived use case that you can think of where we > would want to use one master to talk to one device on the bus, > but another master to talk to another device on the same bus? The only reason I see for this use case is when you have 2 masters, each of them having different capabilities: device A needs cap X device B need cap Y master N provides cap X but not cap Y master M provides cap Y but not cap X In this case you'd want device A to use master M and device B to use master N. > I still hope that we can decide that this is not a useful scenario > at all. I'm not saying this scenario is about to happen IRL, just describing one potential reason for having 2 different masters connected to the same bus and both exposed to Linux. > > 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. > - 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. > - Use dynamic handover according to the bus protocol to > switch masters without having Linux even know that the > two buses are shared. Yep. > > That scenario would then fall completely into the "secondary > master handover" category but require no special handling > in the i3c layer beyond what we need for secondary masters > that are managed by something outside of the kernel's > score (a microcontroller, firmware, ...). I definitely agree that both options should work. It's just that having X times the same physical device represented in Linux seemed like a bad thing to me, but it's also not something I'm strongly opposed to. Regards, Boris