Skip to contentSkip to conversation

Adding ifdefs to call the respective routines only when their configs are enabled

PATCH In review Swetha Joshi 3 participants 4 messages May 25, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Adding ifdefs to call the respective routines only when their configs are enabled

From: Swetha <[email protected]>

---
 target/arm/kvm64.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
target/arm/kvm64.c +9 -5
index dff85f6db9..724ce78265 100644
@@ -1403,7 +1403,10 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)
     hwaddr paddr;
     Object *obj = qdev_get_machine();
     VirtMachineState *vms = VIRT_MACHINE(obj);
+    bool acpi_enabled = false;
+#ifdef CONFIG_ARM_VIRT
     bool acpi_enabled = virt_is_acpi_enabled(vms);
+    #endif /* CONFIG_ARM_VIRT */
 
     assert(code == BUS_MCEERR_AR || code == BUS_MCEERR_AO);
 
@@ -1426,12 +1429,13 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)
              */
             if (code == BUS_MCEERR_AR) {
                 kvm_cpu_synchronize_state(c);
-                if (!acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA, paddr)) {
-                    kvm_inject_arm_sea(c);
-                } else {
-                    error_report("failed to record the error");
-                    abort();
+#ifdef CONFIG_ACPI_APEI
+                if (acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA, paddr)) {
+                  error_report("failed to record the error");
+                  abort();
                 }
+#endif /* CONFIG_ACPI_APEI */
+                kvm_inject_arm_sea(c);
             }
             return;
         }
Signature · 1 line
2.25.1
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH] Adding ifdefs to call the respective routines only when their configs are enabled

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
18cab39 Adding ifdefs to call the respective routines only when their configs are enabled

=== OUTPUT BEGIN ===
ERROR: suspect code indent for conditional statements (16, 18) #38: FILE: target/arm/kvm64.c:1433:
+ if (acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA, paddr)) {
+ error_report("failed to record the error");

total: 1 errors, 0 warnings, 28 lines checked

Commit 18cab39bcd46 (Adding ifdefs to call the respective routines only when their configs are enabled) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#2 lore raw
In reply to Swetha Joshi
Quoted 3 lines · Swetha Joshi

From: Swetha <[email protected]>

What are you trying to accomplish?
That's what belongs in the commit message that you omitted.

target/arm/kvm64.c void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) · line 1408

Quoted 3 lines
target/arm/kvm64.c +2 -0
+    bool acpi_enabled = false;
+#ifdef CONFIG_ARM_VIRT
      bool acpi_enabled = virt_is_acpi_enabled(vms);

Of course this doesn't compile, having declared acpi_enabled twice. So you have clearly not tested this patch sufficiently.

The cc to qemu-trivial is unwarranted.

r~

#3 lore raw

Hey Richard,

I think I submitted the wrong patch, sorry about that. I will go ahead and submit the correct commit id now. What I was trying to do was, when kvm is enabled and if we don't want to include CONFIG_ARM_VIRT or CONFIG_ACPI_APEI, compilation fails as virt_is_acpi_enabled() routine is defined in virt.h and acpi_ghes_record_errors() is defined in ghes.h.

~ Swetha

Quoted 21 lines · Richard Henderson
Quoted 3 lines · Swetha Joshi

From: Swetha <[email protected]>

What are you trying to accomplish?
That's what belongs in the commit message that you omitted.

target/arm/kvm64.c void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) · line 1408

Quoted 3 lines
target/arm/kvm64.c +2 -0
+    bool acpi_enabled = false;
+#ifdef CONFIG_ARM_VIRT
      bool acpi_enabled = virt_is_acpi_enabled(vms);

Of course this doesn't compile, having declared acpi_enabled twice. So you
have clearly not tested this patch sufficiently.

The cc to qemu-trivial is unwarranted.

r~

Signature · 3 lines
Regards

Swetha Joshi.