From patchwork Wed Oct 28 13:02:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7510231 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C684ABF90C for ; Wed, 28 Oct 2015 13:05:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD7DF20710 for ; Wed, 28 Oct 2015 13:05:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27AD520685 for ; Wed, 28 Oct 2015 13:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965098AbbJ1NFP (ORCPT ); Wed, 28 Oct 2015 09:05:15 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:38809 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965687AbbJ1NDE (ORCPT ); Wed, 28 Oct 2015 09:03:04 -0400 Received: by wicll6 with SMTP id ll6so11671775wic.1 for ; Wed, 28 Oct 2015 06:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RqJb8H7yMT8y+8JOYNS2SYxXEa6FIjfZXSlw7NUXxKE=; b=ASxZAVeyX6Mv6/elGV9mCkbCWJdZazsnQVsIKfE5orlehdryUA2Uxakjc5vFGtQ2wC lFtoEKjHKZq5MWtPqZZsFbrLOydHLScm6sfDJkHa1GI2ynJL1zUHo/OXnqY3Ulyi6ifi s9n5DO+3afmYw5Bzqj26RJ8evD0nNTwL2Is6TGmcC83lqChtXXqY/g6qAG5zHYKDkyYF 0N9U3uh4tTlzraXjf49WuR681TeheTBElWMvwl9CdMwRwteH7sa+I3nhjdrU0sG6sx6l 55eOj6NCZhOjWTJM00mtqWDGfl9z6RNJxl8Wa3532b4kZXTH2hh0Mt/7Hyju6pm++nph n01g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RqJb8H7yMT8y+8JOYNS2SYxXEa6FIjfZXSlw7NUXxKE=; b=Sqwfk93WUa0iKEum4oBlOvmRee+Z25TOkmCGEsC/CV6kmzsglLMIJjCkoTEzQNlAbN bzJKPvspcJx3uYQaapYjlLR0W7io6DwKBCfBC+A0n3L1enQFw19Rww5xPfTLkwa6lccr daM42ylLkF4X9VSf3M7RyzvaoV4QhK72WxrL741IbmL4jboJ/D54oWqabdD5gQoZ3EhH BX2YPqMc/c3ILNZdbvm8QFAMCCXoP3G7gIU8yvi+LBnZQMKxFqnB1FENYTLWMHA0UNzi UHkT0MP45sNO/y3XroAjB9RkX9GcV/AjIgtU0rCQ8J3lZOAlB8yNvzVPWL6rTByql3nO qZRw== X-Gm-Message-State: ALoCoQkbApr2V5V40XkP8r3jH2MF+FMMHsnhDPrdTBh5t1c8EbwJRFEU4aV3c5D+/60K6PqkgJZz X-Received: by 10.194.216.34 with SMTP id on2mr30072835wjc.109.1446037382577; Wed, 28 Oct 2015 06:03:02 -0700 (PDT) Received: from new-host-2.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id gl9sm49894196wjb.10.2015.10.28.06.03.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Oct 2015 06:03:01 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v5 7/7] vfio: platform: add dev_info on device reset Date: Wed, 28 Oct 2015 13:02:38 +0000 Message-Id: <1446037358-2079-8-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446037358-2079-1-git-send-email-eric.auger@linaro.org> References: <1446037358-2079-1-git-send-email-eric.auger@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It might be helpful for the end-user to check the device reset function was found by the vfio platform reset framework. Lets store a pointer to the struct device in vfio_platform_device and trace when the reset function is called or not found. Signed-off-by: Eric Auger --- v3: creation --- drivers/vfio/platform/vfio_platform_common.c | 14 ++++++++++++-- drivers/vfio/platform/vfio_platform_private.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index f74836a..376d289 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -144,8 +144,12 @@ static void vfio_platform_release(void *device_data) mutex_lock(&driver_lock); if (!(--vdev->refcnt)) { - if (vdev->reset) + if (vdev->reset) { + dev_info(vdev->device, "reset\n"); vdev->reset(vdev); + } else { + dev_warn(vdev->device, "no reset function found!\n"); + } vfio_platform_regions_cleanup(vdev); vfio_platform_irq_cleanup(vdev); } @@ -174,8 +178,12 @@ static int vfio_platform_open(void *device_data) if (ret) goto err_irq; - if (vdev->reset) + if (vdev->reset) { + dev_info(vdev->device, "reset\n"); vdev->reset(vdev); + } else { + dev_warn(vdev->device, "no reset function found!\n"); + } } vdev->refcnt++; @@ -551,6 +559,8 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, return -EINVAL; } + vdev->device = dev; + group = iommu_group_get(dev); if (!group) { pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index d1b0668..42816dd 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -59,6 +59,7 @@ struct vfio_platform_device { struct module *parent_module; const char *compat; struct module *reset_module; + struct device *device; /* * These fields should be filled by the bus specific binder