From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbcBAPv3 (ORCPT ); Mon, 1 Feb 2016 10:51:29 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:38232 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751287AbcBAPv0 (ORCPT ); Mon, 1 Feb 2016 10:51:26 -0500 Subject: Re: [PATCH V13 10/10] vfio, platform: add QTI HIDMA reset driver To: Eric Auger , dmaengine@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, timur@codeaurora.org, devicetree@vger.kernel.org, cov@codeaurora.org, vinod.koul@intel.com, jcm@redhat.com References: <1454106914-15857-1-git-send-email-okaya@codeaurora.org> <1454106914-15857-11-git-send-email-okaya@codeaurora.org> <56AF7C9D.4070600@linaro.org> Cc: shankerd@codeaurora.org, vikrams@codeaurora.org, agross@codeaurora.org, arnd@arndb.de, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Sinan Kaya Message-ID: <56AF7EFB.9040108@codeaurora.org> Date: Mon, 1 Feb 2016 10:51:23 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56AF7C9D.4070600@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/2016 10:41 AM, Eric Auger wrote: > Hi Sinan, >> + >> + trreg = vdev->regions[0]; >> + if (!trreg.ioaddr) { >> + trreg.ioaddr = >> + ioremap_nocache(trreg.addr, trreg.size); > this is going to leak. See "vfio: platform: reset: calxedaxgmac: fix > ioaddr leak". Thanks, I was following what other drivers were doing and got hit by the same problem :) >> + if (!trreg.ioaddr) >> + return -ENOMEM; >> + } >> + >> + evreg = vdev->regions[1]; >> + if (!evreg.ioaddr) { >> + evreg.ioaddr = >> + ioremap_nocache(evreg.addr, evreg.size); > same here I'll take care of it. >> + if (!evreg.ioaddr) >> + return -ENOMEM; >> + } >> + > I understood the device is a kind of SR-IOV platform device. When the VF > gets reset are there any interactions with the management driver? Is it > handled by HW? There is no communication between the management interface and the DMA channels. Management interface is just a runtime platform resource allocator. "if you pay more, you get more DMA bandwidth. Otherwise, you get to share the channel with other users" The DMA channels can be reset independent of other DMA channels or the management HW. This is a HW feature. > > Best Regards > > Eric >> + /* disable IRQ */ >> + writel(0, evreg.ioaddr + EVCA_IRQ_EN_OFFSET); >> + >> + /* reset both transfer and event channels */ >> + val = readl(trreg.ioaddr + TRCA_CTRLSTS_OFFSET); >> + val &= ~(CH_CONTROL_MASK << 16); >> + val |= CH_RESET << 16; >> + writel(val, trreg.ioaddr + TRCA_CTRLSTS_OFFSET); >> + >> + ret = readl_poll_timeout(trreg.ioaddr + TRCA_CTRLSTS_OFFSET, val, >> + HIDMA_CH_STATE(val) == CH_DISABLED, 1000, >> + 10000); >> + if (ret) >> + return ret; >> + >> + val = readl(evreg.ioaddr + EVCA_CTRLSTS_OFFSET); >> + val &= ~(CH_CONTROL_MASK << 16); >> + val |= CH_RESET << 16; >> + writel(val, evreg.ioaddr + EVCA_CTRLSTS_OFFSET); >> + >> + ret = readl_poll_timeout(evreg.ioaddr + EVCA_CTRLSTS_OFFSET, val, >> + HIDMA_CH_STATE(val) == CH_DISABLED, 1000, >> + 10000); >> + if (ret) >> + return ret; >> + >> + pr_info("HIDMA channel reset\n"); >> + return 0; >> +} >> +module_vfio_reset_handler("qcom,hidma", NULL, >> + vfio_platform_qcomhidma_reset); >> + >> +MODULE_LICENSE("GPL v2"); >> +MODULE_DESCRIPTION("Reset support for Qualcomm Technologies HIDMA device"); >> > -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project