Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1561546pxb; Fri, 20 Aug 2021 08:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqWjm6m9NFiU99JCJ8RkWBvzIbty+cO+h4Az3v7UtgGyjcunBTUeVnwcz0d0rqPDHhUXlP X-Received: by 2002:a5d:97cc:: with SMTP id k12mr16443694ios.4.1629472981763; Fri, 20 Aug 2021 08:23:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629472981; cv=pass; d=google.com; s=arc-20160816; b=km7++DcgOCpoxtg1Ij4Dv+XWvxWxgxf0W2T2POh9MM06cpZfX3IanSX7DOYtBdyWeT sp1xbEwBAdmIiG50VKyvhlN3Qhefl6eU9N8ONTHzroJ2m5gycxCCDH9KQZZH9x5z6ztL O+g+Tt5EA5BdARDuZgftp7TY8uHsAn1pciy+PX7b4dqzSnzKtoRuAVZDxNDJXUlJLqbz 9J+7jO+mWGdHxJgwpLIs0rEBtkY0G+9CZ4QJbkVFMDOv7hxtDkRIN19TeD/XfXk5Rfyi TemZKbo/R1Eygt5l/E/7LKrTa2AMOjE1lGADv9/89lmxJp9357G/vW8Qkl0ZNWlQ7/iG jZeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BO5CBULvSRYz6y1MYiiXQ4rtiz9Cj7y8LYIG1pAHdNc=; b=DDiq0J80sCJh1MzGSlROhD6Ii/nKvJmYVYXZmPliyUNh9gdBIFbNSF1k8jqLnN8Ie8 upDV+sBZQxdrVBCJlWBnY8Q1QuN7Zlq8aYVNJOWa2ZM7+1uk2Dt0KbXF2H26OUql7RvR 3egC3FQwjbNraacry3Vz1wxSBi0pta3fkYutLXlshA5kkTUACfcpRLJ95n58F74fTAPV gJKtPpZrEfHplfTbAuP/bbmoGs9NGbv+Iq1ElqFBXccNOfaB+47hyQ3hng3fvPk++mqP Q8GHxrtmAe8TRw8wCGaC/tPttOAT73CyWeJamyNgIByw4MHoQI9zQqYcNDSNuUuRuIBr ER/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Iwtmz/cn"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si1027935ilt.54.2021.08.20.08.22.49; Fri, 20 Aug 2021 08:23:01 -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=@amd.com header.s=selector1 header.b="Iwtmz/cn"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241088AbhHTPVf (ORCPT + 99 others); Fri, 20 Aug 2021 11:21:35 -0400 Received: from mail-bn8nam08on2046.outbound.protection.outlook.com ([40.107.100.46]:11233 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241042AbhHTPV3 (ORCPT ); Fri, 20 Aug 2021 11:21:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KQYvdvkcfMEYca3m6nLMU45IbEnRWlXKe4DKCZ60Zf/gxUPcZsgygnnfDt/X2Pv1awvH9ZoN5J/N9STt/bhg3R/6pu2ApAFRYNJEasVmQ5jFsVUerAAHItE8edosBNthmyafw62bZH46xk9yG8RGupVDzNGYYwHgi3DlsH74SKmNvum1ecqYMe95yIYXf/8V9hUYclCtAMvmjcYZUKDfa0j39JeLSJCAlGQXp8NhYg4Qtrn9Jquwk/phlnyUAXeaBj8GT5AQZryHv4YIS5oNVlW3H89ylgvLNU9KFK0dT1cmTroGKVWUSjbzc9uHJGAP6J7IrlSiZA+M0LlEHHo6Cw== 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=BO5CBULvSRYz6y1MYiiXQ4rtiz9Cj7y8LYIG1pAHdNc=; b=h6Re++w8EpOuZLYUDLu64Yi/Jiu3OYbF8vfrX6Ed0Yq4bXqOv9CBTyzFDsD7h5aH1KwDK5LXVcLQujEomXyQu15OSKJdemnYGZh21aZ4jU17Jhm/svz7Fm58K0XQjFkXeyH4ea87vUVadSSAkM5UtcAcGJyonNyNOXXS+9SIw//RP55+NwAcLZvq2O3KIHy9/KMoKby3lQq6MinPALM7q/RSG6NPG62nG9+WQTHoaHHQA6fze5HwK8SrCk/UGfxzvxL9iBLkZ51HQANxiSi0y0m+yWInpGQ4FwN1ueRE+1Mpg8v2/NWlWmLPBIE2j3MEdpDZJS1VJjQ7/8MIWIrnXA== 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=BO5CBULvSRYz6y1MYiiXQ4rtiz9Cj7y8LYIG1pAHdNc=; b=Iwtmz/cn+rO1eMOxeC/YVk5PDJbJDxEsVfD1bS8XwvulYdGa+4CYh7GXUG/josUvxt5hrdXe2cd2lis57bP4Dxf8O/MfB+U74cf+n3sW7wtbYweEKlyzftyiZSybKv2Y49M4WbmHGwD4AO4g1tPnIpHui0kuLNjtv/X+uxFeHug= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4557.namprd12.prod.outlook.com (2603:10b6:806:9d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Fri, 20 Aug 2021 15:20:48 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3%6]) with mapi id 15.20.4436.019; Fri, 20 Aug 2021 15:20:48 +0000 From: Brijesh Singh To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org Cc: Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , 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 , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, Brijesh Singh Subject: [PATCH Part1 v5 02/38] x86/sev: Shorten GHCB terminate macro names Date: Fri, 20 Aug 2021 10:18:57 -0500 Message-Id: <20210820151933.22401-3-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210820151933.22401-1-brijesh.singh@amd.com> References: <20210820151933.22401-1-brijesh.singh@amd.com> Content-Type: text/plain X-ClientProxiedBy: SA9P223CA0002.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::7) 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 SA9P223CA0002.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Fri, 20 Aug 2021 15:20:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2259aa3d-213d-4ed2-c24b-08d963ee16cd X-MS-TrafficTypeDiagnostic: SA0PR12MB4557: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TJQn6Pd+PtMQCPBrxGjJGbJf9skReS4KoIii6N3o5dQ1VTQe2RyArgIGBUlJtJhCzSoymHZDFxgPx4omrmDgka7BFRJQY+d6Bysvw4MmSUyL/IkH+Q6Vy14EmDNVfH/7lNb1dEhX/KywORzX3P4NxGqmcSKr5V4HPbChZZ3DLZK/bS5IggZCYyjEr7f4lKu9BP6AkSvfDRBo/Hx+1i2ltdNH//JlXQydsOEWJchnY8uLJxWmvsBsllf4UT0STNHwxhotECgiaxpmgYt4DmexuVP4NvU253EceaWFQKcWyjUYE5usE8heTSQ7h5QEj0i4t01aLCcoxC5E5wdiZ65vIjQ3ojcS1c2pQN/5DhCmog6Rb6V6VVfIHdNPvstfcL/lMb+A6p52na70VSIsFNAQoE/94jtaK3qiPU0yYVhwQR+PCPF1E2RXRMb9O1DIA9GdTlGlpVClZ2MIQKx9HLz45dFkt9bKMXHqXkjsEscjCvNHC5IVYpt3cgI2K49sCGAbxUptRYQAFHarcLfL8g52NV7PlTfc1BAOCZzmWOmRXrLtXjZNHXXHTau/MejKtVKS/DfF5x1eZDTMUdtjhmDYfwdFCesxHjVDuU2QdCAKQJjS1DVZ4VBc6BHG1vtfBBXcbz8e+naAeFtYmG5t/uPRUaoof3x7PgvDcm6Qqwqrs1rYdob5cbNhE1Y+3wwhw6ZSrE4iItOk3lJNKY8YzgPGtQ== 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)(346002)(396003)(366004)(39860400002)(136003)(376002)(66476007)(66946007)(4326008)(478600001)(44832011)(956004)(2616005)(7696005)(7406005)(38350700002)(52116002)(66556008)(7416002)(38100700002)(6666004)(36756003)(186003)(316002)(8936002)(2906002)(83380400001)(86362001)(26005)(54906003)(1076003)(6486002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vwZAHDQeVK/dlBvXSptKFbJdnYdYaoR/NvmqqV9WhLfHWPBGGUMs0hFSkzvR?= =?us-ascii?Q?MbBf54s4dVabVs7CBLOqHqqrZB4UESZr4KJWOODSmpPn8ZC0sx9V96/5pKCM?= =?us-ascii?Q?+wJ1EWvD3cg/oWG/TL3zm6q2eDM9qKgUx361D3Unxk/SAwn7OB22F04Nj8nt?= =?us-ascii?Q?oyhZWnsqJWwDxHIuahc4ojJQY9AgzW/x/aZV87MKPprbnUnPnctr/kPrrf7U?= =?us-ascii?Q?lUDoZpy6mUjocv5mpQh1Lpa8UJk4Zwon9nxIqJ4FTLO76hzOSLdvEN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iv0+gQZUh7seHnF6Di/eAv015?= =?us-ascii?Q?yTykEs15i2PTCPLZl8helSe9vO+BCwqYAxlE0STQZEch1JInmPSiZLo8png3?= =?us-ascii?Q?sF02ULCe5owJquGUiY8wPfiqVXfZOrMVCI77yK42Jhw/ldeMkq4Rq8GUD8oo?= =?us-ascii?Q?iprYfyJlMaPb79Yq/lIpYl7e?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2259aa3d-213d-4ed2-c24b-08d963ee16cd X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2021 15:20:48.7484 (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: UxKffzocIIPPdK+u+AOrUxftr4S9x6VetlVQ29hD6yNqIBdRTvunLx5UGzOErC5zTT3u4dwVRxwDwbHRQM9isw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4557 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 670e998fe930..28bcf04c022e 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,5 +202,5 @@ 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); } 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 9f90f460a28c..114f62fe2529 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -208,7 +208,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 a6895e440bc3..71744ee0add6 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -1429,7 +1429,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"); @@ -1477,7 +1477,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); -- 2.17.1