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: 29823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2408368wrr; Mon, 5 Dec 2022 10:26:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TFOeGsdHOvm8iZwbMb5qpcN9h9zTpQSakBoDL1xYBH0G69GAJUo0vmaWdNltwK8hLFhm4 X-Received: by 2002:a17:906:30c3:b0:7ba:a674:22e4 with SMTP id b3-20020a17090630c300b007baa67422e4mr46152224ejb.279.1670264763280; Mon, 05 Dec 2022 10:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670264763; cv=none; d=google.com; s=arc-20160816; b=KLQIJYcBv8A5l6chstBAdbeoNwrMHJIEqNBWQTJeDyu4HqpHwUyarjZUvg6SLEazLI fmW/emf498cieoPbVo+M4z8sPAShOptlN+YOkbMsoLC0xvK3imBYVMyNW+wVjuAVgPjN FDdi40Ve3JJwT/N03IkxSTCnzQtHSdn7yUIM11UnE7fRcKn+ieT5q0Xem0QuwFTcl0Si rcyaCFvvICcRP3kdggWRM59akZlgHWW5W2Vn8/SF4J/J9oZ7rWAPyjQuOwrX3z0edubK 8jsp/1DxZkgnN6oo5Maqm7osw7bklpU10iIkuf8pRCTkqSRrPO3EOQsE1wE6anLEJpXT rDGA== 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=1aV7J3QuScxKl1k3EtjWYIpQ27RM/miR/AHYADE+pWc=; b=qoBjKyV7w9iMeY4zmTLsSfyIj9vd0/tFA4phY3G3ECgleYSVYicvWN2t2caw6cFdNQ 8C55IFjS9wCJ4XQVMnFBqy8RSSAtJxGjP/3aumoCXqatezuY2gax6G0thiUO3R/uPzBS od+kdccAs/D1T6k+AApdxSSA5DK8N7UhBJD/pyKqZ1J0iSsdLSoCZQAKZ8YevofHaLu1 4AIiLPRqHPoHaI+8qD0qQfQNM1wzhluvxQl3B0thGLPcMVWSYk6YYN0V7qNkbxmsKcGF Kk8FrGY1oZavOdgUJjOmAnzgUJNMmfgr6hbKBfRQxV9X5QpMXlzXmM83+Vkno5LRAUIU BWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Wc0h/3zD"; dkim=neutral (no key) header.i=@linutronix.de header.b="/lp7XoA1"; 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 b11-20020a056402350b00b00461dca37cd0si180638edd.126.2022.12.05.10.25.37; Mon, 05 Dec 2022 10:26:03 -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="Wc0h/3zD"; dkim=neutral (no key) header.i=@linutronix.de header.b="/lp7XoA1"; 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 S232580AbiLESZX (ORCPT + 99 others); Mon, 5 Dec 2022 13:25:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbiLESZO (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 DF8F720BE8; 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=1aV7J3QuScxKl1k3EtjWYIpQ27RM/miR/AHYADE+pWc=; b=Wc0h/3zDWQA/Q80wtxFUpHwtSow8QS7L0MZvnZDne7dez5ONpPoP+xuTNUj0mYNR9Nz107 qfUFnVQI2OSM1/2whXbXAjhmJFhJhlls6N0AyHy0T+hyHChj+W+yU3BW83iQ2yvRNsGVj7 of37zjAzwpPTdppU9Zr85kN2MLVHDHGEJv26GRtKvYuyzWM8KIEH/0QxcbJO8nTnbhRO7Y KN1RsYDObi0SMATTKIk4SOW3+0FlSb+4MiKL1DQ3Vh3ePKqaqBSwj+XZATLCDyIJIN5EAG 9l3XCBuGyQ4K4thFGY9XEDoeOzatTiLAf4Kin59cza5cIhk6izCiG5RH/OQZyQ== 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=1aV7J3QuScxKl1k3EtjWYIpQ27RM/miR/AHYADE+pWc=; b=/lp7XoA10aCe/hgxNKzqRPkMRYrYmaj8baRs1KCY1DGBcQEuzsCCKdtYvlgozPTbcXcCDM V9k/EzHNBv5aZhAQ== 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/vt-d: Enable PCI/IMS Cc: Thomas Gleixner , Kevin Tian , Marc Zyngier , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221124232327.081482253@linutronix.de> References: <20221124232327.081482253@linutronix.de> MIME-Version: 1.0 Message-ID: <167026471037.4906.13014604167814802778.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?1750426167857201762?= X-GMAIL-MSGID: =?utf-8?q?1751399544299466536?= The following commit has been merged into the irq/core branch of tip: Commit-ID: 4f8d12389509c80f275a12926901d6619f2046c7 Gitweb: https://git.kernel.org/tip/4f8d12389509c80f275a12926901d6619f2046c7 Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:26:34 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 19:21:04 +01:00 iommu/vt-d: 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, e.g. for PASID. Signed-off-by: Thomas Gleixner Reviewed-by: Kevin Tian Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20221124232327.081482253@linutronix.de --- drivers/iommu/intel/irq_remapping.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c index 6fab407..a723f53 100644 --- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -82,7 +82,7 @@ static const struct irq_domain_ops intel_ir_domain_ops; static void iommu_disable_irq_remapping(struct intel_iommu *iommu); static int __init parse_ioapics_under_ir(void); -static const struct msi_parent_ops dmar_msi_parent_ops; +static const struct msi_parent_ops dmar_msi_parent_ops, virt_dmar_msi_parent_ops; static bool ir_pre_enabled(struct intel_iommu *iommu) { @@ -577,7 +577,11 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_DMAR); iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; - iommu->ir_domain->msi_parent_ops = &dmar_msi_parent_ops; + + if (cap_caching_mode(iommu->cap)) + iommu->ir_domain->msi_parent_ops = &virt_dmar_msi_parent_ops; + else + iommu->ir_domain->msi_parent_ops = &dmar_msi_parent_ops; ir_table->base = page_address(pages); ir_table->bitmap = bitmap; @@ -1429,11 +1433,20 @@ static const struct irq_domain_ops intel_ir_domain_ops = { }; static const struct msi_parent_ops dmar_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_dmar_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, +}; + /* * Support of Interrupt Remapping Unit Hotplug */