From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basealt.ru; s=dkim; t=1755171623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7k+J9WbL5RxqhhDuZdzZqaKsOzNX8f8amCxhBPdXVqk=; b=R+w/Pm0yijMwz8iI4HewE2vS+4KZU8JGoWlB9Pu8ZwzSczkz+mX0loYdqso1Jk2TyTCdi+ 9eF8Lxqx3r/jNNXCrAAxmp1tbxUoFGvm6JtyFfZCoNtggvpQ5RMDowzw5wbq9kMPMMUh6Y vQTcRfYv/1zY2XRgkGcXwPJHml6sV4cvcXTpn03DDJhMWsjHnhxmWQCiRhkn1eq31md566 +P8a0eqrmCwPaopvJW0zw6vqJ2sJLU14a9uQIpPF9ldEBjH4/8lD8I8EnRFDxS5LxAiAoi Q/OTO67Iv1/aPnJyzOsu0VC5GMAe/gR3sVUgPzCDGHoMTwT2F3PdqM+ncy+c7A== From: Daniil Gnusarev To: gnusarevda@basealt.ru, devel-kernel@lists.altlinux.org Date: Thu, 14 Aug 2025 15:40:25 +0400 Message-ID: <20250814114027.60916-2-gnusarevda@basealt.ru> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20250814114027.60916-1-gnusarevda@basealt.ru> References: <20250814114027.60916-1-gnusarevda@basealt.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [d-kernel] [PATCH 1/1] pcie-baikal: forced enable dma-coherent for pcie on Baikal-M X-BeenThere: devel-kernel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux kernel packages development List-Id: ALT Linux kernel packages development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2025 11:40:25 -0000 Archived-At: List-Archive: List-Post: 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 --- 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