From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFB5DC433EF for ; Wed, 8 Sep 2021 12:35:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 796E661155 for ; Wed, 8 Sep 2021 12:35:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 796E661155 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W24sTXW7a9SD3+JCVdiEpD45VRkkXi1fkPX7BPquLuU=; b=tQsIKtAyp6jTas T34EDhbY8qlMVpaa/u+naxxYtrpkoJ/4VtHhuh+35OOYAWj4Tg+kWstU12EI2wJpyDUwmfhfOnDv7 FdxOfAqOFzDUKOj8SSQnYq9SsIjT2G0BQQcmdMgdWUtgJ/JTePn9SGRl4jHR43ihrswgMM8zRyWAW 7mCn0dCxx3e1lRSFg/9+huhde3Rlf0zd3B0bqKmCoUsOo20WC2T+iArLo0x0mZild/paP/kT9Sg3w 2VdsuaFjRvpx+mgqZpBxaNpi0RKpAn59SXag+TEWWpCIeqnFKQrjL5OP5nnU2t8BNZfow0lgXp6xt PP58LpgArgyqGg7FzqRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNwld-006iAj-Oh; Wed, 08 Sep 2021 12:33:29 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNwlN-006iAP-5z for linux-arm-kernel@lists.infradead.org; Wed, 08 Sep 2021 12:33:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631104391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aWw53LNgJz3aDc43XCZOPsV9FvfAENW+YZYZivjZJN4=; b=cKLVltDOE1OiFTOPcX1TSsRFtoz7lD7ZXx8JUq2rA/ABgHbTVI1iWyHLrmDyhtGunFEBl1 YLMWL75qGyUHASWRUzCsYRcw7ExT0AGotvXk1Oy4mohEKq3AuMbMPTK/ZgCkIcSajQB2tZ 1rrukpXSu/gKF7RD02TkqiC/FCTtn3U= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-cZ65NaGxM_WQfrwohi5-Jg-1; Wed, 08 Sep 2021 08:33:10 -0400 X-MC-Unique: cZ65NaGxM_WQfrwohi5-Jg-1 Received: by mail-ej1-f69.google.com with SMTP id n18-20020a170906089200b005dc91303dfeso908598eje.15 for ; Wed, 08 Sep 2021 05:33:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aWw53LNgJz3aDc43XCZOPsV9FvfAENW+YZYZivjZJN4=; b=M20CwqBf/+WOxO5IDdIW55k0MCFHALFRsVq249Yuv+mkHFt7w6NAqWb8NEpTRiLWk1 7qQynRTuFFH5art9HxYK+SuwQRGFot78YEyioevqco1Xw4+KbkHpol7WFTKCCFq2deeQ DnTLlN25tjiHPtIjt1WbFp+Pd7WIVnTFYCgD7COvQeLmRf3Z9+up6HfMp/DQE3NbE2Iz DDbzP5Wc/L7Ww1gIBrxWUtb5IEHxHWf2iU9NZA6qCoamVEKaoR0PSvjlLpS41IrF/RSf lOdPRLCr1quc8+6P+aPwdeHtEn8CaUfJMTsAfocS2UCtYGKjEO0LyyEysgTjFs0WJcBq hAqA== X-Gm-Message-State: AOAM531ePPwcFspwBisrzijeplkJJpfd3bm7kHp6S7G/KuF6hforfN8/ qNgHIyxlFo2ufKfyuTNZwFySBg41ePE7bs0MguJwM+a/5JvFSYpUisTiDg25xvDHNuoiIJtVRLE LpEo+9sg+MV9+hO0AydQzxaXE3AlcP9dueM0= X-Received: by 2002:a17:906:dc43:: with SMTP id yz3mr3872906ejb.467.1631104389136; Wed, 08 Sep 2021 05:33:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIuRzcv6t607G/tVLSQPrkOuXVPBvLzyNFDBGRHwQRCQr3jx8byLjmzZ6F+EPiIBVQ5zUG3w== X-Received: by 2002:a17:906:dc43:: with SMTP id yz3mr3872889ejb.467.1631104388955; Wed, 08 Sep 2021 05:33:08 -0700 (PDT) Received: from gator (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id h2sm1156061edd.43.2021.09.08.05.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 05:33:08 -0700 (PDT) Date: Wed, 8 Sep 2021 14:33:06 +0200 From: Andrew Jones To: Fuad Tabba Cc: kvmarm@lists.cs.columbia.edu, maz@kernel.org, will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, pbonzini@redhat.com, oupton@google.com, qperret@google.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com Subject: Re: [PATCH v5 1/8] KVM: arm64: Pass struct kvm to per-EC handlers Message-ID: <20210908123306.7xthfbxz274ndxit@gator> References: <20210827101609.2808181-1-tabba@google.com> <20210827101609.2808181-2-tabba@google.com> MIME-Version: 1.0 In-Reply-To: <20210827101609.2808181-2-tabba@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=drjones@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_053313_349400_3B695521 X-CRM114-Status: GOOD ( 22.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 27, 2021 at 11:16:02AM +0100, Fuad Tabba wrote: > We need struct kvm to check for protected VMs to be able to pick > the right handlers for them. > > Mark the handler functions inline, since some handlers will be > called in future code from the protected VM handlers. > > Signed-off-by: Fuad Tabba > --- > arch/arm64/kvm/hyp/include/hyp/switch.h | 16 ++++++++-------- > arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- > arch/arm64/kvm/hyp/vhe/switch.c | 2 +- > 3 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h > index 0397606c0951..7cbff0ee59a5 100644 > --- a/arch/arm64/kvm/hyp/include/hyp/switch.h > +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h > @@ -163,7 +163,7 @@ static inline void __hyp_sve_restore_guest(struct kvm_vcpu *vcpu) > * If FP/SIMD is not implemented, handle the trap and inject an undefined > * instruction exception to the guest. Similarly for trapped SVE accesses. > */ > -static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code) > +static inline bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code) > { > bool sve_guest, sve_host; > u8 esr_ec; > @@ -318,7 +318,7 @@ static inline bool esr_is_ptrauth_trap(u32 esr) > > DECLARE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt); > > -static bool kvm_hyp_handle_ptrauth(struct kvm_vcpu *vcpu, u64 *exit_code) > +static inline bool kvm_hyp_handle_ptrauth(struct kvm_vcpu *vcpu, u64 *exit_code) > { > struct kvm_cpu_context *ctxt; > u64 val; > @@ -343,7 +343,7 @@ static bool kvm_hyp_handle_ptrauth(struct kvm_vcpu *vcpu, u64 *exit_code) > return true; > } > > -static bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code) > +static inline bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code) > { > if (cpus_have_final_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) && > handle_tx2_tvm(vcpu)) > @@ -356,7 +356,7 @@ static bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code) > return false; > } > > -static bool kvm_hyp_handle_cp15(struct kvm_vcpu *vcpu, u64 *exit_code) > +static inline bool kvm_hyp_handle_cp15(struct kvm_vcpu *vcpu, u64 *exit_code) > { > if (static_branch_unlikely(&vgic_v3_cpuif_trap) && > __vgic_v3_perform_cpuif_access(vcpu) == 1) > @@ -365,7 +365,7 @@ static bool kvm_hyp_handle_cp15(struct kvm_vcpu *vcpu, u64 *exit_code) > return false; > } > > -static bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > +static inline bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > { > if (!__populate_fault_info(vcpu)) > return true; > @@ -373,7 +373,7 @@ static bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > return false; > } > > -static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > +static inline bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > { > if (!__populate_fault_info(vcpu)) > return true; > @@ -403,7 +403,7 @@ static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > > typedef bool (*exit_handler_fn)(struct kvm_vcpu *, u64 *); > > -static const exit_handler_fn *kvm_get_exit_handler_array(void); > +const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm); > > /* > * Allow the hypervisor to handle the exit with an exit handler if it has one. > @@ -413,7 +413,7 @@ static const exit_handler_fn *kvm_get_exit_handler_array(void); > */ > static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code) > { > - const exit_handler_fn *handlers = kvm_get_exit_handler_array(); > + const exit_handler_fn *handlers = kvm_get_exit_handler_array(kern_hyp_va(vcpu->kvm)); > exit_handler_fn fn; > > fn = handlers[kvm_vcpu_trap_get_class(vcpu)]; > diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c > index c52d580708e0..ebc0a5a4dd6a 100644 > --- a/arch/arm64/kvm/hyp/nvhe/switch.c > +++ b/arch/arm64/kvm/hyp/nvhe/switch.c > @@ -170,7 +170,7 @@ static const exit_handler_fn hyp_exit_handlers[] = { > [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth, > }; > > -static const exit_handler_fn *kvm_get_exit_handler_array(void) > +const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm) > { > return hyp_exit_handlers; > } > diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c > index 0e0d342358f7..d823b089d3e9 100644 > --- a/arch/arm64/kvm/hyp/vhe/switch.c > +++ b/arch/arm64/kvm/hyp/vhe/switch.c > @@ -108,7 +108,7 @@ static const exit_handler_fn hyp_exit_handlers[] = { > [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth, > }; > > -static const exit_handler_fn *kvm_get_exit_handler_array(void) > +const exit_handler_fn *kvm_get_exit_handler_array(struct kvm *kvm) > { > return hyp_exit_handlers; > } > -- > 2.33.0.259.gc128427fd7-goog > I have to admit my ignorance here. How do we link KVM? Are not nvhe/switch.c and vhe/switch.c linked into the same kernel? If so, then how does this compile after the static on kvm_get_exit_handler_array() was removed? Thanks, drew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel