Re: [PATCH v13 11/24] gunyah: vm_mgr: Add ioctls to support basic non-proxy VM boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/9/23 3:47 PM, Elliot Berman wrote:
Add remaining ioctls to support non-proxy VM boot:

  - Gunyah Resource Manager uses the VM's devicetree to configure the
    virtual machine. The location of the devicetree in the guest's
    virtual memory can be declared via the SET_DTB_CONFIG ioctl.
  - Trigger start of the virtual machine with VM_START ioctl.

Co-developed-by: Prakruthi Deepak Heragu <quic_pheragu@xxxxxxxxxxx>
Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@xxxxxxxxxxx>
Signed-off-by: Elliot Berman <quic_eberman@xxxxxxxxxxx>

I point out a spelling error, but otherwise this looks OK to me.

Reviewed-by: Alex Elder <elder@xxxxxxxxxx>

---
  drivers/virt/gunyah/vm_mgr.c    | 215 ++++++++++++++++++++++++++++++++
  drivers/virt/gunyah/vm_mgr.h    |  11 ++
  drivers/virt/gunyah/vm_mgr_mm.c |  20 +++
  include/uapi/linux/gunyah.h     |  15 +++
  4 files changed, 261 insertions(+)



. . .

+static int gh_vm_ensure_started(struct gh_vm *ghvm)
+{
+	int ret;
+
+	ret = down_read_interruptible(&ghvm->status_lock);
+	if (ret)
+		return ret;
+
+	/* Unlikely because VM is typically started */
+	if (unlikely(ghvm->vm_status == GH_RM_VM_STATUS_NO_STATE)) {
+		up_read(&ghvm->status_lock);
+		ret = gh_vm_start(ghvm);
+		if (ret)
+			return ret;
+		/** gh_vm_start() is guaranteed to bring status out of
+		 * GH_RM_VM_STATUS_LOAD, thus inifitely recursive call is not

s/inifitely/infinitely/

+		 * possible
+		 */
+		return gh_vm_ensure_started(ghvm);
+	}
+
+	/* Unlikely because VM is typically running */
+	if (unlikely(ghvm->vm_status != GH_RM_VM_STATUS_RUNNING))
+		ret = -ENODEV;
+
+	up_read(&ghvm->status_lock);
+	return ret;
+}
+
  static long gh_vm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  {
  	struct gh_vm *ghvm = filp->private_data;
. . .



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux