Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1420639pxk; Fri, 4 Sep 2020 08:59:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmeSSc894+4jqwFg1MvRY9qrWclfV3PUuBCX41j4ZRSB2SnZReMFOR550Ce8W1eeaCXmLY X-Received: by 2002:a17:906:d8cd:: with SMTP id re13mr7921084ejb.140.1599235163466; Fri, 04 Sep 2020 08:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599235163; cv=none; d=google.com; s=arc-20160816; b=czypIABETbwR3/8bf37iWnPzQuspHjAv/g9XVtCCTsQsVq/N1LPvZj7Y7VkbgzxU9H KBJjdGnW8LSgBnWVTaltEETalm1JSX7EB1AImMfrkbELNZx94TMoU8N/FhJrRbgBQ40u T6XGwyl8UsQDQ4+s9n0RvqcDbGpR988EzgyrAFnd7DLE+37HhisSb3Aq3sZxCcbNEPDO KbvSQ1zqiWLfEhAvMMRqjPv3SltAkcvbJr3KlrDXM3Ggz6HBMCJS+xtRBR+1uVhgzP0K /TKj+IIoPscafM7/ESAhyD92+pKo+Q1c5UgW9N6uOISKTvuMcdJoS33uZ6Dp0/X2V/4a J2gw== 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=DlrLWi0+EPsSeP3BqpBLzLHKrGYWhQn9Kmp1s8aI3Bj7Z2VmU7Aa24YGO2xuK7T1hg FjfERm5ICauC3nvu1umbv2LejmhMKm/4LYEiV9TFRtGifdmMJkclVnyAB+6S6zVV5EsJ /hWEAsx+/Dgf4UIIMQ9q7wbaMB6UTOn9Tf51qYmQM1GqfQQcNYAU7D2kWV9Q6k9HFkYR x1VKqQvWjExCOj7FR/wOY+k65JRf7A+bkwu2wm0vbq8e9TR64+4WtFaIvqo9JxTCz8bp A4T+CiVfgtdVQMzqoSY+kp3pi2Ma45K0NjqIIjx3i6osv2C67mJmKfo0IYFj8iUx8NWz GjGw== 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-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 t18si226533edf.313.2020.09.04.08.59.00; Fri, 04 Sep 2020 08:59:23 -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=tb1Sd+n9; 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 S1727089AbgIDPzw (ORCPT + 99 others); Fri, 4 Sep 2020 11:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgIDPz0 (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 AD67DC061260 for ; Fri, 4 Sep 2020 08:55:22 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id p65so4993098qtd.2 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=avdtp5rxFBYRaB7X9SYSnbSlv8OnLCwMehEy3iQ2d0FYWGvpSDbqiX6vmWiRDgHqKw Kku1dY349z29CKKn84CB5jXayPShkiacS5N4jCcmQk7oqp0GqJeKiofAJ+nFvUaA8hUC p22FhVO6HPazVGd26jT0eBZsl5zKpLB3NrlGOPr66i1P86B0oLfXLMewppgtFPaB+ail fZB95wAA10zdXb6xBSDeT+sifurXY1BTyfphIp+ss9C3Jvda02i4Rhsegml7oSvLecSB j1sbe9yUCz3IWrFTYH7mQCgLZfPxxVBv8efLGngtLfwUCm6Rg9qkbxHiagBvb1GtBz4F xNsQ== X-Gm-Message-State: AOAM532nx17VvO/bXat4ytFr8cr9SPMBsN3RxPYljkVqpXDNKwDjw0S3 sSq6OOmQgq9bYbyht53QG2s8nA== 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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 -- 2.28.0