Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp975767pxb; Wed, 15 Sep 2021 18:35:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqkgtJG88KX8Sr+ibNSeDePUnUnTPmDfQe1p+LdmZ9f31DIODZy/eZaG9Spa6LrppQuKGq X-Received: by 2002:a17:907:77d0:: with SMTP id kz16mr3416755ejc.334.1631756128875; Wed, 15 Sep 2021 18:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631756128; cv=none; d=google.com; s=arc-20160816; b=NLXF4L6Mht5LB+zoEcsWXYt3rWztv9DoL8H27G+4fJxifFUCjve+/Tlnyoarmu3ELM Tcjf6ubnKdCZ+n/4sGBE6jH9g7jh5TlwoDk+97gpwY3+UUSKGj96WAvAlF0/gUTyAl/W VHDG1UDIDoc0WLpvRB2ArFPljgJLr03wtaHZlfnXppFOZ3Kn7urQDCSaLXd+y1gQPDxG YMpkXuy6Ok43ouK/jNaG8TFbs+t3Zp7IOTs44CfHIxWmw1OoRfmDZaw2wbodYH7lkGbV PDKMQmKdxSPShK76i3KrpbL3S7rq8ocahWGRfPSm6b/YoYInfLfXNq099qBtV34PP+F8 OVGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Ed4CbC19ybH+NnwttfvtOt3xJo805SgbCxsecwJnerM=; b=FvjCV400LkmpM/wzmVaqPDVlKWvUao9vQmqIvQUTIg+bmTWnt4rrbTB/OqRCIBh84H pko63DUDAHRFhiBMWKNSeH6ouqRv4YHWxfQQddGx2YG8hIdnBqMHd86VYm6G7eNA7v6o /672kIkfDSAt6H20nleh9avdRjhz6MbwKUhLVyah/MXs9bYgFo7ktVIWFDUrNPR3AFHQ A79Te4jNcI5otHhImtz29EH8wgXFJTC02BpQzGTcCRIkTvz2GUgLikX0mTkE3ernUoUy shnlay1PCGzsw1v0Z7vi4otafUe8MN9kP7M5SK9aDlFWQxl3gOGWqoG9j9rmuvbXc6Vo sRxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EgNNAmpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si2524470edj.100.2021.09.15.18.35.05; Wed, 15 Sep 2021 18:35:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EgNNAmpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233688AbhIPBeR (ORCPT + 99 others); Wed, 15 Sep 2021 21:34:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:45822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbhIPBeO (ORCPT ); Wed, 15 Sep 2021 21:34:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 505E5611EE for ; Thu, 16 Sep 2021 01:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631755974; bh=EZUqyiFqMWPQYu1agznmvJd23FYTdk+UAyU6XzSvcJw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EgNNAmpzu9i7yJm0cZHK36sBCBZmvB09twTwUwQ/F9YXaOLPfuUeXS62cDBa+vTaN iHJzAZVobHIGgOVNKKjGBJry1flwMlWSbKge7odewf+YAchywON8xk5IdzEgMQ2RUo k2AI66SXpdYKntCmTc5FI5IrYkU83p8Ubc0A/3AFEd5kVGXHiLPWhWAg7ImrVIyFUs ft3CoKW6COBxDLTvOSj8ZmjjmQfzJ7P7axkkTmUBjC6v3gIwfkpyfkbw1y2FIaApU9 HHQoK45m9AlDkpDZrLhM59i8clNz5bQl16hMIGG2iaIqi+Mx1N8M+BWNJGSWQQf7K+ tfFVNgYdqKOtA== Received: by mail-lf1-f47.google.com with SMTP id i25so11916448lfg.6 for ; Wed, 15 Sep 2021 18:32:54 -0700 (PDT) X-Gm-Message-State: AOAM531EDSHL3EidWrCGLIz+DGx+LESbQwjtD/YMiJikR7YDB6esy3Cf MnHVGK0jvVpIz5I3YdbtzV2qWPpl3HWw7eRbLxY= X-Received: by 2002:a05:651c:b0b:: with SMTP id b11mr2599411ljr.72.1631755972643; Wed, 15 Sep 2021 18:32:52 -0700 (PDT) MIME-Version: 1.0 References: <20210911092139.79607-1-guoren@kernel.org> <20210911092139.79607-5-guoren@kernel.org> <20210915075007.GD20024@lst.de> In-Reply-To: <20210915075007.GD20024@lst.de> From: Guo Ren Date: Thu, 16 Sep 2021 09:32:41 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH V4 4/6] RISC-V: Implement arch_sync_dma* functions To: Christoph Hellwig Cc: Anup Patel , Atish Patra , Palmer Dabbelt , =?UTF-8?Q?Christoph_M=C3=BCllner?= , Philipp Tomsich , liush , wefu@redhat.com, =?UTF-8?B?V2VpIFd1ICjlkLTkvJ8p?= , Drew Fustini , linux-riscv , Linux Kernel Mailing List , taiten.peng@canonical.com, aniket.ponkshe@canonical.com, heinrich.schuchardt@canonical.com, gordan.markus@canonical.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 3:50 PM Christoph Hellwig wrote: > > On Sat, Sep 11, 2021 at 05:21:37PM +0800, guoren@kernel.org wrote: > > +static void __dma_sync(phys_addr_t paddr, size_t size, enum dma_data_direction dir) > > +{ > > + if ((dir == DMA_FROM_DEVICE) && (dma_cache_sync->cache_invalidate)) > > + dma_cache_sync->cache_invalidate(paddr, size); > > + else if ((dir == DMA_TO_DEVICE) && (dma_cache_sync->cache_clean)) > > + dma_cache_sync->cache_clean(paddr, size); > > + else if ((dir == DMA_BIDIRECTIONAL) && dma_cache_sync->cache_flush) > > + dma_cache_sync->cache_flush(paddr, size); > > +} > > Despite various snipplets this is a still pretty much the broken previous > versions. These need to use the CMO instructions directly which are > about to go into review, and then your SBI can trap on those can call > whatever non-standard mess you're using. I think you mean put an ALTERNATIVE slot in the prologue of __dma_sync? #define ALT_DMA_SYNC() \ asm(ALTERNATIVE(".rept 64\n nop\n .endr\n", "", XXX_VENDOR_ID, \ ERRATA_XXX, CONFIG_ERRATA_XXX) \ : : : "memory") static void __dma_sync(phys_addr_t paddr, size_t size, enum dma_data_direction dir) { ALT_DMA_SYNC(); /* future cmo codes */ } -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/