Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1153045pxb; Sun, 10 Oct 2021 22:38:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnuunpaNfDtSs5c2Zl9c3N92EV/pBbmmwm6eBiO6x/K29FPwXESzo2DvCLJ9mA45hYTapu X-Received: by 2002:a63:4f0d:: with SMTP id d13mr16338783pgb.169.1633930731351; Sun, 10 Oct 2021 22:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633930731; cv=none; d=google.com; s=arc-20160816; b=yMeycY5s8yE9qnZc+P8vC+dBsvCDg6+Z2g8qug1JaPALUcs1rhMu4Oh9SRbvJWlVa1 M3zOu0G2hEywTHG4ebI/T6MdDp8FfEJyt61x3KMMSDpPLA687YvJMCTJUl6WZ95ze8qv W39RWWy2Ufy04KdCp+CH+m8A8N5loXCrOWuGEKuEoCR/NmQduyc/s0PtKzW0+Tn6MGe9 VEk8iKWv43uyzm+M/p6K0FiHWRSlRiH+upXo/G6dwraRlsesof/+NITytwYeu+y9h8I8 ksKxD1Me4VgrEn7r1QqLHP7byO9YbrEa8qxzZmUGAIEhVP6cfCgJNlt3o2/kU+XmPEfN wpjw== 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=yJkzv/qLRuMHpfFpS4P34KqTWJ3Vx+EAHqhp1ZZOPqI=; b=SddUKAqmiMMnVponw4e71XYJL6wMViKwlCLmNY207wZ+Q/deaCIu3qa1swrjKaMIr6 7PBKG5O/qQES43ybvsNrUukkbsgVgbUUJEBdPht6ierOaK520uTCJVlHDvLl8IEGlghB 9Lh1qfLD8k7y8dLwdiz3bjECJLN3wHynJeXRNpjoZOdw31T6SOQOvdCS5EKKqfD3zza1 UAgx+xNxaogqrpEob4c6vbIdjdZsKG+flJD78JkZzzf/xdcC16ZZF0biF/rPNQ3+41zz R0RJietmqZdtT9buMnQe4JTzuDuhoqvNLCYFT895fyHTqf4kJJAr2WfEM3dZmjWy+2ij GRpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g7nfie8p; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q203si8549975pfc.293.2021.10.10.22.38.38; Sun, 10 Oct 2021 22:38:51 -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=@linaro.org header.s=google header.b=g7nfie8p; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232145AbhJKENV (ORCPT + 99 others); Mon, 11 Oct 2021 00:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbhJKENT (ORCPT ); Mon, 11 Oct 2021 00:13:19 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E91C06161C for ; Sun, 10 Oct 2021 21:11:20 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id i1so14156379qtr.6 for ; Sun, 10 Oct 2021 21:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yJkzv/qLRuMHpfFpS4P34KqTWJ3Vx+EAHqhp1ZZOPqI=; b=g7nfie8pkWJr8W9Kqw/m1Vzt+2qKlzvyuggXbDSXZwyI3x53OnoV+ClCoAT6bMqbo+ Fw9xw9Q+uutz8BMZkylGG9FSYeCVHjZlVmRe4dG9eAzOFyL8OtwLXuwyJMGujzhjOCqT 4xbpCjnVe8bTFEsxJpdMDp1oRQjQVP9rkw3UjLxf7y75Pt82JMC26UcvpJHuYPifUF7x hse5hvFMSgnTujr4TFfW8sleWouVyzHOPNRji5xM7EcFK0c+HMaln5X+EUOu8swmQQBm 0CzyD03a0bQfFRESp5UrOPO3KClKDCJz72DEewHOE/75UzuGCOABNP+DD+3sFpi+ZGi6 9RWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yJkzv/qLRuMHpfFpS4P34KqTWJ3Vx+EAHqhp1ZZOPqI=; b=hDzfdn1tjjQapO5otVWHB6vABXxticV47OxtAy6ObW5ZJ039u2qPqXT9Nct7K5rAHo 4fv88DfCNDaik9CsI2+d8QpTDIBHFq6u/gcUnbMTSCnSLDBQ5U7gbxLFcQzsfn6eXzPV aK9hNq/4YEiojgArgTpmmO0Vi1SG9ZjL1i/e4zl/XnbcV6buOsaK1EuWYfY6v6AZqK5j JTXBBSCwp/sLQE0BAuDmxY6ObwzOx6YTV6sSTjOLOMhwCEaEWgm3XzNOp7Izn/jw42OQ 80kuE/DVI9RKpZgolRMeQZcYq7QPLIAplSWv1j/QW2yqPRbOxsVQcZG9rSNSzDAQXrk2 KRBA== X-Gm-Message-State: AOAM5324ZPqUEi9GoQ+qFilnnfYnRlBo6Svj3K25tkDWmLRICLz5aBEt 53f+hTxijWIq/quAJTCneqicYy9nyuO9NXkLzSplLQ== X-Received: by 2002:ac8:1011:: with SMTP id z17mr12653163qti.388.1633925479158; Sun, 10 Oct 2021 21:11:19 -0700 (PDT) MIME-Version: 1.0 References: <20211010023350.978638-1-dmitry.baryshkov@linaro.org> In-Reply-To: From: Dmitry Baryshkov Date: Mon, 11 Oct 2021 07:11:07 +0300 Message-ID: Subject: Re: [PATCH] iommu: fix ARM_SMMU vs QCOM_SCM compilation To: Arnd Bergmann Cc: Bjorn Andersson , Joerg Roedel , Will Deacon , Robin Murphy , Kalle Valo , Thierry Reding , Andy Gross , linux-arm-msm , "open list:IOMMU DRIVERS" , Linux Kernel Mailing List , Linux ARM , Daniel Lezcano Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 10 Oct 2021 at 20:42, Arnd Bergmann wrote: > > On Sun, Oct 10, 2021 at 6:17 AM Bjorn Andersson > wrote: > > > > On Sat 09 Oct 21:33 CDT 2021, Dmitry Baryshkov wrote: > > > > > After commit 424953cf3c66 ("qcom_scm: hide Kconfig symbol") arm-smmu got > > > qcom_smmu_impl_init() call guarded by IS_ENABLED(CONFIG_ARM_SMMU_QCOM). > > > However the CONFIG_ARM_SMMU_QCOM Kconfig entry does not exist, so the > > > qcom_smmu_impl_init() is never called. > > > > > > So, let's fix this by always calling qcom_smmu_impl_init(). It does not > > > touch the smmu passed unless the device is a non-Qualcomm one. Make > > > ARM_SMMU select QCOM_SCM for ARCH_QCOM. > > Sorry about this bug. I was sure I had it working, but I lost part of the commit > during a rebase, and my randconfig builds still succeeded without it, so I > sent a wrong version. > > > Arnd's intention was to not force QCOM_SCM to be built on non-Qualcomm > > devices. But as Daniel experienced, attempting to boot most Qualcomm > > boards without this results in a instant reboot. > > > > I think it's okay if we tinker with CONFIG_ARM_SMMU_QCOM for v5.16, but > > we're getting late in v5.15 so I would prefer if we make sure this works > > out of the box. > > Yes, makes sense. For reference, see below for how I would fix this properly, > this is what I had intended to have in the patch. Feel free to pick > either version > as the immediate bugfix. I'll give the below a little more randconfig testing > overnight though. The pasted version of the patch is probably > whitespace-damaged, > let me know if you would like me to send it as a proper patch. > > Arnd > > 8<----- > Subject: iommu: fix ARM_SMMU_QCOM compilation > > My previous bugfix ended up making things worse for the QCOM IOMMU > driver when it forgot to add the Kconfig symbol that is getting used to > control the compilation of the SMMU implementation specific code > for Qualcomm. > > Fixes: 424953cf3c66 ("qcom_scm: hide Kconfig symbol") > Reported-by: Daniel Lezcano > Reported-by: Dmitry Baryshkov > Signed-off-by: Arnd Bergmann > ---- > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index c5c71b7ab7e8..2dfe744ddd97 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -311,6 +311,7 @@ config ARM_SMMU > select IOMMU_API > select IOMMU_IO_PGTABLE_LPAE > select ARM_DMA_USE_IOMMU if ARM > + select QCOM_SCM if ARM_SMMU_QCOM > help > Support for implementations of the ARM System MMU architecture > versions 1 and 2. > @@ -355,6 +356,13 @@ config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT > 'arm-smmu.disable_bypass' will continue to override this > config. > > +config ARM_SMMU_QCOM > + def_bool y > + depends on ARM_SMMU && ARCH_QCOM > + help > + When running on a Qualcomm platform that has the custom variant > + of the ARM SMMU, this needs to be built into the SMMU driver. > + > config ARM_SMMU_V3 > tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > depends on ARM64 The patch seems correct, but it becomes overcomplicated. What about: - restoring QCOM_SCM stubs - making ARM_SMMU select QCOM_SCM if ARM_SMMU_QCOM This would have almost the same result as with your patch, but without extra ARM_SMMU_QCOM Kconfig symbol. -- With best wishes Dmitry