From nobody Wed Mar 12 03:48:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1728384473; cv=none; d=zohomail.com; s=zohoarc; b=ROquwHjsgvzVPD6db/COlsfrzsp65PGOPWzXwnvPOwOvQ8lTbe+5lnHdIyDk9mffg2uUUY5+iPearLfdPbhlQhTF4DAgNJwLbTgsrA07sXS032HZAkmxPApn0h+c4Ab6cJjrW6CyZ2Phe+TWBAlRx2w/SzPd3sVNdCi+KqVXsgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728384473; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Eg++UNuGwihTMeqEph3/1UZvbpjvouqeJeWvfpFRaaM=; b=Cpreohw9ZlddnZzkHZoaROnwvWr+0iIV04rJ6pWelFd/df/pT7w9sCF/Biuu0cSRx6wTcgEfI3qL5Me1X0kbpt67zGWg4q++nLCWcKhEiQXfh6LHDjuF4nH1E7iVffa0Gh9QBdZvRGoCoA+yDGRprnZ4uGqiellw/b01AsE+vos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17283844738878.80353632791514; Tue, 8 Oct 2024 03:47:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.812995.1225755 (Exim 4.92) (envelope-from ) id 1sy7kR-0006Vy-Vs; Tue, 08 Oct 2024 10:47:23 +0000 Received: by outflank-mailman (output) from mailman id 812995.1225755; Tue, 08 Oct 2024 10:47:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sy7kR-0006Vr-Ry; Tue, 08 Oct 2024 10:47:23 +0000 Received: by outflank-mailman (input) for mailman id 812995; Tue, 08 Oct 2024 10:47:21 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sy7kP-0006Vl-MZ for xen-devel@lists.xenproject.org; Tue, 08 Oct 2024 10:47:21 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b10a8d1c-8562-11ef-99a2-01e77a169b0f; Tue, 08 Oct 2024 12:47:19 +0200 (CEST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5398e3f43f3so6250916e87.2 for ; Tue, 08 Oct 2024 03:47:19 -0700 (PDT) Received: from localhost ([213.195.117.215]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e7860cbsm489760866b.120.2024.10.08.03.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 03:47:18 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b10a8d1c-8562-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1728384439; x=1728989239; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Eg++UNuGwihTMeqEph3/1UZvbpjvouqeJeWvfpFRaaM=; b=HQemkBrRZWXGEUq/6WYk4p1r9ean4Wzmi/mg1WUQolZqY7m1mGcpmCUgXPc42dWa2E U/V33Tah0S/O5KhwOYmxJtW93Gij3+7MfiE0RyXPZX1s9a+ihFEQudd3jeYMhQbIOb+d 1jHsiq8gGeDyvDwW5cMf+p+NWEbdrSGyxsyMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728384439; x=1728989239; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Eg++UNuGwihTMeqEph3/1UZvbpjvouqeJeWvfpFRaaM=; b=I0h1vuyiDxF2hRj0n7EfWSyRsq4MwiLdgkzirwKtc0kuXfBhgk8zF369wqEuwwUZwE vHRyHbohYM8tjt3aO91OXTzQFnZ0SUBzJ0CNSBfQwQlWaFX6EJnAFw3K/YxD1ghoNGSf JYWjxlbEJCDtb06pNwBYvU5lLRQgmEuxIe85SBX7Uleoe187U4i+xFtJ+L+FgSjKrru1 CsOD/3mlZM7icmepVumWZLJTaKmL+cPH4Y0nWae/IspeZodV173idmnLeN+tMhVqZB32 3YenErm0amsIU/Waxzr6zijjRrfPEuKt35MD+QeclqgPPVVIMvrFuWfmfZwWa2KkzoEJ eyGA== X-Gm-Message-State: AOJu0YytuGQfQwFApJAa/GD9v0OP6q4bICTHdLfTnP9czaI5gHOUWZcv CFkCOQSwIQ3l6/ADR/eFkKGkWTkdkeatvinI2DvDZH8Wo1f3hJUeLGlAMAm4OsFJXnHidZvrlCG 8 X-Google-Smtp-Source: AGHT+IGlsedWb3JNFYZnMZpvr0kKZ/pocJ/gYOQya5Hsh1jDsWYIZfdaQ3OJN3v/n8LnEGgFWTdUmg== X-Received: by 2002:a05:6512:3d93:b0:52c:e326:f4cf with SMTP id 2adb3069b0e04-539ab84e3a7mr8146475e87.3.1728384438751; Tue, 08 Oct 2024 03:47:18 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , Willi Junga Subject: [PATCH] iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU Date: Tue, 8 Oct 2024 12:47:06 +0200 Message-ID: <20241008104706.74001-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1728384474378116600 IVMD table contains restrictions about memory which must be mandatory assig= ned to devices (and which permissions it should use), or memory that should be never accessible to devices. Some hardware however contains ranges in IVMD that reference devices outsid= e of the IVHD tables (in other words, devices not behind any IOMMU). Such misma= tch will cause Xen to fail in register_range_for_device(), ultimately leading to the IOMMU being disabled, and Xen crashing as x2APIC support might be alrea= dy enabled and relying on the IOMMU functionality. Relax IVMD parsing: allow IVMD blocks to reference devices not assigned to = any IOMMU. It's impossible for Xen to fulfill the requirement in the IVMD bloc= k if the device is not behind any IOMMU, but it's no worse than booting without IOMMU support, and thus not parsing ACPI IVRS in the first place. Reported-by: Willi Junga Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthr= ough/amd/iommu_acpi.c index 3f5508eba049..c416120326c9 100644 --- a/xen/drivers/passthrough/amd/iommu_acpi.c +++ b/xen/drivers/passthrough/amd/iommu_acpi.c @@ -248,8 +248,9 @@ static int __init register_range_for_device( iommu =3D find_iommu_for_device(seg, bdf); if ( !iommu ) { - AMD_IOMMU_ERROR("IVMD: no IOMMU for Dev_Id %#x\n", bdf); - return -ENODEV; + AMD_IOMMU_WARN("IVMD: no IOMMU for device %pp - ignoring constrain= \n", + &PCI_SBDF(seg, bdf)); + return 0; } req =3D ivrs_mappings[bdf].dte_requestor_id; =20 --=20 2.46.0