Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp451170rdh; Sat, 23 Sep 2023 19:13:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEr2/I7aIQ8ymE0H7ivCOqasEZDh4Wr0wKYysmMpkbJIkPDJHVR+Xgb1+OmQW0Ql1x5IDQG X-Received: by 2002:a25:38f:0:b0:d81:89e9:9f48 with SMTP id 137-20020a25038f000000b00d8189e99f48mr2783790ybd.63.1695521615689; Sat, 23 Sep 2023 19:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695521615; cv=none; d=google.com; s=arc-20160816; b=wo20QhNwabUOEWgilaV3LUQyqRhWzHQj+Q53xNP84b6//7ZEnMuNrVzQzIOvV9AETY Bvg/yLpoYpS+bnPuC6XMuAXcbsVqKL+VlvrgSt3WCuq1S/8d6W+Q2Z2tze0UOu7WM3Bj Xo/3LpSTknZs37ksof/iQ0pSgi15RgSWCDJazTims5VLfXIcqTTkgAKRiFc9ME9pod7c U/PGlXONOXQbIZMXC2eyXDjlJVwEob/uE5mlLc9Nva4iCsLFDJVTnfQULsEcoANxbWEA cJ9KcT2qGAUXVDiDRQrrCMSrWvEelx008SJbaOonvbv8xdeY4Z6W4racTLIRl8hpKARX lzeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=hZuHNHNc96TSZL6yyLBe5wiPm/nLTQa1k0Xw7XRxngc=; fh=rrENblR9DW+P8f8MSnFC4QkpxyTeAbSNxgPLVTXlWGs=; b=FsPJcNWEPuC30Qi4EKcnepcCH5pkIKNlyc6patA8x5WMivUMInga2qmWh7Kz8u/lIP L6bNqCoZPUHVZyNyZGhuksvanWOctOy4UuLKEMJ9RlG8H5Utx7gfSGBZcsGKQyqYpB3E sj/rYQiQBQsSIr6EmaeAWJiWfiDDNkWRuHw8Fh+a0sZDje1X/dCtFmqO2eTZ05VY38lN j2HwnCvo6nkVxFpP2qsFDQkdbQedFf8NHkZfVcnFpX0UK8DtjKVGvL6XgabVRQFlypFH +VE4mzO3dtJ+uIRodq06OP9Zq75fdY1SmgO4OjhfxMNtc0JR6/R8L4DkLj2oXek+o5hh WKPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Z+yMBTWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r3-20020a63fc43000000b00578cca373e1si6903602pgk.165.2023.09.23.19.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 19:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Z+yMBTWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3A7C784D5704; Fri, 22 Sep 2023 11:39:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233539AbjIVSjW (ORCPT + 99 others); Fri, 22 Sep 2023 14:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233407AbjIVSit (ORCPT ); Fri, 22 Sep 2023 14:38:49 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F6CEF1; Fri, 22 Sep 2023 11:38:43 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id EC78C212C5D1; Fri, 22 Sep 2023 11:38:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EC78C212C5D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1695407922; bh=hZuHNHNc96TSZL6yyLBe5wiPm/nLTQa1k0Xw7XRxngc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+yMBTWEfdBpfU1cLWO9lCtWjp/B6kZSPJb3O0M6SmX0fMKYe0Fq0HiXqeb7ltCPE 0Bs/GbbPMZsARawTZuPVWNdCJt7ekl6x6gXLVSfMMYlxMfWRqGEC4TxX5FE5UO6IoI YDkxoZvlpxkfO3UNCj9RZ4065tcr8g9TZSRDXCpg= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Cc: patches@lists.linux.dev, mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, gregkh@linuxfoundation.org, haiyangz@microsoft.com, decui@microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com Subject: [PATCH v3 10/15] x86: hyperv: Add mshv_handler irq handler and setup function Date: Fri, 22 Sep 2023 11:38:30 -0700 Message-Id: <1695407915-12216-11-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695407915-12216-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1695407915-12216-1-git-send-email-nunodasneves@linux.microsoft.com> X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 11:39:22 -0700 (PDT) This will handle SYNIC interrupts such as intercepts, doorbells, and scheduling messages intended for the mshv driver. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu Reviewed-by: Tianyu Lan --- arch/x86/kernel/cpu/mshyperv.c | 9 +++++++++ drivers/hv/hv_common.c | 5 +++++ include/asm-generic/mshyperv.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 73fbcc003d68..b8c3177d6389 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -110,6 +110,7 @@ void hv_set_register(unsigned int reg, u64 value) } EXPORT_SYMBOL_GPL(hv_set_register); +static void (*mshv_handler)(void); static void (*vmbus_handler)(void); static void (*hv_stimer0_handler)(void); static void (*hv_kexec_handler)(void); @@ -120,6 +121,9 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback) struct pt_regs *old_regs = set_irq_regs(regs); inc_irq_stat(irq_hv_callback_count); + if (mshv_handler) + mshv_handler(); + if (vmbus_handler) vmbus_handler(); @@ -129,6 +133,11 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback) set_irq_regs(old_regs); } +void hv_setup_mshv_irq(void (*handler)(void)) +{ + mshv_handler = handler; +} + void hv_setup_vmbus_handler(void (*handler)(void)) { vmbus_handler = handler; diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 89f5c1fb2a35..092b0c727db9 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -585,6 +585,11 @@ void __weak hv_remove_vmbus_handler(void) } EXPORT_SYMBOL_GPL(hv_remove_vmbus_handler); +void __weak hv_setup_mshv_irq(void (*handler)(void)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_mshv_irq); + void __weak hv_setup_kexec_handler(void (*handler)(void)) { } diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 5a12e5754e97..0a9e8ff31b73 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -198,6 +198,8 @@ void hv_remove_vmbus_handler(void); void hv_setup_stimer0_handler(void (*handler)(void)); void hv_remove_stimer0_handler(void); +void hv_setup_mshv_irq(void (*handler)(void)); + void hv_setup_kexec_handler(void (*handler)(void)); void hv_remove_kexec_handler(void); void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)); -- 2.25.1