Thread (111 messages) 111 messages, 9 authors, 2023-03-02

Re: [PATCH v10 12/26] gunyah: vm_mgr: Add/remove user memory regions

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2023-02-16 06:38:53
Also in: linux-arm-msm, linux-devicetree, linux-doc, lkml

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?
+	case GH_VM_SET_USER_MEM_REGION: {
+		struct gh_userspace_memory_region region;
+
+		if (copy_from_user(&region, 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, &region);
+		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?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help