From patchwork Wed Feb 7 21:54:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 198099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2536535dyb; Wed, 7 Feb 2024 14:14:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWPukHz4gnpee6wH3z8W4GjyZzX0Thnft65uOgQu5RzTfyuE4CDPUk0mopQWL4dsShW/iQKtDfmzAkFZlLj5gZ4ZDmpMA== X-Google-Smtp-Source: AGHT+IHkbpxIVXGfr6YmRVXsiEkoeBxeS71CbHqQWsWAgF5gr8f55hrL4eW6VptAobmkLJe1av8M X-Received: by 2002:a17:903:2344:b0:1d9:3bb5:2819 with SMTP id c4-20020a170903234400b001d93bb52819mr7983956plh.34.1707344085117; Wed, 07 Feb 2024 14:14:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXvKveYInaWpAL0QJAZq8zPpTlkOpslXDCnQK//wiJ7vja53fHESYn6roc7F05fhhIpGKd8RZcek472jwQRpU8nn026NA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y9-20020a17090264c900b001d4931a0bfcsi2388214pli.638.2024.02.07.14.14.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 14:14:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57243-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=KMRNXkhn; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-57243-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57243-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E8318282988 for ; Wed, 7 Feb 2024 22:13:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EC2313A884; Wed, 7 Feb 2024 21:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="KMRNXkhn" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24AFA82C64; Wed, 7 Feb 2024 21:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707342912; cv=fail; b=HI5rK065B3luFveWXm1F74siQC5DbbWrnb6l4smJzd53HFg8Kl7o+EkfeSKZ/dQjyVjPl3sGCVfm3E0UrMzqSDKXjGb9hjkBI1LMVfyoFPj0gecJ4bn84CrhvtWoZ400O84EQ286y8sAJGGwIgpF/9Npj6suacnxMCLsznMJ7wg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707342912; c=relaxed/simple; bh=VU4zPRfB7b4+rvHXjmvJBy2lGsauUIlnAeJKZnv+UgY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=SBLW0KWvc5vVXGchN1/VlLW647c7gAnshPYA+279PisCBx1MJ9hyhZGAPg9Axd8ML43085HIKzhsXvda5aF1Aaba3afFM7V4et4e6aOekzNE4+3xewc8OeZXnt4GjWeEhrE1l9oYpgvabiIQldWYLHngUIW2aXg2OY3j9666Eiw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=KMRNXkhn; arc=fail smtp.client-ip=40.107.93.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRoFsRQKGZKUMHhCbz2ROBpJ8lNtGFj8YLW1+bIHv3LwpVoFi/o6KwloB3rfJKWLaki3u5K9TrWrYqVH2sa+6Ih/rEYxqEo/WkpA1a5LFpwMPK6fyEVJIkq/x/9fs9YEdOwWSGAgfUHVdSFEEMBmlQgT8JlRzzkjd2n4CKGx1VRA1elqRrVprYxNVyqemRO/5oMZqUQVoiyyMUvqQG9jRpbJumXtd7fTu1E7YzE5z/9if68SL4sWdxQe5Dr/LHAa/4OE7I4KCLD1dA30uhTftT5EziRc93CcKtkLCAzAtrdgKxUz7cm7sG9W7I6JdR3NY3DTm+iqDDR+kbBnUsYeUg== 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=JMxiM99AxPAWOXtJyuakmfTl+99g4pIScw6r4JFl/6Q=; b=H6MZkoKl1ejih6LyNBalPj6colLxjOX3MLjh5JawliV3nkgwaVnyQxxrAHqlGxJqix2vlDlnZpH6oxPtmhS/cOjtlwi/GDiTHcQCEJXDHDgyr7vD7u04JwaRGaWM0fw20sPrtQ8s/EcsHn2tQdht85X+p4NYACX2yqkAdWcZOaemJVaVAxO5BYXYDksY2VXGIvW0tGxPMzKAN/vWm9i1DZKat8fHmWY2MAwpb6htEVTwvK/3Ep4sG9iZY3hPrxcgWs6AJ2rOC/0WE5pbtaDnfNhTrzV2XG+iaIQF0sKT5hp7TMgdHsoHPmPzhPKxSrlHa2NLryKzSfjQi6NNfID2WA== 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 (0) 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=JMxiM99AxPAWOXtJyuakmfTl+99g4pIScw6r4JFl/6Q=; b=KMRNXkhn96vWyp9JcnsDhQjJP8PJcO7u1GGWW4oXbovdhok/numg9Z3vCZ7U7qAY/b4NZb5OyjQt4oTJJbOmZckQ5Je1kX2Jql5N8AvlDvJ2bOTWj9+/3nmo+Zq38Vh+1PFfXCp5Vg4Fmi5rWrj6AvKn/YdbsIh7PU/afRrMrl4= Received: from CH0PR03CA0422.namprd03.prod.outlook.com (2603:10b6:610:10e::19) by MW4PR12MB7263.namprd12.prod.outlook.com (2603:10b6:303:226::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.8; Wed, 7 Feb 2024 21:55:07 +0000 Received: from CH3PEPF0000000A.namprd04.prod.outlook.com (2603:10b6:610:10e:cafe::e5) by CH0PR03CA0422.outlook.office365.com (2603:10b6:610:10e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.38 via Frontend Transport; Wed, 7 Feb 2024 21:55: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 CH3PEPF0000000A.mail.protection.outlook.com (10.167.244.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Wed, 7 Feb 2024 21:55:05 +0000 Received: from AUS-P9-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.2507.34; Wed, 7 Feb 2024 15:55:01 -0600 From: Mario Limonciello To: Herbert Xu CC: Mario Limonciello , Tom Lendacky , John Allen , "open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DB..." , open list , "Tim Van Patten" Subject: [PATCH 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg() Date: Wed, 7 Feb 2024 15:54:38 -0600 Message-ID: <20240207215439.95871-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: CH3PEPF0000000A:EE_|MW4PR12MB7263:EE_ X-MS-Office365-Filtering-Correlation-Id: b793ba3a-c491-4de3-f336-08dc282771fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ANPTg5sPrphLD9JhDgzwfG3t+JkKhzioEyOiqcHfcmckWORl62VEcdiJuO5ntuG1eKKP/vOmrlcZ/kgSZZQc8jvqSvyRGgkVRzs7h9nz90i/24V1gfEngbtuPQPZ3POVCghJg6YhPQrsUXkarHO/ajfbswa3iaSVTJDefcOJI98ABmokNvAI+PkFl1dYFe5B8UyNNs5ISE2MvVXkTCUedF13Zoc7+NAytSP9ncs+Fmss6+IwSPqlBflohEg9U2j7gD7y9j9wGbGfBifzoP54O+QcG0kfXt2QOUdKVbmkB9If2+jLpE4+vBbGohxIAoAAz37ssRJYs7wbVY5D3GaMSyK6Jid82ZXoulWvACBgJPDOQE0dD5O+qWzc7ncF3aaIgImBKptlMuifZrGl6ul/SQW+Sa1XiWvn91EfG9ryvQp/wHGjL8OgCMWpPDXipmNjOeGhCcmCkHR2nc/UDfmGIRe3k6ol6d/O0FqAP2wHliVC4TjnXxuIDUadDCO05tFo/zk3GjpVJaylSjl/+7WIPSrzp3AvcTqH5jhxi7HZO+8vO9N2akfQVL+Q+0oLeQhgF0bjCncu6uqGPv3QHxaMhz6DZqvSMBAFrOoMKc7nknU= 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:(13230031)(4636009)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(1800799012)(451199024)(64100799003)(82310400011)(186009)(36840700001)(40470700004)(46966006)(41300700001)(54906003)(70206006)(70586007)(316002)(6916009)(5660300002)(2906002)(8936002)(8676002)(4326008)(36756003)(44832011)(83380400001)(356005)(81166007)(82740400003)(7696005)(426003)(336012)(6666004)(478600001)(16526019)(2616005)(26005)(1076003)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 21:55:05.9221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b793ba3a-c491-4de3-f336-08dc282771fb 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: CH3PEPF0000000A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7263 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790280031393829656 X-GMAIL-MSGID: 1790280031393829656 When the PSP_CMDRESP_STS field has an error set, the details of the error are in `req->header->status`, and the caller will want to look at them. But if there is no error set then caller may want to check `req->header->status` separately. Stop discarding these errors. Reported-by: Tim Van Patten Fixes: 7ccc4f4e2e50 ("crypto: ccp - Add support for an interface for platform features") Signed-off-by: Mario Limonciello Tested-by: Tim Van Patten --- drivers/crypto/ccp/platform-access.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 94367bc49e35..792ae8d5b11a 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -120,7 +120,8 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, /* Store the status in request header for caller to investigate */ cmd_reg = ioread32(cmd); - req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg); + if (FIELD_GET(PSP_CMDRESP_STS, cmd_reg)) + req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg); if (req->header.status) { ret = -EIO; goto unlock; From patchwork Wed Feb 7 21:54:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 198100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2536579dyb; Wed, 7 Feb 2024 14:14:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDorkS+PNDxbRyazmXQ+/9L+fq/5H4Z+KHxzd63pg9MwvstRmIJSfHMY9AQJD7SZ6ucAr0 X-Received: by 2002:a05:6a00:138b:b0:6e0:4a99:d780 with SMTP id t11-20020a056a00138b00b006e04a99d780mr4877469pfg.34.1707344090979; Wed, 07 Feb 2024 14:14:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOxhoNfoigiEYeQFIrVZAx/qr+LELae+7qC2XjR7Sm6xfJljwjx+RiM9c+cJT1vlr2F2knMPCpzKrKC7DbDWTtvg1m/A== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w64-20020a638243000000b005dbec0a0adfsi2427888pgd.320.2024.02.07.14.14.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 14:14:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57244-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="CqMOx/kX"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-57244-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57244-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 72720282C52 for ; Wed, 7 Feb 2024 22:14:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1365413A89F; Wed, 7 Feb 2024 21:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CqMOx/kX" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2080.outbound.protection.outlook.com [40.107.94.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 622741350F4; Wed, 7 Feb 2024 21:55:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707342914; cv=fail; b=LpDE1oZUQSGTdDGzGUCAK9j96YTvy8pVaGDvimkK4kZxkvdGReLOX0AcnSm2w3HWzG6oI7o4ogTYl3jhxBhaCHgkVmpqEFHh1Qe3gz2SU/rMYLXZvPUqJpUkuW/H3eUcnXF6L0PVreNKwwwYNfSRKttsGi7kldhhljA2p8FzbfI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707342914; c=relaxed/simple; bh=1g3yxX9ps+Kc2EwgJ/o6nEB4qaYHnnBgebJhg1tW+io=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jRHm6jQIVZElhHKJ2w1n70wyWCGGGu1We5LieuusvOsh1g9guhfmxXR58UPnqyPrQrM6G+Hy0eutowwNrTDgEmXJe9xneIQdGcF7+5o54eu9ef1LXzENpRQ5wqJZQKGCDHmkSqirKDG80jjkHfd6+27G5C5KcIMoMt3D1oWBAsY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=CqMOx/kX; arc=fail smtp.client-ip=40.107.94.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UN446AUifdBpF3Bz35AjiXxHzu1Lm3WG0S4fcA4eVt1W9NOvCS3uEFkhLRZDbuKZOoqYWs1VtDgJvtcsSRRf4ZXa+Yx6+FwhGLEPPvizLWkqdG8dUQ2G/669O4OnkrdLb1kaQuIMhlClLQq+XhT4AYNwYbgTw4vBj6OqYhIFw4Hnvad8rKcVP0vlV1fB4HUzowBNUUqA0CPeZaikTRmZR1FBJcIwKpxYjyPHWvdhPBPxlyBfsnsyKQXc6bZN3XeOHgnLcGHKO5jjoy2kKiJILfOQYuohaXigLNqoucXQwZUGm+rxA+RC2xu7Nqxl6NBk7AM0OaKLj+DW86lkVPGPXQ== 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=JQWUb3HiBZR4g9/sYjsjEUNPhe8hXbvdVYnOW41dby4=; b=HGJVyqO6I1ACIczlZcEfg0nKCMNfO2k/6z1EmGrtkxNwxpPAO6k1RZshZeTtZaZK1RFss78tg8IRQvoXgXUStjwR5GpfCzzCt8xvYUniaU42fL8kw/Fw8OaUq5q/Whd4qXwcBlCjBEQTOw9AniYhgBBmbYTIKvLmuyq+FSw6oOTukQVwwcXnarw5RIBwSoVPCSdkTPFSsjUaGDtK229w03S5veaSTFamLK3C9NrLq+O5VjVBGkJT6cqX64CGs0acM1AdQcRzqJIwLU+xJ6z3EnJ2tHMl/sEVa/FonlWqulV34l0yNUccstljCvMM4Ma8DntqkmczkSuuuXWFPLULRg== 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 (0) 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=JQWUb3HiBZR4g9/sYjsjEUNPhe8hXbvdVYnOW41dby4=; b=CqMOx/kXXOpV+MHMFy7byiWxVBikXRMQwV6G48Jd1i6J0g7d9gyyXJJHqmeFAXd4oivjIcE6AQgO6GhbB7bccTauFgxUD8m/JnXbq6iu0j12/yaX5qFy8UdwKN7tvZxJ+9I2ffc3CksekmQJ2yLrYUewneZUFCR9qswNtDfJrAI= Received: from CH0PR03CA0437.namprd03.prod.outlook.com (2603:10b6:610:10e::17) by MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.16; Wed, 7 Feb 2024 21:55:09 +0000 Received: from CH3PEPF0000000A.namprd04.prod.outlook.com (2603:10b6:610:10e:cafe::e7) by CH0PR03CA0437.outlook.office365.com (2603:10b6:610:10e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.37 via Frontend Transport; Wed, 7 Feb 2024 21:55: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 CH3PEPF0000000A.mail.protection.outlook.com (10.167.244.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Wed, 7 Feb 2024 21:55:08 +0000 Received: from AUS-P9-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.2507.34; Wed, 7 Feb 2024 15:55:02 -0600 From: Mario Limonciello To: Herbert Xu CC: Mario Limonciello , Tom Lendacky , John Allen , "open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DB..." , open list Subject: [PATCH 2/2] crypto: ccp: Update return values for some unit tests Date: Wed, 7 Feb 2024 15:54:39 -0600 Message-ID: <20240207215439.95871-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207215439.95871-1-mario.limonciello@amd.com> References: <20240207215439.95871-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: CH3PEPF0000000A:EE_|MN2PR12MB4373:EE_ X-MS-Office365-Filtering-Correlation-Id: 20cdee06-4ffd-4f0f-1f3a-08dc2827734c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RWmNIaVlwpLb+Kv7sM4e8Z7sEyR2A+vMji2G8L1GcyQU/RO5kG4Gon77VBiLURHRYKBrlp2IZV+FS06pd/0b6e0G31hTB8dZigQNuZCipQaiPTqk/e0hOwlIoAQqgL/XwE387hyI0CfJDe7mcwGwf2awlB90GuV+bPzYcEER0f4ndV8ukjQgQ7m2BCatd8EzAb7ujjvz9KlCtxVjyXQL/IopjaEYhoouu6rRg37xW9ZxYTomZKzh+35efH/ANU7GYOUVKwi6MCm+WupGJyX3ZxoIvsabKHpk+nsFv7sIMAmstJtRC5OZTUbYAQLV6XqJCnS+GOW72DvV6R3pS3RAuwvi0fnjT977bg8DqYVBE9rZVK0u9zv65tITuoigv0NUIe3V0kjtdPc8Ki9YafDpWJHn9wb9Yw2XmI9AwiPS4oPUxi+IIZwquhwuzx++7nApKrwxDwVfSPoKbOLjK6PTXWuS3WQa0WzMYkaNT+OktsemhnDgU+Pi/YYQXVip3WVGX4XmRecGHkdsyPiFQjHnYcEAFjVej5l2v/Gd6EWdTQeawsLjraQZJxT/xhV4aGkePu4Ny0txP8L9BgbseJY0Sn02ITLRExUEkANsV0dxlSU= 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:(13230031)(4636009)(346002)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(82310400011)(46966006)(40470700004)(36840700001)(336012)(26005)(426003)(2616005)(16526019)(1076003)(44832011)(41300700001)(36756003)(316002)(356005)(6666004)(83380400001)(82740400003)(478600001)(7696005)(81166007)(70206006)(4326008)(2906002)(86362001)(70586007)(54906003)(6916009)(5660300002)(8936002)(8676002);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 21:55:08.1409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20cdee06-4ffd-4f0f-1f3a-08dc2827734c 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: CH3PEPF0000000A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4373 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790280037302574675 X-GMAIL-MSGID: 1790280037302574675 Until authenticated the platform enforces a state machine. Adjust unit tests with this in mind. Correct the return codes for all the states the unit tests ends up hitting: * Set Param / Get Param: DBC_ERROR_BAD_STATE * Set UID: DBC_ERROR_SIGNATURE_INVALID * Authencitated Nonce: DBC_ERROR_BAD_PARAMETERS Signed-off-by: Mario Limonciello --- tools/crypto/ccp/test_dbc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/crypto/ccp/test_dbc.py b/tools/crypto/ccp/test_dbc.py index 79de3638a01a..bb0e671be96d 100755 --- a/tools/crypto/ccp/test_dbc.py +++ b/tools/crypto/ccp/test_dbc.py @@ -138,12 +138,14 @@ class TestInvalidSignature(DynamicBoostControlTest): def test_authenticated_nonce(self) -> None: """fetch authenticated nonce""" + get_nonce(self.d, None) with self.assertRaises(OSError) as error: get_nonce(self.d, self.signature) - self.assertEqual(error.exception.errno, 1) + self.assertEqual(error.exception.errno, 22) def test_set_uid(self) -> None: """set uid""" + get_nonce(self.d, None) with self.assertRaises(OSError) as error: set_uid(self.d, self.uid, self.signature) self.assertEqual(error.exception.errno, 1) @@ -152,13 +154,13 @@ class TestInvalidSignature(DynamicBoostControlTest): """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, 1) + 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, 1) + self.assertEqual(error.exception.errno, 11) class TestUnFusedSystem(DynamicBoostControlTest):