Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp117363lqs; Mon, 4 Mar 2024 17:39:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4Cbs3LwHFu+BIDyANYwCg1p6bNHXwHsUJHH+UeXHt0hc3wQA2o+n0Yrmj8eymF2yXd+Y//NBZpA4Yn9MCs2Wvy/Yl3cr0bZ8SzzUdQQ== X-Google-Smtp-Source: AGHT+IGMjs90L6VAxuYlQSSLfGtR/OFgKablnqzEUufQi9RyAIl05ndJIf4T61oUAKMBgvS9/KHI X-Received: by 2002:a17:907:20e3:b0:a44:4c9e:8809 with SMTP id rh3-20020a17090720e300b00a444c9e8809mr7257420ejb.32.1709602766657; Mon, 04 Mar 2024 17:39:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709602766; cv=pass; d=google.com; s=arc-20160816; b=d2iqDX80xTcvvVJv2eAY6Cbre/UHoKzd6/q4uUXwQiM5zOnBW62jRj0VZznvwxQ4Dg y1WDXztjqwwb3xhunuhMzBEudIhqBUHybLuBWElBsg8OtCW0stcH76+rtwKHraD7NNU3 n/jl1Is+Y8ruvdGHjTV7dS3gO5e5mmi2NzpZpRUXYIjcBqJ2NOQStY2w4TpPSZTNiXwP fpErKZJvQGBewUjwiYJ1d5TK252xy8Lp3ZFLbqdJJQuklk3hszGMg50IDTbH4sWUhspV B4pwe0WkKc38Lr+mYW58dSgMs3V7PsjEwFmt6O/1cwWirDMfw3hy4Ajig2hVsBurAIOa 3bsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=uxPw1nzCENP4k+cQ9SVFwQaoUKvJweRcALBVLajObUI=; fh=q/aNRRwbk+AHb42I2d6wYfBCRE+T0txaX+dEwQcyGW0=; b=vH0fntDZIPIYXkWky+wRsd4AXCJi8c0jRVRx5jRjHIU2vgP0iX5aXlDRSJlpFYCGDB dMhkqRiuwxks5sxNYZOPvITYi5yCuQzg1urWY1+ljCvxgzFYZPAhZzyfjd1bs+J2bFn2 beDZmWOHixqqlvr2Y3kwETTWS+Lzf6md48Md0uNEc1XdfYHc6TaDGOZXvrl6k/y0jYUL 96ytNUFv6rdtvN/aYN8OWafSfF0l6mhkGjk920cJUt6nmTMosVvqZTNQ6ribdOa9SVTB PlQAIgADOxBtfmVIZDYnTFPXT4UN7YTYAwnbAlBA451N6qp2SDLX/6Fpp2sLsYxn6Ft/ yQUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PerJ+l1z; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-91499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lj24-20020a170906f9d800b00a4408e235c7si4371633ejb.842.2024.03.04.17.39.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 17:39:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PerJ+l1z; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-91499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 66DB21F22EFE for ; Tue, 5 Mar 2024 01:39:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 096DE17C96; Tue, 5 Mar 2024 01:39:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PerJ+l1z" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0FB617C6A for ; Tue, 5 Mar 2024 01:39:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709602759; cv=none; b=jEMMnIVkMv4aCozcuodnQ/ezYMLxBtTtbDrB2D2qZFZodxQFyP3Eq+8Of70OyeUV8FIWyqIxrTZh/CMG8ws/9cywzs3zBZgyQys6JvalOqVfrS0Zcp8jIa2FYTJVohDN+iBLohw41HPMeNgrsGWfeeJW3j1FXDHUGe2m8Wtsxjk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709602759; c=relaxed/simple; bh=eiU/1NcIOJEtkEHiA5OyoXSA8xSvI1Z67moJ09F+JIc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BgmXDjgLj5y2ExVvGKWm6jRUIsVlt3wlpFW3TeO4KrS7aRa1d77NBuKr+M+rPG+n3ozK0LGj90Bsq28jgZoq3L2WsRuvrFEkwvRqHhIek5xAd1P9WpUVy4vPA/v8lHRT4X/a6/R/jaPfA0b3QQFfpPZdtT0VS+hlXTL46DYJt4g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PerJ+l1z; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709602758; x=1741138758; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eiU/1NcIOJEtkEHiA5OyoXSA8xSvI1Z67moJ09F+JIc=; b=PerJ+l1zz/QQE0AO1UB9d2Vxtvmd910J279dlUWvvcQNOP5iR9prdAPx J+C3SG2IJpoYGCtG2W4VVypmUWtoR5uLf20O05bmeQisVMPVUw4wmDJJG nyRuq7jZyzO8UQ5rZmWN2+OwZSHcD72mB8/rFOfJH9P/OU3WJI8/wgUn7 F7+2ZCAxvuzzGcaINvujXcvGTeASLMHlaLJiYyZyrzgTDgluBo/E1ht2m mpVUokH+GLapC+C8IIVFZC1o2fyspZXcFaNSshs965L7nY9esES0OE4zW Cso/NUbPn7rWG1WT/ZeXODQbeOKLYU3PPGPPUJGGdTAtkRtnRzFTx62re Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="4286682" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="4286682" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 17:39:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="13865421" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orviesa004.jf.intel.com with ESMTP; 04 Mar 2024 17:39:14 -0800 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Eric Badger Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v3 0/5] iommu: Fix domain check on release Date: Tue, 5 Mar 2024 09:33:00 +0800 Message-Id: <20240305013305.204605-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This is a follow-up to the discussion thread here: https://lore.kernel.org/linux-iommu/20240221154012.GC13491@ziepe.ca/ It fixes a NULL pointer dereference issue in the Intel iommu driver and strengthens the iommu core to possibly prevent similar failures in other iommu drivers. There are two parts of this topic: [x] Introduce release_domain and fix a kernel NULL pointer dereference issue in the intel iommu driver. [x] Follow-up patches to cleanup intel iommu driver. Best regards, baolu Change log: v3: - Avoid global IOTLB and PASID cache invalidation in normal release path to mitigate the impact on other devices. - Comment and code refinements. v2: - https://lore.kernel.org/linux-iommu/20240229094613.121575-1-baolu.lu@linux.intel.com/ - https://lore.kernel.org/linux-iommu/20240229094804.121610-1-baolu.lu@linux.intel.com/ - The scalable mode context entry should be removed in the release path as it's not part of the blocking domain. v1: https://lore.kernel.org/linux-iommu/20240223051302.177596-1-baolu.lu@linux.intel.com/ Lu Baolu (5): iommu: Add static iommu_ops->release_domain iommu/vt-d: Fix NULL domain on device release iommu/vt-d: Setup scalable mode context entry in probe path iommu/vt-d: Remove scalable mode context entry setup from attach_dev iommu/vt-d: Remove scalabe mode in domain_context_clear_one() include/linux/iommu.h | 1 + drivers/iommu/intel/pasid.h | 2 + drivers/iommu/intel/iommu.c | 214 +++++++++++------------------------- drivers/iommu/intel/pasid.c | 202 ++++++++++++++++++++++++++++++++++ drivers/iommu/iommu.c | 19 +++- 5 files changed, 283 insertions(+), 155 deletions(-) -- 2.34.1