From nobody Fri Nov 22 18:38:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715954141; cv=none; d=zohomail.com; s=zohoarc; b=HT/9e0ZqF6wDZT/43FOuXZ58EOF/mf6n/MLZRtFibEnR0a7T8VlMxfDqWJpMnA+HeWQRv+wCFNiXWI3Ktq28VyiUYWrZWjVzZCZZ+DuZjY+HQ2L4IsH+iUDlA8XnHL7zlJKPvNO8UhvZ77bJ+L0A+y96X1nSFZ97j0VB1SttOYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715954141; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fTDNSGKQqAKoOtL7zFg1D0HVcpP6MEv+cyhDVsjtWjY=; b=f/qjWIadRG6mX3Eay6x64LrSbDnYbjzog/a9NssBEoJ0dhdxQ4u722x0I0ktemIfLiM+IXqpKCIo1LhxGy9bgGUf1RC/HgjZRB4901tF5usx9CEkPmJ59Yil13L2xIfIn9xD6Q/1Aoy5pWJvG6qzdzes5ewbKhxmJIalKrG6c20= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715954141240320.46607583798925; Fri, 17 May 2024 06:55:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.724188.1129441 (Exim 4.92) (envelope-from ) id 1s7y3N-00041H-5N; Fri, 17 May 2024 13:55:21 +0000 Received: by outflank-mailman (output) from mailman id 724188.1129441; Fri, 17 May 2024 13:55:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7y3M-0003z6-Ug; Fri, 17 May 2024 13:55:20 +0000 Received: by outflank-mailman (input) for mailman id 724188; Fri, 17 May 2024 13:55:19 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7y3K-0001sq-QG for xen-devel@lists.xenproject.org; Fri, 17 May 2024 13:55:18 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 16e13c8c-1455-11ef-b4bb-af5377834399; Fri, 17 May 2024 15:55:16 +0200 (CEST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51fb14816f6so766853e87.0 for ; Fri, 17 May 2024 06:55:16 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c81b4sm1117456466b.113.2024.05.17.06.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 06:55:14 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 16e13c8c-1455-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715954115; x=1716558915; 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=fTDNSGKQqAKoOtL7zFg1D0HVcpP6MEv+cyhDVsjtWjY=; b=JVTxYvK83JKiKdJ64CMxW7rdDY+W76aVxt1kTSkyehriTX6p72tuwgl1/FlppTQIBe lw8Y/SZ6SoVOh9NC1aYhrrh8fGCo3fbWEjIMWw6IAxEjVq0OEl5hTyQayvK8b5YYedij qzv/90mh1xYg30eEHe0lafBl4gzlHziqYbZoRgh6dJzjoI7g5JTlzoHY0Gwa1KW9LEpg hccpGq6buzx2wYZ3oWkFBmGTosbuZh4BaHAv4YNG8S/qSe+VDUGfF2g6h/x6yoYRgjcz yj8lDjjfi1GlnjkKwI0JDwhdMnWO5cavTXqN+HLaDNqKpcPiaLioFotepDpl2WCGTgw+ WUJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715954115; x=1716558915; 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=fTDNSGKQqAKoOtL7zFg1D0HVcpP6MEv+cyhDVsjtWjY=; b=cqAYvDEQJ6BY9Hzhk9I9ApMwd9I1oTTgs7wmr3xfg+BUzJEl2ex5hSOJj3Mhs0biBy zfhjuKMxc8NkuiosiZ9bEggZJQqEroYTG5Ol2d+ra3WPVnZ3HdAnFT2XhR9iZlNZaPmG WHtdS/USuukxXGM50nb2eZEeTEF959oU+HLtZftsbhaH/yk1HmL7+K8gRJwfS2HNHFpA fZm0LNeX2IH/jaUcarbIhhmtJC7jY0sFsMfWDtPpZYXDi4haALCINIp5SDk3KrW4bJiK +jpTcUkWnYKgZMf/6EiJREDkLXSpFM0p6mLfh+m6GWwqEDl4KdLHEKIx3/CIp5BTn/QB QUGA== X-Gm-Message-State: AOJu0YyZbZUIk2fR6YLumY4k7CM/hR8rvxbzFPQzjQGe2RxwNFw0+sg+ kv66e5dEb9xi60Wv74Db/eYBiCS2NpnU31aUb0LDebtrQXk7UySHWFeuMIcV X-Google-Smtp-Source: AGHT+IGRn6SScVZRY3a4dnKl4tKASVwrpUz5YO+fZnCSMnLLdTKOL18B0Ez524cvClsoV2oad3TtLg== X-Received: by 2002:a05:6512:2356:b0:519:6953:2ffc with SMTP id 2adb3069b0e04-5221007027amr17339627e87.42.1715954115225; Fri, 17 May 2024 06:55:15 -0700 (PDT) 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 Subject: [PATCH v10 09/14] xen/riscv: add required things to current.h Date: Fri, 17 May 2024 15:54:58 +0200 Message-ID: <6ba3a3f673e54c4235fe3040699d0ce5b52234f4.1715952103.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715954141663100007 Content-Type: text/plain; charset="utf-8" Add minimal requied things to be able to build full Xen. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V5-V10: - Nothing changed. Only rebase. --- Changes in V4: - BUG() was changed to BUG_ON("unimplemented"); - Change "xen/bug.h" to "xen/lib.h" as BUG_ON is defined in xen/lib.h. - Add Acked-by: Jan Beulich --- Changes in V3: - add SPDX - drop a forward declaration of struct vcpu; - update guest_cpu_user_regs() macros - replace get_processor_id with smp_processor_id - update the commit message - code style fixes --- Changes in V2: - Nothing changed. Only rebase. --- xen/arch/riscv/include/asm/current.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/= asm/current.h index d84f15dc50..aedb6dc732 100644 --- a/xen/arch/riscv/include/asm/current.h +++ b/xen/arch/riscv/include/asm/current.h @@ -3,6 +3,21 @@ #ifndef __ASM_CURRENT_H #define __ASM_CURRENT_H =20 +#include +#include +#include + +#ifndef __ASSEMBLY__ + +/* Which VCPU is "current" on this PCPU. */ +DECLARE_PER_CPU(struct vcpu *, curr_vcpu); + +#define current this_cpu(curr_vcpu) +#define set_current(vcpu) do { current =3D (vcpu); } while (0) +#define get_cpu_current(cpu) per_cpu(curr_vcpu, cpu) + +#define guest_cpu_user_regs() ({ BUG_ON("unimplemented"); NULL; }) + #define switch_stack_and_jump(stack, fn) do { \ asm volatile ( \ "mv sp, %0\n" \ @@ -10,4 +25,8 @@ unreachable(); \ } while ( false ) =20 +#define get_per_cpu_offset() __per_cpu_offset[smp_processor_id()] + +#endif /* __ASSEMBLY__ */ + #endif /* __ASM_CURRENT_H */ --=20 2.45.0