Re: I would like to contribute to NetBSD

2018-04-07 Thread Andy Ruhl
On Fri, Apr 6, 2018 at 7:31 AM, Narendra Kangralkar
 wrote:
> Hello All,
>
> I found that NetBSD a supported guest OS under VirtualBox project is
> partially completed. I would like to work on this if this project is still
> available. Please let me know your thoughts regarding this.

I use NetBSD under Virtualbox so I'm guessing you're talking about
making a supported set of guest additions?

Andy


Re: Potential new syscall

2018-04-07 Thread Robert Elz
Date:Sat, 7 Apr 2018 08:36:25 -0400 (EDT)
From:Mouse 
Message-ID:  <201804071236.iaa14...@stone.rodents-montreal.org>

  | kre, assuming you want it now, how would be most useful to get it to
  | you?

e-mail patches or the modified source files (I can easily extract the
original 5.2 versions to compare).

  | What I have is a commit in my based-at-5.2 src git tree.  I can
  | extract diffs easily,

That would be best.

  | or you can clone the git repo

I don't use git - never have ...

Thanks,

kre



Re: sunxi graphic console, try 2

2018-04-07 Thread Jared McNeill

Looks good to me! Thanks for your patience with me on this one.

Cheers,
Jared

On Sat, 7 Apr 2018, Manuel Bouyer wrote:


Hello,
with Jared's feedback, I reimplemented console handling for the sunxi graphic
drivers. There are 3 problems to solve:
- proper handling for console=xxx in the bootargs. I want to switch from
 graphic to serial, or back, from bootargs without changing
 /chosen/stdout-path entry in the device tree each time.
 The kernel can change stdout-path early in the boot process,
 and at this time it's not pratical to make it point to anything
 but serial or /chosen/framebuffer (we don't want to parse the whole
 device tree at this time).
 So I just change sunxi_platform_bootstrap() to understand console=serial
 in bootargs, so is stdout-path points to some graphic device in the
 device tree we can switch back to serial.

- attaching the graphic console to the graphic pipeline instead of simplefb.
 The graphic driver doesn't want to claim the consle at FDT_CONSOLE() time,
 because at this time it doens't know if it will be active or not
 (not to mention which of the 2 pipelines will be active, and will be console).
 In addition, simplefb may be functional until the graphic driver takes over.
 So in sunxi_debe I use FDT_CONSOLE() only to remember the
 simple-framebuffer phandle, which sunxi_debe will need to decide if
 it's console later.

- preventing simplefb from attaching. Once the graphic drivers have attached
 simplefb is not functional any more. So even if there is an active
 simple-framebuffer compatible not in the fdt, we should not attach it.
 I could add a sunxi_simplefb driver which return a higther match
 score, but I don't like the idea of adding a void driver just
 to prevent another one from attaching. Among others, this could
 cause strange effects if the kernel config omits it, hard to debug as
 this is touching the console.
 Basically we have several fdt nodes pointing to the same hardware,
 and we don't want to use them all.
 I added public fdt functions to explicitely inactivate arbitrary
 fdt nodes (here I remove them from the node list but that's implementation
 detail). There is fdt_remove_bycompat(const char *[]) to remove nodes
 matching on compatible strings; for completeness I also added
 fdt_remove_byhandle(int) but I don't need it.

--
Manuel Bouyer 
NetBSD: 26 ans d'experience feront toujours la difference
--



Re: Potential new syscall

2018-04-07 Thread Mouse
>> ["break vfork sharing" syscall]
> Having the mechanism available for testing (even if it was not
> committed to the standard NetBSD sources (yet?)) would be a real
> help, [...]

It works, at least for rudimentary values of "works": a test program
behaves as it should, and the emulator that prompted me to create this
works for small numbers of runs.  I haven't constructed a test to
hammer it for millions or billions of calls; there could well be a rare
failure mode, like a race somewhere.

kre, assuming you want it now, how would be most useful to get it to
you?  What I have is a commit in my based-at-5.2 src git tree.  I can
extract diffs easily, or you can clone the git repo and look at the
commit (git://git.rodents-montreal.org/Mouse/netbsd-fork/5.2/src commit
3bc0da98f79eb0115f5c4992d7b42b6623ae7b78), or if you have something
else to suggest I'm listening.

/~\ The ASCII Mouse
\ / Ribbon Campaign
 X  Against HTMLmo...@rodents-montreal.org
/ \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


sunxi graphic console, try 2

2018-04-07 Thread Manuel Bouyer
Hello,
with Jared's feedback, I reimplemented console handling for the sunxi graphic
drivers. There are 3 problems to solve:
- proper handling for console=xxx in the bootargs. I want to switch from
  graphic to serial, or back, from bootargs without changing
  /chosen/stdout-path entry in the device tree each time.
  The kernel can change stdout-path early in the boot process,
  and at this time it's not pratical to make it point to anything
  but serial or /chosen/framebuffer (we don't want to parse the whole
  device tree at this time).
  So I just change sunxi_platform_bootstrap() to understand console=serial
  in bootargs, so is stdout-path points to some graphic device in the
  device tree we can switch back to serial.

- attaching the graphic console to the graphic pipeline instead of simplefb.
  The graphic driver doesn't want to claim the consle at FDT_CONSOLE() time,
  because at this time it doens't know if it will be active or not
  (not to mention which of the 2 pipelines will be active, and will be console).
  In addition, simplefb may be functional until the graphic driver takes over.
  So in sunxi_debe I use FDT_CONSOLE() only to remember the
  simple-framebuffer phandle, which sunxi_debe will need to decide if
  it's console later. 

- preventing simplefb from attaching. Once the graphic drivers have attached
  simplefb is not functional any more. So even if there is an active
  simple-framebuffer compatible not in the fdt, we should not attach it.
  I could add a sunxi_simplefb driver which return a higther match
  score, but I don't like the idea of adding a void driver just
  to prevent another one from attaching. Among others, this could
  cause strange effects if the kernel config omits it, hard to debug as
  this is touching the console.
  Basically we have several fdt nodes pointing to the same hardware,
  and we don't want to use them all.
  I added public fdt functions to explicitely inactivate arbitrary
  fdt nodes (here I remove them from the node list but that's implementation
  detail). There is fdt_remove_bycompat(const char *[]) to remove nodes
  matching on compatible strings; for completeness I also added
  fdt_remove_byhandle(int) but I don't need it.

-- 
Manuel Bouyer 
 NetBSD: 26 ans d'experience feront toujours la difference
--
Index: dev/fdt/fdtbus.c
===
RCS file: /cvsroot/src/sys/dev/fdt/fdtbus.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 fdtbus.c
--- dev/fdt/fdtbus.c27 Aug 2017 19:13:31 -  1.15
+++ dev/fdt/fdtbus.c7 Apr 2018 11:37:47 -
@@ -265,6 +265,31 @@ fdt_add_node(struct fdt_node *new_node)
TAILQ_INSERT_TAIL(_nodes, new_node, n_nodes);
 }
 
+void
+fdt_remove_byhandle(int phandle)
+{
+   struct fdt_node *node;
+
+   TAILQ_FOREACH(node, _nodes, n_nodes) {
+   if (node->n_phandle == phandle) {
+   TAILQ_REMOVE(_nodes, node, n_nodes);
+   return;
+   }
+   }
+}
+
+void
+fdt_remove_bycompat(const char *compatible[])
+{
+   struct fdt_node *node, *next;
+
+   TAILQ_FOREACH_SAFE(node, _nodes, n_nodes, next) {
+   if (of_match_compatible(node->n_phandle, compatible)) {
+   TAILQ_REMOVE(_nodes, node, n_nodes);
+   }
+   }
+}
+
 static u_int
 fdt_get_order(int phandle)
 {
Index: dev/fdt/fdtvar.h
===
RCS file: /cvsroot/src/sys/dev/fdt/fdtvar.h,v
retrieving revision 1.28
diff -u -p -u -r1.28 fdtvar.h
--- dev/fdt/fdtvar.h10 Dec 2017 21:38:27 -  1.28
+++ dev/fdt/fdtvar.h7 Apr 2018 11:37:47 -
@@ -321,6 +321,8 @@ const void *fdtbus_get_prop(int, const 
 const char *   fdtbus_get_string(int, const char *);
 const char *   fdtbus_get_string_index(int, const char *, u_int);
 
+void   fdt_remove_byhandle(int);
+void   fdt_remove_bycompat(const char *[]);
 intfdtbus_print(void *, const char *);
 
 #endif /* _DEV_FDT_FDTVAR_H */
Index: arch/arm/sunxi/sunxi_debe.c
===
RCS file: /cvsroot/src/sys/arch/arm/sunxi/sunxi_debe.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 sunxi_debe.c
--- arch/arm/sunxi/sunxi_debe.c 5 Apr 2018 10:21:39 -   1.7
+++ arch/arm/sunxi/sunxi_debe.c 7 Apr 2018 11:37:47 -
@@ -58,6 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_debe.c
 
 #include 
 #include 
+#include 
+#include 
 
 enum sunxi_debe_type {
DEBE_A10 = 1,
@@ -128,6 +130,9 @@ static int  sunxi_debe_ioctl(device_t, u_
 static voidsunxi_befb_set_videomode(device_t, u_int, u_int);
 void sunxi_debe_dump_regs(int);
 
+static struct sunxi_debe_softc *debe_console_sc;
+static int sunxi_simplefb_phandle = -1;
+
 CFATTACH_DECL_NEW(sunxi_debe, sizeof(struct sunxi_debe_softc),
sunxi_debe_match, sunxi_debe_attach, NULL, NULL);
 
@@ -242,8 +247,6 @@