From nobody Sun Feb 8 05:41:17 2026 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A997B39902D; Tue, 20 Jan 2026 06:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768891440; cv=none; b=u0d9mKCNsr01ktJEhlMYWQmAUdh95F/W4WVBRCk4E/hPrI/v8OTtQw9uuXST3xMpRbrQ/Vw421TO1ZaNatXyELt8m/xBgtAqj+u/6+H1CKxBp3brnpRRnVDSKwNDQdk18hb5CWd1bI5NiR5kTV5YHLrC+kZxP3I6M0DbGLI5mBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768891440; c=relaxed/simple; bh=+8Qir+mOSVaBv5WqSoKuLu6sxNU4FaFzM6MVmGwCQN8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=REoaSZ1XMvYOqNUXg9Xi/6K3wdjl4u6DZhNepyxCKK0KFUdUJY/7edyCeMSUrYwefNdRgdEhA7MQGEw4EkSo+qA7wM1IoT/Hp65yjCdW9z5T2UCXdUBLT+I8dJriJZN0HJIFNwY1IH8nq105BiaZ9Azi/Es0iQXqz9ZmC6OIUwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=g77JY4hF; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="g77JY4hF" Received: from mrdev.corp.microsoft.com (192-184-212-33.fiber.dynamic.sonic.net [192.184.212.33]) by linux.microsoft.com (Postfix) with ESMTPSA id 56F1620B716C; Mon, 19 Jan 2026 22:43:49 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 56F1620B716C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1768891430; bh=CFz+8gqoAFM3TYZVTFHJmJB8DMHyjUBersKypxC41pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g77JY4hFKZt4z08YLR0YZzPxYsievzoO9oT+MmmeCnQaJOTE1AYBr6CrbTfBE0L6N TnMwk/PF6bC2vogLeTMWTIN/KKILat0XYJgYcsjHR3nbXUO62aw+XbqFPpASY8uVwb JoXRtxbs0LfE0/WkwvkUDdsKlFi+412LYl/5jhoU= From: Mukesh R To: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, longli@microsoft.com, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, joro@8bytes.org, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, bhelgaas@google.com, arnd@arndb.de, nunodasneves@linux.microsoft.com, mhklinux@outlook.com, romank@linux.microsoft.com Subject: [PATCH v0 14/15] mshv: Remove mapping of mmio space during map user ioctl Date: Mon, 19 Jan 2026 22:42:29 -0800 Message-ID: <20260120064230.3602565-15-mrathor@linux.microsoft.com> X-Mailer: git-send-email 2.51.2.vfs.0.1 In-Reply-To: <20260120064230.3602565-1-mrathor@linux.microsoft.com> References: <20260120064230.3602565-1-mrathor@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mukesh Rathor VFIO no longer puts the mmio pfn in vma->vm_pgoff. So, remove code that is using it to map mmio space. It is broken and will cause panic. Signed-off-by: Mukesh Rathor --- drivers/hv/mshv_root_main.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index 27313419828d..03f3aa9f5541 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -1258,16 +1258,8 @@ static int mshv_prepare_pinned_region(struct mshv_me= m_region *region) } =20 /* - * This maps two things: guest RAM and for pci passthru mmio space. - * - * mmio: - * - vfio overloads vm_pgoff to store the mmio start pfn/spa. - * - Two things need to happen for mapping mmio range: - * 1. mapped in the uaddr so VMM can access it. - * 2. mapped in the hwpt (gfn <-> mmio phys addr) so guest can access it. - * - * This function takes care of the second. The first one is managed by v= fio, - * and hence is taken care of via vfio_pci_mmap_fault(). + * This is called for both user ram and mmio space. The mmio space is not + * mapped here, but later during intercept. */ static long mshv_map_user_memory(struct mshv_partition *partition, @@ -1276,7 +1268,6 @@ mshv_map_user_memory(struct mshv_partition *partition, struct mshv_mem_region *region; struct vm_area_struct *vma; bool is_mmio; - ulong mmio_pfn; long ret; =20 if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP) || @@ -1286,7 +1277,6 @@ mshv_map_user_memory(struct mshv_partition *partition, mmap_read_lock(current->mm); vma =3D vma_lookup(current->mm, mem.userspace_addr); is_mmio =3D vma ? !!(vma->vm_flags & (VM_IO | VM_PFNMAP)) : 0; - mmio_pfn =3D is_mmio ? vma->vm_pgoff : 0; mmap_read_unlock(current->mm); =20 if (!vma) @@ -1313,10 +1303,8 @@ mshv_map_user_memory(struct mshv_partition *partitio= n, HV_MAP_GPA_NO_ACCESS, NULL); break; case MSHV_REGION_TYPE_MMIO: - ret =3D hv_call_map_mmio_pages(partition->pt_id, - region->start_gfn, - mmio_pfn, - region->nr_pages); + /* mmio mappings are handled later during intercepts */ + ret =3D 0; break; } =20 --=20 2.51.2.vfs.0.1