diff mbox series

[v5,10/31] opal: add MPIPL interface definitions

Message ID 156630272066.8896.14185583668659839717.stgit@hbathini.in.ibm.com (mailing list archive)
State Superseded
Headers show
Series Add FADump support on PowerNV platform | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (c9633332103e55bc73d80d07ead28b95a22a85a3)
snowpatch_ozlabs/checkpatch warning total: 0 errors, 2 warnings, 0 checks, 86 lines checked

Commit Message

Hari Bathini Aug. 20, 2019, 12:05 p.m. UTC
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
 arch/powerpc/include/asm/opal-api.h        |   50 +++++++++++++++++++++++++++-
 arch/powerpc/include/asm/opal.h            |    6 +++
 arch/powerpc/platforms/powernv/opal-call.c |    3 ++
 3 files changed, 58 insertions(+), 1 deletion(-)

Comments

Michael Ellerman Sept. 3, 2019, 11:10 a.m. UTC | #1
Hari Bathini <hbathini@linux.ibm.com> writes:
> diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
> index 383242e..c8a5665 100644
> --- a/arch/powerpc/include/asm/opal-api.h
> +++ b/arch/powerpc/include/asm/opal-api.h
> @@ -980,6 +983,50 @@ struct opal_sg_list {
>  };
>  
>  /*
> + * Firmware-Assisted Dump (FADump) using MPIPL
> + */
> +
> +/* MPIPL update operations */
> +enum opal_mpipl_ops {
> +	OPAL_MPIPL_ADD_RANGE			= 0,
> +	OPAL_MPIPL_REMOVE_RANGE			= 1,
> +	OPAL_MPIPL_REMOVE_ALL			= 2,
> +	OPAL_MPIPL_FREE_PRESERVED_MEMORY	= 3,
> +};
> +
> +/*
> + * Each tag maps to a metadata type. Use these tags to register/query
> + * corresponding metadata address with/from OPAL.
> + */
> +enum opal_mpipl_tags {
> +	OPAL_MPIPL_TAG_CPU		= 0,
> +	OPAL_MPIPL_TAG_OPAL		= 1,
> +	OPAL_MPIPL_TAG_KERNEL		= 2,
> +	OPAL_MPIPL_TAG_BOOT_MEM		= 3,
> +};
> +
> +/* Preserved memory details */
> +struct opal_mpipl_region {
> +	__be64	src;
> +	__be64	dest;
> +	__be64	size;
> +};
> +
> +/* FADump structure format version */
> +#define MPIPL_FADUMP_VERSION			0x01
> +
> +/* Metadata provided by OPAL. */
> +struct opal_mpipl_fadump {
> +	u8				version;
> +	u8				reserved[7];
> +	__be32				crashing_pir;
> +	__be32				cpu_data_version;
> +	__be32				cpu_data_size;
> +	__be32				region_cnt;
> +	struct opal_mpipl_region	region[];
> +} __attribute__((packed));
> +

The above hunk is in the wrong place vs the skiboot header. Please put
things in exactly the same place in the skiboot and kernel versions of
the header.

After your kernel & skiboot patches are applied, the result of:

 $ git diff ~/src/skiboot/include/opal-api.h arch/powerpc/include/asm/opal-api.h

Should not include anything MPIPL/fadump related.


> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index 57bd029..878110a 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -39,6 +39,12 @@ int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn,
>  				uint64_t PE_handle);
>  int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap,
>  			uint64_t rate_phys, uint32_t size);
> +
> +int64_t opal_mpipl_update(enum opal_mpipl_ops op, u64 src,
> +			  u64 dest, u64 size);
> +int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, uint64_t addr);
> +int64_t opal_mpipl_query_tag(enum opal_mpipl_tags tag, uint64_t *addr);
> +

Please consistently use kernel types for new prototypes in here.

cheers
Hari Bathini Sept. 3, 2019, 4:28 p.m. UTC | #2
On 03/09/19 4:40 PM, Michael Ellerman wrote:
> Hari Bathini <hbathini@linux.ibm.com> writes:
>> diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
>> index 383242e..c8a5665 100644
>> --- a/arch/powerpc/include/asm/opal-api.h
>> +++ b/arch/powerpc/include/asm/opal-api.h
>> @@ -980,6 +983,50 @@ struct opal_sg_list {
>>  };
>>  
>>  /*
>> + * Firmware-Assisted Dump (FADump) using MPIPL
>> + */
>> +
>> +/* MPIPL update operations */
>> +enum opal_mpipl_ops {
>> +	OPAL_MPIPL_ADD_RANGE			= 0,
>> +	OPAL_MPIPL_REMOVE_RANGE			= 1,
>> +	OPAL_MPIPL_REMOVE_ALL			= 2,
>> +	OPAL_MPIPL_FREE_PRESERVED_MEMORY	= 3,
>> +};
>> +
>> +/*
>> + * Each tag maps to a metadata type. Use these tags to register/query
>> + * corresponding metadata address with/from OPAL.
>> + */
>> +enum opal_mpipl_tags {
>> +	OPAL_MPIPL_TAG_CPU		= 0,
>> +	OPAL_MPIPL_TAG_OPAL		= 1,
>> +	OPAL_MPIPL_TAG_KERNEL		= 2,
>> +	OPAL_MPIPL_TAG_BOOT_MEM		= 3,
>> +};
>> +
>> +/* Preserved memory details */
>> +struct opal_mpipl_region {
>> +	__be64	src;
>> +	__be64	dest;
>> +	__be64	size;
>> +};
>> +
>> +/* FADump structure format version */
>> +#define MPIPL_FADUMP_VERSION			0x01
>> +
>> +/* Metadata provided by OPAL. */
>> +struct opal_mpipl_fadump {
>> +	u8				version;
>> +	u8				reserved[7];
>> +	__be32				crashing_pir;
>> +	__be32				cpu_data_version;
>> +	__be32				cpu_data_size;
>> +	__be32				region_cnt;
>> +	struct opal_mpipl_region	region[];
>> +} __attribute__((packed));
>> +
> 
> The above hunk is in the wrong place vs the skiboot header. Please put
> things in exactly the same place in the skiboot and kernel versions of
> the header.
> 
> After your kernel & skiboot patches are applied, the result of:
> 
>  $ git diff ~/src/skiboot/include/opal-api.h arch/powerpc/include/asm/opal-api.h
> 
> Should not include anything MPIPL/fadump related.

Sure.

> 
>> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
>> index 57bd029..878110a 100644
>> --- a/arch/powerpc/include/asm/opal.h
>> +++ b/arch/powerpc/include/asm/opal.h
>> @@ -39,6 +39,12 @@ int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn,
>>  				uint64_t PE_handle);
>>  int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap,
>>  			uint64_t rate_phys, uint32_t size);
>> +
>> +int64_t opal_mpipl_update(enum opal_mpipl_ops op, u64 src,
>> +			  u64 dest, u64 size);
>> +int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, uint64_t addr);
>> +int64_t opal_mpipl_query_tag(enum opal_mpipl_tags tag, uint64_t *addr);
>> +
> 
> Please consistently use kernel types for new prototypes in here.

uint64_t instead of 'enum's?

- Hari
Michael Ellerman Sept. 4, 2019, 11:03 a.m. UTC | #3
Hari Bathini <hbathini@linux.ibm.com> writes:
> On 03/09/19 4:40 PM, Michael Ellerman wrote:
>> Hari Bathini <hbathini@linux.ibm.com> writes:
>>> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
>>> index 57bd029..878110a 100644
>>> --- a/arch/powerpc/include/asm/opal.h
>>> +++ b/arch/powerpc/include/asm/opal.h
>>> @@ -39,6 +39,12 @@ int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn,
>>>  				uint64_t PE_handle);
>>>  int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap,
>>>  			uint64_t rate_phys, uint32_t size);
>>> +
>>> +int64_t opal_mpipl_update(enum opal_mpipl_ops op, u64 src,
>>> +			  u64 dest, u64 size);
>>> +int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, uint64_t addr);
>>> +int64_t opal_mpipl_query_tag(enum opal_mpipl_tags tag, uint64_t *addr);
>>> +
>> 
>> Please consistently use kernel types for new prototypes in here.
>
> uint64_t instead of 'enum's?

The enums are fine, I mean u64 instead of uint64_t, s64 instead of
int64_t etc.

cheers
Michael Ellerman Sept. 4, 2019, 11:05 a.m. UTC | #4
Hi Hari,

One other comment.

Hari Bathini <hbathini@linux.ibm.com> writes:
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>

Change log is missing.

Please define what MPIPL means, and give people some explanation of what
it is, how it works and how you're using it for fadump.

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index 383242e..c8a5665 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -208,7 +208,10 @@ 
 #define OPAL_HANDLE_HMI2			166
 #define	OPAL_NX_COPROC_INIT			167
 #define OPAL_XIVE_GET_VP_STATE			170
-#define OPAL_LAST				170
+#define OPAL_MPIPL_UPDATE			173
+#define OPAL_MPIPL_REGISTER_TAG			174
+#define OPAL_MPIPL_QUERY_TAG			175
+#define OPAL_LAST				175
 
 #define QUIESCE_HOLD			1 /* Spin all calls at entry */
 #define QUIESCE_REJECT			2 /* Fail all calls with OPAL_BUSY */
@@ -980,6 +983,50 @@  struct opal_sg_list {
 };
 
 /*
+ * Firmware-Assisted Dump (FADump) using MPIPL
+ */
+
+/* MPIPL update operations */
+enum opal_mpipl_ops {
+	OPAL_MPIPL_ADD_RANGE			= 0,
+	OPAL_MPIPL_REMOVE_RANGE			= 1,
+	OPAL_MPIPL_REMOVE_ALL			= 2,
+	OPAL_MPIPL_FREE_PRESERVED_MEMORY	= 3,
+};
+
+/*
+ * Each tag maps to a metadata type. Use these tags to register/query
+ * corresponding metadata address with/from OPAL.
+ */
+enum opal_mpipl_tags {
+	OPAL_MPIPL_TAG_CPU		= 0,
+	OPAL_MPIPL_TAG_OPAL		= 1,
+	OPAL_MPIPL_TAG_KERNEL		= 2,
+	OPAL_MPIPL_TAG_BOOT_MEM		= 3,
+};
+
+/* Preserved memory details */
+struct opal_mpipl_region {
+	__be64	src;
+	__be64	dest;
+	__be64	size;
+};
+
+/* FADump structure format version */
+#define MPIPL_FADUMP_VERSION			0x01
+
+/* Metadata provided by OPAL. */
+struct opal_mpipl_fadump {
+	u8				version;
+	u8				reserved[7];
+	__be32				crashing_pir;
+	__be32				cpu_data_version;
+	__be32				cpu_data_size;
+	__be32				region_cnt;
+	struct opal_mpipl_region	region[];
+} __attribute__((packed));
+
+/*
  * Dump region ID range usable by the OS
  */
 #define OPAL_DUMP_REGION_HOST_START		0x80
@@ -1059,6 +1106,7 @@  enum {
 	OPAL_REBOOT_NORMAL		= 0,
 	OPAL_REBOOT_PLATFORM_ERROR	= 1,
 	OPAL_REBOOT_FULL_IPL		= 2,
+	OPAL_REBOOT_MPIPL		= 3,
 };
 
 /* Argument to OPAL_PCI_TCE_KILL */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 57bd029..878110a 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -39,6 +39,12 @@  int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn,
 				uint64_t PE_handle);
 int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap,
 			uint64_t rate_phys, uint32_t size);
+
+int64_t opal_mpipl_update(enum opal_mpipl_ops op, u64 src,
+			  u64 dest, u64 size);
+int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, uint64_t addr);
+int64_t opal_mpipl_query_tag(enum opal_mpipl_tags tag, uint64_t *addr);
+
 int64_t opal_console_write(int64_t term_number, __be64 *length,
 			   const uint8_t *buffer);
 int64_t opal_console_read(int64_t term_number, __be64 *length,
diff --git a/arch/powerpc/platforms/powernv/opal-call.c b/arch/powerpc/platforms/powernv/opal-call.c
index 29ca523..fc8cc7c 100644
--- a/arch/powerpc/platforms/powernv/opal-call.c
+++ b/arch/powerpc/platforms/powernv/opal-call.c
@@ -287,3 +287,6 @@  OPAL_CALL(opal_pci_set_pbcq_tunnel_bar,		OPAL_PCI_SET_PBCQ_TUNNEL_BAR);
 OPAL_CALL(opal_sensor_read_u64,			OPAL_SENSOR_READ_U64);
 OPAL_CALL(opal_sensor_group_enable,		OPAL_SENSOR_GROUP_ENABLE);
 OPAL_CALL(opal_nx_coproc_init,			OPAL_NX_COPROC_INIT);
+OPAL_CALL(opal_mpipl_update,			OPAL_MPIPL_UPDATE);
+OPAL_CALL(opal_mpipl_register_tag,		OPAL_MPIPL_REGISTER_TAG);
+OPAL_CALL(opal_mpipl_query_tag,			OPAL_MPIPL_QUERY_TAG);