From patchwork Fri Dec 22 15:12:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13503439 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 5D87EC47073 for ; Fri, 22 Dec 2023 15:13:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.659411.1029040 (Exim 4.92) (envelope-from ) id 1rGhDP-00005Q-E9; Fri, 22 Dec 2023 15:13:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 659411.1029040; Fri, 22 Dec 2023 15:13:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rGhDP-00005G-AL; Fri, 22 Dec 2023 15:13:31 +0000 Received: by outflank-mailman (input) for mailman id 659411; Fri, 22 Dec 2023 15:13:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rGhDN-0007Ie-Sv for xen-devel@lists.xenproject.org; Fri, 22 Dec 2023 15:13:29 +0000 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [2a00:1450:4864:20::232]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a995ebae-a0dc-11ee-98eb-6d05b1d4d9a1; Fri, 22 Dec 2023 16:13:29 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2ccae380df2so5219351fa.1 for ; Fri, 22 Dec 2023 07:13:29 -0800 (PST) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j7-20020a056512108700b0050e6df07728sm45983lfg.180.2023.12.22.07.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:13:27 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a995ebae-a0dc-11ee-98eb-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703258008; x=1703862808; darn=lists.xenproject.org; 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=XxfRR5iTWHPrG0r8RfFYv+6SXwdr18UERnM1vGt8RNc=; b=i/bckzCGI6P2VP/0O5yMdrsw5jIxbWBOX3lDoqebFZYewWcDOjNemoCZxCIbEzvndl hMgxdXxNByoBcyBKmHiMcrn/dpOWckQexYq789DvJpG+FuRT0wFviL1bZkYSA6DoDw23 7YnagR0jYNt+CQwEilQ3+8e5JZrL7fZi9DfdUcFfp7eeSMPUfskJ1sH5+2cuz84JDV3i GUwfJDx9ZbpKUOeeXyzRhcixHy3Wxjx+6xPAsS8bQTmbDILLF0wAudB0sxtnz0g/sb3n tBlwluLRfMzyhdVcuFhRj71XyZldH9baNS1wlHdicrf3vsqIJ1YR6CcBrG4sGeELbNvR 52vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703258008; x=1703862808; 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=XxfRR5iTWHPrG0r8RfFYv+6SXwdr18UERnM1vGt8RNc=; b=Lqz2on1Z7mLHxQn9CK+nRez3Uyf5/67oX5d9163zRnseAQWIYBadFCJYcPtBYchbfL 0mpco40OpEFcXhrXOLZBTiTRiARVYF+UeWlfq86kFqzNn/lEKa0LB98CfOyIIESOJ0dD TEAxev745zWkIH5fcBa+IvhCVm39g6kydtmH3OnLwv7z/zXVEJwWT/6oSxm3y80+fzwB F2DXduwAjLBbqGA9iiScUApXKu3qfMdf9P9cJ1A6Nqk6tSsLUoPF/bt4Xds8mU4sr3nI mjfO4e3b6Lo/ResS1G9tm2Iawa1xMuSSJZbrkfJwbCdPvDzXryr7PxjhYAmshhp1yVRZ lLjQ== X-Gm-Message-State: AOJu0YwmuGkZcl1PH/cpEQJ5PJKmNLcqLKFj+6Z0pW8WWAY+kTWN5yUU yZxLG/bDVHuzw9cwCtoB1Kq0RIJ2AA0= X-Google-Smtp-Source: AGHT+IEamhQQvmt0GN7tdFSr//TSSoXplDpq1N+R36tHrVkxKS4q38AjTIfliCZaHsIKus1ue0i05A== X-Received: by 2002:a19:7408:0:b0:50e:6bf0:49c9 with SMTP id v8-20020a197408000000b0050e6bf049c9mr378948lfe.53.1703258008130; Fri, 22 Dec 2023 07:13:28 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v3 05/34] xen/riscv: introduce guest_atomics.h Date: Fri, 22 Dec 2023 17:12:49 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Signed-off-by: Oleksii Kurochko --- Changes in V3: - update the commit message - drop TODO commit. - add ASSERT_UNREACHABLE for stubs guest functions. - Add SPDX & footer --- Changes in V2: - Nothing changed. Only rebase. --- xen/arch/riscv/include/asm/guest_atomics.h | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 xen/arch/riscv/include/asm/guest_atomics.h diff --git a/xen/arch/riscv/include/asm/guest_atomics.h b/xen/arch/riscv/include/asm/guest_atomics.h new file mode 100644 index 0000000000..98f7df7b6a --- /dev/null +++ b/xen/arch/riscv/include/asm/guest_atomics.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ASM_RISCV_GUEST_ATOMICS_H +#define __ASM_RISCV_GUEST_ATOMICS_H + +#define guest_testop(name) \ +static inline int guest_##name(struct domain *d, int nr, volatile void *p) \ +{ \ + (void) d; \ + (void) nr; \ + (void) p; \ + \ + ASSERT_UNREACHABLE(); \ + \ + return 0; \ +} + +#define guest_bitop(name) \ +static inline void guest_##name(struct domain *d, int nr, volatile void *p) \ +{ \ + (void) d; \ + (void) nr; \ + (void) p; \ + ASSERT_UNREACHABLE(); \ +} + +guest_bitop(set_bit) +guest_bitop(clear_bit) +guest_bitop(change_bit) + +#undef guest_bitop + +guest_testop(test_and_set_bit) +guest_testop(test_and_clear_bit) +guest_testop(test_and_change_bit) + +#undef guest_testop + +#define guest_test_bit(d, nr, p) ((void)(d), test_bit(nr, p)) + +#endif /* __ASM_RISCV_GUEST_ATOMICS_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */