Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1553181pxa; Thu, 20 Aug 2020 14:27:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI2LxRKPSui7PGrVU2i8AsM1kIq1Vk2HMA6X2WqMn7wxzyiJPNany2e8RRWKt7A4dMpXck X-Received: by 2002:aa7:c251:: with SMTP id y17mr547152edo.13.1597958868525; Thu, 20 Aug 2020 14:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597958868; cv=none; d=google.com; s=arc-20160816; b=cdtn6ztcW/8aRjtYwIx5YNN05Fuf2AbMv2pLYzgDeEGJlkvjK/8CkiTvO36hlImUPp DWFVwWdwXs19TJYBq8/R4JYDbN+GjdT+AtONldiGt5S28gE6okvfIwcyRSar2s+jMpST TQqqGHYN2mIH6gPp0xP380AnjWy6nvsRtfpTgsgBH/n5cOvFypGInzxxgoi/8LHStX4y leLZ9T3nh8cJQT3QZx1m6w52HByjmvy1RT7nqLZpBQsoMFer0Fmuo/FjDr7+TNMbVWYx lb1TC/lz1HgWFIByFYSxiguuPjVJhaGmsnDO73hpQn79jjrsQl+sHIbYHbAN5T13I/OA uVfw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=0NS+1o6H84M5KeXbmPXcxtfs+5ZYUBVwdz8bZ65/kBU=; b=tqpOe3f6cmz0zE/q5YFXXyBy7GdS3RkIybj6PpIeghcMgy3uuwGfx2tAC3KegMfPV0 bPlxNcVEhtF/XoBiXJytAw48uFKEKyx4Iyzvk3Bxqy8RILaP2RNCi5oinHTnv81xos8G RAM65nMrXTshJa9jNYytk869PQEHY6mI2eqaB920STgwIEcOtEhDKOvNI3iMb4ioJRk3 KKnF/QWo1RErbWRNRVTpiwU3hY1E7OhR6o5vLn+eVcmr1aHb+DrzanD+XhVU/ZMQX0jn 8hw1dp7jqi1ni/m5dCSkTzM6VbcUVTyLLageFrBYfVJ9S7uB24orx1cdZDmyAR4+GAAm 0IbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si2183881edu.335.2020.08.20.14.27.24; Thu, 20 Aug 2020 14:27:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbgHTTSp (ORCPT + 99 others); Thu, 20 Aug 2020 15:18:45 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34726 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726702AbgHTTSo (ORCPT ); Thu, 20 Aug 2020 15:18:44 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id A797C29AC9B; Thu, 20 Aug 2020 20:18:42 +0100 (BST) Date: Thu, 20 Aug 2020 21:18:39 +0200 From: Boris Brezillon To: Parshuram Raju Thombare Cc: "bbrezillon@kernel.org" , "vitor.soares@synopsys.com" , Przemyslaw Gaj , "linux-i3c@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Milind Parab , "praneeth@ti.com" Subject: Re: [PATCH v3] i3c: master: fix for SETDASA and DAA process Message-ID: <20200820211839.54a42cf6@collabora.com> In-Reply-To: <20200820210311.5934fc2a@collabora.com> References: <1597930706-15744-1-git-send-email-pthombar@cadence.com> <20200820164820.4fec97b3@collabora.com> <20200820210311.5934fc2a@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-redhat-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 Thu, 20 Aug 2020 21:03:11 +0200 Boris Brezillon wrote: > On Thu, 20 Aug 2020 18:16:14 +0000 > Parshuram Raju Thombare wrote: > > > >Hm, not sure that qualifies as a fix. The current implementation was > > >correct, it was just reserving a slot in the device table for devices > > >that didn't have an init address or on which SETDASA failed. > > If I3C controllers like ours use hardware slots to store slave devices info, > > due to limited available slots this can cause issue. > > If some slots are lost due to > > 1. only init_dyn_addr and no static_addr in DT > > OR > > 2. SETDASA failed > > Well, having a slot with a static address is valid, though I agree > it's not really useful. > > > at the end of DAA some devices may be left without dyn_addr allocated from master > > and hence can't work properly. > > My point is, there's no address or device slot leak, it's just that > reserving a slot for I3C devices that only have a static address is > kind of useless. But let's be honest, given the number of I3C devices > available out there, I don't think it will hurt us before quite some > time :P. That's not to say we shouldn't address that, I just don't > think it deserves a Fixes tag. > > > I think during our discussion we recognized this change as a bug. > > IIRC, I was talking about the first patch in the series. > > > That is the reason I added fixes tag, but if you think otherwise I can remove this tag. > > > > >> -static void i3c_master_pre_assign_dyn_addr(struct i3c_dev_desc *dev) > > >> +static int i3c_master_pre_assign_dyn_addr(struct i3c_master_controller > > >That function now does more than just assigning a dynamic address: it > > >also creates the i3c_dev_desc. It should be renamed accordingly > > >(i3c_master_early_i3c_dev_add() maybe). > > Ok > > > > >You should reserve the address before calling > > >i3c_master_pre_assign_dyn_addr(): > > > > > > /* > > > * We don't attach devices which are not addressable > > > * (no static_addr and dyn_addr) and devices with > > > * static_addr but no init_dyn_addr will participate in DAA. > > > */ > > > if (!i3cboardinfo->init_dyn_addr || > > > !i3cboardinfo->static_addr) > > > continue; > > Don't we want to cover the case when only init_dyn_addr is present ? > > Uh, yes, my bad. > > > I am not sure if we can't have init_dyn_addr without static_addr. > > You can, when you want to assign a specific dynamic address to a device > that doesn't have a static address (see the 'try to assign init_addr > dance' in i3c_dev_add()). > > > May be what we need is > > if (!i3cboardinfo->init_dyn_addr) > > continue; > > > > ret = i3c_bus_get_addr_slot_status(&master->bus, > > i3cboardinfo->init_dyn_addr); > > if (ret != I3C_ADDR_SLOT_FREE) { > > ret = -EBUSY; > > goto err_rstdaa; > > } > > > > i3c_bus_set_addr_slot_status(&master->bus, > > i3cboardinfo->init_dyn_addr, > > I3C_ADDR_SLOT_I3C_DEV); > > > > if (i3cboardinfo->static_addr) > > i3c_master_pre_assign_dyn_addr(master, i3cboardinfo); > > Yep, that's correct. > > > IMHO this is functionally same to what I sent. Just that init_dyn_addr is reserved before, > > and we leverage the change in reattach to bypass failure due to second attempt > > to get init_dyn_addr in reattach called from i3c_master_pre_assign_dyn_addr(). > > Unless I'm missing something, your solution didn't reserve the > init address when there's no static address, and we definitely want > that to happen, otherwise another device might steal it during DAA. My bad, it did. This being said, I find it much easier to follow when the reservation happens in one place, so I'm still in favor of the new version.