Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4777410pxj; Tue, 22 Jun 2021 07:51:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/98YG8FwMUbp+aAtdUk4Dw55lN5yIKHxGboPVMxwD8M02Y9J821SAJtSJZBOK+Ak0Ubrl X-Received: by 2002:a6b:b28b:: with SMTP id b133mr3187788iof.107.1624373468259; Tue, 22 Jun 2021 07:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624373468; cv=none; d=google.com; s=arc-20160816; b=YRk+KLp8RYYxlUHt0VK5nkYNxiihpYTynt50TqtUmArZ1BI5+B64tGlXuGnPipRoiJ VGcOC9absWQsyqL8ds7rilEmhS/Ojde7pEV9wM0taRV2phnHlAhn5JDOrmqAQuLZAxoq vaZZxL1fME9RLZLQeLlAZW2EYBhi58g1eKocdVVlftc4kexkPXjYYxk5ppoztVMUht/b hCIlNr2EWK7zBYHrnZCHMfX7GoFh+0iTLB4So/CCxO1NRin+GuB0EleVdHYQtplpJg7N vp2sJmgJyesVzw8+Nvi0zsIdNLkGbaHncQsZCKzSyEc8AUXq1mSALh/S9wDcEQUKL8S3 SGZQ== ARC-Message-Signature: i=1; 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; bh=0d5JhiaxS1GXj/w7FAnQ5ZjoPv5CKhYc2fNGxIZW54E=; b=ZjL8yE1FcK41qns/QP7E7vdhXUQxD3Vo80cvD5yya49dsVc1+FgRwwuvcjmR0Ay4nc 9jWcq3C48a02ooUsUw/SZUyOh9RV2Fi5NnWhdjDuz/RGGxBM+v7F9HOp3Ael44bFqbyS FP5Kdst4GRzWS0Y3O6lkrlkuZZrolCH89212By8ZaxCE1tiCtZjIHaDNEDJVa9KDUBzN zsrg2xyb8YjOaCacx4VG0kxTfLFkIsv9MXv4yRCcsMVo9A5nXeiA28I3DyN7mG55KKga ZFq3eZ6Uf1pdVHUnh/Xnqh7kwdVNcMH0PqbWtcQQ8NdWrjv4kVdE9G4wO78wFP3VNRo6 VejA== 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 h19si13630290jaj.37.2021.06.22.07.50.54; Tue, 22 Jun 2021 07:51:08 -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 S231761AbhFVOvF (ORCPT + 99 others); Tue, 22 Jun 2021 10:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231961AbhFVOvB (ORCPT ); Tue, 22 Jun 2021 10:51:01 -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 6E9A9C061574; Tue, 22 Jun 2021 07:48:45 -0700 (PDT) Received: from cap.home.8bytes.org (p4ff2ba7c.dip0.t-ipconnect.de [79.242.186.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 629BD26F; Tue, 22 Jun 2021 16:48:42 +0200 (CEST) From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , 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 Date: Tue, 22 Jun 2021 16:48:24 +0200 Message-Id: <20210622144825.27588-3-joro@8bytes.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622144825.27588-1-joro@8bytes.org> References: <20210622144825.27588-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Co-developed-by: Tom Lendacky Signed-off-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..4e6c4c7cb294 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_MASK) >> GHCB_MSR_HV_FT_POS)) + #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