Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5394160pxj; Tue, 22 Jun 2021 23:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz73BAxZI7aNSTs78qx0xTuhrxOx5C8rIS5rU7QZZbXnAz09xdOtUnNACnwwHrtZvZfCV+u X-Received: by 2002:a05:6402:3138:: with SMTP id dd24mr10067014edb.92.1624430665725; Tue, 22 Jun 2021 23:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624430665; cv=none; d=google.com; s=arc-20160816; b=Kc5BU9Gb6s7yAHhS0O6X6GryVj7XrdLgnz/0RycOaSzdW+fsjNZ+WBqlncF3WCS3aV 3Ucr3vBu9a9FY0QcPLl23wq35ZRkZd0lE970/4KO+H1AtFBE2Sixlv7Obzu1GL0QHKZR X/+qC/VCU5MahMg/K53+gYEwswKmcQsLb5LYfUw2lNeDzeCmq76jerANWh/a3acarDXU jlXRV/c9ys6U+TD0HhwRcvINdv12LcZux58yXH/OF1qrl8D7aDmMi61p5sZKtMtxUxf0 sqTOTQShBUPxDSMHAw/oNeWmFhmcDYiF1PTqoeVdkjdLTU3F5EyCU7CrUXlwRuVSKzrw wErw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=pJ0jSpPQfH6MdvG4X+WVphJlquV/3gLX4GQDRXxK5gc=; b=m3e7rOvo0kIqUvcl5uHVu3biM4NvLNEwGbeCJrA++P/queCu13duqWsxX+xaHUKXLA r/a7kXgSr/0Ye46jm7trqw8Gi0KyrIvnizKo7wdanyy/1Kn/3AIi9zNF1xp2B8lOyqQs ZixSQ492G4euPmjEb2A0nPGo1yINlIM8p2MhB3ps2b3aCYQR6jxsR9ydpSbfru23ZnyU 3vJcHIFI7etwFscLBpKMPQLD6/hm1MtMM3BUQPToR/SZyo346jo5+wlzqCgKgxXqR/Wg dBpWUm+PlOd2+IvLTM0yz+mlcADGhKq3GYUoUEJ3nXIDVJJpB98e4Gu597Rf8X6JctZh GVmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si15824381ejl.652.2021.06.22.23.44.03; Tue, 22 Jun 2021 23:44:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbhFWGma (ORCPT + 99 others); Wed, 23 Jun 2021 02:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbhFWGm3 (ORCPT ); Wed, 23 Jun 2021 02:42:29 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C80A7C061574; Tue, 22 Jun 2021 23:40:12 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id 7BB9B3C2; Wed, 23 Jun 2021 08:40:08 +0200 (CEST) Date: Wed, 23 Jun 2021 08:40:00 +0200 From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , Brijesh Singh , Tom Lendacky , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , Arvind Sankar , linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 2/3] x86/sev: Add defines for GHCB version 2 MSR protocol requests Message-ID: References: <20210622144825.27588-1-joro@8bytes.org> <20210622144825.27588-3-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210622144825.27588-3-joro@8bytes.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brijesh Singh Add the necessary defines for supporting the GHCB version 2 protocol. This includes defines for: - MSR-based AP hlt request/response - Hypervisor Feature request/response This is the bare minimum of requests that need to be supported by a GHCB version 2 implementation. There are more requests in the specification, but those depend on Secure Nested Paging support being available. These defines are shared between SEV host and guest support, so they are submitted as an individual patch without users yet to avoid merge conflicts in the future. Signed-off-by: Brijesh Singh Signed-off-by: Tom Lendacky Co-developed-by: Tom Lendacky Signed-off-by: Joerg Roedel --- arch/x86/include/asm/sev-common.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h index 1cc9e7dd8107..9aa2f29b4c97 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -47,6 +47,21 @@ (((unsigned long)reg & GHCB_MSR_CPUID_REG_MASK) << GHCB_MSR_CPUID_REG_POS) | \ (((unsigned long)fn) << GHCB_MSR_CPUID_FUNC_POS)) +/* AP Reset Hold */ +#define GHCB_MSR_AP_RESET_HOLD_REQ 0x006 +#define GHCB_MSR_AP_RESET_HOLD_RESP 0x007 +#define GHCB_MSR_AP_RESET_HOLD_RESULT_POS 12 +#define GHCB_MSR_AP_RESET_HOLD_RESULT_MASK GENMASK_ULL(51, 0) + +/* GHCB Hypervisor Feature Request/Response */ +#define GHCB_MSR_HV_FT_REQ 0x080 +#define GHCB_MSR_HV_FT_RESP 0x081 +#define GHCB_MSR_HV_FT_POS 12 +#define GHCB_MSR_HV_FT_MASK GENMASK_ULL(51, 0) + +#define GHCB_MSR_HV_FT_RESP_VAL(v) \ + ((unsigned long)((v) >> GHCB_MSR_HV_FT_POS) & GHCB_MSR_HV_FT_MASK) + #define GHCB_MSR_TERM_REQ 0x100 #define GHCB_MSR_TERM_REASON_SET_POS 12 #define GHCB_MSR_TERM_REASON_SET_MASK 0xf -- 2.31.1