Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp655657lqp; Fri, 5 Apr 2024 05:17:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+MNw8zGCVeXuBq7/T9NZrvsh8sNLqg4oPOehnhCZV7fWbRvE7spFOx71+PlIThoUkdZBQzmOtTZ6KG1gg7YQOcw/FR64Q26pyxOtJhg== X-Google-Smtp-Source: AGHT+IGHQ68LYc3ltT752cptbU05DKEjAnIwcgBcUJHQfcWDqbrjQRqtFwhUsW75KeyF4qRf+Bf6 X-Received: by 2002:a05:6a20:7fa2:b0:1a3:6f13:b11b with SMTP id d34-20020a056a207fa200b001a36f13b11bmr2022532pzj.4.1712319430982; Fri, 05 Apr 2024 05:17:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712319430; cv=pass; d=google.com; s=arc-20160816; b=zczrGX15/8be3lVcs2gvfo7ZmhFotFmT9gt9By7qY58/dxV6HhizgNtapHwWDUlQ3m d8f7mcvkPosKuwEUMQ9yuyT1JwjqVPbhgA9zAZdHuGh4DriiMbKaBKO9CaVDK4n96LC0 NGCT/3nwlmjaexBDANloMJZKn2s1O5IrP7iUwbWlCVLeYD2yHwRFuIKfAkKDFXG7ML46 z+vT2jfEBFeS31ac1/Gb59gbxm7Qw5l7BH20yyyDdfa+U6WN08U4AzLpRcr1Kim4NpGF +fqT++EHg7H+b0WtqvleytdQ4L32QCKkswcWRm7016KSZ289Sv1Is+KNX72HbksBJrev Epiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YIBbg/0Gkc3vc8eXQdCLIpelrpcjO2owsNnM3FfwOWI=; fh=Lk7//7iNkscH6+8djnyDUCq/yshm8ZrpGXdrKVOEVdI=; b=KHU4hZHgDuqqPC2SzwG03OEo+4xC0pfU2Hnyw279wE2qU3aPeFOcQIIvoqNnTzxU6h /XPgBVCC7PVrlSMWyW/EjttUJV12faTJ7nQJmr0YTToKlytl5VjOPXcmTPO7PDtZNswb WCLk5aIdhA2zHTWR8kcfJyPMQNW3E555jrrWu53Vil91CRsgTQoYkkdG0XPN+gFcg+GK XwWvpi/lMlzk0nsmuLgmBUPWG94vY8YCQv6d+rKxPaq8X/lBuBQW3F1k+iiXzfEZGLxw fxDJuQJS59Z7dkx9hJsHZ16qGuWfRPZezlTXcit5QROlLxgo9vAmI5TBRgdecTNQ7dc7 0S/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=l9HHAiKe; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-132973-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132973-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ff15-20020a056a002f4f00b006eceb8cdc77si1276729pfb.97.2024.04.05.05.17.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:17:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132973-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=l9HHAiKe; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-132973-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132973-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1532728408D for ; Fri, 5 Apr 2024 12:17:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AC8A16D326; Fri, 5 Apr 2024 12:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="l9HHAiKe" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B18E16D307 for ; Fri, 5 Apr 2024 12:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712319394; cv=none; b=ofBKiQTxeh6teDGz/n8x8bjIPWOleORyS0acSaBofh5TAuETnBfkoM6vQEDXDsfUayy2uT8WJjtqKfJFIMvQu+C5Gx+gYkhKPvKpA4Ifo+ZEp3n0wUQIWUxQ0p/bw88BFyJQdaM57Dr0Qn1sKLXNTLcM/opQ71G0JucW2UwgcDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712319394; c=relaxed/simple; bh=WjeDlT9dBOQe+BLqgl2oRIytcPuInRU8X9ml0l76d9Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tLi7tSS4pIj5NlBc5FVMd51wbBXWM7yvsAq/LLR18JaYagZ2oJ0WA9ejqDcztBm/vsZBlCfcYHchRQ9g9V+DhI+AJcvQesADNnLmJeQV+LL1Av6aAp3DLGpIzK0QaGSvVsiTC6iaxNhyCu49LGTWnNECpq8nj/g+bS+GIbRb874= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=l9HHAiKe; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4162ef30461so4340085e9.1 for ; Fri, 05 Apr 2024 05:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1712319390; x=1712924190; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YIBbg/0Gkc3vc8eXQdCLIpelrpcjO2owsNnM3FfwOWI=; b=l9HHAiKeS5T++SgBczi0RQ9c0Y9gqDzXkYnjQLLdlPy45mOj4vSzJ8DuDIx5KR/Xvw Oig8i4piOzHSybQ+8nhTrJ5Kr7o8n82TwKqNbvv+5nnJvVlKv4MffgQ2+GXBopb5ITPX lJLHXGR6zuIstAZXZSTtzotPoFvOe7y6y3MLLtEw1ntfKfe62ECCTBGGuoj5cpdj0WJN QpMM5hZx4Lf9wtxRMDVxN4w/wFEojAsyaZsnpinLhE7u4XP0vsG15Mw1bHf4e4fjU66k sk3K1YdueM8JZoNx+POETKG8r4x7ECkvfwhUBsvBSQQq2eKcfymwinAivF3vm8jgnQmM wRKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712319390; x=1712924190; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YIBbg/0Gkc3vc8eXQdCLIpelrpcjO2owsNnM3FfwOWI=; b=NApdNJAUdsHsZUJOhOw2nNhErxt+43/mCmi2OzI8xXPCxjBfOr3K2N+bLuyi6u2Yzp tohtPibRV7sh48/sXEYTXs12cgegKyqDFNM9jfTSx5StNEE3RRIQhS0EUTzBp8gyP4DH uEf3KzdBpRSEBhQB1q8zSmqKGTnjE5Bl/5KDa9VKdyRdmG9euGh7nJpz0tjtXKOUfb47 0YqRiIbTPdvHlkznFoBxpkZM7v3+TWxJkuTl85k7D9eKe80NXtEqsfFU6+LFZVIa3b/z NoMCN1Akwi1PHnvMyiTmtj4/sWQgcRKy1ZQi+O8xk/4KQeYkWBaMW+X18oOFIJK63j9n Nq5A== X-Gm-Message-State: AOJu0YzKSuOb8sO6ylGF3yUV8J1+JZ4gMZBvWdqir2Se747sM+XCdMt5 bnGQ+I3iLSvqsWQqfN8KodyyZqzmQsWIztMGHR34j/lz+/5bxRF+Tv0ar9ku3ng= X-Received: by 2002:a05:600c:4e0c:b0:414:250:ccaa with SMTP id b12-20020a05600c4e0c00b004140250ccaamr1142350wmq.12.1712319390374; Fri, 05 Apr 2024 05:16:30 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id fc9-20020a05600c524900b004162a9f03a6sm5867007wmb.7.2024.04.05.05.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:16:29 -0700 (PDT) Date: Fri, 5 Apr 2024 14:16:29 +0200 From: Andrew Jones To: Atish Patra Cc: linux-kernel@vger.kernel.org, Ajay Kaher , Alexandre Ghiti , Alexey Makhalov , Anup Patel , Conor Dooley , Juergen Gross , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Shuah Khan , virtualization@lists.linux.dev, VMware PV-Drivers Reviewers , Will Deacon , x86@kernel.org Subject: Re: [PATCH v5 16/22] KVM: riscv: selftests: Move sbi definitions to its own header file Message-ID: <20240405-a09f9ed26805b6988179132c@orel> References: <20240403080452.1007601-1-atishp@rivosinc.com> <20240403080452.1007601-17-atishp@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403080452.1007601-17-atishp@rivosinc.com> On Wed, Apr 03, 2024 at 01:04:45AM -0700, Atish Patra wrote: > The SBI definitions will continue to grow. Move the sbi related > definitions to its own header file from processor.h > > Suggested-by: Andrew Jones > Signed-off-by: Atish Patra > --- > .../selftests/kvm/include/riscv/processor.h | 39 --------------- > .../testing/selftests/kvm/include/riscv/sbi.h | 50 +++++++++++++++++++ > .../selftests/kvm/include/riscv/ucall.h | 1 + > tools/testing/selftests/kvm/steal_time.c | 4 +- > 4 files changed, 54 insertions(+), 40 deletions(-) > create mode 100644 tools/testing/selftests/kvm/include/riscv/sbi.h > > diff --git a/tools/testing/selftests/kvm/include/riscv/processor.h b/tools/testing/selftests/kvm/include/riscv/processor.h > index ce473fe251dd..3b9cb39327ff 100644 > --- a/tools/testing/selftests/kvm/include/riscv/processor.h > +++ b/tools/testing/selftests/kvm/include/riscv/processor.h > @@ -154,45 +154,6 @@ void vm_install_interrupt_handler(struct kvm_vm *vm, exception_handler_fn handle > #define PGTBL_PAGE_SIZE PGTBL_L0_BLOCK_SIZE > #define PGTBL_PAGE_SIZE_SHIFT PGTBL_L0_BLOCK_SHIFT > > -/* SBI return error codes */ > -#define SBI_SUCCESS 0 > -#define SBI_ERR_FAILURE -1 > -#define SBI_ERR_NOT_SUPPORTED -2 > -#define SBI_ERR_INVALID_PARAM -3 > -#define SBI_ERR_DENIED -4 > -#define SBI_ERR_INVALID_ADDRESS -5 > -#define SBI_ERR_ALREADY_AVAILABLE -6 > -#define SBI_ERR_ALREADY_STARTED -7 > -#define SBI_ERR_ALREADY_STOPPED -8 > - > -#define SBI_EXT_EXPERIMENTAL_START 0x08000000 > -#define SBI_EXT_EXPERIMENTAL_END 0x08FFFFFF > - > -#define KVM_RISCV_SELFTESTS_SBI_EXT SBI_EXT_EXPERIMENTAL_END > -#define KVM_RISCV_SELFTESTS_SBI_UCALL 0 > -#define KVM_RISCV_SELFTESTS_SBI_UNEXP 1 > - > -enum sbi_ext_id { > - SBI_EXT_BASE = 0x10, > - SBI_EXT_STA = 0x535441, > -}; > - > -enum sbi_ext_base_fid { > - SBI_EXT_BASE_PROBE_EXT = 3, > -}; > - > -struct sbiret { > - long error; > - long value; > -}; > - > -struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, > - unsigned long arg1, unsigned long arg2, > - unsigned long arg3, unsigned long arg4, > - unsigned long arg5); > - > -bool guest_sbi_probe_extension(int extid, long *out_val); > - > static inline void local_irq_enable(void) > { > csr_set(CSR_SSTATUS, SR_SIE); > diff --git a/tools/testing/selftests/kvm/include/riscv/sbi.h b/tools/testing/selftests/kvm/include/riscv/sbi.h > new file mode 100644 > index 000000000000..ba04f2dec7b5 > --- /dev/null > +++ b/tools/testing/selftests/kvm/include/riscv/sbi.h > @@ -0,0 +1,50 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * RISC-V SBI specific definitions > + * > + * Copyright (C) 2024 Rivos Inc. > + */ > + > +#ifndef SELFTEST_KVM_SBI_H > +#define SELFTEST_KVM_SBI_H > + > +/* SBI return error codes */ > +#define SBI_SUCCESS 0 > +#define SBI_ERR_FAILURE -1 > +#define SBI_ERR_NOT_SUPPORTED -2 > +#define SBI_ERR_INVALID_PARAM -3 > +#define SBI_ERR_DENIED -4 > +#define SBI_ERR_INVALID_ADDRESS -5 > +#define SBI_ERR_ALREADY_AVAILABLE -6 > +#define SBI_ERR_ALREADY_STARTED -7 > +#define SBI_ERR_ALREADY_STOPPED -8 > + > +#define SBI_EXT_EXPERIMENTAL_START 0x08000000 > +#define SBI_EXT_EXPERIMENTAL_END 0x08FFFFFF > + > +#define KVM_RISCV_SELFTESTS_SBI_EXT SBI_EXT_EXPERIMENTAL_END > +#define KVM_RISCV_SELFTESTS_SBI_UCALL 0 > +#define KVM_RISCV_SELFTESTS_SBI_UNEXP 1 > + > +enum sbi_ext_id { > + SBI_EXT_BASE = 0x10, > + SBI_EXT_STA = 0x535441, > +}; > + > +enum sbi_ext_base_fid { > + SBI_EXT_BASE_PROBE_EXT = 3, > +}; > + > +struct sbiret { > + long error; > + long value; > +}; > + > +struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, > + unsigned long arg1, unsigned long arg2, > + unsigned long arg3, unsigned long arg4, > + unsigned long arg5); > + > +bool guest_sbi_probe_extension(int extid, long *out_val); > + > +#endif /* SELFTEST_KVM_SBI_H */ > diff --git a/tools/testing/selftests/kvm/include/riscv/ucall.h b/tools/testing/selftests/kvm/include/riscv/ucall.h > index be46eb32ec27..a695ae36f3e0 100644 > --- a/tools/testing/selftests/kvm/include/riscv/ucall.h > +++ b/tools/testing/selftests/kvm/include/riscv/ucall.h > @@ -3,6 +3,7 @@ > #define SELFTEST_KVM_UCALL_H > > #include "processor.h" > +#include "sbi.h" > > #define UCALL_EXIT_REASON KVM_EXIT_RISCV_SBI > > diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c > index bae0c5026f82..2ff82c7fd926 100644 > --- a/tools/testing/selftests/kvm/steal_time.c > +++ b/tools/testing/selftests/kvm/steal_time.c > @@ -11,7 +11,9 @@ > #include > #include > #include > -#ifndef __riscv > +#ifdef __riscv > +#include "sbi.h" > +#else > #include > #endif > > -- > 2.34.1 > Reviewed-by: Andrew Jones