From patchwork Fri Oct 23 12:37:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7472861 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DFFE39F36A for ; Fri, 23 Oct 2015 12:38:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6119209AD for ; Fri, 23 Oct 2015 12:38:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03D9320990 for ; Fri, 23 Oct 2015 12:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753008AbbJWMiG (ORCPT ); Fri, 23 Oct 2015 08:38:06 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:36533 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753195AbbJWMhe (ORCPT ); Fri, 23 Oct 2015 08:37:34 -0400 Received: by wicfx6 with SMTP id fx6so29398508wic.1 for ; Fri, 23 Oct 2015 05:37:33 -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=BW4iHubS1gQ+ShGZ3b+hmDbSlZ7O+K4Aag741lHClaM=; b=MNdgNlfZpymxllPhkvZ+QOfvUQd1CdDIZvjsNXlK3g4HnPTKFTzqmyS6GINTwdoKGP h2i/H/8fTti76GiBvE4HY4Im4+Cq28GTGmWjjYR9qiPfTlkNUfv/RfTjL6HUnU8wevWz FbCbWXl2AMq8Vu+RLn9AZxcI1YPdFIK3Nz7XFlIVK5pIrqD9DthGLD1cwfLMDVCxcqtv Glux4aclKT9tzP7HfAcxvyB00QBi4nMLsbeNrP964y3aSbRyAs7pS+vCTULEv+E5KRxv uHpzDJ/WgZsOwFCfMpgX+HJ2HPZnVSc1Fosc1v+e+JN2x2Sh1ZHYPX91QOWSNCEIty6G N/1w== X-Gm-Message-State: ALoCoQkwXrI8Q+x9F0i0S+SQHrQaSbAtgB3j9jFq2FHM+FZY2kvG1uB1CnbXUF5DlohWmcQKqfOr X-Received: by 10.195.13.38 with SMTP id ev6mr4446593wjd.150.1445603853361; Fri, 23 Oct 2015 05:37:33 -0700 (PDT) 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 s16sm2837652wik.16.2015.10.23.05.37.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 05:37:31 -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 v3 7/7] vfio: platform: add dev_info on device reset Date: Fri, 23 Oct 2015 14:37:15 +0200 Message-Id: <1445603835-14506-8-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445603835-14506-1-git-send-email-eric.auger@linaro.org> References: <1445603835-14506-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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 de3fb33..207fab6 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 e505c15..ccb99b4 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