[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24903cd3-f5e1-c770-212b-e46149854792@amd.com>
Date: Wed, 19 Jun 2024 10:12:00 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: "Nikunj A. Dadhania" <nikunj@....com>, linux-kernel@...r.kernel.org,
bp@...en8.de, x86@...nel.org, kvm@...r.kernel.org
Cc: mingo@...hat.com, tglx@...utronix.de, dave.hansen@...ux.intel.com,
pgonda@...gle.com, seanjc@...gle.com, pbonzini@...hat.com
Subject: Re: [PATCH v9 06/24] virt: sev-guest: Simplify VMPCK and sequence
number assignments
On 6/19/24 01:06, Nikunj A. Dadhania wrote:
> On 6/19/2024 2:57 AM, Tom Lendacky wrote:
>> On 5/30/24 23:30, Nikunj A Dadhania wrote:
>
> I have separated patch 6 and 7 for better code review and modular changes.
>
> The next patch simplifes this further to:
>
> static inline u8 *get_vmpck(struct snp_guest_dev *snp_dev)
> {
> return snp_dev->secrets->vmpck[snp_dev->vmpck_id];
> }
>
> static bool assign_vmpck(struct snp_guest_dev *dev, unsigned int vmpck_id)
> {
> if ((vmpck_id + 1) > VMPCK_MAX_NUM)
Ok, this still has the "+ 1" thing (and it should be >=, right?). How about:
if (!(vmpck_id < VMPCK_MAX_NUM))
return false;
Just makes it easier to read for me, but if no one else has an issue,
don't worry about it.
Thanks,
Tom
> return false;
>
> dev->vmpck_id = vmpck_id;
>
> return true;
> }
>
>
> Regards
> Nikunj
Powered by blists - more mailing lists