Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1405447
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Eric Auger <eric.auger@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V5 5/6] vfio: platform: call _RST method when using ACPI |
| Date | Mon, 23 May 2016 17:30:02 +0200 |
| Message-ID | <rBZXQ-7DR-9@gated-at.bofh.it> (permalink) |
| References | <rzgiv-HG-67@gated-at.bofh.it> <rzgiE-HG-303@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=t4AGLgK6CBbNKxXgYwLahQVBghoSKlo+UVMboGVJrTs=; b=T4UWNp15vSkq/+VeKhRRBp/63uMdfhXdQmpoxqiO//IXkVY98Of6kTpaK5t7n6KhJ6 f8MjraPxEqTOMEDmss8goDdNguoxApRzxP441ZtLP5QHw05LqrGPuQ2UgVyD0UEVRBFp IplF2SqQAM6YciKKD3RjVwnXd/pYz6H2TJbos= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=t4AGLgK6CBbNKxXgYwLahQVBghoSKlo+UVMboGVJrTs=; b=g1/e6Er38OMc1PuYr5BXtX858q0f+5b3djB6DJJFdh5N7aKs6/UQyUs2yUTOzzNTh6 +/d0kvOLXLYoVW+yQnC68wJOutL7cL5FblVqd+N8+v0lWh5owHscA99kcDPfN0+MCIU2 JWeVYVPFGLIa8VEaZtAhmqp1rto1tIPewi8LNsUnSxxj8ENXkT62nTCNiqGGbtApXrbi IDy9J0zZCnJVbTnrio6KX0pJehybeqYi0KGmyLiT4Mo9Z257amZhhtGvgSuLsifcjo3S 2V34R9knrYV3JPdew51WXWnOQ0qiIEDU5URzD6O6ZmL5+qIBz1CoJeDS4/ORLgeM9AHW 41MQ== |
| X-Gm-Message-State | AOPr4FXc8U9GfQbgNDWSkzgnqYh15IXcw6jUENNCsuqUMaaktKq+rYhFZG4ebuMYv+sMrMTb |
| X-Received | by 10.28.138.13 with SMTP id m13mr18690327wmd.3.1464016979433; Mon, 23 May 2016 08:22:59 -0700 (PDT) |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 106 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-acpi@vger.kernel.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Baptiste Reynal <b.reynal@virtualopensystems.com>, Alex Williamson <alex.williamson@redhat.com>, linux-kernel@vger.kernel.org |
| X-Original-Date | Mon, 23 May 2016 17:21:27 +0200 |
| X-Original-Message-ID | <57431FF7.2060807@linaro.org> |
| X-Original-References | <1463364819-477-1-git-send-email-okaya@codeaurora.org> <1463364819-477-6-git-send-email-okaya@codeaurora.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1405447 |
Show key headers only | View raw
Hi Sinan,
On 05/16/2016 04:13 AM, Sinan Kaya wrote:
> The device tree code checks for the presence of a reset driver and calls
> the of_reset function pointer by looking up the reset driver as a module.
>
> ACPI defines _RST method to perform device level reset. After the _RST
> method is executed, the OS can resume using the device.
>
> This patch checks the presence of _RST method and calls the _RST
> method when reset is requested.
>
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
> drivers/vfio/platform/vfio_platform_common.c | 44 ++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
> index d859d3b..095d5b7 100644
> --- a/drivers/vfio/platform/vfio_platform_common.c
> +++ b/drivers/vfio/platform/vfio_platform_common.c
> @@ -73,21 +73,59 @@ int vfio_platform_acpi_probe(struct vfio_platform_device *vdev,
> }
> return 0;
> }
> +
> +static int vfio_platform_acpi_call_reset(struct vfio_platform_device *vdev)
> +{
> + struct device *dev = vdev->device;
> + acpi_handle handle = ACPI_HANDLE(dev);
> + acpi_status acpi_ret;
> + unsigned long long val;
> +
> + acpi_ret = acpi_evaluate_integer(handle, "_RST", NULL, &val);
> + if (ACPI_FAILURE(acpi_ret))
> + return -EINVAL;
Can't you return something more explicit here? The error code will be
visible to the userspace. Difficult for him to understand the cause of
the failure in that case.
Eric
> +
> + return 0;
> +}
> +
> +static bool vfio_platform_acpi_has_reset(struct vfio_platform_device *vdev)
> +{
> + struct device *dev = vdev->device;
> + acpi_handle handle = ACPI_HANDLE(dev);
> +
> + return acpi_has_method(handle, "_RST");
> +}
> #else
> int vfio_platform_acpi_probe(struct vfio_platform_device *vdev,
> struct device *dev)
> {
> return -EINVAL;
> }
> +
> +static int vfio_platform_acpi_call_reset(struct vfio_platform_device *vdev)
> +{
> + return -EINVAL;
> +}
> +
> +static bool vfio_platform_acpi_has_reset(struct vfio_platform_device *vdev)
> +{
> + return false;
> +}
> #endif
>
> static bool vfio_platform_has_reset(struct vfio_platform_device *vdev)
> {
> + if (vdev->acpihid)
> + return vfio_platform_acpi_has_reset(vdev);
> +
> return vdev->of_reset ? true : false;
> }
>
> static void vfio_platform_get_reset(struct vfio_platform_device *vdev)
> {
> + if (vdev->acpihid)
> + return;
> +
> vdev->of_reset = vfio_platform_lookup_reset(vdev->compat,
> &vdev->reset_module);
> if (!vdev->of_reset) {
> @@ -99,6 +137,9 @@ static void vfio_platform_get_reset(struct vfio_platform_device *vdev)
>
> static void vfio_platform_put_reset(struct vfio_platform_device *vdev)
> {
> + if (vdev->acpihid)
> + return;
> +
> if (vdev->of_reset)
> module_put(vdev->reset_module);
> }
> @@ -177,6 +218,9 @@ static int vfio_platform_call_reset(struct vfio_platform_device *vdev)
> dev_info(vdev->device, "reset\n");
> vdev->of_reset(vdev);
> return 0;
> + } else if (vdev->acpihid) {
> + dev_info(vdev->device, "reset\n");
> + return vfio_platform_acpi_call_reset(vdev);
> }
>
> dev_warn(vdev->device, "no reset function found!\n");
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V5 5/6] vfio: platform: call _RST method when using ACPI Sinan Kaya <okaya@codeaurora.org> - 2016-05-16 04:20 +0200
Re: [PATCH V5 5/6] vfio: platform: call _RST method when using ACPI Eric Auger <eric.auger@linaro.org> - 2016-05-23 16:50 +0200
Re: [PATCH V5 5/6] vfio: platform: call _RST method when using ACPI Sinan Kaya <okaya@codeaurora.org> - 2016-05-24 04:30 +0200
Re: [PATCH V5 5/6] vfio: platform: call _RST method when using ACPI Eric Auger <eric.auger@linaro.org> - 2016-05-23 17:30 +0200
Re: [PATCH V5 5/6] vfio: platform: call _RST method when using ACPI Sinan Kaya <okaya@codeaurora.org> - 2016-05-24 04:30 +0200
csiph-web