[gem5-dev] Change in gem5/gem5[master]: dev, arm: Cleanup Pl050 interrupt handling
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9769 to review the following change. Change subject: dev, arm: Cleanup Pl050 interrupt handling .. dev, arm: Cleanup Pl050 interrupt handling Add support for TX interrupts and cleanup existing RX interrupt handling. Change-Id: If2e5b0c0cc6fbeb2dce09e7e9d935647516b2c47 Signed-off-by: Andreas Sandberg Reviewed-by: Sudhanshu Jha Reviewed-by: Giacomo Travaglini --- M src/dev/arm/RealView.py M src/dev/arm/kmi.cc M src/dev/arm/kmi.hh 3 files changed, 65 insertions(+), 74 deletions(-) diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index 7661db1..9b91f46 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -466,7 +466,6 @@ class Pl050(AmbaIntDevice): type = 'Pl050' cxx_header = "dev/arm/kmi.hh" -int_delay = '1us' amba_id = 0x00141050 ps2 = Param.PS2Device("PS/2 device") diff --git a/src/dev/arm/kmi.cc b/src/dev/arm/kmi.cc index d80bc14..e6e54a4 100644 --- a/src/dev/arm/kmi.cc +++ b/src/dev/arm/kmi.cc @@ -55,10 +55,9 @@ Pl050::Pl050(const Pl050Params *p) : AmbaIntDevice(p, 0xfff), control(0), status(0x43), clkdiv(0), rawInterrupts(0), - intEvent([this]{ generateInterrupt(); }, name()), ps2(p->ps2) { -ps2->hostRegDataAvailable([this]() { this->updateIntStatus(); }); +ps2->hostRegDataAvailable([this]() { this->updateRxInt(); }); } Tick @@ -84,8 +83,8 @@ case kmiData: data = ps2->hostDataAvailable() ? ps2->hostRead() : 0; +updateRxInt(); DPRINTF(Pl050, "Read Data: %#x\n", (uint32_t)data); -updateIntStatus(); break; case kmiClkDiv: @@ -108,21 +107,7 @@ break; } -switch(pkt->getSize()) { - case 1: -pkt->set(data); -break; - case 2: -pkt->set(data); -break; - case 4: -pkt->set(data); -break; - default: -panic("KMI read size too big?\n"); -break; -} - +pkt->setUintX(data, LittleEndianByteOrder); pkt->makeAtomicResponse(); return pioDelay; } @@ -134,29 +119,33 @@ assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize); Addr daddr = pkt->getAddr() - pioAddr; +const uint32_t data = pkt->getUintX(LittleEndianByteOrder); assert(pkt->getSize() == sizeof(uint8_t)); - switch (daddr) { case kmiCr: DPRINTF(Pl050, "Write Commmand: %#x\n", (uint32_t)pkt->get()); -control = pkt->get(); -updateIntStatus(); +// Use the update interrupts helper to make sure any interrupt +// mask changes are handled correctly. +updateRawInts(0, 0, (uint8_t)data); break; case kmiData: DPRINTF(Pl050, "Write Data: %#x\n", (uint32_t)pkt->get()); -ps2->hostWrite(pkt->get()); -updateIntStatus(); +// Clear the TX interrupt before writing new data. +setTxInt(false); +ps2->hostWrite((uint8_t)data); +// Data is written in 0 time, so raise the TX interrupt again. +setTxInt(true); break; case kmiClkDiv: -clkdiv = pkt->get(); +clkdiv = (uint8_t)data; break; default: -warn("Tried to write PL050 at offset %#x that doesn't exist\n", daddr); +warn("PL050: Unhandled write of %#x to offset %#x\n", data, daddr); break; } @@ -164,18 +153,44 @@ return pioDelay; } +void +Pl050::setTxInt(bool value) +{ +InterruptReg set = 0, clear = 0; + +set.tx = value ? 1 : 0; +clear.tx = !value ? 1 : 0; + +updateRawInts(set, clear, control); +} void -Pl050::updateIntStatus() +Pl050::updateRxInt() { -const bool old_interrupt(getInterrupt()); +InterruptReg set = 0, clear = 0; -rawInterrupts.rx = ps2->hostDataAvailable() ? 1 : 0; +set.rx = ps2->hostDataAvailable() ? 1 : 0; +clear.rx = !ps2->hostDataAvailable() ? 1 : 0; -if ((!old_interrupt && getInterrupt()) && !intEvent.scheduled()) { -schedule(intEvent, curTick() + intDelay); -} else if (old_interrupt && !(getInterrupt())) { -gic->clearInt(intNum); +updateRawInts(set, clear, control); +} + +void +Pl050::updateRawInts(InterruptReg set, InterruptReg clear, ControlReg control) +{ +const bool old_pending(getInterrupt()); +this->control = control; +rawInterrupts = (rawInterrupts & ~clear) | set; +const bool new_pending(getInterrupt()); + +if (!old_pending && new_pending) { +DPRINTF(Pl050, "Generate interrupt: rawInt=%#x ctrl=%#x int=%#x\n", +rawInterrupts, control, getInterrupt()); +gic->sendInt(intNum); +} else if (old_pending && !new_pending) { +DPRINTF(Pl050, "Clear interrupt: rawInt=%#x ctrl=%#x int=%#x\n", +rawInterrupts, control, getInterrupt()); +
[gem5-dev] Change in gem5/gem5[master]: ps2: Add proper touchscreen command handling
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9768 to review the following change. Change subject: ps2: Add proper touchscreen command handling .. ps2: Add proper touchscreen command handling The touchscreen model used ad-hoc mechanisms to enable/disable the device. Use standard PS/2 commands to activate/deactivate the device. Add proper TouchKit command handling. Change-Id: I0c5a2e2b47639f36ab3ee07e3e559f11afa54b9d Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/ps2/touchkit.cc M src/dev/ps2/touchkit.hh 2 files changed, 81 insertions(+), 23 deletions(-) diff --git a/src/dev/ps2/touchkit.cc b/src/dev/ps2/touchkit.cc index 1617561..cee4016 100644 --- a/src/dev/ps2/touchkit.cc +++ b/src/dev/ps2/touchkit.cc @@ -54,7 +54,7 @@ PS2TouchKit::PS2TouchKit(const PS2TouchKitParams *p) : PS2Device(p), vnc(p->vnc), - driverInitialized(false) + enabled(false), touchKitEnabled(false) { if (vnc) vnc->setMouse(this); @@ -65,7 +65,8 @@ { PS2Device::serialize(cp); -SERIALIZE_SCALAR(driverInitialized); +SERIALIZE_SCALAR(enabled); +SERIALIZE_SCALAR(touchKitEnabled); } void @@ -73,7 +74,8 @@ { PS2Device::unserialize(cp); -UNSERIALIZE_SCALAR(driverInitialized); +UNSERIALIZE_SCALAR(enabled); +UNSERIALIZE_SCALAR(touchKitEnabled); } bool @@ -81,6 +83,9 @@ { switch (data[0]) { case Ps2::Ps2Reset: +DPRINTF(PS2, "Resetting device.\n"); +enabled = false; +touchKitEnabled = false; sendAck(); send(Ps2::SelfTestPass); return true; @@ -107,9 +112,24 @@ case Ps2::SetScaling1_1: case Ps2::SetScaling1_2: +sendAck(); +return true; + case Ps2::Disable: +DPRINTF(PS2, "Disabling device.\n"); +enabled = false; +sendAck(); +return true; + case Ps2::Enable: +DPRINTF(PS2, "Enabling device.\n"); +enabled = true; +sendAck(); +return true; + case Ps2::SetDefaults: +DPRINTF(PS2, "Setting defaults and disabling device.\n"); +enabled = false; sendAck(); return true; @@ -121,25 +141,53 @@ return true; case Ps2::TouchKitId: -sendAck(); -if (data.size() == 1) { -send(Ps2::TouchKitId); -send(1); -send('A'); - -return false; -} else if (data.size() == 3) { -driverInitialized = true; -return true; -} else { -return false; -} +return recvTouchKit(data); default: -panic("Unknown byte received: %d\n", data[0]); +panic("Unknown byte received: %#x\n", data[0]); } } +bool +PS2TouchKit::recvTouchKit(const std::vector &data) +{ +// Ack all incoming bytes +sendAck(); + +// Packet format is: 0x0A SIZE CMD DATA +assert(data[0] == Ps2::TouchKitId); +if (data.size() < 3 || data.size() - 2 < data[1]) +return false; + +const uint8_t len = data[1]; +const uint8_t cmd = data[2]; + +// We have received at least one TouchKit diagnostic +// command. Enabled TouchKit reports. +touchKitEnabled = true; + + +switch (cmd) { + case TouchKitActive: +warn_if(len != 1, "Unexpected activate packet length: %u\n", len); +sendTouchKit('A'); +return true; + + default: +panic("Unimplemented touchscreen command: %#x\n", cmd); +} +} + +void +PS2TouchKit::sendTouchKit(const uint8_t *data, size_t size) +{ +send(Ps2::TouchKitId); +send(size); +for (int i = 0; i < size; ++i) +send(data[i]); +} + + void PS2TouchKit::mouseAt(uint16_t x, uint16_t y, uint8_t buttons) { @@ -147,7 +195,7 @@ // it anything. Similarly we can get vnc mouse events orders of maginture // faster than m5 can process them. Only queue up two sets mouse movements // and don't add more until those are processed. -if (!driverInitialized || sendPending() > 10) +if (!enabled || !touchKitEnabled || sendPending() > 10) return; // Convert screen coordinates to touchpad coordinates diff --git a/src/dev/ps2/touchkit.hh b/src/dev/ps2/touchkit.hh index f5ef398..1a344ec 100644 --- a/src/dev/ps2/touchkit.hh +++ b/src/dev/ps2/touchkit.hh @@ -50,6 +50,12 @@ protected: static const uint8_t ID[]; +enum TKCommands { +TouchKitActive = 'A', +TouchKitFWRev = 'D', +TouchKitCtrlType = 'E', +}; + public: PS2TouchKit(const PS2TouchKitParams *p); @@ -63,14 +69,18 @@ void mouseAt(uint16_t x, uint16_t y, uint8_t buttons) override; protected: +bool recvTouchKit(const std::vector &data); +void sendTouchKit(const uint8_t *data, size_t size); +void sendTouchKit(uint8_t data) { sendTouchKit(&
[gem5-dev] Change in gem5/gem5[master]: ps2: Unify device data buffering
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9765 to review the following change. Change subject: ps2: Unify device data buffering .. ps2: Unify device data buffering All PS/2 device currently implement various ad-hoc mechanisms to handle multi-byte commands. This is error-prone and makes it hard to implement new devices. Create a buffering mechanism in the base class to avoid this. Change-Id: If5638b0ab68decea8de7631ecead0a9ebad1547b Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/ps2/device.cc M src/dev/ps2/device.hh M src/dev/ps2/keyboard.cc M src/dev/ps2/keyboard.hh M src/dev/ps2/mouse.cc M src/dev/ps2/mouse.hh M src/dev/ps2/touchkit.cc M src/dev/ps2/touchkit.hh 8 files changed, 111 insertions(+), 126 deletions(-) diff --git a/src/dev/ps2/device.cc b/src/dev/ps2/device.cc index 7019423..073e015 100644 --- a/src/dev/ps2/device.cc +++ b/src/dev/ps2/device.cc @@ -44,12 +44,14 @@ #include "dev/ps2/device.hh" #include "base/logging.hh" +#include "debug/PS2.hh" #include "dev/ps2.hh" #include "params/PS2Device.hh" PS2Device::PS2Device(const PS2DeviceParams *p) : SimObject(p) { +inBuffer.reserve(16); } void @@ -58,6 +60,8 @@ std::vector buffer(outBuffer.size()); std::copy(outBuffer.begin(), outBuffer.end(), buffer.begin()); arrayParamOut(cp, "outBuffer", buffer); + +SERIALIZE_CONTAINER(inBuffer); } void @@ -67,6 +71,8 @@ arrayParamIn(cp, "outBuffer", buffer); for (auto c : buffer) outBuffer.push_back(c); + +UNSERIALIZE_CONTAINER(inBuffer); } void @@ -89,7 +95,10 @@ void PS2Device::hostWrite(uint8_t c) { -recv(c); +DPRINTF(PS2, "PS2: Host -> device: %#x\n", c); +inBuffer.push_back(c); +if (recv(inBuffer)) +inBuffer.clear(); } void @@ -97,6 +106,7 @@ { assert(data || size == 0); while (size) { +DPRINTF(PS2, "PS2: Device -> host: %#x\n", *data); outBuffer.push_back(*(data++)); size--; } diff --git a/src/dev/ps2/device.hh b/src/dev/ps2/device.hh index 342a8c2..b485c5e 100644 --- a/src/dev/ps2/device.hh +++ b/src/dev/ps2/device.hh @@ -45,6 +45,7 @@ #define __DEV_PS2_DEVICE_HH__ #include +#include #include "sim/sim_object.hh" @@ -92,8 +93,18 @@ protected: /* Device interface */ /** * Data received from host. + * + * This method is called whenever the host sends a byte to the + * device. The device model may request buffering in the base + * class by returning false. Once all data in the buffer has been + * processed, the method should return true which clears the + * buffer. + * + * @param data Pending input data (at least one byte) + * @return false if more data is needed to process the current + * command, true otherwise. */ -virtual void recv(uint8_t data) = 0; +virtual bool recv(const std::vector &data) = 0; /** * Send data from a PS/2 device to a host @@ -125,6 +136,9 @@ /** Device -> host FIFO */ std::deque outBuffer; +/** Host -> device buffer */ +std::vector inBuffer; + std::function dataAvailableCallback; }; diff --git a/src/dev/ps2/keyboard.cc b/src/dev/ps2/keyboard.cc index 46b89fa..1f8b544 100644 --- a/src/dev/ps2/keyboard.cc +++ b/src/dev/ps2/keyboard.cc @@ -52,7 +52,6 @@ PS2Keyboard::PS2Keyboard(const PS2KeyboardParams *p) : PS2Device(p), - lastCommand(NoCommand), shiftDown(false), enabled(false) { @@ -64,7 +63,6 @@ PS2Keyboard::serialize(CheckpointOut &cp) const { PS2Device::serialize(cp); -SERIALIZE_SCALAR(lastCommand); SERIALIZE_SCALAR(shiftDown); SERIALIZE_SCALAR(enabled); } @@ -73,40 +71,28 @@ PS2Keyboard::unserialize(CheckpointIn &cp) { PS2Device::unserialize(cp); -UNSERIALIZE_SCALAR(lastCommand); UNSERIALIZE_SCALAR(shiftDown); UNSERIALIZE_SCALAR(enabled); } -void -PS2Keyboard::recv(uint8_t data) +bool +PS2Keyboard::recv(const std::vector &data) { -if (lastCommand != NoCommand) { -switch (lastCommand) { - case LEDWrite: +switch (data[0]) { + case LEDWrite: +if (data.size() == 1) { +DPRINTF(PS2, "Got LED write command.\n"); +sendAck(); +return false; +} else { DPRINTF(PS2, "Setting LEDs: " "caps lock %s, num lock %s, scroll lock %s\n", -bits(data, 2) ? "on" : "off", -bits(data, 1) ? "on" : "off", -bits(data, 0) ? "on" : "off"); +bits(data[1], 2) ? "on" : "off", +bits(data[1], 1) ? "on" : "off", +bits(data[1], 0) ? "on" : "off"); sendAck(); -lastCommand = NoCommand; -break; - case TypematicInfo: -DPRINTF(PS2, "S
[gem5-dev] Change in gem5/gem5[master]: ps2: Add VNC support to the keyboard model
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9763 to review the following change. Change subject: ps2: Add VNC support to the keyboard model .. ps2: Add VNC support to the keyboard model Add support for keyboard input from the VNC server in the PS/2 keyboard model. The introduced code is based on the functionality in the Arm PL050 KMI model. Change-Id: If04a9713e5a15e2149d1a7471b999e3060d8ee7d Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/ps2/PS2.py M src/dev/ps2/keyboard.cc M src/dev/ps2/keyboard.hh 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/dev/ps2/PS2.py b/src/dev/ps2/PS2.py index 5db3b6e..da7eae9 100644 --- a/src/dev/ps2/PS2.py +++ b/src/dev/ps2/PS2.py @@ -48,6 +48,8 @@ type = 'PS2Keyboard' cxx_header = "dev/ps2/keyboard.hh" +vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer") + class PS2Mouse(PS2Device): type = 'PS2Mouse' cxx_header = "dev/ps2/mouse.hh" diff --git a/src/dev/ps2/keyboard.cc b/src/dev/ps2/keyboard.cc index a942d34..46b89fa 100644 --- a/src/dev/ps2/keyboard.cc +++ b/src/dev/ps2/keyboard.cc @@ -45,14 +45,19 @@ #include "base/logging.hh" #include "debug/PS2.hh" +#include "dev/ps2.hh" #include "params/PS2Keyboard.hh" const uint8_t PS2Keyboard::ID[] = {0xab, 0x83}; PS2Keyboard::PS2Keyboard(const PS2KeyboardParams *p) : PS2Device(p), - lastCommand(NoCommand) + lastCommand(NoCommand), + shiftDown(false), + enabled(false) { +if (p->vnc) +p->vnc->setKeyboard(this); } void @@ -60,6 +65,8 @@ { PS2Device::serialize(cp); SERIALIZE_SCALAR(lastCommand); +SERIALIZE_SCALAR(shiftDown); +SERIALIZE_SCALAR(enabled); } void @@ -67,6 +74,8 @@ { PS2Device::unserialize(cp); UNSERIALIZE_SCALAR(lastCommand); +UNSERIALIZE_SCALAR(shiftDown); +UNSERIALIZE_SCALAR(enabled); } void @@ -114,14 +123,17 @@ break; case Enable: DPRINTF(PS2, "Enabling the keyboard.\n"); +enabled = true; sendAck(); break; case Disable: DPRINTF(PS2, "Disabling the keyboard.\n"); +enabled = false; sendAck(); break; case DefaultsAndDisable: DPRINTF(PS2, "Disabling and resetting the keyboard.\n"); +enabled = false; sendAck(); break; case AllKeysToTypematic: @@ -148,6 +160,27 @@ } } +void +PS2Keyboard::keyPress(uint32_t key, bool down) +{ +std::list keys; + +// convert the X11 keysym into ps2 codes and update the shift +// state (shiftDown) +Ps2::keySymToPs2(key, down, shiftDown, keys); + +// Drop key presses if the keyboard hasn't been enabled by the +// host. We do that after translating the key code to ensure that +// we keep track of the shift state. +if (!enabled) +return; + +// Insert into our queue of characters +for (uint8_t c : keys) +send(c); +} + + PS2Keyboard * PS2KeyboardParams::create() { diff --git a/src/dev/ps2/keyboard.hh b/src/dev/ps2/keyboard.hh index 8943e7f..f5d8304 100644 --- a/src/dev/ps2/keyboard.hh +++ b/src/dev/ps2/keyboard.hh @@ -44,11 +44,12 @@ #ifndef __DEV_PS2_KEYBOARD_HH__ #define __DEV_PS2_KEYBOARD_HH__ +#include "base/vnc/vncinput.hh" #include "dev/ps2/device.hh" struct PS2KeyboardParams; -class PS2Keyboard : public PS2Device +class PS2Keyboard : public PS2Device, VncKeyboard { protected: static const uint8_t ID[]; @@ -78,6 +79,12 @@ uint16_t lastCommand; +/** is the shift key currently down */ +bool shiftDown; + +/** Is the device enabled? */ +bool enabled; + public: PS2Keyboard(const PS2KeyboardParams *p); @@ -86,6 +93,9 @@ protected: // PS2Device void recv(uint8_t data) override; + + public: // VncKeyboard +void keyPress(uint32_t key, bool down) override; }; #endif // __DEV_PS2_KEYBOARD_hH__ -- To view, visit https://gem5-review.googlesource.com/9763 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: If04a9713e5a15e2149d1a7471b999e3060d8ee7d Gerrit-Change-Number: 9763 Gerrit-PatchSet: 1 Gerrit-Owner: Andreas Sandberg Gerrit-Reviewer: Giacomo Travaglini Gerrit-MessageType: newchange ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: ps2: Add a simple touchscreen model
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9764 to review the following change. Change subject: ps2: Add a simple touchscreen model .. ps2: Add a simple touchscreen model Add a touchscreen model that is compatible with Linux's TouchKit driver. This model is based on the model in the Arm PL050 KMI model. Change-Id: Id4d88a21a26bb42c455e4d778cd89875f650ac57 Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/ps2/PS2.py M src/dev/ps2/SConscript A src/dev/ps2/touchkit.cc A src/dev/ps2/touchkit.hh 4 files changed, 266 insertions(+), 0 deletions(-) diff --git a/src/dev/ps2/PS2.py b/src/dev/ps2/PS2.py index da7eae9..951ace0 100644 --- a/src/dev/ps2/PS2.py +++ b/src/dev/ps2/PS2.py @@ -53,3 +53,9 @@ class PS2Mouse(PS2Device): type = 'PS2Mouse' cxx_header = "dev/ps2/mouse.hh" + +class PS2TouchKit(PS2Device): +type = 'PS2TouchKit' +cxx_header = "dev/ps2/touchkit.hh" + +vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer") diff --git a/src/dev/ps2/SConscript b/src/dev/ps2/SConscript index acce7be..a73e47a 100644 --- a/src/dev/ps2/SConscript +++ b/src/dev/ps2/SConscript @@ -46,5 +46,6 @@ Source('device.cc') Source('keyboard.cc') Source('mouse.cc') +Source('touchkit.cc') DebugFlag('PS2') diff --git a/src/dev/ps2/touchkit.cc b/src/dev/ps2/touchkit.cc new file mode 100644 index 000..e5ee3ef --- /dev/null +++ b/src/dev/ps2/touchkit.cc @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2010, 2017-2018 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * + * Copyright (c) 2005 The Regents of The University of Michigan + * All rights reserved. + * + * 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; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * 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. + * + * Authors: Ali Saidi + * William Wang + * Andreas Sandberg + */ + +#include "dev/ps2/touchkit.hh" + +#include "base/logging.hh" +#include "debug/PS2.hh" +#include "dev/ps2.hh" +#include "params/PS2TouchKit.hh" + +const uint8_t PS2TouchKit::ID[] = {0x00}; + +PS2TouchKit::PS2TouchKit(const PS2TouchKitParams *p) +: PS2Device(p), + vnc(p->vnc), + ackNext(false), + driverInitialized(false) +{ +if (vnc) +vnc->setMouse(this); +} + +void +PS2TouchKit::serialize(CheckpointOut &cp) const +{ +PS2Device::serialize(cp); + +SERIALIZE_SCALAR(ackNext); +SERIALIZE_SCALAR(driverInitialized); +} + +void +PS2TouchKit::unserialize(CheckpointIn &cp) +{ +PS2Device::unserialize(cp); + +UNSERIALIZE_SCALAR(ackNext); +UNSERIALIZE_SCALAR(driverInitialized); +} + +void +PS2TouchKit::recv(uint8_t data) +{ +if (ackNext) { +ackNext--; +sendAck(); +return; +} + +switch (data) { + case Ps2::Ps2Reset: +sendAck(); +send(Ps2::SelfTestPass); +break; + + case Ps2::SetResolution: + case Ps2::SetRate: + case Ps2::SetStatusLed: +
[gem5-dev] Change in gem5/gem5[master]: dev, arm: Use the PS/2 framework in the Pl050 model
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9767 to review the following change. Change subject: dev, arm: Use the PS/2 framework in the Pl050 model .. dev, arm: Use the PS/2 framework in the Pl050 model The Pl050 KMI model currently has its own keyboard and mouse models. Use the generic PS/2 interface instead. Change-Id: I6523d26f8e38bcc8ba399d4d1a131723645d36c7 Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/arm/RealView.py M src/dev/arm/kmi.cc M src/dev/arm/kmi.hh 3 files changed, 51 insertions(+), 205 deletions(-) diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index a59e171..7661db1 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -62,6 +62,7 @@ from SubSystem import SubSystem from Graphics import ImageFormat from ClockedObject import ClockedObject +from PS2 import * # Platforms with KVM support should generally use in-kernel GIC # emulation. Use a GIC model that automatically switches between @@ -465,11 +466,11 @@ class Pl050(AmbaIntDevice): type = 'Pl050' cxx_header = "dev/arm/kmi.hh" -vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer display") -is_mouse = Param.Bool(False, "Is this interface a mouse, if not a keyboard") int_delay = '1us' amba_id = 0x00141050 +ps2 = Param.PS2Device("PS/2 device") + def generateDeviceTree(self, state): node = self.generateBasicPioDeviceNode(state, 'kmi', self.pio_addr, 0x1000, [int(self.int_num)]) @@ -624,8 +625,8 @@ local_cpu_timer = CpuLocalTimer(int_num_timer=29, int_num_watchdog=30, pio_addr=0x1f000600) clcd = Pl111(pio_addr=0x1002, int_num=55) -kmi0 = Pl050(pio_addr=0x10006000, int_num=52) -kmi1 = Pl050(pio_addr=0x10007000, int_num=53, is_mouse=True) +kmi0 = Pl050(pio_addr=0x10006000, int_num=52, ps2=PS2Keyboard()) +kmi1 = Pl050(pio_addr=0x10007000, int_num=53, ps2=PS2TouchKit()) a9scu = A9SCU(pio_addr=0x1f00) cf_ctrl = IdeController(disks=[], pci_func=0, pci_dev=7, pci_bus=2, io_shift = 1, ctrl_offset = 2, Command = 0x1, @@ -753,8 +754,8 @@ timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000) timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000) clcd = Pl111(pio_addr=0x1002, int_num=23) -kmi0 = Pl050(pio_addr=0x10006000, int_num=20) -kmi1 = Pl050(pio_addr=0x10007000, int_num=21, is_mouse=True) +kmi0 = Pl050(pio_addr=0x10006000, int_num=20, ps2=PS2Keyboard()) +kmi1 = Pl050(pio_addr=0x10007000, int_num=21, ps2=PS2TouchKit()) l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff, warn_access="1") flash_fake= IsaFake(pio_addr=0x4000, pio_size=0x2000-1, @@ -904,8 +905,8 @@ timer0 = Sp804(int_num0=34, int_num1=34, pio_addr=0x1C11, clock0='1MHz', clock1='1MHz') timer1 = Sp804(int_num0=35, int_num1=35, pio_addr=0x1C12, clock0='1MHz', clock1='1MHz') clcd = Pl111(pio_addr=0x1c1f, int_num=46) -kmi0 = Pl050(pio_addr=0x1c06, int_num=44) -kmi1 = Pl050(pio_addr=0x1c07, int_num=45, is_mouse=True) +kmi0 = Pl050(pio_addr=0x1c06, int_num=44, ps2=PS2Keyboard()) +kmi1 = Pl050(pio_addr=0x1c07, int_num=45, ps2=PS2TouchKit()) cf_ctrl = IdeController(disks=[], pci_func=0, pci_dev=0, pci_bus=2, io_shift = 2, ctrl_offset = 2, Command = 0x1, BAR0 = 0x1C1A, BAR0Size = '256B', @@ -1136,8 +1137,8 @@ uart0 = Pl011(pio_addr=0x1c09, int_num=37) -kmi0 = Pl050(pio_addr=0x1c06, int_num=44) -kmi1 = Pl050(pio_addr=0x1c07, int_num=45, is_mouse=True) +kmi0 = Pl050(pio_addr=0x1c06, int_num=44, ps2=PS2Keyboard()) +kmi1 = Pl050(pio_addr=0x1c07, int_num=45, ps2=PS2TouchKit()) rtc = PL031(pio_addr=0x1c17, int_num=36) diff --git a/src/dev/arm/kmi.cc b/src/dev/arm/kmi.cc index 8b373b8..d80bc14 100644 --- a/src/dev/arm/kmi.cc +++ b/src/dev/arm/kmi.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 ARM Limited + * Copyright (c) 2010, 2017-2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -48,21 +48,17 @@ #include "debug/Pl050.hh" #include "dev/arm/amba_device.hh" #include "dev/ps2.hh" +#include "dev/ps2/device.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" -Pl050::Pl050(const Params *p) +Pl050::Pl050(const Pl050Params *p) : AmbaIntDevice(p, 0xfff), control(0), status(0x43), clkdiv(0), - rawInterrupts(0), ackNext(false), shiftDown(false), - vnc(p->vnc), driverInitialized(false), - intEvent([this]{ generateInterrupt(); }, name()) + rawInterrupts(0), + in
[gem5-dev] Change in gem5/gem5[master]: mem: Add a helper function to get a word of variable length
Hello Nikos Nikoleris, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9761 to review the following change. Change subject: mem: Add a helper function to get a word of variable length .. mem: Add a helper function to get a word of variable length There are many devices that need to handle reads/writes of different word sizes. A common pattern is a switch statement that check for the size of a packet and then calls the corresponding Packet::(get|set) methods. Simplify this by implementing Packet::(get|set)UintX helper functions. The getter reads a word of the size specified in the packet and the specified endianness. The word is then zero-extended to 64 bits. Conversely, the setter truncates the word down to the size required in the packet and then byte-swaps it to the desired endianness. Change-Id: I2f0c27fe3903abf3859bea13b07c7f5f0fb0809f Signed-off-by: Andreas Sandberg Reviewed-by: Nikos Nikoleris --- M src/mem/packet.cc M src/mem/packet.hh 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/mem/packet.cc b/src/mem/packet.cc index ffda3d5..7a81cdb 100644 --- a/src/mem/packet.cc +++ b/src/mem/packet.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017 ARM Limited + * Copyright (c) 2011-2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -56,6 +56,7 @@ #include "base/cprintf.hh" #include "base/logging.hh" #include "base/trace.hh" +#include "mem/packet_access.hh" using namespace std; @@ -364,6 +365,45 @@ return sender_state; } +uint64_t +Packet::getUintX(ByteOrder endian) const +{ +switch(getSize()) { + case 1: +return (uint64_t)get(endian); + case 2: +return (uint64_t)get(endian); + case 4: +return (uint64_t)get(endian); + case 8: +return (uint64_t)get(endian); + default: +panic("%i isn't a supported word size.\n", getSize()); +} +} + +void +Packet::setUintX(uint64_t w, ByteOrder endian) +{ +switch(getSize()) { + case 1: +set((uint8_t)w, endian); +break; + case 2: +set((uint16_t)w, endian); +break; + case 4: +set((uint32_t)w, endian); +break; + case 8: +set((uint64_t)w, endian); +break; + default: +panic("%i isn't a supported word size.\n", getSize()); +} + +} + void Packet::print(ostream &o, const int verbosity, const string &prefix) const { diff --git a/src/mem/packet.hh b/src/mem/packet.hh index b5b882c..a4eeabe 100644 --- a/src/mem/packet.hh +++ b/src/mem/packet.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 ARM Limited + * Copyright (c) 2012-2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -1068,6 +1068,20 @@ template void set(T v); + +/** + * Get the data in the packet byte swapped from the specified + * endianness and zero-extended to 64 bits. + */ +uint64_t getUintX(ByteOrder endian) const; + +/** + * Set the value in the word w after truncating it to the length + * of the packet and then byteswapping it to the desired + * endianness. + */ +void setUintX(uint64_t w, ByteOrder endian); + /** * Copy data into the packet from the provided pointer. */ -- To view, visit https://gem5-review.googlesource.com/9761 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: I2f0c27fe3903abf3859bea13b07c7f5f0fb0809f Gerrit-Change-Number: 9761 Gerrit-PatchSet: 1 Gerrit-Owner: Andreas Sandberg Gerrit-Reviewer: Nikos Nikoleris Gerrit-MessageType: newchange ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: ps2: Factor out PS/2 devices into their own subsystem
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9762 to review the following change. Change subject: ps2: Factor out PS/2 devices into their own subsystem .. ps2: Factor out PS/2 devices into their own subsystem PS/2 devices are currently emulated both in the i8042 model and the Arm KMI model. This is undesirable since it leads to code duplication. This change introduces a common PS/2 device interface and factor out the x86 keyboard and mouse model. A subsequent commit will implement support for this interface in the Arm KMI model. Change-Id: I440e83517fd9dce362fdc1676db477cc6eee5211 Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/ps2.hh A src/dev/ps2/PS2.py A src/dev/ps2/SConscript A src/dev/ps2/device.cc A src/dev/ps2/device.hh A src/dev/ps2/keyboard.cc A src/dev/ps2/keyboard.hh A src/dev/ps2/mouse.cc A src/dev/ps2/mouse.hh M src/dev/x86/I8042.py M src/dev/x86/i8042.cc M src/dev/x86/i8042.hh 12 files changed, 908 insertions(+), 382 deletions(-) diff --git a/src/dev/ps2.hh b/src/dev/ps2.hh index 9e99867..7b57835 100644 --- a/src/dev/ps2.hh +++ b/src/dev/ps2.hh @@ -61,6 +61,7 @@ ReadId = 0xf2, TpReadId= 0xe1, Ack = 0xfa, +Resend = 0xfe, SetRate = 0xf3, Enable = 0xf4, Disable = 0xf5, diff --git a/src/dev/ps2/PS2.py b/src/dev/ps2/PS2.py new file mode 100644 index 000..5db3b6e --- /dev/null +++ b/src/dev/ps2/PS2.py @@ -0,0 +1,53 @@ +# Copyright (c) 2017-2018 ARM Limited +# All rights reserved +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# +# 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; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# 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. +# +# Authors: Andreas Sandberg + +from m5.SimObject import SimObject +from m5.params import * +from m5.proxy import * + +class PS2Device(SimObject): +type = 'PS2Device' +cxx_header = "dev/ps2/device.hh" +abstract = True + +class PS2Keyboard(PS2Device): +type = 'PS2Keyboard' +cxx_header = "dev/ps2/keyboard.hh" + +class PS2Mouse(PS2Device): +type = 'PS2Mouse' +cxx_header = "dev/ps2/mouse.hh" diff --git a/src/dev/ps2/SConscript b/src/dev/ps2/SConscript new file mode 100644 index 000..acce7be --- /dev/null +++ b/src/dev/ps2/SConscript @@ -0,0 +1,50 @@ +# -*- mode:python -*- + +# Copyright (c) 2017-2018 ARM Limited +# All rights reserved. +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# +# Redistribution and
[gem5-dev] Change in gem5/gem5[master]: ps2: Unify constant names
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9770 to review the following change. Change subject: ps2: Unify constant names .. ps2: Unify constant names Move ps2.hh to dev/ps2/types.hh and update the device models to consistently use well-known constants from this header. Change-Id: Iadfdc774495957beb82f3d341107b1e9232ffd4c Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/SConscript M src/dev/arm/kmi.cc M src/dev/ps2/SConscript M src/dev/ps2/device.cc M src/dev/ps2/keyboard.cc M src/dev/ps2/keyboard.hh M src/dev/ps2/mouse.cc M src/dev/ps2/mouse.hh M src/dev/ps2/touchkit.cc M src/dev/ps2/touchkit.hh R src/dev/ps2/types.cc R src/dev/ps2/types.hh 12 files changed, 167 insertions(+), 174 deletions(-) diff --git a/src/dev/SConscript b/src/dev/SConscript index 6939e03..c9526c2 100644 --- a/src/dev/SConscript +++ b/src/dev/SConscript @@ -50,7 +50,6 @@ Source('mc146818.cc') Source('pixelpump.cc') Source('platform.cc') -Source('ps2.cc') DebugFlag('Intel8254Timer') DebugFlag('MC146818') diff --git a/src/dev/arm/kmi.cc b/src/dev/arm/kmi.cc index e6e54a4..6603ef9 100644 --- a/src/dev/arm/kmi.cc +++ b/src/dev/arm/kmi.cc @@ -47,7 +47,6 @@ #include "base/vnc/vncinput.hh" #include "debug/Pl050.hh" #include "dev/arm/amba_device.hh" -#include "dev/ps2.hh" #include "dev/ps2/device.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" diff --git a/src/dev/ps2/SConscript b/src/dev/ps2/SConscript index a73e47a..59bc242 100644 --- a/src/dev/ps2/SConscript +++ b/src/dev/ps2/SConscript @@ -47,5 +47,6 @@ Source('keyboard.cc') Source('mouse.cc') Source('touchkit.cc') +Source('types.cc') DebugFlag('PS2') diff --git a/src/dev/ps2/device.cc b/src/dev/ps2/device.cc index 073e015..8275cfc 100644 --- a/src/dev/ps2/device.cc +++ b/src/dev/ps2/device.cc @@ -45,7 +45,7 @@ #include "base/logging.hh" #include "debug/PS2.hh" -#include "dev/ps2.hh" +#include "dev/ps2/types.hh" #include "params/PS2Device.hh" PS2Device::PS2Device(const PS2DeviceParams *p) diff --git a/src/dev/ps2/keyboard.cc b/src/dev/ps2/keyboard.cc index 78e287f..5e7dbcc 100644 --- a/src/dev/ps2/keyboard.cc +++ b/src/dev/ps2/keyboard.cc @@ -45,7 +45,7 @@ #include "base/logging.hh" #include "debug/PS2.hh" -#include "dev/ps2.hh" +#include "dev/ps2/types.hh" #include "params/PS2Keyboard.hh" const uint8_t PS2Keyboard::ID[] = {0xab, 0x83}; @@ -79,7 +79,36 @@ PS2Keyboard::recv(const std::vector &data) { switch (data[0]) { - case LEDWrite: + case Ps2::ReadID: +DPRINTF(PS2, "Got keyboard read ID command.\n"); +sendAck(); +send((uint8_t *)&ID, sizeof(ID)); +return true; + case Ps2::Enable: +DPRINTF(PS2, "Enabling the keyboard.\n"); +enabled = true; +sendAck(); +return true; + case Ps2::Disable: +DPRINTF(PS2, "Disabling the keyboard.\n"); +enabled = false; +sendAck(); +return true; + case Ps2::DefaultsAndDisable: +DPRINTF(PS2, "Disabling and resetting the keyboard.\n"); +enabled = false; +sendAck(); +return true; + case Ps2::Reset: +DPRINTF(PS2, "Resetting keyboard.\n"); +enabled = false; +sendAck(); +send(Ps2::SelfTestPass); +return true; + case Ps2::Resend: +panic("Keyboard resend unimplemented.\n"); + + case Ps2::Keyboard::LEDWrite: if (data.size() == 1) { DPRINTF(PS2, "Got LED write command.\n"); sendAck(); @@ -93,16 +122,11 @@ sendAck(); return true; } - case DiagnosticEcho: + case Ps2::Keyboard::DiagnosticEcho: panic("Keyboard diagnostic echo unimplemented.\n"); - case AlternateScanCodes: + case Ps2::Keyboard::AlternateScanCodes: panic("Accessing alternate scan codes unimplemented.\n"); - case ReadID: -DPRINTF(PS2, "Got keyboard read ID command.\n"); -sendAck(); -send((uint8_t *)&ID, sizeof(ID)); -return true; - case TypematicInfo: + case Ps2::Keyboard::TypematicInfo: if (data.size() == 1) { DPRINTF(PS2, "Setting typematic info.\n"); sendAck(); @@ -112,44 +136,21 @@ sendAck(); return true; } - case Enable: -DPRINTF(PS2, "Enabling the keyboard.\n"); -enabled = true; -sendAck(); -return true; - case Disable: -DPRINTF(PS2, "Disabling the keyboard.\n"); -enabled = false; -sendAck(); -return true; - case DefaultsAndDisable: -DPRINTF(PS2, "Disabling and resetting the keyboard.\n"); -enabled = false; -sendAck(); -return true; - case Reset: -DPRINTF(PS2, "Resetting keyboard.\n"); -sendAck(); -enabled =
[gem5-dev] Change in gem5/gem5[master]: ps2: Implement the keyboard reset command
Hello Giacomo Travaglini, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/9766 to review the following change. Change subject: ps2: Implement the keyboard reset command .. ps2: Implement the keyboard reset command Linux tries to reset the PS/2 keyboard at boot. Change-Id: I727fbf6138b654885d82d85be9d964ee3d3365ef Signed-off-by: Andreas Sandberg Reviewed-by: Giacomo Travaglini --- M src/dev/ps2/keyboard.cc 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dev/ps2/keyboard.cc b/src/dev/ps2/keyboard.cc index 1f8b544..78e287f 100644 --- a/src/dev/ps2/keyboard.cc +++ b/src/dev/ps2/keyboard.cc @@ -127,6 +127,12 @@ enabled = false; sendAck(); return true; + case Reset: +DPRINTF(PS2, "Resetting keyboard.\n"); +sendAck(); +enabled = false; +send(Ps2::SelfTestPass); +return true; case AllKeysToTypematic: panic("Setting all keys to typemantic unimplemented.\n"); case AllKeysToMakeRelease: @@ -144,8 +150,6 @@ panic("Setting key to make only unimplemented.\n"); case Resend: panic("Keyboard resend unimplemented.\n"); - case Reset: -panic("Keyboard reset unimplemented.\n"); default: panic("Unknown keyboard command %#02x.\n", data[0]); } -- To view, visit https://gem5-review.googlesource.com/9766 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: I727fbf6138b654885d82d85be9d964ee3d3365ef Gerrit-Change-Number: 9766 Gerrit-PatchSet: 1 Gerrit-Owner: Andreas Sandberg Gerrit-Reviewer: Giacomo Travaglini Gerrit-MessageType: newchange ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: mem-cache: Create Sector Cache
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/9741 Change subject: mem-cache: Create Sector Cache .. mem-cache: Create Sector Cache Implementation of Sector Caches, i.e., a cache with multiple data entries per tag entry. Change-Id: I8e1e9448fa44ba308ccb16cd5bcc5fd36c988feb --- M src/mem/cache/Cache.py M src/mem/cache/SConscript M src/mem/cache/blk.hh M src/mem/cache/cache.cc A src/mem/cache/sector_blk.cc A src/mem/cache/sector_blk.hh M src/mem/cache/tags/SConscript M src/mem/cache/tags/Tags.py M src/mem/cache/tags/base.cc M src/mem/cache/tags/base.hh M src/mem/cache/tags/base_set_assoc.cc M src/mem/cache/tags/base_set_assoc.hh M src/mem/cache/tags/cacheset.hh M src/mem/cache/tags/fa_lru.cc M src/mem/cache/tags/fa_lru.hh A src/mem/cache/tags/sector_tags.cc A src/mem/cache/tags/sector_tags.hh 17 files changed, 870 insertions(+), 51 deletions(-) diff --git a/src/mem/cache/Cache.py b/src/mem/cache/Cache.py index faee092..657be53 100644 --- a/src/mem/cache/Cache.py +++ b/src/mem/cache/Cache.py @@ -75,7 +75,7 @@ prefetch_on_access = Param.Bool(False, "Notify the hardware prefetcher on every access (not just misses)") -tags = Param.BaseTags(BaseSetAssoc(), "Tag store") +tags = Param.BaseTags(SectorTags(), "Tag store") replacement_policy = Param.BaseReplacementPolicy(LRURP(), "Replacement policy") diff --git a/src/mem/cache/SConscript b/src/mem/cache/SConscript index 1c9b002..5547024 100644 --- a/src/mem/cache/SConscript +++ b/src/mem/cache/SConscript @@ -37,6 +37,7 @@ Source('blk.cc') Source('mshr.cc') Source('mshr_queue.cc') +Source('sector_blk.cc') Source('write_queue.cc') Source('write_queue_entry.cc') diff --git a/src/mem/cache/blk.hh b/src/mem/cache/blk.hh index 83807b7..dc3c523 100644 --- a/src/mem/cache/blk.hh +++ b/src/mem/cache/blk.hh @@ -73,9 +73,11 @@ BlkSecure = 0x40, }; +class SectorBlk; + /** * A Basic Cache block. - * Contains the tag, status, and a pointer to data. + * Contains a pointer to its tag, its status, and a pointer to its data. */ class CacheBlk { @@ -83,8 +85,23 @@ /** Task Id associated with this block */ uint32_t task_id; -/** Data block tag value. */ -Addr tag; +/** + * Data block tag pointer. + * A block may share its tag with many other blocks when used compressed + * or sectored caches. + * @sa BaseSetAssoc + */ +std::shared_ptr tag; + +/** + * Sector block associated to this block. + * @sa SectorTags + */ +SectorBlk* secBlk; + +/** Copy of the block's address, for debugging reasons. */ +Addr addr; + /** * Contains a copy of the data in this block for easy access. This is used * for efficient execution when the data could be actually stored in @@ -104,10 +121,10 @@ Tick whenReady; /** - * The set and way this block belongs to. + * The set, way and sector offset this block belongs to. * @todo Move this into subclasses when we fix CacheTags to use them. */ -int set, way; +int set, way, sectorOffset; /** holds the source requestor ID for this block. */ int srcMasterId; @@ -116,7 +133,7 @@ * Replacement data associated to this block. * It is instantiated by the replacement policy. */ -std::unique_ptr replacementData; +std::shared_ptr replacementData; protected: /** @@ -161,8 +178,7 @@ std::list lockList; public: - -CacheBlk() +CacheBlk() : tag(nullptr), secBlk(nullptr) { invalidate(); } @@ -197,7 +213,7 @@ * Checks that a block is valid. * @return True if the block is valid. */ -bool isValid() const +virtual bool isValid() const { return (status & BlkValid) != 0; } @@ -207,7 +223,11 @@ */ virtual void invalidate() { -tag = MaxAddr; +// The first invalidate is called before a tag is instantiated by tags +if (tag) { +*tag = MaxAddr; +} + task_id = ContextSwitchTaskId::Unknown; status = 0; whenReady = MaxTick; @@ -251,6 +271,19 @@ } /** + * Check if block corresponds to given tag. For a match to happen, the + * must be valid and belong to the same secure space. + * + * @param The tag to be matched. + * @param is_secure True if the target memory space is secure. + * @return True if block matches tag. + */ +bool match(const Addr tag, const bool is_secure) const +{ +return (*(this->tag) == tag) && isValid() && (isSecure() == is_secure); +} + +/** * Track the fact that a local locked was issued to the * block. Invalidate any previous LL to the same address. */ diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc index 28c4343..f1b4c42 100644 --- a/src/mem/cache/c
Re: [gem5-dev] Fix opengrok or remove the link from gem.org sidebar
How about switching to a hosted service that integrates with our git repositories directly? I have played around with insight.io, but it seems like they require you to login to the server using your GitHub credentials to access public repos. Something that doesn't require a separate login would be ideal. Does anyone know of anything? Cheers, Andreas On 07/04/2018 22:12, Gabe Black wrote: I don't think removing the link is helpful. We should fix the service it links to. Gabe On Sat, Apr 7, 2018 at 1:14 PM, Ciro Santilli wrote: Ping. Can we remove the link until it gets fixed? From: gem5-dev on behalf of Gabe Black < gabebl...@google.com> Sent: Tuesday, March 13, 2018 10:33:44 PM To: gem5 Developer List Subject: Re: [gem5-dev] Fix opengrok or remove the link from gem.org sidebar For whatever reason, I find that my administrative access on gem5.org comes and goes, and has currently went. I think Ali set up opengrok and so would be best placed to fix it. It was useful back when we first set it up, and it would be good to fix it. Gabe On Tue, Mar 13, 2018 at 5:56 AM, Ciro Santilli wrote: Did you manage to fix it? Still seems broken to me. If not, can we just remove the link for now, and put it back up if someone fixes it? Looks bad for the project to have a broken link on the sidebar 😉 From: gem5-dev on behalf of Gabe Black < gabebl...@google.com> Sent: Tuesday, February 27, 2018 12:40:39 AM To: gem5 Developer List Subject: Re: [gem5-dev] Fix opengrok or remove the link from gem.org sidebar It looks like changing to git would be pretty easy, since that's handled in /etc/cron.daily/opengrok: #!/bin/bash cd /var/opengrok/src/gem5 hg pull hg update /z/opengrok/bin/OpenGrok update On Mon, Feb 26, 2018 at 4:39 PM, Gabe Black wrote: Also it doesn't help that I don't have permission to access any of the logs for tomcat or apache. But looking at the output of ps -ef, I don't see tomcat running, so I don't think the opengrok server bit is running which would fit with the other bit of log I was able to access. Also I notice that the source opengrok is indexing is mercurial. It wouldn't be a bad idea to change that over to git. Gabe On Mon, Feb 26, 2018 at 4:30 PM, Gabe Black wrote: I'm not up on how opengrok is hooked into the gem5.org site, but I ssh-ed in and saw this in one of the log files: 2018-02-24 06:42:31.799-0500 INFO t1 Indexer.sendToConfigHost: Send configuration to: localhost:2424 2018-02-24 06:42:31.813-0500 SEVERE t1 Indexer.sendToConfigHost: Failed to send configuration to localhost:2424 (is web application server running with opengrok deploye d?) It looks like some of the config may have been damaged, or some piece of the setup hasn't been started like it's supposed to be. Without more information about how it's *supposed* to work, it's hard to say. Gabe On Fri, Feb 23, 2018 at 6:08 AM, Ciro Santilli On http://gem5.org on the sidebar there is a link "Search Source" that points to http://grok.gem5.org/ which gives "Service Unavailable". Can we either fix the instance, or remove the link? Personally, I'd just remove it, GitHub + ctags is enough for me. IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listi
Re: [gem5-dev] Fwd: Make me a collaborator on GitHub to better manage issues
@Andreas, can you reply to Gabe's request? On Mon, Apr 9, 2018 at 10:17 PM, Gabe Black wrote: > As an aside, opengrok was set up by Ali who now works for ARM. He has > showed up very briefly since I came back to the project, but I don't think > he's actively following the project. I would take care of some of these > things, but for some reason my root access on gem5.org seems to have been > removed again since the last time I went in there to fix something, and > even that time I had to ask maybe a half dozen times before somebody > finally granted me that access. Ali would be best at fixing opengrok, but I > wouldn't mind having the ability to attempt to fix it. > > Gabe > > On Mon, Apr 9, 2018 at 1:31 PM, Jason Lowe-Power > wrote: > >> Hi Ciro, >> >> First of all, we appreciate your efforts to further document gem5 and >> answer questions on the gem5 users list! >> >> Right now, we're really just using github as a backup mirror of gem5. I'm >> not sure why this was started initially, TBH. It doesn't seem necessary now >> that we are hosting the code on Google's cloud. I really don't like the >> idea of having a fragmented infrastructure. It would be best if everything >> gem5 was in the same place. >> >> As far as an issue tracker goes... the main problem is that we don't have >> anyone to actually *solve* any issues/bugs that people find. Almost all of >> our contributors are working full time in research positions or as grad >> students and cannot be expected to fix bugs unrelated to their research >> directions. What I believe happened with the Flyspray (and what I would >> expect to happen with any issue tracker) is that a huge number of issues >> built up over time. Eventually, it became useless as a place for >> documenting issues because no one tracked how commits effected the issues >> reported. >> >> The reasons I don't want an issue tracker aren't because of problems with >> how it would work, how emails would be sent, spam, etc. It's much more the >> question "how will it help the community?" and "will the benefits out >> weight the costs?" In this case, costs include time to manage, but also >> confusion for new community members on how to communicate with the rest of >> the community. >> >> What I believe we need is more infrastructure for gem5. We need people who >> can manage an issue tracker, fix bugs, implement shared features, and keep >> the general infrastructure up to date. To do this (again, IMO) we need to >> two things: 1) money to pay someone to do this, and 2) someone willing to >> coordinate/manage everything. >> >> This discussion is related to the problems on gem5.org as well. We've been >> trying to move as much of the infrastructure as possible to the cloud >> because it's hard to find community members with the time/know how to >> manage everything internally. For instance, it seems like it would be good >> to get OpenGrok back up, but I don't even know who set it up! It was >> probably one of Steve's students who long ago moved on to other things. >> Even getting rid of the link is hard... I don't know who has access to >> change that page (I don't). >> >> gem5 is a weird project. I really haven't seen anything like it. Most of >> the contributors are only around for a few years while they are getting >> their PhD then they leave. This churn in contributors is clearly makes some >> project management activities very hard. >> >> Sorry for the long message. I wanted to give you (and everyone else >> reading) a little bit of context and history. >> >> I (we) are very open to new contributors and people helping out with the >> project. If you have ideas on how to make things better we're listening! >> Although I argued against using an issue tracker, I'm open to the idea if >> I'm convinced that it will help the community. >> >> Thanks again for all of your contributions so far! I look forward to >> working with you! >> >> Cheers, >> Jason >> >> --- >> Jason Lowe-Power >> Assistant Professor, Computer Science Department >> University of California, Davis >> 3049 Kemper Hall >> jlowepo...@ucdavis.edu >> >> >> On Mon, Apr 9, 2018 at 5:41 AM Ciro Santilli >> wrote: >> >> > If made collaborator, I commit to keep every spam out. But there is >> > little to no spam on GitHub by default anyways. >> > >> > I feel that if users want to use GitHub issues, which seems to be the >> > case, we should cater for their preferred communication mechanism. >> > >> > Issue trackers have several advantages, notably: >> > >> > - open close status immediately visible, which I intend to maintain on >> > a best effort basis. But it is better than the mailing list, where you >> > have to browse N emails before finding out. >> > - you can opt in for notifications only from certain threads >> > - you can reply to messages even though you weren't subscribed when >> > they were made: >> > >> > https://webapps.stackexchange.com/questions/23197/reply-to- >> mailman-archived-message >> > Notably
[gem5-dev] Cron /z/m5/regression/do-regression quick
* build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/minor-timing: FAILED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/o3-timing: FAILED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/simple-atomic: FAILED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/simple-timing: FAILED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/simple-timing-ruby: FAILED! * build/HSAIL_X86/tests/opt/quick/se/04.gpu/x86/linux/gpu-ruby-GPU_RfO: FAILED! * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/minor-timing: CHANGED! * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/o3-timing: CHANGED! * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/simple-timing: CHANGED! * build/ALPHA/tests/opt/quick/se/01.hello-2T-smt/alpha/linux/o3-timing-mt: CHANGED! * build/ALPHA/tests/opt/quick/se/03.learning-gem5/alpha/linux/learning-gem5-p1-simple: CHANGED! * build/ALPHA/tests/opt/quick/se/03.learning-gem5/alpha/linux/learning-gem5-p1-two-level: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-atomic: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-atomic-dual: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-timing: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-timing-dual: CHANGED! * build/MIPS/tests/opt/quick/se/00.hello/mips/linux/o3-timing: CHANGED! * build/MIPS/tests/opt/quick/se/00.hello/mips/linux/simple-timing: CHANGED! * build/MIPS/tests/opt/quick/se/00.hello/mips/linux/simple-timing-ruby: CHANGED! * build/MIPS/tests/opt/quick/se/03.learning-gem5/mips/linux/learning-gem5-p1-simple: CHANGED! * build/MIPS/tests/opt/quick/se/03.learning-gem5/mips/linux/learning-gem5-p1-two-level: CHANGED! * build/NULL_MOESI_hammer/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MOESI_hammer: CHANGED! * build/NULL_MESI_Two_Level/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MESI_Two_Level: CHANGED! * build/NULL_MOESI_CMP_directory/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MOESI_CMP_directory: CHANGED! * build/NULL_MOESI_CMP_token/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MOESI_CMP_token: CHANGED! * build/POWER/tests/opt/quick/se/00.hello/power/linux/o3-timing: CHANGED! * build/SPARC/tests/opt/quick/se/00.hello/sparc/linux/simple-timing: CHANGED! * build/SPARC/tests/opt/quick/se/02.insttest/sparc/linux/o3-timing: CHANGED! * build/SPARC/tests/opt/quick/se/02.insttest/sparc/linux/simple-timing: CHANGED! * build/SPARC/tests/opt/quick/se/03.learning-gem5/sparc/linux/learning-gem5-p1-simple: CHANGED! * build/SPARC/tests/opt/quick/se/03.learning-gem5/sparc/linux/learning-gem5-p1-two-level: CHANGED! * build/SPARC/tests/opt/quick/se/40.m5threads-test-atomic/sparc/linux/o3-timing-mp: CHANGED! * build/SPARC/tests/opt/quick/se/40.m5threads-test-atomic/sparc/linux/simple-atomic-mp: CHANGED! * build/SPARC/tests/opt/quick/se/40.m5threads-test-atomic/sparc/linux/simple-timing-mp: CHANGED! * build/SPARC/tests/opt/quick/se/50.vortex/sparc/linux/simple-timing: CHANGED! * build/SPARC/tests/opt/quick/se/70.twolf/sparc/linux/simple-timing: CHANGED! * build/X86/tests/opt/quick/se/00.hello/x86/linux/simple-timing-ruby: CHANGED! * build/X86/tests/opt/quick/se/00.hello/x86/linux/simple-atomic: CHANGED! * build/X86/tests/opt/quick/se/00.hello/x86/linux/simple-timing: CHANGED!*** diff[simerr]: SKIPPED * build/X86/tests/opt/quick/se/00.hello/x86/linux/o3-timing: CHANGED! * build/X86/tests/opt/quick/se/03.learning-gem5/x86/linux/learning-gem5-p1-simple: CHANGED! * build/X86/tests/opt/quick/se/03.learning-gem5/x86/linux/learning-gem5-p1-two-level: CHANGED! * build/X86/tests/opt/quick/se/10.mcf/x86/linux/simple-atomic: CHANGED! *** diff[simout]: SKIPPED* build/X86/tests/opt/quick/se/70.twolf/x86/linux/simple-timing: CHANGED! * build/X86/tests/opt/quick/se/70.twolf/x86/linux/simple-atomic: CHANGED! * build/RISCV/tests/opt/quick/se/00.hello/riscv/linux/minor-timing: CHANGED! * build/RISCV/tests/opt/quick/se/00.hello/riscv/linux/o3-timing: CHANGED! * build/RISCV/tests/opt/quick/se/00.hello/riscv/linux/simple-atomic: CHANGED! * build/RISCV/tests/opt/quick/se/00.hello/riscv/linux/simple-timing: CHANGED! * build/RISCV/tests/opt/quick/se/00.hello/riscv/linux/simple-timing-ruby: CHANGED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64a/minor-timing: CHANGED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64a/o3-timing: CHANGED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64a/simple-atomic: CHANGED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64a/simple-timing: CHANGED! * build/RISCV/tests/op