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=-16.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 86303C433DB for ; Tue, 9 Feb 2021 03:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40F5964EAA for ; Tue, 9 Feb 2021 03:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbhBIDpM (ORCPT ); Mon, 8 Feb 2021 22:45:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49182 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230392AbhBIDdY (ORCPT ); Mon, 8 Feb 2021 22:33:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612841494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZAcXwo0Oru0ZxTATfw4I2VSKoXfBLIT/f+dSWdjupcA=; b=GmDX2sStC7dbqBO+9R4PqxjbHMm7Ini76gi3EiU3ZXtWMOUw7T6lYS605mFSUBBIwloS0g V1uXZHZkIg/ExZeMvpHNdaGw+2d/ctXpPKeDwJ3OayiEmBc+2u1dvseYyzgIh3EPLTQjWz u7Cm/V0bY8H7GoiUN/MG7rNsrrtYSaU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-NCdWv4KwOj2_o0NG7VVE0Q-1; Mon, 08 Feb 2021 22:28:02 -0500 X-MC-Unique: NCdWv4KwOj2_o0NG7VVE0Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6682192D789; Tue, 9 Feb 2021 03:28:00 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-26.bne.redhat.com [10.64.54.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 532B319C66; Tue, 9 Feb 2021 03:27:57 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Cc: linux-kernel@vger.kernel.org, pbonzini@redhat.com, maz@kernel.org, james.morse@arm.com, Jonathan.Cameron@huawei.com, mark.rutland@arm.com, will@kernel.org, shan.gavin@gmail.com Subject: [PATCH v2 01/21] KVM: arm64: Introduce template for inline functions Date: Tue, 9 Feb 2021 11:27:13 +0800 Message-Id: <20210209032733.99996-2-gshan@redhat.com> In-Reply-To: <20210209032733.99996-1-gshan@redhat.com> References: <20210209032733.99996-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The inline functions used to get the SMCCC parameters have same layout. It means the logical functionality can be presented by a template, to make the code simplified. Besides, this adds more similar inline functions like smccc_get_arg{4,5,6,7,8}() to visit more SMCCC arguments, which are required by SDEI virtualization support. Signed-off-by: Gavin Shan --- include/kvm/arm_hypercalls.h | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h index 0e2509d27910..1120eff7aa28 100644 --- a/include/kvm/arm_hypercalls.h +++ b/include/kvm/arm_hypercalls.h @@ -6,27 +6,21 @@ #include -int kvm_hvc_call_handler(struct kvm_vcpu *vcpu); - -static inline u32 smccc_get_function(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 0); +#define SMCCC_DECLARE_GET_FUNCTION(type, name, reg) \ +static inline type smccc_get_##name(struct kvm_vcpu *vcpu) \ +{ \ + return vcpu_get_reg(vcpu, (reg)); \ } -static inline unsigned long smccc_get_arg1(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 1); -} - -static inline unsigned long smccc_get_arg2(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 2); -} - -static inline unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 3); -} +SMCCC_DECLARE_GET_FUNCTION(u32, function, 0) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg1, 1) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg2, 2) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg3, 3) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg4, 4) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg5, 5) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg6, 6) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg7, 7) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg8, 8) static inline void smccc_set_retval(struct kvm_vcpu *vcpu, unsigned long a0, @@ -40,4 +34,6 @@ static inline void smccc_set_retval(struct kvm_vcpu *vcpu, vcpu_set_reg(vcpu, 3, a3); } +int kvm_hvc_call_handler(struct kvm_vcpu *vcpu); + #endif -- 2.23.0 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 89AA2C433DB for ; Tue, 9 Feb 2021 03:28:09 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id F372364EB6 for ; Tue, 9 Feb 2021 03:28:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F372364EB6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 770F64B66F; Mon, 8 Feb 2021 22:28:08 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@redhat.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X4rg30WV1VyQ; Mon, 8 Feb 2021 22:28:07 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B27FB4B673; Mon, 8 Feb 2021 22:28:05 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2D7344B5F7 for ; Mon, 8 Feb 2021 22:28:05 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oOyLxaFOVaFO for ; Mon, 8 Feb 2021 22:28:04 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 229624B608 for ; Mon, 8 Feb 2021 22:28:04 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612841283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZAcXwo0Oru0ZxTATfw4I2VSKoXfBLIT/f+dSWdjupcA=; b=IBdOsGIXEGBZDGDIxutQ6spz8XF/PwGSgPJxTBGfiU0gb6d+XJf47W4bpedGW0PN0hBQ6A N+3+Y7gZ28pWunq79cBNALwG25iUl652ZKveAs1CI4NopkLN1OMkU3x4B0VbtTmPMytfpD 90B/FlfI9CGzUjAkc2rYfZ6K8iwWiVI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-NCdWv4KwOj2_o0NG7VVE0Q-1; Mon, 08 Feb 2021 22:28:02 -0500 X-MC-Unique: NCdWv4KwOj2_o0NG7VVE0Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6682192D789; Tue, 9 Feb 2021 03:28:00 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-26.bne.redhat.com [10.64.54.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 532B319C66; Tue, 9 Feb 2021 03:27:57 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 01/21] KVM: arm64: Introduce template for inline functions Date: Tue, 9 Feb 2021 11:27:13 +0800 Message-Id: <20210209032733.99996-2-gshan@redhat.com> In-Reply-To: <20210209032733.99996-1-gshan@redhat.com> References: <20210209032733.99996-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Cc: maz@kernel.org, linux-kernel@vger.kernel.org, shan.gavin@gmail.com, Jonathan.Cameron@huawei.com, pbonzini@redhat.com, will@kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu The inline functions used to get the SMCCC parameters have same layout. It means the logical functionality can be presented by a template, to make the code simplified. Besides, this adds more similar inline functions like smccc_get_arg{4,5,6,7,8}() to visit more SMCCC arguments, which are required by SDEI virtualization support. Signed-off-by: Gavin Shan --- include/kvm/arm_hypercalls.h | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h index 0e2509d27910..1120eff7aa28 100644 --- a/include/kvm/arm_hypercalls.h +++ b/include/kvm/arm_hypercalls.h @@ -6,27 +6,21 @@ #include -int kvm_hvc_call_handler(struct kvm_vcpu *vcpu); - -static inline u32 smccc_get_function(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 0); +#define SMCCC_DECLARE_GET_FUNCTION(type, name, reg) \ +static inline type smccc_get_##name(struct kvm_vcpu *vcpu) \ +{ \ + return vcpu_get_reg(vcpu, (reg)); \ } -static inline unsigned long smccc_get_arg1(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 1); -} - -static inline unsigned long smccc_get_arg2(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 2); -} - -static inline unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu) -{ - return vcpu_get_reg(vcpu, 3); -} +SMCCC_DECLARE_GET_FUNCTION(u32, function, 0) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg1, 1) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg2, 2) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg3, 3) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg4, 4) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg5, 5) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg6, 6) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg7, 7) +SMCCC_DECLARE_GET_FUNCTION(unsigned long, arg8, 8) static inline void smccc_set_retval(struct kvm_vcpu *vcpu, unsigned long a0, @@ -40,4 +34,6 @@ static inline void smccc_set_retval(struct kvm_vcpu *vcpu, vcpu_set_reg(vcpu, 3, a3); } +int kvm_hvc_call_handler(struct kvm_vcpu *vcpu); + #endif -- 2.23.0 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm