From patchwork Mon Dec 11 18:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 752521 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1474668wrs; Mon, 11 Dec 2023 10:41:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGw7BoiB8SplVyB5rSGOIyCpnCklKjPuuYNsb+v59KY6zSYDi1hgKJKOBFTkarHQJzY4A08 X-Received: by 2002:a2e:a705:0:b0:2cc:1dac:fe2a with SMTP id s5-20020a2ea705000000b002cc1dacfe2amr1112315lje.64.1702320115425; Mon, 11 Dec 2023 10:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702320115; cv=none; d=google.com; s=arc-20160816; b=lhDHcrvtoX+KlvqmSDQ9nZzQ/jeH/IH0xRQHQh3ab/kgl74sGu+Yw3BVVOhkQk+wWh c6pLtLr0Cyf5u/0hzZ9dWNgXz8wymyWgco5OlHPfyAmVZSIPowyp+0hRoI/FKqxrN01x Hso/kBTM7BPESyNzYUtacgf1cS1XSW2P0LPX48xFSHs8W4TF5oKejPOTP6xadi4n6dBb 5Qh2tvDrpvh6pSGup5ojsd4SfDTPKazV7jMNbuXY4jBvWH4ysbrFiX/nx5sefIkMpJZG iF/McRfI4S0GP8W/DLyCeXT4CAchn18sJOnuVZfOgbJ1cu9h2f7/20JB8QTYhS7naJcY xprA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:content-transfer-encoding :mime-version:message-id:date:subject:from:dkim-signature; bh=bOYZBagc/dRnDfKBL4LicV70lSPsyQCZw1VjpGDlq6M=; fh=tjpWeynJXns2W9JekqRqF9+l0LwdVe2Ss8OskKeymNE=; b=YTeBISQNBmA4Gzy9VSLpVoryzvs0AHl9+TVgMR5zFz+viVYkvmT8GEimPUoarqEp3V btQMe2RrXxgxQ76BvNnN84gzMnmCIUu7xa8I198SLr0cCExem6reRiHx2NDzkDakptEC JC8lPdfg6oIe/1TyWZGCbfE8mX6tZVpl476OehT8rbtTpc0MrzA2N7C/4mWlyHwNLu24 rOKiAMU7zf4180TNCJYNvaiFiLWHZx7YvrY+ovwWnqu8Q85cnbwpP+m4IbqfEDPZe1A/ lBl3w/AqcfC5eVrZgLNyCRM5vt7D/e5JUJ7hfTxqsWBkIIyCAvBDlT1b+hMLIUHHLmeq aOPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gqXqWDA1; 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 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 b24-20020a2e8958000000b002c9e71853f6si2551182ljk.107.2023.12.11.10.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 10:41:55 -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=gqXqWDA1; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0B0278779C; Mon, 11 Dec 2023 19:41:54 +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="gqXqWDA1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 432EF87799; Mon, 11 Dec 2023 19:41:53 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (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 F00CE876E9 for ; Mon, 11 Dec 2023 19:41:50 +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-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40c3984f0cdso31468915e9.1 for ; Mon, 11 Dec 2023 10:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702320110; x=1702924910; darn=lists.denx.de; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=bOYZBagc/dRnDfKBL4LicV70lSPsyQCZw1VjpGDlq6M=; b=gqXqWDA1smuCqvDxqq1jadizOYEdIrCoUz5YtxKmhM1+iLPk0qh7yuvXLTvek0ZzjD 3cjcNOW1FCen41K1yoCOkHYmE74aXowRYkKHqKLIXm18J2E37GmeVq7O6y8LM1incB3V vRZH8CPU3HPX04j8Di6ZEPy8w6++yxBDkEdQe4EHO+wLuKpBBxxLiI3oRGgLQgVjtqT5 J2hHe//MQOcqJTfE9YtQnHUcXEPhEY1L5l5BfwKcm1+wKr0eCZP+njy5IfH2YM0hYono T8Xul5yCbLe1Zqn/ZirtKNxPj7EJBoXkeDeVGsthF0O8tlC46hmYfylvORbAIWiLgMtJ 88Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702320110; x=1702924910; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bOYZBagc/dRnDfKBL4LicV70lSPsyQCZw1VjpGDlq6M=; b=fC61NkDiWBuT2b14twRSRB1CwMR6sIwGAHyn8TJcq7F3wHubxpyxpwxb6gEjBiv3jp kbeC7piNasfge36wWrHKHEbrXTYZh7qJtzZS8bFppzp4eNbNNJarO9cZXKhfxozjVXuT IjwtlAjxv3vdO7aFgGRLzEO0Zdn/uLU6bMMOqQwMWiot0MikI+pGEbs/uyjb9DzoHG85 OyrYQO8AJswPAi2RKQbXGPjb4mHfFbCz6wQZBxlZB6BJA4sYzddolJmkBkS4SabBCymk 0Fnt8e1yPL1TcltHyY+Vk8MtneUz2xdHtkdH9szIrop1lpJOEzwDBx/O5hmqhTsXe1uu Kvxw== X-Gm-Message-State: AOJu0YypvvOTgqsgCaF4ybVOMAruB2CYxQh2EbaBBo+Y0wlL9L/XvsAx 6nEc3tHqn0pdbbYodxmpNNRc4g== X-Received: by 2002:a05:600c:4750:b0:40c:3db8:18b0 with SMTP id w16-20020a05600c475000b0040c3db818b0mr2489449wmo.172.1702320110273; Mon, 11 Dec 2023 10:41:50 -0800 (PST) Received: from lion.localdomain (host-92-17-96-230.as13285.net. [92.17.96.230]) by smtp.gmail.com with ESMTPSA id b1-20020a05600c4e0100b00405959469afsm13910422wmq.3.2023.12.11.10.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 10:41:49 -0800 (PST) From: Caleb Connolly Subject: [PATCH 0/3] Qualcomm quirky SMMU support Date: Mon, 11 Dec 2023 18:41:39 +0000 Message-Id: <20231211-b4-dwc3-qcom-v1-0-46275113b4f2@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAONXd2UC/x3MMQ6AIAxA0auYzjaBwqJXMQ4KVTuIComaEO4uc XzD/xkSR+EEfZMh8i1JjlCh2wbcNoWVUXw1kCKjSWucLfrHGbzcsaO11CmayRjloSZn5EXefze MpXwGLQxPXgAAAA== To: Caleb Connolly , Neil Armstrong , Sumit Garg , Mark Kettenis Cc: Tom Rini , Simon Glass , u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1830; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=hV4KSuR54vcLIDKo1tgzcUPwZq5DW9DgihTQrPl0h5k=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtTy8LclJ+4fN2lW2nnKqa/+m2C40SFTPZNNRvf4VNc9i LIP8YjqKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABM5tJaRYYW8vZLjN7ZT9c23 p5xLzJjQ0PYvwfCpAfuvsFTOuJwrfgz/HYzP602fVN/E4qccdrvpra5Afl/NjMp9zQUhG67Kr1a fCwA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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 Qualcomm platforms are heavily locked down, in many cases offering no way for users to gain EL2 or EL3 code execution and including many additional security features. Among these are modifications made to the SMMU behaviour (done by having the hypervisor intercept register accesses). On many platforms it is not possible to disable the SMMU, and not possible to configure streams in BYPASS. To enable support for peripherals like USB which depend on DMA, we must allocate a context bank on the SMMU and configure an IDENTITY mapping. This patch series fixes support for building IOMMU without CONFIG_PCI. Then, it introduces first introduces support for a .connect() op in IOMMU drivers, this is called before the peripheral drivers .probe() function and allows for IOMMU devices to perform one-time setup. Lastly, introduce a new driver which supports the SMMU as found on Qualcomm platforms, when a DMA capable peripherals is probed, this driver will first see if the previous stage bootloader configured a context bank for the given stream ID already, and if not then it allocates and configures one so that DMA accesses will work. There are no in-tree users for this driver yet, however it is required for upcoming USB support on SDM845 and future Qualcomm platforms. --- Caleb Connolly (3): iommu: fix compilation when CONFIG_PCI disabled iommu: add a connect op iommu: add qcom-hyp-smmu drivers/iommu/Kconfig | 16 ++ drivers/iommu/Makefile | 1 + drivers/iommu/iommu-uclass.c | 16 +- drivers/iommu/qcom-hyp-smmu.c | 396 ++++++++++++++++++++++++++++++++++++++++++ include/iommu.h | 9 + 5 files changed, 436 insertions(+), 2 deletions(-) --- base-commit: 8806443ed784dad5b5daf351b0175acb3343e729 // Caleb (they/them)