From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 C3D902FFDD8 for ; Tue, 2 Dec 2025 23:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764716602; cv=none; b=L4K7ozeSN+2u08D06pt2vH7lMTs7PvjT+TPQguLcj79oub8li3kaMARKC3Abmt3NJWKJfB70bc1FuLMLotLeXxeM4bK60VITO3GRVF7f0Q28pDb4HeW6WcLAI7MS4eQXEGHLI4JzRkZnd2b2Wdlq3vw1VHyQ+LYfrwpbKpsQ6PE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764716602; c=relaxed/simple; bh=TK2EFF6Ag12e+ejnPMv2kVPsFdgJaI/cRmxcuiTgpJE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=W4PnO7aXT5sa/ZScZFVlg1aSLCcI1Yg4YVZuf89p0mmQ5yFlNgJmx2iHD5w35gZcde+j7vgd6e/H7DJnqlJAXiLdEIBlTsir1B1RrUHfikurzFTnffHcnUB4q/MLxbKtYOgX9GpJSwY9guseqMq/KwjsB30030VTKO4fQ3S0MDs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--skhawaja.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HZKkKkNu; arc=none smtp.client-ip=209.85.214.202 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=flex--skhawaja.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HZKkKkNu" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-295952a4dd6so3302415ad.1 for ; Tue, 02 Dec 2025 15:03:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764716600; x=1765321400; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=0dZbKC+fAmBmi+80jHPBDIRcfD9xd6VgsQkdzdniEfU=; b=HZKkKkNuqDQKIPcQ9TEBTA7IE2C8Y/pmJVf4LhVR5l9du39rFtBpHkL++nzvWbNmgO auF7dVt3Spda1RwkCPcqQomePa/lx6hMn8zVXjSCORpt2I7xJUFpQ7DcNrRGORCqcYds NNbxT/P8Y5MQgJ+yfd9yYhmGePZLPFN1YVrQrcusOYOlKggbpHJzflO+PziIEgEkVDGI mHnNyYzGeBEvxogiZgK+/FBORRjy5puf7R5PEEq/UMnjySc8/91C3olfn3G06S9GFU0M nJcF/JIXT/eMMyDrmPKQ6YoEHYxqGKdMYVUvjSei9acBEjhK5l3tJ7wnjivq+ymRlLbr EzMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764716600; x=1765321400; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0dZbKC+fAmBmi+80jHPBDIRcfD9xd6VgsQkdzdniEfU=; b=K9/Y8GIW5WnSc2yujrK3Hu7Ym4rU7ZneUxmlnlPnmVpKPsZnjEHKj39Y8FXs/Dd77N nN5zGnfQUs7yJo1nDBE5biMmCvUJIXdg44jYcBavfWBLyTelu8+S3ffavqIKI2i9wCEy U4ZLSmR6XzN6vKlgiWczBCnzmVRCpxw3jXfXtEXDae0ZDe3n0U7mubw2Z9tpY2pinBBU leYXBwutVat504E1CZ0+47eOwXiSzSNBLNsfR2mqhB+31HVDuyUVryhwZ+b/v3nlC9EO JIORkbz1MPAfuWIHiiwSa/em1eFvW+M9vz2W4SsAR5IjT4cL9OHFkBBUwHEjAzRBlY9n TqhA== X-Forwarded-Encrypted: i=1; AJvYcCVAPjtlOy6fW/e1VyGlarE5i62kVw1fYkOBJNylcCoJdo9DPJEofm1UKAGIAJ+UW+K5A/jAnc78q5ud6w8=@vger.kernel.org X-Gm-Message-State: AOJu0YxL/mFNsjrotCtUXVQzFr3DwAtdw+EdJIAdQ7Li4r0upEEKxFR6 Fo6EZ6XzcIqfYqNqTUw3mx88vLHiEwcRamfmNEzSC27EBfuvKLlj7MWdAv80WclL+KRVjUhk9ob KzziH5cykIPJjdg== X-Google-Smtp-Source: AGHT+IGwujbG6vyR53fAv+matIEUXsWWOhe2XPEeNEAqwdMuXWgmYMDGf6q/rBQ1n1lfvJWuQLXHJrE9Iu2A2g== X-Received: from pgve25.prod.google.com ([2002:a65:6499:0:b0:bc3:cbd2:e0a1]) (user=skhawaja job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:40c5:b0:297:f2c6:8e05 with SMTP id d9443c01a7336-29d5a48b0bfmr44974725ad.6.1764716600146; Tue, 02 Dec 2025 15:03:20 -0800 (PST) Date: Tue, 2 Dec 2025 23:02:40 +0000 In-Reply-To: <20251202230303.1017519-1-skhawaja@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251202230303.1017519-1-skhawaja@google.com> X-Mailer: git-send-email 2.52.0.158.g65b55ccf14-goog Message-ID: <20251202230303.1017519-11-skhawaja@google.com> Subject: [RFC PATCH v2 10/32] iommu: Add iommu_domain ops to preserve, unpreserve and restore From: Samiullah Khawaja To: David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Pasha Tatashin , Jason Gunthorpe , iommu@lists.linux.dev Cc: Samiullah Khawaja , Robin Murphy , Pratyush Yadav , Kevin Tian , Alex Williamson , linux-kernel@vger.kernel.org, Saeed Mahameed , Adithya Jayachandran , Parav Pandit , Leon Romanovsky , William Tu , Vipin Sharma , dmatlack@google.com, YiFei Zhu , Chris Li , praan@google.com Content-Type: text/plain; charset="UTF-8" These domain ops can be implemented by the iommu drivers if they support iommu domain preservation across liveupdate. Signed-off-by: Samiullah Khawaja --- include/linux/iommu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 8c66284a91a8..f681d4d27d6e 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #define IOMMU_READ (1 << 0) @@ -749,6 +750,11 @@ struct iommu_ops { * specific mechanisms. * @set_pgtable_quirks: Set io page table quirks (IO_PGTABLE_QUIRK_*) * @free: Release the domain after use. + * @preserve: Preserve the iommu domain for liveupdate. + * Returns 0 on success, a negative errno on failure. + * @unpreserve: Unpreserve the iommu domain that was preserved earlier. + * @restore: Restore the iommu domain after liveupdate. + * Returns 0 on success, a negative errno on failure. */ struct iommu_domain_ops { int (*attach_dev)(struct iommu_domain *domain, struct device *dev, @@ -779,6 +785,9 @@ struct iommu_domain_ops { unsigned long quirks); void (*free)(struct iommu_domain *domain); + int (*preserve)(struct iommu_domain *domain, struct iommu_domain_ser *ser); + void (*unpreserve)(struct iommu_domain *domain, struct iommu_domain_ser *ser); + int (*restore)(struct iommu_domain *domain, struct iommu_domain_ser *ser); }; /** -- 2.52.0.158.g65b55ccf14-goog