From patchwork Fri Nov 4 06:21:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 15375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp202070wru; Thu, 3 Nov 2022 23:22:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rnxuorTIzwgGj9VxsPMnJY6Tj9PlbnppWSzQfftKfSN9XbKXgOyphJSbjiDqCegVJDZwB X-Received: by 2002:a63:220a:0:b0:463:7c92:ef9d with SMTP id i10-20020a63220a000000b004637c92ef9dmr29185808pgi.42.1667542945688; Thu, 03 Nov 2022 23:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667542945; cv=none; d=google.com; s=arc-20160816; b=bGnKYcNYt9GuyZ5+s3m3F1YVeySOpROkvCzaie7JzT0rj9Np7bhZWGELICKS4mxZ+u ot03jYAN7mvH3ffMoXviRNVENfa+soJ3zzTwdW9gdoRByHbueGuxgSNDIyUCMjqedj18 qOlT5N/BniOhfOiSFoP5m+kCncDDvIGxX20Yi6Nuy3eRiyLXkEE60E1LtgkzzBhTHLM3 VEEylsVHERv9ELJSFSXA1+7artnOeCjSkIwjbjBhpjYfDDDT+ZYcrsCBHSTFrcScoslP 45+aCfnksookvWuq7FdLMcuD6WsJPdWIKOBY+9WtSnLHPD+4OSaCtOGDEyQiRtTIfhz+ aW0A== 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 :dkim-signature; bh=3gm+CCMBzGV2wY5tpR1ywTaFubhsMnT6RUSMviBRIrA=; b=i2cx663BuJQgVyZizNF2HBibmvfUuiPMGuiBm3ktjHJDSRqmRg6T5DKn0cyDoLMOPi 2Qzc7jOPlMuaEOf4OHKGhJ9uMfuGyyzgdtIbB20TvdVLVkBh5oEU7qwjgyXS1RQri0jO 55KpOsCY78po/j2nK/Pi281PWHReJDABSKvteQwSXCX7hAJRfTw6M0CCOyETxgdcvFl6 wKaFjgwnT/G25p2IIozTRXTwXDG747u2agKk3siB5Q/+VcyQo1ItvvnXFRgnyaYWDVCu MZj2KtMu57yxFaj5HMC57eFgq9puVlU4xN+PFN1dfFQuzl3yezSsr6evYckZF+6AmyE4 gZnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2tmx0ZEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 37-20020a631465000000b004349119ea7bsi3961823pgu.401.2022.11.03.23.22.12; Thu, 03 Nov 2022 23:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2tmx0ZEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbiKDGVa (ORCPT + 99 others); Fri, 4 Nov 2022 02:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiKDGVS (ORCPT ); Fri, 4 Nov 2022 02:21:18 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FBB02A43F for ; Thu, 3 Nov 2022 23:21:17 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso2570786wmo.1 for ; Thu, 03 Nov 2022 23:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3gm+CCMBzGV2wY5tpR1ywTaFubhsMnT6RUSMviBRIrA=; b=2tmx0ZEzKlapeA40O0da60uijCZiQnnvovriTJgT3C3YW39LcGgvxSgN7m0Ms0JXRr D92XuuUCup3qht8mttWG9ecOOEurQnH46+r4Oaj2PNwPaCuW57yvPYegBdCMNT8MnSoU NOlY3X6PELYB51vtQkE4j/wGUNXLmEKjmPzkuW9/jS+OiQ316dllc8FPxAsGI0rzGUTU 5q2tEAFlf54tRihF1fQBaPZ+jK4//Gke9zNI4MbzwaxlCrgaYBonTRPX25KVZrENs1J3 Xow0dCWTcpfW0PdaLQ/uzBW2WBuW1Aegf7XTWh65W1L5iuGy79EZUOzhsxIypYrmCsE+ u/Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3gm+CCMBzGV2wY5tpR1ywTaFubhsMnT6RUSMviBRIrA=; b=qzcQcdAXt4ou5wlsDU24821jypVrTRSMNwlkniDmLkN4GNDpBFWULIlRsf4zCFgnrB QnCTtUnP+BcV8DowWT2PEBmhckzrsYV7Q6MEbTHdKegvmrQGFvHkTuWQ8j0rLe7SMe7i DFVWVKMTFhJRQIBCJGq5JIPcNwYHmBoRon7v/oYvoBH2oxjwxwv6Stw5CL3uBX16qJcv ZTKU7Yn5GRNtwDwIB4NZUyK7GFgtdXgGtzEFttEj0+j22NyD2AJK2BTzCUiAMHwpCN3g CJT6hbzJIJc8jPRv9/ImhlBhLMmzneSoap1C23ayH56X6jPf55xQO7z6dNJxD9IVu45H kYvA== X-Gm-Message-State: ACrzQf0ELXq4PUVUWamOSTFtyjkgmaIvT9Cxk/aZwmW8oqAXNzb5VgQ5 qp1E0YLmLzXcCMEZY3JOqN7LHax5wksgyw== X-Received: by 2002:a05:600c:3b87:b0:3cf:59ea:ea26 with SMTP id n7-20020a05600c3b8700b003cf59eaea26mr26647184wms.159.1667542875338; Thu, 03 Nov 2022 23:21:15 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b4d7:0:c7c:f931:dd4c:1ea6]) by smtp.gmail.com with ESMTPSA id w11-20020a5d608b000000b002366f9bd717sm3099924wrt.45.2022.11.03.23.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 23:21:14 -0700 (PDT) From: Usama Arif To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux-foundation.org, linux@armlinux.org.uk, yezengruan@huawei.com, catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, steven.price@arm.com, mark.rutland@arm.com, bagasdotme@gmail.com Cc: fam.zheng@bytedance.com, liangma@liangbit.com, punit.agrawal@bytedance.com, Usama Arif Subject: [v2 2/6] KVM: arm64: Add SMCCC paravirtualised lock calls Date: Fri, 4 Nov 2022 06:21:01 +0000 Message-Id: <20221104062105.4119003-3-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104062105.4119003-1-usama.arif@bytedance.com> References: <20221104062105.4119003-1-usama.arif@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748545511791045051?= X-GMAIL-MSGID: =?utf-8?q?1748545511791045051?= Add a new SMCCC compatible hypercalls for PV lock features: ARM_SMCCC_KVM_FUNC_PV_LOCK: 0xC6000002 Also add the header file which defines the ABI for the paravirtualized lock features we're about to add. Signed-off-by: Zengruan Ye Signed-off-by: Usama Arif --- arch/arm64/include/asm/pvlock-abi.h | 17 +++++++++++++++++ include/linux/arm-smccc.h | 8 ++++++++ tools/include/linux/arm-smccc.h | 8 ++++++++ 3 files changed, 33 insertions(+) create mode 100644 arch/arm64/include/asm/pvlock-abi.h diff --git a/arch/arm64/include/asm/pvlock-abi.h b/arch/arm64/include/asm/pvlock-abi.h new file mode 100644 index 000000000000..3f4574071679 --- /dev/null +++ b/arch/arm64/include/asm/pvlock-abi.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright(c) 2019 Huawei Technologies Co., Ltd + * Author: Zengruan Ye + * Usama Arif + */ + +#ifndef __ASM_PVLOCK_ABI_H +#define __ASM_PVLOCK_ABI_H + +struct pvlock_vcpu_state { + __le64 preempted; + /* Structure must be 64 byte aligned, pad to that size */ + u8 padding[56]; +} __packed; + +#endif diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h index 220c8c60e021..104c10035b10 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -112,6 +112,7 @@ /* KVM "vendor specific" services */ #define ARM_SMCCC_KVM_FUNC_FEATURES 0 #define ARM_SMCCC_KVM_FUNC_PTP 1 +#define ARM_SMCCC_KVM_FUNC_PV_LOCK 2 #define ARM_SMCCC_KVM_FUNC_FEATURES_2 127 #define ARM_SMCCC_KVM_NUM_FUNCS 128 @@ -151,6 +152,13 @@ ARM_SMCCC_OWNER_STANDARD_HYP, \ 0x21) +/* Paravirtualised lock calls */ +#define ARM_SMCCC_VENDOR_HYP_KVM_PV_LOCK_FUNC_ID \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_64, \ + ARM_SMCCC_OWNER_VENDOR_HYP, \ + ARM_SMCCC_KVM_FUNC_PV_LOCK) + /* TRNG entropy source calls (defined by ARM DEN0098) */ #define ARM_SMCCC_TRNG_VERSION \ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ diff --git a/tools/include/linux/arm-smccc.h b/tools/include/linux/arm-smccc.h index 63ce9bebccd3..c21e539c0228 100644 --- a/tools/include/linux/arm-smccc.h +++ b/tools/include/linux/arm-smccc.h @@ -111,6 +111,7 @@ /* KVM "vendor specific" services */ #define ARM_SMCCC_KVM_FUNC_FEATURES 0 #define ARM_SMCCC_KVM_FUNC_PTP 1 +#define ARM_SMCCC_KVM_FUNC_PV_LOCK 2 #define ARM_SMCCC_KVM_FUNC_FEATURES_2 127 #define ARM_SMCCC_KVM_NUM_FUNCS 128 @@ -150,6 +151,13 @@ ARM_SMCCC_OWNER_STANDARD_HYP, \ 0x21) +/* Paravirtualised lock calls */ +#define ARM_SMCCC_VENDOR_HYP_KVM_PV_LOCK_FUNC_ID \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_64, \ + ARM_SMCCC_OWNER_VENDOR_HYP, \ + ARM_SMCCC_KVM_FUNC_PV_LOCK) + /* TRNG entropy source calls (defined by ARM DEN0098) */ #define ARM_SMCCC_TRNG_VERSION \ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \