linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raul E Rangel <rrangel@chromium.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "Anand K. Mistry" <amistry@google.com>,
	x86@kernel.org, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] x86: Add a prompt for HPET_EMULATE_RTC
Date: Wed, 2 Mar 2022 13:37:40 -0700	[thread overview]
Message-ID: <Yh/VlNy1owvTh979@google.com> (raw)
In-Reply-To: <87zgxbhr17.ffs@nanos.tec.linutronix.de>

On Tue, May 04, 2021 at 09:55:16AM +0200, Thomas Gleixner wrote:
> On Tue, May 04 2021 at 11:21, Anand K. Mistry wrote:
> > On Mon, 3 May 2021 at 17:38, Thomas Gleixner <tglx@linutronix.de> wrote:
> >> On Thu, Apr 29 2021 at 16:00, Anand K. Mistry wrote:
> >>
> >> > This does two things:
> >> > 1. Makes the option visible in menuconfig, allowing the user to easily
> >> >    disable this option
> >> > 2. Allows olddefconfig to respect the option if it is set in the old
> >> >    .config file
> >>
> >> Well, it's pretty clear WHAT it does, but there is absolutely no
> >> reasoning WHY this knob is needed in the first place.
> >
> > Without this option, 'make oldolddefconfig' ignores the option in the
> > old .confg file and just sets it to the calculated default for the
> > platform. An easy way to test this is to do 'make defconfig' on
> > x86-64, set CONFIG_HPET_EMULATE_RTC=n in the generated .config, and
> > run 'make olddefconfig'. Without this patch, olddefconfig will ignore
> > the set option and overwrite it with CONFIG_HPET_EMULATE_RTC=y.
> 
> Rightfully so because it's a functional correctness issue. When HPET is
> enabled in legacy mode it takes over the RTC interrupt line, which makes
> RTC alarms disfunctional and therefore we have to emulate it. 
> 
> So, no.
> 
> > So, part of the why is that this enables the use of olddefconfig with
> > the CONFIG_HPET_EMULATE_RTC option. The other part of why is that my
> > team uses 'make olddefconfig' by providing a base config and then
> > using olddefconfig to fill in the unset values with defaults to make a
> > complete config file for a kernel build. I'd like to disable RTC
> > emulation on a particular platform, but I can't use a config option to
> > do it without this patch because 'make olddefconfig' will just ignore
> > the option.
> 
> You can like to disable it, but that does not make it more correct. See
> above. If your platform does not have RTC_DRV_CMOS then you have to
> disable that which will also clear CONFIG_HPET_EMULATE_RTC.

So on recent AMD Chromebooks we have disabled the RTC emulation by
setting rtc-cmos.use_acpi_alarm=1.

* https://chromium-review.googlesource.com/c/chromiumos/overlays/board-overlays/+/3472221
* https://chromium-review.googlesource.com/c/chromiumos/overlays/board-overlays/+/2355073

It looks like recent Intel platforms have also disabled the RTC
emulation.

* https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/kernel/v5.15/drivers/rtc/rtc-cmos.c;l=1202

One thing I've been wondering is why is the legacy mode enabled
unconditionally by the kernel?

* https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/kernel/v5.15/arch/x86/kernel/hpet.c;l=1096

If it's not enabled, can we leave it disabled? I know some firmware
doesn't correctly populate the INT_ROUTE_CAP to describe which IRQs
are available, but if it is populated can we use it and avoid the 
RTC HPET emulation layer? I'm not sure what the story is on MSIs or if
that's a supported use case.

I have been leaving the INT_ROUTE_CAP register unset on the AMD
Chromebooks since it's getting ignored by the kernel.

Thanks,
Raul

> 
> Thanks,
> 
>         tglx

      reply	other threads:[~2022-03-02 20:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  6:00 [PATCH v2] x86: Add a prompt for HPET_EMULATE_RTC Anand K Mistry
2021-05-03  7:38 ` Thomas Gleixner
2021-05-04  1:21   ` Anand K. Mistry
2021-05-04  7:55     ` Thomas Gleixner
2022-03-02 20:37       ` Raul E Rangel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yh/VlNy1owvTh979@google.com \
    --to=rrangel@chromium.org \
    --cc=amistry@google.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).