From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9257CC77B76 for ; Thu, 20 Apr 2023 16:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234487AbjDTQcO (ORCPT ); Thu, 20 Apr 2023 12:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbjDTQcH (ORCPT ); Thu, 20 Apr 2023 12:32:07 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2053.outbound.protection.outlook.com [40.107.244.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC3EE60; Thu, 20 Apr 2023 09:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8He5kvcahhzvUmdWcD34foyPxxxrtJnB4tPVsAAtwLJWXPJsxYYn0XVlmB3QoWTQNubWcW7kmUAI6RvMrbywn4gSSOOkGpQlA1L6qo1Ns3FymoOtg4RyK1UWOiG2U/LMTh9tVVDPNRRttWDPvXK2MziK468yWOcIkCxfTGi5YCMVvNUx0w9QRZ8uivk2yuvpCRBaZdop7qkj7gvjZdzLoPdc15bkmiAz5Oq6C/O3i9t/e/TfDc67QDFgpUgMWu5D8W6FDWvI7o/mc/Q+lGy4JOkOS/EoU3gMVVEwdL9tSHeKhtmXKm61wkQwkiMv0lz7uPhXyPKEjMlZPfglu3UBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=tT9pMXjLl6E+ougnM0VBeecJpTqYTp3ifuOyQ+Nqe0I=; b=i9ZsG6/wvfwc2feY36bU4CftRfnyfIJ1CgzmUP+cRkaenbuGMA9/MKbEYpSd8PwAFD1gq9PxzkLW89EGg8iKtYQ94/lP1wYibBVpi7Ey2rrqVkTF/yDE7phbFRWMh2eQjAgkL4Ekv6Q/54W+MjBpEVekO/7Qnj6vO5Ch0Q0obso0SrdpF278aa97L9j7KuDMJkWd9hbbewF93bsNJd5j5u1vTUTI2tAjBXfm3UIkwRDIbKsbW5NnUS+xqtoHt3SaB/Hno9W9om9AeGGJ/IGlty/vDQ9ZzYILU5FGEt6dxjfHMvN2FSA8ZBcYm4GbTHGT9yh9j9MQOIJpI8ZAdFcNmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tT9pMXjLl6E+ougnM0VBeecJpTqYTp3ifuOyQ+Nqe0I=; b=zuRZSb3jnwPj3ehMJVV8Kn6bCStFa+jfjpWaHpNN+ArakT9KbjChlqCf7upsEi1N19Xk9Bgp5g+zvANrCjRQrZ5j4AuOd2x7g1glUHsFOIWS2eniPTW70q4mjXRk/QMWYGrtobBH7BXkYc3x+bTM6rCI/RLUg54ur7xiOfTinhI= Received: from DS7PR03CA0340.namprd03.prod.outlook.com (2603:10b6:8:55::21) by SN7PR12MB6716.namprd12.prod.outlook.com (2603:10b6:806:270::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Thu, 20 Apr 2023 16:32:04 +0000 Received: from DM6NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::6f) by DS7PR03CA0340.outlook.office365.com (2603:10b6:8:55::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT113.mail.protection.outlook.com (10.13.173.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:03 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:31:58 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 01/10] crypto: ccp: Rename macro for security attributes Date: Thu, 20 Apr 2023 11:31:29 -0500 Message-ID: <20230420163140.14940-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT113:EE_|SN7PR12MB6716:EE_ X-MS-Office365-Filtering-Correlation-Id: 65426dd3-990a-4cc3-da14-08db41bcc5de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cOOAiOYyihBA4HrCWvoLsGyWy35D05UkMYiU0Q2zijZw1MIxAOIG7OaGeyKchB99rtuirHFimUb9lJ+InXcrV8iCEt7vuFFqDWXxKZRu/r+VA7KuxY/uEzrRvzDA/RtdPX+3m/L0PsUfvASsNE5Fj/LfX//yaaym61EJzlzNLvd49UIsRpg+QPlF3+LR0EQ24nP3pOTB8VgoOBpB38Z6l6BN9yr13FmOzxADt0VR4y7O0/UBIWjhlFKoF7L1Zg6neu1CvWniYrzU/uGrf5JvGHbHCduvy5J/TcH+kflAtr1UydDNZELHHupNOfwYIIQepnaY3r5BT0GuQVN23rZ3T5wPbpUoCyovk2Een2dBIJTv6GDMSzpAMnb1eDofPKWL1jzAtGI7v62rmOvAcZ5ltWIj3gr1t4Fls8oqODhFxAODey7IMruq+tKOWrwg1GF1F3dGvpZExLg12SggjrEJ8KArpajNF2WmvRNQWQcsEcnKuAbpN798A24CFlx6Q+sz08kNaPMcgaQV+xX0SysTv+BFW1VOmytzG1IiB4htV91ZMeV8feviF9Ydujw5wX7uvS32bOmL4uW39vjklavIV7yx6QvDIAhTpf6Z/UwkPsvbdE8DBBu95+sfDHDr2WH/raGd8rshcUavORgG6uDI4Vb6EYDHjYESbjAVB7tBhongvbKsWxuqTvVqn+eFFOp4YE8GwDR79ArMyKZw2oWUSQeVAeYq2WjwjXj3EC8mZRI= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199021)(46966006)(40470700004)(36840700001)(6636002)(478600001)(6666004)(8936002)(8676002)(316002)(41300700001)(82740400003)(4326008)(70206006)(70586007)(40480700001)(54906003)(110136005)(81166007)(356005)(186003)(40460700003)(15650500001)(2906002)(16526019)(36756003)(426003)(83380400001)(1076003)(26005)(86362001)(336012)(47076005)(82310400005)(36860700001)(5660300002)(2616005)(7696005)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:03.1649 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65426dd3-990a-4cc3-da14-08db41bcc5de X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The attribute_show() macro is only valid for determining the availability of security related sysfs entries. Rename the macro to better show this relationship. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/sp-pci.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index aa15bc4cac2b..85e3dc8853e2 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -32,7 +32,7 @@ struct sp_pci { }; static struct sp_device *sp_dev_master; =20 -#define attribute_show(name, def) \ +#define security_attribute_show(name, def) \ static ssize_t name##_show(struct device *d, struct device_attribute *attr= , \ char *buf) \ { \ @@ -42,24 +42,24 @@ static ssize_t name##_show(struct device *d, struct dev= ice_attribute *attr, \ return sysfs_emit(buf, "%d\n", (psp->capability & bit) > 0); \ } =20 -attribute_show(fused_part, FUSED_PART) +security_attribute_show(fused_part, FUSED_PART) static DEVICE_ATTR_RO(fused_part); -attribute_show(debug_lock_on, DEBUG_LOCK_ON) +security_attribute_show(debug_lock_on, DEBUG_LOCK_ON) static DEVICE_ATTR_RO(debug_lock_on); -attribute_show(tsme_status, TSME_STATUS) +security_attribute_show(tsme_status, TSME_STATUS) static DEVICE_ATTR_RO(tsme_status); -attribute_show(anti_rollback_status, ANTI_ROLLBACK_STATUS) +security_attribute_show(anti_rollback_status, ANTI_ROLLBACK_STATUS) static DEVICE_ATTR_RO(anti_rollback_status); -attribute_show(rpmc_production_enabled, RPMC_PRODUCTION_ENABLED) +security_attribute_show(rpmc_production_enabled, RPMC_PRODUCTION_ENABLED) static DEVICE_ATTR_RO(rpmc_production_enabled); -attribute_show(rpmc_spirom_available, RPMC_SPIROM_AVAILABLE) +security_attribute_show(rpmc_spirom_available, RPMC_SPIROM_AVAILABLE) static DEVICE_ATTR_RO(rpmc_spirom_available); -attribute_show(hsp_tpm_available, HSP_TPM_AVAILABLE) +security_attribute_show(hsp_tpm_available, HSP_TPM_AVAILABLE) static DEVICE_ATTR_RO(hsp_tpm_available); -attribute_show(rom_armor_enforced, ROM_ARMOR_ENFORCED) +security_attribute_show(rom_armor_enforced, ROM_ARMOR_ENFORCED) static DEVICE_ATTR_RO(rom_armor_enforced); =20 -static struct attribute *psp_attrs[] =3D { +static struct attribute *psp_security_attrs[] =3D { &dev_attr_fused_part.attr, &dev_attr_debug_lock_on.attr, &dev_attr_tsme_status.attr, @@ -83,13 +83,13 @@ static umode_t psp_security_is_visible(struct kobject *= kobj, struct attribute *a return 0; } =20 -static struct attribute_group psp_attr_group =3D { - .attrs =3D psp_attrs, +static struct attribute_group psp_security_attr_group =3D { + .attrs =3D psp_security_attrs, .is_visible =3D psp_security_is_visible, }; =20 static const struct attribute_group *psp_groups[] =3D { - &psp_attr_group, + &psp_security_attr_group, NULL, }; =20 --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0855BC77B7C for ; Thu, 20 Apr 2023 16:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234026AbjDTQcK (ORCPT ); Thu, 20 Apr 2023 12:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232605AbjDTQcH (ORCPT ); Thu, 20 Apr 2023 12:32:07 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2083.outbound.protection.outlook.com [40.107.92.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B55210DA; Thu, 20 Apr 2023 09:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EaMybteynNZ8Fq9I4rvl22LguMwuBTzvBQAJusI9IXyIP/zH8aEJ8/O7lDIAgx9hlBQ659A6zxvdywVtT2kvlYMuz9rQAM5wb5JaLCXqa3pYqIPEV2U2dFo2miYK0IwD1iK/OUyVw0jwwihGK/JbNfYD6uMbRIkKSiB36hLm8pziIaSYBYcd83uyM/zo2RqkNEuLNmCaTYGHbKJv+bULeseJLh94r/TqSga/TKk4L8zkZycRROJ9VtIHW/Fvlo5d9YZNGhn9iDf8hCrN0fe8V+W5UAZwAkJE7+Ln9uFK5qfl9euNd6tCZv00J5DOZLXz904V6QrEkutVgrLDpkTSiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=De/v1LOvw5LzDRNbq4X/mZpXgCayIOs5BnbBcv4n6uA=; b=RYhXYQ3+xjizORPkpMj1W6+meSTG0EwkCdkXk414f7jkT7VmbjmHOsE82ga0sc5B6JysL2bQFLIYJwcb0vQ1Hf26V4QsQYgHAVMigAdnBR1J6a3+6xpoCQV6cYN+PfpZkumOwHgeOxcYsLjy0ftGV8n+Ier9pajuswsHyVlKLsb/WYtwICuqhFx20959T3gF1m4sueOS+KxpEjSbx2qhkfPdtkLQfje93V/UaPdp/dXiJnDSnDnBjIH7efQ3k5SWKdHdv66k/JO7tc+aVKYxhhqRYBJ/1/FIlkmYbQ8t6gJQbiv4VpvHm5Ng8uZZJPFARlHhezZHKePyVIDkGTeFhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=De/v1LOvw5LzDRNbq4X/mZpXgCayIOs5BnbBcv4n6uA=; b=R7yu90jmnoBBAOXFES+rDaS2E3eG4Ht6wAcIGmpdEt9tob3P84woFMGupVcCPzpG5V+WHcbkVG9VkWJUte2hNfHFodqdbVwt1KsWtvB1MUC8GT5o0s3gkhENttG1BfiSfdW1FhSb/fAFAGnxf+xnWJOqq1G/fNLDKbkWwjK6uho= Received: from DM6PR07CA0121.namprd07.prod.outlook.com (2603:10b6:5:330::33) by DM4PR12MB6206.namprd12.prod.outlook.com (2603:10b6:8:a7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:04 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:5:330:cafe::e) by DM6PR07CA0121.outlook.office365.com (2603:10b6:5:330::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:03 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:31:59 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 02/10] crypto: ccp: Add support for displaying PSP firmware versions Date: Thu, 20 Apr 2023 11:31:30 -0500 Message-ID: <20230420163140.14940-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT027:EE_|DM4PR12MB6206:EE_ X-MS-Office365-Filtering-Correlation-Id: 63db6666-7bc1-48ea-7a6c-08db41bcc653 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WWfZTLwYLV+r73ckYhWujG20v4diKqcFWlGmJ3Zl56A6bPZ9VigRCgxZrywOAxYwqBuuHipDk8iI3Nuzu69RbXmOhjm/RQEVqiiAyIweSUSEPF4izoyL9dm2LZdEmqLtnQIFKjqjpNHsfniRcOGeI/vzBhVgfiBaNT/jCai2BvmUBe1/esLH1QMoLmB+pnackxJGJiMlbcqn34j3Cc7uO0zRQKM/+GggRIkCjPMCPJWhgLUZ2K1YQRqLTwXpaUKmqXHp+AF0TYI1CGIl+8MbwtAgG+lrUazKmJtb1ygVJKFCm7GSYtUoiINgoNIqx65F8PP2vfNixL04EMr1HjxapoVP25huKES/yNmeWBBYAI6lKHjCqFiG7Mrkf1u4kJ8Jbi+D5vUxejGH3ZgJAdqtqbeRfqYapcfn4Z5oXf0DWdFnxTVKs/quTcCPedyQ1Hon2WMkl2vlLKotdNwq1BCh1USS53glH5TtUSZP9fo7HfcxYexpwRRpD7g43iH8g8aokTMb5V+7C8s1IrCeOvVglzbn+Oj7d5cgGtbsMoYGki6cptwwOkxsGg8S4gUl4RSSz5fgHWqKFS4cpuw5O8jUAAPnt7bQmPwEN6d5ABhiU/9m7Pt6MNvAA4VquqS7IG+jx+8rWg9SVC9Eo1YDJe9qdrQjxv8sKhF9cNmihAUEUcAb4dVf8jcudjO9EDRrcuzq/ZwyzRAm5zYGX4f/dn72FxpKGCqBjYO6lHqcNpq+ceA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(396003)(346002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(4326008)(316002)(110136005)(54906003)(6636002)(70586007)(70206006)(40460700003)(186003)(16526019)(1076003)(26005)(47076005)(36860700001)(2616005)(336012)(426003)(83380400001)(40480700001)(5660300002)(41300700001)(8676002)(82310400005)(8936002)(478600001)(7696005)(6666004)(82740400003)(36756003)(86362001)(2906002)(81166007)(356005)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:03.9292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63db6666-7bc1-48ea-7a6c-08db41bcc653 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6206 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As it's not always obvious what PSP bootloader or TEE version are present in OEM systems, add the ability to get this information from sysfs for supported platforms. Signed-off-by: Mario Limonciello --- Documentation/ABI/testing/sysfs-driver-ccp | 18 +++++++ drivers/crypto/ccp/sp-dev.h | 2 + drivers/crypto/ccp/sp-pci.c | 58 ++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ccp b/Documentation/ABI= /testing/sysfs-driver-ccp index 7aded9b75553..ee6b787eee7a 100644 --- a/Documentation/ABI/testing/sysfs-driver-ccp +++ b/Documentation/ABI/testing/sysfs-driver-ccp @@ -85,3 +85,21 @@ Description: Possible values: 0: Not enforced 1: Enforced + +What: /sys/bus/pci/devices//bootloader_version +Date: June 2023 +KernelVersion: 6.4 +Contact: mario.limonciello@amd.com +Description: + The /sys/bus/pci/devices//bootloader_version + file reports the firmware version of the AMD AGESA + bootloader. + +What: /sys/bus/pci/devices//tee_version +Date: June 2023 +KernelVersion: 6.4 +Contact: mario.limonciello@amd.com +Description: + The /sys/bus/pci/devices//tee_version + file reports the firmware version of the AMD Trusted + Execution Environment (TEE). diff --git a/drivers/crypto/ccp/sp-dev.h b/drivers/crypto/ccp/sp-dev.h index 1253a0217985..76c32ee6bd65 100644 --- a/drivers/crypto/ccp/sp-dev.h +++ b/drivers/crypto/ccp/sp-dev.h @@ -51,6 +51,7 @@ struct tee_vdata { const unsigned int cmdbuff_addr_hi_reg; const unsigned int ring_wptr_reg; const unsigned int ring_rptr_reg; + const unsigned int info_reg; }; =20 struct platform_access_vdata { @@ -69,6 +70,7 @@ struct psp_vdata { const unsigned int feature_reg; const unsigned int inten_reg; const unsigned int intsts_reg; + const unsigned int bootloader_info_reg; }; =20 /* Structure to hold SP device data */ diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index 85e3dc8853e2..4d729aa1b260 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -8,6 +8,7 @@ * Author: Gary R Hook */ =20 +#include #include #include #include @@ -88,8 +89,65 @@ static struct attribute_group psp_security_attr_group = =3D { .is_visible =3D psp_security_is_visible, }; =20 +#define version_attribute_show(name, _offset) \ +static ssize_t name##_show(struct device *d, struct device_attribute *attr= , \ + char *buf) \ +{ \ + struct sp_device *sp =3D dev_get_drvdata(d); \ + struct psp_device *psp =3D sp->psp_data; \ + unsigned int val =3D ioread32(psp->io_regs + _offset); \ + return sysfs_emit(buf, "%02lx.%02lx.%02lx.%02lx\n", \ + FIELD_GET(GENMASK(31, 24), val), \ + FIELD_GET(GENMASK(23, 16), val), \ + FIELD_GET(GENMASK(15, 8), val), \ + FIELD_GET(GENMASK(7, 0), val)); \ +} + +version_attribute_show(bootloader_version, psp->vdata->bootloader_info_reg) +static DEVICE_ATTR_RO(bootloader_version); +version_attribute_show(tee_version, psp->vdata->tee->info_reg) +static DEVICE_ATTR_RO(tee_version); + +static struct attribute *psp_firmware_attrs[] =3D { + &dev_attr_bootloader_version.attr, + &dev_attr_tee_version.attr, + NULL, +}; + +static umode_t psp_firmware_is_visible(struct kobject *kobj, struct attrib= ute *attr, int idx) +{ + struct device *dev =3D kobj_to_dev(kobj); + struct sp_device *sp =3D dev_get_drvdata(dev); + struct psp_device *psp =3D sp->psp_data; + unsigned int val =3D 0xffffffff; + + if (!psp) + return 0; + + if (attr =3D=3D &dev_attr_bootloader_version.attr && + psp->vdata->bootloader_info_reg) + val =3D ioread32(psp->io_regs + psp->vdata->bootloader_info_reg); + + if (attr =3D=3D &dev_attr_tee_version.attr && + psp->capability & PSP_CAPABILITY_TEE && + psp->vdata->tee->info_reg) + val =3D ioread32(psp->io_regs + psp->vdata->tee->info_reg); + + + if (val !=3D 0xffffffff) + return 0444; + + return 0; +} + +static struct attribute_group psp_firmware_attr_group =3D { + .attrs =3D psp_firmware_attrs, + .is_visible =3D psp_firmware_is_visible, +}; + static const struct attribute_group *psp_groups[] =3D { &psp_security_attr_group, + &psp_firmware_attr_group, NULL, }; =20 --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4636CC77B72 for ; Thu, 20 Apr 2023 16:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234689AbjDTQcZ (ORCPT ); Thu, 20 Apr 2023 12:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233174AbjDTQcJ (ORCPT ); Thu, 20 Apr 2023 12:32:09 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B667B10F1; Thu, 20 Apr 2023 09:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RCWw4LmYEwkJsX3iI2d7HjXLCJvlOq20hCdQ7isZwTyzHHTfrVaWWKztBjFLDZwkcg3x/ft1wPSdVAWRPJ1285kVTpw166EypGQGZyq4EvdvmK/mCbrLEUugon6EsnqWLJsl/DU2JpPiWzyGzo+Zrd/MkgmgSqgekmEG/L3HN23k3WUVLRAYYsG0llbybb82gCfWLxOIQYClrrXad+0AwEmsu4SkWS1bTRxHEz4+cRqfd104xq4Ba4hjtg6vTBiVTgOagZPuJ5An5oWWcmCKvtxV3V7sCtgdlw64juBYGVbNjWSv6zfZVq3sWNmu30mFk4mWRCKAfpUcgyOX5I+tsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=U13fFXEM07lJGuyTMo7PvjJrJ/WZmstRJ6eJu+3aEtM=; b=FgCKTHbWGKZGhS8FmYH/J6mzs9x08hzI1RoNGPc/PNsIvE1I5hHwLQlSBMitjBXm7x3o5VfLcbmIVyGQ+lWwRbdttE6PoZGsfMvpG4EGFR0u1XGTFznZIqmdd1gvaWXyGQFLMYdLpMbq+esV1pnUwO5a5mZn2h44qsnFRaH4zXtsR2J1Ms4FZNVLZQAaCATB1QRZLGE0sLh9lsoSpW4oCu/6KzfoyypwXgOPcYxdOoM6OJFQqGvZnm3NO77QyzGD5NDjDZB1eEutf5BJYnzYRjgNguo0Isl9QtzM6OgkHpcD2bOmzyliglPdp/odekV8/W3GHh0OZ53T088LA9d/OQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U13fFXEM07lJGuyTMo7PvjJrJ/WZmstRJ6eJu+3aEtM=; b=PIYhXMxUBfwsKa8vT5tEzrX0bRHT3AC82jPLxNuL4MB2f4u2OaV26xNBSt/6FlFGizuPPyDO10ULmYsyKJsenQ3R9Asj21vl1ExxkxQcc/cP/gKoAWeu3R0qZXp5RoXm2H58pt5IftvgTCzwklGkok97c8dpUWO57W01aUggFEw= Received: from DS7PR03CA0352.namprd03.prod.outlook.com (2603:10b6:8:55::32) by MN2PR12MB4317.namprd12.prod.outlook.com (2603:10b6:208:1d0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:04 +0000 Received: from DM6NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::c2) by DS7PR03CA0352.outlook.office365.com (2603:10b6:8:55::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT113.mail.protection.outlook.com (10.13.173.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:04 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:00 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 03/10] crypto: ccp: Add bootloader and TEE version offsets Date: Thu, 20 Apr 2023 11:31:31 -0500 Message-ID: <20230420163140.14940-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT113:EE_|MN2PR12MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: 7eeceb28-acab-4aea-0a90-08db41bcc694 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A1b2SOhOFPhiWaPPTqnkhZFM+b20jh8kyTRWr1erXbwEBHHsc4nYDoizSRUmxz1KeWgqVISyo9s9T2BnlZ/1B1Hd5yLn9nG4DihWYzVy4AGcr2bb3qIfFRnQdKncHBUvfOcGasFOGSuWRmAWOpIAO354G/8ww7X+YGIsa17kWHi1jupBJGL5/DNpTxpCT4Xe1VmQuzMwZOtAEt6I8e7ofilKaABqD0no4J3BAFMbpvyiAyTbGWiJfc/Mk2Pff73uCUlZ0917J+JHzbdVAqdCqih8Xy+hR2zE+zJl+0i2q/E4kBv/Wd5SFnVczyEMfhy8Gza5FdgLzWGSXBQoW+MY6llMLVkoJAfo2n4Dym5hk8a2Fz0CbPqjej3qgwk8Kb42dPbpKe31nr9iA0dABMjNKbeDIstb76Euh/d4PVd/c8QFSxzy63qcBymfh4aQIV5Ho41JnEm3jCorv6TvCLnmP99Sj/0liP34c393ZuFNDfqMwEKRFhIpmAPaVk0TwBjr/fhZQLTctcezwsWqNVkWv0B1522atnDmiU/FOyc+r9KYAgzT/n6bPifmE/JB7s1LxgcGRXYApoqZ1uG/bYkBB+KEhJvZvYhN+jIaKJgsEbgQ1jyAhikowDVF+TrW9Ir11LMYTq1VwhCKpvtKx8mHWdNx0fyzT/uYMEDug+2tVP3fstyzuowVE9H2RBB5Zsv1rgBQwSfar9W47hytxFLuY8ejS1KTbEnIFkv1O/qOP88= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199021)(40470700004)(46966006)(36840700001)(86362001)(186003)(16526019)(426003)(336012)(41300700001)(81166007)(356005)(1076003)(82740400003)(316002)(40480700001)(4326008)(26005)(6666004)(7696005)(83380400001)(47076005)(82310400005)(36860700001)(2616005)(478600001)(36756003)(40460700003)(110136005)(8676002)(8936002)(5660300002)(70586007)(70206006)(2906002)(6636002)(54906003)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:04.3523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7eeceb28-acab-4aea-0a90-08db41bcc694 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4317 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The bootloader and TEE versions are stored in registers that can be accessed from sysfs. This exports the information for recent client and datacenter parts. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/sp-pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index 4d729aa1b260..460f3ee12fb6 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -417,6 +417,7 @@ static const struct tee_vdata teev1 =3D { .cmdbuff_addr_hi_reg =3D 0x1054c, /* C2PMSG_19 */ .ring_wptr_reg =3D 0x10550, /* C2PMSG_20 */ .ring_rptr_reg =3D 0x10554, /* C2PMSG_21 */ + .info_reg =3D 0x109e8, /* C2PMSG_58 */ }; =20 static const struct platform_access_vdata pa_v1 =3D { @@ -429,6 +430,7 @@ static const struct platform_access_vdata pa_v1 =3D { =20 static const struct psp_vdata pspv1 =3D { .sev =3D &sevv1, + .bootloader_info_reg =3D 0x105ec, /* C2PMSG_59 */ .feature_reg =3D 0x105fc, /* C2PMSG_63 */ .inten_reg =3D 0x10610, /* P2CMSG_INTEN */ .intsts_reg =3D 0x10614, /* P2CMSG_INTSTS */ @@ -436,6 +438,7 @@ static const struct psp_vdata pspv1 =3D { =20 static const struct psp_vdata pspv2 =3D { .sev =3D &sevv2, + .bootloader_info_reg =3D 0x109ec, /* C2PMSG_59 */ .feature_reg =3D 0x109fc, /* C2PMSG_63 */ .inten_reg =3D 0x10690, /* P2CMSG_INTEN */ .intsts_reg =3D 0x10694, /* P2CMSG_INTSTS */ @@ -444,6 +447,7 @@ static const struct psp_vdata pspv2 =3D { static const struct psp_vdata pspv3 =3D { .tee =3D &teev1, .platform_access =3D &pa_v1, + .bootloader_info_reg =3D 0x109ec, /* C2PMSG_59 */ .feature_reg =3D 0x109fc, /* C2PMSG_63 */ .inten_reg =3D 0x10690, /* P2CMSG_INTEN */ .intsts_reg =3D 0x10694, /* P2CMSG_INTSTS */ @@ -452,6 +456,7 @@ static const struct psp_vdata pspv3 =3D { static const struct psp_vdata pspv4 =3D { .sev =3D &sevv2, .tee =3D &teev1, + .bootloader_info_reg =3D 0x109ec, /* C2PMSG_59 */ .feature_reg =3D 0x109fc, /* C2PMSG_63 */ .inten_reg =3D 0x10690, /* P2CMSG_INTEN */ .intsts_reg =3D 0x10694, /* P2CMSG_INTSTS */ --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1D8AC77B73 for ; Thu, 20 Apr 2023 16:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234585AbjDTQcR (ORCPT ); Thu, 20 Apr 2023 12:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232760AbjDTQcI (ORCPT ); Thu, 20 Apr 2023 12:32:08 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2080.outbound.protection.outlook.com [40.107.94.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D418A3; Thu, 20 Apr 2023 09:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBKfCzlENg/md0N29FDW804u2yGMhWLAotd6pyQDcN6i9eHz9ztNNG9M1LMl94P6DvAXMD0AsjDVNnFxS82OZWqXsVHgif2k5PPko7RFxhWmE7CLXuPgjjF0Cowf6OHZphvCLrCUEb34VAYvD2L5YWnRwx4/bQyF6Gonj/RdPala6xYLvV+/Qxmb1I58gOhNpzeB2XxdTBKxGoyxb5/nXLTo1ngK5sOl7qE8rYMQaHrxhgzm2VpvqDw176PRJAkr+4bqAaaSyNTsFt0mmomK4Xfzx1QMH/jLJdWASjofqz8snI9lYFeX8lgWVM6acvrxXxz8BT8jmlF4q/vNDpopnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=uCK3UFN7kfeIWQFj87Ev9Xsr6tgtpWCv/5cTFSUBohk=; b=VBQGXmOZim+qpg7h1ceoIJjFLQ62sIX1a7r+970pWtCQE01s0OXL1VVkDDAQuULglAoJZb4nZIJ92LZsBfQ0T/ycCtHY7kUtzULm8oFsV9xBELjP8Yvle8rf41bFpwBYDXqBwOVXbI68hUmc9m0lQHngwnl8ele47ZKcFocgOvpGw/v21wXiw7VMayEjOywHeAhmN/vxA3w0fb/PJzvYaLhNdLRfobrlbqxjy5ExpoyShDCRJewYVrknOQ01wuCleQUUH3Sp06/AeAjYLDjPR1aZriYFhC9NZucnWGlXqXEyjTJDjLBR57icu2g8G9YooaTjX2sN3gxa3YCIdwHFrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uCK3UFN7kfeIWQFj87Ev9Xsr6tgtpWCv/5cTFSUBohk=; b=IMt9MAyo4rgaX7w73ZWHSNnw/geSKkWtjzBTdirvbTOav2wNkYcg10hBrN3puD8FgJjxcwt4WA3C5mHa7l8JoiyT6HSti2jxfoSV642uSQPYp8EWGwgzBQgsNFmwBsrT6SXZqc9J7GmnVUQ4fzDt0DBaS4zUwx4sSTtbusv9fW8= Received: from DM6PR07CA0104.namprd07.prod.outlook.com (2603:10b6:5:330::30) by PH0PR12MB8821.namprd12.prod.outlook.com (2603:10b6:510:28d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:04 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:5:330:cafe::d2) by DM6PR07CA0104.outlook.office365.com (2603:10b6:5:330::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:04 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:01 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 04/10] crypto: ccp: move setting PSP master to earlier in the init Date: Thu, 20 Apr 2023 11:31:32 -0500 Message-ID: <20230420163140.14940-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT027:EE_|PH0PR12MB8821:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a47368a-4877-46a4-4dbf-08db41bcc6a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jX6McMOvfkHF83uHpdyl0wE8ztJyJ6OrG/VcUSauMe0G0YrdFvmHY0kZM9kian7ok/koLGrWni24ndjUucURECGpmRiSoflPM6IHBEVUKt8y3yrhU7qGIKW4s4ZU26hwTgk7TQC3Hk75cB1kjFP09LkRX5uk6aXEJoiinM3sZDuUmX6vl6CLdNXRCeLloG6DhGDKH1kKbK10Qp3rBtiEn+l6cc/pH/R1d/1UgZi5CEv7tgvYlhhqfWo9X1ga1FLIVjl4VMD7XpgBnvwm3PorNYf/JUz6qit1FAqX3x1Wn140mZ2YnkV6HLod5H6yeiLvAtM6VRz4xqikUGGqz5N04ew9LnISratO18gUN0DggeBsmhWYKF58tE3T27JNiLAou3c+iMvRmRXzSqOnu3sMRDFirlX2CTtHZ4jEsK+vhhqkDA4AYqVys4TOI3nPkirj9fUuz7awSGFYR+TdVvX3aPq1GuSX18H1cbNwRenmgX4d1fHU0uT58/ma+2IzMCYAcjnSU/GvlSajmMD+IHBaAS28TTbL5PgyqFAm68xh6VLOOFjkfqfHN388GfKo9qdCOl4bMek714inSbsPwwRfCwwSkZ58GVoL3akqaShkIEaq7ZEWF2/PF4CD8YBP50F4Wu4spxDxb1GK6s9WLwUH3mC3YzpSUoP1fs4RnEgJjLF7bZXVdmrFi9U4Av7hIyXzWehEBKc6Z79WchxCeTLs3DzJZzOcYAowL7l5RsgxIjo= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199021)(46966006)(36840700001)(40470700004)(7696005)(356005)(6666004)(478600001)(54906003)(6636002)(426003)(336012)(82310400005)(26005)(186003)(1076003)(110136005)(4744005)(44832011)(5660300002)(2906002)(70586007)(70206006)(41300700001)(16526019)(4326008)(8936002)(8676002)(2616005)(40480700001)(36756003)(40460700003)(86362001)(36860700001)(47076005)(316002)(81166007)(83380400001)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:04.4917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a47368a-4877-46a4-4dbf-08db41bcc6a9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8821 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Dynamic boost control needs to use platform access symbols that look for the PSP master as part of initialization. So move the PSP master before psp_init() so that dynamic boost control can be initialized properly. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/psp-dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index e3d6955d3265..e9136e398174 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -173,13 +173,14 @@ int psp_dev_init(struct sp_device *sp) goto e_err; } =20 + /* master device must be set for platform access */ + if (psp->sp->set_psp_master_device) + psp->sp->set_psp_master_device(psp->sp); + ret =3D psp_init(psp); if (ret) goto e_irq; =20 - if (sp->set_psp_master_device) - sp->set_psp_master_device(sp); - /* Enable interrupt */ iowrite32(-1, psp->io_regs + psp->vdata->inten_reg); =20 --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0980C77B72 for ; Thu, 20 Apr 2023 16:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234723AbjDTQc2 (ORCPT ); Thu, 20 Apr 2023 12:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234286AbjDTQcM (ORCPT ); Thu, 20 Apr 2023 12:32:12 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2060.outbound.protection.outlook.com [40.107.100.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1BF8E77; Thu, 20 Apr 2023 09:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2tWb6jzrIhkOsW6jX9+/Kl21piAGOq5WvFitKJOmxf9QI6W7TV25AUs1TyguUY0REBlFyTWZlsmt+MRDmSeEUpl0nyl23vsRjKXKIUnWMg3s+Qi/V4imjEtRdAyCi+3c7PdNCvWFGGy+QtdzbNu0aTrs5Ar5sI0GR8FvSxlingo+05RaKjJJ7/PiOqyCTGC6D/JNfeFuT+r50nABvD+0TmMxwHnB9WsVQ8Yjr4NESX0epX/hiBRYZjs2vBDGwC7YJsG2tNyFPSY3ujgaV3NPnq13NjqJKACg8Ae5RK/f0QvUkZ7qiPrmS8ToU9x9ZSV8vu24ECF1ABhqvyF+nUafA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=txvBajt/5EvVuThow0jZ0mElcV+mRhSy/U+22CFaFCA=; b=nTH9Bj08pZZAwYnpo3+AJ1JdsMlOjs/jA2FtVmAlN4O9QIhi8rIf8KbZ3e28YjeK0w8cfzxe3oay2KHsT7nE+XQpshw3++Ws4aNVQueW4kCc/VwIRV8fzFGLK8uCK9lxON+QRvgw9WUrPGAWKzww0QTg9lMV1uc5KfVn31ql7CrVxXBzsAUDTKgqBgNetUsl/eJFdLXK+HHnMSgoUpEAeLLF7fzGnCizlDLgOnwMR5lTTz8ao+IIbWkmqtciXBlwCNXegOUWGF2ijPt8gjPX1Yrc26XUG9+qQFNoBs4+RBBB+TvBly41zp9oN33DA47N2RSBNGYYl+TVwRLxT49NhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=txvBajt/5EvVuThow0jZ0mElcV+mRhSy/U+22CFaFCA=; b=I+uEJV6BhumlJGxGBEIyEtWbN0LZOnHsHGsvvtZwU9TjXXre7PotYvPtKLPp3gi1lVhft6ItJtDd8WTMzl8VHYJuI4zaUptyhGSbeLl0KZRf+5636vw3zvz3DY7lr7kArPLeLLA2Ot88WNzHQ7/qdrgeA0MTBlse1YYb/VBb7GU= Received: from DM6PR07CA0110.namprd07.prod.outlook.com (2603:10b6:5:330::26) by DM8PR12MB5461.namprd12.prod.outlook.com (2603:10b6:8:3a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:05 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:5:330:cafe::7b) by DM6PR07CA0110.outlook.office365.com (2603:10b6:5:330::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.25 via Frontend Transport; Thu, 20 Apr 2023 16:32:05 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:04 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 05/10] crypto: ccp: Add support for fetching a nonce for dynamic boost control Date: Thu, 20 Apr 2023 11:31:33 -0500 Message-ID: <20230420163140.14940-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT027:EE_|DM8PR12MB5461:EE_ X-MS-Office365-Filtering-Correlation-Id: 1061e206-a3e7-4471-f849-08db41bcc716 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mj98IwE3Ma84hY/Y9ZrftsdfU0+uvprFnRVOf3Vl6mrbWZWhCWsW1g+cJkIf+gPrB13Pa3Pi4PmVqzrudqho8Czwwruiwj655jLn7I9INoCUi3+EAj3fWrIv5u6mbdFccoV3ZlFcesdiJYdSlwyiHWwxFs7L+ucoDF3VYx5P6g4XbBp5xBDNB4Lm8Z6Dvxr0xvZlvj6tnemmxUmIIDlEMj/CQ1QqPM2du//S5pI3bK6NKfbFccuIPjCL9Be1efDObNGBKhGsBLUkFvPrRk+waRqJnNDG5/FGfNcovT/DtQuULYaEA64/X1HrWbZB10KKsjBWQANFGq8EuC8SlAUdqTHhjST3J1Mu/CK6BJLW8nH93LBKEz7ho46Q1n408u1Mxx3oxXo/8QYWEePvKw5+ytuOgY3J5GfzwAP3EW0Uo+Hu3mRbidtqvSpu6T9cAlQX2nnE0vjjHw+KU6ngwl+XPvkrCvs/EhV5vT5LGNN9SHz4oC1o74g9WTRFLnmNXobdx2oDEO1KH49ExSVk0K9xDREw/7whSjcrEis22xJr0DHPTzKkRfjSkyqPdBtbb6B34oVkOAcCStj9draYTOejesplhuNm9yZmQiijvrJPMKMwBOnKEijdHmkBytpJYn6Xa2LRc+DTTl0GkxeQ+YHZ5bJ5yH/3j1W7MRis3f5I4fQeTFkvUDTZaT+vwNwasDwNghUL8DqeS/YNKXFYvlxl4TnyyqtAYkrCxJw2GE67K+Q= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199021)(40470700004)(46966006)(36840700001)(6636002)(54906003)(47076005)(83380400001)(478600001)(36860700001)(2616005)(7696005)(40480700001)(1076003)(26005)(6666004)(316002)(4326008)(356005)(110136005)(186003)(336012)(426003)(70206006)(82740400003)(70586007)(16526019)(44832011)(5660300002)(8936002)(2906002)(30864003)(8676002)(66899021)(40460700003)(81166007)(41300700001)(86362001)(82310400005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:05.2104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1061e206-a3e7-4471-f849-08db41bcc716 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5461 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Dynamic Boost Control is a feature offered on AMD client platforms that allows software to request and set power or frequency limits. Only software that has authenticated with the PSP can retrieve or set these limits. Create a character device and ioctl for fetching the nonce. This ioctl supports optionally passing authentication information which will influence how many calls the nonce is valid for. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/Makefile | 3 +- drivers/crypto/ccp/dbc.c | 191 ++++++++++++++++++++++++++++ drivers/crypto/ccp/dbc.h | 44 +++++++ drivers/crypto/ccp/psp-dev.c | 9 ++ drivers/crypto/ccp/psp-dev.h | 1 + drivers/crypto/ccp/sp-dev.h | 5 + drivers/crypto/ccp/sp-pci.c | 1 + include/linux/psp-platform-access.h | 1 + include/uapi/linux/psp-dbc.h | 67 ++++++++++ 9 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/ccp/dbc.c create mode 100644 drivers/crypto/ccp/dbc.h create mode 100644 include/uapi/linux/psp-dbc.h diff --git a/drivers/crypto/ccp/Makefile b/drivers/crypto/ccp/Makefile index f6196495e862..aa0ba2d17e1e 100644 --- a/drivers/crypto/ccp/Makefile +++ b/drivers/crypto/ccp/Makefile @@ -11,7 +11,8 @@ ccp-$(CONFIG_PCI) +=3D sp-pci.o ccp-$(CONFIG_CRYPTO_DEV_SP_PSP) +=3D psp-dev.o \ sev-dev.o \ tee-dev.o \ - platform-access.o + platform-access.o \ + dbc.o =20 obj-$(CONFIG_CRYPTO_DEV_CCP_CRYPTO) +=3D ccp-crypto.o ccp-crypto-objs :=3D ccp-crypto-main.o \ diff --git a/drivers/crypto/ccp/dbc.c b/drivers/crypto/ccp/dbc.c new file mode 100644 index 000000000000..7afeca903136 --- /dev/null +++ b/drivers/crypto/ccp/dbc.c @@ -0,0 +1,191 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * AMD Secure Processor Dynamic Boost Control interface + * + * Copyright (C) 2023 Advanced Micro Devices, Inc. + * + * Author: Mario Limonciello + */ + +#include "dbc.h" + +struct error_map { + u32 psp; + int ret; +}; + +#define DBC_ERROR_ACCESS_DENIED 0x0001 +#define DBC_ERROR_EXCESS_DATA 0x0004 +#define DBC_ERROR_BAD_PARAMETERS 0x0006 +#define DBC_ERROR_BAD_STATE 0x0007 +#define DBC_ERROR_NOT_IMPLEMENTED 0x0009 +#define DBC_ERROR_BUSY 0x000D +#define DBC_ERROR_MESSAGE_FAILURE 0x0307 +#define DBC_ERROR_OVERFLOW 0x300F +#define DBC_ERROR_SIGNATURE_INVALID 0x3072 + +static struct error_map error_codes[] =3D { + {DBC_ERROR_ACCESS_DENIED, -EACCES}, + {DBC_ERROR_EXCESS_DATA, -E2BIG}, + {DBC_ERROR_BAD_PARAMETERS, -EINVAL}, + {DBC_ERROR_BAD_STATE, -EAGAIN}, + {DBC_ERROR_MESSAGE_FAILURE, -ENOENT}, + {DBC_ERROR_NOT_IMPLEMENTED, -ENOENT}, + {DBC_ERROR_BUSY, -EBUSY}, + {DBC_ERROR_OVERFLOW, -ENFILE}, + {DBC_ERROR_SIGNATURE_INVALID, -EPERM}, + {0x0, 0x0}, +}; + +static int send_dbc_cmd(struct psp_dbc_device *dbc_dev, + enum psp_platform_access_msg msg) +{ + int ret; + + dbc_dev->mbox->req.header.status =3D 0; + ret =3D psp_send_platform_access_msg(msg, (struct psp_request *)dbc_dev->= mbox); + if (ret =3D=3D -EIO) { + int i; + + dev_dbg(dbc_dev->dev, + "msg 0x%x failed with PSP error: 0x%x\n", + msg, dbc_dev->mbox->req.header.status); + + for (i =3D 0; error_codes[i].psp; i++) { + if (dbc_dev->mbox->req.header.status =3D=3D error_codes[i].psp) + return error_codes[i].ret; + } + } + + return ret; +} + +static int send_dbc_nonce(struct psp_dbc_device *dbc_dev) +{ + int ret; + + dbc_dev->mbox->req.header.payload_size =3D sizeof(dbc_dev->mbox->dbc_nonc= e); + ret =3D send_dbc_cmd(dbc_dev, PSP_DYNAMIC_BOOST_GET_NONCE); + if (ret =3D=3D -EAGAIN) { + dev_dbg(dbc_dev->dev, "retrying get nonce\n"); + ret =3D send_dbc_cmd(dbc_dev, PSP_DYNAMIC_BOOST_GET_NONCE); + } + + return ret; +} + +void dbc_dev_destroy(struct psp_device *psp) +{ + struct psp_dbc_device *dbc_dev =3D psp->dbc_data; + + if (!dbc_dev) + return; + + misc_deregister(&dbc_dev->char_dev); + mutex_destroy(&dbc_dev->ioctl_mutex); + psp->dbc_data =3D NULL; +} + +static long dbc_ioctl(struct file *filp, unsigned int cmd, unsigned long a= rg) +{ + struct psp_device *psp_master =3D psp_get_master_device(); + void __user *argp =3D (void __user *)arg; + struct psp_dbc_device *dbc_dev; + int ret; + + if (!psp_master || !psp_master->dbc_data) + return -ENODEV; + dbc_dev =3D psp_master->dbc_data; + + mutex_lock(&dbc_dev->ioctl_mutex); + + switch (cmd) { + case DBCIOCNONCE: + if (copy_from_user(&dbc_dev->mbox->dbc_nonce.user, argp, + sizeof(struct dbc_user_nonce))) { + ret =3D -EFAULT; + goto unlock; + } + + ret =3D send_dbc_nonce(dbc_dev); + if (ret) + goto unlock; + + if (copy_to_user(argp, &dbc_dev->mbox->dbc_nonce.user, + sizeof(struct dbc_user_nonce))) { + ret =3D -EFAULT; + goto unlock; + } + break; + default: + ret =3D -EINVAL; + + } +unlock: + mutex_unlock(&dbc_dev->ioctl_mutex); + + return ret; +} + +const struct file_operations dbc_fops =3D { + .owner =3D THIS_MODULE, + .unlocked_ioctl =3D dbc_ioctl, +}; + +int dbc_dev_init(struct psp_device *psp) +{ + struct device *dev =3D psp->dev; + struct psp_dbc_device *dbc_dev; + int ret; + + if (!PSP_FEATURE(psp, DBC)) + return 0; + + dbc_dev =3D devm_kzalloc(dev, sizeof(*dbc_dev), GFP_KERNEL); + if (!dbc_dev) + return -ENOMEM; + + BUILD_BUG_ON(sizeof(union dbc_buffer) > PAGE_SIZE); + dbc_dev->mbox =3D (void *)devm_get_free_pages(dev, GFP_KERNEL, 0); + if (!dbc_dev->mbox) { + ret =3D -ENOMEM; + goto cleanup_dev; + } + + psp->dbc_data =3D dbc_dev; + dbc_dev->dev =3D dev; + + ret =3D send_dbc_nonce(dbc_dev); + if (ret =3D=3D -EACCES) { + dev_dbg(dbc_dev->dev, + "dynamic boost control was previously authenticated\n"); + ret =3D 0; + } + dev_dbg(dbc_dev->dev, "dynamic boost control is %savailable\n", + ret ? "un" : ""); + if (ret) { + ret =3D 0; + goto cleanup_mbox; + } + + dbc_dev->char_dev.minor =3D MISC_DYNAMIC_MINOR; + dbc_dev->char_dev.name =3D "dbc"; + dbc_dev->char_dev.fops =3D &dbc_fops; + dbc_dev->char_dev.mode =3D 0600; + ret =3D misc_register(&dbc_dev->char_dev); + if (ret) + goto cleanup_mbox; + + mutex_init(&dbc_dev->ioctl_mutex); + + return 0; + +cleanup_mbox: + devm_free_pages(dev, (unsigned long)dbc_dev->mbox); + +cleanup_dev: + psp->dbc_data =3D NULL; + devm_kfree(dev, dbc_dev); + + return ret; +} diff --git a/drivers/crypto/ccp/dbc.h b/drivers/crypto/ccp/dbc.h new file mode 100644 index 000000000000..1c3a0a078d15 --- /dev/null +++ b/drivers/crypto/ccp/dbc.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * AMD Platform Security Processor (PSP) Dynamic Boost Control support + * + * Copyright (C) 2023 Advanced Micro Devices, Inc. + * + * Author: Mario Limonciello + */ + +#ifndef __DBC_H__ +#define __DBC_H__ + +#include + +#include +#include +#include + +#include "psp-dev.h" + +struct psp_dbc_device { + struct device *dev; + + union dbc_buffer *mbox; + + struct mutex ioctl_mutex; + + struct miscdevice char_dev; +}; + +struct dbc_nonce { + struct psp_req_buffer_hdr header; + struct dbc_user_nonce user; +} __packed; + +union dbc_buffer { + struct psp_request req; + struct dbc_nonce dbc_nonce; +}; + +void dbc_dev_destroy(struct psp_device *psp); +int dbc_dev_init(struct psp_device *psp); + +#endif /* __DBC_H */ diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index e9136e398174..15cc7bfe663d 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -15,6 +15,7 @@ #include "sev-dev.h" #include "tee-dev.h" #include "platform-access.h" +#include "dbc.h" =20 struct psp_device *psp_master; =20 @@ -112,6 +113,12 @@ static void psp_init_platform_access(struct psp_device= *psp) dev_warn(psp->dev, "platform access init failed: %d\n", ret); return; } + + /* dbc must come after platform access as it tests the feature */ + ret =3D dbc_dev_init(psp); + if (ret) + dev_warn(psp->dev, "failed to init dynamic boost control: %d\n", + ret); } =20 static int psp_init(struct psp_device *psp) @@ -214,6 +221,8 @@ void psp_dev_destroy(struct sp_device *sp) =20 tee_dev_destroy(psp); =20 + dbc_dev_destroy(psp); + platform_access_dev_destroy(psp); =20 sp_free_psp_irq(sp, psp); diff --git a/drivers/crypto/ccp/psp-dev.h b/drivers/crypto/ccp/psp-dev.h index 505e4bdeaca8..8a4de69399c5 100644 --- a/drivers/crypto/ccp/psp-dev.h +++ b/drivers/crypto/ccp/psp-dev.h @@ -40,6 +40,7 @@ struct psp_device { void *sev_data; void *tee_data; void *platform_access_data; + void *dbc_data; =20 unsigned int capability; }; diff --git a/drivers/crypto/ccp/sp-dev.h b/drivers/crypto/ccp/sp-dev.h index 76c32ee6bd65..2329ad524b49 100644 --- a/drivers/crypto/ccp/sp-dev.h +++ b/drivers/crypto/ccp/sp-dev.h @@ -28,6 +28,10 @@ #define CACHE_NONE 0x00 #define CACHE_WB_NO_ALLOC 0xb7 =20 +#define PLATFORM_FEATURE_DBC 0x1 + +#define PSP_FEATURE(psp, feat) (psp->vdata && psp->vdata->platform_feature= s & PLATFORM_FEATURE_##feat) + /* Structure to hold CCP device data */ struct ccp_device; struct ccp_vdata { @@ -71,6 +75,7 @@ struct psp_vdata { const unsigned int inten_reg; const unsigned int intsts_reg; const unsigned int bootloader_info_reg; + const unsigned int platform_features; }; =20 /* Structure to hold SP device data */ diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index 460f3ee12fb6..595c8e395f29 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -451,6 +451,7 @@ static const struct psp_vdata pspv3 =3D { .feature_reg =3D 0x109fc, /* C2PMSG_63 */ .inten_reg =3D 0x10690, /* P2CMSG_INTEN */ .intsts_reg =3D 0x10694, /* P2CMSG_INTSTS */ + .platform_features =3D PLATFORM_FEATURE_DBC, }; =20 static const struct psp_vdata pspv4 =3D { diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platfo= rm-access.h index 75da8f5f7ad8..53b4a1df5180 100644 --- a/include/linux/psp-platform-access.h +++ b/include/linux/psp-platform-access.h @@ -8,6 +8,7 @@ enum psp_platform_access_msg { PSP_CMD_NONE =3D 0x0, PSP_I2C_REQ_BUS_CMD =3D 0x64, + PSP_DYNAMIC_BOOST_GET_NONCE, }; =20 struct psp_req_buffer_hdr { diff --git a/include/uapi/linux/psp-dbc.h b/include/uapi/linux/psp-dbc.h new file mode 100644 index 000000000000..d032f78934e2 --- /dev/null +++ b/include/uapi/linux/psp-dbc.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Userspace interface for AMD Dynamic Boost Control (DBC) + * + * Copyright (C) 2023 Advanced Micro Devices, Inc. + * + * Author: Mario Limonciello + */ + +#ifndef __PSP_DBC_USER_H__ +#define __PSP_DBC_USER_H__ + +#include + +/** + * DOC: AMD Dynamic Boost Control (DBC) interface + */ + +#define DBC_NONCE_SIZE 16 +#define DBC_SIG_SIZE 32 + +/** + * struct dbc_user_nonce - Nonce exchange structure (input/output). + * @auth_needed: Whether the PSP should authenticate this request (input). + * 0: no authentication, PSP will return single use nonce. + * 1: authentication: PSP will return multi-use nonce. + * @nonce: 8 byte value used for future authentication (output). + * @signature: Optional 32 byte signature created by software using a + * previous nonce (input). + */ +struct dbc_user_nonce { + __u32 auth_needed; + __u8 nonce[DBC_NONCE_SIZE]; + __u8 signature[DBC_SIG_SIZE]; +} __packed; + +/** + * Dynamic Boost Control (DBC) IOC + * + * possible return codes for all DBC IOCTLs: + * 0: success + * -EINVAL: invalid input + * -E2BIG: excess data passed + * -EFAULT: failed to copy to/from userspace + * -EBUSY: mailbox in recovery or in use + * -ENODEV: driver not bound with PSP device + * -EACCES: request isn't authorized + * -EINVAL: invalid parameter + * -ETIMEDOUT: request timed out + * -EAGAIN: invalid request for state machine + * -ENOENT: not implemented + * -ENFILE: overflow + * -EPERM: invalid signature + * -EIO: unknown error + */ +#define DBC_IOC_TYPE 'D' + +/** + * DBCIOCNONCE - Fetch a nonce from the PSP for authenticating commands. + * If a nonce is fetched without authentication it can only + * be utilized for one command. + * If a nonce is fetched with authentication it can be used + * for multiple requests. + */ +#define DBCIOCNONCE _IOWR(DBC_IOC_TYPE, 0x1, struct dbc_user_nonce) + +#endif /* __PSP_DBC_USER_H__ */ --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94F50C77B73 for ; Thu, 20 Apr 2023 16:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234759AbjDTQcb (ORCPT ); Thu, 20 Apr 2023 12:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234580AbjDTQcR (ORCPT ); Thu, 20 Apr 2023 12:32:17 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2089.outbound.protection.outlook.com [40.107.96.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD491711; Thu, 20 Apr 2023 09:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kih4XmTveQjRZXe3GTqoZ7vJOtrfXKkEFIU1L9fVNfNGRNfwaBVPSztkAKXgKy82sJfH9+IYl3gQjOQfy10jEx+h59ob0b/MoeAputLtggnygsr2dAY6eCTt4ci8Hdr87kfmYkwPYBmDp6vYbTn/Bzi9IWYHaYBfjhX+cOvjPwdSG+aD3PrudBOjDqQQVCRSFA5MaTxySCn2iK12Wryw5U6T+R9vOSH2cHAMQrUg/ZjPr377ISgbXPs0EYzkhyCwZD1aZGYxdlBGMTVkdAxFFm7e9Z3B+aOTKM/Ywod/RlYpaFSoERfcGhDWeT5dxfEloRrp3G55CeWA6ArAe4eJxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/AxmwsspBY+a02inqk/oy2ghT7n4ZQQaI56gq4KLeQM=; b=DGuMH1Ryvto9z9k9IGX91Mpsum433NVt2UDPPALJoCSZUabNodCAfV0HderaA7GlCGlTORhNoyGcbYIGL+NlFWud27L4X4A5oFSoWKsHPD2MmPf2LIJ5sOBvlhH+CCtaXhwjoy6EjbTIRRhYL4OtcOotqCnJ5f5jZeHCwg4E6/rKlpRSPPvyg0GPYnjGhVppC3mZX95wHWzw/7rx9k7+9Fs1JTHS3r6D0lRD6hJ+w5hOgRDf0x2on5WoQwWtaut8Bbz82NhnHsIooHSgIZQz02W+M2LnNyQvaAySM9iSkt47c3MZcLIqfhRffxl3GGEjBM93pphgCdpHUmcjIjMQsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/AxmwsspBY+a02inqk/oy2ghT7n4ZQQaI56gq4KLeQM=; b=h7V9aiF7EF7war79wg0aX8nHQjxj6Hz8WOTEfu/Mc02icp4liSaBDmtTIXSbCJd0WiWHefpy/Pl757qESaFPAm9T3xrN2w+QvhydpL01t9xiHvNg1B9st+oc7XOza5g+nHe+tl3IZIDfm7iFNhN+pkBgkXG64m9MlZkEqkPDBNQ= Received: from DS7PR05CA0074.namprd05.prod.outlook.com (2603:10b6:8:57::22) by MN2PR12MB4189.namprd12.prod.outlook.com (2603:10b6:208:1d8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:08 +0000 Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:8:57:cafe::28) by DS7PR05CA0074.outlook.office365.com (2603:10b6:8:57::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.11 via Frontend Transport; Thu, 20 Apr 2023 16:32:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT016.mail.protection.outlook.com (10.13.173.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.26 via Frontend Transport; Thu, 20 Apr 2023 16:32:06 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:05 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 06/10] crypto: ccp: Add support for setting user ID for dynamic boost control Date: Thu, 20 Apr 2023 11:31:34 -0500 Message-ID: <20230420163140.14940-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT016:EE_|MN2PR12MB4189:EE_ X-MS-Office365-Filtering-Correlation-Id: 1985492f-a8e6-4a81-ef99-08db41bcc7f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OBfuZLkIge9ouGWLWuL1ACXaXFG95EPa5fLdZTZsTaMt2QnyaJVVdE3vPjvPydeZNgCfhFVnefX4fammxrm2oGBKZbAArbht7W18kgCxxetfD4jpMdYOVFhiPHk08pdo5jzOtNJq16ga0FMC5h0JZw6y08KoTODRlPm0QPJK+2l9cHpNKYKw030ennoTZHITHo8apzXYULJe0OTFiHgxf5IAHPKF6FT7nIHlz3GAtC9lNoSQIQwrOrJYLicaA6Ps14IM6zCEvTMHH297TD550IvlsJie+xiHkUIGNEIIEjlBhoWBW3T38bE7aifbvyNJxqjONf7TNoEpgWaNQKdoXFO7zV3XkBratakYfAI4/hwNdBdNbVoUVZFmER3kpuMmCvizwbNnbg/Nayf/lmoNgYo5qKbavBflaUvfsIt6ek4zKfxAw07eihLsXQEidYn9+YI98bHFwRCNVAMQkrszvBvhXRtrm23DqVhPGbPOmPNflTV+4BH+UkwH2zY4+UgR+w8Tr0jFNp746EIhmPLn3U9yY/ZG+x0BMzQIbLeVXbILUh6L87AZ/5SpICW6skDP3dqbekGN2D9V/TektZ+tYbuEBHaJv1D3UPz9eNDJdjxmGM1b6v2uDL8qkVCLr+dBpmBPqpGCyLvGGBhvd5y8zHhvXHWEwmJrZqZ7CiYP/4XXjTa2z4F8H8VkrAvK57G4BqaUvWauMGjLSwm08rYhVj3ysozG8M7IZIh0piDaduk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(2906002)(41300700001)(5660300002)(8676002)(70586007)(70206006)(4326008)(316002)(110136005)(8936002)(44832011)(54906003)(6636002)(478600001)(7696005)(40460700003)(356005)(6666004)(40480700001)(26005)(1076003)(426003)(47076005)(83380400001)(2616005)(336012)(36860700001)(82740400003)(82310400005)(36756003)(16526019)(186003)(86362001)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:06.6847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1985492f-a8e6-4a81-ef99-08db41bcc7f7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4189 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the authentication flow for Dynamic Boost Control, the calling software will need to send a uid used in all of it's future communications. Add support for another IOCTL call to let userspace software set this up. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/dbc.c | 18 ++++++++++++++++++ drivers/crypto/ccp/dbc.h | 6 ++++++ include/linux/psp-platform-access.h | 1 + include/uapi/linux/psp-dbc.h | 20 ++++++++++++++++++++ 4 files changed, 45 insertions(+) diff --git a/drivers/crypto/ccp/dbc.c b/drivers/crypto/ccp/dbc.c index 7afeca903136..ca7ec528536b 100644 --- a/drivers/crypto/ccp/dbc.c +++ b/drivers/crypto/ccp/dbc.c @@ -117,6 +117,24 @@ static long dbc_ioctl(struct file *filp, unsigned int = cmd, unsigned long arg) goto unlock; } break; + case DBCIOCUID: + dbc_dev->mbox->req.header.payload_size =3D sizeof(dbc_dev->mbox->dbc_set= _uid); + if (copy_from_user(&dbc_dev->mbox->dbc_set_uid.user, argp, + sizeof(struct dbc_user_setuid))) { + ret =3D -EFAULT; + goto unlock; + } + + ret =3D send_dbc_cmd(dbc_dev, PSP_DYNAMIC_BOOST_SET_UID); + if (ret) + goto unlock; + + if (copy_to_user(argp, &dbc_dev->mbox->dbc_set_uid.user, + sizeof(struct dbc_user_setuid))) { + ret =3D -EFAULT; + goto unlock; + } + break; default: ret =3D -EINVAL; =20 diff --git a/drivers/crypto/ccp/dbc.h b/drivers/crypto/ccp/dbc.h index 1c3a0a078d15..156435100076 100644 --- a/drivers/crypto/ccp/dbc.h +++ b/drivers/crypto/ccp/dbc.h @@ -33,9 +33,15 @@ struct dbc_nonce { struct dbc_user_nonce user; } __packed; =20 +struct dbc_set_uid { + struct psp_req_buffer_hdr header; + struct dbc_user_setuid user; +} __packed; + union dbc_buffer { struct psp_request req; struct dbc_nonce dbc_nonce; + struct dbc_set_uid dbc_set_uid; }; =20 void dbc_dev_destroy(struct psp_device *psp); diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platfo= rm-access.h index 53b4a1df5180..18b9e0f0cb03 100644 --- a/include/linux/psp-platform-access.h +++ b/include/linux/psp-platform-access.h @@ -9,6 +9,7 @@ enum psp_platform_access_msg { PSP_CMD_NONE =3D 0x0, PSP_I2C_REQ_BUS_CMD =3D 0x64, PSP_DYNAMIC_BOOST_GET_NONCE, + PSP_DYNAMIC_BOOST_SET_UID, }; =20 struct psp_req_buffer_hdr { diff --git a/include/uapi/linux/psp-dbc.h b/include/uapi/linux/psp-dbc.h index d032f78934e2..7443c78ede19 100644 --- a/include/uapi/linux/psp-dbc.h +++ b/include/uapi/linux/psp-dbc.h @@ -18,6 +18,7 @@ =20 #define DBC_NONCE_SIZE 16 #define DBC_SIG_SIZE 32 +#define DBC_UID_SIZE 16 =20 /** * struct dbc_user_nonce - Nonce exchange structure (input/output). @@ -34,6 +35,16 @@ struct dbc_user_nonce { __u8 signature[DBC_SIG_SIZE]; } __packed; =20 +/** + * struct dbc_user_setuid - UID exchange structure (input). + * @uid: 16 byte value representing software identity + * @signature: 32 byte signature created by software using a previous nonce + */ +struct dbc_user_setuid { + __u8 uid[DBC_UID_SIZE]; + __u8 signature[DBC_SIG_SIZE]; +} __packed; + /** * Dynamic Boost Control (DBC) IOC * @@ -64,4 +75,13 @@ struct dbc_user_nonce { */ #define DBCIOCNONCE _IOWR(DBC_IOC_TYPE, 0x1, struct dbc_user_nonce) =20 +/** + * DBCIOCUID - Set the user ID (UID) of a calling process. + * The user ID is 8 bytes long. It must be programmed using a + * 32 byte signature built using the nonce fetched from + * DBCIOCNONCE. + * The UID can only be set once until the system is rebooted. + */ +#define DBCIOCUID _IOW(DBC_IOC_TYPE, 0x2, struct dbc_user_setuid) + #endif /* __PSP_DBC_USER_H__ */ --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3180AC77B76 for ; Thu, 20 Apr 2023 16:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234770AbjDTQce (ORCPT ); Thu, 20 Apr 2023 12:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234606AbjDTQcU (ORCPT ); Thu, 20 Apr 2023 12:32:20 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F4059210B; Thu, 20 Apr 2023 09:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oe8Be30s8/LjXuBcWqG7fN+14fSheNoJdt2L9+bBD7zJSRwfvQ7sQGxAMrzOuFB4iMqjd2APHMtGzmLTNOUgIqmHziZDcOkEB6rmwc2VoYckeRIdLd5aLL8TaWhFPOYQXcb2tXKxXUdveYrCQtHxQkh7hBUoqsXVEbwSMjKv9xTXn5MaVeoxnzaZ7LBggw58ZXXGFWJKk2qUHAVF7B5UqRUCRQRZz3pM5ydaC4fcJ2JeFxRVS7nzOm7dNaz0q9fCyeJfWp4dL4PbfxJP4pfxNHlKBrX9w3j/U0PVC0OtKL1tlulBs8zaQ+7zKTpQN+DBDDdzQYefd3v1A0YKJ9IvEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=aS8JSioac+K5cQTdnoc+oQ3hySJkWDuNq/W398kLq/w=; b=W43JVBBzk7dQk74QSo9XHamyTWbFvcQRWfjav+ubm7vv/KW/OwNV5Iga4oFbs90U2LrB+rGuOHQut1N2YCwvQ0dL1p5yMuX9pqNjGICN39TTnNbBGoZEs5zxKn1XfE59LTI1bUpXtnQ6qWRVXz8Gc+cId9FLhU8fKTGqR3fOUFX8TEex6X4SpOYaY64dVXLkfu9MksG2niatiuyw0uxt4X6eW/JG7FvPIIISdC4K4kpsr9Ql0Mw1qZFk3PZ1VTd1abbhrfCcKrwfZbME/CUBh6DyHJSVEfZqve78L1VT7hdLYIEpSqxjlelgXiAgQv+njEHbVcyl+hiYFw7phaSFxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aS8JSioac+K5cQTdnoc+oQ3hySJkWDuNq/W398kLq/w=; b=44kW31epMaf1vAggFsU7k+MmE5yK3fvhSe1lqVsFVeZZ6o+EbKiL03YN+bBZVgojMMngAnkbvToKBzgT6QB2Y1cicBjbO+Od4A41q2Y6koOQVMYVZ+Y4oLSlOPoUdWaO8vydigCOfzL3hBAZNzfBVoJsez8HItn/HKTcTOninGI= Received: from DS7P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::19) by IA0PR12MB8747.namprd12.prod.outlook.com (2603:10b6:208:48b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:09 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::55) by DS7P222CA0003.outlook.office365.com (2603:10b6:8:2e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.24 via Frontend Transport; Thu, 20 Apr 2023 16:32:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.23 via Frontend Transport; Thu, 20 Apr 2023 16:32:08 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:07 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: "David S . Miller" , Mario Limonciello , , Subject: [PATCH 07/10] crypto: ccp: Add support for getting and setting DBC parameters Date: Thu, 20 Apr 2023 11:31:35 -0500 Message-ID: <20230420163140.14940-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT044:EE_|IA0PR12MB8747:EE_ X-MS-Office365-Filtering-Correlation-Id: d08542e4-88e1-4a20-d4aa-08db41bcc8e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dNEai4bTp0iPBLp1xtXnHx6Z3t1XmCoxWpp5eBmoY5cZh3DfiT7iQ6RICsDpvw+Oq57WJdGqOzgLYjHJsfflWBTlyZZkIz6XkJXOg2cdYL8ur2BeVECQgHDhvaDKY652Hwcv8BN/6eSrzHW9R82aKdJcI/BWN579oFs7eDX8CZs45IBfXC/jCOHelotb6+MtzSAOd0cZoBpLN59uEsYHiYgwyWgruolTfySo8wZEODJqTNgu4wy120q7KOskJS3YmBs0Jz1/CosrLnWDufDE+uzIaPIVOaxcrLVT6w4Mjiuk5oGz33ZRemF4SI5+gfGG245JsHcFgFNatW4+q/3mN6QcnCPE40uPwia0OT/2IzXeHOBu3sqd57zCOlMBCjb84p5m+xFjby88E8jx2TRfo4YjbpkWt6R2w6gHoCxMssQtp4kd/12mn7iNbbBUX6AtgsUR1jAkB2Rp+IQEWH0m6eHIQ9fnAq7CfKBXgo2I1Z/vyZudEwukxVTblTSllNSIdNKHAokqoB+aGYAcIgs6uPUYo1yWIfLe2wmgnMbO+pC5doqZ+46DH/VWoaHbF3pD4yG7M2V5NCYfa6aB+deKqcChqJWuUGXaXGNNZvPXCIIwmR/VXfa49FWR4LEvim6quZFkgmkdCoDPsMqRnncGM8hTt1L9ArGeeBxsK3iGpj92GMqr3PHBlTUx79VQ/GMUniYxTZhqKx1J8Rkt66KNBE+1dT9NMy4xmDVx3EBKCks= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199021)(36840700001)(40470700004)(46966006)(40460700003)(36756003)(44832011)(2906002)(41300700001)(8936002)(8676002)(5660300002)(316002)(40480700001)(86362001)(70206006)(70586007)(82310400005)(356005)(81166007)(82740400003)(4326008)(83380400001)(47076005)(36860700001)(336012)(426003)(2616005)(1076003)(186003)(6636002)(110136005)(26005)(54906003)(7696005)(478600001)(16526019)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:08.2438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d08542e4-88e1-4a20-d4aa-08db41bcc8e5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8747 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" After software has authenticated a dynamic boost control request, it can fetch and set supported parameters using a selection of messages. Add support for these messages and export the ability to do this to userspace. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/dbc.c | 41 ++++++++++++++++++++ drivers/crypto/ccp/dbc.h | 6 +++ include/linux/psp-platform-access.h | 2 + include/uapi/linux/psp-dbc.h | 60 +++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) diff --git a/drivers/crypto/ccp/dbc.c b/drivers/crypto/ccp/dbc.c index ca7ec528536b..89976d6b9109 100644 --- a/drivers/crypto/ccp/dbc.c +++ b/drivers/crypto/ccp/dbc.c @@ -74,6 +74,30 @@ static int send_dbc_nonce(struct psp_dbc_device *dbc_dev) return ret; } =20 +static int send_dbc_parameter(struct psp_dbc_device *dbc_dev) +{ + dbc_dev->mbox->req.header.payload_size =3D sizeof(dbc_dev->mbox->dbc_para= m); + + switch (dbc_dev->mbox->dbc_param.user.msg_index) { + case PARAM_SET_FMAX_CAP: + case PARAM_SET_PWR_CAP: + case PARAM_SET_GFX_MODE: + return send_dbc_cmd(dbc_dev, PSP_DYNAMIC_BOOST_SET_PARAMETER); + case PARAM_GET_FMAX_CAP: + case PARAM_GET_PWR_CAP: + case PARAM_GET_CURR_TEMP: + case PARAM_GET_FMAX_MAX: + case PARAM_GET_FMAX_MIN: + case PARAM_GET_SOC_PWR_MAX: + case PARAM_GET_SOC_PWR_MIN: + case PARAM_GET_SOC_PWR_CUR: + case PARAM_GET_GFX_MODE: + return send_dbc_cmd(dbc_dev, PSP_DYNAMIC_BOOST_GET_PARAMETER); + } + + return -EINVAL; +} + void dbc_dev_destroy(struct psp_device *psp) { struct psp_dbc_device *dbc_dev =3D psp->dbc_data; @@ -135,6 +159,23 @@ static long dbc_ioctl(struct file *filp, unsigned int = cmd, unsigned long arg) goto unlock; } break; + case DBCIOCPARAM: + if (copy_from_user(&dbc_dev->mbox->dbc_param.user, argp, + sizeof(struct dbc_user_param))) { + ret =3D -EFAULT; + goto unlock; + } + + ret =3D send_dbc_parameter(dbc_dev); + if (ret) + goto unlock; + + if (copy_to_user(argp, &dbc_dev->mbox->dbc_param.user, + sizeof(struct dbc_user_param))) { + ret =3D -EFAULT; + goto unlock; + } + break; default: ret =3D -EINVAL; =20 diff --git a/drivers/crypto/ccp/dbc.h b/drivers/crypto/ccp/dbc.h index 156435100076..e963099ca38e 100644 --- a/drivers/crypto/ccp/dbc.h +++ b/drivers/crypto/ccp/dbc.h @@ -38,10 +38,16 @@ struct dbc_set_uid { struct dbc_user_setuid user; } __packed; =20 +struct dbc_param { + struct psp_req_buffer_hdr header; + struct dbc_user_param user; +} __packed; + union dbc_buffer { struct psp_request req; struct dbc_nonce dbc_nonce; struct dbc_set_uid dbc_set_uid; + struct dbc_param dbc_param; }; =20 void dbc_dev_destroy(struct psp_device *psp); diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platfo= rm-access.h index 18b9e0f0cb03..c1dc87fc536b 100644 --- a/include/linux/psp-platform-access.h +++ b/include/linux/psp-platform-access.h @@ -10,6 +10,8 @@ enum psp_platform_access_msg { PSP_I2C_REQ_BUS_CMD =3D 0x64, PSP_DYNAMIC_BOOST_GET_NONCE, PSP_DYNAMIC_BOOST_SET_UID, + PSP_DYNAMIC_BOOST_GET_PARAMETER, + PSP_DYNAMIC_BOOST_SET_PARAMETER, }; =20 struct psp_req_buffer_hdr { diff --git a/include/uapi/linux/psp-dbc.h b/include/uapi/linux/psp-dbc.h index 7443c78ede19..b3845a9ff5fd 100644 --- a/include/uapi/linux/psp-dbc.h +++ b/include/uapi/linux/psp-dbc.h @@ -45,6 +45,23 @@ struct dbc_user_setuid { __u8 signature[DBC_SIG_SIZE]; } __packed; =20 +/** + * struct dbc_user_param - Parameter exchange structure (input/output). + * @msg_index: Message indicating what parameter to set or get (input) + * @param: 4 byte parameter, units are message specific. (input/output) + * @signature: 32 byte signature. + * - When sending a message this is to be created by software + * using a previous nonce (input) + * - For interpreting results, this signature is updated by the + * PSP to allow software to validate the authenticity of the + * results. + */ +struct dbc_user_param { + __u32 msg_index; + __u32 param; + __u8 signature[DBC_SIG_SIZE]; +} __packed; + /** * Dynamic Boost Control (DBC) IOC * @@ -84,4 +101,47 @@ struct dbc_user_setuid { */ #define DBCIOCUID _IOW(DBC_IOC_TYPE, 0x2, struct dbc_user_setuid) =20 +/** + * DBCIOCPARAM - Set or get a parameter from the PSP. + * This request will only work after DBCIOCUID has successfu= lly + * set the UID of the calling process. + * Whether the parameter is set or get is controlled by the + * message ID in the request. + * This command must be sent using a 32 byte signature built + * using the nonce fetched from DBCIOCNONCE. + * When the command succeeds, the 32 byte signature will be + * updated by the PSP for software to authenticate the resul= ts. + */ +#define DBCIOCPARAM _IOWR(DBC_IOC_TYPE, 0x3, struct dbc_user_param) + +/** + * enum dbc_cmd_msg - Messages utilized by DBCIOCPARAM + * @PARAM_GET_FMAX_CAP: Get frequency cap (MHz) + * @PARAM_SET_FMAX_CAP: Set frequency cap (MHz) + * @PARAM_GET_PWR_CAP: Get socket power cap (mW) + * @PARAM_SET_PWR_CAP: Set socket power cap (mW) + * @PARAM_GET_GFX_MODE: Get graphics mode (0/1) + * @PARAM_SET_GFX_MODE: Set graphics mode (0/1) + * @PARAM_GET_CURR_TEMP: Get current temperature (degrees C) + * @PARAM_GET_FMAX_MAX: Get maximum allowed value for frequency (MHz) + * @PARAM_GET_FMAX_MIN: Get minimum allowed value for frequency (MHz) + * @PARAM_GET_SOC_PWR_MAX: Get maximum allowed value for SoC power (mw) + * @PARAM_GET_SOC_PWR_MIN: Get minimum allowed value for SoC power (mw) + * @PARAM_GET_SOC_PWR_CUR: Get current value for SoC Power (mW) + */ +enum dbc_cmd_msg { + PARAM_GET_FMAX_CAP =3D 0x3, + PARAM_SET_FMAX_CAP =3D 0x4, + PARAM_GET_PWR_CAP =3D 0x5, + PARAM_SET_PWR_CAP =3D 0x6, + PARAM_GET_GFX_MODE =3D 0x7, + PARAM_SET_GFX_MODE =3D 0x8, + PARAM_GET_CURR_TEMP =3D 0x9, + PARAM_GET_FMAX_MAX =3D 0xA, + PARAM_GET_FMAX_MIN =3D 0xB, + PARAM_GET_SOC_PWR_MAX =3D 0xC, + PARAM_GET_SOC_PWR_MIN =3D 0xD, + PARAM_GET_SOC_PWR_CUR =3D 0xE, +}; + #endif /* __PSP_DBC_USER_H__ */ --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6607DC77B73 for ; Thu, 20 Apr 2023 16:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbjDTQcp (ORCPT ); Thu, 20 Apr 2023 12:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234646AbjDTQcV (ORCPT ); Thu, 20 Apr 2023 12:32:21 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 277EBE65 for ; Thu, 20 Apr 2023 09:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fo0hh49YXsb2v9+gx0wnQDF2C3PVecNnOgCnCTeQngDJKMhUqqBzkJB13q5LsCYC+rY+zq8sezQnr+n5jzxPHCVQi5gY2pG80T/KHGS2fAUZ8dEdvkwj9dn0PaSEN+AFzf4ForOi5AwOKP3sGdyY0uXQg7UjnGp0gPkdb4Bub96RrnBX0v0UgD/8ZhiruyhqG9QztnVU+SoZaEx+RZ/gnVGQb/oK7plHJZdmcoPz/uIfLfCNVIaOUrhocqM00eI4RLX9n3da+quxCRs1ht92l9iJgUXCufr4oyDVdNG2GXXVD80g/9XV9e9j5aiPZvcPnsfoyPV/21NrJmDJtSzyVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=lJ2R7p1+EheZHnyiiVN2R3UsfUXuzN8/4nby8MGswZg=; b=ncXsfavgRH5BgqU8duhCZhynMnNxuNYgPeg9Q0jHNleWNp8Rrep6R32j96oJYhNvHewwUsOevt0v+P+OgBnucADsoGAh3iVgc2tBVK7d/OnA2WN0wBaiGW7C4qTZvmytkr3awGgDjPnY4qGahZgQkXShvWjuUie++YA6deu2I4Ny/AU1g1ZZEiAONFaS7X4hzs7sVl+zRV0DQEPKwFavOf0ZnKdoKEqry9L3iQXDoliv1hpxFVrH18Fahmv23u1tvigASyUdsgtVprBoXpXPAK0tZu2+bwcWD0D5KM3MVfFWrvF6NpMOWhJSjtOkSQwsVjiwihxmldaEzyXvqVGyQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lJ2R7p1+EheZHnyiiVN2R3UsfUXuzN8/4nby8MGswZg=; b=zwnLoZhlOA5qp48O8dFmtqUxvK0f4JUCmFQzAo1N/xonkyBmfhh2OeXJwfSh3kdWcxerHkU20LuERWBil7QCGe+F0LLBBigFqVyD1pR1nnOmJwS9k6kMzlY9DtQecm8Gqp1VgApHj+1WzKz5kBl1DlUlwfNPG2syrdo9XWAa3dY= Received: from DS7P222CA0012.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::15) by IA0PR12MB8982.namprd12.prod.outlook.com (2603:10b6:208:481::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:10 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::ce) by DS7P222CA0012.outlook.office365.com (2603:10b6:8:2e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.24 via Frontend Transport; Thu, 20 Apr 2023 16:32:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.23 via Frontend Transport; Thu, 20 Apr 2023 16:32:09 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:08 -0500 From: Mario Limonciello To: Herbert Xu , CC: Tom Lendacky , "David S . Miller" , John Allen , Mario Limonciello Subject: [PATCH 08/10] crypto: ccp: Add a sample script for Dynamic Boost Control Date: Thu, 20 Apr 2023 11:31:36 -0500 Message-ID: <20230420163140.14940-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT044:EE_|IA0PR12MB8982:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c3282b3-ba53-47c6-eba5-08db41bcc9e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fL4fCd9XqvwI9swHLe6/EmGa2D76t0V2Q/MxShM0qVEuHH9A31xl0st2DjEGWJYsqSuaBu5f/ctQ3xqeB0niVqIfeSBuUfkOj/BIqJcFTob0aIK2DKlWE7WtV/IO1yQoDmK4nQkDaWAr3LPFksTPs50G56J5QROoMd+6rbG5bAVqxK9Rw8cnEfqJlRVlu3r63AZrB+qNWvIUxeafBrLm4Ensx/q6D48wE65/uq6e08uRJoXqhfDrUH8W6Stk/pwpqCG/uJ7AUkIlQ6OKcql/Yp9nOpURyhbMbiI2DbU2xvCYEasek0+J1twDGE2RvrZz8Kb8/GiFPdLM/yFPDGxHxi4syQXLRbq56PixcKJ360QSMT/qBOzG9SGLai3BXJoL/8kSr9W6wUJoPmkwB5/RY3SSn1DPDNsXKm1PNpuSRh84GmuLUss8hpCDzlLaqPRByIrXz3cl3rBvxHrTKi+DXqhYQWzE9+0tgdCX2XBFOGDJVenZMBXKp4wccgK2pFtE9QyuKGQFZRbuQdSlGLegGqgWcOqLFFE2ZXD1P3ERqfur3CBgkFIakOoZGvRnN/+mAdcK/+aujQ7u5F6U8JfTApJGk5QqOdilfcQyYR64tV6uTsO9x0H+q9tn6uV09Wd1stgZHkggXaFA6tF2QGeqy6IJRcKj/YF8enMZhGFaB4HAKkMWp+xekfPAQfzX8bSLTza7lPnvfJp0KApioIABmlYSf37BS3nd1FDEPgDqorw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199021)(46966006)(36840700001)(40470700004)(36756003)(4326008)(110136005)(54906003)(316002)(70206006)(70586007)(7696005)(478600001)(6666004)(40480700001)(82310400005)(8936002)(5660300002)(41300700001)(8676002)(2906002)(44832011)(82740400003)(86362001)(356005)(81166007)(2616005)(47076005)(426003)(336012)(1076003)(26005)(16526019)(40460700003)(36860700001)(83380400001)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:09.9155 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c3282b3-ba53-47c6-eba5-08db41bcc9e4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8982 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Dynamic Boost Control is utilized by userspace with a collection of 2 R/W IOCTLs and 1 W IOCTL. Userspace needs to prepare buffers with the appropriate signature data and details of the request. To allow rapid prototyping and testing this interface, add a python3 command line script that can validate the functionality of these IOCTLs. NOTE: This script does *not* generate signatures. They will need to be prepared separately and passed as arguments. Signed-off-by: Mario Limonciello --- tools/crypto/ccp/.gitignore | 1 + tools/crypto/ccp/dbc.py | 98 ++++++++++++++++++++++++++++ tools/crypto/ccp/dbc_cli.py | 123 ++++++++++++++++++++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 tools/crypto/ccp/.gitignore create mode 100644 tools/crypto/ccp/dbc.py create mode 100755 tools/crypto/ccp/dbc_cli.py diff --git a/tools/crypto/ccp/.gitignore b/tools/crypto/ccp/.gitignore new file mode 100644 index 000000000000..bee8a64b79a9 --- /dev/null +++ b/tools/crypto/ccp/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/tools/crypto/ccp/dbc.py b/tools/crypto/ccp/dbc.py new file mode 100644 index 000000000000..f1b7342060b1 --- /dev/null +++ b/tools/crypto/ccp/dbc.py @@ -0,0 +1,98 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0 + +from ioctl_opt import IOWR, IOW +import ctypes +import fcntl + +DBC_UID_SIZE =3D 16 +DBC_NONCE_SIZE =3D 16 +DBC_SIG_SIZE =3D 32 + +PARAM_GET_FMAX_CAP =3D (0x3,) +PARAM_SET_FMAX_CAP =3D (0x4,) +PARAM_GET_PWR_CAP =3D (0x5,) +PARAM_SET_PWR_CAP =3D (0x6,) +PARAM_GET_GFX_MODE =3D (0x7,) +PARAM_SET_GFX_MODE =3D (0x8,) +PARAM_GET_CURR_TEMP =3D (0x9,) +PARAM_GET_FMAX_MAX =3D (0xA,) +PARAM_GET_FMAX_MIN =3D (0xB,) +PARAM_GET_SOC_PWR_MAX =3D (0xC,) +PARAM_GET_SOC_PWR_MIN =3D (0xD,) +PARAM_GET_SOC_PWR_CUR =3D (0xE,) + +DEVICE_NODE =3D "/dev/dbc" + + +class _dbc_get_nonce(ctypes.Structure): + _fields_ =3D [ + ("auth_needed", ctypes.c_uint32), + ("nonce", ctypes.c_uint8 * DBC_NONCE_SIZE), + ("signature", ctypes.c_uint8 * DBC_SIG_SIZE), + ] + + +class _dbc_set_uid(ctypes.Structure): + _fields_ =3D [ + ("uid", ctypes.c_uint8 * DBC_UID_SIZE), + ("signature", ctypes.c_uint8 * DBC_SIG_SIZE), + ] + + +class _dbc_param(ctypes.Structure): + _fields_ =3D [ + ("msg_index", ctypes.c_uint32), + ("parameter", ctypes.c_uint32), + ("signature", ctypes.c_uint8 * DBC_SIG_SIZE), + ] + + +DBCIOCNONCE =3D IOWR(ord("D"), 0x01, _dbc_get_nonce) +DBCIOCUID =3D IOW(ord("D"), 0x02, _dbc_set_uid) +DBCIOCPARAM =3D IOWR(ord("D"), 0x03, _dbc_param) + + +def get_nonce(device, signature): + nonce =3D _dbc_get_nonce() + if signature: + nonce.auth_needed =3D 1 + tmp =3D ctypes.c_ubyte * len(signature) + nonce.signature =3D tmp.from_buffer_copy(bytes(signature, "ascii")) + result =3D fcntl.ioctl(device, DBCIOCNONCE, nonce, True) + if result < 0: + raise IOError(result) + return nonce + + +def set_uid(device, new_uid, signature): + uid =3D _dbc_set_uid() + if not signature: + raise ValueError("Signature required") + if not new_uid: + raise ValueError("UID required") + tmp =3D ctypes.c_ubyte * len(signature) + tmp2 =3D ctypes.c_ubyte * len(new_uid) + uid.signature =3D tmp.from_buffer_copy(bytes(signature, "ascii")) + uid.uid =3D tmp2.from_buffer_copy(bytes(new_uid, "ascii")) + result =3D fcntl.ioctl(device, DBCIOCUID, uid, True) + if result < 0: + raise IOError(result) + return True + + +def process_param(device, message, signature, data=3DNone): + param =3D _dbc_param() + if not signature: + raise ValueError("Signature required") + if type(message) !=3D tuple: + raise ValueError("Expected message tuple") + tmp =3D ctypes.c_ubyte * len(signature) + param.signature =3D tmp.from_buffer_copy(bytes(signature, "ascii")) + param.msg_index =3D message[0] + if data: + param.parameter =3D data + result =3D fcntl.ioctl(device, DBCIOCPARAM, param, True) + if result < 0: + raise IOError(result) + return param diff --git a/tools/crypto/ccp/dbc_cli.py b/tools/crypto/ccp/dbc_cli.py new file mode 100755 index 000000000000..2dbefc2b7ed3 --- /dev/null +++ b/tools/crypto/ccp/dbc_cli.py @@ -0,0 +1,123 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0 +import argparse +import binascii +import os +import errno +from dbc import * + +ERRORS =3D { + errno.EACCES: "Access is denied", + errno.E2BIG: "Excess data provided", + errno.EINVAL: "Bad parameters", + errno.EAGAIN: "Bad state", + errno.ENOENT: "Not implemented or message failure", + errno.EBUSY: "Busy", + errno.ENFILE: "Overflow", + errno.EPERM: "Signature invalid", +} + +messages =3D { + "get-fmax-cap": PARAM_GET_FMAX_CAP, + "set-fmax-cap": PARAM_SET_FMAX_CAP, + "get-power-cap": PARAM_GET_PWR_CAP, + "set-power-cap": PARAM_SET_PWR_CAP, + "get-graphics-mode": PARAM_GET_GFX_MODE, + "set-graphics-mode": PARAM_SET_GFX_MODE, + "get-current-temp": PARAM_GET_CURR_TEMP, + "get-fmax-max": PARAM_GET_FMAX_MAX, + "get-fmax-min": PARAM_GET_FMAX_MAX, + "get-soc-power-max": PARAM_GET_SOC_PWR_MAX, + "get-soc-power-min": PARAM_GET_SOC_PWR_MIN, + "get-soc-power-cur": PARAM_GET_SOC_PWR_CUR, +} + + +def _pretty_buffer(ba): + return str(binascii.hexlify(ba, " ")) + + +def parse_args(): + parser =3D argparse.ArgumentParser( + description=3D"Dynamic Boost control command line interface" + ) + parser.add_argument( + "command", + choices=3D["get-nonce", "get-param", "set-param", "set-uid"], + help=3D"Command to send", + ) + parser.add_argument("--device", default=3D"/dev/dbc", help=3D"Device t= o operate") + parser.add_argument("--signature", help=3D"Signature for command") + parser.add_argument("--message", choices=3Dmessages.keys(), help=3D"Me= ssage index") + parser.add_argument("--data", help=3D"Argument to pass to message") + parser.add_argument("--uid", help=3D"UID to pass") + return parser.parse_args() + + +def pretty_error(code): + if code in ERRORS: + print(ERRORS[code]) + else: + print("failed with return code %d" % code) + + +if __name__ =3D=3D "__main__": + args =3D parse_args() + data =3D 0 + if not os.path.exists(args.device): + raise IOError("Missing device {device}".format(device=3Dargs.devic= e)) + if args.signature and len(args.signature) !=3D DBC_SIG_SIZE: + raise ValueError( + "Invalid signature length %d (expected %d)" + % (len(args.signature), DBC_SIG_SIZE) + ) + if args.uid and len(args.uid) !=3D DBC_UID_SIZE: + raise ValueError( + "Invalid UID length %d (expected %d)" % (len(args.uid), DBC_UI= D_SIZE) + ) + if args.data: + try: + data =3D int(args.data, 10) + except ValueError: + data =3D int(args.data, 16) + + with open(args.device) as d: + if args.command =3D=3D "get-nonce": + try: + nonce =3D get_nonce(d, args.signature) + print("Nonce: %s" % _pretty_buffer(bytes(nonce.nonce))) + except OSError as e: + pretty_error(e.errno) + elif args.command =3D=3D "set-uid": + try: + result =3D set_uid(d, args.uid, args.signature) + if result: + print("Set UID") + except OSError as e: + pretty_error(e.errno) + elif args.command =3D=3D "get-param": + if not args.message or args.message.startswith("set"): + raise ValueError("Invalid message %s" % args.message) + try: + param =3D process_param(d, messages[args.message], args.si= gnature) + print( + "Parameter: {par}, response signature {sig}".format( + par=3Dparam.parameter, + sig=3D_pretty_buffer(bytes(param.signature)), + ) + ) + except OSError as e: + pretty_error(e.errno) + elif args.command =3D=3D "set-param": + if not args.message or args.message.startswith("get"): + raise ValueError("Invalid message %s" % args.message) + try: + param =3D process_param(d, messages[args.message], args.si= gnature, data) + print( + "Parameter: {par}, response signature {sig}".format( + par=3Dparam.parameter, + sig=3D_pretty_buffer(bytes(param.signature)), + ) + ) + except OSError as e: + pretty_error(e.errno) --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16541C77B73 for ; Thu, 20 Apr 2023 16:33:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234878AbjDTQdT (ORCPT ); Thu, 20 Apr 2023 12:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234740AbjDTQcb (ORCPT ); Thu, 20 Apr 2023 12:32:31 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E04C91FF6 for ; Thu, 20 Apr 2023 09:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ks30Ngs+Bi0MWbOTTeBwRv0orgnovstZPxCbSnANTWhuSDUSnA2rT4CO7MUtsBeVnL8tukbgN6YevvofeoHEWI32zu2uHieK0D1I5D4qH8vhMSG1F+NqRMNaLBU5jibSF0Er3Aodrh24iBl0duqso0ruIfLvHUDN0srOxS/AzXOuYJMh9n50uym0vl6nssnnnoTL2Qhvt0eGznaMGNxth9wp6kbWqWXOlrAtGyJS3dijiEzKwQrhuK47M5bZ1fafwO6ujlbts8ksicXZLDoqFW5ACG1WaRWM7q+HhJ8U9L2ICifd/P81n8OpyGXv4hI0MUXAOtTuLDJ0oS6vIJqxRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=dsLohCXeKuWWsdVkE72Ow68aKRakDV7sRhzRtAZBwgE=; b=gfRmh+QsiOacBzAaWH9NSqaSrhNRoKssNmI8kCSXdDklCdbnoD32VLu7bMjjUTSAXkrKuV3Ok/v4p8C74qX7yiPs2vbF6TzMnbnfsuGIDe3e4tpY6MnQdytnJoaA0RU7zLoHa49iTQX3UKgHFzkF1bqCvn0pD6rSv9jo4QqinKy9GYFuJY3vwkeZGAjFBQ59lzFIIhxqrMwHB3PawwO1z9uGiecfcD0G7ZRZ0w2OtpcJA2pP3dx/4XOlYPrtDAnPpIyvgxbY2katkqnDwIPN+qp+u6XvIyaL672JbFp+FDiorjwDLDbYEka6fiDNka4xAtpIMXxDpM/4wNnmdW9F7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dsLohCXeKuWWsdVkE72Ow68aKRakDV7sRhzRtAZBwgE=; b=Rnphb6NuwrlLjzACyh81RBHENslMXvZ+Be/hXdynJRDYXSNuLcKRnFq7Q2CuLIm2xyjfhvk/hhWXnObvJHyw+zlx0yeamGzWAYaEuuZ3nzo7n9DOUcIZSgy4L6xUJtl+yGOwz4saA4h7GMDRuIQ1cbGL+wbXiq91KVT0eqdT1/g= Received: from DS7PR03CA0124.namprd03.prod.outlook.com (2603:10b6:5:3b4::9) by SJ2PR12MB7895.namprd12.prod.outlook.com (2603:10b6:a03:4c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 16:32:12 +0000 Received: from DM6NAM11FT090.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::4a) by DS7PR03CA0124.outlook.office365.com (2603:10b6:5:3b4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22 via Frontend Transport; Thu, 20 Apr 2023 16:32:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT090.mail.protection.outlook.com (10.13.172.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.24 via Frontend Transport; Thu, 20 Apr 2023 16:32:11 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:09 -0500 From: Mario Limonciello To: Herbert Xu , CC: Tom Lendacky , "David S . Miller" , John Allen , Mario Limonciello Subject: [PATCH 09/10] crypto: ccp: Add unit tests for dynamic boost control Date: Thu, 20 Apr 2023 11:31:37 -0500 Message-ID: <20230420163140.14940-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT090:EE_|SJ2PR12MB7895:EE_ X-MS-Office365-Filtering-Correlation-Id: 3367d8dc-ca21-4d12-9523-08db41bcca90 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i6qbDykmI3XcbHafSldmTX9RfEgu8RN1BC6QCddDK3oM4ThsVGtr0mniGgetZFlo9XRXpvXb8/292q4Y+pjIDyQF1K+CHkRWHpAEapkzHAQ5tOAPynhl9mAyOD85Imxw8VnePFsXAcCioDR286msT9/bRnNAcYXNwu8YJrpuOO1oEt3egc2clYdQgybUcnHeVedfg0kk0LETAbKckKlyPZODEBQjIQNiyYB5vpxuU6ivmVoaLMiw8BszAcSoJnOzigpz9pfW/1oV+JCXf170b5l2xFip7NWG8YOoFUCnsCLaPr9elTvJFya2rvyWsssPYltlKelAiDHyxsHT9qicX7xq/IssCG25i/+qqPCYtgg4XjRk+wkWfIDqc2iuxwITXngc2w41J+7N7dM2ioIXk7YFwcxBIM1zqtLONhXm5G4bg6IFahC8lX3t63LIkJpCsHvCj+u+Wzy9EWeXsgYhu2kNeER147fSAjokUA6jjR2Ez5Wrkt5Duk3/PT7OzHXJFe1Ppg5ocj/uKwc23H9guxcVOyMuAwoYgnvOz0zpzgdWf+a2U0ODQlS9RcmWV/LUQ2wmFV3T7eV746QFMK38r4Yl+Z8iQQi+ME/NN9ZOiaRNQOri6ZQdc9wyizn+gf/DFPIguLxxdOML4zh5U4wrN66ZoovKnsp0mceLznY0yPhLORUTTjZPiZOLxDgX/erC8F5V/toCa6+2EF5uyAiWQrGTO4wSSeI5JYGRajJhVT8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199021)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(70586007)(70206006)(4326008)(478600001)(110136005)(316002)(54906003)(8936002)(5660300002)(8676002)(81166007)(41300700001)(356005)(82740400003)(186003)(16526019)(336012)(2616005)(47076005)(426003)(83380400001)(36860700001)(7696005)(6666004)(26005)(1076003)(86362001)(36756003)(82310400005)(2906002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:11.0406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3367d8dc-ca21-4d12-9523-08db41bcca90 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT090.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7895 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Interacting with dynamic boost control messages requires the caller to supply a signature. To allow validation of individual dynamic boost control components, introduce a set of tests that can be run. The tests can be run in 3 distinct different environments, and so certain tests will be skipped depending on the environment. 1. Systems that do not support DBC. 2. Production systems that support DBC but are fused. 3. Pre-production systems that support DBC but are unfused. Unfused silicon does not validate the signature, and so this allows testing more of the state machine and functionality. Signed-off-by: Mario Limonciello --- tools/crypto/ccp/test_dbc.py | 266 +++++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100755 tools/crypto/ccp/test_dbc.py diff --git a/tools/crypto/ccp/test_dbc.py b/tools/crypto/ccp/test_dbc.py new file mode 100755 index 000000000000..33f93fddb9be --- /dev/null +++ b/tools/crypto/ccp/test_dbc.py @@ -0,0 +1,266 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0 +import unittest +import os +import time +import glob +from dbc import * + +# Artificial delay between set commands +SET_DELAY =3D 0.5 + + +class invalid_param(ctypes.Structure): + _fields_ =3D [ + ("data", ctypes.c_uint8), + ] + + +def system_is_fused() -> bool: + fused_part =3D glob.glob("/sys/bus/pci/drivers/ccp/**/fused_part")[0] + if os.path.exists(fused_part): + with open(fused_part, "r") as r: + return int(r.read()) =3D=3D 1 + return True + + +class DynamicBoostControlTest(unittest.TestCase): + def __init__(self, data) -> None: + self.d =3D None + self.signature =3D "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + self.uid =3D "1111111111111111" + super().__init__(data) + + def setUp(self) -> None: + self.d =3D open(DEVICE_NODE) + return super().setUp() + + def tearDown(self) -> None: + if self.d: + self.d.close() + return super().tearDown() + + +class TestUnsupportedSystem(DynamicBoostControlTest): + def setUp(self) -> None: + if os.path.exists(DEVICE_NODE): + self.skipTest("system is supported") + with self.assertRaises(FileNotFoundError) as error: + super().setUp() + self.assertEqual(error.exception.errno, 2) + + def test_unauthenticated_nonce(self) -> None: + """fetch unauthenticated nonce""" + with self.assertRaises(TypeError) as error: + get_nonce(self.d, None) + + +class TestInvalidIoctls(DynamicBoostControlTest): + def __init__(self, data) -> None: + self.data =3D invalid_param() + self.data.data =3D 1 + super().__init__(data) + + def setUp(self) -> None: + if not os.path.exists(DEVICE_NODE): + self.skipTest("system is unsupported") + return super().setUp() + + def test_invalid_nonce_ioctl(self) -> None: + """tries to call get_nonce ioctl with invalid data structures""" + + # 0x1 (get nonce), and invalid data + INVALID1 =3D IOWR(ord("D"), 0x01, invalid_param) + with self.assertRaises(OSError) as error: + fcntl.ioctl(self.d, INVALID1, self.data, True) + self.assertEqual(error.exception.errno, 22) + + def test_invalid_setuid_ioctl(self) -> None: + """tries to call set_uid ioctl with invalid data structures""" + + # 0x2 (set uid), and invalid data + INVALID2 =3D IOW(ord("D"), 0x02, invalid_param) + with self.assertRaises(OSError) as error: + fcntl.ioctl(self.d, INVALID2, self.data, True) + self.assertEqual(error.exception.errno, 22) + + def test_invalid_setuid_rw_ioctl(self) -> None: + """tries to call set_uid ioctl with invalid data structures""" + + # 0x2 as RW (set uid), and invalid data + INVALID3 =3D IOWR(ord("D"), 0x02, invalid_param) + with self.assertRaises(OSError) as error: + fcntl.ioctl(self.d, INVALID3, self.data, True) + self.assertEqual(error.exception.errno, 22) + + def test_invalid_param_ioctl(self) -> None: + """tries to call param ioctl with invalid data structures""" + # 0x3 (param), and invalid data + INVALID4 =3D IOWR(ord("D"), 0x03, invalid_param) + with self.assertRaises(OSError) as error: + fcntl.ioctl(self.d, INVALID4, self.data, True) + self.assertEqual(error.exception.errno, 22) + + def test_invalid_call_ioctl(self) -> None: + """tries to call the DBC ioctl with invalid data structures""" + # 0x4, and invalid data + INVALID5 =3D IOWR(ord("D"), 0x04, invalid_param) + with self.assertRaises(OSError) as error: + fcntl.ioctl(self.d, INVALID5, self.data, True) + self.assertEqual(error.exception.errno, 22) + + +class TestInvalidSignature(DynamicBoostControlTest): + def setUp(self) -> None: + if not os.path.exists(DEVICE_NODE): + self.skipTest("system is unsupported") + if not system_is_fused(): + self.skipTest("system is unfused") + return super().setUp() + + def test_unauthenticated_nonce(self) -> None: + """fetch unauthenticated nonce""" + get_nonce(self.d, None) + + def test_multiple_unauthenticated_nonce(self) -> None: + """ensure state machine always returns nonce""" + for count in range(0, 2): + get_nonce(self.d, None) + + def test_authenticated_nonce(self) -> None: + """fetch authenticated nonce""" + with self.assertRaises(OSError) as error: + get_nonce(self.d, self.signature) + self.assertEqual(error.exception.errno, 22) + + def test_set_uid(self) -> None: + """set uid""" + with self.assertRaises(OSError) as error: + set_uid(self.d, self.uid, self.signature) + self.assertEqual(error.exception.errno, 11) + + def test_get_param(self) -> None: + """fetch a parameter""" + with self.assertRaises(OSError) as error: + process_param(self.d, PARAM_GET_SOC_PWR_CUR, self.signature) + self.assertEqual(error.exception.errno, 11) + + def test_set_param(self) -> None: + """set a parameter""" + with self.assertRaises(OSError) as error: + process_param(self.d, PARAM_SET_PWR_CAP, self.signature, 1000) + self.assertEqual(error.exception.errno, 11) + + +class TestUnFusedSystem(DynamicBoostControlTest): + def setup_identity(self) -> None: + """sets up the identity of the caller""" + # if already authenticated these may fail + try: + get_nonce(self.d, None) + except PermissionError: + pass + try: + set_uid(self.d, self.uid, self.signature) + except BlockingIOError: + pass + try: + get_nonce(self.d, self.signature) + except PermissionError: + pass + + def setUp(self) -> None: + if not os.path.exists(DEVICE_NODE): + self.skipTest("system is unsupported") + if system_is_fused(): + self.skipTest("system is fused") + super().setUp() + self.setup_identity() + time.sleep(SET_DELAY) + + def test_get_valid_param(self) -> None: + """fetch all possible parameters""" + # SOC power + soc_power_max =3D process_param(self.d, PARAM_GET_SOC_PWR_MAX, sel= f.signature) + soc_power_min =3D process_param(self.d, PARAM_GET_SOC_PWR_MIN, sel= f.signature) + self.assertGreater(soc_power_max.parameter, soc_power_min.paramete= r) + + # fmax + fmax_max =3D process_param(self.d, PARAM_GET_FMAX_MAX, self.signat= ure) + fmax_min =3D process_param(self.d, PARAM_GET_FMAX_MIN, self.signat= ure) + self.assertGreater(fmax_max.parameter, fmax_min.parameter) + + # cap values + keys =3D { + "fmax-cap": PARAM_GET_FMAX_CAP, + "power-cap": PARAM_GET_PWR_CAP, + "current-temp": PARAM_GET_CURR_TEMP, + "soc-power-cur": PARAM_GET_SOC_PWR_CUR, + } + for k in keys: + result =3D process_param(self.d, keys[k], self.signature) + self.assertGreater(result.parameter, 0) + + def test_get_invalid_param(self) -> None: + """fetch an invalid parameter""" + try: + set_uid(self.d, self.uid, self.signature) + except OSError: + pass + with self.assertRaises(OSError) as error: + process_param(self.d, (0xF,), self.signature) + self.assertEqual(error.exception.errno, 22) + + def test_set_fmax(self) -> None: + """get/set fmax limit""" + # fetch current + original =3D process_param(self.d, PARAM_GET_FMAX_CAP, self.signat= ure) + + # set the fmax + target =3D original.parameter - 100 + process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, target) + time.sleep(SET_DELAY) + new =3D process_param(self.d, PARAM_GET_FMAX_CAP, self.signature) + self.assertEqual(new.parameter, target) + + # revert back to current + process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, original= .parameter) + time.sleep(SET_DELAY) + cur =3D process_param(self.d, PARAM_GET_FMAX_CAP, self.signature) + self.assertEqual(cur.parameter, original.parameter) + + def test_set_power_cap(self) -> None: + """get/set power cap limit""" + # fetch current + original =3D process_param(self.d, PARAM_GET_PWR_CAP, self.signatu= re) + + # set the fmax + target =3D original.parameter - 10 + process_param(self.d, PARAM_SET_PWR_CAP, self.signature, target) + time.sleep(SET_DELAY) + new =3D process_param(self.d, PARAM_GET_PWR_CAP, self.signature) + self.assertEqual(new.parameter, target) + + # revert back to current + process_param(self.d, PARAM_SET_PWR_CAP, self.signature, original.= parameter) + time.sleep(SET_DELAY) + cur =3D process_param(self.d, PARAM_GET_PWR_CAP, self.signature) + self.assertEqual(cur.parameter, original.parameter) + + def test_set_3d_graphics_mode(self) -> None: + """set/get 3d graphics mode""" + # these aren't currently implemented but may be some day + # they are *expected* to fail + with self.assertRaises(OSError) as error: + process_param(self.d, PARAM_GET_GFX_MODE, self.signature) + self.assertEqual(error.exception.errno, 2) + + time.sleep(SET_DELAY) + + with self.assertRaises(OSError) as error: + process_param(self.d, PARAM_SET_GFX_MODE, self.signature, 1) + self.assertEqual(error.exception.errno, 2) + + +if __name__ =3D=3D "__main__": + unittest.main() --=20 2.34.1 From nobody Wed Dec 17 10:24:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7711C77B73 for ; Thu, 20 Apr 2023 16:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234819AbjDTQcn (ORCPT ); Thu, 20 Apr 2023 12:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234641AbjDTQcV (ORCPT ); Thu, 20 Apr 2023 12:32:21 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4361C2D62 for ; Thu, 20 Apr 2023 09:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lqwJ0ff9P/E4lhbI/RX5YtVb3/hynLYwNARWvX+N3Y6lMzLiQR0/d68zBxrQp+itiKYXeeMhx+RIt+dVzr4ow4rW2GqIhBtmfCRGp3tveg5WFx398hwcILV6TVX3ud41QCgfpyPv3hxXPwaUwGLOhxRroaBuxJbspor4HHGDHDQKApa+fpjZTiJxWS0tCYc479FPYm1s8qAPUiz3yeud/CSZDxChzlWmDnKSyqSnAVWRE4Z+upq9HjzDPM+ptK5W34ZQYmF5xQcUjgzJO31mr6H4TM4Kecf9kPefl3ScvGNYHK4sR8iO2+DEbzPohUUWgjDIl7xGiSo1nNBeM5TMeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=sHybiOC7Pf0gITiZl7S51v7l9OkBzy7ZYhRpPscQGGk=; b=SEHRa+dYY2qefJuRjjZycDP5Mj/9A8mT3+nxoxwArsMRlA7St30YXRURbeReg8p3rnmbmIZDJB6HaPofVV3B24Agtpbr0u0tFdrxAjigHkY1I7ma+n2vmrEGhMe+bDKY79yHjImuiHEJssjHfUPswVPJwDRzAFQKghlsH0t9ExNuDG84SVSdIF6DSktnjUbmIjbzixXb7Sv7vkyjiqxu2RWUPZC67Z9nn2w4+cxP/Yjdw1PgcZWnwGeowR8P7u6dFrCnabBIJUWjZKh6uv/SggE5w/3nP0Oid4EMQx22eG6RblAZPOcNLVvI6tD9QCvbLqwMJ+zs6EhWPt9rYhR5CQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sHybiOC7Pf0gITiZl7S51v7l9OkBzy7ZYhRpPscQGGk=; b=aOdCI7TrxspmSEOcIPBJQYlDziFcaourBhppYaahXBXOSS2fBaUDJFiVkRN6e3K1KTluayYCfSe26rffT9FhVhVn4ZmJW5LQYxW0H/gnmC1mvaTpscJuvPaiauiP/1oKI3F9v2F5/Lbyirz384HZDTKR0zoMeDSxufqQ8rYWuQ4= Received: from DS7P222CA0012.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::15) by CH2PR12MB4216.namprd12.prod.outlook.com (2603:10b6:610:a8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Thu, 20 Apr 2023 16:32:12 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::bf) by DS7P222CA0012.outlook.office365.com (2603:10b6:8:2e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.24 via Frontend Transport; Thu, 20 Apr 2023 16:32:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.23 via Frontend Transport; Thu, 20 Apr 2023 16:32:12 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 20 Apr 2023 11:32:11 -0500 From: Mario Limonciello To: Herbert Xu , CC: Tom Lendacky , "David S . Miller" , John Allen , Mario Limonciello Subject: [PATCH 10/10] crypto: ccp: Add Mario to MAINTAINERS Date: Thu, 20 Apr 2023 11:31:38 -0500 Message-ID: <20230420163140.14940-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230420163140.14940-1-mario.limonciello@amd.com> References: <20230420163140.14940-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT044:EE_|CH2PR12MB4216:EE_ X-MS-Office365-Filtering-Correlation-Id: d7539bf2-f8a2-4da7-9a52-08db41bccb3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rbpj9Qjvf3BJpXLYy4HVVVFKRGwAQAXB6YAK8GVLYqNShRhmrLdaZfrWUbFBo0Afp+Kf1a5X/GGXmOwEm//AFmUkn8f7GbWDBs1xu92fxmoXfDBp8vwigzgDfawkvZhMU38IefeDNMEZen3nUujkEVpqVEzzd5nBohUotIakCDybAzzYlKAL7AjvcwRnJ6pYHGpkALBW7kJkAgnS21uFSBuBUUXwpWq8snUX/dLC8T46Si41aHSOE9ecj0Hf04sfraPTDGxHmooJbF/WxbArZmGEY0dkEh6R0r/DWNMUkw6ttMPUB2PXsmziqqfTVCBQAn1DVs4C16F3SYfxxSkBw1Ev00lUgxjkbsLhOwrQgXX/TcEVoZOJMBsirN77bcfZ/7enZyNjXTcjI3frnpP4SjIJLDHaLxbt0U6Ix5QVQBOn0N0AN8zutKf9+Kji1tEY6cG9s2UhxXaHTjkUkZkrCLkTyWomNU0/WTQWMzRWfSupND21nXI1LyKzBz31/hbj9C5NjBQtfEtjgrYI7ogK3CXl9MBstUP8Jp3ZemNnmyacm7UB4NMbjOkd1nC+k98/iu67xLEihDLHaoujGJ+IXO9AoccRfjcm4UX3KidVIw3X6/FsNFP3PNT2IDWjB8ImXgS878kB6SiKO965GehzkNZDg86NbbwebrLkjtGu1OTRMVNOdeLB/wHl9FPz++YKxk3jYP/a4v5TdIhO9fdNVvd96jv3Exvwz8F7TT3Iar4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(451199021)(46966006)(40470700004)(36840700001)(36756003)(8936002)(8676002)(40460700003)(5660300002)(4744005)(44832011)(2906002)(82310400005)(86362001)(70206006)(40480700001)(478600001)(7696005)(6666004)(54906003)(110136005)(186003)(2616005)(36860700001)(1076003)(70586007)(16526019)(356005)(316002)(82740400003)(83380400001)(47076005)(4326008)(41300700001)(426003)(81166007)(26005)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:32:12.1810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7539bf2-f8a2-4da7-9a52-08db41bccb3e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4216 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" I will maintain the platform access interface and dynamic boost control support. Signed-off-by: Mario Limonciello --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 45ee4e6faf9c..9feefcca232d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -980,6 +980,17 @@ S: Supported F: drivers/crypto/ccp/sev* F: include/uapi/linux/psp-sev.h =20 +AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DBC SUPPORT +M: Mario Limonciello +L: linux-crypto@vger.kernel.org +S: Supported +F: drivers/crypto/ccp/dbc.c +F: drivers/crypto/ccp/dbc.h +F: drivers/crypto/ccp/platform-access.c +F: drivers/crypto/ccp/platform-access.h +F: include/uapi/linux/psp-dbc.h +F: tools/crypto/ccp/*.py + AMD DISPLAY CORE M: Harry Wentland M: Leo Li --=20 2.34.1