Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3827003ioa; Tue, 26 Apr 2022 10:29:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtTRtJJlcmMXn76Dk/OJtsQlofvcfZYV7hpeJVXBgUyqsbpf2u5WDwaanTBbEmxW+DNYf8 X-Received: by 2002:a17:906:7684:b0:6e8:5d05:196b with SMTP id o4-20020a170906768400b006e85d05196bmr22735435ejm.209.1650994179413; Tue, 26 Apr 2022 10:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650994179; cv=none; d=google.com; s=arc-20160816; b=cTpGX9x0I39mSsZDwZiMZM9nIBfAen+YFjPL0vBskK8zGaw+lDijSIl86eb54apBDk kj9B/ozgkn8Rq+fs6oDj/fPEZNGndLqQJq4DKqI694gZ6QVv+kkDZLTNT+cODi4KHy/r zTKdhtXQ1wcL19MdoYkE8NSU0JBxX4rFGLZhDvV6YnknNSqsr/X4aBe6WD2jtabBX39I o5CVr4U+O3toLtb5R5Sz3YvplMqcEtjR8IYAvaFgDIQDRCjBg3vke9SJAhsj+bzWEumZ jCFkMetJX5xl1Z2MPlGpwU60p7IpzFCG5R3kS/LkJJcvciLxR8zNFZ7SmRyDKXTc8FvI LHFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YfoDDLuZhanQMApWzEFeNLHeXpq0oQVFIK82FP7fC6c=; b=AHMIspKMa6O9viKvjzne4VM6DSSIoAe4wrzIBQHor0enntYce/QtnZWcjcEHOS3Sjj zzOCitxisstk9q60YzZjF0QAIo8XgTzz0fDUlwRkWAFrUfnskzMPTo9++/T2OWoHpEbB c1Xl8StPdwuDpSWjZplFsXcxM2XXVVd2d+rZyaR3Kbhzs3bnO/xl7XOD+dcMyx+L99WV XM/91JwpKoaziYUXLRV1982ccg/28dOh4W4NESRmGzyXNnuMA36cO25183wdQ+hmOKiv 35VSOuyo0bpClT1eN5/4yZEBz+KAaTcIiDqJSJybEo1YrBhB0XQqzlfv4lF9mvAJsW+/ +I0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ioOlcu4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a170906704900b006df7eafe421si15634138ejj.127.2022.04.26.10.29.12; Tue, 26 Apr 2022 10:29:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ioOlcu4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346544AbiDZJAr (ORCPT + 99 others); Tue, 26 Apr 2022 05:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346970AbiDZIpl (ORCPT ); Tue, 26 Apr 2022 04:45:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338A03B547; Tue, 26 Apr 2022 01:37:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 486556185A; Tue, 26 Apr 2022 08:37:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A74CC385A0; Tue, 26 Apr 2022 08:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962221; bh=Fu+nhyd4Ftx9wFwzYrhYVHcQbXFxR67KTnPhaztFH/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ioOlcu4Yon0HLvaqfsX1toHtpwWb/RQrqy7tQlZxMfR11kPNlvZSrAjBBv8Jj8mN6 BQmvtEVpWh06MmOplCeCto83fh8BYWkW9tEJ1ixmLPCN6badU2ZRIatAJpvYEBFNuB K86FcLKdWGlK9BUSMCFsOdwXCm7QQ9Nk0sUEqEqc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herve Codina , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 025/124] dmaengine: dw-edma: Fix unaligned 64bit access Date: Tue, 26 Apr 2022 10:20:26 +0200 Message-Id: <20220426081748.020932246@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Herve Codina [ Upstream commit 8fc5133d6d4da65cad6b73152fc714ad3d7f91c1 ] On some arch (ie aarch64 iMX8MM) unaligned PCIe accesses are not allowed and lead to a kernel Oops. [ 1911.668835] Unable to handle kernel paging request at virtual address ffff80001bc00a8c [ 1911.668841] Mem abort info: [ 1911.668844] ESR = 0x96000061 [ 1911.668847] EC = 0x25: DABT (current EL), IL = 32 bits [ 1911.668850] SET = 0, FnV = 0 [ 1911.668852] EA = 0, S1PTW = 0 [ 1911.668853] Data abort info: [ 1911.668855] ISV = 0, ISS = 0x00000061 [ 1911.668857] CM = 0, WnR = 1 [ 1911.668861] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000040ff4000 [ 1911.668864] [ffff80001bc00a8c] pgd=00000000bffff003, pud=00000000bfffe003, pmd=0068000018400705 [ 1911.668872] Internal error: Oops: 96000061 [#1] PREEMPT SMP ... The llp register present in the channel group registers is not aligned on 64bit. Fix unaligned 64bit access using two 32bit accesses Fixes: 04e0a39fc10f ("dmaengine: dw-edma: Add writeq() and readq() for 64 bits architectures") Signed-off-by: Herve Codina Link: https://lore.kernel.org/r/20220225120252.309404-1-herve.codina@bootlin.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dw-edma/dw-edma-v0-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 329fc2e57b70..b5b8f8181e77 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -415,8 +415,11 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) (DW_EDMA_V0_CCS | DW_EDMA_V0_LLE)); /* Linked list */ #ifdef CONFIG_64BIT - SET_CH_64(dw, chan->dir, chan->id, llp.reg, - chunk->ll_region.paddr); + /* llp is not aligned on 64bit -> keep 32bit accesses */ + SET_CH_32(dw, chan->dir, chan->id, llp.lsb, + lower_32_bits(chunk->ll_region.paddr)); + SET_CH_32(dw, chan->dir, chan->id, llp.msb, + upper_32_bits(chunk->ll_region.paddr)); #else /* CONFIG_64BIT */ SET_CH_32(dw, chan->dir, chan->id, llp.lsb, lower_32_bits(chunk->ll_region.paddr)); -- 2.35.1