From patchwork Mon Dec 5 18:25:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 29824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2408391wrr; Mon, 5 Dec 2022 10:26:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf4RYnVlqPjJoGIq5szEOmRyPDZ3yL6jaf4AINf3OT8v96sn7eV9llKNjKqiGLSmMyPvcIQK X-Received: by 2002:a17:906:9c89:b0:7c0:7ab4:3715 with SMTP id fj9-20020a1709069c8900b007c07ab43715mr22583977ejc.343.1670264765407; Mon, 05 Dec 2022 10:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670264765; cv=none; d=google.com; s=arc-20160816; b=nTZwlcUfGXmvHxvdXkLO85sGtjykguTEzne9pu3PoIw0J1fN55xWDOeGj00PsQNczI xfglAXg2oIdw1KDSYDRTzF3FA4OFkPhikIH01/9y/03E537EVqFDcpsS4QmF+oyChtp8 1+KCmekknu5bFx8Ci+A/k5KTx0F9K1KmJ0g7L5Un3qjNroutJsXDadQK2HZQI0Rix62f ukDWPvbXoDtBP5EN3Z6glOGaqvnguBKl2Kb4av5wGZL9uHKA+7as9m4sudNfDgBwxaAd njj5sNTthc1UfRrYeY5d7XVFJJdD+sKyT3St9X5j4QswnK5WWrtb7KDUprLzS2iIXiCd 78Xw== 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=k5wGbLfHqr1nnSCyA5sXrLPy2oxdZCa8YH5qCdyQ1sc=; b=qKSygWMUk6rT+A0sZgEnwYcHTaxE+k/EkT6bs3FjUHSYzzjSRXN7ZCsgN9yahIosAc 2/YL8kmpwKHIgz5qgfgpsml/r1AMXcQ2ebrIhN5/C1Z7yzi8QMyVtGSFktLIIx715LAl uWTkhOGgCqb1Z481rrscTDjwC12KW3I0MKxCen16UV+rWPNXQun+ZN1BFlqOOW33S3RN aEk56eTKReSLtAw88uugxzo1ZSNYwgYpS+OYPXQHhocynalmoC2zRSU+vGla+Q7EiXdn OkihvVan1aiHH/uMV+PXKAUMRzP+g7tdimMrU8+l8Buk8fnaoD4IWck4phLrEhpUfIL8 oJfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VsdEpw7Q; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba11-20020a0564021acb00b0046bcc982714si127220edb.481.2022.12.05.10.25.42; Mon, 05 Dec 2022 10:26:05 -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=VsdEpw7Q; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S232702AbiLESZZ (ORCPT + 99 others); Mon, 5 Dec 2022 13:25:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232284AbiLESZO (ORCPT ); Mon, 5 Dec 2022 13:25:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2A3209AE; Mon, 5 Dec 2022 10:25:12 -0800 (PST) Date: Mon, 05 Dec 2022 18:25:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670264710; 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=k5wGbLfHqr1nnSCyA5sXrLPy2oxdZCa8YH5qCdyQ1sc=; b=VsdEpw7QEubc634gEgU0QzWxeJmvPBUV375L406qrO7OWthTQ/YnBXNjcEAihLP7rY/4So BjRvZeFxLoyIv7npkE+DXBIqixz1tzqI1qFFrnn03JSg9mUlp0SYxLJihRca3igPnTWDlN gQe0JhqH5+Pm6Fro3hC84kVpJdyvpRBNZQr+o9Jdg3rMbhFvVksrB3edIMcWdQuT4HbB2e sdaoTV+a2K97G0ir6CHohca5oG1tCFfizFe5Ux/vHlVVQJUB3mFdseAyh1dBfiOq6EKSIV T2R2REWMYmeETzN2oHW/aIrmCa233hSoeEVyfd8uL6lp1gZH3YiJcIUaV2e9vA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670264710; 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=k5wGbLfHqr1nnSCyA5sXrLPy2oxdZCa8YH5qCdyQ1sc=; b=ab8V/6eVP68gBrnF+0SPtujoPk0eijMcrVYUPkd1rBy7Rw/P2gwmQmWPnN+0mqi4TC2T9v VvrREKCFM4tnEPCg== 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: <167026471013.4906.1375739872985314530.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750427101373234803?= X-GMAIL-MSGID: =?utf-8?q?1751399546597061591?= The following commit has been merged into the irq/core branch of tip: Commit-ID: 73c658f384d7a48e0e18ef0bc5458c8c6ea80574 Gitweb: https://git.kernel.org/tip/73c658f384d7a48e0e18ef0bc5458c8c6ea80574 Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:26:36 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 19:21:05 +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; }