Commit 26298264 authored by Dan Williams's avatar Dan Williams

isci: move task context alignment from run-time to compile time

Remove usage of PTR_ALIGN by arranging for the task context to be aligned by
the compiler.  Another step towards unifying isci_request and
scic_sds_request.  Once this is complete the task context in the request can
likely be removed in favor of building the task directly to tc memory (see:
scic_sds_controller_copy_task_context).  It's not clear why this needs to be
cacheline aligned if we just end up copying before submission...
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 0d84366f
...@@ -124,31 +124,6 @@ ...@@ -124,31 +124,6 @@
+ sizeof(struct ssp_cmd_iu) \ + sizeof(struct ssp_cmd_iu) \
)) ))
/**
* scic_sds_ssp_request_get_task_context_buffer() -
*
* This macro returns the address of the task context buffer in the io request
* memory
*/
#define scic_sds_ssp_request_get_task_context_buffer(memory) \
((struct scu_task_context *)(\
((char *)(scic_sds_ssp_request_get_response_buffer(memory))) \
+ SSP_RESP_IU_MAX_SIZE \
))
/**
* scic_sds_ssp_request_get_sgl_element_buffer() -
*
* This macro returns the address of the sgl elment pairs in the io request
* memory buffer
*/
#define scic_sds_ssp_request_get_sgl_element_buffer(memory) \
((struct scu_sgl_element_pair *)(\
((char *)(scic_sds_ssp_request_get_task_context_buffer(memory))) \
+ sizeof(struct scu_task_context) \
))
/** /**
* scic_ssp_task_request_get_object_size() - * scic_ssp_task_request_get_object_size() -
* *
...@@ -184,24 +159,6 @@ ...@@ -184,24 +159,6 @@
+ sizeof(struct ssp_task_iu) \ + sizeof(struct ssp_task_iu) \
)) ))
/**
* scic_sds_ssp_task_request_get_task_context_buffer() -
*
* This macro returs the task context buffer for the SSP task request.
*/
#define scic_sds_ssp_task_request_get_task_context_buffer(memory) \
((struct scu_task_context *)(\
((char *)(scic_sds_ssp_task_request_get_response_buffer(memory))) \
+ SSP_RESP_IU_MAX_SIZE \
))
/*
* ****************************************************************************
* * SCIC SDS IO REQUEST PRIVATE METHODS
* **************************************************************************** */
/** /**
* *
* *
...@@ -210,9 +167,7 @@ ...@@ -210,9 +167,7 @@
static u32 scic_sds_ssp_request_get_object_size(void) static u32 scic_sds_ssp_request_get_object_size(void)
{ {
return sizeof(struct scic_sds_request) return sizeof(struct scic_sds_request)
+ scic_ssp_io_request_get_object_size() + scic_ssp_io_request_get_object_size();
+ sizeof(struct scu_task_context)
+ SMP_CACHE_BYTES;
} }
/** /**
...@@ -328,13 +283,8 @@ static void scic_sds_ssp_io_request_assign_buffers( ...@@ -328,13 +283,8 @@ static void scic_sds_ssp_io_request_assign_buffers(
sci_req->response_buffer = sci_req->response_buffer =
scic_sds_ssp_request_get_response_buffer(sci_req); scic_sds_ssp_request_get_response_buffer(sci_req);
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = sci_req->task_context_buffer = &sci_req->tc;
scic_sds_ssp_request_get_task_context_buffer(sci_req);
sci_req->task_context_buffer =
PTR_ALIGN(sci_req->task_context_buffer,
SMP_CACHE_BYTES);
}
} }
static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req) static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req)
...@@ -530,12 +480,8 @@ static void scic_sds_ssp_task_request_assign_buffers( ...@@ -530,12 +480,8 @@ static void scic_sds_ssp_task_request_assign_buffers(
sci_req->response_buffer = sci_req->response_buffer =
scic_sds_ssp_task_request_get_response_buffer(sci_req); scic_sds_ssp_task_request_get_response_buffer(sci_req);
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = sci_req->task_context_buffer = &sci_req->tc;
scic_sds_ssp_task_request_get_task_context_buffer(sci_req);
sci_req->task_context_buffer =
PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
}
} }
/** /**
......
...@@ -184,6 +184,7 @@ struct scic_sds_request { ...@@ -184,6 +184,7 @@ struct scic_sds_request {
void *command_buffer; void *command_buffer;
void *response_buffer; void *response_buffer;
struct scu_task_context *task_context_buffer; struct scu_task_context *task_context_buffer;
struct scu_task_context tc ____cacheline_aligned;
/* could be larger with sg chaining */ /* could be larger with sg chaining */
#define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2)
......
...@@ -78,9 +78,7 @@ u32 scic_sds_smp_request_get_object_size(void) ...@@ -78,9 +78,7 @@ u32 scic_sds_smp_request_get_object_size(void)
{ {
return sizeof(struct scic_sds_request) return sizeof(struct scic_sds_request)
+ sizeof(struct smp_req) + sizeof(struct smp_req)
+ sizeof(struct smp_resp) + sizeof(struct smp_resp);
+ sizeof(struct scu_task_context)
+ SMP_CACHE_BYTES;
} }
/** /**
...@@ -102,29 +100,7 @@ u32 scic_sds_smp_request_get_object_size(void) ...@@ -102,29 +100,7 @@ u32 scic_sds_smp_request_get_object_size(void)
(((char *)(scic_sds_smp_request_get_command_buffer(memory))) \ (((char *)(scic_sds_smp_request_get_command_buffer(memory))) \
+ sizeof(struct smp_req)) + sizeof(struct smp_req))
/** void scic_sds_smp_request_assign_buffers(struct scic_sds_request *sci_req)
* scic_sds_smp_request_get_task_context_buffer() -
*
* This macro returs the task context buffer for the SMP request.
*/
#define scic_sds_smp_request_get_task_context_buffer(memory) \
((struct scu_task_context *)(\
((char *)(scic_sds_smp_request_get_response_buffer(memory))) \
+ sizeof(struct smp_resp) \
))
/**
* This method build the remainder of the IO request object.
* @sci_req: This parameter specifies the request object being constructed.
*
* The scic_sds_general_request_construct() must be called before this call is
* valid. none
*/
void scic_sds_smp_request_assign_buffers(
struct scic_sds_request *sci_req)
{ {
/* Assign all of the buffer pointers */ /* Assign all of the buffer pointers */
sci_req->command_buffer = sci_req->command_buffer =
...@@ -132,13 +108,8 @@ void scic_sds_smp_request_assign_buffers( ...@@ -132,13 +108,8 @@ void scic_sds_smp_request_assign_buffers(
sci_req->response_buffer = sci_req->response_buffer =
scic_sds_smp_request_get_response_buffer(sci_req); scic_sds_smp_request_get_response_buffer(sci_req);
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = sci_req->task_context_buffer = &sci_req->tc;
scic_sds_smp_request_get_task_context_buffer(sci_req);
sci_req->task_context_buffer =
PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
}
} }
/* /*
......
...@@ -93,18 +93,6 @@ ...@@ -93,18 +93,6 @@
+ sizeof(struct host_to_dev_fis) \ + sizeof(struct host_to_dev_fis) \
)) ))
/**
* scic_sds_stp_request_get_task_context_buffer() -
*
* This macro returns the address of the task context buffer in the io request
* memory
*/
#define scic_sds_stp_request_get_task_context_buffer(memory) \
((struct scu_task_context *)(\
((char *)(scic_sds_stp_request_get_response_buffer(memory))) \
+ SSP_RESP_IU_MAX_SIZE \
))
/** /**
* *
* *
...@@ -114,9 +102,7 @@ u32 scic_sds_stp_request_get_object_size(void) ...@@ -114,9 +102,7 @@ u32 scic_sds_stp_request_get_object_size(void)
{ {
return sizeof(struct scic_sds_stp_request) return sizeof(struct scic_sds_stp_request)
+ sizeof(struct host_to_dev_fis) + sizeof(struct host_to_dev_fis)
+ sizeof(struct dev_to_host_fis) + sizeof(struct dev_to_host_fis);
+ sizeof(struct scu_task_context)
+ SMP_CACHE_BYTES;
} }
void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req)
...@@ -126,12 +112,8 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) ...@@ -126,12 +112,8 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req)
sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req);
sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req);
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = sci_req->task_context_buffer = &sci_req->tc;
scic_sds_stp_request_get_task_context_buffer(stp_req);
sci_req->task_context_buffer = PTR_ALIGN(sci_req->task_context_buffer,
SMP_CACHE_BYTES);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment