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: 7510361 Return-Path: X-Original-To: patchwork-linux-arm@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 7B825BEEA4 for ; Wed, 28 Oct 2015 13:07:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A154A2069D for ; Wed, 28 Oct 2015 13:07:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B2D62069E for ; Wed, 28 Oct 2015 13:07:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZrQQc-0000sm-G1; Wed, 28 Oct 2015 13:06:10 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZrQNw-0006Qg-MA for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2015 13:03:26 +0000 Received: by wikq8 with SMTP id q8so251899278wik.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=Okk0N4cU3CXBncnEHMSjZDsrTdDH1pa2gpjamx+AIZwCtoRTJBtnboGlmY6EXl86Gq +0tnBk4ONvxuZxfkoakDROBMfDOGaBKJtuEkr3cW0lvIIxgyVFSrI0BPyPZ3KQg/A53a GORvBvmGFOYheQse08cmXc4HsidJ1uGD4DdHXdJi8ubqFA/V/kPe7+Abtc77ynPgJCvs piwwZ5fJiuJ0Lxr7Bxc4EatrHly+wqJN9PhSMr+VX5BLZCMXxBZvM/xWX0agoTn/8ylN JT42YXpuQ+buEXG3r4q3LmK8GlkwZfOcWvu4xKxT1K+bPCYT9B2mJ/rcYGJf2hyRPyCi aWoQ== X-Gm-Message-State: ALoCoQlGBLRBm3n/IvgEPSqfVtfCBM2e6bQRwka5YVLk2+pNGF+izaL58ApcEAEDE7RfK9gajdeg 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151028_060324_977224_872F5BE9 X-CRM114-Status: GOOD ( 17.24 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, christoffer.dall@linaro.org, patches@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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