Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5486830pxb; Wed, 26 Jan 2022 13:11:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTVdBguWGibiBGRdBa67zFcsAEq1GFkF4nYPvRcEjK53ZbjIiQ6kD/nsILHjyilcHvt7F4 X-Received: by 2002:a17:907:b01:: with SMTP id h1mr457750ejl.728.1643231482289; Wed, 26 Jan 2022 13:11:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643231482; cv=none; d=google.com; s=arc-20160816; b=dXc99eN2HIFFOkh4IfkTaPZIAAiHFMjscKBESG/7z64myeAxK0jgFHtGnP8IqsKs9U OP/uE5Xxv83FIRtjY5d/Xmep51IQ0Gm0ft8uO8W2rZcPzCtPPfqAzUWYrZeKiXByIcU7 JwX1rfP8557FB/dXRt5qgxNdpZE3LQT16+ZAiJVcmGu/oGpxghiU1S1dxMD5epe58izj fQwhQ/sX2GkCXtTbH4E58O4dDd9SOdrhtga78AHnzN4S7EUZT2sa+xtwOzd4RgQm4zab /GHLuM0qWZGZHujviUqf7A7Vqkoiw+tDA14wqWIJwQeJHr7DsDEDM9cdbML8fXNJzA0S 74Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lyNDT6gMUVd7XADlZEueFFVmp7iqGlnv4um7W4NGQTo=; b=tTQ/n2KYBtV/5gXjzTt9LxucjxHJz60pS3/GJCrlrC1QXYMM2WK2RXeYvD6gqkZiQJ 4eW2Q0xcpnfXdxSIK5Pnt0Sf7oios78TBXbhuOCUZlLtTK1HS+qs/vSk7y8KSnZr2HJk 2muYtuBrb5zlVdacjdLHKe8pD9lWtaV65vowsU/ATs2DalDeTfphyC1KCBee+InVs3xQ 4hd2K1kZH5LvvgFs5o4ObFXhXudn1CJAxa0/ICCi+KZhuy7Um8EE49uM5P63srpWLHCL 1aGiLvJCNHte2M8GT5qvhP1xVqI4krbOcbj49aV5R4BvEDrIkXpM2swn0FATNYpxPDMp B8UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="X/glJO/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sg13si224699ejc.64.2022.01.26.13.10.55; Wed, 26 Jan 2022 13:11:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="X/glJO/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240918AbiAZLpm (ORCPT + 99 others); Wed, 26 Jan 2022 06:45:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240913AbiAZLph (ORCPT ); Wed, 26 Jan 2022 06:45:37 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E56B9C061747 for ; Wed, 26 Jan 2022 03:45:36 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id z5so8258416plg.8 for ; Wed, 26 Jan 2022 03:45:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lyNDT6gMUVd7XADlZEueFFVmp7iqGlnv4um7W4NGQTo=; b=X/glJO/YXqUfegb4WPXVEs5tC0FQx5MOWhX8pyx+pqRXQiUOisuqU2dVXA01T5DC9c SDfhm5o7uSL9nxx4sr+5SPwCINVjHNsrdr142Jx4eYcd76Zqx8SWFZD8nNPEUvueYkAB AP9YiDlNKPWFur9wtrGmfKHrjiV+AYVdXRosdP2jsYeQqGJk/MjG19qyujAC9IltGfvS /1CLgmqFazoZ6/GjjdgLOowm5JSzoGLeCOqhMvH4dlfGl0EOVcmxHGz9xKhoBy7sW/5i OZ2wETRk1posLrUmU9fPqV17/10aUaaOGkit6zhYSs0CHDlv2NXZ3D7twGJaO6Jw3MY5 B2Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lyNDT6gMUVd7XADlZEueFFVmp7iqGlnv4um7W4NGQTo=; b=eZkEKWbXnqaIDGpfh7huNXg76vBghMo3Kk5VfP2T2ajeQHqS98bOwSLDxzuMdI9Jml Rpan4kXh/mfysTAwa2F8d6M/eSTJgaP9ZCqrPIzDPOEZ/kmEZacBNEf2o01BFZ65BrXS Mcz4CHogv0Xih6TLfu6sAvGd6G5m+KfOjjK7031Ze4YuvqRrB6Mp8+13ppZxSK2qoj6V qrYR/0y0iUwr8Aa2XRS1x6PRlPBwjuX4dC2w32x64lYecMzLQ3WQES4bLCV7CB3yUepw ttMNGSwvWs+ezHOau561uHfkcm8Ft89uEWCv2cvUrGcyDQY36G+bNWdTn5ADEkR0pNpm WyLw== X-Gm-Message-State: AOAM531OGCL7/qqmLGe0tr7dVbH5UjNnt/sktEa29wArh3mzAmZPn7eA 58lP8oIT56gMSIdju7TzzUCsmA== X-Received: by 2002:a17:90a:c901:: with SMTP id v1mr8224362pjt.203.1643197536474; Wed, 26 Jan 2022 03:45:36 -0800 (PST) Received: from localhost.localdomain ([122.167.221.23]) by smtp.gmail.com with ESMTPSA id nn2sm2994976pjb.35.2022.01.26.03.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 03:45:35 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Ulf Hansson , "Rafael J . Wysocki" , Pavel Machek , Rob Herring Cc: Sandeep Tripathy , Atish Patra , Alistair Francis , Liush , Anup Patel , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [PATCH v10 4/8] RISC-V: Add SBI HSM suspend related defines Date: Wed, 26 Jan 2022 17:14:48 +0530 Message-Id: <20220126114452.692512-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126114452.692512-1-apatel@ventanamicro.com> References: <20220126114452.692512-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anup Patel We add defines related to SBI HSM suspend call and also update HSM states naming as-per latest SBI specification. Signed-off-by: Anup Patel Signed-off-by: Anup Patel --- arch/riscv/include/asm/sbi.h | 27 ++++++++++++++++++++++----- arch/riscv/kernel/cpu_ops_sbi.c | 2 +- arch/riscv/kvm/vcpu_sbi_hsm.c | 4 ++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index d1c37479d828..06133b4f8e20 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -71,15 +71,32 @@ enum sbi_ext_hsm_fid { SBI_EXT_HSM_HART_START = 0, SBI_EXT_HSM_HART_STOP, SBI_EXT_HSM_HART_STATUS, + SBI_EXT_HSM_HART_SUSPEND, }; -enum sbi_hsm_hart_status { - SBI_HSM_HART_STATUS_STARTED = 0, - SBI_HSM_HART_STATUS_STOPPED, - SBI_HSM_HART_STATUS_START_PENDING, - SBI_HSM_HART_STATUS_STOP_PENDING, +enum sbi_hsm_hart_state { + SBI_HSM_STATE_STARTED = 0, + SBI_HSM_STATE_STOPPED, + SBI_HSM_STATE_START_PENDING, + SBI_HSM_STATE_STOP_PENDING, + SBI_HSM_STATE_SUSPENDED, + SBI_HSM_STATE_SUSPEND_PENDING, + SBI_HSM_STATE_RESUME_PENDING, }; +#define SBI_HSM_SUSP_BASE_MASK 0x7fffffff +#define SBI_HSM_SUSP_NON_RET_BIT 0x80000000 +#define SBI_HSM_SUSP_PLAT_BASE 0x10000000 + +#define SBI_HSM_SUSPEND_RET_DEFAULT 0x00000000 +#define SBI_HSM_SUSPEND_RET_PLATFORM SBI_HSM_SUSP_PLAT_BASE +#define SBI_HSM_SUSPEND_RET_LAST SBI_HSM_SUSP_BASE_MASK +#define SBI_HSM_SUSPEND_NON_RET_DEFAULT SBI_HSM_SUSP_NON_RET_BIT +#define SBI_HSM_SUSPEND_NON_RET_PLATFORM (SBI_HSM_SUSP_NON_RET_BIT | \ + SBI_HSM_SUSP_PLAT_BASE) +#define SBI_HSM_SUSPEND_NON_RET_LAST (SBI_HSM_SUSP_NON_RET_BIT | \ + SBI_HSM_SUSP_BASE_MASK) + enum sbi_ext_srst_fid { SBI_EXT_SRST_RESET = 0, }; diff --git a/arch/riscv/kernel/cpu_ops_sbi.c b/arch/riscv/kernel/cpu_ops_sbi.c index dae29cbfe550..2e16f6732cdf 100644 --- a/arch/riscv/kernel/cpu_ops_sbi.c +++ b/arch/riscv/kernel/cpu_ops_sbi.c @@ -111,7 +111,7 @@ static int sbi_cpu_is_stopped(unsigned int cpuid) rc = sbi_hsm_hart_get_status(hartid); - if (rc == SBI_HSM_HART_STATUS_STOPPED) + if (rc == SBI_HSM_STATE_STOPPED) return 0; return rc; } diff --git a/arch/riscv/kvm/vcpu_sbi_hsm.c b/arch/riscv/kvm/vcpu_sbi_hsm.c index 2e383687fa48..1ac4b2e8e4ec 100644 --- a/arch/riscv/kvm/vcpu_sbi_hsm.c +++ b/arch/riscv/kvm/vcpu_sbi_hsm.c @@ -60,9 +60,9 @@ static int kvm_sbi_hsm_vcpu_get_status(struct kvm_vcpu *vcpu) if (!target_vcpu) return -EINVAL; if (!target_vcpu->arch.power_off) - return SBI_HSM_HART_STATUS_STARTED; + return SBI_HSM_STATE_STARTED; else - return SBI_HSM_HART_STATUS_STOPPED; + return SBI_HSM_STATE_STOPPED; } static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run, -- 2.25.1