Message ID | 20221214194056.161492-27-michael.roth@amd.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F179C4332F for <linux-mm@archiver.kernel.org>; Wed, 14 Dec 2022 19:53:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D43818E0009; Wed, 14 Dec 2022 14:53:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF4148E0002; Wed, 14 Dec 2022 14:53:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B94CA8E0009; Wed, 14 Dec 2022 14:53:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AB07F8E0002 for <linux-mm@kvack.org>; Wed, 14 Dec 2022 14:53:29 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BB30AAB43D for <linux-mm@kvack.org>; Wed, 14 Dec 2022 19:53:28 +0000 (UTC) X-FDA: 80241961296.18.36A1048 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2048.outbound.protection.outlook.com [40.107.223.48]) by imf16.hostedemail.com (Postfix) with ESMTP id F1760180002 for <linux-mm@kvack.org>; Wed, 14 Dec 2022 19:53:25 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=sXvSsfEf; spf=pass (imf16.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.223.48 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1671047606; a=rsa-sha256; cv=pass; b=yRd+f/8Ek6VC3/yuXPAe4DYa1CyIKfr/V+v+2JxRxdCfbyRk/+wEE/oiim1nwskh7TuC00 J0+PEj1lD9bVWzg6ImQR8e7IyIRz2Ow2OCjzfaG7zdVUUAG+X+fCDFHATpogFvu4uZhseX vHD9g83ioobZxxfH6voDCKa/KD0J9Uw= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=sXvSsfEf; spf=pass (imf16.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.223.48 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671047606; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rRY9S+poCqn/XGHRQP5gYUrdAtRxMsAtv6+gdzhKppY=; b=xr1ythBJLaLS1r729zZ+2uLky5x8YLyyZgs+zbq+wjfFS3+Fn5VGF90K5f89V44dvCqMPj TbbGSEFzRBHsVWocFDC9gCE0EIJRHsri/UzYDZfS1U85SOiZmApcDthzp8O0UnpD7mBVu/ xIdAltfzTgd6beOYPJx8rPi7u6bGvNs= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRrLR345INPvxFlhSdSeOpzxiGnpak9+Z/c1uGWs0DYwp0ICxvXEXCd3A6DhYZpVBrPPJrj1MIMHNMgE1DjPC4Tv1M78JD2/OLz3Re+J5zEZsyPbVVBtVCZeHS0Vkmw9RzY6YIrHD1ebhMlUwbnIKheQHCWQwMaNsT0XBgkoGNkb3HV7LN9vJGHAh7uuOFmIAr+i4LfaNGnl5zdlz4E702ByXbwSLOla1a3IoMgpskXK+wm6dpgJLWUyNUHt9NBjiZSiu+kor04kW5U3URTGr+WK9A6TPGR+LXuoDoMH8zA5ejuojg8DGeg0P00eT6ByBPb6LBCz0hif/KQP6Bw+YA== 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=rRY9S+poCqn/XGHRQP5gYUrdAtRxMsAtv6+gdzhKppY=; b=mzCUmD7l7eW0AQ9THCpCmRxX90Z6RVFICk2wGOMqexoVNpSmjYLKO8PZMzviJzZjmQrJeQEa9iyySU57NsWK8vreejo40y4ahq3mmmC9zslEXNFEleN0nzwPDnAC7nTOHGm/ycDXNzTdWDvmGvv05XkKCu4jUxCN3FT3a3pQRb6BCYO/FUCyvE+6NZMXUsEzAGSm4p3yRCwkdWsboAPoFiPIH9R7CNCMLAg37PTEDmlnRIhu0ZF2i+bkWc7Ldh2bCtS3DZAI8jeXu7m2g7Xs9z2ZQxZJjJ3eIDZAI+giu6VDEh21PbsRa2w9v0D4f1GwnELYVrbB5qFjNe1RKsxDfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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=rRY9S+poCqn/XGHRQP5gYUrdAtRxMsAtv6+gdzhKppY=; b=sXvSsfEfC1h83fuOrdHkYJphbRlhDzw/cgN7vUUEUHq9CGWNhaL7tY2Lbber8U81nova0y/pAVf7wJRG2r/HVjqeQRRWPDnyPWDLK6CtahyLoyqkxVjbh6j7rC97Em2rnVHC3xYLZfs1WpFINaKuUmYwZd5w+s0+f9Qj4kEzWm0= Received: from CY5P221CA0115.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:1f::12) by SN7PR12MB7274.namprd12.prod.outlook.com (2603:10b6:806:2ad::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Wed, 14 Dec 2022 19:53:23 +0000 Received: from CY4PEPF0000C979.namprd02.prod.outlook.com (2603:10b6:930:1f:cafe::c7) by CY5P221CA0115.outlook.office365.com (2603:10b6:930:1f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19 via Frontend Transport; Wed, 14 Dec 2022 19:53:23 +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 CY4PEPF0000C979.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.10 via Frontend Transport; Wed, 14 Dec 2022 19:53:23 +0000 Received: from localhost (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; Wed, 14 Dec 2022 13:53:22 -0600 From: Michael Roth <michael.roth@amd.com> To: <kvm@vger.kernel.org> CC: <linux-coco@lists.linux.dev>, <linux-mm@kvack.org>, <linux-crypto@vger.kernel.org>, <x86@kernel.org>, <linux-kernel@vger.kernel.org>, <tglx@linutronix.de>, <mingo@redhat.com>, <jroedel@suse.de>, <thomas.lendacky@amd.com>, <hpa@zytor.com>, <ardb@kernel.org>, <pbonzini@redhat.com>, <seanjc@google.com>, <vkuznets@redhat.com>, <wanpengli@tencent.com>, <jmattson@google.com>, <luto@kernel.org>, <dave.hansen@linux.intel.com>, <slp@redhat.com>, <pgonda@google.com>, <peterz@infradead.org>, <srinivas.pandruvada@linux.intel.com>, <rientjes@google.com>, <dovmurik@linux.ibm.com>, <tobin@ibm.com>, <bp@alien8.de>, <vbabka@suse.cz>, <kirill@shutemov.name>, <ak@linux.intel.com>, <tony.luck@intel.com>, <marcorr@google.com>, <sathyanarayanan.kuppuswamy@linux.intel.com>, <alpergun@google.com>, <dgilbert@redhat.com>, <jarkko@kernel.org>, <ashish.kalra@amd.com>, <harald@profian.com>, Brijesh Singh <brijesh.singh@amd.com> Subject: [PATCH RFC v7 26/64] crypto:ccp: Provide API to issue SEV and SNP commands Date: Wed, 14 Dec 2022 13:40:18 -0600 Message-ID: <20221214194056.161492-27-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214194056.161492-1-michael.roth@amd.com> References: <20221214194056.161492-1-michael.roth@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000C979:EE_|SN7PR12MB7274:EE_ X-MS-Office365-Filtering-Correlation-Id: 05d4b19e-a2f3-4043-3d9e-08dade0cdbe1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tM6Q1mGgnRGZlaP1aoFsB2/kzBMnIguwWv3fBO6jnGcQXHdWiCgtsqgXauO1VOFhkbtR1uO4FhPXIpN6IxpuDAiIKFj2vtMED8LnkeWomf4zyzTjKOuHE6RLzLIyH8yL0w+UxGechGev7X4gcUA7beV5COneye89HsLKj5WA8s8e18fBgGjChADSHXVi39MAtBpTORh2p1rCeEa0egvaTSwkGsWarSbWxCVRFpRe/3PoLpPmMHJKNevQe/j7z2t2XZyUKHzf3SZVd322MCo9HW2GbhyBTc9/Sa6y+fNlzGn/8svr4FHzemx1HSQOeV0cvym6Sn8CpBqgdXgXBGTZ+1tQtU0o3UD5lA4M4zijrz4bjaCy/R1KEfgM/ZdobaYXJOfJHfJIBztnBwtc8yZmhpvNSW9+kC5rVLSH6AfmCLcNE63FGD4fASFAwh6+PsvgQvX+jycM4YAVL1O76IFOdeqyMvM2pUgVQqnlNtsz0O2J7+qFKPlb3UScbItsn9QyoJTR2sBlcZtJhz6U+u2KwMRr2iautfHHN15h3+UsHjrC54Qm3OtMMXcqcyQ8Zpa4iZUih1T82E05jsJ4F6qqRNrULdr5l2YmzTHhjsMMmTJ57YM9EpWPXfT/Gt9JG7t/Bg0sN+S8B5lSK3GyF03LrKnNIANFdWVZAqCz43W4iLc43ixlIkjZSPbu/t/KiWj2nU0gRZExDnylrjJR6WBwlcDH+kCfUczHpv6u4HKncpkDDVqyVqElcw3phoNGPaQjwDP58GMT1tstyejEozTPkA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:CA;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(136003)(396003)(346002)(451199015)(46966006)(36840700001)(40470700004)(7416002)(44832011)(7406005)(186003)(2906002)(70206006)(4326008)(8936002)(8676002)(41300700001)(70586007)(54906003)(316002)(6916009)(16526019)(2616005)(82310400005)(6666004)(36756003)(83380400001)(47076005)(40480700001)(26005)(1076003)(426003)(478600001)(336012)(82740400003)(81166007)(356005)(5660300002)(86362001)(40460700003)(36860700001)(36900700001)(134885004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 19:53:23.5354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05d4b19e-a2f3-4043-3d9e-08dade0cdbe1 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: CY4PEPF0000C979.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7274 X-Rspam-User: X-Rspamd-Queue-Id: F1760180002 X-Rspamd-Server: rspam01 X-Stat-Signature: nemj8jjypgm5q7y6wsdctxesmpxk54md X-HE-Tag: 1671047605-789798 X-HE-Meta: U2FsdGVkX1+UsfkZ1fn5joCSHEiUEILJwl24bZYxwbbdmh6SU7rM+YS9RskQfJMg+MjZ3SU7BxVAquxh/uVpunnXkvalWpFxCmWyH+k/Ug8bAZQDGPDoTSMDLxcw/3N/bzqp6gC2X0hbyXcxuulh9UOMTZJiZ0cAW6JY3zFIcWfhp8FPgLRQjuDGSslq1KOxs/D617gEWunUz8yyR9uoqxGKHvwtuF8DcEwkJe4TFyprUW6boT2yskLsX/HiefRRUZYtSS4jCp019lVOvYCGpAxM6f8Uf2MfVpHRVBPgd4f9zoGB3giUlk8tcQSiqCPtkTUYGsHb5xD1vodT6sutnY3DLM+0d9IUweF1dKd2y0psSdi2o7+Yc8viDcNQAZLxAqpoeDYjzh9ayhZCd5X9q6ogD0ef268r9FdDUnJgZ3YwposZDDlOVyC1Nt1NxyeqbkFMWl0wz8ep5gHl6svqpjPU2JSVchjK2tOaCuG7R+zYTcycLfgKZgriC3Dv9XHJQWQ7qFp0ZP7/jul9Y6wpA7giyz4XUgks2i6HEyR3bWxtOjMliZpNnQXGZvCmihNlYjnGRqxKB6GIwBPWdGEwV6Mn3wheUTbf3YRiU5NiQoJY1h6t7hKGj5bxRB7IwH/aaxLXgJTdWCM6rgzoX424ufJUFzSKYxSnLb8qHJlbK6Qdz4ZpgMlit0kx0oaGTF1A0vmPrQBfHwBDHY17hZzhlzaXjigRauiJjXutX4pGXZOVIGsV8s739X5Rl8eS0UWS5cg/qCtPuJviCMps/+9i4BqtQ+YhFdZ8CtW3Jqt6WITC9DG3o3xIHMXr2m0eYwFmir8CuWvaMYS6H7fJstfIdKJBKtqB91xTdA6HRoY5BSYv2Lkld7Lc0ocOTdYHgkV8lHQBICs0C289Qha9ZUJ/3oQ4D0hDOcMlBPwFGndTCeI5eUnN4af3f7RJ5DnMQFA7LgtvAxtr+QSyuQhnnBv k19Mfmn0 a1765 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
|
expand
|
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index af20420bd6c2..35f605936f1b 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -415,7 +415,7 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) return ret; } -static int sev_do_cmd(int cmd, void *data, int *psp_ret) +int sev_do_cmd(int cmd, void *data, int *psp_ret) { int rc; @@ -425,6 +425,7 @@ static int sev_do_cmd(int cmd, void *data, int *psp_ret) return rc; } +EXPORT_SYMBOL_GPL(sev_do_cmd); static int __sev_init_locked(int *error) { diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h index 8cfe92e82743..46f61e3ae33b 100644 --- a/include/linux/psp-sev.h +++ b/include/linux/psp-sev.h @@ -907,6 +907,20 @@ int sev_guest_df_flush(int *error); */ int sev_guest_decommission(struct sev_data_decommission *data, int *error); +/** + * sev_do_cmd - perform SEV command + * + * @error: SEV command return code + * + * Returns: + * 0 if the SEV successfully processed the command + * -%ENODEV if the SEV device is not available + * -%ENOTSUPP if the SEV does not support SEV + * -%ETIMEDOUT if the SEV command timed out + * -%EIO if the SEV returned a non-zero return code + */ +int sev_do_cmd(int cmd, void *data, int *psp_ret); + void *psp_copy_user_blob(u64 uaddr, u32 len); #else /* !CONFIG_CRYPTO_DEV_SP_PSP */ @@ -924,6 +938,9 @@ sev_guest_deactivate(struct sev_data_deactivate *data, int *error) { return -ENO static inline int sev_guest_decommission(struct sev_data_decommission *data, int *error) { return -ENODEV; } +static inline int +sev_do_cmd(int cmd, void *data, int *psp_ret) { return -ENODEV; } + static inline int sev_guest_activate(struct sev_data_activate *data, int *error) { return -ENODEV; }