From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 E989B3783A0 for ; Fri, 1 May 2026 22:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777675384; cv=none; b=fb0v4nLRX/rHkMEy6tGcycG8WPsaI/zxnSB+hIZ+SYI5dX9wrWOO9y1NhsWroGKpTuOchRPyJyZ23C6N3aae1VI2z3dUR+BjzNf5dt3GEt9VxGF/cGAg2iYVEH+bvxSVeZUYVIdGVl55LgpCFORNkwjW/q4M/W+IeVQfrvVEpDo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777675384; c=relaxed/simple; bh=zxY+FJ/D1qGJPLj7LmqjRlqbTv0Us5t8F//4LBJztq8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R0oWRYXpywzusvo8yOCsF76yA457IJ+OVzGWxLM5SYP9QMDLUPF5lqgCbmdg3PQ/tDZ3sIeQWr0p+5StkYZIMCHmdmAEmz1gzkYxQ7JMRuq2sFMYIigyu/vHZSR6FBps5bCmft9a70ZEY2Yj/cpAs4fpzn6x0hweKMbr9QOoKmI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=m4Ln+7I/; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="m4Ln+7I/" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-364c5317d67so2185445a91.2 for ; Fri, 01 May 2026 15:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777675382; x=1778280182; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zA7ZB+9cdr8jZzJkhetR/xMmU5JX5i8WCgvlAknX308=; b=m4Ln+7I/rTNlDZVJ2LF4fMLARnw3NNs5xfG76SQZSeMZzdYDd0DKOihUgvHOxY4rg1 /tS4HRLRZxP7nbm5/HQv9NvsDrcpjzyBRA5AqX1DGiMGxSL+MNPMt1WDCyRHpy5XZmIg PLLLE8usZEu1QK4XjRKoFmsQDElNDmIFzR1YFTnW42XYD1Wzd+XSZIkd6qUEMCdCdXZN KcKa9tZb9/k3vPRJLlalRWbbPDlscuBOGezAP39aOR2Aj2h/clMw34GSy4CdRIN5Cfsf O18lkSQIB9PUdNCsY689uLrZcX0NUdFmIigcrqixxLsD+BGUcYyd6AjaNpjOK/H23TYu v00w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777675382; x=1778280182; h=in-reply-to:content-disposition: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; bh=zA7ZB+9cdr8jZzJkhetR/xMmU5JX5i8WCgvlAknX308=; b=Jlra4xpMDCQYSpVbpW775DoyYwkDWOnIxUohaSLl1d+EL1E7hsvXGdiB+qSnp4jwIx M9U6c54ZSJeSyqPRj2AF37Py3ogfRbv3tiCg4w0UZtzxnEy4igNaQ5AIxI3NcCATkHY4 AcrydJ/0e3iBLZelWkfMXlP4URpSAK9gL93JRdg1bExI3+iaBpmrBxppmci4fOB5vLhw zAthvYKcnYOS2C7tmJdltMr7hWtZBvAyacNQQ3IKyLOEmww3etPOlC2i1m6fyuQD59cQ prTJ96Xgt1QUIgc9l57XwQdLRQRUk/QIV1WXWLPPppHl3b58e6gK0uxXKPLMp2/GFymX Df0g== X-Forwarded-Encrypted: i=1; AFNElJ+SnqpWNXeQyf6lbe1OJoGsNEQ/KBx2HCQGs/Mx9q116K7sIHR08HqEm+kM+i6Wu4xjFGv0j2YPir9V8yo=@vger.kernel.org X-Gm-Message-State: AOJu0Yxde2pbp94TgqD6Qyp3ycG/mvcwOl5JdC6DOiCUPdGR4zIXC62a 6LxHk6AIvy1AgSqAAZzVxkh5Wtbs30MdAbiFRmPKOaHoynq1zBV9bDNrgFTIRZDW7A== X-Gm-Gg: AeBDietSenahUJBcBr41P39Ldf5ZVDSRI3VCgs4efcdF9fSC/bODpLEVMshuCvzt2gD E2DPqZM8shqDpoEHaOvp02Ev8a/T8Kqs7Sb3liA9RYmUz/cIvfY6GCwZWN5DPqFQ9Ws7TdAcvlt Q3+vfMIH/sh7rXFCNhAFSAyGQi8p2XTLAKoaEFyU7aqNYCvAixq/BAaBZSAsT+wnJC+/r8wtRHt jymOsXfoXbAH0B6sIETa+JbFtj3IhBXb41zVp24+bEiRJGa/SeUaZ6KCDyL2IwruUFnYkKwbTcd xz+yWOM83dJKyahAZznjEde1rxnCKrrrZtgNeSWUy5WpsldMq0uuImb/XZXBeXWRu2wb5S3aCeV q6jgf8+6uD3B0EsoXYjx6N9qe1cCIssOdVzeYSxrkPTHjpgaBSBHxGGDo4tOtvlNFA4eqJnES+n c2jATaLlRqYCGHCnxZA6/kQ/spdMmBXHks7HytLMPiJD0Go/oh/oiHaeRjj3LNkTodjnUmjBtNG u3YVg== X-Received: by 2002:a17:90b:3852:b0:35e:30bc:96e2 with SMTP id 98e67ed59e1d1-3650cdd40cfmr981966a91.10.1777675381854; Fri, 01 May 2026 15:43:01 -0700 (PDT) Received: from google.com (76.9.127.34.bc.googleusercontent.com. [34.127.9.76]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-364f3fc1714sm1322177a91.2.2026.05.01.15.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2026 15:43:01 -0700 (PDT) Date: Fri, 1 May 2026 22:42:57 +0000 From: David Matlack To: Samiullah Khawaja Cc: David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Jason Gunthorpe , Robin Murphy , Kevin Tian , Alex Williamson , Shuah Khan , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Saeed Mahameed , Adithya Jayachandran , Parav Pandit , Leon Romanovsky , William Tu , Pratyush Yadav , Pasha Tatashin , Andrew Morton , Chris Li , Pranjal Shrivastava , Vipin Sharma , YiFei Zhu Subject: Re: [PATCH v2 04/16] iommu: Implement device and IOMMU HW preservation Message-ID: References: <20260427175633.1978233-1-skhawaja@google.com> <20260427175633.1978233-5-skhawaja@google.com> 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: <20260427175633.1978233-5-skhawaja@google.com> On 2026-04-27 05:56 PM, Samiullah Khawaja wrote: > Add IOMMU ops to preserve/unpreserve a device. These can be implemented Can you make this comment more specific about what is being preserved? Saying it preserves a device is vague and maybe even misleading. It's more about about preserving a device's attachment to a specific domain correct? > by the IOMMU drivers that support preservation of devices that have > their IOMMU domains preserved. During device preservation the state of > the associated IOMMU is also preserved as dependency. > > Signed-off-by: Samiullah Khawaja > diff --git a/drivers/iommu/liveupdate.c b/drivers/iommu/liveupdate.c > index f71f14518248..765d042e22e3 100644 > --- a/drivers/iommu/liveupdate.c > +++ b/drivers/iommu/liveupdate.c > +static struct iommu_device_ser *alloc_iommu_device_ser(struct iommu_flb_obj *flb) It is unforunate that struct iommu_device_ser has nothing to do with struct iommu_device. The former represents an a PCI device, while the latter represents an IOMMU. > diff --git a/include/linux/iommu-liveupdate.h b/include/linux/iommu-liveupdate.h > index 6019cfc27428..279c7ab04f09 100644 > --- a/include/linux/iommu-liveupdate.h > +++ b/include/linux/iommu-liveupdate.h > int iommu_domain_preserve(struct iommu_domain *domain, struct iommu_domain_ser **ser); > void iommu_domain_unpreserve(struct iommu_domain *domain); > +int iommu_preserve_device(struct iommu_domain *domain, > + struct device *dev, u64 *preserved_state); > +void iommu_unpreserve_device(struct iommu_domain *domain, struct device *dev); The naming scheme is inconsistent... Maybe it can be: iommu_preserve_domain() iommu_unpreserve_domain() iommu_preserve_device() or iommu_preserve_device_attachment() iommu_unpreserve_device() or iommu_unpreserve_device_attachment() > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > index 3853a3946733..1c424b32c5fc 100644 > --- a/include/linux/iommu.h > +++ b/include/linux/iommu.h > +#ifdef CONFIG_IOMMU_LIVEUPDATE > + int (*preserve_device)(struct device *dev, struct iommu_device_ser *device_ser); > + void (*unpreserve_device)(struct device *dev, struct iommu_device_ser *device_ser); > + int (*preserve)(struct iommu_device *iommu, struct iommu_hw_ser *iommu_ser); > + void (*unpreserve)(struct iommu_device *iommu, struct iommu_hw_ser *iommu_ser); > +#endif Maybe we can make these names a little more specific: preserve_device_attachment() unpreserve_device_attachment() preserve_iommu() unpreserve_iommu() ?