Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp33255lfe; Fri, 15 Apr 2022 18:05:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyqkv7+DFyP3kipO25qSHL2YBSqhYPaZG6DqGnLOOghW8veYnhnqcEcgWyKryBsF8xewlv X-Received: by 2002:a63:5710:0:b0:399:365e:5dde with SMTP id l16-20020a635710000000b00399365e5ddemr1280553pgb.192.1650071147765; Fri, 15 Apr 2022 18:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650071147; cv=none; d=google.com; s=arc-20160816; b=SvXBV96BQ52lX1VJQmlQFYwjtRkw19llIL4V3XQWyCopBdl2ncpjWjBWWMQYkpWZaO KrBv53nsqkFdX85VbNOiEK17TLJsqsQLPfcF0Egl2gq8TyMVTjjBht0VSAnlONsjsvf6 G3QhgXyp/DV9Aut/33VkJlq43KULqeQRSp/YK8148zl0e2eaz/8SjCcj3PTYZkq7t+K+ wxvSJykRKoz8Pewlmxmd4NNavFvR0a4m6RFutM9Xe+CN5HbaEiH0X55eG/jLz/G6s3fh 8G7L/tH44sksQ7C8oGvY+iHcUH3GMJMawEvcGccTmJjsUdSiF9M60a8xhJY4HB5SewTR XUdQ== 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=JEwBbnSv4wy8BjMA4tVtRE4HEbh8Klb/JEyZ0qGQGEM=; b=ruYL4jLUK5ne4wT+chKw0oQzvqEyM0C/X5PH7AdT3IrEnxsjJx6dm6K0r+BECUepgN vp9aqv9Ldt1BW8cOqRn0otJAbMDHLk04hV6lB53MMTgRSQEIFHml46PALLn626BBXhhK p9XymICwqz+sA905dL4YMIbHmLBWfEPrh/qWSzOqp/g4gYJSF2ZeJROaIn6WfeuYWtxV ApDeHnmMYxV0qat4jmqBMOldG/WITPd2IDd5AhmAQrIDPXEMuJQlU1ob/UhWbDFykIRd 9xPbXUCARYloVgJnE1nCULqh30CyXP3+pqx4NWNL6TckEp2d3/EGDU6sGRD/nc/b17bM thGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lHNQR8bO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ot3-20020a17090b3b4300b001c7ba889590si6882107pjb.2.2022.04.15.18.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:05:47 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lHNQR8bO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 44142FABD8; Fri, 15 Apr 2022 17:46:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352678AbiDOL2k (ORCPT + 99 others); Fri, 15 Apr 2022 07:28:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243602AbiDOL2g (ORCPT ); Fri, 15 Apr 2022 07:28:36 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4581E49F23 for ; Fri, 15 Apr 2022 04:26:08 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id e21so10324967wrc.8 for ; Fri, 15 Apr 2022 04:26:08 -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=JEwBbnSv4wy8BjMA4tVtRE4HEbh8Klb/JEyZ0qGQGEM=; b=lHNQR8bOCTyJ+udwv0kNNIQuWIfcelZdA7qCYzeh/hfp1PGUUju3szcLwobmWjlG+D nd0gbdBgA+U/G9MwTm6EwcybEYhz9O7zcuGb+XquO85Cnt3zAnRGSOozeRkelx+Dl5iy Zd1kypx1KsUUlc7kim/LpcGrnp2xsx7hzQBG/i9AToI6iucVECFhibyYCMZ9Hn/abBQs RYYcuLDe6al/DRJa9I4lwCgCdG83QErLqu6AJeyceCHJL7SbVd0fLrGL7VmFqALstkvY bDZ9UIiWlLF66dUri7slTgwOOZnJ8JSVJWFhPE5BC+kVnEgmI4Xok/PyCKyW1WOL8t+E OdRg== 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=JEwBbnSv4wy8BjMA4tVtRE4HEbh8Klb/JEyZ0qGQGEM=; b=1heLqZhYoSHAzMOPgTy5MAMsd4+TTsHOIaSR3WdDTeSAtTE1K2TLz4eGeBOTqDuwVh /qZJCdotipk2EwWX5MmCpF8jOJt+5QWwBUKGPaXcKiRRgDr7hR6biB4G7UcsAehOZDJz AVrMzPvXvA4M7pXAEqc6ajPvcjHutA1+GbNybBzMOGq0MGseUELDEkmm1EJLzpNZVja0 H/d6GjG2SbWq/f3wKNK7/2Bsewy2ymexMPFAc8KTjZUF3oQVfVtqkVzcHC8LHEzeYMF/ GyDS+7j5tyiW8Nj7Rqpw11VJOGeNeP08ZkPchHWPg8sSTZ5/89xLnu9EGmWHQazlEg1D IW3Q== X-Gm-Message-State: AOAM530WrxHNIsAEmi5NOGcEvKdtFj7wPMUa1A0+9C6CwqoJTT9nI6OD iH9gYWjtZ5U68WImD79hDtI= X-Received: by 2002:a5d:47cc:0:b0:204:1c9d:2157 with SMTP id o12-20020a5d47cc000000b002041c9d2157mr5084367wrc.294.1650021966801; Fri, 15 Apr 2022 04:26:06 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm5255924wmb.3.2022.04.15.04.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 04:26:06 -0700 (PDT) Date: Fri, 15 Apr 2022 13:26:04 +0200 From: Corentin Labbe To: Heiko Stuebner Cc: 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, samuel@sholland.org, 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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220307224620.1933061-1-heiko@sntech.de> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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); dma_unmap_single(ce->dev, dma, DMASIZE, DMA_FROM_DEVICE); print_hex_dump(KERN_INFO, "DMATEST3:", DUMP_PREFIX_NONE, 16, 4, buf, 256, false); Will lead to: [ 2.960040] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.965354] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.970709] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.976069] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.981440] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.986814] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.992188] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 2.997560] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.002934] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.008307] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.013680] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.019054] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.024427] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.029802] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.035175] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.040546] DMATEST1:fefefefe fefefefe fefefefe fefefefe [ 3.401647] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3 [ 3.406982] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3 [ 3.412350] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3 [ 3.417720] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3 [ 3.423094] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.428468] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.433841] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.439213] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.444588] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.449962] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.455334] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.460707] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.466081] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.471454] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.476828] DMATEST3:fefefefe fefefefe fefefefe fefefefe [ 3.482200] DMATEST3:fefefefe fefefefe fefefefe fefefefe Even with no DMA action, the buffer is corrupted. Regards