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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84E21C25B7A for ; Tue, 14 May 2024 12:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xcCz+I7UM+RTCBWaNWvfl4vkumZ2Orq4IHk3tEg819c=; b=0gluo3m8ffZnlo /LfOyMqg8qoHWoZ+GQ3YUvNsvx0gcyvitwJWGOi8xiRFYUNYzDA+Aj2NtJmthB7OW5mjsMc5cPQ7j xyZG3wZJ5UwT5HEqAh4sh7eZhw/jhbOZQaH6EnnSMc21K4NfCRi9VZRSy/qiNaH49dS5zkjQ1RUBg YcJyvGVm9WVnCZWvUfGeGojjZX6hPTUOr2F/le0XCbybvOrCoQ8c38g7JYiNmfK454TeHkOlUCWWm UJSTfqVaO9nczT1/xe3liXOQT4WH21EQSYjT2Tb0dnH0y3yv4vrklj7mc1zjNHuGS8bdvzGT8KEzE VUoSaRaYu6A3xiN0Oa6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6rgz-0000000Fw6M-1W7N; Tue, 14 May 2024 12:55:41 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6rgn-0000000Fvxl-3ikL for linux-arm-kernel@lists.infradead.org; Tue, 14 May 2024 12:55:33 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-572f6c56cdaso14239a12.0 for ; Tue, 14 May 2024 05:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715691323; x=1716296123; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ZcD3SBMv2WPSWvvEmNokB9qUa6fTCk0gkIkCBa9/VH4=; b=kGVF2KmxkLzijzT3JgbvA6smvDmJJ1djwewpcGEC3DeLmsCk4U9DDvX3W+vyuduhZb 41aYHENrHCNOszCMmYbRrmaRvmXYUC2Jv4JXJsCPwsjcVDwrMGgh9q8CbwYOhURPTnl4 s3hlUzPhFNFqQAhJR77rNe2TqymNs+ssKV9VYLCdIaRKAYe+g1TaU/Q8ERkKSe7YOR9o McmACKnchtemswrEMvmmy0mr1vBsWhbw7cHan9mHLvpGrUiPcOKXN1mno0QiX3Uf6gIU FQ0i1jTfaqbEFkrLMnMvtsq9COPB/rIJi3ba7JlH2BwF+Zz+b2IGAlHK5sGTw1/87AfH C/Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715691323; x=1716296123; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZcD3SBMv2WPSWvvEmNokB9qUa6fTCk0gkIkCBa9/VH4=; b=UEVeyphsTf+Kt31mXhdrOvu5iFE8nfERoYz8UzgtDnHzlkxE0/h8VImV0U8vXexprc dIHwYVRuDPZYTjDlI6zxV1vmAsNfpiNJt7NiKp2+Gv9PbHZQS7N67mN7YDDK3USyyg1D 2FMTNXHuW4trcXtTgl6cax1ay5XFslpurFyT+v9mtSgHGcLlzOIu4EQrKoAmhmJjPbWU nkzfMCUqflJiXSH2k7vn0BLs956DBp5arlgmYpMrW82mH/r20U15tyovBAFPAbwVmsZb vcLPQ4nmwxQL82m0GU/unV77ZnjKvQhNdXYObcBngDaFyzj/V45UZVY5BL6iPnsRftp3 lTTQ== X-Gm-Message-State: AOJu0YyVZYLtJZ3875c4vy7bMG70t1I9C7BG+zky8yliBYK7USEAq28e w92hrJeBr5J/HJDs5ZwhDk7C8fJC3ny+PieQ3jQCDH5eSHg+97lWmfiXveySULUZrGzCNlGwkw1 wmQ== X-Google-Smtp-Source: AGHT+IEGOBnrKJ1RMjqRPDGBcQ7/M2ddcU4Zyag8LsmSYCKwQLZ25wdNUKi33weh/KdXplq87V3cmA== X-Received: by 2002:a05:6402:1e87:b0:574:ea5c:fa24 with SMTP id 4fb4d7f45d1cf-574ea5cfac9mr68722a12.3.1715691323141; Tue, 14 May 2024 05:55:23 -0700 (PDT) Received: from google.com (216.131.76.34.bc.googleusercontent.com. [34.76.131.216]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3518d817ee2sm9951642f8f.2.2024.05.14.05.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 05:55:22 -0700 (PDT) Date: Tue, 14 May 2024 12:55:20 +0000 From: Sebastian Ene To: Sudeep Holla Cc: linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi , Jens Wiklander Subject: Re: [PATCH 1/2] firmware: arm_ffa: Move the FF-A v1.0 NULL UUID workaround to bus notifier Message-ID: References: <20240510183811.3802285-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240510183811.3802285-1-sudeep.holla@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240514_055530_109506_EAC3C5DD X-CRM114-Status: GOOD ( 37.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 10, 2024 at 07:38:10PM +0100, Sudeep Holla wrote: > Currently FF-A bus ffa_device_match() handles the workaround for the > FF-A v1.0 devices which are not populated with UUID to match. The FF-A > bus layer calls into FF-A driver and populates the device UUID if it > matches with the driver attempting to match. > > But this forces to have both FF-A bus and core driver to be bundled into > a single module. However, keep it as a single module adds problems for > the FF-A driver registrations and their initcall levels. > > In preparation to split the FF-A bus and the core driver into distinct > modules, we need to move the workaround away from the FF-A bus layer. > We can add it into the FF-A core driver as a bus notifier. > > In order to do so, we need to always match any driver with the device if > the UUID is NULL and then during the driver binding phase, we can populate > the UUID if it matches with the driver UUID table using the bus notifiers. > We also need to add a check for NULL UUID before calling the device/driver > probe as devices with NULL UUID is possible since we match all for that > case. > > Signed-off-by: Sudeep Holla > --- > drivers/firmware/arm_ffa/driver.c | 33 ++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > index 9f89ee0aaa6b..159f2106a541 100644 > --- a/drivers/firmware/arm_ffa/driver.c > +++ b/drivers/firmware/arm_ffa/driver.c > @@ -1235,6 +1235,29 @@ void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid) > kfree(pbuf); > } Hello Sudeep, > > +static int > +ffa_bus_notifier(struct notifier_block *nb, unsigned long action, void *data) > +{ > + struct device *dev = data; > + struct ffa_device *fdev = to_ffa_dev(dev); > + > + if (action == BUS_NOTIFY_BIND_DRIVER) { > + struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver); > + const struct ffa_device_id *id_table = ffa_drv->id_table; > + > + if (uuid_is_null(&fdev->uuid)) > + ffa_device_match_uuid(fdev, &id_table->uuid); > + > + return NOTIFY_OK; > + } > + > + return NOTIFY_DONE; > +} > + > +static struct notifier_block ffa_bus_nb = { > + .notifier_call = ffa_bus_notifier, > +}; > + > static int ffa_setup_partitions(void) > { > int count, idx, ret; > @@ -1243,6 +1266,14 @@ static int ffa_setup_partitions(void) > struct ffa_dev_part_info *info; > struct ffa_partition_info *pbuf, *tpbuf; > > + if (drv_info->version == FFA_VERSION_1_0) { Should we remove the version check inside the ffa_device_match_uuid function as this function will only be called from the bus notifier ? > + ret = bus_register_notifier(&ffa_bus_type, &ffa_bus_nb); > + if (ret) { > + pr_err("Failed to register FF-A bus notifiers\n"); > + return ret; > + } > + } > + > count = ffa_partition_probe(&uuid_null, &pbuf); > if (count <= 0) { > pr_info("%s: No partitions found, error %d\n", __func__, count); > @@ -1254,7 +1285,7 @@ static int ffa_setup_partitions(void) > import_uuid(&uuid, (u8 *)tpbuf->uuid); > > /* Note that if the UUID will be uuid_null, that will require > - * ffa_device_match() to find the UUID of this partition id > + * ffa_bus_notifier() to find the UUID of this partition id > * with help of ffa_device_match_uuid(). FF-A v1.1 and above > * provides UUID here for each partition as part of the > * discovery API and the same is passed. > -- > 2.43.2 > Also I wonder if we should have the change from patch 2 (the one which removes the ffa_device_match_uuid call from ffa_device_match) inside this. Wdyth ? Thank you, Sebastian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel