-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jiaan Lu <[email protected]>
- Loading branch information
Showing
6 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (c) 2024 Intel Corporation. | ||
|
||
CC = gcc | ||
CFLAGS = -g -Wall | ||
TARGET = prefetchi | ||
|
||
$(TARGET): prefetchi.c | ||
$(CC) $(CFLAGS) -o $@ $< | ||
|
||
clean: | ||
rm -f $(TARGET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# PREFETCHI (Code SW Prefetch) | ||
|
||
## Description | ||
PREFETCHI is a new set of instructions in the latest Intel platform Granite Rapids. This new instruction set moves code to memory (cache) closer to the processor depending on specific hints. The encodings stay NOPs in processors that do not enumerate these instructions. | ||
|
||
This is a basic test to ensure PREFETCHIT0/1 is supported on your platform. | ||
|
||
## Usage | ||
``` | ||
make | ||
./prefetchi | ||
``` | ||
Test result will be printed out. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
// Copyright (c) 2024 Intel Corporation. | ||
|
||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include "../common/kselftest.h" | ||
|
||
#define CPUID_LEAF7_EDX_PREFETCHI_MASK (1 << 14) /* PREFETCHI instructions */ | ||
|
||
static void check_cpuid_prefetchi(void) | ||
{ | ||
uint32_t eax, ebx, ecx, edx; | ||
|
||
/* | ||
* CPUID.(EAX=07H, ECX=01H).EDX.PREFETCHI[bit 14] enumerates | ||
* support for PREFETCHIT0/1 instructions. | ||
*/ | ||
__cpuid_count(7, 1, eax, ebx, ecx, edx); | ||
if (!(edx & CPUID_LEAF7_EDX_PREFETCHI_MASK)) | ||
printf("cpuid: CPU doesn't support PREFETCHIT0/1.\n"); | ||
else | ||
printf("Test passed\n"); | ||
} | ||
|
||
int main(void) | ||
{ | ||
check_cpuid_prefetchi(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters