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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 98E45C433E0 for ; Mon, 1 Feb 2021 17:30:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 55A6764EAA for ; Mon, 1 Feb 2021 17:30:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55A6764EAA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=Rs8n5jvSog2ET6Zigv7fxrjMA4tamB4nN/We0++xrnA=; b=Ik6Ca0mPlGvZ8HpiN+jIwSotW ya6JrX7MDk0+OU0DKuvohJS0228Y88YTpPo7lKmDdwrD8lqI7XCSssA66Sa4n/NXcjzJSM8P89Ifx FaTR0KRirPxequsc6VLpWMWDBdflW1guXqX0CnXkQslIwrYbWkb5GYllqJejkyRn6BPbVvw8kyQIF SHu5HCQOxDQkn2alAWTWfCuKQECZLrdH96VKC6tkmAO/VqocM2iAeeb3UrLBvfk6BbQybuZI781oC WhdvyfF4APW2f6xa6imErREEBgpsVfCgSPeqddFqUAtzKtDfXnBWe28Jl1Y5FFW6ltSTWRdyBzRu0 QHucqlWEA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6d0G-00062a-Ge; Mon, 01 Feb 2021 17:28:44 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6d0D-00061z-3Q for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2021 17:28:41 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77E5F64EA9; Mon, 1 Feb 2021 17:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612200520; bh=uHAWWNmon96KsVjmF8ftVBBdEemkthXQ9UJ2fc8srng=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CvvqVRBGSncQ6Xl0DR8gjXVt3iAOTkyc7pce4aId8ICWxg6VACch4KtFpnYVLnmM0 PE7ItfKktIRiDNqh7Doo9Xfv5rmfLLKmU179IQx5nVT06+Lw2xgisT7u5GvGOLE94r eYoDXigDq3eE2yjj7UO32kd7q7wtHyt2j8Am/WYH6BPNqYtIUMwk3x2d+qVOfVK1aV bp6HTErm/mDCVqnYV2WdLnjlin63sROqBW/Hht+GatldssqbfS8MA5N1tlWKakjzZC nB83x2hfJxugpY+PMHwWVg7lnc4Y6rHRzCgJ66hnF4T/7xnjvdM4CZQelCzbAER10e 0emvH5Ijw9whA== Date: Mon, 1 Feb 2021 17:28:34 +0000 From: Will Deacon To: Quentin Perret Subject: Re: [RFC PATCH v2 03/26] arm64: kvm: Add standalone ticket spinlock implementation for use at hyp Message-ID: <20210201172833.GA15632@willie-the-truck> References: <20210108121524.656872-1-qperret@google.com> <20210108121524.656872-4-qperret@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210108121524.656872-4-qperret@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210201_122841_220123_9B64A04A X-CRM114-Status: GOOD ( 20.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, kernel-team@android.com, Suzuki K Poulose , android-kvm@google.com, Catalin Marinas , Fuad Tabba , linux-kernel@vger.kernel.org, Rob Herring , James Morse , linux-arm-kernel@lists.infradead.org, Marc Zyngier , David Brazdil , Frank Rowand , kvmarm@lists.cs.columbia.edu, Julien Thierry 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, Jan 08, 2021 at 12:15:01PM +0000, Quentin Perret wrote: > From: Will Deacon > > We will soon need to synchronise multiple CPUs in the hyp text at EL2. > The qspinlock-based locking used by the host is overkill for this purpose > and relies on the kernel's "percpu" implementation for the MCS nodes. > > Implement a simple ticket locking scheme based heavily on the code removed > by commit c11090474d70 ("arm64: locking: Replace ticket lock implementation > with qspinlock"). > > Signed-off-by: Will Deacon > Signed-off-by: Quentin Perret > --- > arch/arm64/kvm/hyp/include/nvhe/spinlock.h | 92 ++++++++++++++++++++++ > 1 file changed, 92 insertions(+) > create mode 100644 arch/arm64/kvm/hyp/include/nvhe/spinlock.h > > diff --git a/arch/arm64/kvm/hyp/include/nvhe/spinlock.h b/arch/arm64/kvm/hyp/include/nvhe/spinlock.h > new file mode 100644 > index 000000000000..7584c397bbac > --- /dev/null > +++ b/arch/arm64/kvm/hyp/include/nvhe/spinlock.h > @@ -0,0 +1,92 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * A stand-alone ticket spinlock implementation for use by the non-VHE > + * KVM hypervisor code running at EL2. > + * > + * Copyright (C) 2020 Google LLC > + * Author: Will Deacon > + * > + * Heavily based on the implementation removed by c11090474d70 which was: > + * Copyright (C) 2012 ARM Ltd. > + */ > + > +#ifndef __ARM64_KVM_NVHE_SPINLOCK_H__ > +#define __ARM64_KVM_NVHE_SPINLOCK_H__ > + > +#include > +#include > + > +typedef union hyp_spinlock { > + u32 __val; > + struct { > +#ifdef __AARCH64EB__ > + u16 next, owner; > +#else > + u16 owner, next; > + }; > +#endif Looks like I put this #endif in the wrong place; probably needs to be a line higher. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel