From patchwork Thu Jan 30 13:09:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Tomasin X-Patchwork-Id: 13954554 Return-Path: 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 60365C0218A for ; Thu, 30 Jan 2025 13:12:21 +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=HhS/tbVVv2nG9EXWShqCV2+SDZU9FYl2KF5Aw4J3220=; b=RJVbEaYDWGjzugF2dLSsR2xL70 /KsYIdKh/dC5iIhgJZKpOZZtJbxsWZZyb+95JiHfaoyNfQY9fIfjE5VMXKr9K3qkkSVjTT46tqdcj AxrVEWFy3DlYfVFBu1Xo5GVtwLoZPzP9RPXFmj5U3RE5yEokDJAjPHVfokG/I3/HSUBCwCqUjDWBo tERiGYUVyiUvmVZaDFuaAQaPxIJ3ib0DxemXtCa4t3Pj9yCmZ2IHg6rJKTVUyByGvQKCiJUQPK6Qw I+6UR5GwhtCHzVQ6GKCkCkXxp0/QSYxRL/dDorVxLTYq33vPJEPY14WIegC0g7+/v4A+wIfUW7QS/ rMU7wdug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tdULE-00000008pb3-1vwK; Thu, 30 Jan 2025 13:12:20 +0000 Received: from mail-vi1eur05on2062e.outbound.protection.outlook.com ([2a01:111:f403:2613::62e] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tdUIc-00000008p2Y-3C5E; Thu, 30 Jan 2025 13:09:41 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=vzRcA3Du+3/CfDEMz67flwZCjan/kRQcEWhPdyjT9QkTG0swrMF3nbs1PW18pJ2uM5W60DW7jamgL2hHK+IhpdjXJ+77NTTIzYaKZnOmC+62Jb0I9MyXWWLIe8rwJm1RLlL0xhiJaRBRWXZTOjXfhx+eTmVR40aJohzuTt8SewBYr5+ohW+y/JApaizNY6Vp9r0AIQiR9+Lvv/SWvZd9rmipEQBeuhnkCtUbTgSy756ClBvZWZ8+B2Oqlws9BoeI8dED4VeDAnL4K/egoaG++9J4xE0l9AgmMti8vL5Il/wQE9BhucU6Tmp/34YC9UeiKsqwcOTRXi4NPNEsBXenXA== ARC-Message-Signature: i=2; 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=HhS/tbVVv2nG9EXWShqCV2+SDZU9FYl2KF5Aw4J3220=; b=JkpT9R64Lp6Kq82AaE6RDK5jHX6gvD7oOaaxTKLbZIQN9xZN5SEk3XlAa+0yLnIRsZiu4a86h9dFsBUj3pgAJ+Xe62vYwEAgUyeaRZXgnVhwjf91dg0qY5spTUlqFdXxB0vdF03UsvinpqIRcEuKWSl+kcHvnBXS14ifmiLB/VZNzUMeAeXpi34B+BMxgtrwm5e+m9v8AwCmvEcPNPyHvjHuJgUdgcvRR0YcIHPyszp6LS5BTGRZano3DgP4HqmJYV15uq5No4ey47p2es5tmKORwdznI/zbWEsp1PywWZiYH8xLlJcPPGz1kOUAXtzm3p/CSKNtnRZcct1gfmqQtA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=0 ltdi=1) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HhS/tbVVv2nG9EXWShqCV2+SDZU9FYl2KF5Aw4J3220=; b=fkNDtMjtfoUjOZMmWF9u6+jJZ3w+VY6r06JMyjGzEOLG7UXt68gukz6GuP3og/XGnwv81E/kfQOZ5CLbxdDGbFqj+rUF/ydxsIBxrMPlM/hMjJf8XqN++vXLrCm3wG5tP1t583T9E1uQw4yu7JE8Im6yLr0/VC58HwwaSq9eqYU= Received: from AM0P190CA0023.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::33) by DU4PR08MB10912.eurprd08.prod.outlook.com (2603:10a6:10:574::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.20; Thu, 30 Jan 2025 13:09:27 +0000 Received: from AMS0EPF000001A1.eurprd05.prod.outlook.com (2603:10a6:208:190:cafe::66) by AM0P190CA0023.outlook.office365.com (2603:10a6:208:190::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.20 via Frontend Transport; Thu, 30 Jan 2025 13:09:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS0EPF000001A1.mail.protection.outlook.com (10.167.16.231) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.14 via Frontend Transport; Thu, 30 Jan 2025 13:09:27 +0000 Received: ("Tessian outbound 5438980c8758:v560"); Thu, 30 Jan 2025 13:09:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 72d6f04d9d32a842 X-TessianGatewayMetadata: VZ1gol2vpkpx7GI7TujVKeQ7nnUISba/c/lJrVYKRpzmsxF6dWy4YHLLxwnmaN2AOXI1uO/Zl3nWOS0J+Z6Q6xPoMSCDH72CZVsXZ0q7W+z6BRmQ6LKRsQ1qwBZg/kABY/22966ghpokeTYy6FKcdrG9WBURHQRFt0m4ilL18hx+JDjVpiGSc8eC799Oyc+PKoymsQ8wRFYcwWj3Ak896w== X-CR-MTA-TID: 64aa7808 Received: from L5f77923fb7d2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8905E2D2-A953-457F-93FE-AF38EA3A1E77.1; Thu, 30 Jan 2025 13:09:19 +0000 Received: from DUZPR83CU001.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L5f77923fb7d2.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 30 Jan 2025 13:09:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aVzDpi/QUa2cZuVapLj71QIsIr+z9ZMtsE7xLbXFQu8iAnQ6u1m5cv1GngrbSAvWO2qxhEtUDNT+qd8eDV8HD22Y/ZZBxX1YweKEN8ZU/tFbHZlHdzBHi8zXibMJfaq7a1kN7M8wXVND3XI1KWUBxkQqhGMYY6i2Nx1Z2NbS0vATwzXxVjYX9/mXp51x5hgvdLxX+9M7Tgx+Y35ZRpg3uuNyDCXoe2m4LgG1dduiV14wK/TIJPvwz5r8HX2Z5R2VMMxUS6epTRFORxZVududeXT+WI419C8zVebUl46Esn3hDJruWk6zPizHfzG5ehGudS7YHj74bC36BVTV40UupQ== 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=HhS/tbVVv2nG9EXWShqCV2+SDZU9FYl2KF5Aw4J3220=; b=iLZ9l4DLYBL2Y8anKVVYheoVs0h8TUFEiVGrURfJCDiWPiAwkyk5OCIVtEbgZPyq1fNsL79C8LNSxcSjFHtvIr+QuuBWk/GBCy7ZpH5NxfwoL77cCtT5/0pqqngbRXjUEXfsNcmFIpxblHGRUFyZVSfUl6YCHMqsDwmTNoBjpMEsSw/5qqwtcaIJr6rCRcRXDOhGx1orX0ncaBrQ1qnHDarUg1o0saeFIHkDPjpIyonAysDH+e36r+dmCob5RbRLCGxqqXcozQxv4wTqGzujF/WHpxHe+oIABbpAZm4rci5CFlgtcgaz7pDAzXzOhV5rm1Qr5wa3dJfYdTlnjJlxpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 172.205.89.229) smtp.rcpttodomain=kernel.org smtp.mailfrom=arm.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HhS/tbVVv2nG9EXWShqCV2+SDZU9FYl2KF5Aw4J3220=; b=fkNDtMjtfoUjOZMmWF9u6+jJZ3w+VY6r06JMyjGzEOLG7UXt68gukz6GuP3og/XGnwv81E/kfQOZ5CLbxdDGbFqj+rUF/ydxsIBxrMPlM/hMjJf8XqN++vXLrCm3wG5tP1t583T9E1uQw4yu7JE8Im6yLr0/VC58HwwaSq9eqYU= Received: from DB3PR06CA0003.eurprd06.prod.outlook.com (2603:10a6:8:1::16) by AS8PR08MB6053.eurprd08.prod.outlook.com (2603:10a6:20b:292::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.20; Thu, 30 Jan 2025 13:09:17 +0000 Received: from DB5PEPF00014B88.eurprd02.prod.outlook.com (2603:10a6:8:1:cafe::f6) by DB3PR06CA0003.outlook.office365.com (2603:10a6:8:1::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Thu, 30 Jan 2025 13:09:17 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; Received: from nebula.arm.com (172.205.89.229) by DB5PEPF00014B88.mail.protection.outlook.com (10.167.8.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8398.14 via Frontend Transport; Thu, 30 Jan 2025 13:09:16 +0000 Received: from AZ-NEU-EXJ01.Arm.com (10.240.25.132) by AZ-NEU-EX05.Arm.com (10.240.25.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 30 Jan 2025 13:09:10 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EXJ01.Arm.com (10.240.25.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 30 Jan 2025 13:09:10 +0000 Received: from e121164.cambridge.arm.com (10.2.10.32) by mail.arm.com (10.240.25.134) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 30 Jan 2025 13:09:09 +0000 From: Florent Tomasin To: Vinod Koul , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Boris Brezillon" , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T . J . Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= , Matthias Brugger , AngeloGioacchino Del Regno , Yong Wu CC: , , , , , , , , , Akash Goel , Florent Tomasin Subject: [RFC PATCH 4/5] drm/panthor: Add support for protected memory allocation in panthor Date: Thu, 30 Jan 2025 13:09:00 +0000 Message-ID: <821252c96ab2ab3e2d8ef211a09f8b171719baaa.1738228114.git.florent.tomasin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB5PEPF00014B88:EE_|AS8PR08MB6053:EE_|AMS0EPF000001A1:EE_|DU4PR08MB10912:EE_ X-MS-Office365-Filtering-Correlation-Id: 6aa4c957-c3f1-442d-84f1-08dd412f537f X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014|921020; X-Microsoft-Antispam-Message-Info-Original: C63ia1BLCksXgv6LrgFDBzOG8TTo0jWWrnsy+E+iug61frIHZ7NPCG4drwMXT5awfStu5UPOzUIGgDoKPioufYA9q+AHXbfYXEwFdfLQKu3KV69+L13saY7e+jrXzAsryGKGTUg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EPPo//seICWDROhZpUB13MY3w6Bgbt2piTMsqgZCV6elovDzw6Te8/PvJma3rsmgDaaSRz+0CuHe3xRUXzFCxcQVGFyJyxic/pxlsw28CCOKC6Zw6lA26aZWgS2liATmiqBGPsYVtZOgQD3OsgKZk/WhpnY3LTDpGsJhZZa7/OoWUm2Ly67kpyXjQVO+a9bLXlVFQODP0H7voiMi22l1KM8Jj+U4czh1Iy1VYMU7WMGcD8fuvYpupdu6+13jC8nsxJeT8SR6QRNe65sU1/Y02Z/wo/WXnDUx3xsGwzb7GDnI413F9e8LaLyoQJcQWpReCX1d X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6053 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:8:1::16];domain=DB3PR06CA0003.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A1.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 640d1777-448e-4775-ac76-08dd412f4d35 X-Microsoft-Antispam: BCL:0;ARA:13230040|14060799003|1800799024|376014|30052699003|36860700013|82310400026|35042699022|921020; X-Microsoft-Antispam-Message-Info: GHSv/rnAKd5nNn/A0k9b+D/KEIPJuV7diKiv9Wfgs1vwIlznoTUo454tJCodsQWwZ+tqxMcVcoQshxm9Iy+wmJrPxYy67Pv+0exAHtFDUU3QGQ44CWEOpFLvkn2VTxODmcrvTdaVks9ipW8TODaNKEz5a7o8CUTS6XpDz6zYf6F20UoRw+BZaVHzPb2MWngTWEsj1KS0WhNF4fk8/eAGAcV2DQIIAJfdxCr3oUuMGGUKH4k/0qPChoxByR+NPJzp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MnVWKZNzvRjwny0qrzgTpxVe4XvRzTWaCBshASvjXx3x/e1qvFK3G4hG6igfC3MKUAN/yONw1ShiX+yJw2v2p69uqmF/BrhK+yRAVS3jsNDP6H+p99hH6zNxDLpj0U65IF8FP+5yPQAUkOf9f5KLwiUaZ4NkCpQxe+MIGkwh5GJQAXu6pP4OTr9l0DZk8dNqmbnBCb1ms4Mtw X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:64aa7808-outbound-1.mta.getcheckrecipient.com;CAT:NONE;SFS:(13230040)(14060799003)(1800799024)(376014)(30052699003)(36860700013)(82310400026)(35042699022)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 13:09:27.5675 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6aa4c957-c3f1-442d-84f1-08dd412f537f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001A1.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR08MB10912 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250130_050939_052984_68564455 X-CRM114-Status: UNSURE ( 4.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org This patch allows Panthor to allocate buffer objects from a protected heap. The Panthor driver should be seen as a consumer of the heap and not an exporter. To help with the review of this patch, here are important information about the Mali GPU protected mode support: - On CSF FW load, the Panthor driver must allocate a protected buffer object to hold data to use by the FW when in protected mode. This protected buffer object is owned by the device and does not belong to a process. - On CSG creation, the Panthor driver must allocate a protected suspend buffer object for the FW to store data when suspending the CSG while in protected mode. The kernel owns this allocation and does not allow user space mapping. The format of the data in this buffer is only known by the FW and does not need to be shared with other entities. To summarize, Mali GPUs require allocations of protected buffer objects at the kernel level. * How is the protected heap accessed by the Panthor driver? The driver will retrieve the protected heap using the name of the heap provided to the driver via the DTB as attribute. If the heap is not yet available, the panthor driver will defer the probe until created. It is an integration error to provide a heap name that does not exist or is never created in the DTB node. * How is the Panthor driver allocating from the heap? Panthor is calling the DMA heap allocation function and obtains a DMA buffer from it. This buffer is then registered to GEM via PRIME by importing the DMA buffer. Signed-off-by: Florent Tomasin --- drivers/gpu/drm/panthor/Kconfig | 1 + drivers/gpu/drm/panthor/panthor_device.c | 22 ++++++++++- drivers/gpu/drm/panthor/panthor_device.h | 7 ++++ drivers/gpu/drm/panthor/panthor_fw.c | 36 +++++++++++++++-- drivers/gpu/drm/panthor/panthor_fw.h | 2 + drivers/gpu/drm/panthor/panthor_gem.c | 49 ++++++++++++++++++++++-- drivers/gpu/drm/panthor/panthor_gem.h | 16 +++++++- drivers/gpu/drm/panthor/panthor_heap.c | 2 + drivers/gpu/drm/panthor/panthor_sched.c | 5 ++- 9 files changed, 130 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panthor/Kconfig b/drivers/gpu/drm/panthor/Kconfig index 55b40ad07f3b..c0208b886d9f 100644 --- a/drivers/gpu/drm/panthor/Kconfig +++ b/drivers/gpu/drm/panthor/Kconfig @@ -7,6 +7,7 @@ config DRM_PANTHOR depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE depends on MMU select DEVFREQ_GOV_SIMPLE_ONDEMAND + select DMABUF_HEAPS select DRM_EXEC select DRM_GEM_SHMEM_HELPER select DRM_GPUVM diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c index 00f7b8ce935a..1018e5c90a0e 100644 --- a/drivers/gpu/drm/panthor/panthor_device.c +++ b/drivers/gpu/drm/panthor/panthor_device.c @@ -4,7 +4,9 @@ /* Copyright 2023 Collabora ltd. */ #include +#include #include +#include #include #include #include @@ -102,6 +104,9 @@ void panthor_device_unplug(struct panthor_device *ptdev) panthor_mmu_unplug(ptdev); panthor_gpu_unplug(ptdev); + if (ptdev->protm.heap) + dma_heap_put(ptdev->protm.heap); + pm_runtime_dont_use_autosuspend(ptdev->base.dev); pm_runtime_put_sync_suspend(ptdev->base.dev); @@ -172,6 +177,7 @@ int panthor_device_init(struct panthor_device *ptdev) u32 *dummy_page_virt; struct resource *res; struct page *p; + const char *protm_heap_name; int ret; ret = panthor_gpu_coherency_init(ptdev); @@ -246,9 +252,19 @@ int panthor_device_init(struct panthor_device *ptdev) return ret; } + /* If a protected heap is specified but not found, defer the probe until created */ + if (!of_property_read_string(ptdev->base.dev->of_node, "protected-heap-name", + &protm_heap_name)) { + ptdev->protm.heap = dma_heap_find(protm_heap_name); + if (!ptdev->protm.heap) { + ret = -EPROBE_DEFER; + goto err_rpm_put; + } + } + ret = panthor_gpu_init(ptdev); if (ret) - goto err_rpm_put; + goto err_dma_heap_put; ret = panthor_mmu_init(ptdev); if (ret) @@ -286,6 +302,10 @@ int panthor_device_init(struct panthor_device *ptdev) err_unplug_gpu: panthor_gpu_unplug(ptdev); +err_dma_heap_put: + if (ptdev->protm.heap) + dma_heap_put(ptdev->protm.heap); + err_rpm_put: pm_runtime_put_sync_suspend(ptdev->base.dev); return ret; diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h index 0e68f5a70d20..406de9e888e2 100644 --- a/drivers/gpu/drm/panthor/panthor_device.h +++ b/drivers/gpu/drm/panthor/panthor_device.h @@ -7,6 +7,7 @@ #define __PANTHOR_DEVICE_H__ #include +#include #include #include #include @@ -190,6 +191,12 @@ struct panthor_device { /** @fast_rate: Maximum device clock frequency. Set by DVFS */ unsigned long fast_rate; + + /** @protm: Protected mode related data. */ + struct { + /** @heap: Pointer to the protected heap */ + struct dma_heap *heap; + } protm; }; struct panthor_gpu_usage { diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c index 4a2e36504fea..7822af1533b4 100644 --- a/drivers/gpu/drm/panthor/panthor_fw.c +++ b/drivers/gpu/drm/panthor/panthor_fw.c @@ -458,6 +458,7 @@ panthor_fw_alloc_queue_iface_mem(struct panthor_device *ptdev, mem = panthor_kernel_bo_create(ptdev, ptdev->fw->vm, SZ_8K, DRM_PANTHOR_BO_NO_MMAP, + 0, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC | DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED, PANTHOR_VM_KERNEL_AUTO_VA); @@ -491,6 +492,28 @@ panthor_fw_alloc_suspend_buf_mem(struct panthor_device *ptdev, size_t size) { return panthor_kernel_bo_create(ptdev, panthor_fw_vm(ptdev), size, DRM_PANTHOR_BO_NO_MMAP, + 0, + DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC, + PANTHOR_VM_KERNEL_AUTO_VA); +} + +/** + * panthor_fw_alloc_protm_suspend_buf_mem() - Allocate a protm suspend buffer + * for a command stream group. + * @ptdev: Device. + * @size: Size of the protm suspend buffer. + * + * Return: A valid pointer in case of success, NULL if no protected heap, an ERR_PTR() otherwise. + */ +struct panthor_kernel_bo * +panthor_fw_alloc_protm_suspend_buf_mem(struct panthor_device *ptdev, size_t size) +{ + if (!ptdev->protm.heap) + return NULL; + + return panthor_kernel_bo_create(ptdev, panthor_fw_vm(ptdev), size, + DRM_PANTHOR_BO_NO_MMAP, + DRM_PANTHOR_KBO_PROTECTED_HEAP, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC, PANTHOR_VM_KERNEL_AUTO_VA); } @@ -503,6 +526,7 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev, ssize_t vm_pgsz = panthor_vm_page_size(ptdev->fw->vm); struct panthor_fw_binary_section_entry_hdr hdr; struct panthor_fw_section *section; + bool is_protm_section = false; u32 section_size; u32 name_len; int ret; @@ -541,10 +565,13 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev, return -EINVAL; } - if (hdr.flags & CSF_FW_BINARY_IFACE_ENTRY_PROT) { + if ((hdr.flags & CSF_FW_BINARY_IFACE_ENTRY_PROT) && !ptdev->protm.heap) { drm_warn(&ptdev->base, "Firmware protected mode entry not be supported, ignoring"); return 0; + } else if ((hdr.flags & CSF_FW_BINARY_IFACE_ENTRY_PROT) && ptdev->protm.heap) { + drm_info(&ptdev->base, "Firmware protected mode entry supported"); + is_protm_section = true; } if (hdr.va.start == CSF_MCU_SHARED_REGION_START && @@ -610,9 +637,10 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev, vm_map_flags |= DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED; section->mem = panthor_kernel_bo_create(ptdev, panthor_fw_vm(ptdev), - section_size, - DRM_PANTHOR_BO_NO_MMAP, - vm_map_flags, va); + section_size, + DRM_PANTHOR_BO_NO_MMAP, + (is_protm_section ? DRM_PANTHOR_KBO_PROTECTED_HEAP : 0), + vm_map_flags, va); if (IS_ERR(section->mem)) return PTR_ERR(section->mem); diff --git a/drivers/gpu/drm/panthor/panthor_fw.h b/drivers/gpu/drm/panthor/panthor_fw.h index 22448abde992..29042d0dc60c 100644 --- a/drivers/gpu/drm/panthor/panthor_fw.h +++ b/drivers/gpu/drm/panthor/panthor_fw.h @@ -481,6 +481,8 @@ panthor_fw_alloc_queue_iface_mem(struct panthor_device *ptdev, u32 *input_fw_va, u32 *output_fw_va); struct panthor_kernel_bo * panthor_fw_alloc_suspend_buf_mem(struct panthor_device *ptdev, size_t size); +struct panthor_kernel_bo * +panthor_fw_alloc_protm_suspend_buf_mem(struct panthor_device *ptdev, size_t size); struct panthor_vm *panthor_fw_vm(struct panthor_device *ptdev); diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c index 8244a4e6c2a2..88caf928acd0 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.c +++ b/drivers/gpu/drm/panthor/panthor_gem.c @@ -9,10 +9,14 @@ #include +#include + #include "panthor_device.h" #include "panthor_gem.h" #include "panthor_mmu.h" +MODULE_IMPORT_NS(DMA_BUF); + static void panthor_gem_free_object(struct drm_gem_object *obj) { struct panthor_gem_object *bo = to_panthor_bo(obj); @@ -31,6 +35,7 @@ static void panthor_gem_free_object(struct drm_gem_object *obj) */ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) { + struct dma_buf *dma_bo = NULL; struct panthor_vm *vm; int ret; @@ -38,6 +43,10 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) return; vm = bo->vm; + + if (bo->flags & DRM_PANTHOR_KBO_PROTECTED_HEAP) + dma_bo = bo->obj->import_attach->dmabuf; + panthor_kernel_bo_vunmap(bo); if (drm_WARN_ON(bo->obj->dev, @@ -51,6 +60,9 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) panthor_vm_free_va(vm, &bo->va_node); drm_gem_object_put(bo->obj); + if (dma_bo) + dma_buf_put(dma_bo); + out_free_bo: panthor_vm_put(vm); kfree(bo); @@ -62,6 +74,7 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) * @vm: VM to map the GEM to. If NULL, the kernel object is not GPU mapped. * @size: Size of the buffer object. * @bo_flags: Combination of drm_panthor_bo_flags flags. + * @kbo_flags: Combination of drm_panthor_kbo_flags flags. * @vm_map_flags: Combination of drm_panthor_vm_bind_op_flags (only those * that are related to map operations). * @gpu_va: GPU address assigned when mapping to the VM. @@ -72,9 +85,11 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) */ struct panthor_kernel_bo * panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm, - size_t size, u32 bo_flags, u32 vm_map_flags, + size_t size, u32 bo_flags, u32 kbo_flags, u32 vm_map_flags, u64 gpu_va) { + struct dma_buf *dma_bo = NULL; + struct drm_gem_object *gem_obj = NULL; struct drm_gem_shmem_object *obj; struct panthor_kernel_bo *kbo; struct panthor_gem_object *bo; @@ -87,14 +102,38 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm, if (!kbo) return ERR_PTR(-ENOMEM); - obj = drm_gem_shmem_create(&ptdev->base, size); + if (kbo_flags & DRM_PANTHOR_KBO_PROTECTED_HEAP) { + if (!ptdev->protm.heap) { + ret = -EINVAL; + goto err_free_bo; + } + + dma_bo = dma_heap_buffer_alloc(ptdev->protm.heap, size, + DMA_HEAP_VALID_FD_FLAGS, DMA_HEAP_VALID_HEAP_FLAGS); + if (!dma_bo) { + ret = -ENOMEM; + goto err_free_bo; + } + + gem_obj = drm_gem_prime_import(&ptdev->base, dma_bo); + if (IS_ERR(gem_obj)) { + ret = PTR_ERR(gem_obj); + goto err_free_dma_bo; + } + + obj = to_drm_gem_shmem_obj(gem_obj); + } else { + obj = drm_gem_shmem_create(&ptdev->base, size); + } + if (IS_ERR(obj)) { ret = PTR_ERR(obj); - goto err_free_bo; + goto err_free_dma_bo; } bo = to_panthor_bo(&obj->base); kbo->obj = &obj->base; + kbo->flags = kbo_flags; bo->flags = bo_flags; /* The system and GPU MMU page size might differ, which becomes a @@ -124,6 +163,10 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm, err_put_obj: drm_gem_object_put(&obj->base); +err_free_dma_bo: + if (dma_bo) + dma_buf_put(dma_bo); + err_free_bo: kfree(kbo); return ERR_PTR(ret); diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h index e43021cf6d45..d4fe8ae9f0a8 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.h +++ b/drivers/gpu/drm/panthor/panthor_gem.h @@ -13,6 +13,17 @@ struct panthor_vm; +/** + * enum drm_panthor_kbo_flags - Kernel buffer object flags, passed at creation time + */ +enum drm_panthor_kbo_flags { + /** + * @DRM_PANTHOR_KBO_PROTECTED_HEAP: The buffer object will be allocated + * from a DMA-Buf protected heap. + */ + DRM_PANTHOR_KBO_PROTECTED_HEAP = (1 << 0), +}; + /** * struct panthor_gem_object - Driver specific GEM object. */ @@ -75,6 +86,9 @@ struct panthor_kernel_bo { * @kmap: Kernel CPU mapping of @gem. */ void *kmap; + + /** @flags: Combination of drm_panthor_kbo_flags flags. */ + u32 flags; }; static inline @@ -138,7 +152,7 @@ panthor_kernel_bo_vunmap(struct panthor_kernel_bo *bo) struct panthor_kernel_bo * panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm, - size_t size, u32 bo_flags, u32 vm_map_flags, + size_t size, u32 bo_flags, u32 kbo_flags, u32 vm_map_flags, u64 gpu_va); void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo); diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/panthor_heap.c index 3796a9eb22af..5395f0d90360 100644 --- a/drivers/gpu/drm/panthor/panthor_heap.c +++ b/drivers/gpu/drm/panthor/panthor_heap.c @@ -146,6 +146,7 @@ static int panthor_alloc_heap_chunk(struct panthor_device *ptdev, chunk->bo = panthor_kernel_bo_create(ptdev, vm, heap->chunk_size, DRM_PANTHOR_BO_NO_MMAP, + 0, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC, PANTHOR_VM_KERNEL_AUTO_VA); if (IS_ERR(chunk->bo)) { @@ -549,6 +550,7 @@ panthor_heap_pool_create(struct panthor_device *ptdev, struct panthor_vm *vm) pool->gpu_contexts = panthor_kernel_bo_create(ptdev, vm, bosize, DRM_PANTHOR_BO_NO_MMAP, + 0, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC, PANTHOR_VM_KERNEL_AUTO_VA); if (IS_ERR(pool->gpu_contexts)) { diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c index ef4bec7ff9c7..e260ed8aef5b 100644 --- a/drivers/gpu/drm/panthor/panthor_sched.c +++ b/drivers/gpu/drm/panthor/panthor_sched.c @@ -3298,6 +3298,7 @@ group_create_queue(struct panthor_group *group, queue->ringbuf = panthor_kernel_bo_create(group->ptdev, group->vm, args->ringbuf_size, DRM_PANTHOR_BO_NO_MMAP, + 0, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC | DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED, PANTHOR_VM_KERNEL_AUTO_VA); @@ -3328,6 +3329,7 @@ group_create_queue(struct panthor_group *group, queue->profiling.slot_count * sizeof(struct panthor_job_profiling_data), DRM_PANTHOR_BO_NO_MMAP, + 0, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC | DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED, PANTHOR_VM_KERNEL_AUTO_VA); @@ -3435,7 +3437,7 @@ int panthor_group_create(struct panthor_file *pfile, } suspend_size = csg_iface->control->protm_suspend_size; - group->protm_suspend_buf = panthor_fw_alloc_suspend_buf_mem(ptdev, suspend_size); + group->protm_suspend_buf = panthor_fw_alloc_protm_suspend_buf_mem(ptdev, suspend_size); if (IS_ERR(group->protm_suspend_buf)) { ret = PTR_ERR(group->protm_suspend_buf); group->protm_suspend_buf = NULL; @@ -3446,6 +3448,7 @@ int panthor_group_create(struct panthor_file *pfile, group_args->queues.count * sizeof(struct panthor_syncobj_64b), DRM_PANTHOR_BO_NO_MMAP, + 0, DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC | DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED, PANTHOR_VM_KERNEL_AUTO_VA);