All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 064/108] x86: Add support for newer CAR schemes
Date: Tue, 19 Nov 2019 16:02:39 +0800	[thread overview]
Message-ID: <CAEUhbmUbp=qzd5KLKMdA8Yo8TZJ7TBStGaGHsR6k8xQvEBcEJg@mail.gmail.com> (raw)
In-Reply-To: <20191021033913.220758-64-sjg@chromium.org>

Hi Simon,

On Mon, Oct 21, 2019 at 11:40 AM Simon Glass <sjg@chromium.org> wrote:
>
> Newer Intel SoCs have different ways of setting up cache-as-ram (CAR).
> Add support for these along with suitable configuration options.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3:
> - Drop unneeded Kconfig file
>
> Changes in v2: None
>
>  arch/x86/Kconfig                        |  16 +
>  arch/x86/cpu/intel_common/Makefile      |   8 +
>  arch/x86/cpu/intel_common/car2.S        | 490 ++++++++++++++++++++++++
>  arch/x86/cpu/intel_common/car2_uninit.S |  87 +++++
>  4 files changed, 601 insertions(+)
>  create mode 100644 arch/x86/cpu/intel_common/car2.S
>  create mode 100644 arch/x86/cpu/intel_common/car2_uninit.S
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 54f51e002b8..69327bd746a 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -889,4 +889,20 @@ config HIGH_TABLE_SIZE
>           Increse it if the default size does not fit the board's needs.
>           This is most likely due to a large ACPI DSDT table is used.
>
> +config INTEL_CAR_CQOS
> +       bool "Support Intel Cache Quality of Service"
> +       help
> +         Cache Quality of Service allows more fine-grained control of cache
> +         usage. As result, it is possible to set up a portion of L2 cache for
> +         CAR and use the remainder for actual caching.
> +
> +#
> +# Each bit in QOS mask controls this many bytes. This is calculated as:
> +# (CACHE_WAYS / CACHE_BITS_PER_MASK) * CACHE_LINE_SIZE * CACHE_SETS
> +#
> +config CACHE_QOS_SIZE_PER_BIT
> +       hex
> +       depends on INTEL_CAR_CQOS
> +       default 0x20000 # 128 KB
> +
>  endmenu
> diff --git a/arch/x86/cpu/intel_common/Makefile b/arch/x86/cpu/intel_common/Makefile
> index dfbc29f0475..4c733f46067 100644
> --- a/arch/x86/cpu/intel_common/Makefile
> +++ b/arch/x86/cpu/intel_common/Makefile
> @@ -8,6 +8,14 @@ obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += me_status.o
>  obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += report_platform.o
>  obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += mrc.o
>  endif
> +
> +ifdef CONFIG_FSP_VERSION2

The new CAR should not be dependent on FSP_VERSION2. It's OK that we
implement a native U-Boot port without FSP2. Besides, when FSP2 FSP-T
is used, the car2 is not needed too.

> +obj-$(CONFIG_TPL_BUILD) += car2.o
> +ifndef CONFIG_SPL_BUILD
> +obj-y += car2_uninit.o
> +endif
> +endif
> +
>  obj-y += cpu.o
>  obj-y += fast_spi.o
>  obj-y += lpc.o
> diff --git a/arch/x86/cpu/intel_common/car2.S b/arch/x86/cpu/intel_common/car2.S
> new file mode 100644
> index 00000000000..bf01b0da849
> --- /dev/null
> +++ b/arch/x86/cpu/intel_common/car2.S
> @@ -0,0 +1,490 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * This file is part of the coreboot project.
> + *
> + * Copyright (C) 2015-2016 Intel Corp.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.

The above license text is not needed, given SPDX format is already used.

> + *
> + */
> +
> +#include <config.h>
> +#include <asm/msr-index.h>
> +#include <asm/mtrr.h>
> +#include <asm/post.h>
> +#include <asm/processor-flags.h>
> +
> +#define KiB 1024
> +
> +.global car_init
> +car_init:
> +       post_code(0x20)

Looks 0x20 is occupied by POST_CAR_SIPI. Can we use a macro, and a
different value?

Please fix this globally in this file.

> +
> +       /*
> +        * Use the MTRR default type MSR as a proxy for detecting INIT#.
> +        * Reset the system if any known bits are set in that MSR. That is
> +        * an indication of the CPU not being properly reset.
> +        */
> +check_for_clean_reset:
> +       mov     $MTRR_DEF_TYPE_MSR, %ecx
> +       rdmsr
> +       and     $(MTRR_DEF_TYPE_EN | MTRR_DEF_TYPE_FIX_EN), %eax
> +       cmp     $0, %eax
> +       jz      no_reset
> +       /* perform warm reset */
> +       movw    $0xcf9, %dx

Use IO_PORT_RESET

> +       movb    $0x06, %al

Use (SYS_RST | RST_CPU)

> +       outb    %al, %dx
> +
> +no_reset:
> +       post_code(0x21)
> +
> +       /* Clear/disable fixed MTRRs */
> +       mov     $fixed_mtrr_list_size, %ebx
> +       xor     %eax, %eax
> +       xor     %edx, %edx
> +
> +clear_fixed_mtrr:
> +       add     $-2, %ebx
> +       movzwl  fixed_mtrr_list(%ebx), %ecx
> +       wrmsr
> +       jnz     clear_fixed_mtrr
> +
> +       post_code(0x22)

Ditto

> +
> +       /* Figure put how many MTRRs we have, and clear them out */
> +       mov     $MTRR_CAP_MSR, %ecx
> +       rdmsr
> +       movzb   %al, %ebx               /* Number of variable MTRRs */
> +       mov     $MTRR_PHYS_BASE_MSR(0), %ecx
> +       xor     %eax, %eax
> +       xor     %edx, %edx
> +
> +clear_var_mtrr:
> +       wrmsr
> +       inc     %ecx
> +       wrmsr
> +       inc     %ecx
> +       dec     %ebx
> +       jnz     clear_var_mtrr
> +
> +       post_code(0x23)
> +
> +       /* Configure default memory type to uncacheable (UC) */
> +       mov     $MTRR_DEF_TYPE_MSR, %ecx
> +       rdmsr
> +       /* Clear enable bits and set default type to UC */
> +       and     $~(MTRR_DEF_TYPE_MASK | MTRR_DEF_TYPE_EN | \
> +                MTRR_DEF_TYPE_FIX_EN), %eax
> +       wrmsr
> +
> +       /* Configure MTRR_PHYS_MASK_HIGH for proper addressing above 4GB

nits: wrong multi-line comment format

> +        * based on the physical address size supported for this processor
> +        * This is based on read from CPUID EAX = 080000008h, EAX bits [7:0]
> +        *
> +        * Examples:
> +        *  MTRR_PHYS_MASK_HIGH = 00000000Fh  For 36 bit addressing
> +        *  MTRR_PHYS_MASK_HIGH = 0000000FFh  For 40 bit addressing
> +        */
> +
> +       movl    $0x80000008, %eax       /* Address sizes leaf */
> +       cpuid
> +       sub     $32, %al
> +       movzx   %al, %eax
> +       xorl    %esi, %esi
> +       bts     %eax, %esi
> +       dec     %esi                    /* esi <- MTRR_PHYS_MASK_HIGH */
> +
> +       post_code(0x24)
> +
> +#if ((CONFIG_DCACHE_RAM_SIZE & (CONFIG_DCACHE_RAM_SIZE - 1)) == 0)
> +       /* Configure CAR region as write-back (WB) */
> +       mov     $MTRR_PHYS_BASE_MSR(0), %ecx
> +       mov     $CONFIG_DCACHE_RAM_BASE, %eax
> +       or      $MTRR_TYPE_WRBACK, %eax
> +       xor     %edx,%edx
> +       wrmsr
> +
> +       /* Configure the MTRR mask for the size region */
> +       mov     $MTRR_PHYS_MASK(0), %ecx
> +       mov     $CONFIG_DCACHE_RAM_SIZE, %eax   /* size mask */
> +       dec     %eax
> +       not     %eax
> +       or      $MTRR_PHYS_MASK_VALID, %eax
> +       movl    %esi, %edx      /* edx <- MTRR_PHYS_MASK_HIGH */
> +       wrmsr
> +#elif (CONFIG_DCACHE_RAM_SIZE == 768 * KiB) /* 768 KiB */
> +       /* Configure CAR region as write-back (WB) */
> +       mov     $MTRR_PHYS_BASE_MSR(0), %ecx
> +       mov     $CONFIG_DCACHE_RAM_BASE, %eax
> +       or      $MTRR_TYPE_WRBACK, %eax
> +       xor     %edx,%edx
> +       wrmsr
> +
> +       mov     $MTRR_PHYS_MASK_MSR(0), %ecx
> +       mov     $(512 * KiB), %eax      /* size mask */
> +       dec     %eax
> +       not     %eax
> +       or      $MTRR_PHYS_MASK_VALID, %eax
> +       movl    %esi, %edx      /* edx <- MTRR_PHYS_MASK_HIGH */
> +       wrmsr
> +
> +       mov     $MTRR_PHYS_BASE_MSR(1), %ecx
> +       mov     $(CONFIG_DCACHE_RAM_BASE + 512 * KiB), %eax
> +       or      $MTRR_TYPE_WRBACK, %eax
> +       xor     %edx,%edx
> +       wrmsr
> +
> +       mov     $MTRR_PHYS_MASK_MSR(1), %ecx
> +       mov     $(256 * KiB), %eax      /* size mask */
> +       dec     %eax
> +       not     %eax
> +       or      $MTRR_PHYS_MASK_VALID, %eax
> +       movl    %esi, %edx      /* edx <- MTRR_PHYS_MASK_HIGH */
> +       wrmsr
> +#else
> +#error "DCACHE_RAM_SIZE is not a power of 2 and setup code is missing"
> +#endif
> +       post_code(0x25)
> +
> +       /* start */
> +/*     mov     $0xffff80a8, %ebx */
> +/*     jmp     *%ebx */
> +.globl _from_bb
> +_from_bb:
> +/*     jmp     car_init_ret */
> +       /* end */
> +
> +       /* Enable variable MTRRs */
> +       mov     $MTRR_DEF_TYPE_MSR, %ecx
> +       rdmsr
> +       or      $MTRR_DEF_TYPE_EN, %eax
> +       wrmsr
> +
> +       /* Enable caching */
> +       mov     %cr0, %eax
> +       and     $~(X86_CR0_CD | X86_CR0_NW), %eax
> +       invd
> +       mov     %eax, %cr0
> +
> +#if IS_ENABLED(CONFIG_INTEL_CAR_NEM)
> +       jmp car_nem

nits: indentation of "car_nem" not correct

> +#elif IS_ENABLED(CONFIG_INTEL_CAR_CQOS)
> +       jmp car_cqos

ditto

> +#elif IS_ENABLED(CONFIG_INTEL_CAR_NEM_ENHANCED)
> +       jmp car_nem_enhanced

ditto

> +#else
> +#error "No CAR mechanism selected:
> +#endif
> +       jmp     car_init_ret
> +
> +#if 0

Dead codes? If yes, please remove the whole block in #if 0

> +.global car_init_done
> +car_init_done:
> +
> +       post_code(0x29)
> +
> +       /* Setup bootblock stack */
> +       mov     $_car_stack_end, %esp
> +
> +       /* Need to align stack to 16 bytes at call instruction. Account for

nits: wrong multi-line comment format

> +          the two pushes below */
> +       andl    $0xfffffff0, %esp
> +       sub     $8, %esp
> +
> +       /*push TSC value to stack*/
> +       movd    %mm2, %eax
> +       pushl   %eax    /* tsc[63:32] */
> +       movd    %mm1, %eax
> +       pushl   %eax    /* tsc[31:0] */
> +
> +before_carstage:
> +       post_code(0x2A)
> +
> +       call    bootblock_c_entry
> +       /* Never reached */
> +#endif
> +
> +fixed_mtrr_list:
> +       .word   MTRR_FIX_64K_00000_MSR
> +       .word   MTRR_FIX_16K_80000_MSR
> +       .word   MTRR_FIX_16K_A0000_MSR
> +       .word   MTRR_FIX_4K_C0000_MSR
> +       .word   MTRR_FIX_4K_C8000_MSR
> +       .word   MTRR_FIX_4K_D0000_MSR
> +       .word   MTRR_FIX_4K_D8000_MSR
> +       .word   MTRR_FIX_4K_E0000_MSR
> +       .word   MTRR_FIX_4K_E8000_MSR
> +       .word   MTRR_FIX_4K_F0000_MSR
> +       .word   MTRR_FIX_4K_F8000_MSR
> +fixed_mtrr_list_size = . - fixed_mtrr_list
> +
> +#if IS_ENABLED(CONFIG_INTEL_CAR_NEM)
> +.global car_nem
> +car_nem:
> +       /* Disable cache eviction (setup stage) */
> +       mov     $MSR_EVICT_CTL, %ecx
> +       rdmsr
> +       or      $0x1, %eax
> +       wrmsr
> +
> +       post_code(0x26)
> +
> +       /* Clear the cache memory region. This will also fill up the cache */
> +       movl    $CONFIG_DCACHE_RAM_BASE, %edi
> +       movl    $CONFIG_DCACHE_RAM_SIZE, %ecx
> +       shr     $0x02, %ecx
> +       xor     %eax, %eax
> +       cld
> +       rep     stosl
> +
> +       post_code(0x27)
> +
> +       /* Disable cache eviction (run stage) */
> +       mov     $MSR_EVICT_CTL, %ecx
> +       rdmsr
> +       or      $0x2, %eax
> +       wrmsr
> +
> +       post_code(0x28)
> +
> +       jmp car_init_done
> +
> +#elif IS_ENABLED(CONFIG_INTEL_CAR_CQOS)
> +.global car_cqos
> +car_cqos:
> +       /*
> +        * Create CBM_LEN_MASK based on CBM_LEN
> +        * Get CPUID.(EAX=10H, ECX=2H):EAX.CBM_LEN[bits 4:0]
> +        */
> +       mov $0x10, %eax
> +       mov $0x2,  %ecx
> +       cpuid
> +       and $0x1F, %eax
> +       add $1, %al
> +
> +       mov $1, %ebx
> +       mov %al, %cl
> +       shl %cl, %ebx
> +       sub $1, %ebx
> +
> +       /* Store the CBM_LEN_MASK in mm3 for later use */
> +       movd %ebx, %mm3

The indentation style inside above block is not consistent with others

> +
> +       /*
> +        * Disable both L1 and L2 prefetcher. For yet-to-understood reason,
> +        * prefetchers slow down filling cache with rep stos in CQOS mode.
> +        */
> +       mov     $MSR_PREFETCH_CTL, %ecx
> +       rdmsr
> +       or      $(PREFETCH_L1_DISABLE | PREFETCH_L2_DISABLE), %eax
> +       wrmsr
> +
> +#if (CONFIG_DCACHE_RAM_SIZE == CONFIG_L2_CACHE_SIZE)
> +/*
> + * If CAR size is set to full L2 size, mask is calculated as all-zeros.
> + * This is not supported by the CPU/uCode.
> + */
> +#error "CQOS CAR may not use whole L2 cache area"
> +#endif
> +
> +       /* Calculate how many bits to be used for CAR */
> +       xor     %edx, %edx
> +       mov     $CONFIG_DCACHE_RAM_SIZE, %eax   /* dividend */
> +       mov     $CONFIG_CACHE_QOS_SIZE_PER_BIT, %ecx    /* divisor */
> +       div     %ecx            /* result is in eax */
> +       mov     %eax, %ecx      /* save to ecx */
> +       mov     $1, %ebx
> +       shl     %cl, %ebx
> +       sub     $1, %ebx        /* resulting mask is is in ebx */
> +
> +       /* Set this mask for initial cache fill */
> +       mov     $MSR_L2_QOS_MASK(0), %ecx
> +       rdmsr
> +       mov     %ebx, %eax
> +       wrmsr
> +
> +       /* Set CLOS selector to 0 */
> +       mov     $MSR_IA32_PQR_ASSOC, %ecx
> +       rdmsr
> +       and     $~MSR_IA32_PQR_ASSOC_MASK, %edx /* select mask 0 */
> +       wrmsr
> +
> +       /* We will need to block CAR region from evicts */
> +       mov     $MSR_L2_QOS_MASK(1), %ecx
> +       rdmsr
> +       /* Invert bits that are to be used for cache */
> +       mov     %ebx, %eax
> +       xor     $~0, %eax                       /* invert 32 bits */
> +
> +       /*
> +        * Use CBM_LEN_MASK stored in mm3 to set bits based on Capacity Bit
> +        * Mask Length.
> +        */
> +       movd    %mm3, %ebx
> +       and     %ebx, %eax
> +       wrmsr
> +
> +       post_code(0x26)
> +
> +       /* Clear the cache memory region. This will also fill up the cache */
> +       movl    $CONFIG_DCACHE_RAM_BASE, %edi
> +       movl    $CONFIG_DCACHE_RAM_SIZE, %ecx
> +       shr     $0x02, %ecx
> +       xor     %eax, %eax
> +       cld
> +       rep     stosl
> +
> +       post_code(0x27)
> +
> +       /* Cache is populated. Use mask 1 that will block evicts */
> +       mov     $MSR_IA32_PQR_ASSOC, %ecx
> +       rdmsr
> +       and     $~MSR_IA32_PQR_ASSOC_MASK, %edx /* clear index bits first */
> +       or      $1, %edx                        /* select mask 1 */
> +       wrmsr
> +
> +       /* Enable prefetchers */
> +       mov     $MSR_PREFETCH_CTL, %ecx
> +       rdmsr
> +       and     $~(PREFETCH_L1_DISABLE | PREFETCH_L2_DISABLE), %eax
> +       wrmsr
> +
> +       post_code(0x28)
> +
> +/*     jmp car_init_done */

Is this really not used and commented out?

> +       jmp     car_init_ret
> +
> +#elif IS_ENABLED(CONFIG_INTEL_CAR_NEM_ENHANCED)
> +.global car_nem_enhanced
> +car_nem_enhanced:
> +       /* Disable cache eviction (setup stage) */
> +       mov     $MSR_EVICT_CTL, %ecx
> +       rdmsr
> +       or      $0x1, %eax
> +       wrmsr
> +       post_code(0x26)
> +
> +       /* Create n-way set associativity of cache */
> +       xorl    %edi, %edi
> +find_llc_subleaf:
> +       movl    %edi, %ecx
> +       movl    $0x04, %eax
> +       cpuid
> +       inc     %edi
> +       and     $0xe0, %al      /* EAX[7:5] = Cache Level */
> +       cmp     $0x60, %al      /* Check to see if it is LLC */
> +       jnz     find_llc_subleaf
> +
> +       /*
> +        * Set MSR 0xC91 IA32_L3_MASK_! = 0xE/0xFE/0xFFE/0xFFFE
> +        * for 4/8/16 way of LLC
> +       */
> +       shr     $22, %ebx
> +       inc     %ebx
> +       /* Calculate n-way associativity of LLC */
> +       mov     %bl, %cl
> +
> +       /*
> +        * Maximizing RO cacheability while locking in the CAR to a
> +        * single way since that particular way won't be victim candidate
> +        * for evictions.
> +        * This has been done after programing LLC_WAY_MASK_1 MSR
> +        * with desired LLC way as mentioned below.
> +        *
> +        * Hence create Code and Data Size as per request
> +        * Code Size (RO) : Up to 16M
> +        * Data Size (RW) : Up to 256K
> +        */
> +       movl    $0x01, %eax
> +       /*
> +        * LLC Ways -> LLC_WAY_MASK_1:
> +        *  4: 0x000E
> +        *  8: 0x00FE
> +        * 12: 0x0FFE
> +        * 16: 0xFFFE
> +        *
> +        * These MSRs contain one bit per each way of LLC
> +        * - If this bit is '0' - the way is protected from eviction
> +        * - If this bit is '1' - the way is not protected from eviction
> +        */
> +       shl     %cl, %eax
> +       subl    $0x02, %eax
> +       movl    $MSR_IA32_L3_MASK_1, %ecx
> +       xorl    %edx, %edx
> +       wrmsr
> +       /*
> +        * Set MSR 0xC92 IA32_L3_MASK_2 = 0x1
> +        *
> +        * For SKL SOC, data size remains 256K consistently.
> +        * Hence, creating 1-way associative cache for Data
> +       */
> +       mov     $MSR_IA32_L3_MASK_2, %ecx
> +       mov     $0x01, %eax
> +       xorl    %edx, %edx
> +       wrmsr
> +       /*
> +        * Set MSR_IA32_PQR_ASSOC = 0x02
> +        *
> +        * Possible values:
> +        * 0: Default value, no way mask should be applied
> +        * 1: Apply way mask 1 to LLC
> +        * 2: Apply way mask 2 to LLC
> +        * 3: Shouldn't be use in NEM Mode
> +        */
> +       movl    $MSR_IA32_PQR_ASSOC, %ecx
> +       movl    $0x02, %eax
> +       xorl    %edx, %edx
> +       wrmsr
> +
> +       movl    $CONFIG_DCACHE_RAM_BASE, %edi
> +       movl    $CONFIG_DCACHE_RAM_SIZE, %ecx
> +       shr     $0x02, %ecx
> +       xor     %eax, %eax
> +       cld
> +       rep     stosl
> +       /*
> +        * Set MSR_IA32_PQR_ASSOC = 0x01
> +        * At this stage we apply LLC_WAY_MASK_1 to the cache.
> +        * i.e. way 0 is protected from eviction.
> +       */
> +       movl    $MSR_IA32_PQR_ASSOC, %ecx
> +       movl    $0x01, %eax
> +       xorl    %edx, %edx
> +       wrmsr
> +
> +       post_code(0x27)
> +       /*
> +        * Enable No-Eviction Mode Run State by setting
> +        * NO_EVICT_MODE MSR 2E0h bit [1] = '1'.
> +        */
> +
> +       movl    $MSR_EVICT_CTL, %ecx
> +       rdmsr
> +       orl     $0x02, %eax
> +       wrmsr
> +
> +       post_code(0x28)
> +
> +       jmp car_init_done

nits: incorrect indentation of car_init_done

> +#endif
> +
> +#if CONFIG_IS_ENABLED(X86_16BIT_INIT)
> +_dt_ucode_base_size:
> +       /* These next two fields are filled in by binman */
> +.globl ucode_base
> +ucode_base:    /* Declared in microcode.h */
> +       .long   0                       /* microcode base */
> +.globl ucode_size
> +ucode_size:    /* Declared in microcode.h */
> +       .long   0                       /* microcode size */
> +       .long   CONFIG_SYS_MONITOR_BASE /* code region base */
> +       .long   CONFIG_SYS_MONITOR_LEN  /* code region size */
> +#endif
> diff --git a/arch/x86/cpu/intel_common/car2_uninit.S b/arch/x86/cpu/intel_common/car2_uninit.S
> new file mode 100644
> index 00000000000..aba3a5381e5
> --- /dev/null
> +++ b/arch/x86/cpu/intel_common/car2_uninit.S
> @@ -0,0 +1,87 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright 2017 Intel Corp.
> + * Copyright 2019 Google LLC
> + * Taken from coreboot file exit_car.S
> + */
> +
> +#include <config.h>
> +#include <asm/msr-index.h>
> +#include <asm/mtrr.h>
> +
> +.text
> +.global car_uninit
> +car_uninit:
> +
> +       /*
> +        * Retrieve return address from stack as it will get trashed below if
> +        * execution is utilizing the cache-as-ram stack.
> +        */
> +       pop     %ebx
> +
> +       /* Disable MTRRs */
> +       mov     $(MTRR_DEF_TYPE_MSR), %ecx
> +       rdmsr
> +       and     $(~(MTRR_DEF_TYPE_EN | MTRR_DEF_TYPE_FIX_EN)), %eax
> +       wrmsr
> +
> +#ifdef CONFIG_INTEL_CAR_NEM
> +.global car_nem_teardown
> +car_nem_teardown:
> +
> +       /* invalidate cache contents */
> +       invd
> +
> +       /* Knock down bit 1 then bit 0 of NEM control not combining steps */
> +       mov     $(MSR_EVICT_CTL), %ecx
> +       rdmsr
> +       and     $(~(1 << 1)), %eax
> +       wrmsr
> +       and     $(~(1 << 0)), %eax
> +       wrmsr
> +
> +#elif IS_ENABLED(CONFIG_INTEL_CAR_CQOS)
> +.global car_cqos_teardown
> +car_cqos_teardown:
> +
> +       /* Go back to all-evicting mode, set both masks to all-1s */
> +       mov     $MSR_L2_QOS_MASK(0), %ecx
> +       rdmsr
> +       mov     $~0, %al
> +       wrmsr
> +
> +       mov     $MSR_L2_QOS_MASK(1), %ecx
> +       rdmsr
> +       mov     $~0, %al
> +       wrmsr
> +
> +       /* Reset CLOS selector to 0 */
> +       mov     $MSR_IA32_PQR_ASSOC, %ecx
> +       rdmsr
> +       and     $~MSR_IA32_PQR_ASSOC_MASK, %edx
> +       wrmsr
> +
> +#elif IS_ENABLED(CONFIG_INTEL_CAR_NEM_ENHANCED)
> +.global car_nem_enhanced_teardown
> +car_nem_enhanced_teardown:
> +
> +       /* invalidate cache contents */
> +       invd
> +
> +       /* Knock down bit 1 then bit 0 of NEM control not combining steps */
> +       mov     $(MSR_EVICT_CTL), %ecx
> +       rdmsr
> +       and     $(~(1 << 1)), %eax
> +       wrmsr
> +       and     $(~(1 << 0)), %eax
> +       wrmsr
> +
> +       /* Reset CLOS selector to 0 */
> +       mov     $IA32_PQR_ASSOC, %ecx
> +       rdmsr
> +       and     $~IA32_PQR_ASSOC_MASK, %edx
> +       wrmsr
> +#endif
> +
> +       /* Return to caller */
> +       jmp     *%ebx
> --

Regards,
Bin

  parent reply	other threads:[~2019-11-19  8:02 UTC|newest]

Thread overview: 201+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  3:37 [U-Boot] [PATCH v3 022/108] x86: timer: Use a separate flag for whether timer is inited Simon Glass
2019-10-21  3:37 ` [U-Boot] [PATCH v3 023/108] x86: timer: Allow a timer base of 0 Simon Glass
2019-10-28 13:02   ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 024/108] x86: spl: Support init of a PUNIT Simon Glass
2019-10-28  7:12   ` Bin Meng
2019-11-02  9:49     ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 025/108] x86: tpl: Add a fake PCI bus Simon Glass
2019-10-21  7:52   ` Andy Shevchenko
2019-10-21 22:53     ` Simon Glass
2019-10-22  8:19       ` Andy Shevchenko
2019-10-22 13:50         ` Simon Glass
2019-10-28  7:12   ` Bin Meng
2019-11-02  9:49     ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 026/108] x86: timer: Reduce timer code size in TPL on Intel CPUs Simon Glass
2019-10-28  7:26   ` Bin Meng
2019-11-02 18:25     ` Simon Glass
2019-10-21  3:37 ` [U-Boot] [PATCH v3 027/108] x86: Drop unnecessary cpu code for TPL Simon Glass
2019-10-28 12:56   ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 028/108] x86: Drop unnecessary interrupt " Simon Glass
2019-10-28  7:49   ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 029/108] x86: Add a CPU init function " Simon Glass
2019-10-28  7:50   ` Bin Meng
2019-11-02  9:58     ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 030/108] x86: Move CPU init to before spl_init() Simon Glass
2019-10-28  7:52   ` Bin Meng
2019-11-02  9:58     ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 031/108] x86: Don't print CPU info in TPL Simon Glass
2019-11-02  5:52   ` Bin Meng
2019-11-02  9:58     ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 032/108] x86: Quieten TPL's jump_to_image_no_args() Simon Glass
2019-11-02  5:52   ` Bin Meng
2019-11-02  9:58     ` Bin Meng
2019-10-21  3:37 ` [U-Boot] [PATCH v3 033/108] x86: power: Add an ACPI PMC uclass Simon Glass
2019-11-02  5:52   ` Bin Meng
2019-11-04  8:02   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-10-21  3:37 ` [U-Boot] [PATCH v3 034/108] x86: sandbox: Add a PMC emulator and test Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 035/108] x86: power: Add a 'pmc' command Simon Glass
2019-10-21  7:48   ` Andy Shevchenko
2019-10-21 22:53     ` Simon Glass
2019-10-22  8:21       ` Andy Shevchenko
2019-10-22 13:50         ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 036/108] pci: Add support for p2sb uclass Simon Glass
2019-11-04  8:23   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 037/108] sandbox: Add PCI driver and test for p2sb Simon Glass
2019-11-04  8:36   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 038/108] x86: Move UCLASS_IRQ into a separate file Simon Glass
2019-11-04  8:41   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 039/108] sandbox: Add a test for IRQ Simon Glass
2019-11-04  8:45   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 040/108] x86: Define the SPL image start Simon Glass
2019-11-04  8:46   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 041/108] x86: Reduce mrccache record alignment size Simon Glass
2019-11-04  8:50   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 042/108] x86: Correct mrccache find_next_mrc_cache() calculation Simon Glass
2019-11-04 15:01   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 043/108] x86: Adjust mrccache_get_region() to use livetree Simon Glass
2019-11-04 15:06   ` Bin Meng
2019-11-12  0:51     ` Simon Glass
2019-11-13 15:16       ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 044/108] x86: Adjust mrccache_get_region() to support get_mmap() Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 045/108] x86: Add a new global_data member for the cache record Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 046/108] x86: Tidy up error handling in mrccache_save() Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 047/108] x86: Update mrccache to support multiple caches Simon Glass
2019-11-04 15:22   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 048/108] x86: Add mrccache support for a 'variable' cache Simon Glass
2019-11-04 15:23   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 049/108] x86: Move fsp_prepare_mrc_cache() to fsp1 directory Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 050/108] x86: Set the DRAM banks to reflect real location Simon Glass
2019-11-04 15:24   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 051/108] x86: Set up the MTRR for SDRAM Simon Glass
2019-11-19  2:23   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 052/108] x86: Don't imply libfdt or SPI flash in TPL Simon Glass
2019-11-19  2:23   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 053/108] x86: Allow removal of standard PCH drivers Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 054/108] x86: Allow interrupt to happen once Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 055/108] x86: fsp: Make graphics support common to FSP1/2 Simon Glass
2019-11-19  2:23   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 056/108] x86: fsp: Correct wrong header inlude in fsp_support.c Simon Glass
2019-11-19  7:25   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 057/108] x86: fsp: Add FSP2 base support Simon Glass
2019-11-19  7:25   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 058/108] x86: fsp: Set up an MTRR for the graphics frame buffer Simon Glass
2019-11-19  7:25   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 059/108] x86: fsp: Add a new arch_fsp_init_r() hook Simon Glass
2019-11-19  7:25   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 060/108] x86: fsp: Allow remembering the location of FSP-S Simon Glass
2019-11-19  7:25   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 061/108] x86: fsp: Make the notify API call common Simon Glass
2019-11-19  8:02   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 062/108] x86: Don't include the BIOS emulator in TPL Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 063/108] x86: Add an option to include a FIT Simon Glass
2019-11-19  8:02   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 064/108] x86: Add support for newer CAR schemes Simon Glass
2019-10-21  8:11   ` Andy Shevchenko
2019-11-19  8:02   ` Bin Meng [this message]
2019-10-21  3:38 ` [U-Boot] [PATCH v3 065/108] x86: Disable microcode section for FSP2 Simon Glass
2019-11-19  8:02   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 066/108] x86: Update the fsp command " Simon Glass
2019-11-19  8:34   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 067/108] x86: Update .dtsi file " Simon Glass
2019-11-19  8:34   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 068/108] x86: Add an option to control the position of U-Boot Simon Glass
2019-11-19  8:34   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 069/108] x86: Add an option to control the position of SPL Simon Glass
2019-11-19  8:34   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 070/108] x86: Add an fdtmap and image-header Simon Glass
2019-11-19  8:34   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 071/108] x86: Don't repeat microcode in U-Boot if not needed Simon Glass
2019-11-19 13:33   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 072/108] x86: Separate out U-Boot and device tree in ROM image Simon Glass
2019-11-19 13:33   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 073/108] x86: Make MSR_PKG_POWER_SKU common Simon Glass
2019-11-19 13:33   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 074/108] spi: Correct operations check in dm_spi_xfer() Simon Glass
2019-11-19 13:33   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 075/108] x86: spi: Don't enable SPI_FLASH_BAR by default Simon Glass
2019-11-19 13:33   ` Bin Meng
2019-11-20  5:22     ` Vignesh Raghavendra
2019-11-21 13:50       ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 076/108] spi: ich: Move init function just above probe() Simon Glass
2019-11-19 13:52   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 077/108] spi: ich: Move the protection/lockdown code into a function Simon Glass
2019-11-19 13:53   ` Bin Meng
2019-11-19 17:53     ` Simon Glass
2019-11-20 12:55       ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 078/108] spi: ich: Convert to livetree Simon Glass
2019-11-19 13:53   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 079/108] spi: ich: Fix header order Simon Glass
2019-11-19 13:53   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 080/108] spi: ich: Various small tidy-ups Simon Glass
2019-11-19 13:53   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 081/108] spi: ich: Add mmio_base to struct ich_spi_platdata Simon Glass
2019-11-19 14:36   ` Bin Meng
2019-11-19 17:53     ` Simon Glass
2019-11-20 12:52       ` Bin Meng
2019-11-21 13:50         ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 082/108] spi: ich: Correct max-size bug in ich_spi_adjust_size() Simon Glass
2019-11-19 14:36   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-11-21 14:04       ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 083/108] spi: ich: Support of-platdata for fast-spi Simon Glass
2019-11-19 14:36   ` Bin Meng
2019-11-19 17:53     ` Simon Glass
2019-11-20 12:48       ` Bin Meng
2019-11-21 13:50         ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 084/108] spi: ich: Support hardware sequencing Simon Glass
2019-11-19 14:36   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 085/108] spi: ich: Add support for get_mmap() method Simon Glass
2019-11-19 14:36   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 086/108] spi: ich: Add TPL support Simon Glass
2019-11-19 14:52   ` Bin Meng
2019-11-21 13:50     ` Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 087/108] spi: ich: Add Apollolake support Simon Glass
2019-11-19 14:52   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 088/108] mtd: spi: Export spi_flash_std_probe() Simon Glass
2019-11-19 14:52   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 089/108] x86: apollolake: Add basic IO addresses Simon Glass
2019-11-19 14:52   ` Bin Meng
2019-10-21  3:38 ` [U-Boot] [PATCH v3 090/108] x86: apollolake: Add PMC driver Simon Glass
2019-10-21  3:38 ` [U-Boot] [PATCH v3 091/108] x86: apollolake: Add low-power subsystem (lpss) support Simon Glass
2019-10-21  8:14   ` Andy Shevchenko
2019-10-21  3:38 ` [U-Boot] [PATCH v3 092/108] x86: apollolake: Add UART driver Simon Glass
2019-10-21  7:46   ` Andy Shevchenko
2019-10-21 22:53     ` Simon Glass
2019-10-22  8:21       ` Andy Shevchenko
2019-10-21  3:38 ` [U-Boot] [PATCH v3 093/108] x86: apollolake: Add GPIO driver Simon Glass
2019-10-21  7:57   ` Andy Shevchenko
2019-10-21  3:38 ` [U-Boot] [PATCH v3 094/108] i2c: designware: Add apollolake support Simon Glass
2019-10-28  4:47   ` Heiko Schocher
2019-10-21  3:39 ` [U-Boot] [PATCH v3 095/108] x86: apollolake: Add systemagent driver Simon Glass
2019-10-21  8:16   ` Andy Shevchenko
2019-10-21  3:39 ` [U-Boot] [PATCH v3 096/108] x86: apollolake: Add hostbridge driver Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 097/108] x86: apollolake: Add ITSS driver Simon Glass
2019-10-21  8:41   ` Andy Shevchenko
2019-10-21  8:43     ` Andy Shevchenko
2019-10-21 22:53       ` Simon Glass
2019-10-22  8:22         ` Andy Shevchenko
2019-10-22 13:50           ` Simon Glass
2019-10-22 18:56             ` Andy Shevchenko
2019-10-21  3:39 ` [U-Boot] [PATCH v3 098/108] x86: apollolake: Add LPC driver Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 099/108] x86: apollolake: Add PCH driver Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 100/108] x86: apollolake: Add PUNIT driver Simon Glass
2019-10-21  8:47   ` Andy Shevchenko
2019-10-21  3:39 ` [U-Boot] [PATCH v3 101/108] x86: apollolake: Add SPL loaders Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 102/108] x86: apollolake: Add a CPU driver Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 103/108] x86: apollolake: Add SPL/TPL init Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 104/108] x86: apollolake: Add P2SB driver Simon Glass
2019-10-21  8:49   ` Andy Shevchenko
2019-10-21 22:53     ` Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 105/108] x86: apollolake: Add Kconfig and Makefile Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 106/108] x86: apollolake: Add FSP structures Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 107/108] x86: apollolake: Add FSP support Simon Glass
2019-10-21  3:39 ` [U-Boot] [PATCH v3 108/108] x86: Add chromebook_coral Simon Glass
2019-10-21 19:15 ` [U-Boot] [PATCH v3 022/108] x86: timer: Use a separate flag for whether timer is inited Park, Aiden
2019-10-28  7:12 ` Bin Meng
2019-11-02  9:47   ` Bin Meng

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='CAEUhbmUbp=qzd5KLKMdA8Yo8TZJ7TBStGaGHsR6k8xQvEBcEJg@mail.gmail.com' \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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.