Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5920701imm; Tue, 26 Jun 2018 22:08:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpevxp5S0+ezGLQ11eF3gaXA9RmcNJxl5M8w4HWG084G/2w8A/z4FNn668ZES/lfE6+AAVdr X-Received: by 2002:a62:21c3:: with SMTP id o64-v6mr4029175pfj.21.1530076128526; Tue, 26 Jun 2018 22:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530076128; cv=none; d=google.com; s=arc-20160816; b=IPjKxaD9HkQDDYIZlEFnRqr2DeTK41wFHykGjgxWNNWB692WRr6+W7EnwmH1Y5zORW TKiJOWuhohh4cIQwK7TxyOueJONNvBPi7xvz9G6PkGw4479/i//93oBY8LrvTH4yJY2g f09gVqR5kADvr/8vZ2JPGSiSs8eQb/MUY3H1m1DrK6RkrjxRaDBRB/1YZxaclxpcgCK+ NZD3wVwBo7uyMxvwGzQxyvzVgwbaxiepdMYe1jCLBx8yQObLtPNPnTbE5St+hG6PoTNP Na9Eu7SNKDu0lPzpQvMq3/CeV30Ombm1yDjvizmiA48q8gJXsMyMwPlUcqnPV9CLmuQ2 r/Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:arc-authentication-results; bh=+T+aX61PnEpJ3BfbBQKJdaggyL7QPnXoG8Ml/xhdpqU=; b=It7r1RdpyG4AYy8bLUQn6MNny15+HyjiVwycrJ+SwSrn7SZwt1my84P3hV8s77MJ32 b+IKbpO/8Lcl4O5ydX+aq0IOgrixtdj0+iMrc9myi4pjLG20aEcukuMzx9h8M9uauoIl 355w120POZ3GvIUnc1dOcba2Esyp68hmSaAEMZ/gihgS2TemkV3BA0gk4l1XWZ/FNVnN UG/ErattxVUZLuQsc7gje10uj+dwjHfghe0sRop4YWNuwKNrEahnDs6WtfYFNRIbYmTE LZO4CTY6EdVJvnzCucXbrKU9c5tgJx9kC7ZO3zWuqnpdigdXxLuKE5y9EnUn6AILnpAK Xosg== ARC-Authentication-Results: i=1; mx.google.com; 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 f2-v6si3927654plt.358.2018.06.26.22.08.33; Tue, 26 Jun 2018 22:08:48 -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; 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 S932143AbeF0EcY (ORCPT + 99 others); Wed, 27 Jun 2018 00:32:24 -0400 Received: from ozlabs.org ([203.11.71.1]:35551 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752702AbeF0EcW (ORCPT ); Wed, 27 Jun 2018 00:32:22 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41Fqkr4FQTz9s1B; Wed, 27 Jun 2018 14:32:20 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Arnd Bergmann , Paul Mackerras , Geert Uytterhoeven , Joshua Thompson Cc: Mathieu Malaterre , Benjamin Herrenschmidt , Greg Ungerer , linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Meelis Roos , Andreas Schwab , Arnd Bergmann Subject: Re: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions In-Reply-To: <20180619140229.3615110-1-arnd@arndb.de> References: <20180619140229.3615110-1-arnd@arndb.de> Date: Wed, 27 Jun 2018 14:32:17 +1000 Message-ID: <87y3f06e9a.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > As Mathieu pointed out, my conversion to time64_t was incorrect and resulted > in negative times to be read from the RTC. The problem is that during the > conversion from a byte array to a time64_t, the 'unsigned char' variable > holding the top byte gets turned into a negative signed 32-bit integer > before being assigned to the 64-bit variable for any times after 1972. > > This changes the logic to cast to an unsigned 32-bit number first for > the Macintosh time and then convert that to the Unix time, which then gives > us a time in the documented 1904..2040 year range. I decided not to use > the longer 1970..2106 range that other drivers use, for consistency with > the literal interpretation of the register, but that could be easily > changed if we decide we want to support any Mac after 2040. > > Just to be on the safe side, I'm also adding a WARN_ON that will trigger > if either the year 2040 has come and is observed by this driver, or we > run into an RTC that got set back to a pre-1970 date for some reason > (the two are indistinguishable). > > For the RTC write functions, Andreas found another problem: both > pmu_request() and cuda_request() are varargs functions, so changing > the type of the arguments passed into them from 32 bit to 64 bit > breaks the API for the set_rtc_time functions. This changes it > back to 32 bits. > > The same code exists in arch/m68k/ and is patched in an identical way now > in a separate patch. > > Fixes: 5bfd643583b2 ("powerpc: use time64_t in read_persistent_clock") > Reported-by: Mathieu Malaterre > Reported-by: Andreas Schwab > Signed-off-by: Arnd Bergmann > --- > arch/powerpc/platforms/powermac/time.c | 29 ++++++++++++++++++++--------- > 1 file changed, 20 insertions(+), 9 deletions(-) So I think I can take this patch in isolation via the powerpc tree as a fix for 4.18. I'll leave the other two alone. cheers