* [PATCH v3 0/4] Add dual-fifo mode support of i.MX ssi
From: Nicolin Chen @ 2013-10-31 8:22 UTC (permalink / raw)
To: s.hauer, timur, shawn.guo, broonie
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, linux-kernel, rob.herring, philippe.retornaz, galak,
dmaengine, ijc+devicetree, linuxppc-dev, linux-arm-kernel
Changelog
v3:
* PATCH-1: Add comments to indicate the end of v1 and v2 array.
* PATCH-3: Use better way to keep watermark as even number.
*
* Nothing changes for PATCH-2 and PATCH-4
v2:
* Instead of adding rogue scripts to current SDMA driver based on firmware
* V1, we define the new SDMA firmware as version 2 and bisect the PATCH-1
* to two patches: The first is to add version check code to the SDMA driver;
* And the second is to add SSI dual FIFO DMATYPE.
*
* Nothing changes for the last two patches.
v1:
* SSI can reduce hardware overrun/underrun possibility when using dual
* fifo mode. To support this mode, we need to first update sdma sciprt
* list, and then enable dual fifo BIT in SSI driver, and last update DT
* bindings of i.MX series.
*
* ! This series of patches has a direct dependency between them. When
* ! applying them, we need to apply to one single branch. Otherwise,
* ! it would break currect branches.
Nicolin Chen (4):
dma: imx-sdma: Add sdma firmware version 2 support
dma: imx-sdma: Add new dma type for ssi dual fifo script
ASoC: fsl_ssi: Add dual fifo mode support
ARM: dts: imx: use dual-fifo sdma script for ssi
.../devicetree/bindings/dma/fsl-imx-sdma.txt | 1 +
arch/arm/boot/dts/imx51.dtsi | 4 ++--
arch/arm/boot/dts/imx53.dtsi | 4 ++--
arch/arm/boot/dts/imx6qdl.dtsi | 12 ++++++------
arch/arm/boot/dts/imx6sl.dtsi | 12 ++++++------
drivers/dma/imx-sdma.c | 19 ++++++++++++++++++-
include/linux/platform_data/dma-imx-sdma.h | 5 +++++
include/linux/platform_data/dma-imx.h | 1 +
sound/soc/fsl/fsl_ssi.c | 22 +++++++++++++++++++++-
9 files changed, 62 insertions(+), 18 deletions(-)
--
1.8.4
^ permalink raw reply
* Re: [PATCH v2 3/4] ASoC: fsl_ssi: Add dual fifo mode support
From: Nicolin Chen @ 2013-10-31 7:44 UTC (permalink / raw)
To: Philippe Rétornaz
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
s.hauer, swarren, timur, rob.herring, linux-kernel, broonie,
galak, dmaengine, ijc+devicetree, shawn.guo, linuxppc-dev,
linux-arm-kernel
In-Reply-To: <52720CA4.3090003@gmail.com>
Hi, Philippe
On Thu, Oct 31, 2013 at 08:54:12AM +0100, Philippe R=E9tornaz wrote:
> Hi
>=20
> >
> >+ /* When using dual fifo mode, we need to keep watermark
> >+ * as even numbers due to dma script limitation.
> >+ */
> >+ ssi_private->dma_params_tx.maxburst /=3D 2;
> >+ ssi_private->dma_params_tx.maxburst *=3D 2;
> >+ ssi_private->dma_params_rx.maxburst /=3D 2;
> >+ ssi_private->dma_params_rx.maxburst *=3D 2;
> >
>=20
> Why not using a mask here ?
> ssi_private->dma_params_tx.maxburst &=3D ~0x1;
> ssi_private->dma_params_rx.maxburst &=3D ~0x1;
I'll use this in v3. Thank you!
Nicolin Chen
>=20
> Regards,
>=20
> Philippe
>=20
>=20
^ permalink raw reply
* Re: [PATCH v2 3/4] ASoC: fsl_ssi: Add dual fifo mode support
From: Philippe Rétornaz @ 2013-10-31 7:54 UTC (permalink / raw)
To: Nicolin Chen
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
s.hauer, swarren, timur, rob.herring, linux-kernel, broonie,
galak, dmaengine, ijc+devicetree, shawn.guo, linuxppc-dev,
linux-arm-kernel
In-Reply-To: <0e947536358af7bd6e179559006a3526801a1abe.1383197521.git.b42378@freescale.com>
Hi
>
> + /* When using dual fifo mode, we need to keep watermark
> + * as even numbers due to dma script limitation.
> + */
> + ssi_private->dma_params_tx.maxburst /= 2;
> + ssi_private->dma_params_tx.maxburst *= 2;
> + ssi_private->dma_params_rx.maxburst /= 2;
> + ssi_private->dma_params_rx.maxburst *= 2;
>
Why not using a mask here ?
ssi_private->dma_params_tx.maxburst &= ~0x1;
ssi_private->dma_params_rx.maxburst &= ~0x1;
Regards,
Philippe
^ permalink raw reply
* Re: [PATCH v2 1/4] dma: imx-sdma: Add sdma firmware version 2 support
From: Sascha Hauer @ 2013-10-31 7:29 UTC (permalink / raw)
To: Nicolin Chen
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, timur, rob.herring, linux-kernel, broonie,
ijc+devicetree, dmaengine, galak, shawn.guo, linuxppc-dev,
linux-arm-kernel
In-Reply-To: <cfe6edbff010aefc8a35df8a719b26bd238cb3cc.1383197521.git.b42378@freescale.com>
On Thu, Oct 31, 2013 at 02:32:03PM +0800, Nicolin Chen wrote:
> On i.MX5/6 series, SDMA is using new version firmware to support SSI
> dual FIFO feature and HDMI Audio (i.MX6Q/DL only). Thus add it.
>
> Signed-off-by: Nicolin Chen <b42378@freescale.com>
> ---
> diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h
> index 3a39428..14ca582 100644
> --- a/include/linux/platform_data/dma-imx-sdma.h
> +++ b/include/linux/platform_data/dma-imx-sdma.h
> @@ -43,6 +43,9 @@ struct sdma_script_start_addrs {
> s32 dptc_dvfs_addr;
> s32 utra_addr;
> s32 ram_code_start_addr;
You could add a comment here, like: /* End of v1 array */
Otherwise:
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> + s32 mcu_2_ssish_addr;
> + s32 ssish_2_mcu_addr;
> + s32 hdmi_dma_addr;
> };
>
> /**
> --
> 1.8.4
>
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply
* [PATCH v2 4/4] ARM: dts: imx: use dual-fifo sdma script for ssi
From: Nicolin Chen @ 2013-10-31 6:32 UTC (permalink / raw)
To: s.hauer, timur, shawn.guo, broonie
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, linux-kernel, rob.herring, galak, dmaengine,
ijc+devicetree, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1383197521.git.b42378@freescale.com>
Use dual-fifo sdma scripts instead of shared scripts for ssi on i.MX series.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
arch/arm/boot/dts/imx51.dtsi | 4 ++--
arch/arm/boot/dts/imx53.dtsi | 4 ++--
arch/arm/boot/dts/imx6qdl.dtsi | 12 ++++++------
arch/arm/boot/dts/imx6sl.dtsi | 12 ++++++------
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 54cee65..1a71eac 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -154,8 +154,8 @@
reg = <0x70014000 0x4000>;
interrupts = <30>;
clocks = <&clks 49>;
- dmas = <&sdma 24 1 0>,
- <&sdma 25 1 0>;
+ dmas = <&sdma 24 22 0>,
+ <&sdma 25 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 4307e80..7208fde 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -153,8 +153,8 @@
reg = <0x50014000 0x4000>;
interrupts = <30>;
clocks = <&clks 49>;
- dmas = <&sdma 24 1 0>,
- <&sdma 25 1 0>;
+ dmas = <&sdma 24 22 0>,
+ <&sdma 25 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 57e9c38..6e096ca 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -223,8 +223,8 @@
reg = <0x02028000 0x4000>;
interrupts = <0 46 0x04>;
clocks = <&clks 178>;
- dmas = <&sdma 37 1 0>,
- <&sdma 38 1 0>;
+ dmas = <&sdma 37 22 0>,
+ <&sdma 38 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
fsl,ssi-dma-events = <38 37>;
@@ -236,8 +236,8 @@
reg = <0x0202c000 0x4000>;
interrupts = <0 47 0x04>;
clocks = <&clks 179>;
- dmas = <&sdma 41 1 0>,
- <&sdma 42 1 0>;
+ dmas = <&sdma 41 22 0>,
+ <&sdma 42 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
fsl,ssi-dma-events = <42 41>;
@@ -249,8 +249,8 @@
reg = <0x02030000 0x4000>;
interrupts = <0 48 0x04>;
clocks = <&clks 180>;
- dmas = <&sdma 45 1 0>,
- <&sdma 46 1 0>;
+ dmas = <&sdma 45 22 0>,
+ <&sdma 46 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
fsl,ssi-dma-events = <46 45>;
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index c46651e..b32ba99 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -195,8 +195,8 @@
reg = <0x02028000 0x4000>;
interrupts = <0 46 0x04>;
clocks = <&clks IMX6SL_CLK_SSI1>;
- dmas = <&sdma 37 1 0>,
- <&sdma 38 1 0>;
+ dmas = <&sdma 37 22 0>,
+ <&sdma 38 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
status = "disabled";
@@ -207,8 +207,8 @@
reg = <0x0202c000 0x4000>;
interrupts = <0 47 0x04>;
clocks = <&clks IMX6SL_CLK_SSI2>;
- dmas = <&sdma 41 1 0>,
- <&sdma 42 1 0>;
+ dmas = <&sdma 41 22 0>,
+ <&sdma 42 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
status = "disabled";
@@ -219,8 +219,8 @@
reg = <0x02030000 0x4000>;
interrupts = <0 48 0x04>;
clocks = <&clks IMX6SL_CLK_SSI3>;
- dmas = <&sdma 45 1 0>,
- <&sdma 46 1 0>;
+ dmas = <&sdma 45 22 0>,
+ <&sdma 46 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
status = "disabled";
--
1.8.4
^ permalink raw reply related
* [PATCH v2 3/4] ASoC: fsl_ssi: Add dual fifo mode support
From: Nicolin Chen @ 2013-10-31 6:32 UTC (permalink / raw)
To: s.hauer, timur, shawn.guo, broonie
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, linux-kernel, rob.herring, galak, dmaengine,
ijc+devicetree, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1383197521.git.b42378@freescale.com>
By enabling dual fifo mode, it would allow SSI enter a better performance
to transimit/receive data without occasional hardware underrun/overrun.
[ Passed compile-test with mpc85xx_defconfig ]
Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
sound/soc/fsl/fsl_ssi.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 35e2773..0dfb7d6 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -143,6 +143,7 @@ struct fsl_ssi_private {
bool ssi_on_imx;
bool imx_ac97;
bool use_dma;
+ bool use_dual_fifo;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
@@ -413,6 +414,16 @@ static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
write_ssi(CCSR_SSI_SOR_WAIT(3), &ssi->sor);
}
+ if (ssi_private->use_dual_fifo) {
+ write_ssi_mask(&ssi->srcr, 0, CCSR_SSI_SRCR_RFEN1);
+ write_ssi_mask(&ssi->stcr, 0, CCSR_SSI_STCR_TFEN1);
+ write_ssi_mask(&ssi->scr, 0, CCSR_SSI_SCR_TCH_EN);
+ } else {
+ write_ssi_mask(&ssi->srcr, CCSR_SSI_SRCR_RFEN1, 0);
+ write_ssi_mask(&ssi->stcr, CCSR_SSI_STCR_TFEN1, 0);
+ write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_TCH_EN, 0);
+ }
+
return 0;
}
@@ -947,7 +958,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
ssi_private->fifo_depth = 8;
if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx21-ssi")) {
- u32 dma_events[2];
+ u32 dma_events[2], dmas[4];
ssi_private->ssi_on_imx = true;
ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
@@ -1001,6 +1012,17 @@ static int fsl_ssi_probe(struct platform_device *pdev)
dma_events[0], shared ? IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI);
imx_pcm_dma_params_init_data(&ssi_private->filter_data_rx,
dma_events[1], shared ? IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI);
+ if (!of_property_read_u32_array(pdev->dev.of_node, "dmas", dmas, 4)
+ && dmas[2] == IMX_DMATYPE_SSI_DUAL) {
+ ssi_private->use_dual_fifo = true;
+ /* When using dual fifo mode, we need to keep watermark
+ * as even numbers due to dma script limitation.
+ */
+ ssi_private->dma_params_tx.maxburst /= 2;
+ ssi_private->dma_params_tx.maxburst *= 2;
+ ssi_private->dma_params_rx.maxburst /= 2;
+ ssi_private->dma_params_rx.maxburst *= 2;
+ }
} else if (ssi_private->use_dma) {
/* The 'name' should not have any slashes in it. */
ret = devm_request_irq(&pdev->dev, ssi_private->irq,
--
1.8.4
^ permalink raw reply related
* [PATCH v2 2/4] dma: imx-sdma: Add new dma type for ssi dual fifo script
From: Nicolin Chen @ 2013-10-31 6:32 UTC (permalink / raw)
To: s.hauer, timur, shawn.guo, broonie
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, linux-kernel, rob.herring, galak, dmaengine,
ijc+devicetree, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1383197521.git.b42378@freescale.com>
This patch adds a new DMA_TYPE for SSI dual FIFO script, included
in SDMA firmware version 2. This script would allow SSI use dual
fifo mode to transimit/receive data without occasional hardware
underrun/overrun.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt | 1 +
drivers/dma/imx-sdma.c | 4 ++++
include/linux/platform_data/dma-imx.h | 1 +
3 files changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
index 4fa814d..68b83ec 100644
--- a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
+++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
@@ -42,6 +42,7 @@ The full ID of peripheral types can be found below.
19 IPU Memory
20 ASRC
21 ESAI
+ 22 SSI Dual FIFO (needs firmware ver >= 2)
The third cell specifies the transfer priority as below.
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index c7ece8d..efaa9a9 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -725,6 +725,10 @@ static void sdma_get_pc(struct sdma_channel *sdmac,
per_2_emi = sdma->script_addrs->app_2_mcu_addr;
emi_2_per = sdma->script_addrs->mcu_2_app_addr;
break;
+ case IMX_DMATYPE_SSI_DUAL:
+ per_2_emi = sdma->script_addrs->ssish_2_mcu_addr;
+ emi_2_per = sdma->script_addrs->mcu_2_ssish_addr;
+ break;
case IMX_DMATYPE_SSI_SP:
case IMX_DMATYPE_MMC:
case IMX_DMATYPE_SDHC:
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index beac6b8..bcbc6c3 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -39,6 +39,7 @@ enum sdma_peripheral_type {
IMX_DMATYPE_IPU_MEMORY, /* IPU Memory */
IMX_DMATYPE_ASRC, /* ASRC */
IMX_DMATYPE_ESAI, /* ESAI */
+ IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
};
enum imx_dma_prio {
--
1.8.4
^ permalink raw reply related
* [PATCH v2 1/4] dma: imx-sdma: Add sdma firmware version 2 support
From: Nicolin Chen @ 2013-10-31 6:32 UTC (permalink / raw)
To: s.hauer, timur, shawn.guo, broonie
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, linux-kernel, rob.herring, galak, dmaengine,
ijc+devicetree, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1383197521.git.b42378@freescale.com>
On i.MX5/6 series, SDMA is using new version firmware to support SSI
dual FIFO feature and HDMI Audio (i.MX6Q/DL only). Thus add it.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
drivers/dma/imx-sdma.c | 15 ++++++++++++++-
include/linux/platform_data/dma-imx-sdma.h | 3 +++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index fc43603..c7ece8d 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -323,6 +323,7 @@ struct sdma_engine {
struct clk *clk_ipg;
struct clk *clk_ahb;
spinlock_t channel_0_lock;
+ u32 script_number;
struct sdma_script_start_addrs *script_addrs;
const struct sdma_driver_data *drvdata;
};
@@ -1238,6 +1239,7 @@ static void sdma_issue_pending(struct dma_chan *chan)
}
#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1 34
+#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2 38
static void sdma_add_scripts(struct sdma_engine *sdma,
const struct sdma_script_start_addrs *addr)
@@ -1246,7 +1248,7 @@ static void sdma_add_scripts(struct sdma_engine *sdma,
s32 *saddr_arr = (u32 *)sdma->script_addrs;
int i;
- for (i = 0; i < SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1; i++)
+ for (i = 0; i < sdma->script_number; i++)
if (addr_arr[i] > 0)
saddr_arr[i] = addr_arr[i];
}
@@ -1272,6 +1274,17 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
goto err_firmware;
if (header->ram_code_start + header->ram_code_size > fw->size)
goto err_firmware;
+ switch (header->version_major) {
+ case 1:
+ sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1;
+ break;
+ case 2:
+ sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2;
+ break;
+ default:
+ dev_err(sdma->dev, "unknown firmware version\n");
+ return;
+ }
addr = (void *)header + header->script_addrs_start;
ram_code = (void *)header + header->ram_code_start;
diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h
index 3a39428..14ca582 100644
--- a/include/linux/platform_data/dma-imx-sdma.h
+++ b/include/linux/platform_data/dma-imx-sdma.h
@@ -43,6 +43,9 @@ struct sdma_script_start_addrs {
s32 dptc_dvfs_addr;
s32 utra_addr;
s32 ram_code_start_addr;
+ s32 mcu_2_ssish_addr;
+ s32 ssish_2_mcu_addr;
+ s32 hdmi_dma_addr;
};
/**
--
1.8.4
^ permalink raw reply related
* [PATCH v2 0/4] Add dual-fifo mode support of i.MX ssi
From: Nicolin Chen @ 2013-10-31 6:32 UTC (permalink / raw)
To: s.hauer, timur, shawn.guo, broonie
Cc: mark.rutland, devicetree, alsa-devel, pawel.moll, linux-doc,
swarren, linux-kernel, rob.herring, galak, dmaengine,
ijc+devicetree, linuxppc-dev, linux-arm-kernel
Changelog
v2:
* Instead of adding rogue scripts to current SDMA driver based on firmware
* V1, we define the new SDMA firmware as version 2 and bisect the PATCH-1
* to two patches: The first is to add version check code to the SDMA driver;
* And the second is to add SSI dual FIFO DMATYPE.
*
* Nothing changes for the last two patches.
v1:
* SSI can reduce hardware overrun/underrun possibility when using dual
* fifo mode. To support this mode, we need to first update sdma sciprt
* list, and then enable dual fifo BIT in SSI driver, and last update DT
* bindings of i.MX series.
*
* ! This series of patches has a direct dependency between them. When
* ! applying them, we need to apply in one single branch. Otherwise,
* ! it would break currect branches.
Nicolin Chen (4):
dma: imx-sdma: Add sdma firmware version 2 support
dma: imx-sdma: Add new dma type for ssi dual fifo script
ASoC: fsl_ssi: Add dual fifo mode support
ARM: dts: imx: use dual-fifo sdma script for ssi
.../devicetree/bindings/dma/fsl-imx-sdma.txt | 1 +
arch/arm/boot/dts/imx51.dtsi | 4 ++--
arch/arm/boot/dts/imx53.dtsi | 4 ++--
arch/arm/boot/dts/imx6qdl.dtsi | 12 +++++------
arch/arm/boot/dts/imx6sl.dtsi | 12 +++++------
drivers/dma/imx-sdma.c | 19 ++++++++++++++++-
include/linux/platform_data/dma-imx-sdma.h | 3 +++
include/linux/platform_data/dma-imx.h | 1 +
sound/soc/fsl/fsl_ssi.c | 24 +++++++++++++++++++++-
9 files changed, 62 insertions(+), 18 deletions(-)
--
1.8.4
^ permalink raw reply
* Re: [PATCH 2/2] of: move definition of of_find_next_cache_node into common code.
From: Benjamin Herrenschmidt @ 2013-10-31 5:20 UTC (permalink / raw)
To: Sudeep KarkadaNagesha; +Cc: Grant Likely, devicetree, linuxppc-dev, Rob Herring
In-Reply-To: <1379501585-12532-3-git-send-email-Sudeep.KarkadaNagesha@arm.com>
On Wed, 2013-09-18 at 11:53 +0100, Sudeep KarkadaNagesha wrote:
> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
>
> Since the definition of_find_next_cache_node is architecture independent,
> the existing definition in powerpc can be moved to driver/of/base.c
>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
I've seen no follow up on that, I'm happy to stick it in powerpc-next
with some other late stuff.
Cheers,
Ben.
> ---
> arch/powerpc/include/asm/prom.h | 3 ---
> arch/powerpc/kernel/prom.c | 31 -------------------------------
> drivers/of/base.c | 31 +++++++++++++++++++++++++++++++
> include/linux/of.h | 2 ++
> 4 files changed, 33 insertions(+), 34 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
> index 7d0c7f3..bf09e5a 100644
> --- a/arch/powerpc/include/asm/prom.h
> +++ b/arch/powerpc/include/asm/prom.h
> @@ -44,9 +44,6 @@ void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
>
> extern void kdump_move_device_tree(void);
>
> -/* cache lookup */
> -struct device_node *of_find_next_cache_node(struct device_node *np);
> -
> #ifdef CONFIG_NUMA
> extern int of_node_to_nid(struct device_node *device);
> #else
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 09be275..4432fd8 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -761,37 +761,6 @@ void __init early_init_devtree(void *params)
> *******/
>
> /**
> - * of_find_next_cache_node - Find a node's subsidiary cache
> - * @np: node of type "cpu" or "cache"
> - *
> - * Returns a node pointer with refcount incremented, use
> - * of_node_put() on it when done. Caller should hold a reference
> - * to np.
> - */
> -struct device_node *of_find_next_cache_node(struct device_node *np)
> -{
> - struct device_node *child;
> - const phandle *handle;
> -
> - handle = of_get_property(np, "l2-cache", NULL);
> - if (!handle)
> - handle = of_get_property(np, "next-level-cache", NULL);
> -
> - if (handle)
> - return of_find_node_by_phandle(be32_to_cpup(handle));
> -
> - /* OF on pmac has nodes instead of properties named "l2-cache"
> - * beneath CPU nodes.
> - */
> - if (!strcmp(np->type, "cpu"))
> - for_each_child_of_node(np, child)
> - if (!strcmp(child->type, "cache"))
> - return child;
> -
> - return NULL;
> -}
> -
> -/**
> * of_get_ibm_chip_id - Returns the IBM "chip-id" of a device
> * @np: device node of the device
> *
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 865d3f6..b2cee3d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1884,3 +1884,34 @@ int of_device_is_stdout_path(struct device_node *dn)
> return of_stdout == dn;
> }
> EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> +
> +/**
> + * of_find_next_cache_node - Find a node's subsidiary cache
> + * @np: node of type "cpu" or "cache"
> + *
> + * Returns a node pointer with refcount incremented, use
> + * of_node_put() on it when done. Caller should hold a reference
> + * to np.
> + */
> +struct device_node *of_find_next_cache_node(const struct device_node *np)
> +{
> + struct device_node *child;
> + const phandle *handle;
> +
> + handle = of_get_property(np, "l2-cache", NULL);
> + if (!handle)
> + handle = of_get_property(np, "next-level-cache", NULL);
> +
> + if (handle)
> + return of_find_node_by_phandle(be32_to_cpup(handle));
> +
> + /* OF on pmac has nodes instead of properties named "l2-cache"
> + * beneath CPU nodes.
> + */
> + if (!strcmp(np->type, "cpu"))
> + for_each_child_of_node(np, child)
> + if (!strcmp(child->type, "cache"))
> + return child;
> +
> + return NULL;
> +}
> diff --git a/include/linux/of.h b/include/linux/of.h
> index f95aee3..c08c07e 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -226,6 +226,8 @@ static inline int of_get_child_count(const struct device_node *np)
> return num;
> }
>
> +/* cache lookup */
> +extern struct device_node *of_find_next_cache_node(const struct device_node *);
> extern struct device_node *of_find_node_with_property(
> struct device_node *from, const char *prop_name);
> #define for_each_node_with_property(dn, prop_name) \
^ permalink raw reply
* Re: perf events ring buffer memory barrier on powerpc
From: Paul E. McKenney @ 2013-10-31 4:32 UTC (permalink / raw)
To: Victor Kaplansky
Cc: Michael Neuling, Mathieu Desnoyers, Peter Zijlstra, LKML,
Oleg Nesterov, Linux PPC dev, Anton Blanchard,
Frederic Weisbecker
In-Reply-To: <OFC6B7100E.31C6B190-ON42257C14.004841C6-42257C14.004A0EA6@il.ibm.com>
On Wed, Oct 30, 2013 at 03:28:54PM +0200, Victor Kaplansky wrote:
> "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote on 10/30/2013
> 11:27:25 AM:
>
> > If you were to back up that insistence with a description of the
> orderings
> > you are relying on, why other orderings are not important, and how the
> > important orderings are enforced, I might be tempted to pay attention
> > to your opinion.
> >
> > Thanx, Paul
>
> NP, though, I feel too embarrassed to explain things about memory barriers
> when
> one of the authors of Documentation/memory-barriers.txt is on cc: list ;-)
>
> Disclaimer: it is anyway impossible to prove lack of *any* problem.
If you want to play the "omit memory barriers" game, then proving a
negative is in fact the task before you.
> Having said that, lets look into an example in
> Documentation/circular-buffers.txt:
And the correctness of this code has been called into question. :-(
An embarrassingly long time ago -- I need to get this either proven
or fixed.
> > THE PRODUCER
> > ------------
> >
> > The producer will look something like this:
> >
> > spin_lock(&producer_lock);
> >
> > unsigned long head = buffer->head;
> > unsigned long tail = ACCESS_ONCE(buffer->tail);
> >
> > if (CIRC_SPACE(head, tail, buffer->size) >= 1) {
> > /* insert one item into the buffer */
> > struct item *item = buffer[head];
> >
> > produce_item(item);
> >
> > smp_wmb(); /* commit the item before incrementing the head
> */
> >
> > buffer->head = (head + 1) & (buffer->size - 1);
> >
> > /* wake_up() will make sure that the head is committed
> before
> > * waking anyone up */
> > wake_up(consumer);
> > }
> >
> > spin_unlock(&producer_lock);
>
> We can see that authors of the document didn't put any memory barrier
> after "buffer->tail" read and before "produce_item(item)" and I think they
> have
> a good reason.
>
> Lets consider an imaginary smp_mb() right before "produce_item(item);".
> Such a barrier will ensure that -
>
> - the memory read on "buffer->tail" is completed
> before store to memory pointed by "item" is committed.
>
> However, the store to "buffer->tail" anyway cannot be completed before
> conditional
> branch implied by "if ()" is proven to execute body statement of the if().
> And the
> latter cannot be proven before read of "buffer->tail" is completed.
>
> Lets see this other way. Lets imagine that somehow a store to the data
> pointed by "item"
> is completed before we read "buffer->tail". That would mean, that the store
> was completed
> speculatively. But speculative execution of conditional stores is
> prohibited by C/C++ standard,
> otherwise any conditional store at any random place of code could pollute
> shared memory.
Before C/C++11, the closest thing to such a prohibition is use of
volatile, for example, ACCESS_ONCE(). Even in C/C++11, you have to
use atomics to get anything resembing this prohibition.
If you just use normal variables, the compiler is within its rights
to transform something like the following:
if (a)
b = 1;
else
b = 42;
Into:
b = 42;
if (a)
b = 1;
Many other similar transformations are permitted. Some are used to all
vector instructions to be used -- the compiler can do a write with an
overly wide vector instruction, then clean up the clobbered variables
later, if it wishes. Again, if the variables are not marked volatile,
or, in C/C++11, atomic.
> On the other hand, if compiler or processor can prove that condition in
> above if() is going
> to be true (or if speculative store writes the same value as it was before
> write), the
> speculative store *is* allowed. In this case we should not be bothered by
> the fact that
> memory pointed by "item" is written before a read from "buffer->tail" is
> completed.
The compilers don't always know as much as they might about the underlying
hardware's memory model. Of course, if this code is architecture specific,
it can avoid DEC Alpha's fun and games, which could also violate your
assumptions in the above paragraph:
http://www.openvms.compaq.com/wizard/wiz_2637.html
Anyway, proving or fixing the code in Documentation/circular-buffers.txt
has been on my list for too long, so I will take a closer look at it.
Thanx, Paul
^ permalink raw reply
* Re: perf events ring buffer memory barrier on powerpc
From: Paul E. McKenney @ 2013-10-31 4:33 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Michael Neuling, Mathieu Desnoyers, LKML, Oleg Nesterov,
Linux PPC dev, Anton Blanchard, Frederic Weisbecker,
Victor Kaplansky
In-Reply-To: <20131030155116.GO16117@laptop.programming.kicks-ass.net>
On Wed, Oct 30, 2013 at 04:51:16PM +0100, Peter Zijlstra wrote:
> On Wed, Oct 30, 2013 at 03:28:54PM +0200, Victor Kaplansky wrote:
> > one of the authors of Documentation/memory-barriers.txt is on cc: list ;-)
> >
> > Disclaimer: it is anyway impossible to prove lack of *any* problem.
> >
> > Having said that, lets look into an example in
> > Documentation/circular-buffers.txt:
>
> >
> > We can see that authors of the document didn't put any memory barrier
>
> Note that both documents have the same author list ;-)
>
> Anyway, I didn't know about the circular thing, I suppose I should use
> CIRC_SPACE() thing :-)
Interesting that we didn't seem to supply a definition... ;-)
Thanx, Paul
^ permalink raw reply
* [Suggestion] drivers: powercap: 'dev_attrs' has already removed from 'struct class'
From: Chen Gang @ 2013-10-31 2:18 UTC (permalink / raw)
To: srinivas.pandruvada, jacob.jun.pan, rafael.j.wysocki@intel.com,
linuxppc-dev@lists.ozlabs.org
Cc: Greg KH
Hello Maintainers
It is removed by "bcc8edb driver core: remove dev_attrs from struct
class" in Oct 5 2013. But "75d2364 PowerCap: Add class driver" still
use it in Oct 11 2013.
The related error (for powerpc with allmodconfig):
CC drivers/powercap/powercap_sys.o
drivers/powercap/powercap_sys.c:484:2: error: unknown field ‘dev_attrs’ specified in initializer
drivers/powercap/powercap_sys.c:484:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/powercap/powercap_sys.c:484:2: warning: (near initialization for ‘powercap_class.suspend’) [enabled by default]
Please give a check thanks.
Thanks.
--
Chen Gang
^ permalink raw reply
* Re: [PATCH] offb: make the screen properties endian safe
From: Benjamin Herrenschmidt @ 2013-10-31 2:08 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: linuxppc-dev
In-Reply-To: <1383149647-15500-1-git-send-email-clg@fr.ibm.com>
On Wed, 2013-10-30 at 17:14 +0100, Cédric Le Goater wrote:
> @@ -552,25 +552,25 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
> if (pp == NULL)
> pp = of_get_property(dp, "depth", &len);
> if (pp && len == sizeof(u32))
> - depth = *pp;
> + depth = be32_to_cpu(*pp);
This is usually written as
depth = be32_to_cpup(pp);
It used to be that the latter generated better code but that might not
be the case anymore, however it's still a better alternative.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] ADB_PMU_LED_IDE selects LEDS_TRIGGER_IDE_DISK which has unmet direct dependencies
From: Benjamin Herrenschmidt @ 2013-10-31 1:37 UTC (permalink / raw)
To: Christian Kujau; +Cc: Geert Uytterhoeven, linuxppc-dev
In-Reply-To: <alpine.DEB.2.11.1310292123190.31521@trent.utfs.org>
On Tue, 2013-10-29 at 21:25 -0700, Christian Kujau wrote:
> On Wed, 30 Oct 2013 at 10:13, Benjamin Herrenschmidt wrote:
> > You probably want to do that to the ADB_PMU_LED_IDE entry not the
> > ADB_PMU_LED one which doesn't have a dependency and isn't the one
> > selecting LEDS_TRIGGER_IDE_DISK :-)
>
> Right you are, sorry for the mixup. Let me try again:
And this time without a changeset comment ? :-)
I've copied it from the previous version but next time, re-send the
complete commit.
Cheers,
Ben.
>
> Signed-off-by: Christian Kujau <lists@nerdbynature.de>
>
> diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
> index 696238b..d26a312 100644
> --- a/drivers/macintosh/Kconfig
> +++ b/drivers/macintosh/Kconfig
> @@ -103,6 +103,7 @@ config ADB_PMU_LED_IDE
> bool "Use front LED as IDE LED by default"
> depends on ADB_PMU_LED
> depends on LEDS_CLASS
> + depends on IDE_GD_ATA
> select LEDS_TRIGGERS
> select LEDS_TRIGGER_IDE_DISK
> help
>
> C.
> --
> BOFH excuse #378:
>
> Operators killed by year 2000 bug bite.
^ permalink raw reply
* Re: [PATCH v2] powerpc/mpc512x: remove unnecessary #if
From: Anatolij Gustschin @ 2013-10-30 22:12 UTC (permalink / raw)
To: Brian Norris; +Cc: Gerhard Sittig, linuxppc-dev
In-Reply-To: <1381513058-14164-1-git-send-email-computersforpeace@gmail.com>
On Fri, 11 Oct 2013 10:37:38 -0700
Brian Norris <computersforpeace@gmail.com> wrote:
> Several functions are only ever referenced locally, so make them static.
> Of those functions, many of them are protected by an #if. However, the
> code which can compile fine in either case.
>
> Now that (1) the unneeded code is marked 'static' and (2) the code is
> only used under a C 'if (IS_ENABLED(CONFIG_FB_FSL_DIU))', the compiler
> can automatically remove the unneeded code, and we don't need the #if or
> the empty stub functions.
>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> v2: left out a diff I was holding locally (to remove an #if/#endif
> completely). Sorry for the noise.
>
> Based off of Gerhard Sittig's patch:
> powerpc/mpc512x: silence build warning upon disabled DIU
>
> Compile-tested with CONFIG_FB_FSL_DIU=n
>
> arch/powerpc/platforms/512x/mpc512x_shared.c | 21 +++++++--------------
> arch/powerpc/sysdev/fsl_soc.h | 3 ---
> 2 files changed, 7 insertions(+), 17 deletions(-)
Applied, thanks!
Anatolij
^ permalink raw reply
* Re: [PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode
From: Tom Musta @ 2013-10-30 21:45 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linuxppc-dev, tmusta, Andreas Schwab
In-Reply-To: <CAMuHMdWMZNF_KOMyVES2UbvCyGEH1N=CFp-TTWuLMzm89SLs3A@mail.gmail.com>
On 10/30/2013 2:43 PM, Geert Uytterhoeven wrote:
> On Wed, Oct 30, 2013 at 8:35 PM, Tom Musta <tommusta@gmail.com> wrote:
>> On 10/30/2013 12:43 PM, Andreas Schwab wrote:
>>>
>>> Tom Musta <tommusta@gmail.com> writes:
>>>
>>>> +#ifdef __LITTLE_ENDIAN__
>>>> + if (!regs->msr & MSR_LE)
>>>
>>>
>>> That won't work.
>>>
>>> Andreas.
>>>
>>
>> Please elaborate.
>
> You want to test for "!(regs & MSR_LE)".
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>
Thanks Adnreas and Geert. I will fix and resubmit.
^ permalink raw reply
* [PATCH v4 2/7] ppc/cell: use get_unused_fd_flags(0) instead of get_unused_fd()
From: Yann Droneaud @ 2013-10-30 19:47 UTC (permalink / raw)
To: Jeremy Kerr, Arnd Bergmann, Benjamin Herrenschmidt,
Paul Mackerras
Cc: Yann Droneaud, cbe-oss-dev, linuxppc-dev, linux-kernel
In-Reply-To: <cover.1383121137.git.ydroneaud@opteya.com>
Macro get_unused_fd() is used to allocate a file descriptor with
default flags. Those default flags (0) can be "unsafe":
O_CLOEXEC must be used by default to not leak file descriptor
across exec().
Instead of macro get_unused_fd(), functions anon_inode_getfd()
or get_unused_fd_flags() should be used with flags given by userspace.
If not possible, flags should be set to O_CLOEXEC to provide userspace
with a default safe behavor.
In a further patch, get_unused_fd() will be removed so that
new code start using anon_inode_getfd() or get_unused_fd_flags()
with correct flags.
This patch replaces calls to get_unused_fd() with equivalent call to
get_unused_fd_flags(0) to preserve current behavor for existing code.
The hard coded flag value (0) should be reviewed on a per-subsystem basis,
and, if possible, set to O_CLOEXEC.
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Link: http://lkml.kernel.org/r/cover.1383121137.git.ydroneaud@opteya.com
---
arch/powerpc/platforms/cell/spufs/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 87ba7cf..51effce 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -301,7 +301,7 @@ static int spufs_context_open(struct path *path)
int ret;
struct file *filp;
- ret = get_unused_fd();
+ ret = get_unused_fd_flags(0);
if (ret < 0)
return ret;
@@ -518,7 +518,7 @@ static int spufs_gang_open(struct path *path)
int ret;
struct file *filp;
- ret = get_unused_fd();
+ ret = get_unused_fd_flags(0);
if (ret < 0)
return ret;
--
1.8.3.1
^ permalink raw reply related
* [PATCH v4 0/7] Getting rid of get_unused_fd()
From: Yann Droneaud @ 2013-10-30 19:47 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu, Al Viro, linux-ia64, Jeremy Kerr,
Arnd Bergmann, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev, cbe-oss-dev, linux-fsdevel, Eric Paris,
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
Cc: Yann Droneaud, linux-kernel
Hi,
Please find the fourth revision of my patchset to remove get_unused_fd()
macro in order to encourage subsystems to use get_unused_fd_flags() or
anon_inode_getfd() with open flags set to O_CLOEXEC were appropriate.
The patchset convert all calls to get_unused_fd() to
get_unused_fd_flags(0) before removing get_unused_fd() macro.
Without get_unused_fd() macro, more subsystems are likely to use
anon_inode_getfd() and be teached to provide an API that let userspace
choose the opening flags of the file descriptor.
Not using O_CLOEXEC by default or not letting userspace provide the
"open" flags should be considered bad practice from security point
of view: in most case O_CLOEXEC must be used to not leak file descriptor
across exec().
Using O_CLOEXEC by default when flags are not provided by userspace
allows userspace to set, using fcntl(), without any risk of race,
if the file descriptor is going to be inherited or not across exec().
Status:
In linux-next tag 20131029, they're currently:
- 32 calls to fd_install()
- 23 calls to get_unused_fd_flags()
- 11 calls to anon_inode_getfd()
- 7 calls to get_unused_fd()
Changes from patchset v3 [PATCHSETv3]:
- industrialio: use anon_inode_getfd() with O_CLOEXEC flag
DROPPED: applied upstream
Changes from patchset v2 [PATCHSETv2]:
- android/sw_sync: use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()
DROPPED: applied upstream
- android/sync: use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()
DROPPED: applied upstream
- vfio: use get_unused_fd_flags(0) instead of get_unused_fd()
DROPPED: applied upstream.
Additionally subsystem maintainer applied another patch on top
to set the flags to O_CLOEXEC.
- industrialio: use anon_inode_getfd() with O_CLOEXEC flag
NEW: propose to use O_CLOEXEC as default flag.
Changes from patchset v1 [PATCHSETv1]:
- explicitly added subsystem maintainers as mail recepients.
- infiniband: use get_unused_fd_flags(0) instead of get_unused_fd()
DROPPED: subsystem maintainer applied another patch
using get_unused_fd_flags(O_CLOEXEC) as suggested.
- android/sw_sync: use get_unused_fd_flags(0) instead of get_unused_fd()
MODIFIED: use get_unused_fd_flags(O_CLOEXEC) as suggested
- android/sync: use get_unused_fd_flags(0) instead of get_unused_fd()
MODIFIED: use get_unused_fd_flags(O_CLOEXEC) as suggested
- xfs: use get_unused_fd_flags(0) instead of get_unused_fd()
DROPPED: applied asis by subsystem maintainer.
- sctp: use get_unused_fd_flags(0) instead of get_unused_fd()
DROPPED: applied asis by subsystem maintainer.
Links:
[PATCHSETv3]
http://lkml.kernel.org/r/cover.1378460926.git.ydroneaud@opteya.com
[PATCHSETv2]
http://lkml.kernel.org/r/cover.1376327678.git.ydroneaud@opteya.com
[PATCHSETv1]
http://lkml.kernel.org/r/cover.1372777600.git.ydroneaud@opteya.com
Yann Droneaud (7):
ia64: use get_unused_fd_flags(0) instead of get_unused_fd()
ppc/cell: use get_unused_fd_flags(0) instead of get_unused_fd()
binfmt_misc: use get_unused_fd_flags(0) instead of get_unused_fd()
file: use get_unused_fd_flags(0) instead of get_unused_fd()
fanotify: use get_unused_fd_flags(0) instead of get_unused_fd()
events: use get_unused_fd_flags(0) instead of get_unused_fd()
file: remove get_unused_fd()
arch/ia64/kernel/perfmon.c | 2 +-
arch/powerpc/platforms/cell/spufs/inode.c | 4 ++--
fs/binfmt_misc.c | 2 +-
fs/file.c | 2 +-
fs/notify/fanotify/fanotify_user.c | 2 +-
include/linux/file.h | 1 -
kernel/events/core.c | 2 +-
7 files changed, 7 insertions(+), 8 deletions(-)
--
1.8.3.1
^ permalink raw reply
* Re: [PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode
From: Geert Uytterhoeven @ 2013-10-30 19:43 UTC (permalink / raw)
To: Tom Musta; +Cc: linuxppc-dev, tmusta, Andreas Schwab
In-Reply-To: <52715F7F.8020206@gmail.com>
On Wed, Oct 30, 2013 at 8:35 PM, Tom Musta <tommusta@gmail.com> wrote:
> On 10/30/2013 12:43 PM, Andreas Schwab wrote:
>>
>> Tom Musta <tommusta@gmail.com> writes:
>>
>>> +#ifdef __LITTLE_ENDIAN__
>>> + if (!regs->msr & MSR_LE)
>>
>>
>> That won't work.
>>
>> Andreas.
>>
>
> Please elaborate.
You want to test for "!(regs & MSR_LE)".
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode
From: Tom Musta @ 2013-10-30 19:35 UTC (permalink / raw)
To: Andreas Schwab; +Cc: tmusta, linuxppc-dev
In-Reply-To: <878uxairi8.fsf@igel.home>
On 10/30/2013 12:43 PM, Andreas Schwab wrote:
> Tom Musta <tommusta@gmail.com> writes:
>
>> +#ifdef __LITTLE_ENDIAN__
>> + if (!regs->msr & MSR_LE)
>
> That won't work.
>
> Andreas.
>
Please elaborate.
^ permalink raw reply
* Re: perf events ring buffer memory barrier on powerpc
From: Peter Zijlstra @ 2013-10-30 19:11 UTC (permalink / raw)
To: Victor Kaplansky
Cc: Michael Neuling, Mathieu Desnoyers, LKML, Oleg Nesterov,
Linux PPC dev, Anton Blanchard, Frederic Weisbecker, paulmck
In-Reply-To: <20131030182930.GP2490@laptop.programming.kicks-ass.net>
On Wed, Oct 30, 2013 at 07:29:30PM +0100, Peter Zijlstra wrote:
> + page_shift = PAGE_SHIFT + page_order(rb);
> +
> + handle->page = (offset >> page_shift) & (rb->nr_pages - 1);
> +
> + offset &= page_shift - 1;
offset &= (1UL << page_shift) - 1;
Weird that it even appeared to work.. /me wonders if he even booted the
right kernel.
> +
> + handle->addr = rb->data_pages[handle->page] + offset;
> + handle->size = (1 << page_shift) - offset;
^ permalink raw reply
* Re: [PATCH 29/51] DMA-API: ata: pata_octeon_cf: convert to use dma_coerce_mask_and_coherent()
From: Geert Uytterhoeven @ 2013-10-30 19:08 UTC (permalink / raw)
To: Russell King
Cc: alsa-devel, linux-doc, Linux MMC List,
Linux Fbdev development list, linux-nvme,
linux-ide@vger.kernel.org, driverdevel, linux-samsung-soc, scsi,
e1000-devel, Linux-Next, b43-dev, Linux Media Mailing List,
devicetree, DRI Development, linux-tegra,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Solarflare linux maintainers, netdev@vger.kernel.org, USB list,
linux-wireless, linux-crypto, Tejun Heo,
uclinux-dist-devel@blackfin.uclinux.org,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <E1VMmAk-0007iq-IU@rmk-PC.arm.linux.org.uk>
On Thu, Sep 19, 2013 at 11:54 PM, Russell King
<rmk+kernel@arm.linux.org.uk> wrote:
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index c51bbb9..6231d43 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -1014,8 +1014,9 @@ static int octeon_cf_probe(struct platform_device *pdev)
> }
> cf_port->c0 = ap->ioaddr.ctl_addr;
>
> - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
> - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
> + rv = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> + if (rv)
> + return ret;
return rv;
http://kisskb.ellerman.id.au/kisskb/buildresult/9959184/
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: perf events ring buffer memory barrier on powerpc
From: Peter Zijlstra @ 2013-10-30 18:29 UTC (permalink / raw)
To: Victor Kaplansky
Cc: Michael Neuling, Mathieu Desnoyers, LKML, Oleg Nesterov,
Linux PPC dev, Anton Blanchard, Frederic Weisbecker, paulmck
In-Reply-To: <20131030155116.GO16117@laptop.programming.kicks-ass.net>
On Wed, Oct 30, 2013 at 04:51:16PM +0100, Peter Zijlstra wrote:
> On Wed, Oct 30, 2013 at 03:28:54PM +0200, Victor Kaplansky wrote:
> > one of the authors of Documentation/memory-barriers.txt is on cc: list ;-)
> >
> > Disclaimer: it is anyway impossible to prove lack of *any* problem.
> >
> > Having said that, lets look into an example in
> > Documentation/circular-buffers.txt:
>
> >
> > We can see that authors of the document didn't put any memory barrier
>
> Note that both documents have the same author list ;-)
>
> Anyway, I didn't know about the circular thing, I suppose I should use
> CIRC_SPACE() thing :-)
The below removes 80 bytes from ring_buffer.o of which 50 bytes are from
perf_output_begin(), it also removes 30 lines of code, so yay!
(x86_64 build)
And it appears to still work.. although I've not stressed the no-space
bits.
---
kernel/events/ring_buffer.c | 74 ++++++++++++++-------------------------------
1 file changed, 22 insertions(+), 52 deletions(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 9c2ddfbf4525..e4a51fa10595 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -12,40 +12,10 @@
#include <linux/perf_event.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
+#include <linux/circ_buf.h>
#include "internal.h"
-static bool perf_output_space(struct ring_buffer *rb, unsigned long tail,
- unsigned long offset, unsigned long head)
-{
- unsigned long sz = perf_data_size(rb);
- unsigned long mask = sz - 1;
-
- /*
- * check if user-writable
- * overwrite : over-write its own tail
- * !overwrite: buffer possibly drops events.
- */
- if (rb->overwrite)
- return true;
-
- /*
- * verify that payload is not bigger than buffer
- * otherwise masking logic may fail to detect
- * the "not enough space" condition
- */
- if ((head - offset) > sz)
- return false;
-
- offset = (offset - tail) & mask;
- head = (head - tail) & mask;
-
- if ((int)(head - offset) < 0)
- return false;
-
- return true;
-}
-
static void perf_output_wakeup(struct perf_output_handle *handle)
{
atomic_set(&handle->rb->poll, POLL_IN);
@@ -115,8 +85,7 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
rb->user_page->data_head = head;
/*
- * Now check if we missed an update, rely on the (compiler)
- * barrier in atomic_dec_and_test() to re-read rb->head.
+ * Now check if we missed an update.
*/
if (unlikely(head != local_read(&rb->head))) {
local_inc(&rb->nest);
@@ -135,7 +104,7 @@ int perf_output_begin(struct perf_output_handle *handle,
{
struct ring_buffer *rb;
unsigned long tail, offset, head;
- int have_lost;
+ int have_lost, page_shift;
struct perf_sample_data sample_data;
struct {
struct perf_event_header header;
@@ -161,7 +130,7 @@ int perf_output_begin(struct perf_output_handle *handle,
goto out;
have_lost = local_read(&rb->lost);
- if (have_lost) {
+ if (unlikely(have_lost)) {
lost_event.header.size = sizeof(lost_event);
perf_event_header__init_id(&lost_event.header, &sample_data,
event);
@@ -171,32 +140,33 @@ int perf_output_begin(struct perf_output_handle *handle,
perf_output_get_handle(handle);
do {
- /*
- * Userspace could choose to issue a mb() before updating the
- * tail pointer. So that all reads will be completed before the
- * write is issued.
- *
- * See perf_output_put_handle().
- */
tail = ACCESS_ONCE(rb->user_page->data_tail);
- smp_mb();
offset = head = local_read(&rb->head);
- head += size;
- if (unlikely(!perf_output_space(rb, tail, offset, head)))
+ if (!rb->overwrite &&
+ unlikely(CIRC_SPACE(head, tail, perf_data_size(rb)) < size))
goto fail;
+ head += size;
} while (local_cmpxchg(&rb->head, offset, head) != offset);
+ /*
+ * Userspace SHOULD issue an MB before writing the tail; see
+ * perf_output_put_handle().
+ */
+ smp_mb();
+
if (head - local_read(&rb->wakeup) > rb->watermark)
local_add(rb->watermark, &rb->wakeup);
- handle->page = offset >> (PAGE_SHIFT + page_order(rb));
- handle->page &= rb->nr_pages - 1;
- handle->size = offset & ((PAGE_SIZE << page_order(rb)) - 1);
- handle->addr = rb->data_pages[handle->page];
- handle->addr += handle->size;
- handle->size = (PAGE_SIZE << page_order(rb)) - handle->size;
+ page_shift = PAGE_SHIFT + page_order(rb);
+
+ handle->page = (offset >> page_shift) & (rb->nr_pages - 1);
+
+ offset &= page_shift - 1;
+
+ handle->addr = rb->data_pages[handle->page] + offset;
+ handle->size = (1 << page_shift) - offset;
- if (have_lost) {
+ if (unlikely(have_lost)) {
lost_event.header.type = PERF_RECORD_LOST;
lost_event.header.misc = 0;
lost_event.id = event->id;
^ permalink raw reply related
* Re: perf events ring buffer memory barrier on powerpc
From: Peter Zijlstra @ 2013-10-30 17:44 UTC (permalink / raw)
To: Victor Kaplansky
Cc: Michael Neuling, Mathieu Desnoyers, LKML, Oleg Nesterov,
Linux PPC dev, Anton Blanchard, Frederic Weisbecker,
Paul E. McKenney
In-Reply-To: <OFCA1DB4AC.7D4F6EEE-ON42257C14.0056F77D-42257C14.005EB5EA@il.ibm.com>
On Wed, Oct 30, 2013 at 07:14:29PM +0200, Victor Kaplansky wrote:
> We need a complete rmb() here IMO. I think there is a fundamental
> difference between load and stores in this aspect. Load are allowed to
> be hoisted by compiler or executed speculatively by HW. To prevent
> load "*(ubuf->data + tail)" to be hoisted beyond "ubuf->head" load you
> would need something like this:
Indeed, we could compute and load ->data + tail the moment we've
completed the tail load but before we've completed the head load and
done the comparison.
So yes, full rmb() it is.
> void
> ubuf_read(void)
> {
> u64 head, tail;
>
> tail = ubuf->tail;
> head = ACCESS_ONCE(ubuf->head);
>
> /*
> * Ensure we read the buffer boundaries before the actual buffer
> * data...
> */
>
> while (tail != head) {
> smp_read_barrier_depends(); /* for Alpha */
> obj = *(ubuf->data + head - 128);
> /* process obj */
> tail += obj->size;
> tail %= ubuf->size;
> }
>
> /*
> * Ensure all data reads are complete before we issue the
> * ubuf->tail update; once that update hits, kbuf_write() can
> * observe and overwrite data.
> */
> smp_mb(); /* D, matches with A */
>
> ubuf->tail = tail;
> }
>
> (note that "head" is part of address calculation of obj load now).
Right, explicit dependent loads; I was hoping the conditional in between
might be enough, but as argued above it is not. The above cannot work in
our case though, we must use tail to find the obj since we have variable
size objects.
> But, even in this demo example some "smp_read_barrier_depends()" before
> "obj = *(ubuf->data + head - 100);" is required for architectures
> like Alpha. Though, on more sane architectures "smp_read_barrier_depends()"
> will be translated to nothing.
Sure.. I know all about that.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox