Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2293373ybt; Fri, 3 Jul 2020 05:49:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKBihZF4DvLBhhuRumJZFbk4vOklJ6/QBAvnX+zI4sQb7qdy6knl76ryJtPSkUKjuknk3r X-Received: by 2002:aa7:d4d2:: with SMTP id t18mr14110229edr.166.1593780597769; Fri, 03 Jul 2020 05:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593780597; cv=none; d=google.com; s=arc-20160816; b=zXkR7yWX7+sDnwzH4aLJ/oDerciHv0ZU9nNGk4D0wf5kShCDfepqLk0wyYCXVt1pPy NpSBN3Cu+H1M5cO8lAgdQGCyXq8o1sX8X9gPGvZi3Gb/YPuYkn7fP01wB2uV7fp9v5wy ApqYN4PnDQgt5EBl2ARwXC4fW7IJuWhWdUlDSmy2MzWuI3PC24jb4z0easUs+irP3v0e QFgUG9EObfVegvvWwgUngfZoasqztD8EvPk8B+6Kr3v6JtsJmhXc3CG9zusFHXlhOWme l8eDuBerznolLyL5HSCaQEppRn4gvkOpOOsToki/EM3f5k6gTfXjVqUC3AwxYPWu0VUz bEoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+2DP+dnO6whAv0f59sXlkOdBxT5ILzCGpoX6OXlCw70=; b=h93Et8yLhaV0Fs8mE9iGohxkyMnEpcBk1resWJ0WNMMHXkiZCLh2jGP9rN9PIucg1U w1ZCXKIN6PD048gyorIcyQoqWobsHsS/mkpexmlf1lMFAuCYy4zD1tPns3shq2DVavMp /HPh1TjvOX+Ju7u9V5yFzotHe8tMywS59hAOP+VORiqFiXeqaY/GTgcTCw8jaZ39LzVu yjJomRBRwwyEsJiEnC2ZbzLpwelKM5iFTIy2CctNlDs+quYGYRRl1gKwoB/ZJUVbfTQ8 Dfs+H/wUHwPHC3qNfMJxTv3yCPuqehvA2M8aIMPX/T0WhM2lmoTuBXaFTIhr8fIpnQ/n 4HLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z0x5onKc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr6si7618516ejb.259.2020.07.03.05.49.34; Fri, 03 Jul 2020 05:49:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Z0x5onKc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726178AbgGCMtV (ORCPT + 99 others); Fri, 3 Jul 2020 08:49:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:45992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbgGCMtV (ORCPT ); Fri, 3 Jul 2020 08:49:21 -0400 Received: from localhost (unknown [122.182.251.219]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE8D520899; Fri, 3 Jul 2020 12:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593780560; bh=+/21p5rQ6k7dd6nmGPMmmCDHBK6ejZw314j+mhRM2/A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z0x5onKcdtJbw5KpysufxQzolTSYRNWscUBkmrJIyVgHOUpN4EpEYuX8M/6MlvrEB pLC3Brtgq8rq8cNtRHsAW6nCIbTIxSoeeAEKEWkuMh8GhEggrx4G7bcxJgzjNMxq7D aLKqoFJhW8+9+7Yxoqi6EMs7/8vbQn0K+zONJh2Q= Date: Fri, 3 Jul 2020 18:19:12 +0530 From: Vinod Koul To: Will Deacon , John Stultz Cc: Marc Zyngier , lkml , Andy Gross , Bjorn Andersson , Joerg Roedel , Thomas Gleixner , Jason Cooper , Linus Walleij , Lina Iyer , Saravana Kannan , Todd Kjos , Greg Kroah-Hartman , linux-arm-msm , iommu@lists.linux-foundation.org, linux-gpio@vger.kernel.org Subject: Re: [RFC][PATCH 5/5] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module Message-ID: <20200703124912.GM273932@vkoul-mobl> References: <20200616061338.109499-1-john.stultz@linaro.org> <20200616061338.109499-6-john.stultz@linaro.org> <0be86735238a0f8b0c25934e2ed39eee@kernel.org> <20200703122343.GB18652@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200703122343.GB18652@willie-the-truck> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03-07-20, 13:23, Will Deacon wrote: > On Tue, Jun 16, 2020 at 01:52:32PM -0700, John Stultz wrote: > > On Tue, Jun 16, 2020 at 12:55 AM Marc Zyngier wrote: > > > On 2020-06-16 07:13, John Stultz wrote: > > > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > > > > index b510f67dfa49..714893535dd2 100644 > > > > --- a/drivers/iommu/Kconfig > > > > +++ b/drivers/iommu/Kconfig > > > > @@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU > > > > config ARM_SMMU > > > > tristate "ARM Ltd. System MMU (SMMU) Support" > > > > depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) && > > > > MMU > > > > + depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y > > > > > > This looks a bit ugly. Could you explain why we need this at the SMMU > > > level? I'd have expected the dependency to flow the other way around... > > > > Yea, so the arm-smmu-qcom.c file calls directly into the qcom-scm code > > via qcom_scm_qsmmu500_wait_safe_toggle() > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/arm-smmu-qcom.c?h=v5.8-rc1#n44 > > > > So if ARM_SMMU=y and QCOM_SCM=m we get: > > drivers/iommu/arm-smmu-qcom.o: In function `qcom_smmu500_reset': > > arm-smmu-qcom.c:(.text+0xb4): undefined reference to > > `qcom_scm_qsmmu500_wait_safe_toggle' > > > > Do you have a suggestion for an alternative approach? > > Can you use symbol_get() or something like that? How are module dependencies > handled by other drivers? So drivers deal with this by making rules in Kconfig which will prohibit this case. QCOM_SCM depends on ARM_SMMU with the caveat that if ARM_SMMU is a module, QCOM_SCM cant be inbuilt. This can be done by adding below line in Kconfig for QCOM_SCM: depends on ARM_SMMU || !ARM_SMMU This is quite prevalent is drivers to ensure dependency like this Thanks -- ~Vinod