Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1872405ybl; Thu, 15 Aug 2019 02:41:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeE0J47D30dGoNb7BawDUUrDSJ3swmlUjF6xn1r4gmM0tN5xEtn05ngg95DwPlPhuzFzHd X-Received: by 2002:aa7:8602:: with SMTP id p2mr4492512pfn.138.1565862103014; Thu, 15 Aug 2019 02:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565862103; cv=none; d=google.com; s=arc-20160816; b=n12JaFIGleWLUwsLDmu2R5HC+umWCQr7bT57u0ta32TKzINzykhoucpw27KC/CvW1t K+AJ3+h3Guexoo6mZDeemusUbV3aT4HLlXP9443WhTWfWXDSGvVQ3YJve2vZy0tv1wpW hYc5SC1S3hRdKLgd5krHypKcp/x4n97lTR5ijw28e0g1TCB2tXB4TfuerUVEjqXxXULs tiYL9AB3P4Un8RlJHskEog9B1w01mDm8j1CdflykKxOdmpmVEphogkwvL3Fi4GbaDEbx 2kzd5k8+dNo5RRhNWYmuxLf9xKBBBtlYoyavqq0iisC5YqS4vtcQ2A04wyZwqsisvgoD rdXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=6KD+T5gfUR3wuFwYav+2+N69HmMIo+T3YUJGgq+xdDU=; b=OaddFK0IhmADR9/DXVw8IgWGFxKEeZ8UiDGgfsa1ehG14vHRmvVCP0hAKJ6CenPkEk O7cIF9il35+/FZiLSaSD8jfa0feRUHQJ2QQsaYwBf5WMoMV7+oJUy1L9v40OxslV5Bc9 wOD3J6Gsu6tIt2cEs+mJFIAD0H6Ankqd7GR1V4qyR+1v4pwzZAxE8BJRUgEJZ4ny5h8U tL1YBnn6mRLSgAN2Cc6LZ5fYOfobMYN/3JfN+s9UGBbAOBo2irjmGF4e9za2HyjRkmy4 JNquDQL1vyuENDEd5j+cVTb93B70Y6XOj9oOHNPuwPCTiF+rypoTE8NbkFzrtvKb4L9p 4ZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=txS1ipMi; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=OlWfXIG7; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f185si1713298pfg.47.2019.08.15.02.41.27; Thu, 15 Aug 2019 02:41:43 -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; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=txS1ipMi; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=OlWfXIG7; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731380AbfHOJ0I (ORCPT + 99 others); Thu, 15 Aug 2019 05:26:08 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:36126 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730346AbfHOJ0I (ORCPT ); Thu, 15 Aug 2019 05:26:08 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 8AEBC8EE1FB; Thu, 15 Aug 2019 02:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1565861165; bh=ChiJO460CwqJr6bCz/k4RtKNXSI3O1ZZt8g3+Id8X0Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=txS1ipMiR7CUHSlUoHY7Yr340RD45sludbWwlFZbAST/wJTgB93X+NH4hXMHmM+sf fNgzpuZSnLQC7esRTxpsajyQxQCp08OzyfabL7vdCWupMwcui8U+xdDnveqEPNhWv9 Z8o5cDslbreqbUwKWCvykOv3uCBIKZbKtc9/CFHc= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xdeaREgeheqG; Thu, 15 Aug 2019 02:26:04 -0700 (PDT) Received: from [192.168.1.74] (host31-48-63-146.range31-48.btcentralplus.com [31.48.63.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 68D8F8EE0BF; Thu, 15 Aug 2019 02:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1565861164; bh=ChiJO460CwqJr6bCz/k4RtKNXSI3O1ZZt8g3+Id8X0Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=OlWfXIG7zOd1sAz8WOHgBIsq+CjD6O6sa7mniwoVsb5xfY6YsyfecX180meWmNBEE AScnlELkp6geKt+seKwyCwqWGyxc9X+k5anMN1Vuga1ATt8Sq1gJxaFt33pFzZ4vBU rFECwrGGAhoFxx6qCn0IkP2mtfuU8za0Eta3XNl4= Message-ID: <1565861152.2963.7.camel@HansenPartnership.com> Subject: Re: [PATCH 7/8] parisc: don't set ARCH_NO_COHERENT_DMA_MMAP From: James Bottomley To: Christoph Hellwig , iommu@lists.linux-foundation.org, Marek Szyprowski Cc: Vladimir Murzin , Takashi Iwai , Helge Deller , Robin Murphy , Michal Simek , linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org Date: Thu, 15 Aug 2019 10:25:52 +0100 In-Reply-To: <20190808160005.10325-8-hch@lst.de> References: <20190808160005.10325-1-hch@lst.de> <20190808160005.10325-8-hch@lst.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-08-08 at 19:00 +0300, Christoph Hellwig wrote: > parisc is the only architecture that sets ARCH_NO_COHERENT_DMA_MMAP > when an MMU is enabled. AFAIK this is because parisc CPUs use VIVT > caches, We're actually VIPT but the same principle applies. > which means exporting normally cachable memory to userspace is > relatively dangrous due to cache aliasing. > > But normally cachable memory is only allocated by dma_alloc_coherent > on parisc when using the sba_iommu or ccio_iommu drivers, so just > remove the .mmap implementation for them so that we don't have to set > ARCH_NO_COHERENT_DMA_MMAP, which I plan to get rid of. So I don't think this is quite right. We have three architectural variants essentially (hidden behind about 12 cpu types): 1. pa70xx: These can't turn off page caching, so they were the non coherent problem case 2. pa71xx: These can manufacture coherent memory simply by turning off the cache on a per page basis 3. pa8xxx: these have a full cache flush coherence mechanism. (I might have this slightly wrong: I vaguely remember the pa71xxlc variants have some weird cache quirks for DMA as well) So I think pa70xx we can't mmap. pa71xx we can provided we mark the page as uncached ... which should already have happened in the allocate and pa8xxx which can always mmap dma memory without any special tricks. James