LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 13/16] ehca: hardware interface
From: Heiko J Schick @ 2006-05-15 17:43 UTC (permalink / raw)
  To: openib-general, Christoph Raisch, Hoang-Nam Nguyen, Marcus Eder,
	schihei, linux-kernel, linuxppc-dev

Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>


  drivers/infiniband/hw/ehca/hipz_fns.h      |   68 ++++
  drivers/infiniband/hw/ehca/hipz_fns_core.h |  122 ++++++++
  drivers/infiniband/hw/ehca/hipz_hw.h       |  395 +++++++++++++++++++++++++++++
  3 files changed, 585 insertions(+)



--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/hipz_fns.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/hipz_fns.h	2006-05-02 12:48:48.000000000 +0200
@@ -0,0 +1,68 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  HW abstraction register functions
+ *
+ *  Authors: Christoph Raisch <raisch@de.ibm.com>
+ *           Reinhard Ernst <rernst@de.ibm.com>
+ *
+ *  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.
+ */
+
+#ifndef __HIPZ_FNS_H__
+#define __HIPZ_FNS_H__
+
+#include "ehca_classes.h"
+#include "hipz_hw.h"
+
+#include "hipz_fns_core.h"
+
+#define hipz_galpa_store_eq(gal, offset, value) \
+	hipz_galpa_store(gal, EQTEMM_OFFSET(offset), value)
+
+#define hipz_galpa_load_eq(gal, offset) \
+	hipz_galpa_load(gal, EQTEMM_OFFSET(offset))
+
+#define hipz_galpa_store_qped(gal, offset, value) \
+	hipz_galpa_store(gal, QPEDMM_OFFSET(offset), value)
+
+#define hipz_galpa_load_qped(gal, offset) \
+	hipz_galpa_load(gal, QPEDMM_OFFSET(offset))
+
+#define hipz_galpa_store_mrmw(gal, offset, value) \
+	hipz_galpa_store(gal, MRMWMM_OFFSET(offset), value)
+
+#define hipz_galpa_load_mrmw(gal, offset) \
+	hipz_galpa_load(gal, MRMWMM_OFFSET(offset))
+
+#endif
--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/hipz_fns_core.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/hipz_fns_core.h	2006-05-02 12:48:48.000000000 +0200
@@ -0,0 +1,122 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  HW abstraction register functions
+ *
+ *  Authors: Christoph Raisch <raisch@de.ibm.com>
+ *           Heiko J Schick <schickhj@de.ibm.com>
+ *           Hoang-Nam Nguyen <hnguyen@de.ibm.com>
+ *           Reinhard Ernst <rernst@de.ibm.com>
+ *
+ *  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.
+ */
+
+#ifndef __HIPZ_FNS_CORE_H__
+#define __HIPZ_FNS_CORE_H__
+
+#include "hcp_phyp.h"
+#include "hipz_hw.h"
+
+#define hipz_galpa_store_cq(gal, offset, value) \
+	hipz_galpa_store(gal, CQTEMM_OFFSET(offset), value)
+
+#define hipz_galpa_load_cq(gal, offset) \
+	hipz_galpa_load(gal, CQTEMM_OFFSET(offset))
+
+#define hipz_galpa_store_qp(gal,offset, value) \
+	hipz_galpa_store(gal, QPTEMM_OFFSET(offset), value)
+#define hipz_galpa_load_qp(gal, offset) \
+	hipz_galpa_load(gal,QPTEMM_OFFSET(offset))
+
+static inline void hipz_update_sqa(struct ehca_qp *qp, u16 nr_wqes)
+{
+	struct h_galpa gal;
+
+	EDEB_EN(7, "qp=%p", qp);
+	gal = qp->galpas.kernel;
+	/*  ringing doorbell :-) */
+	hipz_galpa_store_qp(gal, qpx_sqa, EHCA_BMASK_SET(QPX_SQADDER, nr_wqes));
+	EDEB_EX(7, "qp=%p QPx_SQA = %i", qp, nr_wqes);
+}
+
+static inline void hipz_update_rqa(struct ehca_qp *qp, u16 nr_wqes)
+{
+	struct h_galpa gal;
+
+	EDEB_EN(7, "qp=%p", qp);
+	gal = qp->galpas.kernel;
+	/*  ringing doorbell :-) */
+	hipz_galpa_store_qp(gal, qpx_rqa, EHCA_BMASK_SET(QPX_RQADDER, nr_wqes));
+	EDEB_EX(7, "qp=%p QPx_RQA = %i", qp, nr_wqes);
+}
+
+static inline void hipz_update_feca(struct ehca_cq *cq, u32 nr_cqes)
+{
+	struct h_galpa gal;
+
+	EDEB_EN(7, "cq=%p", cq);
+	gal = cq->galpas.kernel;
+	hipz_galpa_store_cq(gal, cqx_feca,
+			    EHCA_BMASK_SET(CQX_FECADDER, nr_cqes));
+	EDEB_EX(7, "cq=%p CQx_FECA = %i", cq, nr_cqes);
+}
+
+static inline void hipz_set_cqx_n0(struct ehca_cq *cq, u32 value)
+{
+	struct h_galpa gal;
+	u64 CQx_N0_reg = 0;
+
+	EDEB_EN(7, "cq=%p event on solicited completion -- write CQx_N0", cq);
+	gal = cq->galpas.kernel;
+	hipz_galpa_store_cq(gal, cqx_n0,
+			    EHCA_BMASK_SET(CQX_N0_GENERATE_SOLICITED_COMP_EVENT,
+					   value));
+	CQx_N0_reg = hipz_galpa_load_cq(gal, cqx_n0);
+	EDEB_EX(7, "cq=%p loaded CQx_N0=%lx", cq, (unsigned long)CQx_N0_reg);
+}
+
+static inline void hipz_set_cqx_n1(struct ehca_cq *cq, u32 value)
+{
+	struct h_galpa gal;
+	u64 CQx_N1_reg = 0;
+
+	EDEB_EN(7, "cq=%p event on completion -- write CQx_N1",
+		cq);
+	gal = cq->galpas.kernel;
+	hipz_galpa_store_cq(gal, cqx_n1,
+			    EHCA_BMASK_SET(CQX_N1_GENERATE_COMP_EVENT, value));
+	CQx_N1_reg = hipz_galpa_load_cq(gal, cqx_n1);
+	EDEB_EX(7, "cq=%p loaded CQx_N1=%lx", cq, (unsigned long)CQx_N1_reg);
+}
+
+#endif /* __HIPZ_FNC_CORE_H__ */
--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/hipz_hw.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/hipz_hw.h	2006-05-02 10:55:26.000000000 +0200
@@ -0,0 +1,395 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  eHCA register definitions
+ *
+ *  Authors: Waleri Fomin <fomin@de.ibm.com>
+ *           Christoph Raisch <raisch@de.ibm.com>
+ *           Reinhard Ernst <rernst@de.ibm.com>
+ *
+ *  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.
+ */
+
+#ifndef __HIPZ_HW_H__
+#define __HIPZ_HW_H__
+
+#include "ehca_tools.h"
+
+/** QP Table Entry Memory Map
+ */
+struct hipz_qptemm {
+	u64 qpx_hcr;
+	u64 qpx_c;
+	u64 qpx_herr;
+	u64 qpx_aer;
+/* 0x20*/
+	u64 qpx_sqa;
+	u64 qpx_sqc;
+	u64 qpx_rqa;
+	u64 qpx_rqc;
+/* 0x40*/
+	u64 qpx_st;
+	u64 qpx_pmstate;
+	u64 qpx_pmfa;
+	u64 qpx_pkey;
+/* 0x60*/
+	u64 qpx_pkeya;
+	u64 qpx_pkeyb;
+	u64 qpx_pkeyc;
+	u64 qpx_pkeyd;
+/* 0x80*/
+	u64 qpx_qkey;
+	u64 qpx_dqp;
+	u64 qpx_dlidp;
+	u64 qpx_portp;
+/* 0xa0*/
+	u64 qpx_slidp;
+	u64 qpx_slidpp;
+	u64 qpx_dlida;
+	u64 qpx_porta;
+/* 0xc0*/
+	u64 qpx_slida;
+	u64 qpx_slidpa;
+	u64 qpx_slvl;
+	u64 qpx_ipd;
+/* 0xe0*/
+	u64 qpx_mtu;
+	u64 qpx_lato;
+	u64 qpx_rlimit;
+	u64 qpx_rnrlimit;
+/* 0x100*/
+	u64 qpx_t;
+	u64 qpx_sqhp;
+	u64 qpx_sqptp;
+	u64 qpx_nspsn;
+/* 0x120*/
+	u64 qpx_nspsnhwm;
+	u64 reserved1;
+	u64 qpx_sdsi;
+	u64 qpx_sdsbc;
+/* 0x140*/
+	u64 qpx_sqwsize;
+	u64 qpx_sqwts;
+	u64 qpx_lsn;
+	u64 qpx_nssn;
+/* 0x160 */
+	u64 qpx_mor;
+	u64 qpx_cor;
+	u64 qpx_sqsize;
+	u64 qpx_erc;
+/* 0x180*/
+	u64 qpx_rnrrc;
+	u64 qpx_ernrwt;
+	u64 qpx_rnrresp;
+	u64 qpx_lmsna;
+/* 0x1a0 */
+	u64 qpx_sqhpc;
+	u64 qpx_sqcptp;
+	u64 qpx_sigt;
+	u64 qpx_wqecnt;
+/* 0x1c0*/
+
+	u64 qpx_rqhp;
+	u64 qpx_rqptp;
+	u64 qpx_rqsize;
+	u64 qpx_nrr;
+/* 0x1e0*/
+	u64 qpx_rdmac;
+	u64 qpx_nrpsn;
+	u64 qpx_lapsn;
+	u64 qpx_lcr;
+/* 0x200*/
+	u64 qpx_rwc;
+	u64 qpx_rwva;
+	u64 qpx_rdsi;
+	u64 qpx_rdsbc;
+/* 0x220*/
+	u64 qpx_rqwsize;
+	u64 qpx_crmsn;
+	u64 qpx_rdd;
+	u64 qpx_larpsn;
+/* 0x240*/
+	u64 qpx_pd;
+	u64 qpx_scqn;
+	u64 qpx_rcqn;
+	u64 qpx_aeqn;
+/* 0x260*/
+	u64 qpx_aaelog;
+	u64 qpx_ram;
+	u64 qpx_rdmaqe0;
+	u64 qpx_rdmaqe1;
+/* 0x280*/
+	u64 qpx_rdmaqe2;
+	u64 qpx_rdmaqe3;
+	u64 qpx_nrpsnhwm;
+/* 0x298*/
+	u64 reserved[(0x400 - 0x298) / 8];
+/* 0x400 extended data */
+	u64 reserved_ext[(0x500 - 0x400) / 8];
+/* 0x500 */
+	u64 reserved2[(0x1000 - 0x500) / 8];
+/* 0x1000      */
+};
+
+#define QPX_SQADDER EHCA_BMASK_IBM(48,63)
+#define QPX_RQADDER EHCA_BMASK_IBM(48,63)
+
+#define QPTEMM_OFFSET(x) offsetof(struct hipz_qptemm,x)
+
+/** MRMWPT Entry Memory Map
+ */
+struct hipz_mrmwmm {
+	/* 0x00 */
+	u64 mrx_hcr;
+
+	u64 mrx_c;
+	u64 mrx_herr;
+	u64 mrx_aer;
+	/* 0x20 */
+	u64 mrx_pp;
+	u64 reserved1;
+	u64 reserved2;
+	u64 reserved3;
+	/* 0x40 */
+	u64 reserved4[(0x200 - 0x40) / 8];
+	/* 0x200 */
+	u64 mrx_ctl[64];
+
+};
+
+#define MRX_HCR_LPARID_VALID EHCA_BMASK_IBM(0,0)
+
+#define MRMWMM_OFFSET(x) offsetof(struct hipz_mrmwmm,x)
+
+struct hipz_qpedmm {
+	/* 0x00 */
+	u64 reserved0[(0x400) / 8];
+	/* 0x400 */
+	u64 qpedx_phh;
+	u64 qpedx_ppsgp;
+	/* 0x410 */
+	u64 qpedx_ppsgu;
+	u64 qpedx_ppdgp;
+	/* 0x420 */
+	u64 qpedx_ppdgu;
+	u64 qpedx_aph;
+	/* 0x430 */
+	u64 qpedx_apsgp;
+	u64 qpedx_apsgu;
+	/* 0x440 */
+	u64 qpedx_apdgp;
+	u64 qpedx_apdgu;
+	/* 0x450 */
+	u64 qpedx_apav;
+	u64 qpedx_apsav;
+	/* 0x460  */
+	u64 qpedx_hcr;
+	u64 reserved1[4];
+	/* 0x488 */
+	u64 qpedx_rrl0;
+	/* 0x490 */
+	u64 qpedx_rrrkey0;
+	u64 qpedx_rrva0;
+	/* 0x4a0 */
+	u64 reserved2;
+	u64 qpedx_rrl1;
+	/* 0x4b0 */
+	u64 qpedx_rrrkey1;
+	u64 qpedx_rrva1;
+	/* 0x4c0 */
+	u64 reserved3;
+	u64 qpedx_rrl2;
+	/* 0x4d0 */
+	u64 qpedx_rrrkey2;
+	u64 qpedx_rrva2;
+	/* 0x4e0 */
+	u64 reserved4;
+	u64 qpedx_rrl3;
+	/* 0x4f0 */
+	u64 qpedx_rrrkey3;
+	u64 qpedx_rrva3;
+};
+
+#define QPEDMM_OFFSET(x) offsetof(struct hipz_QPEDMM,x)
+
+/** CQ Table Entry Memory Map
+ */
+struct hipz_cqtemm {
+	u64 cqx_hcr;
+	u64 cqx_c;
+	u64 cqx_herr;
+	u64 cqx_aer;
+/* 0x20  */
+	u64 cqx_ptp;
+	u64 cqx_tp;
+	u64 cqx_fec;
+	u64 cqx_feca;
+/* 0x40  */
+	u64 cqx_ep;
+	u64 cqx_eq;
+/* 0x50  */
+	u64 reserved1;
+	u64 cqx_n0;
+/* 0x60  */
+	u64 cqx_n1;
+	u64 reserved2[(0x1000 - 0x60) / 8];
+/* 0x1000 */
+};
+
+#define CQX_FEC_CQE_CNT           EHCA_BMASK_IBM(32,63)
+#define CQX_FECADDER              EHCA_BMASK_IBM(32,63)
+#define CQX_N0_GENERATE_SOLICITED_COMP_EVENT EHCA_BMASK_IBM(0,0)
+#define CQX_N1_GENERATE_COMP_EVENT EHCA_BMASK_IBM(0,0)
+
+#define CQTEMM_OFFSET(x) offsetof(struct hipz_cqtemm,x)
+
+/** EQ Table Entry Memory Map
+ */
+struct hipz_eqtemm {
+	u64 eqx_hcr;
+	u64 eqx_c;
+
+	u64 eqx_herr;
+	u64 eqx_aer;
+/* 0x20 */
+	u64 eqx_ptp;
+	u64 eqx_tp;
+	u64 eqx_ssba;
+	u64 eqx_psba;
+
+/* 0x40 */
+	u64 eqx_cec;
+	u64 eqx_meql;
+	u64 eqx_xisbi;
+	u64 eqx_xisc;
+/* 0x60 */
+	u64 eqx_it;
+
+};
+
+#define EQTEMM_OFFSET(x) offsetof(struct hipz_eqtemm,x)
+
+/* access control defines for MR/MW */
+#define HIPZ_ACCESSCTRL_L_WRITE  0x00800000
+#define HIPZ_ACCESSCTRL_R_WRITE  0x00400000
+#define HIPZ_ACCESSCTRL_R_READ   0x00200000
+#define HIPZ_ACCESSCTRL_R_ATOMIC 0x00100000
+#define HIPZ_ACCESSCTRL_MW_BIND  0x00080000
+
+/* query hca response block */
+struct hipz_query_hca {
+	u32 cur_reliable_dg;
+	u32 cur_qp;
+	u32 cur_cq;
+	u32 cur_eq;
+	u32 cur_mr;
+	u32 cur_mw;
+	u32 cur_ee_context;
+	u32 cur_mcast_grp;
+	u32 cur_qp_attached_mcast_grp;
+	u32 reserved1;
+	u32 cur_ipv6_qp;
+	u32 cur_eth_qp;
+	u32 cur_hp_mr;
+	u32 reserved2[3];
+	u32 max_rd_domain;
+	u32 max_qp;
+	u32 max_cq;
+	u32 max_eq;
+	u32 max_mr;
+	u32 max_hp_mr;
+	u32 max_mw;
+	u32 max_mrwpte;
+	u32 max_special_mrwpte;
+	u32 max_rd_ee_context;
+	u32 max_mcast_grp;
+	u32 max_total_mcast_qp_attach;
+	u32 max_mcast_qp_attach;
+	u32 max_raw_ipv6_qp;
+	u32 max_raw_ethy_qp;
+	u32 internal_clock_frequency;
+	u32 max_pd;
+	u32 max_ah;
+	u32 max_cqe;
+	u32 max_wqes_wq;
+	u32 max_partitions;
+	u32 max_rr_ee_context;
+	u32 max_rr_qp;
+	u32 max_rr_hca;
+	u32 max_act_wqs_ee_context;
+	u32 max_act_wqs_qp;
+	u32 max_sge;
+	u32 max_sge_rd;
+	u32 memory_page_size_supported;
+	u64 max_mr_size;
+	u32 local_ca_ack_delay;
+	u32 num_ports;
+	u32 vendor_id;
+	u32 vendor_part_id;
+	u32 hw_ver;
+	u64 node_guid;
+	u64 hca_cap_indicators;
+	u32 data_counter_register_size;
+	u32 max_shared_rq;
+	u32 max_isns_eq;
+	u32 max_neq;
+} __attribute__ ((packed));
+
+/* query port response block */
+struct hipz_query_port {
+	u32 state;
+	u32 bad_pkey_cntr;
+	u32 lmc;
+	u32 lid;
+	u32 subnet_timeout;
+	u32 qkey_viol_cntr;
+	u32 sm_sl;
+	u32 sm_lid;
+	u32 capability_mask;
+	u32 init_type_reply;
+	u32 pkey_tbl_len;
+	u32 gid_tbl_len;
+	u64 gid_prefix;
+	u32 port_nr;
+	u16 pkey_entries[16];
+	u8  reserved1[32];
+	u32 trent_size;
+	u32 trbuf_size;
+	u64 max_msg_sz;
+	u32 max_mtu;
+	u32 vl_cap;
+	u8  reserved2[1900];
+	u64 guid_entries[255];
+} __attribute__ ((packed));
+
+#endif

^ permalink raw reply

* [PATCH 14/16] ehca: queue page table handling
From: Heiko J Schick @ 2006-05-15 17:43 UTC (permalink / raw)
  To: openib-general, Christoph Raisch, Hoang-Nam Nguyen, Marcus Eder,
	schihei, linux-kernel, linuxppc-dev

Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>


  drivers/infiniband/hw/ehca/ipz_pt_fn.c |  177 ++++++++++++++++++++++
  drivers/infiniband/hw/ehca/ipz_pt_fn.h |  254 +++++++++++++++++++++++++++++++++
  2 files changed, 431 insertions(+)



--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/ipz_pt_fn.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/ipz_pt_fn.h	2006-05-12 12:25:43.000000000 +0200
@@ -0,0 +1,254 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  internal queue handling
+ *
+ *  Authors: Waleri Fomin <fomin@de.ibm.com>
+ *           Reinhard Ernst <rernst@de.ibm.com>
+ *           Christoph Raisch <raisch@de.ibm.com>
+ *
+ *  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.
+ */
+
+#ifndef __IPZ_PT_FN_H__
+#define __IPZ_PT_FN_H__
+
+#include "ehca_qes.h"
+#define EHCA_PAGESHIFT   12
+#define EHCA_PAGESIZE   4096UL
+#define EHCA_PT_ENTRIES 512UL
+
+#include "ehca_tools.h"
+#include "ehca_qes.h"
+
+/* struct generic ehca page
+ */
+struct ipz_page {
+	u8 entries[EHCA_PAGESIZE];
+};
+
+/* struct generic queue in linux kernel virtual memory (kv)
+ */
+struct ipz_queue {
+	u64 current_q_offset;	/* current queue entry */
+
+	struct ipz_page **queue_pages;	/* array of pages belonging to queue */
+	u32 qe_size;		/* queue entry size */
+	u32 act_nr_of_sg;
+	u32 queue_length;	/* queue length allocated in bytes */
+	u32 pagesize;
+	u32 toggle_state;	/* toggle flag - per page */
+	u32 dummy3;		/* 64 bit alignment */
+};
+
+/*  return current Queue Entry for a certain q_offset
+ *   returns address (kv) of Queue Entry
+ */
+static inline void *ipz_qeit_calc(struct ipz_queue *queue, u64 q_offset)
+{
+	struct ipz_page *current_page = NULL;
+	if (q_offset >= queue->queue_length)
+		return NULL;
+	current_page = (queue->queue_pages)[q_offset >> EHCA_PAGESHIFT];
+	return  &current_page->entries[q_offset & (EHCA_PAGESIZE - 1)];
+}
+
+/*  return current Queue Entry
+ *   returns address (kv) of Queue Entry
+ */
+static inline void *ipz_qeit_get(struct ipz_queue *queue)
+{
+	return ipz_qeit_calc(queue, queue->current_q_offset);
+}
+
+/*  return current Queue Page , increment Queue Page iterator from
+ *   page to page in struct ipz_queue, last increment will return 0! and
+ *   NOT wrap
+ *   returns address (kv) of Queue Page
+ *   warning don't use in parallel with ipz_QE_get_inc()
+ */
+void *ipz_qpageit_get_inc(struct ipz_queue *queue);
+
+/*  return current Queue Entry, increment Queue Entry iterator by one
+ *   step in struct ipz_queue, will wrap in ringbuffer
+ *   @returns address (kv) of Queue Entry BEFORE increment
+ *   warning don't use in parallel with ipz_qpageit_get_inc()
+ *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
+ */
+static inline void *ipz_qeit_get_inc(struct ipz_queue *queue)
+{
+	void *ret = NULL;
+
+	ret = ipz_qeit_get(queue);
+	queue->current_q_offset += queue->qe_size;
+	if (queue->current_q_offset >= queue->queue_length) {
+		queue->current_q_offset = 0;
+		/* toggle the valid flag */
+		queue->toggle_state = (~queue->toggle_state) & 1;
+	}
+
+	EDEB(7, "queue=%p ret=%p new current_q_addr=%lx qe_size=%x",
+	     queue, ret, queue->current_q_offset, queue->qe_size);
+
+	return ret;
+}
+
+/*  return current Queue Entry, increment Queue Entry iterator by one
+ *   step in struct ipz_queue, will wrap in ringbuffer
+ *   returns address (kv) of Queue Entry BEFORE increment
+ *   returns 0 and does not increment, if wrong valid state
+ *   warning don't use in parallel with ipz_qpageit_get_inc()
+ *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
+ */
+static inline void *ipz_qeit_get_inc_valid(struct ipz_queue *queue)
+{
+	struct ehca_cqe *cqe = ipz_qeit_get(queue);
+	u32 cqe_flags = cqe->cqe_flags;
+
+	if ((cqe_flags >> 7) != (queue->toggle_state & 1))
+		return NULL;
+
+	ipz_qeit_get_inc(queue);
+	return cqe;
+}
+
+/*  returns and resets Queue Entry iterator
+ *   returns address (kv) of first Queue Entry
+ */
+static inline void *ipz_qeit_reset(struct ipz_queue *queue)
+{
+	queue->current_q_offset = 0;
+	return ipz_qeit_get(queue);
+}
+
+/** struct generic page table
+ */
+struct ipz_pt {
+	u64 entries[EHCA_PT_ENTRIES];
+};
+
+/* struct page table for a queue, only to be used in pf
+ */
+struct ipz_qpt {
+	/* queue page tables (kv), use u64 because we know the element length */
+	u64 *qpts;
+	u32 allocated_qpts_entries;
+	u32 nr_of_PTEs;		/*  number of page table entries PTE iterators */
+	u64 *current_pte_addr;
+};
+
+/* constructor for a ipz_queue_t, placement new for ipz_queue_t,
+ *  new for all dependent datastructors
+ *
+ *  all QP Tables are the same
+ *  flow:
+ *     allocate+pin queue
+ *  see ipz_qpt_ctor()
+ *  returns true if ok, false if out of memory
+ */
+int ipz_queue_ctor(struct ipz_queue *queue, const u32 nr_of_pages,
+		   const u32 pagesize, const u32 qe_size,
+		   const u32 nr_of_sg);
+
+/* destructor for a ipz_queue_t
+ *  -# free queue
+ *  see ipz_queue_ctor()
+ *  returns true if ok, false if queue was NULL-ptr of free failed
+ */
+int ipz_queue_dtor(struct ipz_queue *queue);
+
+/* constructor for a ipz_qpt_t,
+ * placement new for struct ipz_queue, new for all dependent datastructors
+ *
+ *  all QP Tables are the same,
+ *  flow:
+ *  -# allocate+pin queue
+ *  -# initialise ptcb
+ *  -# allocate+pin PTs
+ *  -# link PTs to a ring, according to HCA Arch, set bit62 id needed
+ *  -# the ring must have room for exactly nr_of_PTEs
+ *  see ipz_qpt_ctor()
+ */
+void ipz_qpt_ctor(struct ipz_qpt *qpt,
+		  const u32 nr_of_QEs,
+		  const u32 pagesize,
+		  const u32 qe_size,
+		  const u8 lowbyte, const u8 toggle,
+		  u32 * act_nr_of_QEs, u32 * act_nr_of_pages);
+
+/*  return current Queue Entry, increment Queue Entry iterator by one
+ *   step in struct ipz_queue, will wrap in ringbuffer
+ *   returns address (kv) of Queue Entry BEFORE increment
+ *   warning don't use in parallel with ipz_qpageit_get_inc()
+ *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
+ *
+ *   fix EQ page problems
+ */
+void *ipz_qeit_eq_get_inc(struct ipz_queue *queue);
+
+/*  return current Event Queue Entry, increment Queue Entry iterator
+ *   by one step in struct ipz_queue if valid, will wrap in ringbuffer
+ *   returns address (kv) of Queue Entry BEFORE increment
+ *   returns 0 and does not increment, if wrong valid state
+ *   warning don't use in parallel with ipz_queue_QPageit_get_inc()
+ *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
+ */
+static inline void *ipz_eqit_eq_get_inc_valid(struct ipz_queue *queue)
+{
+	void *ret = ipz_qeit_get(queue);
+	u32 qe = *(u8 *) ret;
+	EDEB(7, "ipz_QEit_EQ_get_inc_valid qe=%x", qe);
+	if ((qe >> 7) == (queue->toggle_state & 1))
+		ipz_qeit_eq_get_inc(queue); /* this is a good one */
+	else
+		ret = NULL;
+	return ret;
+}
+
+/*
+ *   returns address (GX) of first queue entry
+ */
+static inline u64 ipz_qpt_get_firstpage(struct ipz_qpt *qpt)
+{
+	return be64_to_cpu(qpt->qpts[0]);
+}
+
+/*
+ *   returns address (kv) of first page of queue page table
+ */
+static inline void *ipz_qpt_get_qpt(struct ipz_qpt *qpt)
+{
+	return qpt->qpts;
+}
+
+#endif				/* __IPZ_PT_FN_H__ */
--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/ipz_pt_fn.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/ipz_pt_fn.c	2006-05-15 15:43:31.000000000 +0200
@@ -0,0 +1,177 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  internal queue handling
+ *
+ *  Authors: Waleri Fomin <fomin@de.ibm.com>
+ *           Reinhard Ernst <rernst@de.ibm.com>
+ *           Christoph Raisch <raisch@de.ibm.com>
+ *
+ *  Copyright (c) 2005 IBM Corporation
+ *
+ *  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.
+ */
+
+#define DEB_PREFIX "iptz"
+
+#include "ehca_tools.h"
+#include "ipz_pt_fn.h"
+
+extern int ehca_hwlevel;
+
+void *ipz_qpageit_get_inc(struct ipz_queue *queue)
+{
+	void *ret = ipz_qeit_get(queue);
+	queue->current_q_offset += queue->pagesize;
+	if (queue->current_q_offset > queue->queue_length) {
+		queue->current_q_offset -= queue->pagesize;
+		ret = NULL;
+	}
+	if (((u64)ret) % EHCA_PAGESIZE) {
+		EDEB(4, "ERROR!! not at PAGE-Boundary");
+		return NULL;
+	}
+	EDEB(7, "queue=%p ret=%p", queue, ret);
+	return ret;
+}
+
+void *ipz_qeit_eq_get_inc(struct ipz_queue *queue)
+{
+	void *ret = ipz_qeit_get(queue);
+	u64 last_entry_in_q = queue->queue_length - queue->qe_size;
+	queue->current_q_offset += queue->qe_size;
+	if (queue->current_q_offset > last_entry_in_q) {
+		queue->current_q_offset = 0;
+		queue->toggle_state = (~queue->toggle_state) & 1;
+	}
+
+	EDEB(7, "queue=%p ret=%p new current_q_offset=%lx qe_size=%x",
+	     queue, ret, queue->current_q_offset, queue->qe_size);
+
+	return ret;
+}
+
+int ipz_queue_ctor(struct ipz_queue *queue,
+		   const u32 nr_of_pages,
+		   const u32 pagesize, const u32 qe_size, const u32 nr_of_sg)
+{
+	int pages_per_kpage = PAGE_SIZE >> EHCA_PAGESHIFT;
+	int f;
+
+	EDEB_EN(7, "nr_of_pages=%x pagesize=%x qe_size=%x",
+		nr_of_pages, pagesize, qe_size);
+	if (pagesize > PAGE_SIZE) {
+		EDEB_ERR(4, "FATAL ERROR: pagesize=%x is greater than "
+			 "kernel page size", pagesize);
+		return 0;
+	}
+	if (!pages_per_kpage) {
+		EDEB_ERR(4, "FATAL ERROR: invalid kernel page size. "
+			"pages_per_kpage=%x", pages_per_kpage);
+		return 0;
+	}
+	queue->queue_length = nr_of_pages * pagesize;
+	queue->queue_pages = vmalloc(nr_of_pages * sizeof(void *));
+	if (!queue->queue_pages) {
+		EDEB(4, "ERROR!! didn't get the memory");
+		return 0;
+	}
+	memset(queue->queue_pages, 0, nr_of_pages * sizeof(void *));
+	/* allocate pages for queue:
+	   while loop allocates whole kernel pages
+	   if cond allocates so much mem needed for the rest of queue pages,
+	   which is nr_of_pages % pages_per_kpage
+	 */
+	f = 0;
+	while (f + pages_per_kpage <= nr_of_pages) {
+		u8 *kpage = kzalloc(PAGE_SIZE, GFP_KERNEL);
+		int k;
+		if (!kpage)
+			goto ipz_queue_ctor_exit0; /*NOMEM*/
+		for (k = 0; k < pages_per_kpage; k++) {
+			(queue->queue_pages)[f] = (struct ipz_page *)kpage;
+			kpage += EHCA_PAGESIZE;
+			f++;
+		}
+	}
+	if (f < nr_of_pages) {
+		u8 *kpage = kzalloc((nr_of_pages - f) * EHCA_PAGESIZE,
+				      GFP_KERNEL);
+		if (!kpage)
+			goto ipz_queue_ctor_exit0; /*NOMEM*/
+		while (f < nr_of_pages) {
+			(queue->queue_pages)[f] = (struct ipz_page *)kpage;
+			kpage += EHCA_PAGESIZE;
+			f++;
+		}
+	}
+
+	queue->current_q_offset = 0;
+	queue->qe_size = qe_size;
+	queue->act_nr_of_sg = nr_of_sg;
+	queue->pagesize = pagesize;
+	queue->toggle_state = 1;
+	EDEB_EX(7, "queue_length=%x queue_pages=%p qe_size=%x"
+		" act_nr_of_sg=%x", queue->queue_length, queue->queue_pages,
+		queue->qe_size, queue->act_nr_of_sg);
+	return 1;
+
+ ipz_queue_ctor_exit0:
+	EDEB_ERR(4, "Couldn't get alloc pages queue=%p f=%x nr_of_pages=%x",
+		 queue, f, nr_of_pages);
+	for (f = 0; f < nr_of_pages; f += pages_per_kpage) {
+		if (!(queue->queue_pages)[f])
+			break;
+		kfree((queue->queue_pages)[f]);
+	}
+	return 0;
+}
+
+int ipz_queue_dtor(struct ipz_queue *queue)
+{
+	int pages_per_kpage = PAGE_SIZE >> EHCA_PAGESHIFT;
+	int g;
+	int nr_pages;
+
+	EDEB_EN(7, "ipz_queue pointer=%p", queue);
+	if (!queue || !queue->queue_pages) {
+		EDEB_ERR(4, "queue or queue_pages is NULL");
+		return 0;
+	}
+	EDEB(7, "destructing a queue with the following "
+	     "properties:\n nr_of_pages=%x pagesize=%x qe_size=%x",
+	     queue->act_nr_of_sg, queue->pagesize, queue->qe_size);
+	nr_pages = queue->queue_length / queue->pagesize;
+	for (g = 0; g < nr_pages; g += pages_per_kpage)
+		kfree((queue->queue_pages)[g]);
+	vfree(queue->queue_pages);
+
+	EDEB_EX(7, "queue freed!");
+	return 1;
+}

^ permalink raw reply

* [PATCH 15/16] ehca: PHYP abstraction layer
From: Heiko J Schick @ 2006-05-15 17:43 UTC (permalink / raw)
  To: openib-general, Christoph Raisch, Hoang-Nam Nguyen, Marcus Eder,
	schihei, linux-kernel, linuxppc-dev

Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>


  drivers/infiniband/hw/ehca/hcp_phyp.c |   92 ++++++++++++++++++++++++++++++++
  drivers/infiniband/hw/ehca/hcp_phyp.h |   95 ++++++++++++++++++++++++++++++++++
  2 files changed, 187 insertions(+)



--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/hcp_phyp.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/hcp_phyp.h	2006-05-02 12:48:48.000000000 +0200
@@ -0,0 +1,95 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  Firmware calls
+ *
+ *  Authors: Christoph Raisch <raisch@de.ibm.com>
+ *           Hoang-Nam Nguyen <hnguyen@de.ibm.com>
+ *           Waleri Fomin <fomin@de.ibm.com>
+ *           Gerd Bayer <gerd.bayer@de.ibm.com>
+ *
+ *  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.
+ */
+
+#ifndef __HCP_PHYP_H__
+#define __HCP_PHYP_H__
+
+
+/* eHCA page (mapped into memory)
+    resource to access eHCA register pages in CPU address space
+*/
+struct h_galpa {
+	u64 fw_handle;
+	/* for pSeries this is a 64bit memory address where
+	   I/O memory is mapped into CPU address space (kv) */
+};
+
+/*
+   resource to access eHCA address space registers, all types
+*/
+struct h_galpas {
+	u32 pid;		/*PID of userspace galpa checking */
+	struct h_galpa user;	/* user space accessible resource,
+				   set to 0 if unused */
+	struct h_galpa kernel;	/* kernel space accessible resource,
+				   set to 0 if unused */
+};
+
+static inline u64 hipz_galpa_load(struct h_galpa galpa, u32 offset)
+{
+	u64 addr = galpa.fw_handle + offset;
+	u64 out;
+	EDEB_EN(7, "addr=%lx offset=%x ", addr, offset);
+	out = *(u64 *) addr;
+	EDEB_EX(7, "addr=%lx value=%lx", addr, out);
+	return out;
+}
+
+static inline void hipz_galpa_store(struct h_galpa galpa, u32 offset, u64 value)
+{
+	u64 addr = galpa.fw_handle + offset;
+	EDEB(7, "addr=%lx offset=%x value=%lx", addr,
+	     offset, value);
+	*(u64 *) addr = value;
+}
+
+int hcp_galpas_ctor(struct h_galpas *galpas,
+		    u64 paddr_kernel, u64 paddr_user);
+
+int hcp_galpas_dtor(struct h_galpas *galpas);
+
+int hcall_map_page(u64 physaddr, u64 * mapaddr);
+
+int hcall_unmap_page(u64 mapaddr);
+
+#endif
--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/hcp_phyp.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/hcp_phyp.c	2006-05-03 13:44:00.000000000 +0200
@@ -0,0 +1,92 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *   load store abstraction for ehca register access with tracing
+ *
+ *  Authors: Christoph Raisch <raisch@de.ibm.com>
+ *           Hoang-Nam Nguyen <hnguyen@de.ibm.com>
+ *
+ *  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.
+ */
+
+#define DEB_PREFIX "PHYP"
+
+#include "ehca_classes.h"
+#include "hipz_hw.h"
+
+int hcall_map_page(u64 physaddr, u64 *mapaddr)
+{
+	*mapaddr = (u64)(ioremap(physaddr, EHCA_PAGESIZE));
+
+	EDEB(7, "ioremap physaddr=%lx mapaddr=%lx", physaddr, *mapaddr);
+	return 0;
+}
+
+int hcall_unmap_page(u64 mapaddr)
+{
+	EDEB(7, "mapaddr=%lx", mapaddr);
+	iounmap((volatile void __iomem*)mapaddr);
+	return 0;
+}
+
+int hcp_galpas_ctor(struct h_galpas *galpas,
+		    u64 paddr_kernel, u64 paddr_user)
+{
+	int ret = hcall_map_page(paddr_kernel, &galpas->kernel.fw_handle);
+	if (ret)
+		return ret;
+
+	galpas->user.fw_handle = paddr_user;
+
+	EDEB(7, "paddr_kernel=%lx paddr_user=%lx galpas->kernel=%lx"
+	     " galpas->user=%lx",
+	     paddr_kernel, paddr_user, galpas->kernel.fw_handle,
+	     galpas->user.fw_handle);
+
+	return ret;
+}
+
+int hcp_galpas_dtor(struct h_galpas *galpas)
+{
+	int ret = 0;
+
+	if (galpas->kernel.fw_handle)
+		ret = hcall_unmap_page(galpas->kernel.fw_handle);
+
+	if (ret)
+		return ret;
+
+	galpas->user.fw_handle = galpas->kernel.fw_handle = 0;
+
+	return ret;
+}

^ permalink raw reply

* [PATCH 16/16] ehca: integration in Linux kernel build system
From: Heiko J Schick @ 2006-05-15 17:43 UTC (permalink / raw)
  To: openib-general, Christoph Raisch, Hoang-Nam Nguyen, Marcus Eder,
	schihei, linux-kernel, linuxppc-dev

Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>


  drivers/infiniband/hw/ehca/Kconfig  |    6 ++++++
  drivers/infiniband/hw/ehca/Makefile |   16 ++++++++++++++++
  2 files changed, 22 insertions(+)



--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/Kconfig	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/Kconfig	2006-04-28 13:32:08.000000000 +0200
@@ -0,0 +1,6 @@
+config INFINIBAND_EHCA
+       tristate "eHCA support"
+       depends on IBMEBUS && INFINIBAND
+       ---help---
+       This is a low level device driver for the IBM
+       GX based Host channel adapters (HCAs)
--- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/Makefile	2006-04-28 13:31:25.000000000 +0200
@@ -0,0 +1,16 @@
+#  Authors: Heiko J Schick <schickhj@de.ibm.com>
+#           Christoph Raisch <raisch@de.ibm.com>
+#
+#  Copyright (c) 2005 IBM Corporation
+#
+#  All rights reserved.
+#
+#  This source code is distributed under a dual license of GPL v2.0 and OpenIB BSD.
+
+obj-$(CONFIG_INFINIBAND_EHCA) += hcad_mod.o
+
+hcad_mod-objs = ehca_main.o ehca_hca.o ehca_mcast.o ehca_pd.o ehca_av.o ehca_eq.o \
+		ehca_cq.o ehca_qp.o ehca_sqp.o ehca_mrmw.o ehca_reqs.o ehca_irq.o \
+		ehca_uverbs.o hcp_if.o hcp_phyp.o ipz_pt_fn.o
+
+CFLAGS += -DEHCA_USE_HCALL -DEHCA_USE_HCALL_KERNEL

^ permalink raw reply

* [PATCH] remove powerpc bitops infavor of existing generic bitops
From: Jon Mason @ 2006-05-15 18:01 UTC (permalink / raw)
  To: linuxppc-dev

There already exists a big endian safe bitops implementation in
lib/find_next_bit.c.  The code in it is 90%+ common with the powerpc
specific version, so the powerpc version is redundant.  This patch
makes the necessary changes to use the generic bitops in powerpc, and
removes the powerpc specific version.

Thanks,
Jon

Signed-off-by: Jon Mason <jdmason@us.ibm.com>

diff -r bfccde0f7221 arch/powerpc/Kconfig
--- a/arch/powerpc/Kconfig	Sat May 13 08:42:09 2006 +0700
+++ b/arch/powerpc/Kconfig	Mon May 15 17:30:46 2006 +0000
@@ -42,6 +42,10 @@ config GENERIC_HWEIGHT
 	default y
 
 config GENERIC_CALIBRATE_DELAY
+	bool
+	default y
+
+config GENERIC_FIND_NEXT_BIT
 	bool
 	default y
 
diff -r bfccde0f7221 arch/powerpc/lib/Makefile
--- a/arch/powerpc/lib/Makefile	Sat May 13 08:42:09 2006 +0700
+++ b/arch/powerpc/lib/Makefile	Mon May 15 17:30:46 2006 +0000
@@ -7,7 +7,6 @@ obj-$(CONFIG_PPC32)	+= div64.o copy_32.o
 obj-$(CONFIG_PPC32)	+= div64.o copy_32.o checksum_32.o
 endif
 
-obj-y			+= bitops.o
 obj-$(CONFIG_PPC64)	+= checksum_64.o copypage_64.o copyuser_64.o \
 			   memcpy_64.o usercopy_64.o mem_64.o string.o \
 			   strcase.o
diff -r bfccde0f7221 include/asm-powerpc/bitops.h
--- a/include/asm-powerpc/bitops.h	Sat May 13 08:42:09 2006 +0700
+++ b/include/asm-powerpc/bitops.h	Mon May 15 17:30:46 2006 +0000
@@ -288,8 +288,8 @@ static __inline__ int test_le_bit(unsign
 #define __test_and_clear_le_bit(nr, addr) \
 	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define find_first_zero_le_bit(addr, size) find_next_zero_le_bit((addr), (size), 0)
-unsigned long find_next_zero_le_bit(const unsigned long *addr,
+#define find_first_zero_le_bit(addr, size) generic_find_next_zero_le_bit((addr), (size), 0)
+unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
 				    unsigned long size, unsigned long offset);
 
 /* Bitmap functions for the ext2 filesystem */
@@ -309,7 +309,7 @@ unsigned long find_next_zero_le_bit(cons
 #define ext2_find_first_zero_bit(addr, size) \
 	find_first_zero_le_bit((unsigned long*)addr, size)
 #define ext2_find_next_zero_bit(addr, size, off) \
-	find_next_zero_le_bit((unsigned long*)addr, size, off)
+	generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
 
 /* Bitmap functions for the minix filesystem.  */
 
diff -r bfccde0f7221 arch/powerpc/lib/bitops.c
--- a/arch/powerpc/lib/bitops.c	Sat May 13 08:42:09 2006 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-#include <linux/types.h>
-#include <linux/module.h>
-#include <asm/byteorder.h>
-#include <asm/bitops.h>
-
-/**
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
-			    unsigned long offset)
-{
-	const unsigned long *p = addr + BITOP_WORD(offset);
-	unsigned long result = offset & ~(BITS_PER_LONG-1);
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset %= BITS_PER_LONG;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= (~0UL << offset);
-		if (size < BITS_PER_LONG)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= BITS_PER_LONG;
-		result += BITS_PER_LONG;
-	}
-	while (size & ~(BITS_PER_LONG-1)) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += BITS_PER_LONG;
-		size -= BITS_PER_LONG;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp &= (~0UL >> (BITS_PER_LONG - size));
-	if (tmp == 0UL)		/* Are any bits set? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + __ffs(tmp);
-}
-EXPORT_SYMBOL(find_next_bit);
-
-/*
- * This implementation of find_{first,next}_zero_bit was stolen from
- * Linus' asm-alpha/bitops.h.
- */
-unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
-				 unsigned long offset)
-{
-	const unsigned long *p = addr + BITOP_WORD(offset);
-	unsigned long result = offset & ~(BITS_PER_LONG-1);
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset %= BITS_PER_LONG;
-	if (offset) {
-		tmp = *(p++);
-		tmp |= ~0UL >> (BITS_PER_LONG - offset);
-		if (size < BITS_PER_LONG)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= BITS_PER_LONG;
-		result += BITS_PER_LONG;
-	}
-	while (size & ~(BITS_PER_LONG-1)) {
-		if (~(tmp = *(p++)))
-			goto found_middle;
-		result += BITS_PER_LONG;
-		size -= BITS_PER_LONG;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)	/* Are any bits zero? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
-EXPORT_SYMBOL(find_next_zero_bit);
-
-static inline unsigned int ext2_ilog2(unsigned int x)
-{
-	int lz;
-
-	asm("cntlzw %0,%1": "=r"(lz):"r"(x));
-	return 31 - lz;
-}
-
-static inline unsigned int ext2_ffz(unsigned int x)
-{
-	u32 rc;
-	if ((x = ~x) == 0)
-		return 32;
-	rc = ext2_ilog2(x & -x);
-	return rc;
-}
-
-unsigned long find_next_zero_le_bit(const unsigned long *addr,
-				    unsigned long size, unsigned long offset)
-{
-	const unsigned int *p = ((const unsigned int *)addr) + (offset >> 5);
-	unsigned int result = offset & ~31;
-	unsigned int tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 31;
-	if (offset) {
-		tmp = cpu_to_le32p(p++);
-		tmp |= ~0U >> (32 - offset);	/* bug or feature ? */
-		if (size < 32)
-			goto found_first;
-		if (tmp != ~0)
-			goto found_middle;
-		size -= 32;
-		result += 32;
-	}
-	while (size >= 32) {
-		if ((tmp = cpu_to_le32p(p++)) != ~0)
-			goto found_middle;
-		result += 32;
-		size -= 32;
-	}
-	if (!size)
-		return result;
-	tmp = cpu_to_le32p(p);
-found_first:
-	tmp |= ~0 << size;
-	if (tmp == ~0)		/* Are any bits zero? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + ext2_ffz(tmp);
-}
-EXPORT_SYMBOL(find_next_zero_le_bit);

^ permalink raw reply

* Re: [PATCH] Export PowerPC atomic operations to userspace
From: Brent Cook @ 2006-05-15 18:18 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded
In-Reply-To: <20060515171629.GC22868@smtp.west.cox.net>

On Monday 15 May 2006 12:16, Tom Rini wrote:
> On Mon, May 15, 2006 at 11:54:52AM -0500, Brent Cook wrote:
> > The atomic operations in asm/atomic.h are really useful from userspace
> > too. Other architectures (i386, x86_64, mips) export these to userspace,
> > but the powerpc versions are guarded by __KERNEL__ for some reason. Can
> > we remove these if there is no good reason to guard them?
> >
> > Signed-off-by: Brent Cook <bcook@bpointsys.com>
>
> NAK.  i386, x86_64 and mips are broken in this regard.  Please google up
> the previous threads that explain why you can't always get atomic
> operations on all architectures and why exporting this is bad.

OK, I see that possibly the only reason atomic_t is even exported is so that 
sem.h works. Hopefully sem.h will get fixed and people like me will not be 
even tempted by atomic.h.

What I really want is just a standard way to do atomic inc/dec in userspace; 
I'm sure that people are going to continue wanting to have atomic_t 
workalikes for their code.

After reading this thread: 
http://www.developerweb.net/forum/archive/index.php/t-3294.html
it appears that just wrapping an integer in a pthreads mutex on an NPTL 
machine wouldn't be much more overhead than using an atomic_t directly.

Looking at glibc's sources for powerpc nptl:

nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h

confirms that a futex lock is really similar to an atomic_t.

Thanks!

 - Brent

^ permalink raw reply

* Re: [PATCH] Export PowerPC atomic operations to userspace
From: Tom Rini @ 2006-05-15 17:16 UTC (permalink / raw)
  To: Brent Cook; +Cc: linuxppc-embedded
In-Reply-To: <200605151154.52599.bcook@bpointsys.com>

On Mon, May 15, 2006 at 11:54:52AM -0500, Brent Cook wrote:

> The atomic operations in asm/atomic.h are really useful from userspace too. 
> Other architectures (i386, x86_64, mips) export these to userspace, but the 
> powerpc versions are guarded by __KERNEL__ for some reason. Can we remove 
> these if there is no good reason to guard them?
> 
> Signed-off-by: Brent Cook <bcook@bpointsys.com>

NAK.  i386, x86_64 and mips are broken in this regard.  Please google up
the previous threads that explain why you can't always get atomic
operations on all architectures and why exporting this is bad.

-- 
Tom Rini

^ permalink raw reply

* Re: Setting I&D cache enable in the same mtspr instruction
From: Mark A. Greer @ 2006-05-15 18:59 UTC (permalink / raw)
  To: Assaf Hoffman; +Cc: Ronen Shitrit, Rita Shtern, linuxppc-embedded
In-Reply-To: <B9FFC3F97441D04093A504CEA31B7C419E2438@msilexch01.marvell.com>

On Mon, May 08, 2006 at 01:39:13PM +0300, Assaf Hoffman wrote:
> Hi,
> I think the implementation of setup_common_caches() in file
> cpu_setup_6xx.S; not according to the spec as far as MPC74xx concerns.
> Looking in the spec (MPC7450 RISC Microprocessor Family Reference
> Manual, MPC7450UM Rev. 5 1/2005) section 3.4.1.5 L1 Instruction and Data
> Cache Flash Invalidation it says: 
> "Note that HID0[ICFI] and HID0[DCFI] must not both be set with the same
> mtspr instruction, due to the synchronization requirements described in
> Section 2.4.2.4.1, "Context Synchronization."
> But in the code those two do set together.
> Also, the same section says: 
> "An isync must precede the setting of the HID0[ICFI] in order for the
> setting to take effect."
> But in the code, only 'sync' can be found.
> 
> /* Enable caches for 603's, 604, 750 & 7400 */
> setup_common_caches:
> 	mfspr	r11,SPRN_HID0
> 	andi.	r0,r11,HID0_DCE
> 	ori	r11,r11,HID0_ICE|HID0_DCE
> 	ori	r8,r11,HID0_ICFI
> 	bne	1f			/* don't invalidate the D-cache
> */
> 	ori	r8,r8,HID0_DCI		/* unless it wasn't enabled */
> 1:	sync
> 	mtspr	SPRN_HID0,r8		/* enable and invalidate caches
> */ 
>       ^^^^^^^^^^^^^^^^^^^ Here we set both ICFI and DCFI in the same
> mtspr instruction. Also, no isync before setting ICFI.
> 	sync
> 	mtspr	SPRN_HID0,r11		/* enable caches */
> 	sync
> 	isync
> 	blr
> 
> Please advice.
> Thanks.

Yep, looks like a bug.  How about a patch?  :)

Mark

^ permalink raw reply

* Re: Routing problem
From: Antonio Di Bacco @ 2006-05-15 19:39 UTC (permalink / raw)
  To: Yang, Steve; +Cc: linuxppc-embedded
In-Reply-To: <D9055C0A0A86BD4E89AD96A89EA767DB09C061@ALA-MAIL03.corp.ad.wrs.com>

No effect!
I don't understand what is missing in my system.

Thank you for your attention.

Bye,
Antonio.

On Monday 15 May 2006 18:08, Yang, Steve wrote:
> Antonio,
>
> Try this:
>
>   sysctl net.ipv4.ip_forward=1
>
> Regards,
> Steve Yang
> 510-749-4535 Alameda
> AIM: steveyang4535
>
> -----Original Message-----
> From: linuxppc-embedded-bounces+syang=windriver.com@ozlabs.org
> [mailto:linuxppc-embedded-bounces+syang=windriver.com@ozlabs.org] On
> Behalf Of Antonio Di Bacco
> Sent: Friday, May 12, 2006 1:53 PM
> To: linuxppc-embedded@ozlabs.org
> Subject: Routing problem
>
> Hi all,
>
> I have a board with an MPC880 using the tow FECs as two ethernet
> interfaces. I tried to enable the ip forwarding with no success. I have
> issued  "echo 1
>
> > /proc/sys/net/ipv4/ip_forward", is it sufficient to make Linux work as
> >
> > a
>
> router?
>
> Bye,
> Antonio.
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply

* Re: [PATCH] remove powerpc bitops infavor of existing generic bitops
From: jschopp @ 2006-05-15 19:56 UTC (permalink / raw)
  To: Jon Mason; +Cc: linuxppc-dev
In-Reply-To: <20060515180108.GB17646@us.ibm.com>

> There already exists a big endian safe bitops implementation in
> lib/find_next_bit.c.  The code in it is 90%+ common with the powerpc
> specific version, so the powerpc version is redundant.  This patch
> makes the necessary changes to use the generic bitops in powerpc, and
> removes the powerpc specific version.

I like generic as much as the next guy, but I'm also a big fan of fast bitops.  And the 
function below is fast.  You'll have to explain to me how the generic code is going to 
find the first zero as fast without explicit calls to ppc assembly.

> -static inline unsigned int ext2_ilog2(unsigned int x)
> -{
> -	int lz;
> -
> -	asm("cntlzw %0,%1": "=r"(lz):"r"(x));
> -	return 31 - lz;
> -}

^ permalink raw reply

* route problem and simple sniffer
From: Antonio Di Bacco @ 2006-05-15 20:09 UTC (permalink / raw)
  To: linuxppc-embedded

Anyone knows a lightweight sniffer for linux embedded?
I'm going to debug a system that doesn't want to route anything!

Bye,
Antonio.

^ permalink raw reply

* Re: [PATCH] remove powerpc bitops infavor of existing generic bitops
From: Jon Mason @ 2006-05-15 20:38 UTC (permalink / raw)
  To: jschopp; +Cc: linuxppc-dev
In-Reply-To: <4468DCDD.5090609@austin.ibm.com>

On Mon, May 15, 2006 at 02:56:13PM -0500, jschopp wrote:
> >There already exists a big endian safe bitops implementation in
> >lib/find_next_bit.c.  The code in it is 90%+ common with the powerpc
> >specific version, so the powerpc version is redundant.  This patch
> >makes the necessary changes to use the generic bitops in powerpc, and
> >removes the powerpc specific version.
> 
> I like generic as much as the next guy, but I'm also a big fan of fast 
> bitops.  And the function below is fast.  You'll have to explain to me how 
> the generic code is going to find the first zero as fast without explicit 
> calls to ppc assembly.
> 
> >-static inline unsigned int ext2_ilog2(unsigned int x)
> >-{
> >-	int lz;
> >-
> >-	asm("cntlzw %0,%1": "=r"(lz):"r"(x));
> >-	return 31 - lz;
> >-}

Ah but here's the trick, there is the same explicit call to ppc
assembly.  The only function in the file removed is this one you pointed
out, and the only caller of this function is ext2_ffz.  And the only
user of ext2_ffz is find_next_zero_le_bit.  

Now the generic code is very similar to the file removed (`diff -Narup
arch/powerpc/lib/bitops.c lib/find_next_bit.c` to see for yourself).  In
the same place where ext2_ffz is called, ffz is called in the generic
code.  Now if we look at the definition of ffz in
include/asm-powerpc/bitops.h, we see it calls __ilog2 of that same file.
__ilog2 is defined as: 

static __inline__ int __ilog2(unsigned long x)
{
        int lz;

        asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
        return BITS_PER_LONG - 1 - lz;
}

So, its really the same code :)

Thanks,
Jon

^ permalink raw reply

* Re: [PATCH 14/16] ehca: queue page table handling
From: Randy.Dunlap @ 2006-05-15 20:54 UTC (permalink / raw)
  To: Heiko J Schick
  Cc: linux-kernel, openib-general, linuxppc-dev, RAISCH, HNGUYEN,
	MEDER
In-Reply-To: <4468BDAD.3020701@de.ibm.com>

On Mon, 15 May 2006 19:43:09 +0200 Heiko J Schick wrote:

> Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>
> 
> 
>   drivers/infiniband/hw/ehca/ipz_pt_fn.c |  177 ++++++++++++++++++++++
>   drivers/infiniband/hw/ehca/ipz_pt_fn.h |  254 +++++++++++++++++++++++++++++++++
>   2 files changed, 431 insertions(+)
> 
> 
> 
> --- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/ipz_pt_fn.h	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/ipz_pt_fn.h	2006-05-12 12:25:43.000000000 +0200
> @@ -0,0 +1,254 @@

> +/*  return current Queue Page , increment Queue Page iterator from
> + *   page to page in struct ipz_queue, last increment will return 0! and
> + *   NOT wrap
> + *   returns address (kv) of Queue Page
> + *   warning don't use in parallel with ipz_QE_get_inc()
> + */

When not using kernel-doc format... the preferred multi-line
comment format is:

/*
 * foo foo foo ........
 * bar bar bar .......
 * blahz ..........
 */

repeat below.

> +void *ipz_qpageit_get_inc(struct ipz_queue *queue);
> +
> +/*  return current Queue Entry, increment Queue Entry iterator by one
> + *   step in struct ipz_queue, will wrap in ringbuffer
> + *   @returns address (kv) of Queue Entry BEFORE increment
> + *   warning don't use in parallel with ipz_qpageit_get_inc()
> + *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
> + */
> +static inline void *ipz_qeit_get_inc(struct ipz_queue *queue)
> +{
> +	void *ret = NULL;
> +
> +	ret = ipz_qeit_get(queue);
> +	queue->current_q_offset += queue->qe_size;
> +	if (queue->current_q_offset >= queue->queue_length) {
> +		queue->current_q_offset = 0;
> +		/* toggle the valid flag */
> +		queue->toggle_state = (~queue->toggle_state) & 1;
> +	}
> +
> +	EDEB(7, "queue=%p ret=%p new current_q_addr=%lx qe_size=%x",
> +	     queue, ret, queue->current_q_offset, queue->qe_size);
> +
> +	return ret;
> +}
> +
> +/*  return current Queue Entry, increment Queue Entry iterator by one
> + *   step in struct ipz_queue, will wrap in ringbuffer
> + *   returns address (kv) of Queue Entry BEFORE increment
> + *   returns 0 and does not increment, if wrong valid state
> + *   warning don't use in parallel with ipz_qpageit_get_inc()
> + *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
> + */
> +static inline void *ipz_qeit_get_inc_valid(struct ipz_queue *queue)
> +{
> +	struct ehca_cqe *cqe = ipz_qeit_get(queue);
> +	u32 cqe_flags = cqe->cqe_flags;
> +
> +	if ((cqe_flags >> 7) != (queue->toggle_state & 1))
> +		return NULL;
> +
> +	ipz_qeit_get_inc(queue);
> +	return cqe;
> +}
> +

> +/* destructor for a ipz_queue_t
> + *  -# free queue
> + *  see ipz_queue_ctor()
> + *  returns true if ok, false if queue was NULL-ptr of free failed
> + */
> +int ipz_queue_dtor(struct ipz_queue *queue);
> +
> +/* constructor for a ipz_qpt_t,
> + * placement new for struct ipz_queue, new for all dependent datastructors
> + *
> + *  all QP Tables are the same,
> + *  flow:
> + *  -# allocate+pin queue
> + *  -# initialise ptcb
> + *  -# allocate+pin PTs
> + *  -# link PTs to a ring, according to HCA Arch, set bit62 id needed
> + *  -# the ring must have room for exactly nr_of_PTEs
> + *  see ipz_qpt_ctor()
> + */
> +void ipz_qpt_ctor(struct ipz_qpt *qpt,
> +		  const u32 nr_of_QEs,
> +		  const u32 pagesize,
> +		  const u32 qe_size,
> +		  const u8 lowbyte, const u8 toggle,
> +		  u32 * act_nr_of_QEs, u32 * act_nr_of_pages);
> +
> +/*  return current Queue Entry, increment Queue Entry iterator by one
> + *   step in struct ipz_queue, will wrap in ringbuffer
> + *   returns address (kv) of Queue Entry BEFORE increment
> + *   warning don't use in parallel with ipz_qpageit_get_inc()
> + *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
> + *
> + *   fix EQ page problems
> + */
> +void *ipz_qeit_eq_get_inc(struct ipz_queue *queue);
> +
> +/*  return current Event Queue Entry, increment Queue Entry iterator
> + *   by one step in struct ipz_queue if valid, will wrap in ringbuffer
> + *   returns address (kv) of Queue Entry BEFORE increment
> + *   returns 0 and does not increment, if wrong valid state
> + *   warning don't use in parallel with ipz_queue_QPageit_get_inc()
> + *   warning unpredictable results may occur if steps>act_nr_of_queue_entries
> + */
> +static inline void *ipz_eqit_eq_get_inc_valid(struct ipz_queue *queue)
> +{
> +	void *ret = ipz_qeit_get(queue);
> +	u32 qe = *(u8 *) ret;
> +	EDEB(7, "ipz_QEit_EQ_get_inc_valid qe=%x", qe);
> +	if ((qe >> 7) == (queue->toggle_state & 1))
> +		ipz_qeit_eq_get_inc(queue); /* this is a good one */
> +	else
> +		ret = NULL;
> +	return ret;
> +}


---
~Randy

^ permalink raw reply

* Re: [PATCH 12/16] ehca: firmware InfiniBand interface
From: Randy.Dunlap @ 2006-05-15 20:47 UTC (permalink / raw)
  To: Heiko J Schick
  Cc: linux-kernel, openib-general, linuxppc-dev, RAISCH, HNGUYEN,
	MEDER
In-Reply-To: <4468BD99.5050505@de.ibm.com>

On Mon, 15 May 2006 19:42:49 +0200 Heiko J Schick wrote:

> Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>
> 
> 
>   drivers/infiniband/hw/ehca/hcp_if.c | 1476 ++++++++++++++++++++++++++++++++++++
>   drivers/infiniband/hw/ehca/hcp_if.h |  330 ++++++++
>   2 files changed, 1806 insertions(+)
> 
> 
> 
> --- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/hcp_if.h	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/hcp_if.h	2006-05-12 12:48:21.000000000 +0200
> @@ -0,0 +1,330 @@

> +/**
> + * 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
> + */

kernel-doc format needs:
1.  a short function name + description on one line
2.  no blank line between function and parameters
3.  blank line (optional) before more detailed function description

See Documentation/kernel-doc-nano-HOWTO.txt or other kernel source
files for more info.
And please test it with "make htmldocs" or "make mandocs".

---
~Randy

^ permalink raw reply

* Re: [PATCH 05/16] ehca: common include files
From: Randy.Dunlap @ 2006-05-15 21:03 UTC (permalink / raw)
  To: Heiko J Schick
  Cc: linux-kernel, openib-general, linuxppc-dev, RAISCH, HNGUYEN,
	MEDER
In-Reply-To: <4468BD5B.1060406@de.ibm.com>

On Mon, 15 May 2006 19:41:47 +0200 Heiko J Schick wrote:

> Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>
> 
> 
>   drivers/infiniband/hw/ehca/ehca_iverbs.h |  181 +++++++++++++
>   drivers/infiniband/hw/ehca/ehca_tools.h  |  411 +++++++++++++++++++++++++++++++
>   2 files changed, 592 insertions(+)
> 
> 
> 
> --- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/ehca_tools.h	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/ehca_tools.h	2006-05-03 13:44:15.000000000 +0200
> @@ -0,0 +1,411 @@

> +static inline u64 ehca_edeb_filter(const u32 level,
> +				   const u32 id, const u32 line)
> +{
> +	u64 ret = 0;
> +	u32 filenr = 0;
> +	u32 filter_level = 9;
> +	u32 dynamic_level = 0;
> +
> +	/* This is code written for the gcc -O2 optimizer which should colapse
                                                                    collapse
> +	 * to two single ints filter_level is the first level kicked out by
> +	 * compiler means trace everythin below 6. */
                                everything
plus make a real sentence of that, please.

> +}
> +
> +#ifdef EHCA_USE_HCALL_KERNEL
> +#ifdef CONFIG_PPC_PSERIES
> +
> +#include <asm/paca.h>
> +
> +/**
> + * IS_EDEB_ON - Checks if debug is on for the given level.
> + */
> +#define IS_EDEB_ON(level) \
> +    ((ehca_edeb_filter(level, EDEB_ID_TO_U32(DEB_PREFIX), __LINE__) & 0x100000000L)==0)
> +
> +#elif REAL_HCALL
> +
> +
> +#endif
> +#else
> +
> +#endif
> +
> +/**
> + * EDEB - Trace output macro.
> + * @level tracelevel
> + * @format optional format string, use "" if not desired
> + * @args printf like arguments for trace, use %Lx for u64, %x for u32
> + *       %p for pointer
> + */

Use real kernel-doc format here, please.
Parameters at least need a colon (':') after their names, like:

 * @format: optonal format string, use "" if not desired

and test them...

> +#define EDEB(level,format,args...) \
> +	EDEB_P_GENERIC(level,"",format,##args)
> +#define EDEB_ERR(level,format,args...) \
> +	EDEB_P_GENERIC(level,"HCAD_ERROR ",format,##args)
> +#define EDEB_EN(level,format,args...) \
> +	EDEB_P_GENERIC(level,">>>",format,##args)
> +#define EDEB_EX(level,format,args...) \
> +	EDEB_P_GENERIC(level,"<<<",format,##args)
> +
> +/**
> + * EDEB macro to dump a memory block, whose length is n*8 bytes.
      EDEB_DMP

> + * Each line has the following layout:
> + * <format string> adr=X ofs=Y <8 bytes hex> <8 bytes hex>
> + */
> +#define EDEB_DMP(level,adr,len,format,args...) \
> +	do {				       \
> +		unsigned int x;			      \
> +		unsigned int l = (unsigned int)(len); \
> +		unsigned char *deb = (unsigned char*)(adr);	\
> +		for (x = 0; x < l; x += 16) { \
> +		        EDEB(level, format " adr=%p ofs=%04x %016lx %016lx", \
> +			     ##args, deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); \
> +			deb += 16; \
> +		} \
> +	} while (0)
> +
> +/* define a bitmask, little endian version */
> +#define EHCA_BMASK(pos,length) (((pos)<<16)+(length))
> +/* define a bitmask, the ibm way... */
> +#define EHCA_BMASK_IBM(from,to) (((63-to)<<16)+((to)-(from)+1))
> +/* internal function, don't use */
> +#define EHCA_BMASK_SHIFTPOS(mask) (((mask)>>16)&0xffff)
> +/* internal function, don't use */
> +#define EHCA_BMASK_MASK(mask) (0xffffffffffffffffULL >> ((64-(mask))&0xffff))
> +/* return value shifted and masked by mask\n
> + * variable|=HCA_BMASK_SET(MY_MASK,0x4711) ORs the bits in variable\n
> + * variable&=~HCA_BMASK_SET(MY_MASK,-1) clears the bits from the mask
> + * in variable

What are all of those "\n"s up there?  and below?

> +#define EHCA_BMASK_SET(mask,value) \
> +	((EHCA_BMASK_MASK(mask) & ((u64)(value)))<<EHCA_BMASK_SHIFTPOS(mask))
> +/* extract a parameter from value by mask\n
> + * param=EHCA_BMASK_GET(MY_MASK,value)
> + */
> +#define EHCA_BMASK_GET(mask,value) \
> +	( EHCA_BMASK_MASK(mask)& (((u64)(value))>>EHCA_BMASK_SHIFTPOS(mask)))
> +
> +
> +/**
> + * ehca_adr_bad - Handle to be used for adress translation mechanisms,
> + * currently a placeholder.
> + */

Use proper kernel-doc format.

> +static inline int ehca_adr_bad(void *adr)
> +{
> +	return !adr;
> +}
> +
> +/**
> + * ehca2ib_return_code - Returns ib return code corresponding to the given
> + * ehca return code.
> + */

Ditto.

---
~Randy

^ permalink raw reply

* Re: [PATCH] Fix pSeries identification in prom_init.c
From: Benjamin Herrenschmidt @ 2006-05-15 21:08 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev list, Paul Mackerras, segher
In-Reply-To: <20060515161810.E633C679EB@ozlabs.org>

> To be safe if we are returned a non terminated string.  I'd not realised
> the case you've mentioned.
> 
> How much we should trust firmware?  With strcpy, should we explicitly
> terminate the string first (I removed one of these originally)?  Patch
> below, compiled not run.

I wouldn't bother. If it returns a non-terminated string there, a lot of
stuff will break anyway including the kernel probe code

Ben.

> The OF trampoline code prom_init.c still needs to identify IBM pSeries
> (PAPR) machines in order to run some platform specific code on them like
> instantiating the TCE tables. The code doing that detection was changed
> recently in 2.6.17 early stages but was done slightly incorrectly. It
> should be testing for an exact match of "chrp" and it currently tests
> for anything that begins with "chrp". That means it will incorrectly
> match with platforms using Maple-like device-trees and have open
> firmware. This fixes it by using strcmp instead of strncmp to match what
> the actual platform detection code does.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> 
>  arch/powerpc/kernel/prom_init.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6-powerpc/arch/powerpc/kernel/prom_init.c
> ===================================================================
> --- linux-2.6-powerpc.orig/arch/powerpc/kernel/prom_init.c
> +++ linux-2.6-powerpc/arch/powerpc/kernel/prom_init.c
> @@ -1636,7 +1636,8 @@ static int __init prom_find_machine_type
>  			   compat, sizeof(compat)-1);
>  	if (len <= 0)
>  		return PLATFORM_GENERIC;
> -	if (strncmp(compat, RELOC("chrp"), 4))
> +	compat[len] = 0;
> +	if (strcmp(compat, RELOC("chrp")))
>  		return PLATFORM_GENERIC;
>  
>  	/* Default to pSeries. We need to know if we are running LPAR */
> 

^ permalink raw reply

* Re: [PATCH 01/16] ehca: module infrastructure
From: Randy.Dunlap @ 2006-05-15 21:14 UTC (permalink / raw)
  To: Heiko J Schick
  Cc: linux-kernel, openib-general, linuxppc-dev, RAISCH, HNGUYEN,
	MEDER
In-Reply-To: <4468BD39.3010008@de.ibm.com>

On Mon, 15 May 2006 19:41:13 +0200 Heiko J Schick wrote:

> Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>
> 
> 
>   drivers/infiniband/hw/ehca/ehca_main.c |  966 +++++++++++++++++++++++++++++++++
>   1 file changed, 966 insertions(+)
> 
> 
> 
> --- linux-2.6.17-rc2-orig/drivers/infiniband/hw/ehca/ehca_main.c	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.17-rc2/drivers/infiniband/hw/ehca/ehca_main.c	2006-05-15 19:17:26.000000000 +0200

> @@ -0,0 +1,966 @@

> +int ehca_open_aqp1     = 0;
> +int ehca_debug_level   = -1;
> +int ehca_hw_level      = 0;
> +int ehca_nr_ports      = 2;
> +int ehca_use_hp_mr     = 0;
> +int ehca_port_act_time = 30;
> +int ehca_poll_all_eqs  = 1;
> +int ehca_static_rate   = -1;

Don't need to init globals to 0.

---
~Randy

^ permalink raw reply

* Re: [PATCH] remove powerpc bitops infavor of existing generic bitops
From: jschopp @ 2006-05-15 20:42 UTC (permalink / raw)
  To: Jon Mason; +Cc: linuxppc-dev
In-Reply-To: <20060515203815.GC17646@us.ibm.com>

> Ah but here's the trick, there is the same explicit call to ppc
> assembly.  The only function in the file removed is this one you pointed
> out, and the only caller of this function is ext2_ffz.  And the only
> user of ext2_ffz is find_next_zero_le_bit.  
> 
> Now the generic code is very similar to the file removed (`diff -Narup
> arch/powerpc/lib/bitops.c lib/find_next_bit.c` to see for yourself).  In
> the same place where ext2_ffz is called, ffz is called in the generic
> code.  Now if we look at the definition of ffz in
> include/asm-powerpc/bitops.h, we see it calls __ilog2 of that same file.
> __ilog2 is defined as: 
> 
> static __inline__ int __ilog2(unsigned long x)
> {
>         int lz;
> 
>         asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
>         return BITS_PER_LONG - 1 - lz;
> }
> 
> So, its really the same code :)

Good explination.  I'm convinced, so for what it's worth:

Acked-by: Joel Schopp <jschopp@austin.ibm.com>

^ permalink raw reply

* NOT_COHERENT_CACHE: 1. kernel oops in page_add_file_rmap() and 2. crash with HIGHMEM support
From: Gerhard Pircher @ 2006-05-15 22:25 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <3746.1147538916@www086.gmx.net>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 3647 bytes --]

Hi,

I applied the CONFIG_NOT_COHERENT_CACHE option for the AmigaOne, which has a
northbridge with cache coherence problems. Unfortunately the kernel now
crashes when viewing DVD (for example with totem) and when support for
HIGHMEM is compiled in. Kernel version is 2.6.8-16 (debian).

First some infos:
To get NOT_COHERENT_CACHE working on the AmigaOne, I had to limit the PCI
memory and ISA IO/MEM space of the northbridge first and then changed the
CONFIG_CONSISTENT_BASE parameter from 0xFF100000 to 0xF8100000
(CONSISTENT_SIZE is still set to 0x00200000 = 2MB).

The IO/MEM space was previously mapped like this in the platform setup:
io_block_mapping(0xF0000000, 0xF0000000, 0x10000000, _PAGE_IO)

I changed this line to:
io_block_mapping(0xFD000000, 0xFD000000, 0x01000000, _PAGE_IO) -> ISA MEM
and
io_block_mapping(0xFE000000, 0xFE000000, 0x02000000, _PAGE_IO) -> ISA IO/PCI
config space.
These address ranges are mapped by BATs.

The PCI memory normally goes from 0x80000000 to 0xFCFFFFFF, but is limited
to 0xEFFFFFFF in the PCI host controller resource initialization:

amigaone_init_resource(&hose->mem_resources[0], 0x80000000, 0x0xEFFFFFFF,
IORESOURCE_MEM);

With this setup DMA (and UDMA for IDE devices) works without any data
corruption. I tested this with around 500 MD5 checksum tests of three
different files with a file size of at least 100 MB. But when I view a DVD
for example (without HIGHMEM support), the system crashes with the following
kernel oops:

May 12 00:04:17 localhost kernel: kernel BUG in page_add_file_rmap at
mm/rmap.c:387!
May 12 00:04:17 localhost kernel: Oops: Exception in kernel mode, sig: 5
[#1]
May 12 00:04:17 localhost kernel: NIP: C004968C LR: C0044CB8 SP: D2C77E20
REGS: d2c77d70 TRAP: 0700    Not tainted
May 12 00:04:17 localhost kernel: MSR: 00029032 EE: 1 PR: 0 FP: 0 ME: 1
IR/DR: 11
May 12 00:04:17 localhost kernel: TASK = d4918000[2900] 'totem' THREAD:
d2c76000Last syscall: 246
May 12 00:04:17 localhost kernel: GPR00: 00000001 D2C77E20 D4918000 C0D02720
00000000 D27B02A0 02000000 D4FE4400
May 12 00:04:17 localhost kernel: GPR08: C03D0000 38139785 00000000 38139785
24048444 10054698 00000000 10171158
May 12 00:04:17 localhost kernel: GPR16: 00000000 00000000 0EADDD7C 00015F90
000001F6 315B1970 33CA8000 D4D6BBA0
May 12 00:04:17 localhost kernel: GPR24: 00000000 00000000 02000000 D4B7D33C
33CA8000 C0D02720 38139785 D2888220
May 12 00:04:17 localhost kernel: NIP [c004968c] page_add_file_rmap+0x8/0x78
May 12 00:04:17 localhost kernel: LR [c0044cb8] do_no_page+0x1cc/0x37c
May 12 00:04:17 localhost kernel: Call trace:
May 12 00:04:17 localhost kernel:  [c004503c] handle_mm_fault+0xf4/0x174
May 12 00:04:17 localhost kernel:  [c0012100] do_page_fault+0x140/0x398
May 12 00:04:17 localhost kernel:  [c0008178] handle_page_fault+0xc/0x80

Does anybody know how I can debug this crash, or what's happening here? I
don't think that the PCI memory is the cause for this crash, because the
CONSISTENT_BASE address is a virtual address, which is not mapped phyiscally
to the same address (phys = virt)!?

The second problem is HIGHMEM support in combination with
NOT_COHERENT_CACHE. When both options are enabled, the kernel crashes within
kmap_atomic() early in the boot process. kmap_atomic() is called by
__dma_sync_page_highmem(). I guess it should work even, if I have only 512MB
RAM. I moved the PKMAP_BASE to 0xF0000000, because the default address is
again within the ISA MEM space.

Did anyone else experience this problem?

Thanks in advance!

regards,

Gerhard

-- 
Mobile Internet - E-Mail und Internet immer und überall!
GMX zum Mitnehmen: http://www.gmx.net/de/go/pocketweb

^ permalink raw reply

* Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes
From: Mel Gorman @ 2006-05-15 22:44 UTC (permalink / raw)
  To: Andrew Morton
  Cc: davej, tony.luck, linuxppc-dev, ak, bob.picco, linux-kernel,
	linux-mm
In-Reply-To: <20060515122728.GA29253@skynet.ie>

> diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc4-mm4-clean/mm/page_alloc.c linux-2.6.17-rc4-mm4-ia64_force_alignment/mm/page_alloc.c
> --- linux-2.6.17-rc4-mm4-clean/mm/page_alloc.c	2006-05-15 10:37:55.000000000 +0100
> +++ linux-2.6.17-rc4-mm4-ia64_force_alignment/mm/page_alloc.c	2006-05-15 13:10:42.000000000 +0100
> @@ -2640,14 +2640,20 @@ void __init free_area_init_nodes(unsigne
> {
> 	unsigned long nid;
> 	int zone_index;
> +	unsigned long lowest_pfn = find_min_pfn_with_active_regions();
> +
> +	lowest_pfn = zone_boundary_align_pfn(lowest_pfn);
> +	arch_max_dma_pfn = zone_boundary_align_pfn(arch_max_dma_pfn);
> +	arch_max_dma32_pfn = zone_boundary_align_pfn(arch_max_dma32_pfn);
> +	arch_max_low_pfn = zone_boundary_align_pfn(arch_max_low_pfn);
> +	arch_max_high_pfn = zone_boundary_align_pfn(arch_max_high_pfn);
>
> 	/* Record where the zone boundaries are */
> 	memset(arch_zone_lowest_possible_pfn, 0,
> 				sizeof(arch_zone_lowest_possible_pfn));
> 	memset(arch_zone_highest_possible_pfn, 0,
> 				sizeof(arch_zone_highest_possible_pfn));
> -	arch_zone_lowest_possible_pfn[ZONE_DMA] =
> -					find_min_pfn_with_active_regions();
> +	arch_zone_lowest_possible_pfn[ZONE_DMA] = lowest_pfn;
> 	arch_zone_highest_possible_pfn[ZONE_DMA] = arch_max_dma_pfn;
> 	arch_zone_highest_possible_pfn[ZONE_DMA32] = arch_max_dma32_pfn;
> 	arch_zone_highest_possible_pfn[ZONE_NORMAL] = arch_max_low_pfn;
>

Ok, this patch is broken in a number of ways. It doesn't help the IA64 
problem at all and two other machine configurations failed with the patch 
applied during regression testing. Please drop and I'll figure out what 
the correct solution is to your IA64 machine not booting.

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

^ permalink raw reply

* RE: Routing problem
From: Yang, Steve @ 2006-05-15 16:08 UTC (permalink / raw)
  To: Antonio Di Bacco, linuxppc-embedded

Antonio,

Try this:

  sysctl net.ipv4.ip_forward=3D1=20

Regards,=20
Steve Yang
510-749-4535 Alameda
AIM: steveyang4535

-----Original Message-----
From: linuxppc-embedded-bounces+syang=3Dwindriver.com@ozlabs.org
[mailto:linuxppc-embedded-bounces+syang=3Dwindriver.com@ozlabs.org] On
Behalf Of Antonio Di Bacco
Sent: Friday, May 12, 2006 1:53 PM
To: linuxppc-embedded@ozlabs.org
Subject: Routing problem

Hi all,

I have a board with an MPC880 using the tow FECs as two ethernet
interfaces. I tried to enable the ip forwarding with no success. I have
issued  "echo 1=20
> /proc/sys/net/ipv4/ip_forward", is it sufficient to make Linux work as

> a
router?

Bye,
Antonio.=20
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply

* [patch]: pmac nvram driver shouldn't be compileable as a module
From: Guido Guenther @ 2006-05-15 23:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus

Hi,
currently when selecting CONFIG_NVRAM=m on PPC_PMAC on loading the nvram
module one gets:

nvram: module license 'unspecified' taints kernel.
nvram: Unknown symbol of_address_to_resource
nvram: Unknown symbol __alloc_bootmem
nvram: Unknown symbol pmac_newworld

instead of exporting all these to modules it'd be nice to make the
corresponding CONFIG_NVRAM options bool instead of tristate on PMAC_PPC.
I don't think it's intended to be compiled as a module, since it resides
under arch/powerpc/platforms/powermac and not drivers/macintosh. Is
there an easier way to achive this with the build system than the patch
below? If not, please apply.

--- orig/linux-2.6.17-rc4/drivers/char/Kconfig	2006-05-14 21:57:51.000000000 -0500
+++ linux-2.6.17-rc4/drivers/char/Kconfig	2006-05-15 17:06:10.000000000 -0500
@@ -687,7 +687,7 @@
 
 config NVRAM
 	tristate "/dev/nvram support"
-	depends on ATARI || X86 || ARM || GENERIC_NVRAM
+	depends on ATARI || X86 || ARM || (GENERIC_NVRAM && !PPC_PMAC)
 	---help---
 	  If you say Y here and create a character special file /dev/nvram
 	  with major number 10 and minor number 144 using mknod ("man mknod"),
--- orig/linux-2.6.17-rc4/drivers/macintosh/Kconfig	2006-03-19 23:53:29.000000000 -0600
+++ linux-2.6.17-rc4/drivers/macintosh/Kconfig	2006-05-15 17:14:40.000000000 -0500
@@ -200,4 +200,13 @@
 	tristate "Support for ANS LCD display"
 	depends on ADB_CUDA && PPC_PMAC
 
+config PMAC_NVRAM
+	bool "/dev/nvram support"
+	depends on GENERIC_NVRAM && PPC_PMAC
+	---help---
+	  If you say Y here and create a character special file /dev/nvram with
+	  major number 10 and minor number 144 using mknod ("man mknod"), you
+	  get read and write access to the non-volatile memory of your
+	  machine.
+
 endmenu
diff -u -u orig/linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile
--- orig/linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile	2006-03-19 23:53:29.000000000 -0600
+++ linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile	2006-05-15 17:22:43.000000000 -0500
@@ -6,7 +6,7 @@
 obj-$(CONFIG_PMAC_BACKLIGHT)	+= backlight.o
 obj-$(CONFIG_CPU_FREQ_PMAC)	+= cpufreq_32.o
 obj-$(CONFIG_CPU_FREQ_PMAC64)	+= cpufreq_64.o
-obj-$(CONFIG_NVRAM)		+= nvram.o
+obj-$(CONFIG_PMAC_NVRAM)	+= nvram.o
 # ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff
 obj-$(CONFIG_PPC64)		+= nvram.o
 obj-$(CONFIG_PPC32)		+= bootx_init.o

Singed-Off-By: Guido Guenther <agx@sigxcpu.org>
Cheers,
 -- Guido

^ permalink raw reply

* Re: [patch]: pmac nvram driver shouldn't be compileable as a module
From: Benjamin Herrenschmidt @ 2006-05-15 23:11 UTC (permalink / raw)
  To: Guido Guenther; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060515230115.GA9172@bogon.ms20.nix>

On Mon, 2006-05-15 at 18:01 -0500, Guido Guenther wrote:
> Hi,
> currently when selecting CONFIG_NVRAM=m on PPC_PMAC on loading the nvram
> module one gets:
> 
> nvram: module license 'unspecified' taints kernel.
> nvram: Unknown symbol of_address_to_resource
> nvram: Unknown symbol __alloc_bootmem
> nvram: Unknown symbol pmac_newworld
> 
> instead of exporting all these to modules it'd be nice to make the
> corresponding CONFIG_NVRAM options bool instead of tristate on PMAC_PPC.
> I don't think it's intended to be compiled as a module, since it resides
> under arch/powerpc/platforms/powermac and not drivers/macintosh. Is
> there an easier way to achive this with the build system than the patch
> below? If not, please apply.

Maybe simply not wrapping it with CONFIG_NVRAM ... 

Ben.

> --- orig/linux-2.6.17-rc4/drivers/char/Kconfig	2006-05-14 21:57:51.000000000 -0500
> +++ linux-2.6.17-rc4/drivers/char/Kconfig	2006-05-15 17:06:10.000000000 -0500
> @@ -687,7 +687,7 @@
>  
>  config NVRAM
>  	tristate "/dev/nvram support"
> -	depends on ATARI || X86 || ARM || GENERIC_NVRAM
> +	depends on ATARI || X86 || ARM || (GENERIC_NVRAM && !PPC_PMAC)
>  	---help---
>  	  If you say Y here and create a character special file /dev/nvram
>  	  with major number 10 and minor number 144 using mknod ("man mknod"),
> --- orig/linux-2.6.17-rc4/drivers/macintosh/Kconfig	2006-03-19 23:53:29.000000000 -0600
> +++ linux-2.6.17-rc4/drivers/macintosh/Kconfig	2006-05-15 17:14:40.000000000 -0500
> @@ -200,4 +200,13 @@
>  	tristate "Support for ANS LCD display"
>  	depends on ADB_CUDA && PPC_PMAC
>  
> +config PMAC_NVRAM
> +	bool "/dev/nvram support"
> +	depends on GENERIC_NVRAM && PPC_PMAC
> +	---help---
> +	  If you say Y here and create a character special file /dev/nvram with
> +	  major number 10 and minor number 144 using mknod ("man mknod"), you
> +	  get read and write access to the non-volatile memory of your
> +	  machine.
> +
>  endmenu
> diff -u -u orig/linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile
> --- orig/linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile	2006-03-19 23:53:29.000000000 -0600
> +++ linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile	2006-05-15 17:22:43.000000000 -0500
> @@ -6,7 +6,7 @@
>  obj-$(CONFIG_PMAC_BACKLIGHT)	+= backlight.o
>  obj-$(CONFIG_CPU_FREQ_PMAC)	+= cpufreq_32.o
>  obj-$(CONFIG_CPU_FREQ_PMAC64)	+= cpufreq_64.o
> -obj-$(CONFIG_NVRAM)		+= nvram.o
> +obj-$(CONFIG_PMAC_NVRAM)	+= nvram.o
>  # ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff
>  obj-$(CONFIG_PPC64)		+= nvram.o
>  obj-$(CONFIG_PPC32)		+= bootx_init.o
> 
> Singed-Off-By: Guido Guenther <agx@sigxcpu.org>
> Cheers,
>  -- Guido

^ permalink raw reply

* Re: route problem and simple sniffer
From: Wolfgang Denk @ 2006-05-15 23:29 UTC (permalink / raw)
  To: Antonio Di Bacco; +Cc: linuxppc-embedded
In-Reply-To: <200605152209.13033.antonio.dibacco@aruba.it>

In message <200605152209.13033.antonio.dibacco@aruba.it> you wrote:
> Anyone knows a lightweight sniffer for linux embedded?

tcpdump ?

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
How come everyone's going so slow if it's called rush hour?

^ permalink raw reply

* Re: [patch]: pmac nvram driver shouldn't be compileable as a module
From: Guido Guenther @ 2006-05-15 23:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus
In-Reply-To: <1147734713.13588.0.camel@localhost.localdomain>

On Tue, May 16, 2006 at 09:11:53AM +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2006-05-15 at 18:01 -0500, Guido Guenther wrote:
> > Hi,
> > currently when selecting CONFIG_NVRAM=3Dm on PPC_PMAC on loading the nv=
ram
> > module one gets:
> >=20
> > nvram: module license 'unspecified' taints kernel.
> > nvram: Unknown symbol of_address_to_resource
> > nvram: Unknown symbol __alloc_bootmem
> > nvram: Unknown symbol pmac_newworld
> >=20
> > instead of exporting all these to modules it'd be nice to make the
> > corresponding CONFIG_NVRAM options bool instead of tristate on PMAC_PPC.
> > I don't think it's intended to be compiled as a module, since it resides
> > under arch/powerpc/platforms/powermac and not drivers/macintosh. Is
> > there an easier way to achive this with the build system than the patch
> > below? If not, please apply.
>=20
> Maybe simply not wrapping it with CONFIG_NVRAM ...=20
=2E..which would make it non selectable at all. That's why I introduced
the PMAC_NVRAM.
 -- Guido
>=20
> Ben.
>=20
> > --- orig/linux-2.6.17-rc4/drivers/char/Kconfig	2006-05-14 21:57:51.0000=
00000 -0500
> > +++ linux-2.6.17-rc4/drivers/char/Kconfig	2006-05-15 17:06:10.000000000=
 -0500
> > @@ -687,7 +687,7 @@
> > =20
> >  config NVRAM
> >  	tristate "/dev/nvram support"
> > -	depends on ATARI || X86 || ARM || GENERIC_NVRAM
> > +	depends on ATARI || X86 || ARM || (GENERIC_NVRAM && !PPC_PMAC)
> >  	---help---
> >  	  If you say Y here and create a character special file /dev/nvram
> >  	  with major number 10 and minor number 144 using mknod ("man mknod"),
> > --- orig/linux-2.6.17-rc4/drivers/macintosh/Kconfig	2006-03-19 23:53:29=
=2E000000000 -0600
> > +++ linux-2.6.17-rc4/drivers/macintosh/Kconfig	2006-05-15 17:14:40.0000=
00000 -0500
> > @@ -200,4 +200,13 @@
> >  	tristate "Support for ANS LCD display"
> >  	depends on ADB_CUDA && PPC_PMAC
> > =20
> > +config PMAC_NVRAM
> > +	bool "/dev/nvram support"
> > +	depends on GENERIC_NVRAM && PPC_PMAC
> > +	---help---
> > +	  If you say Y here and create a character special file /dev/nvram wi=
th
> > +	  major number 10 and minor number 144 using mknod ("man mknod"), you
> > +	  get read and write access to the non-volatile memory of your
> > +	  machine.
> > +
> >  endmenu
> > diff -u -u orig/linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefi=
le linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile
> > --- orig/linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile	2006=
-03-19 23:53:29.000000000 -0600
> > +++ linux-2.6.17-rc4/arch/powerpc/platforms/powermac/Makefile	2006-05-1=
5 17:22:43.000000000 -0500
> > @@ -6,7 +6,7 @@
> >  obj-$(CONFIG_PMAC_BACKLIGHT)	+=3D backlight.o
> >  obj-$(CONFIG_CPU_FREQ_PMAC)	+=3D cpufreq_32.o
> >  obj-$(CONFIG_CPU_FREQ_PMAC64)	+=3D cpufreq_64.o
> > -obj-$(CONFIG_NVRAM)		+=3D nvram.o
> > +obj-$(CONFIG_PMAC_NVRAM)	+=3D nvram.o
> >  # ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff
> >  obj-$(CONFIG_PPC64)		+=3D nvram.o
> >  obj-$(CONFIG_PPC32)		+=3D bootx_init.o
> >=20
> > Singed-Off-By: Guido Guenther <agx@sigxcpu.org>
> > Cheers,
> >  -- Guido
>=20

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox