From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 677FDC678D4 for ; Wed, 1 Mar 2023 23:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjCAXiP (ORCPT ); Wed, 1 Mar 2023 18:38:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjCAXiD (ORCPT ); Wed, 1 Mar 2023 18:38:03 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21456191 for ; Wed, 1 Mar 2023 15:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677713882; x=1709249882; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=X+fPhGM+miLCMioUQX1fq5QvQADp974IGsVIuBa8IIM=; b=Aql3E/ZuO4ARPqEBFylMJIskEl/mwYpErfaS7ZlfOX0oX67sUtAA8RYr iZQWNXj2ZEHYfxAXbTvJtX4BpjRGycs4demGZ7p+BRFcd6mv0T2L1S/iC nDMBZXynt5uPwD+/2YEFjWYwXB/Vgwbct0936YK5Lm49SYseYo2FVlpF1 j74CQlOjyL0pbnbIR4ezJQmA2li6Ug5nOHRwQyUzms5TVbn59ySHr8bHD fOcfxB0nxQ5xM2YFf7MowjPvr1kqCYbKZlQS1Wrqs7P49yRqVQ7ikCJE5 UTCSvTk3BtwtkZwxggOynuUZBTXJ6Cqri3OOYqyaKyfLxvz3eYahGSacx w==; X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="420818700" X-IronPort-AV: E=Sophos;i="5.98,225,1673942400"; d="scan'208";a="420818700" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2023 15:37:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="738826807" X-IronPort-AV: E=Sophos;i="5.98,225,1673942400"; d="scan'208";a="738826807" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga008.fm.intel.com with ESMTP; 01 Mar 2023 15:37:56 -0800 From: Ricardo Neri To: Tony Luck , Dave Hansen , "Rafael J. Wysocki" , Reinette Chatre , Dan Williams , Len Brown Cc: Andi Kleen , Stephane Eranian , "Ravi V. Shankar" , Ricardo Neri , linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Ricardo Neri , David Woodhouse , Lu Baolu Subject: [PATCH v7 06/24] iommu/vt-d: Clear the redirection hint when the destination mode is physical Date: Wed, 1 Mar 2023 15:47:35 -0800 Message-Id: <20230301234753.28582-7-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230301234753.28582-1-ricardo.neri-calderon@linux.intel.com> References: <20230301234753.28582-1-ricardo.neri-calderon@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the destination mode of an interrupt is physical APICID, the interrupt is delivered only to the single CPU of which the physical APICID is specified in the destination ID field. The redirection hint is meaningless. Furthermore, on certain processors, the IOMMU does not deliver the interrupt when the delivery mode is NMI, the redirection hint is set, and the destination mode is physical. Clearing the redirection hint ensures that the NMI is delivered. Cc: Andi Kleen Cc: David Woodhouse Cc: "Ravi V. Shankar" Cc: Lu Baolu Cc: Stephane Eranian Cc: iommu@lists.linux-foundation.org Cc: linuxppc-dev@lists.ozlabs.org Suggested-by: Ashok Raj Reviewed-by: Lu Baolu Signed-off-by: Ricardo Neri --- Changes since v6: * None Changes since v5: * Introduced this patch. Changes since v4: * N/A Changes since v3: * N/A Changes since v2: * N/A Changes since v1: * N/A --- drivers/iommu/intel/irq_remapping.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c index 6d01fa078c36..2d68f94ae0ee 100644 --- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -1123,7 +1123,17 @@ static void prepare_irte(struct irte *irte, int vector, unsigned int dest) irte->dlvry_mode = apic->delivery_mode; irte->vector = vector; irte->dest_id = IRTE_DEST(dest); - irte->redir_hint = 1; + + /* + * When using the destination mode of physical APICID, only the + * processor specified in @dest receives the interrupt. The redirection + * hint is meaningless. + * + * Furthermore, on some processors, NMIs with physical delivery mode + * and the redirection hint set are delivered as regular interrupts + * or not delivered at all. + */ + irte->redir_hint = apic->dest_mode_logical; } struct irq_remap_ops intel_irq_remap_ops = { -- 2.25.1