Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp569380pxv; Thu, 15 Jul 2021 10:26:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2Xd/6LRLTqT/bRhcIGKWGnHCPVohQyFAR0b2mhhj5SgbgVxtdCWAwp/e2q4HojaHtXBUV X-Received: by 2002:a5d:960b:: with SMTP id w11mr4047357iol.138.1626369966944; Thu, 15 Jul 2021 10:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626369966; cv=none; d=google.com; s=arc-20160816; b=QkE0h+JtC+ONEY7JvVaqDteoogzo4lOmkhxm/VB8+R5wm5vTVc1Vpdr0wo4g9hqDKF 465A/+DDZfYZx3Vz9Ih5fH799T8OWrf3a1Z7xDY50YKlwujO/Gi2s6qJYLdGSvcIGkln BzH9b48DKQh6i4mbepfcYO+iQEC1lGpT1P2Uwa7FIE5X2tqGrgH0H22K6jNISeGba29x OnWfoQPEqVJIsm4IZT7eGJlNwfSYMQfVOkGFrd9wK6pSyWWGWsmF4hkSZW750es2V/6R tMG/1ZwUvUEpa8xdUZqlM1WHcybGdncCEN1EazBwaD8/5U6CJmyiTwywSP06Hc73VVUV +Wfw== 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=AV1CGJy37Z3gaDNke0A5+mYHffstUw23hdhazbGiO21QN8jvHxjaKlrbsWDRwlPUIO GpXxUcwGh+//Vj/RrRp3NA4Bk4MtoiOfBtN5tUyoes0qGUjFOIpE84/sQfxO0qeiWREj SBFkzySs4N/cZmoSNrNJUb1H2xT52U+iepXv8F6vz7P4Prk8wJKWwga76CdPrL0V0sVj 8t1YzfndigEqIcLI5OXNeWTnSG7eNRuwNUsy/3VF6QZp/Trq118t7pf2LLTT7P6Nttf9 BXOi+Y4EuMobJt9ZR18GvUgYEwc9ouuRi571Nb3soy5kRTk06O+zx3f0h5sn8MCA+UiB jwEA== 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 b8si7718554jav.94.2021.07.15.10.25.54; Thu, 15 Jul 2021 10:26:06 -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 S236792AbhGOQ5I (ORCPT + 99 others); Thu, 15 Jul 2021 12:57:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:48770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236785AbhGOQ5E (ORCPT ); Thu, 15 Jul 2021 12:57:04 -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 3BCA76128D; Thu, 15 Jul 2021 16:54:11 +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 1m44Ha-00DYjr-Dm; Thu, 15 Jul 2021 17:32:18 +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, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: [PATCH 11/16] firmware/smccc: Call arch-specific hook on discovering KVM services Date: Thu, 15 Jul 2021 17:31:54 +0100 Message-Id: <20210715163159.1480168-12-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210715163159.1480168-1-maz@kernel.org> References: <20210715163159.1480168-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, 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