Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6532738rwb; Mon, 5 Dec 2022 13:50:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf7L7Ol0C+8yZszWgnupZsS1ZwSVi+VSwftryMf5qy3YFF54CCNWjEH2OOrlCt+VYf+iVbsI X-Received: by 2002:a17:902:8604:b0:188:d78e:16ec with SMTP id f4-20020a170902860400b00188d78e16ecmr80072011plo.154.1670277031543; Mon, 05 Dec 2022 13:50:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670277031; cv=none; d=google.com; s=arc-20160816; b=lRngVvErSTZsGteBwQQaUCw8YkMUV/ymAO9P5Un4ng4dj0ZqvEQ/TWKyqI+CTMI/S3 0KH/aqi9XEp4p5cxqt/ZSVoXJrfBB2ew7IWJPLTElWtc2wJqBe1hsM2qu4ppJuwQ6g5f pr+ywERg+o4cGV/NYkpOAWTLpP2yI8XgXMUzhJ/YvZnY6JhvUm9QoHhefQLeXwwjQzte nO4PyudAq9GYbY8XbgX8ykM5UNbtaNvOxd3J244R4TC5NhgsxFCiRlzB4Axarnvy+o7J 0ymXncL79Wh3+BpcCesiqy4yaqIAfmW4taaBPJwpQkBJVig/D/YuM5C/8/mFBAQhmy9s v3vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=xemZrY8VvbFDpZkx2nsw8iOahizDN/r13dIQFo1Gd6U=; b=oARlg7L9/H78zRd7qXtxLDOodaF6N1jlyJ8dnZgBm0OfuCXJo1LXjPvr5LNdmvm4Wf Fvg4Shcpfa7gt3MFOaJTgEPMbIZrETmm3zHwEftR+Iplxvun5otMjpTCBYXnyeKvP8E3 TYfBeraoMZTXUvaJIEsrqy+CDRndyL0kY5uus1Py8QjRz02fjWuPHpy+DdhYdiKr2Zu+ UDCo+zPgZiDz2w3oC3XLsXej0/NVi637pxXHnEI0q0t5WikL2Cq24LbED4WQAN8+7O9+ wa5VJJdsCuiRuF3xPvfwFUDhMaZkClfBwlUvBn5UzMEYa8WMV8LNS/tVKvRhbn7+CFMT 84tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CAESZvzA; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a6553c6000000b00478ba6bfcf0si3905002pgr.703.2022.12.05.13.50.21; Mon, 05 Dec 2022 13:50:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CAESZvzA; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbiLEVmG (ORCPT + 81 others); Mon, 5 Dec 2022 16:42:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbiLEVlu (ORCPT ); Mon, 5 Dec 2022 16:41:50 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B0B22CCB9; Mon, 5 Dec 2022 13:41:48 -0800 (PST) Date: Mon, 05 Dec 2022 21:41:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670276507; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xemZrY8VvbFDpZkx2nsw8iOahizDN/r13dIQFo1Gd6U=; b=CAESZvzAL9MGvdiksyituk+t0hCiqz/8WBtSOGRECjSDmj+7d7m314OowR0/XivJUNnNIl ZhvisdldFhlcseBPLsO0YFAzC7UazuzB3WjPfpINcjRcY4Pqo+gf0kyJdHuM9w1lpw0HYu DuwALM6/3Ax39/9sy8fLooW7E5XC/XCb5JWTneVMtuWyixyUaWPTDq+GyX62W+9SCJWW+x 9ArZzkNOF+0JkalUGetA+7AKQ3j64A8HvM2JnovZZ61OpX3aKaCVnOmnewaUaHAnKBD1Nx nThkw25aGixM6I95ZoFX4mxIkSe642nhLr92wx7nUbre7BxCCCjSe+sqtZLKPg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670276507; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xemZrY8VvbFDpZkx2nsw8iOahizDN/r13dIQFo1Gd6U=; b=f5BJ8aTA/AWv0szLeqDz5VC/uP8KTjlwhps2Pxpic8llgfVO7ned44ap5r7PKelXZ8wB+y CKBBtRgAo9gUjrDQ== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] iommu/amd: Enable PCI/IMS Cc: Thomas Gleixner , Kevin Tian , Marc Zyngier , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221124232327.140571546@linutronix.de> References: <20221124232327.140571546@linutronix.de> MIME-Version: 1.0 Message-ID: <167027650647.4906.4169983710196863807.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/core branch of tip: Commit-ID: fa5745aca1dc819aee6463a2475b5c277f7cf8f6 Gitweb: https://git.kernel.org/tip/fa5745aca1dc819aee6463a2475b5c277f7cf8f6 Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:26:36 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 22:22:35 +01:00 iommu/amd: Enable PCI/IMS PCI/IMS works like PCI/MSI-X in the remapping. Just add the feature flag, but only when on real hardware. Virtualized IOMMUs need additional support. Signed-off-by: Thomas Gleixner Reviewed-by: Kevin Tian Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20221124232327.140571546@linutronix.de --- drivers/iommu/amd/iommu.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 7caccd8..4d28967 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -3649,11 +3649,20 @@ static struct irq_chip amd_ir_chip = { }; static const struct msi_parent_ops amdvi_msi_parent_ops = { - .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI, + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | + MSI_FLAG_MULTI_PCI_MSI | + MSI_FLAG_PCI_IMS, .prefix = "IR-", .init_dev_msi_info = msi_parent_init_dev_msi_info, }; +static const struct msi_parent_ops virt_amdvi_msi_parent_ops = { + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | + MSI_FLAG_MULTI_PCI_MSI, + .prefix = "vIR-", + .init_dev_msi_info = msi_parent_init_dev_msi_info, +}; + int amd_iommu_create_irq_domain(struct amd_iommu *iommu) { struct fwnode_handle *fn; @@ -3670,7 +3679,11 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu) irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_AMDVI); iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops; + + if (amd_iommu_np_cache) + iommu->ir_domain->msi_parent_ops = &virt_amdvi_msi_parent_ops; + else + iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops; return 0; }