From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 BA219353A7E for ; Mon, 13 Jul 2026 19:25:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783970706; cv=none; b=qcsanhx0qzgjEcXIr92tBsmsajm8StC1Ef9J4miXt/8vxZIA5xR6tJlafolLqNo2q4OytinLMlZpQpMBSp1lwEue5s9jp9teycbCNZCkKFQl5HZh3MyOwNEPJeAOzzlg7GtgP40779xI7+DrYhnxSE3+2qmKfsA5pjL6A+Zxisc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783970706; c=relaxed/simple; bh=kHNC6GKxK3Oa0yY2t9YDWJJoMMfSAWNNMKsiuCwI/8Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O4at+rqIlUWyWjmKVl6rp0ukHeikq03j3orMDZqPYpVR5QInLv028kECoTvUAXFYDcgzb/jOFOAILRfTXX1+9mBI7VUlB1CItPxFbdKbp11+E9m+M3FwzqJEHnhxnE9ExM1lZ8IhO6l4PcYgIGUt1992RnLNgb4wFDDRVEC6Gxc= 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=G38VB55r; arc=none smtp.client-ip=209.85.219.47 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="G38VB55r" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-8efec2c28f8so1580676d6.2 for ; Mon, 13 Jul 2026 12:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783970704; x=1784575504; 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=2kWy2240zOoLDDzwtKisgk31mZ51kjxw8fZyoUW4j0E=; b=G38VB55rczL+HtL37bAUlUAettcihLt8qw6IsSvTED/EB4k6c1rfaN6bxrCXj+zG7t DlpxUo2efzT7g9i6Sdr7GGswN524GurYxz0IJ4yKzh8ugLcJsMaP1paKJYg+0+qUM02y kNh9ehHuxBOpuxmnYJTG6V6gnHseXk9P+D0D/SaqZp+kMDY582RSGsG09PRUEbqhlHls MyH0BbkF7gujhewYW7gPfSjJ6h7L4P3z31F9S+QewRVTP32Dtscjc3DW4oBMWXHhd+Il f0RIfBvaWgXY4GDt+QPb9HzdnhXUr1p/b2HVetn6BCKL7RdR6yYvj3TNYdbvPw/4rPZ0 KCdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783970704; x=1784575504; 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=2kWy2240zOoLDDzwtKisgk31mZ51kjxw8fZyoUW4j0E=; b=awIgkHCYl+UKZ5+/bPJamYmVeFFR47yaUz2hKtwVP85Bzls4bahEidTSKbJEV+GX3I qXQHGsy70l+SDUeBFzo6A5GJd76phIKaHopKYqsLIG62rzuu/8AZ1jDtZVT8LkGxiwAa abv9Pl5b0rWAgqSWcwb5NbXLwKbBqMj4Tg7GBmCZoqn1spTgi0A5iGDf/J85osO7bxcX fdw7/KmRtxYvpdsNkvU4V2kDEHTtC1BJ4eeUM5Y9G+/Fd70db7e4SuTn8F5h7L3ywFxp U2p50U0CteesvSFnGRP/Q4FqAG2jewEp89e7Nhj+dyLBBSQKpLFNrQIOVh4br5godRen LgFg== X-Forwarded-Encrypted: i=1; AHgh+RoyegUke8OwdTPbj0ziav8K+jsjOKLxwvfbSvdYpKMWdh4LtC/qcSsIAfUQ3S2XCBhZ+qhALIrgQw6owfs=@vger.kernel.org X-Gm-Message-State: AOJu0Yww0z6VnNoVozXFPaIgPpfYAZ4LLQIgT10vir3LfvF8/ynANGVB Yk9BbgEom1yVCD5oUpHKUiJbpOo8XpZwMHGnwhUTAyUJlPx6z2vI3XNm3yJQhnK6pUY= X-Gm-Gg: AfdE7cmAzD6cPZIVVgIqDCLZzM3yF8lKhhjA1BYG+k3JU4HsigYYd+37wGPGU1V7iYV jd0XTrN+pf9AB4SPjnKmnDC0qAhtE78j1AWa12o0sUDYyq8IRoMGSuzS1Bir9/Q8rAIdRnpDADi lHavMwdLdx8/PEkAdmAV1y+BkH4NgLhGL2alXRM/wIkmZY/HEhgCh/ab7CPH6KZxKObfTSXTj8S XBbnBK9iBxbeC1/OIYXR8h9UiEk8pmJPNghcj/Db9zoNhC4dc7Kbyl1z0KNgeaUtMlXhDrDUwtJ VTvq59E3QMqZCL/W5/BnGqaypAIQjH4uHydRcvdPmi3zJFpc70TztrE2/e6F6DZ2PiD05SBZTYN ph/WfOvgdYywyWsF29YWUdzPn1rWxQxLd5CSOJNUkBgXTKtjmTzDE5CLLDXMA X-Received: by 2002:a05:6214:2f8d:b0:8ef:76c:cb18 with SMTP id 6a1803df08f44-903fe450e81mr122377626d6.11.1783970703547; Mon, 13 Jul 2026 12:25:03 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd7c1da1bsm137170026d6.30.2026.07.13.12.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 12:25:03 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wjMH0-0000000E5NW-1O3S; Mon, 13 Jul 2026 16:25:02 -0300 Date: Mon, 13 Jul 2026 16:25:02 -0300 From: Jason Gunthorpe To: "Aneesh Kumar K.V (Arm)" Cc: 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, Jiri Pirko , Michael Kelley Subject: Re: [PATCH v7 13/22] dma: swiotlb: track pool encryption state and honor DMA_ATTR_CC_SHARED Message-ID: <20260713192502.GS3133966@ziepe.ca> References: <20260701054926.825925-1-aneesh.kumar@kernel.org> <20260701054926.825925-14-aneesh.kumar@kernel.org> 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: <20260701054926.825925-14-aneesh.kumar@kernel.org> On Wed, Jul 01, 2026 at 11:19:17AM +0530, Aneesh Kumar K.V (Arm) wrote: > Teach swiotlb to distinguish between encrypted and decrypted bounce > buffer pools, and make allocation and mapping paths select a pool whose > state matches the requested DMA attributes. > > Add a cc_shared flag to io_tlb_mem, initialize it for the default and > restricted pools, and propagate __DMA_ATTR_ALLOC_CC_SHARED into swiotlb > pool allocation. Reject swiotlb alloc/map requests when the selected pool > does not match the required encrypted/decrypted state. > > Also return DMA addresses with the matching phys_to_dma_{encrypted, > unencrypted} helper so the DMA address encoding stays consistent with the > chosen pool. > > Tested-by: Jiri Pirko > Tested-by: Michael Kelley > Tested-by: Mostafa Saleh > Signed-off-by: Aneesh Kumar K.V (Arm) > --- > include/linux/dma-direct.h | 10 +++ > include/linux/swiotlb.h | 10 ++- > kernel/dma/direct.c | 13 ++- > kernel/dma/swiotlb.c | 177 ++++++++++++++++++++++++++++--------- > 4 files changed, 162 insertions(+), 48 deletions(-) Reviewed-by: Jason Gunthorpe Jason