Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1071532pxb; Thu, 28 Jan 2021 07:24:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyZb9Ra8L8WmR7HkJXHGeZ5VwMT1hFyrEvlMBmZ0LXrxA0F0Sv6tOU8rBx1CXhh87lKHKQ X-Received: by 2002:a17:906:6a92:: with SMTP id p18mr11078448ejr.308.1611847463428; Thu, 28 Jan 2021 07:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611847463; cv=none; d=google.com; s=arc-20160816; b=XATGn4GI9ugq7mB/hBPzuhjaKIfGa4fmEuHEoGCDyY/1Hvikc/pMN0tiNoOKrisiuc XjX1Gx8Bu972QYgbHr4tsftAFSyATlNX80UkTtAveKARNpmBcE5XRBsKXTEe0J/DK6Yr TlqvQdOM5B/BfdEm9drpw1aQ3SSXDzBW2LMtTPgsswF4RSTfA7mCXG9OscavBYvgwySO 3nEzDNnFGmqJFowlG9yYZAjaMzKPgbw5KQHQDJ6XL5u7yk2b8GMMezav2D2lWikk89tA aSTVQxsPH69eJEKPp0JJDd8NpGthHcEDI1RC8Jm72iLPVyHJMdGNq+Cv+DgPemnglRz/ 25Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=iZAD1R/1PUk5RGFoBNnMJ9K9MRMC2agcdnUR+JpBKcQ=; b=GhD5hDTzJRWHmn2lPkP1IUKHI9mrU0y8YoycxR5uGJkM/DLQA8ncAWqoMJzDaabl+B 4K+ZUya8CvqpCZ7/a9H65/pukOMbKtbG9RWlnXyXt7vWKCi6k6P9ouaSnjxbXDWwi7qH 5Oyl1c0F7CFzhl3Yp3BjwaPRGnaoTx+G3t+B4WLpdgA4eTchaBhPeExincBgIg4EZHGA znmbOvOA7A9VLSl+UcU7a4fFVwxTgB8B+HIiFD/LR3ZJFg6qXpSRDBlDlbfy4uS6jb5j DHuVpAE36ZMA83o/dPXC+3O7USkOJ3enIglcIBCqnZ3CG9L2BGHXFZ87qHEp840MdAi/ L9IA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 33si3242168edq.206.2021.01.28.07.23.58; Thu, 28 Jan 2021 07:24:23 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231924AbhA1PUN (ORCPT + 99 others); Thu, 28 Jan 2021 10:20:13 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:12345 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbhA1PS4 (ORCPT ); Thu, 28 Jan 2021 10:18:56 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DRPG05tyHz7cH8; Thu, 28 Jan 2021 23:16:56 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.184.42) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Thu, 28 Jan 2021 23:18:00 +0800 From: Keqian Zhu To: , , , , , Will Deacon , "Alex Williamson" , Marc Zyngier , Catalin Marinas CC: Kirti Wankhede , Cornelia Huck , Mark Rutland , James Morse , "Robin Murphy" , Suzuki K Poulose , , , , Subject: [RFC PATCH 08/11] iommu/arm-smmu-v3: Add HWDBM device feature reporting Date: Thu, 28 Jan 2021 23:17:39 +0800 Message-ID: <20210128151742.18840-9-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20210128151742.18840-1-zhukeqian1@huawei.com> References: <20210128151742.18840-1-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.184.42] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: jiangkunkun We have implemented these interfaces required to support iommu dirty log tracking. The last step is reporting this feature to upper user, then the user can perform higher policy base on it. This adds a new dev feature named IOMMU_DEV_FEAT_HWDBM in iommu layer. For arm smmuv3, it is equal to ARM_SMMU_FEAT_HTTU_HD. Co-developed-by: Keqian Zhu Signed-off-by: Kunkun Jiang --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++ include/linux/iommu.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 0c24503d29d3..cbde0489cf31 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2629,6 +2629,8 @@ static bool arm_smmu_dev_has_feature(struct device *dev, switch (feat) { case IOMMU_DEV_FEAT_SVA: return arm_smmu_master_sva_supported(master); + case IOMMU_DEV_FEAT_HWDBM: + return !!(master->smmu->features & ARM_SMMU_FEAT_HTTU_HD); default: return false; } diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 1cb6cd0cfc7b..77e561ed57fd 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -160,6 +160,7 @@ struct iommu_resv_region { enum iommu_dev_features { IOMMU_DEV_FEAT_AUX, /* Aux-domain feature */ IOMMU_DEV_FEAT_SVA, /* Shared Virtual Addresses */ + IOMMU_DEV_FEAT_HWDBM, /* Hardware Dirty Bit Management */ }; #define IOMMU_PASID_INVALID (-1U) -- 2.19.1