Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7082653imm; Tue, 24 Jul 2018 08:07:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdAOMEmbIFfYlzMPbBl9DmwHz7/Zq9lkFElx15viA0cyMr1Oasu3JNOWOOfh1mqsHXXsQ0W X-Received: by 2002:aa7:808f:: with SMTP id v15-v6mr18234493pff.38.1532444851515; Tue, 24 Jul 2018 08:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532444851; cv=none; d=google.com; s=arc-20160816; b=Cfk8am5hnyQfWU6B0lXvNYhTl270CJsYKUk9Uk11oJRdeV3ro5KaG27a/QiF6G42rq IUrItpUWdtCGxCPZ6MvjcIxQXxMy9LcNca0RwHDri3WyfojDUIhUwujUNBjdBJUntfdU nymwEyzRUd0dOeVOLyEFELG0LHTbdvqNvzoICIRoY6swR1Hac57wnRrpSSO1i6+1PF4f qNeKXJhfJIMsKxKQ3hnDbeerpV0saw+tPlOd2XAafzKwxoYi5R/QUKDkF7xqeTvFqfLI HhQisVq0WIuo7PIRC4gaHn9HtBS2VEMoTJ8aMQxsLxy67ntGZh2addBBTsLngR/ZVW5S wSsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=psaZoAGmUupsLEIl1sWpjS4VluVWLpN73Iw+xqNqnlk=; b=cLC1X6nCm55qND8IiUEaPDSPMF3DkfIrmQDuH5GbEx5cSP5fd6kG71GClonn1PuHfD lJMiEfsBWOervF+vD6qJ5CeyCmsgHWZn6XUFgPSVr70EdR6Q11bankVJM9CI+k9BQvwZ QLXbxj2mSAPZ0pI1130W4OIDcP+5evjFjUYOYJiek1FCzBcb/eTE2Ld31do67p4NJYgZ 38IGt0/p2ZC0uUZ+lb4UNhjwN3E7oBFoA/bAEtt3C2RDIkjIl2xLr4ItZsv/YXczjma1 lJXtHgc2hy+6fKwGsXv38moIE9jY8WfYzcfiVe/wlRb0g2PA02DLBMCd+PNR8I7QqsB2 cjjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lpMFA5qo; 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 f19-v6si7059077pgv.383.2018.07.24.08.07.16; Tue, 24 Jul 2018 08:07:31 -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=fail header.i=@gmail.com header.s=20161025 header.b=lpMFA5qo; 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 S2388402AbeGXQMn (ORCPT + 99 others); Tue, 24 Jul 2018 12:12:43 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:40765 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388298AbeGXQMn (ORCPT ); Tue, 24 Jul 2018 12:12:43 -0400 Received: by mail-qt0-f196.google.com with SMTP id h4-v6so4410783qtj.7; Tue, 24 Jul 2018 08:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=psaZoAGmUupsLEIl1sWpjS4VluVWLpN73Iw+xqNqnlk=; b=lpMFA5qoimJiTX4flWSO6w2ElEj07MInx6cGauTbT8ZI25Y4Pxx1iUd6wnMdJUgZiu iDGeRFK4uJn41/Dq/AirBDopBGrnT1aFPv5biiFuEOtIgGkO0cLJZyYeJ3Z+SZedlysl bgpO+Td/UB8sttZuaBzvaI28aabiCSu07eA/PfvlRCD5TPWSTMVZht/Vqht/5X3uI1s0 CtY7XySmlb+flvNIEZaOuODTkBGv3NYrB29pqGIiljsua23tfzXs+RTknZNvCtxqIya+ QsOqljrMri22WHFohlb3qb6F9KWJSYHWQGJe5a/H9lEdHqlq70zabbwJX+Tg478iK7gs 904w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=psaZoAGmUupsLEIl1sWpjS4VluVWLpN73Iw+xqNqnlk=; b=gl9m/FTWfPkGrAkCALOWZTd6AbB0If5cjbzrLVp40BYoRwz6DGr7D+bZxtezAIQ1HT 97hsGlKgdlbjWPduq3xvD2NfB0ThtjWrdtYwO2Lgi/zT0zqCpuBLy+tci+1vPQv4fS5a jpJNqzNbcDBRjzTrI0ZGQvagmrog1EXCvSOSLtCHr7LViYUIfMHEmQvcVeWpU4FPzYpU yn2pwzJ5DbOJy6HJYEn0Q4woxMBDqUiJtEJb163QBhi/sETPB0a4fPIFLk7kFvgD8enY l7OwRyB4vbEjOhbXBji44+l6g9BvGK/d8h7SN9ZT2hAhxCMuoOt6lx1oaa5FeVivrQVw ADBg== X-Gm-Message-State: AOUpUlEV00iase3z/39by9Nx4cIozPxBrB2to3NY88e9PBJCUwPIz5nl n6kERW9Z4EhEzpzFSuAfI04Ha8tpAEv7YJcfICc= X-Received: by 2002:ac8:274a:: with SMTP id h10-v6mr17090838qth.187.1532444746779; Tue, 24 Jul 2018 08:05:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:967d:0:0:0:0:0 with HTTP; Tue, 24 Jul 2018 08:05:45 -0700 (PDT) In-Reply-To: <20180724162806.318a92c6@bbrezillon> 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> <20180724162806.318a92c6@bbrezillon> From: Arnd Bergmann Date: Tue, 24 Jul 2018 17:05:45 +0200 X-Google-Sender-Auth: TogHELDCT3s3J0oc3OVOjxIMmYc Message-ID: Subject: Re: [PATCH v6 00/10] Add the I3C subsystem To: Boris Brezillon 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 24, 2018 at 4:28 PM, Boris Brezillon wrote: > 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. Ok, it sounded like that's what you wanted to do here. >> 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. That's not the case I was describing here, I was thinking of what Wolfram described with the Renesas SoC that has two i2c masters multiplexed through the pinmux layer. I would assume that we can still do the same thing in i3c by shutting down the current master without a handover, and reprobing everything from scratch. If only one of the two masters is physically connected to the bus at any time, the handover protocol certainly wouldn't apply. >> >> - 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. Why not? As I described in my earlier mail, we just need to make sure that either one of the two masters gets all the devices and the other master is completely disabled, or each master gets a subset of the devices and all other devices are marked as status="disabled" in DT to prevent them from being bound to a driver more than once. > 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. That sounds helpful, thanks a lot! Arnd