From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34EDBC4360C for ; Fri, 4 Oct 2019 16:37:25 +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 E415620873 for ; Fri, 4 Oct 2019 16:37:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MqrVl0la" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E415620873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.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: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IQa6mG8k0cdSi8PUJDCMDWFL6Ti0EWtcVJY4ZcB7tjk=; b=MqrVl0lac1VAaV SteNwXo8g6wI+GvIuPYgPU1s4vJLPzx0rlZyIR4aoiKKMV24fuhwltUjMDjeoOUbMiTZo5dylgZ1L f6C4Z3wcx5hZEHBUkFz9EBzXQbYALD7Wf1BxSmyM2Wo4CQXNOUUsyQMQYGVD5ZNvt8/45ixQLzZRZ yI32YIgSxS1GsSfcFtdrwHGFGevoimXyug8mLl05f3t3v2xrRktsCkhb40Q1oJ7qGWvNtNSgE0tuL PRnZQ+Sp3XkgccOIfRLYs5AxjN+q/QRcyeRGRlCtkiGIhrVdn78HsJDWRZKt8/LdrXNZHis+Mom5D yqxc/jUMjLG7NDIZr23w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGQa0-0002tb-Ck; Fri, 04 Oct 2019 16:37:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGQZx-0002t6-DV for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2019 16:37:18 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5CFCB15AB; Fri, 4 Oct 2019 09:37:16 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 756AB3F68E; Fri, 4 Oct 2019 09:37:15 -0700 (PDT) Date: Fri, 4 Oct 2019 17:37:13 +0100 From: Mark Rutland To: James Morse Subject: Re: [PATCH 6/8] arm64: entry: convert el0_sync to C Message-ID: <20191004163712.GM34756@lakrids.cambridge.arm.com> References: <20191003171642.135652-1-james.morse@arm.com> <20191003171642.135652-7-james.morse@arm.com> <20191004125746.GE34756@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191004_093717_498008_A8EBDC29 X-CRM114-Status: GOOD ( 19.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Julien Thierry , Masami Hiramatsu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 04, 2019 at 05:09:31PM +0100, James Morse wrote: > Hi Mark, > > On 04/10/2019 13:57, Mark Rutland wrote: > > On Thu, Oct 03, 2019 at 06:16:40PM +0100, James Morse wrote: > >> From: Mark Rutland > >> > >> This is largely a 1-1 conversion of asm to C, with a couple of caveats. > >> > >> The el0_sync{_compat} switches explicitly handle all the EL0 debug > >> cases, so el0_dbg doesn't have to try to bail out for unexpected EL1 > >> debug ESR values. This also means that an unexpected vector catch from > >> AArch32 is routed to el0_inv. > >> > >> We *could* merge the native and compat switches, which would make the > >> diffstat negative, but I've tried to stay as close to the existing > >> assembly as possible for the moment. > > >> +static void notrace el0_dbg(struct pt_regs *regs, unsigned long esr) > >> +{ > >> + unsigned long addr_if_watchpoint = read_sysreg(far_el1); > >> + > >> + if (system_uses_irq_prio_masking()) > >> + gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET); > >> + > >> + user_exit_irqoff(); > >> + do_debug_exception(addr_if_watchpoint, esr, regs); > >> + local_daif_restore(DAIF_PROCCTX_NOIRQ); > >> +} > >> +NOKPROBE_SYMBOL(el0_dbg); > > > > I think that it'd be best to stick with 'far' here, and only have the > > 'addr_if_watchpoint' name within do_debug_exception(), where it used to > > be 'addr'. That way all of this code consistently uses 'far'. > > I'm nervous reading junk into a variable called 'far'... someone might assume its an address. > > Of the exceptions that come through here, FAR_EL1 is only written by the CPU for a > watchpoint, for all the others its UNKNOWN. My argument is that "far" just means "the contents of FAR_EL1", and whether the value has any meaning for the current exception is context-dependent (i.e. within do_debug_exception()). > > Otherwise this all looks good to me: > > > > Reviewed-by: Mark Rutland > > I'll leave this for now, let me know if my paranoia needs re-tuning! Sure; my R-B holds either way. I just think it'd be nicer to use 'far' here for consistency. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel