From patchwork Thu Apr 20 16:31:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp512078rwl; Thu, 20 Apr 2023 09:33:02 -0700 (PDT) X-Google-Smtp-Source: AKy350bUBoqKIrnx5Y+YmG2lhusiVdMZuLthP8kI8WYd/EdbUWImop1RPeILlsuzo43Ba0viOs8E X-Received: by 2002:a05:6a21:100e:b0:f1:8f7:eeb5 with SMTP id nk14-20020a056a21100e00b000f108f7eeb5mr2231014pzb.60.1682008381988; Thu, 20 Apr 2023 09:33:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682008381; cv=pass; d=google.com; s=arc-20160816; b=fbk2hCqLIsu0TQf6U6MeUkbNzK+iI72UmzTo1+ZcJuwrbSxpdz013pXZL21u7liedZ epaqUtj+tXEXTjcF965jVL6l7JT7RwlLUMi+fKULgdakaqx14llUcYsGnoiqiYzV6pcH AniTncB+cwQd806wWbbfvjrVZrebCdRiubds44t3BGXt7GqqAeYPBRGfVXxeU8IOe5YZ H7tHdXXzREXAYwb0Pzs1fKpKGi6rrjZ02t6s3apARrAe0yIegM60YYenp7YTPEAI1/D2 PfbsPf1fE3i5gtW29zCPblKj+fJ1+1aFuC4FHywRBH6brvOVc7X8t3o4+9C/PACKtnOy sa0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tT9pMXjLl6E+ougnM0VBeecJpTqYTp3ifuOyQ+Nqe0I=; b=QWNA6YZUY4dSpIJ1F6kNcNU5enYMAR/nq9iIKb9bWSSkhF2feVxnHQqCMxTq1NxhGu rhFYzhuL987+dkkmoTQfIxgKeHjza6ysspBDgSjqSjkwGXfERF58+ew/hgKq3J9kjBs7 daBAr27lK5n+ejjr6sEAZsE0JIHqlHUJDMojflo8Un9H2rVGi/PrHOSnE3RRNXH0kov0 qd11MLhIkDELc/kk1TWceEZLBCyw2eJ6mw5XBAJ/Sg49XpMgn58dNoSHTz1SVJwT4mFr 9y3DUc71qaTSRl9OjbbMVtiSpoqA7ALvcr2UM/tFEqXBzz2cfujIAi7JKifdJnUCsTd0 jY5w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zuRZSb3j; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a656710000000b00502f0410410si1956185pgf.472.2023.04.20.09.32.48; Thu, 20 Apr 2023 09:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zuRZSb3j; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234457AbjDTQcN (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:13 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763713620610416519?= X-GMAIL-MSGID: =?utf-8?q?1763713620610416519?= 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; -#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 device_attribute *attr, \ return sysfs_emit(buf, "%d\n", (psp->capability & bit) > 0); \ } -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); -static struct attribute *psp_attrs[] = { +static struct attribute *psp_security_attrs[] = { &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; } -static struct attribute_group psp_attr_group = { - .attrs = psp_attrs, +static struct attribute_group psp_security_attr_group = { + .attrs = psp_security_attrs, .is_visible = psp_security_is_visible, }; static const struct attribute_group *psp_groups[] = { - &psp_attr_group, + &psp_security_attr_group, NULL, }; From patchwork Thu Apr 20 16:31:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp524512rwl; Thu, 20 Apr 2023 09:53:54 -0700 (PDT) X-Google-Smtp-Source: AKy350bLKXZoQqp2k8Xk+9m52YUj6GIt93Q9UY083QpjBUfyrbm+Z7XMLlq/s6CrwtmdRz5BFsFT X-Received: by 2002:a17:903:249:b0:1a6:87d8:b8fb with SMTP id j9-20020a170903024900b001a687d8b8fbmr2663132plh.2.1682009634386; Thu, 20 Apr 2023 09:53:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682009634; cv=pass; d=google.com; s=arc-20160816; b=i5A/Bmzc1piYbTWfeQ8Um2KDMwIiIo48gAcThJfBHZ0VtqRjVU2xwAxWMELv8n0A1j 2vHZ4X+GlEmgzkq1ve/CZd/BBoJeYNbSBMOFXhoBP1lPUG7oS1H/Xqrqe1GqPwikQxJr zoKTQYJvWgEt9iV5RONthWOZSBKjZEtst+f+fifX0ZTkwdGxEY4Ly2bO7Fh/Zaq6PO4x pFHT79Ys0VNDhssXnU7g1Wez1+RaoDxCW4OgruCfp0K3c8LPVlCdcy5EDOXMIX4RLQoS +/kz1sq3NcKZcXFNQ1SmTFFDWmaZfFwnkEtobIJxoYYc4aedu0zi3A3yujKF0EtgmoXP TmgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=De/v1LOvw5LzDRNbq4X/mZpXgCayIOs5BnbBcv4n6uA=; b=DQ/tJjGc0nBgGGZQnacDmKyNYpGKjgN9mGJgqTjXXk5eGBggqJ3G0qdOSHJTn/yA4O 0P2jm3IXdCD/clldCl8hIOmm+A9G1yYoufQxaENevvsIljIym5O+Sxh6aU+7OODMVn9y YP44Zk2CEiQBeX7Tqgx2NOc+n0eSw8G3tIpmgydH/7GSLHXs984pUQG6jFZwmt5NXQUm Q7Roj/XhhNqDK/XCMVRXZSCIW+VErCFDbLCUtpklPPGavWhlhJoIPoG1M4becPBahtb2 kvemUBC+05que+6P3pqdMRWAhZaXJnqSIeKglreq9zQquf/HszjQYlkL1v6vUpkLDZ8R V5yg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=R7yu90jm; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm5-20020a17090afa0500b0024728b38038si4933943pjb.72.2023.04.20.09.53.41; Thu, 20 Apr 2023 09:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=R7yu90jm; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232983AbjDTQcJ (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:09 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763714934765403531?= X-GMAIL-MSGID: =?utf-8?q?1763714934765403531?= 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; }; 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; }; /* 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 */ +#include #include #include #include @@ -88,8 +89,65 @@ static struct attribute_group psp_security_attr_group = { .is_visible = psp_security_is_visible, }; +#define version_attribute_show(name, _offset) \ +static ssize_t name##_show(struct device *d, struct device_attribute *attr, \ + char *buf) \ +{ \ + struct sp_device *sp = dev_get_drvdata(d); \ + struct psp_device *psp = sp->psp_data; \ + unsigned int val = 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[] = { + &dev_attr_bootloader_version.attr, + &dev_attr_tee_version.attr, + NULL, +}; + +static umode_t psp_firmware_is_visible(struct kobject *kobj, struct attribute *attr, int idx) +{ + struct device *dev = kobj_to_dev(kobj); + struct sp_device *sp = dev_get_drvdata(dev); + struct psp_device *psp = sp->psp_data; + unsigned int val = 0xffffffff; + + if (!psp) + return 0; + + if (attr == &dev_attr_bootloader_version.attr && + psp->vdata->bootloader_info_reg) + val = ioread32(psp->io_regs + psp->vdata->bootloader_info_reg); + + if (attr == &dev_attr_tee_version.attr && + psp->capability & PSP_CAPABILITY_TEE && + psp->vdata->tee->info_reg) + val = ioread32(psp->io_regs + psp->vdata->tee->info_reg); + + + if (val != 0xffffffff) + return 0444; + + return 0; +} + +static struct attribute_group psp_firmware_attr_group = { + .attrs = psp_firmware_attrs, + .is_visible = psp_firmware_is_visible, +}; + static const struct attribute_group *psp_groups[] = { &psp_security_attr_group, + &psp_firmware_attr_group, NULL, }; From patchwork Thu Apr 20 16:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp512210rwl; Thu, 20 Apr 2023 09:33:14 -0700 (PDT) X-Google-Smtp-Source: AKy350aalPZaG7Ilx2fYIJLenEBQI/fPG0ErYS/BAErNsKy3PgadosWEJgUCwiKB8nnSagxtQNwh X-Received: by 2002:a05:6a20:7345:b0:f0:84dd:4e94 with SMTP id v5-20020a056a20734500b000f084dd4e94mr3096329pzc.22.1682008394667; Thu, 20 Apr 2023 09:33:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682008394; cv=pass; d=google.com; s=arc-20160816; b=GkMOH6vceJMsJK/uHstSW88p7FmlpfjMiiPUPxHrevWZk7Gw5+bp6Jr0gwOYR9u1h4 OYffb+hOAcoeGVu65bR53p6nU3OtwkLHcfqX3tZyMM6ewgHlb2clRuYsvrXbPAsq+2Kh qjh/ROQxla02F7CMQDdOuLOjDiOshV/nXZl3kaLoRdU3n5A01NhsBmv4JYU9PyiN/Iet yLyRBGwDFtKfSO5nLDKMfZEiFZHn6gaXrJi/MVCd9mWUwYrbbtQwX3iSX7kkirxqdRm7 h/dQ+zCke6bULE31feVp7iL5jYFbs5ffGMElVEEpUfW7aISJzmbQVKAtS1PPq1L31cfx 99xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U13fFXEM07lJGuyTMo7PvjJrJ/WZmstRJ6eJu+3aEtM=; b=N90j5+nWMHEykI4jVbzAvqxSle4h5arh6BylTVgPPjpWYrpt1kT/IwgNt6N3b2sSfg nH/g9sESnIxdDkHyiRfdjDN+bcOBM1RDDGuZInKCZq76JAni5075sS1HLSPLNX+5u8AA w0+zywJlmmePMX8pgRhbpOLHQoVywSNo4h6lWLKIMLummhnO+VdKV7qRWkarfmxJTlTM EqwFEBcpU0TcE9KQj6slMcluWxTscNMw9fvaFCtgq7x/bjZbdW9uxdkYpHyRlPnUvfEu y2l3wnEpNXvGJ9U0D86UaIhLW4uFT2wEHJw1SPaTX2IcCuWCRpoi/EmjA+XiOf2S/m4D J3NQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=PIYhXMxU; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t145-20020a635f97000000b00517ac1a9a63si1953597pgb.129.2023.04.20.09.33.01; Thu, 20 Apr 2023 09:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=PIYhXMxU; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234668AbjDTQcY (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:24 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763713634290872832?= X-GMAIL-MSGID: =?utf-8?q?1763713634290872832?= 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 = { .cmdbuff_addr_hi_reg = 0x1054c, /* C2PMSG_19 */ .ring_wptr_reg = 0x10550, /* C2PMSG_20 */ .ring_rptr_reg = 0x10554, /* C2PMSG_21 */ + .info_reg = 0x109e8, /* C2PMSG_58 */ }; static const struct platform_access_vdata pa_v1 = { @@ -429,6 +430,7 @@ static const struct platform_access_vdata pa_v1 = { static const struct psp_vdata pspv1 = { .sev = &sevv1, + .bootloader_info_reg = 0x105ec, /* C2PMSG_59 */ .feature_reg = 0x105fc, /* C2PMSG_63 */ .inten_reg = 0x10610, /* P2CMSG_INTEN */ .intsts_reg = 0x10614, /* P2CMSG_INTSTS */ @@ -436,6 +438,7 @@ static const struct psp_vdata pspv1 = { static const struct psp_vdata pspv2 = { .sev = &sevv2, + .bootloader_info_reg = 0x109ec, /* C2PMSG_59 */ .feature_reg = 0x109fc, /* C2PMSG_63 */ .inten_reg = 0x10690, /* P2CMSG_INTEN */ .intsts_reg = 0x10694, /* P2CMSG_INTSTS */ @@ -444,6 +447,7 @@ static const struct psp_vdata pspv2 = { static const struct psp_vdata pspv3 = { .tee = &teev1, .platform_access = &pa_v1, + .bootloader_info_reg = 0x109ec, /* C2PMSG_59 */ .feature_reg = 0x109fc, /* C2PMSG_63 */ .inten_reg = 0x10690, /* P2CMSG_INTEN */ .intsts_reg = 0x10694, /* P2CMSG_INTSTS */ @@ -452,6 +456,7 @@ static const struct psp_vdata pspv3 = { static const struct psp_vdata pspv4 = { .sev = &sevv2, .tee = &teev1, + .bootloader_info_reg = 0x109ec, /* C2PMSG_59 */ .feature_reg = 0x109fc, /* C2PMSG_63 */ .inten_reg = 0x10690, /* P2CMSG_INTEN */ .intsts_reg = 0x10694, /* P2CMSG_INTSTS */ From patchwork Thu Apr 20 16:31:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp517040rwl; Thu, 20 Apr 2023 09:40:57 -0700 (PDT) X-Google-Smtp-Source: AKy350YuXbrS2UeZsfkVd6U68aAMS9r3i9PDVuyDnuu0pUwM87LNL+6xD+zyvdc+CljE26WwPWhI X-Received: by 2002:a17:903:1245:b0:19c:be03:d1ba with SMTP id u5-20020a170903124500b0019cbe03d1bamr2358509plh.6.1682008857479; Thu, 20 Apr 2023 09:40:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682008857; cv=pass; d=google.com; s=arc-20160816; b=KCnfYBmvfK73DQfRqxCAYmh2D6t904UhjPuuuCx8Z/+o+rCj/CfqJQ2IbilMJzDCF8 m0VAjno53xqWn8xXXQnakLKgA/Y57/34dh5X9QWkkenV7RvBL8zptEkdrfO30mP6SmQY opdKr1qm4CNtA5SczasJOt4/Ug9XgWHr2OPvvbs4ovcZrPJIoE+8ES8coLljnbaTx0KO u4kKrC4PATSS59aLXWNlRsho0LHtUpeAjYv9xTPvf1HH0AUe61UxTJU79mDSUHJdno+V JXJyLSBVB4Eq574vk4VHuMWP8irVN8Ci4fJUTgwA+ub6IUwe+cXs/Yh9eX3QKcgZVoZH qefA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uCK3UFN7kfeIWQFj87Ev9Xsr6tgtpWCv/5cTFSUBohk=; b=XMaGK3bMWQ1x0N1SpHXm4Wq4bNoQ+yaeWiF1FnBvyQaOBlwuaxy2vlBUuM5sR7aLe5 USulJUIy87Dwf9VV/yY0JameXZLt9bHlFge5dxHD0ZakYpILtjF1wEicn4wafPiOB6cC mksEheSudyo9cc/KqbFstGKO4U5tjS6FKwBiwHPks5RJiBAQkB+sSgvQypTYVjZEaAaw 9rZ5AiFqdMDjZIGYbdmrgY1E75pRR+1HarAqE7TEUxHA2FcknlqqBrIKxINuf3x4Zi6E R8eepbYyylYUSNaum9DRKb3ge/FAvO7o0aGxQuGcG7d3AE4rpsRQV1T8lwidFz+VBS/i h60A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IMt9MAyo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a17090341ca00b001a63d8efabasi2272508ple.445.2023.04.20.09.40.43; Thu, 20 Apr 2023 09:40:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IMt9MAyo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234540AbjDTQcQ (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:16 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763714119626463871?= X-GMAIL-MSGID: =?utf-8?q?1763714119626463871?= 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; } + /* master device must be set for platform access */ + if (psp->sp->set_psp_master_device) + psp->sp->set_psp_master_device(psp->sp); + ret = psp_init(psp); if (ret) goto e_irq; - if (sp->set_psp_master_device) - sp->set_psp_master_device(sp); - /* Enable interrupt */ iowrite32(-1, psp->io_regs + psp->vdata->inten_reg); From patchwork Thu Apr 20 16:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp525443rwl; Thu, 20 Apr 2023 09:55:30 -0700 (PDT) X-Google-Smtp-Source: AKy350YZRq1opcrH0abii3ZEotivrAv2KJ4tN1uDICC/9/GdlbTXHnln3ZXc9KgIFcZrucWaVfv5 X-Received: by 2002:a05:6a00:1796:b0:634:7ba3:d140 with SMTP id s22-20020a056a00179600b006347ba3d140mr2631683pfg.15.1682009730105; Thu, 20 Apr 2023 09:55:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682009730; cv=pass; d=google.com; s=arc-20160816; b=amjglbBzbBok9aGkYT61tpsUxf7+8nf8BvRlEXz5xbSng0wSl7tJlrtCOV2v6jdUib axJUHRPUX+Gh1hgp7dNhYoRvy1FeoqTEhJvOlt5n3V/UBprahfWWOgyAeaYG5HbEJAr0 3UWzQRzo6Kh0j2+qc//HXFMW53GT3/JrK9v5gAcJ20F/Fng0kAjADra2dbsW3EspcP0L 7axPp04paUlTsNXD3EUv3NybsffqNNeSbiBGS9wsl/88fb4u/2+mTsfpZFh042yIhG3y JrpuD+3w3FiyQFzKHxackUgyZuN04sOoJ/GgozKmFbdtKl/i0qokp5ynIwXSXzcDrjYg BF3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=txvBajt/5EvVuThow0jZ0mElcV+mRhSy/U+22CFaFCA=; b=Z7ZKQWM86ugBOdiWWy2KMFUzBzQesM4g8BvIDq7azdnTq7mk56Rzy5WYRi0TNEfIAO kH4wZ9CLdEthQ35iXjv6ACURgSNTUsIf5QnuB6JuxsrTZflL+78TDMF142CniFF2YuVk 4FQxeNxAcpAzMOfx7XTBYng3JMZhctRL2DgZfSVSSuO0hhViiGEX9kMbnHP9wmOVw3sr KkcR05GTcF3awvWYy5A6QLYOvzDZ7sSVl1G1umpTp3OvnVgDe5fBJB8Lb0123CZJO6kz N65Tw31Sh77+UYO4TE/6Sp5VRO/CeFfUcI242ptA10U09OX4Q66KuE2dF8Wbshdefr89 OJTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=I+uEJV6B; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 75-20020a62184e000000b0063b5c5ccbb3si2098442pfy.31.2023.04.20.09.55.16; Thu, 20 Apr 2023 09:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=I+uEJV6B; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234708AbjDTQc1 (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:27 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763715034811202232?= X-GMAIL-MSGID: =?utf-8?q?1763715034811202232?= 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) += sp-pci.o ccp-$(CONFIG_CRYPTO_DEV_SP_PSP) += psp-dev.o \ sev-dev.o \ tee-dev.o \ - platform-access.o + platform-access.o \ + dbc.o obj-$(CONFIG_CRYPTO_DEV_CCP_CRYPTO) += ccp-crypto.o ccp-crypto-objs := 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[] = { + {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 = 0; + ret = psp_send_platform_access_msg(msg, (struct psp_request *)dbc_dev->mbox); + if (ret == -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 = 0; error_codes[i].psp; i++) { + if (dbc_dev->mbox->req.header.status == 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 = sizeof(dbc_dev->mbox->dbc_nonce); + ret = send_dbc_cmd(dbc_dev, PSP_DYNAMIC_BOOST_GET_NONCE); + if (ret == -EAGAIN) { + dev_dbg(dbc_dev->dev, "retrying get nonce\n"); + ret = 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 = psp->dbc_data; + + if (!dbc_dev) + return; + + misc_deregister(&dbc_dev->char_dev); + mutex_destroy(&dbc_dev->ioctl_mutex); + psp->dbc_data = NULL; +} + +static long dbc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + struct psp_device *psp_master = psp_get_master_device(); + void __user *argp = (void __user *)arg; + struct psp_dbc_device *dbc_dev; + int ret; + + if (!psp_master || !psp_master->dbc_data) + return -ENODEV; + dbc_dev = 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 = -EFAULT; + goto unlock; + } + + ret = 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 = -EFAULT; + goto unlock; + } + break; + default: + ret = -EINVAL; + + } +unlock: + mutex_unlock(&dbc_dev->ioctl_mutex); + + return ret; +} + +const struct file_operations dbc_fops = { + .owner = THIS_MODULE, + .unlocked_ioctl = dbc_ioctl, +}; + +int dbc_dev_init(struct psp_device *psp) +{ + struct device *dev = psp->dev; + struct psp_dbc_device *dbc_dev; + int ret; + + if (!PSP_FEATURE(psp, DBC)) + return 0; + + dbc_dev = 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 = (void *)devm_get_free_pages(dev, GFP_KERNEL, 0); + if (!dbc_dev->mbox) { + ret = -ENOMEM; + goto cleanup_dev; + } + + psp->dbc_data = dbc_dev; + dbc_dev->dev = dev; + + ret = send_dbc_nonce(dbc_dev); + if (ret == -EACCES) { + dev_dbg(dbc_dev->dev, + "dynamic boost control was previously authenticated\n"); + ret = 0; + } + dev_dbg(dbc_dev->dev, "dynamic boost control is %savailable\n", + ret ? "un" : ""); + if (ret) { + ret = 0; + goto cleanup_mbox; + } + + dbc_dev->char_dev.minor = MISC_DYNAMIC_MINOR; + dbc_dev->char_dev.name = "dbc"; + dbc_dev->char_dev.fops = &dbc_fops; + dbc_dev->char_dev.mode = 0600; + ret = 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 = 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" struct psp_device *psp_master; @@ -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 = dbc_dev_init(psp); + if (ret) + dev_warn(psp->dev, "failed to init dynamic boost control: %d\n", + ret); } static int psp_init(struct psp_device *psp) @@ -214,6 +221,8 @@ void psp_dev_destroy(struct sp_device *sp) tee_dev_destroy(psp); + dbc_dev_destroy(psp); + platform_access_dev_destroy(psp); 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; 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 +#define PLATFORM_FEATURE_DBC 0x1 + +#define PSP_FEATURE(psp, feat) (psp->vdata && psp->vdata->platform_features & 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; }; /* 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 = { .feature_reg = 0x109fc, /* C2PMSG_63 */ .inten_reg = 0x10690, /* P2CMSG_INTEN */ .intsts_reg = 0x10694, /* P2CMSG_INTSTS */ + .platform_features = PLATFORM_FEATURE_DBC, }; static const struct psp_vdata pspv4 = { diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platform-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 = 0x0, PSP_I2C_REQ_BUS_CMD = 0x64, + PSP_DYNAMIC_BOOST_GET_NONCE, }; 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__ */ From patchwork Thu Apr 20 16:31:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp524037rwl; Thu, 20 Apr 2023 09:53:07 -0700 (PDT) X-Google-Smtp-Source: AKy350Ymhh9JCY8lahrPWywMdy7Q3Bf2P9kQ37FW4aXgU/2HIaKi5CggFTIhk3AV2hRPrMuIoEZO X-Received: by 2002:a17:90b:1256:b0:246:ba3f:4f3e with SMTP id gx22-20020a17090b125600b00246ba3f4f3emr2290415pjb.6.1682009587633; Thu, 20 Apr 2023 09:53:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682009587; cv=pass; d=google.com; s=arc-20160816; b=eIE4jSZFb1LK8L6haYlM06CGwD55TXYZwLdjxI9o1MO2e3zVbM3gMMYdHAYvQKz542 QlkclwTZqfaAotokb7xDY6JZgXCqmYL2sli8jlYWXGqNORlUG1/Mehn24tAwqlYKHp4+ dhZm8Zvt9JCts/rHvyBSzxUaEXt2hFcMIw5cqOeVyVI1R2ViPS7p/lyQ5PtXqPOGcA9i Ry8y35JfuAh1mYuhb4jtiRqLSz0B0KV8cgejLtdUMMNx9TgL7FPFj9D2NWF3gF7y7V87 nPve1QspjcY/Mqv6d7x4MiSCKZMJ7K6NTH/gH5VbXFSZfSw1t63YDa6cFDMkeyZjHCsf ypog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/AxmwsspBY+a02inqk/oy2ghT7n4ZQQaI56gq4KLeQM=; b=zFNrmW9P8sNzeLVNYJXSVowg/+p7UlfNXAL588QL57O/xlDr5bTZ6RzOJ9Ruy6AjfF W48G7x0tw8TPkXjQerb/DSbhSvhaMKbxNpEXBnqJPTIW1aTPrLklbrTXvTOKAc56KpSR AX2J7jPsB7InComw0w1BaSZFgEhi0zA95CqeSu4aa+j9jF9QB6Tcgf907WmgLKchyEkF b6vG/izHcBphcULM+6G35ZfamwDj1Tn9HC/kYJjPsh6xViNX5p8baA+RrYSj8ynhP2rL PxeFB/vB9jJDj2BzT45/lKNOXO80M0wUHZ5ocfegi98rDq5iLbUvlM0XyWiFqxVPXpJv JgLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=h7V9aiF7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a17090a738e00b00246799bf0c2si2149855pjg.187.2023.04.20.09.52.55; Thu, 20 Apr 2023 09:53:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=h7V9aiF7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234732AbjDTQcb (ORCPT + 99 others); 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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763714885000920831?= X-GMAIL-MSGID: =?utf-8?q?1763714885000920831?= 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 = 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 = -EFAULT; + goto unlock; + } + + ret = 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 = -EFAULT; + goto unlock; + } + break; default: ret = -EINVAL; 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; +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; }; void dbc_dev_destroy(struct psp_device *psp); diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platform-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 = 0x0, PSP_I2C_REQ_BUS_CMD = 0x64, PSP_DYNAMIC_BOOST_GET_NONCE, + PSP_DYNAMIC_BOOST_SET_UID, }; 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 @@ #define DBC_NONCE_SIZE 16 #define DBC_SIG_SIZE 32 +#define DBC_UID_SIZE 16 /** * struct dbc_user_nonce - Nonce exchange structure (input/output). @@ -34,6 +35,16 @@ struct dbc_user_nonce { __u8 signature[DBC_SIG_SIZE]; } __packed; +/** + * 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) +/** + * 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__ */ From patchwork Thu Apr 20 16:31:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp512642rwl; Thu, 20 Apr 2023 09:33:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtPPYihPQU0CvPMlUiGj6+lsacaLA477mcfQUHCrW5XIqxBebj75gL5+8pPyfchilR8Fa8 X-Received: by 2002:a17:90a:ad82:b0:247:5bb4:f445 with SMTP id s2-20020a17090aad8200b002475bb4f445mr2249462pjq.29.1682008433949; Thu, 20 Apr 2023 09:33:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682008433; cv=pass; d=google.com; s=arc-20160816; b=t2vqNrYZbdtdqGgtm8euueLhbzXLpdQCXlPHDN8efT3Gb6us6hUheAdFcCzg996aBE FdxyTIGjFXJIvmW3h9FpKDi7J3xoA+nLbTLeUYFyd5PEQ7N01Z3ht68Jade1hpaOQo9G vI29OJRiwt2BVolM/Eo1rHQ3xIpE3lYkVwXS6t3cHNql2qixml586JYaTxjrSvcRwY3b UYWFANOntO5G9TrL+vjK2ACNy/zRjl/IBySIM44hnHMVFpIWARvRNv7vGuUZ+SZiV5Vx b7wpP5oBGl5bBkRrN5e2/XDLHJtw2rXEhCmBYolsBjiWuAeCk0hBm0do11xfFMrSy7CD Edkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aS8JSioac+K5cQTdnoc+oQ3hySJkWDuNq/W398kLq/w=; b=c0xbGinXhh9qIffUJK3FS9jHg8pyObzm+FWA+aFyX/ZDlAZ4RG0g/4o3GVrIj9nW9f oKTEvjWMmX9uPtS0sWDxDcZDkkXfN7wVah2kL8Dc7t2/ct19xNH3ieUN9nggUAYHQgpt CXi/8CkEiIcg9E7Laq68LjJAgwrNaLZ0ERdimVOWhA3BOWSBmG09sSD2LMLpjLcOBhO5 tDN7AsrHhqdJwMv61EiYhOwyld6oFdC+Lqoc4U89F+mI47UgzZWzEZVEjcP6lxzvsvoH 6VLxRDqNo/geazG0RzQrat8ApIkltNa+kQMB1dUXQ/ogUY2rq/rjF0bsVqwVyxlT1ksO P2Mw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=44kW31ep; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f24-20020a635118000000b00513a2e4d889si1937857pgb.475.2023.04.20.09.33.41; Thu, 20 Apr 2023 09:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=44kW31ep; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234765AbjDTQcd (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:33 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763713675382136689?= X-GMAIL-MSGID: =?utf-8?q?1763713675382136689?= 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; } +static int send_dbc_parameter(struct psp_dbc_device *dbc_dev) +{ + dbc_dev->mbox->req.header.payload_size = sizeof(dbc_dev->mbox->dbc_param); + + 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 = 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 = -EFAULT; + goto unlock; + } + + ret = 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 = -EFAULT; + goto unlock; + } + break; default: ret = -EINVAL; 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; +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; }; void dbc_dev_destroy(struct psp_device *psp); diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platform-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 = 0x64, PSP_DYNAMIC_BOOST_GET_NONCE, PSP_DYNAMIC_BOOST_SET_UID, + PSP_DYNAMIC_BOOST_GET_PARAMETER, + PSP_DYNAMIC_BOOST_SET_PARAMETER, }; 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; +/** + * 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) +/** + * DBCIOCPARAM - Set or get a parameter from the PSP. + * This request will only work after DBCIOCUID has successfully + * 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 results. + */ +#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 = 0x3, + PARAM_SET_FMAX_CAP = 0x4, + PARAM_GET_PWR_CAP = 0x5, + PARAM_SET_PWR_CAP = 0x6, + PARAM_GET_GFX_MODE = 0x7, + PARAM_SET_GFX_MODE = 0x8, + PARAM_GET_CURR_TEMP = 0x9, + PARAM_GET_FMAX_MAX = 0xA, + PARAM_GET_FMAX_MIN = 0xB, + PARAM_GET_SOC_PWR_MAX = 0xC, + PARAM_GET_SOC_PWR_MIN = 0xD, + PARAM_GET_SOC_PWR_CUR = 0xE, +}; + #endif /* __PSP_DBC_USER_H__ */ From patchwork Thu Apr 20 16:31:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp514382rwl; Thu, 20 Apr 2023 09:36:24 -0700 (PDT) X-Google-Smtp-Source: AKy350ZIa6PMVZxrCYH2FgjsQ8Ph5iZiEWKOWzRXYB6DfmdtlScEf14FpsI4oqz0k/F3b2fVNS+j X-Received: by 2002:a05:6a20:43a8:b0:ef:7d7b:433a with SMTP id i40-20020a056a2043a800b000ef7d7b433amr2555484pzl.47.1682008583794; Thu, 20 Apr 2023 09:36:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682008583; cv=pass; d=google.com; s=arc-20160816; b=DLENH0XDKxe/BhlpPpX7WRYDIlzdHUSlsPZiSb+8w7bDkqQKq0UrEGOvtzQMP3e2/l hsx8sxyRklWGVW26lwMB/BipEY94XhNo3Mx4lVrp3vyU64xLtpd1ukV6SI0CAW7qy36W k71EL0eC6WmQ7F8oJlziNdceLMXLQ0eLZqYPRL9oBRYBo7RxJlzRU22HD+fb+gQ0RLtP SacxLLv5MkqLMEc3jGyENtU2g2vi34SGRFkY+RLiuUEWn/kgNi7ozaiJICizU4R0OiLw JmAJjWsVx3tOeXJRD03WrF8Q7c8T0m1CaPAfVV/q10K3gzuXnUn/B7w+JIoH6XXRnhnJ Q7DQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lJ2R7p1+EheZHnyiiVN2R3UsfUXuzN8/4nby8MGswZg=; b=W3lK8ruWwNPC/oBmcGyKRMDmoRVyDqN5bknp2c5d8S6KzjCS7JPh/dPfX57vJJDjog tT2+DFQS9GF286VuVTknYs/CKoYwfJdfoeqMDc/tSFltbg2PddUk19lIN4iN8sDee3uJ yCYWVW7dyXxVudbwVDGL/Ylj4dK4XxlSFdivK/Qc3+nBxwzJ/tZ06PJGzdXYh+50zaSE 3mHVcpHt7SNJhif+W4tbq+l2sWAcOoP6gkX+qeJBQXq2SPzg5QMrTKiwWBq6HPtaay9k AVgtNB57cKo61GRL6fWWa23xasJsl7jJ5KmRNMUkkS3B7x6PeXbkPR60x7ChG6GhU4C/ Tkcw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zwnLoZhl; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f24-20020a635118000000b00513a2e4d889si1937857pgb.475.2023.04.20.09.36.10; Thu, 20 Apr 2023 09:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zwnLoZhl; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234827AbjDTQco (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:44 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763713833048603453?= X-GMAIL-MSGID: =?utf-8?q?1763713833048603453?= 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 = 16 +DBC_NONCE_SIZE = 16 +DBC_SIG_SIZE = 32 + +PARAM_GET_FMAX_CAP = (0x3,) +PARAM_SET_FMAX_CAP = (0x4,) +PARAM_GET_PWR_CAP = (0x5,) +PARAM_SET_PWR_CAP = (0x6,) +PARAM_GET_GFX_MODE = (0x7,) +PARAM_SET_GFX_MODE = (0x8,) +PARAM_GET_CURR_TEMP = (0x9,) +PARAM_GET_FMAX_MAX = (0xA,) +PARAM_GET_FMAX_MIN = (0xB,) +PARAM_GET_SOC_PWR_MAX = (0xC,) +PARAM_GET_SOC_PWR_MIN = (0xD,) +PARAM_GET_SOC_PWR_CUR = (0xE,) + +DEVICE_NODE = "/dev/dbc" + + +class _dbc_get_nonce(ctypes.Structure): + _fields_ = [ + ("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_ = [ + ("uid", ctypes.c_uint8 * DBC_UID_SIZE), + ("signature", ctypes.c_uint8 * DBC_SIG_SIZE), + ] + + +class _dbc_param(ctypes.Structure): + _fields_ = [ + ("msg_index", ctypes.c_uint32), + ("parameter", ctypes.c_uint32), + ("signature", ctypes.c_uint8 * DBC_SIG_SIZE), + ] + + +DBCIOCNONCE = IOWR(ord("D"), 0x01, _dbc_get_nonce) +DBCIOCUID = IOW(ord("D"), 0x02, _dbc_set_uid) +DBCIOCPARAM = IOWR(ord("D"), 0x03, _dbc_param) + + +def get_nonce(device, signature): + nonce = _dbc_get_nonce() + if signature: + nonce.auth_needed = 1 + tmp = ctypes.c_ubyte * len(signature) + nonce.signature = tmp.from_buffer_copy(bytes(signature, "ascii")) + result = fcntl.ioctl(device, DBCIOCNONCE, nonce, True) + if result < 0: + raise IOError(result) + return nonce + + +def set_uid(device, new_uid, signature): + uid = _dbc_set_uid() + if not signature: + raise ValueError("Signature required") + if not new_uid: + raise ValueError("UID required") + tmp = ctypes.c_ubyte * len(signature) + tmp2 = ctypes.c_ubyte * len(new_uid) + uid.signature = tmp.from_buffer_copy(bytes(signature, "ascii")) + uid.uid = tmp2.from_buffer_copy(bytes(new_uid, "ascii")) + result = fcntl.ioctl(device, DBCIOCUID, uid, True) + if result < 0: + raise IOError(result) + return True + + +def process_param(device, message, signature, data=None): + param = _dbc_param() + if not signature: + raise ValueError("Signature required") + if type(message) != tuple: + raise ValueError("Expected message tuple") + tmp = ctypes.c_ubyte * len(signature) + param.signature = tmp.from_buffer_copy(bytes(signature, "ascii")) + param.msg_index = message[0] + if data: + param.parameter = data + result = 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 = { + 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 = { + "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 = argparse.ArgumentParser( + description="Dynamic Boost control command line interface" + ) + parser.add_argument( + "command", + choices=["get-nonce", "get-param", "set-param", "set-uid"], + help="Command to send", + ) + parser.add_argument("--device", default="/dev/dbc", help="Device to operate") + parser.add_argument("--signature", help="Signature for command") + parser.add_argument("--message", choices=messages.keys(), help="Message index") + parser.add_argument("--data", help="Argument to pass to message") + parser.add_argument("--uid", help="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__ == "__main__": + args = parse_args() + data = 0 + if not os.path.exists(args.device): + raise IOError("Missing device {device}".format(device=args.device)) + if args.signature and len(args.signature) != DBC_SIG_SIZE: + raise ValueError( + "Invalid signature length %d (expected %d)" + % (len(args.signature), DBC_SIG_SIZE) + ) + if args.uid and len(args.uid) != DBC_UID_SIZE: + raise ValueError( + "Invalid UID length %d (expected %d)" % (len(args.uid), DBC_UID_SIZE) + ) + if args.data: + try: + data = int(args.data, 10) + except ValueError: + data = int(args.data, 16) + + with open(args.device) as d: + if args.command == "get-nonce": + try: + nonce = get_nonce(d, args.signature) + print("Nonce: %s" % _pretty_buffer(bytes(nonce.nonce))) + except OSError as e: + pretty_error(e.errno) + elif args.command == "set-uid": + try: + result = set_uid(d, args.uid, args.signature) + if result: + print("Set UID") + except OSError as e: + pretty_error(e.errno) + elif args.command == "get-param": + if not args.message or args.message.startswith("set"): + raise ValueError("Invalid message %s" % args.message) + try: + param = process_param(d, messages[args.message], args.signature) + print( + "Parameter: {par}, response signature {sig}".format( + par=param.parameter, + sig=_pretty_buffer(bytes(param.signature)), + ) + ) + except OSError as e: + pretty_error(e.errno) + elif args.command == "set-param": + if not args.message or args.message.startswith("get"): + raise ValueError("Invalid message %s" % args.message) + try: + param = process_param(d, messages[args.message], args.signature, data) + print( + "Parameter: {par}, response signature {sig}".format( + par=param.parameter, + sig=_pretty_buffer(bytes(param.signature)), + ) + ) + except OSError as e: + pretty_error(e.errno) From patchwork Thu Apr 20 16:31:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp525190rwl; Thu, 20 Apr 2023 09:54:59 -0700 (PDT) X-Google-Smtp-Source: AKy350ahNncCEN11aUATven9m0zi+nhte3myf1VDkKp/YXGHb2NJuEt3OhVaYSGrCDpFp/2b9Y9l X-Received: by 2002:a17:902:e548:b0:19c:a9b8:4349 with SMTP id n8-20020a170902e54800b0019ca9b84349mr2570430plf.32.1682009699498; Thu, 20 Apr 2023 09:54:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682009699; cv=pass; d=google.com; s=arc-20160816; b=j1jnFkGo/DkugFBg3CrYQKEkbDs7TiN5oxmTrVzne1ZK0nPb568bUAB4a+NB9mBK90 gtxVay/5dPGMOPUyU8Mzu9lUFfxEyGm1syEGYEXwFeUY4eVEl5xcosL+FnuRvS90CnJ5 TIuUYglIoq20WeuNZhGq8tA7qWajKVqYthlUea7mW9fVoPJQ/p1WiuengPaMAbxgKhBw ZbVIhyRzHESoPGl0dwS+WTGffqiata6B4247cIKP6nFDRoAn8ho1cazhPU4JN6YFzAyu /urZHmxtpbkao19EszPufgAwaTpTq1Yio6JIWNoQd1TeZlzm1q0YdTGTz6CdcxCtWaiD R5fQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dsLohCXeKuWWsdVkE72Ow68aKRakDV7sRhzRtAZBwgE=; b=BPadT8KamCiacB4nY4LLv7nF+eilXRhHbxtRbA6LGxJWk+Ti6stzIIM1mc7bJZVIqz +0GpCAgMVuhhLW/8HlBACOxbYgumsG5RkC7pnjCfCUo3O1h2GPrpXONfoWFIzsWyAX8B zDZytNMIj/0sMjWeLyKLilsqm08/upi0Qa6RWHXELaVk6Q8ji+Mwg6lxdok2aeaA6DHV Tpzj7kGA9/S3V0nWHv6YoFNzOij+HLLcG/sswJ98aY8Fa/GDvBE/A6IEmfh5Lk8XAh1C Q10hdkmpQQ5xmsfdw11NlmrMZRqmftD93iSJTRHi/3lCt5XL0LUzmDharO2AaB5Iwht1 lWqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Rnphb6Nu; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170902784c00b001a27afc07d9si2048077pln.146.2023.04.20.09.54.44; Thu, 20 Apr 2023 09:54:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Rnphb6Nu; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234856AbjDTQdS (ORCPT + 99 others); Thu, 20 Apr 2023 12:33:18 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763715002697395758?= X-GMAIL-MSGID: =?utf-8?q?1763715002697395758?= 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 = 0.5 + + +class invalid_param(ctypes.Structure): + _fields_ = [ + ("data", ctypes.c_uint8), + ] + + +def system_is_fused() -> bool: + fused_part = 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()) == 1 + return True + + +class DynamicBoostControlTest(unittest.TestCase): + def __init__(self, data) -> None: + self.d = None + self.signature = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + self.uid = "1111111111111111" + super().__init__(data) + + def setUp(self) -> None: + self.d = 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 = invalid_param() + self.data.data = 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 = 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 = 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 = 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 = 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 = 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 = process_param(self.d, PARAM_GET_SOC_PWR_MAX, self.signature) + soc_power_min = process_param(self.d, PARAM_GET_SOC_PWR_MIN, self.signature) + self.assertGreater(soc_power_max.parameter, soc_power_min.parameter) + + # fmax + fmax_max = process_param(self.d, PARAM_GET_FMAX_MAX, self.signature) + fmax_min = process_param(self.d, PARAM_GET_FMAX_MIN, self.signature) + self.assertGreater(fmax_max.parameter, fmax_min.parameter) + + # cap values + keys = { + "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 = 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 = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature) + + # set the fmax + target = original.parameter - 100 + process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, target) + time.sleep(SET_DELAY) + new = 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 = 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 = process_param(self.d, PARAM_GET_PWR_CAP, self.signature) + + # set the fmax + target = original.parameter - 10 + process_param(self.d, PARAM_SET_PWR_CAP, self.signature, target) + time.sleep(SET_DELAY) + new = 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 = 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__ == "__main__": + unittest.main() From patchwork Thu Apr 20 16:31:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 85954 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp517569rwl; Thu, 20 Apr 2023 09:41:51 -0700 (PDT) X-Google-Smtp-Source: AKy350ZN9XjRnFbWdALbpm/mb83PcMYfcQyPqpu+42LQjezlggqlRs9fw4C/RcfTInCxbGLqJsVe X-Received: by 2002:a05:6a20:d699:b0:f0:1386:2f83 with SMTP id it25-20020a056a20d69900b000f013862f83mr2875452pzb.49.1682008911125; Thu, 20 Apr 2023 09:41:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682008911; cv=pass; d=google.com; s=arc-20160816; b=mBNNqE1AlRNUavKAxqv+yeP+ZWrn8rl8md6+vVG+HIYOViFLfF50zf0nCm9tMbTBu7 DWcZeBX1NTLUHBXFTnL28vgU65PQp/LqECiRsprBYI3ocbCdBFRUUC2X/02yTA30Ccxk w0nPnMO/gXmJSNgSyOfWF3e/XuXcInypbwvhzuKKOlJ7CiwfdJHAjkgSIGGci2qeEbZy g9b4nsDIVZLErazVI7KsQRUisJ3d3Ip72HUrJQxU3xyUZIhlb4rEQfixfLhfAaaQGlFm fcLI4YANudMpKjwKJybwt5cZSMgnJhzTwFCLhCav8DCZAchJlwtw0C81K71GspBGc9Rm dUnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sHybiOC7Pf0gITiZl7S51v7l9OkBzy7ZYhRpPscQGGk=; b=piPOFvl+ZB9kFVmvK/KqABO/aqVINBpWD+1Z3rUlbr3hYTyYrsZuRppvfWArqGzzU/ uEDplMV7f6oMvWIVw5hl5ABxAPPXvF7MPdOZKTxHTT/wi19VrxShWD+z5Vlp+YTBqXvw dvn6nKiihBrNEttjwCBWisP3KyTYabK/7ktNmEaiB75a4YDS4NW0mahO/ok3IHPvRtkM K1X5oZ3yTYoCXwhuZm0/0s56kWawPx0VTxq2zzcKN77vF9aBZue+taCCnDx6JzDMxuOV EN3ZZxoitFKZMbiAV9sRAnHo0/RlML6da12Xtp7SONJoEf9EX6cZPUJUJK+sVjGwUt/1 /s2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=aOdCI7Tr; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a63d805000000b0050f692470fasi2012639pgh.301.2023.04.20.09.41.37; Thu, 20 Apr 2023 09:41:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=aOdCI7Tr; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234651AbjDTQcm (ORCPT + 99 others); Thu, 20 Apr 2023 12:32:42 -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 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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763714175980367618?= X-GMAIL-MSGID: =?utf-8?q?1763714175980367618?= 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 +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