Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp549818pxb; Tue, 14 Sep 2021 03:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr23M7+v9GHonmfhGhdV3q8heM4dKGYDQ0Jc6ojQyJK/YVObDWbEE2+kY2dzlboOP6fQzm X-Received: by 2002:a6b:d209:: with SMTP id q9mr13325532iob.206.1631616250394; Tue, 14 Sep 2021 03:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631616250; cv=none; d=google.com; s=arc-20160816; b=qe6H99tF8V47GHaCL7nviUsipcQ+uy8PWjJy7FjodP8UnNDfBtgrqFhLamIR/O4RT+ Aeo0oLFRt6S6cHM9+8UGh8w4yx9oHXEHibcUtYxDF/PFFy7bqROPUJLgeL5WF1aRypuX C7aUJZnAJh/EfOQwGU1LEN00PJuVw6/uBaZJLs6GP1BtTGgMfk4RVROLDqjJD1/wgnmd H9GebX5wdsdi8If/nki/b9hEjU8zRKYdLw9IVqPu/pgGkTN6zYUiJzlj7MBhCTIgVKz8 aF1grzn6WYvLYGZ9neJlk+s3S+s+FPXIOZCqpPLEwScLXg6HREBUo9LyTDFSacwlBbs+ GYpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=uMMsiLqTcNj2knOY1fDgmzBGsyixaACpTSrDNyps9PM=; b=KdmQKtHHOngGTSuU6l+Peu4u4kNRSWkxrsjk02tAtMnGiXTZ2KQWkedoyha7MtYMaY q7KPWvzdmFNyzkxVRqeSLOn/Akf7sIKByTEOPM6IixmNMRl3jq+0gtSzlZJbuAW28d7y DiEW/+9yzD31rar0eypMrJ49em5lOs9SCrJf4B+7HB4e+DcXKB0J5DI9KjzMKF6rRJSh k/fkaO2cA5V9r38iP7t8E2aGQLap8z1uPZ5OHrk2ibkjpQ1n+7ocYnO4ZIHJHHXox7Cm +hSepiUXoZCpjdcsqsCmPuJTjMdTgR9aVMumcN8DAzjQ3vQtZh1/8msodh1Au7rVTeVZ Q/KA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si8166727ila.78.2021.09.14.03.43.58; Tue, 14 Sep 2021 03:44:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231829AbhINKoS (ORCPT + 99 others); Tue, 14 Sep 2021 06:44:18 -0400 Received: from verein.lst.de ([213.95.11.211]:59690 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231941AbhINKoQ (ORCPT ); Tue, 14 Sep 2021 06:44:16 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id A8D3E67373; Tue, 14 Sep 2021 12:42:56 +0200 (CEST) Date: Tue, 14 Sep 2021 12:42:56 +0200 From: Christoph Hellwig To: Andreas Larsson Cc: Christoph Hellwig , David Miller , sparclinux@vger.kernel.org, Sam Ravnborg , linux-kernel@vger.kernel.org, software@gaisler.com Subject: Re: [PATCH] sparc32: Page align size in arch_dma_alloc Message-ID: <20210914104256.GA14645@lst.de> References: <20210908074822.16793-1-andreas@gaisler.com> <20210909060712.GA25485@lst.de> <3a653ab5-14d2-f61f-cb0a-cbeba93b4ac8@gaisler.com> <20210914061705.GB26679@lst.de> <87971ad4-9519-cf0d-76a8-6baa253d0122@gaisler.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87971ad4-9519-cf0d-76a8-6baa253d0122@gaisler.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 10:51:51AM +0200, Andreas Larsson wrote: > On 2021-09-14 08:17, Christoph Hellwig wrote: >> Thanks. Can you take a look and test the two patches below on top of >> your fix? A git tree is also available here: >> >> http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/sparc32-generic-dma >> > > In a quick test, this seems to work on LEON for code paths previously going > to arch_dma_alloc and arch_dma_free. However, this makes setting up these > DMA mappings to not go through sparc_dma_alloc_resource, and it seems > important that they do that on Sun systems. Hopefully, someone with more > knowledge about that could chime in here. Does the hardware actually care about it? The only thing it does is to force allocating from a specific virtual address range, but how would that have a special meaning? > The added pgprot_dmacoherent is problematic as it sets SRMMU_PRIV, which > sets up kernel access only. This was fine for arch_dma_alloc that sets up > kernel accesses only, but for user space DMA mmap this would make them > kernel accessable only. Having no sparc-specific pgprot_dmacoherent, > keeping it to default to pgprot_noncached, is probably better. I've just tried to keep the existing attributes. If SRMMU_PRIV does indeed mean that the page can't also be mapped into userspace page tables it would be good to remove it in an incremental patch. If OTOH it only means that this PTE is a kernel mapping it should not affect a userspace mapping as that will always use separate PTEs. > > -- > Andreas Larsson ---end quoted text---