From 6bed6e0352a68723ea55017b3e09a8c279af11ec Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Fri, 24 Jan 2014 15:29:30 -0600 Subject: cpu: Add CPU support for generatig wake up events when LLSC adresses are snooped. This patch add support for generating wake-up events in the CPU when an address that is currently in the exclusive state is hit by a snoop. This mechanism is required for ARMv8 multi-processor support. --- src/arch/alpha/locked_mem.hh | 7 ++++++- src/arch/arm/locked_mem.hh | 20 ++++++++++++-------- src/arch/mips/locked_mem.hh | 8 +++++++- src/arch/power/locked_mem.hh | 8 +++++++- src/arch/sparc/locked_mem.hh | 8 +++++++- src/arch/x86/locked_mem.hh | 8 +++++++- 6 files changed, 46 insertions(+), 13 deletions(-) (limited to 'src/arch') diff --git a/src/arch/alpha/locked_mem.hh b/src/arch/alpha/locked_mem.hh index e62ed1654..253b94be4 100644 --- a/src/arch/alpha/locked_mem.hh +++ b/src/arch/alpha/locked_mem.hh @@ -93,10 +93,15 @@ handleLockedRead(XC *xc, Request *req) xc->setMiscReg(MISCREG_LOCKFLAG, true); } +template +inline void +handleLockedSnoopHit(XC *xc) +{ +} template inline bool -handleLockedWrite(XC *xc, Request *req) +handleLockedWrite(XC *xc, Request *req, Addr cacheBlockMask) { if (req->isUncacheable()) { // Funky Turbolaser mailbox access...don't update diff --git a/src/arch/arm/locked_mem.hh b/src/arch/arm/locked_mem.hh index 37973ff98..f2601f00c 100644 --- a/src/arch/arm/locked_mem.hh +++ b/src/arch/arm/locked_mem.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 ARM Limited + * Copyright (c) 2012-2013 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -66,26 +66,30 @@ handleLockedSnoop(XC *xc, PacketPtr pkt, Addr cacheBlockMask) return; Addr locked_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask; - Addr snoop_addr = pkt->getAddr(); - - assert((cacheBlockMask & snoop_addr) == snoop_addr); + Addr snoop_addr = pkt->getAddr() & cacheBlockMask; if (locked_addr == snoop_addr) xc->setMiscReg(MISCREG_LOCKFLAG, false); } +template +inline void +handleLockedSnoopHit(XC *xc) +{ +} + template inline void handleLockedRead(XC *xc, Request *req) { - xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr() & ~0xf); + xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr()); xc->setMiscReg(MISCREG_LOCKFLAG, true); } template inline bool -handleLockedWrite(XC *xc, Request *req) +handleLockedWrite(XC *xc, Request *req, Addr cacheBlockMask) { if (req->isSwap()) return true; @@ -93,8 +97,8 @@ handleLockedWrite(XC *xc, Request *req) // Verify that the lock flag is still set and the address // is correct bool lock_flag = xc->readMiscReg(MISCREG_LOCKFLAG); - Addr lock_addr = xc->readMiscReg(MISCREG_LOCKADDR); - if (!lock_flag || (req->getPaddr() & ~0xf) != lock_addr) { + Addr lock_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask; + if (!lock_flag || (req->getPaddr() & cacheBlockMask) != lock_addr) { // Lock flag not set or addr mismatch in CPU; // don't even bother sending to memory system req->setExtraData(0); diff --git a/src/arch/mips/locked_mem.hh b/src/arch/mips/locked_mem.hh index b4003fea9..5b0f8a1b8 100644 --- a/src/arch/mips/locked_mem.hh +++ b/src/arch/mips/locked_mem.hh @@ -86,9 +86,15 @@ handleLockedRead(XC *xc, Request *req) req->threadId(), req->getPaddr() & ~0xf); } +template +inline void +handleLockedSnoopHit(XC *xc) +{ +} + template inline bool -handleLockedWrite(XC *xc, Request *req) +handleLockedWrite(XC *xc, Request *req, Addr cacheBlockMask) { if (req->isUncacheable()) { // Funky Turbolaser mailbox access...don't update diff --git a/src/arch/power/locked_mem.hh b/src/arch/power/locked_mem.hh index f3d042d5c..d962f9aff 100644 --- a/src/arch/power/locked_mem.hh +++ b/src/arch/power/locked_mem.hh @@ -59,9 +59,15 @@ handleLockedRead(XC *xc, Request *req) { } +template +inline void +handleLockedSnoopHit(XC *xc) +{ +} + template inline bool -handleLockedWrite(XC *xc, Request *req) +handleLockedWrite(XC *xc, Request *req, Addr cacheBlockMask) { return true; } diff --git a/src/arch/sparc/locked_mem.hh b/src/arch/sparc/locked_mem.hh index 8277ef487..b28179481 100644 --- a/src/arch/sparc/locked_mem.hh +++ b/src/arch/sparc/locked_mem.hh @@ -54,10 +54,16 @@ handleLockedRead(XC *xc, Request *req) { } +template +inline void +handleLockedSnoopHit(XC *xc) +{ +} + template inline bool -handleLockedWrite(XC *xc, Request *req) +handleLockedWrite(XC *xc, Request *req, Addr cacheBlockMask) { return true; } diff --git a/src/arch/x86/locked_mem.hh b/src/arch/x86/locked_mem.hh index c2a8395aa..51cfb2ea3 100644 --- a/src/arch/x86/locked_mem.hh +++ b/src/arch/x86/locked_mem.hh @@ -56,10 +56,16 @@ namespace X86ISA template inline bool - handleLockedWrite(XC *xc, Request *req) + handleLockedWrite(XC *xc, Request *req, Addr cacheBlockMask) { return true; } + + template + inline void + handleLockedSnoopHit(XC *xc) + { + } } #endif // __ARCH_X86_LOCKEDMEM_HH__ -- cgit v1.2.3