From patchwork Thu Jul 9 05:01:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11653345 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A0426C1 for ; Thu, 9 Jul 2020 05:03:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 545A720708 for ; Thu, 9 Jul 2020 05:03:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MZStIoNz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BXPSxo5V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 545A720708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=66hgGx0KV6ogHqCYDBUnGp6vCEDVivjlft4FTQOAj9s=; b=MZStIoNzTJJGYk2gqf3/9SG2HY 0bcXNpYGsN0jjwMaDtG05fZMUvvnjs1eiZV36JaurXsWyU3D2APY+DcNyL2UHq798+cvVBPMRYAoM glipybD2YsZUw68t6yVjQruIlviAD52dPD5F8s42COuHtY1bZpAicLN2bz54FvnT+NGStFmIvkrhg YNpkXH3l5a58cfHR2p2F1GhQMrsWr9uAIW/idXDxm0bMpvuGhGf8AebBmCoC7rawnot8ToD9Uz31d dXL9Gz3SMw5HDiHHej8seznAOMv5EklTugrtxV4dk61/e4nN3FXAk4P2hXa6OL3lYR2e6VkNsnnXY tLxXYTOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtOgr-0007MK-BQ; Thu, 09 Jul 2020 05:01:45 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtOgo-0007LJ-FQ for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2020 05:01:43 +0000 Received: by mail-pf1-x441.google.com with SMTP id i14so475111pfu.13 for ; Wed, 08 Jul 2020 22:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uN2T4CF/tRygg+rOfQBDGtucvrJg7l2si9rKgMZR/j0=; b=BXPSxo5VbjQ5clTT5R39r8mnuahuMmSnFAX8dVZrldk0UdIVgqWclLWUaFgB9EEvGs 5iz3KpwAkAgn90jBHAhrbXixnEOIEYtjcRThFOHPaMP1iW7G5A9VtiBNmc4MAkl+PePn X8Qxrz9Owin3O+N62O6MOn8S4A+iGJ6Wxb9sX2WIiLAY51C87Q29o3eXidoSP6ooqh+D qS6uu3fHwmtVABvqz/lvBdCP/QxOAANNR/YrgTRHreSoizLsqM/gfFPjeLgGJoCsorW3 bcPBMKwdryQ+Fp3uaE4IZn7ZWggNMNBSXgKfxkkYCqUvqDoX7YBNX084BbbLThuTS7Ou LIZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uN2T4CF/tRygg+rOfQBDGtucvrJg7l2si9rKgMZR/j0=; b=m6kWRYqMyKHcpAQ/mjPz7/l+4Jk/7dqjS/PUEDhrvsESUB8FPBaWjqzj0qMnHLGdj5 z2PKHkIyIFXaGTMscXWKyPG3qtAZGP6S6bscuE1Trf/2hqRnUOuSlaSyFzTqLDe0Td+0 GFX5xk8lvZ+hL9mp/4zwDszMq4wmwTAUejOkf1MB1g6NODqCizoF2vMlze2IWpU6mHXF kOClv2p1h5n41fTKVBeNw63sBhvyt4Ir8GVkCfm+BnGAmYPhp7u/xWAHrRmR714yjtAi bi2kKyafwxo9cCYvkGrJGS0iw23OGQ3eXIt0ZmnC3xTV3dbLjzfFsLBieI8S6u3BI2hl wZtA== X-Gm-Message-State: AOAM530WjQTOLdTrg4pWQynYd/84h00MQ8+/vSCWE5veQyAbVvqF2ph4 2+bwvHLE8TbgCqyjPzxm9kvgAQ== X-Google-Smtp-Source: ABdhPJyYxb2sGMCNEAHm5ala37cPOSV+iadH/fkL3XmUf96HbWpfFw5r1l8q9UAC1q8UkeO/UH2wlA== X-Received: by 2002:a62:346:: with SMTP id 67mr14522608pfd.111.1594270900163; Wed, 08 Jul 2020 22:01:40 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id h15sm999974pjc.14.2020.07.08.22.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 22:01:39 -0700 (PDT) From: Bjorn Andersson To: Will Deacon , Robin Murphy , Joerg Roedel , Thierry Reding , Laurentiu Tudor Subject: [PATCH 0/5] iommu/arm-smmu: Support maintaining bootloader mappings Date: Wed, 8 Jul 2020 22:01:40 -0700 Message-Id: <20200709050145.3520931-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_010142_549717_16483905 X-CRM114-Status: GOOD ( 11.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Jonathan Marek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Based on previous attempts and discussions this is the latest attempt at inheriting stream mappings set up by the bootloader, for e.g. boot splash or efifb. The first patch is an implementation of Robin's suggestion that we should just mark the relevant stream mappings as BYPASS. Relying on something else to set up the stream mappings wanted - e.g. by reading it back in platform specific implementation code. The series then tackles the problem seen in most versions of Qualcomm firmware, that the hypervisor intercepts BYPASS writes and turn them into FAULTs. It does this by allocating context banks for identity domains as well, with translation disabled. Lastly it amends the stream mapping initialization code to allocate a specific identity domain that is used for any mappings inherited from the bootloader, if above Qualcomm quirk is required. The series has been tested and shown to allow booting SDM845, SDM850, SM8150, SM8250 with boot splash screen setup by the bootloader. Specifically it also allows the Lenovo Yoga C630 to boot with SMMU and efifb enabled. Bjorn Andersson (5): iommu/arm-smmu: Make all valid stream mappings BYPASS iommu/arm-smmu: Emulate bypass by using context banks iommu/arm-smmu: Move SMR and S2CR definitions to header file iommu/arm-smmu-qcom: Consstently initialize stream mappings iommu/arm-smmu: Setup identity domain for boot mappings drivers/iommu/arm-smmu-qcom.c | 48 +++++++++++++ drivers/iommu/arm-smmu.c | 124 +++++++++++++++++++++++++++++----- drivers/iommu/arm-smmu.h | 21 ++++++ 3 files changed, 175 insertions(+), 18 deletions(-) Tested-by: Vinod Koul