From patchwork Thu Oct 12 03:26:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lu Yao X-Patchwork-Id: 151679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp957418vqb; Wed, 11 Oct 2023 20:27:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2gsFR56hGvWa0oRCOXBTzCPeOPB+HYSKXxyyZTofU6nl1fMgb0LUudfhKMdylGlyK2EgN X-Received: by 2002:a05:6a00:3985:b0:68f:c8b3:3077 with SMTP id fi5-20020a056a00398500b0068fc8b33077mr24749135pfb.1.1697081253091; Wed, 11 Oct 2023 20:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697081253; cv=none; d=google.com; s=arc-20160816; b=s3knRTN2dYk1Y5xGz8IQ/arKZpXCOPRGxbcD+AH84v3cPJNXfg3WdN8SZzPHy1cOx8 3qwG5WhYJ75rHyE9YrvNf5HTK/mN9MatgqjEoyWKCNOksizZhzMRHtRJqjzER6bccwbi 0BlsHwhhkm2bXtBdRxZd6let8xUFoy+oXqwKIJw+l/ssbwY1UtmiHGqc6td2nNEFnNtl uoq9QpotfiCo8C915UMuEgSVsE2ARYz2qPgQL2/sSxXsF8tcMBGPiEat51YH3WSFCQPD m9fweigQXnsFgL2w7X/btP/51/37YCvhpGLFGbEB43f7vtvhxegN9VKQeC0okp6Zy1mo 11EQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=G8JvVCA3vnUFW2tvobraphCoFoWG3RNDcxg2pC3zemM=; fh=JHrkYf7KSaYTRXcn1TAvf8Xjvh4ojz6+thr229mjObo=; b=iT1yj/dgD0XuCjqw0vuStAlvUdK7DKmPrAyWRldao8sO6Vl6uvzVPEKr66a7QIO0lm baiHajNlF3cQsBXOsBRPX91pMAFX7o11XW82rKftzX7n75lVaf/0/u1VrcHRMQzoPKmU wBSujrv3iduYbaEOi/8LNjM7Dt5DtGrsKM/lLRY5nPrYXIyhxMZvG38k31qV4W6gL6Nj 7FvIzhsRDx26X/3auHfBhc/PzwV57R1+5gpUqI2WXVTHdFDlhL0YP7EJ0g5ZvDP6DWOH OhcVAby/rHMcPRBavUwSwLv8/SFBw9Kwnx4Fzsn5MHe4z9nUn4cIx8LNo/taw8VU5Cxr g4+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id x27-20020a056a00189b00b0068e47f319d9si14009443pfh.280.2023.10.11.20.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 87C5D80473EC; Wed, 11 Oct 2023 20:27:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376785AbjJLD1T (ORCPT + 18 others); Wed, 11 Oct 2023 23:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234050AbjJLD1S (ORCPT ); Wed, 11 Oct 2023 23:27:18 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA46A4 for ; Wed, 11 Oct 2023 20:27:15 -0700 (PDT) X-UUID: 8082050961664414ac8c087896282905-20231012 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:10d5f7a9-3d12-473a-8444-bd7c2cb1cc91,IP:5,U RL:25,TC:0,Content:-25,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,A CTION:release,TS:15 X-CID-INFO: VERSION:1.1.32,REQID:10d5f7a9-3d12-473a-8444-bd7c2cb1cc91,IP:5,URL :25,TC:0,Content:-25,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:15 X-CID-META: VersionHash:5f78ec9,CLOUDID:f5b6b1f0-9a6e-4c39-b73e-f2bc08ca3dc5,B ulkID:2310121127047JV2J5CC,BulkQuantity:0,Recheck:0,SF:24|17|19|44|66|38|1 02,TC:nil,Content:0,EDM:5,IP:-2,URL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil, COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_ULN, TF_CID_SPAM_SNR X-UUID: 8082050961664414ac8c087896282905-20231012 X-User: yaolu@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1332845596; Thu, 12 Oct 2023 11:27:02 +0800 From: Lu Yao To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, rdunlap@infradead.org, lkp@intel.com, Lu Yao Subject: [PATCH v3] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Date: Thu, 12 Oct 2023 11:26:59 +0800 Message-Id: <20231012032659.323251-1-yaolu@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231011055749.98840-1-yaolu@kylinos.cn> References: <20231011055749.98840-1-yaolu@kylinos.cn> MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 20:27:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779437575006491060 X-GMAIL-MSGID: 1779518671906396527 When compiling the x86 kernel, if X86_LOCAL_APIC is not enabled but GENERIC_MSI_IRQ is selected in '.config', the following compilation error will occur: include/linux/gpio/driver.h:38:19: error: field 'msiinfo' has incomplete type kernel/irq/msi.c:752:5: error: invalid use of incomplete typedef 'msi_alloc_info_t' {aka 'struct irq_alloc_info'} kernel/irq/msi.c:740:1: error: control reaches end of non-void function This is because file such as 'kernel/irq/msi.c' only depends on 'GENERIC_MSI_IRQ', and uses 'struct msi_alloc_info_t'. However, this struct depends on 'X86_LOCAL_APIC'. When enable 'GENERIC_MSI_IRQ' or 'X86_LOCAL_APIC' will select 'IRQ_DOMAIN_HIERARCHY', so exposing this struct using 'IRQ_DOMAIN_HIERARCHY' rather than 'X86_LOCAL_APIC'. Under the above conditions, if 'HPET_TIMER' is selected, the following compilation error will occur: arch/x86/kernel/hpet.c:550:13: error: ‘x86_vector_domain’ undeclared arch/x86/kernel/hpet.c:600:9: error: implicit declaration of function ‘init_irq_alloc_info’ This is because 'x86_vector_domain' is defined in 'kernel/apic/vector.c' which is compiled only when 'X86_LOCAL_APIC' is enabled. Besides, function 'msi_domain_set_affinity' is defined in 'include/linux/msi.h' which depends on 'GENERIC_MSI_IRQ'. So use 'X86_LOCAL_APIC' and 'GENERIC_MSI_IRQ' to expose these code. Tested-by: Randy Dunlap Signed-off-by: Lu Yao --- Change from v2: * Fix arch/x86/kernel/hpet.c compiled error when enable 'X86_LOCAL_APIC' 'HPET_TIMER' but disable 'GENERIC_MSI_IRQ'. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310120849.zrfrI44Z-lkp@intel.com/ v2: https://patchew.org/linux/20231011055749.98840-1-yaolu@kylinos.cn/ Change from v1: * Fix arch/x86/kernel/hpet.c compiled error when enable 'X86_LOCAL_APIC' 'GENERIC_MSI_IRQ' 'HPET_TIMER' Thanks to Randy for the feedback. v1: https://lore.kernel.org/lkml/20231008082827.279154-1-yaolu@kylinos.cn/ --- arch/x86/include/asm/hw_irq.h | 6 +++--- arch/x86/kernel/hpet.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 551829884734..b02c3cd3c0f6 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h @@ -28,7 +28,7 @@ #include #include -#ifdef CONFIG_X86_LOCAL_APIC +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY struct irq_data; struct pci_dev; struct msi_desc; @@ -105,10 +105,10 @@ static inline void irq_complete_move(struct irq_cfg *c) { } #endif extern void apic_ack_edge(struct irq_data *data); -#else /* CONFIG_X86_LOCAL_APIC */ +#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */ static inline void lock_vector_lock(void) {} static inline void unlock_vector_lock(void) {} -#endif /* CONFIG_X86_LOCAL_APIC */ +#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ /* Statistics */ extern atomic_t irq_err_count; diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 1648aa0204d9..41eecf180b7f 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -52,7 +52,7 @@ unsigned long hpet_address; u8 hpet_blockid; /* OS timer block num */ bool hpet_msi_disable; -#ifdef CONFIG_GENERIC_MSI_IRQ +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ) static DEFINE_PER_CPU(struct hpet_channel *, cpu_hpet_channel); static struct irq_domain *hpet_domain; #endif @@ -469,7 +469,7 @@ static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc) /* * HPET MSI Support */ -#ifdef CONFIG_GENERIC_MSI_IRQ +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ) static void hpet_msi_unmask(struct irq_data *data) { struct hpet_channel *hc = irq_data_get_irq_handler_data(data);