From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 977EC1EA91; Tue, 27 May 2025 16:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748364551; cv=none; b=Rv5H/93XC0KY+Z+uWtVei8Lm8l8qc8IzciVI21WYCZKeK2TlhQPsROY+JpCq4E/yR31qGpEYCRwGqRvfrhZJAQ7wxKHYPtzf5/AeF3g/BP3FylJZIDdvaCm1ZYchXXQzK7r7nF8YAWFI71ubQLt5x1q5rkDW9Mi9/lYk3TQ2x0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748364551; c=relaxed/simple; bh=+ZwxsHdUx/r9RTjkahTCm6JcqO0YRsKHutnP24zlCXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KEjTSa1DIPRtXz8ydaYlIaFzcOYyw2R+FtFUkiI9idFpAviQmbNGw+TfIrOCe7h0atMa4H9wIqgGWLRo1TwXXPyGpLvOgPG2pZAmjpcdyKLixBgWP6pQ3Mqn3Cbnt6sJGVcXs5YPKIRABW2ZW7wisyQDD2C6E+sl8jOsrBb4jco= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1QFVog60; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1QFVog60" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21852C4CEE9; Tue, 27 May 2025 16:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748364551; bh=+ZwxsHdUx/r9RTjkahTCm6JcqO0YRsKHutnP24zlCXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1QFVog60P6fI3dlSnsGI1uKRD3rMZXAPRHL8kbVxFjsWlBVJbNtcMPrla9LkwRS1a yHFC6FkNKA0g5V3s2fmQackjA8jaZB6sfVuTVhvlVAWJ8GpwaT0f+ePOFzPZEb7RQk 2UXHg1FpEW+KQ/5QC/qlg6dY8k/brlfetjOY/an8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Bjorn Helgaas , Juergen Gross , Sasha Levin Subject: [PATCH 6.12 093/626] PCI: vmd: Disable MSI remapping bypass under Xen Date: Tue, 27 May 2025 18:19:46 +0200 Message-ID: <20250527162448.826740274@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162445.028718347@linuxfoundation.org> References: <20250527162445.028718347@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Roger Pau Monne [ Upstream commit 6c4d5aadf5df31ea0ac025980670eee9beaf466b ] MSI remapping bypass (directly configuring MSI entries for devices on the VMD bus) won't work under Xen, as Xen is not aware of devices in such bus, and hence cannot configure the entries using the pIRQ interface in the PV case, and in the PVH case traps won't be setup for MSI entries for such devices. Until Xen is aware of devices in the VMD bus prevent the VMD_FEAT_CAN_BYPASS_MSI_REMAP capability from being used when running as any kind of Xen guest. The MSI remapping bypass is an optional feature of VMD bridges, and hence when running under Xen it will be masked and devices will be forced to redirect its interrupts from the VMD bridge. That mode of operation must always be supported by VMD bridges and works when Xen is not aware of devices behind the VMD bridge. Signed-off-by: Roger Pau Monné Acked-by: Bjorn Helgaas Message-ID: <20250219092059.90850-3-roger.pau@citrix.com> Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- drivers/pci/controller/vmd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 94ceec50a2b94..8df064b62a2ff 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -17,6 +17,8 @@ #include #include +#include + #include #define VMD_CFGBAR 0 @@ -970,6 +972,24 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) struct vmd_dev *vmd; int err; + if (xen_domain()) { + /* + * Xen doesn't have knowledge about devices in the VMD bus + * because the config space of devices behind the VMD bridge is + * not known to Xen, and hence Xen cannot discover or configure + * them in any way. + * + * Bypass of MSI remapping won't work in that case as direct + * write by Linux to the MSI entries won't result in functional + * interrupts, as Xen is the entity that manages the host + * interrupt controller and must configure interrupts. However + * multiplexing of interrupts by the VMD bridge will work under + * Xen, so force the usage of that mode which must always be + * supported by VMD bridges. + */ + features &= ~VMD_FEAT_CAN_BYPASS_MSI_REMAP; + } + if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20)) return -ENOMEM; -- 2.39.5