[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0d9e9af-1017-953d-3243-facb2ee687b8@amd.com>
Date: Thu, 5 Sep 2024 10:05:46 +0530
From: "Nikunj A. Dadhania" <nikunj@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, thomas.lendacky@....com, x86@...nel.org,
kvm@...r.kernel.org, mingo@...hat.com, tglx@...utronix.de,
dave.hansen@...ux.intel.com, pgonda@...gle.com, seanjc@...gle.com,
pbonzini@...hat.com
Subject: Re: [PATCH v11 08/20] virt: sev-guest: Consolidate SNP guest
messaging parameters to a struct
On 9/4/2024 8:01 PM, Borislav Petkov wrote:
> On Wed, Jul 31, 2024 at 08:37:59PM +0530, Nikunj A Dadhania wrote:
>> +static int handle_guest_request(struct snp_guest_dev *snp_dev, u64 exit_code,
>> + struct snp_guest_request_ioctl *rio, u8 type,
>> + void *req_buf, size_t req_sz, void *resp_buf,
>> + u32 resp_sz)
>> +{
>> + struct snp_guest_req req = {
>> + .msg_version = rio->msg_version,
>> + .msg_type = type,
>> + .vmpck_id = vmpck_id,
>> + .req_buf = req_buf,
>> + .req_sz = req_sz,
>> + .resp_buf = resp_buf,
>> + .resp_sz = resp_sz,
>> + .exit_code = exit_code,
>> + };
>> +
>> + return snp_send_guest_request(snp_dev, &req, rio);
>> +}
>
> Right, except you don't need that silly routine copying stuff around either
> but simply do the right thing at each call site from the get-go.
>
> using the following coding pattern:
>
> struct snp_guest_req req = { };
>
> /* assign all members required for the respective call: */
> req.<member> = ...;
> ...
>
> err = snp_send_guest_request(snp_dev, &req, rio);
> if (err)
> ...
Sure, will update all the call sites.
Regards
Nikunj
Powered by blists - more mailing lists