lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Jul 2019 23:38:40 +0000
From:   Michael Kelley <mikelley@...rosoft.com>
To:     Dexuan Cui <decui@...rosoft.com>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Sasha Levin <Alexander.Levin@...rosoft.com>,
        "sashal@...nel.org" <sashal@...nel.org>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        KY Srinivasan <kys@...rosoft.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 7/7] Drivers: hv: vmbus: Implement suspend/resume for VSC
 drivers for hibernation

From: Dexuan Cui <decui@...rosoft.com> Sent: Monday, July 8, 2019 10:30 PM
> 
> The high-level VSC drivers will implement device-specific callbacks.
> 
> Signed-off-by: Dexuan Cui <decui@...rosoft.com>
> ---
>  drivers/hv/vmbus_drv.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  include/linux/hyperv.h |  3 +++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 1730e7b..e29e2171 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -911,6 +911,43 @@ static void vmbus_shutdown(struct device *child_device)
>  		drv->shutdown(dev);
>  }
> 
> +/*
> + * vmbus_suspend - Suspend a vmbus device
> + */
> +static int vmbus_suspend(struct device *child_device)
> +{
> +	struct hv_driver *drv;
> +	struct hv_device *dev = device_to_hv_device(child_device);
> +
> +	/* The device may not be attached yet */
> +	if (!child_device->driver)
> +		return 0;
> +
> +	drv = drv_to_hv_drv(child_device->driver);
> +	if (!drv->suspend)
> +		return -EOPNOTSUPP;
> +
> +	return drv->suspend(dev);
> +}
> +
> +/*
> + * vmbus_resume - Resume a vmbus device
> + */
> +static int vmbus_resume(struct device *child_device)
> +{
> +	struct hv_driver *drv;
> +	struct hv_device *dev = device_to_hv_device(child_device);
> +
> +	/* The device may not be attached yet */
> +	if (!child_device->driver)
> +		return 0;
> +
> +	drv = drv_to_hv_drv(child_device->driver);
> +	if (!drv->resume)
> +		return -EOPNOTSUPP;
> +
> +	return drv->resume(dev);
> +}
> 
>  /*
>   * vmbus_device_release - Final callback release of the vmbus child device
> @@ -926,6 +963,10 @@ static void vmbus_device_release(struct device *device)
>  	kfree(hv_dev);
>  }
> 
> +static const struct dev_pm_ops vmbus_pm = {
> +	SET_SYSTEM_SLEEP_PM_OPS(vmbus_suspend, vmbus_resume)
> +};
> +
>  /* The one and only one */
>  static struct bus_type  hv_bus = {
>  	.name =		"vmbus",
> @@ -936,6 +977,7 @@ static void vmbus_device_release(struct device *device)
>  	.uevent =		vmbus_uevent,
>  	.dev_groups =		vmbus_dev_groups,
>  	.drv_groups =		vmbus_drv_groups,
> +	.pm =			&vmbus_pm,
>  };
> 
>  struct onmessage_work_context {
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
> index 6256cc3..94443c4 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -1149,6 +1149,9 @@ struct hv_driver {
>  	int (*remove)(struct hv_device *);
>  	void (*shutdown)(struct hv_device *);
> 
> +	int (*suspend)(struct hv_device *);
> +	int (*resume)(struct hv_device *);
> +
>  };
> 
>  /* Base device object */
> --
> 1.8.3.1

Reviewed-by: Michael Kelley <mikelley@...rosoft.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ