From patchwork Wed Nov 13 05:09:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 842876 Delivered-To: patch@linaro.org Received: by 2002:a5d:6392:0:b0:381:e71e:8f7b with SMTP id p18csp24982wru; Tue, 12 Nov 2024 21:09:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVo3kuKFnkMxj3M0H3cWaOxJ2hYeOMGdMnr72LZpEGIIgGu0Oj6Ni6foplUsd9w8fUXQwRI1g==@linaro.org X-Google-Smtp-Source: AGHT+IFzwtOMa9LXSZXh5yShX13gpE0P1EGGn/fAY4ilgHibgCdkPt9ryfgy5s09lvC10v9epaiv X-Received: by 2002:a17:907:72c5:b0:a99:ff2c:78fc with SMTP id a640c23a62f3a-a9ef00504f5mr1999433566b.57.1731474587974; Tue, 12 Nov 2024 21:09:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731474587; cv=none; d=google.com; s=arc-20240605; b=dkd+a94sO1rzqQWfCZAnJ3wX8cRPlE5BSvD/EqC2QwDZrRsj3expp+tE8Fb3gz4R7W mkTfoM1u3pQ0zlU6DOaHcX3GTlz0f9BdFt1a18ztOmb2MJWYGWmmo3fn+gHKgH7HuyU0 pH6QiZXzDTs/RKg/Itx0jyEoGKvSa3ySEiNyCRZHc9HpjxAqUL/T84+YPkrPleHnurlg 2aw/bjsgVwkiVJDF6yC2glDIlCd8ymmrx6AWL7kf/KMxy51UJXdxgqLKm5P5u6i57u8G ChJbcOEDH4HP9VlUMWApplDKAOLS4cCU/GU2Zo1f0IbvFMaxkPtX3lVezi0u9J6E1WIQ niAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=V3qbSGEhVxxKLIcrYq2faMiNq6QqZgNMoK53D0Qu75I=; fh=P+MU8wpNDCV0VEKuUMzGo5tPrqc6k4G98+hX1upq0WA=; b=PhMgKQjy/E3qEIyutksW0sq+3yxIJmr68JIegiy9HASAl4lV8sCg+ajwOEYEbDjjcZ lO33PR+7M1eFOx94tahoDefTRBYLqQ9QsK7jHKRpCCl81R6P0V/pCYV+03Ph6Zne2wH7 8dgyI/XvnRdayCUEL9hJ/rI9YyMn022+qq9/lr/8TwTuOATeedXOuSvStK67DZnfdTTi mCcTg7nRYYTObiZBdLKxnTCOQruRFDLhfHtaFWzA/seMNr2pTPlIO0A8GPVd7jizktSW t/opMBN7bjh3zGrbDsk/BO112Jb6IK1VeIR31DPLEPYOXT3FuCF1uWmzLn7aY1yqtngy o21Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xB/dEi3+"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-a9ee0a36166si923446866b.204.2024.11.12.21.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 21:09:47 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xB/dEi3+"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 21468894E8; Wed, 13 Nov 2024 06:09:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="xB/dEi3+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E62C8894F3; Wed, 13 Nov 2024 06:09:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EC4FC88C0F for ; Wed, 13 Nov 2024 06:09:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-aa1f1f2d508so96569866b.2 for ; Tue, 12 Nov 2024 21:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731474582; x=1732079382; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=V3qbSGEhVxxKLIcrYq2faMiNq6QqZgNMoK53D0Qu75I=; b=xB/dEi3+YwRP6qKmAkKjtI16Yzhv0IlwekzhCJSeLcKkC6N4yMD/FSBwT/pvYsI2aO 77iQAw0AKBkTF7AnN+v4grEfC0FHjSoZKx99LkiCCyjyduJycrogz7EWMAuCuy3hSMuu HGn/er3VMODaitECWxDNUS7s5vpqc0S0GsZAF+LEFAfKv5XerWmJOTSZ1bMNzYcT0fie Ztc6Cm/XfqgPZhSZYZyxX3arxIeSw5KfEQgMKqHjjfBCcbeFVeQCI6Fc4weIRWHqYC9a X86WusrfETf24reNOGdtg0hl27/RhiKI8UcRYFyP8zvE/p2FRL34hFHvJFkcZ91z22/3 BJ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731474582; x=1732079382; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V3qbSGEhVxxKLIcrYq2faMiNq6QqZgNMoK53D0Qu75I=; b=cQLJq8Ves4A92CaYvJOWZG3Yatyu3zImmZkm9KqVkRVNSHKKXZuBUqScnJ9XGbjAdR mEcfMz1AgZar0mViOsU1sEW99ywj+GXqqB/ZCy/sx/BnXaxnElpwsn7o/uQSCRhmsiaZ 2zkB+37W4qFnQ1rqaCux+j/vzpUjVP79B8A575KMbgiXoGqU1oM0RTwqIEeemSMhVGKk wr4VNbglf7HWu8R04xemR1EbNhQrNB/u8wU3Qn512V1HaDKWxDoUGMNEfiN0zGGp+sTd XAligYHf0vtxq8FI6dDwINW1dXfopBxzb8igAWCiBmv6VgGOW16+7Jvi5mkFi/yiK8eM hkAg== X-Forwarded-Encrypted: i=1; AJvYcCXBMYotcJqjGJ5YD0x7vR27qnEA1APfptFI5F7gNM26j+zp6063uk6vkIHC3FHJHm2YZ6nnYfs=@lists.denx.de X-Gm-Message-State: AOJu0Yw/h3G0SeELqWN9Vb09lHX0P8CvKuqOQ0S700f95XFQmsYnez9c MKPT3ajK4JkGq/WibCLDapLjV626E3pzWFFWLv22u+lAyUNbiWxqsfvEfeCxr3c= X-Received: by 2002:a17:906:d554:b0:a9e:8612:eeca with SMTP id a640c23a62f3a-a9ef001710dmr1900189666b.48.1731474582302; Tue, 12 Nov 2024 21:09:42 -0800 (PST) Received: from lion.caleb.rex.connolly.tech ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9ee0dc4cbdsm827746166b.108.2024.11.12.21.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 21:09:41 -0800 (PST) From: Caleb Connolly To: Caleb Connolly , Mattijs Korpershoek , Neil Armstrong , Simon Glass , Sumit Garg , Tom Rini Cc: u-boot-qcom@groups.io, u-boot@lists.denx.de Subject: [PATCH] iommu: qcom-smmu: handle running in el2 Date: Wed, 13 Nov 2024 06:09:24 +0100 Message-ID: <20241113050931.1853447-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean We only need to configure the SMMU when running in EL1. In EL2 the hypervisor isn't running so peripherals can just do DMA as they wish. Signed-off-by: Caleb Connolly Reviewed-by: Neil Armstrong --- drivers/iommu/qcom-hyp-smmu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/qcom-hyp-smmu.c b/drivers/iommu/qcom-hyp-smmu.c index 1b5a09bb7b39..7b7b3ba01a07 100644 --- a/drivers/iommu/qcom-hyp-smmu.c +++ b/drivers/iommu/qcom-hyp-smmu.c @@ -90,8 +90,10 @@ enum arm_smmu_s2cr_type { struct qcom_smmu_priv { phys_addr_t base; struct list_head devices; struct udevice *dev; + /* SMMU is not needed when running in EL2 */ + bool disable; /* Read-once config */ int num_cb; int num_smr; @@ -276,8 +278,11 @@ static int qcom_smmu_connect(struct udevice *dev) priv = dev_get_priv(dev->iommu); if (WARN_ON(!priv)) return -EINVAL; + if (priv->disable) + return 0; + mdev = alloc_dev(dev); if (IS_ERR(mdev) && PTR_ERR(mdev) != -EEXIST) { printf("%s: %s Couldn't create mmu context\n", __func__, dev->name); @@ -347,8 +352,10 @@ static int qcom_smmu_probe(struct udevice *dev) priv->dev = dev; priv->base = dev_read_addr(dev); INIT_LIST_HEAD(&priv->devices); + priv->disable = current_el() > 1; + /* Read SMMU config */ val = gr0_readl(priv, ARM_SMMU_GR0_ID0); priv->num_smr = FIELD_GET(ARM_SMMU_ID0_NUMSMRG, val);