Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp647250yba; Wed, 24 Apr 2019 07:24:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXoLn/jx+DqdoxBbhWdu8uhf77kXxUQI6O5jK67d53wE4GSSh39ahIHYOZs0eaKxUU5Y7U X-Received: by 2002:a63:f012:: with SMTP id k18mr31670288pgh.433.1556115886284; Wed, 24 Apr 2019 07:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556115886; cv=none; d=google.com; s=arc-20160816; b=G8L+h46p7lfFxVbTWkpmX4O7qXdSmk62nbgYgVMdTAy8ImDDe2NgDofVNXaimW0AjN ASPfJ3SzAdlk3I3wbPU4epw+DDDup30VrlsozXccxuF8tHgD4ILfEWhy4VrJf+eLPuQG E8VKyhbQRpxBmgyvBjC2GcZ/lNMDxRKLacYBN3aPCCPuMsaUH4La5WfXOYpduglxaSg4 5Kd/jjibIRoRu7vVMlUIvY+fnhMmOPClyIkU+a+qsczwwiePVjiFDI4Q8b6OVobLxxD7 Ku2lnwhA8+c3CzCtGCkIJ56XFgPktp/lRPHYeu5Boz9HxyOXulMof/o5jl1GVB2rUYYj yPGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Oz2jd3cMcRMoxuS0HdZuoFGRPIbMm6EK9sRpMdoLTio=; b=j94u06eFWFN1dg9f2kRhGmVCN/ApH2B7vfdRP56GR90Kp3r9OMlxxMFPbdhjKlLKsQ NwdtzRsaGYOu0DkDcISuWURh5ZX2GehM7xZoWzXdvYdpkFp7n5ixaPJuf6cen83BIXZp LAfv3uKHi7jCLNzxndPZH8pLNdfq7/6iwtCwwFcbD2at5rgvE8mLcJxAFxW1emsJp7ue yiJHQ3wC3z/GSZz74FfYGK8Z2CWFDxYy5s6Z0ud9FevxEOuvGg/3aa0kJ++Z9xkbbf3A 9LO5BLr5qp+VFCa9XglFb8sEr32wk2SoSUl0qtQRUSnob2U2bDfKjoBE6QTjTQTW1x7g iMjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14si587351pgg.336.2019.04.24.07.24.31; Wed, 24 Apr 2019 07:24:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730459AbfDXOXZ (ORCPT + 99 others); Wed, 24 Apr 2019 10:23:25 -0400 Received: from verein.lst.de ([213.95.11.211]:54144 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbfDXOXY (ORCPT ); Wed, 24 Apr 2019 10:23:24 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 1B95967358; Wed, 24 Apr 2019 16:23:07 +0200 (CEST) Date: Wed, 24 Apr 2019 16:23:06 +0200 From: Christoph Hellwig To: Gary Guo Cc: Guo Ren , Christoph Hellwig , "linux-arch@vger.kernel.org" , Palmer Dabbelt , Andrew Waterman , Arnd Bergmann , Anup Patel , Xiang Xiaoyan , "linux-kernel@vger.kernel.org" , Mike Rapoport , Vincent Chen , Greentime Hu , "ren_guo@c-sky.com" , "linux-riscv@lists.infradead.org" , Marek Szyprowski , Robin Murphy , Scott Wood , "tech-privileged@lists.riscv.org" Subject: Re: [PATCH] riscv: Support non-coherency memory model Message-ID: <20190424142306.GB20974@lst.de> References: <1555947870-23014-1-git-send-email-guoren@kernel.org> <20190422161814.GA30694@lst.de> <20190423001348.GA31639@guoren-Inspiron-7460> <20190423055548.GA12365@lst.de> <20190423154642.GA16001@guoren-Inspiron-7460> <20190424020803.GA27332@guoren-Inspiron-7460> <20190424055703.GA3417@guoren-Inspiron-7460> <4e6b0816-3fe9-8c0b-a749-f7f6ef7e5742@garyguo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e6b0816-3fe9-8c0b-a749-f7f6ef7e5742@garyguo.net> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2019 at 12:45:56PM +0000, Gary Guo wrote: > The RISC-V privileged spec is explicitly designed to allow the > techniques described above (this is the sole purpose of MSTATUS.TVM). It > might be as high performance as a hardware with H-extension, but is > definitely a legit use case. In fact, it is vital for use cases like > recursive virtualization. > > Also, I believe the PTE format of RISC-V is already frozen -- therefore > it is impossible now to merge GLOBAL and USER bit, nor to replace RSW > bit with another bit. Yes, I do not think we can just repurpose a bit. Even using a currently unused one would require some gymnastics. That being said IFF we want to support non-coherent DMA (and I think we do as people glue together their SOCs using shoestring and paper clips, as already demonstrated by Andes and C-SKY in RISC-V space, and most arm, mips and ppc SOCs) we need something like this flag. The current RISC-V method that only allows M-mode to set up such attributes on a small number or PMP regions just doesn't work well with the way how Linux and most non-trivial OSes implement DMA memory allocations. Note that I said well - in theory we can have a firmware provided uncached pool - that is what Linux does on most nommu (that is without pagetables) ports, but the fixed sized pool really does suck and will make users very unhappy.