* [PATCH v2] i386: flush cache only on VIA C3 and earlier
@ 2023-07-06 21:33 ValdikSS
2023-10-05 16:57 ` Daniel Kiper
0 siblings, 1 reply; 3+ messages in thread
From: ValdikSS @ 2023-07-06 21:33 UTC (permalink / raw)
To: grub-devel
The code used to flush the cache on VIA processors unconditionally,
which is excessive.
Check for cpuid family and execute wbinvd only on C3 and earlier.
See: https://savannah.gnu.org/bugs/?45149
See: commit 25492a0f047cb7a6583ae195568599c296a604d6
---
grub-core/kern/i386/pc/init.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c
index 27bc68b8a..7f08d2067 100644
--- a/grub-core/kern/i386/pc/init.c
+++ b/grub-core/kern/i386/pc/init.c
@@ -191,7 +191,7 @@ extern grub_uint16_t grub_bios_via_workaround1, grub_bios_via_workaround2;
static void
grub_via_workaround_init (void)
{
- grub_uint32_t manufacturer[3], max_cpuid;
+ grub_uint32_t manufacturer[3], max_cpuid, procinfo;
if (! grub_cpu_is_cpuid_supported ())
return;
@@ -200,6 +200,15 @@ grub_via_workaround_init (void)
if (grub_memcmp (manufacturer, "CentaurHauls", 12) != 0)
return;
+ if (max_cpuid > 0)
+ {
+ grub_cpuid (1, procinfo, /* Don't care */ manufacturer[0],
+ manufacturer[2], manufacturer[1]);
+ /* Check model, apply only to VIA C3 and lower */
+ if (((procinfo & 0xF0) >> 4 | (procinfo & 0xF0000) >> 12) > 10)
+ return;
+ }
+
grub_bios_via_workaround1 = 0x090f;
grub_bios_via_workaround2 = 0x090f;
asm volatile ("wbinvd");
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i386: flush cache only on VIA C3 and earlier
2023-07-06 21:33 [PATCH v2] i386: flush cache only on VIA C3 and earlier ValdikSS
@ 2023-10-05 16:57 ` Daniel Kiper
2023-10-06 17:22 ` ValdikSS via Grub-devel
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kiper @ 2023-10-05 16:57 UTC (permalink / raw)
To: ValdikSS; +Cc: grub-devel
On Fri, Jul 07, 2023 at 12:33:32AM +0300, ValdikSS via Grub-devel wrote:
> The code used to flush the cache on VIA processors unconditionally,
> which is excessive.
> Check for cpuid family and execute wbinvd only on C3 and earlier.
>
> See: https://savannah.gnu.org/bugs/?45149
> See: commit 25492a0f047cb7a6583ae195568599c296a604d6
s/See/Fixes/
The patch misses Signed-off-by line too. I can add it on your behalf if
you are OK with it.
Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...
Daniel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i386: flush cache only on VIA C3 and earlier
2023-10-05 16:57 ` Daniel Kiper
@ 2023-10-06 17:22 ` ValdikSS via Grub-devel
0 siblings, 0 replies; 3+ messages in thread
From: ValdikSS via Grub-devel @ 2023-10-06 17:22 UTC (permalink / raw)
To: Daniel Kiper; +Cc: ValdikSS, grub-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 629 bytes --]
On 05.10.2023 19:57, Daniel Kiper wrote:
> On Fri, Jul 07, 2023 at 12:33:32AM +0300, ValdikSS via Grub-devel wrote:
>> The code used to flush the cache on VIA processors unconditionally,
>> which is excessive.
>> Check for cpuid family and execute wbinvd only on C3 and earlier.
>>
>> See: https://savannah.gnu.org/bugs/?45149
>> See: commit 25492a0f047cb7a6583ae195568599c296a604d6
>
> s/See/Fixes/
Done, check v3.
>
> The patch misses Signed-off-by line too. I can add it on your behalf if
> you are OK with it.
>
> Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...
+++
>
> Daniel
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
[-- Attachment #2: Type: text/plain, Size: 141 bytes --]
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-06 17:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 21:33 [PATCH v2] i386: flush cache only on VIA C3 and earlier ValdikSS
2023-10-05 16:57 ` Daniel Kiper
2023-10-06 17:22 ` ValdikSS via Grub-devel
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.