diff mbox series

RFC Qemu mipssim patches

Message ID 20210211153746.GA25676@dropje.13thmonkey.org
State New
Headers show
Series RFC Qemu mipssim patches | expand

Commit Message

Reinoud Zandijk Feb. 11, 2021, 3:37 p.m. UTC
Hi,

i'd like to get the following simple patches to the MIPS/mipssim target adding
virtio-mmio devices to it. This makes the target a lot more usefull as microvm
for kernel developement. It currently lives in our qemu extensions patches and
we have a working kernel that supports all virtio devices for it.

Thoughts?

Reinoud Zandijk, NetBSD developer
$NetBSD$

Comments

Philippe Mathieu-Daudé Feb. 12, 2021, 12:13 a.m. UTC | #1
Hi Reinoud,

On 2/11/21 4:37 PM, Reinoud Zandijk wrote:
> Hi,
> 
> i'd like to get the following simple patches to the MIPS/mipssim target adding
> virtio-mmio devices to it. This makes the target a lot more usefull as microvm
> for kernel developement. It currently lives in our qemu extensions patches and
> we have a working kernel that supports all virtio devices for it.
> 
> Thoughts?

Why not start a cleanly specified machine, as Laurent is doing on m68k?
https://www.mail-archive.com/qemu-devel@nongnu.org/msg768802.html

This one doesn't even have an interrupt controller.

Cc'ing Aleksandar who maintains this machine.

Regards,

Phil.
Philippe Mathieu-Daudé Feb. 12, 2021, 9:44 a.m. UTC | #2
On 2/12/21 1:13 AM, Philippe Mathieu-Daudé wrote:
> Hi Reinoud,
> 
> On 2/11/21 4:37 PM, Reinoud Zandijk wrote:
>> Hi,
>>
>> i'd like to get the following simple patches to the MIPS/mipssim target adding
>> virtio-mmio devices to it.

Please submit your patches as a series so we can review them on
the list:
https://wiki.qemu.org/Contribute/SubmitAPatch#Use_git_format-patch

BTW you are ORing the IRQ pointer, so you are likely loosing
interrupts...

In case you want to keep using the MIPSsim, see this example
commit on how to use an OR gate:
https://gitlab.com/qemu-project/qemu/-/commit/a879306ca14

>> This makes the target a lot more usefull as microvm
>> for kernel developement. It currently lives in our qemu extensions patches and
>> we have a working kernel that supports all virtio devices for it.
>>
>> Thoughts?
> 
> Why not start a cleanly specified machine, as Laurent is doing on m68k?
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg768802.html
> 
> This one doesn't even have an interrupt controller.
> 
> Cc'ing Aleksandar who maintains this machine.
> 
> Regards,
> 
> Phil.
>
Reinoud Zandijk Feb. 13, 2021, 10:05 a.m. UTC | #3
Hi,

On Fri, Feb 12, 2021 at 10:44:55AM +0100, Philippe Mathieu-Daudé wrote:
> >> i'd like to get the following simple patches to the MIPS/mipssim target adding
> >> virtio-mmio devices to it.
> 
> Please submit your patches as a series so we can review them on
> the list:
> https://wiki.qemu.org/Contribute/SubmitAPatch#Use_git_format-patch

Oh thanks, i didn't know that; i've created a new patch with the OR gate you
suggested. We deliberated about the change here and we'll at least keep it
here locally for testing and profiling code until a real `virt' platform is
developed for MIPS. Until then it would IMHO be a good expansion to mipssim.
I'll try to get a proper patch posted on the list :)

As for the Malta target, its missing its BIOS and thus its PCI bus is not
initialised correctly for NetBSD to run on when its passed with -kernel. Linux
seems to bodge around this somewhere but if no BIOS is found it would be
better if it was initialised as the BIOS would leave it before handing over to
the kernel.

There are also a few Qemu virtio-pci and virtio-mmio bugs we encountered on
Aarch64 and Sparc64, how can I best file those? Or should I try to contact ppl
directly?

With regards,
Reinoud Zandijk
Philippe Mathieu-Daudé Feb. 13, 2021, 1:14 p.m. UTC | #4
On 2/13/21 11:05 AM, Reinoud Zandijk wrote:
> On Fri, Feb 12, 2021 at 10:44:55AM +0100, Philippe Mathieu-Daudé wrote:
>>>> i'd like to get the following simple patches to the MIPS/mipssim target adding
>>>> virtio-mmio devices to it.
>>
>> Please submit your patches as a series so we can review them on
>> the list:
>> https://wiki.qemu.org/Contribute/SubmitAPatch#Use_git_format-patch
> 
> Oh thanks, i didn't know that; i've created a new patch with the OR gate you
> suggested. We deliberated about the change here and we'll at least keep it
> here locally for testing and profiling code until a real `virt' platform is
> developed for MIPS. Until then it would IMHO be a good expansion to mipssim.
> I'll try to get a proper patch posted on the list :)

What I forgot to mention is that QEMU aims to keep models the closer
to the hardware, so modifying MIPSsim to some Frankenstein is unlikely
to be accepted.

The patch could be useful (we can adapt it to an eventual 'virt'
machine later).

> As for the Malta target, its missing its BIOS and thus its PCI bus is not
> initialised correctly for NetBSD to run on when its passed with -kernel. Linux
> seems to bodge around this somewhere but if no BIOS is found it would be
> better if it was initialised as the BIOS would leave it before handing over to
> the kernel.

Agreed. The current "pseudo bootloader" was developed with Linux guest
in mind. For anything else you need a real BIOS ROM, but even there I'm
not sure it works well, because the GT64120 north bridge is reset in a
particular state suitable for Linux.

> There are also a few Qemu virtio-pci and virtio-mmio bugs we encountered on
> Aarch64 and Sparc64, how can I best file those? Or should I try to contact ppl
> directly?

For now the bug tracking system is on Launchpad:
https://bugs.launchpad.net/qemu/+filebug

You can contact the maintainers directly, but if the bug is complex and
will take time to fix, it is better to track it with a LP ticket IMO.

Regards,

Phil.
Thomas Huth Feb. 15, 2021, 6:39 a.m. UTC | #5
On 13/02/2021 14.14, Philippe Mathieu-Daudé wrote:
> On 2/13/21 11:05 AM, Reinoud Zandijk wrote:
>> On Fri, Feb 12, 2021 at 10:44:55AM +0100, Philippe Mathieu-Daudé wrote:
>>>>> i'd like to get the following simple patches to the MIPS/mipssim target adding
>>>>> virtio-mmio devices to it.
>>>
>>> Please submit your patches as a series so we can review them on
>>> the list:
>>> https://wiki.qemu.org/Contribute/SubmitAPatch#Use_git_format-patch
>>
>> Oh thanks, i didn't know that; i've created a new patch with the OR gate you
>> suggested. We deliberated about the change here and we'll at least keep it
>> here locally for testing and profiling code until a real `virt' platform is
>> developed for MIPS. Until then it would IMHO be a good expansion to mipssim.
>> I'll try to get a proper patch posted on the list :)
> 
> What I forgot to mention is that QEMU aims to keep models the closer
> to the hardware, so modifying MIPSsim to some Frankenstein is unlikely
> to be accepted.

Well, mipssim never was a real hardware, in fact it is already some kind of 
"virt" machine. So you could theoretically also extend this machine instead 
of introducing a new one (but I'm not a MIPS guy, so no clue what makes more 
sense).

  Thomas
Philippe Mathieu-Daudé Feb. 15, 2021, 7:56 a.m. UTC | #6
+Maciej & Laurent (the last time Aleksandar Rikalo made a comment
was 9 months ago).

On 2/15/21 7:39 AM, Thomas Huth wrote:
> On 13/02/2021 14.14, Philippe Mathieu-Daudé wrote:
>> On 2/13/21 11:05 AM, Reinoud Zandijk wrote:
>>> On Fri, Feb 12, 2021 at 10:44:55AM +0100, Philippe Mathieu-Daudé wrote:
>>>>>> i'd like to get the following simple patches to the MIPS/mipssim
>>>>>> target adding
>>>>>> virtio-mmio devices to it.
>>>>
>>>> Please submit your patches as a series so we can review them on
>>>> the list:
>>>> https://wiki.qemu.org/Contribute/SubmitAPatch#Use_git_format-patch
>>>
>>> Oh thanks, i didn't know that; i've created a new patch with the OR
>>> gate you
>>> suggested. We deliberated about the change here and we'll at least
>>> keep it
>>> here locally for testing and profiling code until a real `virt'
>>> platform is
>>> developed for MIPS. Until then it would IMHO be a good expansion to
>>> mipssim.
>>> I'll try to get a proper patch posted on the list :)
>>
>> What I forgot to mention is that QEMU aims to keep models the closer
>> to the hardware, so modifying MIPSsim to some Frankenstein is unlikely
>> to be accepted.
> 
> Well, mipssim never was a real hardware, in fact it is already some kind
> of "virt" machine. So you could theoretically also extend this machine
> instead of introducing a new one (but I'm not a MIPS guy, so no clue
> what makes more sense).

See docs/system/target-mips.rst:

  The mipssim pseudo board emulation provides an environment similar
  to what the proprietary MIPS emulator uses for running Linux. It
  supports:

  -  A range of MIPS CPUs, default is the 24Kf
  -  PC style serial port
  -  MIPSnet network emulation

and
https://web.archive.org/web/20180902214325/http://www.linux-mips.org/wiki/MIPSsim:

  MIPSsim is a proprietary software emulator product of MIPS
  Technologies. It emulates a fairly simple system with two
  8250-class UARTs and a simple network controller. MIPSsim
  consists of several simulators that differ in performance,
  degree of details and debugging features. One for example
  maintains every bit in the system as having three states:
  0, 1 and uninitialized. It's cycle accurate simulator may
  be slow but allows accurate predictors of performance.

  Support status

  MIPSsim support is deprecated and scheduled for removal in
  late 2012 (for the 3.7 release)

  MIPSsim is supported by a stock Linux/MIPS kernel since
  several years. MIPSsim is a proprietary product that is not
  available to the general public. However Qemu supports a
  MIPSsim target as well. That said, MIPSsim is an extremly
  simple platform and virtually everybody is better served by
  the other targets supported by Qemu and the Linux in general.
  At the same time it also appears MIPS Techologies has been
  shifting away from MIPSsim for a while and as such MIPSsim
  support in the kernel is considered obsolete and will
  eventually be removed probably whenever its continued support
  is getting in the way of more useful work.

I doubt MIPS Techologies still has plans for MIPSsim.

Anyhow if we add a virt machine, it does not make sense to use
the NS8250 and MIPSnet devices... We should use the virtio ones.

Regards,

Phil.
diff mbox series

Patch

--- hw/mips/Kconfig.orig	2020-08-11 19:17:15.000000000 +0000
+++ hw/mips/Kconfig
@@ -20,6 +20,7 @@  config MIPSSIM
     select ISA_BUS
     select SERIAL_ISA
     select MIPSNET
+    select VIRTIO_MMIO
 
 config JAZZ
     bool