[PATCH v7 04/13] xen/cpufreq: add missing default: case for x86 vendor

Penny Zheng posted 13 patches 2 months, 1 week ago
Only 12 patches received!
There is a newer version of this series
[PATCH v7 04/13] xen/cpufreq: add missing default: case for x86 vendor
Posted by Penny Zheng 2 months, 1 week ago
Since we are missing default case for x86 vendor, there is possibility (i.e.
new vendor introduced) that we will return successfully while missing the
whole cpufreq driver initialization process.
Move "ret = -ENOENTRY" forward to cover default case for x86 vendor, and
add error log

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v6 -> v7:
- new commit
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index d18735c7ae..e227376bab 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -131,11 +131,11 @@ static int __init cf_check cpufreq_driver_init(void)
 
     if ( cpufreq_controller == FREQCTL_xen )
     {
+        ret = -ENOENT;
+
         switch ( boot_cpu_data.x86_vendor )
         {
         case X86_VENDOR_INTEL:
-            ret = -ENOENT;
-
             for ( unsigned int i = 0; i < cpufreq_xen_cnt; i++ )
             {
                 switch ( cpufreq_xen_opts[i] )
@@ -162,6 +162,10 @@ static int __init cf_check cpufreq_driver_init(void)
         case X86_VENDOR_HYGON:
             ret = IS_ENABLED(CONFIG_AMD) ? powernow_register_driver() : -ENODEV;
             break;
+
+        default:
+            printk(XENLOG_ERR "Cpufreq: unsupported x86 vendor\n");
+            break;
         }
     }
 
-- 
2.34.1
Re: [PATCH v7 04/13] xen/cpufreq: add missing default: case for x86 vendor
Posted by Jan Beulich 2 months ago
On 22.08.2025 12:52, Penny Zheng wrote:
> Since we are missing default case for x86 vendor, there is possibility (i.e.
> new vendor introduced) that we will return successfully while missing the
> whole cpufreq driver initialization process.
> Move "ret = -ENOENTRY" forward to cover default case for x86 vendor, and
> add error log

Requested-by: Jan Beulich <jbeulich@suse.com>
(or Suggested-by: if you like that better)

> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
RE: [PATCH v7 04/13] xen/cpufreq: add missing default: case for x86 vendor
Posted by Penny, Zheng 2 months ago
[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Monday, August 25, 2025 10:43 PM
> To: Penny, Zheng <penny.zheng@amd.com>
> Cc: Huang, Ray <Ray.Huang@amd.com>; Andrew Cooper
> <andrew.cooper3@citrix.com>; Roger Pau Monné <roger.pau@citrix.com>; xen-
> devel@lists.xenproject.org
> Subject: Re: [PATCH v7 04/13] xen/cpufreq: add missing default: case for x86
> vendor
>
> On 22.08.2025 12:52, Penny Zheng wrote:
> > Since we are missing default case for x86 vendor, there is possibility (i.e.
> > new vendor introduced) that we will return successfully while missing
> > the whole cpufreq driver initialization process.
> > Move "ret = -ENOENTRY" forward to cover default case for x86 vendor,

Typo: -ENOENT

> > and add error log
>
> Requested-by: Jan Beulich <jbeulich@suse.com> (or Suggested-by: if you like that
> better)

Ack

>
> > Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thx

>
> Jan