mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, Brijesh Singh <brijesh.singh@amd.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2 4/5] x86/mm: Prepare sme_encrypt_kernel() for PAGE aligned encryption
Date: Mon, 8 Jan 2018 17:20:15 -0600	[thread overview]
Message-ID: <e376cb45-7238-c818-93fe-34286a597ac1@amd.com> (raw)
In-Reply-To: <20180107182513.3bvw3xgrzaxi23m3@pd.tnic>

On 1/7/2018 12:25 PM, Borislav Petkov wrote:
> On Thu, Dec 21, 2017 at 04:03:21PM -0600, Tom Lendacky wrote:
>> @@ -568,17 +578,57 @@ static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd)
>>  		native_set_pud(pud_p, pud);
>>  	}
>>  
>> +	return pmd_p;
>> +}
>> +
>> +static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd)
>> +{
>> +	pmd_t *pmd_p;
>> +
>> +	pmd_p = sme_prepare_pgd(ppd);
>> +	if (!pmd_p)
>> +		return;
>> +
>>  	pmd_p += pmd_index(ppd->vaddr);
>>  	if (!native_pmd_val(*pmd_p) || !(native_pmd_val(*pmd_p) & _PAGE_PSE))
>>  		native_set_pmd(pmd_p,
>>  			       native_make_pmd(ppd->paddr | ppd->pmd_flags));
> 
> Ugly linebreak.

That one will be fixed in the previous patch.

> 
>>  }
>>  
>> -static void __init __sme_map_range(struct sme_populate_pgd_data *ppd,
>> -				   pmdval_t pmd_flags)
>> +static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd)
>>  {
>> -	ppd->pmd_flags = pmd_flags;
>> +	pmd_t *pmd_p;
>> +	pte_t *pte_p;
>> +
>> +	pmd_p = sme_prepare_pgd(ppd);
>> +	if (!pmd_p)
>> +		return;
>> +
>> +	pmd_p += pmd_index(ppd->vaddr);
>> +	if (native_pmd_val(*pmd_p)) {
>> +		if (native_pmd_val(*pmd_p) & _PAGE_PSE)
>> +			return;
>> +
>> +		pte_p = (pte_t *)(native_pmd_val(*pmd_p) & ~PTE_FLAGS_MASK);
>> +	} else {
>> +		pmd_t pmd;
>>  
>> +		pte_p = ppd->pgtable_area;
>> +		memset(pte_p, 0, sizeof(*pte_p) * PTRS_PER_PTE);
>> +		ppd->pgtable_area += sizeof(*pte_p) * PTRS_PER_PTE;
>> +
>> +		pmd = native_make_pmd((pteval_t)pte_p + PMD_FLAGS);
>> +		native_set_pmd(pmd_p, pmd);
>> +	}
>> +
>> +	pte_p += pte_index(ppd->vaddr);
>> +	if (!native_pte_val(*pte_p))
>> +		native_set_pte(pte_p,
>> +			       native_make_pte(ppd->paddr | ppd->pte_flags));
> 
> Ditto.

And this one will be fixed here.

Thanks,
Tom

> 

  reply	other threads:[~2018-01-08 23:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 22:02 [PATCH v2 0/5] x86: SME: BSP/SME microcode update fix Tom Lendacky
2017-12-21 22:02 ` [PATCH v2 1/5] x86/mm: Cleanup register saving in mem_encrypt_boot.S Tom Lendacky
2017-12-21 22:03 ` [PATCH v2 2/5] x86/mm: Use a struct to reduce parameters for SME PGD mapping Tom Lendacky
2017-12-21 22:03 ` [PATCH v2 3/5] x86/mm: Centralize PMD flags in sme_encrypt_kernel() Tom Lendacky
2018-01-07 16:28   ` Borislav Petkov
2018-01-08 23:18     ` Tom Lendacky
2017-12-21 22:03 ` [PATCH v2 4/5] x86/mm: Prepare sme_encrypt_kernel() for PAGE aligned encryption Tom Lendacky
2018-01-07 18:25   ` Borislav Petkov
2018-01-08 23:20     ` Tom Lendacky [this message]
2017-12-21 22:03 ` [PATCH v2 5/5] x86/mm: Encrypt the initrd earlier for BSP microcode update Tom Lendacky

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=e376cb45-7238-c818-93fe-34286a597ac1@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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

all inboxes | Powered by JetHome®