Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5595743ybl; Tue, 27 Aug 2019 07:04:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+iiULwVPArGEAbQ7hzkIIr4WhIRd8aYAPwR8wCoTvZIhEqnD1OXIHDMerlw/DeK9YDbh2 X-Received: by 2002:a17:90a:fa82:: with SMTP id cu2mr26315655pjb.85.1566914674562; Tue, 27 Aug 2019 07:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566914674; cv=none; d=google.com; s=arc-20160816; b=W8ok1rGodBt+sbbYFXLDQwt4yhesdlh9JEpQawHTYzCHJEBRytdmXPw77IBwmY7mQ7 DhQ32N/iY8KnSVyeEHqyoSlKPKIqf0Q5bb8oqIyfq1NPQiZTacWRkclbi3BzmGHP+AOO dfDd325FtYdT9mYjAk7za5y2jv8oNZJmnWkez2wdwNtZPkpUZ14vH3RuTf23YtbdR2z8 fI8TmlU4TdNtXztXkp5bJLPXED3IAHeY0nBrDrROMGYSq2NP9Yuve1gFgw/H+t+CjpvM zBpxOe8QJAmoYXylRAtiOXaQqmbhmvVYgfoumSrfWfyAAuRZ5YMUBr13Jhb83/2gt9OP QIEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Hl8svcAvSlazt0+rAk+TpsMNvw0DYfmMevZpbRXZEJ0=; b=zivxzWqNJ5yjT0K5u9aQWWhxE1Au0DT+VclSc6a6FhcVuK5NKfXoe1JpOUCwK1lv38 rDcYVkcs40R8MmDr9wUNTabgtJmKniOJn3NT/oyY/CVFBApW/3z7wDD57BRRwb9TgEdf X69gwISRODnGXFP6oNVsj/pu15sZeq+9vCmzzRuJegeB0IiPJb4gTiodchJgfixVxsMs U7cy25S/e2i5z/T49qLRF6WKR0dLqIBVCwHNrDBVHvb/zIIyPcLFY4b2YD8r07VlTSEM y6BsvID7On4aecQcNM9XuKwrcpHbsW+FU1PEmZO3AifZqV4AiOB989doAUxyK5ERvUM2 9h5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Qge9FMNO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11si11178695plo.150.2019.08.27.07.04.18; Tue, 27 Aug 2019 07:04:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Qge9FMNO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbfH0ODH (ORCPT + 99 others); Tue, 27 Aug 2019 10:03:07 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41576 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbfH0ODG (ORCPT ); Tue, 27 Aug 2019 10:03:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Hl8svcAvSlazt0+rAk+TpsMNvw0DYfmMevZpbRXZEJ0=; b=Qge9FMNOdFQbBh+DYHEeSB6zM Xi/oK5Yvkr5IeHFhQNk6iFtCDdLFMTORNeEgZvBeWUa76EIp8Y7eKzuxg2YjCCkyNaLuoBFjTUF7L 3Ss6TFYYS6tIQ/0uzpdX+/ivNPU5DX0Z3Ze7m4T9Yw0q779VPHmYmJq9FitUP17It0rNDSj0hixD8 Zl9tiWzIuPgFEuCX8DfIfW5KhtnWkdRF6KPQ7JYVEuZdsB7b5RZTXA3UZw+RZC1MqO7//chqWzhmq TrSDd0bWLhe/yA5fqrYLwHQGBfbqctcnlM7kWWlLsbQKtIj/c4hTy2wWue7hzmyboJ58H4lIxfs9X seK+ai+ww==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1i2c3s-0003ua-DN; Tue, 27 Aug 2019 14:03:04 +0000 Date: Tue, 27 Aug 2019 07:03:04 -0700 From: Christoph Hellwig To: Atish Patra Cc: linux-kernel@vger.kernel.org, Albert Ou , Alan Kao , Alexios Zavras , Anup Patel , Palmer Dabbelt , Mike Rapoport , Paul Walmsley , Gary Guo , Greg Kroah-Hartman , linux-riscv@lists.infradead.org, Thomas Gleixner Subject: Re: [RFC PATCH 1/2] RISC-V: Mark existing SBI as legacy SBI. Message-ID: <20190827140304.GA21855@infradead.org> References: <20190826233256.32383-1-atish.patra@wdc.com> <20190826233256.32383-2-atish.patra@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190826233256.32383-2-atish.patra@wdc.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +#define SBI_EXT_LEGACY_SET_TIMER 0x0 > +#define SBI_EXT_LEGACY_CONSOLE_PUTCHAR 0x1 > +#define SBI_EXT_LEGACY_CONSOLE_GETCHAR 0x2 > +#define SBI_EXT_LEGACY_CLEAR_IPI 0x3 > +#define SBI_EXT_LEGACY_SEND_IPI 0x4 > +#define SBI_EXT_LEGACY_REMOTE_FENCE_I 0x5 > +#define SBI_EXT_LEGACY_REMOTE_SFENCE_VMA 0x6 > +#define SBI_EXT_LEGACY_REMOTE_SFENCE_VMA_ASID 0x7 > +#define SBI_EXT_LEGACY_SHUTDOWN 0x8 As Mike said legacy is a bit of a weird name. I think this should be SBI01_* or so. And pleae align the numeric values and maybe use an enum. > + > +#define SBI_CALL_LEGACY(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); \ Instead of the weird inline assembly with forced register allocation, why not move this to pure assembly? AFAICs this is the whole assembly code we'd need: ENTRY(sbi01_call) ecall END(sbi01_call) > /* Lazy implementations until SBI is finalized */ > -#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0, 0) > -#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0, 0) > -#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0, 0) > -#define SBI_CALL_3(which, arg0, arg1, arg2) \ > - SBI_CALL(which, arg0, arg1, arg2, 0) > -#define SBI_CALL_4(which, arg0, arg1, arg2, arg3) \ > - SBI_CALL(which, arg0, arg1, arg2, arg3) > +#define SBI_CALL_LEGACY_0(which) SBI_CALL_LEGACY(which, 0, 0, 0, 0) > +#define SBI_CALL_LEGACY_1(which, arg0) SBI_CALL_LEGACY(which, arg0, 0, 0, 0) > +#define SBI_CALL_LEGACY_2(which, arg0, arg1) \ > + SBI_CALL_LEGACY(which, arg0, arg1, 0, 0) > +#define SBI_CALL_LEGACY_3(which, arg0, arg1, arg2) \ > + SBI_CALL_LEGACY(which, arg0, arg1, arg2, 0) > +#define SBI_CALL_LEGACY_4(which, arg0, arg1, arg2, arg3) \ > + SBI_CALL_LEGACY(which, arg0, arg1, arg2, arg3) When you touch this anyway I'd suggest you kill these rather pointless wrappers as well as the comment above them.