Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v1 2/2] mmc: sdhci-of-arasan: Add Support for Intel LGM eMMC
From: Ulf Hansson @ 2019-08-27 13:49 UTC (permalink / raw)
  To: Ramuthevar, Vadivel MuruganX
  Cc: Mark Rutland, DTML, qi-ming.wu, andriy.shevchenko, cheol.yong.kim,
	linux-mmc@vger.kernel.org, Michal Simek,
	Linux Kernel Mailing List, Rob Herring, Adrian Hunter, Linux ARM
In-Reply-To: <20190826072800.38413-2-vadivel.muruganx.ramuthevar@linux.intel.com>

On Mon, 26 Aug 2019 at 09:28, Ramuthevar,Vadivel MuruganX
<vadivel.muruganx.ramuthevar@linux.intel.com> wrote:
>
> From: Ramuthevar Vadivel Muruganx <vadivel.muruganx.ramuthevar@linux.intel.com>
>
> The current arasan sdhci PHY configuration isn't compatible
> with the PHY on Intel's LGM(Lightning Mountain) SoC devices.
>
> Therefore, add a new compatible, to adapt the Intel's LGM
> eMMC PHY with arasan-sdhc controller to configure the PHY.
>
> Signed-off-by: Ramuthevar Vadivel Muruganx <vadivel.muruganx.ramuthevar@linux.intel.com>


Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index b12abf9b15f2..7023cbec4017 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -114,6 +114,12 @@ static const struct sdhci_arasan_soc_ctl_map rk3399_soc_ctl_map = {
>         .hiword_update = true,
>  };
>
> +static const struct sdhci_arasan_soc_ctl_map intel_lgm_emmc_soc_ctl_map = {
> +       .baseclkfreq = { .reg = 0xa0, .width = 8, .shift = 2 },
> +       .clockmultiplier = { .reg = 0, .width = -1, .shift = -1 },
> +       .hiword_update = false,
> +};
> +
>  /**
>   * sdhci_arasan_syscon_write - Write to a field in soc_ctl registers
>   *
> @@ -373,6 +379,11 @@ static struct sdhci_arasan_of_data sdhci_arasan_rk3399_data = {
>         .pdata = &sdhci_arasan_cqe_pdata,
>  };
>
> +static struct sdhci_arasan_of_data intel_lgm_emmc_data = {
> +       .soc_ctl_map = &intel_lgm_emmc_soc_ctl_map,
> +       .pdata = &sdhci_arasan_cqe_pdata,
> +};
> +
>  #ifdef CONFIG_PM_SLEEP
>  /**
>   * sdhci_arasan_suspend - Suspend method for the driver
> @@ -474,6 +485,10 @@ static const struct of_device_id sdhci_arasan_of_match[] = {
>                 .compatible = "rockchip,rk3399-sdhci-5.1",
>                 .data = &sdhci_arasan_rk3399_data,
>         },
> +       {
> +               .compatible = "intel,lgm-sdhci-5.1-emmc",
> +               .data = &intel_lgm_emmc_data,
> +       },
>         /* Generic compatible below here */
>         {
>                 .compatible = "arasan,sdhci-8.9a",
> --
> 2.11.0
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH net-next] phy: mdio-sun4i: use devm_platform_ioremap_resource() to simplify code
From: YueHaibing @ 2019-08-27 13:50 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1, davem, mripard, wens
  Cc: netdev, YueHaibing, linux-kernel, linux-arm-kernel

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/phy/mdio-sun4i.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c
index 20ffd8f..58d6504 100644
--- a/drivers/net/phy/mdio-sun4i.c
+++ b/drivers/net/phy/mdio-sun4i.c
@@ -92,7 +92,6 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct mii_bus *bus;
 	struct sun4i_mdio_data *data;
-	struct resource *res;
 	int ret;
 
 	bus = mdiobus_alloc_size(sizeof(*data));
@@ -106,8 +105,7 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
 	bus->parent = &pdev->dev;
 
 	data = bus->priv;
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->membase = devm_ioremap_resource(&pdev->dev, res);
+	data->membase = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(data->membase)) {
 		ret = PTR_ERR(data->membase);
 		goto err_out_free_mdiobus;
-- 
2.7.4



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: Continuous SD IO causes hung task messages
From: Ulf Hansson @ 2019-08-27 13:55 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: linux-mmc@vger.kernel.org, Linux Kernel Mailing List, Linux ARM
In-Reply-To: <20190827134337.GK13294@shell.armlinux.org.uk>

On Tue, 27 Aug 2019 at 15:43, Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
>
> Hi,
>
> While dd'ing the contents of a SD card, I get hung task timeout
> messages as per below.  However, the dd is making progress.  Any
> ideas?
>
> Presumably, mmc_rescan doesn't get a look-in while IO is progressing
> for the card?

Is it a regression?

There not much of recent mmc core and mmc block changes, that I can
think of at this point.

>
> ARM64 host, Macchiatobin, uSD card.

What mmc host driver is it? mmci?

Kind regards
Uffe

>
> Thanks.
>
> root@arm-d06300000000:~# dd if=/dev/mmcblk1 | md5sum
> INFO: task kworker/2:1:52 blocked for more than 120 seconds.
>       Not tainted 5.2.0+ #309
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> kworker/2:1     D    0    52      2 0x00000028
> Workqueue: events_freezable mmc_rescan
> Call trace:
>  __switch_to+0xb0/0x198
>  __schedule+0x22c/0x604
>  schedule+0x38/0xc8
>  __mmc_claim_host+0xcc/0x1ec
>  mmc_get_card+0x30/0x3c
>  mmc_sd_detect+0x1c/0x78
>  mmc_rescan+0x1c4/0x35c
>  process_one_work+0x14c/0x408
>  worker_thread+0x140/0x3f4
>  kthread+0xfc/0x128
>  ret_from_fork+0x10/0x18
> INFO: task kworker/2:1:52 blocked for more than 120 seconds.
>       Not tainted 5.2.0+ #309
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> kworker/2:1     D    0    52      2 0x00000028
> Workqueue: events_freezable mmc_rescan
> Call trace:
>  __switch_to+0xb0/0x198
>  __schedule+0x22c/0x604
>  schedule+0x38/0xc8
>  __mmc_claim_host+0xcc/0x1ec
>  mmc_get_card+0x30/0x3c
>  mmc_sd_detect+0x1c/0x78
>  mmc_rescan+0x1c4/0x35c
>  process_one_work+0x14c/0x408
>  worker_thread+0x140/0x3f4
>  kthread+0xfc/0x128
>  ret_from_fork+0x10/0x18
> INFO: task kworker/2:1:52 blocked for more than 241 seconds.
>       Not tainted 5.2.0+ #309
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> kworker/2:1     D    0    52      2 0x00000028
> Workqueue: events_freezable mmc_rescan
> Call trace:
>  __switch_to+0xb0/0x198
>  __schedule+0x22c/0x604
>  schedule+0x38/0xc8
>  __mmc_claim_host+0xcc/0x1ec
>  mmc_get_card+0x30/0x3c
>  mmc_sd_detect+0x1c/0x78
>  mmc_rescan+0x1c4/0x35c
>  process_one_work+0x14c/0x408
>  worker_thread+0x140/0x3f4
>  kthread+0xfc/0x128
>  ret_from_fork+0x10/0x18
> INFO: task kworker/2:1:52 blocked for more than 362 seconds.
>       Not tainted 5.2.0+ #309
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> kworker/2:1     D    0    52      2 0x00000028
> Workqueue: events_freezable mmc_rescan
> Call trace:
>  __switch_to+0xb0/0x198
>  __schedule+0x22c/0x604
>  schedule+0x38/0xc8
>  __mmc_claim_host+0xcc/0x1ec
>  mmc_get_card+0x30/0x3c
>  mmc_sd_detect+0x1c/0x78
>  mmc_rescan+0x1c4/0x35c
>  process_one_work+0x14c/0x408
>  worker_thread+0x140/0x3f4
>  kthread+0xfc/0x128
>  ret_from_fork+0x10/0x18
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
> According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH] arm64: dts: marvell: armada-37xx: add mailbox node
From: Gregory CLEMENT @ 2019-08-27 13:58 UTC (permalink / raw)
  To: Marek Behún, linux-arm-kernel; +Cc: Miquel Raynal, Marek Behún
In-Reply-To: <20190812163003.23016-1-marek.behun@nic.cz>

Hi Marek,

> This adds the rWTM BIU mailbox node for communication with the secure
> processor. The driver already exists in
> drivers/mailbox/armada-37xx-rwtm-mailbox.c.
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Cc: Gregory Clement <gregory.clement@bootlin.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>


Applied on mvebu/dt64

Thanks,

Gregory


> ---
>  arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
> index f43c43168b00..7f69e3dfcb13 100644
> --- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
> +++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
> @@ -419,6 +419,13 @@
>  				clocks = <&nb_periph_clk 15>;
>  			};
>  
> +			rwtm: mailbox@b0000 {
> +				compatible = "marvell,armada-3700-rwtm-mailbox";
> +				reg = <0xb0000 0x100>;
> +				interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
> +				#mbox-cells = <1>;
> +			};
> +
>  			sdhci1: sdhci@d0000 {
>  				compatible = "marvell,armada-3700-sdhci",
>  					     "marvell,sdhci-xenon";
> -- 
> 2.21.0
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH] media: stm32-dcmi: Delete an unnecessary of_node_put() call in dcmi_probe()
From: Markus Elfring @ 2019-08-27 14:09 UTC (permalink / raw)
  To: linux-media, linux-stm32, linux-arm-kernel, Alexandre Torgue,
	Hugues Fruchet, Mauro Carvalho Chehab, Maxime Coquelin
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 27 Aug 2019 16:00:13 +0200

A null pointer would be passed to a call of the function “of_node_put”
immediately after a call of the function “of_graph_get_next_endpoint”
failed at one place.
Remove this superfluous function call.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/stm32/stm32-dcmi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index cb1daf8217ff..9392e3409fba 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1861,7 +1861,6 @@ static int dcmi_probe(struct platform_device *pdev)
 	np = of_graph_get_next_endpoint(np, NULL);
 	if (!np) {
 		dev_err(&pdev->dev, "Could not find the endpoint\n");
-		of_node_put(np);
 		return -ENODEV;
 	}

--
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCHv6] drivers/amba: add reset control to amba bus probe
From: Dinh Nguyen @ 2019-08-27 14:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: robh, daniel.thompson, tony.luck, manivannan.sadhasivam, keescook,
	devicetree, linus.walleij, anton, linux, dinguyen, p.zabel,
	ccross, frowand.list, linux-arm-kernel

The primecell controller on some SoCs, i.e. SoCFPGA, is held in reset by
default. Until recently, the DMA controller was brought out of reset by the
bootloader(i.e. U-Boot). But a recent change in U-Boot, the peripherals
that are not used are held in reset and are left to Linux to bring them
out of reset.

Add a mechanism for getting the reset property and de-assert the primecell
module from reset if found. This is a not a hard fail if the reset properti
is not present in the device tree node, so the driver will continue to
probe.

Because there are different variants of the controller that may have
multiple reset signals, the code will find all reset(s) specified and
de-assert them.

Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
---
v6: remove the need to reset_control_get_count as
    of_reset_control_array_get_optional_shared is already doing that
v5: use of_reset_control_array_get_optional_shared()
v4: cleaned up indentation in loop
    fix up a few checkpatch warnings
    add Reviewed-by:
v3: add a reset_control_put()
    add error handling
v2: move reset control to bus code
    find all reset properties and de-assert them
---
 drivers/amba/bus.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 100e798a5c82..f39f075abff9 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -18,6 +18,7 @@
 #include <linux/limits.h>
 #include <linux/clk/clk-conf.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 
 #include <asm/irq.h>
 
@@ -401,6 +402,19 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
 	ret = amba_get_enable_pclk(dev);
 	if (ret == 0) {
 		u32 pid, cid;
+		struct reset_control *rstc;
+
+		/*
+		 * Find reset control(s) of the amba bus and de-assert them.
+		 */
+		rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node);
+		if (IS_ERR(rstc)) {
+			if (PTR_ERR(rstc) != -EPROBE_DEFER)
+				dev_err(&dev->dev, "Can't get amba reset!\n");
+			return PTR_ERR(rstc);
+		}
+		reset_control_deassert(rstc);
+		reset_control_put(rstc);
 
 		/*
 		 * Read pid and cid based on size of resource
-- 
2.20.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCHv6] drivers/amba: add reset control to amba bus probe
From: Philipp Zabel @ 2019-08-27 14:20 UTC (permalink / raw)
  To: Dinh Nguyen, linux-kernel
  Cc: devicetree, daniel.thompson, tony.luck, manivannan.sadhasivam,
	keescook, robh, linus.walleij, anton, linux, ccross, frowand.list,
	linux-arm-kernel
In-Reply-To: <20190827141153.20254-1-dinguyen@kernel.org>

On Tue, 2019-08-27 at 09:11 -0500, Dinh Nguyen wrote:
> The primecell controller on some SoCs, i.e. SoCFPGA, is held in reset by
> default. Until recently, the DMA controller was brought out of reset by the
> bootloader(i.e. U-Boot). But a recent change in U-Boot, the peripherals
> that are not used are held in reset and are left to Linux to bring them
> out of reset.
> 
> Add a mechanism for getting the reset property and de-assert the primecell
> module from reset if found. This is a not a hard fail if the reset properti
> is not present in the device tree node, so the driver will continue to
> probe.
> 
> Because there are different variants of the controller that may have
> multiple reset signals, the code will find all reset(s) specified and
> de-assert them.
> 
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
> Reviewed-by: Rob Herring <robh@kernel.org>
> ---
> v6: remove the need to reset_control_get_count as
>     of_reset_control_array_get_optional_shared is already doing that
> v5: use of_reset_control_array_get_optional_shared()
> v4: cleaned up indentation in loop
>     fix up a few checkpatch warnings
>     add Reviewed-by:
> v3: add a reset_control_put()
>     add error handling
> v2: move reset control to bus code
>     find all reset properties and de-assert them
> ---
>  drivers/amba/bus.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index 100e798a5c82..f39f075abff9 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -18,6 +18,7 @@
>  #include <linux/limits.h>
>  #include <linux/clk/clk-conf.h>
>  #include <linux/platform_device.h>
> +#include <linux/reset.h>
>  
>  #include <asm/irq.h>
>  
> @@ -401,6 +402,19 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
>  	ret = amba_get_enable_pclk(dev);
>  	if (ret == 0) {
>  		u32 pid, cid;
> +		struct reset_control *rstc;
> +
> +		/*
> +		 * Find reset control(s) of the amba bus and de-assert them.
> +		 */
> +		rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node);
> +		if (IS_ERR(rstc)) {
> +			if (PTR_ERR(rstc) != -EPROBE_DEFER)
> +				dev_err(&dev->dev, "Can't get amba reset!\n");
> +			return PTR_ERR(rstc);
> +		}
> +		reset_control_deassert(rstc);
> +		reset_control_put(rstc);
>  
>  		/*
>  		 * Read pid and cid based on size of resource

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 00/19] Enhance CP110 COMPHY support
From: Gregory CLEMENT @ 2019-08-27 14:22 UTC (permalink / raw)
  To: Miquel Raynal, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Kishon Vijay Abraham I
  Cc: devicetree, Antoine Tenart, Grzegorz Jaszczyk, Russell King,
	Maxime Chevallier, Nadav Haklai, Rob Herring, Thomas Petazzoni,
	Miquel Raynal, linux-arm-kernel
In-Reply-To: <20190731122126.3049-1-miquel.raynal@bootlin.com>

Hi Miquel,

> Armada CP110 have a COMPHY IP which supports configuring SERDES lanes
> in one mode, either:
> - SATA
> - USB3 host
> - PCIe (several width)
> - Ethernet (several modes)
>
> As of today, only a few Ethernet modes are supported and the code is
> embedded in the Linux driver. A more complete COMPHY driver that can
> be used by both Linux and U-Boot is embedded in the firmware and can
> be run through SMC calls.
>
> First the current COMPHY driver is updated to use SMC calls but
> fallbacks to the already existing functions if the firmware is not
> up-to-date. Then, more Ethernet modes are added (through SMC calls
> only). SATA, USB3H and PCIe modes are also supported one by one.
>
> There is one subtle difference with the PCIe functions: we must tell
> the firmware the number of lanes to configure (x1, x2 or x4). This
> parameter depends on the number of entries in the 'phys' property
> describing the PCIe PHY. We use the "submode" parameter of the generic
> PHY API to carry this value. The Armada-8k PCIe driver has been
> updated to follow this idea and this change has been merged already:
> http://patchwork.ozlabs.org/patch/1072763/
>
> Thanks,
> Miquèl
>
>
> Changes since v2:
> -----------------
> * Inverted two arguments in a trace.
> * Avoid warning the user when EPROBE_DEFER is returned (clocks case).
> * Added Maxime C. and Grzegorz J. 's Tested-by tags (only on the
>   "introducing SMC calls" patch, but they tested the whole series).
> * Added Rob's Reviewed-by on the bindings.
> * Also updated the bindings as suggested by Rob to reflect that there
>   can be from one to four PHYs in the PCIe nodes (hence, the need for
>   the phy-names property).
>
> Changes since v1:
> -----------------
> * All modes report their errors to the user.
> * If the firmware is too old, advise the user to update it.
> * Credit Grzegorz for his work.
> * Fix wrong speed in Ethernet modes.
> * Add COMPHY necessary clocks.
> * Update bindings.
> * The security flaw related to the fact that we must give the CP
>   address to the firmware has been mitigated by the addition of extra
>   checks in ATF recently.
>
>
> Grzegorz Jaszczyk (5):
>   phy: mvebu-cp110-comphy: Add SMC call support
>   phy: mvebu-cp110-comphy: Add RXAUI support
>   phy: mvebu-cp110-comphy: Add USB3 host/device support
>   phy: mvebu-cp110-comphy: Add SATA support
>   phy: mvebu-cp110-comphy: Add PCIe support
>
> Miquel Raynal (14):
>   phy: mvebu-cp110-comphy: Add clocks support
>   phy: mvebu-cp110-comphy: Explicitly initialize the lane submode
>   phy: mvebu-cp110-comphy: List already supported Ethernet modes
>   phy: mvebu-cp110-comphy: Rename the macro handling only Ethernet modes
>   phy: mvebu-cp110-comphy: Allow non-Ethernet modes to be configured
>   phy: mvebu-cp110-comphy: Cosmetic change in a helper
>   phy: mvebu-cp110-comphy: Update comment about powering off all lanes
>     at boot
>   dt-bindings: phy: Add Marvell COMPHY clocks
>   dt-bindings: pci: add PHY properties to Armada 7K/8K controller
>     bindings



>   arm64: dts: marvell: Add CP110 COMPHY clocks
>   arm64: dts: marvell: Add 7k/8k per-port PHYs in SATA nodes
>   arm64: dts: marvell: Add 7k/8k PHYs in USB3 nodes
>   arm64: dts: marvell: Add 7k/8k PHYs in PCIe nodes
>   arm64: dts: marvell: Convert 7k/8k usb-phy properties to phy-supply

These 5 patches have been applied on mvebu/dt64

Thanks,

Gregory



>
>  .../devicetree/bindings/pci/pci-armada8k.txt  |   6 +
>  .../bindings/phy/phy-mvebu-comphy.txt         |  10 +
>  .../arm64/boot/dts/marvell/armada-7040-db.dts |  37 +-
>  .../marvell/armada-8040-clearfog-gt-8k.dts    |  22 +-
>  .../arm64/boot/dts/marvell/armada-8040-db.dts |  43 +-
>  .../boot/dts/marvell/armada-8040-mcbin.dtsi   |  38 +-
>  arch/arm64/boot/dts/marvell/armada-cp110.dtsi |  13 +
>  drivers/phy/marvell/phy-mvebu-cp110-comphy.c  | 412 +++++++++++++++---
>  8 files changed, 499 insertions(+), 82 deletions(-)
>
> -- 
> 2.20.1
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 02/11] kselftest: arm64: adds first test and common utils
From: Cristian Marussi @ 2019-08-27 14:24 UTC (permalink / raw)
  To: Amit Kachhap, linux-kselftest@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, shuah@kernel.org
  Cc: andreyknvl@google.com, Dave P Martin
In-Reply-To: <6f74c9d9-7ea5-15b5-98ec-d896019f1c08@arm.com>

Hi

On 14/08/2019 11:22, Amit Kachhap wrote:
> Hi Cristian,
> 
> I have few more comments,
> 
> On 8/13/19 6:52 PM, Cristian Marussi wrote:
>> Hi Amit
>>
>> thanks for the review.
>>
>> On 12/08/2019 13:43, Amit Kachhap wrote:
>>> Hi Cristian,
>>>
>>> On 8/2/19 10:32 PM, Cristian Marussi wrote:
>>>> Added some arm64/signal specific boilerplate and utility code to help
>>>> further testcase development.
>>>>
>>>> A simple testcase and related helpers are also introduced in this commit:
>>>> mangle_pstate_invalid_compat_toggle is a simple mangle testcase which
>>>> messes with the ucontext_t from within the sig_handler, trying to toggle
>>>> PSTATE state bits to switch the system between 32bit/64bit execution state.
>>>> Expects SIGSEGV on test PASS.
>>>>
>>>> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
>>>> ---
>>>> A few fixes:
>>>> - test_arm64_signals.sh runner script generation has been reviewed in order to
>>>>     be safe against the .gitignore
>>>> - using kselftest.h officially provided defines for tests' return values
>>>> - removed SAFE_WRITE()/dump_uc()
>>>> - looking for si_code==SEGV_ACCERR on SEGV test cases to better understand if
>>>>     the sigfault had been directly triggered by Kernel
>>>> ---
>>>>    tools/testing/selftests/arm64/Makefile        |   2 +-
>>>>    .../testing/selftests/arm64/signal/.gitignore |   6 +
>>>>    tools/testing/selftests/arm64/signal/Makefile |  88 ++++++
>>>>    tools/testing/selftests/arm64/signal/README   |  59 ++++
>>>>    .../arm64/signal/test_arm64_signals.src_shell |  55 ++++
>>>>    .../selftests/arm64/signal/test_signals.c     |  26 ++
>>>>    .../selftests/arm64/signal/test_signals.h     | 137 +++++++++
>>>>    .../arm64/signal/test_signals_utils.c         | 261 ++++++++++++++++++
>>>>    .../arm64/signal/test_signals_utils.h         |  13 +
>>>>    .../arm64/signal/testcases/.gitignore         |   1 +
>>>>    .../mangle_pstate_invalid_compat_toggle.c     |  25 ++
>>>>    .../arm64/signal/testcases/testcases.c        | 150 ++++++++++
>>>>    .../arm64/signal/testcases/testcases.h        |  83 ++++++
>>>>    13 files changed, 905 insertions(+), 1 deletion(-)
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/.gitignore
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/Makefile
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/README
>>>>    create mode 100755 tools/testing/selftests/arm64/signal/test_arm64_signals.src_shell
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/test_signals.c
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/test_signals.h
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/test_signals_utils.c
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/test_signals_utils.h
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/testcases/.gitignore
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/testcases/mangle_pstate_invalid_compat_toggle.c
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/testcases/testcases.c
>>>>    create mode 100644 tools/testing/selftests/arm64/signal/testcases/testcases.h
>>>>
>>>> diff --git a/tools/testing/selftests/arm64/Makefile b/tools/testing/selftests/arm64/Makefile
>>>> index 03a0d4f71218..af59dc74e0dc 100644
>>>> --- a/tools/testing/selftests/arm64/Makefile
>>>> +++ b/tools/testing/selftests/arm64/Makefile
>>>> @@ -6,7 +6,7 @@ ARCH ?= $(shell uname -m)
>>>>    ARCH := $(shell echo $(ARCH) | sed -e s/aarch64/arm64/)
>>>>    
>>>>    ifeq ("x$(ARCH)", "xarm64")
>>>> -SUBDIRS :=
>>>> +SUBDIRS := signal
>>>>    else
>>>>    SUBDIRS :=
>>>>    endif
>>>> diff --git a/tools/testing/selftests/arm64/signal/.gitignore b/tools/testing/selftests/arm64/signal/.gitignore
>>>> new file mode 100644
>>>> index 000000000000..434f65c15f03
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/.gitignore
>>>> @@ -0,0 +1,6 @@
>>>> +# Helper script's internal testcases list (TPROGS) is regenerated
>>>> +# each time by Makefile on standalone (non KSFT driven) runs.
>>>> +# Committing such list creates a dependency between testcases
>>>> +# patches such that they are no more easily revertable. Just ignore.
>>>> +test_arm64_signals.src_shell
>>>> +test_arm64_signals.sh
>>>> diff --git a/tools/testing/selftests/arm64/signal/Makefile b/tools/testing/selftests/arm64/signal/Makefile
>>>> new file mode 100644
>>>> index 000000000000..8c8d08be4b0d
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/Makefile
>>>> @@ -0,0 +1,88 @@
>>>> +# SPDX-License-Identifier: GPL-2.0
>>>> +# Copyright (C) 2019 ARM Limited
>>>> +
>>>> +# Supports also standalone invokation out of KSFT-tree
>>>> +# Compile standalone and run on your device with:
>>>> +#
>>>> +#  $ make -C tools/testing/selftests/arm64/signal INSTALL_PATH=<your-dir> install
>>>> +#
>>>> +# Run standalone on device with:
>>>> +#
>>>> +#  $ <your-device-instdir>/test_arm64_signals.sh [-k|-v]
>>>> +#
>>>> +# If INSTALL_PATH= is NOT provided it will default to ./install
>>>> +
>>>> +# A proper top_srcdir is needed both by KSFT(lib.mk)
>>>> +# and standalone builds
>>>> +top_srcdir = ../../../../..
>>>> +
>>>> +CFLAGS += -std=gnu99 -I. -I$(top_srcdir)/tools/testing/selftests/
>>>> +SRCS := $(filter-out testcases/testcases.c,$(wildcard testcases/*.c))
>>>> +PROGS := $(patsubst %.c,%,$(SRCS))
>>>> +
>>>> +# Guessing as best as we can where the Kernel headers
>>>> +# could have been installed depending on ENV config and
>>>> +# type of invocation.
>>>> +ifeq ($(KBUILD_OUTPUT),)
>>>> +khdr_dir = $(top_srcdir)/usr/include
>>>> +else
>>>> +ifeq (0,$(MAKELEVEL))
>>>> +khdr_dir = $(KBUILD_OUTPUT)/usr/include
>>>> +else
>>>> +# the KSFT preferred location when KBUILD_OUTPUT is set
>>>> +khdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include
>>>> +endif
>>>> +endif
>>>> +
>>>> +CFLAGS += -I$(khdr_dir)
>>>> +
>>>> +# Standalone run
>>>> +ifeq (0,$(MAKELEVEL))
>>>> +CC := $(CROSS_COMPILE)gcc
>>>> +RUNNER_SRC = test_arm64_signals.src_shell
>>>> +RUNNER = test_arm64_signals.sh
> Is this extra level of copying test_arm64_signals.src_shell to 
> test_arm64_signals.sh required? I cannot see them in other selftests.
> Also if done then clean may be required. May be EXTRA_CLEAN parameter
> can be used as done for other selftests.
This was the runner script for standalone mode (build/run): it was generated on
the fly sedding the PROGS list inside the .src_shell template script: I had to be
done this way in order to properly have it .gitignored
Anyway I'm throwing away standalone mode in V4

>>>> +INSTALL_PATH ?= install/
> Here default INSTALL_PATH should be just "install" as it may insert "/" 
> twice for below install case.

Ok
>>>> +
>>>> +all: $(RUNNER)
>>>> +
>>>> +$(RUNNER): $(PROGS)
>>>> +	cp $(RUNNER_SRC) $(RUNNER)
>>>> +	sed -i -e 's#PROGS=.*#PROGS="$(PROGS)"#' $@
>>>> +
>>>> +install: all
>>>> +	mkdir -p $(INSTALL_PATH)/testcases
>>>> +	cp $(PROGS) $(INSTALL_PATH)/testcases
>>>> +	cp $(RUNNER) $(INSTALL_PATH)/
>>>> +
>>>> +.PHONY clean:
>>>> +	rm -f $(PROGS)
>>>> +# KSFT run
>>>> +else
>>>> +# Generated binaries to be installed by top KSFT script
>>>> +TEST_GEN_PROGS := $(notdir $(PROGS))
>>>> +
>>>> +# Get Kernel headers installed and use them.
>>>> +KSFT_KHDR_INSTALL := 1
>>>> +
>>>> +# This include mk will also mangle the TEST_GEN_PROGS list
>>>> +# to account for any OUTPUT target-dirs optionally provided
>>>> +# by the toplevel makefile
>>>> +include ../../lib.mk
>>>> +
>>>> +$(TEST_GEN_PROGS): $(PROGS)
>>>> +	cp $(PROGS) $(OUTPUT)/
> I guess this copy requires cleaning too.
I'll double check but I think OUTPUT is already cleaned by lib.mk default $(CLEAN) target
called below....here I'm copying the just built PROGS in their final destination OUTPUT
since they were built in the subdir arm64/signal and it could not be found by KSFT otherwise,
which expects they in OUTPUT.

>>>> +
>>>> +clean:
>>>> +	$(CLEAN)
>>>> +	rm -f $(PROGS)
> Is clean requires to clean installed programs also?

I avoided cleaning explicitly installed programs. I think by convention Make target
clean is not expected to remove installed files.
ftp://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_14.html

uninstall seems a possible target for that operation, but KSFT does not define it.

Anyway given that these tests could be installed on NFS share mounted on remote testing unit
I don't think it is useful here to be able to unistall

Thanks

Cristian

>>>> +endif
>>>> +
>>>> +# Common test-unit targets to build common-layout test-cases executables
>>>> +# Needs secondary expansion to properly include the testcase c-file in pre-reqs
>>>> +.SECONDEXPANSION:
>>>> +$(PROGS): test_signals.c test_signals_utils.c testcases/testcases.c $$@.c test_signals.h test_signals_utils.h testcases/testcases.h
>>>
>>> I suppose *.h can be removed from the targets here.
>>
>> *.h are in the pre-reqs, $(PROGS) represent the targets and it's comprised by the *.c file contained in testcases/ (excluding testcases.c)
>>
>> If I remove the *.h from this rule, targets won't be rebuilt when headers are changed (like after having added an hypotethical inline)...
>>
>> or am I missing something else ?
> Yes You are right.
> 
> Thanks,
> Amit Daniel
>>
>>
>>>
>>>
>>>> +	@if [ ! -d $(khdr_dir) ]; then \
>>>> +		echo -n "\n!!! WARNING: $(khdr_dir) NOT FOUND."; \
>>>> +		echo "===>  Are you sure Kernel Headers have been installed properly ?\n"; \
>>>> +	fi
>>>> +	$(CC) $(CFLAGS) $^ -o $@
>>>> diff --git a/tools/testing/selftests/arm64/signal/README b/tools/testing/selftests/arm64/signal/README
>>>> new file mode 100644
>>>> index 000000000000..53f005f7910a
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/README
>>>> @@ -0,0 +1,59 @@
>>>> +KSelfTest arm64/signal/
>>>> +=======================
>>>> +
>>>> +Signals Tests
>>>> ++++++++++++++
>>>> +
>>>> +- Tests are built around a common main compilation unit: such shared main
>>>> +  enforces a standard sequence of operations needed to perform a single
>>>> +  signal-test (setup/trigger/run/result/cleanup)
>>>> +
>>>> +- The above mentioned ops are configurable on a test-by-test basis: each test
>>>> +  is described (and configured) using the descriptor signals.h::struct tdescr
>>>> +
>>>> +- Each signal testcase is compiled into its own executable: a separate
>>>> +  executable is used for each test since many tests complete successfully
>>>> +  by receiving some kind of fatal signal from the Kernel, so it's safer
>>>> +  to run each test unit in its own standalone process, so as to start each
>>>> +  test from a clean slate.
>>>> +
>>>> +- New tests can be simply defined in testcases/ dir providing a proper struct
>>>> +  tdescr overriding all the defaults we wish to change (as of now providing a
>>>> +  custom run method is mandatory though)
>>>> +
>>>> +- Signals' test-cases hereafter defined belong currently to two
>>>> +  principal families:
>>>> +
>>>> +  - 'mangle_' tests: a real signal (SIGUSR1) is raised and used as a trigger
>>>> +    and then the test case code messes-up with the sigframe ucontext_t from
>>>> +    inside the sighandler itself.
>>>> +
>>>> +  - 'fake_sigreturn_' tests: a brand new custom artificial sigframe structure
>>>> +    is placed on the stack and a sigreturn syscall is called to simulate a
>>>> +    real signal return. This kind of tests does not use a trigger usually and
>>>> +    they are just fired using some simple included assembly trampoline code.
>>>> +
>>>> + - Most of these tests are successfully passing if the process gets killed by
>>>> +   some fatal signal: usually SIGSEGV or SIGBUS. Since while writing this
>>>> +   kind of tests it is extremely easy in fact to end-up injecting other
>>>> +   unrelated SEGV bugs in the testcases, it becomes extremely tricky to
>>>> +   be really sure that the tests are really addressing what they are meant
>>>> +   to address and they are not instead falling apart due to unplanned bugs
>>>> +   in the test code.
>>>> +   In order to alleviate the misery of the life of such test-developer, a few
>>>> +   helpers are provided:
>>>> +
>>>> +   - a couple of ASSERT_BAD/GOOD_CONTEXT() macros to easily parse a ucontext_t
>>>> +     and verify if it is indeed GOOD or BAD (depending on what we were
>>>> +     expecting), using the same logic/perspective as in the arm64 Kernel signals
>>>> +     routines.
>>>> +
>>>> +   - a sanity mechanism to be used in 'fake_sigreturn_'-alike tests: enabled by
>>>> +     default it takes care to verify that the test-execution had at least
>>>> +     successfully progressed up to the stage of triggering the fake sigreturn
>>>> +     call.
>>>> +
>>>> +  In both cases test results are expected in terms of:
>>>> +   - some fatal signal sent by the Kernel to the test process
>>>> +  or
>>>> +  - analyzing some final regs state
>>>> diff --git a/tools/testing/selftests/arm64/signal/test_arm64_signals.src_shell b/tools/testing/selftests/arm64/signal/test_arm64_signals.src_shell
>>>> new file mode 100755
>>>> index 000000000000..163e941e2997
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/test_arm64_signals.src_shell
>>>> @@ -0,0 +1,55 @@
>>>> +#!/bin/sh
>>>> +# SPDX-License-Identifier: GPL-2.0
>>>> +# Copyright (C) 2019 ARM Limited
>>>> +
>>>> +ret=0
>>>> +keep_on_fail=0
>>>> +err_out="2> /dev/null"
>>>> +
>>>> +usage() {
>>>> +	echo "Usage: `basename $0` [-v] [-k]"
>>>> +	exit 1
>>>> +}
>>>> +
>>>> +# avoiding getopt to avoid compatibility issues on targets
>>>> +# with limited resources
>>>> +while [ $# -gt 0 ]
>>>> +do
>>>> +	case $1 in
>>>> +		"-k")
>>>> +			keep_on_fail=1
>>>> +			;;
>>>> +		"-v")
>>>> +			err_out=
>>>> +			;;
>>>> +		*)
>>>> +			usage
>>>> +			;;
>>>> +	esac
>>>> +	shift
>>>> +done
>>>> +
>>>> +TPROGS=
>>>> +
>>>> +tot=$(echo $TPROGS | wc -w)
>>>> +
>>>> +# Tests are expected in testcases/ subdir inside the installation path
>>>> +workdir="`dirname $0 2>/dev/null`"
>>>> +[ -n $workdir ] && cd $workdir
>>>> +
>>>> +passed=0
>>>> +run=0
>>>> +for test in $TPROGS
>>>> +do
>>>> +	run=$((run + 1))
>>>> +	eval ./$test $err_out
>>>> +	if [ $? != 0 ]; then
>>>> +		[ $keep_on_fail = 0 ] && echo "===>>> FAILED:: $test <<<===" && ret=1 && break
>>>> +	else
>>>> +		passed=$((passed + 1))
>>>> +	fi
>>>> +done
>>>> +
>>>> +echo "==>> PASSED: $passed/$run on $tot available tests."
>>>> +
>>>> +exit $ret
>>>> diff --git a/tools/testing/selftests/arm64/signal/test_signals.c b/tools/testing/selftests/arm64/signal/test_signals.c
>>>> new file mode 100644
>>>> index 000000000000..3447d7011aec
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/test_signals.c
>>>> @@ -0,0 +1,26 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>> +/* Copyright (C) 2019 ARM Limited */
>>>> +
>>>> +#include <kselftest.h>
>>>> +
>>>> +#include "test_signals.h"
>>>> +#include "test_signals_utils.h"
>>>> +
>>>> +struct tdescr *current;
>>>> +extern struct tdescr tde;
>>>> +
>>>> +int main(int argc, char *argv[])
>>>> +{
>>>> +	current = &tde;
>>>> +
>>>> +	ksft_print_msg("%s :: %s - SIG_TRIG:%d  SIG_OK:%d -- current:%p\n",
>>>> +		       current->name, current->descr, current->sig_trig,
>>>> +		       current->sig_ok, current);
>>>> +	if (test_setup(current)) {
>>>> +		if (test_run(current))
>>>> +			test_result(current);
>>>> +		test_cleanup(current);
>>>> +	}
>>>> +
>>>> +	return current->pass ? KSFT_PASS : KSFT_FAIL;
>>>> +}
>>>> diff --git a/tools/testing/selftests/arm64/signal/test_signals.h b/tools/testing/selftests/arm64/signal/test_signals.h
>>>> new file mode 100644
>>>> index 000000000000..85db3ac44b32
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/test_signals.h
>>>> @@ -0,0 +1,137 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>> +/* Copyright (C) 2019 ARM Limited */
>>>> +
>>>> +#ifndef __TEST_SIGNALS_H__
>>>> +#define __TEST_SIGNALS_H__
>>>> +
>>>> +#include <assert.h>
>>>> +#include <stdbool.h>
>>>> +#include <signal.h>
>>>> +#include <ucontext.h>
>>>> +#include <stdint.h>
>>> Headers can be added in alphabetically order.
>>>
>> Ok I'll do.
>>
>> Cheers
>>
>> Cristian
>>
>>> Thanks,
>>> Amit D
>>>> +
>>>> +/*
>>>> + * Using ARCH specific and sanitized Kernel headers installed by KSFT
>>>> + * framework since we asked for it by setting flag KSFT_KHDR_INSTALL
>>>> + * in our Makefile.
>>>> + */
>>>> +#include <asm/ptrace.h>
>>>> +#include <asm/hwcap.h>
>>>> +
>>>> +/* pasted from include/linux/stringify.h */
>>>> +#define __stringify_1(x...)	#x
>>>> +#define __stringify(x...)	__stringify_1(x)
>>>> +
>>>> +/*
>>>> + * Reads a sysreg using the, possibly provided, S3_ encoding in order to
>>>> + * avoid inject any dependency on the used toolchain regarding possibly
>>>> + * still unsupported ARMv8 extensions.
>>>> + *
>>>> + * Using a standard mnemonic here to indicate the specific sysreg (like SSBS)
>>>> + * would introduce a compile-time dependency on possibly unsupported ARMv8
>>>> + * Extensions: you could end-up failing to build the test depending on the
>>>> + * available toolchain.
>>>> + * This is undesirable since some tests, even if specifically targeted at some
>>>> + * ARMv8 Extensions, can be plausibly run even on hardware lacking the above
>>>> + * optional ARM features. (SSBS bit preservation is an example: Kernel handles
>>>> + * it transparently not caring at all about the effective set of supported
>>>> + * features).
>>>> + * On the other side we will expect to observe different behaviours if the
>>>> + * feature is supported or not: usually getting a SIGILL when trying to use
>>>> + * unsupported features. For this reason we have anyway in place some
>>>> + * preliminary run-time checks about the cpu effectively supported features.
>>>> + *
>>>> + * This helper macro is meant to be used for regs readable at EL0, BUT some
>>>> + * EL1 sysregs are indeed readable too through MRS emulation Kernel-mechanism
>>>> + * if the required reg is included in the supported encoding space:
>>>> + *
>>>> + *  Documentation/arm64/cpu-feature-regsiters.txt
>>>> + *
>>>> + *  "The infrastructure emulates only the following system register space:
>>>> + *   	Op0=3, Op1=0, CRn=0, CRm=0,4,5,6,7
>>>> + */
>>>> +#define get_regval(regname, out) \
>>>> +	asm volatile("mrs %0, " __stringify(regname) : "=r" (out) :: "memory")
>>>> +
>>>> +/* Regs encoding and masks naming copied in from sysreg.h */
>>>> +#define SYS_ID_AA64MMFR1_EL1	S3_0_C0_C7_1	/* MRS Emulated */
>>>> +#define SYS_ID_AA64MMFR2_EL1	S3_0_C0_C7_2	/* MRS Emulated */
>>>> +#define ID_AA64MMFR1_PAN_SHIFT	20
>>>> +#define ID_AA64MMFR2_UAO_SHIFT	4
>>>> +
>>>> +/* Local Helpers */
>>>> +#define IS_PAN_SUPPORTED(val) \
>>>> +	(!!((val) & (0xfUL << ID_AA64MMFR1_PAN_SHIFT)))
>>>> +#define IS_UAO_SUPPORTED(val) \
>>>> +	(!!((val) & (0xfUL << ID_AA64MMFR2_UAO_SHIFT)))
>>>> +
>>>> +#define S3_MRS_SSBS_SYSREG		S3_3_C4_C2_6	/* EL0 supported */
>>>> +
>>>> +/*
>>>> + * Feature flags used in tdescr.feats_required to specify
>>>> + * any feature by the test
>>>> + */
>>>> +enum {
>>>> +	FSSBS_BIT,
>>>> +	FPAN_BIT,
>>>> +	FUAO_BIT,
>>>> +	FMAX_END
>>>> +};
>>>> +
>>>> +#define FEAT_SSBS		(1UL << FSSBS_BIT)
>>>> +#define FEAT_PAN		(1UL << FPAN_BIT)
>>>> +#define FEAT_UAO		(1UL << FUAO_BIT)
>>>> +
>>>> +/*
>>>> + * A descriptor used to describe and configure a test case.
>>>> + * Fields with a non-trivial meaning are described inline in the following.
>>>> + */
>>>> +struct tdescr {
>>>> +	/* KEEP THIS FIELD FIRST for easier lookup from assembly */
>>>> +	void		*token;
>>>> +	/* when disabled token based sanity checking is skipped in handler */
>>>> +	bool		sanity_disabled;
>>>> +	/* just a name for the test-case; manadatory field */
>>>> +	char		*name;
>>>> +	char		*descr;
>>>> +	unsigned long	feats_required;
>>>> +	/* bitmask of effectively supported feats: populated at run-time */
>>>> +	unsigned long	feats_supported;
>>>> +	bool		feats_ok;
>>>> +	bool		initialized;
>>>> +	unsigned int	minsigstksz;
>>>> +	/* signum used as a test trigger. Zero if no trigger-signal is used */
>>>> +	int		sig_trig;
>>>> +	/*
>>>> +	 * signum considered as a successful test completion.
>>>> +	 * Zero when no signal is expected on success
>>>> +	 */
>>>> +	int		sig_ok;
>>>> +	/* signum expected on unsupported CPU features. */
>>>> +	int		sig_unsupp;
>>>> +	/* a timeout in second for test completion */
>>>> +	unsigned int	timeout;
>>>> +	bool		triggered;
>>>> +	bool		pass;
>>>> +	/* optional sa_flags for the installed handler */
>>>> +	int		sa_flags;
>>>> +	ucontext_t	saved_uc;
>>>> +
>>>> +	/* a setup function to be called before test starts */
>>>> +	int (*setup)(struct tdescr *td);
>>>> +	void (*cleanup)(struct tdescr *td);
>>>> +
>>>> +	/* an optional function to be used as a trigger for test starting */
>>>> +	int (*trigger)(struct tdescr *td);
>>>> +	/*
>>>> +	 * the actual test-core: invoked differently depending on the
>>>> +	 * presence of the trigger function above; this is mandatory
>>>> +	 */
>>>> +	int (*run)(struct tdescr *td, siginfo_t *si, ucontext_t *uc);
>>>> +
>>>> +	/* an optional function for custom results' processing */
>>>> +	void (*check_result)(struct tdescr *td);
>>>> +
>>>> +	void *priv;
>>>> +};
>>>> +#endif
>>>> diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c
>>>> new file mode 100644
>>>> index 000000000000..ac0055f6340b
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c
>>>> @@ -0,0 +1,261 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>> +/* Copyright (C) 2019 ARM Limited */
>>>> +
>>>> +#include <stdio.h>
>>>> +#include <stdlib.h>
>>>> +#include <signal.h>
>>>> +#include <string.h>
>>>> +#include <unistd.h>
>>>> +#include <assert.h>
>>>> +#include <sys/auxv.h>
>>>> +#include <linux/auxvec.h>
>>>> +#include <ucontext.h>
>>>> +
>>>> +#include "test_signals.h"
>>>> +#include "test_signals_utils.h"
>>>> +#include "testcases/testcases.h"
>>>> +
>>>> +extern struct tdescr *current;
>>>> +
>>>> +static char *feats_store[FMAX_END] = {
>>>> +	"SSBS",
>>>> +	"PAN",
>>>> +	"UAO"
>>>> +};
>>>> +
>>>> +#define MAX_FEATS_SZ	128
>>>> +static inline char *feats_to_string(unsigned long feats)
>>>> +{
>>>> +	static char feats_string[MAX_FEATS_SZ];
>>>> +
>>>> +	for (int i = 0; i < FMAX_END && feats_store[i][0]; i++) {
>>>> +		if (feats & 1UL << i)
>>>> +			snprintf(feats_string, MAX_FEATS_SZ - 1, "%s %s ",
>>>> +				 feats_string, feats_store[i]);
>>>> +	}
>>>> +
>>>> +	return feats_string;
>>>> +}
>>>> +
>>>> +static void unblock_signal(int signum)
>>>> +{
>>>> +	sigset_t sset;
>>>> +
>>>> +	sigemptyset(&sset);
>>>> +	sigaddset(&sset, signum);
>>>> +	sigprocmask(SIG_UNBLOCK, &sset, NULL);
>>>> +}
>>>> +
>>>> +static void default_result(struct tdescr *td, bool force_exit)
>>>> +{
>>>> +	if (td->pass)
>>>> +		fprintf(stderr, "==>> completed. PASS(1)\n");
>>>> +	else
>>>> +		fprintf(stdout, "==>> completed. FAIL(0)\n");
>>>> +	if (force_exit)
>>>> +		exit(td->pass ? EXIT_SUCCESS : EXIT_FAILURE);
>>>> +}
>>>> +
>>>> +static inline bool are_feats_ok(struct tdescr *td)
>>>> +{
>>>> +	return td ? td->feats_required == td->feats_supported : 0;
>>>> +}
>>>> +
>>>> +static void default_handler(int signum, siginfo_t *si, void *uc)
>>>> +{
>>>> +	if (current->sig_trig && signum == current->sig_trig) {
>>>> +		fprintf(stderr, "Handling SIG_TRIG\n");
>>>> +		current->triggered = 1;
>>>> +		/* ->run was asserted NON-NULL in test_setup() already */
>>>> +		current->run(current, si, uc);
>>>> +	} else if (signum == SIGILL && !current->initialized) {
>>>> +		/*
>>>> +		 * A SIGILL here while still not initialized means we failed
>>>> +		 * even to asses the existence of features during init
>>>> +		 */
>>>> +		fprintf(stdout,
>>>> +			"Got SIGILL test_init. Marking ALL features UNSUPPORTED.\n");
>>>> +		current->feats_supported = 0;
>>>> +	} else if (current->sig_ok && signum == current->sig_ok) {
>>>> +		/* it's a bug in the test code when this assert fail */
>>>> +		assert(!current->sig_trig || current->triggered);
>>>> +		fprintf(stderr,
>>>> +			"SIG_OK -- SP:%p  si_addr@:0x%p  si_code:%d  token@:0x%p  offset:%ld\n",
>>>> +			((ucontext_t *)uc)->uc_mcontext.sp,
>>>> +			si->si_addr, si->si_code, current->token,
>>>> +			current->token - si->si_addr);
>>>> +		/*
>>>> +		 * fake_sigreturn tests, which have sanity_enabled=1, set, at
>>>> +		 * the very last time, the token field to the SP address used
>>>> +		 * to place the fake sigframe: so token==0 means we never made
>>>> +		 * it to the end, segfaulting well-before, and the test is
>>>> +		 * possibly broken.
>>>> +		 */
>>>> +		if (!current->sanity_disabled && !current->token) {
>>>> +			fprintf(stdout,
>>>> +				"current->token ZEROED...test is probably broken!\n");
>>>> +			assert(0);
>>>> +		}
>>>> +		/*
>>>> +		 * Trying to narrow down the SEGV to the ones generated by
>>>> +		 * Kernel itself via arm64_notify_segfault()
>>>> +		 */
>>>> +		if (current->sig_ok == SIGSEGV && si->si_code != SEGV_ACCERR) {
>>>> +			fprintf(stdout,
>>>> +				"si_code != SEGV_ACCERR...test is probably broken!\n");
>>>> +			assert(0);
>>>> +		}
>>>> +		fprintf(stderr, "Handling SIG_OK\n");
>>>> +		current->pass = 1;
>>>> +		/*
>>>> +		 * Some tests can lead to SEGV loops: in such a case we want
>>>> +		 * to terminate immediately exiting straight away
>>>> +		 */
>>>> +		default_result(current, 1);
>>>> +	} else {
>>>> +		if (signum == current->sig_unsupp && !are_feats_ok(current)) {
>>>> +			fprintf(stderr, "-- RX SIG_UNSUPP on unsupported feature...OK\n");
>>>> +			current->pass = 1;
>>>> +		} else if (signum == SIGALRM && current->timeout) {
>>>> +			fprintf(stderr, "-- Timeout !\n");
>>>> +		} else {
>>>> +			fprintf(stderr,
>>>> +				"-- RX UNEXPECTED SIGNAL: %d\n", signum);
>>>> +		}
>>>> +		default_result(current, 1);
>>>> +	}
>>>> +}
>>>> +
>>>> +static int default_setup(struct tdescr *td)
>>>> +{
>>>> +	struct sigaction sa;
>>>> +
>>>> +	sa.sa_sigaction = default_handler;
>>>> +	sa.sa_flags = SA_SIGINFO;
>>>> +	if (td->sa_flags)
>>>> +		sa.sa_flags |= td->sa_flags;
>>>> +	sigemptyset(&sa.sa_mask);
>>>> +	/* uncatchable signals naturally skipped ... */
>>>> +	for (int sig = 1; sig < 32; sig++)
>>>> +		sigaction(sig, &sa, NULL);
>>>> +	/*
>>>> +	 * RT Signals default disposition is Term but they cannot be
>>>> +	 * generated by the Kernel in response to our tests; so just catch
>>>> +	 * them all and report them as UNEXPECTED signals.
>>>> +	 */
>>>> +	for (int sig = SIGRTMIN; sig <= SIGRTMAX; sig++)
>>>> +		sigaction(sig, &sa, NULL);
>>>> +
>>>> +	/* just in case...unblock explicitly all we need */
>>>> +	if (td->sig_trig)
>>>> +		unblock_signal(td->sig_trig);
>>>> +	if (td->sig_ok)
>>>> +		unblock_signal(td->sig_ok);
>>>> +	if (td->sig_unsupp)
>>>> +		unblock_signal(td->sig_unsupp);
>>>> +
>>>> +	if (td->timeout) {
>>>> +		unblock_signal(SIGALRM);
>>>> +		alarm(td->timeout);
>>>> +	}
>>>> +	fprintf(stderr, "Registered handlers for all signals.\n");
>>>> +
>>>> +	return 1;
>>>> +}
>>>> +
>>>> +static inline int default_trigger(struct tdescr *td)
>>>> +{
>>>> +	return !raise(td->sig_trig);
>>>> +}
>>>> +
>>>> +static int test_init(struct tdescr *td)
>>>> +{
>>>> +	td->minsigstksz = getauxval(AT_MINSIGSTKSZ);
>>>> +	if (!td->minsigstksz)
>>>> +		td->minsigstksz = MINSIGSTKSZ;
>>>> +	fprintf(stderr, "Detected MINSTKSIGSZ:%d\n", td->minsigstksz);
>>>> +
>>>> +	if (td->feats_required) {
>>>> +		bool feats_ok = false;
>>>> +		td->feats_supported = 0;
>>>> +		/*
>>>> +		 * Checking for CPU required features using both the
>>>> +		 * auxval and the arm64 MRS Emulation to read sysregs.
>>>> +		 */
>>>> +		if (getauxval(AT_HWCAP) & HWCAP_CPUID) {
>>>> +			uint64_t val = 0;
>>>> +
>>>> +			if (td->feats_required & FEAT_SSBS) {
>>>> +				/* Uses HWCAP to check capability */
>>>> +				if (getauxval(AT_HWCAP) & HWCAP_SSBS)
>>>> +					td->feats_supported |= FEAT_SSBS;
>>>> +			}
>>>> +			if (td->feats_required & FEAT_PAN) {
>>>> +				/* Uses MRS emulation to check capability */
>>>> +				get_regval(SYS_ID_AA64MMFR1_EL1, val);
>>>> +				if (IS_PAN_SUPPORTED(val))
>>>> +					td->feats_supported |= FEAT_PAN;
>>>> +			}
>>>> +			if (td->feats_required & FEAT_UAO) {
>>>> +				/* Uses MRS emulation to check capability */
>>>> +				get_regval(SYS_ID_AA64MMFR2_EL1 , val);
>>>> +				if (IS_UAO_SUPPORTED(val))
>>>> +					td->feats_supported |= FEAT_UAO;
>>>> +			}
>>>> +		} else {
>>>> +			fprintf(stderr,
>>>> +				"HWCAP_CPUID NOT available. Mark ALL feats UNSUPPORTED.\n");
>>>> +		}
>>>> +		feats_ok = are_feats_ok(td);
>>>> +		fprintf(stderr,
>>>> +			"Required Features: [%s] %ssupported\n",
>>>> +			feats_ok ? feats_to_string(td->feats_supported) :
>>>> +		        feats_to_string(td->feats_required ^ td->feats_supported),
>>>> +			!feats_ok ? "NOT " : "");
>>>> +	}
>>>> +
>>>> +	td->initialized = 1;
>>>> +	return 1;
>>>> +}
>>>> +
>>>> +int test_setup(struct tdescr *td)
>>>> +{
>>>> +	/* assert core invariants symptom of a rotten testcase */
>>>> +	assert(current);
>>>> +	assert(td);
>>>> +	assert(td->name);
>>>> +	assert(td->run);
>>>> +
>>>> +	if (!test_init(td))
>>>> +		return 0;
>>>> +
>>>> +	if (td->setup)
>>>> +		return td->setup(td);
>>>> +	else
>>>> +		return default_setup(td);
>>>> +}
>>>> +
>>>> +int test_run(struct tdescr *td)
>>>> +{
>>>> +	if (td->sig_trig) {
>>>> +		if (td->trigger)
>>>> +			return td->trigger(td);
>>>> +		else
>>>> +			return default_trigger(td);
>>>> +	} else {
>>>> +		return td->run(td, NULL, NULL);
>>>> +	}
>>>> +}
>>>> +
>>>> +void test_result(struct tdescr *td)
>>>> +{
>>>> +	if (td->check_result)
>>>> +		td->check_result(td);
>>>> +	default_result(td, 0);
>>>> +}
>>>> +
>>>> +void test_cleanup(struct tdescr *td)
>>>> +{
>>>> +	if (td->cleanup)
>>>> +		td->cleanup(td);
>>>> +}
>>>> diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h
>>>> new file mode 100644
>>>> index 000000000000..8658d1a7d4b9
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h
>>>> @@ -0,0 +1,13 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>> +/* Copyright (C) 2019 ARM Limited */
>>>> +
>>>> +#ifndef __TEST_SIGNALS_UTILS_H__
>>>> +#define __TEST_SIGNALS_UTILS_H__
>>>> +
>>>> +#include "test_signals.h"
>>>> +
>>>> +int test_setup(struct tdescr *td);
>>>> +void test_cleanup(struct tdescr *td);
>>>> +int test_run(struct tdescr *td);
>>>> +void test_result(struct tdescr *td);
>>>> +#endif
>>>> diff --git a/tools/testing/selftests/arm64/signal/testcases/.gitignore b/tools/testing/selftests/arm64/signal/testcases/.gitignore
>>>> new file mode 100644
>>>> index 000000000000..8651272e3cfc
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/testcases/.gitignore
>>>> @@ -0,0 +1 @@
>>>> +mangle_pstate_invalid_compat_toggle
>>>> diff --git a/tools/testing/selftests/arm64/signal/testcases/mangle_pstate_invalid_compat_toggle.c b/tools/testing/selftests/arm64/signal/testcases/mangle_pstate_invalid_compat_toggle.c
>>>> new file mode 100644
>>>> index 000000000000..971193e7501b
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/testcases/mangle_pstate_invalid_compat_toggle.c
>>>> @@ -0,0 +1,25 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>> +/* Copyright (C) 2019 ARM Limited */
>>>> +
>>>> +#include "test_signals_utils.h"
>>>> +#include "testcases.h"
>>>> +
>>>> +static int mangle_invalid_pstate_run(struct tdescr *td, siginfo_t *si,
>>>> +				     ucontext_t *uc)
>>>> +{
>>>> +	ASSERT_GOOD_CONTEXT(uc);
>>>> +
>>>> +	/* This config should trigger a SIGSEGV by Kernel */
>>>> +	uc->uc_mcontext.pstate ^= PSR_MODE32_BIT;
>>>> +
>>>> +	return 1;
>>>> +}
>>>> +
>>>> +struct tdescr tde = {
>>>> +		.sanity_disabled = true,
>>>> +		.name = "MANGLE_PSTATE_INVALID_STATE_TOGGLE",
>>>> +		.descr = "Mangling uc_mcontext with INVALID STATE_TOGGLE",
>>>> +		.sig_trig = SIGUSR1,
>>>> +		.sig_ok = SIGSEGV,
>>>> +		.run = mangle_invalid_pstate_run,
>>>> +};
>>>> diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c
>>>> new file mode 100644
>>>> index 000000000000..a59785092e1f
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c
>>>> @@ -0,0 +1,150 @@
>>>> +#include "testcases.h"
>>>> +
>>>> +struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic,
>>>> +				size_t resv_sz, size_t *offset)
>>>> +{
>>>> +	size_t offs = 0;
>>>> +	struct _aarch64_ctx *found = NULL;
>>>> +
>>>> +	if (!head || resv_sz < HDR_SZ)
>>>> +		return found;
>>>> +
>>>> +	do {
>>>> +		if (head->magic == magic) {
>>>> +			found = head;
>>>> +			break;
>>>> +		}
>>>> +		offs += head->size;
>>>> +		head = GET_RESV_NEXT_HEAD(head);
>>>> +	} while (offs < resv_sz - HDR_SZ);
>>>> +
>>>> +	if (offset)
>>>> +		*offset = offs;
>>>> +
>>>> +	return found;
>>>> +}
>>>> +
>>>> +bool validate_extra_context(struct extra_context *extra, char **err)
>>>> +{
>>>> +	struct _aarch64_ctx *term;
>>>> +
>>>> +	if (!extra || !err)
>>>> +		return false;
>>>> +
>>>> +	fprintf(stderr, "Validating EXTRA...\n");
>>>> +	term = GET_RESV_NEXT_HEAD(extra);
>>>> +	if (!term || term->magic || term->size) {
>>>> +		*err = "UN-Terminated EXTRA context";
>>>> +		return false;
>>>> +	}
>>>> +	if (extra->datap & 0x0fUL)
>>>> +		*err = "Extra DATAP misaligned";
>>>> +	else if (extra->size & 0x0fUL)
>>>> +		*err = "Extra SIZE misaligned";
>>>> +	else if (extra->datap != (uint64_t)term + sizeof(*term))
>>>> +		*err = "Extra DATAP misplaced (not contiguos)";
>>>> +	if (*err)
>>>> +		return false;
>>>> +
>>>> +	return true;
>>>> +}
>>>> +
>>>> +bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err)
>>>> +{
>>>> +	bool terminated = false;
>>>> +	size_t offs = 0;
>>>> +	int flags = 0;
>>>> +	struct extra_context *extra = NULL;
>>>> +	struct _aarch64_ctx *head =
>>>> +		(struct _aarch64_ctx *)uc->uc_mcontext.__reserved;
>>>> +
>>>> +	if (!err)
>>>> +		return false;
>>>> +	/* Walk till the end terminator verifying __reserved contents */
>>>> +	while (head && !terminated && offs < resv_sz) {
>>>> +		if ((uint64_t)head & 0x0fUL) {
>>>> +			*err = "Misaligned HEAD";
>>>> +			return false;
>>>> +		}
>>>> +
>>>> +		switch (head->magic) {
>>>> +			case 0:
>>>> +				if (head->size)
>>>> +					*err = "Bad size for MAGIC0";
>>>> +				else
>>>> +					terminated = true;
>>>> +				break;
>>>> +			case FPSIMD_MAGIC:
>>>> +				if (flags & FPSIMD_CTX)
>>>> +					*err = "Multiple FPSIMD_MAGIC";
>>>> +				else if (head->size !=
>>>> +					 sizeof(struct fpsimd_context))
>>>> +					*err = "Bad size for fpsimd_context";
>>>> +				flags |= FPSIMD_CTX;
>>>> +				break;
>>>> +			case ESR_MAGIC:
>>>> +				if (head->size != sizeof(struct esr_context))
>>>> +					fprintf(stderr,
>>>> +						"Bad size for esr_context is not an error...just ignore.\n");
>>>> +				break;
>>>> +			case SVE_MAGIC:
>>>> +				if (flags & SVE_CTX)
>>>> +					*err = "Multiple SVE_MAGIC";
>>>> +				else if (head->size !=
>>>> +					 sizeof(struct sve_context))
>>>> +					*err = "Bad size for sve_context";
>>>> +				flags |= SVE_CTX;
>>>> +				break;
>>>> +			case EXTRA_MAGIC:
>>>> +				if (flags & EXTRA_CTX)
>>>> +					*err = "Multiple EXTRA_MAGIC";
>>>> +				else if (head->size !=
>>>> +					 sizeof(struct extra_context))
>>>> +					*err = "Bad size for extra_context";
>>>> +				flags |= EXTRA_CTX;
>>>> +				extra = (struct extra_context *)head;
>>>> +				break;
>>>> +			case KSFT_BAD_MAGIC:
>>>> +				/*
>>>> +				 * This is a BAD magic header defined
>>>> +				 * artificially by a testcase and surely
>>>> +				 * unknown to the Kernel parse_user_sigframe().
>>>> +				 * It MUST cause a Kernel induced SEGV
>>>> +				 */
>>>> +				*err = "BAD MAGIC !";
>>>> +				break;
>>>> +			default:
>>>> +				/*
>>>> +				 * A still unknown Magic: potentially freshly added
>>>> +				 * to the Kernel code and still unknown to the
>>>> +				 * tests.
>>>> +				 */
>>>> +				fprintf(stdout,
>>>> +					"SKIP Unknown MAGIC: 0x%X - Is KSFT arm64/signal up to date ?\n",
>>>> +					head->magic);
>>>> +				break;
>>>> +		}
>>>> +
>>>> +		if (*err)
>>>> +			return false;
>>>> +
>>>> +		offs += head->size;
>>>> +		if (resv_sz - offs < sizeof(*head)) {
>>>> +			*err = "HEAD Overrun";
>>>> +			return false;
>>>> +		}
>>>> +
>>>> +		if (flags & EXTRA_CTX)
>>>> +			if (!validate_extra_context(extra, err))
>>>> +				return false;
>>>> +
>>>> +		head = GET_RESV_NEXT_HEAD(head);
>>>> +	}
>>>> +
>>>> +	if (terminated && !(flags & FPSIMD_CTX)) {
>>>> +		*err = "Missing FPSIMD";
>>>> +		return false;
>>>> +	}
>>>> +
>>>> +	return true;
>>>> +}
>>>> diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.h b/tools/testing/selftests/arm64/signal/testcases/testcases.h
>>>> new file mode 100644
>>>> index 000000000000..624717c71b1d
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.h
>>>> @@ -0,0 +1,83 @@
>>>> +#ifndef __TESTCASES_H__
>>>> +#define __TESTCASES_H__
>>>> +
>>>> +#include <stdio.h>
>>>> +#include <stdbool.h>
>>>> +#include <stdint.h>
>>>> +#include <unistd.h>
>>>> +#include <ucontext.h>
>>>> +#include <assert.h>
>>>> +
>>>> +/* Architecture specific sigframe definitions */
>>>> +#include <asm/sigcontext.h>
>>>> +
>>>> +#define FPSIMD_CTX	(1 << 0)
>>>> +#define SVE_CTX		(1 << 1)
>>>> +#define EXTRA_CTX	(1 << 2)
>>>> +
>>>> +#define KSFT_BAD_MAGIC	0xdeadbeef
>>>> +
>>>> +#define HDR_SZ \
>>>> +	sizeof(struct _aarch64_ctx)
>>>> +
>>>> +#define GET_SF_RESV_HEAD(sf) \
>>>> +	(struct _aarch64_ctx *)(&(sf).uc.uc_mcontext.__reserved)
>>>> +
>>>> +#define GET_SF_RESV_SIZE(sf) \
>>>> +	sizeof((sf).uc.uc_mcontext.__reserved)
>>>> +
>>>> +#define GET_UCP_RESV_SIZE(ucp) \
>>>> +	sizeof((ucp)->uc_mcontext.__reserved)
>>>> +
>>>> +#define ASSERT_BAD_CONTEXT(uc) do {					\
>>>> +	char *err = NULL;						\
>>>> +	assert(!validate_reserved((uc), GET_UCP_RESV_SIZE((uc)), &err));\
>>>> +	if (err)							\
>>>> +		fprintf(stderr,						\
>>>> +			"Using badly built context - ERR: %s\n", err);	\
>>>> +} while(0)
>>>> +
>>>> +#define ASSERT_GOOD_CONTEXT(uc) do {					 \
>>>> +	char *err = NULL;						 \
>>>> +	if (!validate_reserved((uc), GET_UCP_RESV_SIZE((uc)), &err)) {	 \
>>>> +		if (err)						 \
>>>> +			fprintf(stderr,					 \
>>>> +				"Detected BAD context - ERR: %s\n", err);\
>>>> +		assert(0);						 \
>>>> +	} else {							 \
>>>> +		fprintf(stderr, "uc context validated.\n");		 \
>>>> +	}								 \
>>>> +} while(0)
>>>> +
>>>> +/* head->size accounts both for payload and header _aarch64_ctx size ! */
>>>> +#define GET_RESV_NEXT_HEAD(h) \
>>>> +	(struct _aarch64_ctx *)((char *)(h) + (h)->size)
>>>> +
>>>> +struct fake_sigframe {
>>>> +	siginfo_t	info;
>>>> +	ucontext_t	uc;
>>>> +};
>>>> +
>>>> +
>>>> +bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err);
>>>> +
>>>> +bool validate_extra_context(struct extra_context *extra, char **err);
>>>> +
>>>> +struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic,
>>>> +				size_t resv_sz, size_t *offset);
>>>> +
>>>> +static inline struct _aarch64_ctx *get_terminator(struct _aarch64_ctx *head,
>>>> +						  size_t resv_sz,
>>>> +						  size_t *offset)
>>>> +{
>>>> +	return get_header(head, 0, resv_sz, offset);
>>>> +}
>>>> +
>>>> +static inline void write_terminator_record(struct _aarch64_ctx *tail)
>>>> +{
>>>> +	if (tail) {
>>>> +		tail->magic = 0;
>>>> +		tail->size = 0;
>>>> +	}
>>>> +}
>>>> +#endif
>>>>
>>
>>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH 0/3] CP115 pinctrl support
From: Gregory CLEMENT @ 2019-08-27 14:24 UTC (permalink / raw)
  To: Linus Walleij, Miquel Raynal
  Cc: Mark Rutland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Yan Markman, Antoine Tenart, Grzegorz Jaszczyk, Maxime Chevallier,
	Nadav Haklai, open list:GPIO SUBSYSTEM, Rob Herring,
	Thomas Petazzoni, Stefan Chulski, Marcin Wojtas, Linux ARM
In-Reply-To: <CACRpkdZ+zSCSc9Q40=_+K0kfZ4evuOTAShVYWYvuSeOfgkxZng@mail.gmail.com>

Hi Linus,

> On Sat, Aug 24, 2019 at 1:33 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>> Linus Walleij <linus.walleij@linaro.org> wrote on Thu, 15 Aug 2019
>
>> > OK then maybe I am a bit impatient.
>>
>> Actually Gregory is on vacation until September, so if we still are in
>> time for this merge window I suppose you can take it.
>
> OK I applied the patches.
>
> If someone is upset we can always revert them in the -rc phase.

I had a look on the series and it looks good for me.

Gregory

>
> Yours,
> Linus Walleij

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH 1/5] dt-bindings: sound: sun4i-spdif: Fix dma-names warning
From: Maxime Ripard @ 2019-08-27 14:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Mark Rutland, Rob Herring,
	Frank Rowand
  Cc: linux-arm-kernel, devicetree, alsa-devel, Chen-Yu Tsai,
	Maxime Ripard

From: Maxime Ripard <maxime.ripard@bootlin.com>

Even though the H6 compatible has been properly added, the exeption for the
number of DMA channels hasn't been updated, leading in a validation
warning.

Fix this.

Fixes: b20453031472 ("dt-bindings: sound: sun4i-spdif: Add Allwinner H6 compatible")
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 .../devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml
index e0284d8c3b63..38d4cede0860 100644
--- a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml
@@ -70,7 +70,9 @@ allOf:
       properties:
         compatible:
           contains:
-            const: allwinner,sun8i-h3-spdif
+            enum:
+              - allwinner,sun8i-h3-spdif
+              - allwinner,sun50i-h6-spdif
 
     then:
       properties:
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 2/5] dt-bindings: sound: Convert Allwinner A10 codec to a schema
From: Maxime Ripard @ 2019-08-27 14:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Mark Rutland, Rob Herring,
	Frank Rowand
  Cc: linux-arm-kernel, devicetree, alsa-devel, Chen-Yu Tsai,
	Maxime Ripard
In-Reply-To: <20190827142547.14577-1-mripard@kernel.org>

From: Maxime Ripard <maxime.ripard@bootlin.com>

The Allwinner SoCs have an embedded audio codec that is supported in Linux,
with a matching Device Tree binding.

Now that we have the DT validation in place, let's convert the device tree
bindings for that controller over to a YAML schemas.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 .../sound/allwinner,sun4i-a10-codec.yaml      | 162 ++++++++++++++++++
 .../devicetree/bindings/sound/sun4i-codec.txt |  94 ----------
 2 files changed, 162 insertions(+), 94 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/sun4i-codec.txt

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
new file mode 100644
index 000000000000..44feefae0ef0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
@@ -0,0 +1,162 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/allwinner,sun4i-a10-codec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A10 Codec Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Maxime Ripard <maxime.ripard@bootlin.com>
+
+properties:
+  "#sound-dai-cells":
+    const: 0
+
+  compatible:
+    enum:
+      - allwinner,sun4i-a10-codec
+      - allwinner,sun6i-a31-codec
+      - allwinner,sun7i-a20-codec
+      - allwinner,sun8i-a23-codec
+      - allwinner,sun8i-h3-codec
+      - allwinner,sun8i-v3s-codec
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bus Clock
+      - description: Module Clock
+
+  clock-names:
+    items:
+      - const: apb
+      - const: codec
+
+  dmas:
+    items:
+      - description: RX DMA Channel
+      - description: TX DMA Channel
+
+  dma-names:
+    items:
+      - const: rx
+      - const: tx
+
+  resets:
+    maxItems: 1
+
+  allwinner,audio-routing:
+    $ref: /schemas/types.yaml#definitions/non-unique-string-array
+    description: |-
+      A list of the connections between audio components.  Each entry
+      is a pair of strings, the first being the connection\'s sink, the
+      second being the connection\'s source. Valid names include
+
+        Audio pins on the SoC
+          HP
+          HPCOM
+          LINEIN    (not on sun8i-v3s)
+          LINEOUT   (not on sun8i-a23 or sun8i-v3s)
+          MIC1
+          MIC2      (not on sun8i-v3s)
+          MIC3      (only on sun6i-a31)
+
+        Microphone biases from the SoC
+          HBIAS
+          MBIAS     (not on sun8i-v3s)
+
+        Board connectors
+          Headphone
+          Headset Mic
+          Line In
+          Line Out
+          Mic
+          Speaker
+
+  allwinner,codec-analog-controls:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the codec analog controls in the PRCM
+
+  allwinner,pa-gpios:
+    description: GPIO to enable the external amplifier
+
+required:
+  - "#sound-dai-cells"
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - dmas
+  - dma-names
+
+if:
+  properties:
+    compatible:
+      enum:
+        - allwinner,sun6i-a31-codec
+        - allwinner,sun8i-a23-codec
+        - allwinner,sun8i-h3-codec
+        - allwinner,sun8i-v3s-codec
+
+then:
+  if:
+    properties:
+      compatible:
+        const: allwinner,sun6i-a31-codec
+
+  then:
+    required:
+      - resets
+      - allwinner,audio-routing
+
+  else:
+    required:
+      - resets
+      - allwinner,audio-routing
+      - allwinner,codec-analog-controls
+
+additionalProperties: false
+
+examples:
+  - |
+    codec@1c22c00 {
+        #sound-dai-cells = <0>;
+        compatible = "allwinner,sun7i-a20-codec";
+        reg = <0x01c22c00 0x40>;
+        interrupts = <0 30 4>;
+        clocks = <&apb0_gates 0>, <&codec_clk>;
+        clock-names = "apb", "codec";
+        dmas = <&dma 0 19>, <&dma 0 19>;
+        dma-names = "rx", "tx";
+    };
+
+  - |
+    codec@1c22c00 {
+        #sound-dai-cells = <0>;
+        compatible = "allwinner,sun6i-a31-codec";
+        reg = <0x01c22c00 0x98>;
+        interrupts = <0 29 4>;
+        clocks = <&ccu 61>, <&ccu 135>;
+        clock-names = "apb", "codec";
+        resets = <&ccu 42>;
+        dmas = <&dma 15>, <&dma 15>;
+        dma-names = "rx", "tx";
+        allwinner,audio-routing =
+            "Headphone", "HP",
+            "Speaker", "LINEOUT",
+            "LINEIN", "Line In",
+            "MIC1", "MBIAS",
+            "MIC1", "Mic",
+            "MIC2", "HBIAS",
+            "MIC2", "Headset Mic";
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
deleted file mode 100644
index 66579bbd3294..000000000000
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-* Allwinner A10 Codec
-
-Required properties:
-- compatible: must be one of the following compatibles:
-		- "allwinner,sun4i-a10-codec"
-		- "allwinner,sun6i-a31-codec"
-		- "allwinner,sun7i-a20-codec"
-		- "allwinner,sun8i-a23-codec"
-		- "allwinner,sun8i-h3-codec"
-		- "allwinner,sun8i-v3s-codec"
-- reg: must contain the registers location and length
-- interrupts: must contain the codec interrupt
-- dmas: DMA channels for tx and rx dma. See the DMA client binding,
-	Documentation/devicetree/bindings/dma/dma.txt
-- dma-names: should include "tx" and "rx".
-- clocks: a list of phandle + clock-specifer pairs, one for each entry
-  in clock-names.
-- clock-names: should contain the following:
-   - "apb": the parent APB clock for this controller
-   - "codec": the parent module clock
-
-Optional properties:
-- allwinner,pa-gpios: gpio to enable external amplifier
-
-Required properties for the following compatibles:
-		- "allwinner,sun6i-a31-codec"
-		- "allwinner,sun8i-a23-codec"
-		- "allwinner,sun8i-h3-codec"
-		- "allwinner,sun8i-v3s-codec"
-- resets: phandle to the reset control for this device
-- allwinner,audio-routing: A list of the connections between audio components.
-			   Each entry is a pair of strings, the first being the
-			   connection's sink, the second being the connection's
-			   source. Valid names include:
-
-			   Audio pins on the SoC:
-			   "HP"
-			   "HPCOM"
-			   "LINEIN"	(not on sun8i-v3s)
-			   "LINEOUT"	(not on sun8i-a23 or sun8i-v3s)
-			   "MIC1"
-			   "MIC2"	(not on sun8i-v3s)
-			   "MIC3"	(sun6i-a31 only)
-
-			   Microphone biases from the SoC:
-			   "HBIAS"
-			   "MBIAS"	(not on sun8i-v3s)
-
-			   Board connectors:
-			   "Headphone"
-			   "Headset Mic"
-			   "Line In"
-			   "Line Out"
-			   "Mic"
-			   "Speaker"
-
-Required properties for the following compatibles:
-		- "allwinner,sun8i-a23-codec"
-		- "allwinner,sun8i-h3-codec"
-		- "allwinner,sun8i-v3s-codec"
-- allwinner,codec-analog-controls: A phandle to the codec analog controls
-				   block in the PRCM.
-
-Example:
-codec: codec@1c22c00 {
-	#sound-dai-cells = <0>;
-	compatible = "allwinner,sun7i-a20-codec";
-	reg = <0x01c22c00 0x40>;
-	interrupts = <0 30 4>;
-	clocks = <&apb0_gates 0>, <&codec_clk>;
-	clock-names = "apb", "codec";
-	dmas = <&dma 0 19>, <&dma 0 19>;
-	dma-names = "rx", "tx";
-};
-
-codec: codec@1c22c00 {
-	#sound-dai-cells = <0>;
-	compatible = "allwinner,sun6i-a31-codec";
-	reg = <0x01c22c00 0x98>;
-	interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
-	clocks = <&ccu CLK_APB1_CODEC>, <&ccu CLK_CODEC>;
-	clock-names = "apb", "codec";
-	resets = <&ccu RST_APB1_CODEC>;
-	dmas = <&dma 15>, <&dma 15>;
-	dma-names = "rx", "tx";
-	allwinner,audio-routing =
-		"Headphone", "HP",
-		"Speaker", "LINEOUT",
-		"LINEIN", "Line In",
-		"MIC1",	"MBIAS",
-		"MIC1", "Mic",
-		"MIC2", "HBIAS",
-		"MIC2", "Headset Mic";
-};
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 3/5] dt-bindings: sound: Convert Allwinner A33 codec to a schema
From: Maxime Ripard @ 2019-08-27 14:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Mark Rutland, Rob Herring,
	Frank Rowand
  Cc: linux-arm-kernel, devicetree, alsa-devel, Chen-Yu Tsai,
	Maxime Ripard
In-Reply-To: <20190827142547.14577-1-mripard@kernel.org>

From: Maxime Ripard <maxime.ripard@bootlin.com>

The Allwinner A33 SoC have an embedded audio codec that is supported in Linux,
with a matching Device Tree binding.

Now that we have the DT validation in place, let's convert the device tree
bindings for that controller over to a YAML schemas.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 .../sound/allwinner,sun8i-a33-codec.yaml      | 57 +++++++++++++++++
 .../bindings/sound/sun8i-a33-codec.txt        | 63 -------------------
 2 files changed, 57 insertions(+), 63 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
new file mode 100644
index 000000000000..5e7cc05bbff1
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/allwinner,sun8i-a33-codec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A33 Codec Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Maxime Ripard <maxime.ripard@bootlin.com>
+
+properties:
+  "#sound-dai-cells":
+    const: 0
+
+  compatible:
+    const: allwinner,sun8i-a33-codec
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bus Clock
+      - description: Module Clock
+
+  clock-names:
+    items:
+      - const: bus
+      - const: mod
+
+required:
+  - "#sound-dai-cells"
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    audio-codec@1c22e00 {
+      #sound-dai-cells = <0>;
+      compatible = "allwinner,sun8i-a33-codec";
+      reg = <0x01c22e00 0x400>;
+      interrupts = <0 29 4>;
+      clocks = <&ccu 47>, <&ccu 92>;
+      clock-names = "bus", "mod";
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt b/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt
deleted file mode 100644
index 7ecf6bd60d27..000000000000
--- a/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-Allwinner SUN8I audio codec
-------------------------------------
-
-On Sun8i-A33 SoCs, the audio is separated in different parts:
-	  - A DAI driver. It uses the "sun4i-i2s" driver which is
-	  documented here:
-	  Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml
-	  - An analog part of the codec which is handled as PRCM registers.
-	  See Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
-	  - An digital part of the codec which is documented in this current
-	  binding documentation.
-	  - And finally, an audio card which links all the above components.
-	  The simple-audio card will be used.
-	  See Documentation/devicetree/bindings/sound/simple-card.txt
-
-This bindings documentation exposes Sun8i codec (digital part).
-
-Required properties:
-- compatible: must be "allwinner,sun8i-a33-codec"
-- reg: must contain the registers location and length
-- interrupts: must contain the codec interrupt
-- clocks: a list of phandle + clock-specifer pairs, one for each entry
-  in clock-names.
-- clock-names: should contain followings:
-   - "bus": the parent APB clock for this controller
-   - "mod": the parent module clock
-
-Here is an example to add a sound card and the codec binding on sun8i SoCs that
-are similar to A33 using simple-card:
-
-	sound {
-		compatible = "simple-audio-card";
-		simple-audio-card,name = "sun8i-a33-audio";
-		simple-audio-card,format = "i2s";
-		simple-audio-card,frame-master = <&link_codec>;
-		simple-audio-card,bitclock-master = <&link_codec>;
-		simple-audio-card,mclk-fs = <512>;
-		simple-audio-card,aux-devs = <&codec_analog>;
-		simple-audio-card,routing =
-				"Left DAC", "Digital Left DAC",
-				"Right DAC", "Digital Right DAC";
-
-		simple-audio-card,cpu {
-			sound-dai = <&dai>;
-		};
-
-		link_codec: simple-audio-card,codec {
-			sound-dai = <&codec>;
-		};
-
-	soc@1c00000 {
-		[...]
-
-		audio-codec@1c22e00 {
-			#sound-dai-cells = <0>;
-			compatible = "allwinner,sun8i-a33-codec";
-			reg = <0x01c22e00 0x400>;
-			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
-			clock-names = "bus", "mod";
-		};
-	};
-
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 4/5] dt-bindings: sound: Convert Allwinner A23 analog codec to a schema
From: Maxime Ripard @ 2019-08-27 14:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Mark Rutland, Rob Herring,
	Frank Rowand
  Cc: linux-arm-kernel, devicetree, alsa-devel, Chen-Yu Tsai,
	Maxime Ripard
In-Reply-To: <20190827142547.14577-1-mripard@kernel.org>

From: Maxime Ripard <maxime.ripard@bootlin.com>

The Allwinner A23 SoC and later have an embedded audio codec that uses a
separate controller to drive its analog part, which is supported in Linux,
with a matching Device Tree binding.

Now that we have the DT validation in place, let's convert the device tree
bindings for that controller over to a YAML schemas.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 .../allwinner,sun8i-a23-codec-analog.yaml     | 38 +++++++++++++++++++
 .../bindings/sound/sun8i-codec-analog.txt     | 17 ---------
 2 files changed, 38 insertions(+), 17 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun8i-a23-codec-analog.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a23-codec-analog.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a23-codec-analog.yaml
new file mode 100644
index 000000000000..832779389cbd
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a23-codec-analog.yaml
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/allwinner,sun8i-a23-codec-analog.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A23 Analog Codec Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Maxime Ripard <maxime.ripard@bootlin.com>
+
+properties:
+  compatible:
+    oneOf:
+      # FIXME: This is documented in the PRCM binding, but needs to be
+      # migrated here at some point
+      # - const: allwinner,sun8i-a23-codec-analog
+      - const: allwinner,sun8i-h3-codec-analog
+      - const: allwinner,sun8i-v3s-codec-analog
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    codec_analog: codec-analog@1f015c0 {
+      compatible = "allwinner,sun8i-h3-codec-analog";
+      reg = <0x01f015c0 0x4>;
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
deleted file mode 100644
index 07356758bd91..000000000000
--- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-* Allwinner Codec Analog Controls
-
-Required properties:
-- compatible: must be one of the following compatibles:
-		- "allwinner,sun8i-a23-codec-analog"
-		- "allwinner,sun8i-h3-codec-analog"
-		- "allwinner,sun8i-v3s-codec-analog"
-
-Required properties if not a sub-node of the PRCM node:
-- reg: must contain the registers location and length
-
-Example:
-prcm: prcm@1f01400 {
-	codec_analog: codec-analog {
-		compatible = "allwinner,sun8i-a23-codec-analog";
-	};
-};
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 5/5] dt-bindings: sound: Convert Allwinner A64 analog codec to a schema
From: Maxime Ripard @ 2019-08-27 14:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Mark Rutland, Rob Herring,
	Frank Rowand
  Cc: linux-arm-kernel, devicetree, alsa-devel, Chen-Yu Tsai,
	Maxime Ripard
In-Reply-To: <20190827142547.14577-1-mripard@kernel.org>

From: Maxime Ripard <maxime.ripard@bootlin.com>

The Allwinner A64 SoC has an embedded audio codec that uses a separate
controller to drive its analog part, which is supported in Linux, with a
matching Device Tree binding.

Now that we have the DT validation in place, let's convert the device tree
bindings for that controller over to a YAML schemas.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 .../allwinner,sun50i-a64-codec-analog.yaml    | 39 +++++++++++++++++++
 .../bindings/sound/sun50i-codec-analog.txt    | 14 -------
 2 files changed, 39 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml
new file mode 100644
index 000000000000..f290eb72a878
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/allwinner,sun50i-a64-codec-analog.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A64 Analog Codec Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Maxime Ripard <maxime.ripard@bootlin.com>
+
+properties:
+  compatible:
+    const: allwinner,sun50i-a64-codec-analog
+
+  reg:
+    maxItems: 1
+
+  cpvdd-supply:
+    description:
+      Regulator for the headphone amplifier
+
+required:
+  - compatible
+  - reg
+  - cpvdd-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    codec_analog: codec-analog@1f015c0 {
+      compatible = "allwinner,sun50i-a64-codec-analog";
+      reg = <0x01f015c0 0x4>;
+      cpvdd-supply = <&reg_eldo1>;
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt
deleted file mode 100644
index 056a098495cc..000000000000
--- a/Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-* Allwinner A64 Codec Analog Controls
-
-Required properties:
-- compatible: must be one of the following compatibles:
-		- "allwinner,sun50i-a64-codec-analog"
-- reg: must contain the registers location and length
-- cpvdd-supply: Regulator supply for the headphone amplifier
-
-Example:
-	codec_analog: codec-analog@1f015c0 {
-		compatible = "allwinner,sun50i-a64-codec-analog";
-		reg = <0x01f015c0 0x4>;
-		cpvdd-supply = <&reg_eldo1>;
-	};
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v1 1/1] ARM: dts: rockchip: set crypto default disabled on rk3288
From: Heiko Stuebner @ 2019-08-27 14:28 UTC (permalink / raw)
  To: Elon Zhang
  Cc: mark.rutland, devicetree, linux-kernel, linux-rockchip, robh+dt,
	linux-arm-kernel
In-Reply-To: <20190827071439.14767-1-zhangzj@rock-chips.com>

Hi,

Am Dienstag, 27. August 2019, 09:14:39 CEST schrieb Elon Zhang:
> Not every board needs to enable crypto node, so the node should
> be set default disabled in rk3288.dtsi and enabled in specific
> board dts file.

Can you give a bit more rationale here? There would need to be a very
specific reason because of the following:

The crypto module is not wired to some board-specific components,
so its usability does not depend on the specific board at all.
Instead every board can just use it out of the box and the devicetree
is supposed to describe the hardware and is _not_ meant as a space
for user configuration.

So in fact the status property should probably go away completely from
the crypto node, as it's usable out of the box in all cases.


Heiko



> Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
> ---
>  arch/arm/boot/dts/rk3288.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
> index cc893e154fe5..d509aa24177c 100644
> --- a/arch/arm/boot/dts/rk3288.dtsi
> +++ b/arch/arm/boot/dts/rk3288.dtsi
> @@ -984,7 +984,7 @@
>  		clock-names = "aclk", "hclk", "sclk", "apb_pclk";
>  		resets = <&cru SRST_CRYPTO>;
>  		reset-names = "crypto-rst";
> -		status = "okay";
> +		status = "disabled";
>  	};
>  
>  	iep_mmu: iommu@ff900800 {
> 





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH 3/5] dt-bindings: sound: Convert Allwinner A33 codec to a schema
From: Chen-Yu Tsai @ 2019-08-27 14:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Mark Rutland, devicetree, Linux-ALSA, Liam Girdwood, Rob Herring,
	Mark Brown, Frank Rowand, linux-arm-kernel
In-Reply-To: <20190827142547.14577-3-mripard@kernel.org>

On Tue, Aug 27, 2019 at 10:25 PM Maxime Ripard <mripard@kernel.org> wrote:
>
> From: Maxime Ripard <maxime.ripard@bootlin.com>
>
> The Allwinner A33 SoC have an embedded audio codec that is supported in Linux,
> with a matching Device Tree binding.
>
> Now that we have the DT validation in place, let's convert the device tree
> bindings for that controller over to a YAML schemas.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> ---
>  .../sound/allwinner,sun8i-a33-codec.yaml      | 57 +++++++++++++++++
>  .../bindings/sound/sun8i-a33-codec.txt        | 63 -------------------
>  2 files changed, 57 insertions(+), 63 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
>  delete mode 100644 Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt
>
> diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> new file mode 100644
> index 000000000000..5e7cc05bbff1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/allwinner,sun8i-a33-codec.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner A33 Codec Device Tree Bindings
> +
> +maintainers:
> +  - Chen-Yu Tsai <wens@csie.org>
> +  - Maxime Ripard <maxime.ripard@bootlin.com>
> +
> +properties:
> +  "#sound-dai-cells":
> +    const: 0
> +
> +  compatible:
> +    const: allwinner,sun8i-a33-codec
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    items:
> +      - description: Bus Clock
> +      - description: Module Clock
> +
> +  clock-names:
> +    items:
> +      - const: bus
> +      - const: mod
> +
> +required:
> +  - "#sound-dai-cells"
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - clock-names
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    audio-codec@1c22e00 {
> +      #sound-dai-cells = <0>;
> +      compatible = "allwinner,sun8i-a33-codec";
> +      reg = <0x01c22e00 0x400>;
> +      interrupts = <0 29 4>;
> +      clocks = <&ccu 47>, <&ccu 92>;
> +      clock-names = "bus", "mod";
> +    };
> +
> +...
> diff --git a/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt b/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt
> deleted file mode 100644
> index 7ecf6bd60d27..000000000000
> --- a/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -Allwinner SUN8I audio codec
> -------------------------------------
> -
> -On Sun8i-A33 SoCs, the audio is separated in different parts:
> -         - A DAI driver. It uses the "sun4i-i2s" driver which is
> -         documented here:
> -         Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml
> -         - An analog part of the codec which is handled as PRCM registers.
> -         See Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> -         - An digital part of the codec which is documented in this current
> -         binding documentation.
> -         - And finally, an audio card which links all the above components.
> -         The simple-audio card will be used.
> -         See Documentation/devicetree/bindings/sound/simple-card.txt
> -
> -This bindings documentation exposes Sun8i codec (digital part).
> -
> -Required properties:
> -- compatible: must be "allwinner,sun8i-a33-codec"
> -- reg: must contain the registers location and length
> -- interrupts: must contain the codec interrupt
> -- clocks: a list of phandle + clock-specifer pairs, one for each entry
> -  in clock-names.
> -- clock-names: should contain followings:
> -   - "bus": the parent APB clock for this controller
> -   - "mod": the parent module clock
> -
> -Here is an example to add a sound card and the codec binding on sun8i SoCs that
> -are similar to A33 using simple-card:
> -
> -       sound {
> -               compatible = "simple-audio-card";
> -               simple-audio-card,name = "sun8i-a33-audio";
> -               simple-audio-card,format = "i2s";
> -               simple-audio-card,frame-master = <&link_codec>;
> -               simple-audio-card,bitclock-master = <&link_codec>;
> -               simple-audio-card,mclk-fs = <512>;
> -               simple-audio-card,aux-devs = <&codec_analog>;
> -               simple-audio-card,routing =
> -                               "Left DAC", "Digital Left DAC",
> -                               "Right DAC", "Digital Right DAC";

At some point we should start listing the endpoints available for routing?

ChenYu

> -
> -               simple-audio-card,cpu {
> -                       sound-dai = <&dai>;
> -               };
> -
> -               link_codec: simple-audio-card,codec {
> -                       sound-dai = <&codec>;
> -               };
> -
> -       soc@1c00000 {
> -               [...]
> -
> -               audio-codec@1c22e00 {
> -                       #sound-dai-cells = <0>;
> -                       compatible = "allwinner,sun8i-a33-codec";
> -                       reg = <0x01c22e00 0x400>;
> -                       interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
> -                       clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
> -                       clock-names = "bus", "mod";
> -               };
> -       };
> -
> --
> 2.21.0
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [RFC PATCH 5/7] arm64: smp: use generic SMP stop common code
From: Cristian Marussi @ 2019-08-27 14:34 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-arch, mark.rutland, peterz, catalin.marinas, linux-kernel,
	Christoph Hellwig, takahiro.akashi, james.morse,
	hidehiro.kawai.ez, will, dave.martin, linux-arm-kernel
In-Reply-To: <alpine.DEB.2.21.1908270025340.1939@nanos.tec.linutronix.de>

Hi

On 26/08/2019 23:26, Thomas Gleixner wrote:
> On Mon, 26 Aug 2019, Cristian Marussi wrote:
>> On 8/26/19 4:32 PM, Christoph Hellwig wrote:
>>>> +config ARCH_USE_COMMON_SMP_STOP
>>>> +	def_bool y if SMP
>>>
>>> The option belongs into common code and the arch code shoud only
>>> select it.
>>>
>>
>> In fact that was my first approach, but then I noticed that in kernel/ topdir
>> there was no generic Kconfig but only subsystem specific ones:
>>
>> Kconfig.freezer  Kconfig.hz       Kconfig.locks    Kconfig.preempt
> 
> arch/Kconfig
> 

Ok I'll move it there in v2.

Thanks for the review.

Cristian

> Thanks,
> 
> 	tglx
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: Continuous SD IO causes hung task messages
From: Russell King - ARM Linux admin @ 2019-08-27 14:36 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc@vger.kernel.org, Linux Kernel Mailing List, Linux ARM
In-Reply-To: <CAPDyKFp7e2OD_idam3-2sEd0wJU5OcP=H04G1OvHmAUo2Y-bYw@mail.gmail.com>

On Tue, Aug 27, 2019 at 03:55:23PM +0200, Ulf Hansson wrote:
> On Tue, 27 Aug 2019 at 15:43, Russell King - ARM Linux admin
> <linux@armlinux.org.uk> wrote:
> >
> > Hi,
> >
> > While dd'ing the contents of a SD card, I get hung task timeout
> > messages as per below.  However, the dd is making progress.  Any
> > ideas?
> >
> > Presumably, mmc_rescan doesn't get a look-in while IO is progressing
> > for the card?
> 
> Is it a regression?
> 
> There not much of recent mmc core and mmc block changes, that I can
> think of at this point.

No idea - I just repaired the SD socket after the D2 line became
disconnected, and decided to run that command as a test.

> > ARM64 host, Macchiatobin, uSD card.
> 
> What mmc host driver is it? mmci?

sdhci-xenon.

I'm just trying with one CPU online, then I'll try with two.  My
suspicion is that there's a problem in the ARM64 arch code where
unlocking a mutex doesn't get noticed on other CPUs.

Hmm, I thought I'd try bringing another CPU online, but it seems
like the ARM64 CPU hotplug code is broken:

[ 3552.029689] CPU1: shutdown
[ 3552.031099] psci: CPU1 killed.
[ 3949.835212] CPU1: failed to come online
[ 3949.837753] CPU1: failed in unknown state : 0x0

which means I can only take CPUs down, I can't bring them back
online without rebooting.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v7 6/6] arm64: dts: marvell: Add cpu clock node on Armada 7K/8K
From: Gregory CLEMENT @ 2019-08-27 14:40 UTC (permalink / raw)
  To: Stephen Boyd, Mike Turquette, linux-clk, linux-kernel
  Cc: devicetree, Jason Cooper, Andrew Lunn, Antoine Tenart,
	Maxime Chevallier, Rob Herring, Thomas Petazzoni,
	Miquèl Raynal, linux-arm-kernel, Sebastian Hesselbarth
In-Reply-To: <20190710134346.30239-7-gregory.clement@bootlin.com>



> Add cpu clock node on AP
>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>

Applied on mvebu/dt64

Gregory
> ---
>  arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi | 4 ++++
>  arch/arm64/boot/dts/marvell/armada-ap806.dtsi      | 7 +++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi
> index 2baafe12ebd4..472211159979 100644
> --- a/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi
> +++ b/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi
> @@ -20,24 +20,28 @@
>  			compatible = "arm,cortex-a72";
>  			reg = <0x000>;
>  			enable-method = "psci";
> +			clocks = <&cpu_clk 0>;
>  		};
>  		cpu1: cpu@1 {
>  			device_type = "cpu";
>  			compatible = "arm,cortex-a72";
>  			reg = <0x001>;
>  			enable-method = "psci";
> +			clocks = <&cpu_clk 0>;
>  		};
>  		cpu2: cpu@100 {
>  			device_type = "cpu";
>  			compatible = "arm,cortex-a72";
>  			reg = <0x100>;
>  			enable-method = "psci";
> +			clocks = <&cpu_clk 1>;
>  		};
>  		cpu3: cpu@101 {
>  			device_type = "cpu";
>  			compatible = "arm,cortex-a72";
>  			reg = <0x101>;
>  			enable-method = "psci";
> +			clocks = <&cpu_clk 1>;
>  		};
>  	};
>  };
> diff --git a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi
> index 91dad7e4ee59..fca6536494b3 100644
> --- a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi
> +++ b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi
> @@ -280,6 +280,13 @@
>  				#address-cells = <1>;
>  				#size-cells = <1>;
>  
> +				cpu_clk: clock-cpu@278 {
> +					compatible = "marvell,ap806-cpu-clock";
> +					clocks = <&ap_clk 0>, <&ap_clk 1>;
> +					#clock-cells = <1>;
> +					reg = <0x278 0xa30>;
> +				};
> +
>  				ap_thermal: thermal-sensor@80 {
>  					compatible = "marvell,armada-ap806-thermal";
>  					reg = <0x80 0x10>;
> -- 
> 2.20.1
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 08/10] PCI: layerscape: Add EP mode support for ls1088a and ls2088a
From: Andrew Murray @ 2019-08-27 14:48 UTC (permalink / raw)
  To: Xiaowei Bao
  Cc: christophe leroy, mark.rutland@arm.com, bhelgaas@google.com,
	lorenzo.pieralisi@arm.co, arnd@arndb.de,
	devicetree@vger.kernel.org, gregkh@linuxfoundation.org, Leo Li,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	kishon@ti.com, M.h. Lian, robh+dt@kernel.org,
	linux-arm-kernel@lists.infradead.org, Roy Zang,
	jingoohan1@gmail.com, shawnguo@kernel.org,
	gustavo.pimentel@synopsys.com, linuxppc-dev@lists.ozlabs.org,
	Mingkai Hu
In-Reply-To: <AM5PR04MB3299EBADE7BC04C3465B7DB7F5A60@AM5PR04MB3299.eurprd04.prod.outlook.com>

On Sun, Aug 25, 2019 at 03:07:32AM +0000, Xiaowei Bao wrote:
> 
> 
> > -----Original Message-----
> > From: christophe leroy <christophe.leroy@c-s.fr>
> > Sent: 2019年8月24日 14:45
> > To: Xiaowei Bao <xiaowei.bao@nxp.com>; Andrew Murray
> > <andrew.murray@arm.com>
> > Cc: mark.rutland@arm.com; Roy Zang <roy.zang@nxp.com>;
> > lorenzo.pieralisi@arm.co; arnd@arndb.de; devicetree@vger.kernel.org;
> > gregkh@linuxfoundation.org; linuxppc-dev@lists.ozlabs.org;
> > linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; kishon@ti.com; M.h.
> > Lian <minghuan.lian@nxp.com>; robh+dt@kernel.org;
> > gustavo.pimentel@synopsys.com; jingoohan1@gmail.com;
> > bhelgaas@google.com; Leo Li <leoyang.li@nxp.com>; shawnguo@kernel.org;
> > Mingkai Hu <mingkai.hu@nxp.com>; linux-arm-kernel@lists.infradead.org
> > Subject: Re: [PATCH v2 08/10] PCI: layerscape: Add EP mode support for
> > ls1088a and ls2088a
> > 
> > 
> > 
> > Le 24/08/2019 à 02:18, Xiaowei Bao a écrit :
> > >
> > >
> > >> -----Original Message-----
> > >> From: Andrew Murray <andrew.murray@arm.com>
> > >> Sent: 2019年8月23日 22:28
> > >> To: Xiaowei Bao <xiaowei.bao@nxp.com>
> > >> Cc: bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > >> shawnguo@kernel.org; Leo Li <leoyang.li@nxp.com>; kishon@ti.com;
> > >> lorenzo.pieralisi@arm.co; arnd@arndb.de; gregkh@linuxfoundation.org;
> > M.h.
> > >> Lian <minghuan.lian@nxp.com>; Mingkai Hu <mingkai.hu@nxp.com>; Roy
> > >> Zang <roy.zang@nxp.com>; jingoohan1@gmail.com;
> > >> gustavo.pimentel@synopsys.com; linux-pci@vger.kernel.org;
> > >> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > >> linux-arm-kernel@lists.infradead.org; linuxppc-dev@lists.ozlabs.org
> > >> Subject: Re: [PATCH v2 08/10] PCI: layerscape: Add EP mode support
> > >> for ls1088a and ls2088a
> > >>
> > >> On Thu, Aug 22, 2019 at 07:22:40PM +0800, Xiaowei Bao wrote:
> > >>> Add PCIe EP mode support for ls1088a and ls2088a, there are some
> > >>> difference between LS1 and LS2 platform, so refactor the code of the
> > >>> EP driver.
> > >>>
> > >>> Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
> > >>> ---
> > >>> v2:
> > >>>   - New mechanism for layerscape EP driver.
> > >>
> > >> Was there a v1 of this patch?
> > >
> > > Yes, but I don't know how to comments, ^_^
> > 
> > As far as I can see, in the previous version of the series
> > (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> > work.ozlabs.org%2Fproject%2Flinuxppc-dev%2Flist%2F%3Fseries%3D125315
> > %26state%3D*&amp;data=02%7C01%7Cxiaowei.bao%40nxp.com%7C1befe9
> > a67c8046f9535e08d7285eaab6%7C686ea1d3bc2b4c6fa92cd99c5c301635%
> > 7C0%7C0%7C637022259387139020&amp;sdata=p4wbycd04Z7qRUfAoZtwc
> > UP7pR%2FuA3%2FjVcWMz6YyQVQ%3D&amp;reserved=0),
> > the 8/10 was something completely different, and I can't find any other patch
> > in the series that could have been the v1 of this patch.
> 
> Thanks, I will correct it to v1 in next version patch.

I think you numbered it correctly (so please leave it as v2, referring to
the patch series revision) - I got confused trying to find a previous
version of this patch.

Perhaps in the future when new patches are introduced in a series you can
indicate that in the description patch revision history (e.g. introduced
in v2).

Thanks,

Andrew Murray 

> 
> > 
> > Christophe
> > 
> > >
> > >>
> > >>>
> > >>>   drivers/pci/controller/dwc/pci-layerscape-ep.c | 76
> > >>> ++++++++++++++++++++------
> > >>>   1 file changed, 58 insertions(+), 18 deletions(-)
> > >>>
> > >>> diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c
> > >>> b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> > >>> index 7ca5fe8..2a66f07 100644
> > >>> --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c
> > >>> +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> > >>> @@ -20,27 +20,29 @@
> > >>>
> > >>>   #define PCIE_DBI2_OFFSET		0x1000	/* DBI2 base address*/
> > >>>
> > >>> -struct ls_pcie_ep {
> > >>> -	struct dw_pcie		*pci;
> > >>> -	struct pci_epc_features	*ls_epc;
> > >>> +#define to_ls_pcie_ep(x)	dev_get_drvdata((x)->dev)
> > >>> +
> > >>> +struct ls_pcie_ep_drvdata {
> > >>> +	u32				func_offset;
> > >>> +	const struct dw_pcie_ep_ops	*ops;
> > >>> +	const struct dw_pcie_ops	*dw_pcie_ops;
> > >>>   };
> > >>>
> > >>> -#define to_ls_pcie_ep(x)	dev_get_drvdata((x)->dev)
> > >>> +struct ls_pcie_ep {
> > >>> +	struct dw_pcie			*pci;
> > >>> +	struct pci_epc_features		*ls_epc;
> > >>> +	const struct ls_pcie_ep_drvdata *drvdata; };
> > >>>
> > >>>   static int ls_pcie_establish_link(struct dw_pcie *pci)  {
> > >>>   	return 0;
> > >>>   }
> > >>>
> > >>> -static const struct dw_pcie_ops ls_pcie_ep_ops = {
> > >>> +static const struct dw_pcie_ops dw_ls_pcie_ep_ops = {
> > >>>   	.start_link = ls_pcie_establish_link,  };
> > >>>
> > >>> -static const struct of_device_id ls_pcie_ep_of_match[] = {
> > >>> -	{ .compatible = "fsl,ls-pcie-ep",},
> > >>> -	{ },
> > >>> -};
> > >>> -
> > >>>   static const struct pci_epc_features*
> > >>> ls_pcie_ep_get_features(struct dw_pcie_ep *ep)  { @@ -82,10 +84,44
> > >>> @@ static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
> > >>>   	}
> > >>>   }
> > >>>
> > >>> -static const struct dw_pcie_ep_ops pcie_ep_ops = {
> > >>> +static unsigned int ls_pcie_ep_func_conf_select(struct dw_pcie_ep *ep,
> > >>> +						u8 func_no)
> > >>> +{
> > >>> +	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> > >>> +	struct ls_pcie_ep *pcie = to_ls_pcie_ep(pci);
> > >>> +	u8 header_type;
> > >>> +
> > >>> +	header_type = ioread8(pci->dbi_base + PCI_HEADER_TYPE);
> > >>> +
> > >>> +	if (header_type & (1 << 7))
> > >>> +		return pcie->drvdata->func_offset * func_no;
> > >>> +	else
> > >>> +		return 0;
> > >>
> > >> It looks like there isn't a PCI define for multi function, the
> > >> nearest I could find was PCI_HEADER_TYPE_MULTIDEVICE in
> > >> hotplug/ibmphp.h. A comment above the test might be helpful to explain
> > the test.
> > >
> > > Yes, I have not find the PCI_HEADER_TYPE_MULTIDEVICE define. OK, I
> > > will add The comments in next version patch.
> > >
> > >>
> > >> As the ls_pcie_ep_drvdata structures are static, the unset
> > >> .func_offset will be initialised to 0, so you could just drop the test above.
> > >
> > > OK, thanks
> > >
> > >>
> > >> However something to the effect of the following may help spot
> > >> misconfiguration:
> > >>
> > >> WARN_ON(func_no && !pcie->drvdata->func_offset); return
> > >> pcie->drvdata->func_offset * func_no;
> > >
> > > Thanks a lot, this looks better.
> > >
> > >>
> > >> The WARN is probably quite useful as if you are attempting to use
> > >> non-zero functions and func_offset isn't set - then things may appear
> > >> to work normally but actually will break horribly.
> > >
> > > got it, thanks.
> > >
> > >>
> > >> Thanks,
> > >>
> > >> Andrew Murray
> > >>
> > >>> +}
> > >>> +
> > >>> +static const struct dw_pcie_ep_ops ls_pcie_ep_ops = {
> > >>>   	.ep_init = ls_pcie_ep_init,
> > >>>   	.raise_irq = ls_pcie_ep_raise_irq,
> > >>>   	.get_features = ls_pcie_ep_get_features,
> > >>> +	.func_conf_select = ls_pcie_ep_func_conf_select, };
> > >>> +
> > >>> +static const struct ls_pcie_ep_drvdata ls1_ep_drvdata = {
> > >>> +	.ops = &ls_pcie_ep_ops,
> > >>> +	.dw_pcie_ops = &dw_ls_pcie_ep_ops, };
> > >>> +
> > >>> +static const struct ls_pcie_ep_drvdata ls2_ep_drvdata = {
> > >>> +	.func_offset = 0x20000,
> > >>> +	.ops = &ls_pcie_ep_ops,
> > >>> +	.dw_pcie_ops = &dw_ls_pcie_ep_ops, };
> > >>> +
> > >>> +static const struct of_device_id ls_pcie_ep_of_match[] = {
> > >>> +	{ .compatible = "fsl,ls1046a-pcie-ep", .data = &ls1_ep_drvdata },
> > >>> +	{ .compatible = "fsl,ls1088a-pcie-ep", .data = &ls2_ep_drvdata },
> > >>> +	{ .compatible = "fsl,ls2088a-pcie-ep", .data = &ls2_ep_drvdata },
> > >>> +	{ },
> > >>>   };
> > >>>
> > >>>   static int __init ls_add_pcie_ep(struct ls_pcie_ep *pcie, @@ -98,7
> > >>> +134,7 @@ static int __init ls_add_pcie_ep(struct ls_pcie_ep *pcie,
> > >>>   	int ret;
> > >>>
> > >>>   	ep = &pci->ep;
> > >>> -	ep->ops = &pcie_ep_ops;
> > >>> +	ep->ops = pcie->drvdata->ops;
> > >>>
> > >>>   	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > >> "addr_space");
> > >>>   	if (!res)
> > >>> @@ -137,14 +173,11 @@ static int __init ls_pcie_ep_probe(struct
> > >> platform_device *pdev)
> > >>>   	if (!ls_epc)
> > >>>   		return -ENOMEM;
> > >>>
> > >>> -	dbi_base = platform_get_resource_byname(pdev,
> > IORESOURCE_MEM,
> > >> "regs");
> > >>> -	pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base);
> > >>> -	if (IS_ERR(pci->dbi_base))
> > >>> -		return PTR_ERR(pci->dbi_base);
> > >>> +	pcie->drvdata = of_device_get_match_data(dev);
> > >>>
> > >>> -	pci->dbi_base2 = pci->dbi_base + PCIE_DBI2_OFFSET;
> > >>>   	pci->dev = dev;
> > >>> -	pci->ops = &ls_pcie_ep_ops;
> > >>> +	pci->ops = pcie->drvdata->dw_pcie_ops;
> > >>> +
> > >>>   	pcie->pci = pci;
> > >>>
> > >>>   	ls_epc->linkup_notifier = false,
> > >>> @@ -152,6 +185,13 @@ static int __init ls_pcie_ep_probe(struct
> > >>> platform_device *pdev)
> > >>>
> > >>>   	pcie->ls_epc = ls_epc;
> > >>>
> > >>> +	dbi_base = platform_get_resource_byname(pdev,
> > IORESOURCE_MEM,
> > >> "regs");
> > >>> +	pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base);
> > >>> +	if (IS_ERR(pci->dbi_base))
> > >>> +		return PTR_ERR(pci->dbi_base);
> > >>> +
> > >>> +	pci->dbi_base2 = pci->dbi_base + PCIE_DBI2_OFFSET;
> > >>> +
> > >>>   	platform_set_drvdata(pdev, pcie);
> > >>>
> > >>>   	ret = ls_add_pcie_ep(pcie, pdev);
> > >>> --
> > >>> 2.9.5
> > >>>
> > 
> > ---
> > L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel
> > antivirus Avast.
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.
> > avast.com%2Fantivirus&amp;data=02%7C01%7Cxiaowei.bao%40nxp.com%7
> > C1befe9a67c8046f9535e08d7285eaab6%7C686ea1d3bc2b4c6fa92cd99c5c3
> > 01635%7C0%7C0%7C637022259387139020&amp;sdata=JAYds7X%2FHVxgtrg
> > e%2F%2FvnP84zdb2yReXcctQUiSLC11I%3D&amp;reserved=0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: Continuous SD IO causes hung task messages
From: Russell King - ARM Linux admin @ 2019-08-27 14:52 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc@vger.kernel.org, Linux Kernel Mailing List, Linux ARM
In-Reply-To: <20190827143634.GL13294@shell.armlinux.org.uk>

On Tue, Aug 27, 2019 at 03:36:34PM +0100, Russell King - ARM Linux admin wrote:
> On Tue, Aug 27, 2019 at 03:55:23PM +0200, Ulf Hansson wrote:
> > On Tue, 27 Aug 2019 at 15:43, Russell King - ARM Linux admin
> > <linux@armlinux.org.uk> wrote:
> > >
> > > Hi,
> > >
> > > While dd'ing the contents of a SD card, I get hung task timeout
> > > messages as per below.  However, the dd is making progress.  Any
> > > ideas?
> > >
> > > Presumably, mmc_rescan doesn't get a look-in while IO is progressing
> > > for the card?
> > 
> > Is it a regression?
> > 
> > There not much of recent mmc core and mmc block changes, that I can
> > think of at this point.
> 
> No idea - I just repaired the SD socket after the D2 line became
> disconnected, and decided to run that command as a test.
> 
> > > ARM64 host, Macchiatobin, uSD card.
> > 
> > What mmc host driver is it? mmci?
> 
> sdhci-xenon.
> 
> I'm just trying with one CPU online, then I'll try with two.  My
> suspicion is that there's a problem in the ARM64 arch code where
> unlocking a mutex doesn't get noticed on other CPUs.
> 
> Hmm, I thought I'd try bringing another CPU online, but it seems
> like the ARM64 CPU hotplug code is broken:
> 
> [ 3552.029689] CPU1: shutdown
> [ 3552.031099] psci: CPU1 killed.
> [ 3949.835212] CPU1: failed to come online
> [ 3949.837753] CPU1: failed in unknown state : 0x0
> 
> which means I can only take CPUs down, I can't bring them back
> online without rebooting.

Okay, running on a single CPU shows no problems.

Running on four CPUs (as originally) shows that the kworker thread
_never_ gets scheduled, so the warning is not false.

With three CPUs, same problem.

root@arm-d06300000000:~# ps aux | grep ' D '
root        34  0.0  0.0      0     0 ?        D    15:38   0:00 [kworker/1:1+events_freezable]
root@arm-d06300000000:~# cat /proc/34/sched
kworker/1:1 (34, #threads: 1)
-------------------------------------------------------------------
se.exec_start                                :        318689.992440
se.vruntime                                  :         37750.882357
se.sum_exec_runtime                          :             9.421240
se.nr_migrations                             :                    0
nr_switches                                  :                 1174
nr_voluntary_switches                        :                 1171
nr_involuntary_switches                      :                    3
se.load.weight                               :              1048576
se.runnable_weight                           :              1048576
se.avg.load_sum                              :                    6
se.avg.runnable_load_sum                     :                    6
se.avg.util_sum                              :                 5170
se.avg.load_avg                              :                    0
se.avg.runnable_load_avg                     :                    0
se.avg.util_avg                              :                    0
se.avg.last_update_time                      :         318689991680
se.avg.util_est.ewma                         :                   10
se.avg.util_est.enqueued                     :                    0
policy                                       :                    0
prio                                         :                  120
clock-delta                                  :                    0

The only thing that changes there is "clock-delta".  When I kill the
dd, I get:

root@arm-d06300000000:~# cat /proc/34/sched
kworker/1:1 (34, #threads: 1)
-------------------------------------------------------------------
se.exec_start                                :        574025.791680
se.vruntime                                  :         79996.657300
se.sum_exec_runtime                          :            10.916400
se.nr_migrations                             :                    0
nr_switches                                  :                 1403
nr_voluntary_switches                        :                 1400
nr_involuntary_switches                      :                    3
se.load.weight                               :              1048576
se.runnable_weight                           :              1048576
se.avg.load_sum                              :                   15
se.avg.runnable_load_sum                     :                   15
se.avg.util_sum                              :                15007
se.avg.load_avg                              :                    0
se.avg.runnable_load_avg                     :                    0
se.avg.util_avg                              :                    0
se.avg.last_update_time                      :         574025791488
se.avg.util_est.ewma                         :                   10
se.avg.util_est.enqueued                     :                    0
policy                                       :                    0
prio                                         :                  120
clock-delta                                  :                   40

so the thread makes forward progress.

Down to two CPUs:

root@arm-d06300000000:~# ps aux | grep ' D '
root        34  0.0  0.0      0     0 ?        D    15:38   0:00 [kworker/1:1+events_freezable]

Same symptoms.  dd and md5sum switch between CPU 0 and CPU1.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: FYI: imx-sdma firmware is not compatible with SLUB slab allocator
From: Leonard Crestez @ 2019-08-27 15:04 UTC (permalink / raw)
  To: Jurgen Lambrecht
  Cc: Aisheng Dong, Robin Gong, dl-linux-imx,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <1e2fe2dc-f5ea-db73-59cf-c61ec558131a@televic.com>

On 27.08.2019 16:35, Jurgen Lambrecht wrote:
> We are updating our kernel on our custom board with an iMX6UL from 3.14
> to 4.19, and when loading linux-firmware/imx/sdma/sdma-imx6q.bin v3.5
> the kernel hangs when booting, only "Starting kernel ..." is printed (by
> uBoot I think).

If you enable "earlycon" you should be able to see an useful error 
message from crashes in early boot.

Enabling earlycon is board-specific: if you have a correct 
/chosen/stdout-path reference in dts just adding "earlycon" to kernel 
cmdline should work otherwise you can specify 
earlycon=ec_imx6q,0x202000,115200 with the exact address depending on 
which uart is console on your board.

> When I remove the sdma bin (built-in the kernel via EXTRA_FIRMWARE),
> then it boots.
> 
> I found that the slab allocator (menu config -> General setup -> Choose
> SLAB allocator) is the culprit: when using imx_v6_v7_defconfig the
> kernel boots, but not with our config (based on a tiny config I think).
> And the config that makes the difference is the slab allocator: with
> SLUB or SLAB the kernel (with sdma bin) boots, but not with SLOB.
> 
> I don't know how to force selecting SLUB in Kconfig when selecting
> IMX_SDMA, but anyhow first this issue must be confirmed on other
> processors from the iMX family.

If there's an incompatibility between SLOB and sdma then it's sounds 
like a bug which should be fixed, not worked around via kconfig.

I tried to enable EXTRA_FIRMWARE on v4.19.68 and imx6ul-14x14-evk booted 
worked fine for me with these changes:
diff --git arch/arm/configs/imx_v6_v7_defconfig 
arch/arm/configs/imx_v6_v7_defconfig
index 7f524cee1357..cedd4d2e0e02 100644
--- arch/arm/configs/imx_v6_v7_defconfig
+++ arch/arm/configs/imx_v6_v7_defconfig
@@ -11,8 +11,8 @@ CONFIG_RELAY=y
  CONFIG_BLK_DEV_INITRD=y
  CONFIG_EXPERT=y
  CONFIG_PERF_EVENTS=y
-# CONFIG_SLUB_DEBUG is not set
  # CONFIG_COMPAT_BRK is not set
+CONFIG_SLOB=y
  CONFIG_ARCH_MULTI_V6=y
  CONFIG_ARCH_MXC=y
  CONFIG_MACH_MX31LILLY=y
@@ -90,6 +90,10 @@ CONFIG_RFKILL_INPUT=y
  CONFIG_DEVTMPFS=y
  CONFIG_DEVTMPFS_MOUNT=y
  # CONFIG_STANDALONE is not set
+CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin"
+CONFIG_EXTRA_FIRMWARE_DIR="../linux-firmware"
+CONFIG_FW_LOADER_USER_HELPER=y
+CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
  CONFIG_CMA_SIZE_MBYTES=64
  CONFIG_IMX_WEIM=y
  CONFIG_CONNECTOR=y

Please try to get a stack dump with earlycon.

--
Regards,
Leonard

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: Continuous SD IO causes hung task messages
From: Russell King - ARM Linux admin @ 2019-08-27 15:06 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc@vger.kernel.org, Linux Kernel Mailing List, Linux ARM
In-Reply-To: <20190827145216.GM13294@shell.armlinux.org.uk>

On Tue, Aug 27, 2019 at 03:52:17PM +0100, Russell King - ARM Linux admin wrote:
> On Tue, Aug 27, 2019 at 03:36:34PM +0100, Russell King - ARM Linux admin wrote:
> > On Tue, Aug 27, 2019 at 03:55:23PM +0200, Ulf Hansson wrote:
> > > On Tue, 27 Aug 2019 at 15:43, Russell King - ARM Linux admin
> > > <linux@armlinux.org.uk> wrote:
> > > >
> > > > Hi,
> > > >
> > > > While dd'ing the contents of a SD card, I get hung task timeout
> > > > messages as per below.  However, the dd is making progress.  Any
> > > > ideas?
> > > >
> > > > Presumably, mmc_rescan doesn't get a look-in while IO is progressing
> > > > for the card?
> > > 
> > > Is it a regression?
> > > 
> > > There not much of recent mmc core and mmc block changes, that I can
> > > think of at this point.
> > 
> > No idea - I just repaired the SD socket after the D2 line became
> > disconnected, and decided to run that command as a test.
> > 
> > > > ARM64 host, Macchiatobin, uSD card.
> > > 
> > > What mmc host driver is it? mmci?
> > 
> > sdhci-xenon.
> > 
> > I'm just trying with one CPU online, then I'll try with two.  My
> > suspicion is that there's a problem in the ARM64 arch code where
> > unlocking a mutex doesn't get noticed on other CPUs.
> > 
> > Hmm, I thought I'd try bringing another CPU online, but it seems
> > like the ARM64 CPU hotplug code is broken:
> > 
> > [ 3552.029689] CPU1: shutdown
> > [ 3552.031099] psci: CPU1 killed.
> > [ 3949.835212] CPU1: failed to come online
> > [ 3949.837753] CPU1: failed in unknown state : 0x0
> > 
> > which means I can only take CPUs down, I can't bring them back
> > online without rebooting.
> 
> Okay, running on a single CPU shows no problems.
> 
> Running on four CPUs (as originally) shows that the kworker thread
> _never_ gets scheduled, so the warning is not false.
> 
> With three CPUs, same problem.
> 
> root@arm-d06300000000:~# ps aux | grep ' D '
> root        34  0.0  0.0      0     0 ?        D    15:38   0:00 [kworker/1:1+events_freezable]
> root@arm-d06300000000:~# cat /proc/34/sched
> kworker/1:1 (34, #threads: 1)
> -------------------------------------------------------------------
> se.exec_start                                :        318689.992440
> se.vruntime                                  :         37750.882357
> se.sum_exec_runtime                          :             9.421240
> se.nr_migrations                             :                    0
> nr_switches                                  :                 1174
> nr_voluntary_switches                        :                 1171
> nr_involuntary_switches                      :                    3
> se.load.weight                               :              1048576
> se.runnable_weight                           :              1048576
> se.avg.load_sum                              :                    6
> se.avg.runnable_load_sum                     :                    6
> se.avg.util_sum                              :                 5170
> se.avg.load_avg                              :                    0
> se.avg.runnable_load_avg                     :                    0
> se.avg.util_avg                              :                    0
> se.avg.last_update_time                      :         318689991680
> se.avg.util_est.ewma                         :                   10
> se.avg.util_est.enqueued                     :                    0
> policy                                       :                    0
> prio                                         :                  120
> clock-delta                                  :                    0
> 
> The only thing that changes there is "clock-delta".  When I kill the
> dd, I get:
> 
> root@arm-d06300000000:~# cat /proc/34/sched
> kworker/1:1 (34, #threads: 1)
> -------------------------------------------------------------------
> se.exec_start                                :        574025.791680
> se.vruntime                                  :         79996.657300
> se.sum_exec_runtime                          :            10.916400
> se.nr_migrations                             :                    0
> nr_switches                                  :                 1403
> nr_voluntary_switches                        :                 1400
> nr_involuntary_switches                      :                    3
> se.load.weight                               :              1048576
> se.runnable_weight                           :              1048576
> se.avg.load_sum                              :                   15
> se.avg.runnable_load_sum                     :                   15
> se.avg.util_sum                              :                15007
> se.avg.load_avg                              :                    0
> se.avg.runnable_load_avg                     :                    0
> se.avg.util_avg                              :                    0
> se.avg.last_update_time                      :         574025791488
> se.avg.util_est.ewma                         :                   10
> se.avg.util_est.enqueued                     :                    0
> policy                                       :                    0
> prio                                         :                  120
> clock-delta                                  :                   40
> 
> so the thread makes forward progress.
> 
> Down to two CPUs:
> 
> root@arm-d06300000000:~# ps aux | grep ' D '
> root        34  0.0  0.0      0     0 ?        D    15:38   0:00 [kworker/1:1+events_freezable]
> 
> Same symptoms.  dd and md5sum switch between CPU 0 and CPU1.

Hmm.

static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
                                    const struct blk_mq_queue_data *bd)

        mq->in_flight[issue_type] += 1;
	get_card = (mmc_tot_in_flight(mq) == 1);

        if (get_card)
	        mmc_get_card(card, &mq->ctx);

mmc_get_card() gets the host lock according to the card.

So, if we always have requests in flight (which is probably the case
here) we never drop the host lock, and mmc_rescan() never gets a look
in - hence blocking the kworker.

So this is a real issue with MMC, and not down to something in the
arch.

I suspect the reason that single-CPU doesn't show it is because it is
unable to keep multiple requests in flight.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v3 5/5] ARM: dts: stm32: add ddrperfm on stm32mp157c
From: Gerald BAEZA @ 2019-08-27 15:08 UTC (permalink / raw)
  To: will@kernel.org, mark.rutland@arm.com, robh+dt@kernel.org,
	mcoquelin.stm32@gmail.com, Alexandre TORGUE, corbet@lwn.net,
	linux@armlinux.org.uk, olof@lixom.net, arnd@arndb.de,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
  Cc: Gerald BAEZA
In-Reply-To: <1566918464-23927-1-git-send-email-gerald.baeza@st.com>

The DDRPERFM is the DDR Performance Monitor embedded
in STM32MP1 SOC.

Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
---
 arch/arm/boot/dts/stm32mp157c.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi
index 0c4e6eb..6ea6933 100644
--- a/arch/arm/boot/dts/stm32mp157c.dtsi
+++ b/arch/arm/boot/dts/stm32mp157c.dtsi
@@ -1378,6 +1378,14 @@
 			};
 		};
 
+		ddrperfm: perf@5a007000 {
+			compatible = "st,stm32-ddr-pmu";
+			reg = <0x5a007000 0x400>;
+			clocks = <&rcc DDRPERFM>;
+			resets = <&rcc DDRPERFM_R>;
+			status = "okay";
+		};
+
 		usart1: serial@5c000000 {
 			compatible = "st,stm32h7-uart";
 			reg = <0x5c000000 0x400>;
-- 
2.7.4

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox