netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dykmanj@linux.vnet.ibm.com
To: netdev@vger.kernel.org
Cc: Jim Dykman <dykmanj@linux.vnet.ibm.com>,
	Piyush Chaudhary <piyushc@linux.vnet.ibm.com>,
	Fu-Chung Chang <fcchang@linux.vnet.ibm.com>,
	" William S. Cadden" <wscadden@linux.vnet.ibm.com>,
	" Wen C. Chen" <winstonc@linux.vnet.ibm.com>,
	Scot Sakolish <sakolish@linux.vnet.ibm.com>,
	Jian Xiao <jian@linux.vnet.ibm.com>,
	" Carol L. Soto" <clsoto@linux.vnet.ibm.com>,
	" Sarah J. Sheppard" <sjsheppa@linux.vnet.ibm.com>
Subject: [PATCH v4 14/27] HFI: Add hypercalls to create/modify/free page tables in the nMMU
Date: Mon, 25 Apr 2011 17:23:54 -0400	[thread overview]
Message-ID: <1303766647-30156-15-git-send-email-dykmanj@linux.vnet.ibm.com> (raw)
In-Reply-To: <1303766647-30156-1-git-send-email-dykmanj@linux.vnet.ibm.com>

From: Jim Dykman <dykmanj@linux.vnet.ibm.com>

Signed-off-by:  Piyush Chaudhary <piyushc@linux.vnet.ibm.com>
Signed-off-by:  Jim Dykman <dykmanj@linux.vnet.ibm.com>
Signed-off-by:  Fu-Chung Chang <fcchang@linux.vnet.ibm.com>
Signed-off-by:  William S. Cadden <wscadden@linux.vnet.ibm.com>
Signed-off-by:  Wen C. Chen <winstonc@linux.vnet.ibm.com>
Signed-off-by:  Scot Sakolish <sakolish@linux.vnet.ibm.com>
Signed-off-by:  Jian Xiao <jian@linux.vnet.ibm.com>
Signed-off-by:  Carol L. Soto <clsoto@linux.vnet.ibm.com>
Signed-off-by:  Sarah J. Sheppard <sjsheppa@linux.vnet.ibm.com>
---
 drivers/net/hfi/core/hfidd_hcalls.c |  124 +++++++++++++++++++++++++++++++++++
 drivers/net/hfi/core/hfidd_proto.h  |   15 ++++
 include/linux/hfi/hfidd_hcalls.h    |    3 +
 3 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/drivers/net/hfi/core/hfidd_hcalls.c b/drivers/net/hfi/core/hfidd_hcalls.c
index 2ca1c8a..aabb2a8 100644
--- a/drivers/net/hfi/core/hfidd_hcalls.c
+++ b/drivers/net/hfi/core/hfidd_hcalls.c
@@ -45,6 +45,64 @@ static inline long long h_nmmu_stop(int token, u64 torrent_chip_ID)
 	return plpar_hcall_norets(token, torrent_chip_ID);
 }
 
+static inline long long h_nmmu_allocate_resource(int token,
+		u64 torrent_chip_ID,
+		u64 resource_name,
+		u64 eaddr,
+		u64 memory_region_size,
+		u64 access_controls,
+		u64 protection_domain,
+		u64 MR_Handle_In,
+		u64 *MR_Handle_out,
+		u64 *L_Key,
+		u64 *liobn)
+{
+	u64 hyp_outputs[PLPAR_HCALL9_BUFSIZE];
+	long long rc;
+
+	rc = plpar_hcall9(token, (unsigned long *)hyp_outputs,
+			torrent_chip_ID, resource_name, eaddr,
+			memory_region_size, access_controls,
+			protection_domain, MR_Handle_In);
+	*MR_Handle_out = hyp_outputs[0];	/* 1st ret value */
+	*L_Key = hyp_outputs[1];		/* 2nd */
+	*liobn = hyp_outputs[3];		/* 4th */
+
+	return rc;
+}
+
+static inline long long h_nmmu_free_resource(int token,
+		u64 torrent_chip_ID,
+		u64 resource_name,
+		u64 MR_Handle,
+		u64 subregion)
+{
+	return  plpar_hcall_norets(token,
+				torrent_chip_ID,
+				resource_name,
+				MR_Handle,
+				subregion);
+}
+
+static inline long long h_nmmu_modify_resource(int token,
+		u64 torrent_chip_ID,
+		u64 request,
+		u64 MR_Handle,
+		u64 subregion,
+		u64 eaddr,
+		u64 laddr,
+		u64 num_pg_sz)
+{
+	return  plpar_hcall_norets(token,
+				torrent_chip_ID,
+				request,
+				MR_Handle,
+				subregion,
+				eaddr,
+				laddr,
+				num_pg_sz);
+}
+
 static inline long long h_hfi_start_interface(int token,
 		u64 HFI_chip_ID)
 {
@@ -94,6 +152,72 @@ long long hfi_stop_nmmu(u64 chip_id)
 	return hvrc;
 }
 
+long long hfi_allocate_mr(u64 chip_id, u64 res, u64 addr, u64 mr_size,
+		u64 access,
+		u64 job_id,
+		u64 mr_handle_in,
+		u64 *mr_handle_out,
+		u64 *lkey_p,
+		u64 *liobn)
+{
+	return h_nmmu_allocate_resource(H_NMMU_ALLOCATE_RESOURCE,
+			chip_id,
+			res,
+			addr,
+			mr_size,
+			access,
+			job_id,
+			mr_handle_in,
+			mr_handle_out,
+			lkey_p,
+			liobn);
+}
+
+long long hfi_modify_mr(u64 chip_id, u64 request, u64 mr_handle,
+		u64 sub_id,
+		u64 e_addr,
+		u64 l_addr,
+		u64 num_pg_sz)
+{
+	long long  hvrc;
+	u64 start_time = get_jiffies_64();
+
+	while (1) {
+		hvrc = h_nmmu_modify_resource(H_NMMU_MODIFY_RESOURCE,
+				chip_id,
+				request,
+				mr_handle,
+				sub_id,
+				e_addr,
+				l_addr,
+				num_pg_sz);
+		if (hvrc != H_BUSY)
+			break;
+		if (hfidd_age_hcall(start_time))
+			break;
+	}
+	return hvrc;
+}
+
+long long hfi_free_mr(u64 chip_id, u64 res, u64 mr_handle, u64 sub_region_id)
+{
+	long long	hvrc;
+	u64 start_time = get_jiffies_64();
+
+	while (1) {
+		hvrc = h_nmmu_free_resource(H_NMMU_FREE_RESOURCE,
+				chip_id,
+				res,
+				mr_handle,
+				sub_region_id);
+		if (hvrc != H_BUSY)
+			break;
+		if (hfidd_age_hcall(start_time))
+			break;
+	}
+	return hvrc;
+}
+
 long long hfi_hquery_interface(u64 unit_id, u64 subtype,
 			       u64 query_p, u64 *state)
 {
diff --git a/drivers/net/hfi/core/hfidd_proto.h b/drivers/net/hfi/core/hfidd_proto.h
index 001f6d5..fb9c8c8 100644
--- a/drivers/net/hfi/core/hfidd_proto.h
+++ b/drivers/net/hfi/core/hfidd_proto.h
@@ -64,6 +64,21 @@ int hfidd_start_interface(struct hfidd_acs *p_acs);
 int hfidd_stop_interface(struct hfidd_acs *p_acs, unsigned int hfi_id);
 long long hfi_start_nmmu(u64 chip_id, void *nmmu_info);
 long long hfi_stop_nmmu(u64 chip_id);
+long long hfi_allocate_mr(u64 chip_id, u64 res, u64 addr,
+		u64 mr_size,
+		u64 access,
+		u64 job_id,
+		u64 mr_handle_in,
+		u64 *mr_handle_out,
+		u64 *lkey_p,
+		u64 *liobn);
+long long hfi_modify_mr(u64 chip_id, u64 request, u64 mr_handle,
+		u64 sub_id,
+		u64 e_addr,
+		u64 l_addr,
+		u64 num_pg_sz);
+long long hfi_free_mr(u64 chip_id, u64 res, u64 mr_handle,
+		u64 sub_region_id);
 long long hfi_hquery_interface(u64 unit_id, u64 subtype, u64 query_p,
 		u64 *state);
 long long hfi_start_interface(u64 unit_id);
diff --git a/include/linux/hfi/hfidd_hcalls.h b/include/linux/hfi/hfidd_hcalls.h
index 57140a0..9fa87c5 100644
--- a/include/linux/hfi/hfidd_hcalls.h
+++ b/include/linux/hfi/hfidd_hcalls.h
@@ -41,6 +41,9 @@
 #define H_HFI_STOP_INTERFACE		0xF008
 #define H_NMMU_START			0xF028
 #define H_NMMU_STOP			0xF02C
+#define H_NMMU_ALLOCATE_RESOURCE	0xF030
+#define H_NMMU_FREE_RESOURCE		0xF034
+#define H_NMMU_MODIFY_RESOURCE		0xF03C
 
 #define HFI_PAGE_CODE_SHIFT	28
 
-- 
1.7.3.5


  parent reply	other threads:[~2011-04-25 21:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-25 21:23 [PATCH v4 00/27] HFI: minimal device driver/ip driver dykmanj
2011-04-25 21:23 ` [PATCH v4 01/27] HFI: skeleton driver dykmanj
2011-05-20 18:37   ` Brian King
2011-04-25 21:23 ` [PATCH v4 02/27] HFI: Add HFI adapter control structure dykmanj
2011-04-25 21:23 ` [PATCH v4 03/27] HFI: Add device_create/device_destroy calls for HFI devices dykmanj
2011-04-25 21:23 ` [PATCH v4 04/27] HFI: Find HFI devices in the device tree dykmanj
2011-04-25 21:23 ` [PATCH v4 05/27] HFI: The first few HFI-specific hypervisor calls dykmanj
2011-04-25 21:23 ` [PATCH v4 06/27] HFI: Add DD calls to START/STOP INTERFACE HCALLs dykmanj
2011-04-25 21:23 ` [PATCH v4 07/27] HFI: Add nMMU start/stop hypervisor calls dykmanj
2011-04-25 21:23 ` [PATCH v4 08/27] HFI: DD request framework and first HFI DD request dykmanj
2011-04-25 21:23 ` [PATCH v4 09/27] HFI: Add HFI window resource tracking dykmanj
2011-04-25 21:23 ` [PATCH v4 10/27] HFI: HFIDD_REQ_OPEN_WINDOW request dykmanj
2011-04-25 21:23 ` [PATCH v4 11/27] HFI: Check window number/assign window number dykmanj
2011-04-25 21:23 ` [PATCH v4 12/27] HFI: Sanity check send and receive fifo parameters dykmanj
2011-04-25 21:23 ` [PATCH v4 13/27] HFI: Send and receive fifo address translation dykmanj
2011-04-25 21:23 ` dykmanj [this message]
2011-04-25 21:23 ` [PATCH v4 15/27] HFI: Set up nMMU page tables for the send and receive fifos dykmanj
2011-04-25 21:23 ` [PATCH v4 16/27] HFI: Add window open hypervisor call dykmanj
2011-04-25 21:23 ` [PATCH v4 17/27] HFI: Set up and call the open window hypercall dykmanj
2011-04-25 21:23 ` [PATCH v4 18/27] HFI: Map window registers into user process dykmanj
2011-04-25 21:23 ` [PATCH v4 19/27] HFI: Add window close request dykmanj
2011-04-25 21:24 ` [PATCH v4 20/27] HFI: Close window hypervisor call dykmanj
2011-04-25 21:24 ` [PATCH v4 21/27] HFI: Add send and receive interrupts dykmanj
2011-04-25 21:24 ` [PATCH v4 22/27] HFI: Add event notifications dykmanj
2011-04-25 21:24 ` [PATCH v4 23/27] HFI: Define packet header formats and window register offsets dykmanj
2011-04-25 21:24 ` [PATCH v4 24/27] HFI: hfi_ip network driver dykmanj
2011-04-25 21:24 ` [PATCH v4 25/27] HFI: hfi_ip fifo transmit paths dykmanj
2011-04-25 21:24 ` [PATCH v4 26/27] HFI: hfi_ip fifo receive path dykmanj
2011-04-25 21:24 ` [PATCH v4 27/27] HFI: hfi_ip ethtool support dykmanj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303766647-30156-15-git-send-email-dykmanj@linux.vnet.ibm.com \
    --to=dykmanj@linux.vnet.ibm.com \
    --cc=clsoto@linux.vnet.ibm.com \
    --cc=fcchang@linux.vnet.ibm.com \
    --cc=jian@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=piyushc@linux.vnet.ibm.com \
    --cc=sakolish@linux.vnet.ibm.com \
    --cc=sjsheppa@linux.vnet.ibm.com \
    --cc=winstonc@linux.vnet.ibm.com \
    --cc=wscadden@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).