Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3082803pxj; Mon, 7 Jun 2021 01:37:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzpv2lDP1JklqSSy5uAPYJ31c5yZHWhy8JiyOImXSz18Gmiot6muE7HdGj2q7inxBux5zX X-Received: by 2002:a05:6402:1592:: with SMTP id c18mr11917662edv.2.1623055067807; Mon, 07 Jun 2021 01:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623055067; cv=none; d=google.com; s=arc-20160816; b=CoxWTXDIdi0/l955tcxXERvmxxxCobEnLRnuOd0s/txZjmW1UprEe1IJVxZc1BfW1g R5sv0WS/X/fCxmnd+/DZO2cBYERfcMT/YHL5V4+DlpbyU8N5gazDYNMslLEIlcl4Nw1W n7J+jUGIVnuGGFKllZA9N0m3GjQQTTCWS+09usBuPXAgwDrVwJ+irJ1yIvjhoi/SOUSp zWI/lU0QCtrWz6CdMhHJi3q8Aub/aUBGnjWnIGjB1YGr5YAvQRekK/hSEPHNM/oOotiM kpzYvAw1AUcpTs+Ja/uRXn6No742hW8yqWZDKeEIQD3sBu5gGKamYBNowqxwpu682tlb /sRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :organization:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=k+EaaBVJ5SZF52GV6QZldsE7s1ESsN0x0MSxSfZOaKQ=; b=waq7FUMWuyO5Q32ClCYZ7shDfGTxddNSWUcbid8ot+SVQRh5NxJlgJRRhOlcKLBP7i Rpy9vbagY5+2cFLiTyBHs8r8802pwQvMVx642TEHfrXr6UdUQM7EwL/22aV/admO+mqc 5Utk4BSOgb5RWYUb4dkdT7JDposJOBuD8hvrGZxnPbsaeYypKzPC0SaOV/MdeyCtcpfc 3CMgOOK+2GFj6wLwnk9KbFgsrHJLI1ceSZ1mtaFyNZ76kE5JDpZ/UhfwaGMKKIwZ9K17 b2Lm2lJ0yDeh4SiaOBT+Ol/fTFTRQU5GLQG6/LMejVXqCNOCO21DqaRbDHM6QdT3DGMM v37w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@ics.forth.gr header.s=av header.b=bG9eFawA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ics.forth.gr Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc38si1161916ejc.36.2021.06.07.01.37.24; Mon, 07 Jun 2021 01:37:47 -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=fail (test mode) header.i=@ics.forth.gr header.s=av header.b=bG9eFawA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ics.forth.gr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbhFGIhz (ORCPT + 99 others); Mon, 7 Jun 2021 04:37:55 -0400 Received: from mailgate.ics.forth.gr ([139.91.1.2]:40720 "EHLO mailgate.ics.forth.gr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbhFGIhy (ORCPT ); Mon, 7 Jun 2021 04:37:54 -0400 Received: from av3.ics.forth.gr (av3in.ics.forth.gr [139.91.1.77]) by mailgate.ics.forth.gr (8.15.2/ICS-FORTH/V10-1.8-GATE) with ESMTP id 1578a10X075206 for ; Mon, 7 Jun 2021 11:36:01 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; d=ics.forth.gr; s=av; c=relaxed/simple; q=dns/txt; i=@ics.forth.gr; t=1623054956; x=1625646956; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=U2J+Ype/9wfTlT1A3imO+PgEUuLf+/IqrknC2YO9Ouw=; b=bG9eFawA/MiBh1Ajgsjq8Jb319A0IeZOVL7YWEF+8upJj7Op3XKkQiR6LUOOYFeV pzz2evNRRJ4oXxegB4le1VP+rDitLomkFYl8tZ3m4WOd5+9DUBfR5Kd2Ez4A9wax DyPndqwcmtdP/b3WUT055Z2UscW58fs7smtY+GwGsnsIrYNKGcJMCLxKMzBCUU7k rHestxfq3/fEtn+o3KpY1gQ97Igkvt8gq5pvQttpLsB5f3cgrB0h9J9RdPOeMRmr O9FZSATzQzZF4Aepjn0sW7FM0tsqHW//ykdK4b4gI27+/WnJi0q22JTq2lpSB6Y8 hOCec2Kz+PIKGrxqoPr4bg==; X-AuditID: 8b5b014d-962f1700000067b6-37-60bdda6c6f6f Received: from enigma.ics.forth.gr (webmail.ics.forth.gr [139.91.151.35]) by av3.ics.forth.gr (Symantec Messaging Gateway) with SMTP id 52.7F.26550.C6ADDB06; Mon, 7 Jun 2021 11:35:56 +0300 (EEST) X-ICS-AUTH-INFO: Authenticated user: at ics.forth.gr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 07 Jun 2021 11:35:55 +0300 From: Nick Kossifidis To: Guo Ren Cc: Nick Kossifidis , Christoph Hellwig , Drew Fustini , Anup Patel , Palmer Dabbelt , wefu@redhat.com, =?UTF-8?Q?Wei_Wu_?= =?UTF-8?Q?=28=E5=90=B4=E4=BC=9F=29?= , linux-riscv , Linux Kernel Mailing List , linux-arch , linux-sunxi@lists.linux.dev, Guo Ren , Paul Walmsley , Benjamin Koch , Matteo Croce , Wei Fu Subject: Re: [PATCH RFC 0/3] riscv: Add DMA_COHERENT support Organization: FORTH In-Reply-To: References: <1621400656-25678-1-git-send-email-guoren@kernel.org> <20210519052048.GA24853@lst.de> <20210519064435.GA3076809@x1> <20210519065352.GA31590@lst.de> <29733b0931d9dd6a2f0b6919067c7efe@mailhost.ics.forth.gr> Message-ID: <7347df23102503c77c5da10b48afcf9a@mailhost.ics.forth.gr> X-Sender: mick@mailhost.ics.forth.gr User-Agent: Roundcube Webmail/1.3.16 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsXSHT1dWTfn1t4Eg2k3ZCyefJjIZnFvxTJ2 ixd7G1ksjj/axWKxcvVRJotLX66xWHTs+spicXnXHDaLbZ9b2Cym7NvFZnHx13xGi+Z359gt tm5cx2jRNovfYtbi2+wW99edY7No2T+FxUHQ493vZYwe994+YfLYOesuu8eCTaUeDzddYvLY tKqTzWPnQ0uPX9uPMnlsXlLv8WLzTEaP3Tcb2Dze77vK5nGp+Tq7x+dNch7tB7qZAvijuGxS UnMyy1KL9O0SuDIevN7MXLCCr2LDk7usDYzruLsYOTkkBEwken4fYOxi5OIQEjjGKPF26kEW iISpxOy9nYwgNq+AoMTJmU/A4swCFhJTr+xnhLDlJZq3zmYGsVkEVCW27twOVsMmoCkx/xLE HBGgmt9HO1kh6j+zSvQ/4AWxhQVsJA5dWQ8W5xcQlvh09yKYzSkQKDFlyh92iIO2skg0HnrL BHGEi8S9Y5tYIY5Tkfjw+wFQEQeHKJC9ea7SBEbBWUhOnYXk1FlITl3AyLyKUSCxzFgvM7lY Ly2/qCRDL71oEyM4Zhl9dzDe3vxW7xAjEwfjIUYJDmYlEV4vmT0JQrwpiZVVqUX58UWlOanF hxilOViUxHl59SbECwmkJ5akZqemFqQWwWSZODilGpgM/5z/5q9dvOFa98sH4Voitq6Rgt8c v+z+EP/fZIswT8CPr6cL9zy+ItomO2HHdAt/1gKzIHOWb1ZR5glfUxNl/rXeChYS8ufz9TTb t/DJ7/VTw9oE3vWcsH7PaP3lyy6ru/xX3Lh5LHeZrSx2UVv+bN2iunVJfV8fdlvP2LtF7yBX 2zP1xJj3wt0WU5inf11g6KNs+4Tb+epUx6qLW3/LHRU/+n3uHqHct7LX/oqv7rn2q7isZqIG c17cGbmPBU+nv5TYm/btnU/u/jOHezfGakt8DDlYufaK8+4Hf89Nmf38xol3/pM31UQlP/Y7 Pyco/oZ4tZLPsYP/3PY90yheOH+l8fTs09PLz/Hd+FFyUImlOCPRUIu5qDgRABsgYjJIAwAA Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Στις 2021-06-07 06:19, Guo Ren έγραψε: >> The C-bit was recently dropped, there is a new proposal for Page Based >> Memory Attributes (PBMT) that we can work on / push for. > C-bit still needs discussion, we shouldn't drop it directly. > You can always participate on the discussion on virtmem mailing list. > Raise a page fault won't solve anything. We still need access to the > page with proper performance. > The point is that future hw implementations will be required to return a page fault in case we tamper with those reserved bits, they won't just ignore them. Supporting custom values there means supporting non-compliant implementations. > > We need PTEs to provide a non-coherency solution, and only CMO > instructions are not enough. We can't modify so many Linux drivers to > fit it. > From Linux non-coherency view, we need: > - Non-cache + Strong Order PTE attributes to deal with drivers' DMA > descriptors > - Non-cache + weak order to deal with framebuffer drivers > - CMO dma_sync to sync cache with DMA devices > - Userspace icache_sync solution, which prevents calls to S-mode with > IPI fence.i. (Necessary to JIT java scenarios.) > > All above are not in spec, but the real chips are done. > (Actually, these have been talked about for more than five years, we > still haven't the uniform idea.) > > The idea of C-bit is really important for us which prevents our chips > violates the spec. Have you checked the PBMT proposal ? It defines (so far) the following attributes that can be set on PTEs to override the PMAs of the underlying physical memory: Bits [62:61] 00 (WB) -> Cacheable, default ordering 01 (NC) -> Noncacheable, default ordering 10 (IO) -> Noncacheable, strong ordering So it'll cover the use cases you mention.