Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp101136ybz; Tue, 21 Apr 2020 05:34:04 -0700 (PDT) X-Google-Smtp-Source: APiQypKhIX7Ind0pBBcp3bGswDd1wDPt5bJFBTPs6gQu9HSZBg5LZ6zBMcTmudOIBVYaz1UPtoGP X-Received: by 2002:a05:6402:17e3:: with SMTP id t3mr18829323edy.203.1587472443804; Tue, 21 Apr 2020 05:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587472443; cv=none; d=google.com; s=arc-20160816; b=I4HfQUq6n1xmnjYU+YN73SSkbpnXRogf34JNGS20Au9sn+CB5tWPbaIBqCdjYnRTzN PERfomV1T88IuIdzajlgf+IK1A9ZtDyvKRwKgRNgSkhApRI0iNSJ6iITpVwvQQWbuiE1 YmQIPGjOpDg7S6ulzUVuVPHU9BtqmOLnovtXNnpY9nSu5Cafy0ABQScLD4U/2vEppOuw undQPEsKV5Sl5XZEOTj13mSk2f/+Z9kL2LXZqC5KGliqwaZ9cZi4C32M9I2uk6Fm+vD2 UNlNcTLFxf8Ri6vtkGtTQ4jNSu1ho+3N/ZhubH+meYm8hbaUcXqroa9xc4kGy0QHTmCB LHkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7NEj2sRXNBIkySKkG0OSq2YDMUCl4HD9QB3NEE7v7vk=; b=biDzVXP2hTgqFoVwtRT9mwFl3gdQg7CNdTaUHCBTyHdX5OVP+UX696P5fK032Ou6kD ylQevSg+F4oZLL/Ioq1fQ6rP8IcDimVBYCg5ZwVF8PdgduYyAefJ8pAnDprTlM19y8JA JRxGxIQDhR+fXG+DjqvXCOTDioMkbE4wbaCPBOR4yoqPndzSBJW9744Dj0Ef3ABvn+xb YTvRUUm9b7/diG01RQTJtIFv7XtSxvqnQTVrZ5ote7kIrapzgCNzxOQjAmlr2di4p8sL d2HDREG2MpTjo9nAUi5KMBJMWWuAd1SWUTTl7+D21WqUi87kJ+29gjZwrYr1Qzi/l+ao pTBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 dp4si1839071ejc.399.2020.04.21.05.33.31; Tue, 21 Apr 2020 05:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S1728337AbgDUMdR (ORCPT + 99 others); Tue, 21 Apr 2020 08:33:17 -0400 Received: from 8bytes.org ([81.169.241.247]:36602 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728576AbgDUMdQ (ORCPT ); Tue, 21 Apr 2020 08:33:16 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id CB4602B0; Tue, 21 Apr 2020 14:33:14 +0200 (CEST) Date: Tue, 21 Apr 2020 14:33:11 +0200 From: Joerg Roedel To: Tom Lendacky Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Herbert Xu , David Miller , Borislav Petkov , Brijesh Singh Subject: Re: [PATCH] crypto: ccp: Add support for SEV-ES to the PSP driver Message-ID: <20200421123311.GJ21900@8bytes.org> References: <134926f3bcd38e51d5d0b0919afc7a16311d9c0f.1587412498.git.thomas.lendacky@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <134926f3bcd38e51d5d0b0919afc7a16311d9c0f.1587412498.git.thomas.lendacky@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Tom, On Mon, Apr 20, 2020 at 02:54:58PM -0500, Tom Lendacky wrote: > static inline bool sev_version_greater_or_equal(u8 maj, u8 min) > { > struct sev_device *sev = psp_master->sev_data; > @@ -214,6 +226,21 @@ static int __sev_platform_init_locked(int *error) > if (sev->state == SEV_STATE_INIT) > return 0; > > + if (sev_es_tmr) { > + u64 tmr_pa; > + > + /* > + * Do not include the encryption mask on the physical > + * address of the TMR (firmware should clear it anyway). > + */ > + tmr_pa = __pa(sev_es_tmr); > + tmr_pa = ALIGN(tmr_pa, SEV_ES_TMR_ALIGN); No need to manually align the region, see below. > + /* Obtain the TMR memory area for SEV-ES use */ > + tmr_page = alloc_pages(GFP_KERNEL, get_order(SEV_ES_TMR_LEN)); > + 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"); > + } This allocates a 2M region where 1M is needed. The page allocator gives you naturally aligned region for any allocation order, so when you allocate 1M, it will automatically be 1M aligned. Other than that this patch looks good to me. Regards, Joerg