Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5670950pxj; Wed, 23 Jun 2021 06:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7+NpytbbuksHKsPOCkjw9xhoqU9aUB2cfM/Sy4N9ZjSYqJaIVHm0Cgyn2gBMeEiRk77KG X-Received: by 2002:a17:907:628d:: with SMTP id nd13mr14197ejc.299.1624455393575; Wed, 23 Jun 2021 06:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624455393; cv=none; d=google.com; s=arc-20160816; b=JYP0cNsW05V2z2kn0hLCZLwidOMwuVExJKgb7sqcsDtmuL1YT07FtJyk+2vQy/xQ6P HtoB37c+Fcb3r2w9DYuSm/Vf8rrY+Xv4kM40aG+Kj3eFmLTU85SQH7FMhBFOLNCn1Ple mCeRcDbIWE4YpyBPnXPl5rfCkP/kMNasCCrZK4kcqIEFXq+fSRruiy9Wu5+lqew4zL5+ coHNBvtgZBwuJTraRwUc80IHV74rPSuMdhI1P/3/m+JAxz5VLZZcsflxP6rd3qshsp6Y LpoECvL8rqDy8lWdX/hBYvdSbd11FIXszltOQhn4RPacT1r2OPt3ObWk+bnAl2x8tdMt /x0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=5rRyPDoyzf7pWCwJUID6RT7A29wPFDd0o+KqNzKqwnI=; b=cGEPI6L/bnP93i71HveF0Eh3IpbmavxS1hpjw9BY2hqpy3TeRIB941cIKHgXB9dmH8 HZUbONIj5qMntt9iJAwHvEIhOXqzfPg8u2A22qg/+37btWf2PuUxCS2ra5tswQ4Fhk7z +56Nf9jNI+3jw/C4Sx1/LiQYJWP0Gsw1jJprDTg9PvMhQnvo0x9yMmEZXyds2PHz08ax XgvGcvNWhssasmYdjKcdrEdlUsA3khVSV+qnmeEDg6Judghbx3tRvqAjM+4tj1308fnn COUQkKpGHQUGNeZZFa7JKeZlbwHTMAI8gTV5PUfeFoIfXcrs5pK1sT7gitB5X4xn61Su ib0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0U4TL1Dd; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j15si10163635edq.273.2021.06.23.06.36.10; Wed, 23 Jun 2021 06:36:33 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0U4TL1Dd; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230449AbhFWNet (ORCPT + 99 others); Wed, 23 Jun 2021 09:34:49 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:37604 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231159AbhFWNeh (ORCPT ); Wed, 23 Jun 2021 09:34:37 -0400 Date: Wed, 23 Jun 2021 13:32:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1624455134; h=from:from:sender:sender:reply-to: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; bh=5rRyPDoyzf7pWCwJUID6RT7A29wPFDd0o+KqNzKqwnI=; b=0U4TL1DdrIjv7h7BIx79HuufXMaHvdLVmq3OeSObIu2xmyJJLkvu3MnzkMcszAGp3DJEEK h9T78aC5dNXo2xVZEkPD9ed2LJ3mQUNQ1VFhRTw7U9i9QIiNYIaNBFH8PrHp2l5uVdeqTn tKupNcL2LgFLin2aUoB5tUWZrfrhS7dTFjuUnPxAJfByRdY7hHtuJzGV/exHs+cMCU2qR9 bJAuiPm2rj533FuDeUTFg/VwyaSDwmMPH7eaTY+J8/5U37aoOWGDAIRoND3ZuO5t21OIc1 wCUW+EvWnut9Z/60mKICQDlVglV02v/gdNJq4etlVTcN0+1nxvKHkEtc4xPRrA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1624455134; h=from:from:sender:sender:reply-to: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; bh=5rRyPDoyzf7pWCwJUID6RT7A29wPFDd0o+KqNzKqwnI=; b=YY4kVe4O0PAb53364p3kijv4tH05jX300NpEFLA5WaDKJ6yMUVAD56OITLNcHn2uMwvv13 gZG5I53krOTS8LDQ== From: "tip-bot2 for Brijesh Singh" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] x86/sev: Add defines for GHCB version 2 MSR protocol requests Cc: Tom Lendacky , Brijesh Singh , Joerg Roedel , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <162445513402.395.15234934774265504366.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/sev branch of tip: Commit-ID: 310f134ed41fcaa03eff302b1e69f1ce1ee21841 Gitweb: https://git.kernel.org/tip/310f134ed41fcaa03eff302b1e69f1ce1ee21841 Author: Brijesh Singh AuthorDate: Wed, 23 Jun 2021 08:40:00 +02:00 Committer: Borislav Petkov CommitterDate: Wed, 23 Jun 2021 11:25:17 +02:00 x86/sev: Add defines for GHCB version 2 MSR protocol requests 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. [ bp: Fold in https://lkml.kernel.org/r/20210622144825.27588-2-joro@8bytes.org too. Simplify the brewing macro maze into readability. ] Co-developed-by: Tom Lendacky Signed-off-by: Tom Lendacky Signed-off-by: Brijesh Singh Signed-off-by: Joerg Roedel Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/YNLXQIZ5e1wjkshG@8bytes.org --- arch/x86/include/asm/sev-common.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h index 629c3df..2cef6c5 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -9,8 +9,13 @@ #define __ASM_X86_SEV_COMMON_H #define GHCB_MSR_INFO_POS 0 -#define GHCB_MSR_INFO_MASK (BIT_ULL(12) - 1) +#define GHCB_DATA_LOW 12 +#define GHCB_MSR_INFO_MASK (BIT_ULL(GHCB_DATA_LOW) - 1) +#define GHCB_DATA(v) \ + (((unsigned long)(v) & ~GHCB_MSR_INFO_MASK) >> GHCB_DATA_LOW) + +/* SEV Information Request/Response */ #define GHCB_MSR_SEV_INFO_RESP 0x001 #define GHCB_MSR_SEV_INFO_REQ 0x002 #define GHCB_MSR_VER_MAX_POS 48 @@ -28,6 +33,7 @@ #define GHCB_MSR_PROTO_MAX(v) (((v) >> GHCB_MSR_VER_MAX_POS) & GHCB_MSR_VER_MAX_MASK) #define GHCB_MSR_PROTO_MIN(v) (((v) >> GHCB_MSR_VER_MIN_POS) & GHCB_MSR_VER_MIN_MASK) +/* CPUID Request/Response */ #define GHCB_MSR_CPUID_REQ 0x004 #define GHCB_MSR_CPUID_RESP 0x005 #define GHCB_MSR_CPUID_FUNC_POS 32 @@ -45,6 +51,14 @@ (((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 + +/* GHCB Hypervisor Feature Request/Response */ +#define GHCB_MSR_HV_FT_REQ 0x080 +#define GHCB_MSR_HV_FT_RESP 0x081 + #define GHCB_MSR_TERM_REQ 0x100 #define GHCB_MSR_TERM_REASON_SET_POS 12 #define GHCB_MSR_TERM_REASON_SET_MASK 0xf