Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3063324rwl; Mon, 27 Mar 2023 08:46:10 -0700 (PDT) X-Google-Smtp-Source: AKy350ZUNDo7aytP8AVqbNewMK3ehd8K8oiO+GC01ygkuPXZKIyNFRXnr5uwCGlLvYkM/08m0xMr X-Received: by 2002:aa7:c2c8:0:b0:501:cde5:4cc9 with SMTP id m8-20020aa7c2c8000000b00501cde54cc9mr11718600edp.39.1679931969921; Mon, 27 Mar 2023 08:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679931969; cv=none; d=google.com; s=arc-20160816; b=Q+hYZ311R7SLdZUd43tZ9lKRBX2C1eWWqGcHO+oOD+CGvQWfjaAwzuSg0cVPfbB+fr gzbNqDAPbK4m5VAyl6CMOvdymrtzV8qcfGWsu4KCm6Krrry1G9TfWo4bXgpIrKxjkHRB X1bAwnaVM/hhbv0k9nxMJp2LHFjPQVFoZM86jLyg38dRIQBchqjTNGwujBoWO62hD4un KR2UNBwn8c2fuPTSUOVwrpsT2GCNO2UFde3L7j5ivAgwwSbJrOW9q2qVlTEA5vOId/uQ SnFL0h64egqzI7QOcryULJuRlVd8XOVlbWKa6yVfFhXk3lErc9TfhCLw28vq/TtLGG+z Qefw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HRasUUTOEu/ok1S92mQy2tcMp/4KwW2lXbLEiKBj/7o=; b=eoADwAkqxSO5b4q70Jm7Rf4vkguI7h4oxKgP5b6XFDWW6/dyFjtehML5tX9OYKscIZ Rro7tm5wahN1UUldO319AdqMxVyBHffDCQ0FSbBTQ1awggcsZDFtjzqM/M6gMr8Zka/n 5GWYdy40Pvt/uECt42iPxn+gJyaD2CH7N2nRuOyr4ZoPwRsb4r4HSSrtG+GETMHFFUpZ 2jOFBbznyqG9y+4QKpBnI+S+oO1QYPGRZUURhezMmfZVVKg33+wyepL3GAiemPTkq/mA a3PCt+7Uim9g2l5PMA2cNhvM/iJ3yP7Buy0KpCQZcmUSQ4v96ICPALD5DHX+HZKdj3sD riRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HZFjetxT; 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 t15-20020aa7d70f000000b004bf743f9e1fsi23993834edq.304.2023.03.27.08.45.44; Mon, 27 Mar 2023 08:46:09 -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=HZFjetxT; 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 S232984AbjC0Pnm (ORCPT + 99 others); Mon, 27 Mar 2023 11:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232372AbjC0Png (ORCPT ); Mon, 27 Mar 2023 11:43:36 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B26014C2B; Mon, 27 Mar 2023 08:43:11 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id z10so5399459pgr.8; Mon, 27 Mar 2023 08:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679931790; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HRasUUTOEu/ok1S92mQy2tcMp/4KwW2lXbLEiKBj/7o=; b=HZFjetxTrU0/nv8Y55FAOK1Apm3VUH13SuQEA6blI4LQsquf470BO/HxA5cmFNd3aK KhVXkKlmZq93fBkC6giJvUDlt7FuVro1W64JdaQrEtphQxoptl43dqOAsJuOdXDllTly etHqoII3GsZRYL1O1XM8c2+DB4jJ3oBH+CWict03ya4f003TK7u/v0bAMMATlIwbsHEE Eab9bSU2vOsS7u7Hi3cpukhSfrOKg/M8N1PXdsx2k+lYCOOyiPnKWQEclkXPeaKbVR3e gND/Ow1eDKT0AYLAkJBh79+oSz/WTGmxOT1B4ufDuEkJHS9CEZchC2NFdFV6xpk2+oqj wINA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679931790; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HRasUUTOEu/ok1S92mQy2tcMp/4KwW2lXbLEiKBj/7o=; b=2uXRTuoC1ocHq0ysOFqUlq7tujubPS5okZDsune7qMxOyo25dhaVI5SZ1QHqX8NUus FJh2FZtnhnVTprMF6/Ff4287oGeqBK7zi7a5zAT1J02g5xm9FH/p4HxtNCyp4SOqLtEE Zly9EVfqiJ0YnAhRbL4ObVSUzK+YPFvwGSlDst/MGf2vCE3L5TpF9l3Q1O2Oh31KCStZ rZes7he4CRBInLrtdJCLPhygt/lxgqUn3j3RhMaI6TuyI/mDTiQEzzo6ymLjxvjrApXy 5m6lwHnXNALRoTSYjWdGZg6+PbMGzb7/TdOJll6rP54VGSheRLTifBKNhRWEXMHIzz7F oy5Q== X-Gm-Message-State: AAQBX9edXI9GmIk2aek5dCRmQIDAdBdWUw9WsNWqhrt1Y+avnMwk13Xm WM2NjJZpTWKtrswOzpUxV7kGWn8+MoEDMNhT6iA= X-Received: by 2002:a63:e20f:0:b0:50a:592b:25ba with SMTP id q15-20020a63e20f000000b0050a592b25bamr3326211pgh.3.1679931790647; Mon, 27 Mar 2023 08:43:10 -0700 (PDT) MIME-Version: 1.0 References: <20230327121317.4081816-1-arnd@kernel.org> <20230327121317.4081816-3-arnd@kernel.org> In-Reply-To: <20230327121317.4081816-3-arnd@kernel.org> From: Max Filippov Date: Mon, 27 Mar 2023 08:42:59 -0700 Message-ID: Subject: Re: [PATCH 02/21] xtensa: dma-mapping: use normal cache invalidation rules To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Vineet Gupta , Russell King , Neil Armstrong , Linus Walleij , Catalin Marinas , Will Deacon , Guo Ren , Brian Cain , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Stafford Horne , Helge Deller , Michael Ellerman , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Rich Felker , John Paul Adrian Glaubitz , "David S. Miller" , Christoph Hellwig , Robin Murphy , Lad Prabhakar , Conor Dooley , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-oxnas@groups.io, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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 Mon, Mar 27, 2023 at 5:14=E2=80=AFAM Arnd Bergmann wro= te: > > From: Arnd Bergmann > > xtensa is one of the platforms that has both write-back and write-through > caches, and needs to account for both in its DMA mapping operations. > > It does this through a set of operations that is different from any > architecture. This is not a problem by itself, but it makes it rather > hard to figure out whether this is correct or not, and to unify this > implementation with the others. > > Change the semantics to the usual ones for non-speculating CPUs: > > - On DMA_TO_DEVICE, call __flush_dcache_range() to perform the > writeback even on writethrough caches, where this is a nop. > > - On DMA_FROM_DEVICE, invalidate the mapping before the DMA rather > than afterwards. > > - On DMA_BIDIRECTIONAL, combine the pre-writeback with the > post-invalidate into a call to __flush_invalidate_dcache_range() > that turns into a simple invalidate on writeback caches. > > Signed-off-by: Arnd Bergmann > --- > arch/xtensa/Kconfig | 1 - > arch/xtensa/include/asm/cacheflush.h | 6 +++--- > arch/xtensa/kernel/pci-dma.c | 29 +++++----------------------- > 3 files changed, 8 insertions(+), 28 deletions(-) Reviewed-by: Max Filippov --=20 Thanks. -- Max