Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5077532rdb; Tue, 12 Dec 2023 19:44:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOi2/P+EI7S0zmshaPxr5ytvlDX9H2xQqsfeTQnFJaVOGZI2nn21SKYw5+k+6NBVZTzzb9 X-Received: by 2002:a05:6e02:174a:b0:35d:5995:1d71 with SMTP id y10-20020a056e02174a00b0035d59951d71mr13410803ill.54.1702439076579; Tue, 12 Dec 2023 19:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702439076; cv=none; d=google.com; s=arc-20160816; b=pTrBOP7kNKGocmlv+787C7/cx0t014WykeMQ40DS0mWTITuIja/4EtuoTExb2/gDVn mVoiz2209E3L3/9QeOqWz3KAWQYHHbRB82sk1eCJ9jUEuhNg+vgNo4WkQnDgAEO/tCaf wrPKCvJXxnM/M1dX5Q2xz4zsKwVoz5PZaEkceY2da6a1JL3LF7UdAVEr6hYc6XE3UaXd gw0zhDge3AggEJSUukhF40IRi5q11aNJuH8yC1+gfXq0OO7qPklKAAmUl26CHwvZnjo0 L+NJ8blyjKSw/vT99piaEFkzZd1doPILinY7RqyeM7hjaPVdAHA0EbLV3FjxiiWAgB0B 7lfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=7qF2xFkWlVSsFO9bsob/upuqqPfE2jWaLQPf36+NNkc=; fh=ZvpbeHpP0Y0v3u+CaZzOwTVebjaGJIGbrjWY8xhkDeQ=; b=xnfEnEWaTz9wDQVjEtw50nzfz2RsrAuYej4ezUe+g/YFPdw61FZyUIhQ+pwankRm1n sQsKO1nCZ9XyCnee+VKpTgJErth4gSWL/S0y+eNMIQqG3+DVkxYQb4x1Gzo1f3DKbmZH TxkAfiSPmHq9Ly8csG7YkkhB6c15f/muPK+rcOO6d/fM4it1Da46jjCZcvBgw6/rvP/F SmW9okblJLVRB7Vzj/6d0r8l/TP6GopDLcI54S/RY6Y+oGtQKLVu125nEnTqpW2tMNv7 7a4XxN12ctFl+OEezdyF5fxxUvzy3JgqGVBt1Lmd/gKArG7vBnT2W3SWeSK/jjee1uVc A7+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Vi6NzdT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id ju2-20020a170903428200b001d0ad0cf9e1si8644337plb.286.2023.12.12.19.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 19:44:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Vi6NzdT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0ED108043ECD; Tue, 12 Dec 2023 19:44:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378409AbjLMDhN (ORCPT + 99 others); Tue, 12 Dec 2023 22:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjLMDhM (ORCPT ); Tue, 12 Dec 2023 22:37:12 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D60FB7; Tue, 12 Dec 2023 19:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702438639; x=1733974639; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/TTYLl6m3nDoZ6t2LsN549k9K+o9cYhBy102gdNwk1c=; b=Vi6NzdT6kd3JMjVYms06tVD4Gdpqt3D2xROK79nOy7Pti5Wt4pKrP306 gVGdQ5XhEfrmssw9i/Ugz0sW/HMnTij6/C6UejRKJcEjU42xNHvLKn8A2 zcUsoGbkDr7/pGWRq89JnC8vciWZRIFYq3dTZhMvwmFxxF1URDv4TWnKg UA3i3C98NkVRv09OclxzdiMSmA9YyeMjH18F3GhcNiOxdQT05LnwiUilz oUxC5oAxxJX06QmMoZT6cq5vPu9l/IB3tuhRrFxo2KMwZc+XfMvN0xseb Xr67EZgChn0pWZOSI/gSbDKKV5w/A6XWfPz9MdqNORjTE/zAnA+9AADmK g==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="2081089" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="2081089" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 19:37:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="917520199" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="917520199" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 19:37:18 -0800 Date: Tue, 12 Dec 2023 19:42:13 -0800 From: Jacob Pan To: Thomas Gleixner Cc: LKML , X86 Kernel , iommu@lists.linux.dev, Lu Baolu , kvm@vger.kernel.org, Dave Hansen , Joerg Roedel , "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Raj Ashok , "Tian, Kevin" , maz@kernel.org, peterz@infradead.org, seanjc@google.com, Robin Murphy , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH RFC 11/13] iommu/vt-d: Add an irq_chip for posted MSIs Message-ID: <20231212194213.1ad94584@jacob-builder> In-Reply-To: <87wmtrt625.ffs@tglx> References: <20231112041643.2868316-1-jacob.jun.pan@linux.intel.com> <20231112041643.2868316-12-jacob.jun.pan@linux.intel.com> <87wmtrt625.ffs@tglx> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 19:44:34 -0800 (PST) Hi Thomas, On Wed, 06 Dec 2023 21:44:02 +0100, Thomas Gleixner wrote: > On Sat, Nov 11 2023 at 20:16, Jacob Pan wrote: > > static void fill_msi_msg(struct msi_msg *msg, u32 index, u32 subhandle) > > { > > memset(msg, 0, sizeof(*msg)); > > @@ -1361,7 +1397,7 @@ static int intel_irq_remapping_alloc(struct > > irq_domain *domain, > > irq_data->hwirq = (index << 16) + i; > > irq_data->chip_data = ird; > > - irq_data->chip = &intel_ir_chip; > > + irq_data->chip = posted_msi_supported() ? > > &intel_ir_chip_post_msi : &intel_ir_chip; > > This is just wrong because you change the chip to posted for _ALL_ > domains unconditionally. > > The only domains which want this chip are the PCI/MSI domains. And those > are distinct from the domains which serve IO/APIC, HPET, no? > > So you can set that chip only for PCI/MSI and just let IO/APIC, HPET > domains keep the original chip, which spares any modification of the > IO/APIC domain. > > make sense. - irq_data->chip = posted_msi_supported() ? &intel_ir_chip_post_msi : &intel_ir_chip; + if ((info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI) && posted_msi_supported()) + irq_data->chip = &intel_ir_chip_post_msi; + else + irq_data->chip = &intel_ir_chip; Now in IRQ debugfs, I can see the correct IR chips for IOAPIC IRQs and MSIs. e.g domain: IO-APIC-8 hwirq: 0x9 chip: IR-IO-APIC flags: 0x410 IRQCHIP_SKIP_SET_WAKE parent: domain: INTEL-IR-9-13 hwirq: 0x80000 chip: INTEL-IR flags: 0x0 parent: domain: VECTOR domain: IR-PCI-MSI-0000:3d:00.4-11 hwirq: 0x0 chip: IR-PCI-MSI-0000:3d:00.4 flags: 0x430 IRQCHIP_SKIP_SET_WAKE IRQCHIP_ONESHOT_SAFE parent: domain: INTEL-IR-4-13 hwirq: 0x0 chip: INTEL-IR-POST flags: 0x0 parent: domain: VECTOR Thanks, Jacob