Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp877386pxb; Wed, 29 Sep 2021 11:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx13SL52t7o+F+H+U+YmIwxrBw74x0Kz9QQ8lOcLNGTEY9fLaKA3dj8vZwtey0ilXuQMZ3l X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr1695479edb.169.1632940350335; Wed, 29 Sep 2021 11:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632940350; cv=none; d=google.com; s=arc-20160816; b=ZFQIcf/nao2dVZF2VVCI4mBRdyrxhbvTnmAU7+UQAuMW6TKkT1LvnRS34X7Mbeen7v TiHcStUVjyrDEc8jSu5x3vJha08Jyi+pXXGUmgMVUjBMDd/e1Ggp79pJMV9GFcZyb9pf IGrudbkRc91ux7PerT5RDePq3oCKfixxJyBuLXHNAjStDqO17egOERUKN/WWAc+tygxf 1gzHi6f0pNPmeq/Yak7n3vHJzIXqdlNcma1elkTtLcY05JlyYHO0W0N10DpdLna3l/iH kAOSy8uI650R4lVlOybw0nOCCpEjMdMFXPetT3opy+MkbB0JxSFRhokc76ioxvlrbgYP zDqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PZ2BnVccAHvhRU+jrsZTOy9Gya9Z6imcjNaRX+m4kyg=; b=ZEik40rut9uZcAyE8zDf4dQc0M6rjPgYDun1d1ZjpcDcdGfLdSAIlnrZxpJQTRuGB/ 5+emdxMtbGUgy/3I8x0ZfDOOdkM3iqBfLlyX3LMA1q9/tm1zxgmbcAXltNVpjzvoM6lW DH4kzqq2rDRat4HhslkTp3lK33VON+TIviwREI/ovlwZDoQuSuW6dKVJxGiZhrPrKx7F 3/EsUe86Ep+0uSX/APLHrjcF946VRy1dNTdbOkivjyMExj5UZ7jq3ttdArtdoynNosA6 OFfm6oe9spR6TL34S7Z9aM3bEfG9kIu5SHtG2Nr3l0ti/YLHZ9AboyFmZoV8u7uAjBz9 I0Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CISl9Rl7; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 kl24si664889ejc.190.2021.09.29.11.31.51; Wed, 29 Sep 2021 11:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=k20201202 header.b=CISl9Rl7; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S1346165AbhI2Scc (ORCPT + 78 others); Wed, 29 Sep 2021 14:32:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:60364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345707AbhI2Scb (ORCPT ); Wed, 29 Sep 2021 14:32:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8816F61527; Wed, 29 Sep 2021 18:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632940249; bh=gjF28VMTIug2m1bl/FU/M9snQ4rR61AFv5fVsRKalNI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CISl9Rl7R+M6haM6b37hM8Y55j2HAbcMi0eojp8x2X5LO3rMaVS5sudmIbZDpY2Fa v3jkZlxqIQsgk7xdc/KNDPDNwnRYggSWDCUgB/s/FiZxlhlKX24dWHVpR7Wt0mlN/7 mhK6ym9B69BkMQdp4WI4pKJ+rr90hmai+tmZp9rhMJtK7ONWh9AhmLAFD2pHKhaUG3 HMRbEb2CCpVxIrKjjd6yE6ttU5SikyGGITOLPKJu1L7QFLNrx8p43TXVkgBvbCSBJk HoUf+R5uDfbywO7AlRlXS5uX8pbpj5u56JSH5+uMScUwkPlS/zeQ1/1lCIAk541NMv d88464bdH/fHQ== Received: by mail-wr1-f46.google.com with SMTP id s21so5795619wra.7; Wed, 29 Sep 2021 11:30:49 -0700 (PDT) X-Gm-Message-State: AOAM533mlJSocCVOo/4P9J4qQuKiBP7NH/xEdDD9UUrSLsaNSwbRmlJY BB6Hiwg8DRcMl0JsnYHnxRYjLAvza1+qy4aCjik= X-Received: by 2002:a05:6000:1561:: with SMTP id 1mr1607418wrz.369.1632940247984; Wed, 29 Sep 2021 11:30:47 -0700 (PDT) MIME-Version: 1.0 References: <20210927152412.2900928-1-arnd@kernel.org> <20210929095107.GA21057@willie-the-truck> In-Reply-To: From: Arnd Bergmann Date: Wed, 29 Sep 2021 20:30:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] [RFC] qcom_scm: hide Kconfig symbol To: Bjorn Andersson Cc: Will Deacon , Arnd Bergmann , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Joerg Roedel , Mauro Carvalho Chehab , Ulf Hansson , Alex Elder , "David S. Miller" , Jakub Kicinski , Kalle Valo , Andy Gross , Linus Walleij , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Linux Kernel Mailing List , linux-arm-msm , dri-devel , freedreno , "open list:IOMMU DRIVERS" , Linux Media Mailing List , linux-mmc , Networking , ath10k@lists.infradead.org, linux-wireless , "open list:GPIO SUBSYSTEM" , Linux ARM , linux-sunxi@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, Sep 29, 2021 at 4:46 PM Bjorn Andersson wrote: > > On Wed 29 Sep 05:04 CDT 2021, Arnd Bergmann wrote: > > > On Wed, Sep 29, 2021 at 11:51 AM Will Deacon wrote: > > > On Mon, Sep 27, 2021 at 05:22:13PM +0200, Arnd Bergmann wrote: > > > > > > > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > > > > index 124c41adeca1..989c83acbfee 100644 > > > > --- a/drivers/iommu/Kconfig > > > > +++ b/drivers/iommu/Kconfig > > > > @@ -308,7 +308,7 @@ config APPLE_DART > > > > config ARM_SMMU > > > > tristate "ARM Ltd. System MMU (SMMU) Support" > > > > depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64) > > > > - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y > > > > + select QCOM_SCM > > > > select IOMMU_API > > > > select IOMMU_IO_PGTABLE_LPAE > > > > select ARM_DMA_USE_IOMMU if ARM > > > > > > I don't want to get in the way of this patch because I'm also tired of the > > > randconfig failures caused by QCOM_SCM. However, ARM_SMMU is applicable to > > > a wide variety of (non-qcom) SoCs and so it seems a shame to require the > > > QCOM_SCM code to be included for all of those when it's not strictly needed > > > at all. > > > > Good point, I agree that needs to be fixed. I think this additional > > change should do the trick: > > > > ARM_SMMU and QCOM_IOMMU are two separate implementations and both uses > QCOM_SCM. So both of them should select QCOM_SCM. Right, I figured that out later as well. > "Unfortunately" the Qualcomm portion of ARM_SMMU is builtin > unconditionally, so going with something like select QCOM_SCM if > ARCH_QCOM would still require the stubs in qcom_scm.h. Yes, sounds good. I also noticed that I still need one hack in there if I do this: diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index 55690af1b25d..36c304a8fc9b 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -427,6 +427,9 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu) { const struct device_node *np = smmu->dev->of_node; + if (!IS_ENABLED(CONFIG_QCOM_SCM)) + return ERR_PTR(-ENXIO); + #ifdef CONFIG_ACPI if (np == NULL) { /* Match platform for ACPI boot */ Otherwise it still breaks with ARM_SMMU=y and QCOM_SCM=m. Splitting out the qualcomm portion of the arm_smmu driver using a separate 'bool' symbol should also work, if you prefer that and can suggest a name and help text for that symbol. It would look like diff --git a/drivers/iommu/arm/arm-smmu/Makefile b/drivers/iommu/arm/arm-smmu/Makefile index e240a7bcf310..b0cc01aa20c9 100644 --- a/drivers/iommu/arm/arm-smmu/Makefile +++ b/drivers/iommu/arm/arm-smmu/Makefile @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_QCOM_IOMMU) += qcom_iommu.o obj-$(CONFIG_ARM_SMMU) += arm_smmu.o -arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o arm-smmu-qcom.o +arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o +arm_smmu-$(CONFIG_ARM_SMMU_QCOM) += arm-smmu-qcom.o diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c index 9f465e146799..2c25cce38060 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c @@ -215,7 +215,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) of_device_is_compatible(np, "nvidia,tegra186-smmu")) return nvidia_smmu_impl_init(smmu); - smmu = qcom_smmu_impl_init(smmu); + if (IS_ENABLED(CONFIG_ARM_SMMU_QCOM)) + smmu = qcom_smmu_impl_init(smmu); if (of_device_is_compatible(np, "marvell,ap806-smmu-500")) smmu->impl = &mrvl_mmu500_impl; Arnd