From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 21 Sep 2016 15:09:01 +0200 (CEST) Received: from localhost.localdomain ([127.0.0.1]:47578 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S23991986AbcIUNIyVZAwA (ORCPT ); Wed, 21 Sep 2016 15:08:54 +0200 Received: from scotty.linux-mips.net (localhost.localdomain [127.0.0.1]) by scotty.linux-mips.net (8.15.2/8.14.8) with ESMTP id u8LD8rVB015238; Wed, 21 Sep 2016 15:08:53 +0200 Received: (from ralf@localhost) by scotty.linux-mips.net (8.15.2/8.15.2/Submit) id u8LD8qee015237; Wed, 21 Sep 2016 15:08:52 +0200 Date: Wed, 21 Sep 2016 15:08:52 +0200 From: Ralf Baechle To: James Hogan Cc: Matt Redfearn , linux-mips@linux-mips.org Subject: Re: [PATCH 1/9] MIPS: traps: 64bit kernels should read CP0_EBase 64bit Message-ID: <20160921130852.GA10899@linux-mips.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.0 (2016-08-17) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 55219 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: ralf@linux-mips.org Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On Thu, Sep 01, 2016 at 05:30:07PM +0100, James Hogan wrote: > When reading the CP0_EBase register containing the WG (write gate) bit, > the ebase variable should be set to the full value of the register, i.e. > on a 64-bit kernel the full 64-bit width of the register via > read_cp0_ebase_64(), and on a 32-bit kernel the full 32-bit width > including bits 31:30 which may be writeable. How about changing the definition of read/write_c0_ebase to #define read_c0_ebase() __read_ulong_c0_register($15, 1) #define write_c0_ebase(val) __write_ulong_c0_register($15, 1, val) or using a new variant like #define read_c0_ebase_ulong() __read_ulong_c0_register($15, 1) #define write_c0_ebase_ulong(val) __write_ulong_c0_register($15, 1, val) to avoid the ifdefery? This could also make this bit ebase = cpu_has_mips64r6 ? read_c0_ebase_64() : (s32)read_c0_ebase(); in cpu-probe.c prettier. Ralf