From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB7B8247280 for ; Sat, 25 Jul 2026 14:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784990058; cv=none; b=FiXox4i1+quPpacYH4E+KL5iYoWFDFuEWPruP7lpxEt2+ADliJW1k6ylJUcZ4sKD5oWsqBrK1iwYgQ2xSE2fz1kcCurHNLTwhHud8/xGwKjOevE3AdPqX4C5922lW1RXoZ0cAaGQ6wYwbl8h0uPuzBmkwl96vRzv8Lm2SkUQ/MQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784990058; c=relaxed/simple; bh=YvPY+TLfnAZJLuA11fwmu2rvBC8Nt5tUSqw5kT8WiQI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rAzWMN77WtpuQMkJSIqPVo9L1Dq31jraV2s0XprxQrDz8kjR3qfRRperWtZEG5D4TAb12Sl7S3mPFeu1G4l8qioGeMAuWWAy055+bLtvPM7kBxyU0jsaeDuADahdUX8Y3sPkV5rKgTvH4IjLtmZ7vIOQ/Jgfio4o7KR+ujEyaV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=XUMaulVM; arc=none smtp.client-ip=209.85.222.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="XUMaulVM" Received: by mail-ua1-f51.google.com with SMTP id a1e0cc1a2514c-977310532a7so1662779241.0 for ; Sat, 25 Jul 2026 07:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1784990056; x=1785594856; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=vD91S1DbebApVBCN527t7AaQw07MlhokwGC+vI5FhsI=; b=XUMaulVMriK2c49kk4iystDShc7ivllItiMlNvFoalQdNBdfzKDkDGPCnY6EeP7xpI XmqYz8snPcYjC4JiXgSohd3oF09yMaWPyJkBLCkOWOIxemVv2Pzx3MCa2mUnHu+8G99j fr2GPkbN7fsdj99DAoVvfCnRtaHMhrD9IHciay+cqpzLH1BV4FJKXdrfeoT1SAh43hZY YyB0RnMxkMTXSsCsTOHtwTCjaYNAKljLz4YCN+Su9JqL6Nb21FyJYIeR74Q2i7I53C04 v++1ASZmuN0o4TMyX9sPhUo1o/tD1gPp+RWA8NtJ1nHZP5krs0DelwvFgEG6Ql1NYsD0 g6Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784990056; x=1785594856; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vD91S1DbebApVBCN527t7AaQw07MlhokwGC+vI5FhsI=; b=M4Sm2zBl3QmPHo61euygHXD+g7NOCcLR+y+vLpZCGvW2/MLyeutCtDus3lkoAhkTSi C0Q2vmRG7AaWPXNbtQ/DFl7usXRaZzhj9H6NL8foqNB49blv4WEf02jlR9x1RBap/nqx HswaMREewFpneIFhs5+qD7zQSn3Epgf8IfJie1WRu2F442TVqCA7nnbX0vp+7LwfeDj5 8e55EO5OUtfRcL+BqHStWWbfyqYfxOZRVsfgbh0DGnYwQLXSHk1gYgztUugJuK3KbJ6O ky/kF/rmLyqcQNBuQUqZGKSvDeULVhvNJlsmlFLk2Ytjk4aAAxPcWoZQBBqMqzt8iSRl fOOA== X-Forwarded-Encrypted: i=1; AHgh+RqfJf6KP5dVBorEjAUkgjIZglKHKOYa0LBuTmnTWJey4J1ubG9G/o5xxzC8Gyo0h5cb4YPlzKcWMaRmsWk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/7Rg+dMTPg0QN+d/236G4z/9G5usAzYEYGGw9sKWYjhKwfJpN nPKa8nFTHwH32TLtE+HIVyc+OrHNprim4wM0I9tsiBkHcpoaXWFUkAUO002Ys5LUTQw= X-Gm-Gg: AR+sD12IOjepQIrvA8iz894oenGGQ4aOFDr69PiMmFr6cRKdLk6FCpu4duId1fCw6b/ YPsTZx2NLVZvxMK8n2nO8kSIVknj7SfH0YeRAF7EjfZp49aZG7yWLaZf9B9aW/uO7A5gNUuYc+h it7bArqwBxI9S6N7MN/1IYaauk3Fr2+r6fK2cOjUPbIiMf9dxzlTKe+Yqzf9GAvHTa9qZhjXRVA Y+R6HZiJPP+uY71MKjyi08th5MCRyDm/xT6bYK6EMiIcABQIg2pMsiyI5p6k5meFgHeyc2bQpeE AjlpCGOZdFgSxEJIs2gq/gmhAOG/ObqUWHmG0LIgWJd6h9iUwg7edGwXTsFsj4LVqN+flrs6DUQ JAOkDWgWxcyoW7PhbCzBdXKJlQ3swhK1nVWwyN1YuX6zCwzvd4uh5 X-Received: by 2002:a67:fd76:0:b0:744:d517:b0b0 with SMTP id ada2fe7eead31-74f9f02b7f2mr2159251137.10.1784990055747; Sat, 25 Jul 2026 07:34:15 -0700 (PDT) Received: from ziepe.ca ([12.18.163.234]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-97774f12690sm1878229241.12.2026.07.25.07.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jul 2026 07:34:15 -0700 (PDT) Received: from jgg by NV-9X0Z6D3.localdomain with local (Exim 4.97) (envelope-from ) id 1wndS7-000000000hU-1YTd; Sat, 25 Jul 2026 11:34:11 -0300 Date: Sat, 25 Jul 2026 11:34:11 -0300 From: Jason Gunthorpe To: Leon Romanovsky Cc: "Aneesh Kumar K.V" , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, Robin Murphy , Marek Szyprowski , Will Deacon , Marc Zyngier , Steven Price , Suzuki K Poulose , Catalin Marinas , Jiri Pirko , Mostafa Saleh , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , x86@kernel.org, stable@vger.kernel.org, Michael Kelley Subject: Re: [PATCH v8 01/23] dma-direct: return struct page from dma_direct_alloc_from_pool() Message-ID: References: <20260717180442.110954-1-aneesh.kumar@kernel.org> <20260717180442.110954-2-aneesh.kumar@kernel.org> <20260721115456.GI110966@unreal> <20260721142921.GN110966@unreal> <20260721153321.GO110966@unreal> <20260723075704.GC110966@unreal> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260723075704.GC110966@unreal> On Thu, Jul 23, 2026 at 10:57:04AM +0300, Leon Romanovsky wrote: > On Wed, Jul 22, 2026 at 04:59:12PM -0300, Jason Gunthorpe wrote: > > On Tue, Jul 21, 2026 at 06:33:21PM +0300, Leon Romanovsky wrote: > > > > > Something like, but probably void* needs to be phys_addr_t: > > > > > > static inline struct page *dma_phys_to_page(void *addr) > > > { > > > #ifdef CONFIG_DMA_DIRECT_REMAP > > > return vmalloc_to_page(addr); > > > #else > > > return virt_to_page(addr); > > > #endif > > > } > > > > I don't like this, we don't know for sure the addr will be in a vmap > > and this will fail if it isn't. > > Of course we know. The existing "#ifdef CONFIG_DMA_DIRECT_REMAP" is > relevant for addresses acquired from pool. Yeah, but I still don't like it :) It is hard to follow if you make those kinds of leaps, someone will call this new helper on something they shouldn't > dma_phys_to_page() is a bad name for some low-level conversion function. > It needs to be internal to DMA logic, in the level when we convert from > phys to page. I think we should not convert from phys to page, that's also easy to do wrong Jason