Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp628691rwb; Tue, 25 Jul 2023 23:33:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlHgfbWrKx6E9HtiuGjuGsm00VUm+zzPqZtaL8FUAktALR6vbbMxtlzNlmOsL1acuNZ6YlHH X-Received: by 2002:a05:6402:68e:b0:522:5980:ae08 with SMTP id f14-20020a056402068e00b005225980ae08mr852473edy.18.1690353200494; Tue, 25 Jul 2023 23:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690353200; cv=none; d=google.com; s=arc-20160816; b=NkOgrmS0diziG/XEPFSjpV45xTj8CRFtHGZ2CWwEWynKVkIFAePp2vLNiNnT1DwO/H lhLI30jeWqcuHH1jyv0qJMbtnatWHsCiYTFM5BaFaYVVBb41hijpoIV4Nwrirzi0mgJc GflnhTRfcZ6K7RY11USw/95hwF+ildIYMZUbHfb3f1AOUuKCwGeKXVupipQNL3GCi9pC wQvtAo+eMN6tTP4KaLHGmi2OQyj9qHNTWsgwerzZqIlV2tjRZr59txi0xwa1c8RHX9cs K6S4f4lZ8F/Ch0o0Va7tMbNlfBJTN7WaHdfvpW8d+YBaDpCDdeRBg+EymEhP7rsWJmCT /PEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iiYAyAdhsq0wJEMkqB/TOUdYdu8vCrbQjmoRQ0d5xiA=; fh=M4KYKuNWheY6Y9d+ovUSieHoLT8sTJv8wZUZyJ3KigY=; b=ZyeVQhX51xMuPEIlIf6E1ThC72MzT2qczmNe+EBpQAEBtcognCZXR+PJTG4Qh2nzat ufxRnd4TvIXmx3GHIVPLD3gxcupkbwXR0FmHtqNjtcl20gMDbpyJ/3/OLYSgYqTQ5PZr 6UpD3uhtwDtDmVFtfkpDqHVz18VuFjXdvzGaFcD+B5XLPDh550s8M2FhurjSOPlFFoSA JHCWP58o6ZsBAUcqOVpE7Cba4+7kzC/Yq2OxKBhUTx6KQUP4bpEkYK6iWzg3LOgB8fNU JN8SGM2KyKIXpbt8ZUfFO/mNyyu4qAP/P0/Cicu5Oaa+/JVB9tEWoSrrGAsz1vyT5ZwN VOGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sf1W+CCw; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020aa7c743000000b0052275937198si451046eds.628.2023.07.25.23.32.55; Tue, 25 Jul 2023 23:33:20 -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=@kernel.org header.s=k20201202 header.b=Sf1W+CCw; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231561AbjGZF6J (ORCPT + 99 others); Wed, 26 Jul 2023 01:58:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjGZF6H (ORCPT ); Wed, 26 Jul 2023 01:58:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19F35170D; Tue, 25 Jul 2023 22:58:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ACC65615F0; Wed, 26 Jul 2023 05:58:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73A48C433C8; Wed, 26 Jul 2023 05:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690351086; bh=wdDUWWLGKY/0b5qmLazgZKL+qx2jfNkIERNSCJhI2Fc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Sf1W+CCwC50u6xijnDsJhrPB1Gr0HDAQQDnwsQ8ko3Hgn6/iFU7lI1Tx5SlUGIIU8 mFaTh1V5WK40BkCm/ih8timG+aKJ8DDPS3VaMeuSzWnlA9xQS1wiwrIFcXjCCLJ2lW TVjfjuM+o9iAXN38g7jcX/be5b9pnrN448YX7yC/MpfKGFXVQKedNoBDmJAsT1M6Re m6mpg2KdL7EmJ5Cv/hvPODuLxwBhVWy2r90IbUYyH2Y/g0n+nMNL4g1oHPYLj5maSd w0rDP5klLRdht9DFiTzvo5oOy5RLPgBndjZsmOyZiX1xfjIrA1GP1VJNxJsM/AZM6k Rj6nIdzWUzOSA== Date: Tue, 25 Jul 2023 23:01:19 -0700 From: Bjorn Andersson To: Douglas Anderson Cc: Mark Brown , Vijaya Krishna Nivarthi , Andy Gross , Konrad Dybcio , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH 1/2] spi: spi-qcom-qspi: Fallback to PIO for xfers that aren't multiples of 4 bytes Message-ID: References: <20230725110226.1.Ia2f980fc7cd0b831e633391f0bb1272914d8f381@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725110226.1.Ia2f980fc7cd0b831e633391f0bb1272914d8f381@changeid> X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 On Tue, Jul 25, 2023 at 11:02:26AM -0700, Douglas Anderson wrote: > The Qualcomm QSPI driver appears to require that any reads using DMA > are a mutliple of 4 bytes. If this isn't true then the controller will > clobber any extra bytes in memory following the last word. Let's > detect this and falback to PIO. > > This fixes problems reported by slub_debug=FZPUA, which would complain > about "kmalloc Redzone overwritten". One such instance said: > > 0xffffff80c29d541a-0xffffff80c29d541b @offset=21530. First byte 0x0 instead of 0xcc > Allocated in mtd_kmalloc_up_to+0x98/0xac age=36 cpu=3 pid=6658 > > Tracing through what was happening I saw that, while we often did DMA > tranfers of 0x1000 bytes, sometimes we'd end up doing ones of 0x41a > bytes. Those 0x41a byte transfers were the problem. > > NOTE: a future change will enable the SPI "mem ops" to help avoid this > case, but it still seems good to add the extra check in the transfer. > > Fixes: b5762d95607e ("spi: spi-qcom-qspi: Add DMA mode support") > Signed-off-by: Douglas Anderson Reviewed-by: Bjorn Andersson Regards, Bjorn