From patchwork Mon Oct 17 11:51:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13008664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BED5BC433FE for ; Mon, 17 Oct 2022 11:56:46 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yt0sxyOHefCLMm8JK+C+hPcb5ce9fUDe/oNFdFQ2y0E=; b=lk937sUk+/3yHl wcAlaZukWYl8EkQgVM7uzdwznM/5fuBKwSjCPs+jdpyy4Nc/DaVnIfFKIiR26CH628ELbKTyMlCCu FRSVNM9Z4Adi3hv9jeG/7l0pK2SQDkZUTxoXY+YTVZMX3S8XMz1V53eA+8GB3wZimHHspNPH48OBd hbRy6ZuwbnNs9GVgniXrKJZSJstOX95Zng1PJKRmQfszVROPZqaRU/uA5kqo4SwEO99lwcJ/e8w29 W3qcZqEq+FWXguxKISarr+X32WC9gW6asabnxxHs3qG15t01iF1uWgyVgp/41QhPqe6rStGWnjE4G Dy1bN16vn91M1MMlHtYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okOid-00BFKs-Dh; Mon, 17 Oct 2022 11:55:43 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okOg0-00BCk4-C7 for linux-arm-kernel@lists.infradead.org; Mon, 17 Oct 2022 11:53:01 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0CDF2B812A8; Mon, 17 Oct 2022 11:52:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5939C43470; Mon, 17 Oct 2022 11:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666007577; bh=8SOmXtI+0us+qdlvL7fSrftel8tnl6QXbcToLbVYnW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtV2hgxAyir7vaWS0ZGWfCioTh33iTvaaq8VeijwzGvKlDDob+C0fawZnINEXEqCy ZVjJvPooLPNGdVjoJFPzPE+Xiiy0cdZLIZpaIeok6f9Ry5vz9KeFQfMHD2cBUK+mC5 drvWNCLMamDdpur32YUj3OB65+2g1OKjZsccjmNphgKU1XiLST4TcNynwDG59vrIOz XJilUmskXbNkliWYtgGKRVknD20/Iv0Q9J+In6xmdCN48oAt4x3csXiUs7Qh+mrOz/ ugRVEy65lV+2X4TELFdE68GwYVMdfgRoBZjeLl3rQsxttQ9OkCADH6zgdlxXAyqpIV G4RoyOuKXIagw== From: Will Deacon To: kvmarm@lists.linux.dev Cc: Will Deacon , Sean Christopherson , Vincent Donnefort , Alexandru Elisei , Catalin Marinas , James Morse , Chao Peng , Quentin Perret , Suzuki K Poulose , Mark Rutland , Fuad Tabba , Oliver Upton , Marc Zyngier , kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 10/25] KVM: arm64: Add hyp_spinlock_t static initializer Date: Mon, 17 Oct 2022 12:51:54 +0100 Message-Id: <20221017115209.2099-11-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221017115209.2099-1-will@kernel.org> References: <20221017115209.2099-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221017_045300_597368_22D5D1BB X-CRM114-Status: GOOD ( 12.47 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Fuad Tabba Introduce a static initializer macro for 'hyp_spinlock_t' so that it is straightforward to instantiate global locks at EL2. This will be later utilised for locking the VM table in the hypervisor. Tested-by: Vincent Donnefort Signed-off-by: Fuad Tabba Signed-off-by: Will Deacon Reviewed-by: Philippe Mathieu-Daudé --- arch/arm64/kvm/hyp/include/nvhe/spinlock.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/include/nvhe/spinlock.h b/arch/arm64/kvm/hyp/include/nvhe/spinlock.h index 4652fd04bdbe..7c7ea8c55405 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/spinlock.h +++ b/arch/arm64/kvm/hyp/include/nvhe/spinlock.h @@ -28,9 +28,17 @@ typedef union hyp_spinlock { }; } hyp_spinlock_t; +#define __HYP_SPIN_LOCK_INITIALIZER \ + { .__val = 0 } + +#define __HYP_SPIN_LOCK_UNLOCKED \ + ((hyp_spinlock_t) __HYP_SPIN_LOCK_INITIALIZER) + +#define DEFINE_HYP_SPINLOCK(x) hyp_spinlock_t x = __HYP_SPIN_LOCK_UNLOCKED + #define hyp_spin_lock_init(l) \ do { \ - *(l) = (hyp_spinlock_t){ .__val = 0 }; \ + *(l) = __HYP_SPIN_LOCK_UNLOCKED; \ } while (0) static inline void hyp_spin_lock(hyp_spinlock_t *lock)