From patchwork Tue Jan 28 02:27:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11353481 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F18E139A for ; Tue, 28 Jan 2020 02:28:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27C9724682 for ; Tue, 28 Jan 2020 02:28:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="N0Nvr23Y"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="pUfl4lvR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27C9724682 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date :Subject:To:From:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O+c9WUtL6/Lnv35RbuPb68w31uHNCt8mbEATKbG+Chg=; b=N0Nvr23YKRLE5S qvGC7czG1W+FB7QDXpdkWEZj82Vsreol5gnXe9Wr2+5oi3fVZoKcuxgrb9/NoACf5/WxNhGNV3xVQ EGitzwqsNJ+4UmszSeh1Oy5c6wZtYF7G0ehL559qYDmFuAUEdGZcT9/yMwP3xRYGweJfd0G+ruPpk hIg5ejYDo/93fhjQkF3dNzZb0gcJuGr03gSuGVU/jK8QbGpVAiUOytiQQSbkAAPjNdF7IBKWkXOEO /YquzHvs1OZoHt8pFnQ6z/xHlYgVFQ9uie+cH5pDNBL3FAu8N4jN87kF9mcF0Dg9IpJsQj+ZyCy8e t7aHq88hh+d7HLMALUhQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwGbs-0005r6-Ga; Tue, 28 Jan 2020 02:28:12 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwGbo-0005ps-N7 for linux-riscv@lists.infradead.org; Tue, 28 Jan 2020 02:28:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580178508; x=1611714508; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UorqLKP57b6PMCT+1VL4L6XYE1Vd36TEURwukvr+gSY=; b=pUfl4lvRMpN0Dk0ml9JX8nv0HQ7736i+/H0yeaZjhlXPhp4a4hp7CjiM zL5na0Z8gBO0f2lOeUL1lrDW/gsiokLdB9ObTbY5qgj+BNCWYYJfOMoy0 hgxlGF9IAPEJFKpPzw14ELKQp4+2qWjX5nHKlIFQSwSERseWeC49K+PqD nTo3KHZmmaIoK4RF6pEhbBHmTZMl2Ivn/IU44ADrirs8zo1+p2nbbMPJ3 2PTaKa+VEMxO89AuwKrltXB2cwoqPcr5JrWj13CqOHh2hIpdaVISifMvn uDn6PXE/AKsAZtkTu5aQVbaTa+xRg/HCMNI8Sa4b/o1Z4ZrOZzJdQ6WyQ A==; IronPort-SDR: 50/9mvt5UQhcIFVbI69NerqtbudwlVx0ey5YgNVBA10UYgmi47RAlRDlYvZi6Xqn+6jFqIQ+au 7YBLxZ1d8G17iqbJEThjNt5+GHBXYY8ieroauMlSQanKoz1LLUUGvL27G6Yq1BxBnxIbpUPtFk cuDx3n8SZjltZWraWiqzGFypHtGA0OrtnHU3ouO4FBWkc6Ap7eK19xSbpPDvPWdpq7JqPgGKQP 9OrttzrguJnhCJFCZk6/7KGRVwpR+n9s4SxAywK1uSIZEA13CQQ++m7tuo16ke1jYeYwDexFGQ of8= X-IronPort-AV: E=Sophos;i="5.70,372,1574092800"; d="scan'208";a="230237580" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 28 Jan 2020 10:28:26 +0800 IronPort-SDR: 3Aib+gh66cw5XV/+IhCnTM4EqNeevPdto/rVw38f7aJ1glTqf7E188FA/yU2BwYORNh7fSuMVk OSoWxjxtMPdV5t2FNEtVOrG4N8orcifUqXAkEWg+jPZulr8bqoWBLy62oqPzQ7XsJ9ecmynVlW EdYNwdg9Xe7mRvNzhW3NYCs2qSFrDigCkHnEMqnYH4j7+J2KQvK3fqplZzzyc1GdeVFoZIK/MU SnRGFrrjhXOKb3vvGO11FNh0ceZ6bZIwZ0I4sFPe+pZZs4FmYfgCdqL+HicepBLaxpppMHJ3IQ VWC+/RG4Fzs7wbh+HYfIBkZu Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2020 18:21:22 -0800 IronPort-SDR: gZweaIFfZbH6bxjhNbxuvU235VwbWSMSVstM5yqZLjd10PZmIGau1fOhJzV/J4YP7bu3UrxibT s9x9Gw2nTFmCp9PjioxE7ojb2Z2crQp2591B2iojxoeJq0hiYAEkuLvZi0cxW9wk6OKBKJMw+r arOQhZ9SYfeBfnFpoUUUguTNSTo5ha2J88sliAO4PITBaxMkN4a/UmBCple3UIQJgbqPbZH+4z nVt9fV0WpGCeD2rLXAWIabVpsp23T6NlDY/4wZqJeTx1J90qt5Q1vR4PHIGP0BSOLytUgNxIbd f6g= WDCIronportException: Internal Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip01.wdc.com with ESMTP; 27 Jan 2020 18:28:08 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v7 01/10] RISC-V: Mark existing SBI as 0.1 SBI. Date: Mon, 27 Jan 2020 18:27:28 -0800 Message-Id: <20200128022737.15371-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200128022737.15371-1-atish.patra@wdc.com> References: <20200128022737.15371-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200127_182808_792773_AB914012 X-CRM114-Status: GOOD ( 12.96 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Albert Ou , Thomas Gleixner , Kees Cook , abner.chang@hpe.com, Vincent Chen , nickhu@andestech.com, Anup Patel , Palmer Dabbelt , Heiko Carstens , Mike Rapoport , clin@suse.com, Atish Patra , Geert Uytterhoeven , "Eric W. Biederman" , Paul Walmsley , Greg Kroah-Hartman , Greentime Hu , linux-riscv@lists.infradead.org, Borislav Petkov , Palmer Dabbelt , Mao Han Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org As per the new SBI specification, current SBI implementation version is defined as 0.1 and will be removed/replaced in future. Each of the function call in 0.1 is defined as a separate extension which makes easier to replace them one at a time. Rename existing implementation to reflect that. This patch is just a preparatory patch for SBI v0.2 and doesn't introduce any functional changes. Signed-off-by: Atish Patra Reviewed-by: Anup Patel Reviewed-by: Palmer Dabbelt --- arch/riscv/include/asm/sbi.h | 44 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 2570c1e683d3..b38bc36f7429 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (C) 2015 Regents of the University of California + * Copyright (c) 2019 Western Digital Corporation or its affiliates. */ #ifndef _ASM_RISCV_SBI_H @@ -9,17 +10,17 @@ #include #ifdef CONFIG_RISCV_SBI -#define SBI_SET_TIMER 0 -#define SBI_CONSOLE_PUTCHAR 1 -#define SBI_CONSOLE_GETCHAR 2 -#define SBI_CLEAR_IPI 3 -#define SBI_SEND_IPI 4 -#define SBI_REMOTE_FENCE_I 5 -#define SBI_REMOTE_SFENCE_VMA 6 -#define SBI_REMOTE_SFENCE_VMA_ASID 7 -#define SBI_SHUTDOWN 8 +#define SBI_EXT_0_1_SET_TIMER 0x0 +#define SBI_EXT_0_1_CONSOLE_PUTCHAR 0x1 +#define SBI_EXT_0_1_CONSOLE_GETCHAR 0x2 +#define SBI_EXT_0_1_CLEAR_IPI 0x3 +#define SBI_EXT_0_1_SEND_IPI 0x4 +#define SBI_EXT_0_1_REMOTE_FENCE_I 0x5 +#define SBI_EXT_0_1_REMOTE_SFENCE_VMA 0x6 +#define SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID 0x7 +#define SBI_EXT_0_1_SHUTDOWN 0x8 -#define SBI_CALL(which, arg0, arg1, arg2, arg3) ({ \ +#define SBI_CALL(which, arg0, arg1, arg2, arg3) ({ \ register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0); \ register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1); \ register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2); \ @@ -43,48 +44,50 @@ static inline void sbi_console_putchar(int ch) { - SBI_CALL_1(SBI_CONSOLE_PUTCHAR, ch); + SBI_CALL_1(SBI_EXT_0_1_CONSOLE_PUTCHAR, ch); } static inline int sbi_console_getchar(void) { - return SBI_CALL_0(SBI_CONSOLE_GETCHAR); + return SBI_CALL_0(SBI_EXT_0_1_CONSOLE_GETCHAR); } static inline void sbi_set_timer(uint64_t stime_value) { #if __riscv_xlen == 32 - SBI_CALL_2(SBI_SET_TIMER, stime_value, stime_value >> 32); + SBI_CALL_2(SBI_EXT_0_1_SET_TIMER, stime_value, + stime_value >> 32); #else - SBI_CALL_1(SBI_SET_TIMER, stime_value); + SBI_CALL_1(SBI_EXT_0_1_SET_TIMER, stime_value); #endif } static inline void sbi_shutdown(void) { - SBI_CALL_0(SBI_SHUTDOWN); + SBI_CALL_0(SBI_EXT_0_1_SHUTDOWN); } static inline void sbi_clear_ipi(void) { - SBI_CALL_0(SBI_CLEAR_IPI); + SBI_CALL_0(SBI_EXT_0_1_CLEAR_IPI); } static inline void sbi_send_ipi(const unsigned long *hart_mask) { - SBI_CALL_1(SBI_SEND_IPI, hart_mask); + SBI_CALL_1(SBI_EXT_0_1_SEND_IPI, hart_mask); } static inline void sbi_remote_fence_i(const unsigned long *hart_mask) { - SBI_CALL_1(SBI_REMOTE_FENCE_I, hart_mask); + SBI_CALL_1(SBI_EXT_0_1_REMOTE_FENCE_I, hart_mask); } static inline void sbi_remote_sfence_vma(const unsigned long *hart_mask, unsigned long start, unsigned long size) { - SBI_CALL_3(SBI_REMOTE_SFENCE_VMA, hart_mask, start, size); + SBI_CALL_3(SBI_EXT_0_1_REMOTE_SFENCE_VMA, hart_mask, + start, size); } static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, @@ -92,7 +95,8 @@ static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, unsigned long size, unsigned long asid) { - SBI_CALL_4(SBI_REMOTE_SFENCE_VMA_ASID, hart_mask, start, size, asid); + SBI_CALL_4(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, hart_mask, + start, size, asid); } #else /* CONFIG_RISCV_SBI */ /* stubs for code that is only reachable under IS_ENABLED(CONFIG_RISCV_SBI): */