Skip to contentSkip to conversation

ehca: firmware InfiniBand interface

PATCH In review Heiko J Schick 6 participants 8 messages Apr 27, 2006 – May 3, 2006 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 13/16 ehca: firmware InfiniBand interface

 hcp_if.c | 2028 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hcp_if.h |  398 ++++++++++++
 2 files changed, 2426 insertions(+)
drivers/infiniband/hw/ehca/hcp_if.h +398 -0
@@ -0,0 +1,398 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  Firmware Infiniband Interface code for POWER
+ *
+ *  Authors: Christoph Raisch <[email protected]>
+ *           Hoang-Nam Nguyen <[email protected]>
+ *           Gerd Bayer <[email protected]>
+ *           Waleri Fomin <[email protected]>
+ *
+ *  Copyright (c) 2005 IBM Corporation
+ *
+ *  All rights reserved.
+ *
+ *  This source code is distributed under a dual license of GPL v2.0 and OpenIB
+ *  BSD.
+ *
+ * OpenIB BSD License
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  $Id: hcp_if.h,v 1.12 2006/04/04 21:52:30 nguyen Exp $
+ */
+
+#ifndef __HCP_IF_H__
+#define __HCP_IF_H__
+
+#include "ehca_classes.h"
+#include "hipz_hw.h"
+
+/**
+ * hipz_h_alloc_resource_eq - Allocate EQ resources in HW and FW, initalize
+ * resources, create the empty EQPT (ring).
+ *
+ * @eq_handle:         eq handle for this queue
+ * @act_nr_of_entries: actual number of queue entries
+ * @act_pages:         actual number of queue pages
+ * @eq_ist:            used by hcp_H_XIRR() call
+ */
+u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle adapter_handle,
+			     struct ehca_pfeq *pfeq,
+			     const u32 neq_control,
+			     const u32 number_of_entries,
+			     struct ipz_eq_handle *eq_handle,
+			     u32 * act_nr_of_entries,
+			     u32 * act_pages,
+			     u32 * eq_ist);
+
+u64 hipz_h_reset_event(const struct ipz_adapter_handle adapter_handle,
+		       struct ipz_eq_handle eq_handle,
+		       const u64 event_mask);
+/**
+ * hipz_h_allocate_resource_cq - Allocate CQ resources in HW and FW, initialize
+ * resources, create the empty CQPT (ring).
+ *
+ * @eq_handle:         eq handle to use for this cq
+ * @cq_handle:         cq handle for this queue
+ * @act_nr_of_entries: actual number of queue entries
+ * @act_pages:         actual number of queue pages
+ * @galpas:            contain logical adress of priv. storage and
+ *                     log_user_storage
+ */
+u64 hipz_h_alloc_resource_cq(const struct ipz_adapter_handle adapter_handle,
+			     struct ehca_pfcq *pfcq,
+			     const struct ipz_eq_handle eq_handle,
+			     const u32 cq_token,
+			     const u32 number_of_entries,
+			     struct ipz_cq_handle *cq_handle,
+			     u32 * act_nr_of_entries,
+			     u32 * act_pages,
+			     struct h_galpas *galpas);
+
+/**
+ * hipz_h_alloc_resource_qp - Allocate QP resources in HW and FW,
+ * initialize resources, create empty QPPTs (2 rings).
+ *
+ * @h_galpas to access HCA resident QP attributes
+ */
+u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,
+			     struct ehca_pfqp *pfqp,
+			     const u8 servicetype,
+			     const u8 daqp_ctrl,
+			     const u8 signalingtype,
+			     const u8 ud_av_l_key_ctl,
+			     const struct ipz_cq_handle send_cq_handle,
+			     const struct ipz_cq_handle receive_cq_handle,
+			     const struct ipz_eq_handle async_eq_handle,
+			     const u32 qp_token,
+			     const struct ipz_pd pd,
+			     const u16 max_nr_send_wqes,
+			     const u16 max_nr_receive_wqes,
+			     const u8 max_nr_send_sges,
+			     const u8 max_nr_receive_sges,
+			     const u32 ud_av_l_key,
+			     struct ipz_qp_handle *qp_handle,
+			     u32 * qp_nr,
+			     u16 * act_nr_send_wqes,
+			     u16 * act_nr_receive_wqes,
+			     u8 * act_nr_send_sges,
+			     u8 * act_nr_receive_sges,
+			     u32 * nr_sq_pages,
+			     u32 * nr_rq_pages,
+			     struct h_galpas *h_galpas);
+
+u64 hipz_h_query_port(const struct ipz_adapter_handle adapter_handle,
+		      const u8 port_id,
+		      struct hipz_query_port *query_port_response_block);
+
+u64 hipz_h_query_hca(const struct ipz_adapter_handle adapter_handle,
+		     struct hipz_query_hca *query_hca_rblock);
+
+/**
+ * hipz_h_register_rpage - hcp_if.h internal function for all
+ * hcp_H_REGISTER_RPAGE calls.
+ *
+ * @logical_address_of_page: kv transformation to GX address in this routine
+ */
+u64 hipz_h_register_rpage(const struct ipz_adapter_handle adapter_handle,
+			  const u8 pagesize,
+			  const u8 queue_type,
+			  const u64 resource_handle,
+			  const u64 logical_address_of_page,
+			  u64 count);
+
+u64 hipz_h_register_rpage_eq(const struct ipz_adapter_handle adapter_handle,
+			     const struct ipz_eq_handle eq_handle,
+			     struct ehca_pfeq *pfeq,
+			     const u8 pagesize,
+			     const u8 queue_type,
+			     const u64 logical_address_of_page,
+			     const u64 count);
+
+u32 hipz_h_query_int_state(const struct ipz_adapter_handle
+			   hcp_adapter_handle,
+			   u32 ist);
+
+u64 hipz_h_register_rpage_cq(const struct ipz_adapter_handle adapter_handle,
+			     const struct ipz_cq_handle cq_handle,
+			     struct ehca_pfcq *pfcq,
+			     const u8 pagesize,
+			     const u8 queue_type,
+			     const u64 logical_address_of_page,
+			     const u64 count,
+			     const struct h_galpa gal);
+
+u64 hipz_h_register_rpage_qp(const struct ipz_adapter_handle adapter_handle,
+			     const struct ipz_qp_handle qp_handle,
+			     struct ehca_pfqp *pfqp,
+			     const u8 pagesize,
+			     const u8 queue_type,
+			     const u64 logical_address_of_page,
+			     const u64 count,
+			     const struct h_galpa galpa);
+
+u64 hipz_h_remove_rpt_cq(const struct ipz_adapter_handle adapter_handle,
+			 const struct ipz_cq_handle cq_handle,
+			 struct ehca_pfcq *pfcq);
+
+u64 hipz_h_remove_rpt_eq(const struct ipz_adapter_handle adapter_handle,
+			 const struct ipz_eq_handle eq_handle,
+			 struct ehca_pfeq *pfeq);
+
+u64 hipz_h_remove_rpt_qp(const struct ipz_adapter_handle adapter_handle,
+			 const struct ipz_qp_handle qp_handle,
+			 struct ehca_pfqp *pfqp);
+
+u64 hipz_h_disable_and_get_wqe(const struct ipz_adapter_handle adapter_handle,
+			       const struct ipz_qp_handle qp_handle,
+			       struct ehca_pfqp *pfqp,
+			       void **log_addr_next_sq_wqe_tb_processed,
+			       void **log_addr_next_rq_wqe_tb_processed,
+			       int dis_and_get_function_code);
+enum hcall_sigt {
+	HCALL_SIGT_NO_CQE = 0,
+	HCALL_SIGT_BY_WQE = 1,
+	HCALL_SIGT_EVERY = 2
+};
+
+u64 hipz_h_modify_qp(const struct ipz_adapter_handle adapter_handle,
+		     const struct ipz_qp_handle qp_handle,
+		     struct ehca_pfqp *pfqp,
+		     const u64 update_mask,
+		     struct hcp_modify_qp_control_block *mqpcb,
+		     struct h_galpa gal);
+
+u64 hipz_h_query_qp(const struct ipz_adapter_handle adapter_handle,
+		    const struct ipz_qp_handle qp_handle,
+		    struct ehca_pfqp *pfqp,
+		    struct hcp_modify_qp_control_block *qqpcb,
+		    struct h_galpa gal);
+
+u64 hipz_h_destroy_qp(const struct ipz_adapter_handle adapter_handle,
+		      struct ehca_qp *qp);
+
+u64 hipz_h_define_aqp0(const struct ipz_adapter_handle adapter_handle,
+		       const struct ipz_qp_handle qp_handle,
+		       struct h_galpa gal,
+		       u32 port);
+
+u64 hipz_h_define_aqp1(const struct ipz_adapter_handle adapter_handle,
+		       const struct ipz_qp_handle qp_handle,
+		       struct h_galpa gal,
+		       u32 port, u32 * pma_qp_nr,
+		       u32 * bma_qp_nr);
+
+u64 hipz_h_attach_mcqp(const struct ipz_adapter_handle adapter_handle,
+		       const struct ipz_qp_handle qp_handle,
+		       struct h_galpa gal,
+		       u16 mcg_dlid,
+		       u64 subnet_prefix, u64 interface_id);
+
+u64 hipz_h_detach_mcqp(const struct ipz_adapter_handle adapter_handle,
+		       const struct ipz_qp_handle qp_handle,
+		       struct h_galpa gal,
+		       u16 mcg_dlid,
+		       u64 subnet_prefix, u64 interface_id);
+
+u64 hipz_h_destroy_cq(const struct ipz_adapter_handle adapter_handle,
+		      struct ehca_cq *cq,
+		      u8 force_flag);
+
+u64 hipz_h_destroy_eq(const struct ipz_adapter_handle adapter_handle,
+		      struct ehca_eq *eq);
+
+/**
+ * hipz_h_alloc_resource_mr - Allocate MR resources in HW and FW, initialize
+ * resources.
+ *
+ * @pfmr:        platform specific for MR
+ * pfshca:       platform specific for SHCA
+ * vaddr:        Memory Region I/O Virtual Address
+ * @length:      Memory Region Length
+ * @access_ctrl: Memory Region Access Controls
+ * @pd:          Protection Domain
+ * @mr_handle:   Memory Region Handle
+ */
+u64 hipz_h_alloc_resource_mr(const struct ipz_adapter_handle adapter_handle,
+			     struct ehca_pfmr *pfmr,
+			     struct ehca_pfshca *pfshca,
+			     const u64 vaddr,
+			     const u64 length,
+			     const u32 access_ctrl,
+			     const struct ipz_pd pd,
+			     struct ipz_mrmw_handle *mr_handle,
+			     u32 * lkey,
+			     u32 * rkey);
+
+/**
+ * hipz_h_register_rpage_mr - Register MR resource page in HW and FW .
+ *
+ * @pfmr:       platform specific for MR
+ * @pfshca:     platform specific for SHCA
+ * @queue_type: must be zero for MR
+ */
+u64 hipz_h_register_rpage_mr(const struct ipz_adapter_handle adapter_handle,
+			     const struct ipz_mrmw_handle *mr_handle,
+			     struct ehca_pfmr *pfmr,
+			     struct ehca_pfshca *pfshca,
+			     const u8 pagesize,
+			     const u8 queue_type,
+			     const u64 logical_address_of_page,
+			     const u64 count);
+
+/**
+ * hipz_h_query_mr - Query MR in HW and FW.
+ *
+ * @pfmr:             platform specific for MR
+ * @mr_handle:        Memory Region Handle
+ * @mr_local_length:  Local MR Length
+ * @mr_local_vaddr:   Local MR I/O Virtual Address
+ * @mr_remote_length: Remote MR Length
+ * @mr_remote_vaddr   Remote MR I/O Virtual Address
+ * @access_ctrl:      Memory Region Access Controls
+ * @pd:               Protection Domain
+ * lkey:              L_Key
+ * rkey:              R_Key
+ */
+u64 hipz_h_query_mr(const struct ipz_adapter_handle adapter_handle,
+		    struct ehca_pfmr *pfmr,
+		    const struct ipz_mrmw_handle *mr_handle,
+		    u64 * mr_local_length,
+		    u64 * mr_local_vaddr,
+		    u64 * mr_remote_length,
+		    u64 * mr_remote_vaddr,
+		    u32 * access_ctrl,
+		    struct ipz_pd *pd,
+		    u32 * lkey,
+		    u32 * rkey);
+
+/**
+ * hipz_h_free_resource_mr - Free MR resources in HW and FW.
+ *
+ * @pfmr:      platform specific for MR
+ * @mr_handle: Memory Region Handle
+ */
+u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle adapter_handle,
+			    struct ehca_pfmr *pfmr,
+			    const struct ipz_mrmw_handle *mr_handle);
+
+/**
+ * hipz_h_reregister_pmr - Reregister MR in HW and FW.
+ *
+ * @pfmr:        platform specific for MR
+ * @pfshca:      platform specific for SHCA
+ * @mr_handle:   Memory Region Handle
+ * @vaddr_in:    Memory Region I/O Virtual Address
+ * @length:      Memory Region Length
+ * @access_ctrl: Memory Region Access Controls
+ * @pd:          Protection Domain
+ * @mr_addr_cb:  Logical Address of MR Control Block
+ * @vaddr_out:   Memory Region I/O Virtual Address
+ * lkey:         L_Key
+ * rkey:         R_Key
+ *
+ */
+u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
+			  struct ehca_pfmr *pfmr,
+			  struct ehca_pfshca *pfshca,
+			  const struct ipz_mrmw_handle *mr_handle,
+			  const u64 vaddr_in,
+			  const u64 length,
+			  const u32 access_ctrl,
+			  const struct ipz_pd pd,
+			  const u64 mr_addr_cb,
+			  u64 * vaddr_out,
+			  u32 * lkey,
+			  u32 * rkey);
+
+/**
+ * hipz_h_register_smr - Register shared MR in HW and FW.
+ *
+ * @pfmr:           platform specific for new shared MR
+ * @orig_pfmr:      platform specific for original MR
+ * @pfshca:         platform specific for SHCA
+ * @orig_mr_handle: Memory Region Handle of original MR
+ * @vaddr_in:       Memory Region I/O Virtual Address of new shared MR
+ * @access_ctrl:    Memory Region Access Controls of new shared MR
+ * @pd:             Protection Domain of new shared MR
+ * @mr_handle:      Memory Region Handle of new shared MR
+ * @lkey:           L_Key of new shared MR
+ * @rkey:           R_Key of new shared MR
+ */
+u64 hipz_h_register_smr(const struct ipz_adapter_handle adapter_handle,
+			struct ehca_pfmr *pfmr,
+			struct ehca_pfmr *orig_pfmr,
+			struct ehca_pfshca *pfshca,
+			const struct ipz_mrmw_handle *orig_mr_handle,
+			const u64 vaddr_in,
+			const u32 access_ctrl,
+			const struct ipz_pd pd,
+			struct ipz_mrmw_handle *mr_handle,
+			u32 * lkey,
+			u32 * rkey);
+
+u64 hipz_h_alloc_resource_mw(const struct ipz_adapter_handle adapter_handle,
+			     struct ehca_pfmw *pfmw,
+			     struct ehca_pfshca *pfshca,
+			     const struct ipz_pd pd,
+			     struct ipz_mrmw_handle *mw_handle,
+			     u32 * rkey);
+
+u64 hipz_h_query_mw(const struct ipz_adapter_handle adapter_handle,
+		    struct ehca_pfmw *pfmw,
+		    const struct ipz_mrmw_handle *mw_handle,
+		    u32 * rkey,
+		    struct ipz_pd *pd);
+
+u64 hipz_h_free_resource_mw(const struct ipz_adapter_handle adapter_handle,
+			    struct ehca_pfmw *pfmw,
+			    const struct ipz_mrmw_handle *mw_handle);
+
+u64 hipz_h_error_data(const struct ipz_adapter_handle adapter_handle,
+		      const u64 ressource_handle,
+		      void *rblock,
+		      unsigned long *byte_count);
+
+#endif /* __HCP_IF_H__ */
drivers/infiniband/hw/ehca/hcp_if.c +2028 -0

2,028 lines not on this page · raw message

#1 lore raw
Quoted 16 lines · Heiko J Schick

+u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,

drivers/infiniband/hw/ehca/hcp_if.h +14 -0
+			     struct ehca_pfqp *pfqp,
+			     const u8 servicetype,
+			     const u8 daqp_ctrl,
+			     const u8 signalingtype,
+			     const u8 ud_av_l_key_ctl,
+			     const struct ipz_cq_handle send_cq_handle,
+			     const struct ipz_cq_handle receive_cq_handle,
+			     const struct ipz_eq_handle async_eq_handle,
+			     const u32 qp_token,
+			     const struct ipz_pd pd,
+			     const u16 max_nr_send_wqes,
+			     const u16 max_nr_receive_wqes,
+			     const u8 max_nr_send_sges,
+			     const u8 max_nr_receive_sges,

drivers/infiniband/hw/ehca/hcp_if.h line 124

Quoted 10 lines
drivers/infiniband/hw/ehca/hcp_if.h +10 -0
+			     const u32 ud_av_l_key,
+			     struct ipz_qp_handle *qp_handle,
+			     u32 * qp_nr,
+			     u16 * act_nr_send_wqes,
+			     u16 * act_nr_receive_wqes,
+			     u8 * act_nr_send_sges,
+			     u8 * act_nr_receive_sges,
+			     u32 * nr_sq_pages,
+			     u32 * nr_rq_pages,
+			     struct h_galpas *h_galpas);

25 parameters? If you tell me which drugs were involved in this code, I know what to stay away from. Might be the current record for any code ever proposed for inclusion.

The whole patch is full of parameter-happy functions with this one being the ugly top of the iceberg. I sincerely hope this is not a defined ABI and can still be changed.

Jörn

Signature · 4 lines
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
-- Brian W. Kernighan
#2 lore raw
Quoted 3 lines · Jörn Engel

The whole patch is full of parameter-happy functions with this one being the ugly top of the iceberg. I sincerely hope this is not a defined ABI and can still be changed.

It's not in mainline, so it can be changed.

Pekka

#3 lore raw
Quoted 6 lines · Pekka Enberg
Quoted 3 lines · Jörn Engel

The whole patch is full of parameter-happy functions with this one being the ugly top of the iceberg. I sincerely hope this is not a defined ABI and can still be changed.

It's not in mainline, so it can be changed.

I was thinking more about firmware ABI.

Jörn

Signature · 3 lines
But this is not to say that the main benefit of Linux and other GPL
software is lower-cost. Control is the main benefit--cost is secondary.
-- Bruce Perens
#4 lore raw
In reply to Jörn Engel
Quoted 30 lines · Jörn Engel
Quoted 16 lines · Heiko J Schick

+u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,

drivers/infiniband/hw/ehca/hcp_if.h +14 -0
+			     struct ehca_pfqp *pfqp,
+			     const u8 servicetype,
+			     const u8 daqp_ctrl,
+			     const u8 signalingtype,
+			     const u8 ud_av_l_key_ctl,
+			     const struct ipz_cq_handle send_cq_handle,
+			     const struct ipz_cq_handle receive_cq_handle,
+			     const struct ipz_eq_handle async_eq_handle,
+			     const u32 qp_token,
+			     const struct ipz_pd pd,
+			     const u16 max_nr_send_wqes,
+			     const u16 max_nr_receive_wqes,
+			     const u8 max_nr_send_sges,
+			     const u8 max_nr_receive_sges,

drivers/infiniband/hw/ehca/hcp_if.h line 124

Quoted 10 lines
drivers/infiniband/hw/ehca/hcp_if.h +10 -0
+			     const u32 ud_av_l_key,
+			     struct ipz_qp_handle *qp_handle,
+			     u32 * qp_nr,
+			     u16 * act_nr_send_wqes,
+			     u16 * act_nr_receive_wqes,
+			     u8 * act_nr_send_sges,
+			     u8 * act_nr_receive_sges,
+			     u32 * nr_sq_pages,
+			     u32 * nr_rq_pages,
+			     struct h_galpas *h_galpas);

25 parameters? If you tell me which drugs were involved in this code, I know what to stay away from. Might be the current record for any code ever proposed for inclusion.

Quoted 1 line

The whole patch is full of parameter-happy functions with this one being the ugly top of the iceberg. I sincerely hope this is not a defined ABI and can still be changed.

What's worse; look at the stack usage on that sucker alone:

10 pointers, 6 u8, 2 u16, 2 u32, and topped off with 3 unknown-sized "struct ipz_cq_handle", an unknown-sized "struct ipz_pd". The alignment alone probably chews up at least another couple bytes in there somewhere too. That's at _least_ 98 + 3*sizeof(struct ipz_cq_handle) + sizeof(struct ipz_pd) on a 64-bit platform (58 + 3*sizeof(struct ipz_cq_handle) + sizeof(struct ipz_pd) on 32-bit). Not to mention the fact that you totally screwed the compiler's chances of ever passing the important stuff in registers. And you haven't even gotten into local variables yet.

Cheers,
Kyle Moffett

#5 lore raw
In reply to Jörn Engel
Quoted 1 line · J=F6rn Engel writes:

25 parameters=3F If you tell me which drugs were involved in this co=

de,

Quoted 1 line

I know what to stay away from.

You really need to ask the firmware architects that, since this is basically a single firmware call.

Mind you, since a lot of the parameters are used to return individual bytes or half-words, which are then put into structures, it might be better to pass the pointers to the structures and let the wrapper put the values straight into the structures.

Paul.

#6 lore raw

We started like that to get a clean interface between the register intensive h_calls and the driver code.
We're in the middle of the tradeoff "nice interface" vs strict fencing of data structures from one code piece to another.
Initially these functions, which only move paramaters from the stack into registers and back, were inline functions.
So the compiler collapsed the function call into "nothing", which won't work if you use a struct *.
Somewhen during code reviews people agreed that having this many inline functions leads to large header files
which isn't a good idea either.

We're about to change that interface again, so what should be the max number of parameters in a function call?
The limit in existing kernel code is somewhere between 5-8 (just as a reminder, 8 is the max nr of parameters to be passed by register on ppc)

christoph raisch

Paul Mackerras <[email protected]> wrote on 28.04.2006 00:42:14:

Quoted 14 lines
Quoted 2 lines · Jörn Engel

25 parameters? If you tell me which drugs were involved in this code, I know what to stay away from.

You really need to ask the firmware architects that, since this is basically a single firmware call.

Mind you, since a lot of the parameters are used to return individual bytes or half-words, which are then put into structures, it might be better to pass the pointers to the structures and let the wrapper put the values straight into the structures.

Paul.

#7 lore raw
In reply to Paul Mackerras

Paul Mackerras <[email protected]> wrote on 28.04.2006 00:42:14:

Quoted 6 lines

Mind you, since a lot of the parameters are used to return individual bytes or half-words, which are then put into structures, it might be better to pass the pointers to the structures and let the wrapper put the values straight into the structures.

Paul.

As Paul already mentioned we can't change the firmware interface.

...so we would propose the following solution:
For the two h_call wrappers with more than 8 parameters we'll change to the following signature:

hipz_h_alloc_resource_cq(const struct ipz_adapter_handle adapter_handle,
struct ehca_cq *cq, /* used for input and output
parameters */

                         const struct ipz_eq_handle eq_handle);

hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,
struct ehca_qp * qp, /* used for input and output
parameters */
struct ehca_alloc_qp_params * param); /*input
params not in ehca_qp*/

hipz_h_alloc_resource_mr(const struct ipz_adapter_handle adapter_handle,
struct ehca_mr *mr,
const u64 vaddr,
const u64 length,
const u32 access_ctrl,
const struct ipz_pd pd);

u64 hipz_h_query_mr(const struct ipz_adapter_handle adapter_handle,

                    struct ehca_mr *mr);

u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
struct ehca_mr *mr,
const u64 vaddr_in,
const u64 length,
const u32 access_ctrl,
const struct ipz_pd pd,
const u64 mr_addr_cb);

u64 hipz_h_register_smr(const struct ipz_adapter_handle adapter_handle,
struct ehca_mr *mr,
struct ehca_mr *orig_mr,
const u64 vaddr_in,
const u32 access_ctrl,
const struct ipz_pd pd);

What do you think about this solution?

Gruss / Regards . . . Christoph Raisch