From patchwork Fri Dec 22 15:13:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13503453 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 03E3FC46CD2 for ; Fri, 22 Dec 2023 15:19:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.659498.1029200 (Exim 4.92) (envelope-from ) id 1rGhJS-0002AL-TW; Fri, 22 Dec 2023 15:19:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 659498.1029200; Fri, 22 Dec 2023 15:19:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rGhJS-0002AE-Qs; Fri, 22 Dec 2023 15:19:46 +0000 Received: by outflank-mailman (input) for mailman id 659498; Fri, 22 Dec 2023 15:19:45 +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-MB for xen-devel@lists.xenproject.org; Fri, 22 Dec 2023 15:13:55 +0000 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [2a00:1450:4864:20::136]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b8f8621c-a0dc-11ee-98eb-6d05b1d4d9a1; Fri, 22 Dec 2023 16:13:55 +0100 (CET) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50e2d00f99cso2278210e87.0 for ; Fri, 22 Dec 2023 07:13:55 -0800 (PST) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j7-20020a056512108700b0050e6df07728sm45983lfg.180.2023.12.22.07.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:13:53 -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: b8f8621c-a0dc-11ee-98eb-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703258034; x=1703862834; 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=x8FSka20emVR5MBynLJ4eD5Np71hFeYAHDuqjNk27Ic=; b=Xr8WVsyMz4B78e7x78SypHC/PCBVWSY9rmU98hjGJh8bSrpznojDSDrKNpjfhZPx73 MX9rgmOIYvGI/Xa/N26lFPuQrRg8a5qyl/ik9D8HkjEH5cmCW95R2regd/cBRo4ZuPRs W6UyZNqN6YlnrpfumTnoGmZYfCLKlSxur4VJPnIjY76TG2/lnAaOwJe79CpKp1MsgyNN Y3mIG6D5EKpYvE19r4MW0aGT0UoksLFr5vgQDRpIp6jqR+lICW6pDh/PRwhKGPCF1YaE tQGwZ+eOTCkfXxgmQmCPvMTqjr/wZAEi5hKkIl2TPQ7t1pTgC8Z8BFrPgEA0bhLBX6UZ e2oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703258034; x=1703862834; 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=x8FSka20emVR5MBynLJ4eD5Np71hFeYAHDuqjNk27Ic=; b=URm9NbvIoNfZhy+h9xhysyv1FvlSbf+kOvu8cn50wRmz+XXMnPgv1Meayje78EGf74 tWK2RXbvduY8neZDCN8FB6q1ESAl5D6/KRFohog/VA/ThyUaA/QOr2qmy0cABqLXFtoE 0YsJjaWsZYv+bTQ/09DECqPq6FOA70ox1UwDyCcO+gG/0lRgWy8n7+SHXwWvkAe1sW96 3v2Ae/zwMEeT7r1mCHzLaHc7nbENfROx6LycFKZpUBKiJi4daUX9to/2zRYizvYgh9nO klj8wk9OAKOuhavSa9W3CIWrWS5+bVEGa/MyjSNQQ43ZZ5PNXvyw5jz8hUSDf4KaDg6Q dsEw== X-Gm-Message-State: AOJu0Yw89FkzLTtm4baKk6jW6ZulgiLAdeGJocCeXMhkxHHtY9/d0A/c gMuUJg98Y2qMhyPb7e+D+HRVk9GnTyU= X-Google-Smtp-Source: AGHT+IHjJ2HZBHWS5du2wbhHvQ9CEtfMPB0lh9DE4LLCqS2POsqWxKIBTwWu1DIuXeOnrNvcQXeuoQ== X-Received: by 2002:ac2:4352:0:b0:50e:3f2e:c726 with SMTP id o18-20020ac24352000000b0050e3f2ec726mr816019lfl.87.1703258033996; Fri, 22 Dec 2023 07:13:53 -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 30/34] xen/riscv: add minimal stuff to processor.h to build full Xen Date: Fri, 22 Dec 2023 17:13:14 +0200 Message-ID: <5bd7c5db6638f09dabdc13a6e12f0b204eacb234.1703255175.git.oleksii.kurochko@gmail.com> 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 - rename get_processor_id to smp_processor_id - code style fixes - update the cpu_relax instruction: use pause instruction instead of div %0, %0, zero --- Changes in V2: - Nothing changed. Only rebase. --- xen/arch/riscv/include/asm/processor.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h index 6db681d805..a3bff6c9c3 100644 --- a/xen/arch/riscv/include/asm/processor.h +++ b/xen/arch/riscv/include/asm/processor.h @@ -12,6 +12,9 @@ #ifndef __ASSEMBLY__ +/* TODO: need to be implemeted */ +#define smp_processor_id() 0 + /* On stack VCPU state */ struct cpu_user_regs { @@ -53,6 +56,18 @@ struct cpu_user_regs unsigned long pregs; }; +/* TODO: need to implement */ +#define cpu_to_core(cpu) (0) +#define cpu_to_socket(cpu) (0) + +static inline void cpu_relax(void) +{ + /* Encoding of the pause instruction */ + __asm__ __volatile__ ( ".insn 0x100000F" ); + + barrier(); +} + static inline void wfi(void) { __asm__ __volatile__ ("wfi");