From patchwork Fri Sep 4 15:55:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 249121 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1530574ilg; Fri, 4 Sep 2020 08:56:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAtyAmStINYaDdWqGUh4w4Xwxs5xWErvHZnorOCxH+Jv8+gpgXiSyUioj2DsWBbM8hPoUp X-Received: by 2002:aa7:c98d:: with SMTP id c13mr9552415edt.199.1599234961940; Fri, 04 Sep 2020 08:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599234961; cv=none; d=google.com; s=arc-20160816; b=ClpejfyyAyiYLL+amE3Ad3EuoO3V84GkstZzbGTBa70gDSFSEHYKJL5CUn/BmmsZex 42kV+VlsguObTeswh2xL4TsqWSL9SJmGS7j3Fy3NygGs24zUqgUGM3WQT3UzsfZW6ako pcDXZTCT37C03gNDUVAuxy+Yy/2kTewg8VLcJUpKI4hotifRgmO7ODBJYNVUtJUzkHSw 9zvnuGwo9+BPSM+Y9FkMz9AeTAhOwSetnmZinLSP+MOJHPftXj1aLjixRSJYyXhyju5Q GNr9MosaJs9YEgHlqrP8icVrq+w5eJ7NcUkvNIv6a1vKDTjTmskHngEtMlgp0QCyoUSS d6fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ls6xTeazp01VU5rx1tZcn8CZ6m3ZwOm0FhCvNs4H/UM=; b=JeYinp5qlpa0SOiBtIrKI7FI3msAmxkaiCxd/aENstMq9DWfDsgg6hG50OcMWDFv4K ujOtSRfJx6nKzL89pnt0hVMfX0u75rEdtHR/RMUSgNCnafBEpgs9M2HnYbtdvTieaLsD 8zan+wHhdSlVrEOkBLtYUFSY1NJWdG8GfQNt4ITRY+Lb0wUCtHFGaj/6tjD+5nHSoSs9 PraCvlm6FFzng6OuZZMFZnBVKAHin/RguPqivzDPRkkQx/X1rFngHf2tM6zaMHCNbzaV I9lx1Q6ZES2gQed0UDHdQz+UL7SOfFJI6mpuOGkc5YW2GqHaGQcINuy4qqmordhxM/O6 glHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tb1Sd+n9; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 i22si4540618ejy.5.2020.09.04.08.56.01; Fri, 04 Sep 2020 08:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=tb1Sd+n9; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726441AbgIDPzs (ORCPT + 15 others); Fri, 4 Sep 2020 11:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbgIDPz0 (ORCPT ); Fri, 4 Sep 2020 11:55:26 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B20DBC061261 for ; Fri, 4 Sep 2020 08:55:22 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id e7so4927724qtj.11 for ; Fri, 04 Sep 2020 08:55:22 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ls6xTeazp01VU5rx1tZcn8CZ6m3ZwOm0FhCvNs4H/UM=; b=tb1Sd+n9qybC0+ro/HdiC+RBRiJc3INwSffhtqG6iMH+37s6uZXFul1N9db1cLf0O+ W0rjcAJiucucmVQfVxG2MUkMAVBzL72kxYXPDM94Y8Eog3yqNAhbIBZ0SvhdqCqHjDss eqJnjUevNWz0I2ajfvSEgBRETGT0byopb7rb3HjelVEJIa/NYG7qIZZfDuUsq9UT8H2o wmlglYCueMqRUyXl0caryl5xIGgDggZeBNuaZUM8AtvG0YPJM0pCBnwyWbzDQmzoIDUC 8377oUebGf4yS6DRCQMoNRh9frdfOYrnjbWjR3K67Znyzlh8ybqe7mNP7I9znqOGTQSk sGjA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ls6xTeazp01VU5rx1tZcn8CZ6m3ZwOm0FhCvNs4H/UM=; b=HDJYyDgs+8gUXj8VHaKl2oEvGb57ZDpFejdKU+yuFKw4fKkUB1cfWiuBtr2R/sMRjk GKe113eod/mYek28+6EGZyGCuM0d0imZMQx1qZUOopKYDPAJZtPOwdpGzwchUe5HJRHO N9Z2qLpKjMZhj9B+dcCtHCitPmFWGgZwbc0Q9D7daydrzgXwf3X4dfci4FQD9DUs4/8C 7FZ5nGai61spj25z2/AF+cL+ZFzFhC2l6w71GXwKlOGsWUy1XF8P87Suk6jjaLfH+oZV olhB6W+GjHu5Lnyijx+7RdYwnXXJebhajlOvDzJ6J2oMsynxq1s8xxe3gqEEJVYi8g/q mc4g== X-Gm-Message-State: AOAM532o3t3ySVuTiit1lyU0+e8x9aYZ9fgeOmDyY6SO8Z+DiGLuybIM STlXa5Clg7bMw9KHNjB0v3rnqQ== X-Received: by 2002:ac8:17af:: with SMTP id o44mr9239269qtj.343.1599234921881; Fri, 04 Sep 2020 08:55:21 -0700 (PDT) Received: from localhost.localdomain (ec2-34-197-84-77.compute-1.amazonaws.com. [34.197.84.77]) by smtp.gmail.com with ESMTPSA id v18sm4724473qtq.15.2020.09.04.08.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 08:55:21 -0700 (PDT) From: Bjorn Andersson To: Will Deacon , Robin Murphy , Joerg Roedel , Bjorn Andersson , Sai Prakash Ranjan , Jordan Crouse , Rob Clark Cc: Sibi Sankar , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings Date: Fri, 4 Sep 2020 15:55:11 +0000 Message-Id: <20200904155513.282067-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200904155513.282067-1-bjorn.andersson@linaro.org> References: <20200904155513.282067-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a new operation to allow platform implementations to inherit any stream mappings from the boot loader. Signed-off-by: Bjorn Andersson --- Changes since v2: - New patch/interface drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 ++++++----- drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) -- 2.28.0 Reviewed-by: Sai Prakash Ranjan Tested-by: Sai Prakash Ranjan diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index eb5c6ca5c138..4c4d302cd747 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -85,11 +85,6 @@ static inline void arm_smmu_rpm_put(struct arm_smmu_device *smmu) pm_runtime_put_autosuspend(smmu->dev); } -static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) -{ - return container_of(dom, struct arm_smmu_domain, domain); -} - static struct platform_driver arm_smmu_driver; static struct iommu_ops arm_smmu_ops; @@ -2188,6 +2183,12 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (err) return err; + if (smmu->impl->inherit_mappings) { + err = smmu->impl->inherit_mappings(smmu); + if (err) + return err; + } + if (smmu->version == ARM_SMMU_V2) { if (smmu->num_context_banks > smmu->num_context_irqs) { dev_err(dev, diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h index 235d9a3a6ab6..f58164976e74 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h @@ -378,6 +378,11 @@ struct arm_smmu_domain { struct iommu_domain domain; }; +static inline struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) +{ + return container_of(dom, struct arm_smmu_domain, domain); +} + struct arm_smmu_master_cfg { struct arm_smmu_device *smmu; s16 smendx[]; @@ -442,6 +447,7 @@ struct arm_smmu_impl { int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain, struct arm_smmu_device *smmu, struct device *dev, int start); + int (*inherit_mappings)(struct arm_smmu_device *smmu); }; #define INVALID_SMENDX -1