Blame SOURCES/kvm-i386-Don-t-print-warning-if-phys-bits-was-set-automa.patch

Pablo Greco e6a3ae
From 7e78c8e8b5a9cab9ef4604dc29eab4b4323e9b9b Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
Date: Tue, 13 Aug 2019 01:53:55 +0100
Pablo Greco e6a3ae
Subject: [PATCH 01/21] i386: Don't print warning if phys-bits was set
Pablo Greco e6a3ae
 automatically
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190813015355.17556-1-ehabkost@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 89946
Pablo Greco e6a3ae
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH] i386: Don't print warning if phys-bits was set automatically
Pablo Greco e6a3ae
Bugzilla: 1719127
Pablo Greco e6a3ae
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: John Snow <jsnow@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1719127
Pablo Greco e6a3ae
BRANCH: rhel-8.1.0
Pablo Greco e6a3ae
UPSTREAM: fea306520ea4b2f189dd23c70a6afd2fc4ffafdc
Pablo Greco e6a3ae
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23026463
Pablo Greco e6a3ae
Pablo Greco e6a3ae
If cpu->host_phys_bits_limit is set, QEMU will make
Pablo Greco e6a3ae
cpu->phys_bits be lower than host_phys_bits on some cases.  This
Pablo Greco e6a3ae
triggers a warning that was supposed to be printed only if
Pablo Greco e6a3ae
phys-bits was explicitly set in the command-line.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Reorder the code so the value of cpu->phys_bits is validated
Pablo Greco e6a3ae
before the cpu->host_phys_bits handling.  This will avoid
Pablo Greco e6a3ae
unexpected warnings when cpu->host_phys_bits_limit is set.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
Message-Id: <20190611205420.20286-1-ehabkost@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit fea306520ea4b2f189dd23c70a6afd2fc4ffafdc)
Pablo Greco e6a3ae
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 target/i386/cpu.c | 18 +++++++++---------
Pablo Greco e6a3ae
 1 file changed, 9 insertions(+), 9 deletions(-)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
Pablo Greco e6a3ae
index c8f50a7..c69116c 100644
Pablo Greco e6a3ae
--- a/target/i386/cpu.c
Pablo Greco e6a3ae
+++ b/target/i386/cpu.c
Pablo Greco e6a3ae
@@ -5116,15 +5116,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
Pablo Greco e6a3ae
             uint32_t host_phys_bits = x86_host_phys_bits();
Pablo Greco e6a3ae
             static bool warned;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-            if (cpu->host_phys_bits) {
Pablo Greco e6a3ae
-                /* The user asked for us to use the host physical bits */
Pablo Greco e6a3ae
-                cpu->phys_bits = host_phys_bits;
Pablo Greco e6a3ae
-                if (cpu->host_phys_bits_limit &&
Pablo Greco e6a3ae
-                    cpu->phys_bits > cpu->host_phys_bits_limit) {
Pablo Greco e6a3ae
-                    cpu->phys_bits = cpu->host_phys_bits_limit;
Pablo Greco e6a3ae
-                }
Pablo Greco e6a3ae
-            }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
             /* Print a warning if the user set it to a value that's not the
Pablo Greco e6a3ae
              * host value.
Pablo Greco e6a3ae
              */
Pablo Greco e6a3ae
@@ -5136,6 +5127,15 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
Pablo Greco e6a3ae
                 warned = true;
Pablo Greco e6a3ae
             }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+            if (cpu->host_phys_bits) {
Pablo Greco e6a3ae
+                /* The user asked for us to use the host physical bits */
Pablo Greco e6a3ae
+                cpu->phys_bits = host_phys_bits;
Pablo Greco e6a3ae
+                if (cpu->host_phys_bits_limit &&
Pablo Greco e6a3ae
+                    cpu->phys_bits > cpu->host_phys_bits_limit) {
Pablo Greco e6a3ae
+                    cpu->phys_bits = cpu->host_phys_bits_limit;
Pablo Greco e6a3ae
+                }
Pablo Greco e6a3ae
+            }
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
             if (cpu->phys_bits &&
Pablo Greco e6a3ae
                 (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS ||
Pablo Greco e6a3ae
                 cpu->phys_bits < 32)) {
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae