From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 31858357D13 for ; Mon, 13 Jul 2026 19:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783971740; cv=none; b=IDUgaM4jYb263PRVrkmOXcnp8qYmA+qejjt9QMj5Bq9smMMuhbNwrXNbl8PUGDMzEhnvHzqM4tqs4VqQtBgsMObNVmbZAzpp0V3AwPU2vZkKUTdgVEjgHok/WZfIYpCOh5uVAF6EmBCOkL5FA9YHCV0f7WK03bxcq5dCAzjXsf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783971740; c=relaxed/simple; bh=5d6Bc8gkCbSlPfvzi0E/608dMWlnVz1C1iUyYSF7w/A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OVzcQTOqeOSwNsUeN1sU4nQHYEAtAlx4WHFhKmjqqounHrk2tlfUhLjJpvUDSpZ7+87jbTr1g2Ev21BXgB8Myu6mDM2uuccWDfKXjPjYLiGfmiqdJ82YIcxjZQ5m7vocb9JqXPnJktl0Z81LSS43fDCKmSQvlCnIGvB7nqfOH1Q= 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=K/qvTTqN; arc=none smtp.client-ip=209.85.222.182 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="K/qvTTqN" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-92e5d50b0dbso16620885a.1 for ; Mon, 13 Jul 2026 12:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783971738; x=1784576538; 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=q5KluJxuBWim2YOI+gCMldEdZU/bLOQ3tr992AX6OwE=; b=K/qvTTqNV9qxStEIt2GJD2Wf6/0r0z9sW9cWUCgNW5gGeAQjbbXSrxxu2Bx2DFxfT8 DGllO8QzGEousqgXPH65cd9le50bm6uPxlOQgnizfBly/QgnH187G5C1rOdBO830NO7o kPTactL8NC/UHK8nW0KOwy+LacaUHWUS0kbL21Eg+BJEyUwpn1tMc9Ge1UWxAX4I8ozi hDhOei25p6uEqJci904/XXhjkzbdy+WK7mUmW1biWG8gRrnNYrkRL2YuCjt3rG4Ratvx oO8pfQ5H+zLvfeMnJKiXToUjB3PBoLjxEcSIOiAMortJfIDYvnOeQ/BGWyXHS4A0lpcE 3hpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783971738; x=1784576538; 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=q5KluJxuBWim2YOI+gCMldEdZU/bLOQ3tr992AX6OwE=; b=pFKusiTF12Zd7IYUZBzIGU86e46vowq4L3m+/Sjbze1CIGi+yY+1zQHQHGf35Gcn/j BAx6gY1ko+be5nB1Q1IoDl0Q8QILFS8QoRs1GcvSTNJnc3/VEWKfVd68SnsDey0/kL3A J8ffdPX7/8rFWvtHDUJ2RA/VSZgXFrBJzJ0qi97p2yTYPmgHHi3xC5AdFGi59E1suhzh wcf+4W+M1eRB0iedxsB+CmMd6I3+mEC0xpBZf3A9rs7vJp7XB4EBMF03R47N7W/H3u4/ rDBaPcBsrvPpkIBrIgd8cygastfS2qI9yZT3DmcCFREDDeiq988CK76qb8lIC5+HrUlz 5U6g== X-Forwarded-Encrypted: i=1; AHgh+Rq5sqe3phyG5f5gpqfXNKEvoOpqEkXH0HTXwewmFkVc8PXj86wmC98Dk8T4E1bI4ZYblGNTRQm6ZvPcGIo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4zkwDG7KEwzSakRoRefGw2C4zSNQ2p8OUf5IPfpoGEHUZmoYE HepqRzv4ZGIrfmgDcTir21zibLgUhZb7oUe31ls7dfp2PIPvs8CkEM/KRXMmLbzpMKE= X-Gm-Gg: AfdE7clOnNaWL0Dw3VeMRREnRVUGncshmgqAvos04ZZlMPW9Qm3EByj4ZVB3zJezgTA bxhUTPz6S2zR0H9KxV5vsTv+KyYfmFjeXhWEPr1Dl5PKJozn49SP3DP2qPSIlMOcYCsnkA8F51M Yhe8EAM9pffk7Gs17zXH/7mNxFBIcyyAyBtt4OcWViePp1hAJJCLvTtz0MqtoY+LNic7IjjgRUK 5CN4iADGyLRi4rJJiCPfm33duW62/4rC9DLeL3hlSiYkdgF8QK2hLhUIwOVn8zoCGK90hwdD9fF ytkor/4LpUPgUMjVrwbfmHBdgLAgIDo5z68t1PkasYVOZYchUTdKCPu28ElRub+b+YbS8V7vr5i 1uDW0FEFaltpiqt9S/gwa+z87pE9TT7FEIJQy3SfGO0KBNqvWN1hK2lXK0csL X-Received: by 2002:a05:620a:262a:b0:92b:d4e3:1f08 with SMTP id af79cd13be357-92ef2bcc2e9mr1042196885a.55.1783971738155; Mon, 13 Jul 2026 12:42:18 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92ee5d37540sm1154048285a.38.2026.07.13.12.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 12:42:17 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wjMXh-0000000E6o6-0etu; Mon, 13 Jul 2026 16:42:17 -0300 Date: Mon, 13 Jul 2026 16:42:17 -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, Michael Kelley Subject: Re: [PATCH v7 21/22] dma: swiotlb: handle set_memory_decrypted() failures Message-ID: <20260713194217.GA3133966@ziepe.ca> References: <20260701054926.825925-1-aneesh.kumar@kernel.org> <20260701054926.825925-22-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-22-aneesh.kumar@kernel.org> On Wed, Jul 01, 2026 at 11:19:25AM +0530, Aneesh Kumar K.V (Arm) wrote: > Check the return value when converting swiotlb pools between encrypted and > decrypted mappings. If the default pool cannot be decrypted after early > initialization, mark the pool fully used so it cannot satisfy future bounce > allocations. > > For late initialization, return the `set_memory_decrypted()` failure. For > restricted DMA pools, fail device initialization if the reserved pool > cannot be decrypted. > > This prevents swiotlb from using pools whose encryption attributes do not > match their metadata, and avoids returning pages with uncertain encryption > state back to the allocator. > > Tested-by: Michael Kelley > Tested-by: Mostafa Saleh > Reviewed-by: Petr Tesarik > Signed-off-by: Aneesh Kumar K.V (Arm) > --- > kernel/dma/swiotlb.c | 80 +++++++++++++++++++++++++++++++++++--------- > 1 file changed, 65 insertions(+), 15 deletions(-) Reviewed-by: Jason Gunthorpe Jason