Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1381038ybk; Sun, 10 May 2020 15:15:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKhCvQl4K2TB4cqwzrT9IP5+nkoO9wX0Q/k190qe7Ehi2PquyC45VDvAKJgWEeqDPniDW3o X-Received: by 2002:a17:906:a984:: with SMTP id jr4mr5397415ejb.3.1589148936345; Sun, 10 May 2020 15:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589148936; cv=none; d=google.com; s=arc-20160816; b=GRpCcB+5Go1oNXRCXya+L6YXWcPb9KnN6sbXlj0F2xOmnVH+CaGPNPM7R/zVn3Zg57 zo8PzFt9ToSQwauTANh4biQJkfaRp3dgI4Kt78UdaSjqaWf9MKjS8+bNqEuVvtt7ddGs f2JlWrbmtQJddzpdrG47nEkLuL9SFd10izU72XcHDJbPbgZ46Kdg6P0XIeg2e0casft1 9g7IWACgBjXZAgpMkrfTgjTIggC51uiWY5aReBtypWUj5mwv1Hg+YBm1CfAO0W+Zr9La w1T8az/P7q+SXhb0C5BTqAxmpfBVQybALV1nH9r75ai0oGqZTKayIs0ZVs3GYXLdu+Ip Ds/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=l35YyoCS9sUo3eoR5khwpG9zVXhdWOdgw7m7CznxLL8=; b=s63csRd2fjWG6lD04eK+BIvn0T3wvcfTCa6Bocw5KLuepMW4MBljRAKO/9wMADVEc2 1/gY66DeXKZStLWBInOXyLzs5/sfCNXC5v85uqzkXkFgLjxlUeSUdbLtsMOF5zthUEcu 1s8AImBcxI9/+FX4si1Ohs9hlJx3fvhfvjSxfLQUPN+PnjI2SMaX6gODjihxvSOWngm4 fUPUzzlauCl6kkIy7jJsf1kNO3hchGI7yfkrm6WqsBqIBbGQUNgHtinRu7T+EeQKOY0/ z3IwFRJXmnImk+P84q73GwK0zfDOXYW6Bs6XC8bSlgjkVR0ElZEYhBKSkZDIdk1C8gIR WFlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu15si4760726edb.129.2020.05.10.15.15.13; Sun, 10 May 2020 15:15:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729347AbgEJWNt (ORCPT + 99 others); Sun, 10 May 2020 18:13:49 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:47580 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728763AbgEJWNt (ORCPT ); Sun, 10 May 2020 18:13:49 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id D2DE68030807; Sun, 10 May 2020 22:13:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KXGCpCbzb8BW; Mon, 11 May 2020 01:13:45 +0300 (MSK) Date: Mon, 11 May 2020 01:13:44 +0300 From: Serge Semin To: Thomas Bogendoerfer CC: Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , , , Zhou Yanjie , Paul Cercueil , Jiaxun Yang , , Subject: Re: [PATCH v2 11/20] mips: MAAR: Use more precise address mask Message-ID: <20200510221344.kixpbwy2kcxf62ie@mobilestation> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> <20200506174238.15385-12-Sergey.Semin@baikalelectronics.ru> <20200507110951.GD11616@alpha.franken.de> <20200507191337.la6z476myszqethj@mobilestation> <20200508092236.GA9085@alpha.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200508092236.GA9085@alpha.franken.de> X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 11:22:36AM +0200, Thomas Bogendoerfer wrote: > On Thu, May 07, 2020 at 10:13:37PM +0300, Serge Semin wrote: > > On Thu, May 07, 2020 at 01:09:51PM +0200, Thomas Bogendoerfer wrote: > > > On Wed, May 06, 2020 at 08:42:29PM +0300, Sergey.Semin@baikalelectronics.ru wrote: > > > > From: Serge Semin > > > > > > > > Indeed according to the P5600/P6000 manual the MAAR pair register > > > > address field either takes [12:31] bits for 32-bits non-XPA systems > > > > and [12:35] otherwise. In any case the current address mask is just > > > > wrong for 64-bit and 32-bits XPA chips. So lets extend it to 39-bits > > > > value. This shall cover the 64-bits architecture and systems with XPA > > > > enabled, and won't cause any problem for non-XPA 32-bit systems, since > > > > the value will be just truncated when written to the 32-bits register. > > > > > > according to MIPS32 Priveleged Resoure Architecture Rev. 6.02 > > > ADDR spans from bit 12 to bit 55. So your patch fits only for P5600. > > > > > Does the wider mask cause any problems ? > > > > No, it won't. Bits written to the [40:62] range will be just ignored, > > while reading from there should return zeros. Setting GENMASK_ULL(55, 12) > > would also work. Though this solution is a bit workarounding because > > MIPS_MAAR_ADDR wouldn't reflect the real mask of the ADDR field. Something > > like the next macro would work better: > > > > +#define MIPS_MAAR_ADDR \ > > +({ \ > > + u64 __mask; \ > > + \ > > + if (cpu_has_lpa && read_c0_pagegrain() & PG_ELPA) { \ > > + __mask = GENMASK_ULL(55, 12); \ > > + else \ > > + __mask = GENMASK_ULL(31, 12); \ > > + \ > > + __mask; \ > > +}) > > that looks horrible. > > > What do you think? What is better: the macro above or setting > > GENMASK_ULL(55, 12)? > > just that one ;-) Agreed. I'll fix it in v3. -Sergey > > Thomas. > > -- > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > good idea. [ RFC1925, 2.3 ]