All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC Qemu mipssim patches
@ 2021-02-11 15:37 Reinoud Zandijk
  2021-02-12  0:13 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Reinoud Zandijk @ 2021-02-11 15:37 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

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


[-- Attachment #2: patch-hw-mips-Kconfig --]
[-- Type: text/plain, Size: 236 bytes --]

$NetBSD$

--- 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

[-- Attachment #3: patch-hw-mips-mipssim.c --]
[-- Type: text/x-c, Size: 888 bytes --]

$NetBSD$

--- hw/mips/mipssim.c.orig	2020-08-11 19:17:15.000000000 +0000
+++ hw/mips/mipssim.c
@@ -45,6 +45,7 @@
 #include "qemu/error-report.h"
 #include "sysemu/qtest.h"
 #include "sysemu/reset.h"
+#include "hw/virtio/virtio-mmio.h"
 
 static struct _loaderparams {
     int ram_size;
@@ -229,6 +230,16 @@ mips_mipssim_init(MachineState *machine)
     if (nd_table[0].used)
         /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */
         mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
+
+    /*
+     * virtio extention; register 32 virtio devices just after the ISA space
+     * at 0x1fd10000 with strave of 512 bytes as per i386s microvm target.
+     */
+    for (int i = 0; i < 32; i++) {
+        sysbus_create_simple("virtio-mmio",
+            0x1fd10000 + i * 512,
+            env->irq[3]);
+    }
 }
 
 static void mips_mipssim_machine_init(MachineClass *mc)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC Qemu mipssim patches
  2021-02-11 15:37 RFC Qemu mipssim patches Reinoud Zandijk
@ 2021-02-12  0:13 ` Philippe Mathieu-Daudé
  2021-02-12  9:44   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-12  0:13 UTC (permalink / raw)
  To: Reinoud Zandijk, Aleksandar Rikalo; +Cc: Thomas Huth, Huacai Chen, qemu-devel

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC Qemu mipssim patches
  2021-02-12  0:13 ` Philippe Mathieu-Daudé
@ 2021-02-12  9:44   ` Philippe Mathieu-Daudé
  2021-02-13 10:05     ` Qemu mipssim patches, mips malta and virtio bugs Reinoud Zandijk
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-12  9:44 UTC (permalink / raw)
  To: Reinoud Zandijk, Aleksandar Rikalo; +Cc: Thomas Huth, Huacai Chen, qemu-devel

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.
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Qemu mipssim patches, mips malta and virtio bugs
  2021-02-12  9:44   ` Philippe Mathieu-Daudé
@ 2021-02-13 10:05     ` Reinoud Zandijk
  2021-02-13 13:14       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Reinoud Zandijk @ 2021-02-13 10:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Aleksandar Rikalo, Huacai Chen, Reinoud Zandijk, Thomas Huth, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1247 bytes --]

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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Qemu mipssim patches, mips malta and virtio bugs
  2021-02-13 10:05     ` Qemu mipssim patches, mips malta and virtio bugs Reinoud Zandijk
@ 2021-02-13 13:14       ` Philippe Mathieu-Daudé
  2021-02-15  6:39         ` Thomas Huth
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-13 13:14 UTC (permalink / raw)
  To: Reinoud Zandijk; +Cc: Aleksandar Rikalo, Huacai Chen, Thomas Huth, qemu-devel

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Qemu mipssim patches, mips malta and virtio bugs
  2021-02-13 13:14       ` Philippe Mathieu-Daudé
@ 2021-02-15  6:39         ` Thomas Huth
  2021-02-15  7:56           ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Huth @ 2021-02-15  6:39 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Reinoud Zandijk
  Cc: Aleksandar Rikalo, Huacai Chen, qemu-devel

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Qemu mipssim patches, mips malta and virtio bugs
  2021-02-15  6:39         ` Thomas Huth
@ 2021-02-15  7:56           ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-15  7:56 UTC (permalink / raw)
  To: Thomas Huth, Reinoud Zandijk, Maciej W. Rozycki
  Cc: Aleksandar Rikalo, Huacai Chen, qemu-devel, Laurent Vivier

+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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-15  7:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 15:37 RFC Qemu mipssim patches Reinoud Zandijk
2021-02-12  0:13 ` Philippe Mathieu-Daudé
2021-02-12  9:44   ` Philippe Mathieu-Daudé
2021-02-13 10:05     ` Qemu mipssim patches, mips malta and virtio bugs Reinoud Zandijk
2021-02-13 13:14       ` Philippe Mathieu-Daudé
2021-02-15  6:39         ` Thomas Huth
2021-02-15  7:56           ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.