On Oct 17, 2016, at 3:05 AM, Mark Cave-Ayland wrote:
On 17/10/16 02:37, Programmingkid wrote:
I did your suggestion and OpenBIOS compiled without errors or warnings. I tried testing the change with a USB keyboard. No characters displayed. I then removed the changes and tried the USB keyboard again. No characters displayed. It looks like USB keyboards do not work in OpenBIOS.
Here is the command-line I used: qemu-system-ppc -M mac99 -device usb-kbd -bios openbios-qemu.elf.nostrip
Regression in QEMU?
I can't say for sure. This is my first time using the USB keyboard in OpenBIOS.
Do USB keyboards work with your new OpenBIOS used with a vanilla 2.7 release?
It does not. Did USB keyboard ever work with OpenBIOS?
The OpenBIOS binary that comes with QEMU doesn't even work. My test was with this command-line: qemu-system-ppc -usb -device usb-kbd
On Mon, 17 Oct 2016, Programmingkid wrote:
On Oct 17, 2016, at 3:05 AM, Mark Cave-Ayland wrote:
On 17/10/16 02:37, Programmingkid wrote:
Here is the command-line I used: qemu-system-ppc -M mac99 -device usb-kbd -bios openbios-qemu.elf.nostrip
Regression in QEMU?
I can't say for sure. This is my first time using the USB keyboard in OpenBIOS.
Do USB keyboards work with your new OpenBIOS used with a vanilla 2.7 release?
It does not. Did USB keyboard ever work with OpenBIOS?
It worked back when I've added the driver to OpenBIOS but maybe there were some changes in QEMU that broke it since or you could try to not have both ADB and USB keyboards only USB (not sure if this would help but could be something to try). Also enabling debug output might help to see if it's trying to access the OHCI hardware and what it's doing.
Regards, BALATON Zoltan
On 17/10/16 17:35, BALATON Zoltan wrote:
On Mon, 17 Oct 2016, Programmingkid wrote:
On Oct 17, 2016, at 3:05 AM, Mark Cave-Ayland wrote:
On 17/10/16 02:37, Programmingkid wrote:
Here is the command-line I used: qemu-system-ppc -M mac99 -device usb-kbd -bios openbios-qemu.elf.nostrip
Regression in QEMU?
I can't say for sure. This is my first time using the USB keyboard in OpenBIOS.
Do USB keyboards work with your new OpenBIOS used with a vanilla 2.7 release?
It does not. Did USB keyboard ever work with OpenBIOS?
It worked back when I've added the driver to OpenBIOS but maybe there were some changes in QEMU that broke it since or you could try to not have both ADB and USB keyboards only USB (not sure if this would help but could be something to try). Also enabling debug output might help to see if it's trying to access the OHCI hardware and what it's doing.
Is there any chance you can confirm the command line you used and a bit of information as to how you tested the patch so I can try and recreate here?
ATB,
Mark.
On Mon, 17 Oct 2016, Mark Cave-Ayland wrote:
On 17/10/16 17:35, BALATON Zoltan wrote:
It worked back when I've added the driver to OpenBIOS but maybe there were some changes in QEMU that broke it since or you could try to not have both ADB and USB keyboards only USB (not sure if this would help but could be something to try). Also enabling debug output might help to see if it's trying to access the OHCI hardware and what it's doing.
Is there any chance you can confirm the command line you used and a bit of information as to how you tested the patch so I can try and recreate here?
Sorry, I don't remember. But enabling CONFIG_DEBUG_USB option in config/examples/ppc_config.xml (with the patch fixing it I've sent separately to the list) I get the following debug output:
rh init done root hub status change attachment change on port 0 Warning: port reset too short: 0ms; should be at least 10ms. rh port reset finished after 0ms. fullspeed device ohci_control(): doing transfer with 0. first_td at 7c9b430 Waiting for 0 pages on dev 07c9b074 with head 07c9b490 Processed 2 done TDs. processed 2 done tds, 0 intr tds thereof. HALTED! set_address failed
So it seems to have found the OHCI controller and root hub but failed during trying to use the USB keyboard. That's all I could identify to hint at where it should be debugged. I don't know what the actual problem is.
Regards, BALATON Zoltan
On 17/10/16 22:25, BALATON Zoltan wrote:
So it seems to have found the OHCI controller and root hub but failed during trying to use the USB keyboard. That's all I could identify to hint at where it should be debugged. I don't know what the actual problem is.
After a bit of digging I managed to bisect this down to commit 070ea6080606813bdedf667a070917155819abed which had me scratching my head a bit until I enabled USB_DEBUG_ED in usbohci.c:
Good:
|:::::::::::::::::: OHCI TD CHAIN ::::::::::::::::::| +---------------------------------------------------+ |..[SETUP]..........................................| |:|============ OHCI TD at [0x07c9b430] ==========|:| |:| ERRORS = [3] | CONFIG = [0xe2e00000] | |:| |:+-----------------------------------------------+:| |:| C | Condition Code | [14] |:| |:| O | Direction/PID | [0] |:| |:| N | Buffer Rounding | [0] |:| |:| F | Delay Intterrupt | [7] |:| |:| I | Data Toggle | [2] |:| |:| G | Error Count | [0] |:| |:+-----------------------------------------------+:| |:| Current Buffer Pointer [0x07df7730] |:| |:+-----------------------------------------------+:| |:| Next TD [0x07c9b450] |:| |:+-----------------------------------------------+:| |:| Current Buffer End [0x07df7737] |:| |:|-----------------------------------------------|:| |...................................................| +---------------------------------------------------+
Bad:
|:::::::::::::::::: OHCI TD CHAIN ::::::::::::::::::| +---------------------------------------------------+ |..[SETUP]..........................................| |:|============ OHCI TD at [0x07c9b430] ==========|:| |:| ERRORS = [3] | CONFIG = [0xe2e00000] | |:| |:+-----------------------------------------------+:| |:| C | Condition Code | [14] |:| |:| O | Direction/PID | [0] |:| |:| N | Buffer Rounding | [0] |:| |:| F | Delay Intterrupt | [7] |:| |:| I | Data Toggle | [2] |:| |:| G | Error Count | [0] |:| |:+-----------------------------------------------+:| |:| Current Buffer Pointer [0xffff5a50] |:| |:+-----------------------------------------------+:| |:| Next TD [0x07c9b450] |:| |:+-----------------------------------------------+:| |:| Current Buffer End [0xffff5a57] |:| |:|-----------------------------------------------|:| |...................................................| +---------------------------------------------------+
The issue here is that the buffer pointers are pointing to virtual rather than physical addresses.
Digging into this it seems that the problem is that the virt_to_phys() macro in OpenBIOS doesn't actually do anything since virt_offset is always set to zero, i.e. physical address = virtual address. In fact the correct logic for internal physical/virtual address conversions is the va2pa() function found in the OFMEM implementation.
The commit above tried to bring PPC into line with the other architectures by allocating the OpenBIOS stack in the virtual image, but that won't work here due to the incorrect virt_to_phys() macro.
Rather than try and fix that up, I think the best solution for the moment is to continue to use the context but inject the existing stack pointer into the context just before the switch which will ensure that stack allocations also occur in 1:1 mapped address space.
ATB,
Mark.