* [PATCH 2/4] powerpc/powernv: Remove some OPAL function declaration duplication
2014-03-27 5:18 [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs Anton Blanchard
@ 2014-03-27 5:19 ` Anton Blanchard
2014-03-27 5:20 ` [PATCH 3/4] powerpc/powernv: Fix little endian issues with opal_do_notifier calls Anton Blanchard
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2014-03-27 5:19 UTC (permalink / raw)
To: stewart, benh, paulus; +Cc: linuxppc-dev
We had some duplication of the internal OPAL functions.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: b/arch/powerpc/include/asm/opal.h
===================================================================
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -877,7 +877,8 @@ int64_t opal_sensor_read(uint32_t sensor
uint32_t *sensor_data);
/* Internal functions */
-extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
+extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
+ int depth, void *data);
extern int early_init_dt_scan_recoverable_ranges(unsigned long node,
const char *uname, int depth, void *data);
@@ -886,10 +887,6 @@ extern int opal_put_chars(uint32_t vterm
extern void hvc_opal_init_early(void);
-/* Internal functions */
-extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
- int depth, void *data);
-
extern int opal_notifier_register(struct notifier_block *nb);
extern int opal_message_notifier_register(enum OpalMessageType msg_type,
struct notifier_block *nb);
@@ -897,9 +894,6 @@ extern void opal_notifier_enable(void);
extern void opal_notifier_disable(void);
extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
-extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
-extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
-
extern int __opal_async_get_token(void);
extern int opal_async_get_token_interruptible(void);
extern int __opal_async_release_token(int token);
@@ -907,8 +901,6 @@ extern int opal_async_release_token(int
extern int opal_async_wait_response(uint64_t token, struct opal_msg *msg);
extern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data);
-extern void hvc_opal_init_early(void);
-
struct rtc_time;
extern int opal_set_rtc_time(struct rtc_time *tm);
extern void opal_get_rtc_time(struct rtc_time *tm);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/4] powerpc/powernv: Fix little endian issues with opal_do_notifier calls
2014-03-27 5:18 [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs Anton Blanchard
2014-03-27 5:19 ` [PATCH 2/4] powerpc/powernv: Remove some OPAL function declaration duplication Anton Blanchard
@ 2014-03-27 5:20 ` Anton Blanchard
2014-03-27 5:20 ` [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code Anton Blanchard
2014-03-27 5:54 ` [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs Stewart Smith
3 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2014-03-27 5:20 UTC (permalink / raw)
To: stewart, benh, paulus; +Cc: linuxppc-dev
The bitmap in opal_poll_events and opal_handle_interrupt is
big endian, so we need to byteswap it on little endian builds.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: b/arch/powerpc/platforms/powernv/opal.c
===================================================================
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -216,14 +216,14 @@ void opal_notifier_update_evt(uint64_t e
void opal_notifier_enable(void)
{
int64_t rc;
- uint64_t evt = 0;
+ __be64 evt = 0;
atomic_set(&opal_notifier_hold, 0);
/* Process pending events */
rc = opal_poll_events(&evt);
if (rc == OPAL_SUCCESS && evt)
- opal_do_notifier(evt);
+ opal_do_notifier(be64_to_cpu(evt));
}
void opal_notifier_disable(void)
@@ -501,7 +501,7 @@ static irqreturn_t opal_interrupt(int ir
opal_handle_interrupt(virq_to_hw(irq), &events);
- opal_do_notifier(events);
+ opal_do_notifier(be64_to_cpu(events));
return IRQ_HANDLED;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code
2014-03-27 5:18 [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs Anton Blanchard
2014-03-27 5:19 ` [PATCH 2/4] powerpc/powernv: Remove some OPAL function declaration duplication Anton Blanchard
2014-03-27 5:20 ` [PATCH 3/4] powerpc/powernv: Fix little endian issues with opal_do_notifier calls Anton Blanchard
@ 2014-03-27 5:20 ` Anton Blanchard
2014-03-27 6:17 ` Stewart Smith
2014-03-27 5:54 ` [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs Stewart Smith
3 siblings, 1 reply; 7+ messages in thread
From: Anton Blanchard @ 2014-03-27 5:20 UTC (permalink / raw)
To: stewart, benh, paulus; +Cc: linuxppc-dev
Fix little endian issues with the OPAL error log code.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: b/arch/powerpc/platforms/powernv/opal-elog.c
===================================================================
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -243,18 +243,25 @@ static struct elog_obj *create_elog_obj(
static void elog_work_fn(struct work_struct *work)
{
+ __be64 size;
+ __be64 id;
+ __be64 type;
uint64_t elog_size;
uint64_t log_id;
uint64_t elog_type;
int rc;
char name[2+16+1];
- rc = opal_get_elog_size(&log_id, &elog_size, &elog_type);
+ rc = opal_get_elog_size(&id, &size, &type);
if (rc != OPAL_SUCCESS) {
pr_err("ELOG: Opal log read failed\n");
return;
}
+ elog_size = be64_to_cpu(size);
+ log_id = be64_to_cpu(id);
+ elog_type = be64_to_cpu(type);
+
BUG_ON(elog_size > OPAL_MAX_ERRLOG_SIZE);
if (elog_size >= OPAL_MAX_ERRLOG_SIZE)
Index: b/arch/powerpc/include/asm/opal.h
===================================================================
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -851,7 +851,7 @@ int64_t opal_lpc_read(uint32_t chip_id,
uint32_t addr, __be32 *data, uint32_t sz);
int64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id);
-int64_t opal_get_elog_size(uint64_t *log_id, uint64_t *size, uint64_t *elog_type);
+int64_t opal_get_elog_size(__be64 *log_id, __be64 *size, __be64 *elog_type);
int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset);
int64_t opal_send_ack_elog(uint64_t log_id);
void opal_resend_pending_logs(void);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code
2014-03-27 5:20 ` [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code Anton Blanchard
@ 2014-03-27 6:17 ` Stewart Smith
2014-03-27 22:04 ` Anton Blanchard
0 siblings, 1 reply; 7+ messages in thread
From: Stewart Smith @ 2014-03-27 6:17 UTC (permalink / raw)
To: Anton Blanchard, benh, paulus; +Cc: linuxppc-dev
Anton Blanchard <anton@samba.org> writes:
> Fix little endian issues with the OPAL error log code.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Do we also need any magic for the getting of error logs themselves?
You may want to check the md5 of the logs themselves on be and le.
> ---
>
> Index: b/arch/powerpc/platforms/powernv/opal-elog.c
> ===================================================================
> --- a/arch/powerpc/platforms/powernv/opal-elog.c
> +++ b/arch/powerpc/platforms/powernv/opal-elog.c
> @@ -243,18 +243,25 @@ static struct elog_obj *create_elog_obj(
>
> static void elog_work_fn(struct work_struct *work)
> {
> + __be64 size;
> + __be64 id;
> + __be64 type;
> uint64_t elog_size;
> uint64_t log_id;
> uint64_t elog_type;
> int rc;
> char name[2+16+1];
>
> - rc = opal_get_elog_size(&log_id, &elog_size, &elog_type);
> + rc = opal_get_elog_size(&id, &size, &type);
> if (rc != OPAL_SUCCESS) {
> pr_err("ELOG: Opal log read failed\n");
> return;
> }
>
> + elog_size = be64_to_cpu(size);
> + log_id = be64_to_cpu(id);
> + elog_type = be64_to_cpu(type);
> +
> BUG_ON(elog_size > OPAL_MAX_ERRLOG_SIZE);
>
> if (elog_size >= OPAL_MAX_ERRLOG_SIZE)
> Index: b/arch/powerpc/include/asm/opal.h
> ===================================================================
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -851,7 +851,7 @@ int64_t opal_lpc_read(uint32_t chip_id,
> uint32_t addr, __be32 *data, uint32_t sz);
>
> int64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id);
> -int64_t opal_get_elog_size(uint64_t *log_id, uint64_t *size, uint64_t *elog_type);
> +int64_t opal_get_elog_size(__be64 *log_id, __be64 *size, __be64 *elog_type);
> int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset);
> int64_t opal_send_ack_elog(uint64_t log_id);
> void opal_resend_pending_logs(void);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code
2014-03-27 6:17 ` Stewart Smith
@ 2014-03-27 22:04 ` Anton Blanchard
0 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2014-03-27 22:04 UTC (permalink / raw)
To: Stewart Smith; +Cc: paulus, linuxppc-dev
Hi Stewart,
> Do we also need any magic for the getting of error logs themselves?
>
> You may want to check the md5 of the logs themselves on be and le.
Good idea. An md5 of the logs in LE and BE on this box checks out, so I
think we are good.
Anton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs
2014-03-27 5:18 [PATCH 1/4] powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs Anton Blanchard
` (2 preceding siblings ...)
2014-03-27 5:20 ` [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code Anton Blanchard
@ 2014-03-27 5:54 ` Stewart Smith
3 siblings, 0 replies; 7+ messages in thread
From: Stewart Smith @ 2014-03-27 5:54 UTC (permalink / raw)
To: Anton Blanchard, benh, paulus; +Cc: linuxppc-dev
Anton Blanchard <anton@samba.org> writes:
> Using size_t in our APIs is asking for trouble, especially
> when some OPAL calls use size_t pointers.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>
> ---
>
> Index: b/arch/powerpc/include/asm/opal.h
> ===================================================================
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -850,8 +850,8 @@ int64_t opal_lpc_write(uint32_t chip_id,
> int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
> uint32_t addr, __be32 *data, uint32_t sz);
>
> -int64_t opal_read_elog(uint64_t buffer, size_t size, uint64_t log_id);
> -int64_t opal_get_elog_size(uint64_t *log_id, size_t *size, uint64_t *elog_type);
> +int64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id);
> +int64_t opal_get_elog_size(uint64_t *log_id, uint64_t *size, uint64_t *elog_type);
> int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset);
> int64_t opal_send_ack_elog(uint64_t log_id);
> void opal_resend_pending_logs(void);
> @@ -866,13 +866,13 @@ int64_t opal_dump_read(uint32_t dump_id,
> int64_t opal_dump_ack(uint32_t dump_id);
> int64_t opal_dump_resend_notification(void);
>
> -int64_t opal_get_msg(uint64_t buffer, size_t size);
> -int64_t opal_check_completion(uint64_t buffer, size_t size, uint64_t token);
> +int64_t opal_get_msg(uint64_t buffer, uint64_t size);
> +int64_t opal_check_completion(uint64_t buffer, uint64_t size, uint64_t token);
> int64_t opal_sync_host_reboot(void);
> int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer,
> - size_t length);
> + uint64_t length);
> int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer,
> - size_t length);
> + uint64_t length);
> int64_t opal_sensor_read(uint32_t sensor_hndl, int token,
> uint32_t *sensor_data);
>
> Index: b/arch/powerpc/platforms/powernv/opal-elog.c
> ===================================================================
> --- a/arch/powerpc/platforms/powernv/opal-elog.c
> +++ b/arch/powerpc/platforms/powernv/opal-elog.c
> @@ -243,7 +243,7 @@ static struct elog_obj *create_elog_obj(
>
> static void elog_work_fn(struct work_struct *work)
> {
> - size_t elog_size;
> + uint64_t elog_size;
> uint64_t log_id;
> uint64_t elog_type;
> int rc;
^ permalink raw reply [flat|nested] 7+ messages in thread