From patchwork Thu Jul 27 19:54:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Das Neves X-Patchwork-Id: 127136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1332356vqo; Thu, 27 Jul 2023 12:58:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlHb0tRQJIdd2OKfKbmGnEa8rCRN+s9E8a5Mel8Ah21SOkZNSP+AVlMrZsbXAkKB+aiNhNs3 X-Received: by 2002:a05:6512:280d:b0:4f1:3d7d:409e with SMTP id cf13-20020a056512280d00b004f13d7d409emr223061lfb.0.1690487915268; Thu, 27 Jul 2023 12:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690487915; cv=none; d=google.com; s=arc-20160816; b=VnzR4T4cKWMLOys0EZ0zDFltR2My2B9Ege7BKo4TdsveGoM5D5B6IsWJ6aYrm3Oh3C P05s1MMOkus64RlyIfwGxECU3mvEK3G/X9Fpqo/3OBtnNjjhsLxmoMYHYbZClxpC3uaR nx20/PZw/LxNia8NF/KObcaUfqHeE7F87dE4LRBpSL/ZXdLTDJuHzyG1sSJUvGFc/ucb vY054MalVN6W8pjjwfJH69u/isZbMy5SMsKQ8c8gziZr1EyJHT+Va2M/8j0aisqfatLp XIZ6IsiVcm6sd8EmGHTfyxN28wXL61X9HT0oXBdY/FKTtCQuTehnd4rBLdRkxOaHokt2 cKAQ== 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=h738RNvcA5o4p69LOjSdBatj1DuwmgH8MKjylimMz/w=; fh=y8tS7hHyMnVm4J/EG8JBk7xmqgMCnIiFB1dTM3zggRY=; b=SJXqg/0J2xNCCQJaWrTAOIvwa/edP64oa0XKlve0oexV07cMPCIcaU7PPRi9zAFXgW 3uCZ5G5Qvojf8LZv3MJTCzLH1oJvsZnrdzGL+Jv/qLnRe6SXTvksMaxmlYsnNZV1i2nn YrCjIDv8Vte2rgIXr7a6LeOLYWva2qerLo7KbHuuJCcbTyxSbW8xFvH+FDETCn2T+3Nw G7bG/KCp+nooT4M2MBgn8/Lm+xaFR2QkGjpKYNDvTjXNzwb1pkOkSH/cWHwykw1zF8m5 T4lPFHvM0JPt3h6rgTQM2aMPg8zyj0LKKCEcEXYUCrkm/LWl6HaJuGYSjvzVHXeqYQcR aAKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=YbDzD2b4; 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=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a50fb07000000b0051dd2c07091si1317516edq.161.2023.07.27.12.58.10; Thu, 27 Jul 2023 12:58:35 -0700 (PDT) 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=@linux.microsoft.com header.s=default header.b=YbDzD2b4; 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=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232498AbjG0Tzn (ORCPT + 99 others); Thu, 27 Jul 2023 15:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbjG0TzC (ORCPT ); Thu, 27 Jul 2023 15:55:02 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4E1FE30D6; Thu, 27 Jul 2023 12:54:59 -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 73A482383EFA; Thu, 27 Jul 2023 12:54:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 73A482383EFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1690487697; bh=h738RNvcA5o4p69LOjSdBatj1DuwmgH8MKjylimMz/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbDzD2b4olu+68DoBQ3IDYod06BsI5456KkcX2Y8PhJ8nmjVqT3yyQD+RgZ+P0xU1 sE5xb5QU0Cl/hNfKiFK/KoI4oE52MSXCmdFbTbNKrC+gIzJy21h/fGFnEZewYwlpOa 0HCj2zCebxI/Q24mRmF/QwrObi+xh8fpMLbi7G0I= 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: mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@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 10/15] x86: hyperv: Add mshv_handler irq handler and setup function Date: Thu, 27 Jul 2023 12:54:45 -0700 Message-Id: <1690487690-2428-11-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772605056168116232 X-GMAIL-MSGID: 1772605056168116232 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 --- 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 e44291e902ae..442d00fe70f1 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -105,6 +105,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); @@ -115,6 +116,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(); @@ -139,6 +143,11 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_nested_vmbus_intr) 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 16f069beda78..678a3f2e1dc1 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -557,6 +557,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 9118d678b27a..2b20994d809e 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -193,6 +193,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));