From patchwork Wed Nov 10 22:06:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 12613139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4DFC4332F for ; Wed, 10 Nov 2021 22:08:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5BEE461406 for ; Wed, 10 Nov 2021 22:08:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5BEE461406 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 01B6A6B0072; Wed, 10 Nov 2021 17:08:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9596B0074; Wed, 10 Nov 2021 17:08:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D85E86B0075; Wed, 10 Nov 2021 17:08:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id CAE8C6B0072 for ; Wed, 10 Nov 2021 17:08:06 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8D7627FAB3 for ; Wed, 10 Nov 2021 22:08:06 +0000 (UTC) X-FDA: 78794409372.07.8ABA040 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2061.outbound.protection.outlook.com [40.107.94.61]) by imf14.hostedemail.com (Postfix) with ESMTP id C13CD60019B1 for ; Wed, 10 Nov 2021 22:08:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G7W7w69U1nnJIU43om0KMLjBo9JavYIfWo0l2eIc1AOoGteJqWuwtr7LvuyxPfBa+VHbnFFtJvK/rWhU5Mh+8g9CkhO8vJIka0ZtRSmKGENAdeCoXKmFrevUyxA5LYAicnGLEu2ka3vP8dFPX87XQHNfZvXrKNZUmRMEYbAknPWwfvp0GCGagoHCr/ce4fzXZvSSvOtxHxEyl65DJuSlismGlNGWp1J4gA+cGHEYbu3PwDjHI+HlBhB1t81FqPW6D926yaTDBr58GMmB0PohPauB3q9bl5fs8lu8ECw0r9bZ0oDsgna3FxnY6hodD19OyrgPrjL8EuaQ/92rIbt6uA== 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=+j+qK2q5w0RYZchzZROMnIvIi0Oc7+QfDvEAR9a+BoU=; b=lISyewayvHWEQ4hYsO4UgsyjjOnSXhRAIYHfCRZTpoDHwk2oM6wP5ercDaX9Ps9iyBTMf8ja9jXRVTQJcK3ohgZLtgyH4OJlm35rAWAFI9yRrDPm2/X5GBQo/XqKOsbGRptDqGfb+ulXDz1tdPiWPgSRJcrvIRmQjXV6x4HfXafZVYThdKhl/f/nf/5jSUOCRWSDp3HLsRXMADO1sMiffeEAYvArGn7rK9fz8zKHJWBnwEw2UKf5HYpM5BnND8hIwT59ussmBr/VIFCdI9dcF6cpWI7G0CcRjWL2P0v4pjfQgFdWXQvj6x60kv36c1JvabdjcrIEx2osa85fHWxJdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=+j+qK2q5w0RYZchzZROMnIvIi0Oc7+QfDvEAR9a+BoU=; b=Y9amqIJHUeHjM7GLyp4p3ZoUkKfGsZqdXgIeZIMKrrt009oT9DNRNQ47fXQPi0EK/CUgzr3XND4kJb+powtuGTSSsbLkefXzzdsJZLLo7p/8vxC5589OLK4HWSzVBwzX1IgMAtAsTKeVIZLs0zWGfqSS5WDg9dQZCRBttZccv+U= Received: from DS7PR07CA0013.namprd07.prod.outlook.com (2603:10b6:5:3af::19) by MW3PR12MB4571.namprd12.prod.outlook.com (2603:10b6:303:5c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 22:08:00 +0000 Received: from DM6NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::f8) by DS7PR07CA0013.outlook.office365.com (2603:10b6:5:3af::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 22:08:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT055.mail.protection.outlook.com (10.13.173.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 22:07:59 +0000 Received: from sbrijesh-desktop.amd.com (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.17; Wed, 10 Nov 2021 16:07:57 -0600 From: Brijesh Singh To: , , , , , , CC: Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , "Vitaly Kuznetsov" , Jim Mattson , "Andy Lutomirski" , Dave Hansen , Sergio Lopez , Peter Gonda , "Peter Zijlstra" , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , , , , Brijesh Singh , Venu Busireddy , "Borislav Petkov" Subject: [PATCH v7 04/45] x86/sev: Shorten GHCB terminate macro names Date: Wed, 10 Nov 2021 16:06:50 -0600 Message-ID: <20211110220731.2396491-5-brijesh.singh@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211110220731.2396491-1-brijesh.singh@amd.com> References: <20211110220731.2396491-1-brijesh.singh@amd.com> MIME-Version: 1.0 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-Office365-Filtering-Correlation-Id: a692e087-6ea7-4702-971a-08d9a4968efb X-MS-TrafficTypeDiagnostic: MW3PR12MB4571: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nvqajCaF1cWCsC5pcf+1uWo3G8uO2UKRDuzlj9fXhf1YdaBAUnlA9xVSSClJnkL/ePjvgOhyaGddk/iswxaFY+xqti9aPaWTLn4wbxJnA8/O7O22qtg/JNP13LWrpYIGVFQxIZ0hh7fhzDPuz9G3ueKq31dUFea448EJkJ7T3ZbAy4JG4qws5mxZZBmOf/Yu4i7juoFTzl4aVbyAp5yx24cZXbCFk1ScDmhu+iwKd+J6844JSGv1m6LdGo/cxbDLhnH56qDwZXCdT88N2U28MNQAWJI4CKnDPbzB/xkbHqulQxVzPx13ZlXQw40BMx9RFJKYMx6fHFyxodcgiOWFMfUjIZdXVlxut1VZQbKGEMn6aPQZKxf7XrlZI30xaWY0Ma+R3XZqSmlXDHYnvNVCj1FalZap/DVKQoZlgZB7lQW6EhanvBxRbcDeCUVswyUeEWckFz89s3wrTtHzKoZExcgKPIkKKMrVbT7+Gz5CadvV6cR9atov3mh8KTbTGgDtieyt1lNFWb5TsHV2h+p9pQcna8ZLa+k/bsDF+kBEyWJnLkeYPvCax7VvHwQNpC6jPIRaRSP1Pp5x8Uo+wH5Ss+WtNyyD+YRiBYv/mRlJXW3nPcNYAf2zlGKH1of4bUl7+wMZQ49FaZ16GSyEFcGLeYu7ktj3ytE9CHGnZ2LNClnos6Hd3pCbbEAaqpbMGaxv3ywa2tUONaFKoIOg6sssl5lY6c+sXVVON3mAu9FXr9LL4wKnHhxFQDzoADkaswSW X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(1076003)(186003)(7406005)(2906002)(26005)(47076005)(508600001)(8676002)(7696005)(4326008)(83380400001)(5660300002)(86362001)(36756003)(70586007)(16526019)(356005)(70206006)(81166007)(110136005)(8936002)(36860700001)(6666004)(426003)(44832011)(54906003)(2616005)(316002)(82310400003)(336012)(7416002)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 22:07:59.9469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a692e087-6ea7-4702-971a-08d9a4968efb 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: DM6NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4571 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Y9amqIJH; spf=pass (imf14.hostedemail.com: domain of brijesh.singh@amd.com designates 40.107.94.61 as permitted sender) smtp.mailfrom=brijesh.singh@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C13CD60019B1 X-Stat-Signature: j8gp473839g645jibits7c1smj1o87pg X-HE-Tag: 1636582086-304508 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: Shorten macro names for improved readability. Reviewed-by: Venu Busireddy Suggested-by: Borislav Petkov Signed-off-by: Brijesh Singh --- arch/x86/boot/compressed/sev.c | 6 +++--- arch/x86/include/asm/sev-common.h | 4 ++-- arch/x86/kernel/sev-shared.c | 2 +- arch/x86/kernel/sev.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c index c91ad835b78e..8c6410014d22 100644 --- a/arch/x86/boot/compressed/sev.c +++ b/arch/x86/boot/compressed/sev.c @@ -122,7 +122,7 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, static bool early_setup_sev_es(void) { if (!sev_es_negotiate_protocol()) - sev_es_terminate(GHCB_SEV_ES_REASON_PROTOCOL_UNSUPPORTED); + sev_es_terminate(GHCB_SEV_ES_PROT_UNSUPPORTED); if (set_page_decrypted((unsigned long)&boot_ghcb_page)) return false; @@ -175,7 +175,7 @@ void do_boot_stage2_vc(struct pt_regs *regs, unsigned long exit_code) enum es_result result; if (!boot_ghcb && !early_setup_sev_es()) - sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST); + sev_es_terminate(GHCB_SEV_ES_GEN_REQ); vc_ghcb_invalidate(boot_ghcb); result = vc_init_em_ctxt(&ctxt, regs, exit_code); @@ -202,7 +202,7 @@ void do_boot_stage2_vc(struct pt_regs *regs, unsigned long exit_code) if (result == ES_OK) vc_finish_insn(&ctxt); else if (result != ES_RETRY) - sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST); + sev_es_terminate(GHCB_SEV_ES_GEN_REQ); } static inline u64 rd_sev_status_msr(void) diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h index 2cef6c5a52c2..855b0ec9c4e8 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -68,8 +68,8 @@ (((((u64)reason_set) & GHCB_MSR_TERM_REASON_SET_MASK) << GHCB_MSR_TERM_REASON_SET_POS) | \ ((((u64)reason_val) & GHCB_MSR_TERM_REASON_MASK) << GHCB_MSR_TERM_REASON_POS)) -#define GHCB_SEV_ES_REASON_GENERAL_REQUEST 0 -#define GHCB_SEV_ES_REASON_PROTOCOL_UNSUPPORTED 1 +#define GHCB_SEV_ES_GEN_REQ 0 +#define GHCB_SEV_ES_PROT_UNSUPPORTED 1 #define GHCB_RESP_CODE(v) ((v) & GHCB_MSR_INFO_MASK) diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index 787dc5f568b5..ce987688bbc0 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -221,7 +221,7 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code) fail: /* Terminate the guest */ - sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST); + sev_es_terminate(GHCB_SEV_ES_GEN_REQ); } static enum es_result vc_insn_string_read(struct es_em_ctxt *ctxt, diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index 74f0ec955384..0a6c82e060e0 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -1411,7 +1411,7 @@ DEFINE_IDTENTRY_VC_KERNEL(exc_vmm_communication) show_regs(regs); /* Ask hypervisor to sev_es_terminate */ - sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST); + sev_es_terminate(GHCB_SEV_ES_GEN_REQ); /* If that fails and we get here - just panic */ panic("Returned from Terminate-Request to Hypervisor\n"); @@ -1459,7 +1459,7 @@ bool __init handle_vc_boot_ghcb(struct pt_regs *regs) /* Do initial setup or terminate the guest */ if (unlikely(boot_ghcb == NULL && !sev_es_setup_ghcb())) - sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST); + sev_es_terminate(GHCB_SEV_ES_GEN_REQ); vc_ghcb_invalidate(boot_ghcb);