alistair23 / qemu

Alistair's fork of the official QEMU repository
http://wiki.qemu.org/Main_Page
Other
7 stars 9 forks source link

Externally Trigger Interrupts #3

Closed alistair23 closed 9 years ago

alistair23 commented 9 years ago

Think of a method to externally trigger GPIO interrupts Ideas so far:

pete128 commented 9 years ago

Some sore of Python Qtest thing?

Then you can make little guis in python specific to the lab etc.

Regards, Peter


From: Alistair Francis [notifications@github.com] Sent: Friday, August 08, 2014 11:58 AM To: alistair23/qemu Subject: [qemu] Externally Trigger Interrupts (#3)

Think of a method to externally trigger GPIO interrupts Ideas so far:

— Reply to this email directly or view it on GitHubhttps://github.com/alistair23/qemu/issues/3.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

alistair23 commented 9 years ago

Yeah, I've just started looking into it and qtest.c looks like it has everything, should be simple to use

pete128 commented 9 years ago

So does this just mean that you wiggle GPIOs from qtest, then the GPIO controller does the interrupt? I don't think you should directly intercept IRQs on the user level.

alistair23 commented 9 years ago

At the moment when the GPIO controller is read, it triggers an interrupt. It's a hack I have just for testing.

What ideally would be good is an external method to trigger the GPIO interrupt. The problem is that Qtest is an internal component and QMP and HMP don't have ways to do this (that I can see)

pete128 commented 9 years ago

I'm struggling to understand the real hw setup though?

Is it a GPIO control that lets you trigger interrupts on state changes? Or is it a raw external input pin straight to the interrupt controller?

Regards, Peter


From: Alistair Francis [notifications@github.com] Sent: Thursday, August 14, 2014 1:04 PM To: alistair23/qemu Cc: Peter Crosthwaite Subject: Re: [qemu] Externally Trigger Interrupts (#3)

At the moment when the GPIO controller is read, it triggers an interrupt. It's a hack I have just for testing.

What ideally would be good is an external method to trigger the GPIO interrupt. The problem is that Qtest is an internal component and QMP and HMP don't have ways to do this (that I can see)

— Reply to this email directly or view it on GitHubhttps://github.com/alistair23/qemu/issues/3#issuecomment-52144140.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

alistair23 commented 9 years ago

It's an external pin, that can be configured to trigger an interrupt on an event

pete128 commented 9 years ago

What does the “configuration” though? An interrupt controller or GPIO controller?

From: Alistair Francis [mailto:notifications@github.com] Sent: Thursday, August 14, 2014 11:21 PM To: alistair23/qemu Cc: Peter Crosthwaite Subject: Re: [qemu] Externally Trigger Interrupts (#3)

It's an external pin, that can be configured to trigger an interrupt on an event

— Reply to this email directly or view it on GitHubhttps://github.com/alistair23/qemu/issues/3#issuecomment-52181740.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

alistair23 commented 9 years ago

I think it's the GPIO controller

alistair23 commented 9 years ago

So I looked into it a bit more, it's actually an external device that handles the external interrupts. It's the EXTI device, so this will need to be added to handle interrupts. This should actually be easier as I was really confused how the GPIO controller was going to be configured. Still have the problem of externally triggering them though

pete128 commented 9 years ago

Is it a button on the board?


From: Alistair Francis [notifications@github.com] Sent: Thursday, August 21, 2014 9:52 AM To: alistair23/qemu Cc: Peter Crosthwaite Subject: Re: [qemu] Externally Trigger Interrupts (#3)

So I looked into it a bit more, it's actually an external device that handles the external interrupts. It's the EXTI device, so this will need to be added to handle interrupts. This should actually be easier as I was really confused how the GPIO controller was going to be configured. Still have the problem of externally triggering them though

— Reply to this email directly or view it on GitHubhttps://github.com/alistair23/qemu/issues/3#issuecomment-52869510.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

Konstanty commented 9 years ago

There is one button on board, but the rest of the GPIOs will be buttons/lasers/etc connected via wires to the GPIO pins.

alistair23 commented 9 years ago

Most of the EXTI interrupts are from GPIO pins changing (there are also some reserved)

Konstanty commented 9 years ago

Some pretty old code... which does "external" control of GPIO.. https://lists.gnu.org/archive/html/qemu-devel/2009-09/msg00023.html

Not sure this is a good way to do it though.

alistair23 commented 9 years ago

The GPIO device now has GPIOs in and also sends signals out to the EXTI device to trigger interrupts. Just need an external way to trigger the GPIO in lines to the device

alistair23 commented 9 years ago

Based on Biffer's work I now have I/O access to the GPIO device via TCP. I can read and write strings into and out of QEMU. The next step is to expand the Python script to make it more automated and support the new QEMU strings

alistair23 commented 9 years ago

Using Biffer's code (but changing the port being used) Python has read/write access to QEMU. Unfortunately I don't know Python that well, so I haven't had a chance to edit the scripts to change values

alistair23 commented 9 years ago

Can now change the values of GPIO pins. The Python script isn't very robust at the moment, but the QEMU side is there. Interrupts don't work yet though

alistair23 commented 9 years ago

So this now works :) It still needs a bit of work and tidying up, but I'm going to close this issue and re-open one next week based on what the next steps are decided to be. This patch has some details: https://github.com/alistair23/qemu/commit/1d7783675d39001ff7fbae9cc1447253413b0da5 but I will write up a full explanation in the wiki when I get a chance