From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5150C636CB for ; Fri, 16 Jul 2021 15:35:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57112613F3 for ; Fri, 16 Jul 2021 15:35:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57112613F3 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 86BAA8D00F5; Fri, 16 Jul 2021 11:35:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81BD88D00EC; Fri, 16 Jul 2021 11:35:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 695618D00F5; Fri, 16 Jul 2021 11:35:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 485898D00EC for ; Fri, 16 Jul 2021 11:35:13 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 03C2C824805A for ; Fri, 16 Jul 2021 15:35:12 +0000 (UTC) X-FDA: 78368849664.34.3E89622 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf21.hostedemail.com (Postfix) with ESMTP id B5AAFD00C895 for ; Fri, 16 Jul 2021 15:35:11 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id b12so5477073plh.10 for ; Fri, 16 Jul 2021 08:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0cTnZy2I4CZKY1bHPxJLKssBACveTIPG9X+4FMx1/uQ=; b=afSs59INL/oaaVSpQPeRtiIcJrpZwqHHpaDKcKMQGA6aWrOaBsFQgpUgROlc1OHvsr R8+DUt0nxbzW92N5jyf1GQnF/hr52cuxKwcH10Pr8I7RED3k1ryiX7DXdXuaA7APN6m4 XWPOS5SwXn7SL7HD5a2j5vD6dOKAEQY9m1vnGiABnDA5fHtdH2zr8Y5fdOgg0bb0iuku DojBvVx1otGchwtODy/S4//wZ2V3ziB+XpzqgAvJEq/hlGIebWzzQh0E5JJgub29thOP YmvVF0HsEbccSVc12R6sAKoXRNAtlV+kh3t3D5Xb8MzS29UsDlX4R1djNaCtt7Rgc/uW jh4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0cTnZy2I4CZKY1bHPxJLKssBACveTIPG9X+4FMx1/uQ=; b=snvcZ8OjrfQN17dQk2APKTHiy5Arxxj/p6kk0Ik3hkVRfrzgqKszB+oB8jSZR6jgyy YoClXtcGDawFskgLz1xVYDRKGfDbhOWEME6M3e0/a9gbg6Gv+gtlepIzzCDPgvdBUp7G cgyWLi2awpoRfrYRKYKKxLh/5t0Vk/P4kJRU4e0caMEx1D3TtMwhTNqB8vCOlit3OjJ1 sEC30gjVsM4DpgrkqKiLP47RzUun5nrfngQbKP2VMdk1/y6x8TNUrFeV0PQBsvX9hmi4 qmc4fHTqZLogmcm7gckD+jEyE7qCy1me3bQZ0AQ50ZAn0x99vTNWzcRFcXrZY5+cfDsW KF0A== X-Gm-Message-State: AOAM530mu/c0ltbqPJ+KFP7HIf1puPwOqNXmd6nEVEdch7QUJsOGOFgA 8YANz9I3uhgBBWrNZFRlfvrofw== X-Google-Smtp-Source: ABdhPJzO0czTiC4lrspMK8pptIQ8UcgEuTYWN2rX0ygskl7xaEBTKiH2YjQzLJUVfWfhZQnvHsTqCA== X-Received: by 2002:a17:902:ed82:b029:ef:48c8:128e with SMTP id e2-20020a170902ed82b02900ef48c8128emr8350696plj.72.1626449710421; Fri, 16 Jul 2021 08:35:10 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id j21sm8548916pjz.26.2021.07.16.08.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 08:35:09 -0700 (PDT) Date: Fri, 16 Jul 2021 15:35:05 +0000 From: Sean Christopherson To: Brijesh Singh Cc: 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, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , 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 , tony.luck@intel.com, npmccallum@redhat.com, brijesh.ksingh@gmail.com Subject: Re: [PATCH Part2 RFC v4 15/40] crypto: ccp: Handle the legacy TMR allocation when SNP is enabled Message-ID: References: <20210707183616.5620-1-brijesh.singh@amd.com> <20210707183616.5620-16-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=afSs59IN; spf=pass (imf21.hostedemail.com: domain of seanjc@google.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=seanjc@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B5AAFD00C895 X-Stat-Signature: ky3xofcb3ofibebznpm9q5dsetaepre7 X-HE-Tag: 1626449711-967568 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: On Fri, Jul 16, 2021, Brijesh Singh wrote: > > On 7/15/21 6:48 PM, Sean Christopherson wrote: > > On Wed, Jul 07, 2021, Brijesh Singh wrote: > >> @@ -1204,16 +1322,6 @@ void sev_pci_init(void) > >> sev_update_firmware(sev->dev) == 0) > >> sev_get_api_version(); > >> > >> - /* Obtain the TMR memory area for SEV-ES use */ > >> - tmr_page = alloc_pages(GFP_KERNEL, get_order(SEV_ES_TMR_SIZE)); > >> - if (tmr_page) { > >> - sev_es_tmr = page_address(tmr_page); > >> - } else { > >> - sev_es_tmr = NULL; > >> - dev_warn(sev->dev, > >> - "SEV: TMR allocation failed, SEV-ES support unavailable\n"); > >> - } > >> - > >> /* > >> * If boot CPU supports the SNP, then first attempt to initialize > >> * the SNP firmware. > >> @@ -1229,6 +1337,16 @@ void sev_pci_init(void) > >> } > >> } > >> > >> + /* Obtain the TMR memory area for SEV-ES use */ > >> + tmr_page = __snp_alloc_firmware_pages(GFP_KERNEL, get_order(sev_es_tmr_size), false); > >> + if (tmr_page) { > >> + sev_es_tmr = page_address(tmr_page); > >> + } else { > >> + sev_es_tmr = NULL; > >> + dev_warn(sev->dev, > >> + "SEV: TMR allocation failed, SEV-ES support unavailable\n"); > >> + } > > I think your patch ordering got a bit wonky. AFAICT, the chunk that added > > sev_snp_init() and friends in the previous patch 14 should have landed above > > the TMR allocation, i.e. the code movement here should be unnecessary. > > I was debating about it whether to include all the SNP supports in one > patch or divide it up. If I had included all legacy support new > requirement in the same patch which adds the SNP then it will be a big > patch. I had feeling that others may ask me to split it. It wasn't comment on the patch organization, rather that the code added in patch 14 appears to have landed in the wrong location within the code. The above diff shows that the TMR allocation is being moved around the SNP initialization code that was added in patch 14 (the immediately prior patch). Presumably the required order doesn't magically change just because the TMR is now being allocated as a 2mb blob, so either the code movement is unnecessary churn or the original location was wrong. In either case, landing the SNP initialization code above the TMR allocation in patch 14 would eliminate the above code movement.