From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 07339357CFE for ; Mon, 13 Jul 2026 19:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783971447; cv=none; b=jalgLxPCNOS7egiV1zXaE/4HQacPN5E44Q9ERyED5GaZBYxQASuoLOxnCWUHfJXVB0deZ7zo2xvh9q7r/MrY16mY8JYcb6LShlowXeDsn5UfO0NcV1wcMBHH7JM3Wr2qQORCUX8c36KGlox3aJ7cCZJpPXVLEzonyhS73jUjurY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783971447; c=relaxed/simple; bh=Xsfi+SO6SJr84aSbkQrUqh5LTCvlYWMyrm0+dQckaBI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nN8WZMJJ4a+rHaZt5hAmN2bxbzus3BvcVFA2y8Js0QJ0VWTOJynHBPR+KNng1fC2PIGDKVI1I0ot/Iq+Kms+CitYCQMZQkNBTs3uhSIFSpS6wGXCQe7y7il8APgT4kZPkp+mnlfOP4uQuEaA7m0E0mFgTUGhX7PSHIaeUyq8QfE= 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=bCH7thWk; arc=none smtp.client-ip=209.85.222.177 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="bCH7thWk" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-92e85499ffbso20849585a.0 for ; Mon, 13 Jul 2026 12:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783971444; x=1784576244; 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=seRQ4x7WCVBDlRNvM1ESoBfWnXSVwL4ZPJ5Cc52Vq54=; b=bCH7thWkHUmHqjRoXeaBgsb3lecl0+IbVkKRPH4GzvVS4UZWsD+3865TdbqG8jpLSP SsjWB0DamBr1/ayp5/ZSi7hpGwSkHr35Xxk5Bn9hEraHpLp5mkDXoziSKuanF46obtot +6Qm8zvlRIGqaYAmemVVD0BPyR9dH7o9xnRrz8AFyl23uq6meFQ6kbW7nRgdUWJGuLLL J7qbilrsVdDj9QfFMcAQBUDhzU8VN1Yk24MGvwXFMWIZwlL4EFi0TUGoKf9o8eRbRIqV XF9Fxexa0xMZ6AsBI7tO525l7G3+5BPfasS86Q03YBqjqpUY/twzQg4xpUuXe2wIQPGX fsOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783971444; x=1784576244; 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=seRQ4x7WCVBDlRNvM1ESoBfWnXSVwL4ZPJ5Cc52Vq54=; b=XT8kkgXKz268Qsz+UGgtp9CybVoUzD1VTZHzOjMkQ3jIRPpd1rJZdq1GddBMIWMoen N3+8yoqKAT/2IVwoVpL0vCndinZ8aXBE7NhDuxr6G85xFRX3DAof8bV1/6FoUnuBMDf9 fmL9TTrzpfTVXH1wpdgDnqunYS08C2qv7CVGorYUuaOiqsmtcCMMN6lKy8OaS4IZGIQt EIs3xPz3bXc/dnnhVE6Exp9TwvsKvpAQ73t4qZuktOQg+XwfcPWcqhtJjOsDpBS0xzhZ kExHkGxRgAIh1dYyVmbP3uEHR508hCeQnL407mCyVMBVXz5ONqvnESybdFXg1ckx05tg PFuQ== X-Forwarded-Encrypted: i=1; AHgh+Rqh9iBwbEdYOHlgCG9SNlEAkNJO7EM+7LNlbQMxRW9FuxN1B6ZYLxpWmzfuiBGHTPvlqAPCtIZS1OEy5ZI=@vger.kernel.org X-Gm-Message-State: AOJu0YzNKL3lh3xK8TNJ8zL4yI0HqfOcZPI7iK3+tU3FQx1ZAvmsJhbx Gkuo9Lwkd15c9+BUCIAWfs4NQuyUIKEy+1A8LQ/g7qwwjDGeIc3U8YFozowSj/2oBOI= X-Gm-Gg: AfdE7cloIeO2o/01y/tGHkFKTmoJNbjehJb5EhGRdDmioxTEi7FaN/wiRZRpUe0WBGH 4aA2ZLoiAcyWraOXswOmKD5ICytRmkTkQ8fFdM6f4pNNbO/kJYuEblTZfI0SYWIzhu4p7+wNGwq wM2WI3cH8k1v2Y71ZBQ610Kg2UNhJ6NUHYVJHadJYDfZ8/8UEn7vtHdrxk2z9XZY1dipefjan9c 66hWTfZn01kVaBKNVGlVZVtbFuSkcsAkT2sLXO9C41evUtxBO3prlAG2G0jXOO0bXWQajiM52cA kjizbsnVuuRLoCzyFYjozYiyJgSTPwHyl24h27NNnne673ePKU4WyNWv+WrOozSq0M4UoFGpn/n 7bawMH/N7oPFJhwML2CKWmj2GC3rxQD3Wxo0sB5B8br3tfRbKVmkU/+aCUMhYjx9txQk7cYE= X-Received: by 2002:a05:620a:2551:b0:915:5930:94e6 with SMTP id af79cd13be357-92ef2bcc91emr1112783085a.51.1783971443832; Mon, 13 Jul 2026 12:37:23 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92ee5b86276sm1177578085a.11.2026.07.13.12.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 12:37:23 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wjMSw-0000000E6Rs-2gqS; Mon, 13 Jul 2026 16:37:22 -0300 Date: Mon, 13 Jul 2026 16:37:22 -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 17/22] dma-direct: set decrypted flag for remapped DMA allocations Message-ID: <20260713193722.GW3133966@ziepe.ca> References: <20260701054926.825925-1-aneesh.kumar@kernel.org> <20260701054926.825925-18-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-18-aneesh.kumar@kernel.org> On Wed, Jul 01, 2026 at 11:19:21AM +0530, Aneesh Kumar K.V (Arm) wrote: > Devices that are DMA non-coherent and require a remap were skipping > dma_set_decrypted(), leaving DMA buffers encrypted even when the device > requires unencrypted access. Move the call after the if (remap) branch > so that both the direct and remapped allocation paths correctly mark the > allocation as decrypted (or fail cleanly) before use. > > Fix dma_direct_alloc() and dma_direct_free() to apply set_memory_*() to the > linear-map alias of the backing pages instead of the remapped CPU address. > Also disallow highmem pages for __DMA_ATTR_ALLOC_CC_SHARED, because highmem > buffers do not provide a usable linear-map address. > > Tested-by: Jiri Pirko > Tested-by: Michael Kelley > Tested-by: Mostafa Saleh > Signed-off-by: Aneesh Kumar K.V (Arm) > --- > kernel/dma/direct.c | 56 +++++++++++++++++++++++++++++++++++---------- > 1 file changed, 44 insertions(+), 12 deletions(-) Reviewed-by: Jason Gunthorpe Jason