Sequencer.cc (7832:de7601e6e19d) Sequencer.cc (7907:d648b8409d4c)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 217 unchanged lines hidden (view full) ---

226 schedule(deadlockCheckEvent, m_deadlock_threshold + curTick());
227 }
228
229 Address line_addr(request->ruby_request.paddr);
230 line_addr.makeLineAddress();
231 if ((request->ruby_request.type == RubyRequestType_ST) ||
232 (request->ruby_request.type == RubyRequestType_RMW_Read) ||
233 (request->ruby_request.type == RubyRequestType_RMW_Write) ||
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 217 unchanged lines hidden (view full) ---

226 schedule(deadlockCheckEvent, m_deadlock_threshold + curTick());
227 }
228
229 Address line_addr(request->ruby_request.paddr);
230 line_addr.makeLineAddress();
231 if ((request->ruby_request.type == RubyRequestType_ST) ||
232 (request->ruby_request.type == RubyRequestType_RMW_Read) ||
233 (request->ruby_request.type == RubyRequestType_RMW_Write) ||
234 (request->ruby_request.type == RubyRequestType_Locked_Read) ||
235 (request->ruby_request.type == RubyRequestType_Locked_Write)) {
234 (request->ruby_request.type == RubyRequestType_Load_Linked) ||
235 (request->ruby_request.type == RubyRequestType_Store_Conditional)) {
236 pair<RequestTable::iterator, bool> r =
237 m_writeRequestTable.insert(RequestTable::value_type(line_addr, 0));
238 bool success = r.second;
239 RequestTable::iterator i = r.first;
240 if (!success) {
241 i->second = request;
242 // return true;
243

--- 41 unchanged lines hidden (view full) ---

285 m_writeRequestTable.size() + m_readRequestTable.size());
286
287 const RubyRequest & ruby_request = srequest->ruby_request;
288 Address line_addr(ruby_request.paddr);
289 line_addr.makeLineAddress();
290 if ((ruby_request.type == RubyRequestType_ST) ||
291 (ruby_request.type == RubyRequestType_RMW_Read) ||
292 (ruby_request.type == RubyRequestType_RMW_Write) ||
236 pair<RequestTable::iterator, bool> r =
237 m_writeRequestTable.insert(RequestTable::value_type(line_addr, 0));
238 bool success = r.second;
239 RequestTable::iterator i = r.first;
240 if (!success) {
241 i->second = request;
242 // return true;
243

--- 41 unchanged lines hidden (view full) ---

285 m_writeRequestTable.size() + m_readRequestTable.size());
286
287 const RubyRequest & ruby_request = srequest->ruby_request;
288 Address line_addr(ruby_request.paddr);
289 line_addr.makeLineAddress();
290 if ((ruby_request.type == RubyRequestType_ST) ||
291 (ruby_request.type == RubyRequestType_RMW_Read) ||
292 (ruby_request.type == RubyRequestType_RMW_Write) ||
293 (ruby_request.type == RubyRequestType_Locked_Read) ||
294 (ruby_request.type == RubyRequestType_Locked_Write)) {
293 (ruby_request.type == RubyRequestType_Load_Linked) ||
294 (ruby_request.type == RubyRequestType_Store_Conditional)) {
295 m_writeRequestTable.erase(line_addr);
296 } else {
297 m_readRequestTable.erase(line_addr);
298 }
299
300 markRemoved();
301}
302
303bool
304Sequencer::handleLlsc(const Address& address, SequencerRequest* request)
305{
306 //
307 // The success flag indicates whether the LLSC operation was successful.
308 // LL ops will always succeed, but SC may fail if the cache line is no
309 // longer locked.
310 //
311 bool success = true;
295 m_writeRequestTable.erase(line_addr);
296 } else {
297 m_readRequestTable.erase(line_addr);
298 }
299
300 markRemoved();
301}
302
303bool
304Sequencer::handleLlsc(const Address& address, SequencerRequest* request)
305{
306 //
307 // The success flag indicates whether the LLSC operation was successful.
308 // LL ops will always succeed, but SC may fail if the cache line is no
309 // longer locked.
310 //
311 bool success = true;
312 if (request->ruby_request.type == RubyRequestType_Locked_Write) {
312 if (request->ruby_request.type == RubyRequestType_Store_Conditional) {
313 if (!m_dataCache_ptr->isLocked(address, m_version)) {
314 //
315 // For failed SC requests, indicate the failure to the cpu by
316 // setting the extra data to zero.
317 //
318 request->ruby_request.pkt->req->setExtraData(0);
319 success = false;
320 } else {
321 //
322 // For successful SC requests, indicate the success to the cpu by
323 // setting the extra data to one.
324 //
325 request->ruby_request.pkt->req->setExtraData(1);
326 }
327 //
328 // Independent of success, all SC operations must clear the lock
329 //
330 m_dataCache_ptr->clearLocked(address);
313 if (!m_dataCache_ptr->isLocked(address, m_version)) {
314 //
315 // For failed SC requests, indicate the failure to the cpu by
316 // setting the extra data to zero.
317 //
318 request->ruby_request.pkt->req->setExtraData(0);
319 success = false;
320 } else {
321 //
322 // For successful SC requests, indicate the success to the cpu by
323 // setting the extra data to one.
324 //
325 request->ruby_request.pkt->req->setExtraData(1);
326 }
327 //
328 // Independent of success, all SC operations must clear the lock
329 //
330 m_dataCache_ptr->clearLocked(address);
331 } else if (request->ruby_request.type == RubyRequestType_Locked_Read) {
331 } else if (request->ruby_request.type == RubyRequestType_Load_Linked) {
332 //
333 // Note: To fully follow Alpha LLSC semantics, should the LL clear any
334 // previously locked cache lines?
335 //
336 m_dataCache_ptr->setLocked(address, m_version);
337 } else if (m_dataCache_ptr->isLocked(address, m_version)) {
338 //
339 // Normal writes should clear the locked address

--- 33 unchanged lines hidden (view full) ---

373 SequencerRequest* request = i->second;
374
375 m_writeRequestTable.erase(i);
376 markRemoved();
377
378 assert((request->ruby_request.type == RubyRequestType_ST) ||
379 (request->ruby_request.type == RubyRequestType_RMW_Read) ||
380 (request->ruby_request.type == RubyRequestType_RMW_Write) ||
332 //
333 // Note: To fully follow Alpha LLSC semantics, should the LL clear any
334 // previously locked cache lines?
335 //
336 m_dataCache_ptr->setLocked(address, m_version);
337 } else if (m_dataCache_ptr->isLocked(address, m_version)) {
338 //
339 // Normal writes should clear the locked address

--- 33 unchanged lines hidden (view full) ---

373 SequencerRequest* request = i->second;
374
375 m_writeRequestTable.erase(i);
376 markRemoved();
377
378 assert((request->ruby_request.type == RubyRequestType_ST) ||
379 (request->ruby_request.type == RubyRequestType_RMW_Read) ||
380 (request->ruby_request.type == RubyRequestType_RMW_Write) ||
381 (request->ruby_request.type == RubyRequestType_Locked_Read) ||
382 (request->ruby_request.type == RubyRequestType_Locked_Write));
381 (request->ruby_request.type == RubyRequestType_Load_Linked) ||
382 (request->ruby_request.type == RubyRequestType_Store_Conditional));
383
384 //
385 // For Alpha, properly handle LL, SC, and write requests with respect to
386 // locked cache blocks.
387 //
388 bool success = handleLlsc(address, request);
389
390 if (request->ruby_request.type == RubyRequestType_RMW_Read) {

--- 105 unchanged lines hidden (view full) ---

496 }
497#endif
498
499 // update the data
500 if (ruby_request.data != NULL) {
501 if ((type == RubyRequestType_LD) ||
502 (type == RubyRequestType_IFETCH) ||
503 (type == RubyRequestType_RMW_Read) ||
383
384 //
385 // For Alpha, properly handle LL, SC, and write requests with respect to
386 // locked cache blocks.
387 //
388 bool success = handleLlsc(address, request);
389
390 if (request->ruby_request.type == RubyRequestType_RMW_Read) {

--- 105 unchanged lines hidden (view full) ---

496 }
497#endif
498
499 // update the data
500 if (ruby_request.data != NULL) {
501 if ((type == RubyRequestType_LD) ||
502 (type == RubyRequestType_IFETCH) ||
503 (type == RubyRequestType_RMW_Read) ||
504 (type == RubyRequestType_Locked_Read)) {
504 (type == RubyRequestType_Load_Linked)) {
505
506 memcpy(ruby_request.data,
507 data.getData(request_address.getOffset(), ruby_request.len),
508 ruby_request.len);
509 } else {
510 data.setData(ruby_request.data, request_address.getOffset(),
511 ruby_request.len);
512 }

--- 96 unchanged lines hidden (view full) ---

609 ctype = CacheRequestType_IFETCH;
610 break;
611 case RubyRequestType_LD:
612 ctype = CacheRequestType_LD;
613 break;
614 case RubyRequestType_ST:
615 ctype = CacheRequestType_ST;
616 break;
505
506 memcpy(ruby_request.data,
507 data.getData(request_address.getOffset(), ruby_request.len),
508 ruby_request.len);
509 } else {
510 data.setData(ruby_request.data, request_address.getOffset(),
511 ruby_request.len);
512 }

--- 96 unchanged lines hidden (view full) ---

609 ctype = CacheRequestType_IFETCH;
610 break;
611 case RubyRequestType_LD:
612 ctype = CacheRequestType_LD;
613 break;
614 case RubyRequestType_ST:
615 ctype = CacheRequestType_ST;
616 break;
617 case RubyRequestType_Locked_Read:
618 case RubyRequestType_Locked_Write:
617 case RubyRequestType_Load_Linked:
618 case RubyRequestType_Store_Conditional:
619 ctype = CacheRequestType_ATOMIC;
620 break;
621 case RubyRequestType_RMW_Read:
622 ctype = CacheRequestType_ATOMIC;
623 break;
624 case RubyRequestType_RMW_Write:
625 ctype = CacheRequestType_ATOMIC;
626 break;

--- 91 unchanged lines hidden ---
619 ctype = CacheRequestType_ATOMIC;
620 break;
621 case RubyRequestType_RMW_Read:
622 ctype = CacheRequestType_ATOMIC;
623 break;
624 case RubyRequestType_RMW_Write:
625 ctype = CacheRequestType_ATOMIC;
626 break;

--- 91 unchanged lines hidden ---