Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp628676pxb; Wed, 16 Feb 2022 00:17:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcCJnExmfVZmUzT+QCdN9NjrAWlIjXH62/c3t7GQ0tH872WW7yBja369UZDxH7qBEs+ngd X-Received: by 2002:a17:902:654b:b0:14d:964d:7578 with SMTP id d11-20020a170902654b00b0014d964d7578mr1467872pln.166.1644999475225; Wed, 16 Feb 2022 00:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644999475; cv=none; d=google.com; s=arc-20160816; b=ExyjlM9Ke76YDDtUGTBGSvYg+QYG286mF6HvzaSZ22a0xPbQqxZbrVAZTc9Ma5zW6g SeWVs4spLRWYNEAvuFvs7n+wqiaiVr8OrU6qwQ7mGoY5v4Jnhecn0l+kUPci4wOwWFqK IJ6etMSmAoNNiuIjvPjY66FzncyJo+R+gkQBWQCxll1vKtVastEy6wENVXdYg5rnQjft F3qqM9597G4aDPq5zqer1wG+jVuujubShUG9wj+gV6vff/OBoKzCu3X7LlG+yPNdVMgn XVVPN5ueuKRbzQF66C/iLcPQSaqSrEhWQBirTN+hKTTx47dWQjok9hBYcTCDrQAVRBlR XgyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oMtBLX0dxO/FEXDrSK4WwXrfvEvOmP/i+ozpjhDxh2o=; b=QZIhhhlDaiQplyNUJR2Y4PcK1FI3KxDAMi7k6zQ+fJ5tyIBQVGBkW7LYdPl6xRBUAv VEI1FTMdIN2WW2c5xqsypXZDBb2WhSwm5mZq9Zm830CbFVaoP3mhYBv07wXDs9hPEHP0 ZW6a5Z8YI/ufi94z9dJrDa0eC0aUcFEPDDI4Xushn5cbuTHm+uXUymfFoR1z8vdHsNwI wGvml+dQ1sUp5ie0X2JVuo9k/nblAzVy/+cZRtjbgG02FtAAHome6eTLqO4I3uOoZgyr SP7cqfx1UKvMLfow8QA2TUT/MKc6ZrcKeRRvPKA9QE/LV2tRYfgV6oVx8uf2agrmakUR xA/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=EGr7uINo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id oj6si10559420pjb.1.2022.02.16.00.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 00:17:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=EGr7uINo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85F2663D0; Tue, 15 Feb 2022 23:57:28 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230274AbiBPH5b (ORCPT + 99 others); Wed, 16 Feb 2022 02:57:31 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:33760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbiBPH53 (ORCPT ); Wed, 16 Feb 2022 02:57:29 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A87462C5 for ; Tue, 15 Feb 2022 23:57:17 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id l125so3614558ybl.4 for ; Tue, 15 Feb 2022 23:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oMtBLX0dxO/FEXDrSK4WwXrfvEvOmP/i+ozpjhDxh2o=; b=EGr7uINoD4BR8i3qX/tomHNRruYcjc/QbsipOZJBMwQk2ZyhvOQqpMphIFGGGWNWd3 JuGaeHSzEymH3RXHvUYHLSTERTs3AOZYPXnaVJ7N/QHn/Lzy8Soxfsdbwy63HmyHvoGF ibPohfBIFhqTBcVfC4PMPdPyf0zXr8PsqaP7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oMtBLX0dxO/FEXDrSK4WwXrfvEvOmP/i+ozpjhDxh2o=; b=rWEPJV5rjUkIumhETRs6qVqAR5D7bHqYdS9UCbY4ujZWmVGrqKTnDg5ufxTVVbP+b/ MqZAJx3RtAtD/z/4u/GnsBAoE9aSxIxqaUxgC/EJB58OewPvUfrehNiMddJw/qvSDlUE Bn30PKhCLWpckj6K/AC4iUM3o26zdmytnB0cu6KjZTC3ZkfimZpBo00ZP/P4/scnBSPW R+aHaP2HlsbZGGNvGJ1nygh8p6gPuicILzlgIN+7PvxhR7UUHfBWBcPz7A2bC3B1WDD7 Sur3F9K/dw8RCbKPHfsp92tOzvyN4aJ1RXNvqQXiBiRnWUDHcimkqETUhP9bSxXDE/sS b+Wg== X-Gm-Message-State: AOAM533Gw2qoafu38DN/Z5ZxxI9oJtdoqwMcSwfmsPCAY8zU0wwY2v5v fm3uV8oDyW2pPu9TzP+d5F8+DMph09bNTIU+cRou X-Received: by 2002:a5b:ec5:0:b0:615:4edf:4641 with SMTP id a5-20020a5b0ec5000000b006154edf4641mr1079024ybs.494.1644998236462; Tue, 15 Feb 2022 23:57:16 -0800 (PST) MIME-Version: 1.0 References: <20220210054947.170134-1-apatel@ventanamicro.com> <20220210054947.170134-5-apatel@ventanamicro.com> In-Reply-To: <20220210054947.170134-5-apatel@ventanamicro.com> From: Atish Patra Date: Tue, 15 Feb 2022 23:57:05 -0800 Message-ID: Subject: Re: [PATCH v11 4/8] RISC-V: Add SBI HSM suspend related defines To: Anup Patel Cc: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Ulf Hansson , "Rafael J . Wysocki" , Pavel Machek , Rob Herring , Sandeep Tripathy , Alistair Francis , Liush , Anup Patel , devicetree , linux-riscv , "linux-kernel@vger.kernel.org List" , "open list:THERMAL" , "linux-arm-kernel@lists.infradead.org" , kvm-riscv@lists.infradead.org, Guo Ren Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 9, 2022 at 9:50 PM Anup Patel wrote: > > 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 > Reviewed-by: Guo Ren > --- > 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 > Reviewed-by: Atish Patra -- Regards, Atish