diff mbox

Can't boot as Xen dom0 due to commit fe055896

Message ID 20161215171755.xpfuax7a6q3jofet@pd.tnic (mailing list archive)
State New, archived
Headers show

Commit Message

Borislav Petkov Dec. 15, 2016, 5:17 p.m. UTC
On Thu, Dec 15, 2016 at 12:00:22PM -0500, Boris Ostrovsky wrote:
> There is an error on AMD as well. We end up being called at
> load_microcode_amd() with size=0 and crash soon after.

Does that fix it?


> (As a side note, I think verify_and_add_patch() should return error
> codes and not crnt_size, which may be a positive number. Which it was in
> my case.)

It does return negative values when there's some failure. It returns
crnt_size which can be a positive number so that we can advance to the
next patch in the blob.

Comments

Boris Ostrovsky Dec. 15, 2016, 5:27 p.m. UTC | #1
On 12/15/2016 12:17 PM, Borislav Petkov wrote:
> On Thu, Dec 15, 2016 at 12:00:22PM -0500, Boris Ostrovsky wrote:
>> There is an error on AMD as well. We end up being called at
>> load_microcode_amd() with size=0 and crash soon after.
> Does that fix it?
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index dd47e60aabf5..e238119b5dff 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1202,6 +1202,7 @@ config X86_REBOOTFIXUPS
>  config MICROCODE
>  	bool "CPU microcode loading support"
>  	default y
> +	depends on !XEN
>  	depends on CPU_SUP_AMD || CPU_SUP_INTEL
>  	select FW_LOADER
>  	---help---


It will probably fix it but I don't think we want this: it's a
build-time solution. Most kernels have XEN on even though they are
booted bare-metal.

>
>> (As a side note, I think verify_and_add_patch() should return error
>> codes and not crnt_size, which may be a positive number. Which it was in
>> my case.)
> It does return negative values when there's some failure. 

I meant, for example:

        proc_fam = find_cpu_family_by_equiv_cpu(proc_id);
        if (!proc_fam) {
                pr_err("No patch family for equiv ID: 0x%04x\n", proc_id);
                return crnt_size;
        }

-boris

> It returns
> crnt_size which can be a positive number so that we can advance to the
> next patch in the blob.
>
Borislav Petkov Dec. 15, 2016, 5:36 p.m. UTC | #2
On Thu, Dec 15, 2016 at 12:27:49PM -0500, Boris Ostrovsky wrote:
> It will probably fix it but I don't think we want this: it's a
> build-time solution. Most kernels have XEN on even though they are
> booted bare-metal.

Lemme tell you want I want: a way to detect I'm running on xen. Does
CPUID(4) work really early, at load_ucode_bsp() time?

IOW, can I use some of the functionality hypervisor_cpuid_base() uses to
detect xen and stop loading any further?

> I meant, for example:
> 
>         proc_fam = find_cpu_family_by_equiv_cpu(proc_id);
>         if (!proc_fam) {
>                 pr_err("No patch family for equiv ID: 0x%04x\n", proc_id);
>                 return crnt_size;
>         }
> 
> -boris
> 
> > It returns
> > crnt_size which can be a positive number so that we can advance to the
> > next patch in the blob.
^^^^^^^^^^^^^^^

Read what I wrote here.
diff mbox

Patch

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dd47e60aabf5..e238119b5dff 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1202,6 +1202,7 @@  config X86_REBOOTFIXUPS
 config MICROCODE
 	bool "CPU microcode loading support"
 	default y
+	depends on !XEN
 	depends on CPU_SUP_AMD || CPU_SUP_INTEL
 	select FW_LOADER
 	---help---