From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 88F7F3AE1A3 for ; Thu, 11 Jun 2026 11:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781178618; cv=none; b=eLWfCpiwaoV71xl/pmpMnA0seaI/HgH9qnIusUcnRtuY5hqD+nrhD333chgYY+E2tp0dKlX0qexjt5c2zuJvkUkrDfDcmM0/rkWHR0GCIdooEY7COwD0qzAxRSQNF29GYPuVZhjB/0HNkKMVJYgjkxXt4jOR+R8VjJAPOH2DgCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781178618; c=relaxed/simple; bh=UmW9Vbd3ZtejVIzFUGtLzNmEE0KC+mhPuzfVyC+exsY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HwbJIz3yzh/QYpZRqlnRgso4BPhsPWJVCnZ9ZErGtufEPIrx3crFXSE8Godh0Nq1c3SBHt4KTJDirZT08N0Hx6Na3BfKh5x9E0SUsjG5FsOTS1zC9FidIjEHKZIhv5UwZOiQ0hhuF7443Si3fDBtL+xO4Q4VpSMWpXxakumtdYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=ePbyMgN4; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ePbyMgN4" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-45ef57256d8so721410f8f.3 for ; Thu, 11 Jun 2026 04:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1781178615; x=1781783415; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=By5jxDRfMhWNJ3zdMqbqgKEuQjBAiR2dgY0SOpXrO1o=; b=ePbyMgN4/p5PmK4IrIrPgzeiRfypzzATrVlfJ+nvzVpSaugbxCQZkx6vHGGa/yZgll D/JOvh+ALQCbHa8WN+inI1G8BWJcJTKFHFz9+MxCvGW8DIWsRWUANJVk0erULeetbZFD Lfz9hW6TVZT6X80ompDUwrPS4WBO6pdTFrDvjfYBDjVo6sehCDp+Ze63D32pTcRqy/eK wMrhxmzz2GHte1+G9srCHpK/60BN039JF1KLjHi2ZBLhhSPTM2BRrQa3At3erAlnPDjv C4timz3+B/wKzV2iwo1cwg2H0YLapiBBCzcN+mqHj7W8MClFjY3pUv+u03rEmXyZzH3/ tD0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781178615; x=1781783415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=By5jxDRfMhWNJ3zdMqbqgKEuQjBAiR2dgY0SOpXrO1o=; b=jag+k9HW6SVCbsfbHdDcS/vJDyl/Ar9yRkGRWYD+bXgJ0JJRaRm/XH3Z/zA+Lv8vOE SB/ExtkOKq0caYLgJwkjPOaZ6ZyOZKqX2a+md5bZ7RfjBbVRPqqPJVVqp3oVjHtq4Gdh lwmprbFXUIO2h6xtAOg4twLBVwY1y5chGaUNawDvwIcS4c6WkrDja3/ZW90IM7TYqAGD XX3dbo96BCYr0r9wKI66gfn8TQK/hdnvqgzQcBcGiWel8X6Rl9s91Bf4Y63LmhrYWNSR sT6P3QakrCIriRZ3IT4AAm31bPre2Di+Xd7zGNgUuN13uAMFnuGJM4VyXtepfV1BFJ8m foVg== X-Forwarded-Encrypted: i=1; AFNElJ/1Zp/oS7BIRTHu/HDulmERl7FPI0Sy0TyT9WgoR6N0pnztStoAxDG9CDDx6pRdcHLO8EsQwWgFERAhtmY=@vger.kernel.org X-Gm-Message-State: AOJu0YzDgiAJmczrrRlB6KPNeI4BtKTq+Cd8WnOB39Q4xdjOKI16u0i5 7W5mwXkQsr0kYpSJJGDvzyhICHTObwUBEhg2BbZ1mNDEDyor+o0LvJvwAZoZuULc5MI= X-Gm-Gg: Acq92OHLLwDDB61XKPTSVyeoW3CZHapt/VvTmKTLMBdzMmEYBd2kSfnVVm23Yf9if1w sVjirdszNAUEwEQauFsYYG1TiVac6S0K6vyrzPzLlrijDiow3YKU2HMRzOwq6n+1ERBxujl6Q6g yZUktiufIuIC6Sdcxhocgqkm1xynAGyXrIK4pnR8Bt5rhXJl1t5GDb2vohfrIBa72q9mUleR6Oc wdyLpCTYUYlUqfLrn3gECbzJIYpzC9qhB7mxg7ffB6aOjmx12nNFLNGHivnkKMLIRdSguanHHhY 27tc0O03ZxKSYfC20a1yDsNVAY7hssjXnDnoYx1o61oDly7fdZ/FITbqYPKNeqjOnp7aC9EQadh n0LBpDgqfwxFiFcAbZ6rZMDnt6ctJaCz0wG6h0xwQUVfv8JH+pz8Chiu40G1NVO0U3NiYKmMGh/ 0SUfAVarh0Fd2MnZJedB83fKtVXUpPDGgCoROuv5WZV2ysGpWCaNfBxOQhgd4wv/NyCgt0u7mz+ o6SecLZFRdAe7PD13RSFqVhOdhHeUiKkYntlg== X-Received: by 2002:a05:6000:2508:b0:460:1bf8:c959 with SMTP id ffacd0b85a97d-460673e3ae5mr1690022f8f.0.1781178614930; Thu, 11 Jun 2026 04:50:14 -0700 (PDT) Received: from mordecai (dynamic-2a00-1028-83b8-1e7a-3010-3bd6-8521-caf1.ipv6.o2.cz. [2a00:1028:83b8:1e7a:3010:3bd6:8521:caf1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f2ed944sm83042430f8f.13.2026.06.11.04.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 04:50:14 -0700 (PDT) Date: Thu, 11 Jun 2026 13:50:04 +0200 From: Petr Tesarik To: Jason Gunthorpe 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 , 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, Jiri Pirko , Michael Kelley Subject: Re: [PATCH v6 04/20] dma-pool: track decrypted atomic pools and select them via attrs Message-ID: <20260611135004.70d48daa@mordecai> In-Reply-To: <20260611113740.GB1066031@ziepe.ca> References: <20260604083959.1265923-1-aneesh.kumar@kernel.org> <20260604083959.1265923-5-aneesh.kumar@kernel.org> <20260609143242.GK2764304@ziepe.ca> <20260611113740.GB1066031@ziepe.ca> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-suse-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 11 Jun 2026 08:37:40 -0300 Jason Gunthorpe wrote: > On Thu, Jun 11, 2026 at 10:55:47AM +0530, Aneesh Kumar K.V wrote: > > Jason Gunthorpe writes: > > > > > The sashiko note does look legit though: > > > > > > if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) && > > > !gfpflags_allow_blocking(gfp) && !coherent) { > > > page = dma_alloc_from_pool(dev, PAGE_ALIGN(size), &cpu_addr, > > > gfp, attrs, NULL); > > > if (!page) > > > return NULL; > > > > > > I don't see anything doing the force_dma_unencrypted test along this > > > callchain.. > > > > > > I guess it should be done one step up in dma_alloc_attrs() instead of > > > in dma_direct_alloc()? > > > > > > > I think we should do something similar to what dma_map_phys() does here, > > considering that we only support DMA direct with DMA_ATTR_CC_SHARED/DMA_ATTR_ALLOC_CC_SHARED. > > Yeah, I think that's the right idea for now.. > > > + if (force_dma_unencrypted(dev)) > > + attrs |= DMA_ATTR_ALLOC_CC_SHARED; > > + > > + is_cc_shared = attrs & DMA_ATTR_CC_SHARED; > > + > > if (dma_alloc_direct(dev, ops) || arch_dma_alloc_direct(dev)) { > > cpu_addr = dma_direct_alloc(dev, size, dma_handle, flag, attrs); > > + } else if (is_cc_shared) { > > + trace_dma_alloc(dev, NULL, 0, size, DMA_BIDIRECTIONAL, flag, > > + attrs); > > But it would be clearer to put the test in the iommu_ functions I > think, since they are the ones that have the issue. We will need to > fix it someday.. > > I think we can ignore the op-> functions, arches cannot support CC and > still use dma_map_ops.. Hm, sounds reasonable. Should we probably enforce this at configure or build time? Petr T