Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2590860pxa; Mon, 24 Aug 2020 19:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzle5b+hKsLW+s7WPM6+DXoDQtNt7DpABNk5Dez/qC5DlkhtuoEGyAeV3mrgTq/bwy8GWlq X-Received: by 2002:a50:eb9a:: with SMTP id y26mr4011497edr.123.1598323930702; Mon, 24 Aug 2020 19:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598323930; cv=none; d=google.com; s=arc-20160816; b=kg3W5qh51khX/vknYAhIUSU8cS6bRY2CA6ZMBAC4xiWt3IPdLOhDM1JRaVYdv1jGWe WnZd2X1ALOA3I8hB0zqIGqEULHnpoidbM0RzwU4Y0yDf70wrF2FtZLmi8y3O4y7i4B27 cBHIr9WphA1O7piGcjWTBj/V0EDbNTLFMOSVL0ZyJCJU/ijLqPz8Yem19+F0D0XZ4LoX eDckUHFI88dYQfHmqrIqR/2v5YqOSjb72TAjYe9LDs98So0KVaMPodego81fX4b9X3fp ZKBqh2PkRPjKOTbYSwnJ0BQ4l3eWQ5Sysvp+q34aqcwQyXgNkOD4oejzdC/ZGnkwLadf o1WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=v0Au+lz32KQNReBt2WCs39DAeAu9qBARKCRfQo39Pw8=; b=nZcFwf7ZuW7wsm1JJ5v6pnXbsVNa5aHJT01a8PGc/M5kni+T01eToZvfkqK+IWq2uz H6btxZM3oHCbsX7n8TSKYg+xysB/YPWFCzEPLGw9IdOVG2xZHt2CL6g4sr04iiEBRTZO 9yadsM2CFXbsmFZiyoQzt1z8mww1HQQcjaL1m+jBv9/7JFTLOM/nhDS1TZJQ+HpA+noH A/Rc8HXcV53BanjwDpaadsWaxkT1uxErQP2IsHdhSDhgIl6I6bBsDNl777pEd/5yQ7jo QZAbn2mWCZvL5/nWT/elwtm/bjdCl/Fj02rQlfzz5XIvywj1oDZ4Caj4rszE+nzaqvVZ 1tUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si3715401edq.394.2020.08.24.19.51.47; Mon, 24 Aug 2020 19:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727813AbgHYCuq (ORCPT + 99 others); Mon, 24 Aug 2020 22:50:46 -0400 Received: from mga18.intel.com ([134.134.136.126]:37715 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgHYCun (ORCPT ); Mon, 24 Aug 2020 22:50:43 -0400 IronPort-SDR: AuwOuu/gzwybZ/4T45yOW8Ai7iMWIX+k9xKTRDv5gVyqw8STovJW4Q+DdNQBRQ9SfHowJQWQfD WCXtQ9D1NizQ== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="143690750" X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="143690750" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 19:50:43 -0700 IronPort-SDR: 8OZdsr4heA13TcngIN0C2OSTLJzK0W2zO9RYnHWx2kbsHbY3bspIbwjL/Iwz8H84WnEKQMKhzf liuT+io3Spxg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="312409708" Received: from shsi6026.sh.intel.com ([10.239.147.135]) by orsmga002.jf.intel.com with ESMTP; 24 Aug 2020 19:50:39 -0700 From: shuo.a.liu@intel.com To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sean Christopherson , Yu Wang , Reinette Chatre , x86@kernel.org, Shuo Liu , Yakui Zhao , Zhi Wang , Dave Hansen , Dan Williams , Fengwei Yin , Zhenyu Wang Subject: [PATCH 02/17] x86/acrn: Introduce acrn_{setup, remove}_intr_handler() Date: Tue, 25 Aug 2020 10:45:02 +0800 Message-Id: <20200825024516.16766-3-shuo.a.liu@intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825024516.16766-1-shuo.a.liu@intel.com> References: <20200825024516.16766-1-shuo.a.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shuo Liu The ACRN Hypervisor builds an I/O request when a trapped I/O access happens in User VM. Then, ACRN Hypervisor issues an upcall by sending a notification interrupt to the Service VM. HSM in the Service VM needs to hook the notification interrupt to handle I/O requests. Notification interrupts from ACRN Hypervisor are already supported and a, currently uninitialized, callback called. Export two APIs for HSM to setup/remove its callback. Originally-by: Yakui Zhao Signed-off-by: Shuo Liu Reviewed-by: Zhi Wang Reviewed-by: Reinette Chatre Cc: Dave Hansen Cc: Sean Christopherson Cc: Dan Williams Cc: Fengwei Yin Cc: Zhi Wang Cc: Zhenyu Wang Cc: Yu Wang Cc: Reinette Chatre --- arch/x86/include/asm/acrn.h | 8 ++++++++ arch/x86/kernel/cpu/acrn.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 arch/x86/include/asm/acrn.h diff --git a/arch/x86/include/asm/acrn.h b/arch/x86/include/asm/acrn.h new file mode 100644 index 000000000000..ff259b69cde7 --- /dev/null +++ b/arch/x86/include/asm/acrn.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_ACRN_H +#define _ASM_X86_ACRN_H + +void acrn_setup_intr_handler(void (*handler)(void)); +void acrn_remove_intr_handler(void); + +#endif /* _ASM_X86_ACRN_H */ diff --git a/arch/x86/kernel/cpu/acrn.c b/arch/x86/kernel/cpu/acrn.c index 0b2c03943ac6..bd1d7e759a0f 100644 --- a/arch/x86/kernel/cpu/acrn.c +++ b/arch/x86/kernel/cpu/acrn.c @@ -9,7 +9,11 @@ * */ +#define pr_fmt(fmt) "acrn: " fmt + #include + +#include #include #include #include @@ -55,6 +59,21 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_acrn_hv_callback) set_irq_regs(old_regs); } +void acrn_setup_intr_handler(void (*handler)(void)) +{ + if (acrn_intr_handler) + pr_warn("Overwrite the acrn_intr_handler.\n"); + + acrn_intr_handler = handler; +} +EXPORT_SYMBOL_GPL(acrn_setup_intr_handler); + +void acrn_remove_intr_handler(void) +{ + acrn_intr_handler = NULL; +} +EXPORT_SYMBOL_GPL(acrn_remove_intr_handler); + const __initconst struct hypervisor_x86 x86_hyper_acrn = { .name = "ACRN", .detect = acrn_detect, -- 2.28.0