From: Tom Lendacky <thomas.lendacky@amd.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
David Miller <davem@davemloft.net>,
Borislav Petkov <bp@alien8.de>,
Brijesh Singh <brijesh.singh@amd.com>
Subject: Re: [PATCH] crypto: ccp: Add support for SEV-ES to the PSP driver
Date: Tue, 21 Apr 2020 08:15:16 -0500 [thread overview]
Message-ID: <c609bc22-735a-0db9-3367-0713898707ab@amd.com> (raw)
In-Reply-To: <20200421123311.GJ21900@8bytes.org>
On 4/21/20 7:33 AM, Joerg Roedel wrote:
> 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.
Ah, I did not realize that. I'll update the patch to allocate just 1M then.
Thanks,
Tom
>
> Other than that this patch looks good to me.
>
> Regards,
>
> Joerg
>
prev parent reply other threads:[~2020-04-21 13:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 19:54 [PATCH] crypto: ccp: Add support for SEV-ES to the PSP driver Tom Lendacky
2020-04-21 12:33 ` Joerg Roedel
2020-04-21 13:15 ` Tom Lendacky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c609bc22-735a-0db9-3367-0713898707ab@amd.com \
--to=thomas.lendacky@amd.com \
--cc=bp@alien8.de \
--cc=brijesh.singh@amd.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=joro@8bytes.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).