[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75cb309b-b05c-42a0-a3ca-de08fa1cae59@amd.com>
Date: Fri, 31 May 2024 12:34:49 -0500
From: "Kalra, Ashish" <ashish.kalra@....com>
To: Borislav Petkov <bp@...en8.de>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"Rafael J. Wysocki" <rafael@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
Elena Reshetova <elena.reshetova@...el.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
Sean Christopherson <seanjc@...gle.com>, "Huang, Kai" <kai.huang@...el.com>,
Ard Biesheuvel <ardb@...nel.org>, Baoquan He <bhe@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, "K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>, kexec@...ts.infradead.org,
linux-hyperv@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-coco@...ts.linux.dev, linux-kernel@...r.kernel.org,
Tao Liu <ltao@...hat.com>
Subject: Re: [PATCHv11 11/19] x86/tdx: Convert shared memory back to private
on kexec
Hello Boris,
On 5/31/2024 10:14 AM, Borislav Petkov wrote:
>> static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
>> {
>> - if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))
>> - return __set_memory_enc_pgtable(addr, numpages, enc);
>> + int ret = 0;
>>
>> - return 0;
>> + if (cc_platform_has(CC_ATTR_MEM_ENCRYPT)) {
>> + if (!down_read_trylock(&mem_enc_lock))
>> + return -EBUSY;
>> +
>> + ret = __set_memory_enc_pgtable(addr, numpages, enc);
>> +
>> + up_read(&mem_enc_lock);
>> + }
> So CC_ATTR_MEM_ENCRYPT is set for SEV* guests too. You need to change
> that code here to take the lock only on TDX, where you want it, not on
> the others.
SNP guest kexec patches are based on top of this patch-series and SNP
guests also need this exclusive mem_enc_lock protection, so
CC_ATTR_MEM_ENCRYPT makes sense to be used here.
Thanks, Ashish
Powered by blists - more mailing lists