Add x86_64_v2
This commit is contained in:
parent
88660ad393
commit
b7b9157fd5
119
SOURCES/2536.patch
Normal file
119
SOURCES/2536.patch
Normal file
@ -0,0 +1,119 @@
|
||||
From 65ae8d101f18e9d85b5e8d91f0d164117d811914 Mon Sep 17 00:00:00 2001
|
||||
From: Arun Ajith S <aajith@arista.com>
|
||||
Date: Tue, 6 Jun 2023 07:20:06 -0700
|
||||
Subject: [PATCH] rpmrc: Fix how x86 models are derived
|
||||
|
||||
The code to autodetect x86 CPU model runs the cpuid instruction after
|
||||
setting up 1 in eax. This gives the processor signature back in eax
|
||||
which encodes the model number.
|
||||
|
||||
As per Intel Application Note 485 and AMD publication #25481, when
|
||||
deriving model, we should look at both the base model in eax[7:4] and
|
||||
the extended model in eax[19:16]. However current code is only looking
|
||||
at base model and this causes some newer CPUs like Icelake(Model 0x6a)
|
||||
to be detected wrongly as Pentium 3(Model 0x0a).
|
||||
|
||||
Note that this code is only exercised when rpm is built as 32-bit
|
||||
binary because all of this is within a `#if defined(__i386__)`.
|
||||
|
||||
Because of this misdetection on Icelake, `setarch x86_64 rpm --showrc`
|
||||
has `pentium3` as the `installed arch` instead of the expected `x86_64`.
|
||||
It doesn't have `x86_64` as one of the `compatible archs` as expected.
|
||||
Attempting to install a x86_64 rpm with `setarch x86_64 rpm -i` is
|
||||
failing with `is intended for a different architecture` errors.
|
||||
|
||||
```
|
||||
ARCHITECTURE AND OS:
|
||||
build arch : i386
|
||||
compatible build archs: pentium3 i686 i586 i486 i386 noarch fat
|
||||
build os : Linux
|
||||
compatible build os's : Linux
|
||||
install arch : pentium3
|
||||
install os : Linux
|
||||
compatible archs : pentium3 i686 i586 i486 i386 noarch fat
|
||||
compatible os's : Linux
|
||||
```
|
||||
|
||||
Fix the code to also consider extended model and extended family when
|
||||
applicable. The implementation is similar to the one in the linuxi
|
||||
kernel.
|
||||
|
||||
References:
|
||||
https://www.scss.tcd.ie/~jones/CS4021/processor-identification-cpuid-instruction-note.pdf
|
||||
https://www.amd.com/system/files/TechDocs/25481.pdf
|
||||
https://elixir.bootlin.com/linux/v6.3.6/source/arch/x86/lib/cpu.c#L19
|
||||
|
||||
Fixes: #2535
|
||||
---
|
||||
lib/rpmrc.c | 37 +++++++++++++++++++++++++++++++------
|
||||
1 file changed, 31 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
|
||||
index e5ddeb0916..8e77ca5458 100644
|
||||
--- a/lib/rpmrc.c
|
||||
+++ b/lib/rpmrc.c
|
||||
@@ -933,6 +933,31 @@ static int is_athlon(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static unsigned int x86_family(unsigned int processor_sig)
|
||||
+{
|
||||
+ unsigned int base_family = (processor_sig >> 8) & 0x0f;
|
||||
+ unsigned int family;
|
||||
+ if (base_family == 0x0f) {
|
||||
+ unsigned int extended_family = (processor_sig >> 20) & 0x0ff;
|
||||
+ family = base_family + extended_family;
|
||||
+ } else
|
||||
+ family = base_family;
|
||||
+ return family;
|
||||
+}
|
||||
+
|
||||
+static unsigned int x86_model(unsigned int processor_sig)
|
||||
+{
|
||||
+ unsigned int base_model = (processor_sig >> 4) & 0x0f;
|
||||
+ unsigned int family = x86_family(processor_sig);
|
||||
+ unsigned int model;
|
||||
+ if (family >= 0x6) {
|
||||
+ unsigned int extended_model = (processor_sig >> 16) & 0x0f;
|
||||
+ model = (extended_model << 4) | base_model;
|
||||
+ } else
|
||||
+ model = base_model;
|
||||
+ return model;
|
||||
+}
|
||||
+
|
||||
static int is_pentium3(void)
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx, family, model;
|
||||
@@ -945,8 +970,8 @@ static int is_pentium3(void)
|
||||
if (!rstreqn(vendor, "GenuineIntel", 12))
|
||||
return 0;
|
||||
cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
- family = (eax >> 8) & 0x0f;
|
||||
- model = (eax >> 4) & 0x0f;
|
||||
+ family = x86_family(eax);
|
||||
+ model = x86_model(eax);
|
||||
if (family == 6)
|
||||
switch (model)
|
||||
{
|
||||
@@ -972,8 +997,8 @@ static int is_pentium4(void)
|
||||
if (!rstreqn(vendor, "GenuineIntel", 12))
|
||||
return 0;
|
||||
cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
- family = (eax >> 8) & 0x0f;
|
||||
- model = (eax >> 4) & 0x0f;
|
||||
+ family = x86_family(eax);
|
||||
+ model = x86_model(eax);
|
||||
if (family == 15)
|
||||
switch (model)
|
||||
{
|
||||
@@ -1002,8 +1027,8 @@ static int is_geode(void)
|
||||
if (!rstreqn(vendor, "AuthenticAMD", 12))
|
||||
return 0;
|
||||
cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
- family = (eax >> 8) & 0x0f;
|
||||
- model = (eax >> 4) & 0x0f;
|
||||
+ family = x86_family(eax);
|
||||
+ model = x86_model(eax);
|
||||
if (family == 5)
|
||||
switch (model)
|
||||
{
|
43
SOURCES/x86_64_v2.patch
Normal file
43
SOURCES/x86_64_v2.patch
Normal file
@ -0,0 +1,43 @@
|
||||
diff -aruN rpm-4.16.1.3/rpmrc.in rpm-4.16.1.3.alma/rpmrc.in
|
||||
--- rpm-4.16.1.3/rpmrc.in 2024-11-22 12:40:24
|
||||
+++ rpm-4.16.1.3.alma/rpmrc.in 2024-11-22 12:42:04
|
||||
@@ -22,6 +22,7 @@
|
||||
optflags: geode -Os -g -m32 -march=geode
|
||||
optflags: ia64 -O2 -g
|
||||
optflags: x86_64 -O2 -g
|
||||
+optflags: x86_64_v2 -O2 -g -march=x86-64-v2
|
||||
optflags: amd64 -O2 -g
|
||||
optflags: ia32e -O2 -g
|
||||
|
||||
@@ -147,6 +148,7 @@
|
||||
archcolor: ia64 2
|
||||
|
||||
archcolor: x86_64 2
|
||||
+archcolor: x86_64_v2 2
|
||||
|
||||
archcolor: sh3 1
|
||||
archcolor: sh4 1
|
||||
@@ -376,6 +378,7 @@
|
||||
buildarchtranslate: ia64: ia64
|
||||
|
||||
buildarchtranslate: x86_64: x86_64
|
||||
+buildarchtranslate: x86_64_v2: x86_64
|
||||
buildarchtranslate: amd64: x86_64
|
||||
buildarchtranslate: ia32e: x86_64
|
||||
|
||||
@@ -489,6 +492,7 @@
|
||||
arch_compat: x86_64: amd64 em64t athlon noarch
|
||||
arch_compat: amd64: x86_64 em64t athlon noarch
|
||||
arch_compat: ia32e: x86_64 em64t athlon noarch
|
||||
+arch_compat: x86_64_v2: x86_64 amd64 em64t athlon noarch
|
||||
|
||||
arch_compat: sh3: noarch
|
||||
arch_compat: sh4: noarch
|
||||
@@ -624,6 +628,7 @@
|
||||
|
||||
buildarch_compat: ia64: noarch
|
||||
|
||||
+buildarch_compat: x86_64_v2: x86_64
|
||||
buildarch_compat: x86_64: noarch
|
||||
buildarch_compat: amd64: x86_64
|
||||
buildarch_compat: ia32e: x86_64
|
@ -48,7 +48,7 @@
|
||||
Summary: The RPM package management system
|
||||
Name: rpm
|
||||
Version: %{rpmver}
|
||||
Release: %{?snapver:0.%{snapver}.}%{rel}%{?dist}
|
||||
Release: %{?snapver:0.%{snapver}.}%{rel}%{?dist}.alma.100
|
||||
Url: http://www.rpm.org/
|
||||
Source0: http://ftp.rpm.org/releases/%{srcdir}/rpm-%{srcver}.tar.bz2
|
||||
%if %{with bdb} && %{with int_bdb}
|
||||
@ -138,6 +138,10 @@ Patch1002: 0001-Macroize-find-debuginfo-script-location.patch
|
||||
Patch1003: 0001-Fix-root-relocation-regression.patch
|
||||
Patch1004: 0001-Skip-to-hashed-subpacket-data-directly.patch
|
||||
|
||||
|
||||
Patch10001: 2536.patch
|
||||
Patch10002: x86_64_v2.patch
|
||||
|
||||
# Partially GPL/LGPL dual-licensed and some bits with BSD
|
||||
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
|
||||
License: GPLv2+
|
||||
@ -1247,4 +1251,3 @@ fi
|
||||
|
||||
* Thu Aug 10 2017 Panu Matilainen <pmatilai@redhat.com> - 4.13.90-0.git14000.1
|
||||
- Rebase to rpm 4.13.90 aka 4.14.0-alpha (#1474836)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user