diff mbox

[v2] x86: commit 0ade5e causes psr features in cmdline cannot be correctly enumerated

Message ID 1506046726-42267-1-git-send-email-yi.y.sun@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yi Sun Sept. 22, 2017, 2:18 a.m. UTC
Commit 0ade5e causes a bug that the psr features presented in cmdline
cannot be correctly enumerated.
1. If there is only 'psr=', then CMT is enumerated which is not right.
2. If cmdline is 'psr=cmt,cat,cdp,mba', only the last feature is enumerated.

This patch fixes the issues.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
v2:
    - fix title and commit message.
      (suggested by Jan Beulich)
---
 xen/arch/x86/psr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 4515100..daa2aeb 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -422,9 +422,10 @@  static bool __init parse_psr_bool(const char *s, const char *delim,
                                   const char *ss, const char *feature,
                                   unsigned int mask)
 {
-    if ( !strncmp(s, feature, delim - s) )
+    /* If cmdline is 'psr=', we need make sure delim != s */
+    if ( delim != s && !strncmp(s, feature, delim - s) )
     {
-        if ( !*delim )
+        if ( !*delim || *delim == ',' )
             opt_psr |= mask;
         else
         {
@@ -457,6 +458,10 @@  static int __init parse_psr_param(const char *s)
         if ( !val_delim )
             val_delim = strchr(s, '\0');
 
+        /* E.g. 'psr=cmt,rmid_max:200' */
+        if ( val_delim > ss )
+            val_delim = ss;
+
         if ( *val_delim && !strncmp(s, "rmid_max", val_delim - s) )
         {
             opt_rmid_max = simple_strtoul(val_delim + 1, &q, 0);