[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94992117-2cab-71e6-f38c-bded109171d2@quicinc.com>
Date: Thu, 16 Feb 2023 09:24:45 -0800
From: Elliot Berman <quic_eberman@...cinc.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Alex Elder <elder@...aro.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Prakruthi Deepak Heragu <quic_pheragu@...cinc.com>,
Murali Nalajala <quic_mnalajal@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>,
Carl van Schaik <quic_cvanscha@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
"Arnd Bergmann" <arnd@...db.de>, Rob Herring <robh+dt@...nel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@...aro.org>,
Jonathan Corbet <corbet@....net>,
Bagas Sanjaya <bagasdotme@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Jassi Brar <jassisinghbrar@...il.com>,
<linux-arm-msm@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v10 12/26] gunyah: vm_mgr: Add/remove user memory regions
On 2/15/2023 10:38 PM, Greg Kroah-Hartman wrote:
> On Tue, Feb 14, 2023 at 01:24:16PM -0800, Elliot Berman wrote:
>>
>> When launching a virtual machine, Gunyah userspace allocates memory for
>> the guest and informs Gunyah about these memory regions through
>> SET_USER_MEMORY_REGION ioctl.
>
> It also frees memory, see below. Why not document that?
>
I can mention in commit text, too.
>> + case GH_VM_SET_USER_MEM_REGION: {
>> + struct gh_userspace_memory_region region;
>> +
>> + if (copy_from_user(®ion, argp, sizeof(region)))
>> + return -EFAULT;
>> +
>> + /* All other flag bits are reserved for future use */
>> + if (region.flags & ~(GH_MEM_ALLOW_READ | GH_MEM_ALLOW_WRITE | GH_MEM_ALLOW_EXEC |
>> + GH_MEM_LENT))
>> + return -EINVAL;
>
> Nice, thanks for validating that.
>
>
>> +
>> +
>
> Nit, 2 blank lines are not needed :(
>
>
>> + if (region.memory_size)
>> + r = gh_vm_mem_alloc(ghvm, ®ion);
>> + else
>> + r = gh_vm_mem_free(ghvm, region.label);
>
> So if you set the size to 0 it is freed? Wouldn't a separate ioctl make
> more sense? Where is this logic documented to userspace? >
We're following KVM convention here. The logic is documented in patch 17/26.
Thanks,
Elliot
Powered by blists - more mailing lists