Skip to content

Commit

Permalink
prefetchi: add 1 BAT case
Browse files Browse the repository at this point in the history
Signed-off-by: Jiaan Lu <[email protected]>
  • Loading branch information
jiaanlu committed May 31, 2024
1 parent 8343b68 commit e349d9a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
1 change: 1 addition & 0 deletions BM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [IFS(In Field Scan)](ifs/README.md)
* [ISST](isst/README.md)
* [PMU](pmu/README.md)
* [PREFETCHI(Code SW Prefetch)](prefetchi/README.md)
* [pstate](pstate/README.md)
* [Intel_PT](pt/README.md)
* [RAPL](rapl/README.md)
Expand Down
5 changes: 0 additions & 5 deletions BM/cmpccxadd/.vscode/settings.json

This file was deleted.

12 changes: 12 additions & 0 deletions BM/prefetchi/Makefile
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)
13 changes: 13 additions & 0 deletions BM/prefetchi/README.md
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.
29 changes: 29 additions & 0 deletions BM/prefetchi/prefetchi.c
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;
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ More details please refer to following.
* [IFS(In Field Scan)](BM/ifs/README.md)
* [ISST](BM/isst/README.md)
* [PMU](BM/pmu/README.md)
* [PREFETCHI(Code SW Prefetch)](BM/prefetchi/README.md)
* [pstate](BM/pstate/README.md)
* [Intel_PT](BM/pt/README.md)
* [RAPL](BM/rapl/README.md)
Expand Down

0 comments on commit e349d9a

Please sign in to comment.