From patchwork Fri Jul 9 21:55:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 12368075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ECA3C07E99 for ; Fri, 9 Jul 2021 21:58:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2CF0613C2 for ; Fri, 9 Jul 2021 21:58:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2CF0613C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1yW8-0004Rl-8K for qemu-devel@archiver.kernel.org; Fri, 09 Jul 2021 17:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1yTs-0001yz-81 for qemu-devel@nongnu.org; Fri, 09 Jul 2021 17:56:21 -0400 Received: from mail-dm6nam12on2067.outbound.protection.outlook.com ([40.107.243.67]:33505 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1yTp-0005q1-KX for qemu-devel@nongnu.org; Fri, 09 Jul 2021 17:56:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZrTaX+CsAYrNokH/sgrJM34pOeSkLFXyX1sD5uiUuOuUGqtrGekKZnfTuy2+MpcwNBAl/g3FxO45EzXoINRhJkwqqy5ViRgk1d1nVsklQnfQ7pV2qF/DajgRZyg4gPeYe/JBAYj0mWShK3C7DVgQ8DhzWaPGUr+l9a/N63FgBEB0tZbtLywmGzhWAdP6xBPXhzTCV91uioGuvNjgFr28gOKLDtPauNWGiiMhqFZ/4+TWUV35Ph3E5LNYqKgFUhque9dQ/sqKawd5luW07lGqpJFiwfGmX0u3wPn0Ju7Yt+/klHo7mUCIseNZo4mlO+GoxvH/KmJ5BRLHSyEC/b9FUg== 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-SenderADCheck; bh=+xJGT0HcR5qZFQMgoHuLjT8knIauKod8GS2YRW73PeE=; b=DDK4gPHfMXDoDyNeI8/WJupYdWaIhrHCcJZ/kPv4MResfwzNfn1b98X3vu3T520GVEfdKFgnLObDFcCSws17MqAfEYX+b8SihETddNBCIH8n1lgVpkTWEAsFv90glBQCNsDFWqMDU0xXHjslIdHzDCxuhCiuVKed/VmvfwuGypOyHTcHOD5gHJl7CrXKqt8QxO/PvfDc1b4wshU/RssVVIIGeS5orFnizdkPrre8H+jRJht0t/e6OcPDsrIMI6TkGG1PEpoMRwF2VJ7oonZpR1mJNKYubZexWazxj0I6qKscY4I8MR5LT17mYZOa1+LME+IO0uBltyM8jh/tgamFsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=+xJGT0HcR5qZFQMgoHuLjT8knIauKod8GS2YRW73PeE=; b=43/d0dlopn0znK0/23fD8UjvNUMtXydT04hXC08Tt211S71Zu9lmCB4xnnW6dlVJHbnaELLpxk/Fdoum6S4DcQjaXdUnahmLaAsRyY0NjH0hpeGpDlESHMih6Jfngw3V6xJUTy/FtR4E381uCkhfg5v/fi4AdvHEoWgphydkaE0= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4575.namprd12.prod.outlook.com (2603:10b6:806:73::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21; Fri, 9 Jul 2021 21:56:10 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::a8a9:2aac:4fd1:88fa]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::a8a9:2aac:4fd1:88fa%3]) with mapi id 15.20.4308.022; Fri, 9 Jul 2021 21:56:10 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Cc: Connor Kuehl , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" , James Bottomley , "Dr . David Alan Gilbert" , Tom Lendacky , Paolo Bonzini , Dov Murik , David Gibson , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , kvm@vger.kernel.org, Michael Roth , Eduardo Habkost , Brijesh Singh Subject: [RFC PATCH 1/6] linux-header: add the SNP specific command Date: Fri, 9 Jul 2021 16:55:45 -0500 Message-Id: <20210709215550.32496-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210709215550.32496-1-brijesh.singh@amd.com> References: <20210709215550.32496-1-brijesh.singh@amd.com> X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Fri, 9 Jul 2021 21:56:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a092e81-0390-4534-df84-08d943245c88 X-MS-TrafficTypeDiagnostic: SA0PR12MB4575: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:792; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D8vqCiWZNRqNUyOeNkMXCYH08yqzDKaBN6HQ5zOjs1ZsVHZPFpiEluymnU/j/0ljaD9gv2okIn1/5VX4g+qwrW9V2r3LBprdIZ4mnEMIa4PgWd3ecVCAgr+UK0l4cv4L+VjjjHzN7RxtvQC+LEL/bmU8ZTVCpVcfjI9O88fDvMe7bGS7tGlLp31FfCAtDGCj2L0GzzvnoXxi9k47qRH1+Eb4qWhbWy5r4TPbXSobzrpnSeHYfF+iG5OvkqRidkm2V2+sFxC7sWO4OtOZJ7Crl3NpifIJ5Qs3/dZ/MMT+p0Yg38tjuUdvO7Ergr82Gc4PhJmWbqNJqgcK8C/5VSYgaXOGcFcresn3sZzdS2cL3uV4gZDTC+mGSPDa+x+eH12wOsrzNvKPuqj0EZkiZ5PQe3Sfhvio9ldhCgDajhHJfQN1xqGW3+xysDHg1hjqrRuzXBnj+K06qI44ABCaKxlgL9pZlLu57g4JlIijAYs/OdB4zNQ7WLOotBsJe/pGgD3fbRmpei+3tjW5KvqHv7nPrcQZeucV+bfrEtZYPJfM0Hr9V9YqLhBl3l4TqI2FABpDOBjzjxsQQmFYvIw4AJvhX02+kETY6/H818V4jdP8geZ0eGcN9jE62fUanIpBj6gfwFvibdhezUMYZH2MHCH3OrJqHfU7mNcUqwj3IkMuq5AO5wU6OwXKUdwO0eLWnhHNgvrfMJs1bipFuAJdTucNlw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR12MB2718.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(39860400002)(376002)(396003)(346002)(6916009)(2616005)(66556008)(36756003)(6666004)(6486002)(83380400001)(7696005)(52116002)(2906002)(66476007)(316002)(4326008)(186003)(38100700002)(66946007)(38350700002)(8676002)(8936002)(956004)(86362001)(5660300002)(44832011)(54906003)(478600001)(1076003)(26005)(7416002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zzGiQxlQ4lrjypRCpehiZqhHBaPic64HS90XyBPt3H7JMxKA3uoQY5I6Aig4cnjlLqFlO3ScEA+hZf70JOW71VEd9dQwjdy0SjVOWRM8FVfXWxA+ZJSfuW7Nv+N1O2n42tY0fdH4Jt+scAQZC/if0v/m5iK23H/kdkldRiAHI5ZIUz+/JjMFdM+Mt2AymwYMALX57yHJPbYBfF1JCogLUCEJoNlTMxbeg9W8/YPD2l4u3IywUi8nRRIuHjF0MHABOsot0t04REika2EiU7UQPDqPHywSCf+CyaSDZec6d4DQX9Q+6LbZ42VmPLhK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df84-08d943245c88 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2021 21:56:10.1402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SaLsfUSxIgurZrz15m6BrUgdKJdqVATd9nLYZCNzOlV7mPjc915u/C/1JBq/vnwRZ0Fa7/pO5UqPU+mAjCk86Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4575 Received-SPF: softfail client-ip=40.107.243.67; envelope-from=brijesh.singh@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Sync the kvm.h with the kernel to include the SNP specific commands. Signed-off-by: Brijesh Singh --- linux-headers/linux/kvm.h | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 20d6a263bb..c17ace1ece 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1679,6 +1679,12 @@ enum sev_cmd_id { /* Guest Migration Extension */ KVM_SEV_SEND_CANCEL, + /* SNP specific commands */ + KVM_SEV_SNP_INIT = 256, + KVM_SEV_SNP_LAUNCH_START, + KVM_SEV_SNP_LAUNCH_UPDATE, + KVM_SEV_SNP_LAUNCH_FINISH, + KVM_SEV_NR_MAX, }; @@ -1775,6 +1781,47 @@ struct kvm_sev_receive_update_data { __u32 trans_len; }; +struct kvm_snp_init { + __u64 flags; +}; + +struct kvm_sev_snp_launch_start { + __u64 policy; + __u64 ma_uaddr; + __u8 ma_en; + __u8 imi_en; + __u8 gosvw[16]; +}; + +#define KVM_SEV_SNP_PAGE_TYPE_NORMAL 0x1 +#define KVM_SEV_SNP_PAGE_TYPE_VMSA 0x2 +#define KVM_SEV_SNP_PAGE_TYPE_ZERO 0x3 +#define KVM_SEV_SNP_PAGE_TYPE_UNMEASURED 0x4 +#define KVM_SEV_SNP_PAGE_TYPE_SECRETS 0x5 +#define KVM_SEV_SNP_PAGE_TYPE_CPUID 0x6 + +struct kvm_sev_snp_launch_update { + __u64 uaddr; + __u32 len; + __u8 imi_page; + __u8 page_type; + __u8 vmpl3_perms; + __u8 vmpl2_perms; + __u8 vmpl1_perms; +}; + +#define KVM_SEV_SNP_ID_BLOCK_SIZE 96 +#define KVM_SEV_SNP_ID_AUTH_SIZE 4096 +#define KVM_SEV_SNP_FINISH_DATA_SIZE 32 + +struct kvm_sev_snp_launch_finish { + __u64 id_block_uaddr; + __u64 id_auth_uaddr; + __u8 id_block_en; + __u8 auth_key_en; + __u8 host_data[KVM_SEV_SNP_FINISH_DATA_SIZE]; +}; + #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)