From patchwork Tue Nov 3 18:12:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7546261 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 B0EFDBEEA4 for ; Tue, 3 Nov 2015 18:16:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D14BC20719 for ; Tue, 3 Nov 2015 18:16:46 +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 EA6DD204D6 for ; Tue, 3 Nov 2015 18:16:45 +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 1Ztg6j-0006Ws-Nq; Tue, 03 Nov 2015 18:14:57 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ztg4o-0004yM-3f for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2015 18:13:01 +0000 Received: by wmff134 with SMTP id f134so91297793wmf.1 for ; Tue, 03 Nov 2015 10:12:36 -0800 (PST) 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=ZAH7Jmtf/xswD1f+kINOZye/6bx1giEuGxVMxlMAFFlYqH7eAL66keZNkUzPWMtRhd 6ib6sL3GE52XE8lPoGdaegiW08KYvgYRI/WM+Wujnw3PaIpy1yDlh7ieFqG13SCaNga7 hie1SludL66PL79p7PX26VrbtHpgMDKw7uk47HMzzK8XrI1m8LYLXNUOsl1hf6EjkRKy pCrPV4OwAcHIjmILpUOoaBpcNX3Vn2KuQGcPNo5mncQPSAFDNUVdRsnQp0woWRy11+h8 oBD9RNen1FaawklqxALB4mY7cq0YNTP42805sDbhah7z/CBHnoxfx9uLtyglO1QSStk6 LpDQ== 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=T6QxfTpVNOoulcvzju/Jpuw4vW9QNRnUmaX3AA6vN5ztL8o2EhwSIREyzY8byDAiI+ M8Ls45quowie805D7AL+yQ/zfbLN/bu5ghsRiN0vknTzyrXEj0A1xgw6YZZzzgmdtlzB edRvD6pQlv83Vz2CT0iRbQpl0KgeHaiuYL7ns5+xObVBMjLF+oNIXos+8d+q7FRtLN6n A9Y7aEIw9gDvy3KA/epMtfhAlzXLHcbOQko7RxGooFwWCAXrxJosTDe/bLoY/v8ZVIYm EeNBZsrUWIjRuy/htAC0b+UGWkBnnJhaLgHCTe1mjP268Q/RXLPtcuFYBvPel5zZYub6 t6oQ== X-Gm-Message-State: ALoCoQnkO0TtKfxb5nvbHNvhIR8K1RXwLtVf9UxFt79temPtfoYru/lK0ufP5SGSOtl4ZqJdpoi3 X-Received: by 10.28.142.193 with SMTP id q184mr19859713wmd.15.1446574355917; Tue, 03 Nov 2015 10:12:35 -0800 (PST) Received: from new-host-3.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id om1sm28830527wjc.2.2015.11.03.10.12.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Nov 2015 10:12:35 -0800 (PST) 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 v6 7/8] vfio: platform: add dev_info on device reset Date: Tue, 3 Nov 2015 18:12:18 +0000 Message-Id: <1446574339-1843-8-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446574339-1843-1-git-send-email-eric.auger@linaro.org> References: <1446574339-1843-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151103_101258_490442_AC2DDA55 X-CRM114-Status: GOOD ( 17.24 ) X-Spam-Score: -1.9 (-) 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, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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