mips_malta: do not raise exceptions when accessing invalid memory
PATCH 1/1 mips_malta: do not raise exceptions when accessing invalid memory
Since commit c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises exceptions when accessing invalid memory. This is not the correct behaviour for MIPS Malta Core LV, as the GT-64120A system controller just ignore undecoded access. This feature is used by the Linux kernel to probe for some devices.
Emulate the correct behaviour in QEMU by adding an empty slot covering the entire memory space decoded by the GT-64120A.
--- default-configs/mips-softmmu.mak | 1 + default-configs/mips64-softmmu.mak | 1 + default-configs/mips64el-softmmu.mak | 1 + default-configs/mipsel-softmmu.mak | 1 + hw/mips/mips_malta.c | 6 ++++++ 5 files changed, 10 insertions(+)
default-configs/mips-softmmu.mak +1 -0
@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=y
default-configs/mips64-softmmu.mak +1 -0
@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=y
default-configs/mips64el-softmmu.mak +1 -0
@@ -36,3 +36,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=y
default-configs/mipsel-softmmu.mak +1 -0
@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=y
hw/mips/mips_malta.c +6 -0
@@ -50,6 +50,7 @@#include "qemu/host-utils.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" +#include "hw/empty_slot.h" //#define DEBUG_BOARD_INIT
@@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)DeviceState *dev =qdev_create (NULL ,TYPE_MIPS_MALTA );MaltaState *s =MIPS_MALTA (dev); +/* The whole address space decoded by the GT-64120A doesn't generate +exception when accessing invalid memory. Create an empty slot to +emulate this feature. */ +empty_slot_init (0 ,0x1fffffff ); +qdev_init_nofail (dev);/* Make sure the first 3 serial ports are associated with a device. */
Signature · 1 line
1.7.10.4
Am 12.08.2013 21:44, schrieb Aurelien Jarno:
Quoted 68 lines
Since commit
c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises exceptions when accessing invalid memory. This is not the correct behaviour for MIPS Malta Core LV, as the GT-64120A system controller just ignore undecoded access. This feature is used by the Linux kernel to probe for some devices.Emulate the correct behaviour in QEMU by adding an empty slot covering the entire memory space decoded by the GT-64120A.
Signed-off-by Aurelien Jarno <[email protected]>--- default-configs/mips-softmmu.mak | 1 + default-configs/mips64-softmmu.mak | 1 + default-configs/mips64el-softmmu.mak | 1 + default-configs/mipsel-softmmu.mak | 1 + hw/mips/mips_malta.c | 6 ++++++ 5 files changed, 10 insertions(+)default-configs/mips-softmmu.mak +1
-0@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=ydefault-configs/mips64-softmmu.mak +1
-0@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=ydefault-configs/mips64el-softmmu.mak +1
-0@@ -36,3 +36,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=ydefault-configs/mipsel-softmmu.mak +1
-0@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=yhw/mips/mips_malta.c +1
-0@@ -50,6 +50,7 @@#include "qemu/host-utils.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" +#include "hw/empty_slot.h" //#define DEBUG_BOARD_INIT @@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)DeviceState *dev =qdev_create (NULL ,TYPE_MIPS_MALTA );
hw/mips/mips_malta.c void mips_malta_init(QEMUMachineInitArgs *args) · line 919
Quoted 10 lines
hw/mips/mips_malta.c +5
-0MaltaState *s =MIPS_MALTA (dev); +/* The whole address space decoded by the GT-64120A doesn't generate +exception when accessing invalid memory. Create an empty slot to +emulate this feature. */ +empty_slot_init (0 ,0x1fffffff ); +qdev_init_nofail (dev);/* Make sure the first 3 serial ports are associated with a device. */
Hello Aurelien,
the patch fixes Linux boot with Malta, therefore
The 2nd parameter of empty_slot_init is not the end address but the length, so I think it should be 0x20000000. With this modification, the patch is good for 1.6.
I did not find a hint in the GT-64120A documentation about handling of addresses without connected devices. It is still strange that the exception handler throws a secondary exception with the current code.
Regards,
Stefan
Quoted 82 lines · Stefan Weil
Am 12.08.2013 21:44, schrieb Aurelien Jarno:
Quoted 68 lines
Since commit
c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises exceptions when accessing invalid memory. This is not the correct behaviour for MIPS Malta Core LV, as the GT-64120A system controller just ignore undecoded access. This feature is used by the Linux kernel to probe for some devices.Emulate the correct behaviour in QEMU by adding an empty slot covering the entire memory space decoded by the GT-64120A.
Signed-off-by Aurelien Jarno <[email protected]>--- default-configs/mips-softmmu.mak | 1 + default-configs/mips64-softmmu.mak | 1 + default-configs/mips64el-softmmu.mak | 1 + default-configs/mipsel-softmmu.mak | 1 + hw/mips/mips_malta.c | 6 ++++++ 5 files changed, 10 insertions(+)default-configs/mips-softmmu.mak +1
-0@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=ydefault-configs/mips64-softmmu.mak +1
-0@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=ydefault-configs/mips64el-softmmu.mak +1
-0@@ -36,3 +36,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=ydefault-configs/mipsel-softmmu.mak +1
-0@@ -34,3 +34,4 @@ CONFIG_JAZZ_LED=y CONFIG_MC146818RTC=y CONFIG_VT82C686=y CONFIG_ISA_TESTDEV=y +CONFIG_EMPTY_SLOT=yhw/mips/mips_malta.c +1
-0@@ -50,6 +50,7 @@#include "qemu/host-utils.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" +#include "hw/empty_slot.h" //#define DEBUG_BOARD_INIT @@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)DeviceState *dev =qdev_create (NULL ,TYPE_MIPS_MALTA );hw/mips/mips_malta.c void mips_malta_init(QEMUMachineInitArgs *args) · line 919
Quoted 10 lines
hw/mips/mips_malta.c +5
-0MaltaState *s =MIPS_MALTA (dev); +/* The whole address space decoded by the GT-64120A doesn't generate +exception when accessing invalid memory. Create an empty slot to +emulate this feature. */ +empty_slot_init (0 ,0x1fffffff ); +qdev_init_nofail (dev);/* Make sure the first 3 serial ports are associated with a device. */ Hello Aurelien,
Quoted 7 lines
the patch fixes Linux boot with Malta, therefore
Tested-by Stefan Weil <[email protected]>The 2nd parameter of
empty_slot_initis not the end address but the length, so I think it should be0x20000000. With this modification, the patch is good for 1.6.
Thanks for the test, I'll fix that.
Quoted 2 lines
I did not find a hint in the GT-64120A documentation about handling of addresses without connected devices. It is still
Me neither, there is no mention on returning such error to the CPU. Given how old is this kind of chipset (from the R4700/R5000 era), my guess is that these are simply ignored.
Quoted 2 lines
strange that the exception handler throws a secondary exception with the current code.
The exception handler is provided by the kernel, and I guess this kind of exception is not very common, so not handled very well.
Regards,
Aurelien
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 11 lines · Aurelien Jarno
Since commit
c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises exceptions when accessing invalid memory. This is not the correct behaviour for MIPS Malta Core LV, as the GT-64120A system controller just ignore undecoded access. This feature is used by the Linux kernel to probe for some devices.Emulate the correct behaviour in QEMU by adding an empty slot covering the entire memory space decoded by the GT-64120A.
Signed-off-by Aurelien Jarno <[email protected]>---
<snip>
hw/mips/mips_malta.c void mips_malta_init(QEMUMachineInitArgs *args) · line 915
Quoted 8 lines
hw/mips/mips_malta.c +4
-0@@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)DeviceState *dev =qdev_create (NULL ,TYPE_MIPS_MALTA );MaltaState *s =MIPS_MALTA (dev); +/* The whole address space decoded by the GT-64120A doesn't generate +exception when accessing invalid memory. Create an empty slot to +emulate this feature. */ +empty_slot_init (0 ,0x1fffffff );
Out of interest, any particular reason not to put this in hw/mips/gt64xxx_pci.c? As far as I can tell from your description it's specific to the GT-64* system controller rather than the malta board?
Cheers
James
Am 13.08.2013 12:05, schrieb James Hogan:
Quoted 19 lines · Aurelien Jarno
Quoted 11 lines
Since commit
c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises exceptions when accessing invalid memory. This is not the correct behaviour for MIPS Malta Core LV, as the GT-64120A system controller just ignore undecoded access. This feature is used by the Linux kernel to probe for some devices.Emulate the correct behaviour in QEMU by adding an empty slot covering the entire memory space decoded by the GT-64120A.
Signed-off-by Aurelien Jarno <[email protected]>---
<snip>
Quoted 4 lines
hw/mips/mips_malta.c +0
-0@@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)DeviceState *dev =qdev_create (NULL ,TYPE_MIPS_MALTA );MaltaState *s =MIPS_MALTA (dev);
Quoted 8 lines
hw/mips/mips_malta.c void mips_malta_init(QEMUMachineInitArgs *args) · line 915
Quoted 4 lines
hw/mips/mips_malta.c +4
-0+/* The whole address space decoded by the GT-64120A doesn't generate +exception when accessing invalid memory. Create an empty slot to +emulate this feature. */ +empty_slot_init (0 ,0x1fffffff );Out of interest, any particular reason not to put this in
hw/mips/gt64xxx_pci.c? As far as I can tell from your description it's specific to the GT-64* system controller rather than the malta board?
I was assuming that we didn't properly model that device when putting it on the board directly, but if there is one then putting it into such a device will avoid having to copy it into multiple boards.
Perhaps in that case we can even have a proper MemoryRegion in the SysBus device instead of a separate empty slot pseudo-device?
FWIW gt64xxx_pci.c could certainly use some more love to eliminate gt64120_register() and to create PCIDevice and PCIBus in the bridge itself for instance...
Regards,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 28 lines · Andreas Färber
Am 13.08.2013 12:05, schrieb James Hogan:
Quoted 27 lines · Aurelien Jarno
Quoted 11 lines
Since commit
c658b94f6e8c206c59d02aa6fbac285b86b53d2c, MIPS raises exceptions when accessing invalid memory. This is not the correct behaviour for MIPS Malta Core LV, as the GT-64120A system controller just ignore undecoded access. This feature is used by the Linux kernel to probe for some devices.Emulate the correct behaviour in QEMU by adding an empty slot covering the entire memory space decoded by the GT-64120A.
Signed-off-by Aurelien Jarno <[email protected]>---
<snip>
hw/mips/mips_malta.c void mips_malta_init(QEMUMachineInitArgs *args) · line 915
Quoted 8 lines
hw/mips/mips_malta.c +4
-0@@ -908,6 +909,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)DeviceState *dev =qdev_create (NULL ,TYPE_MIPS_MALTA );MaltaState *s =MIPS_MALTA (dev); +/* The whole address space decoded by the GT-64120A doesn't generate +exception when accessing invalid memory. Create an empty slot to +emulate this feature. */ +empty_slot_init (0 ,0x1fffffff );Out of interest, any particular reason not to put this in
hw/mips/gt64xxx_pci.c? As far as I can tell from your description it's specific to the GT-64* system controller rather than the malta board?
That is correct that it is specific to the GT-64* system controller. That said it is modeled in QEMU as the PCI controller, and not as the system and memory controller.
Quoted 6 lines
I was assuming that we didn't properly model that device when putting it on the board directly, but if there is one then putting it into such a device will avoid having to copy it into multiple boards.
Perhaps in that case we can even have a proper MemoryRegion in the SysBus device instead of a separate empty slot pseudo-device?
The problem is that while the behaviour is GT-64120A specific, the decoded range is Malta specific. Putting this on one side or another is still introducing assumptions from the other side.
Quoted 3 lines
FWIW
gt64xxx_pci.ccould certainly use some more love to eliminategt64120_register()and to create PCIDevice and PCIBus in the bridge itself for instance...
gt64xxx_pci.c was following all the API at the time it has been added.
It's great that people improve QEMU by providing new APIs allowing more things. That said it's a real pitty that people providing a new API do not (always) convert devices to the new API, as they are the one really knowing and understanding it. Now I'll have to spend time on that instead of doing things actually useful.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 5 lines · Aurelien Jarno
It's great that people improve QEMU by providing new APIs allowing more things. That said it's a real pitty that people providing a new API do not (always) convert devices to the new API, as they are the one really knowing and understanding it. Now I'll have to spend time on that instead of doing things actually useful.
Andreas has actually been putting in a lot of work converting and updating various devices to new APIs. However we have a lot of devices, and with only a few people doing conversions it takes a while to cover everything.
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 5 lines · Aurelien Jarno
It's great that people improve QEMU by providing new APIs allowing more things. That said it's a real pitty that people providing a new API do not (always) convert devices to the new API, as they are the one really knowing and understanding it. Now I'll have to spend time on that instead of doing things actually useful.
Andreas has actually been putting in a lot of work converting and updating various devices to new APIs. However we have a lot of devices, and with only a few people doing conversions it takes a while to cover everything.
I agree that Andreas is taking time to update the various devices, thanks. That said he's not the one who has introduced this new API, and that should not be a justification for removing the Malta board or even the MIPS target from QEMU.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 4 lines · Aurelien Jarno
I agree that Andreas is taking time to update the various devices, thanks. That said he's not the one who has introduced this new API, and that should not be a justification for removing the Malta board or even the MIPS target from QEMU.
Has anybody suggested that? I don't think we're anywhere near that stage yet (and I'd certainly object at this point to dropping devices simply because they hadn't been QOMified).
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 4 lines · Aurelien Jarno
I agree that Andreas is taking time to update the various devices, thanks. That said he's not the one who has introduced this new API, and that should not be a justification for removing the Malta board or even the MIPS target from QEMU.
Has anybody suggested that? I don't think we're anywhere near that stage yet (and I'd certainly object at this point to dropping devices simply because they hadn't been QOMified).
We have seen some patches in the past intentionally breaking non-qdevified devices, and it has been suggested on IRC to schedule MIPS target for removal because there was no free bios available.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Re: [Qemu-devel] Free BIOS for MIPS Malta (was: mips_malta: do not raise exceptions when accessing invalid memory)
Am 13.08.2013 23:26, schrieb Aurelien Jarno:
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Aurelien Jarno
Quoted 4 lines
I agree that Andreas is taking time to update the various devices, thanks. That said he's not the one who has introduced this new API, and that should not be a justification for removing the Malta board or even the MIPS target from QEMU.
Quoted 6 lines
Quoted 3 lines
Has anybody suggested that? I don't think we're anywhere near that stage yet (and I'd certainly object at this point to dropping devices simply because they hadn't been QOMified).
We have seen some patches in the past intentionally breaking non-qdevified devices, and it has been suggested on IRC to schedule MIPS target for removal because there was no free bios available.
Redboot / eCOS is free and available in source for Malta:
http://ecos.sourceware.org/docs-latest/redboot/malta.html
Some years ago I testedit with QEMU and was able to build (there are no pre-built binaries for Malta) and run it (command prompt, basic commands).
There are also some recent mails on using U-Boot with MIPS Malta:
http://lists.denx.de/pipermail/u-boot/2013-January/144505.html
So we have at least two free BIOS available.
The large number of systems, devices and file systemswhich are supported is one of the really great features of QEMU.I don't want to miss this diversity, although I am aware that commercial distributors are more interested in features which support their business like KVM, configuration or migration.
Regards,
Stefan