Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3882722pxb; Mon, 4 Oct 2021 11:43:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/kwB+N1LgGkYZCWfIcLMEQ5uB6USo8ch0/RbO9uhq/h7K9cXvOv2+jaaqnAle0VJ6DHNU X-Received: by 2002:a17:906:2706:: with SMTP id z6mr19191376ejc.551.1633373033668; Mon, 04 Oct 2021 11:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633373033; cv=none; d=google.com; s=arc-20160816; b=D4KDPJZtwficn9JpM+fHdrmhV0ZROTOOpiLRXcW/EsbN8qBbT/rRqNL+Eko6YA//2Y 4tcS0PZpUiYxbTohRAQ/p+5DFNpPLRmzpla0AYcHiYb157YlSsBPbRBSvvuMru0u6GGc lIrSiNkd/ucVKC6+b3gdevHpf7jTOT5KP2qiVlVZuxlPQUn57ukAf3EIS1smE5X6b3sA sOG3TGkhbAdYfAqt9TDPbFWNnypfucnngegSE56z3dhN7xL6qFqHpeiqoStK2wnL3l7N HleLQEUIywk7iSnr3BevKHb15z5IRucoKD39SxZrQtWjsL7zIAmFZTwzJvo9ZQD6n7MB UUrg== 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=yNwbiaFFYv6uP3uHXedx4BxPHmGTgWcZBs2FftmHi40=; b=aCYFN19S5iX75MecTyXgWH4yd3W/FL1BePR9h4NHjtj4BSPb30a2oc5h1heX2Rmjw/ prOIjZm7WfrqTkU5fOma6orAl/B2VuSvYRdgnYZmMLfqueSUv/SA/BmcOupiEHDNoFko pFCUJE6cNtW+amIvfQ7JUUjp9xhqYcYP/LBK+5YylSemck7Ljvk7HVw4IgBAYmwy28S8 mPOYj2HuPm7wELR/ZPiFuW9jocsfqAEIOwpNMp1KVmq0yaixd4df6e2mpQQ0mZjrRN8p wmrSs3h5pobDXgXdVO1OjJ5PcQBmnmndl/kMeFwbGYspL5Heq/kZyGfyJ5eq0dZVfuyA H7Wg== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds3si24482832ejc.302.2021.10.04.11.43.29; Mon, 04 Oct 2021 11:43:53 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235702AbhJDR6q (ORCPT + 99 others); Mon, 4 Oct 2021 13:58:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:36156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235624AbhJDR6l (ORCPT ); Mon, 4 Oct 2021 13:58:41 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2DCF6115C; Mon, 4 Oct 2021 17:56:52 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mXS5H-00EhBv-45; Mon, 04 Oct 2021 18:49:03 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, qperret@google.com, dbrazdil@google.com, Steven Price , Andrew Jones , Fuad Tabba , Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: [PATCH v2 11/16] firmware/smccc: Call arch-specific hook on discovering KVM services Date: Mon, 4 Oct 2021 18:48:44 +0100 Message-Id: <20211004174849.2831548-12-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211004174849.2831548-1-maz@kernel.org> References: <20211004174849.2831548-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, qperret@google.com, dbrazdil@google.com, steven.price@arm.com, drjones@redhat.com, tabba@google.com, vatsa@codeaurora.org, sdonthineni@nvidia.com, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arm64 will soon require its own callback to initialise services that are only availably on this architecture. Introduce a hook that can be overloaded by the architecture. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/hypervisor.h | 1 + arch/arm64/include/asm/hypervisor.h | 1 + drivers/firmware/smccc/kvm_guest.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/arch/arm/include/asm/hypervisor.h b/arch/arm/include/asm/hypervisor.h index bd61502b9715..8133c8c81a35 100644 --- a/arch/arm/include/asm/hypervisor.h +++ b/arch/arm/include/asm/hypervisor.h @@ -6,5 +6,6 @@ void kvm_init_hyp_services(void); bool kvm_arm_hyp_service_available(u32 func_id); +void kvm_arm_init_hyp_services(void); #endif diff --git a/arch/arm64/include/asm/hypervisor.h b/arch/arm64/include/asm/hypervisor.h index 0ae427f352c8..8e77f411903f 100644 --- a/arch/arm64/include/asm/hypervisor.h +++ b/arch/arm64/include/asm/hypervisor.h @@ -6,5 +6,6 @@ void kvm_init_hyp_services(void); bool kvm_arm_hyp_service_available(u32 func_id); +void kvm_arm_init_hyp_services(void); #endif diff --git a/drivers/firmware/smccc/kvm_guest.c b/drivers/firmware/smccc/kvm_guest.c index 2d3e866decaa..56169e73252a 100644 --- a/drivers/firmware/smccc/kvm_guest.c +++ b/drivers/firmware/smccc/kvm_guest.c @@ -9,6 +9,8 @@ #include +void __weak kvm_arm_init_hyp_services(void) {} + static DECLARE_BITMAP(__kvm_arm_hyp_services, ARM_SMCCC_KVM_NUM_FUNCS) __ro_after_init = { }; void __init kvm_init_hyp_services(void) @@ -38,6 +40,8 @@ void __init kvm_init_hyp_services(void) pr_info("hypervisor services detected (0x%08lx 0x%08lx 0x%08lx 0x%08lx)\n", res.a3, res.a2, res.a1, res.a0); + + kvm_arm_init_hyp_services(); } bool kvm_arm_hyp_service_available(u32 func_id) -- 2.30.2