[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/48] acpi/ghes: simplify acpi_ghes_record_errors() code
From: |
Michael S. Tsirkin |
Subject: |
[PULL 28/48] acpi/ghes: simplify acpi_ghes_record_errors() code |
Date: |
Wed, 15 Jan 2025 13:09:56 -0500 |
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reduce the ident of the function and prepares it for
the next changes.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id:
<19af4188535217213486d169e0501e592bc78a95.1736945236.git.mchehab+huawei@kernel.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/acpi/ghes.c | 56 ++++++++++++++++++++++++++------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c
index dc217694de..e66f3be150 100644
--- a/hw/acpi/ghes.c
+++ b/hw/acpi/ghes.c
@@ -402,40 +402,42 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t
physical_address)
start_addr = le64_to_cpu(ags->ghes_addr_le);
- if (physical_address) {
+ if (!physical_address) {
+ return -1;
+ }
- if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) {
- start_addr += source_id * sizeof(uint64_t);
- }
+ if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) {
+ start_addr += source_id * sizeof(uint64_t);
+ }
- cpu_physical_memory_read(start_addr, &error_block_addr,
- sizeof(error_block_addr));
+ cpu_physical_memory_read(start_addr, &error_block_addr,
+ sizeof(error_block_addr));
- error_block_addr = le64_to_cpu(error_block_addr);
+ error_block_addr = le64_to_cpu(error_block_addr);
- read_ack_register_addr = start_addr +
- ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t);
+ read_ack_register_addr = start_addr +
+ ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t);
- cpu_physical_memory_read(read_ack_register_addr,
- &read_ack_register,
sizeof(read_ack_register));
+ cpu_physical_memory_read(read_ack_register_addr,
+ &read_ack_register, sizeof(read_ack_register));
- /* zero means OSPM does not acknowledge the error */
- if (!read_ack_register) {
- error_report("OSPM does not acknowledge previous error,"
- " so can not record CPER for current error anymore");
- } else if (error_block_addr) {
- read_ack_register = cpu_to_le64(0);
- /*
- * Clear the Read Ack Register, OSPM will write it to 1 when
- * it acknowledges this error.
- */
- cpu_physical_memory_write(read_ack_register_addr,
- &read_ack_register, sizeof(uint64_t));
+ /* zero means OSPM does not acknowledge the error */
+ if (!read_ack_register) {
+ error_report("OSPM does not acknowledge previous error,"
+ " so can not record CPER for current error anymore");
+ } else if (error_block_addr) {
+ read_ack_register = cpu_to_le64(0);
+ /*
+ * Clear the Read Ack Register, OSPM will write it to 1 when
+ * it acknowledges this error.
+ */
+ cpu_physical_memory_write(read_ack_register_addr,
+ &read_ack_register, sizeof(uint64_t));
- ret = acpi_ghes_record_mem_error(error_block_addr,
- physical_address);
- } else
- error_report("can not find Generic Error Status Block");
+ ret = acpi_ghes_record_mem_error(error_block_addr,
+ physical_address);
+ } else {
+ error_report("can not find Generic Error Status Block");
}
return ret;
--
MST
- [PULL 18/48] intel_iommu: Add support for PASID-based device IOTLB invalidation, (continued)
- [PULL 18/48] intel_iommu: Add support for PASID-based device IOTLB invalidation, Michael S. Tsirkin, 2025/01/15
- [PULL 33/48] acpi/ghes: Change the type for source_id, Michael S. Tsirkin, 2025/01/15
- [PULL 32/48] acpi/ghes: Remove a duplicated out of bounds check, Michael S. Tsirkin, 2025/01/15
- [PULL 15/48] intel_iommu: Flush stage-1 cache in iotlb invalidation, Michael S. Tsirkin, 2025/01/15
- [PULL 16/48] intel_iommu: Process PASID-based iotlb invalidation, Michael S. Tsirkin, 2025/01/15
- [PULL 40/48] acpi/ghes: move offset calculus to a separate function, Michael S. Tsirkin, 2025/01/15
- [PULL 21/48] intel_iommu: Set default aw_bits to 48 starting from QEMU 9.2, Michael S. Tsirkin, 2025/01/15
- [PULL 22/48] tests/acpi: q35: Update host address width in DMAR, Michael S. Tsirkin, 2025/01/15
- [PULL 41/48] acpi/ghes: Change ghes fill logic to work with only one source, Michael S. Tsirkin, 2025/01/15
- [PULL 46/48] hw/cxl: Fix msix_notify: Assertion `vector < dev->msix_entries_nr`, Michael S. Tsirkin, 2025/01/15
- [PULL 28/48] acpi/ghes: simplify acpi_ghes_record_errors() code,
Michael S. Tsirkin <=
- [PULL 25/48] tests/qtest: Add intel-iommu test, Michael S. Tsirkin, 2025/01/15
- [PULL 37/48] acpi/ghes: don't crash QEMU if ghes GED is not found, Michael S. Tsirkin, 2025/01/15
- [PULL 30/48] acpi/ghes: better handle source_id and notification, Michael S. Tsirkin, 2025/01/15
- [PULL 44/48] pci: acpi: Windows 'PCI Label Id' bug workaround, Michael S. Tsirkin, 2025/01/15
- [PULL 48/48] virtio-net: vhost-user: Implement internal migration, Michael S. Tsirkin, 2025/01/15
- [PULL 36/48] acpi/ghes: better name GHES memory error function, Michael S. Tsirkin, 2025/01/15
- [PULL 35/48] acpi/ghes: make the GHES record generation more generic, Michael S. Tsirkin, 2025/01/15
- [PULL 39/48] acpi/ghes: better name the offset of the hardware error firmware, Michael S. Tsirkin, 2025/01/15
- [PULL 38/48] acpi/ghes: rename etc/hardware_error file macros, Michael S. Tsirkin, 2025/01/15
- [PULL 42/48] docs: acpi_hest_ghes: fix documentation for CPER size, Michael S. Tsirkin, 2025/01/15