Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4436655ioa; Wed, 27 Apr 2022 03:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmBz6uFWIzWe2HPEZRlnmQZwtgP4+D49PdXf5qeN2jP5WzVsnTWG7i9Kv8cqJpZRAai+jm X-Received: by 2002:a05:6a00:814:b0:50d:450a:dc5e with SMTP id m20-20020a056a00081400b0050d450adc5emr13299164pfk.15.1651057182614; Wed, 27 Apr 2022 03:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651057182; cv=none; d=google.com; s=arc-20160816; b=Np1Jn1dxDzvf5+D2wGMzq1uAHpEx7sCttp/dhDDhljTPx7s0nufwOAy28/pTp72efP SWoknFioOE0EM0htbN2TFbRwDJd3IgIaI/QZdHeFWOuzY1DDovoxMIWjmKTD3SKcbTyX zLmehGhJuWnDG37s6DDfW1jie+Kp8FKZcesQWRlr0a7O2grwqaRvaujA6a0KsM/WRqT3 yOZoBIKAVFKyLjaD+T3I0dYVv0h7xKUcJ7x/owOLMRz/FSA2M21IJBHMTUri0OvtgUXi 8gfpmSiUa8lmEOa0pG+j6PX/Zwwm1cQBfzi9CC4WMBcnxPy1kcm6bXjWvkxUa4EIbMfX xjlg== 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=mBmiCa/JiZvImANjQ/oGBtW5D2mDs/On8CR9JDGEP/ScGMTBrZ/VznJjVnj9mj1ctR BR++SGUW15mRJvgmbqkScKBzOSuX5G0sgRig59FC19wlJdOLfnLi4MP9ng3pJROymgMW qU53Qgu2q1Jj/kKR65FrutQ+rkTuTqjz73oQp+0npsZt15WP13YwCcZDdfltAZQaZOuY CmQhKClf77nxuWfm/NKuRZkS31VnTH9bfEFRYV9Vx3QphxseSfQCwYzxw+Qi3RHJHCpA Wu4csh4RCa2yqFHQQ2l2f5qNt0ZCQjvFrjSjzEmjAR5T8sHZtQG1TUztwi2xW/CFYxI2 RKRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T5krVWyU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d16-20020a631d10000000b0039d7d10e4bfsi1070315pgd.852.2022.04.27.03.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T5krVWyU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4C7F8449372; Wed, 27 Apr 2022 03:07:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347625AbiDZJdR (ORCPT + 99 others); Tue, 26 Apr 2022 05:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347560AbiDZJF5 (ORCPT ); Tue, 26 Apr 2022 05:05:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49617D6; Tue, 26 Apr 2022 01:44:58 -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 74C5861344; Tue, 26 Apr 2022 08:44:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80739C385A0; Tue, 26 Apr 2022 08:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962697; bh=Fu+nhyd4Ftx9wFwzYrhYVHcQbXFxR67KTnPhaztFH/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T5krVWyUWsNw91QjtpY5qQ2B0EMhUES4YdvsSMNgbEGefMQxJArnsAFcazvjC0fhS 0d2K8dFxkCgRy6vp4eC1GyRRmRuttasKYi2ifh94eC25VGAV7ya/6YIqsygYHexX96 gkTtsFohREiNTW0WNNezQSDrFtf9LQ89sKBaI8go= 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.17 019/146] dmaengine: dw-edma: Fix unaligned 64bit access Date: Tue, 26 Apr 2022 10:20:14 +0200 Message-Id: <20220426081750.605299587@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081750.051179617@linuxfoundation.org> References: <20220426081750.051179617@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=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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