2012-10-08 20:17:39 +02:00
|
|
|
/*
|
|
|
|
* QEMU PowerPC pSeries Logical Partition (aka sPAPR) hardware System Emulator
|
|
|
|
*
|
|
|
|
* RTAS events handling
|
|
|
|
*
|
|
|
|
* Copyright (c) 2012 David Gibson, IBM Corporation.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
2019-08-12 07:23:42 +02:00
|
|
|
|
2016-01-26 19:16:58 +01:00
|
|
|
#include "qemu/osdep.h"
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 09:01:28 +01:00
|
|
|
#include "qapi/error.h"
|
2012-10-08 20:17:39 +02:00
|
|
|
#include "cpu.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/device_tree.h"
|
2019-08-12 07:23:59 +02:00
|
|
|
#include "sysemu/runstate.h"
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2016-07-25 16:24:41 +02:00
|
|
|
#include "hw/ppc/fdt.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/ppc/spapr.h"
|
|
|
|
#include "hw/ppc/spapr_vio.h"
|
2015-05-07 07:33:49 +02:00
|
|
|
#include "hw/pci/pci.h"
|
2019-08-12 07:23:42 +02:00
|
|
|
#include "hw/irq.h"
|
2015-05-07 07:33:49 +02:00
|
|
|
#include "hw/pci-host/spapr.h"
|
|
|
|
#include "hw/ppc/spapr_drc.h"
|
2016-03-20 18:16:19 +01:00
|
|
|
#include "qemu/help_option.h"
|
|
|
|
#include "qemu/bcd.h"
|
2020-01-30 19:44:19 +01:00
|
|
|
#include "qemu/main-loop.h"
|
2016-10-27 04:20:26 +02:00
|
|
|
#include "hw/ppc/spapr_ovec.h"
|
2012-10-08 20:17:39 +02:00
|
|
|
#include <libfdt.h>
|
2020-01-30 19:44:22 +01:00
|
|
|
#include "migration/blocker.h"
|
2012-10-08 20:17:39 +02:00
|
|
|
|
|
|
|
#define RTAS_LOG_VERSION_MASK 0xff000000
|
|
|
|
#define RTAS_LOG_VERSION_6 0x06000000
|
|
|
|
#define RTAS_LOG_SEVERITY_MASK 0x00e00000
|
|
|
|
#define RTAS_LOG_SEVERITY_ALREADY_REPORTED 0x00c00000
|
|
|
|
#define RTAS_LOG_SEVERITY_FATAL 0x00a00000
|
|
|
|
#define RTAS_LOG_SEVERITY_ERROR 0x00800000
|
|
|
|
#define RTAS_LOG_SEVERITY_ERROR_SYNC 0x00600000
|
|
|
|
#define RTAS_LOG_SEVERITY_WARNING 0x00400000
|
|
|
|
#define RTAS_LOG_SEVERITY_EVENT 0x00200000
|
|
|
|
#define RTAS_LOG_SEVERITY_NO_ERROR 0x00000000
|
|
|
|
#define RTAS_LOG_DISPOSITION_MASK 0x00180000
|
|
|
|
#define RTAS_LOG_DISPOSITION_FULLY_RECOVERED 0x00000000
|
|
|
|
#define RTAS_LOG_DISPOSITION_LIMITED_RECOVERY 0x00080000
|
|
|
|
#define RTAS_LOG_DISPOSITION_NOT_RECOVERED 0x00100000
|
|
|
|
#define RTAS_LOG_OPTIONAL_PART_PRESENT 0x00040000
|
|
|
|
#define RTAS_LOG_INITIATOR_MASK 0x0000f000
|
|
|
|
#define RTAS_LOG_INITIATOR_UNKNOWN 0x00000000
|
|
|
|
#define RTAS_LOG_INITIATOR_CPU 0x00001000
|
|
|
|
#define RTAS_LOG_INITIATOR_PCI 0x00002000
|
|
|
|
#define RTAS_LOG_INITIATOR_MEMORY 0x00004000
|
|
|
|
#define RTAS_LOG_INITIATOR_HOTPLUG 0x00006000
|
|
|
|
#define RTAS_LOG_TARGET_MASK 0x00000f00
|
|
|
|
#define RTAS_LOG_TARGET_UNKNOWN 0x00000000
|
|
|
|
#define RTAS_LOG_TARGET_CPU 0x00000100
|
|
|
|
#define RTAS_LOG_TARGET_PCI 0x00000200
|
|
|
|
#define RTAS_LOG_TARGET_MEMORY 0x00000400
|
|
|
|
#define RTAS_LOG_TARGET_HOTPLUG 0x00000600
|
|
|
|
#define RTAS_LOG_TYPE_MASK 0x000000ff
|
|
|
|
#define RTAS_LOG_TYPE_OTHER 0x00000000
|
|
|
|
#define RTAS_LOG_TYPE_RETRY 0x00000001
|
|
|
|
#define RTAS_LOG_TYPE_TCE_ERR 0x00000002
|
|
|
|
#define RTAS_LOG_TYPE_INTERN_DEV_FAIL 0x00000003
|
|
|
|
#define RTAS_LOG_TYPE_TIMEOUT 0x00000004
|
|
|
|
#define RTAS_LOG_TYPE_DATA_PARITY 0x00000005
|
|
|
|
#define RTAS_LOG_TYPE_ADDR_PARITY 0x00000006
|
|
|
|
#define RTAS_LOG_TYPE_CACHE_PARITY 0x00000007
|
|
|
|
#define RTAS_LOG_TYPE_ADDR_INVALID 0x00000008
|
|
|
|
#define RTAS_LOG_TYPE_ECC_UNCORR 0x00000009
|
|
|
|
#define RTAS_LOG_TYPE_ECC_CORR 0x0000000a
|
|
|
|
#define RTAS_LOG_TYPE_EPOW 0x00000040
|
2015-05-07 07:33:49 +02:00
|
|
|
#define RTAS_LOG_TYPE_HOTPLUG 0x000000e5
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2017-07-12 03:55:53 +02:00
|
|
|
struct rtas_error_log {
|
|
|
|
uint32_t summary;
|
|
|
|
uint32_t extended_length;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2012-10-08 20:17:39 +02:00
|
|
|
struct rtas_event_log_v6 {
|
|
|
|
uint8_t b0;
|
|
|
|
#define RTAS_LOG_V6_B0_VALID 0x80
|
|
|
|
#define RTAS_LOG_V6_B0_UNRECOVERABLE_ERROR 0x40
|
|
|
|
#define RTAS_LOG_V6_B0_RECOVERABLE_ERROR 0x20
|
|
|
|
#define RTAS_LOG_V6_B0_DEGRADED_OPERATION 0x10
|
|
|
|
#define RTAS_LOG_V6_B0_PREDICTIVE_ERROR 0x08
|
|
|
|
#define RTAS_LOG_V6_B0_NEW_LOG 0x04
|
|
|
|
#define RTAS_LOG_V6_B0_BIGENDIAN 0x02
|
|
|
|
uint8_t _resv1;
|
|
|
|
uint8_t b2;
|
|
|
|
#define RTAS_LOG_V6_B2_POWERPC_FORMAT 0x80
|
|
|
|
#define RTAS_LOG_V6_B2_LOG_FORMAT_MASK 0x0f
|
|
|
|
#define RTAS_LOG_V6_B2_LOG_FORMAT_PLATFORM_EVENT 0x0e
|
|
|
|
uint8_t _resv2[9];
|
|
|
|
uint32_t company;
|
|
|
|
#define RTAS_LOG_V6_COMPANY_IBM 0x49424d00 /* IBM<null> */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
struct rtas_event_log_v6_section_header {
|
|
|
|
uint16_t section_id;
|
|
|
|
uint16_t section_length;
|
|
|
|
uint8_t section_version;
|
|
|
|
uint8_t section_subtype;
|
|
|
|
uint16_t creator_component_id;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
struct rtas_event_log_v6_maina {
|
|
|
|
#define RTAS_LOG_V6_SECTION_ID_MAINA 0x5048 /* PH */
|
|
|
|
struct rtas_event_log_v6_section_header hdr;
|
|
|
|
uint32_t creation_date; /* BCD: YYYYMMDD */
|
|
|
|
uint32_t creation_time; /* BCD: HHMMSS00 */
|
|
|
|
uint8_t _platform1[8];
|
|
|
|
char creator_id;
|
|
|
|
uint8_t _resv1[2];
|
|
|
|
uint8_t section_count;
|
|
|
|
uint8_t _resv2[4];
|
|
|
|
uint8_t _platform2[8];
|
|
|
|
uint32_t plid;
|
|
|
|
uint8_t _platform3[4];
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
struct rtas_event_log_v6_mainb {
|
|
|
|
#define RTAS_LOG_V6_SECTION_ID_MAINB 0x5548 /* UH */
|
|
|
|
struct rtas_event_log_v6_section_header hdr;
|
|
|
|
uint8_t subsystem_id;
|
|
|
|
uint8_t _platform1;
|
|
|
|
uint8_t event_severity;
|
|
|
|
uint8_t event_subtype;
|
|
|
|
uint8_t _platform2[4];
|
|
|
|
uint8_t _resv1[2];
|
|
|
|
uint16_t action_flags;
|
|
|
|
uint8_t _resv2[4];
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
struct rtas_event_log_v6_epow {
|
|
|
|
#define RTAS_LOG_V6_SECTION_ID_EPOW 0x4550 /* EP */
|
|
|
|
struct rtas_event_log_v6_section_header hdr;
|
|
|
|
uint8_t sensor_value;
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_RESET 0
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_WARN_COOLING 1
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_WARN_POWER 2
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_SYSTEM_SHUTDOWN 3
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_SYSTEM_HALT 4
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_MAIN_ENCLOSURE 5
|
|
|
|
#define RTAS_LOG_V6_EPOW_ACTION_POWER_OFF 7
|
|
|
|
uint8_t event_modifier;
|
|
|
|
#define RTAS_LOG_V6_EPOW_MODIFIER_NORMAL 1
|
|
|
|
#define RTAS_LOG_V6_EPOW_MODIFIER_ON_UPS 2
|
|
|
|
#define RTAS_LOG_V6_EPOW_MODIFIER_CRITICAL 3
|
|
|
|
#define RTAS_LOG_V6_EPOW_MODIFIER_TEMPERATURE 4
|
|
|
|
uint8_t extended_modifier;
|
|
|
|
#define RTAS_LOG_V6_EPOW_XMODIFIER_SYSTEM_WIDE 0
|
|
|
|
#define RTAS_LOG_V6_EPOW_XMODIFIER_PARTITION_SPECIFIC 1
|
|
|
|
uint8_t _resv;
|
|
|
|
uint64_t reason_code;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2017-07-11 20:07:55 +02:00
|
|
|
struct epow_extended_log {
|
2012-10-08 20:17:39 +02:00
|
|
|
struct rtas_event_log_v6 v6hdr;
|
|
|
|
struct rtas_event_log_v6_maina maina;
|
|
|
|
struct rtas_event_log_v6_mainb mainb;
|
|
|
|
struct rtas_event_log_v6_epow epow;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier {
|
|
|
|
uint32_t index;
|
|
|
|
uint32_t count;
|
|
|
|
struct {
|
|
|
|
uint32_t count;
|
|
|
|
uint32_t index;
|
|
|
|
} count_indexed;
|
|
|
|
char name[1];
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2015-05-07 07:33:49 +02:00
|
|
|
struct rtas_event_log_v6_hp {
|
|
|
|
#define RTAS_LOG_V6_SECTION_ID_HOTPLUG 0x4850 /* HP */
|
|
|
|
struct rtas_event_log_v6_section_header hdr;
|
|
|
|
uint8_t hotplug_type;
|
|
|
|
#define RTAS_LOG_V6_HP_TYPE_CPU 1
|
|
|
|
#define RTAS_LOG_V6_HP_TYPE_MEMORY 2
|
|
|
|
#define RTAS_LOG_V6_HP_TYPE_SLOT 3
|
|
|
|
#define RTAS_LOG_V6_HP_TYPE_PHB 4
|
|
|
|
#define RTAS_LOG_V6_HP_TYPE_PCI 5
|
spapr: Add NVDIMM device support
Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
device interface in QEMU to support virtual NVDIMM devices for Power.
Create the required DT entries for the device (some entries have
dummy values right now).
The patch creates the required DT node and sends a hotplug
interrupt to the guest. Guest is expected to undertake the normal
DR resource add path in response and start issuing PAPR SCM hcalls.
The device support is verified based on the machine version unlike x86.
This is how it can be used ..
Ex :
For coldplug, the device to be added in qemu command line as shown below
-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
-device nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
For hotplug, the device to be added from monitor as below
object_add memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
device_add nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
[Early implementation]
Message-Id: <158131058078.2897.12767731856697459923.stgit@lep8c.aus.stglabs.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-02-10 05:56:31 +01:00
|
|
|
#define RTAS_LOG_V6_HP_TYPE_PMEM 6
|
2015-05-07 07:33:49 +02:00
|
|
|
uint8_t hotplug_action;
|
|
|
|
#define RTAS_LOG_V6_HP_ACTION_ADD 1
|
|
|
|
#define RTAS_LOG_V6_HP_ACTION_REMOVE 2
|
|
|
|
uint8_t hotplug_identifier;
|
|
|
|
#define RTAS_LOG_V6_HP_ID_DRC_NAME 1
|
|
|
|
#define RTAS_LOG_V6_HP_ID_DRC_INDEX 2
|
|
|
|
#define RTAS_LOG_V6_HP_ID_DRC_COUNT 3
|
2016-10-27 04:20:28 +02:00
|
|
|
#define RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED 4
|
2015-05-07 07:33:49 +02:00
|
|
|
uint8_t reserved;
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier drc_id;
|
2015-05-07 07:33:49 +02:00
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2017-07-11 20:07:55 +02:00
|
|
|
struct hp_extended_log {
|
2015-05-07 07:33:49 +02:00
|
|
|
struct rtas_event_log_v6 v6hdr;
|
|
|
|
struct rtas_event_log_v6_maina maina;
|
|
|
|
struct rtas_event_log_v6_mainb mainb;
|
|
|
|
struct rtas_event_log_v6_hp hp;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2020-01-30 19:44:20 +01:00
|
|
|
struct rtas_event_log_v6_mc {
|
|
|
|
#define RTAS_LOG_V6_SECTION_ID_MC 0x4D43 /* MC */
|
|
|
|
struct rtas_event_log_v6_section_header hdr;
|
|
|
|
uint32_t fru_id;
|
|
|
|
uint32_t proc_id;
|
|
|
|
uint8_t error_type;
|
|
|
|
#define RTAS_LOG_V6_MC_TYPE_UE 0
|
|
|
|
#define RTAS_LOG_V6_MC_TYPE_SLB 1
|
|
|
|
#define RTAS_LOG_V6_MC_TYPE_ERAT 2
|
|
|
|
#define RTAS_LOG_V6_MC_TYPE_TLB 4
|
|
|
|
#define RTAS_LOG_V6_MC_TYPE_D_CACHE 5
|
|
|
|
#define RTAS_LOG_V6_MC_TYPE_I_CACHE 7
|
|
|
|
uint8_t sub_err_type;
|
|
|
|
#define RTAS_LOG_V6_MC_UE_INDETERMINATE 0
|
|
|
|
#define RTAS_LOG_V6_MC_UE_IFETCH 1
|
|
|
|
#define RTAS_LOG_V6_MC_UE_PAGE_TABLE_WALK_IFETCH 2
|
|
|
|
#define RTAS_LOG_V6_MC_UE_LOAD_STORE 3
|
|
|
|
#define RTAS_LOG_V6_MC_UE_PAGE_TABLE_WALK_LOAD_STORE 4
|
|
|
|
#define RTAS_LOG_V6_MC_SLB_PARITY 0
|
|
|
|
#define RTAS_LOG_V6_MC_SLB_MULTIHIT 1
|
|
|
|
#define RTAS_LOG_V6_MC_SLB_INDETERMINATE 2
|
|
|
|
#define RTAS_LOG_V6_MC_ERAT_PARITY 1
|
|
|
|
#define RTAS_LOG_V6_MC_ERAT_MULTIHIT 2
|
|
|
|
#define RTAS_LOG_V6_MC_ERAT_INDETERMINATE 3
|
|
|
|
#define RTAS_LOG_V6_MC_TLB_PARITY 1
|
|
|
|
#define RTAS_LOG_V6_MC_TLB_MULTIHIT 2
|
|
|
|
#define RTAS_LOG_V6_MC_TLB_INDETERMINATE 3
|
2020-03-18 08:34:20 +01:00
|
|
|
/*
|
|
|
|
* Per PAPR,
|
|
|
|
* For UE error type, set bit 1 of sub_err_type to indicate effective addr is
|
|
|
|
* provided. For other error types (SLB/ERAT/TLB), set bit 0 to indicate
|
|
|
|
* same.
|
|
|
|
*/
|
|
|
|
#define RTAS_LOG_V6_MC_UE_EA_ADDR_PROVIDED 0x40
|
|
|
|
#define RTAS_LOG_V6_MC_EA_ADDR_PROVIDED 0x80
|
2020-01-30 19:44:20 +01:00
|
|
|
uint8_t reserved_1[6];
|
|
|
|
uint64_t effective_address;
|
|
|
|
uint64_t logical_address;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
struct mc_extended_log {
|
|
|
|
struct rtas_event_log_v6 v6hdr;
|
|
|
|
struct rtas_event_log_v6_mc mc;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
struct MC_ierror_table {
|
|
|
|
unsigned long srr1_mask;
|
|
|
|
unsigned long srr1_value;
|
|
|
|
bool nip_valid; /* nip is a valid indicator of faulting address */
|
|
|
|
uint8_t error_type;
|
|
|
|
uint8_t error_subtype;
|
|
|
|
unsigned int initiator;
|
|
|
|
unsigned int severity;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct MC_ierror_table mc_ierror_table[] = {
|
|
|
|
{ 0x00000000081c0000, 0x0000000000040000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_UE, RTAS_LOG_V6_MC_UE_IFETCH,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000080000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_SLB, RTAS_LOG_V6_MC_SLB_PARITY,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000000081c0000, 0x00000000000c0000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_SLB, RTAS_LOG_V6_MC_SLB_MULTIHIT,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000100000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_ERAT, RTAS_LOG_V6_MC_ERAT_MULTIHIT,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000140000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_TLB, RTAS_LOG_V6_MC_TLB_MULTIHIT,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000180000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_UE, RTAS_LOG_V6_MC_UE_PAGE_TABLE_WALK_IFETCH,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, } };
|
|
|
|
|
|
|
|
struct MC_derror_table {
|
|
|
|
unsigned long dsisr_value;
|
|
|
|
bool dar_valid; /* dar is a valid indicator of faulting address */
|
|
|
|
uint8_t error_type;
|
|
|
|
uint8_t error_subtype;
|
|
|
|
unsigned int initiator;
|
|
|
|
unsigned int severity;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct MC_derror_table mc_derror_table[] = {
|
|
|
|
{ 0x00008000, false,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_UE, RTAS_LOG_V6_MC_UE_LOAD_STORE,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00004000, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_UE, RTAS_LOG_V6_MC_UE_PAGE_TABLE_WALK_LOAD_STORE,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000800, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_ERAT, RTAS_LOG_V6_MC_ERAT_MULTIHIT,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000400, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_TLB, RTAS_LOG_V6_MC_TLB_MULTIHIT,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000080, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_SLB, RTAS_LOG_V6_MC_SLB_MULTIHIT, /* Before PARITY */
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, },
|
|
|
|
{ 0x00000100, true,
|
|
|
|
RTAS_LOG_V6_MC_TYPE_SLB, RTAS_LOG_V6_MC_SLB_PARITY,
|
|
|
|
RTAS_LOG_INITIATOR_CPU, RTAS_LOG_SEVERITY_ERROR_SYNC, } };
|
|
|
|
|
|
|
|
#define SRR1_MC_LOADSTORE(srr1) ((srr1) & PPC_BIT(42))
|
|
|
|
|
2016-10-27 04:20:26 +02:00
|
|
|
typedef enum EventClass {
|
|
|
|
EVENT_CLASS_INTERNAL_ERRORS = 0,
|
|
|
|
EVENT_CLASS_EPOW = 1,
|
|
|
|
EVENT_CLASS_RESERVED = 2,
|
|
|
|
EVENT_CLASS_HOT_PLUG = 3,
|
|
|
|
EVENT_CLASS_IO = 4,
|
|
|
|
EVENT_CLASS_MAX
|
|
|
|
} EventClassIndex;
|
|
|
|
#define EVENT_CLASS_MASK(index) (1 << (31 - index))
|
|
|
|
|
|
|
|
static const char * const event_names[EVENT_CLASS_MAX] = {
|
|
|
|
[EVENT_CLASS_INTERNAL_ERRORS] = "internal-errors",
|
|
|
|
[EVENT_CLASS_EPOW] = "epow-events",
|
|
|
|
[EVENT_CLASS_HOT_PLUG] = "hot-plug-events",
|
|
|
|
[EVENT_CLASS_IO] = "ibm,io-events",
|
|
|
|
};
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
struct SpaprEventSource {
|
2016-10-27 04:20:26 +02:00
|
|
|
int irq;
|
|
|
|
uint32_t mask;
|
|
|
|
bool enabled;
|
|
|
|
};
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static SpaprEventSource *spapr_event_sources_new(void)
|
2016-10-27 04:20:26 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
return g_new0(SpaprEventSource, EVENT_CLASS_MAX);
|
2016-10-27 04:20:26 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static void spapr_event_sources_register(SpaprEventSource *event_sources,
|
2016-10-27 04:20:26 +02:00
|
|
|
EventClassIndex index, int irq)
|
|
|
|
{
|
|
|
|
/* we only support 1 irq per event class at the moment */
|
|
|
|
g_assert(event_sources);
|
|
|
|
g_assert(!event_sources[index].enabled);
|
|
|
|
event_sources[index].irq = irq;
|
|
|
|
event_sources[index].mask = EVENT_CLASS_MASK(index);
|
|
|
|
event_sources[index].enabled = true;
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static const SpaprEventSource *
|
|
|
|
spapr_event_sources_get_source(SpaprEventSource *event_sources,
|
2016-10-27 04:20:26 +02:00
|
|
|
EventClassIndex index)
|
|
|
|
{
|
|
|
|
g_assert(index < EVENT_CLASS_MAX);
|
|
|
|
g_assert(event_sources);
|
|
|
|
|
|
|
|
return &event_sources[index];
|
|
|
|
}
|
2012-10-08 20:17:39 +02:00
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_dt_events(SpaprMachineState *spapr, void *fdt)
|
2012-10-08 20:17:39 +02:00
|
|
|
{
|
2016-10-27 04:20:26 +02:00
|
|
|
uint32_t irq_ranges[EVENT_CLASS_MAX * 2];
|
|
|
|
int i, count = 0, event_sources;
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprEventSource *events = spapr->event_sources;
|
2016-10-27 04:20:26 +02:00
|
|
|
|
|
|
|
g_assert(events);
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2016-10-20 06:56:48 +02:00
|
|
|
_FDT(event_sources = fdt_add_subnode(fdt, 0, "event-sources"));
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2016-10-27 04:20:26 +02:00
|
|
|
for (i = 0, count = 0; i < EVENT_CLASS_MAX; i++) {
|
|
|
|
int node_offset;
|
|
|
|
uint32_t interrupts[2];
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
const SpaprEventSource *source =
|
2016-10-27 04:20:26 +02:00
|
|
|
spapr_event_sources_get_source(events, i);
|
|
|
|
const char *source_name = event_names[i];
|
|
|
|
|
|
|
|
if (!source->enabled) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-01-17 18:14:39 +01:00
|
|
|
spapr_dt_irq(interrupts, source->irq, false);
|
2016-10-27 04:20:26 +02:00
|
|
|
|
|
|
|
_FDT(node_offset = fdt_add_subnode(fdt, event_sources, source_name));
|
|
|
|
_FDT(fdt_setprop(fdt, node_offset, "interrupts", interrupts,
|
|
|
|
sizeof(interrupts)));
|
|
|
|
|
|
|
|
irq_ranges[count++] = interrupts[0];
|
|
|
|
irq_ranges[count++] = cpu_to_be32(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
_FDT((fdt_setprop(fdt, event_sources, "interrupt-controller", NULL, 0)));
|
|
|
|
_FDT((fdt_setprop_cell(fdt, event_sources, "#interrupt-cells", 2)));
|
|
|
|
_FDT((fdt_setprop(fdt, event_sources, "interrupt-ranges",
|
|
|
|
irq_ranges, count * sizeof(uint32_t))));
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static const SpaprEventSource *
|
|
|
|
rtas_event_log_to_source(SpaprMachineState *spapr, int log_type)
|
2016-10-27 04:20:26 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
const SpaprEventSource *source;
|
2016-10-27 04:20:26 +02:00
|
|
|
|
|
|
|
g_assert(spapr->event_sources);
|
|
|
|
|
|
|
|
switch (log_type) {
|
|
|
|
case RTAS_LOG_TYPE_HOTPLUG:
|
|
|
|
source = spapr_event_sources_get_source(spapr->event_sources,
|
|
|
|
EVENT_CLASS_HOT_PLUG);
|
|
|
|
if (spapr_ovec_test(spapr->ov5_cas, OV5_HP_EVT)) {
|
|
|
|
g_assert(source->enabled);
|
|
|
|
break;
|
|
|
|
}
|
2019-07-19 15:14:25 +02:00
|
|
|
/* fall through back to epow for legacy hotplug interrupt source */
|
2016-10-27 04:20:26 +02:00
|
|
|
case RTAS_LOG_TYPE_EPOW:
|
|
|
|
source = spapr_event_sources_get_source(spapr->event_sources,
|
|
|
|
EVENT_CLASS_EPOW);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
source = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static int rtas_event_log_to_irq(SpaprMachineState *spapr, int log_type)
|
2016-10-27 04:20:26 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
const SpaprEventSource *source;
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2016-10-27 04:20:26 +02:00
|
|
|
source = rtas_event_log_to_source(spapr, log_type);
|
|
|
|
g_assert(source);
|
|
|
|
g_assert(source->enabled);
|
|
|
|
|
|
|
|
return source->irq;
|
2012-10-08 20:17:39 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static uint32_t spapr_event_log_entry_type(SpaprEventLogEntry *entry)
|
2015-05-07 07:33:49 +02:00
|
|
|
{
|
2017-07-12 03:55:53 +02:00
|
|
|
return entry->summary & RTAS_LOG_TYPE_MASK;
|
2017-07-11 20:07:55 +02:00
|
|
|
}
|
2012-10-08 20:17:39 +02:00
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static void rtas_event_log_queue(SpaprMachineState *spapr,
|
|
|
|
SpaprEventLogEntry *entry)
|
2017-07-11 20:07:55 +02:00
|
|
|
{
|
2015-05-07 07:33:49 +02:00
|
|
|
QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next);
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static SpaprEventLogEntry *rtas_event_log_dequeue(SpaprMachineState *spapr,
|
2017-07-11 20:07:55 +02:00
|
|
|
uint32_t event_mask)
|
2012-10-08 20:17:39 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprEventLogEntry *entry = NULL;
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2015-05-07 07:33:49 +02:00
|
|
|
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
const SpaprEventSource *source =
|
2017-07-11 20:07:55 +02:00
|
|
|
rtas_event_log_to_source(spapr,
|
|
|
|
spapr_event_log_entry_type(entry));
|
2016-10-27 04:20:26 +02:00
|
|
|
|
2019-11-25 13:34:51 +01:00
|
|
|
g_assert(source);
|
2016-10-27 04:20:26 +02:00
|
|
|
if (source->mask & event_mask) {
|
2015-05-07 07:33:49 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entry) {
|
|
|
|
QTAILQ_REMOVE(&spapr->pending_events, entry, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
hw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry
Currenty we do not have any RTAS event that is reported by the
event-scan interface. The existing events, RTAS_LOG_TYPE_EPOW and
RTAS_LOG_TYPE_HOTPLUG, are being reported by the check-exception
interface and, as such, marked as 'exception=true'.
Commit 79853e18d9, 'spapr_events: event-scan RTAS interface', added
the event_scan interface because the guest kernel requires it to
initialize other required interfaces. It is acting since then as
a stub because no events that would be reported by it were added
since then. However, the existence of the 'exception' boolean adds
an unnecessary load in the future migration of the pending_events,
sPAPREventLogEntry QTAILQ that hosts the pending RTAS events.
To make the code cleaner and ease the future migration changes, this
patch makes the following changes:
- remove the 'exception' boolean that filter these events. There is
nothing to filter since all events are reported by check-exception;
- functions rtas_event_log_queue, rtas_event_log_dequeue and
rtas_event_log_contains don't receive the 'exception' boolean
as parameter;
- event_scan function was simplified. It was calling
'rtas_event_log_dequeue(mask, false)' that was always returning
'NULL' because we have no events that are created with
exception=false, thus in the end it would execute a jump to
'out_no_events' all the time. The function now assumes that
this will always be the case and all the remaining logic were
deleted.
In the future, when or if we add new RTAS events that should
be reported with the event_scan interface, we can refer to
the changes made in this patch to add the event_scan logic
back.
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-19 16:27:49 +02:00
|
|
|
static bool rtas_event_log_contains(uint32_t event_mask)
|
2015-05-07 07:33:49 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
|
|
|
SpaprEventLogEntry *entry = NULL;
|
2015-05-07 07:33:49 +02:00
|
|
|
|
|
|
|
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
const SpaprEventSource *source =
|
2017-07-11 20:07:55 +02:00
|
|
|
rtas_event_log_to_source(spapr,
|
|
|
|
spapr_event_log_entry_type(entry));
|
2016-10-27 04:20:26 +02:00
|
|
|
|
|
|
|
if (source->mask & event_mask) {
|
2015-05-07 07:33:49 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2015-05-07 07:33:49 +02:00
|
|
|
static uint32_t next_plid;
|
|
|
|
|
|
|
|
static void spapr_init_v6hdr(struct rtas_event_log_v6 *v6hdr)
|
|
|
|
{
|
2012-10-08 20:17:39 +02:00
|
|
|
v6hdr->b0 = RTAS_LOG_V6_B0_VALID | RTAS_LOG_V6_B0_NEW_LOG
|
|
|
|
| RTAS_LOG_V6_B0_BIGENDIAN;
|
|
|
|
v6hdr->b2 = RTAS_LOG_V6_B2_POWERPC_FORMAT
|
|
|
|
| RTAS_LOG_V6_B2_LOG_FORMAT_PLATFORM_EVENT;
|
|
|
|
v6hdr->company = cpu_to_be32(RTAS_LOG_V6_COMPANY_IBM);
|
2015-05-07 07:33:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void spapr_init_maina(struct rtas_event_log_v6_maina *maina,
|
|
|
|
int section_count)
|
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
2015-05-07 07:33:49 +02:00
|
|
|
struct tm tm;
|
|
|
|
int year;
|
2012-10-08 20:17:39 +02:00
|
|
|
|
|
|
|
maina->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINA);
|
|
|
|
maina->hdr.section_length = cpu_to_be16(sizeof(*maina));
|
|
|
|
/* FIXME: section version, subtype and creator id? */
|
2017-03-07 10:23:40 +01:00
|
|
|
spapr_rtc_read(&spapr->rtc, &tm, NULL);
|
2012-10-08 20:17:39 +02:00
|
|
|
year = tm.tm_year + 1900;
|
|
|
|
maina->creation_date = cpu_to_be32((to_bcd(year / 100) << 24)
|
|
|
|
| (to_bcd(year % 100) << 16)
|
|
|
|
| (to_bcd(tm.tm_mon + 1) << 8)
|
|
|
|
| to_bcd(tm.tm_mday));
|
|
|
|
maina->creation_time = cpu_to_be32((to_bcd(tm.tm_hour) << 24)
|
|
|
|
| (to_bcd(tm.tm_min) << 16)
|
|
|
|
| (to_bcd(tm.tm_sec) << 8));
|
|
|
|
maina->creator_id = 'H'; /* Hypervisor */
|
2015-05-07 07:33:49 +02:00
|
|
|
maina->section_count = section_count;
|
2012-10-08 20:17:39 +02:00
|
|
|
maina->plid = next_plid++;
|
2015-05-07 07:33:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void spapr_powerdown_req(Notifier *n, void *opaque)
|
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
|
|
|
SpaprEventLogEntry *entry;
|
2015-05-07 07:33:49 +02:00
|
|
|
struct rtas_event_log_v6 *v6hdr;
|
|
|
|
struct rtas_event_log_v6_maina *maina;
|
|
|
|
struct rtas_event_log_v6_mainb *mainb;
|
|
|
|
struct rtas_event_log_v6_epow *epow;
|
2017-07-11 20:07:55 +02:00
|
|
|
struct epow_extended_log *new_epow;
|
2015-05-07 07:33:49 +02:00
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
entry = g_new(SpaprEventLogEntry, 1);
|
2015-05-07 07:33:49 +02:00
|
|
|
new_epow = g_malloc0(sizeof(*new_epow));
|
2017-07-11 20:07:55 +02:00
|
|
|
entry->extended_log = new_epow;
|
|
|
|
|
2015-05-07 07:33:49 +02:00
|
|
|
v6hdr = &new_epow->v6hdr;
|
|
|
|
maina = &new_epow->maina;
|
|
|
|
mainb = &new_epow->mainb;
|
|
|
|
epow = &new_epow->epow;
|
|
|
|
|
2017-07-12 03:55:53 +02:00
|
|
|
entry->summary = RTAS_LOG_VERSION_6
|
2017-07-11 20:07:55 +02:00
|
|
|
| RTAS_LOG_SEVERITY_EVENT
|
|
|
|
| RTAS_LOG_DISPOSITION_NOT_RECOVERED
|
|
|
|
| RTAS_LOG_OPTIONAL_PART_PRESENT
|
|
|
|
| RTAS_LOG_TYPE_EPOW;
|
2017-07-12 03:55:53 +02:00
|
|
|
entry->extended_length = sizeof(*new_epow);
|
2015-05-07 07:33:49 +02:00
|
|
|
|
|
|
|
spapr_init_v6hdr(v6hdr);
|
|
|
|
spapr_init_maina(maina, 3 /* Main-A, Main-B and EPOW */);
|
2012-10-08 20:17:39 +02:00
|
|
|
|
|
|
|
mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);
|
|
|
|
mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb));
|
|
|
|
/* FIXME: section version, subtype and creator id? */
|
|
|
|
mainb->subsystem_id = 0xa0; /* External environment */
|
|
|
|
mainb->event_severity = 0x00; /* Informational / non-error */
|
|
|
|
mainb->event_subtype = 0xd0; /* Normal shutdown */
|
|
|
|
|
|
|
|
epow->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_EPOW);
|
|
|
|
epow->hdr.section_length = cpu_to_be16(sizeof(*epow));
|
|
|
|
epow->hdr.section_version = 2; /* includes extended modifier */
|
|
|
|
/* FIXME: section subtype and creator id? */
|
|
|
|
epow->sensor_value = RTAS_LOG_V6_EPOW_ACTION_SYSTEM_SHUTDOWN;
|
|
|
|
epow->event_modifier = RTAS_LOG_V6_EPOW_MODIFIER_NORMAL;
|
|
|
|
epow->extended_modifier = RTAS_LOG_V6_EPOW_XMODIFIER_PARTITION_SPECIFIC;
|
|
|
|
|
2017-07-11 20:07:55 +02:00
|
|
|
rtas_event_log_queue(spapr, entry);
|
2015-05-07 07:33:49 +02:00
|
|
|
|
2017-12-01 17:06:04 +01:00
|
|
|
qemu_irq_pulse(spapr_qirq(spapr,
|
|
|
|
rtas_event_log_to_irq(spapr, RTAS_LOG_TYPE_EPOW)));
|
2015-05-07 07:33:49 +02:00
|
|
|
}
|
|
|
|
|
2015-08-03 07:35:42 +02:00
|
|
|
static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action,
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprDrcType drc_type,
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier *drc_id)
|
2015-05-07 07:33:49 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
|
|
|
SpaprEventLogEntry *entry;
|
2017-07-11 20:07:55 +02:00
|
|
|
struct hp_extended_log *new_hp;
|
2015-05-07 07:33:49 +02:00
|
|
|
struct rtas_event_log_v6 *v6hdr;
|
|
|
|
struct rtas_event_log_v6_maina *maina;
|
|
|
|
struct rtas_event_log_v6_mainb *mainb;
|
|
|
|
struct rtas_event_log_v6_hp *hp;
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
entry = g_new(SpaprEventLogEntry, 1);
|
2017-07-11 20:07:55 +02:00
|
|
|
new_hp = g_malloc0(sizeof(struct hp_extended_log));
|
|
|
|
entry->extended_log = new_hp;
|
|
|
|
|
2015-05-07 07:33:49 +02:00
|
|
|
v6hdr = &new_hp->v6hdr;
|
|
|
|
maina = &new_hp->maina;
|
|
|
|
mainb = &new_hp->mainb;
|
|
|
|
hp = &new_hp->hp;
|
|
|
|
|
2017-07-12 03:55:53 +02:00
|
|
|
entry->summary = RTAS_LOG_VERSION_6
|
|
|
|
| RTAS_LOG_SEVERITY_EVENT
|
|
|
|
| RTAS_LOG_DISPOSITION_NOT_RECOVERED
|
|
|
|
| RTAS_LOG_OPTIONAL_PART_PRESENT
|
|
|
|
| RTAS_LOG_INITIATOR_HOTPLUG
|
|
|
|
| RTAS_LOG_TYPE_HOTPLUG;
|
|
|
|
entry->extended_length = sizeof(*new_hp);
|
2015-05-07 07:33:49 +02:00
|
|
|
|
|
|
|
spapr_init_v6hdr(v6hdr);
|
|
|
|
spapr_init_maina(maina, 3 /* Main-A, Main-B, HP */);
|
|
|
|
|
|
|
|
mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);
|
|
|
|
mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb));
|
|
|
|
mainb->subsystem_id = 0x80; /* External environment */
|
|
|
|
mainb->event_severity = 0x00; /* Informational / non-error */
|
|
|
|
mainb->event_subtype = 0x00; /* Normal shutdown */
|
|
|
|
|
|
|
|
hp->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG);
|
|
|
|
hp->hdr.section_length = cpu_to_be16(sizeof(*hp));
|
|
|
|
hp->hdr.section_version = 1; /* includes extended modifier */
|
|
|
|
hp->hotplug_action = hp_action;
|
2015-08-03 07:35:42 +02:00
|
|
|
hp->hotplug_identifier = hp_id;
|
2015-05-07 07:33:49 +02:00
|
|
|
|
|
|
|
switch (drc_type) {
|
|
|
|
case SPAPR_DR_CONNECTOR_TYPE_PCI:
|
|
|
|
hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;
|
|
|
|
break;
|
2015-09-01 03:22:35 +02:00
|
|
|
case SPAPR_DR_CONNECTOR_TYPE_LMB:
|
|
|
|
hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_MEMORY;
|
|
|
|
break;
|
2016-06-10 02:59:04 +02:00
|
|
|
case SPAPR_DR_CONNECTOR_TYPE_CPU:
|
|
|
|
hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_CPU;
|
|
|
|
break;
|
2019-02-19 18:18:34 +01:00
|
|
|
case SPAPR_DR_CONNECTOR_TYPE_PHB:
|
|
|
|
hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PHB;
|
|
|
|
break;
|
spapr: Add NVDIMM device support
Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
device interface in QEMU to support virtual NVDIMM devices for Power.
Create the required DT entries for the device (some entries have
dummy values right now).
The patch creates the required DT node and sends a hotplug
interrupt to the guest. Guest is expected to undertake the normal
DR resource add path in response and start issuing PAPR SCM hcalls.
The device support is verified based on the machine version unlike x86.
This is how it can be used ..
Ex :
For coldplug, the device to be added in qemu command line as shown below
-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
-device nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
For hotplug, the device to be added from monitor as below
object_add memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
device_add nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
[Early implementation]
Message-Id: <158131058078.2897.12767731856697459923.stgit@lep8c.aus.stglabs.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-02-10 05:56:31 +01:00
|
|
|
case SPAPR_DR_CONNECTOR_TYPE_PMEM:
|
|
|
|
hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PMEM;
|
|
|
|
break;
|
2015-05-07 07:33:49 +02:00
|
|
|
default:
|
|
|
|
/* we shouldn't be signaling hotplug events for resources
|
|
|
|
* that don't support them
|
|
|
|
*/
|
|
|
|
g_assert(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-08-03 07:35:42 +02:00
|
|
|
if (hp_id == RTAS_LOG_V6_HP_ID_DRC_COUNT) {
|
2016-10-27 04:20:28 +02:00
|
|
|
hp->drc_id.count = cpu_to_be32(drc_id->count);
|
2015-08-03 07:35:42 +02:00
|
|
|
} else if (hp_id == RTAS_LOG_V6_HP_ID_DRC_INDEX) {
|
2016-10-27 04:20:28 +02:00
|
|
|
hp->drc_id.index = cpu_to_be32(drc_id->index);
|
|
|
|
} else if (hp_id == RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED) {
|
|
|
|
/* we should not be using count_indexed value unless the guest
|
|
|
|
* supports dedicated hotplug event source
|
|
|
|
*/
|
|
|
|
g_assert(spapr_ovec_test(spapr->ov5_cas, OV5_HP_EVT));
|
|
|
|
hp->drc_id.count_indexed.count =
|
|
|
|
cpu_to_be32(drc_id->count_indexed.count);
|
|
|
|
hp->drc_id.count_indexed.index =
|
|
|
|
cpu_to_be32(drc_id->count_indexed.index);
|
2015-08-03 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
2017-07-11 20:07:55 +02:00
|
|
|
rtas_event_log_queue(spapr, entry);
|
2015-05-07 07:33:49 +02:00
|
|
|
|
2017-12-01 17:06:04 +01:00
|
|
|
qemu_irq_pulse(spapr_qirq(spapr,
|
|
|
|
rtas_event_log_to_irq(spapr, RTAS_LOG_TYPE_HOTPLUG)));
|
2015-05-07 07:33:49 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_hotplug_req_add_by_index(SpaprDrc *drc)
|
2015-08-03 07:35:42 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprDrcType drc_type = spapr_drc_type(drc);
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier drc_id;
|
2015-08-03 07:35:42 +02:00
|
|
|
|
2017-06-02 05:49:20 +02:00
|
|
|
drc_id.index = spapr_drc_index(drc);
|
2015-08-03 07:35:42 +02:00
|
|
|
spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX,
|
2016-10-27 04:20:28 +02:00
|
|
|
RTAS_LOG_V6_HP_ACTION_ADD, drc_type, &drc_id);
|
2015-08-03 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_hotplug_req_remove_by_index(SpaprDrc *drc)
|
2015-08-03 07:35:42 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprDrcType drc_type = spapr_drc_type(drc);
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier drc_id;
|
2015-08-03 07:35:42 +02:00
|
|
|
|
2017-06-02 05:49:20 +02:00
|
|
|
drc_id.index = spapr_drc_index(drc);
|
2015-08-03 07:35:42 +02:00
|
|
|
spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX,
|
2016-10-27 04:20:28 +02:00
|
|
|
RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc_id);
|
2015-08-03 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_hotplug_req_add_by_count(SpaprDrcType drc_type,
|
2015-08-03 07:35:42 +02:00
|
|
|
uint32_t count)
|
2015-05-07 07:33:49 +02:00
|
|
|
{
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier drc_id;
|
|
|
|
|
|
|
|
drc_id.count = count;
|
2015-08-03 07:35:42 +02:00
|
|
|
spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT,
|
2016-10-27 04:20:28 +02:00
|
|
|
RTAS_LOG_V6_HP_ACTION_ADD, drc_type, &drc_id);
|
2015-05-07 07:33:49 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_hotplug_req_remove_by_count(SpaprDrcType drc_type,
|
2015-08-03 07:35:42 +02:00
|
|
|
uint32_t count)
|
2015-05-07 07:33:49 +02:00
|
|
|
{
|
2016-10-27 04:20:28 +02:00
|
|
|
union drc_identifier drc_id;
|
|
|
|
|
|
|
|
drc_id.count = count;
|
2015-08-03 07:35:42 +02:00
|
|
|
spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT,
|
2016-10-27 04:20:28 +02:00
|
|
|
RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc_id);
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_hotplug_req_add_by_count_indexed(SpaprDrcType drc_type,
|
2016-10-27 04:20:28 +02:00
|
|
|
uint32_t count, uint32_t index)
|
|
|
|
{
|
|
|
|
union drc_identifier drc_id;
|
|
|
|
|
|
|
|
drc_id.count_indexed.count = count;
|
|
|
|
drc_id.count_indexed.index = index;
|
|
|
|
spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED,
|
|
|
|
RTAS_LOG_V6_HP_ACTION_ADD, drc_type, &drc_id);
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_hotplug_req_remove_by_count_indexed(SpaprDrcType drc_type,
|
2016-10-27 04:20:28 +02:00
|
|
|
uint32_t count, uint32_t index)
|
|
|
|
{
|
|
|
|
union drc_identifier drc_id;
|
|
|
|
|
|
|
|
drc_id.count_indexed.count = count;
|
|
|
|
drc_id.count_indexed.index = index;
|
|
|
|
spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED,
|
|
|
|
RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc_id);
|
2012-10-08 20:17:39 +02:00
|
|
|
}
|
|
|
|
|
2020-03-18 08:34:20 +01:00
|
|
|
static void spapr_mc_set_ea_provided_flag(struct mc_extended_log *ext_elog)
|
|
|
|
{
|
|
|
|
switch (ext_elog->mc.error_type) {
|
|
|
|
case RTAS_LOG_V6_MC_TYPE_UE:
|
|
|
|
ext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_UE_EA_ADDR_PROVIDED;
|
|
|
|
break;
|
|
|
|
case RTAS_LOG_V6_MC_TYPE_SLB:
|
|
|
|
case RTAS_LOG_V6_MC_TYPE_ERAT:
|
|
|
|
case RTAS_LOG_V6_MC_TYPE_TLB:
|
|
|
|
ext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_EA_ADDR_PROVIDED;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-30 19:44:20 +01:00
|
|
|
static uint32_t spapr_mce_get_elog_type(PowerPCCPU *cpu, bool recovered,
|
|
|
|
struct mc_extended_log *ext_elog)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
CPUPPCState *env = &cpu->env;
|
|
|
|
uint32_t summary;
|
|
|
|
uint64_t dsisr = env->spr[SPR_DSISR];
|
|
|
|
|
|
|
|
summary = RTAS_LOG_VERSION_6 | RTAS_LOG_OPTIONAL_PART_PRESENT;
|
|
|
|
if (recovered) {
|
|
|
|
summary |= RTAS_LOG_DISPOSITION_FULLY_RECOVERED;
|
|
|
|
} else {
|
|
|
|
summary |= RTAS_LOG_DISPOSITION_NOT_RECOVERED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SRR1_MC_LOADSTORE(env->spr[SPR_SRR1])) {
|
|
|
|
for (i = 0; i < ARRAY_SIZE(mc_derror_table); i++) {
|
|
|
|
if (!(dsisr & mc_derror_table[i].dsisr_value)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ext_elog->mc.error_type = mc_derror_table[i].error_type;
|
|
|
|
ext_elog->mc.sub_err_type = mc_derror_table[i].error_subtype;
|
|
|
|
if (mc_derror_table[i].dar_valid) {
|
|
|
|
ext_elog->mc.effective_address = cpu_to_be64(env->spr[SPR_DAR]);
|
2020-03-18 08:34:20 +01:00
|
|
|
spapr_mc_set_ea_provided_flag(ext_elog);
|
2020-01-30 19:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
summary |= mc_derror_table[i].initiator
|
|
|
|
| mc_derror_table[i].severity;
|
|
|
|
|
|
|
|
return summary;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < ARRAY_SIZE(mc_ierror_table); i++) {
|
|
|
|
if ((env->spr[SPR_SRR1] & mc_ierror_table[i].srr1_mask) !=
|
|
|
|
mc_ierror_table[i].srr1_value) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ext_elog->mc.error_type = mc_ierror_table[i].error_type;
|
|
|
|
ext_elog->mc.sub_err_type = mc_ierror_table[i].error_subtype;
|
|
|
|
if (mc_ierror_table[i].nip_valid) {
|
|
|
|
ext_elog->mc.effective_address = cpu_to_be64(env->nip);
|
2020-03-18 08:34:20 +01:00
|
|
|
spapr_mc_set_ea_provided_flag(ext_elog);
|
2020-01-30 19:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
summary |= mc_ierror_table[i].initiator
|
|
|
|
| mc_ierror_table[i].severity;
|
|
|
|
|
|
|
|
return summary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
summary |= RTAS_LOG_INITIATOR_CPU;
|
|
|
|
return summary;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void spapr_mce_dispatch_elog(PowerPCCPU *cpu, bool recovered)
|
|
|
|
{
|
|
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
2020-03-16 15:26:09 +01:00
|
|
|
CPUState *cs = CPU(cpu);
|
2020-01-30 19:44:20 +01:00
|
|
|
CPUPPCState *env = &cpu->env;
|
2020-03-16 15:26:09 +01:00
|
|
|
uint64_t rtas_addr;
|
2020-01-30 19:44:20 +01:00
|
|
|
struct rtas_error_log log;
|
|
|
|
struct mc_extended_log *ext_elog;
|
|
|
|
uint32_t summary;
|
|
|
|
|
|
|
|
ext_elog = g_malloc0(sizeof(*ext_elog));
|
|
|
|
summary = spapr_mce_get_elog_type(cpu, recovered, ext_elog);
|
|
|
|
|
|
|
|
log.summary = cpu_to_be32(summary);
|
|
|
|
log.extended_length = cpu_to_be32(sizeof(*ext_elog));
|
|
|
|
|
|
|
|
spapr_init_v6hdr(&ext_elog->v6hdr);
|
|
|
|
ext_elog->mc.hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MC);
|
|
|
|
ext_elog->mc.hdr.section_length =
|
|
|
|
cpu_to_be16(sizeof(struct rtas_event_log_v6_mc));
|
|
|
|
ext_elog->mc.hdr.section_version = 1;
|
|
|
|
|
|
|
|
/* get rtas addr from fdt */
|
|
|
|
rtas_addr = spapr_get_rtas_addr();
|
|
|
|
if (!rtas_addr) {
|
2020-03-16 15:26:06 +01:00
|
|
|
qemu_system_guest_panicked(NULL);
|
2020-01-30 19:44:20 +01:00
|
|
|
g_free(ext_elog);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
stq_be_phys(&address_space_memory, rtas_addr + RTAS_ERROR_LOG_OFFSET,
|
|
|
|
env->gpr[3]);
|
|
|
|
cpu_physical_memory_write(rtas_addr + RTAS_ERROR_LOG_OFFSET +
|
|
|
|
sizeof(env->gpr[3]), &log, sizeof(log));
|
|
|
|
cpu_physical_memory_write(rtas_addr + RTAS_ERROR_LOG_OFFSET +
|
|
|
|
sizeof(env->gpr[3]) + sizeof(log), ext_elog,
|
|
|
|
sizeof(*ext_elog));
|
2020-03-16 15:26:09 +01:00
|
|
|
g_free(ext_elog);
|
2020-01-30 19:44:20 +01:00
|
|
|
|
|
|
|
env->gpr[3] = rtas_addr + RTAS_ERROR_LOG_OFFSET;
|
|
|
|
|
2020-03-16 15:26:09 +01:00
|
|
|
ppc_cpu_do_fwnmi_machine_check(cs, spapr->fwnmi_machine_check_addr);
|
2020-01-30 19:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
|
2020-01-30 19:44:19 +01:00
|
|
|
{
|
|
|
|
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
|
|
|
CPUState *cs = CPU(cpu);
|
2020-01-30 19:44:22 +01:00
|
|
|
int ret;
|
|
|
|
Error *local_err = NULL;
|
2020-01-30 19:44:19 +01:00
|
|
|
|
2020-03-16 15:26:07 +01:00
|
|
|
if (spapr->fwnmi_machine_check_addr == -1) {
|
2020-01-30 19:44:19 +01:00
|
|
|
/*
|
|
|
|
* This implies that we have hit a machine check either when the
|
|
|
|
* guest has not registered FWNMI (i.e., "ibm,nmi-register" not
|
|
|
|
* called) or between system reset and "ibm,nmi-register".
|
|
|
|
* Fall back to the old machine check behavior in such cases.
|
|
|
|
*/
|
|
|
|
cs->exception_index = POWERPC_EXCP_MCHECK;
|
|
|
|
ppc_cpu_do_interrupt(cs);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-16 15:26:07 +01:00
|
|
|
while (spapr->fwnmi_machine_check_interlock != -1) {
|
2020-01-30 19:44:19 +01:00
|
|
|
/*
|
|
|
|
* Check whether the same CPU got machine check error
|
|
|
|
* while still handling the mc error (i.e., before
|
|
|
|
* that CPU called "ibm,nmi-interlock")
|
|
|
|
*/
|
2020-03-16 15:26:07 +01:00
|
|
|
if (spapr->fwnmi_machine_check_interlock == cpu->vcpu_id) {
|
2020-01-30 19:44:19 +01:00
|
|
|
qemu_system_guest_panicked(NULL);
|
|
|
|
return;
|
|
|
|
}
|
2020-03-16 15:26:07 +01:00
|
|
|
qemu_cond_wait_iothread(&spapr->fwnmi_machine_check_interlock_cond);
|
2020-01-30 19:44:19 +01:00
|
|
|
/* Meanwhile if the system is reset, then just return */
|
2020-03-16 15:26:07 +01:00
|
|
|
if (spapr->fwnmi_machine_check_addr == -1) {
|
2020-01-30 19:44:19 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-01-30 19:44:20 +01:00
|
|
|
|
2020-01-30 19:44:22 +01:00
|
|
|
ret = migrate_add_blocker(spapr->fwnmi_migration_blocker, &local_err);
|
|
|
|
if (ret == -EBUSY) {
|
|
|
|
/*
|
|
|
|
* We don't want to abort so we let the migration to continue.
|
|
|
|
* In a rare case, the machine check handler will run on the target.
|
|
|
|
* Though this is not preferable, it is better than aborting
|
|
|
|
* the migration or killing the VM.
|
|
|
|
*/
|
|
|
|
warn_report("Received a fwnmi while migration was in progress");
|
|
|
|
}
|
|
|
|
|
2020-03-16 15:26:07 +01:00
|
|
|
spapr->fwnmi_machine_check_interlock = cpu->vcpu_id;
|
2020-01-30 19:44:20 +01:00
|
|
|
spapr_mce_dispatch_elog(cpu, recovered);
|
2020-01-30 19:44:19 +01:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static void check_exception(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
2012-10-08 20:17:39 +02:00
|
|
|
uint32_t token, uint32_t nargs,
|
|
|
|
target_ulong args,
|
|
|
|
uint32_t nret, target_ulong rets)
|
|
|
|
{
|
2015-05-07 07:33:49 +02:00
|
|
|
uint32_t mask, buf, len, event_len;
|
2012-10-08 20:17:39 +02:00
|
|
|
uint64_t xinfo;
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprEventLogEntry *event;
|
2017-07-12 03:55:53 +02:00
|
|
|
struct rtas_error_log header;
|
2016-10-27 04:20:26 +02:00
|
|
|
int i;
|
2012-10-08 20:17:39 +02:00
|
|
|
|
|
|
|
if ((nargs < 6) || (nargs > 7) || nret != 1) {
|
2013-11-19 05:28:54 +01:00
|
|
|
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
|
2012-10-08 20:17:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
xinfo = rtas_ld(args, 1);
|
|
|
|
mask = rtas_ld(args, 2);
|
|
|
|
buf = rtas_ld(args, 4);
|
|
|
|
len = rtas_ld(args, 5);
|
|
|
|
if (nargs == 7) {
|
|
|
|
xinfo |= (uint64_t)rtas_ld(args, 6) << 32;
|
|
|
|
}
|
|
|
|
|
2017-07-11 20:07:55 +02:00
|
|
|
event = rtas_event_log_dequeue(spapr, mask);
|
2015-05-07 07:33:49 +02:00
|
|
|
if (!event) {
|
|
|
|
goto out_no_events;
|
|
|
|
}
|
2012-10-08 20:17:39 +02:00
|
|
|
|
2017-07-12 03:55:53 +02:00
|
|
|
event_len = event->extended_length + sizeof(header);
|
2015-05-07 07:33:49 +02:00
|
|
|
|
|
|
|
if (event_len < len) {
|
|
|
|
len = event_len;
|
|
|
|
}
|
|
|
|
|
2017-07-12 03:55:53 +02:00
|
|
|
header.summary = cpu_to_be32(event->summary);
|
|
|
|
header.extended_length = cpu_to_be32(event->extended_length);
|
|
|
|
cpu_physical_memory_write(buf, &header, sizeof(header));
|
|
|
|
cpu_physical_memory_write(buf + sizeof(header), event->extended_log,
|
|
|
|
event->extended_length);
|
2015-05-07 07:33:49 +02:00
|
|
|
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
|
2017-07-11 20:07:55 +02:00
|
|
|
g_free(event->extended_log);
|
2015-05-07 07:33:49 +02:00
|
|
|
g_free(event);
|
|
|
|
|
|
|
|
/* according to PAPR+, the IRQ must be left asserted, or re-asserted, if
|
|
|
|
* there are still pending events to be fetched via check-exception. We
|
|
|
|
* do the latter here, since our code relies on edge-triggered
|
|
|
|
* interrupts.
|
|
|
|
*/
|
2016-10-27 04:20:26 +02:00
|
|
|
for (i = 0; i < EVENT_CLASS_MAX; i++) {
|
hw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry
Currenty we do not have any RTAS event that is reported by the
event-scan interface. The existing events, RTAS_LOG_TYPE_EPOW and
RTAS_LOG_TYPE_HOTPLUG, are being reported by the check-exception
interface and, as such, marked as 'exception=true'.
Commit 79853e18d9, 'spapr_events: event-scan RTAS interface', added
the event_scan interface because the guest kernel requires it to
initialize other required interfaces. It is acting since then as
a stub because no events that would be reported by it were added
since then. However, the existence of the 'exception' boolean adds
an unnecessary load in the future migration of the pending_events,
sPAPREventLogEntry QTAILQ that hosts the pending RTAS events.
To make the code cleaner and ease the future migration changes, this
patch makes the following changes:
- remove the 'exception' boolean that filter these events. There is
nothing to filter since all events are reported by check-exception;
- functions rtas_event_log_queue, rtas_event_log_dequeue and
rtas_event_log_contains don't receive the 'exception' boolean
as parameter;
- event_scan function was simplified. It was calling
'rtas_event_log_dequeue(mask, false)' that was always returning
'NULL' because we have no events that are created with
exception=false, thus in the end it would execute a jump to
'out_no_events' all the time. The function now assumes that
this will always be the case and all the remaining logic were
deleted.
In the future, when or if we add new RTAS events that should
be reported with the event_scan interface, we can refer to
the changes made in this patch to add the event_scan logic
back.
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-19 16:27:49 +02:00
|
|
|
if (rtas_event_log_contains(EVENT_CLASS_MASK(i))) {
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
const SpaprEventSource *source =
|
2016-10-27 04:20:26 +02:00
|
|
|
spapr_event_sources_get_source(spapr->event_sources, i);
|
|
|
|
|
|
|
|
g_assert(source->enabled);
|
2017-12-01 17:06:04 +01:00
|
|
|
qemu_irq_pulse(spapr_qirq(spapr, source->irq));
|
2016-10-27 04:20:26 +02:00
|
|
|
}
|
2012-10-08 20:17:39 +02:00
|
|
|
}
|
2015-05-07 07:33:49 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
out_no_events:
|
|
|
|
rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);
|
2012-10-08 20:17:39 +02:00
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
static void event_scan(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
2015-05-07 07:33:50 +02:00
|
|
|
uint32_t token, uint32_t nargs,
|
|
|
|
target_ulong args,
|
|
|
|
uint32_t nret, target_ulong rets)
|
|
|
|
{
|
|
|
|
if (nargs != 4 || nret != 1) {
|
|
|
|
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_clear_pending_events(SpaprMachineState *spapr)
|
2017-08-30 20:21:40 +02:00
|
|
|
{
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
SpaprEventLogEntry *entry = NULL, *next_entry;
|
2017-08-30 20:21:40 +02:00
|
|
|
|
2017-09-12 20:48:05 +02:00
|
|
|
QTAILQ_FOREACH_SAFE(entry, &spapr->pending_events, next, next_entry) {
|
2017-08-30 20:21:40 +02:00
|
|
|
QTAILQ_REMOVE(&spapr->pending_events, entry, next);
|
|
|
|
g_free(entry->extended_log);
|
|
|
|
g_free(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-24 20:23:43 +01:00
|
|
|
void spapr_clear_pending_hotplug_events(SpaprMachineState *spapr)
|
|
|
|
{
|
|
|
|
SpaprEventLogEntry *entry = NULL, *next_entry;
|
|
|
|
|
|
|
|
QTAILQ_FOREACH_SAFE(entry, &spapr->pending_events, next, next_entry) {
|
|
|
|
if (spapr_event_log_entry_type(entry) == RTAS_LOG_TYPE_HOTPLUG) {
|
|
|
|
QTAILQ_REMOVE(&spapr->pending_events, entry, next);
|
|
|
|
g_free(entry->extended_log);
|
|
|
|
g_free(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 05:35:37 +01:00
|
|
|
void spapr_events_init(SpaprMachineState *spapr)
|
2012-10-08 20:17:39 +02:00
|
|
|
{
|
2018-07-30 16:11:32 +02:00
|
|
|
int epow_irq = SPAPR_IRQ_EPOW;
|
2018-06-18 19:34:00 +02:00
|
|
|
|
2018-07-30 16:11:32 +02:00
|
|
|
if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
|
|
|
|
epow_irq = spapr_irq_findone(spapr, &error_fatal);
|
|
|
|
}
|
2018-06-18 19:34:00 +02:00
|
|
|
|
|
|
|
spapr_irq_claim(spapr, epow_irq, false, &error_fatal);
|
|
|
|
|
2015-05-07 07:33:49 +02:00
|
|
|
QTAILQ_INIT(&spapr->pending_events);
|
2016-10-27 04:20:26 +02:00
|
|
|
|
|
|
|
spapr->event_sources = spapr_event_sources_new();
|
|
|
|
|
|
|
|
spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_EPOW,
|
2018-06-18 19:34:00 +02:00
|
|
|
epow_irq);
|
2016-10-27 04:20:26 +02:00
|
|
|
|
|
|
|
/* NOTE: if machine supports modern/dedicated hotplug event source,
|
|
|
|
* we add it to the device-tree unconditionally. This means we may
|
|
|
|
* have cases where the source is enabled in QEMU, but unused by the
|
|
|
|
* guest because it does not support modern hotplug events, so we
|
|
|
|
* take care to rely on checking for negotiation of OV5_HP_EVT option
|
|
|
|
* before attempting to use it to signal events, rather than simply
|
|
|
|
* checking that it's enabled.
|
|
|
|
*/
|
|
|
|
if (spapr->use_hotplug_event_source) {
|
2018-07-30 16:11:32 +02:00
|
|
|
int hp_irq = SPAPR_IRQ_HOTPLUG;
|
2018-06-18 19:34:00 +02:00
|
|
|
|
2018-07-30 16:11:32 +02:00
|
|
|
if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
|
|
|
|
hp_irq = spapr_irq_findone(spapr, &error_fatal);
|
|
|
|
}
|
2018-06-18 19:34:00 +02:00
|
|
|
|
|
|
|
spapr_irq_claim(spapr, hp_irq, false, &error_fatal);
|
|
|
|
|
2016-10-27 04:20:26 +02:00
|
|
|
spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_HOT_PLUG,
|
2018-06-18 19:34:00 +02:00
|
|
|
hp_irq);
|
2016-10-27 04:20:26 +02:00
|
|
|
}
|
|
|
|
|
2012-10-08 20:17:39 +02:00
|
|
|
spapr->epow_notifier.notify = spapr_powerdown_req;
|
|
|
|
qemu_register_powerdown_notifier(&spapr->epow_notifier);
|
2014-06-23 15:26:32 +02:00
|
|
|
spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception",
|
|
|
|
check_exception);
|
2015-05-07 07:33:50 +02:00
|
|
|
spapr_rtas_register(RTAS_EVENT_SCAN, "event-scan", event_scan);
|
2012-10-08 20:17:39 +02:00
|
|
|
}
|