Message ID | cba810b86d0597715738b4fb87084eacc734d8fd.1728491532.git.nicolinc@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C380CEE330 for <linux-arm-kernel@archiver.kernel.org>; Wed, 9 Oct 2024 17:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UYYC3COHkotNUNMY31Vzls0Pl9/pAN8f8XFYHFTkDqs=; b=Lhi+R6JZrSs02I0RSR0bLIsCwa 3IPGqmkKyCzMWvp5uevFWJwEMItIzKDQh4RogDpLI2w4G33a3Kw0TqXqLeZeEBBVvgE7Q3VUxhQk9 U247fZyzxNyg1znrbzQX0MLM4kZWzF3FLGoUbE7CcqiflvZd4E2qNOeCR5XUowlqyXP5JynLWwy0k ZkH8yphDp4Vc/Hh+is1FVaq0YYPjxmj63F3cE27wgDUNhdPdG9n35QAWDjWukDwc8Q81heJzutfC9 DgMs05YU7fv5mv/YwiEmyr040eJvIJvRbVoVG7QPbmwARXV5MvUqpWg06Y4prBYQcfFxkqnbtlgQl gl3S/VpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syaIj-0000000A8xC-0wde; Wed, 09 Oct 2024 17:16:41 +0000 Received: from mail-dm6nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2413::601] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syZib-0000000A0bl-46Tp for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 16:39:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kUNdnzkj5OsLb7eOVmTkmw5h+HqCsekGpE4ambZLJIWqLQEHrwfKUm7G+9c2fl99mlaHNPUDkcEo2rTRz4VluKWYy9txIPBk8z0vTRPXB7tdpn2y37EiWxScho6VitMofO88h5QVijheAuWMTeQLhsDu/UabdFw457pkAO8gWf0zEW2ynty4R4jNl5N6HohDgbr98qluvevJp5AZoIkGI7ixcyvWEkdBbdA2JPPszkLCKK34Ghsa2mFy78TqXAmezPLiNv+VAxDddq0tRHwq62RTO86Z73Sfp44Wzep5nliv9Y2zQ8m9pfazKanLx/o9gseH+oobhPXy9SOydbl/uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UYYC3COHkotNUNMY31Vzls0Pl9/pAN8f8XFYHFTkDqs=; b=lvRhwXwGiPfVcFI7/IbR/4ULzWYv2fQnG3N9L4BUvCTu8fV3zhnUsgOABmGRATXpd08cTE4tSGC5i0uhhkIgK7E2jg53mBkpASyRNoagyewcAE1m/H+Szj1/oYClYa6hRY+qQiiBLL2S0v0gH1zmv661JbmGW2uXoTAp0CshFHiWKL3MxOEnFDwaCOdBnYqQTRSiRdBww34a93Zr56Nl5rZEom3BsQHWwp2apG9S13dWVVXsmH88vry7o/6yqN9AI9pnmnmLhvoGyNIXD1WyNkt/mzJt4xS5l0YX3FJ07oiKLfPbCjtd2oWabE0pPOk0G4v6TdblhJlwCtN1Iqz4mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UYYC3COHkotNUNMY31Vzls0Pl9/pAN8f8XFYHFTkDqs=; b=OAKO/UTcHWBkS4/29mqPjweGNGPRiu6BcGE4kGUW5d+r0k1zGk9nAaNgSHtyuL98/I8YHOg5ejsCiCMM7RXh4nmY3Y2qZ4mb3fNRMf+eZOI+DiMh+ND5tBk/pwhCO7mRlW0clgqDgHAdbRCwYZhavkjg7nf+HfSMxBW0zvSYZP33SLYiAQLY+xxQnKj0f8s0mqLYuqk9HzKq3TM8UL52pXyBEokTMntOlFXuYL/4CvkLEeM1I+4ysjFGXXNJdFruiIsa3OqBwhQ21jYlEd3bZqG7jGJwlOpL/otwe9BdTXkjzJLUdaXI10efSpR15h9PGePFGIXyGwZSKWd5L4fLxw== Received: from CH0P223CA0003.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::15) by SA3PR12MB9227.namprd12.prod.outlook.com (2603:10b6:806:398::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.25; Wed, 9 Oct 2024 16:39:11 +0000 Received: from DS3PEPF000099DD.namprd04.prod.outlook.com (2603:10b6:610:116:cafe::27) by CH0P223CA0003.outlook.office365.com (2603:10b6:610:116::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Wed, 9 Oct 2024 16:39:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS3PEPF000099DD.mail.protection.outlook.com (10.167.17.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.13 via Frontend Transport; Wed, 9 Oct 2024 16:39:10 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 9 Oct 2024 09:39:04 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 9 Oct 2024 09:39:03 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 9 Oct 2024 09:39:02 -0700 From: Nicolin Chen <nicolinc@nvidia.com> To: <jgg@nvidia.com>, <kevin.tian@intel.com>, <will@kernel.org> CC: <joro@8bytes.org>, <suravee.suthikulpanit@amd.com>, <robin.murphy@arm.com>, <dwmw2@infradead.org>, <baolu.lu@linux.intel.com>, <shuah@kernel.org>, <linux-kernel@vger.kernel.org>, <iommu@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>, <linux-kselftest@vger.kernel.org>, <eric.auger@redhat.com>, <jean-philippe@linaro.org>, <mdf@kernel.org>, <mshavit@google.com>, <shameerali.kolothum.thodi@huawei.com>, <smostafa@google.com>, <yi.l.liu@intel.com>, <aik@amd.com>, <patches@lists.linux.dev> Subject: [PATCH v3 06/16] iommufd/hw_pagetable: Allow viommu->ops->cache_invalidate for hwpt_nested Date: Wed, 9 Oct 2024 09:38:18 -0700 Message-ID: <cba810b86d0597715738b4fb87084eacc734d8fd.1728491532.git.nicolinc@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <cover.1728491532.git.nicolinc@nvidia.com> References: <cover.1728491532.git.nicolinc@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DD:EE_|SA3PR12MB9227:EE_ X-MS-Office365-Filtering-Correlation-Id: 357eeda9-f4cf-45c8-31c5-08dce880e700 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: 5VgQk4MTgtzZ0YMznNjW6zzTYYQ+nYetJuYuJUjwvyO1GKF6SHGsHlcQDFgwumdz+tbcOLWISAykmmPwsoTORgdzx7+RjL/9RioMoekfCbeU0npW/KdGw0ZYmuNoOWDMmhP5NIySkt5u3cH8kVdTcb4jxyDKPK5V2FRt3jeb3AZYFiYQfsNuoiwimH0EVecrBFqZtnOYHfQlTDw4X2XSW40wO5zAiSp/A444Kkd2MAF9u/JHROC8VfUuA+uFwj3NaGWqFtNz+Pq9Yse/fiUKqYfNl9HjosQT8RfmeTZ8sNs1ObL6qS+kV4ZZyaR0bASMxNu2rEOySKK9rJWvcJ6NWEp2QDPUkfwrusm5axr0AVkUMSI3IuqJ1xoM0NW8d6Hzuf1EN++Af0I93ClLWlm7VTQUYE1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edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 16:39:10.7681 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 357eeda9-f4cf-45c8-31c5-08dce880e700 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DD.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9227 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_093922_134165_0E0DFF5A X-CRM114-Status: GOOD ( 12.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[v3,01/16] iommufd/viommu: Introduce IOMMUFD_OBJ_VDEVICE and its related struct
|
expand
|
On Wed, Oct 09, 2024 at 09:38:18AM -0700, Nicolin Chen wrote: > Now cache entries for hwpt_nested can be invalidated via the vIOMMU's > cache_invalidate op alternatively. Allow iommufd_hwpt_nested_alloc to > support such a case. > > Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> > --- > drivers/iommu/iommufd/hw_pagetable.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c index b88a638d07da..ccaaf801955c 100644 --- a/drivers/iommu/iommufd/hw_pagetable.c +++ b/drivers/iommu/iommufd/hw_pagetable.c @@ -202,6 +202,17 @@ iommufd_hwpt_paging_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas, return ERR_PTR(rc); } +static inline bool +iommufd_hwpt_nested_has_invalidate_op(struct iommufd_hwpt_nested *hwpt_nested) +{ + struct iommufd_viommu *viommu = hwpt_nested->viommu; + + if (viommu) + return viommu->ops && viommu->ops->cache_invalidate; + else + return hwpt_nested->common.domain->ops->cache_invalidate_user; +} + /** * iommufd_hwpt_nested_alloc() - Get a NESTED iommu_domain for a device * @ictx: iommufd context @@ -257,7 +268,7 @@ iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx, hwpt->domain->owner = ops; if (WARN_ON_ONCE(hwpt->domain->type != IOMMU_DOMAIN_NESTED || - !hwpt->domain->ops->cache_invalidate_user)) { + !iommufd_hwpt_nested_has_invalidate_op(hwpt_nested))) { rc = -EINVAL; goto out_abort; }
Now cache entries for hwpt_nested can be invalidated via the vIOMMU's cache_invalidate op alternatively. Allow iommufd_hwpt_nested_alloc to support such a case. Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> --- drivers/iommu/iommufd/hw_pagetable.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)