ALT Linux kernel packages development
 help / color / mirror / Atom feed
From: Daniil Gnusarev <gnusarevda@basealt.ru>
To: gnusarevda@basealt.ru, devel-kernel@lists.altlinux.org
Subject: [d-kernel] [PATCH 1/1] pcie-baikal: forced enable dma-coherent for pcie on Baikal-M
Date: Thu, 14 Aug 2025 15:40:25 +0400
Message-ID: <20250814114027.60916-2-gnusarevda@basealt.ru> (raw)
In-Reply-To: <20250814114027.60916-1-gnusarevda@basealt.ru>

When using the CONFIG_INIT_ON_ALLOC_DEFAULT_ON=Y kernel option or
the init_on_alloc=1 boot parameter, errors are observed when initializing
nvme on the PCIe bus:
    [   71.480815] nvme nvme0: I/O tag 16 (0010) QID 0 timeout, disable controller
    [   71.489912] nvme nvme0: Device not ready; aborting shutdown, CSTS=0x1
    [   71.496838] nvme nvme0: Identify Controller failed (-4)
    [   71.502910] nvme 0000:01:00.0: probe with driver nvme failed with error -5
As a solution, Baikal Electronics proposed to add the 'dma-coherent'
property to the PCIe device description in dts. To support devices with
older firmware versions, this property is forced into the device driver.

Signed-off-by: Daniil Gnusarev <gnusarevda@basealt.ru>
---
 drivers/pci/controller/dwc/pcie-baikal-core.c | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-baikal-core.c b/drivers/pci/controller/dwc/pcie-baikal-core.c
index 9e85edfb656a4..0c1355a22630b 100644
--- a/drivers/pci/controller/dwc/pcie-baikal-core.c
+++ b/drivers/pci/controller/dwc/pcie-baikal-core.c
@@ -2209,11 +2209,32 @@ static int baikal_pcie_probe(struct platform_device *pdev)
 	union baikal_pcie *bp;
 	const struct baikal_pcie_of_data *data;
 	int ret;
+	struct of_changeset ocs;
 
 	data = of_device_get_match_data(dev);
 	if (!data)
 		return -EINVAL;
 
+	if (!of_property_present(dev->of_node,"dma-coherent") &&
+		!of_property_present(dev->of_node,"dma-noncoherent"))
+	{
+		dev->dma_coherent = true;
+
+		of_changeset_init(&ocs);
+
+		ret=of_changeset_add_prop_bool(&ocs,dev->of_node,"dma-coherent");
+		if (ret) {
+			dev_err(dev, "failed to append dma-coherent property\n");
+			return ret;
+		}
+
+		ret=of_changeset_apply(&ocs);
+		if (ret) {
+			dev_err(dev, "failed to append dma-coherent property\n");
+			return ret;
+		}
+	}
+
 	bp = devm_kzalloc(dev, sizeof(*bp), GFP_KERNEL);
 	if (!bp)
 		return -ENOMEM;
-- 
2.42.2



  reply	other threads:[~2025-08-14 11:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 11:40 [d-kernel] [PATCH 0/1] Ядро 6.12 с поддержкой СнК Байкал-М Daniil Gnusarev
2025-08-14 11:40 ` Daniil Gnusarev [this message]
2025-08-14 19:58 ` Vitaly Chikunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250814114027.60916-2-gnusarevda@basealt.ru \
    --to=gnusarevda@basealt.ru \
    --cc=devel-kernel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git