From patchwork Thu Jun 30 16:22:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 71258 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp480501qgy; Thu, 30 Jun 2016 09:24:24 -0700 (PDT) X-Received: by 10.67.3.7 with SMTP id bs7mr23086951pad.86.1467303864029; Thu, 30 Jun 2016 09:24:24 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id g144si4677592pfb.195.2016.06.30.09.24.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jun 2016 09:24:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIekI-0002lC-Ne; Thu, 30 Jun 2016 16:23:18 +0000 Received: from mail-it0-x234.google.com ([2607:f8b0:4001:c0b::234]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIejk-0002H2-JY for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2016 16:22:45 +0000 Received: by mail-it0-x234.google.com with SMTP id f6so73770185ith.0 for ; Thu, 30 Jun 2016 09:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=szxnQQzmUfqEn71KEP8krUsSMQGOc2xgLbEUEoS8zug=; b=eoogryPUmRpgWJrts3jLxr/6YP3WhGuzx0X19QM5xq8eQ53spVbBcY7+yqtce/UsrX X2fdQ9U5xXAqsqaGaQ8Xqgdg7SWhXd5D+eVfZQN5e5pz3dUyXLxfN6jcwyFTdHZkDU9r eSPi3ZqAfsh2hJ023w++iEvV73dp85YrUTgHs= 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=szxnQQzmUfqEn71KEP8krUsSMQGOc2xgLbEUEoS8zug=; b=JgnlQgbFgE7OFMQR/UUB7I62rprJZVLbMzwPWZRGNaLu4k16X0dC3TayQ9N0Kp1XqJ QRgP5AtwYv8i0bp4ZfHL12abe6qpVhiixUCSYVMWIIozivXyeYZK+VHx6qLoFMi+lx/b v5Ubt4d/o8X8mwZG7VUrbg2Y5loFWGbMJgO0rJmy7Yvd4aKrxGz45V/059DHWcOcvX89 fiH173MDbu+DUjJnxR2sQLSGApijT1Ar8SYajDl+9DdxmgcSpLQWbo6aqQJV6nVNtuWi W1brwocVYjNYUaMqwPtzUsq002trbeoBRdVzHCJ+813NU2Kbd4abaTBvUbov7ls30eXD 1rMA== X-Gm-Message-State: ALyK8tJ2yOkjGI5outC4x+8M7VkL6ZmzBNQRFne85Uz4Ha4k9RorRMV+EddUJUIo+jwIIQdD X-Received: by 10.36.228.133 with SMTP id o127mr16027403ith.9.1467303743674; Thu, 30 Jun 2016 09:22:23 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id m203sm4209375iom.21.2016.06.30.09.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jun 2016 09:22:23 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/13] coresight-stm: support mmapping channel regions with mmio_addr Date: Thu, 30 Jun 2016 10:22:08 -0600 Message-Id: <1467303739-12543-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467303739-12543-1-git-send-email-mathieu.poirier@linaro.org> References: <1467303739-12543-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160630_092244_850830_F47A0DCA X-CRM114-Status: GOOD ( 12.33 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c0b:0:0:0:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org From: Chunyan Zhang CoreSight STM device allows direct mapping of the channel regions to userspace for zero-copy writing. To support this ability, the STM framework has provided a hook 'mmio_addr', this patch just implemented this hook for CoreSight STM. This patch also added an item into 'channel_space' to save the physical base address of channel region which mmap operation needs to know. Signed-off-by: Chunyan Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-stm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 73be58a11e4f..482c8bb27f87 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -105,10 +105,12 @@ module_param_named( /** * struct channel_space - central management entity for extended ports * @base: memory mapped base address where channels start. + * @phys: physical base address of channel region. * @guaraneed: is the channel delivery guaranteed. */ struct channel_space { void __iomem *base; + phys_addr_t phys; unsigned long *guaranteed; }; @@ -356,6 +358,23 @@ static void stm_generic_unlink(struct stm_data *stm_data, stm_disable(drvdata->csdev); } +static phys_addr_t +stm_mmio_addr(struct stm_data *stm_data, unsigned int master, + unsigned int channel, unsigned int nr_chans) +{ + struct stm_drvdata *drvdata = container_of(stm_data, + struct stm_drvdata, stm); + phys_addr_t addr; + + addr = drvdata->chs.phys + channel * BYTES_PER_CHANNEL; + + if (offset_in_page(addr) || + offset_in_page(nr_chans * BYTES_PER_CHANNEL)) + return 0; + + return addr; +} + static long stm_generic_set_options(struct stm_data *stm_data, unsigned int master, unsigned int channel, @@ -761,7 +780,9 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata) drvdata->stm.sw_end = 1; drvdata->stm.hw_override = true; drvdata->stm.sw_nchannels = drvdata->numsp; + drvdata->stm.sw_mmiosz = BYTES_PER_CHANNEL; drvdata->stm.packet = stm_generic_packet; + drvdata->stm.mmio_addr = stm_mmio_addr; drvdata->stm.link = stm_generic_link; drvdata->stm.unlink = stm_generic_unlink; drvdata->stm.set_options = stm_generic_set_options; @@ -808,6 +829,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) ret = stm_get_resource_byname(np, "stm-stimulus-base", &ch_res); if (ret) return ret; + drvdata->chs.phys = ch_res.start; base = devm_ioremap_resource(dev, &ch_res); if (IS_ERR(base))