public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 13/14] x86/init: rename ebda code file
       [not found] <1459987594-5434-1-git-send-email-mcgrof@kernel.org>
@ 2016-04-07 21:31 ` Luis R. Rodriguez
       [not found] ` <1459987594-5434-12-git-send-email-mcgrof@kernel.org>
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-07 21:31 UTC (permalink / raw)
  To: bp, hpa, tglx, mingo, rusty
  Cc: x86, linux-kernel, luto, boris.ostrovsky, david.vrabel,
	konrad.wilk, xen-devel, lguest, andriy.shevchenko, jlee, glin,
	matt, andrew.cooper3, rjw, lenb, robert.moore, lv.zheng,
	toshi.kani, linux-acpi, Luis R. Rodriguez

This makes it clearer what this is.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 arch/x86/Makefile                  | 2 +-
 arch/x86/kernel/Makefile           | 2 +-
 arch/x86/kernel/{head.c => ebda.c} | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename arch/x86/kernel/{head.c => ebda.c} (100%)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index f9ed8a7ce2b6..6fce7f096b88 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -208,7 +208,7 @@ endif
 
 head-y := arch/x86/kernel/head_$(BITS).o
 head-y += arch/x86/kernel/head$(BITS).o
-head-y += arch/x86/kernel/head.o
+head-y += arch/x86/kernel/ebda.o
 head-y += arch/x86/kernel/platform-quirks.o
 
 libs-y  += arch/x86/lib/
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 7a9e44d935de..0503f5bfb18d 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -4,7 +4,7 @@
 
 extra-y	:= head_$(BITS).o
 extra-y	+= head$(BITS).o
-extra-y	+= head.o
+extra-y	+= ebda.o
 extra-y	+= platform-quirks.o
 extra-y	+= vmlinux.lds
 
diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/ebda.c
similarity index 100%
rename from arch/x86/kernel/head.c
rename to arch/x86/kernel/ebda.c
-- 
2.7.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Xen-devel] [PATCH v4 11/14] pnpbios: replace paravirt_enabled() check with legacy device check
       [not found]   ` <57062C63.2010609@citrix.com>
@ 2016-04-07 21:42     ` Luis R. Rodriguez
  0 siblings, 0 replies; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-07 21:42 UTC (permalink / raw)
  To: David Vrabel
  Cc: Luis R. Rodriguez, bp, hpa, tglx, mingo, rusty, xen-devel, matt,
	andrew.cooper3, x86, linux-kernel, luto, jlee, lguest, glin,
	boris.ostrovsky, andriy.shevchenko, Josh Triplett, robert.moore,
	lv.zheng, rafael.j.wysocki, toshi.kani, linux-acpi, tiwai

On Thu, Apr 07, 2016 at 10:46:11AM +0100, David Vrabel wrote:
> On 07/04/16 01:06, Luis R. Rodriguez wrote:
> > Since we are removing paravirt_enabled() replace it with a
> > logical equivalent. Even though PNPBIOS is x86 specific we
> > add an arch-specific type call, which can be implemented by
> > any architecture to show how other legacy attribute devices
> > can later be also checked for with other ACPI legacy attribute
> > flags.
> > 
> > This implicates the first ACPI 5.2.9.3 IA-PC Boot Architecture
> > ACPI_FADT_LEGACY_DEVICES flag device, and shows how to add more.
> [...]
> > +struct x86_legacy_devices {
> > +	int pnpbios;
> > +};
> 
> It's not clear why pnpbios needs a new structure

I'm glad you asked. Dealing with placing pnpbios quirk in a more useful generic
fashion was perhaps the most difficult challenge in this series.  As I reviewed
possibilities to remove paravirt_enabled() the best prospect I found was to see
if Xen could instead use ACPI 5.2.9.3 IA-PC Boot Architecture flags to annotate
some quirks. It turns out that it is possible, but there are only so many flags,
and also, we didn't want to have a solution that incurred respective upstream
Xen hypervisor change, that would be silly.

To make this quirk more useful then this folds the pnpbios quirk as a sub
quirk under the more borad ACPI_FADT_LEGACY_DEVICES ACPI flag. What this
does, as can be seen by also looking at the next patch, "x86, ACPI: parse
ACPI_FADT_LEGACY_DEVICES" is it explicitly folds pnpbios as one of the
ACPI_FADT_LEGACY_DEVICES devices, but also paves the way for further known
main legacy components to added to the list.

> and why this structure of devices does not have the bit for the rtc device.

That's because ACPI has its own dedicated flag for it, so there already
is a one-to-one mapping available. All we needed to do to replace the
RTC hack was to provide a mechanism to unify both the paravirt RTC hack
with the ACPI RTC flag.

  Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 08/14] apm32: remove paravirt_enabled() use
       [not found]   ` <57065BD4.3040209@oracle.com>
@ 2016-04-07 22:31     ` Luis R. Rodriguez
  0 siblings, 0 replies; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-07 22:31 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Luis R. Rodriguez, bp, hpa, tglx, mingo, rusty, x86, linux-kernel,
	luto, david.vrabel, konrad.wilk, xen-devel, lguest,
	andriy.shevchenko, jlee, glin, matt, andrew.cooper3, rjw, lenb,
	robert.moore, lv.zheng, toshi.kani, linux-acpi, Takashi Iwai

On Thu, Apr 07, 2016 at 09:08:36AM -0400, Boris Ostrovsky wrote:
> On 04/06/2016 08:06 PM, Luis R. Rodriguez wrote:
> >There is already a check for apm_info.bios == 0, the
> >apm_info.bios is set from the boot_params.apm_bios_info.
> >Both Xen and lguest, which are also the only ones that set
> >paravirt_enabled to true, never set the apm_bios.info. The
> >
> >Xen folks are sure force disable to 0 is not needed,
> 
> Because apm_info lives in .bss (which we recently made sure is
> cleared on Xen PV). May be worth mentioning in the commit message so
> that we don't forget why this is not needed.

Thanks, I'll change that last paragraph with:

Xen folks are sure force disable to 0 is not needed because
apm_info lives in .bss, we recently forced disabled this on
lguest, and on the Xen side just to be sure Boris zeroed out
the .bss for PV guests through commit 04b6b4a56884327c1648
("xen/x86: Zero out .bss for PV guests"). With this care taken
into consideration the paravirt_enabled() check is simply not
needed anymore.

> I think you also have this statement in other patches.

Indeed, I'll highlight this on the tboot commit log as well.

  Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 01/14] x86/boot: enumerate documentation for the x86 hardware_subarch
       [not found]   ` <1460028338.6620.19.camel@linux.intel.com>
@ 2016-04-07 22:36     ` Luis R. Rodriguez
  0 siblings, 0 replies; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-07 22:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Luis R. Rodriguez, bp, hpa, tglx, mingo, rusty, x86, linux-kernel,
	luto, boris.ostrovsky, david.vrabel, konrad.wilk, xen-devel,
	lguest, jlee, glin, matt, andrew.cooper3, rjw, lenb, robert.moore,
	lv.zheng, toshi.kani, linux-acpi, Josh Triplett, kozerkov

On Thu, Apr 07, 2016 at 02:25:38PM +0300, Andy Shevchenko wrote:
> On Wed, 2016-04-06 at 17:06 -0700, Luis R. Rodriguez wrote:
> > Although hardware_subarch has been in place since the x86 boot
> > protocol 2.07 it hasn't been used much. Enumerate current possible
> > values to avoid misuses and help with semantics later at boot
> > time should this be used further.
> > 
> > These enums should only ever be used by architecture x86 code,
> > and all that code should be well contained and compartamentalized,
> > clarify that as well.
> 
> Nitpick:
> 
> > + * @X86_SUBARCH_PC: Should be used if the hardware is enumerable
> > using standard
> > + *	PC mechanisms (PCI, ACPI) and doesn't need a special boot
> > flow.
> > + * @X86_SUBARCH_LGUEST: Used for x86 hypervisor demo, lguest
> > + * @X86_SUBARCH_XEN: Used for Xen guest types which follow the PV
> > boot path,
> > + * 	which start at asm startup_xen() entry point and later
> > jump to the C
> > + * 	xen_start_kernel() entry point.
> > + * @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet
> > Device) platform
> > + *	systems which do not have the PCI legacy interfaces.
> > + * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100)
> > SOC for
> 
> I think 'SoC' (without quotes) will be better.

Amended, since I think I'll need a re-spin and since we may need to take
care of the dom0 Vs domU semantics I'll also make some changes to include
X86_SUBARCH_XEN documentation to annotate that PV guests can be of domU
or dom0 type...

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
       [not found]   ` <570658DA.7060509@oracle.com>
@ 2016-04-08  0:32     ` Luis R. Rodriguez
  2016-04-08  5:18       ` Juergen Gross
  0 siblings, 1 reply; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-08  0:32 UTC (permalink / raw)
  To: Boris Ostrovsky, Juergen Gross
  Cc: Luis R. Rodriguez, bp, hpa, tglx, mingo, rusty, x86, linux-kernel,
	luto, david.vrabel, konrad.wilk, xen-devel, lguest,
	andriy.shevchenko, jlee, glin, matt, andrew.cooper3, rjw, lenb,
	robert.moore, lv.zheng, toshi.kani, linux-acpi, kozerkov, josh,
	Joerg Roedel

On Thu, Apr 07, 2016 at 08:55:54AM -0400, Boris Ostrovsky wrote:
> On 04/06/2016 08:06 PM, Luis R. Rodriguez wrote:
> >We have 4 types of x86 platforms that disable RTC:
> >
> >   * Intel MID
> >   * Lguest - uses paravirt
> >   * Xen dom-U - uses paravirt
> >   * x86 on legacy systems annotated with an ACPI legacy flag
> >
> >We can consolidate all of these into a platform specific legacy
> >quirk set early in boot through i386_start_kernel() and through
> >x86_64_start_reservations(). This deals with the RTC quirks which
> >we can rely on through the hardware subarch, the ACPI check can
> >be dealt with separately.
> >
> >v2: split the subarch check from the ACPI check, clarify
> >     on the ACPI change commit log why ordering works
> >
> >Suggested-by: Ingo Molnar <mingo@kernel.org>
> >Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>

<-- snip -->

> >diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c
> >new file mode 100644
> >index 000000000000..1b114ac5996f
> >--- /dev/null
> >+++ b/arch/x86/kernel/platform-quirks.c
> >@@ -0,0 +1,18 @@
> >+#include <linux/kernel.h>
> >+#include <linux/init.h>
> >+
> >+#include <asm/setup.h>
> >+#include <asm/bios_ebda.h>
> >+
> >+void __init x86_early_init_platform_quirks(void)
> >+{
> >+	x86_platform.legacy.rtc = 1;
> >+
> >+	switch (boot_params.hdr.hardware_subarch) {
> >+	case X86_SUBARCH_XEN:
> >+	case X86_SUBARCH_LGUEST:
> >+	case X86_SUBARCH_INTEL_MID:
> >+		x86_platform.legacy.rtc = 0;
> >+		break;
> >+	}
> >+}
> 
> What about Xen dom0 (aka initial domain)?

Indeed, thanks for catching this, the hunk below removes the re-enablement of
the the RTC for dom0:

> >--- a/arch/x86/xen/enlighten.c
> >+++ b/arch/x86/xen/enlighten.c
> >@@ -1192,7 +1192,6 @@ static const struct pv_info xen_info __initconst = {
> >  #ifdef CONFIG_X86_64
> >  	.extra_user_64bit_cs = FLAT_USER_CS64,
> >  #endif
> >-	.features = 0,
> >  	.name = "Xen",
> >  };
> >@@ -1525,8 +1524,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
> >  	/* Install Xen paravirt ops */
> >  	pv_info = xen_info;
> >-	if (xen_initial_domain())
> >-		pv_info.features |= PV_SUPPORTED_RTC;
> >  	pv_init_ops = xen_init_ops;
> >  	if (!xen_pvh_domain()) {
> >  		pv_cpu_ops = xen_cpu_ops;

This should then break dom0 unless of course you have the respective next
patch applied and that disabled the RTC due to an ACPI setting on your
platform. Juergen, can you check to see if that was the case for your
testing platform on dom0 ?

This highlights a semantic gap issue. From a quick cursory review, I think
we can address this temporarily by just using a check:

void __init x86_early_init_platform_quirks(void)
{
	x86_platform.legacy.rtc = 1;

	switch (boot_params.hdr.hardware_subarch) {
	case X86_SUBARCH_XEN:
	case X86_SUBARCH_LGUEST:
	case X86_SUBARCH_INTEL_MID:
-		x86_platform.legacy.rtc = 0;
+		if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
+			x86_platform.legacy.rtc = 0;
		break;
	}
}

This would work given x86_early_init_platform_quirks() is called prior
to the any code that sets up x86_init.mpparse*, and the only code that
would have set this is the PV guest path, and the dom0 override. Is
would be replacing one hack with another though so I'm not exactly happy
with it as a compromise.

Another x86 standard thing dom0 populates on the PV path is
&boot_params.screen_info, done through xen_init_vga() -- but it
was not clear exactly what domU does with this ? Does domU never
have VGA set up? Given that the PV path is the only thing that would
ever set up the x86 zero page I take it domU leaves that empty,
and dom0 *always* seems to set up the screen_info->orig_video_isVGA,
so another mechanism might be something like:

void __init x86_early_init_platform_quirks(void)
{
+	struct screen_info *screen_info = &boot_params.screen_info;
+
	x86_platform.legacy.rtc = 1;

	switch (boot_params.hdr.hardware_subarch) {
	case X86_SUBARCH_XEN:
	case X86_SUBARCH_LGUEST:
	case X86_SUBARCH_INTEL_MID:
-		x86_platform.legacy.rtc = 0;
+		if (!screen_info->orig_video_isVGA)
+			x86_platform.legacy.rtc = 0;
		break;
	}
}

If the semantics of requiring VGA through the x86 boot params
suffice to annotate PV path dom0 then we have a win. Specially
if this might be useful to other virtualization environments
to do some of their own virtualization quirks in this path.

Additionally -- if domU never sets the screen info stuff, should
it or does it always set ACPI_FADT_NO_VGA as well ?

Is Xen the only guest type we have that has a notion of dom0 and need dom0 type
of quirks ? Also how would this work for HVMLite for domU and dom0 ? I think
the ARM folks are doing some things with EFI configuration tables to pass the
screen_info stuff, so perhaps that should be looked at.

  Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 00/14] x86: remove paravirt_enabled
       [not found] <1459987594-5434-1-git-send-email-mcgrof@kernel.org>
                   ` (4 preceding siblings ...)
       [not found] ` <1459987594-5434-5-git-send-email-mcgrof@kernel.org>
@ 2016-04-08  1:14 ` Luis R. Rodriguez
  2016-04-08 10:23   ` Borislav Petkov
  5 siblings, 1 reply; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-08  1:14 UTC (permalink / raw)
  To: bp
  Cc: hpa, tglx, mingo, rusty, x86, linux-kernel, luto, boris.ostrovsky,
	david.vrabel, konrad.wilk, xen-devel, lguest, andriy.shevchenko,
	jlee, glin, matt, andrew.cooper3, rjw, lenb, robert.moore,
	lv.zheng, toshi.kani, linux-acpi, kozerkov, josh

On Wed, Apr 06, 2016 at 05:06:20PM -0700, Luis R. Rodriguez wrote:
> Now that Andy's ASM paravirt_enabled() use is merged 

Sorry I should have provided more context, I meant that now
that Andy's ASM paravirt_enabled() removal is merged:

This is the ASM hack that Andy removed:
https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=x86/fsgsbase&id=58a5aac5331388a175a42b6ed2154f0559cefb21

This puts a nail on coffin for the ASM hack:
https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=x86/fsgsbase&id=0dd0036f6e07f741a1356b424b84a3164b6e59cf

  Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  0:32     ` [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk Luis R. Rodriguez
@ 2016-04-08  5:18       ` Juergen Gross
  2016-04-08  6:29         ` Luis R. Rodriguez
  0 siblings, 1 reply; 17+ messages in thread
From: Juergen Gross @ 2016-04-08  5:18 UTC (permalink / raw)
  To: Luis R. Rodriguez, Boris Ostrovsky
  Cc: bp, hpa, tglx, mingo, rusty, x86, linux-kernel, luto,
	david.vrabel, konrad.wilk, xen-devel, lguest, andriy.shevchenko,
	jlee, glin, matt, andrew.cooper3, rjw, lenb, robert.moore,
	lv.zheng, toshi.kani, linux-acpi, kozerkov, josh, Joerg Roedel

On 08/04/16 02:32, Luis R. Rodriguez wrote:
> On Thu, Apr 07, 2016 at 08:55:54AM -0400, Boris Ostrovsky wrote:
>> On 04/06/2016 08:06 PM, Luis R. Rodriguez wrote:
>>> We have 4 types of x86 platforms that disable RTC:
>>>
>>>   * Intel MID
>>>   * Lguest - uses paravirt
>>>   * Xen dom-U - uses paravirt
>>>   * x86 on legacy systems annotated with an ACPI legacy flag
>>>
>>> We can consolidate all of these into a platform specific legacy
>>> quirk set early in boot through i386_start_kernel() and through
>>> x86_64_start_reservations(). This deals with the RTC quirks which
>>> we can rely on through the hardware subarch, the ACPI check can
>>> be dealt with separately.
>>>
>>> v2: split the subarch check from the ACPI check, clarify
>>>     on the ACPI change commit log why ordering works
>>>
>>> Suggested-by: Ingo Molnar <mingo@kernel.org>
>>> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> 
> <-- snip -->
> 
>>> diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c
>>> new file mode 100644
>>> index 000000000000..1b114ac5996f
>>> --- /dev/null
>>> +++ b/arch/x86/kernel/platform-quirks.c
>>> @@ -0,0 +1,18 @@
>>> +#include <linux/kernel.h>
>>> +#include <linux/init.h>
>>> +
>>> +#include <asm/setup.h>
>>> +#include <asm/bios_ebda.h>
>>> +
>>> +void __init x86_early_init_platform_quirks(void)
>>> +{
>>> +	x86_platform.legacy.rtc = 1;
>>> +
>>> +	switch (boot_params.hdr.hardware_subarch) {
>>> +	case X86_SUBARCH_XEN:
>>> +	case X86_SUBARCH_LGUEST:
>>> +	case X86_SUBARCH_INTEL_MID:
>>> +		x86_platform.legacy.rtc = 0;
>>> +		break;
>>> +	}
>>> +}
>>
>> What about Xen dom0 (aka initial domain)?
> 
> Indeed, thanks for catching this, the hunk below removes the re-enablement of
> the the RTC for dom0:
> 
>>> --- a/arch/x86/xen/enlighten.c
>>> +++ b/arch/x86/xen/enlighten.c
>>> @@ -1192,7 +1192,6 @@ static const struct pv_info xen_info __initconst = {
>>>  #ifdef CONFIG_X86_64
>>>  	.extra_user_64bit_cs = FLAT_USER_CS64,
>>>  #endif
>>> -	.features = 0,
>>>  	.name = "Xen",
>>>  };
>>> @@ -1525,8 +1524,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
>>>  	/* Install Xen paravirt ops */
>>>  	pv_info = xen_info;
>>> -	if (xen_initial_domain())
>>> -		pv_info.features |= PV_SUPPORTED_RTC;
>>>  	pv_init_ops = xen_init_ops;
>>>  	if (!xen_pvh_domain()) {
>>>  		pv_cpu_ops = xen_cpu_ops;
> 
> This should then break dom0 unless of course you have the respective next
> patch applied and that disabled the RTC due to an ACPI setting on your
> platform. Juergen, can you check to see if that was the case for your
> testing platform on dom0 ?

Are you sure it would break? Wouldn't it just fall back to another
clock source, e.g. hpet?

I looked into my test system: seems as if add_rtc_cmos() is returning
before the .legacy.rtc test.

> This highlights a semantic gap issue. From a quick cursory review, I think
> we can address this temporarily by just using a check:
> 
> void __init x86_early_init_platform_quirks(void)
> {
> 	x86_platform.legacy.rtc = 1;
> 
> 	switch (boot_params.hdr.hardware_subarch) {
> 	case X86_SUBARCH_XEN:
> 	case X86_SUBARCH_LGUEST:
> 	case X86_SUBARCH_INTEL_MID:
> -		x86_platform.legacy.rtc = 0;
> +		if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
> +			x86_platform.legacy.rtc = 0;

No! Why don't you just use the explicit test xen_initial_domain() ?


Juergen


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  5:18       ` Juergen Gross
@ 2016-04-08  6:29         ` Luis R. Rodriguez
  2016-04-08  6:38           ` Juergen Gross
  2016-04-08 12:25           ` Boris Ostrovsky
  0 siblings, 2 replies; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-08  6:29 UTC (permalink / raw)
  To: Juergen Gross
  Cc: Boris Ostrovsky, Borislav Petkov, H. Peter Anvin, Thomas Gleixner,
	Ingo Molnar, Rusty Russell, X86 ML, linux-kernel@vger.kernel.org,
	Andy Lutomirski, David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani <toshi.k>

On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>> On Thu, Apr 07, 2016 at 08:55:54AM -0400, Boris Ostrovsky wrote:
>>> On 04/06/2016 08:06 PM, Luis R. Rodriguez wrote:
>>>> We have 4 types of x86 platforms that disable RTC:
>>>>
>>>>   * Intel MID
>>>>   * Lguest - uses paravirt
>>>>   * Xen dom-U - uses paravirt
>>>>   * x86 on legacy systems annotated with an ACPI legacy flag
>>>>
>>>> We can consolidate all of these into a platform specific legacy
>>>> quirk set early in boot through i386_start_kernel() and through
>>>> x86_64_start_reservations(). This deals with the RTC quirks which
>>>> we can rely on through the hardware subarch, the ACPI check can
>>>> be dealt with separately.
>>>>
>>>> v2: split the subarch check from the ACPI check, clarify
>>>>     on the ACPI change commit log why ordering works
>>>>
>>>> Suggested-by: Ingo Molnar <mingo@kernel.org>
>>>> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
>>
>> <-- snip -->
>>
>>>> diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c
>>>> new file mode 100644
>>>> index 000000000000..1b114ac5996f
>>>> --- /dev/null
>>>> +++ b/arch/x86/kernel/platform-quirks.c
>>>> @@ -0,0 +1,18 @@
>>>> +#include <linux/kernel.h>
>>>> +#include <linux/init.h>
>>>> +
>>>> +#include <asm/setup.h>
>>>> +#include <asm/bios_ebda.h>
>>>> +
>>>> +void __init x86_early_init_platform_quirks(void)
>>>> +{
>>>> +   x86_platform.legacy.rtc = 1;
>>>> +
>>>> +   switch (boot_params.hdr.hardware_subarch) {
>>>> +   case X86_SUBARCH_XEN:
>>>> +   case X86_SUBARCH_LGUEST:
>>>> +   case X86_SUBARCH_INTEL_MID:
>>>> +           x86_platform.legacy.rtc = 0;
>>>> +           break;
>>>> +   }
>>>> +}
>>>
>>> What about Xen dom0 (aka initial domain)?
>>
>> Indeed, thanks for catching this, the hunk below removes the re-enablement of
>> the the RTC for dom0:
>>
>>>> --- a/arch/x86/xen/enlighten.c
>>>> +++ b/arch/x86/xen/enlighten.c
>>>> @@ -1192,7 +1192,6 @@ static const struct pv_info xen_info __initconst = {
>>>>  #ifdef CONFIG_X86_64
>>>>     .extra_user_64bit_cs = FLAT_USER_CS64,
>>>>  #endif
>>>> -   .features = 0,
>>>>     .name = "Xen",
>>>>  };
>>>> @@ -1525,8 +1524,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
>>>>     /* Install Xen paravirt ops */
>>>>     pv_info = xen_info;
>>>> -   if (xen_initial_domain())
>>>> -           pv_info.features |= PV_SUPPORTED_RTC;
>>>>     pv_init_ops = xen_init_ops;
>>>>     if (!xen_pvh_domain()) {
>>>>             pv_cpu_ops = xen_cpu_ops;
>>
>> This should then break dom0 unless of course you have the respective next
>> patch applied and that disabled the RTC due to an ACPI setting on your
>> platform. Juergen, can you check to see if that was the case for your
>> testing platform on dom0 ?
>
> Are you sure it would break?

No, suspected that it should though.

> Wouldn't it just fall back to another
> clock source, e.g. hpet?

I suppose so.

> I looked into my test system: seems as if add_rtc_cmos() is returning
> before the .legacy.rtc test.

OK thanks...

>> This highlights a semantic gap issue. From a quick cursory review, I think
>> we can address this temporarily by just using a check:
>>
>> void __init x86_early_init_platform_quirks(void)
>> {
>>       x86_platform.legacy.rtc = 1;
>>
>>       switch (boot_params.hdr.hardware_subarch) {
>>       case X86_SUBARCH_XEN:
>>       case X86_SUBARCH_LGUEST:
>>       case X86_SUBARCH_INTEL_MID:
>> -             x86_platform.legacy.rtc = 0;
>> +             if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
>> +                     x86_platform.legacy.rtc = 0;
>
> No! Why don't you just use the explicit test xen_initial_domain() ?

Because we don't want to sprinkle Xen specific code outside of Xen
code. What do you think about the second possibility I listed?
Otherwise, any other ideas?

  Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  6:29         ` Luis R. Rodriguez
@ 2016-04-08  6:38           ` Juergen Gross
  2016-04-08  6:56             ` Luis R. Rodriguez
  2016-04-08 12:25           ` Boris Ostrovsky
  1 sibling, 1 reply; 17+ messages in thread
From: Juergen Gross @ 2016-04-08  6:38 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Boris Ostrovsky, Borislav Petkov, H. Peter Anvin, Thomas Gleixner,
	Ingo Molnar, Rusty Russell, X86 ML, linux-kernel@vger.kernel.org,
	Andy Lutomirski, David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani <toshi.k>

On 08/04/16 08:29, Luis R. Rodriguez wrote:
> On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
>> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>>> This highlights a semantic gap issue. From a quick cursory review, I think
>>> we can address this temporarily by just using a check:
>>>
>>> void __init x86_early_init_platform_quirks(void)
>>> {
>>>       x86_platform.legacy.rtc = 1;
>>>
>>>       switch (boot_params.hdr.hardware_subarch) {
>>>       case X86_SUBARCH_XEN:
>>>       case X86_SUBARCH_LGUEST:
>>>       case X86_SUBARCH_INTEL_MID:
>>> -             x86_platform.legacy.rtc = 0;
>>> +             if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
>>> +                     x86_platform.legacy.rtc = 0;
>>
>> No! Why don't you just use the explicit test xen_initial_domain() ?
> 
> Because we don't want to sprinkle Xen specific code outside of Xen
> code. What do you think about the second possibility I listed?
> Otherwise, any other ideas?

Don't try to guess.

In case you don't want to inject Xen internals here, just call a Xen
function to either return the correct value, or to set all structure
elements correctly.

Thinking more about it: why not do that for all the subarchs? You'd
have the specific settings where they belong: in a subarch specific
source. Just do the default settings in x86_early_init_platform_quirks()
and let the subarch functions set the non-default values.


Juergen


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  6:38           ` Juergen Gross
@ 2016-04-08  6:56             ` Luis R. Rodriguez
  2016-04-08  7:13               ` Juergen Gross
  0 siblings, 1 reply; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-08  6:56 UTC (permalink / raw)
  To: Juergen Gross
  Cc: Boris Ostrovsky, Borislav Petkov, H. Peter Anvin, Thomas Gleixner,
	Ingo Molnar, Rusty Russell, X86 ML, linux-kernel@vger.kernel.org,
	Andy Lutomirski, David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani <toshi.k>

On Thu, Apr 7, 2016 at 11:38 PM, Juergen Gross <jgross@suse.com> wrote:
> On 08/04/16 08:29, Luis R. Rodriguez wrote:
>> On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
>>> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>>>> This highlights a semantic gap issue. From a quick cursory review, I think
>>>> we can address this temporarily by just using a check:
>>>>
>>>> void __init x86_early_init_platform_quirks(void)
>>>> {
>>>>       x86_platform.legacy.rtc = 1;
>>>>
>>>>       switch (boot_params.hdr.hardware_subarch) {
>>>>       case X86_SUBARCH_XEN:
>>>>       case X86_SUBARCH_LGUEST:
>>>>       case X86_SUBARCH_INTEL_MID:
>>>> -             x86_platform.legacy.rtc = 0;
>>>> +             if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
>>>> +                     x86_platform.legacy.rtc = 0;
>>>
>>> No! Why don't you just use the explicit test xen_initial_domain() ?
>>
>> Because we don't want to sprinkle Xen specific code outside of Xen
>> code. What do you think about the second possibility I listed?
>> Otherwise, any other ideas?
>
> Don't try to guess.

I can only do that given there is nothing at all to tell me what to
expect here with regards to RTC on Xen guest, if there is some
documentation that could help with that please let me know.

> In case you don't want to inject Xen internals here, just call a Xen
> function to either return the correct value, or to set all structure
> elements correctly.

I like the later as an option, in case there are further hardware
subarch specific quirks which require internal logistics. What do
others think?

> Thinking more about it: why not do that for all the subarchs?

I originally had went with that approach, but Ingo made the point that
it would be best to instead move all quirk settings into one place.
That lets a reader easily tell what is going on in one place, it also
compartmentalizes the hardware subarch uses.

> You'd
> have the specific settings where they belong: in a subarch specific
> source. Just do the default settings in x86_early_init_platform_quirks()
> and let the subarch functions set the non-default values.

This is a rather different approach than what I had originally tried.
Bike shed thing -- someone just has to decide.

Left up to me, I kind of really like centralizing the quirk settings
in one place approach as it means a reader can easily tell what's
going on regardless of platform in one place for odd settings. I
prefer this given that we *already* have the semantics over hardware
subarch in a generalized fashion. We *do not* have semantics for dom0
Vs domU -- if such a notion is generic to other virtualization
environments it deserves consideration to new semantics to deal with
that, otherwise the callback for handling further quirks is best, but
I'd also highly discourage such callback to be used.

 Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  6:56             ` Luis R. Rodriguez
@ 2016-04-08  7:13               ` Juergen Gross
  2016-04-08  7:36                 ` Luis R. Rodriguez
  0 siblings, 1 reply; 17+ messages in thread
From: Juergen Gross @ 2016-04-08  7:13 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Boris Ostrovsky, Borislav Petkov, H. Peter Anvin, Thomas Gleixner,
	Ingo Molnar, Rusty Russell, X86 ML, linux-kernel@vger.kernel.org,
	Andy Lutomirski, David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani <toshi.k>

On 08/04/16 08:56, Luis R. Rodriguez wrote:
> On Thu, Apr 7, 2016 at 11:38 PM, Juergen Gross <jgross@suse.com> wrote:
>> On 08/04/16 08:29, Luis R. Rodriguez wrote:
>>> On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
>>>> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>>>>> This highlights a semantic gap issue. From a quick cursory review, I think
>>>>> we can address this temporarily by just using a check:
>>>>>
>>>>> void __init x86_early_init_platform_quirks(void)
>>>>> {
>>>>>       x86_platform.legacy.rtc = 1;
>>>>>
>>>>>       switch (boot_params.hdr.hardware_subarch) {
>>>>>       case X86_SUBARCH_XEN:
>>>>>       case X86_SUBARCH_LGUEST:
>>>>>       case X86_SUBARCH_INTEL_MID:
>>>>> -             x86_platform.legacy.rtc = 0;
>>>>> +             if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
>>>>> +                     x86_platform.legacy.rtc = 0;
>>>>
>>>> No! Why don't you just use the explicit test xen_initial_domain() ?
>>>
>>> Because we don't want to sprinkle Xen specific code outside of Xen
>>> code. What do you think about the second possibility I listed?
>>> Otherwise, any other ideas?
>>
>> Don't try to guess.
> 
> I can only do that given there is nothing at all to tell me what to
> expect here with regards to RTC on Xen guest, if there is some
> documentation that could help with that please let me know.

Only Xen inernals. :-)

> 
>> In case you don't want to inject Xen internals here, just call a Xen
>> function to either return the correct value, or to set all structure
>> elements correctly.
> 
> I like the later as an option, in case there are further hardware
> subarch specific quirks which require internal logistics. What do
> others think?
> 
>> Thinking more about it: why not do that for all the subarchs?
> 
> I originally had went with that approach, but Ingo made the point that
> it would be best to instead move all quirk settings into one place.
> That lets a reader easily tell what is going on in one place, it also
> compartmentalizes the hardware subarch uses.

Okay. Another idea (not sure whether this is really a good one):

Add X86_SUBARCH_XEN_DOM0. As hardware_subarch is 32 bits wide I don't
think the number of subarchs is a scarce resource. :-)

I'd expect other quirks in future might have different settings for
domU and dom0, too.

>> You'd
>> have the specific settings where they belong: in a subarch specific
>> source. Just do the default settings in x86_early_init_platform_quirks()
>> and let the subarch functions set the non-default values.
> 
> This is a rather different approach than what I had originally tried.
> Bike shed thing -- someone just has to decide.
> 
> Left up to me, I kind of really like centralizing the quirk settings
> in one place approach as it means a reader can easily tell what's
> going on regardless of platform in one place for odd settings. I
> prefer this given that we *already* have the semantics over hardware
> subarch in a generalized fashion. We *do not* have semantics for dom0
> Vs domU -- if such a notion is generic to other virtualization

That's not carved in stone - see above. :-)

> environments it deserves consideration to new semantics to deal with
> that, otherwise the callback for handling further quirks is best, but
> I'd also highly discourage such callback to be used.


Juergen


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  7:13               ` Juergen Gross
@ 2016-04-08  7:36                 ` Luis R. Rodriguez
  2016-04-08  7:59                   ` Juergen Gross
  0 siblings, 1 reply; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-08  7:36 UTC (permalink / raw)
  To: Juergen Gross, H. Peter Anvin
  Cc: Boris Ostrovsky, Borislav Petkov, Thomas Gleixner, Ingo Molnar,
	Rusty Russell, X86 ML, linux-kernel@vger.kernel.org,
	Andy Lutomirski, David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani, ACPI

On Fri, Apr 8, 2016 at 12:13 AM, Juergen Gross <jgross@suse.com> wrote:
> On 08/04/16 08:56, Luis R. Rodriguez wrote:
>> On Thu, Apr 7, 2016 at 11:38 PM, Juergen Gross <jgross@suse.com> wrote:
>>> On 08/04/16 08:29, Luis R. Rodriguez wrote:
>>>> On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
>>>>> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>>>>>> This highlights a semantic gap issue. From a quick cursory review, I think
>>>>>> we can address this temporarily by just using a check:
>>>>>>
>>>>>> void __init x86_early_init_platform_quirks(void)
>>>>>> {
>>>>>>       x86_platform.legacy.rtc = 1;
>>>>>>
>>>>>>       switch (boot_params.hdr.hardware_subarch) {
>>>>>>       case X86_SUBARCH_XEN:
>>>>>>       case X86_SUBARCH_LGUEST:
>>>>>>       case X86_SUBARCH_INTEL_MID:
>>>>>> -             x86_platform.legacy.rtc = 0;
>>>>>> +             if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
>>>>>> +                     x86_platform.legacy.rtc = 0;
>>>>>
>>>>> No! Why don't you just use the explicit test xen_initial_domain() ?
>>>>
>>>> Because we don't want to sprinkle Xen specific code outside of Xen
>>>> code. What do you think about the second possibility I listed?
>>>> Otherwise, any other ideas?
>>>
>>> Don't try to guess.
>>
>> I can only do that given there is nothing at all to tell me what to
>> expect here with regards to RTC on Xen guest, if there is some
>> documentation that could help with that please let me know.
>
> Only Xen inernals. :-)

Where can I look at this specifically on the Xen sources? No worries
if you don't care -- as I don't really either.

>>> In case you don't want to inject Xen internals here, just call a Xen
>>> function to either return the correct value, or to set all structure
>>> elements correctly.
>>
>> I like the later as an option, in case there are further hardware
>> subarch specific quirks which require internal logistics. What do
>> others think?
>>
>>> Thinking more about it: why not do that for all the subarchs?
>>
>> I originally had went with that approach, but Ingo made the point that
>> it would be best to instead move all quirk settings into one place.
>> That lets a reader easily tell what is going on in one place, it also
>> compartmentalizes the hardware subarch uses.
>
> Okay. Another idea (not sure whether this is really a good one):
>
> Add X86_SUBARCH_XEN_DOM0. As hardware_subarch is 32 bits wide I don't
> think the number of subarchs is a scarce resource. :-)

This would mean bumping the x86 boot protocol, we shouldn't take that
lightly, but given that in this case the new subarch would really only
be set by the kernel (or future loaders for perhaps HVMLite) I'd think
this is not such an intrusive alternative.

> I'd expect other quirks in future might have different settings for
> domU and dom0, too.

Can you elaborate a bit more on this. I realize we expect domU and
dom0 on HVMLite in the future, would HVMLite use the subarch ? From
the last discussions on the HVMLite thread Boris noted HVMLite would
use the PC subarch -- how would we do dom0 Vs domU quirk management?

If it goes the EFI route, I gather Xen instead can use the EFI
configuration tables for Xen specific tunings, however we may also
need a generic x86 configuration table for generic quirks I think. We
may need to provide a 1-1 mapping of these quirks there, if the
subarch is not used.

>>> You'd
>>> have the specific settings where they belong: in a subarch specific
>>> source. Just do the default settings in x86_early_init_platform_quirks()
>>> and let the subarch functions set the non-default values.
>>
>> This is a rather different approach than what I had originally tried.
>> Bike shed thing -- someone just has to decide.
>>
>> Left up to me, I kind of really like centralizing the quirk settings
>> in one place approach as it means a reader can easily tell what's
>> going on regardless of platform in one place for odd settings. I
>> prefer this given that we *already* have the semantics over hardware
>> subarch in a generalized fashion. We *do not* have semantics for dom0
>> Vs domU -- if such a notion is generic to other virtualization
>
> That's not carved in stone - see above. :-)

Another subarch for Xen dom0 works well for me as well given the new
subarch would just all set in the kernel. It does mean extending the
x86 boot protocol though, and so for that I yield to hpa.

 Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  7:36                 ` Luis R. Rodriguez
@ 2016-04-08  7:59                   ` Juergen Gross
  2016-04-08 12:37                     ` Boris Ostrovsky
  0 siblings, 1 reply; 17+ messages in thread
From: Juergen Gross @ 2016-04-08  7:59 UTC (permalink / raw)
  To: Luis R. Rodriguez, H. Peter Anvin
  Cc: Boris Ostrovsky, Borislav Petkov, Thomas Gleixner, Ingo Molnar,
	Rusty Russell, X86 ML, linux-kernel@vger.kernel.org,
	Andy Lutomirski, David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani, ACPI

On 08/04/16 09:36, Luis R. Rodriguez wrote:
> On Fri, Apr 8, 2016 at 12:13 AM, Juergen Gross <jgross@suse.com> wrote:
>> On 08/04/16 08:56, Luis R. Rodriguez wrote:
>>> On Thu, Apr 7, 2016 at 11:38 PM, Juergen Gross <jgross@suse.com> wrote:
>>>> On 08/04/16 08:29, Luis R. Rodriguez wrote:
>>>>> On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
>>>>>> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>>>>>>> This highlights a semantic gap issue. From a quick cursory review, I think
>>>>>>> we can address this temporarily by just using a check:
>>>>>>>
>>>>>>> void __init x86_early_init_platform_quirks(void)
>>>>>>> {
>>>>>>>       x86_platform.legacy.rtc = 1;
>>>>>>>
>>>>>>>       switch (boot_params.hdr.hardware_subarch) {
>>>>>>>       case X86_SUBARCH_XEN:
>>>>>>>       case X86_SUBARCH_LGUEST:
>>>>>>>       case X86_SUBARCH_INTEL_MID:
>>>>>>> -             x86_platform.legacy.rtc = 0;
>>>>>>> +             if (x86_init.mpparse.get_smp_config != x86_init_uint_noop)
>>>>>>> +                     x86_platform.legacy.rtc = 0;
>>>>>>
>>>>>> No! Why don't you just use the explicit test xen_initial_domain() ?
>>>>>
>>>>> Because we don't want to sprinkle Xen specific code outside of Xen
>>>>> code. What do you think about the second possibility I listed?
>>>>> Otherwise, any other ideas?
>>>>
>>>> Don't try to guess.
>>>
>>> I can only do that given there is nothing at all to tell me what to
>>> expect here with regards to RTC on Xen guest, if there is some
>>> documentation that could help with that please let me know.
>>
>> Only Xen inernals. :-)
> 
> Where can I look at this specifically on the Xen sources? No worries
> if you don't care -- as I don't really either.

Just look how xen_initial_domain() is defined. :-)

>>>> In case you don't want to inject Xen internals here, just call a Xen
>>>> function to either return the correct value, or to set all structure
>>>> elements correctly.
>>>
>>> I like the later as an option, in case there are further hardware
>>> subarch specific quirks which require internal logistics. What do
>>> others think?
>>>
>>>> Thinking more about it: why not do that for all the subarchs?
>>>
>>> I originally had went with that approach, but Ingo made the point that
>>> it would be best to instead move all quirk settings into one place.
>>> That lets a reader easily tell what is going on in one place, it also
>>> compartmentalizes the hardware subarch uses.
>>
>> Okay. Another idea (not sure whether this is really a good one):
>>
>> Add X86_SUBARCH_XEN_DOM0. As hardware_subarch is 32 bits wide I don't
>> think the number of subarchs is a scarce resource. :-)
> 
> This would mean bumping the x86 boot protocol, we shouldn't take that
> lightly, but given that in this case the new subarch would really only
> be set by the kernel (or future loaders for perhaps HVMLite) I'd think
> this is not such an intrusive alternative.

I think adding an own subarch for dom0 isn't that bad. It really is
different from domU as dom0 has per default access to the real hardware
(or at least to most of it).

>> I'd expect other quirks in future might have different settings for
>> domU and dom0, too.
> 
> Can you elaborate a bit more on this.

I guess we might want to add other quirks in order to switch on/off
more features instead of doing this based on #ifdef or environment
tests. I'm thinking of current use, not of HVMlite specific stuff.

> I realize we expect domU and
> dom0 on HVMLite in the future, would HVMLite use the subarch ? From
> the last discussions on the HVMLite thread Boris noted HVMLite would
> use the PC subarch -- how would we do dom0 Vs domU quirk management?

This would have to be settled. I think it might be a good idea to
initialize the quirks to their defaults statically in x86_init.c
and just modify some as needed for HVMlite on early boot (e.g. in
the HVMlite or EFI stub). This will enable us to either make use of
subarch or not for HVMlite, just what fits best.

> If it goes the EFI route, I gather Xen instead can use the EFI
> configuration tables for Xen specific tunings, however we may also
> need a generic x86 configuration table for generic quirks I think. We
> may need to provide a 1-1 mapping of these quirks there, if the
> subarch is not used.

The EFI stub can set the quirks just according to it's needs. Going
this route would _require_ HVMlite is using the PC subarch, though,
in order to avoid overwriting the quirks in
x86_early_init_platform_quirks() later.

> 
>>>> You'd
>>>> have the specific settings where they belong: in a subarch specific
>>>> source. Just do the default settings in x86_early_init_platform_quirks()
>>>> and let the subarch functions set the non-default values.
>>>
>>> This is a rather different approach than what I had originally tried.
>>> Bike shed thing -- someone just has to decide.
>>>
>>> Left up to me, I kind of really like centralizing the quirk settings
>>> in one place approach as it means a reader can easily tell what's
>>> going on regardless of platform in one place for odd settings. I
>>> prefer this given that we *already* have the semantics over hardware
>>> subarch in a generalized fashion. We *do not* have semantics for dom0
>>> Vs domU -- if such a notion is generic to other virtualization
>>
>> That's not carved in stone - see above. :-)
> 
> Another subarch for Xen dom0 works well for me as well given the new
> subarch would just all set in the kernel. It does mean extending the
> x86 boot protocol though, and so for that I yield to hpa.

Fair enough.


Juergen


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 00/14] x86: remove paravirt_enabled
  2016-04-08  1:14 ` [PATCH v4 00/14] x86: remove paravirt_enabled Luis R. Rodriguez
@ 2016-04-08 10:23   ` Borislav Petkov
  0 siblings, 0 replies; 17+ messages in thread
From: Borislav Petkov @ 2016-04-08 10:23 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: hpa, tglx, mingo, rusty, x86, linux-kernel, luto, boris.ostrovsky,
	david.vrabel, konrad.wilk, xen-devel, lguest, andriy.shevchenko,
	jlee, glin, matt, andrew.cooper3, rjw, lenb, robert.moore,
	lv.zheng, toshi.kani, linux-acpi, kozerkov, josh

On Fri, Apr 08, 2016 at 03:14:43AM +0200, Luis R. Rodriguez wrote:
> On Wed, Apr 06, 2016 at 05:06:20PM -0700, Luis R. Rodriguez wrote:
> > Now that Andy's ASM paravirt_enabled() use is merged 
> 
> Sorry I should have provided more context, I meant that now
> that Andy's ASM paravirt_enabled() removal is merged:
> 
> This is the ASM hack that Andy removed:
> https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=x86/fsgsbase&id=58a5aac5331388a175a42b6ed2154f0559cefb21
> 
> This puts a nail on coffin for the ASM hack:
> https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=x86/fsgsbase&id=0dd0036f6e07f741a1356b424b84a3164b6e59cf

Ah right, that.

Thanks!

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  6:29         ` Luis R. Rodriguez
  2016-04-08  6:38           ` Juergen Gross
@ 2016-04-08 12:25           ` Boris Ostrovsky
  1 sibling, 0 replies; 17+ messages in thread
From: Boris Ostrovsky @ 2016-04-08 12:25 UTC (permalink / raw)
  To: Luis R. Rodriguez, Juergen Gross
  Cc: kozerkov, Matt Fleming, Lv Zheng, H. Peter Anvin, lguest,
	Joerg Roedel, X86 ML, Moore, Robert, ACPI Devel Maling List,
	Ingo Molnar, Gary Lin, Len Brown, Rusty Russell, Josh Triplett,
	Joey Lee, xen-devel@lists.xensource.com, Borislav Petkov,
	Thomas Gleixner, Andy Shevchenko, Toshi Kani, Andrew Cooper,
	Rafael J. Wysocki, linux-kernel@vger.kernel.org

On 04/08/2016 02:29 AM, Luis R. Rodriguez wrote:
> On Thu, Apr 7, 2016 at 10:18 PM, Juergen Gross <jgross@suse.com> wrote:
>> On 08/04/16 02:32, Luis R. Rodriguez wrote:
>>> On Thu, Apr 07, 2016 at 08:55:54AM -0400, Boris Ostrovsky wrote:
>>>> On 04/06/2016 08:06 PM, Luis R. Rodriguez wrote:
>>>>> We have 4 types of x86 platforms that disable RTC:
>>>>>
>>>>>    * Intel MID
>>>>>    * Lguest - uses paravirt
>>>>>    * Xen dom-U - uses paravirt
>>>>>    * x86 on legacy systems annotated with an ACPI legacy flag
>>>>>
>>>>> We can consolidate all of these into a platform specific legacy
>>>>> quirk set early in boot through i386_start_kernel() and through
>>>>> x86_64_start_reservations(). This deals with the RTC quirks which
>>>>> we can rely on through the hardware subarch, the ACPI check can
>>>>> be dealt with separately.
>>>>>
>>>>> v2: split the subarch check from the ACPI check, clarify
>>>>>      on the ACPI change commit log why ordering works
>>>>>
>>>>> Suggested-by: Ingo Molnar <mingo@kernel.org>
>>>>> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
>>> <-- snip -->
>>>
>>>>> diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c
>>>>> new file mode 100644
>>>>> index 000000000000..1b114ac5996f
>>>>> --- /dev/null
>>>>> +++ b/arch/x86/kernel/platform-quirks.c
>>>>> @@ -0,0 +1,18 @@
>>>>> +#include <linux/kernel.h>
>>>>> +#include <linux/init.h>
>>>>> +
>>>>> +#include <asm/setup.h>
>>>>> +#include <asm/bios_ebda.h>
>>>>> +
>>>>> +void __init x86_early_init_platform_quirks(void)
>>>>> +{
>>>>> +   x86_platform.legacy.rtc = 1;
>>>>> +
>>>>> +   switch (boot_params.hdr.hardware_subarch) {
>>>>> +   case X86_SUBARCH_XEN:
>>>>> +   case X86_SUBARCH_LGUEST:
>>>>> +   case X86_SUBARCH_INTEL_MID:
>>>>> +           x86_platform.legacy.rtc = 0;
>>>>> +           break;
>>>>> +   }
>>>>> +}
>>>> What about Xen dom0 (aka initial domain)?
>>> Indeed, thanks for catching this, the hunk below removes the re-enablement of
>>> the the RTC for dom0:
>>>
>>>>> --- a/arch/x86/xen/enlighten.c
>>>>> +++ b/arch/x86/xen/enlighten.c
>>>>> @@ -1192,7 +1192,6 @@ static const struct pv_info xen_info __initconst = {
>>>>>   #ifdef CONFIG_X86_64
>>>>>      .extra_user_64bit_cs = FLAT_USER_CS64,
>>>>>   #endif
>>>>> -   .features = 0,
>>>>>      .name = "Xen",
>>>>>   };
>>>>> @@ -1525,8 +1524,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
>>>>>      /* Install Xen paravirt ops */
>>>>>      pv_info = xen_info;
>>>>> -   if (xen_initial_domain())
>>>>> -           pv_info.features |= PV_SUPPORTED_RTC;
>>>>>      pv_init_ops = xen_init_ops;
>>>>>      if (!xen_pvh_domain()) {
>>>>>              pv_cpu_ops = xen_cpu_ops;
>>> This should then break dom0 unless of course you have the respective next
>>> patch applied and that disabled the RTC due to an ACPI setting on your
>>> platform. Juergen, can you check to see if that was the case for your
>>> testing platform on dom0 ?
>> Are you sure it would break?
> No, suspected that it should though.
>
>> Wouldn't it just fall back to another
>> clock source, e.g. hpet?
> I suppose so.
>
>> I looked into my test system: seems as if add_rtc_cmos() is returning
>> before the .legacy.rtc test.
> OK thanks...

It works because the clock must have been discovered by ACPI prior to 
add_rtc_cmos() call. It's PNP0b00 object, I believe. The rest of the 
routine is to handle the case when RTC is not found in ACPI tables for 
whatever reasons (I think).

That's why we added paravirt_has(RTC) --- dom0 should be able to handle 
such cases, just like bare metal.

-boris

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08  7:59                   ` Juergen Gross
@ 2016-04-08 12:37                     ` Boris Ostrovsky
  2016-04-08 18:45                       ` Luis R. Rodriguez
  0 siblings, 1 reply; 17+ messages in thread
From: Boris Ostrovsky @ 2016-04-08 12:37 UTC (permalink / raw)
  To: Juergen Gross, Luis R. Rodriguez, H. Peter Anvin
  Cc: Borislav Petkov, Thomas Gleixner, Ingo Molnar, Rusty Russell,
	X86 ML, linux-kernel@vger.kernel.org, Andy Lutomirski,
	David Vrabel, Konrad Rzeszutek Wilk,
	xen-devel@lists.xensource.com, lguest, Andy Shevchenko, Joey Lee,
	Gary Lin, Matt Fleming, Andrew Cooper, Rafael J. Wysocki,
	Len Brown, Moore, Robert, Lv Zheng, Toshi Kani,
	ACPI Devel Maling List, kozerkov

On 04/08/2016 03:59 AM, Juergen Gross wrote:
> On 08/04/16 09:36, Luis R. Rodriguez wrote:
>> On Fri, Apr 8, 2016 at 12:13 AM, Juergen Gross <jgross@suse.com> wrote:
>>> On 08/04/16 08:56, Luis R. Rodriguez wrote:
>>>> On Thu, Apr 7, 2016 at 11:38 PM, Juergen Gross <jgross@suse.com> wrote:
>>>>
>>>> Okay. Another idea (not sure whether this is really a good one):
>>>>
>>>> Add X86_SUBARCH_XEN_DOM0. As hardware_subarch is 32 bits wide I don't
>>>> think the number of subarchs is a scarce resource. :-)
>> This would mean bumping the x86 boot protocol, we shouldn't take that
>> lightly, but given that in this case the new subarch would really only
>> be set by the kernel (or future loaders for perhaps HVMLite) I'd think
>> this is not such an intrusive alternative.
> I think adding an own subarch for dom0 isn't that bad. It really is
> different from domU as dom0 has per default access to the real hardware
> (or at least to most of it).

Can we do this (overwrite quirks) in x86_init_ops.arch_setup? I'd really 
like to avoid adding a what essentially is a sub-subarch.

-boris

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk
  2016-04-08 12:37                     ` Boris Ostrovsky
@ 2016-04-08 18:45                       ` Luis R. Rodriguez
  0 siblings, 0 replies; 17+ messages in thread
From: Luis R. Rodriguez @ 2016-04-08 18:45 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Juergen Gross, Luis R. Rodriguez, H. Peter Anvin, Borislav Petkov,
	Thomas Gleixner, Ingo Molnar, Rusty Russell, X86 ML,
	linux-kernel@vger.kernel.org, Andy Lutomirski, David Vrabel,
	Konrad Rzeszutek Wilk, xen-devel@lists.xensource.com, lguest,
	Andy Shevchenko, Joey Lee, Gary Lin, Matt Fleming, Andrew Cooper,
	Rafael J. Wysocki, Len Brown, Moore, Robert, Lv Zheng

On Fri, Apr 08, 2016 at 08:37:44AM -0400, Boris Ostrovsky wrote:
> On 04/08/2016 03:59 AM, Juergen Gross wrote:
> >On 08/04/16 09:36, Luis R. Rodriguez wrote:
> >>On Fri, Apr 8, 2016 at 12:13 AM, Juergen Gross <jgross@suse.com> wrote:
> >>>On 08/04/16 08:56, Luis R. Rodriguez wrote:
> >>>>On Thu, Apr 7, 2016 at 11:38 PM, Juergen Gross <jgross@suse.com> wrote:
> >>>>
> >>>>Okay. Another idea (not sure whether this is really a good one):
> >>>>
> >>>>Add X86_SUBARCH_XEN_DOM0. As hardware_subarch is 32 bits wide I don't
> >>>>think the number of subarchs is a scarce resource. :-)
> >>This would mean bumping the x86 boot protocol, we shouldn't take that
> >>lightly, but given that in this case the new subarch would really only
> >>be set by the kernel (or future loaders for perhaps HVMLite) I'd think
> >>this is not such an intrusive alternative.
> >I think adding an own subarch for dom0 isn't that bad. It really is
> >different from domU as dom0 has per default access to the real hardware
> >(or at least to most of it).
> 
> Can we do this (overwrite quirks) in x86_init_ops.arch_setup? I'd
> really like to avoid adding a what essentially is a sub-subarch.

I'm going with this. Will respin.

  Luis

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-04-08 18:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1459987594-5434-1-git-send-email-mcgrof@kernel.org>
2016-04-07 21:31 ` [PATCH v4 13/14] x86/init: rename ebda code file Luis R. Rodriguez
     [not found] ` <1459987594-5434-12-git-send-email-mcgrof@kernel.org>
     [not found]   ` <57062C63.2010609@citrix.com>
2016-04-07 21:42     ` [Xen-devel] [PATCH v4 11/14] pnpbios: replace paravirt_enabled() check with legacy device check Luis R. Rodriguez
     [not found] ` <1459987594-5434-9-git-send-email-mcgrof@kernel.org>
     [not found]   ` <57065BD4.3040209@oracle.com>
2016-04-07 22:31     ` [PATCH v4 08/14] apm32: remove paravirt_enabled() use Luis R. Rodriguez
     [not found] ` <1459987594-5434-2-git-send-email-mcgrof@kernel.org>
     [not found]   ` <1460028338.6620.19.camel@linux.intel.com>
2016-04-07 22:36     ` [PATCH v4 01/14] x86/boot: enumerate documentation for the x86 hardware_subarch Luis R. Rodriguez
     [not found] ` <1459987594-5434-5-git-send-email-mcgrof@kernel.org>
     [not found]   ` <570658DA.7060509@oracle.com>
2016-04-08  0:32     ` [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk Luis R. Rodriguez
2016-04-08  5:18       ` Juergen Gross
2016-04-08  6:29         ` Luis R. Rodriguez
2016-04-08  6:38           ` Juergen Gross
2016-04-08  6:56             ` Luis R. Rodriguez
2016-04-08  7:13               ` Juergen Gross
2016-04-08  7:36                 ` Luis R. Rodriguez
2016-04-08  7:59                   ` Juergen Gross
2016-04-08 12:37                     ` Boris Ostrovsky
2016-04-08 18:45                       ` Luis R. Rodriguez
2016-04-08 12:25           ` Boris Ostrovsky
2016-04-08  1:14 ` [PATCH v4 00/14] x86: remove paravirt_enabled Luis R. Rodriguez
2016-04-08 10:23   ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox