Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1188379pxb; Sat, 16 Apr 2022 00:51:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySknSwHFMpSHT+JjJ7urDrmPcdflTh6gfJiAX/tKhSzvWd/lE9z4mgfolBjJTSbuq6py+9 X-Received: by 2002:a17:902:bc86:b0:151:ec83:4a8b with SMTP id bb6-20020a170902bc8600b00151ec834a8bmr2521987plb.69.1650095474672; Sat, 16 Apr 2022 00:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650095474; cv=none; d=google.com; s=arc-20160816; b=CA+pLW7LIIq7V9Aaw6nqzDSbZwtdfXfyVNBg+2/uuthPcR8axNrtrQ2hMPHiFnCwuo DjbKVBcq65yzzvVklCZulGywMPPvhFpc4UhTyRzmE81+a/0Ng89KKqdnUO971MTiuZMX JtY42FbmhcgpfquUriZAJqOTCvMx2sisIk0Id8FHWD6NBJG9JrSC/9o6xA8lxJUdrECH HmBn4Z94mfSvzfq8AjjmG56+oCFn307yGz/0JMojiX10NWEflcnTuI1wK2dT2QFl/xX+ Ed6In60GqP3h6TYSEdgEGdLGvPM0eJkb+/h4B5N/WG7Cbd9X4INnuY/tENCQv3fWkxth JHZw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n3udlrmFRG5gOrbFNhXLisVJVRQDIPelDEgRxtU6UwA=; b=f38tJrpu/wPwGLhRHHy5t7XOFuPWSNc/d9/7Hluw1IcyI/gErCT6RQ23mndGU9KQYz EElvjsfGp+eky48iFSLcvFgl6iSq4mc1GzFh+B0mwDSG6XNf+ZpHlX52pQ9M8ZNT/PSx 24ALIgxM4SJm/HaPEfTBWvt1LO63TE/35HsqXqN6gEMYeVsCepkiNkcsoLgVMnr8IUJa D4NknorIsm5JtiMmpWMj486xlYYuhRu4ukoV3IfsdCT5fDsYeDizvd12hb8n31KqCLy0 XBW+2DTiF7j43DGziiXn+p2l81w2L2hQ8qJN8vwKvENaUDsvMHLDN1rh81Vtv8YphDxd XCew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RA8I9Cdr; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v5-20020a631505000000b0039d9bea33e4si3518718pgl.277.2022.04.16.00.51.00; Sat, 16 Apr 2022 00:51:14 -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=@gmail.com header.s=20210112 header.b=RA8I9Cdr; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbiDPHhv (ORCPT + 99 others); Sat, 16 Apr 2022 03:37:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiDPHht (ORCPT ); Sat, 16 Apr 2022 03:37:49 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F72424971 for ; Sat, 16 Apr 2022 00:35:18 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id g18so12866905wrb.10 for ; Sat, 16 Apr 2022 00:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=n3udlrmFRG5gOrbFNhXLisVJVRQDIPelDEgRxtU6UwA=; b=RA8I9Cdr3AKi1lYngqd/bphEz2n7JJWcnyCNtKEpfArKxgIc+8PRyHMpMh12dE6t0M gAj8j4is59ks+20l8jN9jnFhNbu+cOQ9K1LQsotipfxEi4MxvsuogVF6t4A++4mbdo1a RQ2p7Wc0mJukYm6jyRIeCxwmbxtSFNGzzwodbssHLJ2/SRd8g3kOha92ZvTBNr03epFF Qbfjtx0gDPcCVCDZ9lJ2gqmbh8yBgR78MUt3j7Nz1mfExrbexbiez8a/SznHxtY6kmp9 PqJzgpGoaYE3XplfaqGiKk3B6NY0+V4vbftGba4vBGvIetTv8opxaYRGtUMGgROF/fkc y7WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=n3udlrmFRG5gOrbFNhXLisVJVRQDIPelDEgRxtU6UwA=; b=XZgZDzV+V5BfIy9BK8OpX7+Gyg5EkJyJZuyBR+uxk8RvVYT36b0brYS32x5/HuphVc WPlTfbet6Rs5Rip5ZvBbKfGgDRFMTti7ouAy8e5SO8GvEby+VVGAib1QGaayqE91ulE+ JYrV11saniyPpZbfGowPpElYvUl/WFmMoeZgC/lRXIa89kLNx8AVpBq9iqbzT68fcvdc kOHlQdh7jHXouM8zUugPra2tSyCrnoMsbBQFYknciML12/0yiRE2Hs1CdznQw6Gb+1Pi enVg/1zk57mTvIxrR5EUluPQoWxtlWuZntnRSFa5ggduxbeVXsD08bMT6v1Ito3R0JTg 9gsg== X-Gm-Message-State: AOAM53106fU7IVnbpEVrSGyFe39HVbhuBAPI7xw9DY6dzpcGTxZLrWq5 rofz2j3czbRXDmoqBfRraToBnBT0xGo= X-Received: by 2002:adf:ed43:0:b0:207:ac79:84ee with SMTP id u3-20020adfed43000000b00207ac7984eemr1733242wro.321.1650094516563; Sat, 16 Apr 2022 00:35:16 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id 205-20020a1c02d6000000b003928c42d02asm800268wmc.23.2022.04.16.00.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 00:35:16 -0700 (PDT) Date: Sat, 16 Apr 2022 09:35:13 +0200 From: Corentin Labbe To: Samuel Holland Cc: Heiko Stuebner , palmer@dabbelt.com, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, wefu@redhat.com, guoren@kernel.org, atishp@atishpatra.org, anup@brainfault.org, mick@ics.forth.gr, cmuellner@linux.com, philipp.tomsich@vrull.eu Subject: Re: [PATCH 0/2] riscv: implement Zicbom-based CMO instructions + the t-head variant Message-ID: References: <20220307224620.1933061-1-heiko@sntech.de> <70da24dd-2d03-fc49-151d-daabb315a5f6@sholland.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <70da24dd-2d03-fc49-151d-daabb315a5f6@sholland.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Le Fri, Apr 15, 2022 at 09:19:23PM -0500, Samuel Holland a ?crit : > On 4/15/22 6:26 AM, Corentin Labbe wrote: > > Le Mon, Mar 07, 2022 at 11:46:18PM +0100, Heiko Stuebner a ?crit : > >> This series is based on the alternatives changes done in my svpbmt series > >> and thus also depends on Atish's isa-extension parsing series. > >> > >> It implements using the cache-management instructions from the Zicbom- > >> extension to handle cache flush, etc actions on platforms needing them. > >> > >> SoCs using cpu cores from T-Head like the Allwinne D1 implement a > >> different set of cache instructions. But while they are different, > >> instructions they provide the same functionality, so a variant can > >> easly hook into the existing alternatives mechanism on those. > >> > >> > > > > Hello > > > > I am testing https://github.com/smaeul/linux.git branch:origin/riscv/d1-wip which contain this serie. > > > > I am hitting a buffer corruption problem with DMA. > > The sun8i-ce crypto driver fail self tests due to "device overran destination buffer". > > In fact the buffer is not overran by device but by dma_map_single() operation. > > > > The following small code show the problem: > > > > dma_addr_t dma; > > u8 *buf; > > #define BSIZE 2048 > > #define DMASIZE 16 > > > > buf = kmalloc(BSIZE, GFP_KERNEL | GFP_DMA); > > for (i = 0; i < BSIZE; i++) > > buf[i] = 0xFE; > > print_hex_dump(KERN_INFO, "DMATEST1:", DUMP_PREFIX_NONE, 16, 4, buf, 256, false); > > dma = dma_map_single(ce->dev, buf, DMASIZE, DMA_FROM_DEVICE); > > This function (through dma_direct_map_page()) ends up calling > arch_sync_dma_for_device(..., ..., DMA_FROM_DEVICE), which invalidates the CPU's > cache. This is the same thing other architectures do (at least arm, arm64, > openrisc, and powerpc). So this appears to be working as intended. > > Regards, > Samuel > This behavour is not present at least on ARM and ARM64. The sample code I provided does not corrupt the buffer on them. Regards