From patchwork Fri Oct 23 15:47:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 55500 Delivered-To: patches@linaro.org Received: by 10.55.75.214 with SMTP id y205csp1170022qka; Fri, 23 Oct 2015 08:48:47 -0700 (PDT) X-Received: by 10.180.198.194 with SMTP id je2mr5122422wic.26.1445615263719; Fri, 23 Oct 2015 08:47:43 -0700 (PDT) Return-Path: Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com. [209.85.212.169]) by mx.google.com with ESMTPS id aw7si5428263wjc.90.2015.10.23.08.47.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 08:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.169 as permitted sender) client-ip=209.85.212.169; Authentication-Results: mx.google.com; spf=pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.169 as permitted sender) smtp.mailfrom=eric.auger@linaro.org Received: by wicfx6 with SMTP id fx6so37065436wic.1 for ; Fri, 23 Oct 2015 08:47:43 -0700 (PDT) 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=fSBXu4TBclzLetMRvpFkVdA9i02aCWM8eFp8Xk30JP1WT0EGF6bCBBjHCYRSxq+wiU 2KrgPK4FqA4vd5HP6sfwcagUYgnnLdg2PWeKLXQTvvhmGcHbVjfl6rF7FuFdOBQ66YWt jYgIXk9ee8M+bG+1vJop5OurtE8tLMYF2OS4yzbo8fEx0StlMLSqmbc/yo7irJ4SYZRC 9dYBg+2q1H0Xm4T/DSlIUCQMeXgm9jHEuON3FB5JnyhLHeGnq46mb2+Fm6WAauDtZ97o HhFGheaGMMw68htOHlKm4OIHSprnRg433v8TeW8MFuWCcJE2E280cwh+L/U1BZScmpSa YcXQ== X-Gm-Message-State: ALoCoQm2FLMZ1KDOxUnIy2N94vCKlFV3jmT2jvXfLgppXVFFzhv03/c8QMczJq7tKUN+nDAIqfKj X-Received: by 10.180.208.82 with SMTP id mc18mr5078377wic.85.1445615263489; Fri, 23 Oct 2015 08:47:43 -0700 (PDT) Return-Path: Received: from gnx2579.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id i3sm3388471wij.9.2015.10.23.08.47.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 08:47:42 -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 v4 7/7] vfio: platform: add dev_info on device reset Date: Fri, 23 Oct 2015 17:47:25 +0200 Message-Id: <1445615245-31124-8-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445615245-31124-1-git-send-email-eric.auger@linaro.org> References: <1445615245-31124-1-git-send-email-eric.auger@linaro.org> 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(-) -- 1.9.1 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