All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Adam Dunlap <acdunlap@google.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v1 1/1] x86/cpu: Fix boot on Intel Quark X1000
Date: Thu, 16 May 2024 11:21:13 -0700	[thread overview]
Message-ID: <8286f8b9-488c-418f-8bad-d23871a8afab@intel.com> (raw)
In-Reply-To: <20240516173928.3960193-1-andriy.shevchenko@linux.intel.com>

On 5/16/24 10:39, Andy Shevchenko wrote:
> The initial change to set x86_virt_bits to the correct value straight
> away broke boot on Intel Quark X1000 CPUs (which are family 5, model 9,
> stepping 0)

Do you know what _actually_ broke?  Like was there a crash somewhere?

> With deeper investigation it appears that the Quark doesn't have
> the bit 19 set in 0x01 CPUID leaf, which means it doesn't provide
> any clflush instructions and hence the cache alignment is set to 0.
> The actual cache line size is 16 bytes, hence we may set the alignment
> accordingly. At the same time the physical and virtual address bits
> are retrieved via 0x80000008 CPUID leaf.

This seems to be saying that ->x86_clflush_size must come from CPUID.
But there _are_ CPUID-independent defaults set in identify_cpu().  How
do those fit in?

> Note, we don't really care about the value of x86_clflush_size as it
> is either used with a proper check for the instruction to be present,
> or, like in PCI case, it assumes 32 bytes for all supported 32-bit CPUs
> that have actually smaller cache line sizes and don't advertise it.

Are you trying to say that having ->x86_clflush_size==0 is not fatal
while having ->x86_cache_alignment==0 _is_ fatal?

> The commit fbf6449f84bf ("x86/sev-es: Set x86_virt_bits to the correct
> value straight away, instead of a two-phase approach") basically
> revealed the issue that has been present from day 1 of introducing
> the Quark support.

How did it do that, exactly?  It's still not crystal clear.

> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> index be30d7fa2e66..2bffae158dd5 100644
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -321,6 +321,15 @@ static void early_init_intel(struct cpuinfo_x86 *c)
>  #ifdef CONFIG_X86_64
>  	set_cpu_cap(c, X86_FEATURE_SYSENTER32);
>  #else
> +	/*
> +	 * The Quark doesn't have bit 19 set in 0x01 CPUID leaf, which means
> +	 * it doesn't provide any clflush instructions and hence the cache
> +	 * alignment is set to 0. The actual cache line size is 16 bytes,
> +	 * hence set the alignment accordingly. At the same time the physical
> +	 * and virtual address bits are retrieved via 0x80000008 CPUID leaf.
> +	 */
> +	if (c->x86 == 5 && c->x86_model == 9)
> +		c->x86_cache_alignment = 16;

What are the odds that another CPU has this issue?  I'm thinking we
should just set a default in addition to hacking around this for Quark.

  reply	other threads:[~2024-05-16 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 17:39 [PATCH v1 1/1] x86/cpu: Fix boot on Intel Quark X1000 Andy Shevchenko
2024-05-16 18:21 ` Dave Hansen [this message]
2024-05-17 13:48   ` Andy Shevchenko

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=8286f8b9-488c-418f-8bad-d23871a8afab@intel.com \
    --to=dave.hansen@intel.com \
    --cc=acdunlap@google.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=stable@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.